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()]
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.
15 // authors: Martin Vala (martin.vala@cern.ch)
16 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
19 #include <Riostream.h>
24 #include "AliESDtrackCuts.h"
26 #include "AliRsnEvent.h"
27 #include "AliRsnDaughter.h"
28 #include "AliRsnCutV0.h"
32 //_________________________________________________________________________________________________
33 //AliRsnCutV0::AliRsnCutV0(const char *name, Int_t hypothesis) :
34 AliRsnCutV0::AliRsnCutV0(const char *name, Int_t hypothesis, AliPID::EParticleType pid, AliPID::EParticleType pid2) :
35 AliRsnCut(name, AliRsnTarget::kDaughter),
40 fMinCosPointAngle(0.95),
41 fMaxDaughtersDCA(0.5),
51 // Default constructor.
52 // Initializes all cuts in such a way that all of them are disabled.
55 SetHypothesis(hypothesis);
58 //_________________________________________________________________________________________________
59 AliRsnCutV0::AliRsnCutV0(const AliRsnCutV0 ©) :
61 fHypothesis(copy.fHypothesis),
63 fTolerance(copy.fTolerance),
64 fMaxDCAVertex(copy.fMaxDCAVertex),
65 fMinCosPointAngle(copy.fMinCosPointAngle),
66 fMaxDaughtersDCA(copy.fMaxDaughtersDCA),
67 fMaxRapidity(copy.fMaxRapidity),
70 fPIDCut1(copy.fPIDCut1),
71 fPIDCut2(copy.fPIDCut2),
72 fPIDCut3(copy.fPIDCut3),
73 fESDtrackCuts(copy.fESDtrackCuts)
77 // Just copy all data member values.
81 //_________________________________________________________________________________________________
82 AliRsnCutV0 &AliRsnCutV0::operator=(const AliRsnCutV0 ©)
85 // Assignment operator.
86 // Just copy all data member values.
91 fHypothesis = copy.fHypothesis;
93 fTolerance = copy.fTolerance;
94 fMaxDCAVertex = copy.fMaxDCAVertex;
95 fMinCosPointAngle = copy.fMinCosPointAngle;
96 fMaxDaughtersDCA = copy.fMaxDaughtersDCA;
97 fMaxRapidity = copy.fMaxRapidity;
100 fPIDCut1 = copy.fPIDCut1;
101 fPIDCut2 = copy.fPIDCut2;
102 fPIDCut3 = copy.fPIDCut3;
103 fESDtrackCuts = copy.fESDtrackCuts;
108 //_________________________________________________________________________________________________
109 Bool_t AliRsnCutV0::IsSelected(TObject *object)
113 // Checks the type of object being evaluated
114 // and then calls the appropriate sub-function (for ESD or AOD)
118 if (!TargetOK(object)) return kFALSE;
121 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
122 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
123 //cout << fDaughter->GetRef()->ClassName() << ' ' << v0esd << ' ' << v0aod << endl;
125 // operate depending on cast
127 return CheckESD(v0esd);
129 return CheckAOD(v0aod);
131 AliDebugClass(1, "Object is not a V0");
136 //_________________________________________________________________________________________________
137 Bool_t AliRsnCutV0::CheckESD(AliESDv0 *v0)
141 // This is done using the default track checker for ESD.
142 // It is declared static, not to recreate it every time.
145 AliDebugClass(1, "Check ESD");
146 if (v0->GetOnFlyStatus()) {
147 AliDebugClass(1, "Rejecting V0 in 'on fly' status");
148 return kFALSE; // if kTRUE, then this V0 is recontructed
151 // retrieve pointer to owner event
152 AliESDEvent *lESDEvent = fEvent->GetRefESD();
153 Double_t xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
154 Double_t yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
155 Double_t zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
156 AliDebugClass(2, Form("Primary vertex: %f %f %f", xPrimaryVertex, yPrimaryVertex, zPrimaryVertex));
158 // retrieve the V0 daughters
159 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0->GetPindex());
160 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0->GetNindex());
161 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
162 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
164 // check quality cuts
166 AliDebugClass(2, "Checking quality cuts");
167 if (!fESDtrackCuts->IsSelected(pTrack)) {
168 AliDebugClass(2, "Positive daughter failed quality cuts");
171 if (!fESDtrackCuts->IsSelected(nTrack)) {
172 AliDebugClass(2, "Negative daughter failed quality cuts");
177 // filter like-sign V0
178 if ( TMath::Abs( ((pTrack->GetSign()) - (nTrack->GetSign())) ) < 0.1) {
179 AliDebugClass(2, "Failed like-sign V0 check");
184 // check compatibility with expected species hypothesis
185 v0->ChangeMassHypothesis(fHypothesis);
186 if ((TMath::Abs(v0->GetEffMass() - fMass)) > fTolerance) {
187 AliDebugClass(2, "V0 is not in the expected inv mass range");
191 // topological checks
192 if (TMath::Abs(v0->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex)) > fMaxDCAVertex) {
193 AliDebugClass(2, "Failed check on DCA to primary vertes");
196 if (TMath::Abs(v0->GetV0CosineOfPointingAngle()) < fMinCosPointAngle) {
197 AliDebugClass(2, "Failed check on cosine of pointing angle");
200 if (TMath::Abs(v0->GetDcaV0Daughters()) > fMaxDaughtersDCA) {
201 AliDebugClass(2, "Failed check on DCA between daughters");
204 if (TMath::Abs(v0->Y(fHypothesis)) > fMaxRapidity) {
205 AliDebugClass(2, "Failed check on V0 rapidity");
210 // check PID on proton or antiproton from V0
212 // check initialization of PID object
213 AliPIDResponse *pid = fEvent->GetPIDResponse();
215 AliFatal("NULL PID response");
219 // check if TOF is matched
220 // and computes all values used in the PID cut
221 //Bool_t isTOFpos = MatchTOF(ptrack);
222 //Bool_t isTOFneg = MatchTOF(ntrack);
223 Double_t pospTPC = pTrack->GetTPCmomentum();
224 Double_t negpTPC = nTrack->GetTPCmomentum();
225 //Double_t posp = pTrack->P();
226 //Double_t negp = nTrack->P();
227 Double_t posnsTPC = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, fPID));
228 Double_t posnsTPC2 = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, fPID2));
229 //Double_t posnsTOF = TMath::Abs(pid->NumberOfSigmasTOF(ptrack, fPID));
230 Double_t negnsTPC = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, fPID));
231 Double_t negnsTPC2 = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, fPID2));
232 //Double_t negnsTOF = TMath::Abs(pid->NumberOfSigmasTOF(ntrack, fPID));
233 Double_t maxTPC = 1E20;
234 Double_t maxTPC2 = 1E20;
235 //Double_t maxTOF = 1E20;
237 // applies the cut differently depending on the PID and the momentum
239 if(fHypothesis==kLambda0) {
241 // TPC: 5sigma cut for all
242 //if (posnsTPC > 5.0) return kFALSE;
245 //return (posnsTOF <= maxTOF);
248 // below 600 MeV: 4sigma
249 // above 600 MeV: 3sigma
251 if (pospTPC <= 0.6 && fPID==AliPID::kProton)
254 else if (pospTPC > 0.6 && fPID==AliPID::kProton)
263 if (! ((posnsTPC <= maxTPC) && (negnsTPC2 <= maxTPC2)) ) {
264 AliDebugClass(2, "Failed check on V0 PID");
271 if(fHypothesis==kLambda0Bar) {
273 // TPC: 5sigma cut for all
274 //if (negnsTPC > 5.0) return kFALSE;
277 //return (negnsTOF <= maxTOF);
280 // below 600 MeV: 4sigma
281 // above 600 MeV: 3sigma
283 if (negpTPC <= 0.6 && fPID==AliPID::kProton)
286 else if (negpTPC > 0.6 && fPID==AliPID::kProton)
295 if(! ((negnsTPC <= maxTPC) && (posnsTPC2 <= maxTPC2)) ) {
296 AliDebugClass(2, "Failed check on V0 PID");
303 // if we reach this point, all checks were successful
304 AliDebugClass(2, "Good V0 (hallelujah)");
308 //_________________________________________________________________________________________________
309 Bool_t AliRsnCutV0::CheckAOD(AliAODv0 *)
313 // This is done doing directly all checks, since there is not
314 // an equivalend checker for AOD tracks
317 AliWarning("Cuts is not yet implemented for AOD");
322 //_________________________________________________________________________________________________
323 void AliRsnCutV0::Print(const Option_t *) const
326 // Print information on this cut