38 const int FileNo =
file.size();
39 TH2F*** h =
new TH2F**[
PadNo2];
40 TCanvas*** c =
new TCanvas**[
PadNo2];
41 TLegend*** lgd =
new TLegend**[
PadNo2];
42 gStyle->SetOptStat(0);
43 gStyle->SetCanvasColor(10);
46 h[i] =
new TH2F*[FileNo/2];
47 c[i] =
new TCanvas*[FileNo/2];
48 lgd[i] =
new TLegend*[FileNo/2];
58 stringstream histname;
59 stringstream ss_file1;
60 stringstream ss_file2;
64 stringstream legendheader;
66 for(
int k=0;k<FileNo;k+=2)
70 f1=
new TFile(ss_file1.str().c_str());
71 tree1=(TTree*)
f1->Get(
"ddgcalib");
72 tree1->SetBranchAddress(
"Out_gain", gain1);
73 tree1->SetBranchAddress(
"Ip_eangle", Ip_eangle1);
75 tree1->SetMarkerStyle(22);
76 tree1->SetMarkerColor(4);
77 tree1->SetLineColor(4);
81 f2=
new TFile(ss_file2.str().c_str());
82 tree2=(TTree*)f2->Get(
"ddgcalib");
83 tree2->SetBranchAddress(
"Out_gain", gain2);
84 tree2->SetBranchAddress(
"Ip_eangle", Ip_eangle2);
86 tree2->SetMarkerStyle(20);
87 tree2->SetMarkerColor(2);
88 tree2->SetLineColor(2);
99 if(Ip_eangle1[j]!=i)
continue;
100 if(gain1[j]>
gainmin && gain1[j]<
gainmax) {Norm1 += gain1[j];k1++;}
101 if(gain2[j]>
gainmin && gain2[j]<
gainmax) {Norm2 += gain2[j];k2++;}
103 if(k1==0 || k2==0) {Norm1=1; Norm2=1;}
104 else {Norm1/= k1; Norm2/= k2;}
105 cout<<
"Norm1= "<<Norm1<<
" Norm2= "<<Norm2<<endl;
107 legendheader.str(
"");
110 lgd[i][k/2] =
new TLegend(.3, .75, .89, .89);
111 lgd[i][k/2] ->SetFillColor(10);
112 lgd[i][k/2] ->SetBorderSize(1);
113 lgd[i][k/2] ->SetHeader(legendheader.str().c_str());
114 lgd[i][k/2] ->AddEntry(tree1, ss_file1.str().c_str() ,
"p");
115 lgd[i][k/2] ->AddEntry(tree2, ss_file2.str().c_str() ,
"p");
118 histname<<
"eangle"<<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(
"doca");
125 c[i][k/2] =
new TCanvas(histname.str().c_str(),histname.str().c_str(),800,600);
129 cut<<
"Ip_eangle=="<<i;
130 cout<<
"cut: "<<
cut.str().c_str()<<endl;
133 if(
NormFlag) ss1<<
"Out_gain/"<<Norm1<<
":Id_doca";
134 else ss1<<
"Out_gain"<<
":Id_doca";
135 tree1->Draw(ss1.str().c_str(),
cut.str().c_str(),
"sameLP");
137 if(
NormFlag) ss2<<
"Out_gain/"<<Norm2<<
":Id_doca";
138 else ss2<<
"Out_gain"<<
":Id_doca";
139 tree2->Draw(ss2.str().c_str(),
cut.str().c_str(),
"sameLP");
140 lgd[i][k/2] ->Draw();
144 TFile* g =
new TFile(
"gainVsDoca.root",
"RECREATE");
147 for(
int k=0;k<FileNo;k+=2)
149 c[i][k/2] ->
Write();
156 cc->Print(
"gainVsDoca.ps[");
159 for(
int k=0;k<FileNo;k+=2)
163 c[i][k/2]->DrawClonePad();
164 c[i][k/2] ->
Close();
165 lgd[i][k/2] ->Delete();
168 cc->Print(
"gainVsDoca.ps");
170 cc->Print(
"gainVsDoca.ps]");
176 for(
int k=0;k<FileNo;k+=2)