27 const int FileNo =
file.size();
28 TH2F*** h =
new TH2F**[
PadNo2];
29 TCanvas*** c =
new TCanvas**[
PadNo2];
30 TLegend*** lgd =
new TLegend**[
PadNo2];
31 gStyle->SetOptStat(0);
32 gStyle->SetCanvasColor(10);
35 h[i] =
new TH2F*[FileNo/2];
36 c[i] =
new TCanvas*[FileNo/2];
37 lgd[i] =
new TLegend*[FileNo/2];
47 stringstream histname;
48 stringstream ss_file1;
49 stringstream ss_file2;
53 stringstream legendheader;
55 for(
int k=0;k<FileNo;k+=2)
59 f1=
new TFile(ss_file1.str().c_str());
60 tree1=(TTree*)
f1->Get(
"ddgcalib");
61 tree1->SetBranchAddress(
"Out_gain", gain1);
62 tree1->SetBranchAddress(
"Ip_eangle", Ip_eangle1);
64 tree1->SetMarkerStyle(22);
65 tree1->SetMarkerColor(4);
66 tree1->SetLineColor(4);
70 f2=
new TFile(ss_file2.str().c_str());
71 tree2=(TTree*)f2->Get(
"ddgcalib");
72 tree2->SetBranchAddress(
"Out_gain", gain2);
73 tree2->SetBranchAddress(
"Ip_eangle", Ip_eangle2);
75 tree2->SetMarkerStyle(20);
76 tree2->SetMarkerColor(2);
77 tree2->SetLineColor(2);
88 if(Ip_eangle1[j]!=i)
continue;
92 if(k1==0 || k2==0) {Norm1=1; Norm2=1;}
93 else {Norm1/= k1; Norm2/= k2;}
94 cout<<
"Norm1= "<<Norm1<<
" Norm2= "<<Norm2<<endl;
99 lgd[i][k/2] =
new TLegend(.3, .75, .89, .89);
100 lgd[i][k/2] ->SetFillColor(10);
101 lgd[i][k/2] ->SetBorderSize(1);
102 lgd[i][k/2] ->SetHeader(legendheader.str().c_str());
103 lgd[i][k/2] ->AddEntry(tree1, ss_file1.str().c_str() ,
"p");
104 lgd[i][k/2] ->AddEntry(tree2, ss_file2.str().c_str() ,
"p");
107 histname<<
"eangle"<<i<<
"_"<<
file[k]<<
"-"<<
file[k+1];
110 else h[i][k/2] =
new TH2F(histname.str().c_str(),
"",100,0,
NumSlices,100,(Norm1+Norm2)/2-
delta,(Norm1+Norm2)/2+
delta);
111 h[i][k/2] ->
GetYaxis()->SetTitle(
"gain");
112 h[i][k/2] ->
GetYaxis()->SetTitleOffset(1.);
113 h[i][k/2] ->
GetXaxis()->SetTitle(
"doca");
114 c[i][k/2] =
new TCanvas(histname.str().c_str(),histname.str().c_str(),800,600);
118 cut<<
"Ip_eangle=="<<i;
119 cout<<
"cut: "<<
cut.str().c_str()<<endl;
122 if(
NormFlag) ss1<<
"Out_gain/"<<Norm1<<
":Id_doca";
123 else ss1<<
"Out_gain"<<
":Id_doca";
124 tree1->Draw(ss1.str().c_str(),
cut.str().c_str(),
"sameLP");
126 if(
NormFlag) ss2<<
"Out_gain/"<<Norm2<<
":Id_doca";
127 else ss2<<
"Out_gain"<<
":Id_doca";
128 tree2->Draw(ss2.str().c_str(),
cut.str().c_str(),
"sameLP");
129 lgd[i][k/2] ->Draw();
133 TFile* g =
new TFile(
"gainVsDoca.root",
"RECREATE");
136 for(
int k=0;k<FileNo;k+=2)
138 c[i][k/2] ->
Write();
145 cc->Print(
"gainVsDoca.ps[");
148 for(
int k=0;k<FileNo;k+=2)
152 c[i][k/2]->DrawClonePad();
153 c[i][k/2] ->
Close();
154 lgd[i][k/2] ->Delete();
157 cc->Print(
"gainVsDoca.ps");
159 cc->Print(
"gainVsDoca.ps]");
165 for(
int k=0;k<FileNo;k+=2)
mg GetYaxis() -> SetRangeUser(0.8, 1.02)
mg GetXaxis() -> SetRangeUser(0.5, 1.9)