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(
"Id_doca", Id_doca1);
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(
"Id_doca", Id_doca2);
75 tree2->SetMarkerStyle(20);
76 tree2->SetMarkerColor(2);
77 tree2->SetLineColor(2);
88 if(Id_doca1[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;
98 cout<<
"legendheader: "<<legendheader.str().c_str()<<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");
105 lgd[i][k/2] ->Draw();
108 histname<<
"doca"<<i<<
"_"<<
file[k]<<
"-"<<
file[k+1];
111 else h[i][k/2] =
new TH2F(histname.str().c_str(),
"",100,0,
NumSlices,100,(Norm1+Norm2)/2-
delta,(Norm1+Norm2)/2+
delta);
112 h[i][k/2] ->
GetYaxis()->SetTitle(
"gain");
113 h[i][k/2] ->
GetYaxis()->SetTitleOffset(1.);
114 h[i][k/2] ->
GetXaxis()->SetTitle(
"eangle");
115 c[i][k/2] =
new TCanvas(histname.str().c_str(),histname.str().c_str(),800,600);
120 cout<<
"cut: "<<
cut.str().c_str()<<endl;
123 if(
NormFlag) ss1<<
"Out_gain/"<<Norm1<<
":Ip_eangle";
124 else ss1<<
"Out_gain"<<
":Ip_eangle";
125 tree1->Draw(ss1.str().c_str(),
cut.str().c_str(),
"sameLP");
127 if(
NormFlag) ss2<<
"Out_gain/"<<Norm2<<
":Ip_eangle";
128 else ss2<<
"Out_gain"<<
":Ip_eangle";
129 tree2->Draw(ss2.str().c_str(),
cut.str().c_str(),
"sameLP");
133 TFile* g =
new TFile(
"gainVsEangle.root",
"RECREATE");
136 for(
int k=0;k<FileNo;k+=2)
138 c[i][k/2] ->
Write();
145 cc->Print(
"gainVsEangle.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(
"gainVsEangle.ps");
159 cc->Print(
"gainVsEangle.ps]");
165 for(
int k=0;k<FileNo;k+=2)
mg GetYaxis() -> SetRangeUser(0.8, 1.02)
mg GetXaxis() -> SetRangeUser(0.5, 1.9)