1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // class to calculate TRD dEdx
24 // lu@physi.uni-heidelberg.de
34 #include "THnSparse.h"
38 #include "TObjArray.h"
40 #include "TStopwatch.h"
43 #include "TTreeStream.h"
46 #include "AliCDBMetaData.h"
47 #include "AliCDBStorage.h"
48 #include "AliESDEvent.h"
49 #include "AliESDfriendTrack.h"
50 #include "AliESDtrack.h"
51 #include "AliTRDtrackV1.h"
53 #include "AliTRDdEdxUtils.h"
57 THnSparseD * AliTRDdEdxUtils::fgHistGain=0x0;
58 THnSparseD * AliTRDdEdxUtils::fgHistT0=0x0;
59 THnSparseD * AliTRDdEdxUtils::fgHistVd=0x0;
60 TObjArray * AliTRDdEdxUtils::fgHistPHQ=new TObjArray(8);
62 TString AliTRDdEdxUtils::fgCalibFile;
63 TObjArray * AliTRDdEdxUtils::fgObjGain = 0x0;
64 TObjArray * AliTRDdEdxUtils::fgObjT0 = 0x0;
65 TObjArray * AliTRDdEdxUtils::fgObjVd = 0x0;
66 TObjArray * AliTRDdEdxUtils::fgObjPHQ = 0x0;
68 Int_t AliTRDdEdxUtils::fgNchamber = -999;
69 Double_t AliTRDdEdxUtils::fgChamberQ[6];
70 Double_t AliTRDdEdxUtils::fgChamberTmean[6];
72 Double_t AliTRDdEdxUtils::fgTrackTmean = -999;
74 //===================================================================================
76 //===================================================================================
77 void AliTRDdEdxUtils::GetCDFCuts(const TH1D *hh, const Int_t ncut, Double_t cuts[], const Double_t cdfs[], const Double_t thres)
80 //counts of hh is sorted
83 for(Int_t ii=0; ii<ncut; ii++){
88 const Int_t nbin = hh->GetNbinsX();
90 for(Int_t ii=1; ii<=nbin; ii++){
91 const Double_t res = hh->GetBinContent(ii);
103 TMath::Sort(nsel, datas, id, kFALSE);
105 for(Int_t ii=0; ii<ncut; ii++){
106 const Double_t icdf = cdfs[ii];
107 if(icdf<0 || icdf>1){
108 printf("AliTRDdEdxUtils::GetCDFCuts error cdfs[%d] %15f out of range!\n", ii, icdf); exit(1);
110 cuts[ii] = datas[id[Int_t(icdf*nsel)]];
114 Double_t AliTRDdEdxUtils::GetMeanRMS(const Double_t nn, const Double_t sum, const Double_t w2s, Double_t * grms, Double_t * gerr)
117 //calculate mean (with error) and rms from sum, w2s, nn
118 //if nn=0, mean, error, and rms all = 0
121 Double_t tmean = 0, trms = 0, terr = 0;
126 const Double_t arg = w2s/nn-tmean*tmean;
127 if(TMath::Abs(arg)<EPSILON){
132 printf("AliTRDdEdxUtils::GetMeanRMS error negative sqrt argument!! %e -- %e %e %f\n", arg, w2s, sum, nn); exit(1);
135 trms = TMath::Sqrt(arg);
138 terr = trms/TMath::Sqrt(nn);
152 Double_t AliTRDdEdxUtils::TruncatedMean(const Int_t nx, const Double_t xdata[], const Double_t lowfrac, const Double_t highfrac, Double_t * grms, Double_t * gerr, Double_t *wws)
155 //calculate truncated mean
156 //return <x*w>_{low-high according to x}
161 for(Int_t ii=0; ii<nx; ii++){
162 printf("test %d/%d %f\n", ii, nx, xdata[ii]);
168 TMath::Sort(nx, xdata, index, kFALSE);
173 const Int_t istart = Int_t (nx*lowfrac);
174 const Int_t istop = Int_t (nx*highfrac);
176 //=,< correct, because when low=0, high=1 it is correct
177 for(Int_t ii=istart; ii<istop; ii++){
180 weight = wws[index[ii]];
182 const Double_t sx = xdata[index[ii]]*weight;
188 //printf("test in loop %d/%d %f %f %f\n", ii, nused, sx, sum, w2s);
192 return GetMeanRMS(nused, sum, w2s, grms, gerr);
195 Double_t AliTRDdEdxUtils::TruncatedMean(const TH1 *hh, const Double_t lowfrac, const Double_t highfrac, Double_t * grms, Double_t * gerr)
198 //do truncation on histogram
200 //if hh is scaled, be sure Sumw2 is called before scaling!! then mean, rms and err will all be correct
202 //with under-/over-flow
203 Double_t npreTrunc = 0;
204 for(Int_t itmp=0; itmp<=hh->GetNbinsX()+1; itmp++){
205 const Double_t be = hh->GetBinError(itmp);
206 const Double_t bc = hh->GetBinContent(itmp);
209 printf("AliTRDdEdxUtils::TruncatedMean (hist) error %e %e %d\n", bc, be, itmp); exit(1);
213 npreTrunc += bc*bc/be/be;
216 const Double_t nstart = npreTrunc*lowfrac;
217 const Double_t nstop = npreTrunc*highfrac;
219 //with Double_t this should also handle normalized hist
224 for(Int_t itmp=0; itmp<=hh->GetNbinsX()+1; itmp++){
225 const Double_t be = hh->GetBinError(itmp);
226 const Double_t bc = hh->GetBinContent(itmp);
229 printf("AliTRDdEdxUtils::TruncatedMean (hist) error %e %e %d\n", bc, be, itmp); exit(1);
233 const Double_t weight = bc*bc/be/be;
235 //<= correct, because when high=1, nstop has to be included
236 if(ntot>nstart && ntot<=nstop){
238 const Double_t val = hh->GetBinCenter(itmp);
240 w2s += weight*val*val;
244 //printf("test %d %f %f --- %f %f -- %f %f\n", itmp, weight, val, sum, w2s, nused, nsample);
247 if(itmp>=hh->GetNbinsX()){
248 printf("AliTRDdEdxUtils::TruncatedMean warning hist range too small %s %f %f %d %d, %15f %15f %15f; nused w2s sum set to 0\n", hh->GetName(), hh->GetBinLowEdge(1), hh->GetBinLowEdge(itmp), itmp, hh->GetNbinsX(), hh->GetBinContent(hh->GetNbinsX())/hh->Integral(0,hh->GetNbinsX()+1), hh->GetBinContent(hh->GetNbinsX()), hh->Integral(0,hh->GetNbinsX()+1)); //exit(1);
256 return GetMeanRMS(nused, sum, w2s, grms, gerr);
259 void AliTRDdEdxUtils::FitSlicesY(const TH2D *hh, TH1D *&hnor, TH1D *&hmpv, TH1D *&hwid, TH1D *&hres, const Double_t thres, const Double_t lowfrac, const Double_t highfrac)
262 //fit slices of hh using truncation
265 const Int_t x0 = hh->GetXaxis()->GetFirst();
266 const Int_t x1 = hh->GetXaxis()->GetLast();
267 const Int_t y0 = hh->GetYaxis()->GetFirst();
268 const Int_t y1 = hh->GetYaxis()->GetLast();
270 const Int_t nx = hh->GetNbinsX();
271 const Int_t ny = hh->GetNbinsY();
272 const Double_t xmin = hh->GetXaxis()->GetXmin();
273 const Double_t xmax = hh->GetXaxis()->GetXmax();
274 const Double_t ymin = hh->GetYaxis()->GetXmin();
275 const Double_t ymax = hh->GetYaxis()->GetXmax();
277 hnor = new TH1D(Form("%s_amp",hh->GetName()), "", nx, xmin, xmax);
278 hmpv = new TH1D(Form("%s_mpv",hh->GetName()), "", nx, xmin, xmax);
279 hwid = new TH1D(Form("%s_wid",hh->GetName()), "", nx, xmin, xmax);
280 hres = new TH1D(Form("%s_res",hh->GetName()), "", nx, xmin, xmax);
282 for(Int_t ix=x0; ix<=x1; ix++){
284 const Double_t rawcount = hh->Integral(ix,ix,0, ny+1);
285 if(rawcount<EPSILON){
289 TH1D *htmp = new TH1D(Form("FitSlicesY_%s_%d", hh->GetName(), ix),"",ny, ymin, ymax);
291 for(Int_t iy=y0; iy<=y1; iy++){
292 const Double_t be = hh->GetBinError(ix,iy);
293 const Double_t bc = hh->GetBinContent(ix, iy);
297 printf("AliTRDdEdxUtils::FitSlicesY error %d %d %e %e\n", ix, iy, be, bc); exit(1);
302 htmp->SetBinContent(iy, bc);
303 htmp->SetBinError(iy, be);
305 ntot += (bc/be)*(bc/be);
307 //if(be) printf("test %d %d : %f %f %f\n", ix, iy, bc, be, pow(bc/be,2));
310 hnor->SetBinContent(ix, ntot);
311 hnor->SetBinError( ix, 0);
313 if(ntot<thres || htmp->GetRMS()<EPSILON){
319 Double_t trms = -999, terr = -999;
320 const Double_t tmean = TruncatedMean(htmp, lowfrac, highfrac, &trms, &terr);
322 hmpv->SetBinContent(ix, tmean);
323 hmpv->SetBinError( ix, terr);
325 hwid->SetBinContent(ix, trms);
326 hwid->SetBinError( ix, 0);
328 hres->SetBinContent(ix, tmean>EPSILON ? trms/tmean:0);
329 hres->SetBinError( ix, 0);
334 TH1 *hhs[]={hnor, hmpv, hwid, hres};
335 const TString yt[]={"N", "MPV", "#sigma", "#sigma/MPV"};
336 const Int_t nh = sizeof(hhs)/sizeof(TH1*);
337 for(Int_t ii=0; ii<nh; ii++){
338 hhs[ii]->SetYTitle(Form("%s of %s", yt[ii].Data(), hh->GetYaxis()->GetTitle()));
339 hhs[ii]->SetXTitle(hh->GetXaxis()->GetTitle());
340 hhs[ii]->GetYaxis()->SetTitleOffset(hh->GetYaxis()->GetTitleOffset());
341 hhs[ii]->SetTitle(hh->GetTitle());
345 //===================================================================================
346 // TRD Analysis Fast Tool
347 //===================================================================================
349 Int_t AliTRDdEdxUtils::GetNtracklet(const AliESDEvent *esd)
352 //number of trd tracklet in one esd event
354 const Int_t ntrk0 = esd->GetNumberOfTracks();
356 for(Int_t ii=0; ii<ntrk0; ii++){
357 ntrdv1 += esd->GetTrack(ii)->GetTRDntracklets();
362 AliTRDtrackV1 * AliTRDdEdxUtils::GetTRDtrackV1(const AliESDtrack * esdtrack)
365 //Get TRD friend track
368 AliESDfriendTrack * friendtrk = (AliESDfriendTrack *)esdtrack->GetFriendTrack();
370 //printf("xlulog AliAnalysisTaskCosmicTRD::GetTRDtrack no friend!!\n"); exit(1);
374 TObject *calibObject=0x0;
375 AliTRDtrackV1 * trdtrack=0x0;
376 for(Int_t l=0; (calibObject=friendtrk->GetCalibObject(l)); l++) {
377 if( (trdtrack=dynamic_cast<AliTRDtrackV1*>(calibObject)) )
384 Bool_t AliTRDdEdxUtils::IsInSameStack(const AliTRDtrackV1 *trdtrack)
387 // to check if all tracklets are in the same stack, useful in cosmic
390 TVectorD secs(18), stks(5);
392 for(Int_t ilayer = 0; ilayer < 6; ilayer++){
393 AliTRDseedV1 *tracklet=trdtrack->GetTracklet(ilayer);
397 const Int_t det = tracklet->GetDetector();
398 const Int_t isector = AliTRDgeometry::GetSector(det);
399 const Int_t istack = AliTRDgeometry::GetStack(det);
405 if(secs.Sum()!=1 || stks.Sum()!=1){
412 Bool_t AliTRDdEdxUtils::GetFirstSectorStackMomentum(const AliTRDtrackV1 *trdtrack, Int_t & isec, Int_t & istk, Double_t & mom)
420 for(Int_t ilayer = 0; ilayer < 6; ilayer++){
421 AliTRDseedV1 *tracklet=trdtrack->GetTracklet(ilayer);
425 const Int_t det = tracklet->GetDetector();
426 isec = AliTRDgeometry::GetSector(det);
427 istk = AliTRDgeometry::GetStack(det);
429 mom = tracklet->GetMomentum();
440 //===================================================================================
442 //===================================================================================
443 Double_t AliTRDdEdxUtils::GetCalibTPCscale(const Int_t tpcncls, const Double_t tpcsig)
446 //the scale used in calibration
449 if(tpcncls < CalibTPCnclsCut())
459 Int_t AliTRDdEdxUtils::GetPHQIterator(const Bool_t kinvq, const Double_t mag, const Int_t charge)
462 //iterator for calib obj and hist
464 return kinvq*4 + (mag>0)*2 + (charge>0);
467 TObjArray * AliTRDdEdxUtils::GetObjPHQ(const Bool_t kinvq, const Double_t mag, const Int_t charge)
473 printf("AliTRDdEdxUtils::GetObjPHQ error fgObjPHQ null!!\n"); exit(1);
476 return (TObjArray*) fgObjPHQ->At(GetPHQIterator(kinvq, mag, charge));
479 THnSparseD * AliTRDdEdxUtils::GetHistPHQ(const Bool_t kinvq, const Double_t mag, const Int_t charge)
484 return (THnSparseD*) fgHistPHQ->At(GetPHQIterator(kinvq, mag, charge));
487 TString AliTRDdEdxUtils::GetPHQName(const Bool_t kobj, const Int_t iter)
490 //get name of calib obj/hist of PHQ
492 return Form("TRDCalib%sPHQ%d", kobj?"Obj":"Hist", iter);
495 void AliTRDdEdxUtils::DeleteCalibObj()
509 fgObjPHQ->SetOwner();
515 Bool_t AliTRDdEdxUtils::GenerateDefaultPHQOCDB(const TString path)
518 //generate default OCDB object PHQ, do like
519 //AliTRDdEdxUtils::GenerateDefaultPHQOCDB("local://./")
522 TObjArray * arr8 = new TObjArray(8);
525 for(Int_t ii=0; ii<8; ii++){
526 TObjArray * arr1 = new TObjArray(1);
528 arr1->SetName(GetPHQName(1, ii));
530 const Int_t nbins = NTRDtimebin();
531 TVectorD * vec = new TVectorD(nbins);
532 for(Int_t jj=0; jj<nbins; jj++){
539 AliCDBMetaData *metaData= new AliCDBMetaData();
540 metaData->SetObjectClassName("TObjArray");
541 metaData->SetResponsible("Raphaelle Bailhache and Xianguo Lu");
543 AliCDBId id1("TRD/Calib/PHQ", 0, 999999999);
544 AliCDBStorage * gStorage = AliCDBManager::Instance()->GetStorage(path);
545 gStorage->Put(arr8, id1, metaData);
553 void AliTRDdEdxUtils::IniCalibObj()
556 //set CalibObj from file, clone to static calib obj
561 TFile *cfile=new TFile(fgCalibFile);
562 if(!cfile->IsOpen()){
563 printf("AliTRDdEdxUtils::IniCalibObj error fgCalibFile not open! %s\n", fgCalibFile.Data());exit(1);
566 printf("\nAliTRDdEdxUtils::IniCalibObj file: %s\n", fgCalibFile.Data());
569 const TString objnames[] ={"TRDCalibObjGain", "TRDCalibObjT0", "TRDCalibObjVd"};
570 TObjArray ** gobjs[]={ &fgObjGain, &fgObjT0, &fgObjVd};
572 const Int_t nobj = sizeof(objnames)/sizeof(TString);
573 for(Int_t iobj=0; iobj<nobj; iobj++){
575 cfile->GetObject(objnames[iobj], tmpo);
577 printf("AliTRDdEdxUtils::IniCalibObj error obj %s not found!\n", objnames[iobj].Data()); exit(1);
580 (*gobjs[iobj])=(TObjArray*)tmpo->Clone();
581 (*gobjs[iobj])->SetOwner();
584 fgObjPHQ = new TObjArray(8);
585 for(Int_t iter=0; iter<8; iter++){
586 const TString objn = GetPHQName(1, iter);
588 cfile->GetObject(objn, tmpo);
590 printf("AliTRDdEdxUtils::IniCalibObj error obj %s not found!\n", objn.Data()); exit(1);
593 TObjArray *obji=(TObjArray*) tmpo->Clone();
595 fgObjPHQ->AddAt(obji, iter);
604 void AliTRDdEdxUtils::DeleteCalibHist()
617 //fgHistPHQ owns the hists
618 fgHistPHQ->SetOwner();
622 void AliTRDdEdxUtils::IniCalibHist(TList *list, const Bool_t kPHQonly)
625 //initialize calib hist, list should not own the hist, or list->Clear/delete hist should not be called
631 const Double_t xmin[2]={0, 0};
634 nbin[0]=NTRDtimebin(); nbin[1]= 11250; xmax[0]=nbin[0]; xmax[1]=20;
635 for(Int_t iter=0; iter<8; iter++){
636 const TString hn = GetPHQName(0, iter);
637 THnSparseD *hi = new THnSparseD(hn, "", 2, nbin, xmin, xmax);
638 //fgHistPHQ owns the hists
639 fgHistPHQ->AddAt(hi, iter);
646 nbin[0]=NTRDchamber(); nbin[1]= 11250; xmax[0]=nbin[0]; xmax[1]=20; fgHistGain = new THnSparseD("TRDCalibHistGain", "", 2, nbin, xmin, xmax);
647 nbin[0]=NTRDchamber(); nbin[1]= 11250; xmax[0]=nbin[0]; xmax[1]=AliTRDseedV1::kNtb; fgHistT0 = new THnSparseD("TRDCalibHistT0", "", 2, nbin, xmin, xmax);
648 nbin[0]=NTRDchamber(); nbin[1]= 11250; xmax[0]=nbin[0]; xmax[1]=AliTRDseedV1::kNtb; fgHistVd = new THnSparseD("TRDCalibHistVd", "", 2, nbin, xmin, xmax);
650 list->Add(fgHistGain);
655 Bool_t AliTRDdEdxUtils::ReadCalibHist(const TString filename, const TString listname)
658 //used in AliTRDPreprocessorOffline
659 //read in calib hist from file, only for PHQ
663 //maybe already open by others... don't close
664 TFile fcalib(filename);
666 TObjArray * array = (TObjArray*)fcalib.Get(listname);
668 for(Int_t iter=0; iter<8; iter++){
669 const TString hn = GetPHQName(0, iter);
670 THnSparseD * tmph=0x0;
672 tmph = (THnSparseD *) array->FindObject(hn);
675 tmph = (THnSparseD *) fcalib.Get(hn);
678 printf("AliTRDdEdxUtils::ReadCalibHist warning calib hist not found! %s %s\n", filename.Data(), listname.Data());
685 THnSparseD *hi = (THnSparseD*)tmph->Clone();
686 fgHistPHQ->AddAt(hi, iter);
692 void AliTRDdEdxUtils::FillCalibHist(const Int_t ncls, const TVectorD *arrayQ, const TVectorD *arrayX, THnSparseD * hcalib, const Double_t scale)
695 //fill calibration hist
697 if(!hcalib){printf("AliTRDdEdxUtils::FillCalibHist errro hcalib null!!\n"); exit(1);}
699 for(Int_t ii=0; ii<ncls; ii++){
700 const Double_t dq = (*arrayQ)[ii];
701 const Double_t xx = (*arrayX)[ii];
703 const Double_t qmax = hcalib->GetAxis(1)->GetXmax() -0.5 * hcalib->GetAxis(1)->GetBinWidth(1);
704 const Double_t xmin = hcalib->GetAxis(0)->GetXmin();
705 const Double_t xmax = hcalib->GetAxis(0)->GetXmax();
707 if(xx>=xmax || xx<xmin){
708 printf("AliTRDdEdxUtils::FillCalibHist error x overflow or underflow! %s %15f %15f %15f\n", hcalib->GetName(), xx, xmin, xmax); exit(1);
711 const Double_t var[]={xx, TMath::Min(dq, qmax)/scale};
716 void AliTRDdEdxUtils::FillCalibHist(const AliTRDtrackV1 *trdv1, const Bool_t kinvq, const Double_t mag, const Int_t charge, const Double_t scale)
719 //get cluster Q and fill calib hist, if kinvq = kTRUE, 1/Q is filled
722 THnSparseD * hcalib = AliTRDdEdxUtils::GetHistPHQ(kinvq, mag, charge);
724 TVectorD arrayQ(200), arrayX(200);
725 const Int_t ncls = AliTRDdEdxUtils::GetArrayClusterQ(kinvq, &arrayQ, &arrayX, trdv1);
726 FillCalibHist(ncls, &arrayQ, &arrayX, hcalib, kinvq ? 1/scale : scale);
728 static Int_t kprint = 100;
730 printf("\nAliTRDdEdxUtils::FillCalibHist summary: \n");
731 printf("\nkinvq= %d;\n", kinvq);
732 for(Int_t iq=0; iq<ncls; iq++){
733 printf("arrayX[%3d] = %15.0f; arrayQ[%3d] = %15f;\n", iq, arrayX[iq], iq, arrayQ[iq]);
740 Int_t AliTRDdEdxUtils::ApplyCalib(const Int_t nc0, TVectorD *arrayQ, TVectorD *arrayX, const TObjArray *cobj)
743 //apply calibration on arrayQ
745 if(!cobj){ printf("AliTRDdEdxUtils::ApplyCalib error gain array null!!\n"); exit(1);}
747 TVectorD tmpq(arrayQ->GetNrows());
748 TVectorD tmpx(arrayX->GetNrows());
751 const TVectorD * gain = (TVectorD*) cobj->At(0);
752 for(Int_t ii=0; ii<nc0; ii++){
753 const Double_t dq = (*arrayQ)[ii];
754 const Int_t xx = (Int_t)(*arrayX)[ii];
755 const Double_t gg = (*gain)[xx];
772 void AliTRDdEdxUtils::GetPHCountMeanRMS(const TH1D *hnor, TH1D *&hmean)
775 //calculate from the ph calib hist the (mean-3sigma) ph-count in the chamber, save in the TH1D output
777 const Int_t ndet = 540;
778 TObjArray *obj=new TObjArray(ndet);
780 for(Int_t ii=0; ii<ndet; ii++){
781 obj->Add(new TVectorD(AliTRDseedV1::kNtb));
784 //ibin = binlowedge of bin(ibin+1) = the number fills this bin
785 for(Int_t ibin=0; ibin<hnor->GetNbinsX(); ibin++){
786 const Double_t stat = hnor->GetBinContent(ibin+1);
791 const Int_t idet = ToDetector(ibin);
792 const Int_t itb = ToTimeBin(ibin);
793 TVectorD *vec=(TVectorD *)obj->At(idet);
797 hmean = new TH1D(Form("%sdetmean", hnor->GetName()), "", hnor->GetNbinsX(), hnor->GetXaxis()->GetXmin(), hnor->GetXaxis()->GetXmax());
798 for(Int_t ibin=0; ibin<hnor->GetNbinsX(); ibin++){
799 const Int_t idet = ToDetector(ibin);
800 const TVectorD *vec=(TVectorD *)obj->At(idet);
803 for(Int_t ii=0; ii<vec->GetNrows(); ii++){
804 if((*vec)[ii]>EPSILON){
810 const Double_t lowfrac = 0.6;
811 //if there are too many 0's, reject this chamber by settig mean=rms=0
812 if(nonzero> (AliTRDseedV1::kNtb*(1-lowfrac)) ){
813 //only highest (1-lowfrac)*31 timebins are used to estimate the mean and rms! important! otherwise the 0' will make rms very large!
814 mean = TruncatedMean(AliTRDseedV1::kNtb, vec->GetMatrixArray(), lowfrac, 1);
817 hmean->SetBinContent(ibin+1, mean);
823 void AliTRDdEdxUtils::CalibOutput(const TList *lin, Int_t run)
826 //produce calibration objects
829 TString objnames("TRDCalibHistGain TRDCalibHistT0 TRDCalibHistVd ");
830 for(Int_t iter=0; iter<8; iter++){
831 objnames+= GetPHQName(0, iter)+" ";
834 TList * lout = new TList;
837 TTreeSRedirector *calibStream = new TTreeSRedirector(Form("TRDCalibStream_%010d.root", run));
839 const Int_t nh=lin->GetEntries();
840 for(Int_t ii=0; ii<nh; ii++){
841 const THnSparseD *hh=(THnSparseD*)lin->At(ii);
842 const TString hname = hh->GetName();
843 if(!objnames.Contains(hname))
846 TObjArray * cobj0 = GetCalibObj(hh, run, lout, calibStream);
852 //=============================================================
853 //=============================================================
855 TFile *fout=new TFile(Form("TRDCalibObj_%010d.root", run),"recreate");
857 const Int_t nout=lout->GetEntries();
858 for(Int_t ii=0; ii<nout; ii++){
859 const TString oname = lout->At(ii)->GetName();
860 if(oname.Contains("Obj")){
861 TObjArray * cobj = (TObjArray*) lout->At(ii);
862 cobj->Write(oname, TObjArray::kSingleKey);
869 fout=new TFile(Form("TRDCalibList_%010d.root", run),"recreate");
880 http://root.cern.ch/root/html/TH1.html
881 When an histogram is created, a reference to it is automatically added to the list of in-memory objects for the current file or directory. This default behaviour can be changed by:
883 h->SetDirectory(0); for the current histogram h
884 TH1::AddDirectory(kFALSE); sets a global switch disabling the reference
886 When the histogram is deleted, the reference to it is removed from the list of objects in memory. When a file is closed, all histograms in memory associated with this file are automatically deleted.
891 TObjArray* AliTRDdEdxUtils::GetCalibObj(const THnSparseD *hh, Int_t run, TList *lout, TTreeSRedirector *calibStream)
894 //produce calibration objects
897 const TString hname = hh->GetName();
898 const Bool_t kinvq = TString(hname(hname.First('Q')+1,1)).Atoi()&4;
900 //----------------------------------------
901 // Define nbin, tag, cobj0
902 //----------------------------------------
904 if(hname.Contains("Gain") || hname.Contains("T0") || hname.Contains("Vd")){
905 nbin = NTRDchamber();
907 else if(hname.Contains("PHQ")){
908 nbin = NTRDtimebin();
911 printf("AliTRDdEdxUtils::GetCalibObj error wrong hname!! %s\n", hname.Data()); exit(1);
915 tag.ReplaceAll("Hist","Obj");
917 TObjArray * cobj0 = new TObjArray(1);
920 cobj0->Add(new TVectorD(nbin));
922 //----------------------------------------
923 // Define lowFrac, highFrac
924 //----------------------------------------
925 Double_t lowFrac = -999, highFrac = -999;
926 if(hname.Contains("Gain") || (hname.Contains("PHQ") && !kinvq) ){
927 lowFrac = 0.01; highFrac = Q0Frac();
929 else if(hname.Contains("PHQ") && kinvq){
930 lowFrac = Q1Frac(); highFrac = 0.99;
937 //----------------------------------------
938 // Get analysis result
939 //----------------------------------------
940 TH1::AddDirectory(kFALSE);//important!
941 TH1D *hnor=0x0, *hmpv=0x0, *hres=0x0, *hwid=0x0, *htrdphmean = 0x0;//if(!lout), these have to be deleted
942 TH2D *hpj = hh->Projection(1,0);
943 FitSlicesY(hpj, hnor, hmpv, hwid, hres, 0, lowFrac, highFrac);
944 if(hname.Contains("PHQ")){
945 GetPHCountMeanRMS(hnor, htrdphmean);
947 lout->Add(htrdphmean);
959 //----------------------------------------
961 //----------------------------------------
962 TVectorD *countDet=0x0;
963 TObjArray *countSSL=0x0;
965 if(hname.Contains("PHQ") && !kinvq){
966 countDet=new TVectorD(540);
967 countSSL=new TObjArray(90);//SectorStackLayer
968 countSSL->SetOwner();
969 for(Int_t ii=0; ii<90; ii++){
970 countSSL->Add(new TVectorD(6));
974 //----------------------------------------
976 //----------------------------------------
978 //ibin = binlowedge of bin(ibin+1) = the number fills this bin
979 for(Int_t ibin=0; ibin<nbin; ibin++){
980 Double_t gnor = hnor->GetBinContent(ibin+1);
981 Double_t gmpv = hmpv->GetBinContent(ibin+1);
982 Double_t gwid = hwid->GetBinContent(ibin+1);
983 Double_t gres = hres->GetBinContent(ibin+1);
985 //--- set additional cut by kpass
986 Bool_t kpass = kTRUE;
987 Double_t gtrdphmean = -999;
989 gtrdphmean = htrdphmean->GetBinContent(ibin+1);
990 //chamber no statistics (e.g. too many 0's), not usual, not seen in run 143237
991 if(gtrdphmean<EPSILON){
994 if(gnor<TimeBinCountCut()*gtrdphmean){
999 //--- set calibration constant p0
1002 //reason for gmpv=0:
1003 //1)gnor<=3; truncation in hist: (0, 0.6*ntot=1.8 with ntot=3]={1}, in hist entries can pile up so that ntot=2, or 3, and (ntot>nstart && ntot<=nstop) is skipped;
1004 //2)TruncatedMean(hist) out of range (only for Q0, not Q1).
1006 if(gmpv>EPSILON && kpass){
1007 if(tag.Contains("T0")){
1013 //printf("outcalibobj%s %d %15.6e\n", tag.Data(), ibin, p0);
1016 (*( (TVectorD*)cobj0->At(0) ))[ibin] = p0;
1018 //--- save optional record
1019 if(p0>EPSILON && countDet && countSSL){
1020 const Int_t idet = ToDetector(ibin);
1021 (*countDet)[idet]=1;
1023 const Int_t isector = ToSector(ibin);
1024 const Int_t istack = ToStack(ibin);
1025 const Int_t ilayer = ToLayer(ibin);
1026 TVectorD * vecsectorstack = (TVectorD*)countSSL->At(istack*18+isector);
1027 (*vecsectorstack)[ilayer]=1;
1031 (*calibStream)<<tag<<
1039 "gtrdphmean="<<gtrdphmean<<
1046 //----------------------------------------
1048 //----------------------------------------
1049 if(countDet && countSSL){
1050 TVectorD count2Dstack(90);
1051 for(Int_t ii=0; ii<90; ii++){
1052 TVectorD * vecsectorstack = (TVectorD*)countSSL->At(ii);
1053 const Int_t nlayer = (Int_t)vecsectorstack->Sum();
1059 printf("\nAliTRDdEdxUtils::GetCalibObj Summary run: %d name: %s entries: %.0f ndetector: %03.0f n2dstack %02.0f\n\n", run, hname.Data(), hh->GetEntries(), countDet->Sum(), count2Dstack.Sum());
1062 //----------------------------------------
1064 //----------------------------------------
1066 TH1D **hhs[]={&hnor, &hmpv, &hwid, &hres, &htrdphmean};
1067 const Int_t nhh=sizeof(hhs)/sizeof(TH1D**);
1068 for(Int_t ihh=0; ihh<nhh; ihh++){
1077 //----------------------------------------
1082 //===================================================================================
1084 //===================================================================================
1085 Double_t AliTRDdEdxUtils::GetSignal(const Int_t nch, const Int_t ncls, const Double_t qq)
1088 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1091 printf("AliTRDdEdxUtils::GetSignal error ncls>1e3! %d\n", ncls); exit(1);
1094 return nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq);
1097 Int_t AliTRDdEdxUtils::GetNch(const Double_t signal)
1100 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1102 return Int_t(signal/1e6);
1106 Int_t AliTRDdEdxUtils::GetNcls(const Double_t signal)
1109 //signal = Nch*1e6 + Ncls*1e3 + (Q>=1e3? 999 : Q)
1112 return Int_t ( (signal-GetNch(signal)*1e6)/1e3 );
1115 Double_t AliTRDdEdxUtils::GetQ(const Double_t signal)
1118 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1121 return signal-GetNch(signal)*1e6 - GetNcls(signal)*1e3;
1124 Double_t AliTRDdEdxUtils::ToyCook(const Bool_t kinvq, Int_t &ncluster, TVectorD *arrayQ, TVectorD *arrayX, const TObjArray *cobj)
1127 //template for cookdedx
1130 if(arrayQ && arrayX){
1131 ncluster = ApplyCalib(ncluster, arrayQ, arrayX, cobj);
1134 printf("AliTRDdEdxUtils::ToyCook arrayQ arrayX null, applycalib can not be applied!\n"); exit(1);
1138 Double_t lowFrac =-999, highFrac = -999;
1140 lowFrac = Q1Frac(); highFrac = 0.99;
1143 lowFrac = 0.01; highFrac = Q0Frac();
1146 Double_t meanQ = TruncatedMean(ncluster, arrayQ->GetMatrixArray(), lowFrac, highFrac);
1156 Double_t AliTRDdEdxUtils::CombineddEdx(const Bool_t kinvq, Int_t &concls, TVectorD *coarrayQ, TVectorD *coarrayX, const Int_t tpcncls, const TVectorD *tpcarrayQ, const TVectorD *tpcarrayX, const Int_t trdncls, const TVectorD *trdarrayQ, const TVectorD *trdarrayX)
1159 //combine tpc and trd dedx
1162 for(Int_t iq=0; iq<tpcncls; iq++){
1163 (*coarrayQ)[iq]=(*tpcarrayQ)[iq];
1164 if(tpcarrayX && trdarrayX && coarrayX){
1165 (*coarrayX)[iq]=(*tpcarrayX)[iq];
1168 for(Int_t iq=0; iq<trdncls; iq++){
1169 (*coarrayQ)[tpcncls+iq]=(*trdarrayQ)[iq];
1170 if(tpcarrayX && trdarrayX && coarrayX){
1171 (*coarrayX)[tpcncls+iq]=159+(*trdarrayX)[iq];
1175 concls=trdncls+tpcncls;
1177 const Double_t coQ = ToyCook(kinvq, concls, coarrayQ, coarrayX);
1183 //===================================================================================
1184 // dEdx Getter and Setter
1185 //===================================================================================
1186 Double_t AliTRDdEdxUtils::GetAngularCorrection(const AliTRDseedV1 *seed)
1189 //return angular normalization factor
1192 return TMath::Sqrt(1+seed->GetYref(1)*seed->GetYref(1)+seed->GetZref(1)*seed->GetZref(1));
1195 Double_t AliTRDdEdxUtils::GetClusterQ(const Bool_t kinvq, const AliTRDseedV1 * seed, const Int_t itb)
1198 //get cluster charge
1201 const AliTRDcluster *cl = 0x0;
1203 cl = seed->GetClusters(itb); if(cl) dq+=cl->GetRawQ();
1204 cl = seed->GetClusters(itb+AliTRDseedV1::kNtb); if(cl) dq+=cl->GetRawQ();
1206 dq /= GetAngularCorrection(seed);
1219 Int_t AliTRDdEdxUtils::GetArrayClusterQ(const Bool_t kinvq, TVectorD *arrayQ, TVectorD *arrayX, const AliTRDtrackV1 *trdtrack, Int_t timeBin0, Int_t timeBin1, Int_t tstep)
1223 //(if kinvq, return 1/q array), size of array must be larger than 31*6
1225 if(!arrayQ || arrayQ->GetNrows()< (AliTRDseedV1::kNtb*AliTRDtrackV1::kNplane)){
1226 printf("AliTRDdEdxUtils::GetArrayClusterQ error arrayQ null or size too small! %d\n", arrayQ? arrayQ->GetNrows() : -999); exit(1);
1228 if(!arrayX || arrayX->GetNrows()< (AliTRDseedV1::kNtb*AliTRDtrackV1::kNplane)){
1229 printf("AliTRDdEdxUtils::GetArrayClusterQ error arrayX null or size too small! %d\n", arrayX? arrayX->GetNrows() : -999); exit(1);
1232 const Int_t mintb = 0;
1233 const Int_t maxtb = AliTRDseedV1::kNtb-1;
1234 if(timeBin0<mintb) timeBin0=mintb;
1235 if(timeBin1>maxtb) timeBin1=maxtb;
1236 if(tstep<=0) tstep=1;
1243 for(Int_t ichamber=0; ichamber < AliTRDtrackV1::kNplane; ichamber++){
1244 const AliTRDseedV1 * seed = trdtrack->GetTracklet(ichamber);
1248 const Int_t det = seed->GetDetector();
1250 for(Int_t itb=timeBin0; itb<=timeBin1; itb+=tstep){
1251 const Double_t dq = GetClusterQ(kinvq, seed, itb);
1255 const Int_t gtb = det * AliTRDseedV1::kNtb + itb;
1264 for(Int_t iq=0; iq<tbN; iq++){
1268 (*arrayQ)[ncls] = tbQ[iq];
1269 (*arrayX)[ncls] = tbBin[iq];
1274 static Int_t kprint = 100;
1276 printf("\nAliTRDdEdxUtils::GetArrayClusterQ raw cluster-Q\n");
1277 for(Int_t iq=0; iq<ncls; iq++){
1278 const Int_t ichamber = ToLayer((*arrayX)[iq]);
1279 const AliTRDseedV1 * seed = trdtrack->GetTracklet(ichamber);
1281 printf("error seed null!!\n"); exit(1);
1283 const Double_t rawq = (*arrayQ)[iq] * 45. * GetAngularCorrection(seed);
1284 printf("esdid=%d; chamber=%d; timebin=%d; rawq= %.3f; myq[%d]= %e;\n", trdtrack->GetESDid(), ichamber, ToTimeBin((*arrayX)[iq]), rawq, iq, (*arrayQ)[iq]);
1293 Int_t AliTRDdEdxUtils::UpdateArrayX(const Int_t ncls, TVectorD* arrayX)
1296 //arrayX det*Ntb+itb -> itb
1299 TVectorD countChamber(6);
1300 for(Int_t ii = 0; ii<ncls; ii++){
1301 const Int_t xx = (Int_t)(*arrayX)[ii];
1302 const Int_t idet = ToDetector(xx);
1304 const Double_t ich = AliTRDgeometry::GetLayer(idet);
1305 const Double_t itb = ToTimeBin(xx);
1306 (*arrayX)[ii] = ich*AliTRDseedV1::kNtb+itb;
1308 countChamber[ich] = 1;
1311 const Double_t nch = countChamber.Sum();
1315 void AliTRDdEdxUtils::SetChamberQT(const AliTRDtrackV1 *trdtrack, const Int_t kcalib, THnSparseD * hgain, THnSparseD * ht0, THnSparseD * hvd)
1318 //CookdEdx at TRD track level, use chamber info, related calibrations: chamber-gain; T0, Vd based on raw PH distribution
1321 static Int_t kprint = 100;
1324 for(Int_t ichamber=0; ichamber < AliTRDtrackV1::kNplane; ichamber++){
1325 //initialize output, default values: 0, so that summation and weighting will automatically discard default quantities
1326 fgChamberQ[ichamber] = fgChamberTmean[ichamber] = 0;
1328 const AliTRDseedV1 *seed = trdtrack->GetTracklet(ichamber);
1332 const Int_t idet = seed->GetDetector();
1334 //-------------------------------------------------------------------------
1336 Double_t qsum = 0, qtsum = 0, w2sum = 0;
1337 for(Int_t itb=0; itb<AliTRDseedV1::kNtb; itb++){
1338 const Double_t dq = GetClusterQ(0, seed, itb);
1344 w2sum += dq*itb*itb;
1349 //-------------------------------------------------------------------------
1351 Double_t tbm, tbr = 0;
1352 tbm = GetMeanRMS(qsum, qtsum, w2sum, &tbr);
1357 const Double_t var[]={idet, qsum};
1361 const Double_t var[]={idet, tbm};
1365 const Double_t var[]={idet, tbr};
1369 Double_t gain = 1, t0 = 0, vd = 1;
1371 if(!fgObjGain) {printf("AliTRDdEdxUtils::SetChamberQT error Gain array null!!\n"); exit(1);}
1372 if(! fgObjT0) {printf("AliTRDdEdxUtils::SetChamberQT error T0 array null!!\n"); exit(1);}
1373 if(! fgObjVd) {printf("AliTRDdEdxUtils::SetChamberQT error Vd array null!!\n"); exit(1);}
1375 const TVectorD * gainvec = (TVectorD*) fgObjGain->At(0); gain = (*gainvec)[idet];
1376 const TVectorD * t0vec = (TVectorD*) fgObjT0->At(0); t0 = (* t0vec)[idet];
1377 const TVectorD * vdvec = (TVectorD*) fgObjVd->At(0); vd = (* vdvec)[idet];
1380 printf("\nAliTRDdEdxUtils::CookdEdxV2\n");
1381 printf("idet = %d;\n", idet);
1382 printf("gain = %15f; t0 = %15f; vd = %15f;\n", gain, t0, vd);
1392 //-------------------------------------------------------------------------
1394 //should have non-zero value, initialized with default 0 (except for calibrated tbm, may be very close to 0)
1395 fgChamberQ[ichamber] = qsum;
1396 fgChamberTmean[ichamber] = tbm;
1401 printf("\nAliTRDdEdxUtils::CookdEdxV2 summary:\n");
1403 printf("\nfgNchamber = %d\n", fgNchamber);
1404 for(Int_t ich=0; ich<AliTRDtrackV1::kNplane; ich++){
1405 printf("fgChamberTmean[%d] = %15f; fgChamberQ[%d] = %15f;\n", ich, fgChamberTmean[ich], ich, fgChamberQ[ich]);
1409 fgTrackTmean = -999;
1412 for(Int_t ich=0; ich<AliTRDtrackV1::kNplane; ich++){
1413 fgTrackTmean += fgChamberTmean[ich];
1415 fgTrackTmean /= fgNchamber;
1419 printf("\nAliTRDdEdxUtils::CookdEdxV2\n");
1420 printf("GetTrackTmean() %15f\n", GetTrackTmean());
1429 //===================================================================================
1430 // dEdx Parameterization
1431 //===================================================================================
1433 Double_t AliTRDdEdxUtils::Q0MeanTRDpp(const Double_t bg)
1436 //truncated Mean Q_{xx} in TRD
1442 par[0]= 2.397001e-01;
1443 par[1]= 1.334697e+00;
1444 par[2]= 6.967470e+00;
1445 par[3]= 9.055289e-02;
1446 par[4]= 9.388760e+00;
1447 par[5]= 9.452742e-04;
1448 par[6]= -1.866091e+00;
1449 par[7]= 1.403545e+00;
1451 ///u/xlu/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot/Separation/see2.log:hhtype2Q0b2c2 scale 0.428543 at ltbg 0.650000
1452 return 0.428543*MeandEdxTR(&bg, par);
1455 Double_t AliTRDdEdxUtils::Q0MeanTRDPbPb(const Double_t bg)
1458 //truncated Mean Q_{xx} in TRD
1465 par[0]= 1.844912e-01;
1466 par[1]= 2.509702e+00;
1467 par[2]= 6.744031e+00;
1468 par[3]= 7.355123e-02;
1469 par[4]= 1.166023e+01;
1470 par[5]= 1.736186e-04;
1471 par[6]= -1.716063e+00;
1472 par[7]= 1.611366e+00;
1474 ///u/xlu/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot/Separation/see4.log:hhtype4Q0b2c2 scale 0.460994 at ltbg 0.650000
1475 return 0.460994*MeandEdxTR(&bg, par);
1478 Double_t AliTRDdEdxUtils::Q1MeanTRDpp(const Double_t bg)
1481 //truncated Mean 1/(1/Q)_{xx} in TRD
1486 //So 4. Mär 13:30:51 CET 2012
1488 par[0]= 2.434646e-01;
1489 par[1]= 1.400211e+00;
1490 par[2]= 6.937471e+00;
1491 par[3]= 7.758118e-02;
1492 par[4]= 1.097372e+01;
1493 par[5]= 4.297518e-04;
1494 par[6]= -1.806266e+00;
1495 par[7]= 1.543811e+00;
1497 //hhtype2Q1b2c2 scale 0.418629 at ltbg 0.650000
1499 return 0.418629*MeandEdxTR(&bg, par);
1502 Double_t AliTRDdEdxUtils::Q1MeanTRDPbPb(const Double_t bg)
1505 //truncated Mean 1/(1/Q)_{xx} in TRD
1510 //So 4. Mär 13:30:52 CET 2012
1512 par[0]= 2.193660e-01;
1513 par[1]= 2.051864e+00;
1514 par[2]= 6.825112e+00;
1515 par[3]= 6.151693e-02;
1516 par[4]= 1.390343e+01;
1517 par[5]= 6.010032e-05;
1518 par[6]= -1.676324e+00;
1519 par[7]= 1.838873e+00;
1521 //hhtype4Q1b2c2 scale 0.457988 at ltbg 0.650000
1523 return 0.457988*MeandEdxTR(&bg, par);
1526 Double_t AliTRDdEdxUtils::QMeanTPC(const Double_t bg)
1529 //bethe bloch in TPC
1533 //Mi 15. Feb 14:48:05 CET 2012
1534 //train_2012-02-13_1214.12001, tpcsig
1541 return MeandEdx(&bg, par);
1544 Double_t AliTRDdEdxUtils::MeandEdxTR(const Double_t * xx, const Double_t * pin)
1547 //ALEPH+LOGISTIC parametrization for dEdx+TR, in unit of MIP
1550 Double_t ptr[4]={0};
1551 for(int ii=0; ii<3; ii++){
1554 return MeanTR(xx,ptr) + MeandEdx(xx,&(pin[3]));
1557 Double_t AliTRDdEdxUtils::MeanTR(const Double_t * xx, const Double_t * par)
1560 //ALEPH+LOGISTIC parametrization for dEdx+TR, in unit of MIP
1564 const Double_t bg = xx[0];
1565 const Double_t gamma = sqrt(1+bg*bg);
1567 const Double_t p0 = TMath::Abs(par[1]);
1568 const Double_t p1 = TMath::Abs(par[2]);
1569 const Double_t p2 = TMath::Abs(par[3]);
1571 const Double_t zz = TMath::Log(gamma);
1572 const Double_t tryield = p0/( 1 + TMath::Exp(-p1*(zz-p2)) );
1574 return par[0]+tryield;
1577 Double_t AliTRDdEdxUtils::MeandEdx(const Double_t * xx, const Double_t * par)
1580 //ALEPH parametrization for dEdx
1584 const Double_t bg = xx[0];
1585 const Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
1587 const Double_t p0 = TMath::Abs(par[0]);
1588 const Double_t p1 = TMath::Abs(par[1]);
1589 const Double_t p2 = TMath::Abs(par[2]);
1590 const Double_t p3 = TMath::Abs(par[3]);
1591 const Double_t p4 = TMath::Abs(par[4]);
1593 const Double_t aa = TMath::Power(beta, p3);
1594 const Double_t bb = TMath::Log( p2 + TMath::Power(1./bg, p4) );
1596 //printf("test----- %f %f -- %f %f %f %f %f --- %f %f %f\n", bg, beta, p0, p1, p2, p3, p4, p0/aa, aa, bb);
1598 return (p1-aa-bb)*p0/aa;
1601 Double_t AliTRDdEdxUtils::ToLogx(FFunc func, const Double_t * xx, const Double_t * par)
1604 //f(x)-> f(y) with y=log10(x)
1606 const Double_t x2[]={TMath::Power(10, xx[0])};
1607 return func(x2, par);
1610 //===================================================================================
1611 // Detector, Data and Control Constant
1612 //===================================================================================
1613 Int_t AliTRDdEdxUtils::ToDetector(const Int_t gtb)
1618 return gtb/AliTRDseedV1::kNtb;
1621 Int_t AliTRDdEdxUtils::ToTimeBin(const Int_t gtb)
1626 return gtb%AliTRDseedV1::kNtb;
1629 Int_t AliTRDdEdxUtils::ToSector(const Int_t gtb)
1634 return AliTRDgeometry::GetSector(ToDetector(gtb));
1637 Int_t AliTRDdEdxUtils::ToStack(const Int_t gtb)
1642 return AliTRDgeometry::GetStack(ToDetector(gtb));
1645 Int_t AliTRDdEdxUtils::ToLayer(const Int_t gtb)
1650 return AliTRDgeometry::GetLayer(ToDetector(gtb));
1653 TString AliTRDdEdxUtils::GetRunType(const Int_t run)
1660 if(run>=121527 && run<= 126460)//LHC10d
1661 type="pp2010LHC10d";
1662 else if(run>=126461 && run<= 130930)//LHC10e
1663 type="pp2010LHC10e";
1664 else if(run>=136782 && run <= 139846)//LHC10h
1665 type="PbPb2010LHC10h";
1666 else if(run>= 143224 && run<= 143237)//2011Feb
1667 type="cosmic2011Feb";
1668 else if(run>= 150587 && run<= 154930){
1669 type="cosmic2011MayJun";
1671 TString runstr(Form("%d",run));
1672 const TString listrun1kg("154601 154602 154629 154634 154636 154639 154643");
1673 if(listrun1kg.Contains(runstr)){
1688 void AliTRDdEdxUtils::PrintControl()
1691 //print out control variable
1693 printf("\nAliTRDdEdxUtils::PrintControl Q0Frac %.1f, Q1Frac %.1f, TimeBinCountCut %.2f, CalibTPCnclsCut %d, IsExBOn %d\n\n", Q0Frac(), Q1Frac(), TimeBinCountCut(), CalibTPCnclsCut(), IsExBOn());
1695 //===================================================================================
1696 //===================================================================================