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 AliRsnCut(name, AliRsnTarget::kDaughter),
39 fMinCosPointAngle(0.95),
40 fMaxDaughtersDCA(0.1),
44 // Default constructor.
45 // Initializes all cuts in such a way that all of them are disabled.
48 SetHypothesis(hypothesis);
51 //_________________________________________________________________________________________________
52 AliRsnCutV0::AliRsnCutV0(const AliRsnCutV0 ©) :
54 fHypothesis(copy.fHypothesis),
56 fTolerance(copy.fTolerance),
57 fMaxDCAVertex(copy.fMaxDCAVertex),
58 fMinCosPointAngle(copy.fMinCosPointAngle),
59 fMaxDaughtersDCA(copy.fMaxDaughtersDCA),
60 fESDtrackCuts(copy.fESDtrackCuts)
64 // Just copy all data member values.
68 //_________________________________________________________________________________________________
69 AliRsnCutV0 &AliRsnCutV0::operator=(const AliRsnCutV0 ©)
72 // Assignment operator.
73 // Just copy all data member values.
79 fHypothesis = copy.fHypothesis;
81 fTolerance = copy.fTolerance;
82 fMaxDCAVertex = copy.fMaxDCAVertex;
83 fMinCosPointAngle = copy.fMinCosPointAngle;
84 fMaxDaughtersDCA = copy.fMaxDaughtersDCA;
85 fESDtrackCuts = copy.fESDtrackCuts;
90 //_________________________________________________________________________________________________
91 Bool_t AliRsnCutV0::IsSelected(TObject *object)
95 // Checks the type of object being evaluated
96 // and then calls the appropriate sub-function (for ESD or AOD)
100 if (!TargetOK(object)) return kFALSE;
103 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
104 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
105 //cout << fDaughter->GetRef()->ClassName() << ' ' << v0esd << ' ' << v0aod << endl;
107 // operate depending on cast
109 return CheckESD(v0esd);
111 return CheckAOD(v0aod);
113 AliDebugClass(1, "Object is not a V0");
118 //_________________________________________________________________________________________________
119 Bool_t AliRsnCutV0::CheckESD(AliESDv0 *v0)
123 // This is done using the default track checker for ESD.
124 // It is declared static, not to recreate it every time.
127 AliDebugClass(1, "Check ESD");
128 if (v0->GetOnFlyStatus()) {
129 AliDebugClass(1, "Rejecting V0 in 'on fly' status");
130 return kFALSE; // if kTRUE, then this V0 is recontructed
133 // retrieve pointer to owner event
134 AliESDEvent *lESDEvent = fEvent->GetRefESD();
135 Double_t xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
136 Double_t yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
137 Double_t zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
138 AliDebugClass(2, Form("Primary vertex: %f %f %f", xPrimaryVertex, yPrimaryVertex, zPrimaryVertex));
140 // retrieve the V0 daughters
141 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0->GetPindex());
142 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0->GetNindex());
143 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
144 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
146 // check quality cuts
148 AliDebugClass(2, "Checking quality cuts");
149 if (!fESDtrackCuts->IsSelected(pTrack)) {
150 AliDebugClass(2, "Positive daughter failed quality cuts");
153 if (!fESDtrackCuts->IsSelected(nTrack)) {
154 AliDebugClass(2, "Negative daughter failed quality cuts");
159 // filter like-sign V0
160 //if ((TMath::Abs(pTrack->GetSign()) - TMath::Abs(nTrack->GetSign()) ) < 0.1) {
161 // AliDebugClass(2, "Failed like-sign V0 check");
165 // check compatibility with expected species hypothesis
166 v0->ChangeMassHypothesis(fHypothesis);
167 if ((TMath::Abs(v0->GetEffMass() - fMass)) > fTolerance) {
168 AliDebugClass(2, "V0 is not in the expected inv mass range");
172 // topological checks
173 if (TMath::Abs(v0->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex)) > fMaxDCAVertex) {
174 AliDebugClass(2, "Failed check on DCA to primary vertes");
177 if (TMath::Abs(v0->GetV0CosineOfPointingAngle()) < fMinCosPointAngle) {
178 AliDebugClass(2, "Failed check on cosine of pointing angle");
181 if (TMath::Abs(v0->GetDcaV0Daughters()) > fMaxDaughtersDCA) {
182 AliDebugClass(2, "Failed check on DCA between daughters");
186 // if we reach this point, all checks were successful
187 AliDebugClass(2, "Good V0 (hallelujah)");
191 //_________________________________________________________________________________________________
192 Bool_t AliRsnCutV0::CheckAOD(AliAODv0 *)
196 // This is done doing directly all checks, since there is not
197 // an equivalend checker for AOD tracks
200 AliWarning("Cuts is not yet implemented for AOD");
205 //_________________________________________________________________________________________________
206 void AliRsnCutV0::Print(const Option_t *) const
209 // Print information on this cut