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