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