CbmRoot
CbmLitTrackSelectionCuts.cxx
Go to the documentation of this file.
1 /* CbmLitTrackSelectionCuts.cxx
2  * @author Andrey Lebedev <andrey.lebedev@gsi.de>
3  * @since 2011
4  * @version 1.0
5  */
7 
8 #include "data/CbmLitTrack.h"
9 
10 #include <cmath>
11 #include <limits>
12 
14  : fMaxChiSq(std::numeric_limits<litfloat>::max())
15  , fMinLastPlaneId(-1)
16  , fMinNofHits(-1)
17  , fMinMomentum(0.) {}
18 
20  int minLastPlaneId,
21  int minNofHits,
22  litfloat minMomentum)
23  : fMaxChiSq(maxChiSq)
24  , fMinLastPlaneId(minLastPlaneId)
25  , fMinNofHits(minNofHits)
26  , fMinMomentum(minMomentum) {}
27 
29 
31  TrackPtrIterator itEnd) {
32  if (itBegin == itEnd) { return kLITSUCCESS; }
33 
34  for (TrackPtrIterator iTrack = itBegin; iTrack != itEnd; iTrack++) {
35  if ((*iTrack)->GetQuality() == kLITBAD) { continue; }
36 
37  if ((*iTrack)->GetChi2() / (*iTrack)->GetNDF() > fMaxChiSq
38  || (*iTrack)->GetNofHits() < fMinNofHits
39  || (*iTrack)->GetLastStationId() < fMinLastPlaneId) {
40  (*iTrack)->SetQuality(kLITBAD);
41  }
42 
43  // Momentum cut
44  if (fMinMomentum != 0.) {
45  if ((*iTrack)->GetParamLast()->GetQp() == 0.) {
46  (*iTrack)->SetQuality(kLITBAD);
47  continue;
48  }
49  litfloat mom = std::abs(1. / (*iTrack)->GetParamLast()->GetQp());
50  if (mom < fMinMomentum) { (*iTrack)->SetQuality(kLITBAD); }
51  }
52  }
53 
54  return kLITSUCCESS;
55 }
56 
58  return DoSelect(tracks.begin(), tracks.end());
59 }
litfloat
double litfloat
Definition: CbmLitFloat.h:15
CbmLitTrackSelectionCuts::fMinNofHits
int fMinNofHits
Definition: CbmLitTrackSelectionCuts.h:65
CbmLitTrackSelectionCuts.h
CbmLitTrackSelectionCuts::~CbmLitTrackSelectionCuts
virtual ~CbmLitTrackSelectionCuts()
Definition: CbmLitTrackSelectionCuts.cxx:28
CbmLitTrackSelectionCuts::DoSelect
virtual LitStatus DoSelect(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Main function to be implemented for concrete track selection algorithm.
Definition: CbmLitTrackSelectionCuts.cxx:30
CbmLitTrackSelectionCuts::CbmLitTrackSelectionCuts
CbmLitTrackSelectionCuts()
Definition: CbmLitTrackSelectionCuts.cxx:13
kLITSUCCESS
@ kLITSUCCESS
Definition: CbmLitEnums.h:24
TrackPtrIterator
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition: CbmTofTypes.h:21
TrackPtrVector
std::vector< CbmTofTrack * > TrackPtrVector
Definition: CbmTofTypes.h:22
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
kLITBAD
@ kLITBAD
Definition: CbmLitEnums.h:33
CbmLitTrackSelectionCuts::fMaxChiSq
litfloat fMaxChiSq
Definition: CbmLitTrackSelectionCuts.h:61
CbmLitTrackSelectionCuts::fMinLastPlaneId
int fMinLastPlaneId
Definition: CbmLitTrackSelectionCuts.h:63
CbmLitTrack.h
Base data class for track.
LitStatus
LitStatus
Definition: CbmLitEnums.h:23
max
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: L1/vectors/P4_F32vec4.h:36
CbmLitTrackSelectionCuts::fMinMomentum
litfloat fMinMomentum
Definition: CbmLitTrackSelectionCuts.h:67