]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutV0.cxx
introduce the option to analyze with PROOF, plus cosmetics
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutV0.cxx
CommitLineData
8082e538 1//
2// Class AliRsnCutV0
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#include <TFormula.h>
21#include <TBits.h>
22
23#include "AliLog.h"
24#include "AliESDtrackCuts.h"
25
26#include "AliRsnEvent.h"
27#include "AliRsnDaughter.h"
28#include "AliRsnCutV0.h"
29
30ClassImp(AliRsnCutV0)
31
32//_________________________________________________________________________________________________
33AliRsnCutV0::AliRsnCutV0(const char *name, Int_t hypothesis) :
34 AliRsnCut(name, AliRsnTarget::kDaughter),
35 fHypothesis(0),
36 fMass(0.0),
37 fTolerance(0.2),
38 fMaxDCAVertex(0.3),
39 fMinCosPointAngle(0.95),
40 fMaxDaughtersDCA(0.1),
41 fESDtrackCuts(0x0)
42{
43//
44// Default constructor.
45// Initializes all cuts in such a way that all of them are disabled.
46//
47
48 SetHypothesis(hypothesis);
49}
50
51//_________________________________________________________________________________________________
52AliRsnCutV0::AliRsnCutV0(const AliRsnCutV0 &copy) :
53 AliRsnCut(copy),
54 fHypothesis(copy.fHypothesis),
55 fMass(copy.fMass),
56 fTolerance(copy.fTolerance),
57 fMaxDCAVertex(copy.fMaxDCAVertex),
58 fMinCosPointAngle(copy.fMinCosPointAngle),
59 fMaxDaughtersDCA(copy.fMaxDaughtersDCA),
60 fESDtrackCuts(copy.fESDtrackCuts)
61{
62//
63// Copy constructor.
64// Just copy all data member values.
65//
66}
67
68//_________________________________________________________________________________________________
69AliRsnCutV0& AliRsnCutV0::operator=(const AliRsnCutV0 &copy)
70{
71//
72// Assignment operator.
73// Just copy all data member values.
74//
75
76
77 fHypothesis = copy.fHypothesis;
78 fMass = copy.fMass;
79 fTolerance = copy.fTolerance;
80 fMaxDCAVertex = copy.fMaxDCAVertex;
81 fMinCosPointAngle = copy.fMinCosPointAngle;
82 fMaxDaughtersDCA = copy.fMaxDaughtersDCA;
83 fESDtrackCuts = copy.fESDtrackCuts;
84
85 return (*this);
86}
87
88//_________________________________________________________________________________________________
89Bool_t AliRsnCutV0::IsSelected(TObject *object)
90{
91//
92// Cut checker.
93// Checks the type of object being evaluated
94// and then calls the appropriate sub-function (for ESD or AOD)
95//
96
97 // coherence check
98 if (!TargetOK(object)) return kFALSE;
99
100 // check cast
101 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
102 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
103 //cout << fDaughter->GetRef()->ClassName() << ' ' << v0esd << ' ' << v0aod << endl;
104
105 // operate depending on cast
106 if (v0esd) {
107 return CheckESD(v0esd);
108 } else if (v0aod) {
109 return CheckAOD(v0aod);
110 } else {
111 AliDebugClass(1, "Object is not a V0");
112 return kFALSE;
113 }
114}
115
116//_________________________________________________________________________________________________
117Bool_t AliRsnCutV0::CheckESD(AliESDv0 *v0)
118{
119//
120// Check an ESD V0.
121// This is done using the default track checker for ESD.
122// It is declared static, not to recreate it every time.
123//
124
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
129 }
130
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));
137
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);
143
144 // check quality cuts
145 if (fESDtrackCuts) {
146 AliDebugClass(2, "Checking quality cuts");
147 if (!fESDtrackCuts->IsSelected(pTrack)) {
148 AliDebugClass(2, "Positive daughter failed quality cuts");
149 return kFALSE;
150 }
151 if (!fESDtrackCuts->IsSelected(nTrack)) {
152 AliDebugClass(2, "Negative daughter failed quality cuts");
153 return kFALSE;
154 }
155 }
156
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");
160 // return kFALSE;
161 //}
162
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");
167 return kFALSE;
168 }
169
170 // topological checks
171 if (TMath::Abs(v0->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex)) > fMaxDCAVertex) {
172 AliDebugClass(2, "Failed check on DCA to primary vertes");
173 return kFALSE;
174 }
175 if (TMath::Abs(v0->GetV0CosineOfPointingAngle()) < fMinCosPointAngle) {
176 AliDebugClass(2, "Failed check on cosine of pointing angle");
177 return kFALSE;
178 }
179 if (TMath::Abs(v0->GetDcaV0Daughters()) > fMaxDaughtersDCA) {
180 AliDebugClass(2, "Failed check on DCA between daughters");
181 return kFALSE;
182 }
183
184 // if we reach this point, all checks were successful
185 AliDebugClass(2, "Good V0 (hallelujah)");
186 return kTRUE;
187}
188
189//_________________________________________________________________________________________________
375df156 190Bool_t AliRsnCutV0::CheckAOD(AliAODv0 *)
8082e538 191{
192//
193// Check an AOD V0.
194// This is done doing directly all checks, since there is not
195// an equivalend checker for AOD tracks
196//
197
198 AliWarning("Cuts is not yet implemented for AOD");
199
200 return kTRUE;
201}
202
203//_________________________________________________________________________________________________
204void AliRsnCutV0::Print(const Option_t *) const
205{
206//
207// Print information on this cut
208//
209}