8 #include <tracking/eventTimeExtraction/findlets/TrackSelector.h>
9 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
10 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
11 #include <tracking/dataobjects/RecoTrack.h>
12 #include <framework/core/ModuleParamList.h>
15 using namespace TrackFindingCDC;
17 void TrackSelector::exposeParameters(
ModuleParamList* moduleParamList,
const std::string& prefix)
19 moduleParamList->
addParameter(prefixed(prefix,
"minNumberCDCHits"), m_param_minNumberCDCHits,
20 "Minimal number of CDC hits for a track", m_param_minNumberCDCHits);
21 moduleParamList->
addParameter(prefixed(prefix,
"maximumNumberOfTracks"), m_param_maximumNumberOfTracks,
22 "Maximal number of tracks in an event", m_param_maximumNumberOfTracks);
23 moduleParamList->
addParameter(prefixed(prefix,
"minimumTrackPt"), m_param_minimumTrackPt,
24 "Minimal pt for a track", m_param_minimumTrackPt);
27 void TrackSelector::apply(std::vector<RecoTrack*>& tracks)
29 const auto trackHasEnoughPtAndHits = [
this](
RecoTrack * rt) {
30 return (rt->getNumberOfCDCHits() < m_param_minNumberCDCHits) or
31 (rt->getMomentumSeed().Rho() < m_param_minimumTrackPt);
33 TrackFindingCDC::erase_remove_if(tracks, trackHasEnoughPtAndHits);
40 std::sort(tracks.begin(), tracks.end(), greaterHits);
42 const unsigned int maximalNumberOfElements = std::min(
static_cast<unsigned int>(tracks.size()),
43 m_param_maximumNumberOfTracks);
45 tracks.resize(maximalNumberOfElements);
47 B2DEBUG(25,
"Limited number of selected tracks: " << tracks.size());
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
unsigned int getNumberOfCDCHits() const
Return the number of cdc hits.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.