1 TH2F *h2Ped=0, *h2Sig=0, *h2Peak;
2 TH1F *h1Stat=0, *h2CapStat;
3 TH1F *h1p7=0, *h1p77=0, *h1p777=0;
8 gStyle->SetPalette(1,0);
12 char *pathOut=
"iter3/";
13 char txt[1000], txt2[1000];
16 sprintf(txt,
"%s/pedBprsR%dallCap.hist.root",pathOut,run);
17 fd2=
new TFile(txt,
"recreate");
18 int nb=800, xx1=100,xx2=300;
19 h1p7=
new TH1F(
"pedSoftId7",
"pedestals(cap) , softID=7, crate=0; pedestal(ADC)", nb,xx1,xx2);
20 h1p607=
new TH1F(
"pedSoftId607",
"pedestals(cap) , softID=607, crate=1; pedestal(ADC)", nb,xx1,xx2);
21 h1p2407=
new TH1F(
"pedSoftId2407",
"pedestals(cap) , softID=2407, crate=2; pedestal(ADC)", nb,xx1,xx2);
22 h1p3007=
new TH1F(
"pedSoftId3007",
"pedestals(cap) , softID=3007, crate=2; pedestal(ADC)", nb,xx1,xx2);
24 for(
int cap=cap1;cap<=cap2;cap++) {
26 sprintf(txt,
"%s/pedBprsR%d-cap%d.hist.root",pathIn,run,cap);
27 fd1=
new TFile(txt); assert(fd1->IsOpen());
28 TH1F * ih1ped= (TH1F *)fd1->Get(
"pedBPRS"); assert(ih1ped);
29 TH1F * ih1stat= (TH1F *)fd1->Get(
"statBPRS"); assert(ih1stat);
30 TH1F * ih1sig= (TH1F *)fd1->Get(
"sigPedBPRS"); assert(ih1sig);
31 TH1F * ih1peak= (TH1F *)fd1->Get(
"pedPeakBPRS"); assert(ih1peak);
32 printf(
"----- merge: %s entries=%d\n",txt,ih1ped->GetEntries());
33 printf(
" %s entries=%d\n",txt,ih1stat->GetEntries());
34 axX=ih1ped->GetXaxis();
35 float x1=axX->GetXmin();
36 float x2=axX->GetXmax();
37 int nbX=axX->GetNbins();
38 printf(
"X-axis range --> [%.1f, %.1f], nb=%d %s\n",x1,x2,nbX,axX->GetTitle());
41 sprintf(txt,
"pedBPRScap");
42 sprintf(txt2,
"BPRS pedestal (ADC), R%d ; BPRS soft ID; capID",run);
43 h2Ped=
new TH2F(txt,txt2,nbX,x1,x2,nCap,-0.5,nCap-0.5);
45 sprintf(txt,
"sigPedBPRScap");
46 sprintf(txt2,
"BPRS sig(ped) (Z=ADC), R%d ; BPRS soft ID; capID",run);
47 h2Sig=
new TH2F(txt,txt2,nbX,x1,x2,nCap,-0.5,nCap-0.5);
49 sprintf(txt,
"peakPedBPRScap");
50 sprintf(txt2,
"integral of pedestal peak, R%d ; BPRS soft ID; capID",run);
51 h2Peak=
new TH2F(txt,txt2,nbX,x1,x2,nCap,-0.5,nCap-0.5);
53 sprintf(txt,
"statBPRSallCap");
54 sprintf(txt2,
"BPRS status from all caps, R%d ; BPRS soft ID; # of bad caps",run);
55 h1Stat=
new TH1F(txt,txt2,nbX,x1,x2);
57 sprintf(txt,
"capStatBPRSallSoft");
58 sprintf(txt2,
"BPRS status from all softID, R%d ; BPRS capID; # of bad softID",run);
59 h1CapStat=
new TH1F(txt,txt2,128,-0.5,127.5);
61 printf(
"H2 created\n");
64 for(
int i=1;i<=nbX;i++) {
65 h2Ped->SetBinContent(i,cap+1,ih1ped->GetBinContent(i));
66 h2Sig->SetBinContent(i,cap+1,ih1sig->GetBinContent(i));
67 h2Peak->SetBinContent(i,cap+1,ih1peak->GetBinContent(i));
68 if(ih1stat->GetBinContent(i)>0) {
70 h1CapStat->Fill(cap,1);
74 h1p7->Fill(ih1ped->GetBinContent(7));
75 h1p607->Fill(ih1ped->GetBinContent(607));
76 h1p2407->Fill(ih1ped->GetBinContent(2407));
77 h1p3007->Fill(ih1ped->GetBinContent(3007));
83 for(
int i=1;i<=nbX;i++) {
84 if(h1Stat->GetBinContent(i)) nDead++;
86 h1Stat->SetEntries(nDead);
87 printf(
" accumulated nDead=%d\n",nDead);
100 printf(
"total entries=%d\n",h2Ped->GetEntries());
104 for(
int k=120;k<=128;k++)
105 for(
int i=1;i<=nbX;i++)
106 for(
int j=1;j<=nbY;j++)
108 float val=h3->GetBinContent(i,j,k);
110 printf(
"chan(i)=%d, adc(j)=%d, cap(k)=%d val=%f\n", i-1,j+100,k-1,val);
117 c->cd(1);pedSoft7->Draw();
118 c->cd(2);pedSoft77->Draw();
119 c->cd(3);pedSoft777->Draw();