]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutPIDITS.cxx
method added to add a run list (A.Pulvirenti)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPIDITS.cxx
CommitLineData
659ef4f0 1//
2// Class AliRsnCutPIDITS
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 "AliRsnCutPIDITS.h"
30
31ClassImp(AliRsnCutPIDITS)
32
33//_________________________________________________________________________________________________
34AliRsnCutPIDITS::AliRsnCutPIDITS
35(const char *name, AliPID::EParticleType type, Bool_t isMC, Double_t momLimit, Double_t cut1, Double_t cut2) :
36 AliRsnCut(name, AliRsnCut::kDaughter, 0.0, 0.0),
37 fPIDtype(type),
38 fIsMC(isMC),
39 fMomentumLimit(momLimit),
40 fLargeCut(TMath::Max(cut1, cut2)),
41 fSmallCut(TMath::Min(cut1, cut2)),
42 fESDpid(),
43 fAODpid()
44{
45//
46// Main constructor.
47//
48
49 SetMC(isMC);
50}
51
52//_________________________________________________________________________________________________
53AliRsnCutPIDITS::AliRsnCutPIDITS
54(const AliRsnCutPIDITS& copy) :
55 AliRsnCut(copy),
56 fPIDtype(copy.fPIDtype),
57 fIsMC(copy.fIsMC),
58 fMomentumLimit(copy.fMomentumLimit),
59 fLargeCut(copy.fLargeCut),
60 fSmallCut(copy.fSmallCut),
61 fESDpid(copy.fESDpid),
62 fAODpid(copy.fAODpid)
63{
64//
65// Copy constructor.
66//
67
68 SetMC(copy.fIsMC);
69}
70
71//_________________________________________________________________________________________________
72AliRsnCutPIDITS& AliRsnCutPIDITS::operator=(const AliRsnCutPIDITS& copy)
73{
74//
75// Assignment operator
76//
77
78 AliRsnCut::operator=(copy);
79
80 fPIDtype = copy.fPIDtype;
81 fMomentumLimit = copy.fMomentumLimit;
82 fLargeCut = copy.fLargeCut;
83 fSmallCut = copy.fSmallCut;
84 fESDpid = copy.fESDpid;
85 fAODpid = copy.fAODpid;
86
87 SetMC(copy.fIsMC);
88
89 return (*this);
90}
91
92//_________________________________________________________________________________________________
93void AliRsnCutPIDITS::SetMC(Bool_t yn)
94{
95//
96// Properly set the PID response
97//
98
99 fIsMC = yn;
100 AliITSPIDResponse itsresponse(fIsMC);
101 fESDpid.GetITSResponse() = itsresponse;
102 fAODpid.GetITSResponse() = itsresponse;
103}
104
105//_________________________________________________________________________________________________
106Bool_t AliRsnCutPIDITS::IsSelected(TObject *object)
107{
108//
109// Cut checker.
110//
111
112 // coherence check
113 if (!TargetOK(object)) return kFALSE;
114
115 // reject not ITS tracks
116 // status is checked in the same way for all tracks
117 AliVTrack *vtrack = dynamic_cast<AliVTrack*>(fDaughter->GetRef());
118 if (!vtrack)
119 {
120 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
121 return kFALSE;
122 }
123
124 // check status, to know it track is an ITS+TPC or ITS standalone
125 // and reject it if it is of none of the allowed types
126 Bool_t isSA = kFALSE;
127 if (IsITSTPC(vtrack)) isSA = kFALSE;
128 else if (IsITSSA(vtrack)) isSA = kTRUE;
129 else
130 {
131 AliWarning("Track is neither ITS+TPC nor ITS standalone");
132 return kFALSE;
133 }
134
135 // common evaluation variables
136 Double_t mom = vtrack->P();
137 Int_t k, nITSpidLayers;
138
139 // retrieve real object type
140 AliESDtrack *esdTrack = fDaughter->GetRefESDtrack();
141 AliAODTrack *aodTrack = fDaughter->GetRefAODtrack();
142 if (esdTrack)
143 {
144 AliDebug(AliLog::kDebug + 2, "Checking an ESD track");
145
146 // count PID layers and reject if they are too few
147 nITSpidLayers = 0;
148 UChar_t itsCluMap = esdTrack->GetITSClusterMap();
149 for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers;
150 if (nITSpidLayers < 3)
151 {
152 AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
153 return kFALSE;
154 }
155
156 // create the PID response object and compute nsigma
157 AliITSPIDResponse &itsrsp = fESDpid.GetITSResponse();
158 fCutValueD = itsrsp.GetNumberOfSigmas(mom, esdTrack->GetITSsignal(), fPIDtype, nITSpidLayers, isSA);
159 }
160 else if (aodTrack)
161 {
162 AliDebug(AliLog::kDebug + 2, "Checking an AOD track");
163
164 // count PID layers and reject if they are too few
165 nITSpidLayers = 0;
166 for(k = 2; k < 6; k++) if (TESTBIT(aodTrack->GetITSClusterMap(), k)) ++nITSpidLayers;
167 if (nITSpidLayers < 3)
168 {
169 AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
170 return kFALSE;
171 }
172
173 // compute nsigma
174 fCutValueD = fAODpid.NumberOfSigmasITS(aodTrack, fPIDtype);
175 }
176 else
177 {
178 AliDebug(AliLog::kDebug + 2, Form("This object is not either an ESD nor AOD track, it is an %s", fDaughter->GetRef()->ClassName()));
179 return kFALSE;
180 }
181
182 // determine cut range from the momentum
183 if (mom < fMomentumLimit)
184 {
185 fMinD = -fLargeCut;
186 fMaxD = fLargeCut;
187 }
188 else
189 {
190 fMinD = -fSmallCut;
191 fMaxD = fSmallCut;
192 }
193
194 // check the cut using the standard AliRsnCut facilities
195 return OkRangeD();
196}
197
198//_________________________________________________________________________________________________
199void AliRsnCutPIDITS::Print(const Option_t *) const
200{
201//
202// Print information on this cut
203//
204
205 AliInfo(Form("Cut name, type : %s %s", GetName(), ClassName()));
a909ffad 206 AliInfo(Form("ITS PID cut: limit, large, small: %.3f %.3f %.3f", fMomentumLimit, fLargeCut, fSmallCut));
659ef4f0 207}