]>
Commit | Line | Data |
---|---|---|
3a72645a | 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 | // Class AliHFEtrdPIDqaV1 | |
17 | // Monitoring TRD PID in the HFE PID montioring framework. The following | |
18 | // quantities are monitored: | |
19 | // TRD electron likelihood | |
20 | // TRD dE/dx (Absolute values) | |
21 | // TPC dE/dx (Number of sigmas, control histogram) | |
22 | // (Always as function of momentum, particle species and centrality | |
23 | // before and after cut) | |
24 | // More information about the PID monitoring framework can be found in | |
25 | // AliHFEpidQAmanager.cxx and AliHFEdetPIDqa.cxx | |
26 | // | |
27 | // Author: | |
28 | // Markus Fasel <M.Fasel@gsi.de> | |
29 | // | |
30 | ||
31 | #include <TAxis.h> | |
e3ae862b | 32 | #include <TBrowser.h> |
3a72645a | 33 | #include <TH2.h> |
34 | #include <THnSparse.h> | |
35 | #include <TString.h> | |
36 | ||
e3ae862b | 37 | #include "AliESDtrack.h" |
6555e2ad | 38 | #include "AliLog.h" |
3a72645a | 39 | #include "AliPID.h" |
8c1c76e9 | 40 | #include "AliPIDResponse.h" |
3a72645a | 41 | |
42 | #include "AliHFEcollection.h" | |
43 | #include "AliHFEpidBase.h" | |
6555e2ad | 44 | #include "AliHFEpidQAmanager.h" |
45 | #include "AliHFEpidTPC.h" | |
46 | #include "AliHFEpidTRD.h" | |
3a72645a | 47 | #include "AliHFEtrdPIDqaV1.h" |
48 | ||
49 | ClassImp(AliHFEtrdPIDqaV1) | |
50 | ||
51 | //____________________________________________________________ | |
52 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(): | |
53 | AliHFEdetPIDqa(), | |
54 | fHistos(NULL) | |
55 | { | |
56 | // | |
57 | // Dummy constructor | |
58 | // | |
59 | } | |
60 | ||
61 | //____________________________________________________________ | |
62 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const Char_t *name): | |
63 | AliHFEdetPIDqa(name, "QA for TRD"), | |
64 | fHistos(NULL) | |
65 | { | |
66 | // | |
67 | // Default constructor | |
68 | // | |
69 | } | |
70 | ||
71 | //____________________________________________________________ | |
72 | AliHFEtrdPIDqaV1::AliHFEtrdPIDqaV1(const AliHFEtrdPIDqaV1 &o): | |
73 | AliHFEdetPIDqa(o), | |
74 | fHistos(NULL) | |
75 | { | |
76 | // | |
77 | // Copy constructor | |
78 | // | |
79 | } | |
80 | ||
81 | //____________________________________________________________ | |
82 | AliHFEtrdPIDqaV1 &AliHFEtrdPIDqaV1::operator=(const AliHFEtrdPIDqaV1 &o){ | |
83 | // | |
84 | // Make assignment | |
85 | // | |
aa1417ee | 86 | if(this == &o) return *this; |
3a72645a | 87 | AliHFEdetPIDqa::operator=(o); |
88 | fHistos = o.fHistos; | |
89 | ||
90 | return *this; | |
91 | } | |
df8926e7 R |
92 | //____________________________________________________________ |
93 | AliHFEtrdPIDqaV1::~AliHFEtrdPIDqaV1(){ | |
94 | // | |
95 | // Deconstructor | |
96 | // | |
97 | if(fHistos) delete fHistos; | |
3a72645a | 98 | |
df8926e7 | 99 | } |
3a72645a | 100 | //_________________________________________________________ |
101 | Long64_t AliHFEtrdPIDqaV1::Merge(TCollection *coll){ | |
102 | // | |
103 | // Merge with other objects | |
104 | // | |
105 | if(!coll) return 0; | |
106 | if(coll->IsEmpty()) return 1; | |
107 | ||
108 | TIter it(coll); | |
109 | AliHFEtrdPIDqaV1 *refQA = NULL; | |
110 | TObject *o = NULL; | |
111 | Long64_t count = 0; | |
112 | TList listHistos; | |
113 | while((o = it())){ | |
114 | refQA = dynamic_cast<AliHFEtrdPIDqaV1 *>(o); | |
115 | if(!refQA) continue; | |
116 | ||
117 | listHistos.Add(refQA->fHistos); | |
118 | count++; | |
119 | } | |
120 | fHistos->Merge(&listHistos); | |
121 | return count + 1; | |
122 | } | |
123 | ||
e3ae862b | 124 | //_________________________________________________________ |
125 | void AliHFEtrdPIDqaV1::Browse(TBrowser *b){ | |
126 | // | |
127 | // Browse the PID QA | |
128 | // | |
129 | if(b){ | |
130 | if(fHistos){ | |
131 | b->Add(fHistos, fHistos->GetName()); | |
132 | ||
133 | // Make Projections of the dE/dx Spectra and add them to a new Folder | |
134 | TString specnames[4] = {"All", "Electrons", "Pions", "Protons"}; | |
135 | Int_t specind[4] = {-1, AliPID::kElectron, AliPID::kPion, AliPID::kProton}; | |
136 | TList *listTM = new TList; | |
137 | listTM->SetOwner(); | |
138 | TList *listLike = new TList; | |
139 | listLike->SetOwner(); | |
140 | TList *listCharge = new TList; | |
141 | listCharge->SetOwner(); | |
142 | TList *listTPCnsigma = new TList; | |
143 | listTPCnsigma->SetOwner(); | |
144 | ||
145 | TH2 *hptr = NULL; | |
e156c3bb | 146 | TList *lctm, *lclike, *lccharge, *lcTPCsig; |
147 | for(Int_t icent = -1; icent < 11; icent++){ | |
148 | lctm = new TList; | |
149 | lctm->SetName(icent < 0 ? "MinBias" : Form("Centrality%d", icent)); | |
150 | lctm->SetOwner(); | |
151 | listTM->Add(lctm); | |
152 | lclike = new TList; | |
153 | lclike->SetName(icent < 0 ? "MinBias" : Form("Centrality%d", icent)); | |
154 | lclike->SetOwner(); | |
155 | listLike->Add(lclike); | |
156 | lccharge = new TList; | |
157 | lccharge->SetName(icent < 0 ? "MinBias" : Form("Centrality%d", icent)); | |
158 | lccharge->SetOwner(); | |
159 | listCharge->Add(lccharge); | |
160 | lcTPCsig = new TList; | |
161 | lcTPCsig->SetName(icent < 0 ? "MinBias" : Form("Centrality%d", icent)); | |
162 | lcTPCsig->SetOwner(); | |
163 | listTPCnsigma->Add(lcTPCsig); | |
164 | for(Int_t ispec = 0; ispec < 4; ispec++){ | |
165 | for(Int_t istep = 0; istep < 2; istep++){ | |
166 | hptr = MakeTRDspectrumTM(static_cast<AliHFEdetPIDqa::EStep_t>(istep), specind[ispec], icent); | |
167 | if(hptr){ | |
168 | hptr->SetName(Form("hTRDtm%s%s", specnames[ispec].Data(), istep == 0 ? "Before" : "After")); | |
169 | lctm->Add(hptr); | |
170 | } | |
171 | hptr = MakeTRDlikelihoodDistribution(static_cast<AliHFEdetPIDqa::EStep_t>(istep), specind[ispec], icent); | |
172 | hptr->SetName(Form("hTRDlike%s%s", specnames[ispec].Data(), istep == 0 ? "Before" : "After")); | |
173 | lclike->Add(hptr); | |
174 | hptr = MakeTRDchargeDistribution(static_cast<AliHFEdetPIDqa::EStep_t>(istep), specind[ispec], icent); | |
175 | hptr->SetName(Form("hTRDcharge%s%s", specnames[ispec].Data(), istep == 0 ? "Before" : "After")); | |
176 | lccharge->Add(hptr); | |
177 | hptr = MakeTPCspectrumNsigma(static_cast<AliHFEdetPIDqa::EStep_t>(istep), specind[ispec], icent); | |
178 | hptr->SetName(Form("hTPCspectrum%s%s", specnames[ispec].Data(), istep == 0 ? "Before" : "After")); | |
179 | lcTPCsig->Add(hptr); | |
ccc37cdc | 180 | } |
e3ae862b | 181 | } |
182 | } | |
e156c3bb | 183 | |
e3ae862b | 184 | b->Add(listTM, "Projections Truncated Mean"); |
185 | b->Add(listLike, "Projections Likelihood distribution"); | |
186 | b->Add(listCharge, "Projections Tracklet Charge"); | |
187 | b->Add(listTPCnsigma, "Projections TPC spectra"); | |
188 | } | |
189 | } | |
190 | } | |
191 | ||
3a72645a | 192 | //____________________________________________________________ |
193 | void AliHFEtrdPIDqaV1::Initialize(){ | |
194 | // | |
195 | // Initialize QA histos for TRD PID | |
196 | // | |
197 | ||
198 | AliDebug(1, "Initializing PID QA for TRD"); | |
199 | // Make common binning | |
200 | const Int_t kPIDbins = AliPID::kSPECIES + 1; | |
3a72645a | 201 | const Int_t kSteps = 2; |
202 | const Double_t kMinPID = -1; | |
203 | const Double_t kMinP = 0.; | |
204 | const Double_t kMaxPID = (Double_t)AliPID::kSPECIES; | |
205 | const Double_t kMaxP = 20.; | |
f9f097c0 | 206 | const Int_t kCentralityBins = 11; |
3a72645a | 207 | |
8c1c76e9 | 208 | // Define number of bins |
209 | Int_t kPbins = fQAmanager->HasHighResolutionHistos() ? 1000 : 100; | |
3e03bd67 | 210 | Int_t tpcSigmaBins = fQAmanager->HasHighResolutionHistos() ? 1400 : 140; |
211 | Int_t trdLikelihoodBins = fQAmanager->HasHighResolutionHistos() ? 200 : 100; | |
212 | ||
3a72645a | 213 | fHistos = new AliHFEcollection("trdqahistos", "Collection of TRD QA histograms"); |
214 | ||
215 | // Create Control Histogram monitoring the TPC sigma between the selection steps | |
f9f097c0 | 216 | Int_t nBinsTPCSigma[5] = {kPIDbins, kPbins, tpcSigmaBins, kSteps, kCentralityBins}; |
217 | Double_t minTPCSigma[5] = {kMinPID, kMinP, -12., 0., 0.}; | |
218 | Double_t maxTPCSigma[5] = {kMaxPID, kMaxP, 12., 2., 11.}; | |
e156c3bb | 219 | fHistos->CreateTHnSparse("hTPCsigma", "TPC sigma; species p [GeV/c]; TPC dEdx - <dE/dx>|_{el} [#sigma]; selection step", 5, nBinsTPCSigma, minTPCSigma, maxTPCSigma); |
bf892a6a | 220 | fHistos->Sumw2("hTPCsigma"); |
3a72645a | 221 | // Create Monitoring histogram for the Likelihood distribution |
f9f097c0 | 222 | Int_t nBinsTRDlike[5] = {kPIDbins, kPbins, trdLikelihoodBins, kSteps, kCentralityBins}; |
223 | Double_t minTRDlike[5] = {kMinPID, kMinP, 0., 0., 0.}; | |
224 | Double_t maxTRDlike[5] = {kMaxPID, kMaxP, 1., 2., 11.}; | |
e156c3bb | 225 | fHistos->CreateTHnSparse("hTRDlikelihood", "TRD Likelihood Distribution; species; p [GeV/c]; TRD electron Likelihood; selection step", 5, nBinsTRDlike, minTRDlike, maxTRDlike); |
bf892a6a | 226 | fHistos->Sumw2("hTRDlikelihood"); |
3a72645a | 227 | // Create Monitoring histogram for the TRD total charge |
228 | const Int_t kTRDchargeBins = 1000; | |
f9f097c0 | 229 | Int_t nBinsTRDcharge[5] = {kPIDbins, kPbins, kTRDchargeBins, kSteps, kCentralityBins}; |
230 | Double_t minTRDcharge[5] = {kMinPID, kMinP, 0., 0., 0.}; | |
231 | Double_t maxTRDcharge[5] = {kMaxPID, kMaxP, 100000., 2., 11.}; | |
e156c3bb | 232 | fHistos->CreateTHnSparse("hTRDcharge", "Total TRD charge; species; p [GeV/c]; TRD charge [a.u.]; selection step", 5, nBinsTRDcharge, minTRDcharge, maxTRDcharge); |
bf892a6a | 233 | fHistos->Sumw2("hTRDcharge"); |
e3ae862b | 234 | // Monitoring of the TRD truncated mean according to version 1 |
235 | const Int_t kTRDtmBins = 1000; | |
f9f097c0 | 236 | Int_t nBinsTRDtm[5] = {kPIDbins, kPbins, kTRDtmBins, kSteps, kCentralityBins}; |
237 | Double_t minTRDtm[5] = {kMinPID, kMinP, 0., 0., 0.}; | |
238 | Double_t maxTRDtm[5] = {kMaxPID, kMaxP, 20000., 2., 11.}; | |
e156c3bb | 239 | fHistos->CreateTHnSparse("hTRDtruncatedMean", "TRD truncated Mean; species; p [GeV/c]; TRD signal [a.u.]; selection step", 5, nBinsTRDtm, minTRDtm, maxTRDtm); |
ccc37cdc | 240 | fHistos->Sumw2("hTRDtruncatedMean"); |
e17c1f86 | 241 | |
242 | // Monitoring of the number of tracklets | |
243 | fHistos->CreateTH2F("hNtrackletsBefore", "Number of tracklets before PID; species; p (GeV/c), Number of Tracklets", kPbins, kMinP, kMaxP, 7, 0., 7.); | |
244 | fHistos->Sumw2("hNtrackletsBefore"); | |
245 | fHistos->CreateTH2F("hNtrackletsAfter", "Number of tracklets after PID; species; p (GeV/c), Number of Tracklets", kPbins, kMinP, kMaxP, 7, 0., 7.); | |
246 | fHistos->Sumw2("hNtrackletsAfter"); | |
3a72645a | 247 | } |
248 | ||
249 | //____________________________________________________________ | |
6555e2ad | 250 | void AliHFEtrdPIDqaV1::ProcessTrack(const AliHFEpidObject *track, AliHFEdetPIDqa::EStep_t step){ |
3a72645a | 251 | // |
252 | // Process the track, fill the containers | |
253 | // | |
254 | AliDebug(1, Form("QA started for TRD PID for step %d", (Int_t)step)); | |
255 | Int_t species = track->GetAbInitioPID(); | |
e3ae862b | 256 | if(species >= AliPID::kSPECIES) species = -1; |
6555e2ad | 257 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
3a72645a | 258 | |
6555e2ad | 259 | AliHFEpidTRD *trdpid = dynamic_cast<AliHFEpidTRD *>(fQAmanager->GetDetectorPID(AliHFEpid::kTRDpid)); |
8c1c76e9 | 260 | const AliPIDResponse *pidResponse = trdpid ? trdpid->GetPIDResponse() : NULL; |
6555e2ad | 261 | |
f9f097c0 | 262 | Double_t container[5]; |
3a72645a | 263 | container[0] = species; |
bf892a6a | 264 | container[1] = trdpid ? trdpid->GetP(track->GetRecTrack(), anatype) : 0.; |
8c1c76e9 | 265 | container[2] = pidResponse ? pidResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron) : 0.; |
3a72645a | 266 | container[3] = step; |
f9f097c0 | 267 | container[4] = track->GetCentrality(); |
85358761 | 268 | AliDebug(1, Form("Species %d, p %f, number of sigma TPC %f, step %f, centrality %f", (Int_t)species,(Float_t) container[1],(Float_t) container[2],(Float_t) container[3],(Float_t) container[4])); |
3a72645a | 269 | fHistos->Fill("hTPCsigma", container); |
85358761 | 270 | AliDebug(1, "Filled TPC sigma\n"); |
271 | ||
272 | ||
3a72645a | 273 | |
8c1c76e9 | 274 | container[2] = trdpid ? trdpid->GetElectronLikelihood(static_cast<const AliVTrack*>(track->GetRecTrack()), anatype) : 0; |
3a72645a | 275 | fHistos->Fill("hTRDlikelihood", container); |
85358761 | 276 | AliDebug(1, "Filled likelihood\n"); |
3a72645a | 277 | |
e3ae862b | 278 | if(track->IsESDanalysis()){ |
63bffcf1 | 279 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track->GetRecTrack()); |
280 | if(esdtrack){ | |
281 | container[2] = trdpid ? trdpid->GetTRDSignalV1(esdtrack) : 0; | |
282 | fHistos->Fill("hTRDtruncatedMean", container); | |
283 | } | |
e3ae862b | 284 | } |
6555e2ad | 285 | for(UInt_t ily = 0; ily < 6; ily++){ |
f9f097c0 | 286 | container[2] = trdpid ? trdpid->GetChargeLayer(track->GetRecTrack(), ily, anatype) : 0; |
e156c3bb | 287 | if(container[2] < 1e-3) continue; // Filter out 0 entries |
3a72645a | 288 | fHistos->Fill("hTRDcharge", container); |
85358761 | 289 | AliDebug(1, "Filled TRD charge\n"); |
3a72645a | 290 | } |
e17c1f86 | 291 | |
292 | Int_t ntracklets = track->GetRecTrack()->GetTRDntrackletsPID(); | |
293 | if(step == AliHFEdetPIDqa::kBeforePID) | |
294 | fHistos->Fill("hNtrackletsBefore", trdpid ? trdpid->GetP(track->GetRecTrack(), anatype) : 0., ntracklets); | |
295 | else | |
296 | fHistos->Fill("hNtrackletsAfter", trdpid ? trdpid->GetP(track->GetRecTrack(), anatype) : 0., ntracklets); | |
85358761 | 297 | AliDebug(1, "Filled tracklet\n"); |
3a72645a | 298 | } |
299 | ||
300 | //_________________________________________________________ | |
e156c3bb | 301 | TH2 *AliHFEtrdPIDqaV1::MakeTPCspectrumNsigma(AliHFEdetPIDqa::EStep_t step, Int_t species, Int_t centralityClass){ |
3a72645a | 302 | // |
303 | // Get the TPC control histogram for the TRD selection step (either before or after PID) | |
304 | // | |
3a72645a | 305 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTPCsigma")); |
306 | if(!histo){ | |
307 | AliError("QA histogram monitoring TPC nSigma not available"); | |
308 | return NULL; | |
309 | } | |
310 | if(species > -1 && species < AliPID::kSPECIES){ | |
311 | // cut on species (if available) | |
312 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
313 | } | |
e156c3bb | 314 | TString centname, centtitle; |
315 | Bool_t hasCentralityInfo = kTRUE; | |
316 | if(centralityClass > -1){ | |
317 | if(histo->GetNdimensions() < 5){ | |
318 | AliError("Centrality Information not available"); | |
319 | centname = centtitle = "MinBias"; | |
320 | hasCentralityInfo = kFALSE; | |
321 | } else { | |
322 | // Project centrality classes | |
323 | // -1 is Min. Bias | |
324 | histo->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); | |
325 | centname = Form("Cent%d", centralityClass); | |
326 | centtitle = Form("Centrality %d", centralityClass); | |
327 | } | |
328 | } else { | |
329 | histo->GetAxis(4)->SetRange(1, histo->GetAxis(4)->GetNbins()-1); | |
330 | centname = centtitle = "MinBias"; | |
331 | hasCentralityInfo = kTRUE; | |
332 | } | |
6555e2ad | 333 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
3a72645a | 334 | |
335 | TH2 *hSpec = histo->Projection(2, 1); | |
336 | // construct title and name | |
6555e2ad | 337 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 338 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
339 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
e156c3bb | 340 | TString histname = Form("hSigmaTPC%s%s%s", specID.Data(), stepname.Data(), centname.Data()); |
341 | TString histtitle = Form("TPC Sigma for %s %s PID %s", speciesname.Data(), stepname.Data(), centtitle.Data()); | |
3a72645a | 342 | hSpec->SetName(histname.Data()); |
343 | hSpec->SetTitle(histtitle.Data()); | |
344 | ||
345 | // Unset range on the original histogram | |
e3ae862b | 346 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); |
e156c3bb | 347 | histo->GetAxis(3)->SetRange(0, histo->GetAxis(3)->GetNbins()); |
348 | if(hasCentralityInfo)histo->GetAxis(4)->SetRange(0, histo->GetAxis(4)->GetNbins()); | |
e3ae862b | 349 | return hSpec; |
350 | } | |
351 | ||
352 | //_________________________________________________________ | |
e156c3bb | 353 | TH2 *AliHFEtrdPIDqaV1::MakeTRDspectrumTM(AliHFEdetPIDqa::EStep_t step, Int_t species, Int_t centralityClass){ |
e3ae862b | 354 | // |
355 | // Get the TPC control histogram for the TRD selection step (either before or after PID) | |
356 | // | |
357 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTRDtruncatedMean")); | |
358 | if(!histo){ | |
359 | AliError("QA histogram monitoring TPC nSigma not available"); | |
360 | return NULL; | |
361 | } | |
362 | if(species > -1 && species < AliPID::kSPECIES){ | |
363 | // cut on species (if available) | |
364 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
365 | } | |
e156c3bb | 366 | TString centname, centtitle; |
367 | Bool_t hasCentralityInfo = kTRUE; | |
368 | if(centralityClass > -1){ | |
369 | if(histo->GetNdimensions() < 5){ | |
370 | AliError("Centrality Information not available"); | |
371 | centname = centtitle = "MinBias"; | |
372 | hasCentralityInfo= kFALSE; | |
373 | } else { | |
374 | // Project centrality classes | |
375 | // -1 is Min. Bias | |
376 | histo->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); | |
377 | centname = Form("Cent%d", centralityClass); | |
378 | centtitle = Form("Centrality %d", centralityClass); | |
379 | } | |
380 | } else { | |
381 | histo->GetAxis(4)->SetRange(1, histo->GetAxis(4)->GetNbins()-1); | |
382 | centname = centtitle = "MinBias"; | |
383 | hasCentralityInfo= kFALSE; | |
384 | } | |
e3ae862b | 385 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
386 | ||
387 | TH2 *hSpec = histo->Projection(2, 1); | |
388 | // construct title and name | |
389 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; | |
390 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; | |
391 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
e156c3bb | 392 | TString histname = Form("hTMTRD%s%s%s", specID.Data(), stepname.Data(), centname.Data()); |
393 | TString histtitle = Form("TRD Truncated Mean for %s %s PID %s", speciesname.Data(), stepname.Data(), centtitle.Data()); | |
e3ae862b | 394 | hSpec->SetName(histname.Data()); |
395 | hSpec->SetTitle(histtitle.Data()); | |
396 | ||
397 | // Unset range on the original histogram | |
3a72645a | 398 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); |
399 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
e156c3bb | 400 | if(hasCentralityInfo)histo->GetAxis(4)->SetRange(0, histo->GetAxis(4)->GetNbins()); |
3a72645a | 401 | return hSpec; |
402 | } | |
403 | ||
404 | //_________________________________________________________ | |
e156c3bb | 405 | TH2 *AliHFEtrdPIDqaV1::MakeTRDlikelihoodDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species, Int_t centralityClass){ |
3a72645a | 406 | // |
407 | // Make Histogram for TRD Likelihood distribution | |
408 | // | |
409 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTRDlikelihood")); | |
410 | if(!histo){ | |
411 | AliError("QA histogram monitoring TRD Electron Likelihood not available"); | |
412 | return NULL; | |
413 | } | |
414 | if(species > -1 && species < AliPID::kSPECIES){ | |
415 | // cut on species (if available) | |
416 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
417 | } | |
e156c3bb | 418 | TString centname, centtitle; |
419 | Bool_t hasCentralityInfo = kTRUE; | |
420 | if(centralityClass > -1){ | |
421 | if(histo->GetNdimensions() < 5){ | |
422 | AliError("Centrality Information not available"); | |
423 | centname = centtitle = "MinBias"; | |
424 | hasCentralityInfo= kFALSE; | |
425 | } else { | |
426 | // Project centrality classes | |
427 | // -1 is Min. Bias | |
428 | histo->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); | |
429 | centname = Form("Cent%d", centralityClass); | |
430 | centtitle = Form("Centrality %d", centralityClass); | |
431 | } | |
432 | } else { | |
433 | histo->GetAxis(4)->SetRange(1, histo->GetAxis(4)->GetNbins()-1); | |
434 | centname = centtitle = "MinBias"; | |
435 | hasCentralityInfo= kTRUE; | |
436 | } | |
c2690925 | 437 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
3a72645a | 438 | |
439 | TH2 *hSpec = histo->Projection(2, 1); | |
440 | // construct title and name | |
6555e2ad | 441 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 442 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
443 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
e156c3bb | 444 | TString histname = Form("hLikeElTRD%s%s%s", specID.Data(), stepname.Data(),centname.Data()); |
445 | TString histtitle = Form("TRD electron Likelihood for %s %s PID %s", speciesname.Data(), stepname.Data(),centtitle.Data()); | |
3a72645a | 446 | hSpec->SetName(histname.Data()); |
447 | hSpec->SetTitle(histtitle.Data()); | |
448 | ||
449 | // Unset range on the original histogram | |
450 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); | |
451 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
e156c3bb | 452 | if(hasCentralityInfo)histo->GetAxis(4)->SetRange(0, histo->GetAxis(4)->GetNbins()); |
3a72645a | 453 | return hSpec; |
454 | } | |
455 | ||
456 | //_________________________________________________________ | |
e156c3bb | 457 | TH2 *AliHFEtrdPIDqaV1::MakeTRDchargeDistribution(AliHFEdetPIDqa::EStep_t step, Int_t species, Int_t centralityClass){ |
3a72645a | 458 | // |
459 | // Make Histogram for TRD Likelihood distribution | |
460 | // | |
461 | THnSparseF *histo = dynamic_cast<THnSparseF *>(fHistos->Get("hTRDcharge")); | |
462 | if(!histo){ | |
463 | AliError("QA histogram monitoring TRD total charge not available"); | |
464 | return NULL; | |
465 | } | |
466 | if(species > -1 && species < AliPID::kSPECIES){ | |
467 | // cut on species (if available) | |
468 | histo->GetAxis(0)->SetRange(species + 2, species + 2); // undef + underflow | |
469 | } | |
e156c3bb | 470 | TString centname, centtitle; |
471 | Bool_t hasCentralityInfo = kTRUE; | |
472 | if(centralityClass > -1){ | |
473 | if(histo->GetNdimensions() < 5){ | |
474 | AliError("Centrality Information not available"); | |
475 | centname = centtitle = "MinBias"; | |
476 | hasCentralityInfo= kFALSE; | |
477 | } else { | |
478 | // Project centrality classes | |
479 | // -1 is Min. Bias | |
480 | histo->GetAxis(4)->SetRange(centralityClass+1, centralityClass+1); | |
481 | centname = Form("Cent%d", centralityClass); | |
482 | centtitle = Form("Centrality %d", centralityClass); | |
483 | } | |
484 | } else { | |
485 | histo->GetAxis(4)->SetRange(1, histo->GetAxis(4)->GetNbins()-1); | |
486 | centname = centtitle = "MinBias"; | |
487 | hasCentralityInfo= kTRUE; | |
488 | } | |
6555e2ad | 489 | histo->GetAxis(3)->SetRange(step + 1, step + 1); |
3a72645a | 490 | |
491 | TH2 *hSpec = histo->Projection(2, 1); | |
492 | // construct title and name | |
6555e2ad | 493 | TString stepname = step == AliHFEdetPIDqa::kBeforePID ? "before" : "after"; |
3a72645a | 494 | TString speciesname = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "all Particles"; |
495 | TString specID = species > -1 && species < AliPID::kSPECIES ? AliPID::ParticleName(species) : "unid"; | |
e156c3bb | 496 | TString histname = Form("hChargeTRD%s%s%s", specID.Data(), stepname.Data(), centname.Data()); |
497 | TString histtitle = Form("TRD total charge for %s %s PID %s", speciesname.Data(), stepname.Data(), centtitle.Data()); | |
3a72645a | 498 | hSpec->SetName(histname.Data()); |
499 | hSpec->SetTitle(histtitle.Data()); | |
500 | ||
501 | // Unset range on the original histogram | |
502 | histo->GetAxis(0)->SetRange(0, histo->GetAxis(0)->GetNbins()); | |
503 | histo->GetAxis(2)->SetRange(0, histo->GetAxis(2)->GetNbins()); | |
e156c3bb | 504 | if(hasCentralityInfo)histo->GetAxis(4)->SetRange(0, histo->GetAxis(4)->GetNbins()); |
3a72645a | 505 | return hSpec; |
506 | } | |
507 |