Renamed
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskPIDResponse.cxx
CommitLineData
66ab8ab2 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/* $Id: AliAnalysisTaskPIDResponse.cxx 43811 2010-09-23 14:13:31Z wiechula $ */
17#include <TList.h>
18#include <TVectorD.h>
19#include <TObjArray.h>
20#include <TH2.h>
21#include <TFile.h>
22#include <TPRegexp.h>
23#include <TChain.h>
24
25#include <AliAnalysisManager.h>
26#include <AliInputEventHandler.h>
27#include <AliVEventHandler.h>
28#include <AliVEvent.h>
29#include <AliVParticle.h>
30#include <AliVTrack.h>
31#include <AliLog.h>
32#include <AliPID.h>
33#include <AliPIDResponse.h>
34#include <AliITSPIDResponse.h>
35#include <AliTPCPIDResponse.h>
36#include <AliTRDPIDResponse.h>
37#include <AliTOFPIDResponse.h>
38
39#include "AliAnalysisTaskPIDResponse.h"
40
41
42ClassImp(AliAnalysisTaskPIDResponse)
43
44//______________________________________________________________________________
45AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse():
46AliAnalysisTaskSE(),
47fIsMC(kFALSE),
48fTOFTimeZeroTypeUser(-1),
49fTOFTimeZeroType(AliPIDResponse::kBest_T0),
50fTOFres(100.),
51fPIDResponse(0x0),
52fListQA(0x0),
53fListQAits(0x0),
54fListQAtpc(0x0),
55fListQAtrd(0x0),
56fListQAtof(0x0),
57fBeamType("PP"),
58fLHCperiod(),
59fMCperiodTPC(),
60fRecoPass(0),
61fRun(0),
62fOldRun(0),
63fArrPidResponseMaster(0x0)
64{
65 //
66 // Dummy constructor
67 //
68}
69
70//______________________________________________________________________________
71AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse(const char* name):
72AliAnalysisTaskSE(name),
73fIsMC(kFALSE),
74fTOFTimeZeroTypeUser(-1),
52c1c86c 75fTOFTimeZeroType(AliPIDResponse::kBest_T0),
66ab8ab2 76fTOFres(100.),
77fPIDResponse(0x0),
78fListQA(0x0),
79fListQAits(0x0),
80fListQAtpc(0x0),
81fListQAtrd(0x0),
82fListQAtof(0x0),
83fBeamType("PP"),
84fLHCperiod(),
85fMCperiodTPC(),
86fRecoPass(0),
87fRun(0),
88fOldRun(0),
89fArrPidResponseMaster(0x0)
90{
91 //
92 // Default constructor
93 //
94 DefineInput(0,TChain::Class());
95 DefineOutput(1,TList::Class());
96}
97
98//______________________________________________________________________________
99AliAnalysisTaskPIDResponse::~AliAnalysisTaskPIDResponse()
100{
101 //
102 // Destructor
103 //
104
105 delete fArrPidResponseMaster;
106}
107
108//______________________________________________________________________________
109void AliAnalysisTaskPIDResponse::ExecNewRun()
110{
111 //
112 // Things to Execute upon a new run
113 //
114
115 SetRecoInfo();
116
117 SetITSParametrisation();
118
119 SetTPCPidResponseMaster();
120 SetTPCParametrisation();
121
122 fPIDResponse->GetTOFResponse().SetTimeResolution(fTOFres);
123}
124
125//______________________________________________________________________________
126void AliAnalysisTaskPIDResponse::UserCreateOutputObjects()
127{
128 //
129 // Create the output QA objects
130 //
131
132 AliLog::SetClassDebugLevel("AliAnalysisTaskPIDResponse",10);
133
134 //input hander
135 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
136 AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
137 if (!inputHandler) AliFatal("Input handler needed");
138
139 //pid response object
140 inputHandler->CreatePIDResponse(fIsMC);
141 fPIDResponse=inputHandler->GetPIDResponse();
87977cf5 142 if (!fPIDResponse) AliFatal("PIDResponse object was not created");
66ab8ab2 143
144 //
145 fListQA=new TList;
146 fListQAits=new TList;
147 fListQAits->SetName("ITS");
148 fListQAtpc=new TList;
149 fListQAtpc->SetName("TPC");
150 fListQAtrd=new TList;
151 fListQAtrd->SetName("TRD");
152 fListQAtof=new TList;
153 fListQAtof->SetName("TOF");
154
155 fListQA->Add(fListQAits);
156 fListQA->Add(fListQAtpc);
157 fListQA->Add(fListQAtrd);
158 fListQA->Add(fListQAtof);
159
160 SetupTTSqa();
161 SetupTPCqa();
162 SetupTRDqa();
163 SetupTOFqa();
164
165 PostData(1,fListQA);
166}
167
168
169//______________________________________________________________________________
170void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)
171{
172 //
173 // Setup the PID response functions and fill the QA histograms
174 //
175
176 AliVEvent *event=InputEvent();
177 if (!event) return;
178 fRun=event->GetRunNumber();
179
180 if (fRun!=fOldRun){
181 ExecNewRun();
182 fOldRun=fRun;
183 }
184
185 Double_t timeZeroType=fTOFTimeZeroTypeUser;
186 if (timeZeroType<0) timeZeroType=fTOFTimeZeroType;
187 fPIDResponse->SetTOFResponse(event, (AliPIDResponse::EStartTimeType_t)timeZeroType);
188
189 FillITSqa();
190 FillTPCqa();
191 FillTOFqa();
192
193 PostData(1,fListQA);
194}
195
196
197//______________________________________________________________________________
198void AliAnalysisTaskPIDResponse::SetRecoInfo()
199{
200 //
201 // Set reconstruction information
202 //
203
204 //reset information
205 fRecoPass=0;
206 fLHCperiod="";
207 fMCperiodTPC="";
208
209 fBeamType="";
210
211 //Get the current file to check the reconstruction pass (UGLY, but not stored in ESD... )
212 AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
213 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
214 if (!inputHandler) return;
215
216 TTree *tree= (TTree*)inputHandler->GetTree();
217 TFile *file= (TFile*)tree->GetCurrentFile();
218
219 if (!file) {
220 AliError("Current file not found, cannot set reconstruction information");
221 return;
222 }
223
224 fBeamType="PP";
225
226 //find the period by run number (UGLY, but not stored in ESD and AOD... )
227 if (fRun>=114737&&fRun<=117223) { fLHCperiod="LHC10B"; fMCperiodTPC="LHC10D1"; }
228 else if (fRun>=118503&&fRun<=121040) { fLHCperiod="LHC10C"; fMCperiodTPC="LHC10D1"; }
229 else if (fRun>=122195&&fRun<=126437) { fLHCperiod="LHC10D"; fMCperiodTPC="LHC10F6A"; }
230 else if (fRun>=127719&&fRun<=130850) { fLHCperiod="LHC10E"; fMCperiodTPC="LHC10F6A"; }
231 else if (fRun>=133004&&fRun<=135029) { fLHCperiod="LHC10F"; fMCperiodTPC="LHC10F6A"; }
232 else if (fRun>=135654&&fRun<=136377) { fLHCperiod="LHC10G"; fMCperiodTPC="LHC10F6A"; }
233 else if (fRun>=136851&&fRun<=139517) { fLHCperiod="LHC10H"; fMCperiodTPC="LHC10H8"; fBeamType="PBPB"; }
234 else if (fRun>=139699) { fLHCperiod="LHC11A"; fMCperiodTPC="LHC10F6A"; }
235
236 //find pass from file name (UGLY, but not stored in ESD... )
237 TString fileName(file->GetName());
238 if (fileName.Contains("/pass1")) {
239 fRecoPass=1;
240 } else if (fileName.Contains("/pass2")) {
241 fRecoPass=2;
242 } else if (fileName.Contains("/pass3")) {
243 fRecoPass=3;
244 }
245
246}
247
248//______________________________________________________________________________
249void AliAnalysisTaskPIDResponse::SetITSParametrisation()
250{
251 //
252 // Set the ITS parametrisation
253 //
254}
255
256//______________________________________________________________________________
257void AliAnalysisTaskPIDResponse::SetTPCPidResponseMaster()
258{
259 //
260 // Load the TPC pid response functions from the OADB
261 //
262
263 //reset the PID response functions
264 delete fArrPidResponseMaster;
265 fArrPidResponseMaster=0x0;
266
267 TString fileName(Form("%s/COMMON/PID/data/TPCPIDResponse.root", AliAnalysisManager::GetOADBPath()));
268
269 TFile f(fileName.Data());
270 if (f.IsOpen() && !f.IsZombie()){
271 fArrPidResponseMaster=dynamic_cast<TObjArray*>(f.Get("TPCPIDResponse"));
66ab8ab2 272 f.Close();
273 }
274
275 if (!fArrPidResponseMaster){
276 AliFatal("Could not retrieve the TPC pid response");
277 return;
278 }
87977cf5 279 fArrPidResponseMaster->SetOwner();
66ab8ab2 280}
281
282//______________________________________________________________________________
283void AliAnalysisTaskPIDResponse::SetTPCParametrisation()
284{
285 //
286 // Change BB parametrisation for current run
287 //
288
289 if (fLHCperiod.IsNull()) {
290 AliFatal("No period set, not changing parametrisation");
291 return;
292 }
293
294 //
295 // Set default parametrisations for data and MC
296 //
297
298 //data type
299 TString datatype="DATA";
300 //in case of mc fRecoPass is per default 1
301 if (fIsMC) {
302 datatype="MC";
303 fRecoPass=1;
304 }
305
306 //
307 //set the PID splines
308 //
309 TString period=fLHCperiod;
310 if (fArrPidResponseMaster){
311 TObject *grAll=0x0;
312 //for MC don't use period information
313// if (fIsMC) period="[A-Z0-9]*";
314 //for MC use MC period information
315 if (fIsMC) period=fMCperiodTPC;
316//pattern for the default entry (valid for all particles)
317 TPRegexp reg(Form("TSPLINE3_%s_([A-Z]*)_%s_PASS%d_%s_MEAN",datatype.Data(),period.Data(),fRecoPass,fBeamType.Data()));
318
319 //loop over entries and filter them
320 for (Int_t iresp=0; iresp<fArrPidResponseMaster->GetEntriesFast();++iresp){
321 TObject *responseFunction=fArrPidResponseMaster->At(iresp);
322 if (responseFunction==0x0) continue;
323 TString responseName=responseFunction->GetName();
324
325 if (!reg.MatchB(responseName)) continue;
326
327 TObjArray *arr=reg.MatchS(responseName);
328 TString particleName=arr->At(1)->GetName();
329 delete arr;
330 if (particleName.IsNull()) continue;
331 if (particleName=="ALL") grAll=responseFunction;
332 else {
333 //find particle id
334 for (Int_t ispec=0; ispec<AliPID::kSPECIES; ++ispec){
335 TString particle=AliPID::ParticleName(ispec);
336 particle.ToUpper();
337 if ( particle == particleName ){
338 //test if there is already a function set. If yes, cleanup
339 TObject *old=const_cast<TObject*>(fPIDResponse->GetTPCResponse().GetResponseFunction((AliPID::EParticleType)ispec));
340 if (old) delete old;
341 fPIDResponse->GetTPCResponse().SetResponseFunction((AliPID::EParticleType)ispec,responseFunction);
342 fPIDResponse->GetTPCResponse().SetUseDatabase(kTRUE);
343 AliInfo(Form("Adding graph: %d - %s",ispec,responseFunction->GetName()));
344 break;
345 }
346 }
347 }
348 }
349
350 //set default response function to all particles which don't have a specific one
351 if (grAll){
352 for (Int_t ispec=0; ispec<AliPID::kSPECIES; ++ispec){
353 if (!fPIDResponse->GetTPCResponse().GetResponseFunction((AliPID::EParticleType)ispec)){
354 fPIDResponse->GetTPCResponse().SetResponseFunction((AliPID::EParticleType)ispec,grAll);
355 AliInfo(Form("Adding graph: %d - %s",ispec,grAll->GetName()));
356 }
357 }
358 }
359 }
360
361 //
362 // Setup resolution parametrisation
363 //
364
365 //default
366 fPIDResponse->GetTPCResponse().SetSigma(3.79301e-03, 2.21280e+04);
367
368 if (fRun>=122195){
369 fPIDResponse->GetTPCResponse().SetSigma(2.30176e-02, 5.60422e+02);
370 }
371// if ( fBeamType == "PBPB" ){
372// Double_t corrSigma=GetMultiplicityCorrectionSigma(GetTPCMultiplicityBin());
373// fPIDResponse->GetTPCResponse().SetSigma(3.79301e-03*corrSigma, 2.21280e+04);
374// }
375
376}
377
378//______________________________________________________________________________
379void AliAnalysisTaskPIDResponse::FillITSqa()
380{
381 AliVEvent *event=InputEvent();
382
383 Int_t ntracks=event->GetNumberOfTracks();
384 for(Int_t itrack = 0; itrack < ntracks; itrack++){
385 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
386 ULong_t status=track->GetStatus();
387 // not that nice. status bits not in virtual interface
388 // ITS refit + ITS pid
389 if (!( (status&0x0004==0x0004) && (status&0x0008==0x0008) )) return;
390 Double_t mom=track->P();
391
392 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
393 TH2 *h=(TH2*)fListQAits->At(ispecie);
394 if (!h) continue;
395 Double_t nSigma=fPIDResponse->NumberOfSigmasITS(track, (AliPID::EParticleType)ispecie);
396 h->Fill(mom,nSigma);
397 }
398
399 TH2 *h=(TH2*)fListQAits->At(AliPID::kSPECIES);
400 if (h) {
401 Double_t sig=track->GetITSsignal();
402 h->Fill(mom,sig);
403 }
404
405 }
406}
407
408//______________________________________________________________________________
409void AliAnalysisTaskPIDResponse::FillTPCqa()
410{
411 AliVEvent *event=InputEvent();
412
413 Int_t ntracks=event->GetNumberOfTracks();
414 for(Int_t itrack = 0; itrack < ntracks; itrack++){
415 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
416
417 //
418 //basic track cuts
419 //
420 ULong_t status=track->GetStatus();
421 // not that nice. status bits not in virtual interface
422 // TPC refit + ITS refit + TPC pid
423 if (!(status&0x0040==0x0040) || !(status&0x0004==0x0004) || !(status&0x0080==0x0080) ) return;
424
425 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
426 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
427 if (track->GetTPCNclsF()>0) {
428 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
429 }
430
431 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
432
433 Double_t mom=track->GetTPCmomentum();
434
435 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
436 TH2 *h=(TH2*)fListQAtpc->At(ispecie);
437 if (!h) continue;
438 Double_t nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);
439 h->Fill(mom,nSigma);
440 }
441
442 TH2 *h=(TH2*)fListQAtpc->At(AliPID::kSPECIES);
443 if (h) {
444 Double_t sig=track->GetTPCsignal();
445 h->Fill(mom,sig);
446 }
447
448 TH2 *hPt=(TH2*)fListQAtpc->At(AliPID::kSPECIES+1);
449 if (hPt) {
450 Double_t sig=track->GetTPCsignal();
451 hPt->Fill(sig);
452 }
453
454 TH2 *hMom=(TH2*)fListQAtpc->At(AliPID::kSPECIES+2);
455 if (hMom) {
456 Double_t sig=track->GetTPCmomentum();
457 hMom->Fill(sig);
458 }
459
460 }
461}
462
463//______________________________________________________________________________
464void AliAnalysisTaskPIDResponse::FillTOFqa()
465{
466 AliVEvent *event=InputEvent();
467
468 Int_t ntracks=event->GetNumberOfTracks();
469 for(Int_t itrack = 0; itrack < ntracks; itrack++){
470 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);
471
472 //
473 //basic track cuts
474 //
475 ULong_t status=track->GetStatus();
476 // not that nice. status bits not in virtual interface
477 // TPC refit + ITS refit +
478 // TOF out + TOFpid +
479 // kTIME
480 if (!(status&0x0040==0x0040) || !(status&0x0004==0x0004)
481 || !(status&0x2000==0x2000) || !(status&0x8000==0x8000)
482 || !(status&0x80000000==0x80000000) ) return;
483
484 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
485 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
486 if (track->GetTPCNclsF()>0) {
487 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
488 }
489
490 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;
491
492
493 Double_t mom=track->P();
494
495 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
496 TH2 *h=(TH2*)fListQAtof->At(ispecie);
497 if (!h) continue;
498 Double_t nSigma=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);
499 h->Fill(mom,nSigma);
500 }
501
502 TH2 *h=(TH2*)fListQAtof->At(AliPID::kSPECIES);
503 if (h) {
504 Double_t sig=track->GetTOFsignal();
505 h->Fill(mom,sig);
506 }
507
508 }
509}
510
511//______________________________________________________________________________
512void AliAnalysisTaskPIDResponse::SetupTTSqa()
513{
514 //
515 // Create the ITS qa objects
516 //
517
518 TVectorD *vX=MakeLogBinning(200,.1,30);
519
520 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
521 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_ITS_%s",AliPID::ParticleName(ispecie)),
522 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),
523 vX->GetNrows()-1,vX->GetMatrixArray(),
524 200,-10,10);
525 fListQAits->Add(hNsigmaP);
526 }
527
528
529 TH2F *hSig = new TH2F("hSigP_ITS",
530 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",
531 vX->GetNrows()-1,vX->GetMatrixArray(),
532 300,0,300);
533
534 fListQAits->Add(hSig);
535
536}
537
538//______________________________________________________________________________
539void AliAnalysisTaskPIDResponse::SetupTPCqa()
540{
541 //
542 // Create the TPC qa objects
543 //
544
545 TVectorD *vX=MakeLogBinning(200,.1,30);
546
547 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
548 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s",AliPID::ParticleName(ispecie)),
549 Form("TPC n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),
550 vX->GetNrows()-1,vX->GetMatrixArray(),
551 200,-10,10);
552 fListQAtpc->Add(hNsigmaP);
553 }
554
555
556 TH2F *hSig = new TH2F("hSigP_TPC",
557 "TPC signal vs. p;p [GeV]; TPC signal [arb. units]",
558 vX->GetNrows()-1,vX->GetMatrixArray(),
559 300,0,300);
560
561 fListQAtpc->Add(hSig);
562
563 TH1F *hPt = new TH1F("hPt","Pt_TPC",100,0,300);
564 fListQAtpc->Add(hPt);
565
566 TH1F *hMom = new TH1F("hMom","Mom_TPC",100,0,20);
567 fListQAtpc->Add(hMom);
568
569}
570
571//______________________________________________________________________________
572void AliAnalysisTaskPIDResponse::SetupTRDqa()
573{
574 //
575 // Create the TRD qa objects
576 //
577
578}
579
580//______________________________________________________________________________
581void AliAnalysisTaskPIDResponse::SetupTOFqa()
582{
583 //
584 // Create the TOF qa objects
585 //
586
587 TVectorD *vX=MakeLogBinning(200,.1,30);
588
589 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){
590 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TOF_%s",AliPID::ParticleName(ispecie)),
591 Form("TOF n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),
592 vX->GetNrows()-1,vX->GetMatrixArray(),
593 200,-10,10);
594 fListQAtof->Add(hNsigmaP);
595 }
596
597
598 TH2F *hSig = new TH2F("hSigP_TOF",
599 "TOF signal vs. p;p [GeV]; TOF signal [arb. units]",
600 vX->GetNrows()-1,vX->GetMatrixArray(),
601 300,0,300);
602
603 fListQAtof->Add(hSig);
604
605}
606
607//______________________________________________________________________________
608TVectorD* AliAnalysisTaskPIDResponse::MakeLogBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)
609{
610 //
611 // Make logarithmic binning
612 // the user has to delete the array afterwards!!!
613 //
614
615 //check limits
616 if (xmin<1e-20 || xmax<1e-20){
617 AliError("For Log binning xmin and xmax must be > 1e-20. Using linear binning instead!");
618 return MakeLinBinning(nbinsX, xmin, xmax);
619 }
620 if (xmax<xmin){
621 Double_t tmp=xmin;
622 xmin=xmax;
623 xmax=tmp;
624 }
625 TVectorD *binLim=new TVectorD(nbinsX+1);
626 Double_t first=xmin;
627 Double_t last=xmax;
628 Double_t expMax=TMath::Log(last/first);
629 for (Int_t i=0; i<nbinsX+1; ++i){
630 (*binLim)[i]=first*TMath::Exp(expMax/nbinsX*(Double_t)i);
631 }
632 return binLim;
633}
634
635//______________________________________________________________________________
636TVectorD* AliAnalysisTaskPIDResponse::MakeLinBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)
637{
638 //
639 // Make linear binning
640 // the user has to delete the array afterwards!!!
641 //
642 if (xmax<xmin){
643 Double_t tmp=xmin;
644 xmin=xmax;
645 xmax=tmp;
646 }
647 TVectorD *binLim=new TVectorD(nbinsX+1);
648 Double_t first=xmin;
649 Double_t last=xmax;
650 Double_t binWidth=(last-first)/nbinsX;
651 for (Int_t i=0; i<nbinsX+1; ++i){
652 (*binLim)[i]=first+binWidth*(Double_t)i;
653 }
654 return binLim;
655}
656
657//_____________________________________________________________________________
658TVectorD* AliAnalysisTaskPIDResponse::MakeArbitraryBinning(const char* bins)
659{
660 //
661 // Make arbitrary binning, bins separated by a ','
662 //
663 TString limits(bins);
664 if (limits.IsNull()){
665 AliError("Bin Limit string is empty, cannot add the variable");
666 return 0x0;
667 }
668
669 TObjArray *arr=limits.Tokenize(",");
670 Int_t nLimits=arr->GetEntries();
671 if (nLimits<2){
672 AliError("Need at leas 2 bin limits, cannot add the variable");
673 delete arr;
674 return 0x0;
675 }
676
677 TVectorD *binLimits=new TVectorD(nLimits);
678 for (Int_t iLim=0; iLim<nLimits; ++iLim){
679 (*binLimits)[iLim]=(static_cast<TObjString*>(arr->At(iLim)))->GetString().Atof();
680 }
681
682 delete arr;
683 return binLimits;
684}