]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnValueDaughter.cxx
Added quantities for V0 daughters + modified cuts for V0 + modified cuts and train...
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnValueDaughter.cxx
CommitLineData
2895972e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16////////////////////////////////////////////////////////////////////////////////
17//
18// This class contains all code which is used to compute any of the values
19// which can be of interest within a resonance analysis. Besides the obvious
20// invariant mass, it allows to compute other utility values on all possible
21// targets, in order to allow a wide spectrum of binning and checks.
22// When needed, this object can also define a binning in the variable which
23// it is required to compute, which is used for initializing axes of output
24// histograms (see AliRsnFunction).
25// The value computation requires this object to be passed the object whose
26// informations will be used. This object can be of any allowed input type
27// (track, Daughter, event), then this class must inherit from AliRsnTarget.
28// Then, when value computation is attempted, a check on target type is done
29// and computation is successful only if expected target matches that of the
30// passed object.
31// In some cases, the value computation can require a support external object,
32// which must then be passed to this class. It can be of any type inheriting
33// from TObject.
34//
35// authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
36// M. Vala (martin.vala@cern.ch)
37//
38////////////////////////////////////////////////////////////////////////////////
39
b63357a0 40#include <Riostream.h>
2895972e 41#include "AliVVertex.h"
42#include "AliMultiplicity.h"
43#include "AliESDtrackCuts.h"
44#include "AliESDpid.h"
45#include "AliAODPid.h"
46#include "AliCentrality.h"
47#include "AliESDUtils.h"
b63357a0 48#include "AliPIDResponse.h"
2895972e 49
50#include "AliRsnEvent.h"
51#include "AliRsnDaughter.h"
52#include "AliRsnMother.h"
53#include "AliRsnDaughterDef.h"
54#include "AliRsnDaughterDef.h"
55
56#include "AliRsnValueDaughter.h"
57
58ClassImp(AliRsnValueDaughter)
59
60//_____________________________________________________________________________
61AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) :
62 AliRsnValue(name, AliRsnTarget::kDaughter),
63 fType(type)
64{
65//
66// Constructor
67//
68}
69
70//_____________________________________________________________________________
61f275d1 71AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter &copy) :
2895972e 72 AliRsnValue(copy),
73 fType(copy.fType)
74{
75//
76// Copy constructor
77//
78}
79
80//_____________________________________________________________________________
61f275d1 81AliRsnValueDaughter &AliRsnValueDaughter::operator=(const AliRsnValueDaughter &copy)
2895972e 82{
83//
84// Assignment operator.
85// Works like copy constructor.
86//
87
88 AliRsnValue::operator=(copy);
e6f3a909 89 if (this == &copy)
61f275d1 90 return *this;
2895972e 91 fType = copy.fType;
61f275d1 92
2895972e 93 return (*this);
94}
95
96//_____________________________________________________________________________
61f275d1 97const char *AliRsnValueDaughter::GetTypeName() const
2895972e 98{
99//
100// This method returns a string to give a name to each possible
101// computation value.
102//
103
104 switch (fType) {
92932daf 105 case kP: return "SingleTrackPtot";
106 case kPt: return "SingleTrackPt";
107 case kPtpc: return "SingleTrackPtpc";
108 case kEta: return "SingleTrackEta";
109 case kMass: return "SingleTrackMass";
110 case kITSsignal: return "SingleTrackITSsignal";
111 case kTPCsignal: return "SingleTrackTPCsignal";
112 case kTOFsignal: return "SingleTrackTOFsignal";
113 case kTPCnsigmaPi: return "SingleTrackTPCnsigmaPion";
114 case kTPCnsigmaK: return "SingleTrackTPCnsigmaKaon";
115 case kTPCnsigmaP: return "SingleTrackTPCnsigmaProton";
116 case kTOFnsigmaPi: return "SingleTrackTOFnsigmaPion";
117 case kTOFnsigmaK: return "SingleTrackTOFnsigmaKaon";
118 case kTOFnsigmaP: return "SingleTrackTOFnsigmaProton";
119 case kV0DCA: return "V0DCAToPrimaryVertex";
120 case kDaughterDCA: return "V0DaughterDCA";
121 case kCosPointAng: return "V0CosineOfPointingAngle";
122 case kLambdaProtonPIDCut: return "V0LambdaProtonNsigma";
123 case kAntiLambdaAntiProtonPIDCut: return "V0AntiLambdaAntiProtonNsigma";
124 case kLambdaPionPIDCut: return "V0LambdaPionNsigma";
125 case kAntiLambdaAntiPionPIDCut: return "V0AntiLambdaPionNsigma";
126 default: return "Undefined";
2895972e 127 }
128}
129
130//_____________________________________________________________________________
131Bool_t AliRsnValueDaughter::Eval(TObject *object)
132{
133//
134// Evaluation of the required value.
135// Checks that the passed object is of the right type
136// and if this check is successful, computes the required value.
137// The output of the function tells if computing was successful,
138// and the values must be taken with GetValue().
139//
61f275d1 140
141 // coherence check, which also casts object
2895972e 142 // to AliRsnTarget data members and returns kFALSE
143 // in case the object is NULL
144 if (!TargetOK(object)) return kFALSE;
145
146 // set a reference to the mother momentum
b63357a0 147 AliVParticle *ref = fDaughter->GetRef();
148 AliVParticle *refMC = fDaughter->GetRefMC();
2895972e 149 AliVTrack *track = fDaughter->Ref2Vtrack();
92932daf 150 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
151 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
152 AliESDEvent *lESDEvent = fEvent->GetRefESD();
153
154 Double_t xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
155 Double_t yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
156 Double_t zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
157
b63357a0 158 if (fUseMCInfo && !refMC) {
159 AliError("No MC");
160 return kFALSE;
161 }
162 if (!fUseMCInfo && !ref) {
163 AliError("No DATA");
164 return kFALSE;
165 }
61f275d1 166
2895972e 167 // compute value depending on types in the enumeration
168 // if the type does not match any available choice, or if
169 // the computation is not doable due to any problem
170 // (not initialized support object, wrong values, risk of floating point errors)
171 // the method returng kFALSE and sets the computed value to a meaningless number
172 switch (fType) {
173 case kP:
b63357a0 174 fComputedValue = (fUseMCInfo ? refMC->P() : ref->P());
2895972e 175 return kTRUE;
176 case kPt:
b63357a0 177 fComputedValue = (fUseMCInfo ? refMC->Pt() : ref->Pt());
2895972e 178 return kTRUE;
179 case kEta:
b63357a0 180 fComputedValue = (fUseMCInfo ? refMC->Eta() : ref->Eta());
2895972e 181 return kTRUE;
b154f736 182 case kMass:
e6952ec7 183 fComputedValue = (fUseMCInfo ? refMC->M() : ref->M());
b154f736 184 return kTRUE;
2895972e 185 case kPtpc:
186 if (track) {
187 fComputedValue = track->GetTPCmomentum();
188 return kTRUE;
189 } else {
190 AliWarning("Cannot get TPC momentum for non-track object");
191 fComputedValue = 0.0;
192 return kFALSE;
193 }
194 case kITSsignal:
195 if (track) {
196 fComputedValue = track->GetITSsignal();
197 return kTRUE;
198 } else {
199 AliWarning("Cannot get ITS signal for non-track object");
200 fComputedValue = 0.0;
201 return kFALSE;
202 }
203 case kTPCsignal:
204 if (track) {
205 fComputedValue = track->GetTPCsignal();
206 return kTRUE;
207 } else {
208 AliWarning("Cannot get TPC signal for non-track object");
209 fComputedValue = 0.0;
210 return kFALSE;
211 }
212 case kTOFsignal:
213 if (track) {
214 fComputedValue = track->GetTOFsignal();
215 return kTRUE;
216 } else {
217 AliWarning("Cannot get TOF signal for non-track object");
218 fComputedValue = 0.0;
219 return kFALSE;
220 }
52e6652d 221 case kTPCnsigmaPi:
222 if (track) {
223 AliPIDResponse *pid = fEvent->GetPIDResponse();
224 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kPion);
225 return kTRUE;
226 } else {
227 AliWarning("Cannot get TOF signal for non-track object");
228 fComputedValue = 0.0;
229 return kFALSE;
230 }
231 case kTPCnsigmaK:
232 if (track) {
233 AliPIDResponse *pid = fEvent->GetPIDResponse();
234 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kKaon);
235 return kTRUE;
236 } else {
237 AliWarning("Cannot get TOF signal for non-track object");
238 fComputedValue = 0.0;
239 return kFALSE;
240 }
241 case kTPCnsigmaP:
242 if (track) {
243 AliPIDResponse *pid = fEvent->GetPIDResponse();
244 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kProton);
245 return kTRUE;
246 } else {
247 AliWarning("Cannot get TOF signal for non-track object");
248 fComputedValue = 0.0;
249 return kFALSE;
250 }
b63357a0 251 case kTOFnsigmaPi:
252 if (track) {
253 AliPIDResponse *pid = fEvent->GetPIDResponse();
254 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kPion);
255 return kTRUE;
256 } else {
257 AliWarning("Cannot get TOF signal for non-track object");
258 fComputedValue = 0.0;
259 return kFALSE;
260 }
261 case kTOFnsigmaK:
262 if (track) {
263 AliPIDResponse *pid = fEvent->GetPIDResponse();
264 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kKaon);
265 return kTRUE;
266 } else {
267 AliWarning("Cannot get TOF signal for non-track object");
268 fComputedValue = 0.0;
269 return kFALSE;
270 }
271 case kTOFnsigmaP:
272 if (track) {
273 AliPIDResponse *pid = fEvent->GetPIDResponse();
274 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kProton);
275 return kTRUE;
276 } else {
277 AliWarning("Cannot get TOF signal for non-track object");
278 fComputedValue = 0.0;
279 return kFALSE;
280 }
a83bcf6e 281 case kNITSclusters:
282 if (track) {
e6952ec7 283 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
284 if (trackESD) {
285 fComputedValue = trackESD->GetITSclusters(0);
286 } else {
287 fComputedValue = ((AliAODTrack *)track)->GetITSNcls();
288 }
a83bcf6e 289 return kTRUE;
290 } else {
291 AliWarning("Cannot get n ITS clusters for non-track object");
292 fComputedValue = 0.0;
293 return kFALSE;
294 }
295 case kNTPCclusters:
296 if (track) {
e6952ec7 297 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
298 if (trackESD) {
299 fComputedValue = trackESD->GetTPCclusters(0);
300 } else {
301 fComputedValue = ((AliAODTrack *)track)->GetTPCNcls();
302 }
a83bcf6e 303 return kTRUE;
304 } else {
305 AliWarning("Cannot get n TPC clusters for non-track object");
306 fComputedValue = 0.0;
307 return kFALSE;
308 }
309 case kITSchi2:
310 if (track) {
e6952ec7 311 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
312 if (trackESD) {
313 UShort_t nClustersITS = trackESD->GetITSclusters(0);
314 fComputedValue = trackESD->GetITSchi2()/Float_t(nClustersITS);
315 } else {
316 fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
317 }
a83bcf6e 318 return kTRUE;
319 } else {
320 AliWarning("Cannot get ITS chi^2 for non-track object");
321 fComputedValue = 0.0;
322 return kFALSE;
323 }
324 case kTPCchi2:
325 if (track) {
e6952ec7 326 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
327 if (trackESD) {
328 UShort_t nClustersTPC = trackESD->GetTPCclusters(0);
329 fComputedValue = trackESD->GetTPCchi2()/Float_t(nClustersTPC);
330 } else {
331 fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
332 }
a83bcf6e 333 return kTRUE;
334 } else {
335 AliWarning("Cannot get TPC chi^2 for non-track object");
336 fComputedValue = 0.0;
337 return kFALSE;
338 }
3d0e1672 339 case kDCAXY:
340 if (track) {
e6952ec7 341 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
342 if (trackESD) {
343 Float_t b[2], bCov[3];
344 trackESD->GetImpactParameters(b, bCov);
345 fComputedValue = b[0];
346 } else {
347 Double_t b[2]= {-999,-999}, cov[3];
348 AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
349 if(vertex) {
350 track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
351 fComputedValue = b[0];
352 } else {
353 fComputedValue = -999;
354 }
355 }
3d0e1672 356 return kTRUE;
357 } else {
358 AliWarning("Cannot get TPC chi^2 for non-track object");
359 fComputedValue = 0.0;
360 return kFALSE;
361 }
362 case kDCAZ:
363 if (track) {
e6952ec7 364 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
365 if (trackESD) {
366 Float_t b[2], bCov[3];
367 trackESD->GetImpactParameters(b, bCov);
368 fComputedValue = b[1];
369 } else {
370 Double_t b[2]= {-999,-999}, cov[3];
371 AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
372 if(vertex) {
373 track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
374 fComputedValue = b[1];
375 } else {
376 fComputedValue = -999;
377 }
3d0e1672 378
e6952ec7 379 }
3d0e1672 380 return kTRUE;
381 } else {
382 AliWarning("Cannot get TPC chi^2 for non-track object");
383 fComputedValue = 0.0;
384 return kFALSE;
385 }
92932daf 386 case kV0DCA:
387 if(v0esd) {
388 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
389 fComputedValue = v0ESD->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
390 return kTRUE;
391 }
392 if(v0aod) {
393 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
394 fComputedValue = v0AOD->DcaV0ToPrimVertex();
395 return kTRUE;
396 }
397 else {
398 fComputedValue = -999;
399 return kFALSE;
400 }
401 case kDaughterDCA:
402 if(v0esd) {
403 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
404 fComputedValue = v0ESD->GetDcaV0Daughters();
405 return kTRUE;
406 }
407 if(v0aod) {
408 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
409 fComputedValue = v0AOD->DcaV0Daughters();
410 return kTRUE;
411 }
412 else {
413 fComputedValue = -999;
414 return kFALSE;
415 }
416 case kCosPointAng:
417 if(v0esd) {
418 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
419 fComputedValue = v0ESD->GetV0CosineOfPointingAngle();
420 return kTRUE;
421 }
422 if(v0aod) {
423 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
424 fComputedValue = TMath::Cos(v0AOD->OpenAngleV0());
425 return kTRUE;
426 }
427 else {
428 fComputedValue = -999;
429 return kFALSE;
430 }
431 case kLambdaProtonPIDCut:
432 if(v0esd) {
433 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
434 // retrieve the V0 daughters
435 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0ESD->GetPindex());
436 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
437 AliPIDResponse *pid = fEvent->GetPIDResponse();
438 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
439 return kTRUE;
440 }
441 if(v0aod) {
442 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
443 AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
444 AliPIDResponse *pid = fEvent->GetPIDResponse();
445 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
446 return kTRUE;
447 }
448 else {
449 fComputedValue = -999;
450 return kFALSE;
451 }
452 case kAntiLambdaAntiProtonPIDCut:
453 if(v0esd) {
454 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
455 // retrieve the V0 daughters
456 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0ESD->GetNindex());
457 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
458 AliPIDResponse *pid = fEvent->GetPIDResponse();
459 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
460 return kTRUE;
461 }
462 if(v0aod) {
463 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
464 AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
465 AliPIDResponse *pid = fEvent->GetPIDResponse();
466 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
467 return kTRUE;
468 }
469 else {
470 fComputedValue = -999;
471 return kFALSE;
472 }
473 case kLambdaPionPIDCut:
474 if(v0esd) {
475 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
476 // retrieve the V0 daughters
477 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0ESD->GetNindex());
478 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
479 AliPIDResponse *pid = fEvent->GetPIDResponse();
480 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
481 return kTRUE;
482 }
483 if(v0aod) {
484 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
485 AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
486 AliPIDResponse *pid = fEvent->GetPIDResponse();
487 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
488 return kTRUE;
489 }
490 else {
491 fComputedValue = -999;
492 return kFALSE;
493 }
494 case kAntiLambdaAntiPionPIDCut:
495 if(v0esd) {
496 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
497 // retrieve the V0 daughters
498 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0ESD->GetPindex());
499 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
500 AliPIDResponse *pid = fEvent->GetPIDResponse();
501 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
502 return kTRUE;
503 }
504 if(v0aod) {
505 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
506 AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
507 AliPIDResponse *pid = fEvent->GetPIDResponse();
508 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
509 return kTRUE;
510 }
511 else {
512 fComputedValue = -999;
8ddd6d70 513 return kFALSE;
92932daf 514 }
515
516
2895972e 517 default:
518 AliError(Form("[%s] Invalid value type for this computation", GetName()));
519 return kFALSE;
520 }
521}