Skip to content

Commit 2e33b57

Browse files
authored
Merge pull request #6 from MuonColliderSoft/jetReco
Some fixes for jet reconstruction
2 parents 0d0f58b + cb62ea3 commit 2e33b57

6 files changed

Lines changed: 52 additions & 44 deletions

File tree

include/LCTupleConf.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ struct CollID : public lcrtrel::LCIntExtension<CollID> {} ;
2424

2525
#define LCT_COLLENTRIES_MAX 1000000
2626
#define LCT_MCPARTICLE_MAX 1000000
27-
#define LCT_RECOPARTICLE_MAX 100000
28-
#define LCT_TRACK_MAX 100000
27+
#define LCT_RECOPARTICLE_MAX 500000
28+
#define LCT_TRACK_MAX 300000
2929
#define LCT_TRACKSTATE_MAX 1000000
30-
#define LCT_CLUSTER_MAX 100000
30+
#define LCT_CLUSTER_MAX 500000
3131
#define LCT_RELATION_MAX 1000000
32-
#define LCT_SIMTRACKERHIT_MAX 1000000
33-
#define LCT_TRACKERHIT_MAX 1000000
32+
#define LCT_SIMTRACKERHIT_MAX 2000000
33+
#define LCT_TRACKERHIT_MAX 3000000
3434
#define LCT_TRACKERRAWHIT_MAX 5000000
3535
#define LCT_SIMCALORIMETERHIT_MAX 1000000
3636
#define LCT_CALORIMETERHIT_MAX 1000000
3737
#define LCT_PARTICLEID_MAX 1000000
3838
#define LCT_VERTEX_MAX 1000
39-
#define LCT_JET_MAX 20
40-
#define LCT_JET_PARTICLES_MAX 20
39+
#define LCT_JET_MAX 200
40+
#define LCT_JET_PARTICLES_MAX 200
4141
#define LCT_ISOLEP_MAX 100000
4242

4343
#define LCT_STRING_MAX 1024

