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