Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selector updates: holes and existence of TrackState at caloface #17

Merged
merged 9 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/Utils/include/FilterTracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class FilterTracks : public marlin::Processor
std::string _OutputTrackCollection {};

bool _BarrelOnly = false;
bool _HasCaloState = false;

//! Cut off for total number of hits
int _NHitsTotal = 7;
Expand All @@ -71,6 +72,9 @@ class FilterTracks : public marlin::Processor
//! Cut off for number of hits in outer tracker (barrel and endcap combined)
int _NHitsOuter = 1;

//! Cut off for maximum number of holes on track
int _MaxHoles = 0;

//! Cut off for momentum (GeV)
float _MinPt = 1.0; //units GeV

Expand Down
28 changes: 27 additions & 1 deletion source/Utils/src/FilterTracks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ FilterTracks::FilterTracks()
_BarrelOnly
);

registerProcessorParameter("HasCaloState",
"If true, just keep tracks that have a TrackState at the Calorimeter surface",
_HasCaloState,
_HasCaloState
);

registerProcessorParameter("NHitsTotal",
"Minimum number of hits on track",
_NHitsTotal,
Expand All @@ -49,6 +55,12 @@ FilterTracks::FilterTracks()
_NHitsOuter
);

registerProcessorParameter("MaxHoles",
"Maximum number of holes on track",
_MaxHoles,
_MaxHoles
);

registerProcessorParameter("MinPt",
"Minimum transverse momentum",
_MinPt,
Expand Down Expand Up @@ -132,6 +144,19 @@ void FilterTracks::processEvent( LCEvent * evt )

float chi2spatial = trk->getChi2();

int nholes = trk->getNholes();

bool foundCaloState = false;
madbaron marked this conversation as resolved.
Show resolved Hide resolved
// Check if a TrackState at the calo surface exists
const std::vector<EVENT::TrackState*>& trackStates = trk->getTrackStates();
for (const auto& state : trackStates) {
if (state->getLocation() == EVENT::TrackState::AtCalorimeter) {
foundCaloState = true;
break;
}
}
madbaron marked this conversation as resolved.
Show resolved Hide resolved
if (_HasCaloState && !foundCaloState) { continue; }

if(_BarrelOnly == true) {
bool endcaphits = false;
for(int j=0; j<nhittotal; ++j) {
Expand All @@ -149,7 +174,8 @@ void FilterTracks::processEvent( LCEvent * evt )
nhitinner > _NHitsInner &&
nhitouter > _NHitsOuter &&
pt > _MinPt &&
chi2spatial > _Chi2Spatial)
chi2spatial > _Chi2Spatial &&
nholes <= _MaxHoles)
madbaron marked this conversation as resolved.
Show resolved Hide resolved
{ OutputTrackCollection->addElement(trk); }
}
}
Expand Down
Loading