include/TrackBranches.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class TrackBranches : public CollectionBranches {
4646
float _trrih[ LCT_TRACK_MAX ] {} ;
4747
int _trthn[ LCT_TRACK_MAX ] {} ; // total number of hits
4848
int _trthi[ LCT_TRACK_MAX ][50] {} ; // track hit indices
49+
int _trthd[ LCT_TRACK_MAX ][50] {} ; // track hit subdetector
4950
int _trshn[ LCT_TRACK_MAX ][12] {} ;
5051
int _trnts[ LCT_TRACK_MAX ] {} ;
5152
int _trfts[ LCT_TRACK_MAX ] {} ;

include/TrackerHitBranches.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class TrackerHitBranches : public CollectionBranches {
4646
double _thpoz[ LCT_TRACKERHIT_MAX ] {} ;
4747
float _thedp[ LCT_TRACKERHIT_MAX ] {} ;
4848
float _thtim[ LCT_TRACKERHIT_MAX ] {} ;
49+
int _thdet[ LCT_TRACKERHIT_MAX ] {} ;
4950

5051
float _thcov[ LCT_TRACKERHIT_MAX ][6] {} ;
5152

src/JetBranches.cc

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,27 @@ void JetBranches::initBranches( TTree* tree, const std::string& pre){
8787

8888
tree->Branch( (pre+"jnpid" ).c_str() , &_jnpid , (pre+"jnpid/I").c_str() ) ;
8989
tree->Branch( (pre+"npfojet").c_str(), &_njetpfo , (pre+"npfojet["+pre+"njet]/I").c_str() ) ;
90-
tree->Branch( (pre+"rcidx").c_str(), &_jetpfoori , (pre+"rcidx["+pre+"njet][20]/I").c_str() ) ;
90+
tree->Branch( (pre+"rcidx").c_str(), &_jetpfoori , (pre+"rcidx["+pre+"njet][LCT_JET_PARTICLES_MAX]/I").c_str() ) ;
9191
} // end if
9292

9393
//PFO branches
9494

9595
if(_writeDaughtersParameters) {
96+
9697
tree->Branch( (pre+"ndaughters").c_str(), _ndaughters , (pre+"ndaughters["+pre+"njet]/I").c_str() ) ;
97-
tree->Branch( (pre+"ntracks").c_str(), _ntracks , (pre+"ntracks["+pre+"njet]/I").c_str() ) ;
98-
tree->Branch( (pre+"nclusters").c_str(), _nclusters , (pre+"nclusters["+pre+"njet]/I").c_str() ) ;
99-
tree->Branch( (pre+"daughters_PX").c_str(), _daughters_PX , (pre+"daughters_PX["+pre+"njet][20]/F").c_str() ) ;
100-
tree->Branch( (pre+"daughters_PY").c_str(), _daughters_PY , (pre+"daughters_PY["+pre+"njet][20]/F").c_str() ) ;
101-
tree->Branch( (pre+"daughters_PZ").c_str(), _daughters_PZ , (pre+"daughters_PZ["+pre+"njet][20]/F").c_str() ) ;
102-
tree->Branch( (pre+"daughters_E").c_str(), _daughters_E , (pre+"daughters_E["+pre+"njet][20]/F").c_str() ) ;
103-
tree->Branch( (pre+"daughters_M").c_str(), _daughters_M , (pre+"daughters_M["+pre+"njet][20]/F").c_str() ) ;
104-
tree->Branch( (pre+"daughters_Q").c_str(), _daughters_Q , (pre+"daughters_Q["+pre+"njet][20]/F").c_str() ) ;
105-
tree->Branch( (pre+"daughters_trackD0").c_str(), _daughters_trackD0 , (pre+"daughters_trackD0["+pre+"njet][20]/F").c_str() ) ;
106-
tree->Branch( (pre+"daughters_trackPhi").c_str(), _daughters_trackPhi , (pre+"daughters_trackPhi["+pre+"njet][20]/F").c_str() ) ;
107-
tree->Branch( (pre+"daughters_trackOmega").c_str(), _daughters_trackOmega , (pre+"daughters_trackOmega["+pre+"njet][20]/F").c_str() ) ;
108-
tree->Branch( (pre+"daughters_trackZ0").c_str(), _daughters_trackZ0 , (pre+"daughters_trackZ0["+pre+"njet][20]/F").c_str() ) ;
109-
tree->Branch( (pre+"daughters_trackTanLambda").c_str(), _daughters_trackTanLambda , (pre+"daughters_trackTanLambda["+pre+"njet][20]/F").c_str() ) ;
98+
tree->Branch( (pre+"ntracks").c_str(), _ntracks , (pre+"ntracks["+pre+"njet]/I").c_str() ) ;
99+
tree->Branch( (pre+"nclusters").c_str(), _nclusters , (pre+"nclusters["+pre+"njet]/I").c_str() ) ;
100+
tree->Branch( (pre+"daughters_PX").c_str(), _daughters_PX , (pre+"daughters_PX["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
101+
tree->Branch( (pre+"daughters_PY").c_str(), _daughters_PY , (pre+"daughters_PY["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
102+
tree->Branch( (pre+"daughters_PZ").c_str(), _daughters_PZ , (pre+"daughters_PZ["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
103+
tree->Branch( (pre+"daughters_E").c_str(), _daughters_E , (pre+"daughters_E["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
104+
tree->Branch( (pre+"daughters_M").c_str(), _daughters_M , (pre+"daughters_M["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
105+
tree->Branch( (pre+"daughters_Q").c_str(), _daughters_Q , (pre+"daughters_Q["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
106+
tree->Branch( (pre+"daughters_trackD0").c_str(), _daughters_trackD0 , (pre+"daughters_trackD0["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
107+
tree->Branch( (pre+"daughters_trackPhi").c_str(), _daughters_trackPhi , (pre+"daughters_trackPhi["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
108+
tree->Branch( (pre+"daughters_trackOmega").c_str(), _daughters_trackOmega , (pre+"daughters_trackOmega["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
109+
tree->Branch( (pre+"daughters_trackZ0").c_str(), _daughters_trackZ0 , (pre+"daughters_trackZ0["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
110+
tree->Branch( (pre+"daughters_trackTanLambda").c_str(), _daughters_trackTanLambda , (pre+"daughters_trackTanLambda["+pre+"njet][LCT_JET_PARTICLES_MAX]/F").c_str() ) ;
110111
}
111112

112113

@@ -196,23 +197,23 @@ void JetBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt )
196197
_ntracks[ i ] = 0;
197198
_nclusters[ i ] = 0;
198199

199-
200-
for ( size_t j = 0; j < LCT_JET_PARTICLES_MAX ; ++j ) {
200+
if(_writeDaughtersParameters) {
201+
202+
for ( size_t j = 0; j < LCT_JET_PARTICLES_MAX ; ++j ) {
201203
_daughters_PX[ i ][ j ] = 0 ;
202204
_daughters_PY[ i ][ j ] = 0 ;
203205
_daughters_PZ[ i ][ j ] = 0 ;
204206
_daughters_E[ i ][ j ] = 0 ;
205207
_daughters_M[ i ][ j ] = 0 ;
206208
_daughters_Q[ i ][ j ] = 0 ;
207-
_daughters_trackD0[ i ][ j ] = 0;
209+
_daughters_trackD0[ i ][ j ] = 0;
208210
_daughters_trackPhi[ i ][ j ] = 0;
209211
_daughters_trackOmega[ i ][ j ] = 0;
210212
_daughters_trackZ0[ i ][ j ] = 0;
211213
_daughters_trackTanLambda[ i ][ j ] = 0;
212-
213-
}
214-
215-
}
214+
}
215+
}
216+
}
216217

217218
if( !col ) return ;
218219

@@ -289,18 +290,16 @@ void JetBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt )
289290
_jcov8[ i ] = jet->getCovMatrix()[8];
290291
_jcov9[ i ] = jet->getCovMatrix()[9];
291292

292-
if(_writeDaughtersParameters){
293-
auto particles = jet->getParticles();
294-
_ndaughters[ i ] = particles.size() ;
295-
296-
int nparticles = std::min<int>( particles.size() , LCT_JET_PARTICLES_MAX ); // check array limit ...
297-
memset( &_jetpfoori[ i ][0], -1, LCT_JET_PARTICLES_MAX ); // init indices
293+
if (_writeDaughtersParameters) {
294+
auto particles = jet->getParticles();
295+
_ndaughters[ i ] = particles.size() ;
298296

299-
int ntracks=0;
300-
int nclusters=0;
297+
int ntracks=0;
298+
int nclusters=0;
299+
int nparticles = std::min<int>( particles.size() , LCT_JET_PARTICLES_MAX ); // check array limit ...
301300

302-
for( int partid = 0 ; partid < nparticles ; ++partid ) {
303-
_daughters_PX[ i ][ partid ] = particles[partid]->getMomentum()[0] ;
301+
for( int partid = 0 ; partid < nparticles ; ++partid ) {
302+
_daughters_PX[ i ][ partid ] = particles[partid]->getMomentum()[0] ;
304303
_daughters_PY[ i ][ partid ] = particles[partid]->getMomentum()[1] ;
305304
_daughters_PZ[ i ][ partid ] = particles[partid]->getMomentum()[2] ;
306305
_daughters_E[ i ][ partid ] = particles[partid]->getEnergy() ;
@@ -310,7 +309,7 @@ void JetBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt )
310309
if (abs(_daughters_Q[ i ][ partid ])>0) ntracks++;
311310
if (abs(_daughters_Q[ i ][ partid ])==0) nclusters++;
312311

313-
auto tracks = particles[partid]->getTracks();
312+
auto tracks = particles[partid]->getTracks();
314313
//std::cout << "ntracks = " << tracks.size() << " charge = " << _daughters_Q[ i ][ partid ] << std::endl;
315314

316315
if (tracks.size()>0) {
@@ -321,12 +320,12 @@ void JetBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt )
321320
_daughters_trackTanLambda[ i ][ partid ] = tracks[0]->getTanLambda();
322321
}
323322

324-
}
325-
_ntracks[ i ] = ntracks ;
326-
_nclusters[ i ] = nclusters ;
323+
}
324+
_ntracks[ i ] = ntracks ;
325+
_nclusters[ i ] = nclusters ;
327326
}
328327

329-
// write tagginf parameters if it is enabled
328+
// write tagging parameters if it is enabled
330329
if(_writeTaggingParameters) {
331330
std::vector< float > pidvec = pid->getParticleID (jet, algo).getParameters() ;
332331

src/TrackBranches.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void TrackBranches::initBranches( TTree* tree, const std::string& pre){
3131
tree->Branch( (pre+"trthn").c_str() , _trthn , (pre+"trthn["+pre+"ntrk]/I").c_str() ) ;
3232
tree->Branch( (pre+"trthi").c_str() , _trthi , (pre+"trthi["+pre+"ntrk][50]/I").c_str() ) ;
3333
tree->Branch( (pre+"trshn").c_str() , _trshn , (pre+"trshn["+pre+"ntrk][12]/I").c_str() ) ;
34+
tree->Branch( (pre+"trthd").c_str() , _trthd , (pre+"trthd["+pre+"ntrk][50]/I").c_str() ) ;
3435
tree->Branch( (pre+"trnts").c_str() , _trnts , (pre+"trnts["+pre+"ntrk]/I").c_str() ) ;
3536
tree->Branch( (pre+"trfts").c_str() , _trfts , (pre+"trfts["+pre+"ntrk]/I").c_str() ) ;
3637
tree->Branch( (pre+"trsip").c_str() , _trsip , (pre+"trsip["+pre+"ntrk]/I").c_str() ) ;
@@ -157,7 +158,10 @@ void TrackBranches::fill(const EVENT::LCCollection* col, EVENT::LCEvent* evt ){
157158
int hit_index = ( trk->getTrackerHits().at(ihit) ?
158159
trk->getTrackerHits().at(ihit)->ext<CollIndex>() - 1 :
159160
-1 );
160-
161+
unsigned det = ( trk->getTrackerHits().at(ihit) ?
162+
(unsigned) (trk->getTrackerHits().at(ihit)->getCellID0() & 0x1f) :
163+
0 );
164+
_trthd[ i ][ ihit ] = det ;
161165
_trthi[ i ][ ihit ] = hit_index;
162166

163167
}

src/TrackerHitBranches.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void TrackerHitBranches::initBranches( TTree* tree, const std::string& pre ){
3131
tree->Branch( (pre+"thpoz").c_str() , _thpoz , (pre+"thpoz["+pre+"ntrh]/D").c_str() ) ;
3232
tree->Branch( (pre+"thedp").c_str() , _thedp , (pre+"thedp["+pre+"ntrh]/F").c_str() ) ;
3333
tree->Branch( (pre+"thtim").c_str() , _thtim , (pre+"thtim["+pre+"ntrh]/F").c_str() ) ;
34+
tree->Branch( (pre+"thdet").c_str() , _thdet , (pre+"thdet["+pre+"ntrh]/I").c_str() ) ;
3435

3536
tree->Branch( (pre+"thcov").c_str() , _thcov , (pre+"thcov["+pre+"ntrh][6]/F").c_str() ) ;
3637

@@ -95,6 +96,8 @@ void TrackerHitBranches::fill(const EVENT::LCCollection* col, const EVENT::LCCol
9596
_thedp[i] = hit->getEDep() ;
9697
_thtim[i] = hit->getTime() ;
9798

99+
_thdet[i] = (unsigned) hit->getCellID0() & 0x1f ;
100+
98101
for(int j=0;j<6;++j){
99102
_thcov[ i ][ j ] = hit->getCovMatrix()[j] ;
100103
}

0 commit comments

Comments
 (0)