CbmRoot
Loading...
Searching...
No Matches
CbmLitTrackSelectionCuts.cxx
Go to the documentation of this file.
1/* Copyright (C) 2011-2013 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
6
7#include "data/CbmLitTrack.h"
8
9#include <cmath>
10#include <limits>
11
13 : fMaxChiSq(std::numeric_limits<litfloat>::max())
14 , fMinLastPlaneId(-1)
15 , fMinNofHits(-1)
16 , fMinMomentum(0.)
17{
18}
19
20CbmLitTrackSelectionCuts::CbmLitTrackSelectionCuts(litfloat maxChiSq, int minLastPlaneId, int minNofHits,
21 litfloat minMomentum)
22 : fMaxChiSq(maxChiSq)
23 , fMinLastPlaneId(minLastPlaneId)
24 , fMinNofHits(minNofHits)
25 , fMinMomentum(minMomentum)
26{
27}
28
30
32{
33 if (itBegin == itEnd) {
34 return kLITSUCCESS;
35 }
36
37 for (TrackPtrIterator iTrack = itBegin; iTrack != itEnd; iTrack++) {
38 if ((*iTrack)->GetQuality() == kLITBAD) {
39 continue;
40 }
41
42 if ((*iTrack)->GetChi2() / (*iTrack)->GetNDF() > fMaxChiSq || (*iTrack)->GetNofHits() < fMinNofHits
43 || (*iTrack)->GetLastStationId() < fMinLastPlaneId) {
44 (*iTrack)->SetQuality(kLITBAD);
45 }
46
47 // Momentum cut
48 if (fMinMomentum != 0.) {
49 if ((*iTrack)->GetParamLast()->GetQp() == 0.) {
50 (*iTrack)->SetQuality(kLITBAD);
51 continue;
52 }
53 litfloat mom = std::abs(1. / (*iTrack)->GetParamLast()->GetQp());
54 if (mom < fMinMomentum) {
55 (*iTrack)->SetQuality(kLITBAD);
56 }
57 }
58 }
59
60 return kLITSUCCESS;
61}
62
TClonesArray * tracks
@ kLITBAD
Definition CbmLitEnums.h:40
LitStatus
Definition CbmLitEnums.h:29
@ kLITSUCCESS
Definition CbmLitEnums.h:30
double litfloat
Definition CbmLitFloat.h:19
Base data class for track.
std::vector< CbmTofTrack * >::iterator TrackPtrIterator
Definition CbmTofTypes.h:25
std::vector< CbmTofTrack * > TrackPtrVector
Definition CbmTofTypes.h:26
virtual LitStatus DoSelect(TrackPtrIterator itBegin, TrackPtrIterator itEnd)
Main function to be implemented for concrete track selection algorithm.
Hash for CbmL1LinkKey.