]>
Commit | Line | Data |
---|---|---|
1423bac9 | 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 | ||
539a5a59 | 25 | #include "TRandom.h" |
1423bac9 | 26 | #include "AliLog.h" |
27 | #include "AliPID.h" | |
28 | #include "AliAODpidUtil.h" | |
29 | #include "AliAODEvent.h" | |
30 | #include "AliAODTrack.h" | |
31 | #include "AliAODPid.h" | |
32 | #include "AliTRDPIDResponse.h" | |
1c2fc6e0 | 33 | #include "AliESDtrack.h" |
539a5a59 | 34 | #include "AliAODMCHeader.h" |
35 | #include "AliAODMCParticle.h" | |
c53e310b | 36 | #include "AliTOFPIDParams.h" |
1423bac9 | 37 | |
00a38d07 | 38 | #include <AliDetectorPID.h> |
39 | ||
1423bac9 | 40 | ClassImp(AliAODpidUtil) |
41 | ||
1423bac9 | 42 | //_________________________________________________________________________ |
539a5a59 | 43 | Float_t AliAODpidUtil::GetTPCsignalTunedOnData(const AliVTrack *t) const { |
44 | AliAODTrack *track = (AliAODTrack *) t; | |
45 | Float_t dedx = track->GetTPCsignalTunedOnData(); | |
46 | if(dedx > 0) return dedx; | |
47 | ||
539a5a59 | 48 | dedx = t->GetTPCsignal(); |
49 | track->SetTPCsignalTunedOnData(dedx); | |
50 | ||
51 | if(dedx < 20) return dedx; | |
52 | ||
53 | ||
54 | AliPID::EParticleType type = AliPID::kPion; | |
55 | ||
56 | AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(track->GetAODEvent()->GetList()->FindObject(AliAODMCHeader::StdBranchName())); | |
57 | if (mcHeader) { | |
ed268b64 | 58 | |
539a5a59 | 59 | TClonesArray *mcArray = (TClonesArray*)track->GetAODEvent()->GetList()->FindObject(AliAODMCParticle::StdBranchName()); |
60 | ||
61 | Bool_t kGood = kTRUE; | |
ed268b64 | 62 | |
63 | if ( mcArray->At(TMath::Abs(t->GetLabel())) != NULL ) { // protects against label-0 tracks e.g. the initial proton for Phythia events | |
64 | Int_t iS = TMath::Abs(((AliAODMCParticle*)mcArray->At(TMath::Abs(t->GetLabel())))->GetPdgCode()); | |
65 | if(iS==AliPID::ParticleCode(AliPID::kElectron)){ | |
539a5a59 | 66 | type = AliPID::kElectron; |
ed268b64 | 67 | } |
68 | else if(iS==AliPID::ParticleCode(AliPID::kMuon)){ | |
539a5a59 | 69 | type = AliPID::kMuon; |
ed268b64 | 70 | } |
71 | else if(iS==AliPID::ParticleCode(AliPID::kPion)){ | |
539a5a59 | 72 | type = AliPID::kPion; |
ed268b64 | 73 | } |
74 | else if(iS==AliPID::ParticleCode(AliPID::kKaon)){ | |
539a5a59 | 75 | type = AliPID::kKaon; |
ed268b64 | 76 | } |
77 | else if(iS==AliPID::ParticleCode(AliPID::kProton)){ | |
539a5a59 | 78 | type = AliPID::kProton; |
ed268b64 | 79 | } |
80 | else if(iS==AliPID::ParticleCode(AliPID::kDeuteron)){ // d | |
539a5a59 | 81 | type = AliPID::kDeuteron; |
ed268b64 | 82 | } |
83 | else if(iS==AliPID::ParticleCode(AliPID::kTriton)){ // t | |
539a5a59 | 84 | type = AliPID::kTriton; |
ed268b64 | 85 | } |
86 | else if(iS==AliPID::ParticleCode(AliPID::kHe3)){ // 3He | |
539a5a59 | 87 | type = AliPID::kHe3; |
ed268b64 | 88 | } |
89 | else if(iS==AliPID::ParticleCode(AliPID::kAlpha)){ // 4He | |
539a5a59 | 90 | type = AliPID::kAlpha; |
ed268b64 | 91 | } |
539a5a59 | 92 | else |
93 | kGood = kFALSE; | |
ed268b64 | 94 | } else kGood = kFALSE; |
539a5a59 | 95 | |
96 | if(kGood){ | |
f85a3764 | 97 | //TODO maybe introduce different dEdxSources? |
87da0205 | 98 | Double_t bethe = fTPCResponse.GetExpectedSignal(track, type, AliTPCPIDResponse::kdEdxDefault, this->UseTPCEtaCorrection(), |
99 | this->UseTPCMultiplicityCorrection()); | |
100 | Double_t sigma = fTPCResponse.GetExpectedSigma(track, type, AliTPCPIDResponse::kdEdxDefault, this->UseTPCEtaCorrection(), | |
101 | this->UseTPCMultiplicityCorrection()); | |
f85a3764 | 102 | dedx = gRandom->Gaus(bethe,sigma); |
103 | ||
567624b5 | 104 | // if(iS == AliPID::ParticleCode(AliPID::kHe3) || iS == AliPID::ParticleCode(AliPID::kAlpha)) dedx *= 5; |
539a5a59 | 105 | } |
106 | ||
107 | } | |
108 | ||
109 | track->SetTPCsignalTunedOnData(dedx); | |
110 | return dedx; | |
111 | } | |
a2c30af1 | 112 | //_________________________________________________________________________ |
113 | Float_t AliAODpidUtil::GetTOFsignalTunedOnData(const AliVTrack *t) const { | |
114 | AliAODTrack *track = (AliAODTrack *) t; | |
115 | Double_t tofSignal = track->GetTOFsignalTunedOnData(); | |
116 | ||
117 | if(tofSignal < 99999) return (Float_t)tofSignal; // it has been already set | |
c53e310b | 118 | |
119 | // read additional mismatch fraction | |
120 | Float_t addmism = GetTOFPIDParams()->GetTOFadditionalMismForMC(); | |
121 | if(addmism > 1.){ | |
122 | Float_t centr = GetCurrentCentrality(); | |
123 | if(centr > 50) addmism *= 0.1667; | |
124 | else if(centr > 20) addmism *= 0.33; | |
125 | } | |
126 | ||
a2c30af1 | 127 | AliAODPid *pidObj = track->GetDetPid(); |
c53e310b | 128 | tofSignal = pidObj->GetTOFsignal() + fTOFResponse.GetTailRandomValue(t->Pt(),t->Eta(),pidObj->GetTOFsignal(),addmism); |
a2c30af1 | 129 | track->SetTOFsignalTunedOnData(tofSignal); |
130 | return (Float_t)tofSignal; | |
131 | } | |
567624b5 | 132 | |
133 | //_________________________________________________________________________ | |
1d59271b | 134 | Float_t AliAODpidUtil::GetSignalDeltaTOFold(const AliVParticle *vtrack, AliPID::EParticleType type, Bool_t ratio/*=kFALSE*/) const |
567624b5 | 135 | { |
136 | // | |
137 | // Number of sigma implementation for the TOF | |
138 | // | |
139 | ||
140 | AliAODTrack *track=(AliAODTrack*)vtrack; | |
567624b5 | 141 | AliAODPid *pidObj = track->GetDetPid(); |
142 | if (!pidObj) return -9999.; | |
a2c30af1 | 143 | Double_t tofTime = 99999; |
144 | if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack); | |
145 | else tofTime=pidObj->GetTOFsignal(); | |
567624b5 | 146 | const Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type); |
147 | Double_t sigmaTOFPid[AliPID::kSPECIES]; | |
148 | pidObj->GetTOFpidResolution(sigmaTOFPid); | |
149 | AliAODEvent *event=(AliAODEvent*)track->GetAODEvent(); | |
150 | if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer | |
151 | AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader(); | |
152 | if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD | |
153 | tofTime -= fTOFResponse.GetStartTime(vtrack->P()); | |
154 | } | |
155 | } else { | |
156 | AliError("pointer to AliAODEvent not found, please call GetTrack to set it"); | |
157 | return -9999.; | |
158 | } | |
1d59271b | 159 | |
160 | Double_t delta=-9999.; | |
161 | ||
162 | if (!ratio) delta=tofTime-expTime; | |
163 | else if (expTime>1.e-20) delta=tofTime/expTime; | |
567624b5 | 164 | |
1d59271b | 165 | return delta; |
567624b5 | 166 | } |
167 | ||
00a38d07 | 168 | //_________________________________________________________________________ |
355b831b | 169 | Float_t AliAODpidUtil::GetNumberOfSigmasTOFold(const AliVParticle *vtrack, AliPID::EParticleType type) const |
00a38d07 | 170 | { |
171 | // | |
172 | // Number of sigma implementation for the TOF | |
173 | // | |
174 | ||
175 | AliAODTrack *track=(AliAODTrack*)vtrack; | |
176 | ||
00a38d07 | 177 | Bool_t oldAod=kTRUE; |
567624b5 | 178 | Double_t sigTOF=0.; |
00a38d07 | 179 | AliAODPid *pidObj = track->GetDetPid(); |
180 | if (!pidObj) return -999.; | |
a2c30af1 | 181 | Double_t tofTime = 99999; |
182 | if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack); | |
183 | else tofTime=pidObj->GetTOFsignal(); | |
00a38d07 | 184 | Double_t expTime=fTOFResponse.GetExpectedSignal((AliVTrack*)vtrack,type); |
185 | Double_t sigmaTOFPid[AliPID::kSPECIES]; | |
186 | pidObj->GetTOFpidResolution(sigmaTOFPid); | |
187 | AliAODEvent *event=(AliAODEvent*)track->GetAODEvent(); | |
188 | if (event) { // protection if the user didn't call GetTrack, which sets the internal pointer | |
189 | AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader(); | |
190 | if (tofH && (TMath::Abs(sigmaTOFPid[0]) <= 1.E-16) ) { // new AOD | |
191 | sigTOF=fTOFResponse.GetExpectedSigma(track->P(),expTime,AliPID::ParticleMassZ(type)); //fTOFResponse is set in InitialiseEvent | |
192 | tofTime -= fTOFResponse.GetStartTime(vtrack->P()); | |
193 | oldAod=kFALSE; | |
194 | } | |
195 | } else { | |
196 | AliError("pointer to AliAODEvent not found, please call GetTrack to set it"); | |
197 | return -996.; | |
198 | } | |
199 | if (oldAod) { // old AOD | |
200 | if (type <= AliPID::kProton) { | |
201 | sigTOF=sigmaTOFPid[type]; | |
202 | } else return -998.; // light nuclei cannot be supported on old AOD because we don't have timeZero resolution | |
203 | } | |
204 | if (sigTOF>0) return (tofTime - expTime)/sigTOF; | |
205 | else return -997.; | |
206 | } |