1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////////
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
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
35 // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
36 // M. Vala (martin.vala@cern.ch)
38 ////////////////////////////////////////////////////////////////////////////////
40 #include <Riostream.h>
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"
48 #include "AliPIDResponse.h"
50 #include "AliRsnEvent.h"
51 #include "AliRsnDaughter.h"
52 #include "AliRsnMother.h"
53 #include "AliRsnDaughterDef.h"
54 #include "AliRsnDaughterDef.h"
56 #include "AliRsnValueDaughter.h"
58 ClassImp(AliRsnValueDaughter)
60 //_____________________________________________________________________________
61 AliRsnValueDaughter::AliRsnValueDaughter(const char *name, EType type) :
62 AliRsnValue(name, AliRsnTarget::kDaughter),
70 //_____________________________________________________________________________
71 AliRsnValueDaughter::AliRsnValueDaughter(const AliRsnValueDaughter ©) :
80 //_____________________________________________________________________________
81 AliRsnValueDaughter &AliRsnValueDaughter::operator=(const AliRsnValueDaughter ©)
84 // Assignment operator.
85 // Works like copy constructor.
88 AliRsnValue::operator=(copy);
96 //_____________________________________________________________________________
97 const char *AliRsnValueDaughter::GetTypeName() const
100 // This method returns a string to give a name to each possible
101 // computation value.
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 kCharge: return "SingleTrackCharge";
120 case kPhi: return "SingleTrackPhi";
121 case kPhiOuterTPC: return "SingleTrackPhiOuterTPC";
122 case kV0DCA: return "V0DCAToPrimaryVertex";
123 case kDaughterDCA: return "V0DaughterDCA";
124 case kCosPointAng: return "V0CosineOfPointingAngle";
125 case kLambdaProtonPIDCut: return "V0LambdaProtonNsigma";
126 case kAntiLambdaAntiProtonPIDCut: return "V0AntiLambdaAntiProtonNsigma";
127 case kLambdaPionPIDCut: return "V0LambdaPionNsigma";
128 case kAntiLambdaAntiPionPIDCut: return "V0AntiLambdaPionNsigma";
129 default: return "Undefined";
133 //_____________________________________________________________________________
134 Bool_t AliRsnValueDaughter::Eval(TObject *object)
137 // Evaluation of the required value.
138 // Checks that the passed object is of the right type
139 // and if this check is successful, computes the required value.
140 // The output of the function tells if computing was successful,
141 // and the values must be taken with GetValue().
144 // coherence check, which also casts object
145 // to AliRsnTarget data members and returns kFALSE
146 // in case the object is NULL
147 if (!TargetOK(object)) return kFALSE;
149 // set a reference to the mother momentum
150 AliVParticle *ref = fDaughter->GetRef();
151 AliVParticle *refMC = fDaughter->GetRefMC();
152 AliVTrack *track = fDaughter->Ref2Vtrack();
153 AliESDv0 *v0esd = fDaughter->Ref2ESDv0();
154 AliAODv0 *v0aod = fDaughter->Ref2AODv0();
155 AliESDEvent *lESDEvent = fEvent->GetRefESD();
157 Double_t xPrimaryVertex = -999.9;
158 Double_t yPrimaryVertex = -999.9;
159 Double_t zPrimaryVertex = -999.9;
163 xPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetX();
164 yPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetY();
165 zPrimaryVertex = lESDEvent->GetPrimaryVertex()->GetZ();
169 if (fUseMCInfo && !refMC) {
173 if (!fUseMCInfo && !ref) {
178 // compute value depending on types in the enumeration
179 // if the type does not match any available choice, or if
180 // the computation is not doable due to any problem
181 // (not initialized support object, wrong values, risk of floating point errors)
182 // the method returng kFALSE and sets the computed value to a meaningless number
185 fComputedValue = (fUseMCInfo ? refMC->P() : ref->P());
188 fComputedValue = (fUseMCInfo ? refMC->Pt() : ref->Pt());
191 fComputedValue = (fUseMCInfo ? refMC->Eta() : ref->Eta());
194 fComputedValue = (fUseMCInfo ? refMC->M() : ref->M());
198 fComputedValue = track->GetTPCmomentum();
201 AliWarning("Cannot get TPC momentum for non-track object");
202 fComputedValue = 0.0;
207 fComputedValue = track->GetITSsignal();
210 AliWarning("Cannot get ITS signal for non-track object");
211 fComputedValue = 0.0;
216 fComputedValue = track->GetTPCsignal();
219 AliWarning("Cannot get TPC signal for non-track object");
220 fComputedValue = 0.0;
225 fComputedValue = track->GetTOFsignal();
228 AliWarning("Cannot get TOF signal for non-track object");
229 fComputedValue = 0.0;
234 AliPIDResponse *pid = fEvent->GetPIDResponse();
235 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kPion);
238 AliWarning("Cannot get TOF signal for non-track object");
239 fComputedValue = 0.0;
244 AliPIDResponse *pid = fEvent->GetPIDResponse();
245 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kKaon);
248 AliWarning("Cannot get TOF signal for non-track object");
249 fComputedValue = 0.0;
254 AliPIDResponse *pid = fEvent->GetPIDResponse();
255 fComputedValue = pid->NumberOfSigmasTPC(track, AliPID::kProton);
258 AliWarning("Cannot get TOF signal for non-track object");
259 fComputedValue = 0.0;
264 AliPIDResponse *pid = fEvent->GetPIDResponse();
265 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kPion);
268 AliWarning("Cannot get TOF signal for non-track object");
269 fComputedValue = 0.0;
274 AliPIDResponse *pid = fEvent->GetPIDResponse();
275 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kKaon);
278 AliWarning("Cannot get TOF signal for non-track object");
279 fComputedValue = 0.0;
284 AliPIDResponse *pid = fEvent->GetPIDResponse();
285 fComputedValue = pid->NumberOfSigmasTOF(track, AliPID::kProton);
288 AliWarning("Cannot get TOF signal for non-track object");
289 fComputedValue = 0.0;
294 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
296 fComputedValue = trackESD->GetITSclusters(0);
298 fComputedValue = ((AliAODTrack *)track)->GetITSNcls();
302 AliWarning("Cannot get n ITS clusters for non-track object");
303 fComputedValue = 0.0;
308 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
310 fComputedValue = trackESD->GetTPCclusters(0);
312 fComputedValue = ((AliAODTrack *)track)->GetTPCNcls();
316 AliWarning("Cannot get n TPC clusters for non-track object");
317 fComputedValue = 0.0;
322 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
324 UShort_t nClustersITS = trackESD->GetITSclusters(0);
325 fComputedValue = trackESD->GetITSchi2()/Float_t(nClustersITS);
327 fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
331 AliWarning("Cannot get ITS chi^2 for non-track object");
332 fComputedValue = 0.0;
337 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
339 UShort_t nClustersTPC = trackESD->GetTPCclusters(0);
340 fComputedValue = trackESD->GetTPCchi2()/Float_t(nClustersTPC);
342 fComputedValue = ((AliAODTrack *)track)->Chi2perNDF();
346 AliWarning("Cannot get TPC chi^2 for non-track object");
347 fComputedValue = 0.0;
352 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
354 Float_t b[2], bCov[3];
355 trackESD->GetImpactParameters(b, bCov);
356 fComputedValue = b[0];
358 Double_t b[2]= {-999,-999}, cov[3];
359 AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
361 track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
362 fComputedValue = b[0];
364 fComputedValue = -999;
369 AliWarning("Cannot get TPC chi^2 for non-track object");
370 fComputedValue = 0.0;
375 AliESDtrack *trackESD = dynamic_cast<AliESDtrack *>(track);
377 Float_t b[2], bCov[3];
378 trackESD->GetImpactParameters(b, bCov);
379 fComputedValue = b[1];
381 Double_t b[2]= {-999,-999}, cov[3];
382 AliAODVertex *vertex = fEvent->GetRefAOD()->GetPrimaryVertex();
384 track->PropagateToDCA(vertex, fEvent->GetRefAOD()->GetMagneticField(),kVeryBig, b, cov);
385 fComputedValue = b[1];
387 fComputedValue = -999;
393 AliWarning("Cannot get TPC chi^2 for non-track object");
394 fComputedValue = 0.0;
399 fComputedValue = (fUseMCInfo ? refMC->Charge() : ref->Charge());
403 fComputedValue = (fUseMCInfo ? (refMC->Phi()*TMath::RadToDeg()) : (ref->Phi()*TMath::RadToDeg()));
408 Double_t pos[3]={0.,0.,0.};
409 Double_t phiOut = -999.0;
410 Double_t radius = 278.;//TPC outer (vessel) = 278 cm, TOF radius (active surf.) = 378 cm; ref. PPR.1
411 AliExternalTrackParam etp; //thanks to Andrea and Cristina
412 etp.CopyFromVTrack(track);
413 if(etp.GetXYZAt(radius, 5., pos)){
414 phiOut=TMath::ATan2(pos[1],pos[0])*TMath::RadToDeg();
415 if (phiOut<0) phiOut+= (2*TMath::Pi()*TMath::RadToDeg());
417 fComputedValue = phiOut;
419 AliWarning("Cannot get phi at outer TPC radius for non-track object");
420 fComputedValue = -99.0;
427 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
428 fComputedValue = v0ESD->GetD(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
432 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
433 fComputedValue = v0AOD->DcaV0ToPrimVertex();
437 fComputedValue = -999;
442 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
443 fComputedValue = v0ESD->GetDcaV0Daughters();
447 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
448 fComputedValue = v0AOD->DcaV0Daughters();
452 fComputedValue = -999;
457 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
458 fComputedValue = v0ESD->GetV0CosineOfPointingAngle();
462 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
463 fComputedValue = TMath::Cos(v0AOD->OpenAngleV0());
467 fComputedValue = -999;
470 case kLambdaProtonPIDCut:
471 if(v0esd && lESDEvent) {
472 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
473 // retrieve the V0 daughters
474 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0ESD->GetPindex());
475 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
476 AliPIDResponse *pid = fEvent->GetPIDResponse();
477 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
481 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
482 AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
483 AliPIDResponse *pid = fEvent->GetPIDResponse();
484 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kProton));
488 fComputedValue = -999;
491 case kAntiLambdaAntiProtonPIDCut:
492 if(v0esd && lESDEvent) {
493 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
494 // retrieve the V0 daughters
495 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0ESD->GetNindex());
496 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
497 AliPIDResponse *pid = fEvent->GetPIDResponse();
498 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
502 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
503 AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
504 AliPIDResponse *pid = fEvent->GetPIDResponse();
505 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kProton));
509 fComputedValue = -999;
512 case kLambdaPionPIDCut:
513 if(v0esd && lESDEvent) {
514 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
515 // retrieve the V0 daughters
516 UInt_t lIdxNeg = (UInt_t) TMath::Abs(v0ESD->GetNindex());
517 AliESDtrack *nTrack = lESDEvent->GetTrack(lIdxNeg);
518 AliPIDResponse *pid = fEvent->GetPIDResponse();
519 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
523 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
524 AliAODTrack *nTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(1));
525 AliPIDResponse *pid = fEvent->GetPIDResponse();
526 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(nTrack, AliPID::kPion));
530 fComputedValue = -999;
533 case kAntiLambdaAntiPionPIDCut:
534 if(v0esd && lESDEvent) {
535 AliESDv0 *v0ESD = dynamic_cast<AliESDv0 *>(v0esd);
536 // retrieve the V0 daughters
537 UInt_t lIdxPos = (UInt_t) TMath::Abs(v0ESD->GetPindex());
538 AliESDtrack *pTrack = lESDEvent->GetTrack(lIdxPos);
539 AliPIDResponse *pid = fEvent->GetPIDResponse();
540 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
544 AliAODv0 *v0AOD = dynamic_cast<AliAODv0 *>(v0aod);
545 AliAODTrack *pTrack = (AliAODTrack *) (v0AOD->GetSecondaryVtx()->GetDaughter(0));
546 AliPIDResponse *pid = fEvent->GetPIDResponse();
547 fComputedValue = TMath::Abs(pid->NumberOfSigmasTPC(pTrack, AliPID::kPion));
551 fComputedValue = -999;
557 AliError(Form("[%s] Invalid value type for this computation", GetName()));