AliRoot Core  edcc906 (edcc906)
AliAODpidUtil.cxx
Go to the documentation of this file.
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 /* $Id: AliAODpidUtil.cxx 38329 2010-01-17 19:17:24Z hristov $ */
17 
18 //-----------------------------------------------------------------
19 // Implementation of the combined PID class
20 // For the AOD Class
21 // containing information on the particle identification
22 // Origin: Rosa Romita, GSI, r.romita@gsi.de
23 //-----------------------------------------------------------------
24 
25 #include "AliLog.h"
26 #include "AliAODpidUtil.h"
27 #include "AliAODEvent.h"
28 #include "AliAODTrack.h"
29 #include "AliAODPid.h"
30 
31 ClassImp(AliAODpidUtil)
32 
33 
34 //_________________________________________________________________________
35 Float_t AliAODpidUtil::GetSignalDeltaTOFold(const AliVParticle *vtrack, AliPID::EParticleType type, Bool_t ratio/*=kFALSE*/) const
36 {
37  //
38  // Number of sigma implementation for the TOF
39  //
40 
41  AliAODTrack *track=(AliAODTrack*)vtrack;
42  AliAODPid *pidObj = track->GetDetPid();
43  if (!pidObj) return -9999.;
44  Double_t tofTime = 99999;
45  if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
46  else tofTime=pidObj->GetTOFsignal();
47  const Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
48  Double_t sigmaTOFPid[AliPID::kSPECIES];
49  pidObj->GetTOFpidResolution(sigmaTOFPid);
50  AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
51  if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer
52  AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
53  if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD
54  tofTime -= fTOFResponse.GetStartTime(vtrack->P());
55  }
56  } else {
57  AliError("pointer to AliAODEvent not found, please call GetTrack to set it");
58  return -9999.;
59  }
60 
61  Double_t delta=-9999.;
62 
63  if (!ratio) delta=tofTime-expTime;
64  else if (expTime>1.e-20) delta=tofTime/expTime;
65 
66  return delta;
67 }
68 
69 //_________________________________________________________________________
71 {
72  //
73  // Number of sigma implementation for the TOF
74  //
75 
76  AliAODTrack *track=(AliAODTrack*)vtrack;
77 
78  Bool_t oldAod=kTRUE;
79  Double_t sigTOF=0.;
80  AliAODPid *pidObj = track->GetDetPid();
81  if (!pidObj) return -999.;
82  Double_t tofTime = 99999;
83  if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
84  else tofTime=pidObj->GetTOFsignal();
85  Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type);
86  Double_t sigmaTOFPid[AliPID::kSPECIES];
87  pidObj->GetTOFpidResolution(sigmaTOFPid);
88  AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
89  if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer
90  AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
91  if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD
92  sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent
93  tofTime -= fTOFResponse.GetStartTime(vtrack->P());
94  oldAod=kFALSE;
95  }
96  } else {
97  AliError("pointer to AliAODEvent not found, please call GetTrack to set it");
98  return -996.;
99  }
100  if (oldAod) { // old AOD
101  if (type <= AliPID::kProton) {
102  sigTOF=sigmaTOFPid[type];
103  } else return -998.; // light nuclei cannot be supported on old AOD because we don't have timeZero resolution
104  }
105  if (sigTOF>0) return (tofTime - expTime)/sigTOF;
106  else return -997.;
107 }
Double_t GetExpectedSignal(const AliVTrack *track, AliPID::EParticleType type) const
virtual Double_t P() const
Definition: AliAODTrack.h:125
virtual Double_t P() const =0
EParticleType
Definition: AliPID.h:27
AliTPCfastTrack * track
Double_t GetTOFsignal() const
Definition: AliAODPid.h:68
virtual Float_t GetTOFsignalTunedOnData(const AliVTrack *t) const
AliTOFPIDResponse fTOFResponse
virtual Float_t GetNumberOfSigmasTOFold(const AliVParticle *vtrack, AliPID::EParticleType type) const
Definition: AliPID.h:19
Double_t GetExpectedSigma(Float_t mom, Float_t tof, Float_t massZ) const
const AliAODEvent * GetAODEvent() const
Definition: AliAODTrack.h:365
Float_t GetStartTime(Float_t mom) const
AliAODPid * GetDetPid() const
Definition: AliAODTrack.h:370
void GetTOFpidResolution(Double_t tofRes[5]) const
Definition: AliAODPid.cxx:165
#define AliError(message)
Definition: AliLog.h:591
static Float_t ParticleMassZ(Int_t iType)
Definition: AliPID.h:60