4 void plBtowGainPerCrate() {
5 gStyle->SetPalette(1,0);
6 gStyle->SetOptStat(10);
8 hg=
new TH1F(
"hg",
"threshold ADC; crate ID",30,0.5,30.5);
10 TFile *_file0 = TFile::Open(
"/star/data05/scratch/balewski/2009-Wana-outB4.3-bckgNoEtow/data/run9setABCD.wana.hist.root");
15 muTr2D1->Draw(
"colz");
17 h2D= pubCrR; h2D->Draw(
"colz");
24 for(iEW=0;iEW<2; iEW++) {
26 c=
new TCanvas(
"gainEastB" ,
"gainEastB" ,600,1000);
28 c=
new TCanvas(
"gainWestB" ,
"gainWestB" ,600,1000);
30 for(
int i=1;i<=15;i++) {
35 h->Draw(); gPad->SetLogy();
36 h->SetAxisRange(0,2000); h->SetTitleSize(0.4);
37 float adc1=findFraction(h,0.06);
52 TH1F * getSlice(
int crateID){
53 TAxis* axX=h2D->GetXaxis();
54 Taxis* axY=h2D->GetYaxis();
55 float x1=axX->GetXmin();
56 float x2=axX->GetXmax();
57 int nbX=axX->GetNbins();
60 sprintf(tit1,
"CR=%d; %s",crateID,axX->GetTitle());
62 TH1F*h=
new TH1F(tit1,tit1,nbX,x1,x2);
63 h->SetLineColor(kBlue); h->SetFillColor(18);
64 h->GetXaxis()->SetLabelSize(0.09);
68 for(
int i=1;i<=nbX;i++) h->SetBinContent(i,h2D->GetBinContent(i,crateID));
69 h->SetEntries(h->Integral());
75 float findFraction( TH1F * h,
float frac){
76 TAxis* axX=h->GetXaxis();
77 int nbX=axX->GetNbins();
78 float total=h->Integral();
79 float thres=total*(1-frac);
83 for(
int i=1;i<=nbX;i++) {
84 sum+=h->GetBinContent(i);
85 if(sum< thres)
continue;
86 float adc1=h->GetBinCenter(i);
87 printf(
" got sum=%.0f i=%d adc=%.0f\n",sum,i,adc1);
88 Lx=h->GetListOfFunctions();
89 ln=
new TLine(adc1,0,adc1,1.e6); ln->SetLineColor(kRed); Lx->Add(ln);