diff --git a/include/RecoParticleBranches.h b/include/RecoParticleBranches.h index fb4b3c8..56720d8 100644 --- a/include/RecoParticleBranches.h +++ b/include/RecoParticleBranches.h @@ -27,7 +27,7 @@ class RecoParticleBranches : public CollectionBranches { virtual void initBranches( TTree* tree, const std::string& prefix="" ) ; //const char* prefix=0) ; - virtual void fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt, const EVENT::LCCollection* colCluster ) ; + virtual void fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt, const EVENT::LCCollection* colTracks, const EVENT::LCCollection* colCluster) ; virtual ~RecoParticleBranches() {} ; @@ -71,7 +71,8 @@ class RecoParticleBranches : public CollectionBranches { // EVENT::ClusterVec _clusters ; // EVENT::TrackVec _tracks ; - int _rcclid[ LCT_RECOPARTICLE_MAX ][10] {} ; + int _rcclid[ LCT_RECOPARTICLE_MAX ][5] {} ; + int _rctrid[ LCT_RECOPARTICLE_MAX ][5] {} ; } ; diff --git a/src/LCTuple.cc b/src/LCTuple.cc index 9aa74e7..5fbb8c5 100644 --- a/src/LCTuple.cc +++ b/src/LCTuple.cc @@ -565,7 +565,7 @@ void LCTuple::processEvent( LCEvent * evt ) { if( mcpRemoveOverlayCol ) _mcpremoveoverlayBranches->fill( mcpRemoveOverlayCol , evt ) ; if( recCol ) { - _recBranches->fill( recCol , evt , cluCol ) ; + _recBranches->fill( recCol , evt, trkCol , cluCol ) ; for( auto pidb : _pidBranchesVec ) pidb->fill( recCol , evt ) ; } diff --git a/src/RecoParticleBranches.cc b/src/RecoParticleBranches.cc index 58a0d08..d681d19 100644 --- a/src/RecoParticleBranches.cc +++ b/src/RecoParticleBranches.cc @@ -56,11 +56,12 @@ void RecoParticleBranches::initBranches( TTree* tree, const std::string& pre){ tree->Branch( (pre+"pialg").c_str() , _pialg , (pre+"pialg["+pre+"npid]/I").c_str() ) ; //tree->Branch( (pre+"rcclid").c_str() , _rcclid , (pre+"rcclid["+pre+"nrec]["+pre+"rcncl]/I").c_str() ) ; - tree->Branch( (pre+"rcclid").c_str() , _rcclid , (pre+"rcclid["+pre+"nrec][10]/I").c_str() ) ; + tree->Branch( (pre+"rcclid").c_str() , _rcclid , (pre+"rcclid["+pre+"nrec][5]/I").c_str() ) ; + tree->Branch( (pre+"rctrid").c_str() , _rctrid , (pre+"rctrid["+pre+"nrec][5]/I").c_str() ) ; } -void RecoParticleBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt, const EVENT::LCCollection* colCluster){ +void RecoParticleBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt, const EVENT::LCCollection* colTracks, const EVENT::LCCollection* colCluster){ if( !col ) return ; @@ -108,6 +109,7 @@ void RecoParticleBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* } std::vector usedClusters; + std::vector usedTracks; //------ fill the Reconstructed particle ---------------------------- for(int i=0 ; i < _nrec ; ++i){ @@ -150,8 +152,9 @@ void RecoParticleBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* _rcftr[ i ] = ( rec->getTracks().size() > 0 ? rec->getTracks()[0]->ext() - 1 : -1 ) ; - for(int s = 0; s < 10; s++){ + for(int s = 0; s < 5; s++){ _rcclid[i][s] = -1; + _rctrid[i][s] = -1; } if(!colCluster) continue; @@ -175,6 +178,27 @@ void RecoParticleBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* } } + if(!colTracks) continue; + lcio::TrackVec tracks = rec->getTracks(); + lcio::Track* temp_trk = NULL; + + for(unsigned int t = 0; t < tracks.size(); t++){ + + for(int tcoll = 0; tcoll < colTracks->getNumberOfElements(); tcoll++){ + + if(std::find(usedTracks.begin(), usedTracks.end(), tcoll) != usedTracks.end() ) + continue; + + temp_trk = static_cast( colTracks->getElementAt(tcoll) ); + + if(temp_trk->id() != tracks[t]->id()) continue; + + _rctrid[i][t] = tcoll; + usedTracks.push_back(tcoll); + break; + } + } + usedClusters.clear(); }