#include #include #include #include IFgdStoppingProtonControlSample::IFgdStoppingProtonControlSample() : IControlSampleBase("FgdStoppingProton"){ AddValidTrigger(COMET::Trigger::kBeamSpill); fProtonPullMax = COMET::IOARuntimeParameters::Get().GetParameterD("oaControlSample.FgdStoppingProton.ProtonPullMax"); fOtherPullMin = COMET::IOARuntimeParameters::Get().GetParameterD("oaControlSample.FgdStoppingProton.OtherPullMin"); } void IFgdStoppingProtonControlSample::InitHistograms(){ return; } bool IFgdStoppingProtonControlSample::IsEventSelectedInternal(COMET::ICOMETEvent& event) { COMET::IHandle trackerResult = event.GetFit("ReconTracker"); if(!trackerResult) return false; COMET::IHandle finalTracks = trackerResult->GetResultsContainer("final"); if(!finalTracks) return false; // Loop over tracks. for(unsigned int i = 0; i < finalTracks->size(); i++){ COMET::IHandle pid = (*finalTracks)[i]; if(!pid) continue; // Look for the following topologies: // 1) Particle from P0D/ECAL passing through TPC1, stopping in FGD1 // (hasTPC1, hasFGD1, !hasTPC2). // 2) Particles from FGD/ECAL passing through TPC2, stopping in FGD2 // (hasTPC2, hasFGD2, !hasTPC3). bool hasTPC1 = pid->UsesDetector(COMET::IReconBase::kTPC1); bool hasTPC2 = pid->UsesDetector(COMET::IReconBase::kTPC2); bool hasTPC3 = pid->UsesDetector(COMET::IReconBase::kTPC3); bool hasFGD1 = pid->UsesDetector(COMET::IReconBase::kFGD1); bool hasFGD2 = pid->UsesDetector(COMET::IReconBase::kFGD2); bool fgd1_candidate = false, fgd2_candidate = false; COMET::IHandle tpc_pid; if(hasTPC1 && hasFGD1 && !hasTPC2){ fgd1_candidate = true; tpc_pid = ReconObjectUtils::GetConstituentInDetector(pid,COMET::IReconBase::kTPC1); } else if (hasTPC2 && hasFGD2 && !hasTPC3){ fgd2_candidate = true; tpc_pid = ReconObjectUtils::GetConstituentInDetector(pid,COMET::IReconBase::kTPC2); }else{ continue; } if(!tpc_pid){ std::cerr << "IFgdStoppingProtonControlSample::IsEventSelectedInternal " << "\nWeird, how are we missing the TPC PID??? " << std::endl; continue; } double charge = tpc_pid->GetCharge(); double mupull = fabs((tpc_pid)->Get< COMET::IRealDatum >("tpcPid_PullMuon")->GetValue()); double pipull = fabs((tpc_pid)->Get< COMET::IRealDatum >("tpcPid_PullPion")->GetValue()); double elecpull = fabs((tpc_pid)->Get< COMET::IRealDatum >("tpcPid_PullEle")->GetValue()); double protonpull = fabs((tpc_pid)->Get< COMET::IRealDatum >("tpcPid_PullProton")->GetValue()); if(charge > 0 && protonpull < fProtonPullMax && mupull > fOtherPullMin && pipull > fOtherPullMin && elecpull > fOtherPullMin){ return true; } } return false; }