Skip to content

Commit

Permalink
It saves real tracks, not pointers.
Browse files Browse the repository at this point in the history
It saves also the list of hits.
Change two default values.
  • Loading branch information
gianelle committed Dec 11, 2024
1 parent 61b7e43 commit 74100ae
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions source/Utils/include/FilterTracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FilterTracks : public marlin::Processor
//! Cut off for number of hits in outer tracker (barrel and endcap combined)
int _NHitsOuter = 1;
//! Cut off for number of holes
int _MaxHoles = 1;
int _MaxHoles = 10;

//! Cut off for momentum (GeV)
float _MinPt = 0.5; //units GeV
Expand All @@ -91,7 +91,7 @@ class FilterTracks : public marlin::Processor
int _MinNdf = 1;

//! Cut off for outliers number
int _MaxOutl = 0;
int _MaxOutl = 10;

//! Cut off for spatial and temporal chi squared values
float _Chi2Spatial = 0;
Expand Down
25 changes: 20 additions & 5 deletions source/Utils/src/FilterTracks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <EVENT/TrackerHit.h>
#include <IMPL/LCCollectionVec.h>
#include <IMPL/LCFlagImpl.h>
#include <IMPL/TrackImpl.h>
#include <UTIL/CellIDDecoder.h>
#include <UTIL/LCTrackerConf.h>

Expand Down Expand Up @@ -180,7 +181,13 @@ void FilterTracks::processEvent( LCEvent * evt )
{
// Make the output track collection
LCCollectionVec *OutputTrackCollection = new LCCollectionVec(LCIO::TRACK);
OutputTrackCollection->setSubset(true);
// do not store pointers but real tracks
OutputTrackCollection->setSubset(false);

// if we want to point back to the hits we need to set the flag
LCFlagImpl trkFlag(0);
trkFlag.setBit(LCIO::TRBIT_HITS);
OutputTrackCollection->setFlag(trkFlag.getFlag());

TMVA::Reader* reader = new TMVA::Reader();

Expand Down Expand Up @@ -242,12 +249,17 @@ void FilterTracks::processEvent( LCEvent * evt )
break;
}
}
if(endcaphits == false) { OutputTrackCollection->addElement(trk); }
if (endcaphits == false) {
auto itrk = dynamic_cast<IMPL::TrackImpl*>(trk);
OutputTrackCollection->addElement(new IMPL::TrackImpl(*itrk));
}
} else { // track property cuts
if ( not _NNmethod.empty() ) { // NN cuts
auto prediction = reader->EvaluateMVA(_NNmethod);
if ( prediction > _NNthr )
OutputTrackCollection->addElement(trk);
if ( prediction > _NNthr ) {
auto itrk = dynamic_cast<IMPL::TrackImpl*>(trk);
OutputTrackCollection->addElement(new IMPL::TrackImpl(*itrk));
}
} else { // user cuts
if (vars["trtnh"] > _NHitsTotal &&
vars["trtvhn"] > _NHitsVertex &&
Expand All @@ -261,7 +273,10 @@ void FilterTracks::processEvent( LCEvent * evt )
vars["trndf"] > _MinNdf &&
vars["trtnh"]-vars["trndf"]/2 < _MaxOutl &&
vars["trthn"] < _MaxHoles)
{ OutputTrackCollection->addElement(trk); }
{
auto itrk = dynamic_cast<IMPL::TrackImpl*>(trk);
OutputTrackCollection->addElement(new IMPL::TrackImpl(*itrk));
}
}
}
}
Expand Down

0 comments on commit 74100ae

Please sign in to comment.