/[PAMELA software]/calo/ground/QLOOK/macros/CaloPULSE.c
ViewVC logotype

Contents of /calo/ground/QLOOK/macros/CaloPULSE.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Mon Dec 5 16:12:46 2005 UTC (19 years ago) by mocchiut
Branch point for: MAIN, QLOOK
File MIME type: text/plain
Initial revision

1 //
2 // Show pulse distributions of the calorimeter PULSE calibration
3 //
4 // CaloPULSE.c version 1.05 (2005-11-15)
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.04 - 1.05 : compiled!
11 //
12 // 1.03 - 1.04 : don't load yodaUtility.c use clones of routines
13 //
14 // 1.02 - 1.03 : small changes for compilation.
15 //
16 // 1.01 - 1.02 : changed to be inserted in package CaloQLOOK.
17 //
18 // 1.00 - 1.01 : check if file is older than 05015_007.
19 //
20 // 1.00 : it works.
21 //
22 #include <fstream>
23 #include <sstream>
24 #include <TTree.h>
25 #include <TClassEdit.h>
26 #include <TObject.h>
27 #include <TList.h>
28 #include <TSystem.h>
29 #include <TSystemDirectory.h>
30 #include <TString.h>
31 #include <TFile.h>
32 #include <TClass.h>
33 #include <TCanvas.h>
34 #include <TH1.h>
35 #include <TH1F.h>
36 #include <TH2D.h>
37 #include <TLatex.h>
38 #include <TPad.h>
39 #include <TPaveLabel.h>
40 #include <TChain.h>
41 #if !defined (__CINT__)
42 #include <event/PamelaRun.h>
43 #include <event/physics/calorimeter/CalorimeterEvent.h>
44 #include <event/physics/trigger/TriggerEvent.h>
45 #include <event/CalibCalPedEvent.h>
46 #include <event/CalibCalPulse1Event.h>
47 #include <event/CalibCalPulse2Event.h>
48 #include <event/varDump/VarDumpEvent.h>
49 #include <event/varDump/VarDumpRecord.h>
50 #include <caloclasses.h>
51 #endif
52 #include <CaloFunctions.h>
53
54
55 void CaloPULSE(TString filename, TString outDir = "", Int_t tosave = 0, TString saveas = "eps"){
56 gROOT->GetListOfCanvases()->Delete("a");
57 gDirectory->GetList()->Delete();
58 emicheckLib();
59 if ( outDir == "" ) outDir = filename;
60 // TString *file[17];
61 //file = "dw_000000_000.dat";
62 //file = getFilename(filename);
63 TString fififile = getFilename(filename);
64 const char *file = fififile;
65 //
66 TFile *vardumphFile;
67 TFile *vardumpFile;
68 TFile *calheadFile;
69 TFile *calcalibFile;
70 calheadFile = emigetFile(filename, "CalibCalPulse1", "Header");
71 calcalibFile = emigetFile(filename, "CalibCalPulse1");
72 //Takes the tree of the header file
73 TTree *tr = (TTree*)calheadFile->Get("Pscu");
74 tr->AddFriend("CalibCalPulse1", calcalibFile);
75 pamela::CalibCalPulse1Event *ce = 0;
76 pamela::EventHeader *ceh = new pamela::EventHeader();
77 tr->SetBranchAddress("Header", &ceh);
78 tr->SetBranchAddress("Event", &ce);
79 Int_t tmpSize;
80 vardumphFile = emigetFile(filename, "VarDump", "Header");
81 vardumpFile = emigetFile(filename, "VarDump");
82 //Takes the tree of the header file
83 TTree *vdtr = (TTree*)vardumphFile->Get("Pscu");
84 vdtr->AddFriend("VarDump", vardumpFile);
85 pamela::VarDumpEvent *vde = 0;
86 pamela::VarDumpRecord *vdr = 0;
87 vdtr->SetBranchAddress("VarDump.Event", &vde);
88 Long64_t nevents = vdtr->GetEntries();
89 // char *ptype = 0;
90 stringstream ptype;
91 stringstream stno;
92 // char *stno = 0;
93 for (Int_t i = 0; i < nevents ; i++){
94 vdtr->GetEntry(i);
95 tmpSize = vde->Records->GetEntries();
96 for (Int_t j = 0; j < tmpSize; j++){
97 vdr = (pamela::VarDumpRecord*)vde->Records->At(j);
98 if ( (int)vdr->VAR_VALUE>32760 && (int)vdr->VAR_VALUE<32790 ){
99 printf(" PULSE TYPE = %X ",vdr->VAR_VALUE);
100 ptype.str("");
101 ptype << " PULSE TYPE = ";
102 ptype << hex << vdr->VAR_VALUE;
103 // ptype = Form(" PULSE TYPE = %X ",vdr->VAR_VALUE);
104 vdr = (pamela::VarDumpRecord*)vde->Records->At(j+1);
105 printf(" STRIP = %X \n",vdr->VAR_VALUE);
106 stno.str("");
107 stno << " STRIP = ";
108 stno << hex << vdr->VAR_VALUE;
109 //stno = Form(" STRIP = %X \n",vdr->VAR_VALUE);
110 };
111 };
112 };
113 vardumphFile->Close();
114 vardumpFile->Close();
115
116 TCanvas *figura2 = new TCanvas("calpulse", "calpulse", 950, 850);
117 figura2->cd();
118 gPad->SetLogy();
119 Long64_t ncalibs = tr->GetEntries();
120 TH1F *calpulse1;
121 Int_t workornot = 1;
122 int stoppa = 0;
123 for (Int_t ci = 0; ci < ncalibs ; ci++){
124 int stoppa = 0;
125 int per = 0;
126 tr->GetEntry(ci);
127 gDirectory->Delete("calpulse");
128 calpulse1 = new TH1F("calpulse","",96,-0.5,8000.);
129 calpulse1->SetBit(TH1F::kCanRebin);
130 for ( Int_t s=0 ; s<4 ;s++ ){
131 if ( ce->unpackError ) {
132 per = 1;
133 } else {
134 per = 0;
135 //gPad->SetLogy();
136 for ( Int_t d=0 ; d<11 ;d++ ){
137 for ( Int_t j=0; j<96 ;j++){
138 calpulse1->Fill(ce->calpuls[s][d][j]);
139 if ( ce->calpuls[s][d][j] != 0. ) stoppa = 1;
140 if ( ce->calpuls[s][d][j] < 0. ) workornot = 0;
141 };
142 };
143 };
144 };
145 if ( !per ){
146 figura2->cd();
147 figura2->SetFillColor(10);
148 // char *titolo = 0;
149 stringstream titolo;
150 titolo.str("");
151 titolo << "Pulse1 " << ptype.str().c_str();
152 titolo << " " << stno.str().c_str();
153 // titolo = Form("Pulse1 %s %s",ptype,stno);
154 calpulse1->Draw();
155 calpulse1->SetTitle(titolo.str().c_str());
156 figura2->Modified();
157 figura2->Update();
158
159 // char *figrec = 0;
160 //figrec = "dw_000000_000";
161 // memcpy(figrec, file, 13);
162 //const char *outdir = outDir;
163 //const char *format = saveas;
164 stringstream figsave;
165 figsave.str("");
166 //figsave << outdir << "/";
167 //figsave << figrec << "_pulse1_";
168 figsave << "pulse1_";
169 figsave << ci;
170 // figsave << ci << ".";
171 // figsave << format;
172 //if ( tosave ) figura2->SaveAs(figsave.str().c_str());
173
174 if ( tosave ) PrintFigure(filename,outDir,figsave.str().c_str(),saveas,*figura2);
175 };
176 // printf("press enter to continue, 1 calib no. %i \n ",ci);
177 // if ( stoppa ) getchar();
178 };
179 calheadFile = emigetFile(filename, "CalibCalPulse2", "Header");
180 calcalibFile = emigetFile(filename, "CalibCalPulse2");
181 //Takes the tree of the header file
182 tr = (TTree*)calheadFile->Get("Pscu");
183 tr->AddFriend("CalibCalPulse2", calcalibFile);
184 pamela::CalibCalPulse2Event *cee = 0;
185 // pamela::PscuHeader *cph = new pamela::PscuHeader();
186 //pamela::EventHeader *ceh = new pamela::EventHeader();
187 tr->SetBranchAddress("Header", &ceh);
188 tr->SetBranchAddress("Event", &cee);
189
190 figura2 = new TCanvas("calpulse", "calpulse", 950, 850);
191 figura2->cd();
192 gPad->SetLogy();
193 ncalibs = tr->GetEntries();
194 TH1F *calpulse2;
195 for (Int_t ci = 0; ci < ncalibs ; ci++){
196 int stoppa = 0;
197 int per = 0;
198 tr->GetEntry(ci);
199 gDirectory->Delete("calpulse");
200 calpulse2 = new TH1F("calpulse","",96,-0.5,8000.);
201 calpulse2->SetBit(TH1F::kCanRebin);
202 for ( Int_t s=0 ; s<4 ;s++ ){
203 if ( cee->unpackError ){
204 per = 1;
205 } else {
206 per = 0;
207 for ( Int_t d=0 ; d<11 ;d++ ){
208 for ( Int_t j=0; j<96 ;j++){
209 calpulse2->Fill(cee->calpuls[s][d][j]);
210 if ( cee->calpuls[s][d][j] != 0. ) {
211 stoppa = 1;
212 // printf("ce->calpuls[s][d][j] %f \n",ce->calpuls[s][d][j]);
213 };
214 if ( cee->calpuls[s][d][j] < 0. ) workornot = 0;
215 };
216 };
217 };
218 };
219 if ( !per ){
220 figura2->cd();
221 figura2->SetFillColor(10);
222 figura2->Range(0,0,100,100);
223 // char *titolo = 0;
224 stringstream titolo;
225 titolo.str("");
226 titolo << "Pulse2 " << ptype.str().c_str();
227 titolo << " " << stno.str().c_str();
228 // titolo = Form("Pulse2 %s %s",ptype,stno);
229 calpulse2->SetTitle(titolo.str().c_str());
230 calpulse2->Draw();
231 // gPad->SetLogy();
232 figura2->Modified();
233 figura2->Update();
234 //
235 // char *figrec = 0;
236 //figrec = "dw_000000_000";
237 // memcpy(figrec, file, 13);
238 //const char *outdir = outDir;
239 //const char *format = saveas;
240 stringstream figsave;
241 figsave.str("");
242 //figsave << outdir << "/";
243 //figsave << figrec << "_pulse1_";
244 figsave << "pulse2_";
245 figsave << ci;
246 // figsave << ci << ".";
247 // figsave << format;
248 //if ( tosave ) figura2->SaveAs(figsave.str().c_str());
249
250 if ( tosave ) PrintFigure(filename,outDir,figsave.str().c_str(),saveas,*figura2);
251
252 //
253 //char *figrec = 0;
254 //figrec = "dw_000000_000";
255 //memcpy(figrec, file, 13);
256 //const char *outdir = outDir;
257 //// char *figsave = 0;
258 //const char *format = saveas;
259 //stringstream figsave;
260 //figsave.str("");
261 //figsave << outdir << "/";
262 //figsave << figrec << "_pulse2_";
263 //figsave << ci << ".";
264 //figsave << format;
265 //// figsave = Form("%s/%s_pulse2_%i.%s",outdir,figrec,ci,format);
266 //if ( tosave ) figura2->SaveAs(figsave.str().c_str());
267 };
268 // printf("press enter to continue, 2 calib no. %i\n ",ci);
269 // if ( stoppa ) getchar();
270 };
271 if ( stoppa ){
272 if ( workornot ){
273 printf("File %s is ok \n",file);
274 } else {
275 printf("File %s is NOT OK! \n",file);
276 };
277 };
278 }
279
280 void CaloPULSEMATRA(TString filename, TString outDir = "", Int_t tosave = 0, TString saveas = "eps"){
281 gROOT->GetListOfCanvases()->Delete("a");
282 gDirectory->GetList()->Delete();
283 emicheckLib();
284 if ( outDir == "" ) outDir = filename;
285 //TString *file[17];
286 //file = "dw_000000_000.dat";
287 //file = getFilename(filename);
288 TString fififile = getFilename(filename);
289 const char *file = fififile;
290 //
291 struct Calib calib;
292 for (Int_t s=0; s<4;s++){
293 for (Int_t d = 0; d<50; d++){
294 calib.ttime[s][d] = 0 ;
295 if ( d < 49 ) calib.time[s][d] = 0 ;
296 };
297 };
298 //
299 // first of all find the calibrations in the file
300 //
301 OLDCaloFindCalibs(filename, calib);
302 //
303 // print on the screen the results:
304 //
305 printf(" ---------------------------------------------------------- \n \n");
306 Int_t calibex = 0;
307 for (Int_t s=0; s<4;s++){
308 Int_t stop = 0;
309 for (Int_t d = 0; d<48; d++){
310 if ( calib.ttime[s][d] != 0 ) {
311 calibex++;
312 };
313 if ( calib.time[s][0] != 0 ){
314 if ( d == 0 ) printf(" Section %i from time 0 to time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d]);
315 if ( calib.time[s][d+1] != 0 ) {
316 printf(" Section %i from time %i to time %i use calibration at time %i \n",s,calib.time[s][d],calib.time[s][d+1],calib.ttime[s][d+1]);
317 } else {
318 if ( !stop ){
319 printf(" Section %i from time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d+1]);
320 stop = 1;
321 };
322 };
323 } else {
324 if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %i \n",s,calib.ttime[s][d]);
325 };
326 };
327 printf("\n");
328 };
329
330 Int_t workornot = 1;
331 TFile *vardumphFile;
332 TFile *vardumpFile;
333 Int_t tmpSize;
334 vardumphFile = emigetFile(filename, "VarDump", "Header");
335 vardumpFile = emigetFile(filename, "VarDump");
336 //Takes the tree of the header file
337 TTree *vdtr = (TTree*)vardumphFile->Get("Pscu");
338 vdtr->AddFriend("VarDump", vardumpFile);
339 pamela::VarDumpEvent *vde = 0;
340 pamela::VarDumpRecord *vdr = 0;
341 vdtr->SetBranchAddress("VarDump.Event", &vde);
342 Long64_t nevents = vdtr->GetEntries();
343 stringstream ptype;
344 stringstream stno;
345 // char *ptype = 0;
346 //char *stno = 0;
347 for (Int_t i = 0; i < nevents ; i++){
348 vdtr->GetEntry(i);
349 tmpSize = vde->Records->GetEntries();
350 for (Int_t j = 0; j < tmpSize; j++){
351 vdr = (pamela::VarDumpRecord*)vde->Records->At(j);
352 if ( (int)vdr->VAR_VALUE>32760 && (int)vdr->VAR_VALUE<32790 ){
353 printf(" PULSE TYPE = %X ",vdr->VAR_VALUE);
354 ptype.str("");
355 ptype << " PULSE TYPE = ";
356 ptype << hex << vdr->VAR_VALUE;
357 // ptype = Form(" PULSE TYPE = %X ",vdr->VAR_VALUE);
358 vdr = (pamela::VarDumpRecord*)vde->Records->At(j+1);
359 printf(" STRIP = %X \n",vdr->VAR_VALUE);
360 stno.str("");
361 stno << " STRIP = ";
362 stno << hex << vdr->VAR_VALUE;
363 };
364 };
365 };
366 vardumphFile->Close();
367 vardumpFile->Close();
368
369
370 TFile *calheadFile;
371 TFile *calcalibFile;
372 TFile *calcalibFile3;
373 calheadFile = emigetFile(filename, "CalibCalPulse2", "Header");
374 calcalibFile = emigetFile(filename, "CalibCalPulse2");
375 calcalibFile3 = emigetFile(filename, "CalibCalPulse1");
376 //Takes the tree of the header file
377 TTree *tr = (TTree*)calheadFile->Get("Pscu");
378 tr->AddFriend("CalibCalPulse2", calcalibFile);
379 tr->AddFriend("CalibCalPulse1", calcalibFile3);
380 pamela::CalibCalPulse2Event *cee = 0;
381 pamela::CalibCalPulse1Event *cee1 = 0;
382 pamela::EventHeader *ceh = new pamela::EventHeader();
383 tr->SetBranchAddress("Header", &ceh);
384 tr->SetBranchAddress("CalibCalPulse2.Event", &cee);
385 tr->SetBranchAddress("CalibCalPulse1.Event", &cee1);
386
387 Long64_t ncalibs = tr->GetEntries();
388 //
389 TCanvas *figura2 = new TCanvas("Calorimeter_tracks", "Calorimeter_tracks", 750, 650);
390 figura2->SetFillColor(10);
391 figura2->Range(0,0,100,100);
392 Int_t ci = 0;
393 int stoppa = 0;
394 while ( ci < ncalibs ){
395 stoppa = 0;
396 int per = 0;
397 // if ( ci !=0 && ci%4==0 && ci<5){
398
399 // if ( ci%8 != 0 && ci%4==0 ){
400 // printf("sto calibrando! ci = %i \n",ci);
401 // calibr++;
402 // calib.iev = 0;
403 // for (Int_t m = 0; m < 22; m++){
404 // if ( m < 4) {
405 // calib.cstwerr[m] = 0;
406 // calib.cperror[m] = 0.;
407 // };
408 // for (Int_t l = 0; l < 2; l++){
409 // for (Int_t n = 0; n < 96; n++){
410 // calib.calped[l][m][n] = 0.;
411 // calib.calgood[l][m][n] = 0.;
412 // calib.calrms[l][m][n] = 0.;
413 // if ( n < 6 ) {
414 // calib.calthr[l][m][n] = 0.;
415 // calib.calbase[l][m][n] = 0.;
416 // calib.calvar[l][m][n] = 0.;
417 // };
418 // };
419 // };
420 // };
421 // //
422 // // call calibration
423 // //
424 // for (Int_t s = 0; s < 4; s++){
425 // CaloPede(filename,s,calib.ttime[s][calibr],calib);
426 // };
427 //};
428 //otr->GetEntry(0);
429 //for (Int_t l = 0; l < 2; l++){
430 // for (Int_t m = 0; m < 22; m++){
431 // Int_t pre = -1;
432 // for (Int_t n = 0; n < 96; n++){
433 // if ( n%16 == 0 ) pre++;
434 // if ( cp->base[l][m][pre] != 0. ) calib.calbase[l][m][pre] = cp->base[l][m][pre];
435 // };
436 // };
437 //};
438 //
439 figura2->Clear();
440 //
441 // Book the histograms:
442 //
443 //
444 stringstream xview;
445 xview.str("");
446 xview << "x-view event " << (ci+1);
447 stringstream yview;
448 yview.str("");
449 yview << "y-view event " << (ci+1);
450 gDirectory->Delete(xview.str().c_str());
451 gDirectory->Delete(yview.str().c_str());
452 TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
453 TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
454 //
455 // figures:
456 //
457 Int_t bgcolor = 10;
458 TLatex *t=new TLatex();
459 t->SetTextFont(32);
460 t->SetTextColor(1);
461 t->SetTextSize(0.03);
462 t->SetTextAlign(12);
463 // char *titolo = 0;
464 //sprintf(titolo,"Calorimeter tracks - file %s - event number %i ",file,i+1);
465 //t->DrawLatex(0.5,97.,titolo);
466 TPad *pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor);
467 TPad *pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor);
468 TPad *palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.9,bgcolor);
469 figura2->cd();
470 t=new TLatex();
471 t->SetTextFont(32);
472 t->SetTextColor(1);
473 t->SetTextSize(0.03);
474 t->SetTextAlign(12);
475 t->DrawLatex(92.,92.5,"MIP");
476 pd1->Range(0,0,100,100);
477 pd2->Range(0,0,100,100);
478 palette->Range(0,0,100,100);
479 pd1->SetTicks();
480 pd2->SetTicks();
481 pd1->Draw();
482 pd2->Draw();
483 palette->Draw();
484 palette->cd();
485 // palette
486 TPaveLabel *box1 = new TPaveLabel(2,2,98,16.3,"0","");
487 box1->SetTextFont(32);
488 box1->SetTextColor(1);
489 box1->SetTextSize(0.25);
490 box1->SetFillColor(10);
491 box1->Draw();
492 TPaveLabel *box2 = new TPaveLabel(2,18.3,98,32.66,"0-2","");
493 box2->SetTextFont(32);
494 box2->SetTextColor(1);
495 box2->SetTextSize(0.25);
496 box2->SetFillColor(38);
497 box2->Draw();
498 TPaveLabel *box3 = new TPaveLabel(2,34.66,98,48.96,"2-10","");
499 box3->SetTextFont(32);
500 box3->SetTextColor(1);
501 box3->SetTextSize(0.25);
502 box3->SetFillColor(4);
503 box3->Draw();
504 TPaveLabel *box4 = new TPaveLabel(2,50.96,98,65.26,"10-100","");
505 box4->SetTextFont(32);
506 box4->SetTextColor(1);
507 box4->SetTextSize(0.25);
508 box4->SetFillColor(3);
509 box4->Draw();
510 TPaveLabel *box5 = new TPaveLabel(2,67.26,98,81.56,"100-500","");
511 box5->SetTextFont(32);
512 box5->SetTextColor(1);
513 box5->SetTextSize(0.2);
514 box5->SetFillColor(2);
515 box5->Draw();
516 TPaveLabel *box6 = new TPaveLabel(2,83.56,98,97.86,">500","");
517 box6->SetTextFont(32);
518 box6->SetTextColor(1);
519 box6->SetTextSize(0.25);
520 box6->SetFillColor(6);
521 box6->Draw();
522 figura2->cd();
523 gStyle->SetOptDate(1);
524 pd1->cd();
525 gStyle->SetOptStat(0);
526 Xview->SetXTitle("strip");
527 Xview->SetYTitle("X - plane");
528 Xview->GetYaxis()->SetTitleOffset(0.5);
529 Xview->SetFillColor(bgcolor);
530 Xview->Fill(1.,1.,1.);
531 Xview->Draw("box");
532 pd1->Update();
533 pd2->cd();
534 gStyle->SetOptStat(0);
535 Yview->SetXTitle("strip");
536 Yview->SetYTitle("Y - plane");
537 Yview->GetYaxis()->SetTitleOffset(0.5);
538 Yview->SetFillColor(bgcolor);
539 Yview->Fill(1.,1.,1.);
540 Yview->Draw("box");
541 pd2->Update();
542 //
543 Int_t m = 0;
544 Int_t l = 3;
545 Int_t ss = 0;
546 Float_t estrip = 0.;
547 for ( Int_t s=0 ; s<4 ;s++ ){
548 tr->GetEntry(ci);
549 // printf("ci = %i unpkerr = %i \n",ci,cee->unpackError);
550 if ( cee->unpackError ){
551 per = 1;
552 } else {
553 if ( s == 0 ) ss = 0;
554 if ( s == 1 ) ss = 2;
555 if ( s == 2 ) ss = 3;
556 if ( s == 3 ) ss = 1;
557 per = 0;
558 for ( Int_t d=0 ; d<11 ;d++ ){
559 Int_t pre = -1;
560 for ( Int_t j=0; j<96 ;j++){
561 figura2->cd();
562 if ( j%16 == 0 ) pre++;
563 estrip = 0.;
564 if ( s == 2 ) m = 2*d+1;
565 if ( s == 3 ) m = 2*d;
566 if ( s == 0 ) m = 2*d;
567 if ( s == 1 ) m = 2*d+1;
568 if ( s == 3 ) l = 0;
569 if ( s == 2 ) l = 0;
570 if ( s == 1 ) l = 1;
571 if ( s == 0 ) l = 1;
572 // estrip = (cee->calpuls[ss][d][j]-calib.calbase[l][m][pre]-calib.calped[l][m][j])/26.;
573 estrip = (cee->calpuls[ss][d][j]-cee1->calpuls[ss][d][j])/26.;
574 if ( estrip > 0.7 ){
575 // if ( d == 0 ) printf("strip number: %i MIP: %f \n",j,estrip);
576 xview.str("");
577 xview << "x-view event " << j;
578 xview << " " << m;
579 xview << " " << l;
580 yview.str("");
581 yview << "y-view event " << j;
582 yview << " " << m;
583 yview << " " << l;
584 gDirectory->Delete(xview.str().c_str());
585 gDirectory->Delete(yview.str().c_str());
586 TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
587 TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
588 Int_t colo;
589 ColorMIP(estrip,colo);
590 Xview->SetFillColor(colo);
591 Yview->SetFillColor(colo);
592 if ( l == 0 ) {
593 Xview->Fill(j,m,1.);
594 pd1->cd();
595 Xview->Draw("box same");
596 };
597 if ( l == 1 ) {
598 Yview->Fill(j,m,1.);
599 pd2->cd();
600 Yview->Draw("box same");
601 };
602 };
603 if ( cee->calpuls[s][d][j] != 0. ) {
604 stoppa = 1;
605 };
606 if ( cee->calpuls[s][d][j] < 0. ) workornot = 0;
607 };
608 };
609 };
610 ci++;
611 };
612 if ( !per ){
613 pd1->Update();
614 pd2->Update();
615 figura2->Modified();
616 figura2->Update();
617
618 // char *figrec = 0;
619 //figrec = "dw_000000_000";
620 // memcpy(figrec, file, 13);
621 //const char *outdir = outDir;
622 //const char *format = saveas;
623 stringstream figsave;
624 figsave.str("");
625 //figsave << outdir << "/";
626 //figsave << figrec << "_pulse1_";
627 figsave << "pulsematra2_";
628 figsave << ci;
629 // figsave << ci << ".";
630 // figsave << format;
631 //if ( tosave ) figura2->SaveAs(figsave.str().c_str());
632
633 if ( tosave ) PrintFigure(filename,outDir,figsave.str().c_str(),saveas,*figura2);
634
635 //char *figrec = 0;
636 //figrec = "dw_000000_000";
637 //memcpy(figrec, file, 13);
638 //const char *outdir = outDir;
639 //// char *figsave = 0;
640 //const char *format = saveas;
641 //stringstream figsave;
642 //figsave.str("");
643 //figsave << outdir << "/";
644 //figsave << figrec << "_pulsematra2_";
645 //figsave << ci << ".";
646 //figsave << format;
647 //// figsave = Form("%s/%s_pulsematra2_%i.%s",outdir,figrec,ci,format);
648 //if ( tosave ) figura2->SaveAs(figsave.str().c_str());
649
650 // printf("Press enter to continue \n");
651 //getchar();
652 };
653 };
654 // printf("press enter to continue, 2 calib no. %i\n ",ci);
655 // if ( stoppa ) getchar();
656 if ( stoppa ){
657 if ( workornot ){
658 printf("File %s is ok \n",file);
659 } else {
660 printf("File %s is NOT OK! \n",file);
661 };
662 };
663 }

  ViewVC Help
Powered by ViewVC 1.1.23