5 static TFile* mTFile=0;
8 static const char* CP[NP+1]={
"gamma",
"pi-",
"electron",
"mu-",
"pi0",
"data"};
9 static const char* CMG[2]={
"nomerge",
"merge"};
14 void plot(
char* name,
int cut=0,
char* opt=
""){
17 for(
int p=0; p<NP-1; p++){
19 TVirtualPad *pad = c1->cd(p+1);
20 if(LOG==1) pad->SetLogy();
21 if(LOG==2) pad->SetLogz();
22 char cc[100], tit[100];
23 sprintf(cc,
"%s_c%d",name,cut);
24 sprintf(tit,
"%s %s cut=%d",CP[p],name,cut);
25 TH1* h=(TH1*)mTFile->Get(cc);
31 sprintf(file,
"plotsim/%s_cut%d.png",name,cut);
35 void plotcut(
char* name1,
char* name2,
int p,
int cut0=0,
int cut1=1,
int cut2=6,
char* opt=
""){
40 for(
int v=0; v<2; v++){
43 for(
int c=0; c<3; c++){
47 TVirtualPad *pad = c2->cd(n);
48 if(LOG==1) pad->SetLogy();
49 if(LOG==2) pad->SetLogz();
50 char cc[100], tit[100];
51 sprintf(cc,
"%s_c%d",name,cut);
52 sprintf(tit,
"%s %s cut=%d",CP[p],name,cut);
53 TH1* h=(TH1*)mTFile->Get(cc);
61 sprintf(file,
"plotsim/fvc_%s_%s.png",name1,name2,CP[p]);
66 void readfile(
int particle=0,
int merge=0){
69 sprintf(file,
"%s_%s/fmsfps.root",DIRDATA,CMG[merge]);
71 sprintf(file,
"%s_%s/test_%s.fmsfps.root",DIR,CMG[merge],CP[particle]);
73 printf(
"Reading %s\n",file);
74 mTFile =
new TFile(file);
78 c1 =
new TCanvas(
"FPS",
"FPS",50,20,700,800);
79 c2 =
new TCanvas(
"FPS2",
"FPS2",750,20,1100,800);
80 c3 =
new TCanvas(
"FPS3",
"FPS3",1450,20,700,800);
81 gStyle->SetPalette(1);
82 gStyle->SetStatW(0.4);
85 void drawfms(
int cut){
89 TH1* h=(TH1*)mTFile->Get(
"p_xy_c2");
91 gROOT->Macro(
"draw_survey_sim.C(1)");
92 c1->SaveAs(
"plotsim/fvc_nocut.png");
95 TH1* h=(TH1*)mTFile->Get(
"p_xy_c3");
97 gROOT->Macro(
"draw_survey_sim.C(1)");
98 c3->SaveAs(
"plotsim/fvc_fvcut.png");
101 void drawhit(
int p=0){
105 TH2* h=(TH2*)mTFile->Get(
"FmsHitLarge");
108 TH2* h=(TH2*)mTFile->Get(
"FmsHitSmall");
110 c2->SaveAs(
"plotsim/fmshit.png");
113 void comp(
char* name,
float xmax=0.0,
int tit=0,
float scale=0.0,
int skipdata=0){
118 int p[N]={5,1,0,2,4,3};
119 int c[N]={1,4,2,6,8,5};
122 for(
int i=0; i<N; i++){
123 readfile(p[i],MERGE);
124 h[i]=(TH1F*)mTFile->Get(name);
125 n[i]=h[i]->GetEntries();
127 if(i==0 && skipdata==0) {
128 float max=h[i]->GetMaximum();
129 h[i]->SetMaximum(max*1.3);
130 h[i]->SetLineWidth(2);
131 h[i]->SetLineColor(c[i]);
132 if(p[i]==5) h[i]->SetFillColor(kCyan);
133 if(xmax!=0.0) h[i]->GetXaxis()->SetRangeUser(0.0,xmax);
137 for(
int i=1; i<N; i++){
142 float max=h[i]->GetMaximum();
143 h[i]->SetMaximum(max*scale);
144 printf(
"scale=%f\n",scale);
150 factor=float(n[0])/float(n[i]);
154 h[i]->SetLineColor(c[i]);
155 h[i]->SetLineWidth(2);
156 if(skipdata==1 && i==1) {h[i]->Draw();}
157 else {h[i]->Draw(
"same");}
160 for(
int i=0; i<N; i++){
161 TText* c1=
new TText(0.6,0.8-i*0.07,CP[p[i]]); c1->SetNDC(); c1->SetTextColor(c[i]); c1->SetTextSize(0.08); c1->Draw();
166 void compfps(
int p1=2){
168 c1->cd(1); comp(
"FpsMipL1",1);
169 c1->cd(2); comp(
"FpsMipL2");
170 c1->cd(3)->SetLogy(); comp(
"FpsMipL3");
172 c1->SaveAs(
"plotsim/compfps.png");
177 c1->cd(1)->SetLogy(); comp(
"SigMaxL",2.0,1);
178 c1->cd(2)->SetLogy(); comp(
"SigMaxS",2.0);
179 c1->cd(3)->SetLogy(); comp(
"SigMinL",1.2);
180 c1->cd(4)->SetLogy(); comp(
"SigMinS",1.2);
181 c1->cd(5)->SetLogy(); comp(
"Chi2L",500.0);
182 c1->cd(6)->SetLogy(); comp(
"Chi2S",500.0);
186 c1->SaveAs(
"plotsim/compclu.png");
189 void compmass(
int cut){
192 sprintf(cc,
"p_m1_c%d",cut);
193 c1->cd(1); comp(cc,0.0,1,7.0);
194 sprintf(cc,
"p_eta_c%d",cut);
195 c1->cd(2); comp(cc,0.0,0,50.0);
197 c1->SaveAs(
"plotsim/compmass.png");
203 sprintf(cc,
"e_c%d",1);
205 c1->cd(1); comp(cc,0.0,1,70.0);
206 sprintf(cc,
"elo_c%d",0);
207 c1->cd(2); comp(cc,0.0,0,70.0);
209 c1->SaveAs(
"plotsim/compmip.png");
213 void pairxy(
int cut){
215 for(
int p=0; p<NP+1; p++){
217 if(LOG==0) c2->cd(p+1);
218 if(LOG==1) c2->cd(p+1)->SetLogz();
220 sprintf(cc,
"p_xy_c%d",cut);
221 TH2F* h=(TH2F*)mTFile->Get(cc);
223 TText* t1=
new TText(50,80,CP[p]); t1->SetTextSize(0.1); t1->Draw();
226 sprintf(file,
"plotsim/pairxy.%s.c%d.png",DIR,cut);
230 void drawfps(
int p=2){
233 c1->cd(1); TH1* h=(TH1*)mTFile->Get(
"FpsMipL1"); h->Draw(
"");
234 c1->cd(2); TH1* h=(TH1*)mTFile->Get(
"FpsMipL2"); h->Draw(
"");
235 c1->cd(3); TH1* h=(TH1*)mTFile->Get(
"FpsMipL3"); h->Draw(
"");
237 c1->SaveAs(
"plotsim/fpsmip.png");
240 void drawntow(
int p=0){
243 c1->cd(1)->SetLogy(); NTowL->Draw();
244 int i1=NTowL->Integral(0,51);
245 int i2=NTowL->Integral(25,51);
246 printf(
"all=%d above25=%d fraction=%f\n",i1,i2,
float(i2)/
float(i1));
247 TH1F* h=
new TH1F; NTowL->Copy(*h);
248 h->SetFillColor(2); h->GetXaxis()->SetRangeUser(25,51); h->Draw(
"same");
249 char c[100]; sprintf(c,
"%f",
float(i2)/
float(i1));
250 TText* t1=
new TText(0.6,0.4,c);
251 t1->SetTextColor(2); t1->SetNDC(); t1->Draw();
253 c1->cd(2)->SetLogy(); NTowS->Draw();
255 c1->cd(3)->SetLogz(); NTowEL->Draw(
"colz");
256 int binx0 = NTowEL->GetXaxis()->FindBin(0);
257 int binx1 = NTowEL->GetXaxis()->FindBin(25);
258 int binx2 = NTowEL->GetXaxis()->FindBin(51);
259 int biny1 = NTowEL->GetYaxis()->FindBin(3.0);
260 int biny2 = NTowEL->GetYaxis()->FindBin(101.0);
261 int i3=NTowEL->Integral(binx0,binx2,biny1,biny2);
262 int i4=NTowEL->Integral(binx1,binx2,biny1,biny2);
263 printf(
"all=%d above25&3GeV=%d fraction=%f\n",i3,i4,
float(i4)/
float(i3));
264 sprintf(c,
"Above 3GeV \n %f",
float(i4)/
float(i3));
265 TText* t2=
new TText(0.3,0.8,c);
266 t2->SetTextColor(1); t2->SetNDC(); t2->Draw();
267 TH2F* h2=
new TH2F; NTowEL->Copy(*h2);
268 h2->GetXaxis()->SetRangeUser(binx1,binx2);
269 h2->GetYaxis()->SetRangeUser(biny1,biny2);
272 c1->cd(4)->SetLogz(); NTowES->Draw(
"colz");
274 sprintf(cc,
"plotsim/ntow_%s.png",CP[p]);
278 void plotsim(
int plt=1,
int merge=0,
int cut=1,
int log=0,
char* dir=
"sim",
char* datadir=
"hist"){
279 printf(
"plt=%d merge=%d cut=%d log=%d dir=%s datadir=%s\n",
280 plt,merge,cut,log,dir,datadir);
285 gStyle->SetOptStat(0);
287 if(plt==1 || plt==0) plot(
"ept",cut);
288 if(plt==2 || plt==0) plot(
"pid",cut);
289 if(plt==3 || plt==0) plot(
"pid2",cut);
290 if(plt==4 || plt==0) plot(
"x",cut);
291 if(plt==5 || plt==0) plot(
"pt",cut);
292 if(plt==6 || plt==0) plot(
"p_dgg",cut);
293 if(plt==7 || plt==0) drawntow(cut);
294 if(plt==10 || plt==0) plotcut(
"xy",
"pt",0);
295 if(plt==11 || plt==0) plotcut(
"p_dgg",
"pt",0);
296 if(plt==12 || plt==0) drawfms(cut);
297 if(plt==20 || plt==0) drawhit(cut);
298 if(plt==21 || plt==0) drawfps(cut);
299 if(plt==22 || plt==0) compfps(cut);
300 if(plt==23 || plt==0) compclu();
301 if(plt==24 || plt==0) compmass(cut);
302 if(plt==25 || plt==0) pairxy(cut);
303 if(plt==26 || plt==0) compmip();