]>
Commit | Line | Data |
---|---|---|
659ef4f0 | 1 | // |
2 | // Class AliRsnCutPIDTPC | |
3 | // | |
4 | // General implementation of a single cut strategy, which can be: | |
5 | // - a value contained in a given interval [--> IsBetween() ] | |
6 | // - a value equal to a given reference [--> MatchesValue()] | |
7 | // | |
8 | // In all cases, the reference value(s) is (are) given as data members | |
9 | // and each kind of cut requires a given value type (Int, UInt, Double), | |
10 | // but the cut check procedure is then automatized and chosen thanks to | |
11 | // an enumeration of the implemented cut types. | |
12 | // At the end, the user (or any other point which uses this object) has | |
13 | // to use the method IsSelected() to check if this cut has been passed. | |
14 | // | |
15 | // authors: Martin Vala (martin.vala@cern.ch) | |
16 | // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
17 | // | |
18 | ||
19 | #include <Riostream.h> | |
20 | ||
21 | #include "AliESDpid.h" | |
22 | #include "AliTOFT0maker.h" | |
23 | #include "AliTOFcalib.h" | |
24 | #include "AliCDBManager.h" | |
25 | #include "AliITSPIDResponse.h" | |
26 | ||
27 | #include "AliRsnEvent.h" | |
28 | #include "AliRsnDaughter.h" | |
29 | #include "AliRsnCutPIDTPC.h" | |
30 | ||
31 | ClassImp(AliRsnCutPIDTPC) | |
32 | ||
33 | //_________________________________________________________________________________________________ | |
34 | AliRsnCutPIDTPC::AliRsnCutPIDTPC | |
80e49c8b | 35 | (const char *name, AliPID::EParticleType type, Double_t min, Double_t max, Bool_t rejectOutside) : |
36 | AliRsnCut(name, AliRsnCut::kDaughter, min, max), | |
37 | fRejectOutside(rejectOutside), | |
38 | fMomMin(0.0), | |
39 | fMomMax(1E+20), | |
40 | fRefType(type), | |
659ef4f0 | 41 | fESDpid(), |
42 | fAODpid() | |
43 | { | |
44 | // | |
45 | // Main constructor. | |
46 | // | |
47 | } | |
48 | ||
49 | //_________________________________________________________________________________________________ | |
50 | AliRsnCutPIDTPC::AliRsnCutPIDTPC | |
51 | (const AliRsnCutPIDTPC& copy) : | |
52 | AliRsnCut(copy), | |
80e49c8b | 53 | fRejectOutside(copy.fRejectOutside), |
54 | fMomMin(copy.fMomMin), | |
55 | fMomMax(copy.fMomMax), | |
56 | fRefType(copy.fRefType), | |
659ef4f0 | 57 | fESDpid(copy.fESDpid), |
58 | fAODpid(copy.fAODpid) | |
59 | { | |
60 | // | |
61 | // Copy constructor. | |
62 | // | |
63 | } | |
64 | ||
65 | //_________________________________________________________________________________________________ | |
66 | AliRsnCutPIDTPC& AliRsnCutPIDTPC::operator=(const AliRsnCutPIDTPC& copy) | |
67 | { | |
68 | // | |
69 | // Assignment operator | |
70 | // | |
71 | ||
72 | AliRsnCut::operator=(copy); | |
73 | ||
80e49c8b | 74 | fRejectOutside = copy.fRejectOutside; |
75 | fMomMin = copy.fMomMin; | |
76 | fMomMax = copy.fMomMax; | |
77 | fRefType = copy.fRefType; | |
78 | fESDpid = copy.fESDpid; | |
79 | fAODpid = copy.fAODpid; | |
659ef4f0 | 80 | |
81 | return (*this); | |
82 | } | |
83 | ||
84 | //_________________________________________________________________________________________________ | |
85 | void AliRsnCutPIDTPC::SetBBParam(Double_t p0, Double_t p1, Double_t p2, Double_t p3, Double_t p4) | |
86 | { | |
87 | // | |
88 | // Properly set the Bethe-Bloch parameters in all places where it is needed. | |
89 | // | |
90 | ||
91 | fESDpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); | |
92 | fAODpid.GetTPCResponse().SetBetheBlochParameters(p0, p1, p2, p3, p4); | |
93 | } | |
94 | ||
95 | //_________________________________________________________________________________________________ | |
96 | Bool_t AliRsnCutPIDTPC::IsSelected(TObject *object) | |
97 | { | |
98 | // | |
99 | // Cut checker. | |
100 | // | |
101 | ||
102 | // coherence check | |
103 | if (!TargetOK(object)) return kFALSE; | |
104 | ||
105 | // reject not TPC tracks | |
659ef4f0 | 106 | AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef()); |
80e49c8b | 107 | if (!vtrack) return kFALSE; |
108 | if (!IsTPC(vtrack)) | |
659ef4f0 | 109 | { |
110 | AliDebug(AliLog::kDebug + 2, "Track is not found in TPC"); | |
111 | return kFALSE; | |
112 | } | |
113 | ||
114 | // common evaluation variables | |
80e49c8b | 115 | Double_t mom; |
659ef4f0 | 116 | AliESDtrack *esdTrack = fDaughter->GetRefESDtrack(); |
117 | AliAODTrack *aodTrack = fDaughter->GetRefAODtrack(); | |
80e49c8b | 118 | |
119 | // get inner momentum and check it w.r. to allowed range: | |
120 | // all tracks outside it will pass the cut or not, depending on 'fRejectOutside' | |
121 | if (esdTrack) | |
659ef4f0 | 122 | mom = esdTrack->GetInnerParam()->P(); |
659ef4f0 | 123 | else if (aodTrack) |
80e49c8b | 124 | mom = aodTrack->GetDetPid()->GetTPCmomentum(); |
659ef4f0 | 125 | else |
126 | { | |
80e49c8b | 127 | AliDebug(AliLog::kDebug + 2, Form("Impossible to process an object of type '%s'. Cut applicable only to ESD/AOD tracks", fDaughter->GetRef()->ClassName())); |
659ef4f0 | 128 | return kFALSE; |
129 | } | |
80e49c8b | 130 | if ((mom < fMomMin || mom > fMomMax)) |
659ef4f0 | 131 | { |
80e49c8b | 132 | AliDebug(AliLog::kDebug + 2, Form("Track momentum = %.5f, outside allowed range", mom)); |
133 | return (!fRejectOutside); | |
659ef4f0 | 134 | } |
80e49c8b | 135 | |
136 | // assign PID nsigmas to default cut check value | |
137 | // since bad object types are rejected before, here we have an ESD track or AOD track | |
138 | if (esdTrack) | |
139 | fCutValueD = fESDpid.GetTPCResponse().GetNumberOfSigmas(mom, esdTrack->GetTPCsignal(), esdTrack->GetTPCsignalN(), fRefType); | |
659ef4f0 | 140 | else |
80e49c8b | 141 | fCutValueD = fAODpid.NumberOfSigmasTPC(aodTrack, fRefType); |
142 | ||
143 | // use AliRsnCut default method to check cut | |
659ef4f0 | 144 | return OkRangeD(); |
145 | } | |
146 | ||
147 | //_________________________________________________________________________________________________ | |
148 | void AliRsnCutPIDTPC::Print(const Option_t *) const | |
149 | { | |
150 | // | |
151 | // Print information on this cut | |
152 | // | |
153 | ||
80e49c8b | 154 | AliInfo(Form("Cut name : %s", GetName())); |
155 | AliInfo(Form("--> cut range (nsigma) : %.3f %.3f", fMinD, fMaxD)); | |
156 | AliInfo(Form("--> momentum range : %.3f %.3f", fMomMin, fMomMax)); | |
157 | AliInfo(Form("--> tracks outside range are: %s", (fRejectOutside ? "rejected" : "accepted"))); | |
659ef4f0 | 158 | } |