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.
77 fHypothesis = copy.fHypothesis;
79 fTolerance = copy.fTolerance;
80 fMaxDCAVertex = copy.fMaxDCAVertex;
81 fMinCosPointAngle = copy.fMinCosPointAngle;
82 fMaxDaughtersDCA = copy.fMaxDaughtersDCA;
83 fESDtrackCuts = copy.fESDtrackCuts;
88 //_________________________________________________________________________________________________
89 Bool_t AliRsnCutV0::IsSelected(TObject *object)
93 // Checks the type of object being evaluated
94 // and then calls the appropriate sub-function (for ESD or AOD)
98 if (!TargetOK(object)) return kFALSE;
101 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
102 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
103 //cout << fDaughter->GetRef()->ClassName() << ' ' << v0esd << ' ' << v0aod << endl;
105 // operate depending on cast
107 return CheckESD(v0esd);
109 return CheckAOD(v0aod);
111 AliDebugClass(1, "Object is not a V0");
116 //_________________________________________________________________________________________________
117 Bool_t AliRsnCutV0::CheckESD(AliESDv0 *v0)
121 // This is done using the default track checker for ESD.
122 // It is declared static, not to recreate it every time.
125 AliDebugClass(1, "Check ESD");
126 if (v0->GetOnFlyStatus()) {
127 AliDebugClass(1, "Rejecting V0 in 'on fly' status");
128 return kFALSE; // if kTRUE, then this V0 is recontructed
131 // retrieve pointer to owner event
132 AliESDEvent *lESDEvent = fEvent->GetRefESD();
133 Double_t xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
134 Double_t yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
135 Double_t zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
136 AliDebugClass(2, Form("Primary vertex: %f %f %f", xPrimaryVertex, yPrimaryVertex, zPrimaryVertex));
138 // retrieve the V0 daughters
139 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0->GetPindex());
140 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0->GetNindex());
141 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
142 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
144 // check quality cuts
146 AliDebugClass(2, "Checking quality cuts");
147 if (!fESDtrackCuts->IsSelected(pTrack)) {
148 AliDebugClass(2, "Positive daughter failed quality cuts");
151 if (!fESDtrackCuts->IsSelected(nTrack)) {
152 AliDebugClass(2, "Negative daughter failed quality cuts");
157 // filter like-sign V0
158 //if ((TMath::Abs(pTrack->GetSign()) - TMath::Abs(nTrack->GetSign()) ) < 0.1) {
159 // AliDebugClass(2, "Failed like-sign V0 check");
163 // check compatibility with expected species hypothesis
164 v0->ChangeMassHypothesis(fHypothesis);
165 if ((TMath::Abs(v0->GetEffMass() - fMass)) > fTolerance) {
166 AliDebugClass(2, "V0 is not in the expected inv mass range");
170 // topological checks
171 if (TMath::Abs(v0->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex)) > fMaxDCAVertex) {
172 AliDebugClass(2, "Failed check on DCA to primary vertes");
175 if (TMath::Abs(v0->GetV0CosineOfPointingAngle()) < fMinCosPointAngle) {
176 AliDebugClass(2, "Failed check on cosine of pointing angle");
179 if (TMath::Abs(v0->GetDcaV0Daughters()) > fMaxDaughtersDCA) {
180 AliDebugClass(2, "Failed check on DCA between daughters");
184 // if we reach this point, all checks were successful
185 AliDebugClass(2, "Good V0 (hallelujah)");
189 //_________________________________________________________________________________________________
190 Bool_t AliRsnCutV0::CheckAOD(AliAODv0 *)
194 // This is done doing directly all checks, since there is not
195 // an equivalend checker for AOD tracks
198 AliWarning("Cuts is not yet implemented for AOD");
203 //_________________________________________________________________________________________________
204 void AliRsnCutV0::Print(const Option_t *) const
207 // Print information on this cut