14 if(CheckRange(fGTruthToG4Particles, itruth)) {
15 return &fGTruthToG4Particles.at(itruth);
18 return new vector<UInt_t>();
22 if(CheckRange(fGTruthToTracks, itruth)) {
23 return &fGTruthToTracks.at(itruth);
26 return new vector<UInt_t>();
34 if(CheckRange(fG4ParticleToGTruth, ig4p)) {
35 return fG4ParticleToGTruth.at(ig4p);
44 if(CheckRange(fG4ParticleToTracks, ig4p)) {
45 return &fG4ParticleToTracks.at(ig4p);
48 return new vector<UInt_t>();
57 if(CheckRange(fTrackToGTruth, itrk)) {
58 return fTrackToGTruth.at(itrk);
66 if(CheckRange(fTrackToG4Particles, itrk)) {
67 return &fTrackToG4Particles.at(itrk);
70 return new vector<UInt_t>();
76 vector<pair<UInt_t,float>> outvec;
77 auto ig4ps = TrackToG4Particles(itrk);
78 auto iddeps =
rec->TrackTrueDeposits(itrk);
80 map<int,UInt_t> trackIdToig4;
81 for(
auto const& ig4p : *
ig4ps){
82 trackIdToig4[
g4->TrackID(ig4p)] = ig4p;
86 for(
auto const& iddep : *iddeps) {
87 outvec.push_back(make_pair(trackIdToig4[iddep.first],iddep.second));
95 if(CheckRange(fTrackToG4Particle, itrk)) {
96 return fTrackToG4Particle.at(itrk);
105 int trkidMax =
rec->TrackTrkIdMaxDeposit(itrk);
106 auto ig4ps = TrackToG4Particles(itrk);
107 map<int,UInt_t> trackIdToig4;
109 for(
auto const& ig4p : *
ig4ps){
110 trackIdToig4[
g4->TrackID(ig4p)] = ig4p;
113 const pair<UInt_t,float> outpair(trackIdToig4[trkidMax],
rec->TrackMaxDeposit(itrk));
119 if(CheckRange(fVertexToGTruth, ivtx)) {
120 return fVertexToGTruth.at(ivtx);
128 if(CheckRange(fGTruthToVertex, itruth)) {
129 return fGTruthToVertex.at(itruth);
137 if(CheckRange(fVertexToG4Particles, ivtx)) {
138 return &fVertexToG4Particles.at(ivtx);
141 return new vector<UInt_t>();
146 if(CheckRange(fG4ParticleToVertices, ig4p)) {
147 return &fG4ParticleToVertices.at(ig4p);
150 return new vector<UInt_t>();
155 return fVeeToGTruth.at(ivee);
158 return fGTruthToVee.at(itruth);
161 if(CheckRange(fVeeToG4Particles, ivee)) {
162 return &fVeeToG4Particles.at(ivee);
165 return new vector<UInt_t>();
169 return fG4ParticleToVee.at(ig4p);
173 if(CheckRange(fTrackToVertices, itrk)) {
174 return &fTrackToVertices.at(itrk);
177 return new vector<UInt_t>();
181 if(CheckRange(fVertexToTracks, ivtx)) {
182 return &fVertexToTracks.at(ivtx);
185 return new vector<UInt_t>();
189 if(CheckRange(fTrackToVees, itrk)) {
190 return &fTrackToVees.at(itrk);
193 return new vector<UInt_t>();
197 if(CheckRange(fVeeToTracks, ivee)) {
198 return &fVeeToTracks.at(ivee);
201 return new vector<UInt_t>();
206 if(CheckRange(fTrackToCaloClusters, itrk)) {
207 return &fTrackToCaloClusters.at(itrk);
210 return new vector<UInt_t>();
215 if(CheckRange(fCaloClusterToTracks, icluster)) {
216 return &fCaloClusterToTracks.at(icluster);
219 return new vector<UInt_t>();
224 if(CheckRange(fG4PToCaloClusters, ig4p)) {
225 return &fG4PToCaloClusters.at(ig4p);
228 return new vector<UInt_t>();
233 if(CheckRange(fCaloClusterToG4Ps, icluster)) {
234 return &fCaloClusterToG4Ps.at(icluster);
237 return new vector<UInt_t>();
253 if(fTM->IsActiveG4Tree())
g4 = fTM->GetG4Tree();
255 if(fTM->IsActiveRecTree())
rec = fTM->GetRecoTree();
258 if(fTM->IsActiveG4Tree()){
261 for(UInt_t ig4p=0; ig4p<
g4->NSim(); ig4p++) {
262 fG4ParticleToTracks[ig4p] = {};
265 if(fTM->IsActiveRecTree()){
267 for(UInt_t itrk = 0; itrk<
rec->NTrack(); itrk++ ) {
273 rec->GetTrackG4PIndices(itrk, fTrackToG4Particles[itrk]);
275 int matchid =
rec->TrackTrkIdMaxDeposit(itrk);
279 if(
rec->TrackMaxDepositFrac(itrk)<ASSN_THRESHOLD) {
286 for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[itrk].size(); ig4p++){
289 if(fG4ParticleToTracks.find(fTrackToG4Particles[itrk][ig4p]) != fG4ParticleToTracks.end()) {
294 if(
g4->TrackID(fTrackToG4Particles[itrk][ig4p]) == matchid ) {
296 fTrackToG4Particle[itrk] = ig4p;
297 fG4ParticleToTracks[ig4p].push_back(itrk);
315 if(fTM->IsActiveGenTree()){
319 if(fTM->IsActiveG4Tree()){
322 for(UInt_t ig4 = 0; ig4<
g4->NSim(); ig4++ ) {
323 fG4ParticleToGTruth[ig4] =
g4->GetTruthIndex(ig4);
324 fGTruthToG4Particles[ fG4ParticleToGTruth[ig4] ].push_back(ig4);
334 if(fTM->IsActiveRecTree()){
337 for(UInt_t itrk=0; itrk<
rec->NTrack(); itrk++ ) {
341 if(fTrackToG4Particles[itrk].
size()==0)
continue;
342 fTrackToGTruth[itrk] = fG4ParticleToGTruth[ fTrackToG4Particles[itrk][0] ];
344 fGTruthToTracks[ fTrackToGTruth[itrk] ].push_back(itrk);
351 for(UInt_t ivtx=0; ivtx<
rec->NVertex(); ivtx++ ) {
352 rec->GetVertexTrackIndices(ivtx,fVertexToTracks[ivtx]);
353 for(UInt_t itrk=0; itrk<fVertexToTracks[ivtx].size(); itrk++) {
354 fTrackToVertices[ fVertexToTracks[ivtx][itrk] ].push_back(ivtx);
356 for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[fVertexToTracks[ivtx][itrk]].size(); ig4p++) {
357 fVertexToG4Particles[ivtx].push_back( fTrackToG4Particles[ fVertexToTracks[ivtx][itrk] ][ig4p] );
358 fG4ParticleToVertices[ fVertexToG4Particles[ivtx].back() ].push_back(ivtx);
362 fVertexToGTruth[ivtx] = fTrackToGTruth[ fVertexToTracks[ivtx][0] ];
363 fGTruthToVertex[ fVertexToGTruth[ivtx] ] = ivtx;
369 for(UInt_t ivee=0; ivee<
rec->NVee(); ivee++){
371 rec->GetVeeTrackIndices(ivee, fVeeToTracks[ivee]);
373 for(UInt_t itrk=0; itrk<fVeeToTracks[ivee].size(); itrk++){
375 fTrackToVees[ fVeeToTracks[ivee][itrk] ].push_back(ivee);
377 for(UInt_t ig4p=0; ig4p<fTrackToG4Particles[ fVeeToTracks[ivee][itrk] ].size(); ig4p++) {
378 fVeeToG4Particles[ivee].push_back(fTrackToG4Particles[ fVeeToTracks[ivee][itrk] ][ig4p]);
379 fG4ParticleToVee[fVeeToG4Particles[ivee].back()] = ivee;
383 fVeeToGTruth[ivee] = fTrackToGTruth[ fVeeToTracks[ivee][0] ];
384 fGTruthToVee[ fVeeToGTruth[ivee] ] = ivee;
390 for(UInt_t iclust=0; iclust<
rec->NCalCluster(); iclust++){
392 rec->GetCalClusterTrackIndices(iclust,fCaloClusterToTracks[iclust]);
394 for(UInt_t itrk=0; itrk<fCaloClusterToTracks[iclust].size(); itrk++){
395 fTrackToCaloClusters[ fCaloClusterToTracks[iclust][itrk] ].push_back(iclust);
398 rec->GetCalClusterG4Indices(iclust,fCaloClusterToG4Ps[iclust]);
400 for(UInt_t ig4p=0; ig4p<fCaloClusterToG4Ps[iclust].size(); ig4p++){
401 fG4PToCaloClusters[ fCaloClusterToG4Ps[iclust][ig4p] ].push_back(iclust);
418 if(m.find(i)==m.end())
435 fGTruthToG4Particles.clear();
436 fG4ParticleToGTruth.clear();
437 fGTruthToTracks.clear();
438 fTrackToGTruth.clear();
439 fTrackToG4Particles.clear();
440 fTrackToG4Particle.clear();
441 fG4ParticleToTracks.clear();
444 fVertexToGTruth.clear();
445 fGTruthToVertex.clear();
446 fG4ParticleToVertices.clear();
447 fVertexToG4Particles.clear();
448 fVertexToGTruth.clear();
449 fGTruthToVertex.clear();
450 fVeeToG4Particles.clear();
451 fG4ParticleToVee.clear();
452 fVeeToGTruth.clear();
453 fGTruthToVee.clear();
454 fTrackToVertices.clear();
455 fVertexToTracks.clear();
456 fVeeToTracks.clear();
457 fTrackToVees.clear();
458 fCaloClusterToTracks.clear();
459 fTrackToCaloClusters.clear();
460 fCaloClusterToG4Ps.clear();
461 fG4PToCaloClusters.clear();
UInt_t const G4ParticleToVee(const UInt_t &ig4p) const
const vector< UInt_t > * G4ParticleToVertices(const UInt_t &ig4p) const
const vector< pair< UInt_t, float > > TrackToG4ParticlesDeposits(const UInt_t &itrk) const
UInt_t const G4ParticleToGTruth(const UInt_t &ig4p) const
UInt_t const TrackToG4Particle(const UInt_t &itrk) const
UInt_t const TrackToGTruth(const UInt_t &itrk) const
UInt_t const VeeToGTruth(const UInt_t &ivee) const
UInt_t const VertexToGTruth(const UInt_t &ivtx) const
const vector< UInt_t > * TrackToG4Particles(const UInt_t &itrk) const
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
const vector< UInt_t > * VertexToTracks(const UInt_t &ivtx) const
const pair< UInt_t, float > TrackToG4ParticleDeposit(const UInt_t &itrk) const
const vector< UInt_t > * TrackToVees(const UInt_t &itrk) const
const vector< UInt_t > * G4PToCalClusters(const UInt_t &itrk) const
UInt_t const GTruthToVee(const UInt_t &ivee) const
const vector< UInt_t > * TrackToVertices(const UInt_t &itrk) const
const vector< UInt_t > * G4ParticleToTracks(const UInt_t &ig4p) const
const vector< UInt_t > * CalClusterToTracks(const UInt_t &itrk) const
const vector< UInt_t > * VeeToTracks(const UInt_t &ivee) const
const vector< UInt_t > * VertexToG4Particles(const UInt_t &ivtx) const
UInt_t const GTruthToVertex(const UInt_t &ivtx) const
const vector< UInt_t > * CalClusterToG4Ps(const UInt_t &itrk) const
const vector< UInt_t > * GTruthToG4Particles(const UInt_t &itruth) const
const vector< UInt_t > * VeeToG4Particles(const UInt_t &ivee) const
const vector< UInt_t > * GTruthToTracks(const UInt_t &itruth) const
const vector< UInt_t > * TrackToCalClusters(const UInt_t &itrk) const
bool CheckRange(const map< UInt_t, T > &m, const UInt_t &i) const