]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnCutV0.cxx
Added AliRsnAction, AliRsnPIDRange
[u/mrichter/AliRoot.git] / PWGLF / 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//_________________________________________________________________________________________________
61f275d1 69AliRsnCutV0 &AliRsnCutV0::operator=(const AliRsnCutV0 &copy)
8082e538 70{
71//
72// Assignment operator.
73// Just copy all data member values.
74//
75
61f275d1 76 if (this == &copy)
77 return *this;
78
79 fHypothesis = copy.fHypothesis;
80 fMass = copy.fMass;
81 fTolerance = copy.fTolerance;
82 fMaxDCAVertex = copy.fMaxDCAVertex;
83 fMinCosPointAngle = copy.fMinCosPointAngle;
84 fMaxDaughtersDCA = copy.fMaxDaughtersDCA;
85 fESDtrackCuts = copy.fESDtrackCuts;
86
8082e538 87 return (*this);
88}
89
90//_________________________________________________________________________________________________
91Bool_t AliRsnCutV0::IsSelected(TObject *object)
92{
93//
94// Cut checker.
95// Checks the type of object being evaluated
96// and then calls the appropriate sub-function (for ESD or AOD)
97//
98
99 // coherence check
100 if (!TargetOK(object)) return kFALSE;
61f275d1 101
8082e538 102 // check cast
103 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
104 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
105 //cout << fDaughter->GetRef()->ClassName() << ' ' << v0esd << ' ' << v0aod << endl;
61f275d1 106
8082e538 107 // operate depending on cast
108 if (v0esd) {
109 return CheckESD(v0esd);
110 } else if (v0aod) {
111 return CheckAOD(v0aod);
112 } else {
113 AliDebugClass(1, "Object is not a V0");
114 return kFALSE;
115 }
116}
117
118//_________________________________________________________________________________________________
119Bool_t AliRsnCutV0::CheckESD(AliESDv0 *v0)
120{
121//
122// Check an ESD V0.
123// This is done using the default track checker for ESD.
124// It is declared static, not to recreate it every time.
125//
126
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
131 }
61f275d1 132
8082e538 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));
61f275d1 139
8082e538 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);
61f275d1 145
8082e538 146 // check quality cuts
147 if (fESDtrackCuts) {
148 AliDebugClass(2, "Checking quality cuts");
149 if (!fESDtrackCuts->IsSelected(pTrack)) {
150 AliDebugClass(2, "Positive daughter failed quality cuts");
151 return kFALSE;
152 }
153 if (!fESDtrackCuts->IsSelected(nTrack)) {
154 AliDebugClass(2, "Negative daughter failed quality cuts");
155 return kFALSE;
156 }
157 }
61f275d1 158
8082e538 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");
162 // return kFALSE;
163 //}
61f275d1 164
8082e538 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");
169 return kFALSE;
170 }
61f275d1 171
8082e538 172 // topological checks
173 if (TMath::Abs(v0->GetD(xPrimaryVertex, yPrimaryVertex, zPrimaryVertex)) > fMaxDCAVertex) {
174 AliDebugClass(2, "Failed check on DCA to primary vertes");
175 return kFALSE;
176 }
177 if (TMath::Abs(v0->GetV0CosineOfPointingAngle()) < fMinCosPointAngle) {
178 AliDebugClass(2, "Failed check on cosine of pointing angle");
179 return kFALSE;
180 }
181 if (TMath::Abs(v0->GetDcaV0Daughters()) > fMaxDaughtersDCA) {
182 AliDebugClass(2, "Failed check on DCA between daughters");
183 return kFALSE;
184 }
61f275d1 185
8082e538 186 // if we reach this point, all checks were successful
187 AliDebugClass(2, "Good V0 (hallelujah)");
61f275d1 188 return kTRUE;
8082e538 189}
190
191//_________________________________________________________________________________________________
375df156 192Bool_t AliRsnCutV0::CheckAOD(AliAODv0 *)
8082e538 193{
194//
195// Check an AOD V0.
196// This is done doing directly all checks, since there is not
197// an equivalend checker for AOD tracks
198//
199
200 AliWarning("Cuts is not yet implemented for AOD");
61f275d1 201
8082e538 202 return kTRUE;
203}
204
205//_________________________________________________________________________________________________
206void AliRsnCutV0::Print(const Option_t *) const
207{
208//
209// Print information on this cut
210//
211}