10 file.push_back(
"../../DocaEangle/docaeangle.root");
11 file.push_back(
"docaeangle.root");
37 const int FileNo =
file.size();
38 TH2F*** h =
new TH2F**[
PadNo2];
39 TCanvas*** c =
new TCanvas**[
PadNo2];
40 TLegend*** lgd =
new TLegend**[
PadNo2];
41 gStyle->SetOptStat(0);
42 gStyle->SetCanvasColor(10);
45 h[i] =
new TH2F*[FileNo/2];
46 c[i] =
new TCanvas*[FileNo/2];
47 lgd[i] =
new TLegend*[FileNo/2];
57 stringstream histname;
58 stringstream ss_file1;
59 stringstream ss_file2;
63 stringstream legendheader;
65 for(
int k=0;k<FileNo;k+=2)
69 f1=
new TFile(ss_file1.str().c_str());
70 tree1=(TTree*)f1->Get(
"ddgcalib");
71 tree1->SetBranchAddress(
"Out_gain", gain1);
72 tree1->SetBranchAddress(
"Id_doca", Id_doca1);
74 tree1->SetMarkerStyle(22);
75 tree1->SetMarkerColor(4);
76 tree1->SetLineColor(4);
80 f2=
new TFile(ss_file2.str().c_str());
81 tree2=(TTree*)f2->Get(
"ddgcalib");
82 tree2->SetBranchAddress(
"Out_gain", gain2);
83 tree2->SetBranchAddress(
"Id_doca", Id_doca2);
85 tree2->SetMarkerStyle(20);
86 tree2->SetMarkerColor(2);
87 tree2->SetLineColor(2);
98 if(Id_doca1[j]!=i)
continue;
100 if(gain2[j]>
gainmin && gain2[j]<
gainmax) {Norm2 += gain2[j];k2++;}
102 if(k1==0 || k2==0) {Norm1=1; Norm2=1;}
103 else {Norm1/= k1; Norm2/= k2;}
104 cout<<
"Norm1= "<<Norm1<<
" Norm2= "<<Norm2<<endl;
106 legendheader.str(
"");
108 cout<<
"legendheader: "<<legendheader.str().c_str()<<endl;
109 lgd[i][k/2] =
new TLegend(.3, .75, .89, .89);
110 lgd[i][k/2] ->SetFillColor(10);
111 lgd[i][k/2] ->SetBorderSize(1);
112 lgd[i][k/2] ->SetHeader(legendheader.str().c_str());
113 lgd[i][k/2] ->AddEntry(tree1, ss_file1.str().c_str() ,
"p");
114 lgd[i][k/2] ->AddEntry(tree2, ss_file2.str().c_str() ,
"p");
115 lgd[i][k/2] ->Draw();
118 histname<<
"doca"<<i<<
"_"<<
file[k]<<
"-"<<
file[k+1];
121 else h[i][k/2] =
new TH2F(histname.str().c_str(),
"",100,0,
NumSlices,100,(Norm1+Norm2)/2-
delta,(Norm1+Norm2)/2+
delta);
122 h[i][k/2] ->
GetYaxis()->SetTitle(
"gain");
123 h[i][k/2] ->
GetYaxis()->SetTitleOffset(1.);
124 h[i][k/2] ->
GetXaxis()->SetTitle(
"eangle");
125 c[i][k/2] =
new TCanvas(histname.str().c_str(),histname.str().c_str(),800,600);
130 cout<<
"cut: "<<
cut.str().c_str()<<endl;
133 if(
NormFlag) ss1<<
"Out_gain/"<<Norm1<<
":Ip_eangle";
134 else ss1<<
"Out_gain"<<
":Ip_eangle";
135 tree1->Draw(ss1.str().c_str(),
cut.str().c_str(),
"sameLP");
137 if(
NormFlag) ss2<<
"Out_gain/"<<Norm2<<
":Ip_eangle";
138 else ss2<<
"Out_gain"<<
":Ip_eangle";
139 tree2->Draw(ss2.str().c_str(),
cut.str().c_str(),
"sameLP");
143 TFile* g =
new TFile(
"gainVsEangle.root",
"RECREATE");
146 for(
int k=0;k<FileNo;k+=2)
148 c[i][k/2] ->
Write();
155 cc->Print(
"gainVsEangle.ps[");
158 for(
int k=0;k<FileNo;k+=2)
162 c[i][k/2]->DrawClonePad();
163 c[i][k/2] ->
Close();
164 lgd[i][k/2] ->Delete();
167 cc->Print(
"gainVsEangle.ps");
169 cc->Print(
"gainVsEangle.ps]");
175 for(
int k=0;k<FileNo;k+=2)
mg GetYaxis() -> SetRangeUser(0.8, 1.02)
mg GetXaxis() -> SetRangeUser(0.5, 1.9)