3 #include "sbnanaobj/StandardRecord/Proxy/SRProxy.h"
13 for (
unsigned int i = 0; i < slc->reco.nshw; i++) {
14 auto const& shw = slc->reco.shw[i];
15 if (!shw.pfp.parent_is_primary)
17 if (shw.bestplane_energy > maxEnergy) {
19 maxEnergy = shw.bestplane_energy;
29 if(largestShwIdx == -1)
return 0;
30 return &slc->reco.shw[largestShwIdx];
37 return shw ? double(shw->bestplane_energy) : -5;
43 return shw ? int(shw->truth.p.pdg) : -5;
50 if(!shw || shw->bestplane_dEdx < 0)
return -5.;
51 return shw->bestplane_dEdx;
57 return shw ? double(shw->conversion_gap) : -5.;
63 return shw ? double(shw->density) : -5.;
69 return shw ? double(shw->plane[1].energy) : -5.;
75 return shw ? double(shw->len) : -5.;
81 return shw ? 180. * shw->open_angle / M_PI : -5.;
87 return shw ? double(shw->start.x) : -9999.;
93 return shw ? double(shw->start.y) : -9999.;
99 return shw ? double(shw->start.z) : -9999.;
105 return shw ? double(shw->start.x + shw->dir.x * shw->len) : -9999.;
111 return shw ? double(shw->start.y + shw->dir.y * shw->len) : -9999.;
117 return shw ? double(shw->start.z + shw->dir.z * shw->len) : -9999.;
123 return shw ? double(shw->selVars.densityGradient) : -5.;
129 return shw ? double(shw->selVars.densityGradientPower) : -5.;
135 return shw ? double(shw->selVars.trackLength) : -5.;
141 return shw ? double(shw->selVars.trackWidth) : -5.;
147 for (
auto const& shw : slc->reco.shw) {
148 if (shw.bestplane_energy > 0.2f)
157 double maxLength(-1);
159 for (
unsigned int i = 0; i < slc->reco.ntrk; i++) {
160 auto const& trk = slc->reco.trk[i];
161 if (!trk.pfp.parent_is_primary)
164 if (trk.len > maxLength) {
176 if(longestTrackIdx == -1)
return 0;
177 return &slc->reco.trk[longestTrackIdx];
183 return trk ? int(trk->truth.p.pdg) : -5;
189 return trk ? double(trk->len) : -5.;
195 if(trk->bestplane == -1)
return 0;
196 return &trk->chi2pid[trk->bestplane];
208 return chi2 ? double(chi2->chi2_muon) : -5.;
214 return chi2 ? double(chi2->chi2_pion) : -5.;
220 return chi2 ? double(chi2->chi2_kaon) : -5.;
226 return chi2 ? double(chi2->chi2_proton) : -5.;
242 return trk ? (int)trk->dazzle.pdg : -5;
248 return trk ? (float)trk->dazzle.muonScore : -5.f;
254 return shw ? (int)shw->razzle.pdg : -5;
260 return shw ? (float)shw->razzle.electronScore : -5.f;
const Var kRecoShower_EndX([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.x+shw->dir.x *shw->len):-9999.;})
const Var kRecoShower_OpenAngle([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?180.*shw->open_angle/M_PI:-5.;})
const Var kRecoShower_trackLength([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->selVars.trackLength):-5.;})
const Var kLongestTrackChi2Proton([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_proton):-5.;})
const Var kRecoShower_trackWidth([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->selVars.trackWidth):-5.;})
const Var kRecoShower_StartX([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.x):-9999.;})
const Var kRecoShower_StartY([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.y):-9999.;})
process_name opflashCryoW ana
const Var kRecoShowers_EnergyCut([](const caf::SRSliceProxy *slc) -> unsigned{unsigned int counter(0);for(auto const &shw:slc->reco.shw){++counter;}return counter;})
const caf::SRTrkChi2PIDProxy * BestPlaneChi2PID(const caf::SRTrackProxy *trk)
const Var kLongestTrackDazzleMuonScore([](const caf::SRSliceProxy *slc) -> float{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?(float) trk->dazzle.muonScore:-5.f;})
caf::Proxy< caf::SRSlice > SRSliceProxy
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
const Var kMuonTrackLength([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);if(!trk) return-5;if(trk &&(kLongestTrackChi2Muon(slc)< 30.f &&kLongestTrackChi2Proton(slc) > 60.f)){return trk->len;}return-5;})
const Var kRecoShower_BestEnergy([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->bestplane_energy):-5;})
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
const Var kRecoShower_EndY([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.y+shw->dir.y *shw->len):-9999.;})
const Var kRecoShower_Length([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->len):-5.;})
const Var kRecoShower_Energy([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->plane[1].energy):-5.;})
const Var kLargestRecoShowerIdx([](const caf::SRSliceProxy *slc) -> int{int bestIdx(-1);double maxEnergy(-1);for(unsigned int i=0;i< slc->reco.nshw;i++){auto const &shw=slc->reco.shw[i];continue;if(shw.bestplane_energy > maxEnergy){bestIdx=i;maxEnergy=shw.bestplane_energy;}}return bestIdx;})
const Var kLongestTrackChi2Pion([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_pion):-5.;})
const Var kRecoShower_StartZ([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.z):-9999.;})
const Var kRecoShowerRazzlePID([](const caf::SRSliceProxy *slc) -> int{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?(int) shw->razzle.pdg:-5;})
const caf::SRTrackProxy * LongestRecoTrack(const caf::SRSliceProxy *slc)
Pointer to longest reconstructed shower, or null pointer if none exists.
const Var kLongestTrackChi2Muon([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_muon):-5.;})
const Var kRecoShower_Density([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->density):-5.;})
const Var kLongestTrackTruePdg([](const caf::SRSliceProxy *slc) -> int{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?int(trk->truth.p.pdg):-5;})
const caf::SRShowerProxy * LargestRecoShower(const caf::SRSliceProxy *slc)
Pointer to largest reconstructed shower, or null pointer if none exists.
const Var kLongestTrackIdx([](const caf::SRSliceProxy *slc) -> int{int bestIdx(-1);double maxLength(-1);for(unsigned int i=0;i< slc->reco.ntrk;i++){auto const &trk=slc->reco.trk[i];continue;if(trk.len > maxLength){bestIdx=i;maxLength=trk.len;}}return bestIdx;})
const Var kRecoShower_EndZ([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->start.z+shw->dir.z *shw->len):-9999.;})
const Var kRecoShower_ConversionGap([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->conversion_gap):-5.;})
const Var kRecoShower_densityGradientPower([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->selVars.densityGradientPower):-5.;})
const Var kRecoShowerRazzleElectronScore([](const caf::SRSliceProxy *slc) -> float{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?(float) shw->razzle.electronScore:-5.f;})
const Var kRecoShower_BestdEdx([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);if(!shw||shw->bestplane_dEdx< 0) return-5.;return shw->bestplane_dEdx;})
const Var kLongestTrackDazzlePID([](const caf::SRSliceProxy *slc) -> int{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?(int) trk->dazzle.pdg:-5;})
const caf::SRTrkChi2PIDProxy * LongestTrackBestPlaneChi2PID(const caf::SRSliceProxy *slc)
const Var kLongestTrackChi2Kaon([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrkChi2PIDProxy *chi2=LongestTrackBestPlaneChi2PID(slc);return chi2?double(chi2->chi2_kaon):-5.;})
const Var kRecoShower_TruePdg([](const caf::SRSliceProxy *slc) -> int{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?int(shw->truth.p.pdg):-5;})
const Var kRecoShower_densityGradient([](const caf::SRSliceProxy *slc) -> double{const caf::SRShowerProxy *shw=LargestRecoShower(slc);return shw?double(shw->selVars.densityGradient):-5.;})
const Var kLongestTrackLength([](const caf::SRSliceProxy *slc) -> double{const caf::SRTrackProxy *trk=LongestRecoTrack(slc);return trk?double(trk->len):-5.;})