3 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
30 bool atslc, contained, maybe_muon_exiting, maybe_muon_contained;
31 float chi2_proton, chi2_muon;
33 for(
unsigned int trkidx = 0; trkidx < slc->reco.trk.size(); ++trkidx){
34 const caf::SRTrackProxy& trk = slc->reco.trk[trkidx];
35 if(trk.bestplane == -1)
continue;
38 dist = sqrt((pow(trk.start.x - slc->vertex.x,2)) + (pow(trk.start.y - slc->vertex.y,2)) + (pow(trk.start.z - slc->vertex.z,2)));
40 if(!atslc || !trk.pfp.parent_is_primary)
continue;
46 contained = ( (-199.15 + 10) < trk.end.x && trk.end.x < (199.15 - 10) && (-200. + 10) < trk.end.y && trk.end.y < (200. - 10) && (0.0 + 10) < trk.end.z && trk.end.z < (500. - 50));
49 chi2_proton = trk.chi2pid[trk.bestplane].chi2_proton;
50 chi2_muon = trk.chi2pid[trk.bestplane].chi2_muon;
52 maybe_muon_exiting = !contained && trk.len > 100;
53 maybe_muon_contained = contained && chi2_proton > 60 && chi2_muon < 30 && trk.len > 50;
55 if(!maybe_muon_contained && !maybe_muon_exiting)
continue;
57 if(trk.len > longest){
76 bool contained(
false);
80 contained = ( (-199.15 + 10) <
ptrk.end.x &&
ptrk.end.x < (199.15 - 10) && (-200. + 10) <
ptrk.end.y &&
ptrk.end.y < (200. - 10) && (0.0 + 10) <
ptrk.end.z &&
ptrk.end.z < (500. - 50));
82 if(contained) recop =
ptrk.rangeP.p_muon;
83 else recop =
ptrk.mcsP.fwdP_muon;
90 float crttrktime(-5.f);
93 const caf::SRTrackProxy&
ptrk = slc->reco.trk[ptrkid];
94 crttrktime = ptrk.crthit.hit.time;
101 float crttrkangle(-5.f);
104 const caf::SRTrackProxy&
ptrk = slc->reco.trk[ptrkid];
105 crttrkangle = ptrk.crttrack.angle;
112 float crttrkdist(-5.f);
115 const caf::SRTrackProxy&
ptrk = slc->reco.trk[ptrkid];
116 crttrkdist = ptrk.crthit.distance;
123 return slc->nu_score;
131 const caf::SRTrackProxy&
ptrk = slc->reco.trk[ptrkid];
const Var kCRTTrkAngle([](const caf::SRSliceProxy *slc) -> double{float crttrkangle(-5.f);if(kPrimaryMuonTrkIdx(slc) >=0){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRTrackProxy &ptrk=slc->reco.trk[ptrkid];crttrkangle=ptrk.crttrack.angle;}return crttrkangle;})
const Cut kNuScore([](const caf::SRSliceProxy *slc){return(!isnan(slc->nu_score)&&slc->nu_score > 0.4);})
process_name opflashCryoW ana
caf::Proxy< caf::SRSlice > SRSliceProxy
const Var kCRTTrkTime([](const caf::SRSliceProxy *slc) -> double{float crttrktime(-5.f);if(kPrimaryMuonTrkIdx(slc) >=0){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRTrackProxy &ptrk=slc->reco.trk[ptrkid];crttrktime=ptrk.crthit.hit.time;}return crttrktime;})
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
const Var kPrimaryMuonTrkLen([](const caf::SRSliceProxy *slc) -> double{float ptrklen(-5.f);if(kPrimaryMuonTrkIdx(slc) >=0){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRTrackProxy &ptrk=slc->reco.trk[ptrkid];ptrklen=ptrk.len;}return ptrklen;})
const Var kPrimaryMuonTrkIdx([](const caf::SRSliceProxy *slc){double longest=-1;int best_idx=-1;double dist=-1;bool atslc, contained, maybe_muon_exiting, maybe_muon_contained;float chi2_proton, chi2_muon;for(unsigned int trkidx=0;trkidx< slc->reco.trk.size();++trkidx){const caf::SRTrackProxy &trk=slc->reco.trk[trkidx];if(trk.bestplane==-1) continue;dist=sqrt((pow(trk.start.x-slc->vertex.x, 2))+(pow(trk.start.y-slc->vertex.y, 2))+(pow(trk.start.z-slc->vertex.z, 2)));atslc=dist< 10;if(!atslc||!trk.pfp.parent_is_primary) continue;contained=((-199.15+10)< trk.end.x &&trk.end.x< (199.15-10)&&(-200.+10)< trk.end.y &&trk.end.y< (200.-10)&&(0.0+10)< trk.end.z &&trk.end.z< (500.-50));chi2_proton=trk.chi2pid[trk.bestplane].chi2_proton;chi2_muon=trk.chi2pid[trk.bestplane].chi2_muon;maybe_muon_exiting=!contained &&trk.len > 100;maybe_muon_contained=contained &&chi2_proton > 60 &&chi2_muon< 30 &&trk.len > 50;if(!maybe_muon_contained &&!maybe_muon_exiting) continue;if(trk.len > longest){longest=trk.len;best_idx=trkidx;}}return best_idx;})
const Var kPrimaryMuonTrkP([](const caf::SRSliceProxy *slc){float recop(-5.f);bool contained(false);if(kPrimaryMuonTrkIdx(slc) >=0){auto const &ptrk=slc->reco.trk.at(kPrimaryMuonTrkIdx(slc));contained=((-199.15+10)< ptrk.end.x &&ptrk.end.x< (199.15-10)&&(-200.+10)< ptrk.end.y &&ptrk.end.y< (200.-10)&&(0.0+10)< ptrk.end.z &&ptrk.end.z< (500.-50));if(contained) recop=ptrk.rangeP.p_muon;else recop=ptrk.mcsP.fwdP_muon;}return recop;})
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
const Var kCRTHitDist([](const caf::SRSliceProxy *slc) -> double{float crttrkdist(-5.f);if(kPrimaryMuonTrkIdx(slc) >=0){int ptrkid=kPrimaryMuonTrkIdx(slc);const caf::SRTrackProxy &ptrk=slc->reco.trk[ptrkid];crttrkdist=ptrk.crthit.distance;}return crttrkdist;})