1 |
// |
2 |
// Show the hit distribution on each plane. Can be used to see tracks - Emiliano Mocchiutti |
3 |
// |
4 |
// FCaloPLANES.cxx version 1.01 (2006-03-08) |
5 |
// |
6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
// |
8 |
// Changelog: |
9 |
// |
10 |
// 1.00 - 1.01 (2006-03-08): Flight version, read unique YODA file. |
11 |
// |
12 |
// 0.00 - 1.00 (2006-03-08): Clone of CaloPLANES v2r13. |
13 |
// |
14 |
|
15 |
#include <fstream> |
16 |
#include <sstream> |
17 |
#include <TTree.h> |
18 |
#include <TClassEdit.h> |
19 |
#include <TObject.h> |
20 |
#include <TList.h> |
21 |
#include <TSystem.h> |
22 |
#include <TSystemDirectory.h> |
23 |
#include <TString.h> |
24 |
#include <TFile.h> |
25 |
#include <TClass.h> |
26 |
#include <TCanvas.h> |
27 |
#include <TH1.h> |
28 |
#include <TH1F.h> |
29 |
#include <TH2D.h> |
30 |
#include <TLatex.h> |
31 |
#include <TPad.h> |
32 |
#include <TPaveLabel.h> |
33 |
#include <TChain.h> |
34 |
#include <TStyle.h> |
35 |
// |
36 |
extern bool existfile(TString); |
37 |
extern TString getFilename(const TString); |
38 |
extern void PrintFigure(TString, TString, TString, TString, TCanvas&); |
39 |
// |
40 |
#include <caloclassesfun.h> |
41 |
// |
42 |
using namespace std; |
43 |
|
44 |
void FCaloPLANES(TString filename, TString viewxy="both", TString parity="both", Int_t plane = 0, Int_t fromevent = 0, Int_t toevent = 0, TString outDir = "", TString saveas = "gif"){ |
45 |
const char* startingdir = gSystem->WorkingDirectory(); |
46 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
47 |
if ( !existfile(filename) ){ |
48 |
printf(" %s :no such file or directory \n",filename.Data()); |
49 |
printf("\n ERROR: No calorimeter LEVEL1 file! \n\n Run FCaloLEVEL1 to generate level1 data. \n\n"); |
50 |
return; |
51 |
}; |
52 |
// |
53 |
TFile *File = new TFile(filename.Data()); |
54 |
TTree *otr = (TTree*)File->Get("CaloLevel1"); |
55 |
if ( !otr ){ |
56 |
printf(" %s are you sure? I need a LEVEL1 file! \n",filename.Data()); |
57 |
return; |
58 |
}; |
59 |
// |
60 |
CalorimeterLevel1 *calo = new CalorimeterLevel1(); |
61 |
otr->SetBranchAddress("Event", &calo); |
62 |
// |
63 |
Long64_t nevents = otr->GetEntries(); |
64 |
// |
65 |
// input limits |
66 |
// |
67 |
Int_t minview = 0; |
68 |
Int_t maxview = 0; |
69 |
if ( viewxy != "both" && viewxy != "x" && viewxy != "y" ) { |
70 |
printf("You can choose viewxy = x, viewxy = y or viewxy = both \n"); |
71 |
return; |
72 |
}; |
73 |
if ( viewxy == "both" ) { |
74 |
minview = 0; |
75 |
maxview = 2; |
76 |
}; |
77 |
if ( viewxy == "x" ) { |
78 |
minview = 0; |
79 |
maxview = 1; |
80 |
}; |
81 |
if ( viewxy == "y" ) { |
82 |
minview = 1; |
83 |
maxview = 2; |
84 |
}; |
85 |
|
86 |
|
87 |
if ( parity !="both" && parity != "odd" && parity != "even" ) { |
88 |
printf("You can choose parity = odd, parity = even or parity = both \n"); |
89 |
return; |
90 |
}; |
91 |
Int_t dispari = 0; |
92 |
if ( parity == "odd" ){ |
93 |
dispari = 1; |
94 |
}; |
95 |
if ( parity == "even" ){ |
96 |
dispari = 0; |
97 |
}; |
98 |
if ( parity == "both" ){ |
99 |
dispari = -1; |
100 |
}; |
101 |
|
102 |
if ( plane > 11 || plane < 0 ) { |
103 |
printf("You can choose plane between 1 and 11 or plane = 0 (all)\n"); |
104 |
return; |
105 |
}; |
106 |
plane--; |
107 |
|
108 |
|
109 |
if ( fromevent > toevent && toevent ){ |
110 |
printf("It must be fromevent < toevent \n"); |
111 |
return; |
112 |
}; |
113 |
|
114 |
|
115 |
if ( fromevent > nevents+1 || fromevent < 0 ) { |
116 |
printf("You can choose fromevent between 0 (all) and %i \n",(int)nevents+1); |
117 |
return; |
118 |
}; |
119 |
|
120 |
if ( toevent > nevents+1 || toevent < 0 ) { |
121 |
printf("You can choose toevent between 0 (all) and %i \n",(int)nevents+1); |
122 |
return; |
123 |
}; |
124 |
|
125 |
Int_t minevent; |
126 |
Int_t maxevent; |
127 |
if ( fromevent == 0 ) { |
128 |
minevent = 0; |
129 |
maxevent = nevents; |
130 |
} else { |
131 |
minevent = fromevent - 1; |
132 |
if ( toevent > 0 ){ |
133 |
maxevent = toevent - 1; |
134 |
} else { |
135 |
maxevent = fromevent - 1; |
136 |
}; |
137 |
}; |
138 |
nevents = maxevent-minevent; |
139 |
Float_t fnev; |
140 |
fnev = (Float_t)(maxevent-minevent); |
141 |
// |
142 |
// run over all the events |
143 |
// |
144 |
printf("\n Processed events: \n\n"); |
145 |
// |
146 |
TH1F *Plane[2][2][11]; |
147 |
//TH1 *Plane[2][2][11]; |
148 |
// char *tutti="asldkalskdlasdjkafoiwhkehguierahgklshdfjkhakfhdasklkdfhksadfhkjdsblablah"; |
149 |
stringstream tutti; |
150 |
stringstream plfor; |
151 |
char *uno="blablah"; |
152 |
char *due="blablah"; |
153 |
// char *tre="blablah"; |
154 |
for (Int_t i = 0; i < 2; i++){ |
155 |
for (Int_t j = 0; j < 2; j++){ |
156 |
for (Int_t l = 0; l < 11; l++){ |
157 |
// gDirectory->Delete(Form("plane %i%i%i",i,j,l)); |
158 |
// sprintf(tre," %i ",(l+1)); |
159 |
if ( i == 0 ){ |
160 |
uno = "x"; |
161 |
} else { |
162 |
uno = "y"; |
163 |
}; |
164 |
if ( j == 0 ){ |
165 |
due = "even"; |
166 |
} else { |
167 |
due = "odd"; |
168 |
}; |
169 |
// tutti = Form("View %s %s Plane %i",uno,due,(l+1)); |
170 |
tutti.str(""); |
171 |
tutti << "View " << uno; |
172 |
tutti << " " << due; |
173 |
tutti << " Plane " << (l+1); |
174 |
plfor.str(""); |
175 |
plfor << "plane " << i; |
176 |
plfor << j << l; |
177 |
Plane[i][j][l] = new TH1F(plfor.str().c_str(),tutti.str().c_str(),96,-0.5,95.5); |
178 |
}; |
179 |
}; |
180 |
}; |
181 |
Float_t energia = 0.; |
182 |
Int_t stripclu = 0; |
183 |
Float_t eclu = 0.; |
184 |
Int_t pari = 0; |
185 |
Int_t pl = 0; |
186 |
Int_t pre = -1; |
187 |
for (Int_t i = minevent; i < maxevent; i++){ |
188 |
if ( i%1000 == 0 && i > 0 ) printf(" %iK \n",i/1000); |
189 |
// |
190 |
otr->GetEntry(i); |
191 |
// |
192 |
// run over views and planes |
193 |
// |
194 |
stripclu = 0; |
195 |
eclu = 0.; |
196 |
// |
197 |
for (Int_t l = minview; l < maxview; l++){ |
198 |
for (Int_t m = 0; m < 22; m++){ |
199 |
// |
200 |
// determine the section number |
201 |
// |
202 |
pari = 0; |
203 |
pl = 0; |
204 |
if (l == 0 && m%2 == 0){ |
205 |
pl = m/2; |
206 |
pari = 0; |
207 |
}; |
208 |
if (l == 0 && m%2 != 0){ |
209 |
pl = (m-1)/2; |
210 |
pari = 1; |
211 |
}; |
212 |
if (l == 1 && m%2 == 0){ |
213 |
pl = m/2; |
214 |
pari = 0; |
215 |
}; |
216 |
if (l == 1 && m%2 != 0){ |
217 |
pl = (m-1)/2; |
218 |
pari = 1; |
219 |
}; |
220 |
// |
221 |
// run over strips |
222 |
// |
223 |
pre = -1; |
224 |
stripclu = 0; |
225 |
eclu = 0.; |
226 |
// |
227 |
//goto boh; |
228 |
//printf("qua1 "); |
229 |
for (Int_t n = 0; n < 96; n++){ |
230 |
if ( n%16 == 0 ) pre++; |
231 |
if ( calo-> estrip[l][m][n] > 0.7 ) { |
232 |
stripclu++; |
233 |
eclu += calo->estrip[l][m][n]; |
234 |
}; |
235 |
}; |
236 |
// printf("qua2 "); |
237 |
// boh: |
238 |
//goto boh; |
239 |
energia = 0.; |
240 |
for (Int_t n = 0; n < 96; n++){ |
241 |
if ( stripclu ) { |
242 |
if ( calo->estrip[l][m][n] > 0.7 ) { |
243 |
energia = (calo->estrip[l][m][n]/eclu)/(fnev*(Float_t)stripclu); |
244 |
// printf(" fnev %f n %i eclu %f stripclu %f energia = %f \n",fnev,n,eclu,(Float_t)stripclu,energia); |
245 |
Plane[l][pari][pl]->Fill(n,energia); |
246 |
} |
247 |
}; |
248 |
}; |
249 |
// boh: |
250 |
// printf("qua3 %i %i \n",l,m); |
251 |
}; |
252 |
}; |
253 |
}; |
254 |
gStyle->SetOptStat(0); |
255 |
// TString *file[17]; |
256 |
//file = "dw_000000_000.dat"; |
257 |
//file = getFilename(filename); |
258 |
printf("\n Finished!\n"); |
259 |
// |
260 |
TString fififile = getFilename(filename); |
261 |
// const char *file = fififile; |
262 |
// |
263 |
TPad *pd1; |
264 |
TPad *pd2; |
265 |
if ( plane >= 0 ){ |
266 |
TCanvas *figura = new TCanvas("The_calorimeter_planes_hit", "The_calorimeter_planes_hit", 1100, 900); |
267 |
figura->SetFillColor(10); |
268 |
figura->Range(0,0,100,100); |
269 |
figura->cd(); |
270 |
if ( dispari == -1 && viewxy == "both" ) { |
271 |
// |
272 |
// four figures |
273 |
// |
274 |
TPad *pd[2][2]; |
275 |
pd[0][0] = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.49,10); |
276 |
pd[0][1] = new TPad("pd2","This is pad2",0.51,0.02,0.98,0.49,10); |
277 |
pd[1][0] = new TPad("pd2","This is pad3",0.02,0.51,0.49,0.98,10); |
278 |
pd[1][1] = new TPad("pd4","This is pad4",0.51,0.51,0.98,0.98,10); |
279 |
for (Int_t l = 0; l < 2; l++) { |
280 |
for (Int_t m = 0; m < 2; m++) { |
281 |
figura->cd(); |
282 |
pd[l][m]->Range(0,0,100,100); |
283 |
pd[l][m]->Draw(); |
284 |
pd[l][m]->cd(); |
285 |
Plane[l][m][plane]->GetYaxis()->SetTitleOffset(1.5); |
286 |
pd[l][m]->SetLeftMargin(0.15); |
287 |
Plane[l][m][plane]->SetXTitle("strip"); |
288 |
Plane[l][m][plane]->SetYTitle("Average energy released (MIP)"); |
289 |
Plane[l][m][plane]->SetFillColor(1); |
290 |
Plane[l][m][plane]->Draw(); |
291 |
pd[l][m]->Update(); |
292 |
}; |
293 |
}; |
294 |
TString figty = "planes4"; |
295 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
296 |
return; |
297 |
}; |
298 |
if ( dispari == -1 || viewxy == "both" ) { |
299 |
// |
300 |
// two figures |
301 |
// |
302 |
pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.98,10); |
303 |
pd2 = new TPad("pd2","This is pad2",0.51,0.02,0.98,0.98,10); |
304 |
figura->cd(); |
305 |
pd1->Range(0,0,100,100); |
306 |
pd2->Range(0,0,100,100); |
307 |
pd1->Draw(); |
308 |
pd2->Draw(); |
309 |
if ( dispari != -1 ){ |
310 |
pd1->cd(); |
311 |
gStyle->SetTitleFontSize(0.07); |
312 |
pd1->SetLeftMargin(0.15); |
313 |
Plane[0][dispari][plane]->GetYaxis()->SetTitleOffset(1.8); |
314 |
Plane[0][dispari][plane]->SetXTitle("strip"); |
315 |
Plane[0][dispari][plane]->SetYTitle("Average energy released (MIP)"); |
316 |
Plane[0][dispari][plane]->SetFillColor(1); |
317 |
Plane[0][dispari][plane]->Draw(); |
318 |
pd2->cd(); |
319 |
gStyle->SetTitleFontSize(0.07); |
320 |
pd2->SetLeftMargin(0.15); |
321 |
Plane[1][dispari][plane]->GetYaxis()->SetTitleOffset(1.8); |
322 |
Plane[1][dispari][plane]->SetXTitle("strip"); |
323 |
Plane[1][dispari][plane]->SetYTitle("Average energy released (MIP)"); |
324 |
Plane[1][dispari][plane]->SetFillColor(1); |
325 |
Plane[1][dispari][plane]->Draw(); |
326 |
} |
327 |
if ( viewxy != "both" ){ |
328 |
Int_t l = 0; |
329 |
if ( viewxy == "x" ) l = 0; |
330 |
if ( viewxy == "y" ) l = 1; |
331 |
pd1->cd(); |
332 |
pd1->SetLeftMargin(0.15); |
333 |
gStyle->SetTitleFontSize(0.07); |
334 |
Plane[l][0][plane]->GetYaxis()->SetTitleOffset(1.8); |
335 |
Plane[l][0][plane]->SetXTitle("strip"); |
336 |
Plane[l][0][plane]->SetYTitle("Average energy released (MIP)"); |
337 |
Plane[l][0][plane]->SetFillColor(1); |
338 |
Plane[l][0][plane]->Draw(); |
339 |
pd2->cd(); |
340 |
gStyle->SetTitleFontSize(0.07); |
341 |
pd2->SetLeftMargin(0.15); |
342 |
Plane[l][1][plane]->GetYaxis()->SetTitleOffset(1.8); |
343 |
Plane[l][1][plane]->SetXTitle("strip"); |
344 |
Plane[l][1][plane]->SetYTitle("Average energy released (MIP)"); |
345 |
Plane[l][1][plane]->SetFillColor(1); |
346 |
Plane[l][1][plane]->Draw(); |
347 |
} |
348 |
TString figty = "planes2"; |
349 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
350 |
return; |
351 |
}; |
352 |
// |
353 |
// one figure |
354 |
// |
355 |
pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.98,0.98,10); |
356 |
figura->cd(); |
357 |
pd1->Range(0,0,100,100); |
358 |
pd1->Draw(); |
359 |
pd1->cd(); |
360 |
gStyle->SetTitleFontSize(0.03); |
361 |
pd1->SetLeftMargin(0.15); |
362 |
Int_t l = 0; |
363 |
if ( viewxy == "x" ) l = 0; |
364 |
if ( viewxy == "y" ) l = 1; |
365 |
Plane[l][dispari][plane]->GetYaxis()->SetTitleOffset(2.); |
366 |
Plane[l][dispari][plane]->SetXTitle("strip"); |
367 |
Plane[l][dispari][plane]->SetYTitle("Average energy released (MIP)"); |
368 |
Plane[l][dispari][plane]->SetFillColor(1); |
369 |
Plane[l][dispari][plane]->Draw(); |
370 |
TString figty = "planes1"; |
371 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
372 |
return; |
373 |
} else { |
374 |
if ( dispari == -1 && viewxy == "both" ){ |
375 |
// |
376 |
// 44 figures |
377 |
// |
378 |
TCanvas *figura = new TCanvas("The_calorimeter_planes_hit_1", "The_calorimeter_planes_hit", 1300, 1100); |
379 |
figura->SetFillColor(10); |
380 |
figura->Range(0,0,100,100); |
381 |
figura->cd(); |
382 |
TPad *pd[11][11]; |
383 |
Float_t ypos1; |
384 |
Float_t ypos2 = 0.; |
385 |
TLatex *t=new TLatex(); |
386 |
t->SetTextFont(32); |
387 |
t->SetTextColor(1); |
388 |
t->SetTextSize(0.02); |
389 |
t->SetTextAlign(12); |
390 |
t->DrawLatex(20.,99.,"View x odd"); |
391 |
t->DrawLatex(70.,99.,"View y even"); |
392 |
for (Int_t m = 0; m < 11; m++) { |
393 |
figura->cd(); |
394 |
ypos1 = 0.01 + ypos2; |
395 |
ypos2 = 0.079 + ypos1; |
396 |
Float_t ytit = 100.*(ypos1 + (ypos2-ypos1)/2.); |
397 |
TLatex *t=new TLatex(); |
398 |
t->SetTextFont(32); |
399 |
t->SetTextColor(1); |
400 |
t->SetTextSize(0.03); |
401 |
t->SetTextAlign(12); |
402 |
//char *tito; |
403 |
stringstream tito; |
404 |
tito.str(""); |
405 |
tito << "pl. " << (m+1); |
406 |
// tito = Form("pl. %i",m+1); |
407 |
t->DrawLatex(48.,ytit,tito.str().c_str()); |
408 |
for (Int_t n = 0; n < 2; n++) { |
409 |
Float_t xpos1; |
410 |
Float_t xpos2; |
411 |
figura->cd(); |
412 |
if ( n == 0 ){ |
413 |
xpos1 = 0.02; |
414 |
xpos2 = 0.45; |
415 |
} else{ |
416 |
xpos1 = 0.55; |
417 |
xpos2 = 0.98; |
418 |
}; |
419 |
pd[m][n] = new TPad("pd1","This is pad1",xpos1,ypos1,xpos2,ypos2,10); |
420 |
pd[m][n]->Range(0,0,100,100); |
421 |
pd[m][n]->Draw(); |
422 |
pd[m][n]->cd(); |
423 |
dispari = 0; |
424 |
if ( n == 0 ) dispari = 1; |
425 |
Plane[n][dispari][m]->SetXTitle(""); |
426 |
Plane[n][dispari][m]->SetYTitle(""); |
427 |
Plane[n][dispari][m]->SetTitle(""); |
428 |
Plane[n][dispari][m]->SetFillColor(1); |
429 |
Plane[n][dispari][m]->Draw(); |
430 |
}; |
431 |
}; |
432 |
TCanvas *figura2 = new TCanvas("The_calorimeter_planes_hit_2", "The_calorimeter_planes_hit", 1300, 1100); |
433 |
figura2->SetFillColor(10); |
434 |
figura2->Range(0,0,100,100); |
435 |
figura2->cd(); |
436 |
//TPad *pd[11][11]; |
437 |
// Float_t ypos1; |
438 |
ypos1 = 0; |
439 |
// Float_t ypos2 = 0.; |
440 |
ypos2 = 0.; |
441 |
//TLatex *t=new TLatex(); |
442 |
t=new TLatex(); |
443 |
t->SetTextFont(32); |
444 |
t->SetTextColor(1); |
445 |
t->SetTextSize(0.02); |
446 |
t->SetTextAlign(12); |
447 |
t->DrawLatex(20.,99.,"View x even"); |
448 |
t->DrawLatex(70.,99.,"View y odd"); |
449 |
for (Int_t mu = 0; mu < 11; mu++) { |
450 |
figura2->cd(); |
451 |
ypos1 = 0.01 + ypos2; |
452 |
ypos2 = 0.079 + ypos1; |
453 |
Float_t ytit = 100.*(ypos1 + (ypos2-ypos1)/2.); |
454 |
TLatex *t=new TLatex(); |
455 |
t->SetTextFont(32); |
456 |
t->SetTextColor(1); |
457 |
t->SetTextSize(0.03); |
458 |
t->SetTextAlign(12); |
459 |
stringstream tato; |
460 |
tato.str(""); |
461 |
tato << "pl. " << (mu+1); |
462 |
// char *tato; |
463 |
//tato = Form("pl. %i",mu+1); |
464 |
t->DrawLatex(48.,ytit,tato.str().c_str()); |
465 |
for (Int_t n = 0; n < 2; n++) { |
466 |
figura2->cd(); |
467 |
Float_t xpos1; |
468 |
Float_t xpos2; |
469 |
if ( n == 0 ){ |
470 |
xpos1 = 0.02; |
471 |
xpos2 = 0.45; |
472 |
} else{ |
473 |
xpos1 = 0.55; |
474 |
xpos2 = 0.98; |
475 |
}; |
476 |
pd[mu][n] = new TPad("pd1","This is pad1",xpos1,ypos1,xpos2,ypos2,10); |
477 |
pd[mu][n]->Range(0,0,100,100); |
478 |
pd[mu][n]->Draw(); |
479 |
pd[mu][n]->cd(); |
480 |
dispari = n; |
481 |
Plane[n][dispari][mu]->SetXTitle(""); |
482 |
Plane[n][dispari][mu]->SetYTitle(""); |
483 |
Plane[n][dispari][mu]->SetTitle(""); |
484 |
Plane[n][dispari][mu]->SetFillColor(1); |
485 |
Plane[n][dispari][mu]->Draw(); |
486 |
}; |
487 |
}; |
488 |
TString figty = "planes22a"; |
489 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
490 |
//TString figty = "planes22b"; |
491 |
figty = "planes22b"; |
492 |
PrintFigure(filename,outDir,figty,saveas,*figura2); |
493 |
return; |
494 |
}; |
495 |
if ( dispari == -1 || viewxy == "both" ){ |
496 |
// |
497 |
// 22 figures |
498 |
// |
499 |
TCanvas *figura = new TCanvas("The_calorimeter_planes_hit", "The_calorimeter_planes_hit", 1300, 1100); |
500 |
figura->SetFillColor(10); |
501 |
figura->Range(0,0,100,100); |
502 |
figura->cd(); |
503 |
TPad *pd[11][11]; |
504 |
if ( dispari == -1 ){ |
505 |
Float_t ypos1; |
506 |
Float_t ypos2 = 0.; |
507 |
Int_t l = 0; |
508 |
if ( viewxy == "x" ) l = 0; |
509 |
if ( viewxy == "y" ) l = 1; |
510 |
TLatex *t=new TLatex(); |
511 |
t->SetTextFont(32); |
512 |
t->SetTextColor(1); |
513 |
t->SetTextSize(0.02); |
514 |
t->SetTextAlign(12); |
515 |
// char *titol="calcalcalcalaclaclcalca"; |
516 |
stringstream titol; |
517 |
char *zuno; |
518 |
char *zdue; |
519 |
if ( viewxy == "x" ) { |
520 |
zuno = "x"; |
521 |
} else { |
522 |
zuno = "y"; |
523 |
}; |
524 |
zdue ="even"; |
525 |
titol.str(""); |
526 |
titol << "View " << zuno; |
527 |
titol << " " << zdue; |
528 |
// titol = Form("View %s %s",zuno,zdue); |
529 |
t->DrawLatex(20.,99.,titol.str().c_str()); |
530 |
zdue ="odd"; |
531 |
titol.str(""); |
532 |
titol << "View " <<zuno; |
533 |
titol << " " << zdue; |
534 |
// titol = Form("View %s %s",zuno,zdue); |
535 |
t->DrawLatex(70.,99.,titol.str().c_str()); |
536 |
for (Int_t m = 0; m < 11; m++) { |
537 |
figura->cd(); |
538 |
ypos1 = 0.01 + ypos2; |
539 |
ypos2 = 0.079 + ypos1; |
540 |
Float_t ytit = 100.*(ypos1 + (ypos2-ypos1)/2.); |
541 |
TLatex *t=new TLatex(); |
542 |
t->SetTextFont(32); |
543 |
t->SetTextColor(1); |
544 |
t->SetTextSize(0.03); |
545 |
t->SetTextAlign(12); |
546 |
// char *tito; |
547 |
stringstream tito; |
548 |
tito.str(""); |
549 |
tito << "pl. " << (m+1); |
550 |
//tito = Form("pl. %i",m+1); |
551 |
t->DrawLatex(48.,ytit,tito.str().c_str()); |
552 |
for (Int_t n = 0; n < 2; n++) { |
553 |
figura->cd(); |
554 |
Float_t xpos1; |
555 |
Float_t xpos2; |
556 |
if ( n == 0 ){ |
557 |
xpos1 = 0.02; |
558 |
xpos2 = 0.45; |
559 |
} else{ |
560 |
xpos1 = 0.55; |
561 |
xpos2 = 0.98; |
562 |
}; |
563 |
pd[m][n] = new TPad("pd1","This is pad1",xpos1,ypos1,xpos2,ypos2,10); |
564 |
pd[m][n]->Range(0,0,100,100); |
565 |
pd[m][n]->Draw(); |
566 |
pd[m][n]->cd(); |
567 |
Plane[l][n][m]->SetXTitle(""); |
568 |
Plane[l][n][m]->SetYTitle(""); |
569 |
Plane[l][n][m]->SetTitle(""); |
570 |
Plane[l][n][m]->SetFillColor(1); |
571 |
Plane[l][n][m]->Draw(); |
572 |
}; |
573 |
}; |
574 |
} else { |
575 |
Float_t ypos1; |
576 |
Float_t ypos2 = 0.; |
577 |
TLatex *t=new TLatex(); |
578 |
t->SetTextFont(32); |
579 |
t->SetTextColor(1); |
580 |
t->SetTextSize(0.02); |
581 |
t->SetTextAlign(12); |
582 |
stringstream titol; |
583 |
// char *titol="calcalcalcalaclaclcalca"; |
584 |
char *zuno; |
585 |
char *zdue; |
586 |
if ( parity == "odd" ) { |
587 |
zdue = "odd"; |
588 |
} else { |
589 |
zdue = "even"; |
590 |
}; |
591 |
zuno ="x"; |
592 |
titol.str(""); |
593 |
titol << "View " << zuno; |
594 |
titol << " " << zdue; |
595 |
// titol = Form("View %s %s",zuno,zdue); |
596 |
t->DrawLatex(20.,99.,titol.str().c_str()); |
597 |
zuno ="y"; |
598 |
titol.str(""); |
599 |
titol << "View " << zuno; |
600 |
titol << " " << zdue; |
601 |
// titol = Form("View %s %s",zuno,zdue); |
602 |
t->DrawLatex(70.,99.,titol.str().c_str()); |
603 |
for (Int_t m = 0; m < 11; m++) { |
604 |
figura->cd(); |
605 |
ypos1 = 0.01 + ypos2; |
606 |
ypos2 = 0.079 + ypos1; |
607 |
Float_t ytit = 100.*(ypos1 + (ypos2-ypos1)/2.); |
608 |
TLatex *t=new TLatex(); |
609 |
t->SetTextFont(32); |
610 |
t->SetTextColor(1); |
611 |
t->SetTextSize(0.03); |
612 |
t->SetTextAlign(12); |
613 |
// char *tito; |
614 |
stringstream tito; |
615 |
tito.str(""); |
616 |
tito << "pl. " << (m+1); |
617 |
// tito = Form("pl. %i",m+1); |
618 |
t->DrawLatex(48.,ytit,tito.str().c_str()); |
619 |
for (Int_t n = 0; n < 2; n++) { |
620 |
figura->cd(); |
621 |
Float_t xpos1; |
622 |
Float_t xpos2; |
623 |
if ( n == 0 ){ |
624 |
xpos1 = 0.02; |
625 |
xpos2 = 0.45; |
626 |
} else{ |
627 |
xpos1 = 0.55; |
628 |
xpos2 = 0.98; |
629 |
}; |
630 |
pd[m][n] = new TPad("pd1","This is pad1",xpos1,ypos1,xpos2,ypos2,10); |
631 |
pd[m][n]->Range(0,0,100,100); |
632 |
pd[m][n]->Draw(); |
633 |
pd[m][n]->cd(); |
634 |
Plane[n][dispari][m]->SetXTitle(""); |
635 |
Plane[n][dispari][m]->SetYTitle(""); |
636 |
Plane[n][dispari][m]->SetTitle(""); |
637 |
Plane[n][dispari][m]->SetFillColor(1); |
638 |
Plane[n][dispari][m]->Draw(); |
639 |
}; |
640 |
}; |
641 |
}; |
642 |
TString figty = "planes11"; |
643 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
644 |
return; |
645 |
}; |
646 |
// |
647 |
// 11 figures |
648 |
// |
649 |
TCanvas *figura = new TCanvas("The_calorimeter_planes_hit", "The_calorimeter_planes_hit", 650, 1100); |
650 |
figura->SetFillColor(10); |
651 |
figura->Range(0,0,100,100); |
652 |
figura->cd(); |
653 |
TPad *pd[11]; |
654 |
Float_t ypos1; |
655 |
Float_t ypos2 = 0.; |
656 |
Int_t l = 0; |
657 |
if ( viewxy == "x" ) l = 0; |
658 |
if ( viewxy == "y" ) l = 1; |
659 |
TLatex *t=new TLatex(); |
660 |
t->SetTextFont(32); |
661 |
t->SetTextColor(1); |
662 |
t->SetTextSize(0.03); |
663 |
t->SetTextAlign(12); |
664 |
stringstream titol; |
665 |
// char *titol="calcalcalcalaclaclcalca"; |
666 |
char *zuno; |
667 |
char *zdue; |
668 |
if ( viewxy == "x" ) { |
669 |
zuno = "x"; |
670 |
} else { |
671 |
zuno = "y"; |
672 |
}; |
673 |
if ( parity == "odd" ) { |
674 |
zdue = "odd"; |
675 |
} else { |
676 |
zdue = "even"; |
677 |
}; |
678 |
titol.str(""); |
679 |
titol << "View " << zuno; |
680 |
titol << " " << zdue; |
681 |
// titol = Form("View %s %s",zuno,zdue); |
682 |
t->DrawLatex(40.,99.,titol.str().c_str()); |
683 |
for (Int_t m = 0; m < 11; m++) { |
684 |
figura->cd(); |
685 |
ypos1 = 0.01 + ypos2; |
686 |
ypos2 = 0.079 + ypos1; |
687 |
Float_t ytit = 100.*(ypos1 + (ypos2-ypos1)/2.); |
688 |
TLatex *t=new TLatex(); |
689 |
t->SetTextFont(32); |
690 |
t->SetTextColor(1); |
691 |
t->SetTextSize(0.03); |
692 |
t->SetTextAlign(12); |
693 |
stringstream tito; |
694 |
tito.str(""); |
695 |
tito << "pl. " << (m+1); |
696 |
// char *tito; |
697 |
//tito = Form("pl. %i",m+1); |
698 |
t->DrawLatex(93.,ytit,tito.str().c_str()); |
699 |
pd[m] = new TPad("pd1","This is pad1",0.02,ypos1,0.91,ypos2,10); |
700 |
pd[m]->Range(0,0,100,100); |
701 |
pd[m]->Draw(); |
702 |
pd[m]->cd(); |
703 |
Plane[l][dispari][m]->SetXTitle(""); |
704 |
Plane[l][dispari][m]->SetYTitle(""); |
705 |
Plane[l][dispari][m]->SetTitle(""); |
706 |
Plane[l][dispari][m]->SetFillColor(1); |
707 |
Plane[l][dispari][m]->Draw(); |
708 |
}; |
709 |
TString figty = "planes11"; |
710 |
PrintFigure(filename,outDir,figty,saveas,*figura); |
711 |
return; |
712 |
}; |
713 |
// |
714 |
// caloFile->Close(); |
715 |
//headerFile->Close(); |
716 |
gSystem->ChangeDirectory(startingdir); |
717 |
} |