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