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());
683 THnSparseD *hi = (THnSparseD*)tmph->Clone();
684 fgHistPHQ->AddAt(hi, iter);
690 void AliTRDdEdxUtils::FillCalibHist(const Int_t ncls, const TVectorD *arrayQ, const TVectorD *arrayX, THnSparseD * hcalib, const Double_t scale)
693 //fill calibration hist
695 if(!hcalib){printf("AliTRDdEdxUtils::FillCalibHist errro hcalib null!!\n"); exit(1);}
697 for(Int_t ii=0; ii<ncls; ii++){
698 const Double_t dq = (*arrayQ)[ii];
699 const Double_t xx = (*arrayX)[ii];
701 const Double_t qmax = hcalib->GetAxis(1)->GetXmax() -0.5 * hcalib->GetAxis(1)->GetBinWidth(1);
702 const Double_t xmin = hcalib->GetAxis(0)->GetXmin();
703 const Double_t xmax = hcalib->GetAxis(0)->GetXmax();
705 if(xx>=xmax || xx<xmin){
706 printf("AliTRDdEdxUtils::FillCalibHist error x overflow or underflow! %s %15f %15f %15f\n", hcalib->GetName(), xx, xmin, xmax); exit(1);
709 const Double_t var[]={xx, TMath::Min(dq, qmax)/scale};
714 void AliTRDdEdxUtils::FillCalibHist(const AliTRDtrackV1 *trdv1, const Bool_t kinvq, const Double_t mag, const Int_t charge, const Double_t scale)
717 //get cluster Q and fill calib hist, if kinvq = kTRUE, 1/Q is filled
720 THnSparseD * hcalib = AliTRDdEdxUtils::GetHistPHQ(kinvq, mag, charge);
722 TVectorD arrayQ(200), arrayX(200);
723 const Int_t ncls = AliTRDdEdxUtils::GetArrayClusterQ(kinvq, &arrayQ, &arrayX, trdv1);
724 FillCalibHist(ncls, &arrayQ, &arrayX, hcalib, kinvq ? 1/scale : scale);
726 static Int_t kprint = 100;
728 printf("\nAliTRDdEdxUtils::FillCalibHist summary: \n");
729 printf("\nkinvq= %d;\n", kinvq);
730 for(Int_t iq=0; iq<ncls; iq++){
731 printf("arrayX[%3d] = %15.0f; arrayQ[%3d] = %15f;\n", iq, arrayX[iq], iq, arrayQ[iq]);
738 Int_t AliTRDdEdxUtils::ApplyCalib(const Int_t nc0, TVectorD *arrayQ, TVectorD *arrayX, const TObjArray *cobj)
741 //apply calibration on arrayQ
743 if(!cobj){ printf("AliTRDdEdxUtils::ApplyCalib error gain array null!!\n"); exit(1);}
745 TVectorD tmpq(arrayQ->GetNrows());
746 TVectorD tmpx(arrayX->GetNrows());
749 const TVectorD * gain = (TVectorD*) cobj->At(0);
750 for(Int_t ii=0; ii<nc0; ii++){
751 const Double_t dq = (*arrayQ)[ii];
752 const Int_t xx = (Int_t)(*arrayX)[ii];
753 const Double_t gg = (*gain)[xx];
770 void AliTRDdEdxUtils::GetPHCountMeanRMS(const TH1D *hnor, TH1D *&hmean)
773 //calculate from the ph calib hist the (mean-3sigma) ph-count in the chamber, save in the TH1D output
775 const Int_t ndet = 540;
776 TObjArray *obj=new TObjArray(ndet);
778 for(Int_t ii=0; ii<ndet; ii++){
779 obj->Add(new TVectorD(AliTRDseedV1::kNtb));
782 //ibin = binlowedge of bin(ibin+1) = the number fills this bin
783 for(Int_t ibin=0; ibin<hnor->GetNbinsX(); ibin++){
784 const Double_t stat = hnor->GetBinContent(ibin+1);
789 const Int_t idet = ToDetector(ibin);
790 const Int_t itb = ToTimeBin(ibin);
791 TVectorD *vec=(TVectorD *)obj->At(idet);
795 hmean = new TH1D(Form("%sdetmean", hnor->GetName()), "", hnor->GetNbinsX(), hnor->GetXaxis()->GetXmin(), hnor->GetXaxis()->GetXmax());
796 for(Int_t ibin=0; ibin<hnor->GetNbinsX(); ibin++){
797 const Int_t idet = ToDetector(ibin);
798 const TVectorD *vec=(TVectorD *)obj->At(idet);
801 for(Int_t ii=0; ii<vec->GetNrows(); ii++){
802 if((*vec)[ii]>EPSILON){
808 const Double_t lowfrac = 0.6;
809 //if there are too many 0's, reject this chamber by settig mean=rms=0
810 if(nonzero> (AliTRDseedV1::kNtb*(1-lowfrac)) ){
811 //only highest (1-lowfrac)*31 timebins are used to estimate the mean and rms! important! otherwise the 0' will make rms very large!
812 mean = TruncatedMean(AliTRDseedV1::kNtb, vec->GetMatrixArray(), lowfrac, 1);
815 hmean->SetBinContent(ibin+1, mean);
821 void AliTRDdEdxUtils::CalibOutput(const TList *lin, Int_t run)
824 //produce calibration objects
827 TString objnames("TRDCalibHistGain TRDCalibHistT0 TRDCalibHistVd ");
828 for(Int_t iter=0; iter<8; iter++){
829 objnames+= GetPHQName(0, iter)+" ";
832 TList * lout = new TList;
835 TTreeSRedirector *calibStream = new TTreeSRedirector(Form("TRDCalibStream_%010d.root", run));
837 const Int_t nh=lin->GetEntries();
838 for(Int_t ii=0; ii<nh; ii++){
839 const THnSparseD *hh=(THnSparseD*)lin->At(ii);
840 const TString hname = hh->GetName();
841 if(!objnames.Contains(hname))
844 TObjArray * cobj0 = GetCalibObj(hh, run, lout, calibStream);
850 //=============================================================
851 //=============================================================
853 TFile *fout=new TFile(Form("TRDCalibObj_%010d.root", run),"recreate");
855 const Int_t nout=lout->GetEntries();
856 for(Int_t ii=0; ii<nout; ii++){
857 const TString oname = lout->At(ii)->GetName();
858 if(oname.Contains("Obj")){
859 TObjArray * cobj = (TObjArray*) lout->At(ii);
860 cobj->Write(oname, TObjArray::kSingleKey);
867 fout=new TFile(Form("TRDCalibList_%010d.root", run),"recreate");
878 http://root.cern.ch/root/html/TH1.html
879 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:
881 h->SetDirectory(0); for the current histogram h
882 TH1::AddDirectory(kFALSE); sets a global switch disabling the reference
884 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.
889 TObjArray* AliTRDdEdxUtils::GetCalibObj(const THnSparseD *hh, Int_t run, TList *lout, TTreeSRedirector *calibStream)
892 //produce calibration objects
895 const TString hname = hh->GetName();
896 const Bool_t kinvq = TString(hname(hname.First('Q')+1,1)).Atoi()&4;
898 //----------------------------------------
899 // Define nbin, tag, cobj0
900 //----------------------------------------
902 if(hname.Contains("Gain") || hname.Contains("T0") || hname.Contains("Vd")){
903 nbin = NTRDchamber();
905 else if(hname.Contains("PHQ")){
906 nbin = NTRDtimebin();
909 printf("AliTRDdEdxUtils::GetCalibObj error wrong hname!! %s\n", hname.Data()); exit(1);
913 tag.ReplaceAll("Hist","Obj");
915 TObjArray * cobj0 = new TObjArray(1);
918 cobj0->Add(new TVectorD(nbin));
920 //----------------------------------------
921 // Define lowFrac, highFrac
922 //----------------------------------------
923 Double_t lowFrac = -999, highFrac = -999;
924 if(hname.Contains("Gain") || (hname.Contains("PHQ") && !kinvq) ){
925 lowFrac = 0.01; highFrac = Q0Frac();
927 else if(hname.Contains("PHQ") && kinvq){
928 lowFrac = Q1Frac(); highFrac = 0.99;
935 //----------------------------------------
936 // Get analysis result
937 //----------------------------------------
938 TH1::AddDirectory(kFALSE);//important!
939 TH1D *hnor=0x0, *hmpv=0x0, *hres=0x0, *hwid=0x0, *htrdphmean = 0x0;//if(!lout), these have to be deleted
940 TH2D *hpj = hh->Projection(1,0);
941 FitSlicesY(hpj, hnor, hmpv, hwid, hres, 0, lowFrac, highFrac);
942 if(hname.Contains("PHQ")){
943 GetPHCountMeanRMS(hnor, htrdphmean);
945 lout->Add(htrdphmean);
957 //----------------------------------------
959 //----------------------------------------
960 TVectorD *countDet=0x0;
961 TObjArray *countSSL=0x0;
963 if(hname.Contains("PHQ") && !kinvq){
964 countDet=new TVectorD(540);
965 countSSL=new TObjArray(90);//SectorStackLayer
966 countSSL->SetOwner();
967 for(Int_t ii=0; ii<90; ii++){
968 countSSL->Add(new TVectorD(6));
972 //----------------------------------------
974 //----------------------------------------
976 //ibin = binlowedge of bin(ibin+1) = the number fills this bin
977 for(Int_t ibin=0; ibin<nbin; ibin++){
978 Double_t gnor = hnor->GetBinContent(ibin+1);
979 Double_t gmpv = hmpv->GetBinContent(ibin+1);
980 Double_t gwid = hwid->GetBinContent(ibin+1);
981 Double_t gres = hres->GetBinContent(ibin+1);
983 //--- set additional cut by kpass
984 Bool_t kpass = kTRUE;
985 Double_t gtrdphmean = -999;
987 gtrdphmean = htrdphmean->GetBinContent(ibin+1);
988 //chamber no statistics (e.g. too many 0's), not usual, not seen in run 143237
989 if(gtrdphmean<EPSILON){
992 if(gnor<TimeBinCountCut()*gtrdphmean){
997 //--- set calibration constant p0
1000 //reason for gmpv=0:
1001 //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;
1002 //2)TruncatedMean(hist) out of range (only for Q0, not Q1).
1004 if(gmpv>EPSILON && kpass){
1005 if(tag.Contains("T0")){
1011 //printf("outcalibobj%s %d %15.6e\n", tag.Data(), ibin, p0);
1014 (*( (TVectorD*)cobj0->At(0) ))[ibin] = p0;
1016 //--- save optional record
1017 if(p0>EPSILON && countDet && countSSL){
1018 const Int_t idet = ToDetector(ibin);
1019 (*countDet)[idet]=1;
1021 const Int_t isector = ToSector(ibin);
1022 const Int_t istack = ToStack(ibin);
1023 const Int_t ilayer = ToLayer(ibin);
1024 TVectorD * vecsectorstack = (TVectorD*)countSSL->At(istack*18+isector);
1025 (*vecsectorstack)[ilayer]=1;
1029 (*calibStream)<<tag<<
1037 "gtrdphmean="<<gtrdphmean<<
1044 //----------------------------------------
1046 //----------------------------------------
1047 if(countDet && countSSL){
1048 TVectorD count2Dstack(90);
1049 for(Int_t ii=0; ii<90; ii++){
1050 TVectorD * vecsectorstack = (TVectorD*)countSSL->At(ii);
1051 const Int_t nlayer = (Int_t)vecsectorstack->Sum();
1057 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());
1060 //----------------------------------------
1062 //----------------------------------------
1064 TH1D **hhs[]={&hnor, &hmpv, &hwid, &hres, &htrdphmean};
1065 const Int_t nhh=sizeof(hhs)/sizeof(TH1D**);
1066 for(Int_t ihh=0; ihh<nhh; ihh++){
1075 //----------------------------------------
1080 //===================================================================================
1082 //===================================================================================
1083 Double_t AliTRDdEdxUtils::GetSignal(const Int_t nch, const Int_t ncls, const Double_t qq)
1086 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1089 printf("AliTRDdEdxUtils::GetSignal error ncls>1e3! %d\n", ncls); exit(1);
1092 return nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq);
1095 Int_t AliTRDdEdxUtils::GetNch(const Double_t signal)
1098 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1100 return Int_t(signal/1e6);
1104 Int_t AliTRDdEdxUtils::GetNcls(const Double_t signal)
1107 //signal = Nch*1e6 + Ncls*1e3 + (Q>=1e3? 999 : Q)
1110 return Int_t ( (signal-GetNch(signal)*1e6)/1e3 );
1113 Double_t AliTRDdEdxUtils::GetQ(const Double_t signal)
1116 //signal = nch*1e6 + ncls*1e3 + (qq>=1e3? 999 : qq)
1119 return signal-GetNch(signal)*1e6 - GetNcls(signal)*1e3;
1122 Double_t AliTRDdEdxUtils::ToyCook(const Bool_t kinvq, Int_t &ncluster, TVectorD *arrayQ, TVectorD *arrayX, const TObjArray *cobj)
1125 //template for cookdedx
1128 if(arrayQ && arrayX){
1129 ncluster = ApplyCalib(ncluster, arrayQ, arrayX, cobj);
1132 printf("AliTRDdEdxUtils::ToyCook arrayQ arrayX null, applycalib can not be applied!\n"); exit(1);
1136 Double_t lowFrac =-999, highFrac = -999;
1138 lowFrac = Q1Frac(); highFrac = 0.99;
1141 lowFrac = 0.01; highFrac = Q0Frac();
1144 Double_t meanQ = TruncatedMean(ncluster, arrayQ->GetMatrixArray(), lowFrac, highFrac);
1154 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)
1157 //combine tpc and trd dedx
1160 for(Int_t iq=0; iq<tpcncls; iq++){
1161 (*coarrayQ)[iq]=(*tpcarrayQ)[iq];
1162 if(tpcarrayX && trdarrayX && coarrayX){
1163 (*coarrayX)[iq]=(*tpcarrayX)[iq];
1166 for(Int_t iq=0; iq<trdncls; iq++){
1167 (*coarrayQ)[tpcncls+iq]=(*trdarrayQ)[iq];
1168 if(tpcarrayX && trdarrayX && coarrayX){
1169 (*coarrayX)[tpcncls+iq]=159+(*trdarrayX)[iq];
1173 concls=trdncls+tpcncls;
1175 const Double_t coQ = ToyCook(kinvq, concls, coarrayQ, coarrayX);
1181 //===================================================================================
1182 // dEdx Getter and Setter
1183 //===================================================================================
1184 Double_t AliTRDdEdxUtils::GetAngularCorrection(const AliTRDseedV1 *seed)
1187 //return angular normalization factor
1190 return TMath::Sqrt(1+seed->GetYref(1)*seed->GetYref(1)+seed->GetZref(1)*seed->GetZref(1));
1193 Double_t AliTRDdEdxUtils::GetClusterQ(const Bool_t kinvq, const AliTRDseedV1 * seed, const Int_t itb)
1196 //get cluster charge
1199 const AliTRDcluster *cl = 0x0;
1201 cl = seed->GetClusters(itb); if(cl) dq+=cl->GetRawQ();
1202 cl = seed->GetClusters(itb+AliTRDseedV1::kNtb); if(cl) dq+=cl->GetRawQ();
1204 dq /= GetAngularCorrection(seed);
1217 Int_t AliTRDdEdxUtils::GetArrayClusterQ(const Bool_t kinvq, TVectorD *arrayQ, TVectorD *arrayX, const AliTRDtrackV1 *trdtrack, Int_t timeBin0, Int_t timeBin1, Int_t tstep)
1221 //(if kinvq, return 1/q array), size of array must be larger than 31*6
1223 if(!arrayQ || arrayQ->GetNrows()< (AliTRDseedV1::kNtb*AliTRDtrackV1::kNplane)){
1224 printf("AliTRDdEdxUtils::GetArrayClusterQ error arrayQ null or size too small! %d\n", arrayQ? arrayQ->GetNrows() : -999); exit(1);
1226 if(!arrayX && arrayX->GetNrows()< (AliTRDseedV1::kNtb*AliTRDtrackV1::kNplane)){
1227 printf("AliTRDdEdxUtils::GetArrayClusterQ error arrayX null or size too small! %d\n", arrayX? arrayX->GetNrows() : -999); exit(1);
1230 const Int_t mintb = 0;
1231 const Int_t maxtb = AliTRDseedV1::kNtb-1;
1232 if(timeBin0<mintb) timeBin0=mintb;
1233 if(timeBin1>maxtb) timeBin1=maxtb;
1234 if(tstep<=0) tstep=1;
1241 for(Int_t ichamber=0; ichamber < AliTRDtrackV1::kNplane; ichamber++){
1242 const AliTRDseedV1 * seed = trdtrack->GetTracklet(ichamber);
1246 const Int_t det = seed->GetDetector();
1248 for(Int_t itb=timeBin0; itb<=timeBin1; itb+=tstep){
1249 const Double_t dq = GetClusterQ(kinvq, seed, itb);
1253 const Int_t gtb = det * AliTRDseedV1::kNtb + itb;
1262 for(Int_t iq=0; iq<tbN; iq++){
1266 (*arrayQ)[ncls] = tbQ[iq];
1267 (*arrayX)[ncls] = tbBin[iq];
1274 printf("\nAliTRDdEdxUtils::GetArrayClusterQ raw cluster-Q\n");
1275 for(Int_t iq=0; iq<ncls; iq++){
1276 const Int_t ichamber = ToLayer((*arrayX)[iq]);
1277 const AliTRDseedV1 * seed = trdtrack->GetTracklet(ichamber);
1279 printf("error seed null!!\n"); exit(1);
1281 const Double_t rawq = (*arrayQ)[iq] * 45. * GetAngularCorrection(seed);
1282 printf("esdid=%d; chamber=%d; timebin=%d; rawq= %.3f; myq[%d]= %e;\n", trdtrack->GetESDid(), ichamber, ToTimeBin((*arrayX)[iq]), rawq, iq, (*arrayQ)[iq]);
1290 Int_t AliTRDdEdxUtils::UpdateArrayX(const Int_t ncls, TVectorD* arrayX)
1293 //arrayX det*Ntb+itb -> itb
1296 TVectorD countChamber(6);
1297 for(Int_t ii = 0; ii<ncls; ii++){
1298 const Int_t xx = (Int_t)(*arrayX)[ii];
1299 const Int_t idet = ToDetector(xx);
1301 const Double_t ich = AliTRDgeometry::GetLayer(idet);
1302 const Double_t itb = ToTimeBin(xx);
1303 (*arrayX)[ii] = ich*AliTRDseedV1::kNtb+itb;
1305 countChamber[ich] = 1;
1308 const Double_t nch = countChamber.Sum();
1312 void AliTRDdEdxUtils::SetChamberQT(const AliTRDtrackV1 *trdtrack, const Int_t kcalib, THnSparseD * hgain, THnSparseD * ht0, THnSparseD * hvd)
1315 //CookdEdx at TRD track level, use chamber info, related calibrations: chamber-gain; T0, Vd based on raw PH distribution
1318 static Int_t kprint = 100;
1321 for(Int_t ichamber=0; ichamber < AliTRDtrackV1::kNplane; ichamber++){
1322 //initialize output, default values: 0, so that summation and weighting will automatically discard default quantities
1323 fgChamberQ[ichamber] = fgChamberTmean[ichamber] = 0;
1325 const AliTRDseedV1 *seed = trdtrack->GetTracklet(ichamber);
1329 const Int_t idet = seed->GetDetector();
1331 //-------------------------------------------------------------------------
1333 Double_t qsum = 0, qtsum = 0, w2sum = 0;
1334 for(Int_t itb=0; itb<AliTRDseedV1::kNtb; itb++){
1335 const Double_t dq = GetClusterQ(0, seed, itb);
1341 w2sum += dq*itb*itb;
1346 //-------------------------------------------------------------------------
1348 Double_t tbm, tbr = 0;
1349 tbm = GetMeanRMS(qsum, qtsum, w2sum, &tbr);
1354 const Double_t var[]={idet, qsum};
1358 const Double_t var[]={idet, tbm};
1362 const Double_t var[]={idet, tbr};
1366 Double_t gain = 1, t0 = 0, vd = 1;
1368 if(!fgObjGain) {printf("AliTRDdEdxUtils::SetChamberQT error Gain array null!!\n"); exit(1);}
1369 if(! fgObjT0) {printf("AliTRDdEdxUtils::SetChamberQT error T0 array null!!\n"); exit(1);}
1370 if(! fgObjVd) {printf("AliTRDdEdxUtils::SetChamberQT error Vd array null!!\n"); exit(1);}
1372 const TVectorD * gainvec = (TVectorD*) fgObjGain->At(0); gain = (*gainvec)[idet];
1373 const TVectorD * t0vec = (TVectorD*) fgObjT0->At(0); t0 = (* t0vec)[idet];
1374 const TVectorD * vdvec = (TVectorD*) fgObjVd->At(0); vd = (* vdvec)[idet];
1377 printf("\nAliTRDdEdxUtils::CookdEdxV2\n");
1378 printf("idet = %d;\n", idet);
1379 printf("gain = %15f; t0 = %15f; vd = %15f;\n", gain, t0, vd);
1389 //-------------------------------------------------------------------------
1391 //should have non-zero value, initialized with default 0 (except for calibrated tbm, may be very close to 0)
1392 fgChamberQ[ichamber] = qsum;
1393 fgChamberTmean[ichamber] = tbm;
1398 printf("\nAliTRDdEdxUtils::CookdEdxV2 summary:\n");
1400 printf("\nfgNchamber = %d\n", fgNchamber);
1401 for(Int_t ich=0; ich<AliTRDtrackV1::kNplane; ich++){
1402 printf("fgChamberTmean[%d] = %15f; fgChamberQ[%d] = %15f;\n", ich, fgChamberTmean[ich], ich, fgChamberQ[ich]);
1406 fgTrackTmean = -999;
1409 for(Int_t ich=0; ich<AliTRDtrackV1::kNplane; ich++){
1410 fgTrackTmean += fgChamberTmean[ich];
1412 fgTrackTmean /= fgNchamber;
1416 printf("\nAliTRDdEdxUtils::CookdEdxV2\n");
1417 printf("GetTrackTmean() %15f\n", GetTrackTmean());
1426 //===================================================================================
1427 // dEdx Parameterization
1428 //===================================================================================
1430 Double_t AliTRDdEdxUtils::Q0MeanTRDpp(const Double_t bg)
1433 //truncated Mean Q_{xx} in TRD
1439 par[0]= 2.397001e-01;
1440 par[1]= 1.334697e+00;
1441 par[2]= 6.967470e+00;
1442 par[3]= 9.055289e-02;
1443 par[4]= 9.388760e+00;
1444 par[5]= 9.452742e-04;
1445 par[6]= -1.866091e+00;
1446 par[7]= 1.403545e+00;
1448 ///u/xlu/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot/Separation/see2.log:hhtype2Q0b2c2 scale 0.428543 at ltbg 0.650000
1449 return 0.428543*MeandEdxTR(&bg, par);
1452 Double_t AliTRDdEdxUtils::Q0MeanTRDPbPb(const Double_t bg)
1455 //truncated Mean Q_{xx} in TRD
1462 par[0]= 1.844912e-01;
1463 par[1]= 2.509702e+00;
1464 par[2]= 6.744031e+00;
1465 par[3]= 7.355123e-02;
1466 par[4]= 1.166023e+01;
1467 par[5]= 1.736186e-04;
1468 par[6]= -1.716063e+00;
1469 par[7]= 1.611366e+00;
1471 ///u/xlu/.task/CommondEdx/myAnaData/Optimum/check11/Merged/LHC10e_plot/Separation/see4.log:hhtype4Q0b2c2 scale 0.460994 at ltbg 0.650000
1472 return 0.460994*MeandEdxTR(&bg, par);
1475 Double_t AliTRDdEdxUtils::Q1MeanTRDpp(const Double_t bg)
1478 //truncated Mean 1/(1/Q)_{xx} in TRD
1483 //So 4. Mär 13:30:51 CET 2012
1485 par[0]= 2.434646e-01;
1486 par[1]= 1.400211e+00;
1487 par[2]= 6.937471e+00;
1488 par[3]= 7.758118e-02;
1489 par[4]= 1.097372e+01;
1490 par[5]= 4.297518e-04;
1491 par[6]= -1.806266e+00;
1492 par[7]= 1.543811e+00;
1494 //hhtype2Q1b2c2 scale 0.418629 at ltbg 0.650000
1496 return 0.418629*MeandEdxTR(&bg, par);
1499 Double_t AliTRDdEdxUtils::Q1MeanTRDPbPb(const Double_t bg)
1502 //truncated Mean 1/(1/Q)_{xx} in TRD
1507 //So 4. Mär 13:30:52 CET 2012
1509 par[0]= 2.193660e-01;
1510 par[1]= 2.051864e+00;
1511 par[2]= 6.825112e+00;
1512 par[3]= 6.151693e-02;
1513 par[4]= 1.390343e+01;
1514 par[5]= 6.010032e-05;
1515 par[6]= -1.676324e+00;
1516 par[7]= 1.838873e+00;
1518 //hhtype4Q1b2c2 scale 0.457988 at ltbg 0.650000
1520 return 0.457988*MeandEdxTR(&bg, par);
1523 Double_t AliTRDdEdxUtils::QMeanTPC(const Double_t bg)
1526 //bethe bloch in TPC
1530 //Mi 15. Feb 14:48:05 CET 2012
1531 //train_2012-02-13_1214.12001, tpcsig
1538 return MeandEdx(&bg, par);
1541 Double_t AliTRDdEdxUtils::MeandEdxTR(const Double_t * xx, const Double_t * pin)
1544 //ALEPH+LOGISTIC parametrization for dEdx+TR, in unit of MIP
1547 Double_t ptr[4]={0};
1548 for(int ii=0; ii<3; ii++){
1551 return MeanTR(xx,ptr) + MeandEdx(xx,&(pin[3]));
1554 Double_t AliTRDdEdxUtils::MeanTR(const Double_t * xx, const Double_t * par)
1557 //ALEPH+LOGISTIC parametrization for dEdx+TR, in unit of MIP
1561 const Double_t bg = xx[0];
1562 const Double_t gamma = sqrt(1+bg*bg);
1564 const Double_t p0 = TMath::Abs(par[1]);
1565 const Double_t p1 = TMath::Abs(par[2]);
1566 const Double_t p2 = TMath::Abs(par[3]);
1568 const Double_t zz = TMath::Log(gamma);
1569 const Double_t tryield = p0/( 1 + TMath::Exp(-p1*(zz-p2)) );
1571 return par[0]+tryield;
1574 Double_t AliTRDdEdxUtils::MeandEdx(const Double_t * xx, const Double_t * par)
1577 //ALEPH parametrization for dEdx
1581 const Double_t bg = xx[0];
1582 const Double_t beta = bg/TMath::Sqrt(1.+ bg*bg);
1584 const Double_t p0 = TMath::Abs(par[0]);
1585 const Double_t p1 = TMath::Abs(par[1]);
1586 const Double_t p2 = TMath::Abs(par[2]);
1587 const Double_t p3 = TMath::Abs(par[3]);
1588 const Double_t p4 = TMath::Abs(par[4]);
1590 const Double_t aa = TMath::Power(beta, p3);
1591 const Double_t bb = TMath::Log( p2 + TMath::Power(1./bg, p4) );
1593 //printf("test----- %f %f -- %f %f %f %f %f --- %f %f %f\n", bg, beta, p0, p1, p2, p3, p4, p0/aa, aa, bb);
1595 return (p1-aa-bb)*p0/aa;
1598 Double_t AliTRDdEdxUtils::ToLogx(FFunc func, const Double_t * xx, const Double_t * par)
1601 //f(x)-> f(y) with y=log10(x)
1603 const Double_t x2[]={TMath::Power(10, xx[0])};
1604 return func(x2, par);
1607 //===================================================================================
1608 // Detector, Data and Control Constant
1609 //===================================================================================
1610 Int_t AliTRDdEdxUtils::ToDetector(const Int_t gtb)
1615 return gtb/AliTRDseedV1::kNtb;
1618 Int_t AliTRDdEdxUtils::ToTimeBin(const Int_t gtb)
1623 return gtb%AliTRDseedV1::kNtb;
1626 Int_t AliTRDdEdxUtils::ToSector(const Int_t gtb)
1631 return AliTRDgeometry::GetSector(ToDetector(gtb));
1634 Int_t AliTRDdEdxUtils::ToStack(const Int_t gtb)
1639 return AliTRDgeometry::GetStack(ToDetector(gtb));
1642 Int_t AliTRDdEdxUtils::ToLayer(const Int_t gtb)
1647 return AliTRDgeometry::GetLayer(ToDetector(gtb));
1650 TString AliTRDdEdxUtils::GetRunType(const Int_t run)
1657 if(run>=121527 && run<= 126460)//LHC10d
1658 type="pp2010LHC10d";
1659 else if(run>=126461 && run<= 130930)//LHC10e
1660 type="pp2010LHC10e";
1661 else if(run>=136782 && run <= 139846)//LHC10h
1662 type="PbPb2010LHC10h";
1663 else if(run>= 143224 && run<= 143237)//2011Feb
1664 type="cosmic2011Feb";
1665 else if(run>= 150587 && run<= 154930){
1666 type="cosmic2011MayJun";
1668 TString runstr(Form("%d",run));
1669 const TString listrun1kg("154601 154602 154629 154634 154636 154639 154643");
1670 if(listrun1kg.Contains(runstr)){
1685 void AliTRDdEdxUtils::PrintControl()
1688 //print out control variable
1690 printf("\nAliTRDdEdxUtils::PrintControl Q0Frac %.1f, Q1Frac %.1f, TimeBinCountCut %.2f, CalibTPCnclsCut %d, IsExBOn %d\n\n", Q0Frac(), Q1Frac(), TimeBinCountCut(), CalibTPCnclsCut(), IsExBOn());
1692 //===================================================================================
1693 //===================================================================================