{ // This script find location of pedestals for E and dE planes for BB //gROOT->Reset(); //gStyle->SetOptFit(1); Int_t nbins=1990; Int_t bmin=10, bmax=2000; int nbars; int a, pnum, tr; Double_t maxR, maxL; Double_t Rpedest[35],Lpedest[35]; char *left, *right, *left1, * right1, *c; left=(char *)malloc(1000); right=(char *)malloc(1000); left1=(char *)malloc(1000); right1=(char *)malloc(1000); c=(char *)malloc(1000); TH1D *hr=new TH1D("hr","hr",nbins,bmin,bmax); TH1D *hl=new TH1D("hl","hl",nbins,bmin,bmax); cout<<"\n"<>a; cout<<"\n"<>tr; //===================== ADC pedestals for E plane ============================== if(tr==0) TCut cut=""; else { sprintf(c,"fEvtHdr.fEvtType==%i",tr); TCut cut=c; } if(a==1) { nbars=24; TCanvas c1; TCanvas c2; c2.Divide(4,6); TCanvas c3; c3.Divide(4,6); for(int i=0;i>hl",i); sprintf(right,"BB.tp.e.RA[%i]>>hr",i); T->Draw(left,cut); T->Draw(right,cut); maxL=hl.GetMaximumBin(); // find the maximum channel for Left ADC maxR=hr.GetMaximumBin(); // find the maximum channel for Right ADC TH1D *HL=new TH1D("HL","HL",200,maxL-30,maxL+30); // define histogram around the maximum location TH1D *HR=new TH1D("HR","HR",200,maxR-30,maxR+30); sprintf(left1,"BB.tp.e.LA[%i]>>HL",i); sprintf(right1,"BB.tp.e.RA[%i]>>HR",i); c2.cd(i+1); T->Draw(left1,cut); Lpedest[i]=HL.GetBinCenter(HL.GetMaximumBin()); c3.cd(i+1); T->Draw(right1,cut); Rpedest[i]=HR.GetBinCenter(HR.GetMaximumBin()); } //for } // if // ====================== ADC pedestals for dE plane =================================== if(a==2) { nbars=24; TCanvas c1; TCanvas c2; c2.Divide(4,6); TCanvas c3; c3.Divide(4,6); for(int i=0;i>hl",i); sprintf(right,"BB.tp.de.RA[%i]>>hr",i); T->Draw(left,cut); T->Draw(right,cut); maxL=hl.GetMaximumBin(); // find the maximum channel for Left ADC maxR=hr.GetMaximumBin(); // find the maximum channel for Right ADC TH1D *HL=new TH1D("HL","HL",200,maxL-30,maxL+30); // define histogram around the maximum location TH1D *HR=new TH1D("HR","HR",200,maxR-30,maxR+30); sprintf(left1,"BB.tp.de.LA[%i]>>HL",i); sprintf(right1,"BB.tp.de.RA[%i]>>HR",i); c2.cd(i+1); T->Draw(left1,cut); Lpedest[i]=HL.GetBinCenter(HL.GetMaximumBin()); c3.cd(i+1); T->Draw(right1,cut); Rpedest[i]=GetBinCenter(HR.GetMaximumBin()); } //for }//if // ========================= Print pedestals on screen ======================= for(int j=0;j