]>
Commit | Line | Data |
---|---|---|
8c1c76e9 | 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 | // QA class for Bayes PID | |
17 | // Plot likelihoods vs various observables | |
18 | // combined likelihood as well as indiv. detector response | |
19 | // also plot mass spectrum using TOF for prior determination | |
20 | // | |
21 | // Author: | |
22 | // Yvonne Pachmayer <Y.Pachmayer@gsi.de> | |
23 | // | |
24 | #include <TBrowser.h> | |
25 | #include <TClass.h> | |
26 | #include <TH2.h> | |
27 | #include <THnSparse.h> | |
28 | #include <TString.h> | |
29 | ||
30 | #include "AliAODTrack.h" | |
31 | #include "AliESDtrack.h" | |
32 | #include "AliLog.h" | |
33 | #include "AliPID.h" | |
34 | #include "AliPIDResponse.h" | |
35 | ||
36 | #include "AliHFEcollection.h" | |
37 | #include "AliHFEpidBase.h" | |
38 | #include "AliHFEpidQAmanager.h" | |
39 | #include "AliHFEpidTPC.h" | |
40 | #include "AliHFEpidTOF.h" | |
41 | #include "AliHFEpidTRD.h" | |
42 | #include "AliHFEpidBayes.h" | |
43 | #include "AliHFEtools.h" | |
44 | #include "AliHFEbayesPIDqa.h" | |
45 | #include "AliHFEdetPIDqa.h" | |
46 | ||
47 | ClassImp(AliHFEbayesPIDqa) | |
48 | ||
49 | //---------------------------------------------------------------- | |
50 | // Definition of common binning | |
51 | const Int_t kNdim = 5; | |
52 | const Int_t kPIDbins = AliPID::kSPECIES + 1; | |
53 | const Int_t kProbbins = 100; | |
54 | const Int_t kSteps = 2; | |
55 | const Int_t kCentralityBins = 11; | |
56 | const Double_t kMinPID = -1; | |
57 | const Double_t kMinP = 0.; | |
58 | const Double_t kMaxPID = (Double_t)AliPID::kSPECIES; | |
59 | const Double_t kMaxP = 20.; | |
60 | ||
61 | const Int_t AliHFEbayesPIDqa::fgkNBinsProb[kNdim] = { | |
62 | kPIDbins, // species | |
63 | 1000, // p-bins | |
64 | kProbbins, // probability | |
65 | kSteps, // step | |
66 | kCentralityBins // centrality | |
67 | }; | |
68 | const Double_t AliHFEbayesPIDqa::fgkMinBinsProb[kNdim] = { | |
69 | -1., // species | |
70 | 0., // p-bins | |
71 | 0., // probability | |
72 | 0., // step | |
73 | 0. // centrality | |
74 | }; | |
75 | const Double_t AliHFEbayesPIDqa::fgkMaxBinsProb[kNdim] = { | |
76 | (Double_t)AliPID::kSPECIES, // species | |
77 | 20., // p-bins | |
78 | 1., // probability | |
79 | 2., // step | |
80 | 11. // centrality | |
81 | }; | |
82 | //---------------------------------------------------------------- | |
83 | ||
84 | //_________________________________________________________ | |
85 | AliHFEbayesPIDqa::AliHFEbayesPIDqa(): | |
86 | AliHFEdetPIDqa() | |
87 | , fHistos(NULL) | |
88 | { | |
89 | // | |
90 | // Dummy constructor | |
91 | // | |
92 | } | |
93 | ||
94 | //_________________________________________________________ | |
95 | AliHFEbayesPIDqa::AliHFEbayesPIDqa(const char* name): | |
96 | AliHFEdetPIDqa(name, "QA for Bayes") | |
97 | , fHistos(NULL) | |
98 | { | |
99 | // | |
100 | // Default constructor | |
101 | // | |
102 | } | |
103 | ||
104 | //____________________________________________________________ | |
105 | AliHFEbayesPIDqa::AliHFEbayesPIDqa(const AliHFEbayesPIDqa &o): | |
106 | AliHFEdetPIDqa(o), | |
107 | fHistos(NULL) | |
108 | { | |
109 | // | |
110 | // Copy constructor | |
111 | // | |
112 | } | |
113 | ||
114 | //____________________________________________________________ | |
115 | AliHFEbayesPIDqa &AliHFEbayesPIDqa::operator=(const AliHFEbayesPIDqa &o){ | |
116 | // | |
117 | // Make assignment | |
118 | // | |
119 | AliHFEdetPIDqa::operator=(o); | |
120 | fHistos = o.fHistos; | |
121 | ||
122 | return *this; | |
123 | } | |
124 | ||
125 | ||
126 | //_________________________________________________________ | |
127 | AliHFEbayesPIDqa::~AliHFEbayesPIDqa(){ | |
128 | // | |
129 | // Destructor | |
130 | // | |
131 | if(fHistos) delete fHistos; | |
132 | } | |
133 | ||
134 | //_________________________________________________________ | |
135 | void AliHFEbayesPIDqa::Initialize(){ | |
136 | // | |
137 | // Define Histograms | |
138 | // | |
139 | ||
140 | fHistos = new AliHFEcollection("BAYESqahistos", "Collection of Bayes QA histograms"); | |
141 | ||
142 | CreateProbabilityHistograms(); | |
143 | CreateDetectorSignalHistograms(); | |
144 | ||
145 | // fBAYESpid = new AliHFEpidBayes("QAbayesPID"); | |
146 | ||
147 | } | |
148 | ||
149 | //__________________________________________________________________ | |
150 | void AliHFEbayesPIDqa::CreateProbabilityHistograms(){ | |
151 | // | |
152 | // Create Histogram for Probability Studies | |
153 | // | |
154 | ||
155 | fHistos->CreateTHnSparse("combprob", "Comb prob; species; p [GeV/c]; Comb prob; Selection Step; Centrality", kNdim, fgkNBinsProb, fgkMinBinsProb, fgkMaxBinsProb); | |
156 | ||
157 | ||
158 | } | |
159 | ||
160 | void AliHFEbayesPIDqa::CreateDetectorSignalHistograms(){ | |
161 | // | |
162 | // Create Histogram for Probability Studies | |
163 | // | |
164 | Int_t kPbins = fQAmanager->HasHighResolutionHistos() ? 1000 : 100; | |
165 | Int_t kSigmaBins = fQAmanager->HasHighResolutionHistos() ? 1400 : 240; | |
166 | Int_t nBinsSigma[kNdim] = {kPIDbins, kPbins, kSigmaBins, kSteps, kCentralityBins}; | |
167 | Double_t minSigma[kNdim] = {kMinPID, kMinP, -12., 0., 0.}; | |
168 | Double_t maxSigma[kNdim] = {kMaxPID, kMaxP, 12., 2., 11.}; | |
169 | fHistos->CreateTHnSparse("tpcsigma", "TPC sigma; species; p [GeV/c]; TPC sigma; Selection Step; Centrality", kNdim, nBinsSigma, minSigma,maxSigma); | |
170 | fHistos->CreateTHnSparse("tofsigma", "TOF sigma; species; p [GeV/c]; TOF sigma; Selection Step; Centrality", kNdim, nBinsSigma, minSigma,maxSigma); | |
171 | ||
172 | Int_t trdLikelihoodBins = fQAmanager->HasHighResolutionHistos() ? 200 : 100; | |
173 | Int_t nBinsTRDlike[5] = {kPIDbins, kPbins, trdLikelihoodBins, kSteps, kCentralityBins}; | |
174 | Double_t minTRDlike[5] = {kMinPID, kMinP, 0., 0., 0.}; | |
175 | Double_t maxTRDlike[5] = {kMaxPID, kMaxP, 1., 2., 11.}; | |
176 | fHistos->CreateTHnSparse("trdlikeli", "TRD Likelihood Distribution; species; p [GeV/c]; TRD electron Likelihood; selection step", 5, nBinsTRDlike, minTRDlike, maxTRDlike); | |
177 | ||
178 | Int_t nBinsContr[6] = {kPIDbins, kPbins, kProbbins, kSigmaBins, kSigmaBins, trdLikelihoodBins}; | |
179 | Double_t minContr[6] = {kMinPID, kMinP, 0, -12., -12., 0.}; | |
180 | Double_t maxContr[6] = {kMaxPID, kMaxP, 1, 12., 12., 1.}; | |
181 | fHistos->CreateTHnSparse("control", "Control; species; p [GeV/c]; Comb prob; TPC sigma; TOF sigma; TRD electron Likelihood", 6, nBinsContr, minContr,maxContr); | |
182 | ||
183 | Int_t nBinsTOFmass[5] = {kPIDbins, kPbins, 150, kSteps, kCentralityBins}; | |
184 | Double_t minTOFmass[5] = {kMinPID, kMinP, 0., 0., 0.}; | |
185 | Double_t maxTOFmass[5] = {kMaxPID, kMaxP, 1.5, 2., 11.}; | |
186 | fHistos->CreateTHnSparse("tofmass", "TOF mass; species; p [GeV/c]; TOF mass; selection step", 5, nBinsTOFmass, minTOFmass, maxTOFmass); | |
187 | ||
188 | ||
189 | } | |
190 | //_________________________________________________________ | |
191 | void AliHFEbayesPIDqa::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::EStep_t step){ | |
192 | // | |
193 | // Fill TPC histograms | |
194 | // | |
195 | AliDebug(1, Form("QA started for BAYES PID for step %d", (Int_t)step)); | |
196 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; | |
197 | Float_t centrality = track->GetCentrality(); | |
198 | Int_t species = track->GetAbInitioPID(); | |
199 | if(species >= AliPID::kSPECIES) species = -1; | |
200 | ||
201 | Double_t probComb[AliPID::kSPECIES]={0.}; | |
202 | AliHFEpidBayes *bayespid = dynamic_cast<AliHFEpidBayes *>(fQAmanager->GetDetectorPID(AliHFEpid::kBAYESpid)); | |
203 | const AliPIDResponse *pidResponseBayes = bayespid ? bayespid->GetPIDResponse() : NULL; | |
204 | bayespid->CalcCombProb(track,pidResponseBayes, probComb); | |
205 | ||
206 | Double_t contentSignal[5]; | |
207 | contentSignal[0] = species; | |
208 | contentSignal[1] = track->GetRecTrack()->P(); | |
209 | contentSignal[2] = probComb[AliPID::kElectron]; | |
210 | // contentSignal[2] = contentSignal[2] = pidResponse ? pidResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron) : 0.; | |
211 | contentSignal[3] = step; | |
212 | contentSignal[4] = centrality; | |
213 | fHistos->Fill("combprob", contentSignal); | |
214 | ||
215 | Double_t contentContr[6]; | |
216 | contentContr[0]=contentSignal[0]; | |
217 | contentContr[1]=contentSignal[1]; | |
218 | contentContr[2]=contentSignal[2]; | |
219 | ||
220 | AliHFEpidTOF *tofpid = dynamic_cast<AliHFEpidTOF *>(fQAmanager->GetDetectorPID(AliHFEpid::kTOFpid)); | |
221 | const AliPIDResponse *pidResponseTOF = tofpid ? tofpid->GetPIDResponse() : NULL; | |
222 | contentSignal[2] = pidResponseTOF ? pidResponseTOF->NumberOfSigmasTOF(track->GetRecTrack(), AliPID::kElectron): -10.; | |
223 | fHistos->Fill("tofsigma", contentSignal); | |
224 | contentContr[3]=contentSignal[2]; | |
225 | ||
226 | AliHFEpidTPC *tpcpid = dynamic_cast<AliHFEpidTPC *>(fQAmanager->GetDetectorPID(AliHFEpid::kTPCpid)); | |
227 | const AliPIDResponse *pidResponse = tpcpid ? tpcpid->GetPIDResponse() : NULL; | |
228 | contentSignal[2] = pidResponse ? pidResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron) : -10.; | |
229 | fHistos->Fill("tpcsigma", contentSignal); | |
230 | contentContr[4]=contentSignal[2]; | |
231 | ||
232 | ||
233 | AliHFEpidTRD *trdpid = dynamic_cast<AliHFEpidTRD *>(fQAmanager->GetDetectorPID(AliHFEpid::kTRDpid)); | |
234 | contentSignal[2] = trdpid ? trdpid->GetElectronLikelihood(static_cast<const AliVTrack*>(track->GetRecTrack()), anatype) : -10; | |
235 | fHistos->Fill("trdlikeli", contentSignal); | |
236 | ||
237 | contentContr[5]=contentSignal[2]; | |
238 | fHistos->Fill("control", contentContr); | |
239 | ||
240 | Double_t masscalcfromtof=CalcTOFMass(track); | |
241 | contentSignal[2]=masscalcfromtof; | |
242 | fHistos->Fill("tofmass", contentSignal); | |
243 | } | |
244 | ||
245 | Double_t AliHFEbayesPIDqa::CalcTOFMass(const AliHFEpidObject *track){ | |
246 | // | |
247 | // Calc TOF mass | |
248 | // | |
249 | ||
250 | Double_t mass=-99; //GeV | |
251 | Double_t length=((AliESDtrack*)track->GetRecTrack())->GetIntegratedLength(); | |
252 | if (length<=0) return mass; | |
253 | Double_t tofTime=((AliESDtrack*)track->GetRecTrack())->GetTOFsignal();//in ps | |
254 | Double_t tof= tofTime*1E-3; // ns, average T0 fill subtracted, no info from T0detector | |
255 | if (tof<=0) return mass; | |
256 | Double_t c=TMath::C()*1.E-9;// m/ns | |
257 | length =length*0.01; // in meters | |
258 | tof=tof*c; | |
259 | Double_t fact= (tof/length)*(tof/length) -1.; | |
260 | Double_t mom=track->GetRecTrack()->P(); | |
261 | if(mom==0) return mass; | |
262 | ||
263 | if(fact<=0) { | |
264 | mass = -mom*TMath::Sqrt(-fact); | |
265 | }else{ | |
266 | mass = mom*TMath::Sqrt(fact); | |
267 | } | |
268 | ||
269 | return mass; | |
270 | } | |
271 |