Skip to content

Commit

Permalink
Add possibility to cut on theta and on hits outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
gianelle committed Nov 29, 2024
1 parent 692194c commit 61b7e43
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
15 changes: 14 additions & 1 deletion source/Utils/include/FilterTracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ namespace TrackPerf
* @parameter NHitsVertex Minimum number of hits on vertex detector
* @parameter NHitsInner Minimum number of hits on inner tracker
* @parameter NHitsOuter Minimum number of hits on outer tracker
* @parameter MaxOutliers Maximum number of outliers hits on track
* @parameter MaxHoles Maximum number of holes on track
* @parameter MinNdf Minimum value for ndf
* @parameter MinPt Minimum transverse momentum
* @parameter MaxPt Max transverse momentum
* @parameter MinTheta Minimum theta
* @parameter MaxTheta Max theta
* @parameter Chi2Spatial Spatial chi squared
*
* @author N. Bruhwiler
Expand Down Expand Up @@ -77,8 +83,15 @@ class FilterTracks : public marlin::Processor
float _MinPt = 0.5; //units GeV
float _MaxPt = 1000.0; //units GeV

//! Cut off for theta (rad)
float _MinTheta = 0;
float _MaxTheta = 3.14;

//! Cut off for the value ndf
int _MinNdf = 1;
int _MinNdf = 1;

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

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

Expand Down Expand Up @@ -66,6 +67,18 @@ FilterTracks::FilterTracks()
_MaxPt
);

registerProcessorParameter("MinTheta",
"Minimum theta",
_MinTheta,
_MinTheta
);

registerProcessorParameter("MaxTheta",
"Max theta",
_MaxTheta,
_MaxTheta
);

registerProcessorParameter("Chi2Spatial",
"iMinimum value for Spatial chi squared",
_Chi2Spatial,
Expand All @@ -84,6 +97,12 @@ FilterTracks::FilterTracks()
_MaxHoles
);

registerProcessorParameter("MaxOutliers",
"Max number of outliers",
_MaxOutl,
_MaxOutl
);

registerProcessorParameter("Bz",
"Magnetic field in Tesla (default: 5)",
_Bz,
Expand Down Expand Up @@ -135,7 +154,7 @@ void FilterTracks::init()
{
// Print the initial parameters
printParameters() ;
// it require that geometry is initialized
// it requires that geometry has been already initialized
// buildBfield() ;
}

Expand Down Expand Up @@ -166,8 +185,8 @@ void FilterTracks::processEvent( LCEvent * evt )
TMVA::Reader* reader = new TMVA::Reader();

// Get input collection
LCCollection* InputTrackCollection =evt->getCollection(_InputTrackCollection);

LCCollection* InputTrackCollection = evt->getCollection(_InputTrackCollection);
if( InputTrackCollection->getTypeName() != lcio::LCIO::TRACK )
{ throw EVENT::Exception( "Invalid collection type: " + InputTrackCollection->getTypeName() ) ; }

Expand Down Expand Up @@ -208,7 +227,7 @@ void FilterTracks::processEvent( LCEvent * evt )

vars["trthn"] = trk->getNholes();
float pt = fabs(0.3*_Bz/trk->getOmega()/1000);

float theta = M_PI_2-atan(trk->getTanLambda());
vars["trch2"] = trk->getChi2();

vars["trndf"] = trk->getNdf();
Expand Down Expand Up @@ -236,8 +255,11 @@ void FilterTracks::processEvent( LCEvent * evt )
vars["trtohn"] > _NHitsOuter &&
pt > _MinPt &&
pt < _MaxPt &&
theta > _MinTheta &&
theta < _MaxTheta &&
vars["trch2"] > _Chi2Spatial &&
vars["trndf"] > _MinNdf &&
vars["trtnh"]-vars["trndf"]/2 < _MaxOutl &&
vars["trthn"] < _MaxHoles)
{ OutputTrackCollection->addElement(trk); }
}
Expand Down

0 comments on commit 61b7e43

Please sign in to comment.