/[PAMELA software]/eventviewer/flight/macros/FEventViewer.cxx
ViewVC logotype

Contents of /eventviewer/flight/macros/FEventViewer.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Fri Jul 14 14:21:43 2006 UTC (18 years, 4 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
FILE REMOVED
New _BETA_ and buggy version

1 //-------------------------------------------------------------------------------------------------------------------------------------------------------
2 //
3 // FEventViewer.c version 1.03 (2006-04-04)
4 //
5 // Shows PAMELA events - Emiliano Mocchiutti
6 //
7 //-------------------------------------------------------------------------------------------------------------------------------------------------------
8 //
9 //
10 // Standard use:
11 //
12 // bash> EventViewer
13 //
14 // For further informations use:
15 //
16 // EventViewer --help
17 //
18 // or
19 //
20 // EventViewer --version
21 //
22 //-------------------------------------------------------------------------------------------------------------------------------------------------------
23 //
24 // Changelog:
25 //
26 // 1.02 - 1.03 (2006-04-04): Make it possible to select events with the calorimeter also when generating level1 from level0.
27 //
28 // 1.01 - 1.02 (2006-03-22): Read calorimeter ADC2MIP flight conversion file. Do not install FEventviewer.cxx!
29 //
30 // 1.00 - 1.01 (2006-03-09): Flight version, read unique YODA file. Many capabilities disabled at the moment (reads only LEVEL0 data).
31 //
32 // 0.00 - 1.00 (2006-03-09): Clone of EventViewer.c v9r01.
33 //
34 #include <math.h>
35 #include <stdio.h>
36 //
37 #include <iostream>
38 #include <iomanip>
39 #include <fstream>
40 //#include <sstream>
41 #if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
42 char* operator+( std::streampos&, char* );
43 #endif
44 //
45 #include <TObjectTable.h>
46 #include <TGClient.h>
47 #include <TGButton.h>
48 #include <TGComboBox.h>
49 #include <TGLabel.h>
50 #include <TGTextEntry.h>
51 #include <TGFrame.h>
52 #include <TGButtonGroup.h>
53 #include <TGProgressBar.h>
54 #include <TGMsgBox.h>
55 #include <TGComboBox.h>
56 //
57 #include <TTree.h>
58 #include <TClassEdit.h>
59 #include <TObject.h>
60 #include <TList.h>
61 #include <TSystem.h>
62 #include <TSystemDirectory.h>
63 #include <TString.h>
64 #include <TFile.h>
65 #include <TClass.h>
66 #include <TCanvas.h>
67 #include <TH1.h>
68 #include <TH1F.h>
69 #include <TH2D.h>
70 #include <TLatex.h>
71 #include <TPad.h>
72 #include <TPaveLabel.h>
73 #include <TLine.h>
74 #include <TPolyLine.h>
75 #include <TChain.h>
76 #include <TApplication.h>
77 #include <TVirtualX.h>
78 #include <TGClient.h>
79 #include <TGWindow.h>
80 #include <TEllipse.h>
81 #include <TArrow.h>
82 #include <TStyle.h>
83 //
84 //#include <trklev1struct.h>
85 //
86 #include <PamelaRun.h>
87 #include <physics/calorimeter/CalorimeterEvent.h>
88 #include <physics/trigger/TriggerEvent.h>
89 #include <physics/tof/TofEvent.h>
90 #include <physics/tracker/TrackerEvent.h>
91 #include <physics/anticounter/AnticounterEvent.h>
92 #include <physics/neutronDetector/NeutronEvent.h>
93 #include <physics/S4/S4Event.h>
94 #include <CalibCalPedEvent.h>
95 #include <CalibTrk1Event.h>
96 #include <CalibTrk2Event.h>
97 //#include <caloclasses.h>
98 extern void stringcopy(TString&, const TString&, Int_t, Int_t);
99 extern void stringappend(TString&, const TString&);
100 extern const char *pathtocalibration();
101 // extern void creadB(const char []);
102 // extern void projectlev1(Trklev1 &);
103 // extern void ctrack(int, Double_t [], Double_t [], Double_t [], Double_t [], int &);
104 // //
105 // //
106 // #include <CaloFunctions.h>
107 #include <FEVpamevcontrolfun.h>
108 //
109 // #include <ctrkstruct.h>
110 // #include <ctrkinclude.h>
111 // #include <ctofstruct.h>
112 // #include <ctofinclude.h>
113 // #include <aclev1class.h>
114 //
115
116 using namespace std;
117
118
119 Bool_t existfile(TString filename){
120 ifstream myfile;
121 myfile.open(filename.Data());
122 if ( !myfile ){
123 // printf("\n\nERROR: not able to open file: %s \n",filename.Data());
124 return(false);
125 };
126 myfile.close();
127 return(true);
128 }
129
130
131 TString getFilename(const TString filename){
132 const string fil = (const char*)filename;
133 Int_t posiz = fil.find("dw_");
134 if ( posiz == -1 ) posiz = fil.find("DW_");
135 if ( posiz == -1 ) return 0;
136 Int_t posiz2 = posiz+13;
137 TString file2;
138 stringcopy(file2,filename,posiz,posiz2);
139 TString pdat(".dat");
140 stringappend(file2,pdat);
141 return file2;
142 }
143
144 void ColorMIP(Float_t mip, int& colo){
145 // printf("mip = %f \n",mip);
146 if ( colo > 0 ){
147 colo = 10;
148 if ( mip > 0.7 ) colo = 38;
149 if ( mip > 2. ) colo = 4;
150 if ( mip > 10. ) colo = 3;
151 if ( mip > 100. ) colo = 2;
152 if ( mip > 500. ) colo = 6;
153 } else {
154 colo = 10;
155 if ( mip > 0.7 ) colo = 17;
156 if ( mip > 2. ) colo = 15;
157 if ( mip > 10. ) colo = 14;
158 if ( mip > 100. ) colo = 13;
159 if ( mip > 500. ) colo = 12;
160 };
161 }
162
163 void ColorTOFMIP(Float_t mip, int& colo){
164 // printf("mip = %f \n",mip);
165 if ( colo > 0 ){
166 colo = 10;
167 if ( mip > 0. ) colo = 38;
168 if ( mip > 2. ) colo = 4;
169 if ( mip > 10. ) colo = 3;
170 if ( mip > 100. ) colo = 2;
171 if ( mip > 500. ) colo = 6;
172 } else {
173 colo = 10;
174 if ( mip > 0. ) colo = 17;
175 if ( mip > 2. ) colo = 15;
176 if ( mip > 10. ) colo = 14;
177 if ( mip > 100. ) colo = 13;
178 if ( mip > 500. ) colo = 12;
179 };
180 }
181
182 typedef struct Evento {
183 Int_t iev;
184 Int_t stwerr[4];
185 Float_t emin;
186 Float_t perror[4];
187 Float_t dexy[2][22][96];
188 Float_t dexyc[2][22][96];
189 Double_t base[2][22][6];
190 Float_t calselftrig[4][7];
191 Float_t calIItrig[4];
192 Float_t calstriphit[4];
193 Float_t calDSPtaberr[4];
194 Float_t calevnum[4];
195 Float_t shift;
196 } evento;
197
198 typedef struct Calib {
199 TString tablename;
200 TString basepath;
201 TString yodalev;
202 char *db;
203 Int_t DW;
204 Int_t mysql;
205 Int_t obtjump;
206 Int_t time[4][51];
207 Int_t ttime[4][51];
208 Int_t fcode[4][51];
209 Int_t iev;
210 Int_t cstwerr[4];
211 Float_t ispaw;
212 Float_t cperror[4];
213 Float_t mip[2][22][96];
214 Float_t calped[2][22][96];
215 Float_t calgood[2][22][96];
216 Float_t calthr[2][22][6];
217 Float_t calrms[2][22][96];
218 Float_t calbase[2][22][6];
219 Float_t calvar[2][22][6];
220 Float_t calpuls[2][22][96];
221 Double_t sbase[2][22][6];
222 Double_t al_p[5][2];
223 Int_t trkchi2;
224 Bool_t good2;
225 } calib;
226
227
228 int CaloPede(TString filename, Int_t s, Int_t atime, Calib & calib){
229 if ( !existfile(filename) ) return(3);
230 //
231 TFile *File = new TFile(filename.Data());
232 TTree *tr = (TTree*)File->Get("CalibCalPed");
233 //
234 pamela::CalibCalPedEvent *ce = 0;
235 pamela::PscuHeader *cph = 0;
236 pamela::EventHeader *ceh = 0;
237 tr->SetBranchAddress("Header", &ceh);
238 tr->SetBranchAddress("CalibCalPed", &ce);
239 //
240 Long64_t ncalibs = tr->GetEntries();
241 for (Int_t ci = 0; ci < ncalibs ; ci++){
242 tr->GetEntry(ci);
243 cph = ceh->GetPscuHeader();
244 if ( atime == cph->GetOrbitalTime()){
245 calib.iev = ce->iev;
246 if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
247 for ( Int_t d=0 ; d<11 ;d++ ){
248 Int_t pre = -1;
249 for ( Int_t j=0; j<96 ;j++){
250 if ( j%16 == 0 ) pre++;
251 if ( s == 2 ){
252 calib.calped[0][2*d+1][j] = ce->calped[3][d][j];
253 calib.cstwerr[3] = ce->cstwerr[3];
254 calib.cperror[3] = ce->cperror[3];
255 calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j];
256 calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre];
257 calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j];
258 calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre];
259 calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre];
260 };
261 if ( s == 3 ){
262 calib.calped[0][2*d][j] = ce->calped[1][d][j];
263 calib.cstwerr[1] = ce->cstwerr[1];
264 calib.cperror[1] = ce->cperror[1];
265 calib.calgood[0][2*d][j] = ce->calgood[1][d][j];
266 calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre];
267 calib.calrms[0][2*d][j] = ce->calrms[1][d][j];
268 calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre];
269 calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre];
270 };
271 if ( s == 0 ){
272 calib.calped[1][2*d][j] = ce->calped[0][d][j];
273 calib.cstwerr[0] = ce->cstwerr[0];
274 calib.cperror[0] = ce->cperror[0];
275 calib.calgood[1][2*d][j] = ce->calgood[0][d][j];
276 calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre];
277 calib.calrms[1][2*d][j] = ce->calrms[0][d][j];
278 calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre];
279 calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre];
280 };
281 if ( s == 1 ){
282 calib.calped[1][2*d+1][j] = ce->calped[2][d][j];
283 calib.cstwerr[2] = ce->cstwerr[2];
284 calib.cperror[2] = ce->cperror[2];
285 calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j];
286 calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre];
287 calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j];
288 calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre];
289 calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre];
290 };
291 };
292 };
293 };
294 };
295 };
296 tr->Delete();
297 return(0);
298 }
299
300 void CaloFindBaseRaw(Calib & calib, Evento & evento, Int_t l, Int_t m, Int_t pre){
301 Float_t minstrip = 100000.;
302 Float_t rms = 0.;
303 evento.base[l][m][pre] = 0.;
304 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
305 if ( calib.calgood[l][m][e] == 0. && evento.dexy[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexy[l][m][e] > 0.) {
306 minstrip = evento.dexy[l][m][e]-calib.calped[l][m][e];
307 rms = calib.calthr[l][m][pre];
308 };
309 };
310 if ( minstrip != 100000. ) {
311 Float_t strip6s = 0.;
312 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
313 if ( (evento.dexy[l][m][e]-calib.calped[l][m][e]) >= minstrip && (evento.dexy[l][m][e]-calib.calped[l][m][e]) <= (minstrip+rms) ) {
314 strip6s += 1.;
315 evento.base[l][m][pre] += (evento.dexy[l][m][e] - calib.calped[l][m][e]);
316 };
317 //
318 // compression
319 //
320 if ( abs((int)(evento.dexy[l][m][e]-calib.calped[l][m][e])) <= (minstrip+rms) ) {
321 evento.dexyc[l][m][e] = 0.;
322 } else {
323 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
324 };
325 };
326 if ( strip6s >= 9. ){
327 Double_t arro = evento.base[l][m][pre]/strip6s;
328 Float_t deci = 1000.*((float)arro - float(int(arro)));
329 if ( deci < 500. ) {
330 arro = double(int(arro));
331 } else {
332 arro = 1. + double(int(arro));
333 };
334 evento.base[l][m][pre] = arro;
335 } else {
336 evento.base[l][m][pre] = 31000.;
337 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
338 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
339 };
340 };
341 } else {
342 evento.base[l][m][pre] = 31000.;
343 };
344 }
345
346 void CaloCompressData(Calib & calib, Evento & evento, Int_t l, Int_t m, Int_t pre){
347 Float_t minstrip = 100000.;
348 Float_t rms = 0.;
349 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
350 if ( calib.calgood[l][m][e] == 0. && evento.dexyc[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexyc[l][m][e] > 0.) {
351 minstrip = evento.dexyc[l][m][e]-calib.calped[l][m][e];
352 rms = calib.calthr[l][m][pre];
353 };
354 };
355 //
356 // compression
357 //
358 if ( minstrip < evento.base[l][m][pre] && minstrip != 100000.){
359 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
360 if ( evento.dexyc[l][m][e]-calib.calped[l][m][e] <= (minstrip+rms) ) evento.dexyc[l][m][e] = 0.;
361 };
362 };
363 }
364
365 int OLDCaloFindCalibs(TString &filename, Calib & calib){
366 for (Int_t s = 0; s < 4; s++){
367 for (Int_t d = 1; d<50; d++){
368 calib.ttime[s][d] = 0;
369 if ( d < 49 ) calib.time[s][d] = 0;
370 };
371 };
372 if ( !existfile(filename) ) return(1);
373 //
374 TFile *File = new TFile(filename.Data());
375 TTree *tr = (TTree*)File->Get("CalibCalPed");
376 pamela::CalibCalPedEvent *ce = 0;
377 pamela::PscuHeader *cph = 0;
378 pamela::EventHeader *ceh = 0;
379 tr->SetBranchAddress("Header", &ceh);
380 tr->SetBranchAddress("CalibCalPed", &ce);
381 Long64_t ncalibs = tr->GetEntries();
382 Int_t inter;
383 for (Int_t s = 0; s < 4; s++){
384 for (Int_t d = 1; d<50; d++){
385 calib.ttime[s][d] = 0;
386 if ( d < 49 ) calib.time[s][d] = 0;
387 };
388 };
389 for (Int_t s = 0; s < 4; s++){
390 inter = 0;
391 for (Int_t c = 0; c < ncalibs; c++){
392 tr->GetEntry(c);
393 cph = ceh->GetPscuHeader();
394 calib.ttime[s][inter] = 0;
395 if ( ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
396 calib.ttime[s][inter] = cph->GetOrbitalTime();
397 inter++;
398 } else {
399 if ( ce->cstwerr[s] != 0 && ce->cperror[s] != 0 ) {
400 printf(" ERROR: entry %i stwerr %X perror %f \n",c,ce->cstwerr[s],ce->cperror[s]);
401 };
402 };
403 };
404 if ( inter == 0 ){
405 printf(" ERROR: no suitable calibration for section %i in this file!\n",s);
406 };
407 for (Int_t d = 1; d<50; d++){
408 if ( calib.ttime[s][d] != 0 ) {
409 calib.time[s][d-1] = calib.ttime[s][d-1] + (int)((calib.ttime[s][d] - calib.ttime[s][d-1])/2.);
410 } else {
411 if ( d == 1 ) {
412 calib.time[s][d-1] = 0;
413 };
414 };
415 };
416 };
417 File->Close();
418 return(0);
419 }
420
421 void Calo1stcalib(TString filename, Calib & calib, Int_t b[4]){
422 Float_t estrip[2][22][96];
423 //
424 // this is the value of the mip for each strip. To be changed when we will have the real values
425 //
426 for (Int_t s=0; s<4;s++){
427 for (Int_t d = 0; d<50; d++){
428 calib.ttime[s][d] = 0 ;
429 if ( d < 49 ) calib.time[s][d] = 0 ;
430 };
431 };
432 for (Int_t m = 0; m < 2 ; m++ ){
433 for (Int_t k = 0; k < 22; k++ ){
434 for (Int_t l = 0; l < 96; l++ ){
435 calib.calped[m][k][l] = 0. ;
436 estrip[m][k][l] = 0.;
437 };
438 };
439 }
440 //
441 // first of all find the calibrations in the file
442 //
443 OLDCaloFindCalibs(filename, calib);
444 //
445 // print on the screen the results:
446 //
447 printf(" ---------------------------------------------------------- \n \n");
448 Int_t calibex = 0;
449 for (Int_t s=0; s<4;s++){
450 Int_t stop = 0;
451 for (Int_t d = 0; d<48; d++){
452 if ( calib.ttime[s][d] != 0 ) calibex++;
453 if ( calib.time[s][0] != 0 ){
454 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]);
455 if ( calib.time[s][d+1] != 0 ) {
456 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]);
457 } else {
458 if ( !stop ){
459 printf(" Section %i from time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d+1]);
460 stop = 1;
461 };
462 };
463 } else {
464 if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %i \n",s,calib.ttime[s][d]);
465 };
466 };
467 printf("\n");
468 };
469 printf(" ---------------------------------------------------------- \n");
470 if ( calibex < 1 ) {
471 printf("No full calibration data in this file, sorry!\n");
472 } else {
473 //
474 // calibrate before starting
475 //
476 for (Int_t s = 0; s < 4; s++){
477 b[s]=0;
478 CaloPede(filename,s,calib.ttime[s][b[s]],calib);
479 };
480 };
481 }
482
483 //**********************************************************************************
484 // LEVEL0 SUBROUTINES //
485 //**********************************************************************************
486
487 void ShowCaloRAW(Int_t i, TTree *otr, Variables & var){
488
489 pamela::calorimeter::CalorimeterEvent *de = 0;
490 otr->SetBranchAddress("Calorimeter", &de);
491 if ( !var.nosig ) otr->GetEntry(i);
492
493 //
494 // Book the histograms:
495 //
496 //
497 stringstream delex;
498 delex.str("");
499 delex << "x-view event " << (i+1);
500 stringstream deley;
501 deley.str("");
502 deley << "y-view event " << (i+1);
503 gDirectory->Delete(delex.str().c_str());
504 gDirectory->Delete(deley.str().c_str());
505 TH2F *Xview = new TH2F(delex.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
506 TH2F *Yview = new TH2F(deley.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
507 Xview->GetYaxis()->SetLabelColor(10);
508 Yview->GetYaxis()->SetLabelColor(10);
509 //
510 // figures:
511 //
512 Int_t bgcolor = 10;
513 TPad *pd1 = new TPad("calox","This is pad1",var.xxvc-0.154*var.sfx,var.yxvc-0.3645*var.sfy,var.xxvc+0.154*var.sfx,var.yxvc-0.1200*var.sfy,bgcolor);
514 TPad *pd2 = new TPad("caloy","This is pad2",var.xyvc-0.154*var.sfx,var.yyvc-0.3645*var.sfy,var.xyvc+0.154*var.sfx,var.yyvc-0.1200*var.sfy,bgcolor);
515
516 pd1->SetFillStyle(4000);
517 pd1->SetFillColor(0);
518 pd1->SetFrameFillStyle(4000);
519 pd2->SetFillStyle(4000);
520 pd2->SetFillColor(0);
521 pd2->SetFrameFillStyle(4000);
522
523 TLatex *t=new TLatex();
524 t->SetTextFont(32);
525 t->SetTextColor(1);
526 t->SetTextSize(0.03);
527 t->SetTextAlign(12);
528 pd1->Range(0.,0.,1.,1.);
529 pd2->Range(0.,0.,1.,1.);
530 pd1->SetTicks();
531 pd2->SetTicks();
532 pd1->Draw();
533 pd2->Draw();
534
535 pd1->cd();
536 gStyle->SetOptStat(0);
537 Xview->GetYaxis()->SetTitleOffset(0.5);
538 Xview->SetFillColor(bgcolor);
539 Xview->Fill(1.,1.,1.);
540 Xview->Draw("box");
541 pd1->Update();
542 pd2->cd();
543 gStyle->SetOptStat(0);
544 Yview->GetYaxis()->SetTitleOffset(0.5);
545 Yview->SetFillColor(bgcolor);
546 Yview->Fill(1.,1.,1.);
547 Yview->Draw("box");
548 pd2->Update();
549
550 //
551 // run over views and planes
552 //
553 stringstream xevent;
554 stringstream yevent;
555 for (Int_t m = 0; m < 22; m++){
556 for (Int_t l = 0; l < 2; l++){
557 //
558 // determine the section number
559 //
560 Int_t se = 5;
561 if ( !l && m%2 == 0 ){
562 se = 3;
563 };
564 if ( !l && m%2 != 0 ){
565 se = 2;
566 };
567 if ( l && m%2 == 0 ){
568 se = 1;
569 };
570 if ( l && m%2 != 0 ){
571 se = 0;
572 };
573 //
574 // determine what kind of event we are going to analyze
575 //
576 bool isCOMP = 0;
577 bool isFULL = 0;
578 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
579 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
580 //
581 // run over strips
582 //
583 if ( isCOMP || isFULL ) {
584 for (Int_t n = 0; n < 96; n++){
585 if ( de->dexyc[l][m][n] > 0. && !var.nosig ){
586 xevent.str("");
587 yevent.str("");
588 xevent << "x-view event " << n;
589 xevent << " " << m;
590 xevent << " " << l;
591 yevent << "y-view event " << n;
592 yevent << " " << m;
593 yevent << " " << l;
594 gDirectory->Delete(xevent.str().c_str());
595 gDirectory->Delete(yevent.str().c_str());
596 TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
597 TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
598 Int_t colo;
599 if ( var.bw ){
600 colo = 17;
601 } else {
602 colo = 38;
603 };
604 Xview->SetFillColor(colo);
605 Yview->SetFillColor(colo);
606 if ( l == 0 ) {
607 Xview->Fill(n,21-m,1.);
608 pd1->cd();
609 Xview->Draw("box same");
610 };
611 if ( l == 1 ) {
612 Yview->Fill(95-n,21-m,1.);
613 pd2->cd();
614 Yview->Draw("box same");
615 };
616 };
617 };
618 };
619 };
620 };
621 pd1->Update();
622 pd2->Update();
623 var.qtot=0;
624 var.nstrip=0;
625 }
626
627 void ShowND(Int_t evno, TTree *otr, Variables & var){
628 Int_t tmpSize;
629 Int_t yUpperTrig = 0;
630 Int_t yUpperBk = 0;
631 Int_t yBottomBk = 0;
632 pamela::neutron::NeutronEvent *ne = 0;
633 pamela::neutron::NeutronRecord *nr = 0;
634 otr->SetBranchAddress("Neutron", &ne);
635 //
636 if ( !var.nosig ) otr->GetEntry(evno);
637 //
638 tmpSize = ne->Records->GetEntries();
639 for (Int_t j = 0; j < tmpSize; j++){
640 nr = (pamela::neutron::NeutronRecord*)ne->Records->At(j);
641 yUpperTrig += (int)nr->trigPhysics;
642 yUpperBk += (int)nr->upperBack;
643 yBottomBk += (int)nr->bottomBack;
644 }
645
646 var.trup = yUpperTrig;
647 var.bkup = yUpperBk;
648 var.bkbo = yBottomBk;
649
650 if ( var.nosig ){
651 yUpperTrig = 0;
652 yUpperBk = 0;
653 yBottomBk = 0;
654 }
655 Int_t ucolo = 10;
656 if ( var.bw ){
657 if ( yUpperTrig == 1 ){
658 ucolo = 17;
659 }
660 if ( yUpperTrig == 2 ){
661 ucolo = 15;
662 }
663 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
664 ucolo = 14;
665 }
666 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
667 ucolo = 13;
668 }
669 if ( yUpperTrig >= 14 ){
670 ucolo = 12;
671 };
672 } else {
673 if ( yUpperTrig == 1 ){
674 ucolo = 38;
675 }
676 if ( yUpperTrig == 2 ){
677 ucolo = 4;
678 }
679 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
680 ucolo = 3;
681 }
682 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
683 ucolo = 2;
684 }
685 if ( yUpperTrig >= 14 ){
686 ucolo = 6;
687 };
688 };
689 //
690 // figures:
691 //
692 if ( true ){
693 Float_t xc1[5]={ -0.300, 0.300, 0.300, -0.300, -0.300 };
694 Float_t yc1[5]={ -0.47-0.04, -0.47-0.04, -0.47+2.*0.075-0.04, -0.47+2.*0.075-0.04, -0.47-0.04};
695 //
696 // Upper X-view
697 //
698 Float_t xc[5];
699 Float_t yc[5];
700 for (Int_t i = 0; i<5 ; i++) {
701 xc[i]= var.xxvc + xc1[i]*var.nds4;
702 yc[i] = var.yxvc + yc1[i]*var.sfy;
703 };
704 TPolyLine *fnd2x = new TPolyLine(5,xc,yc);
705 fnd2x->SetLineColor(1);
706 fnd2x->SetFillColor(ucolo);
707 fnd2x->SetLineWidth(1);
708 fnd2x->Draw("f");
709 fnd2x->Draw();
710 };
711 if ( true ){
712 Float_t xc1[5]={ -0.275, 0.275, 0.275, -0.275, -0.275 };
713 Float_t yc1[5]={ -0.47-0.04-0.075, -0.47-0.04-0.075, -0.47+0.075-0.04, -0.47+0.075-0.04, -0.47-0.04-0.075};
714 //
715 // Upper Y-view
716 //
717 Float_t xc[5];
718 Float_t yc[5];
719 for (Int_t i = 0; i<5 ; i++) {
720 xc[i]= var.xyvc + xc1[i]*var.nds4;
721 yc[i] = var.yyvc + (yc1[i]+0.075)*var.sfy;
722 };
723 TPolyLine *fnd2y = new TPolyLine(5,xc,yc);
724 fnd2y->SetLineColor(1);
725 fnd2y->SetFillColor(ucolo);
726 fnd2y->SetLineWidth(1);
727 fnd2y->Draw("f");
728 fnd2y->Draw();
729 };
730 }
731
732 void ShowTRKL0(Int_t evno, TTree *otr, Variables & var){
733 //
734 pamela::tracker::TrackerEvent *trk = 0;
735 otr->SetBranchAddress("Tracker", &trk);
736 if ( !var.nosig ) otr->GetEntry(evno);
737 //
738 // a matrix of pads for each view x and y
739 //
740 TPad *trkpad[12];
741 for (Int_t n = 0; n<12; n++){
742 stringstream spd;
743 spd.str("");
744 spd << "pd1" << n;
745 gDirectory->Delete(spd.str().c_str());
746 spd.str("");
747 spd << "pd2" << n;
748 gDirectory->Delete(spd.str().c_str());
749 spd.str("");
750 spd << "pd3" << n;
751 gDirectory->Delete(spd.str().c_str());
752 spd.str("");
753 spd << "pd4" << n;
754 gDirectory->Delete(spd.str().c_str());
755 spd.str("");
756 spd << "pd5" << n;
757 gDirectory->Delete(spd.str().c_str());
758 spd.str("");
759 spd << "pd6" << n;
760 gDirectory->Delete(spd.str().c_str());
761 spd.str("");
762 stringstream sbd;
763 sbd.str("");
764 Int_t magcol = 0;
765 TPad *mag1 = 0;
766 TPad *mag2 = 0;
767 if ( n%2 ) {
768 Float_t posx = var.xxvc;
769 Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
770 spd.str("");
771 sbd.str("");
772 spd << "pd1" << n;
773 sbd << "bd1" << n;
774 trkpad[n] = new TPad(spd.str().c_str(),sbd.str().c_str(),posx-0.081*var.sfx,posy,posx+0.081*var.sfx,posy+0.089*var.sfy,10);
775 trkpad[n]->SetFillStyle(4000);
776 trkpad[n]->SetFillColor(0);
777 trkpad[n]->SetFrameFillStyle(4000);
778 trkpad[n]->Draw();
779 if ( n != 1 ) {
780 if ( var.bw ) {
781 magcol = 1;
782 } else {
783 magcol = 45;
784 };
785 spd.str("");
786 sbd.str("");
787 spd << "pd2" << n;
788 sbd << "bd2" << n;
789 mag1 = new TPad(spd.str().c_str(),sbd.str().c_str(),posx-(0.039+0.081)*var.sfx,posy+0.004*var.sfy,posx-0.081*var.sfx,posy+0.088*var.sfy,magcol);
790 if ( var.bw ) mag1->SetFillStyle(3001);
791 mag1->Draw();
792 spd.str("");
793 sbd.str("");
794 spd << "pd3" << n;
795 sbd << "bd3" << n;
796 mag2 = new TPad(spd.str().c_str(),sbd.str().c_str(),posx+0.081*var.sfx,posy+0.004*var.sfy,posx+(0.081+0.039)*var.sfx,posy+0.088*var.sfy,magcol);
797 if ( var.bw ) mag2->SetFillStyle(3001);
798 mag2->Draw();
799 };
800 } else {
801 Float_t posx = var.xyvc;
802 Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
803 spd.str("");
804 sbd.str("");
805 spd << "pd4" << n;
806 sbd << "bd4" << n;
807 trkpad[n] = new TPad(spd.str().c_str(),sbd.str().c_str(),posx-0.07*var.sfx,posy,posx+0.07*var.sfx,posy+0.089*var.sfy,10);
808 trkpad[n]->SetFillStyle(4000);
809 trkpad[n]->SetFillColor(0);
810 trkpad[n]->SetFrameFillStyle(4000);
811 trkpad[n]->Draw();
812 if ( n != 0 ) {
813 if ( var.bw ) {
814 magcol = 1;
815 } else {
816 magcol = 45;
817 };
818 spd.str("");
819 sbd.str("");
820 spd << "pd5" << n;
821 sbd << "bd5" << n;
822 mag1 = new TPad(spd.str().c_str(),sbd.str().c_str(),posx-(0.048+0.066)*var.sfx,posy+0.004*var.sfy,posx-0.066*var.sfx,posy+0.088*var.sfy,magcol);
823 if ( var.bw ) mag1->SetFillStyle(3001);
824 mag1->Draw();
825 spd.str("");
826 sbd.str("");
827 spd << "pd6" << n;
828 sbd << "bd6" << n;
829 mag2 = new TPad(spd.str().c_str(),sbd.str().c_str(),posx+0.066*var.sfx,posy+0.004*var.sfy,posx+(0.066+0.048)*var.sfx,posy+0.088*var.sfy,magcol);
830 if ( var.bw ) mag2->SetFillStyle(3001);
831 mag2->Draw();
832 };
833 };
834 };
835 TPad *trplv;
836 gDirectory->Delete("trkplv");
837 trplv = new TPad("trkplv","trkplv",var.xcat-0.066*var.sfx,var.ycat-0.081*var.sfy,var.xcat+0.066*var.sfx,var.ycat+0.081*var.sfy,10);
838 trplv->SetFillStyle(4000);
839 trplv->SetFillColor(0);
840 trplv->SetFrameFillStyle(4000);
841 trplv->Draw();
842 //
843 Int_t sigcol1 = 17;
844 Int_t sigcol2 = 15;
845 Int_t linecol = 13;
846 if ( var.bw ) {
847 sigcol1 = 17;
848 sigcol2 = 15;
849 linecol = 13;
850 } else {
851 sigcol1 = 32;
852 sigcol2 = 38;
853 linecol = 42;
854 };
855 TLine *linea = 0;
856 TLine *linea1x = 0;
857 TLine *linea2x = 0;
858 TLine *linea1y = 0;
859 Float_t x = 0.;
860 for (Int_t l = 0; l<12; l++){
861 trkpad[l]->cd();
862 if ( l%2 ) {
863 trkpad[l]->Range(0.,0.,3100.,1.);
864 linea = new TLine(0.,0.01,3100.,0.01);
865 linea1x = new TLine(1033.,0.01,1033,0.030);
866 linea2x = new TLine(2066.,0.01,2066,0.030);
867 } else {
868 trkpad[l]->Range(0.,0.,2076.,1.);
869 linea = new TLine(0.,0.01,2076.,0.01);
870 linea1y = new TLine(1038.,0.01,1038,0.030);
871 };
872 linea->SetLineWidth(2);
873 linea->SetLineColor(linecol);
874 linea->Draw();
875 if ( l%2 ) {
876 linea1x->SetLineWidth(1);
877 linea1x->SetLineColor(1);
878 linea1x->Draw();
879 linea2x->SetLineWidth(1);
880 linea2x->SetLineColor(1);
881 linea2x->Draw();
882 } else {
883 linea1y->SetLineWidth(1);
884 linea1y->SetLineColor(1);
885 linea1y->Draw();
886 };
887 //
888 Int_t planeno = trk->DSPnumber[l]-1;
889 if ( planeno < 0 || planeno > 11 ) planeno = 0;
890 if ( planeno >= 0 && !var.nosig ) {
891 if ( (planeno+1)%2 ){
892 trkpad[planeno]->cd();
893 trkpad[planeno]->Range(0.,0.,2076.,1.);
894 for (Int_t m = 0; m<3; m++){
895 if ( trk->signcluster[l][m] != 0. ){
896 if ( planeno == 10 ) {
897 x = 1024 - trk->addrcluster[l][m];
898 } else {
899 x = trk->addrcluster[l][m];
900 };
901 linea = new TLine(14.+x,0.01,14.+x,0.3);
902 linea->SetLineWidth(2);
903 linea->SetLineColor(sigcol1);
904 linea->Draw();
905 x += 1024.;
906 linea = new TLine(14.+x,0.01,14.+x,0.3);
907 linea->SetLineWidth(2);
908 linea->SetLineColor(sigcol2);
909 linea->Draw();
910 var.ncly++;
911 };
912 };
913 } else {
914 trkpad[planeno]->cd();
915 trkpad[planeno]->Range(0.,0.,3100.,1.);
916 for (Int_t m = 0; m<3; m++){
917 if ( trk->signcluster[l][m] != 0. ){
918 x = trk->addrcluster[l][m] + 1024. * m;
919 linea = new TLine(14.+x,0.01,14.+x,0.3);
920 linea->SetLineWidth(2);
921 linea->SetLineColor(sigcol2);
922 linea->Draw();
923 var.nclx++;
924 };
925 };
926 };
927 };
928 };
929 //
930 // Show track in the plane view!
931 //
932 Float_t xh[6];
933 Float_t yh1[6];
934 Float_t yh2[6];
935 Float_t mag[6];
936 for (Int_t l = 0; l<6; l++ ){
937 xh[l] = 0.;
938 yh1[l] = 0.;
939 yh2[l] = 0.;
940 mag[l] = 0.;
941 };
942 Int_t ncro = 0;
943 //
944 for (Int_t l = 0; l<12; l++ ){
945 Float_t xsig = 0.;
946 Float_t ysig = 0.;
947 Int_t planeno = trk->DSPnumber[l]-1;
948 for (Int_t e = 0; e<12;e++){
949 Int_t planeno2 = trk->DSPnumber[e]-1;
950 if ( planeno == planeno2-1 ){
951 if ( planeno < 0 || planeno > 11 ) planeno = 0;
952 if ( planeno >= 0 && !var.nosig ) {
953 mag[ncro] = ((float)planeno+1.)/5.;
954 if ( (planeno+1)%2 ){
955 for (Int_t m = 0; m<3; m++){
956 if ( trk->signcluster[l][m] != 0. ){
957 if ( planeno == 10 ) {
958 x = 1024 - trk->addrcluster[l][m];
959 } else {
960 x = trk->addrcluster[l][m];
961 };
962 x += 1024.;
963 if ( trk->signcluster[l][m]> ysig ){
964 ysig = trk->signcluster[l][m];
965 yh1[ncro] = x-1024.;
966 yh2[ncro] = x;
967 };
968 };
969 };
970 for (Int_t m = 0; m<3; m++){
971 if ( trk->signcluster[e][m] != 0. ){
972 x = trk->addrcluster[e][m] + 1024. * m;
973 if ( trk->signcluster[e][m]> xsig && !( planeno == 0 && x > 2800) ){
974 xsig = trk->signcluster[e][m];
975 xh[ncro] = x;
976 };
977 };
978 };
979 } else {
980 for (Int_t m = 0; m<3; m++){
981 if ( trk->signcluster[l][m] != 0. ){
982 x = trk->addrcluster[l][m] + 1024. * m;
983 if ( trk->signcluster[l][m]> xsig && !( planeno == 0 && x > 2800) ){
984 xsig = trk->signcluster[l][m];
985 xh[ncro] = x;
986 };
987 };
988 };
989 if ( (planeno+1)%2 ){
990 for (Int_t m = 0; m<3; m++){
991 if ( trk->signcluster[e][m] != 0. ){
992 if ( planeno == 10 ) {
993 x = 1024 - trk->addrcluster[e][m];
994 } else {
995 x = trk->addrcluster[e][m];
996 };
997 x += 1024.;
998 if ( trk->signcluster[e][m]> ysig ){
999 ysig = trk->signcluster[e][m];
1000 yh1[ncro] = x-1024.;
1001 yh2[ncro] = x;
1002 };
1003 };
1004 };
1005 };
1006 };
1007 if ( ysig > 0. && xsig > 0. ) {
1008 ncro++;
1009 };
1010 };
1011 };
1012 };
1013 };
1014 //
1015 // Draw crosses
1016 //
1017 if ( ncro && var.AC ) {
1018 trplv->cd();
1019 trplv->Range(0.,0.,2076.,3100.);
1020 for ( Int_t i = 0; i<ncro; i++){
1021 //
1022 Float_t cdx = (55./mag[i])*var.sfx;
1023 Float_t cdy = (55./mag[i])*var.sfy;
1024 Float_t lwx = (1.9)*var.sfy;
1025 Float_t lwy = (1.9)*var.sfx;
1026 //
1027 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
1028 linea->SetLineWidth((int)lwx);
1029 linea->SetLineColor(sigcol1);
1030 linea->Draw();
1031 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
1032 linea->SetLineWidth((int)lwy);
1033 linea->SetLineColor(sigcol1);
1034 linea->Draw();
1035 //
1036 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
1037 linea->SetLineWidth((int)lwx);
1038 linea->SetLineColor(sigcol2);
1039 linea->Draw();
1040 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
1041 linea->SetLineWidth((int)lwy);
1042 linea->SetLineColor(sigcol2);
1043 linea->Draw();
1044 };
1045 };
1046 }
1047
1048 void ShowAC(Int_t i, TTree *otr, Variables & var, Int_t lev){
1049 //
1050 Int_t hitmapA = 0;
1051 Int_t hitmapB = 0;
1052 Int_t hitstatusA = 0;
1053 Int_t hitstatusB = 0;
1054 if ( lev == 0 ){
1055 pamela::anticounter::AnticounterEvent *ace = 0;
1056 otr->SetBranchAddress("Anticounter", &ace);
1057 if ( !var.nosig ) otr->GetEntry(i);
1058 hitmapA = ace->hitmap[0];
1059 hitmapB = ace->hitmap[1];
1060 if ( lev == 0 ){
1061 hitstatusA = 65535;
1062 hitstatusB = 65535;
1063 } else {
1064 hitstatusA = ace->status[0];
1065 hitstatusB = ace->status[1];
1066 };
1067 };
1068 // if ( lev == 1 ){
1069 // AnticounterLevel1 *ace1 = new AnticounterLevel1();
1070 // otr->SetBranchAddress("AcLevel1.Event", &ace1);
1071 // if ( !var.nosig ) otr->GetEntry(i);
1072 // hitmapA = ace1->hitmap[0];
1073 // hitmapB = ace1->hitmap[1];
1074 // if ( lev == 0 ){
1075 // hitstatusA = 65535;
1076 // hitstatusB = 65535;
1077 // } else {
1078 // hitstatusA = ace1->hitstatus[0];
1079 // hitstatusB = ace1->hitstatus[1];
1080 // };
1081 // };
1082 //
1083 if ( var.nosig ){
1084 hitmapA = 0;
1085 hitmapB = 0;
1086 hitstatusA = 0;
1087 hitstatusB = 0;
1088 };
1089 //
1090 Float_t cas1 = 0.;
1091 Float_t cas2 = 0.;
1092 Float_t cas3 = 0.;
1093 Float_t cas4 = 0.;
1094 Float_t cas1b = 0.;
1095 Float_t cas2b = 0.;
1096 Float_t cas3b = 0.;
1097 Float_t cas4b = 0.;
1098 //
1099 Float_t cat1 = 0.;
1100 Float_t cat2 = 0.;
1101 Float_t cat3 = 0.;
1102 Float_t cat4 = 0.;
1103 Float_t cat1b = 0.;
1104 Float_t cat2b = 0.;
1105 Float_t cat3b = 0.;
1106 Float_t cat4b = 0.;
1107 //
1108 Float_t card1 = 0.;
1109 Float_t card2 = 0.;
1110 Float_t card3 = 0.;
1111 Float_t card4 = 0.;
1112 Float_t card1b = 0.;
1113 Float_t card2b = 0.;
1114 Float_t card3b = 0.;
1115 Float_t card4b = 0.;
1116 //
1117 Float_t intime = -0.25;
1118 Float_t outtime = -0.375;
1119 if ( var.bw ){
1120 intime = -0.25;
1121 outtime = -0.375;
1122 } else {
1123 intime = 1.;
1124 outtime = -4.;
1125 };
1126 //
1127 // main board
1128 //
1129 if ( hitmapA & (1<<0) ) {
1130 card4 = intime;
1131 if ( !(hitstatusA & (1<<0)) ) card4 = outtime ;
1132 var.hcard++;
1133 }
1134 if ( hitmapA & (1<<1) ) {
1135 cat2 = intime;
1136 if ( !(hitstatusA & (1<<1)) ) cat2 = outtime ;
1137 var.hcat++;
1138 }
1139 if ( hitmapA & (1<<2) ) {
1140 cas1 = intime;
1141 if ( !(hitstatusA & (1<<2)) ) cas1 = outtime ;
1142 var.hcas++;
1143 }
1144 //
1145 if ( hitmapA & (1<<4) ) {
1146 card2 = intime;
1147 if ( !(hitstatusA & (1<<4)) ) card2 = outtime ;
1148 var.hcard++;
1149 }
1150 if ( hitmapA & (1<<5) ) {
1151 cat4 = intime;
1152 if ( !(hitstatusA & (1<<5)) ) cat4 = outtime ;
1153 var.hcat++;
1154 }
1155 if ( hitmapA & (1<<6) ) {
1156 cas4 = intime;
1157 if ( !(hitstatusA & (1<<6)) ) cas4 = outtime ;
1158 var.hcas++;
1159 }
1160 //
1161 if ( hitmapA & (1<<8) ) {
1162 card3 = intime;
1163 if ( !(hitstatusA & (1<<8)) ) card3 = outtime ;
1164 var.hcard++;
1165 }
1166 if ( hitmapA & (1<<9) ) {
1167 cat3 = intime;
1168 if ( !(hitstatusA & (1<<9)) ) cat3 = outtime ;
1169 var.hcat++;
1170 }
1171 if ( hitmapA & (1<<10) ) {
1172 cas3 = intime;
1173 if ( !(hitstatusA & (1<<10)) ) cas3 = outtime ;
1174 var.hcas++;
1175 }
1176 //
1177 if ( hitmapA & (1<<12) ) {
1178 card1 = intime;
1179 if ( !(hitstatusA & (1<<12)) ) card1 = outtime ;
1180 var.hcard++;
1181 }
1182 if ( hitmapA & (1<<13) ) {
1183 cat1 = intime;
1184 if ( !(hitstatusA & (1<<13)) ) cat1 = outtime ;
1185 var.hcat++;
1186 }
1187 if ( hitmapA & (1<<14) ) {
1188 cas2 = intime;
1189 if ( !(hitstatusA & (1<<14)) ) cas2 = outtime ;
1190 var.hcas++;
1191 }
1192
1193 //
1194 // extra board
1195 //
1196 if ( hitmapB & (1<<0) ) {
1197 card4b = intime;
1198 if ( !(hitstatusB & (1<<0)) ) card4b = outtime ;
1199 var.hcard++;
1200 }
1201 if ( hitmapB & (1<<1) ) {
1202 cat2b = intime;
1203 if ( !(hitstatusB & (1<<1)) ) cat2b = outtime ;
1204 var.hcat++;
1205 }
1206 if ( hitmapB & (1<<2) ) {
1207 cas1b = intime;
1208 if ( !(hitstatusB & (1<<2)) ) cas1b = outtime;
1209 var.hcas++;
1210 }
1211 //
1212 if ( hitmapB & (1<<4) ) {
1213 card2b = intime;
1214 if ( !(hitstatusB & (1<<4)) ) card2b = outtime ;
1215 var.hcard++;
1216 }
1217 if ( hitmapB & (1<<5) ) {
1218 cat4b = intime;
1219 if ( !(hitstatusB & (1<<5)) ) cat4b = outtime ;
1220 var.hcat++;
1221 }
1222 if ( hitmapB & (1<<6) ) {
1223 cas4b = intime;
1224 if ( !(hitstatusB & (1<<6)) ) cas4b = outtime ;
1225 var.hcas++;
1226 }
1227 //
1228 if ( hitmapB & (1<<8) ) {
1229 card3b = intime;
1230 if ( !(hitstatusB & (1<<8)) ) card3b = outtime ;
1231 var.hcard++;
1232 }
1233 if ( hitmapB & (1<<9) ) {
1234 cat3b = intime;
1235 if ( !(hitstatusB & (1<<9)) ) cat3b = outtime ;
1236 var.hcat++;
1237 }
1238 if ( hitmapB & (1<<10) ) {
1239 cas3b = intime;
1240 if ( !(hitstatusB & (1<<10)) ) cas3b = outtime ;
1241 var.hcas++;
1242 }
1243 //
1244 if ( hitmapB & (1<<12) ) {
1245 card1b = intime;
1246 if ( !(hitstatusB & (1<<12)) ) card1b = outtime ;
1247 var.hcard++;
1248 }
1249 if ( hitmapB & (1<<13) ) {
1250 cat1b = intime;
1251 if ( !(hitstatusB & (1<<13)) ) cat1b = outtime ;
1252 var.hcat++;
1253 }
1254 if ( hitmapB & (1<<14) ) {
1255 cas2b = intime;
1256 if ( !(hitstatusB & (1<<14)) ) cas2b = outtime ;
1257 var.hcas++;
1258 };
1259 Int_t colo = 0;
1260 //
1261 // CAS height and width
1262 //
1263 Float_t csh = 0.194*var.sfy;
1264 Float_t csw = 0.008*var.sfx;
1265 Float_t ctw = 0.008;
1266
1267 //
1268 // CAS2 -0.039-0.081 |TRX TRY
1269 //
1270 if ( true ){
1271 Float_t xofs = var.xxvc -(0.039+0.081+0.0273)*var.sfx;
1272 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1273 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1274 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
1275 TPolyLine *fcas2 = new TPolyLine(4,x,y);
1276 fcas2->SetLineColor(1);
1277 colo = (int)(10. - cas2 * 8.);
1278 fcas2->SetFillColor(colo);
1279 fcas2->SetLineWidth(1);
1280 fcas2->Draw("f");
1281 fcas2->Draw();
1282 };
1283 if ( true ){
1284 Float_t xofs = var.xxvc -(0.039 +0.081 +0.0273)*var.sfx;
1285 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1286 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1287 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
1288 TPolyLine *fcas2b = new TPolyLine(4,x,y);
1289 fcas2b->SetLineColor(1);
1290 colo = (int)(10. - cas2b * 8.);
1291 fcas2b->SetFillColor(colo);
1292 fcas2b->SetLineWidth(1);
1293 fcas2b->Draw("f");
1294 fcas2b->Draw();
1295 };
1296 //
1297 // CAS1 -0.039+0.081 TRX| TRY
1298 //
1299 if ( true ){
1300 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
1301 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1302 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1303 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
1304 TPolyLine *fcas1 = new TPolyLine(4,x,y);
1305 fcas1->SetLineColor(1);
1306 colo = (int)(10. - cas1 * 8.);
1307 fcas1->SetFillColor(colo);
1308 fcas1->SetLineWidth(1);
1309 fcas1->Draw("f");
1310 fcas1->Draw();
1311 };
1312 if ( true ){
1313 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
1314 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1315 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1316 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
1317 TPolyLine *fcas1b = new TPolyLine(4,x,y);
1318 fcas1b->SetLineColor(1);
1319 colo = (int)(10. - cas1b * 8.);
1320 fcas1b->SetFillColor(colo);
1321 fcas1b->SetLineWidth(1);
1322 fcas1b->Draw("f");
1323 fcas1b->Draw();
1324 };
1325 //
1326 // CAS4 -0.039-0.081 TRX |TRY
1327 //
1328 if ( true ){
1329 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
1330 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1331 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1332 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
1333 TPolyLine *fcas4 = new TPolyLine(4,x,y);
1334 fcas4->SetLineColor(1);
1335 colo = (int)(10. - cas4 * 8.);
1336 fcas4->SetFillColor(colo);
1337 fcas4->SetLineWidth(1);
1338 fcas4->Draw("f");
1339 fcas4->Draw();
1340 };
1341 if ( true ){
1342 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
1343 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1344 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1345 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
1346 TPolyLine *fcas4b = new TPolyLine(4,x,y);
1347 fcas4b->SetLineColor(1);
1348 colo = (int)(10. - cas4b * 8.);
1349 fcas4b->SetFillColor(colo);
1350 fcas4b->SetLineWidth(1);
1351 fcas4b->Draw("f");
1352 fcas4b->Draw();
1353 };
1354
1355 //
1356 // CAS3 -0.039+0.081 TRX TRY|
1357 //
1358 if ( true ){
1359 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
1360 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1361 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1362 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
1363 TPolyLine *fcas3 = new TPolyLine(4,x,y);
1364 fcas3->SetLineColor(1);
1365 colo = (int)(10. - cas3 * 8.);
1366 fcas3->SetFillColor(colo);
1367 fcas3->SetLineWidth(1);
1368 fcas3->Draw("f");
1369 fcas3->Draw();
1370 };
1371 if ( true ){
1372 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
1373 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1374 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1375 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
1376 TPolyLine *fcas3b = new TPolyLine(4,x,y);
1377 fcas3b->SetLineColor(1);
1378 colo = (int)(10. - cas3b * 8.);
1379 fcas3b->SetFillColor(colo);
1380 fcas3b->SetLineWidth(1);
1381 fcas3b->Draw("f");
1382 fcas3b->Draw();
1383 };
1384
1385 //
1386 // CAT coordinate system
1387 //
1388 Float_t xcat = var.xcat;
1389 Float_t ycat = var.ycat;
1390 Float_t pmt1 = 0.0356;
1391 Float_t pmt2 = 0.038;
1392 Float_t xpmt1 = -0.149*var.sfx;
1393 Float_t ypmt1 = 0.251*var.sfy;
1394 Float_t apmt1 = atan((11.*var.sfy)/(14.*var.sfx));
1395 Float_t xpmt2 = -0.257*var.sfx;
1396 Float_t ypmt2 = 0.158*var.sfy;
1397 Float_t apmt2 = atan((11.*var.sfx)/(15.*var.sfy));
1398 //
1399 Int_t cattime = 13;
1400 Int_t catnoti = 12;
1401 if ( var.bw ){
1402 cattime = 13;
1403 catnoti = 12;
1404 } else {
1405 cattime = 2;
1406 catnoti = 42;
1407 };
1408 //
1409 if ( true ){
1410 // PMTs
1411 Float_t xc1[5]={ 0., 0.014*var.sfx, 0.014*var.sfx-var.sfx*var.sfx*pmt1*cos(apmt1), -var.sfx*var.sfx*pmt1*cos(apmt1), 0.};
1412 Float_t yc1[5]={ 0., 0.011*var.sfy, 0.011*var.sfy+var.sfy*var.sfy*pmt1*sin(apmt1), var.sfy*var.sfy*pmt1*sin(apmt1), 0.};
1413 Float_t xc2[5]={ 0., 0.011*var.sfx, 0.011*var.sfx-pmt2*var.sfx*var.sfx*cos(apmt2), -pmt2*var.sfx*var.sfx*cos(apmt2), 0.};
1414 Float_t yc2[5]={ 0., 0.015*var.sfy, 0.015*var.sfy+var.sfy*pmt2*var.sfy*sin(apmt2), var.sfy*pmt2*var.sfy*sin(apmt2), 0.};
1415 // SCINTs
1416 Float_t xcc1[10]={-0.149, -0.090165, -0.090165, -0.149, -0.242, -0.257, -0.212, -0.257, -0.242, -0.149};
1417 Float_t ycc1[10]={ 0.169, 0.108165, -0.108165, -0.169, -0.169, -0.158, 0., 0.158, 0.169, 0.169};
1418 Float_t xcc2[10]={-0.149, -0.149, -0.138, 0., 0.138, 0.149, 0.149, 0.090165, -0.090165, -0.149};
1419 Float_t ycc2[10]={ 0.169, 0.251, 0.265, 0.220, 0.265, 0.251, 0.169, 0.108165, 0.108165, 0.169};
1420 //
1421 // CAT sections
1422 //
1423 if ( true ){
1424 Float_t xofs = var.xxvc -0.108165*var.sfx;
1425 Float_t yofs = var.yxvc + 0.3725*var.sfy ;
1426 Double_t xx[5] = {xofs,xofs-0.112*var.sfx,xofs-0.112*var.sfx,xofs,xofs};
1427 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
1428 TPolyLine *fcat3 = new TPolyLine(5,xx,yy);
1429 fcat3->SetLineColor(1);
1430 if ( cat3 != 0. || cat3b != 0. ){
1431 if ( cat3 > 0 || cat3b > 0 || cat3 == -0.25 || cat3b == -0.25 ){
1432 colo = cattime;
1433 } else {
1434 colo = catnoti;
1435 };
1436 } else {
1437 colo = 10;
1438 };
1439 fcat3->SetFillColor(colo);
1440 fcat3->SetLineWidth(1);
1441 fcat3->Draw("f");
1442 fcat3->Draw();
1443 };
1444 if ( true ){
1445 Float_t xofs = var.xxvc +0.108165*var.sfx;
1446 Float_t yofs = var.yxvc + 0.3725 *var.sfy;
1447 Double_t xx[5] = {xofs,xofs+0.112*var.sfx,xofs+0.112*var.sfx,xofs,xofs};
1448 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
1449 TPolyLine *fcat4 = new TPolyLine(5,xx,yy);
1450 fcat4->SetLineColor(1);
1451 if ( cat4 != 0. || cat4b != 0. ){
1452 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b == -.25 ){
1453 colo = cattime;
1454 } else {
1455 colo = catnoti;
1456 };
1457 } else {
1458 colo = 10;
1459 };
1460 fcat4->SetFillColor(colo);
1461 fcat4->SetLineWidth(1);
1462 fcat4->Draw("f");
1463 fcat4->Draw();
1464 };
1465 if ( true ){
1466 Float_t xofs = var.xyvc + 0.090165*var.sfx;
1467 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
1468 Double_t xx[5] = {xofs,xofs+0.122*var.sfx,xofs+0.122*var.sfx,xofs,xofs};
1469 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
1470 TPolyLine *fcat1 = new TPolyLine(5,xx,yy);
1471 fcat1->SetLineColor(1);
1472 if ( cat1 != 0. || cat1b != 0. ){
1473 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
1474 colo = cattime;
1475 } else {
1476 colo = catnoti;
1477 };
1478 } else {
1479 colo = 10;
1480 };
1481 fcat1->SetFillColor(colo);
1482 fcat1->SetLineWidth(1);
1483 fcat1->Draw("f");
1484 fcat1->Draw();
1485 };
1486 if ( true ){
1487 Float_t xofs = var.xyvc - 0.090165*var.sfx;
1488 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
1489 Double_t xx[5] = {xofs,xofs-0.122*var.sfx,xofs-0.122*var.sfx,xofs,xofs};
1490 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
1491 TPolyLine *fcat2 = new TPolyLine(5,xx,yy);
1492 fcat2->SetLineColor(1);
1493 if ( cat2 != 0. || cat2b != 0. ){
1494 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
1495 colo = cattime;
1496 } else {
1497 colo = catnoti;
1498 };
1499 } else {
1500 colo = 10;
1501 };
1502 fcat2->SetFillColor(colo);
1503 fcat2->SetLineWidth(1);
1504 fcat2->Draw("f");
1505 fcat2->Draw();
1506 };
1507 //
1508 // CAT1
1509 //
1510 Float_t xcc[10];
1511 Float_t ycc[10];
1512 if ( true ){
1513 for (Int_t i = 0; i<10 ; i++) {
1514 xcc[i]= xcat - xcc1[i]*var.sfx;
1515 ycc[i] = ycat + ycc1[i]*var.sfy;
1516 };
1517 TPolyLine *fcat1 = new TPolyLine(10,xcc,ycc);
1518 fcat1->SetLineColor(1);
1519 colo = 10;
1520 if ( cat1 != 0. || cat1b != 0. ) {
1521 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
1522 colo = cattime;
1523 } else {
1524 colo = catnoti;
1525 };
1526 };
1527 fcat1->SetFillColor(colo);
1528 fcat1->SetLineWidth(1);
1529 fcat1->Draw("f");
1530 fcat1->Draw();
1531 };
1532 //
1533 // CAT2
1534 //
1535 if ( true ){
1536 for (Int_t i = 0; i<10 ; i++) {
1537 xcc[i]= xcat + xcc1[i]*var.sfx;
1538 ycc[i] = ycat + ycc1[i]*var.sfy;
1539 };
1540 TPolyLine *fcat2 = new TPolyLine(10,xcc,ycc);
1541 fcat2->SetLineColor(1);
1542 colo = 10;
1543 if ( cat2 != 0. || cat2b != 0. ) {
1544 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
1545 colo = cattime;
1546 } else {
1547 colo = catnoti;
1548 };
1549 };
1550 fcat2->SetFillColor(colo);
1551 fcat2->SetLineWidth(1);
1552 fcat2->Draw("f");
1553 fcat2->Draw();
1554 };
1555 //
1556 // CAT3
1557 //
1558 if ( true ){
1559 for (Int_t i = 0; i<10 ; i++) {
1560 xcc[i]= xcat + xcc2[i]*var.sfx;
1561 ycc[i] = ycat - ycc2[i]*var.sfy;
1562 };
1563 TPolyLine *fcat3 = new TPolyLine(10,xcc,ycc);
1564 fcat3->SetLineColor(1);
1565 colo = 10;
1566 if ( cat3 != 0. || cat3b != 0. ) {
1567 if ( cat3 > 0 || cat3b > 0 || cat3 == -.25 || cat3b ==-.25 ){
1568 colo = cattime;
1569 } else {
1570 colo = catnoti;
1571 };
1572 };
1573 fcat3->SetFillColor(colo);
1574 fcat3->SetLineWidth(1);
1575 fcat3->Draw("f");
1576 fcat3->Draw();
1577 };
1578 //
1579 // CAT4
1580 //
1581 if ( true ){
1582 for (Int_t i = 0; i<10 ; i++) {
1583 xcc[i]= xcat + xcc2[i]*var.sfx;
1584 ycc[i] = ycat + ycc2[i]*var.sfy;
1585 };
1586 TPolyLine *fcat4 = new TPolyLine(10,xcc,ycc);
1587 fcat4->SetLineColor(1);
1588 colo = 10;
1589 if ( cat4 != 0. || cat4b != 0. ) {
1590 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b ==-.25 ){
1591 colo = cattime;
1592 } else {
1593 colo = catnoti;
1594 };
1595 };
1596 fcat4->SetFillColor(colo);
1597 fcat4->SetLineWidth(1);
1598 fcat4->Draw("f");
1599 fcat4->Draw();
1600 };
1601 //
1602 // CAT1 PMTs
1603 //
1604 Float_t xc[5];
1605 Float_t yc[5];
1606 if ( true ){
1607 for (Int_t i = 0; i<5 ; i++) {
1608 xc[i]= xcat - xpmt2 - xc1[i];
1609 yc[i] = ycat + ypmt2 + yc1[i];
1610 };
1611 TPolyLine *fcat1 = new TPolyLine(5,xc,yc);
1612 fcat1->SetLineColor(1);
1613 colo = (int)(10. - cat1 * 8.);
1614 fcat1->SetFillColor(colo);
1615 fcat1->SetLineWidth(1);
1616 fcat1->Draw("f");
1617 fcat1->Draw();
1618 };
1619 if ( true ){
1620 for (Int_t i = 0; i<5 ; i++) {
1621 xc[i]= xcat - xpmt2 - xc1[i];
1622 yc[i] = ycat - ypmt2 - yc1[i];
1623 };
1624 TPolyLine *fcat1b = new TPolyLine(5,xc,yc);
1625 fcat1b->SetLineColor(1);
1626 colo = (int)(10. - cat1b * 8.);
1627 fcat1b->SetFillColor(colo);
1628 fcat1b->SetLineWidth(1);
1629 fcat1b->Draw("f");
1630 fcat1b->Draw();
1631 };
1632 //
1633 // CAT2 PMTs
1634 //
1635 if ( true ){
1636 for (Int_t i = 0; i<5 ; i++) {
1637 xc[i]= xcat + xpmt2 + xc1[i];
1638 yc[i] = ycat + ypmt2 + yc1[i];
1639 };
1640 TPolyLine *fcat2 = new TPolyLine(5,xc,yc);
1641 fcat2->SetLineColor(1);
1642 colo = (int)(10. - cat2 * 8.);
1643 fcat2->SetFillColor(colo);
1644 fcat2->SetLineWidth(1);
1645 fcat2->Draw("f");
1646 fcat2->Draw();
1647 };
1648 if ( true ){
1649 for (Int_t i = 0; i<5 ; i++) {
1650 xc[i]= xcat + xpmt2 + xc1[i];
1651 yc[i] = ycat - ypmt2 - yc1[i];
1652 };
1653 TPolyLine *fcat2b = new TPolyLine(5,xc,yc);
1654 fcat2b->SetLineColor(1);
1655 colo = (int)(10. - cat2b * 8.);
1656 fcat2b->SetFillColor(colo);
1657 fcat2b->SetLineWidth(1);
1658 fcat2b->Draw("f");
1659 fcat2b->Draw();
1660 };
1661 //
1662 // CAT3 PMTs
1663 //
1664 if ( true ){
1665 for (Int_t i = 0; i<5 ; i++) {
1666 xc[i]= xcat + xpmt1 + xc2[i];
1667 yc[i] = ycat - ypmt1 - yc2[i];
1668 };
1669 TPolyLine *fcat3b = new TPolyLine(5,xc,yc);
1670 fcat3b->SetLineColor(1);
1671 colo = (int)(10. - cat3b * 8.);
1672 fcat3b->SetFillColor(colo);
1673 fcat3b->SetLineWidth(1);
1674 fcat3b->Draw("f");
1675 fcat3b->Draw();
1676 };
1677 if ( true ){
1678 for (Int_t i = 0; i<5 ; i++) {
1679 xc[i]= xcat - xpmt1 - xc2[i];
1680 yc[i] = ycat - ypmt1 - yc2[i];
1681 };
1682 TPolyLine *fcat3 = new TPolyLine(5,xc,yc);
1683 fcat3->SetLineColor(1);
1684 colo = (int)(10. - cat3 * 8.);
1685 fcat3->SetFillColor(colo);
1686 fcat3->SetLineWidth(1);
1687 fcat3->Draw("f");
1688 fcat3->Draw();
1689 };
1690 //
1691 // CAT4 PMTs
1692 //
1693 if ( true ){
1694 for (Int_t i = 0; i<5 ; i++) {
1695 xc[i]= xcat + xpmt1 + xc2[i];
1696 yc[i] = ycat + ypmt1 + yc2[i];
1697 };
1698 TPolyLine *fcat4b = new TPolyLine(5,xc,yc);
1699 fcat4b->SetLineColor(1);
1700 colo = (int)(10. - cat4b * 8.);
1701 fcat4b->SetFillColor(colo);
1702 fcat4b->SetLineWidth(1);
1703 fcat4b->Draw("f");
1704 fcat4b->Draw();
1705 };
1706 if ( true ){
1707 for (Int_t i = 0; i<5 ; i++) {
1708 xc[i]= xcat - xpmt1 - xc2[i];
1709 yc[i] = ycat + ypmt1 + yc2[i];
1710 };
1711 TPolyLine *fcat4 = new TPolyLine(5,xc,yc);
1712 fcat4->SetLineColor(1);
1713 colo = (int)(10. - cat4 * 8.);
1714 fcat4->SetFillColor(colo);
1715 fcat4->SetLineWidth(1);
1716 fcat4->Draw("f");
1717 fcat4->Draw();
1718 };
1719 };
1720 if ( true ){
1721 //
1722 // CAS plane view:
1723 //
1724 Float_t xofs = -0.025;
1725 Float_t yofs = 0.039 +0.081+0.0273;
1726 Float_t csy = 0.33/2.;
1727 Float_t pmofs = 0.004;
1728 Float_t csw2 = 0.008;
1729 Float_t xc1[5] = { xofs-csy, xofs-csy, xofs+csy, xofs+csy, xofs-csy};
1730 Float_t yc1[5] = { yofs, yofs+csw2, yofs+csw2, yofs, yofs};
1731
1732 Float_t xc2[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
1733 Float_t yc2[5] = { yofs+pmofs, yofs+pmofs+csw2, yofs+pmofs+csw2, yofs+pmofs, yofs+pmofs};
1734 Float_t xc3[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
1735 Float_t yc3[5] = { yofs+pmofs, yofs+pmofs-csw2, yofs+pmofs-csw2, yofs+pmofs, yofs+pmofs};
1736
1737 //
1738 // CAS1
1739 //
1740 Float_t xc[5];
1741 Float_t yc[5];
1742 for (Int_t i = 0; i<5 ; i++) {
1743 xc[i]= xcat + xc1[i]*var.sfx;
1744 yc[i] = ycat + yc1[i]*var.sfy;
1745 };
1746 TPolyLine *pcass1 = new TPolyLine(5,xc,yc);
1747 pcass1->SetLineColor(1);
1748 colo = 10;
1749 if ( cas1 != 0. || cas1b != 0. ) {
1750 if ( cas1 > 0 || cas1b > 0 || cas1 ==-.25 || cas1b ==-.25){
1751 colo = cattime;
1752 } else {
1753 colo = catnoti;
1754 };
1755 };
1756 if ( colo != 10 ) pcass1->SetFillStyle(3001);
1757 pcass1->SetFillColor(colo);
1758 pcass1->SetLineWidth(1);
1759 pcass1->SetLineStyle(2);
1760 pcass1->Draw("f");
1761 pcass1->Draw();
1762 //
1763 for (Int_t i = 0; i<5 ; i++) {
1764 xc[i]= xcat + xc2[i]*var.sfx;
1765 yc[i] = ycat + yc2[i]*var.sfy;
1766 };
1767 TPolyLine *pcasp1b = new TPolyLine(5,xc,yc);
1768 pcasp1b->SetLineColor(1);
1769 colo = (int)(10. - cas1b * 8.);
1770 if ( colo != 10 ) pcasp1b->SetFillStyle(3001);
1771 pcasp1b->SetFillColor(colo);
1772 pcasp1b->SetLineWidth(1);
1773 pcasp1b->SetLineStyle(2);
1774 pcasp1b->Draw("f");
1775 pcasp1b->Draw();
1776 //
1777 for (Int_t i = 0; i<5 ; i++) {
1778 xc[i]= xcat + xc3[i]*var.sfx;
1779 yc[i] = ycat + yc3[i]*var.sfy;
1780 };
1781 TPolyLine *pcasp1 = new TPolyLine(5,xc,yc);
1782 pcasp1->SetLineColor(1);
1783 colo = (int)(10. - cas1 * 8.);
1784 if ( colo != 10 ) pcasp1->SetFillStyle(3001);
1785 pcasp1->SetFillColor(colo);
1786 pcasp1->SetLineWidth(1);
1787 pcasp1->SetLineStyle(2);
1788 pcasp1->Draw("f");
1789 pcasp1->Draw();
1790 //
1791 // CAS2
1792 //
1793 for (Int_t i = 0; i<5 ; i++) {
1794 xc[i]= xcat - xc1[i]*var.sfx;
1795 yc[i] = ycat - yc1[i]*var.sfy;
1796 };
1797 TPolyLine *pcass2 = new TPolyLine(5,xc,yc);
1798 pcass2->SetLineColor(1);
1799 colo = 10;
1800 if ( cas2 != 0. || cas2b != 0. ) {
1801 if ( cas2 > 0 || cas2b > 0 || cas2 ==-.25 || cas2b ==-.25 ){
1802 colo = cattime;
1803 } else {
1804 colo = catnoti;
1805 };
1806 };
1807 if ( colo != 10 ) pcass2->SetFillStyle(3001);
1808 pcass2->SetFillColor(colo);
1809 pcass2->SetLineWidth(1);
1810 pcass2->SetLineStyle(2);
1811 pcass2->Draw("f");
1812 pcass2->Draw();
1813 //
1814 for (Int_t i = 0; i<5 ; i++) {
1815 xc[i]= xcat - xc2[i]*var.sfx;
1816 yc[i] = ycat - yc2[i]*var.sfy;
1817 };
1818 TPolyLine *pcasp2b = new TPolyLine(5,xc,yc);
1819 pcasp2b->SetLineColor(1);
1820 colo = (int)(10. - cas2b * 8.);
1821 if ( colo != 10 ) pcasp2b->SetFillStyle(3001);
1822 pcasp2b->SetFillColor(colo);
1823 pcasp2b->SetLineWidth(1);
1824 pcasp2b->SetLineStyle(2);
1825 pcasp2b->Draw("f");
1826 pcasp2b->Draw();
1827 //
1828 for (Int_t i = 0; i<5 ; i++) {
1829 xc[i]= xcat - xc3[i]*var.sfx;
1830 yc[i] = ycat - yc3[i]*var.sfy;
1831 };
1832 TPolyLine *pcasp2 = new TPolyLine(5,xc,yc);
1833 pcasp2->SetLineColor(1);
1834 colo = (int)(10. - cas2 * 8.);
1835 pcasp2->SetFillColor(colo);
1836 if ( colo != 10 ) pcasp2->SetFillStyle(3001);
1837 pcasp2->SetLineWidth(1);
1838 pcasp2->SetLineStyle(2);
1839 pcasp2->Draw("f");
1840 pcasp2->Draw();
1841
1842 };
1843 if ( true ){
1844 Float_t xofs = 0.048 +0.066+0.0273;
1845 Float_t yofs = 0.02;
1846 Float_t csy = 0.33/2.;
1847 Float_t pmofs = 0.004;
1848 Float_t csw2 = 0.008;
1849 Float_t xc1[5] = { xofs, xofs+csw2, xofs+csw2, xofs, xofs};
1850 Float_t yc1[5] = { yofs-csy, yofs-csy, yofs+csy, yofs+csy, yofs-csy};
1851 Float_t xc2[5] = { xofs+pmofs, xofs+pmofs+csw2, xofs+pmofs+csw2, xofs+pmofs, xofs+pmofs};
1852 Float_t yc2[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
1853 Float_t xc3[5] = { xofs+pmofs, xofs+pmofs-csw2, xofs+pmofs-csw2, xofs+pmofs, xofs+pmofs};
1854 Float_t yc3[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
1855 //
1856 // CAS3
1857 //
1858 Float_t xc[5];
1859 Float_t yc[5];
1860 for (Int_t i = 0; i<5 ; i++) {
1861 xc[i]= xcat + xc1[i]*var.sfx;
1862 yc[i] = ycat + yc1[i]*var.sfy;
1863 };
1864 TPolyLine *pcass3 = new TPolyLine(5,xc,yc);
1865 pcass3->SetLineColor(1);
1866 colo = 10;
1867 if ( cas3 != 0. || cas3b != 0. ) {
1868 if ( cas3 > 0 || cas3b > 0 || cas3 ==-.25 || cas3b ==-.25){
1869 colo = cattime;
1870 } else {
1871 colo = catnoti;
1872 };
1873 };
1874 if ( colo != 10 ) pcass3->SetFillStyle(3001);
1875 pcass3->SetFillColor(colo);
1876 pcass3->SetLineWidth(1);
1877 pcass3->SetLineStyle(2);
1878 pcass3->Draw("f");
1879 pcass3->Draw();
1880 //
1881 for (Int_t i = 0; i<5 ; i++) {
1882 xc[i]= xcat + xc2[i]*var.sfx;
1883 yc[i] = ycat + yc2[i]*var.sfy;
1884 };
1885 TPolyLine *pcasp3b = new TPolyLine(5,xc,yc);
1886 pcasp3b->SetLineColor(1);
1887 colo = (int)(10. - cas3b * 8.);
1888 if ( colo != 10 ) pcasp3b->SetFillStyle(3001);
1889 pcasp3b->SetFillColor(colo);
1890 pcasp3b->SetLineWidth(1);
1891 pcasp3b->SetLineStyle(2);
1892 pcasp3b->Draw("f");
1893 pcasp3b->Draw();
1894 //
1895 for (Int_t i = 0; i<5 ; i++) {
1896 xc[i]= xcat + xc3[i]*var.sfx;
1897 yc[i] = ycat + yc3[i]*var.sfy;
1898 };
1899 TPolyLine *pcasp3 = new TPolyLine(5,xc,yc);
1900 pcasp3->SetLineColor(1);
1901 colo = (int)(10. - cas3 * 8.);
1902 pcasp3->SetFillColor(colo);
1903 if ( colo != 10 ) pcasp3->SetFillStyle(3001);
1904 pcasp3->SetLineWidth(1);
1905 pcasp3->SetLineStyle(2);
1906 pcasp3->Draw("f");
1907 pcasp3->Draw();
1908 //
1909 // CAS4
1910 //
1911 for (Int_t i = 0; i<5 ; i++) {
1912 xc[i]= xcat - xc1[i]*var.sfx;
1913 yc[i] = ycat - yc1[i]*var.sfy;
1914 };
1915 TPolyLine *pcass4 = new TPolyLine(5,xc,yc);
1916 pcass4->SetLineColor(1);
1917 colo = 10;
1918 if ( cas4 != 0. || cas4b != 0. ) {
1919 if ( cas4 > 0 || cas4b > 0 || cas4 ==-.25 || cas4b ==-.25 ){
1920 colo = cattime;
1921 } else {
1922 colo = catnoti;
1923 };
1924 };
1925 pcass4->SetFillColor(colo);
1926 if ( colo != 10 ) pcass4->SetFillStyle(3001);
1927 pcass4->SetLineWidth(1);
1928 pcass4->SetLineStyle(2);
1929 pcass4->Draw("f");
1930 pcass4->Draw();
1931 //
1932 for (Int_t i = 0; i<5 ; i++) {
1933 xc[i]= xcat - xc2[i]*var.sfx;
1934 yc[i] = ycat - yc2[i]*var.sfy;
1935 };
1936 TPolyLine *pcasp4 = new TPolyLine(5,xc,yc);
1937 pcasp4->SetLineColor(1);
1938 colo = (int)(10. - cas4 * 8.);
1939 pcasp4->SetFillColor(colo);
1940 if ( colo != 10 ) pcasp4->SetFillStyle(3001);
1941 pcasp4->SetLineWidth(1);
1942 pcasp4->SetLineStyle(2);
1943 pcasp4->Draw("f");
1944 pcasp4->Draw();
1945 //
1946 for (Int_t i = 0; i<5 ; i++) {
1947 xc[i]= xcat - xc3[i]*var.sfx;
1948 yc[i] = ycat - yc3[i]*var.sfy;
1949 };
1950 TPolyLine *pcasp4b = new TPolyLine(5,xc,yc);
1951 pcasp4b->SetLineColor(1);
1952 colo = (int)(10. - cas4b * 8.);
1953 pcasp4b->SetFillColor(colo);
1954 if ( colo != 10 ) pcasp4b->SetFillStyle(3001);
1955 pcasp4b->SetLineWidth(1);
1956 pcasp4b->SetLineStyle(2);
1957 pcasp4b->Draw("f");
1958 pcasp4b->Draw();
1959 };
1960 Float_t alfa = 1.2020334;
1961 Float_t lcrd = 0.1815/2.;
1962 Float_t wcrd = 0.008;
1963 if ( true ){
1964 //
1965 // CARD plane view:
1966 //
1967 Float_t xc1[5] = { -0.090165, -0.090165, -0.082165, -0.082165, -0.090165};
1968 Float_t yc1[5] = { -0.100, 0.092, 0.092, -0.100, -0.100};
1969 Float_t xc2[5] = { -0.094165, -0.094165, -0.086165, -0.086165, -0.094165};
1970 Float_t yc2[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
1971 Float_t xc3[5] = { -0.086165, -0.086165, -0.078165, -0.078165, -0.086165};
1972 Float_t yc3[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
1973 //
1974 // CARD1
1975 //
1976 Float_t xc[5];
1977 Float_t yc[5];
1978 for (Int_t i = 0; i<5 ; i++) {
1979 xc[i]= xcat + xc1[i]*var.sfx;
1980 yc[i] = ycat + yc1[i]*var.sfy;
1981 };
1982 TPolyLine *pcars1 = new TPolyLine(5,xc,yc);
1983 pcars1->SetLineColor(1);
1984 colo = 10;
1985 if ( card1 != 0. || card1b != 0. ) {
1986 if ( card1 > 0 || card1b > 0 || card1 ==-.25 || card1b ==-.25 ){
1987 colo = cattime;
1988 } else {
1989 colo = catnoti;
1990 };
1991 };
1992 pcars1->SetFillColor(colo);
1993 pcars1->SetLineWidth(1);
1994 pcars1->Draw("f");
1995 pcars1->Draw();
1996 //
1997 for (Int_t i = 0; i<5 ; i++) {
1998 xc[i]= xcat + xc2[i]*var.sfx;
1999 yc[i] = ycat + yc2[i]*var.sfy;
2000 };
2001 TPolyLine *pcarp1b = new TPolyLine(5,xc,yc);
2002 pcarp1b->SetLineColor(1);
2003 colo = (int)(10. - card1b * 8.);
2004 pcarp1b->SetFillColor(colo);
2005 pcarp1b->SetLineWidth(1);
2006 pcarp1b->Draw("f");
2007 pcarp1b->Draw();
2008 //
2009 for (Int_t i = 0; i<5 ; i++) {
2010 xc[i] = xcat + xc3[i]*var.sfx;
2011 yc[i] = ycat + yc3[i]*var.sfy;
2012 };
2013 TPolyLine *pcarp1 = new TPolyLine(5,xc,yc);
2014 pcarp1->SetLineColor(1);
2015 colo = (int)(10. - card1 * 8.);
2016 pcarp1->SetFillColor(colo);
2017 pcarp1->SetLineWidth(1);
2018 pcarp1->Draw("f");
2019 pcarp1->Draw();
2020 //
2021 // CARD4
2022 //
2023 for (Int_t i = 0; i<5 ; i++) {
2024 xc[i]= xcat - xc1[i]*var.sfx;
2025 yc[i] = ycat - yc1[i]*var.sfy;
2026 };
2027 TPolyLine *pcars4 = new TPolyLine(5,xc,yc);
2028 pcars4->SetLineColor(1);
2029 colo = 10;
2030 if ( card4 != 0. || card4b != 0. ) {
2031 if ( card4 > 0 || card4b > 0 || card4 ==-.25 || card4b ==-.25){
2032 colo = cattime;
2033 } else {
2034 colo = catnoti;
2035 };
2036 };
2037 pcars4->SetFillColor(colo);
2038 pcars4->SetLineWidth(1);
2039 pcars4->Draw("f");
2040 pcars4->Draw();
2041 //
2042 for (Int_t i = 0; i<5 ; i++) {
2043 xc[i]= xcat - xc2[i]*var.sfx;
2044 yc[i] = ycat - yc2[i]*var.sfy;
2045 };
2046 TPolyLine *pcarp4b = new TPolyLine(5,xc,yc);
2047 pcarp4b->SetLineColor(1);
2048 colo = (int)(10. - card4b * 8.);
2049 pcarp4b->SetFillColor(colo);
2050 pcarp4b->SetLineWidth(1);
2051 pcarp4b->Draw("f");
2052 pcarp4b->Draw();
2053 //
2054 for (Int_t i = 0; i<5 ; i++) {
2055 xc[i]= xcat - xc3[i]*var.sfx;
2056 yc[i] = ycat - yc3[i]*var.sfy;
2057 };
2058 TPolyLine *pcarp4 = new TPolyLine(5,xc,yc);
2059 pcarp4->SetLineColor(1);
2060 colo = (int)(10. - card4 * 8.);
2061 pcarp4->SetFillColor(colo);
2062 pcarp4->SetLineWidth(1);
2063 pcarp4->Draw("f");
2064 pcarp4->Draw();
2065 };
2066 if ( true ){
2067 Float_t xc1[5] = { -0.074, 0.074, 0.074, -0.074, -0.074};
2068 Float_t yc1[5] = { 0.108165, 0.108165, 0.100165, 0.100165, 0.108165};
2069 Float_t xc2[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
2070 Float_t yc2[5] = { 0.112165, 0.112165, 0.104165, 0.104165, 0.112165};
2071 Float_t xc3[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
2072 Float_t yc3[5] = { 0.104165, 0.104165, 0.096165, 0.096165, 0.104165};
2073 //
2074 // CARD2
2075 //
2076 Float_t xc[5];
2077 Float_t yc[5];
2078 for (Int_t i = 0; i<5 ; i++) {
2079 xc[i]= xcat - (xc1[i]-0.0025)*var.sfx;
2080 yc[i] = ycat - yc1[i]*var.sfy;
2081 };
2082 TPolyLine *pcars2 = new TPolyLine(5,xc,yc);
2083 pcars2->SetLineColor(1);
2084 colo = 10;
2085 if ( card2 != 0. || card2b != 0.) {
2086 if ( card2 > 0 || card2b > 0 || card2 ==-.25 || card2b ==-.25 ){
2087 colo = cattime;
2088 } else {
2089 colo = catnoti;
2090 };
2091 };
2092 pcars2->SetFillColor(colo);
2093 pcars2->SetLineWidth(1);
2094 pcars2->Draw("f");
2095 pcars2->Draw();
2096 //
2097 for (Int_t i = 0; i<5 ; i++) {
2098 xc[i]= xcat - (xc2[i]-0.0025)*var.sfx;
2099 yc[i] = ycat - yc2[i]*var.sfy;
2100 };
2101 TPolyLine *pcarp2 = new TPolyLine(5,xc,yc);
2102 pcarp2->SetLineColor(1);
2103 colo = (int)(10. - card2 * 8.);
2104 pcarp2->SetFillColor(colo);
2105 pcarp2->SetLineWidth(1);
2106 pcarp2->Draw("f");
2107 pcarp2->Draw();
2108 //
2109 for (Int_t i = 0; i<5 ; i++) {
2110 xc[i]= xcat - (xc3[i]-0.0025)*var.sfx;
2111 yc[i] = ycat - yc3[i]*var.sfy;
2112 };
2113 TPolyLine *pcarp2b = new TPolyLine(5,xc,yc);
2114 pcarp2b->SetLineColor(1);
2115 colo = (int)(10. - card2b * 8.);
2116 pcarp2b->SetFillColor(colo);
2117 pcarp2b->SetLineWidth(1);
2118 pcarp2b->Draw("f");
2119 pcarp2b->Draw();
2120 //
2121 // CARD3
2122 //
2123 for (Int_t i = 0; i<5 ; i++) {
2124 xc[i]= xcat + (xc1[i]-0.0025)*var.sfx;
2125 yc[i] = ycat + yc1[i]*var.sfy;
2126 };
2127 TPolyLine *pcars3 = new TPolyLine(5,xc,yc);
2128 pcars3->SetLineColor(1);
2129 colo = 10;
2130 if ( card3 != 0. || card3b != 0. ) {
2131 if ( card3 > 0 || card3b > 0 || card3==-.25 || card3b ==-.25){
2132 colo = cattime;
2133 } else {
2134 colo = catnoti;
2135 };
2136 };
2137 pcars3->SetFillColor(colo);
2138 pcars3->SetLineWidth(1);
2139 pcars3->Draw("f");
2140 pcars3->Draw();
2141 //
2142 for (Int_t i = 0; i<5 ; i++) {
2143 xc[i]= xcat + (xc2[i]-0.0025)*var.sfx;
2144 yc[i] = ycat + yc2[i]*var.sfy;
2145 };
2146 TPolyLine *pcarp3 = new TPolyLine(5,xc,yc);
2147 pcarp3->SetLineColor(1);
2148 colo = (int)(10. - card3 * 8.);
2149 pcarp3->SetFillColor(colo);
2150 pcarp3->SetLineWidth(1);
2151 pcarp3->Draw("f");
2152 pcarp3->Draw();
2153 //
2154 for (Int_t i = 0; i<5 ; i++) {
2155 xc[i]= xcat + (xc3[i]-0.0025)*var.sfx;
2156 yc[i] = ycat + yc3[i]*var.sfy;
2157 };
2158 TPolyLine *pcarp3b = new TPolyLine(5,xc,yc);
2159 pcarp3b->SetLineColor(1);
2160 colo = (int)(10. - card3b * 8.);
2161 pcarp3b->SetFillColor(colo);
2162 pcarp3b->SetLineWidth(1);
2163 pcarp3b->Draw("f");
2164 pcarp3b->Draw();
2165
2166 //
2167 // CARD - X-view
2168 //
2169 Float_t cardcx = 0.143168*var.sfx;
2170 Float_t cardcy = 0.1475*var.sfy;
2171 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
2172 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
2173 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
2174 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
2175
2176 //
2177 // CARD3 X/ Y
2178 //
2179 Float_t xcc[4];
2180 Float_t ycc[4];
2181 for (Int_t i = 0; i<4 ; i++) {
2182 xcc[i] = cardcx + var.xxvc + acrdx[i]*var.sfx;
2183 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
2184 };
2185 TPolyLine *fcard3 = new TPolyLine(4,xcc,ycc);
2186 fcard3->SetLineColor(1);
2187 colo = (int)(10. - card3 * 8.);
2188 fcard3->SetFillColor(colo);
2189 fcard3->SetLineWidth(1);
2190 fcard3->Draw("f");
2191 fcard3->Draw();
2192 //
2193 for (Int_t i = 0; i<4 ; i++) {
2194 xcc[i] = cardcx + var.xxvc + bcrdx[i]*var.sfx;
2195 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
2196 };
2197 TPolyLine *fcard3b = new TPolyLine(4,xcc,ycc);
2198 fcard3b->SetLineColor(1);
2199 colo = (int)(10. - card3b * 8.);
2200 fcard3b->SetFillColor(colo);
2201 fcard3b->SetLineWidth(1);
2202 fcard3b->Draw("f");
2203 fcard3b->Draw();
2204
2205 //
2206 // CARD2 \X Y
2207 //
2208 for (Int_t i = 0; i<4 ; i++) {
2209 xcc[i] = -cardcx + var.xxvc - acrdx[i]*var.sfx;
2210 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
2211 };
2212 TPolyLine *fcard2 = new TPolyLine(4,xcc,ycc);
2213 fcard2->SetLineColor(1);
2214 colo = (int)(10. - card2 * 8.);
2215 fcard2->SetFillColor(colo);
2216 fcard2->SetLineWidth(1);
2217 fcard2->Draw("f");
2218 fcard2->Draw();
2219 //
2220 for (Int_t i = 0; i<4 ; i++) {
2221 xcc[i] = -cardcx + var.xxvc - bcrdx[i]*var.sfx;
2222 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
2223 };
2224 TPolyLine *fcard2b = new TPolyLine(4,xcc,ycc);
2225 fcard2b->SetLineColor(1);
2226 colo = (int)(10. - card2b * 8.);
2227 fcard2b->SetFillColor(colo);
2228 fcard2b->SetLineWidth(1);
2229 fcard2b->Draw("f");
2230 fcard2b->Draw();
2231 };
2232
2233 if ( true ){
2234 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
2235 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
2236 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
2237 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
2238 //
2239 // CARD - Y-view
2240 //
2241 Float_t cardcx = 0.12*var.sfx;
2242 Float_t cardcy = 0.1475*var.sfy;
2243 //
2244 // CARD4 X Y/
2245 //
2246 Float_t xcc[4];
2247 Float_t ycc[4];
2248 for (Int_t i = 0; i<4 ; i++) {
2249 xcc[i] = cardcx + var.xyvc + acrdx[i]*var.sfx;
2250 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
2251 };
2252 TPolyLine *fcard4 = new TPolyLine(4,xcc,ycc);
2253 fcard4->SetLineColor(1);
2254 colo = (int)(10. - card4 * 8.);
2255 fcard4->SetFillColor(colo);
2256 fcard4->SetLineWidth(1);
2257 fcard4->Draw("f");
2258 fcard4->Draw();
2259 //
2260 for (Int_t i = 0; i<4 ; i++) {
2261 xcc[i] = cardcx + var.xyvc + bcrdx[i]*var.sfx;
2262 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
2263 };
2264 TPolyLine *fcard4b = new TPolyLine(4,xcc,ycc);
2265 fcard4b->SetLineColor(1);
2266 colo = (int)(10. - card4b * 8.);
2267 fcard4b->SetFillColor(colo);
2268 fcard4b->SetLineWidth(1);
2269 fcard4b->Draw("f");
2270 fcard4b->Draw();
2271
2272 //
2273 // CARD1 X \Y
2274 //
2275 for (Int_t i = 0; i<4 ; i++) {
2276 xcc[i] = -cardcx + var.xyvc - acrdx[i]*var.sfx;
2277 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
2278 };
2279 TPolyLine *fcard1 = new TPolyLine(4,xcc,ycc);
2280 fcard1->SetLineColor(1);
2281 colo = (int)(10. - card1 * 8.);
2282 fcard1->SetFillColor(colo);
2283 fcard1->SetLineWidth(1);
2284 fcard1->Draw("f");
2285 fcard1->Draw();
2286 //
2287 for (Int_t i = 0; i<4 ; i++) {
2288 xcc[i] = -cardcx + var.xyvc - bcrdx[i]*var.sfx;
2289 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
2290 };
2291 TPolyLine *fcard1b = new TPolyLine(4,xcc,ycc);
2292 fcard1b->SetLineColor(1);
2293 colo = (int)(10. - card1b * 8.);
2294 fcard1b->SetFillColor(colo);
2295 fcard1b->SetLineWidth(1);
2296 fcard1b->Draw("f");
2297 fcard1b->Draw();
2298 };
2299 }
2300
2301 void ShowTOF(Int_t j, TTree *otr, Variables & var){
2302 //
2303 // get the trigger infos
2304 //
2305 pamela::trigger::TriggerEvent *trigger = 0;
2306 otr->SetBranchAddress("Trigger", &trigger);
2307 if ( !var.nosig ) otr->GetEntry(j);
2308 //
2309
2310 //
2311 // on day these variables will contain the MIP value for each paddle
2312 //
2313 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2314 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
2315 Float_t ms21a[2] = {0.,0.};
2316 Float_t ms22a[2] = {0.,0.};
2317 Float_t ms31a[3] = {0.,0.,0.};
2318 Float_t ms32a[3] = {0.,0.,0.};
2319 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2320 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
2321 Float_t ms21b[2] = {0.,0.};
2322 Float_t ms22b[2] = {0.,0.};
2323 Float_t ms31b[3] = {0.,0.,0.};
2324 Float_t ms32b[3] = {0.,0.,0.};
2325 //
2326 // TDC info for each PMT
2327 //
2328 Float_t mt11[2][8];
2329 Float_t mt12[2][6];
2330 Float_t mt21[2][2];
2331 Float_t mt22[2][2];
2332 Float_t mt31[2][3];
2333 Float_t mt32[2][3];
2334 //
2335 Int_t S3 = 0;
2336 Int_t S2 = 0;
2337 Int_t S12 = 0;
2338 Int_t S11 = 0;
2339 if ( !var.nosig ) {
2340 S3 = trigger->patterntrig[2];
2341 S2 = trigger->patterntrig[3];
2342 S12 = trigger->patterntrig[4];
2343 S11 = trigger->patterntrig[5];
2344 };
2345 //
2346 for ( Int_t i = 0; i<8; i++ ) {
2347 if ( S11 & (1<<i) ){
2348 ms11a[i] = 1.;
2349 }
2350 if ( S11 & (1<<(i+8) ) ){
2351 ms11b[i] = 1.;
2352 }
2353 };
2354 for ( Int_t i = 0; i<6; i++ ) {
2355 if ( S12 & (1<<i) ) {
2356 ms12a[i] = 1.;
2357 }
2358 if ( S12 & (1<<(i+6)) ) {
2359 ms12b[i] = 1.;
2360 }
2361 };
2362 Int_t ii = 2;
2363 for ( Int_t i = 0; i<2; i++ ) {
2364 ii--;
2365 if ( S2 & (1<<i) ) {
2366 ms21a[ii] = 1.;
2367 }
2368 if ( S2 & (1<<(i+2)) ) {
2369 ms21b[ii] = 1.;
2370 }
2371 };
2372 for ( Int_t i = 4; i<6; i++ ) {
2373 if ( S2 & (1<<i) ) {
2374 ms22a[i-4] = 1.;
2375 }
2376 if ( S2 & (1<<(i+2)) ) {
2377 ms22b[i-4] = 1.;
2378 }
2379 };
2380 for ( Int_t i = 0; i<3; i++ ) {
2381 if ( S3 & (1<<i) ) {
2382 ms31a[i] = 1.;
2383 }
2384 if ( S3 & (1<<(i+3)) ) {
2385 ms31b[i] = 1.;
2386 }
2387 };
2388 for ( Int_t i = 6; i<9; i++ ) {
2389 if ( S3 & (1<<i) ) {
2390 ms32a[i-6] = 1.;
2391 }
2392 if ( S3 & (1<<(i+3)) ) {
2393 ms32b[i-6] = 1.;
2394 }
2395 };
2396 //
2397 Int_t colo;
2398 Int_t ocolo;
2399 Float_t xs2x = var.xxvc;
2400 Float_t ys2x = var.yxvc + 0.36*var.sfy;
2401 Float_t xs2y = var.xyvc;
2402 Float_t ys2y = var.yyvc + 0.36*var.sfy;
2403 Float_t ws2 = 0.005;
2404 Float_t ws13 = 0.007;
2405 Int_t noadc = 12;
2406 if ( var.bw ){
2407 noadc=12;
2408 } else {
2409 noadc=41;
2410 };
2411 //
2412 // S11 X-view
2413 //
2414 // A
2415 Float_t s11p = 0.051;
2416 ocolo = 10;
2417 TPolyLine *ftof11xa[8];
2418 for ( Int_t j=0; j<8; j++){
2419 Float_t xc1[4]={ (s11p*j), (s11p*j), s11p*(j+1), (s11p*j)};
2420 Float_t yc1[4]={ 0., ws13, ws13, 0.};
2421 Float_t xc[4];
2422 Float_t yc[4];
2423 for (Int_t i = 0; i<4 ; i++) {
2424 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
2425 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
2426 };
2427 ftof11xa[j] = new TPolyLine(4,xc,yc);
2428 ftof11xa[j]->SetLineColor(1);
2429 if ( var.bw ){
2430 colo = -1;
2431 } else {
2432 colo = 1;
2433 };
2434 ColorMIP(ms11a[j],colo);
2435 //
2436 if ( colo != 10 ) ocolo = colo;
2437 if ( mt11[0][j] == 4095. ) colo = noadc;
2438 //
2439 ftof11xa[j]->SetFillColor(colo);
2440 ftof11xa[j]->SetLineWidth(1);
2441 ftof11xa[j]->Draw("f");
2442 ftof11xa[j]->Draw();
2443 };
2444 // B
2445 s11p = 0.051;
2446 TPolyLine *ftof11xb[8];
2447 for ( Int_t j=0; j<8; j++){
2448 Float_t xc1[4]={ (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
2449 Float_t yc1[4]={ 0., 0., ws13, 0.};
2450 Float_t xc[4];
2451 Float_t yc[4];
2452 for (Int_t i = 0; i<4 ; i++) {
2453 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
2454 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
2455 };
2456 ftof11xb[j] = new TPolyLine(4,xc,yc);
2457 ftof11xb[j]->SetLineColor(1);
2458 if ( var.bw ){
2459 colo = -1;
2460 } else {
2461 colo = 1;
2462 };
2463 ColorMIP(ms11b[j],colo);
2464 //
2465 if ( colo != 10 ) ocolo = colo;
2466 if ( mt11[1][j] == 4095. ) colo = noadc;
2467 //
2468 ftof11xb[j]->SetFillColor(colo);
2469 ftof11xb[j]->SetLineWidth(1);
2470 ftof11xb[j]->Draw("f");
2471 ftof11xb[j]->Draw();
2472 };
2473
2474 //
2475 // S11 Y-view
2476 //
2477 if ( true ){
2478 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
2479 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2480 Float_t nxc[5];
2481 Float_t nyc[5];
2482 for (Int_t i = 0; i<5 ; i++) {
2483 nxc[i]= xs2y + nxc1[i]*var.sfx;
2484 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2485 };
2486 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
2487 ftof11y->SetLineColor(1);
2488 ftof11y->SetFillColor(ocolo);
2489 ftof11y->SetLineWidth(1);
2490 ftof11y->Draw("f");
2491 ftof11y->Draw();
2492 };
2493
2494 //
2495 // S12 Y-view
2496 //
2497 // A
2498 Float_t s12p = 0.055;
2499 ocolo = 10;
2500 TPolyLine *ftof12ya[6];
2501 for ( Int_t j=0; j<6; j++){
2502 Float_t xc1[4]={ (s12p*j), s12p*(j), s12p*(j+1), (s12p*j)};
2503 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
2504 Float_t xc[4];
2505 Float_t yc[4];
2506 for (Int_t i = 0; i<4 ; i++) {
2507 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
2508 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
2509 };
2510 ftof12ya[j] = new TPolyLine(4,xc,yc);
2511 ftof12ya[j]->SetLineColor(1);
2512 if ( var.bw ){
2513 colo = -1;
2514 } else {
2515 colo = 1;
2516 };
2517 ColorMIP(ms12a[j],colo);
2518 //
2519 if ( colo != 10 ) ocolo = colo;
2520 if ( mt12[0][j] == 4095. ) colo = noadc;
2521 //
2522 ftof12ya[j]->SetFillColor(colo);
2523 ftof12ya[j]->SetLineWidth(1);
2524 ftof12ya[j]->Draw("f");
2525 ftof12ya[j]->Draw();
2526 };
2527 // B
2528 s12p = 0.055;
2529 TPolyLine *ftof12yb[6];
2530 for ( Int_t j=0; j<6; j++){
2531 Float_t xc1[4]={ (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
2532 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
2533 Float_t xc[4];
2534 Float_t yc[4];
2535 for (Int_t i = 0; i<4 ; i++) {
2536 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
2537 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
2538 };
2539 ftof12yb[j] = new TPolyLine(4,xc,yc);
2540 ftof12yb[j]->SetLineColor(1);
2541 if ( var.bw ){
2542 colo = -1;
2543 } else {
2544 colo = 1;
2545 };
2546 ColorMIP(ms12b[j],colo);
2547 //
2548 if ( colo != 10 ) ocolo = colo;
2549 if ( mt12[1][j] == 4095. ) colo = noadc;
2550 //
2551 ftof12yb[j]->SetFillColor(colo);
2552 ftof12yb[j]->SetLineWidth(1);
2553 ftof12yb[j]->Draw("f");
2554 ftof12yb[j]->Draw();
2555 };
2556 //
2557 // S12 X-view
2558 //
2559 if ( true ){
2560 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
2561 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2562 Float_t nxc[5];
2563 Float_t nyc[5];
2564 for (Int_t i = 0; i<5 ; i++) {
2565 nxc[i]= xs2x + nxc1[i]*var.sfx;
2566 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2567 };
2568 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
2569 ftof12x->SetLineColor(1);
2570 ftof12x->SetFillColor(ocolo);
2571 ftof12x->SetLineWidth(1);
2572 ftof12x->Draw("f");
2573 ftof12x->Draw();
2574 };
2575
2576 //
2577 // S21 Y-view
2578 //
2579 // A
2580 Float_t s21p = 0.075;
2581 ocolo = 10;
2582 TPolyLine *ftof21ya[2];
2583 for ( Int_t j=0; j<2; j++){
2584 Float_t xc1[4]={ s21p*(j-1), s21p*(j-1), s21p*j, s21p*(j-1)};
2585 Float_t yc1[4]={ 0., ws2, ws2, 0.};
2586 Float_t xc[4];
2587 Float_t yc[4];
2588 for (Int_t i = 0; i<4 ; i++) {
2589 xc[i]= xs2y + xc1[i]*var.sfx;
2590 yc[i] = ys2y + yc1[i]*var.sfy;
2591 };
2592 ftof21ya[j] = new TPolyLine(4,xc,yc);
2593 ftof21ya[j]->SetLineColor(1);
2594 if ( var.bw ){
2595 colo = -1;
2596 } else {
2597 colo = 1;
2598 };
2599 ColorMIP(ms21a[j],colo);
2600 //
2601 if ( colo != 10 ) ocolo = colo;
2602 if ( mt21[0][j] == 4095. ) colo = noadc;
2603 //
2604 ftof21ya[j]->SetFillColor(colo);
2605 ftof21ya[j]->SetLineWidth(1);
2606 ftof21ya[j]->Draw("f");
2607 ftof21ya[j]->Draw();
2608 };
2609 // B
2610 s21p = 0.075;
2611 TPolyLine *ftof21yb[2];
2612 for ( Int_t j=0; j<2; j++){
2613 Float_t xc1[4]={ s21p*(j-1), s21p*j, s21p*j, s21p*(j-1)};
2614 Float_t yc1[4]={ 0., 0., ws2, 0.};
2615 Float_t xc[4];
2616 Float_t yc[4];
2617 for (Int_t i = 0; i<4 ; i++) {
2618 xc[i]= xs2y + xc1[i]*var.sfx;
2619 yc[i] = ys2y + yc1[i]*var.sfy;
2620 };
2621 ftof21yb[j] = new TPolyLine(4,xc,yc);
2622 ftof21yb[j]->SetLineColor(1);
2623 if ( var.bw ){
2624 colo = -1;
2625 } else {
2626 colo = 1;
2627 };
2628 ColorMIP(ms21b[j],colo);
2629 //
2630 if ( colo != 10 ) ocolo = colo;
2631 if ( mt21[1][j] == 4095. ) colo = noadc;
2632 //
2633 ftof21yb[j]->SetFillColor(colo);
2634 ftof21yb[j]->SetLineWidth(1);
2635 ftof21yb[j]->Draw("f");
2636 ftof21yb[j]->Draw();
2637 };
2638 //
2639 // S21 X-view
2640 //
2641 if ( true ){
2642 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2643 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
2644 Float_t nxc[5];
2645 Float_t nyc[5];
2646 for (Int_t i = 0; i<5 ; i++) {
2647 nxc[i]= xs2x + nxc1[i]*var.sfx;
2648 nyc[i] = ys2x + nyc1[i]*var.sfy;
2649 };
2650 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
2651 ftof21x->SetLineColor(1);
2652 ftof21x->SetFillColor(ocolo);
2653 ftof21x->SetLineWidth(1);
2654 ftof21x->Draw("f");
2655 ftof21x->Draw();
2656 };
2657 //
2658 // S22 X-view
2659 //
2660 // A
2661 Float_t s22p = 0.090;
2662 ocolo = 10;
2663 TPolyLine *ftof22xa[2];
2664 for ( Int_t j=0; j<2; j++){
2665 Float_t xc1[4]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*(j-1)};
2666 Float_t yc1[4]={ -ws2, 0., 0., -ws2};
2667 Float_t xc[4];
2668 Float_t yc[4];
2669 for (Int_t i = 0; i<4 ; i++) {
2670 xc[i]= xs2x + xc1[i]*var.sfx;
2671 yc[i] = ys2x + yc1[i]*var.sfy;
2672 };
2673 ftof22xa[j] = new TPolyLine(4,xc,yc);
2674 ftof22xa[j]->SetLineColor(1);
2675 if ( var.bw ){
2676 colo = -1;
2677 } else {
2678 colo = 1;
2679 };
2680 ColorMIP(ms22a[j],colo);
2681 //
2682 if ( colo != 10 ) ocolo = colo;
2683 if ( mt22[0][j] == 4095. ) colo = noadc;
2684 //
2685 ftof22xa[j]->SetFillColor(colo);
2686 ftof22xa[j]->SetLineWidth(1);
2687 ftof22xa[j]->Draw("f");
2688 ftof22xa[j]->Draw();
2689 };
2690 // B
2691 s22p = 0.090;
2692 TPolyLine *ftof22xb[2];
2693 for ( Int_t j=0; j<2; j++){
2694 Float_t xc1[4]={ s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
2695 Float_t yc1[4]={ -ws2, -ws2, 0., -ws2};
2696 Float_t xc[4];
2697 Float_t yc[4];
2698 for (Int_t i = 0; i<4 ; i++) {
2699 xc[i]= xs2x + xc1[i]*var.sfx;
2700 yc[i] = ys2x + yc1[i]*var.sfy;
2701 };
2702 ftof22xb[j] = new TPolyLine(4,xc,yc);
2703 ftof22xb[j]->SetLineColor(1);
2704 if ( var.bw ){
2705 colo = -1;
2706 } else {
2707 colo = 1;
2708 };
2709 ColorMIP(ms22b[j],colo);
2710 //
2711 if ( colo != 10 ) ocolo = colo;
2712 if ( mt22[1][j] == 4095. ) colo = noadc;
2713 //
2714 ftof22xb[j]->SetFillColor(colo);
2715 ftof22xb[j]->SetLineWidth(1);
2716 ftof22xb[j]->Draw("f");
2717 ftof22xb[j]->Draw();
2718 };
2719 //
2720 // S22 Y-view
2721 //
2722 if ( true ){
2723 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2724 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
2725 Float_t nxc[5];
2726 Float_t nyc[5];
2727 for (Int_t i = 0; i<5 ; i++) {
2728 nxc[i]= xs2y + nxc1[i]*var.sfx;
2729 nyc[i] = ys2y + nyc1[i]*var.sfy;
2730 };
2731 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
2732 ftof22y->SetLineColor(1);
2733 ftof22y->SetFillColor(ocolo);
2734 ftof22y->SetLineWidth(1);
2735 ftof22y->Draw("f");
2736 ftof22y->Draw();
2737 };
2738
2739 //
2740 // S31 X-view
2741 //
2742 // A
2743 Float_t s31p = 0.060;
2744 ocolo = 10;
2745 TPolyLine *ftof31xa[3];
2746 for ( Int_t j=0; j<3; j++){
2747 Float_t xc1[4]={ (s31p*j), (s31p*j), s31p*(j+1), (s31p*j)};
2748 Float_t yc1[4]={ 0., ws13, ws13, 0.};
2749 Float_t xc[4];
2750 Float_t yc[4];
2751 for (Int_t i = 0; i<4 ; i++) {
2752 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
2753 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
2754 };
2755 ftof31xa[j] = new TPolyLine(4,xc,yc);
2756 ftof31xa[j]->SetLineColor(1);
2757 if ( var.bw ){
2758 colo = -1;
2759 } else {
2760 colo = 1;
2761 };
2762 ColorMIP(ms31a[j],colo);
2763 //
2764 if ( colo != 10 ) ocolo = colo;
2765 if ( mt31[0][j] == 4095. ) colo = noadc;
2766 //
2767 ftof31xa[j]->SetFillColor(colo);
2768 ftof31xa[j]->SetLineWidth(1);
2769 ftof31xa[j]->Draw("f");
2770 ftof31xa[j]->Draw();
2771 };
2772 // B
2773 s31p = 0.060;
2774 TPolyLine *ftof31xb[3];
2775 for ( Int_t j=0; j<3; j++){
2776 Float_t xc1[4]={ (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
2777 Float_t yc1[4]={ 0., 0., ws13, 0.};
2778 Float_t xc[4];
2779 Float_t yc[4];
2780 for (Int_t i = 0; i<4 ; i++) {
2781 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
2782 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
2783 };
2784 ftof31xb[j] = new TPolyLine(4,xc,yc);
2785 ftof31xb[j]->SetLineColor(1);
2786 if ( var.bw ){
2787 colo = -1;
2788 } else {
2789 colo = 1;
2790 };
2791 ColorMIP(ms31b[j],colo);
2792 //
2793 if ( colo != 10 ) ocolo = colo;
2794 if ( mt31[1][j] == 4095. ) colo = noadc;
2795 //
2796 ftof31xb[j]->SetFillColor(colo);
2797 ftof31xb[j]->SetLineWidth(1);
2798 ftof31xb[j]->Draw("f");
2799 ftof31xb[j]->Draw();
2800 };
2801 //
2802 // S31 Y-view
2803 //
2804 if ( true ){
2805 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2806 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2807 Float_t nxc[5];
2808 Float_t nyc[5];
2809 for (Int_t i = 0; i<5 ; i++) {
2810 nxc[i]= xs2y + nxc1[i]*var.sfx;
2811 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
2812 };
2813 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
2814 ftof31y->SetLineColor(1);
2815 ftof31y->SetFillColor(ocolo);
2816 ftof31y->SetLineWidth(1);
2817 ftof31y->Draw("f");
2818 ftof31y->Draw();
2819 };
2820 //
2821 // S32 Y-view
2822 //
2823 Float_t s32p = 0.050;
2824 ocolo = 10;
2825 TPolyLine *ftof32ya[3];
2826 for ( Int_t j=0; j<3; j++){
2827 Float_t xc1[4]={ (s32p*j), (s32p*j), s32p*(j+1), (s32p*j)};
2828 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
2829 Float_t xc[4];
2830 Float_t yc[4];
2831 for (Int_t i = 0; i<4 ; i++) {
2832 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
2833 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
2834 };
2835 ftof32ya[j] = new TPolyLine(4,xc,yc);
2836 ftof32ya[j]->SetLineColor(1);
2837 if ( var.bw ){
2838 colo = -1;
2839 } else {
2840 colo = 1;
2841 };
2842 ColorMIP(ms32a[j],colo);
2843 //
2844 if ( colo != 10 ) ocolo = colo;
2845 if ( mt32[0][j] == 4095. ) colo = noadc;
2846 //
2847 ftof32ya[j]->SetFillColor(colo);
2848 ftof32ya[j]->SetLineWidth(1);
2849 ftof32ya[j]->Draw("f");
2850 ftof32ya[j]->Draw();
2851 };
2852 s32p = 0.050;
2853 TPolyLine *ftof32yb[3];
2854 for ( Int_t j=0; j<3; j++){
2855 Float_t xc1[4]={ (s32p*j), s32p*(j+1), s32p*(j+1), (s32p*j)};
2856 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
2857 Float_t xc[4];
2858 Float_t yc[4];
2859 for (Int_t i = 0; i<4 ; i++) {
2860 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
2861 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
2862 };
2863 ftof32yb[j] = new TPolyLine(4,xc,yc);
2864 ftof32yb[j]->SetLineColor(1);
2865 if ( var.bw ){
2866 colo = -1;
2867 } else {
2868 colo = 1;
2869 };
2870 ColorMIP(ms32b[j],colo);
2871 //
2872 if ( colo != 10 ) ocolo = colo;
2873 if ( mt32[1][j] == 4095. ) colo = noadc;
2874 //
2875 ftof32yb[j]->SetFillColor(colo);
2876 ftof32yb[j]->SetLineWidth(1);
2877 ftof32yb[j]->Draw("f");
2878 ftof32yb[j]->Draw();
2879 };
2880 //
2881 // S32 X-view
2882 //
2883 if ( true ){
2884 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2885 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2886 Float_t nxc[5];
2887 Float_t nyc[5];
2888 for (Int_t i = 0; i<5 ; i++) {
2889 nxc[i]= xs2x + nxc1[i]*var.sfx;
2890 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
2891 };
2892 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
2893 ftof32x->SetLineColor(1);
2894 ftof32x->SetFillColor(ocolo);
2895 ftof32x->SetLineWidth(1);
2896 ftof32x->Draw("f");
2897 ftof32x->Draw();
2898 };
2899 }
2900
2901 void ShowS4L0(Int_t i, TTree *otr, Variables & var){
2902
2903 pamela::trigger::TriggerEvent *trigger = 0;
2904 otr->SetBranchAddress("Trigger", &trigger);
2905 if ( !var.nosig ) otr->GetEntry(i);
2906
2907 Float_t ms4[3] = {0.,0.,0.};
2908 Int_t S4 = 0;
2909 if ( !var.nosig ) {
2910 S4 = trigger->patterntrig[1];
2911 };
2912 //
2913 for ( Int_t i = 0; i<3; i++ ) {
2914 if ( S4 & (1<<0) ) ms4[i] = 1.;
2915 };
2916 //
2917 Int_t colo;
2918 Float_t xs4x = var.xxvc;
2919 Float_t ys4x = var.yxvc - 0.3250*var.sfy; //25
2920 Float_t xs4y = var.xyvc;
2921 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
2922 Float_t ws4 = 0.010;
2923
2924 //
2925 // Y-view
2926 //
2927 Float_t s4p = 0.1606667;
2928 Int_t ocolo = 0;
2929 TPolyLine *fs4y[3];
2930 for ( Int_t j=0; j<3; j++){
2931 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
2932 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
2933 Float_t xc[5];
2934 Float_t yc[5];
2935 for (Int_t i = 0; i<5 ; i++) {
2936 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
2937 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
2938 };
2939 fs4y[j] = new TPolyLine(5,xc,yc);
2940 fs4y[j]->SetLineColor(1);
2941 if ( var.bw ){
2942 colo = -1;
2943 } else {
2944 colo = 1;
2945 };
2946 ColorMIP(ms4[j],colo);
2947 //
2948 if ( colo != 10 ) ocolo = colo;
2949 //
2950 fs4y[j]->SetFillColor(colo);
2951 fs4y[j]->SetLineWidth(1);
2952 fs4y[j]->Draw("f");
2953 fs4y[j]->Draw();
2954 };
2955 //
2956 // X-view
2957 //
2958 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
2959 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
2960 Float_t xc[5];
2961 Float_t yc[5];
2962 for (Int_t i = 0; i<5 ; i++) {
2963 xc[i]= xs4x + xc1[i]*var.nds4;
2964 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
2965 };
2966 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
2967 fs4x->SetLineColor(1);
2968 fs4x->SetFillColor(ocolo);
2969 fs4x->SetLineWidth(1);
2970 fs4x->Draw("f");
2971 fs4x->Draw();
2972 }
2973
2974 //**********************************************************************************
2975 // LEVEL1 SUBROUTINES //
2976 //**********************************************************************************
2977
2978 void ShowS4L1(Int_t i, TTree *otr, Variables & var){
2979
2980 pamela::S4::S4Event *s4 = 0;
2981 otr->SetBranchAddress("S4", &s4);
2982 if ( !var.nosig ) otr->GetEntry(i);
2983
2984 Float_t ms4[3] = {0.,0.,0.};
2985 Int_t data = 0;
2986 if ( !var.nosig ) {
2987 data = s4->S4_DATA;
2988 };
2989 //
2990 Float_t calibdata;
2991 if ( !s4->unpackError && data > 31 ){
2992 calibdata = ((Float_t)data - 32.) * 0.5;
2993 } else {
2994 calibdata = 0.;
2995 };
2996 var.s4sig = calibdata;
2997 //
2998 for ( Int_t j = 0; j<3; j++ ) {
2999 ms4[j] = calibdata;
3000 };
3001 Int_t colo;
3002 Float_t xs4x = var.xxvc;
3003 Float_t ys4x = var.yxvc - 0.3250*var.sfy;
3004 Float_t xs4y = var.xyvc;
3005 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
3006 Float_t ws4 = 0.010;
3007 //
3008 // Y-view
3009 //
3010 Float_t s4p = 0.1606667;
3011 Int_t ocolo = 0;
3012 TPolyLine *fs4y[3];
3013 for ( Int_t j=0; j<3; j++){
3014 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
3015 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3016 Float_t xc[5];
3017 Float_t yc[5];
3018 for (Int_t i = 0; i<5 ; i++) {
3019 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
3020 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
3021 };
3022 fs4y[j] = new TPolyLine(5,xc,yc);
3023 fs4y[j]->SetLineColor(1);
3024 if ( var.bw ){
3025 colo = -1;
3026 } else {
3027 colo = 1;
3028 };
3029 ColorMIP(ms4[j],colo);
3030 //
3031 if ( colo != 10 ) ocolo = colo;
3032 //
3033 fs4y[j]->SetFillColor(colo);
3034 fs4y[j]->SetLineWidth(1);
3035 fs4y[j]->Draw("f");
3036 fs4y[j]->Draw();
3037 };
3038 //
3039 // X-view
3040 //
3041 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
3042 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3043 Float_t xc[5];
3044 Float_t yc[5];
3045 for (Int_t i = 0; i<5 ; i++) {
3046 xc[i]= xs4x + xc1[i]*var.nds4;
3047 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
3048 };
3049 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
3050 fs4x->SetLineColor(1);
3051 fs4x->SetFillColor(ocolo);
3052 fs4x->SetLineWidth(1);
3053 fs4x->Draw("f");
3054 fs4x->Draw();
3055 }
3056
3057 // void ShowCaloL1(Int_t i, TTree *otr, Variables & var){
3058 // //
3059 // CalorimeterLevel1 *calo = new CalorimeterLevel1();
3060 // otr->SetBranchAddress("CaloLevel1.Event", &calo);
3061 // if ( !var.nosig ) otr->GetEntry(i);
3062 // //
3063 // // Book the histograms:
3064 // //
3065 // //
3066 // stringstream xview;
3067 // stringstream yview;
3068 // xview.str("");
3069 // yview.str("");
3070 // xview << "x-view event " << (i+1);
3071 // yview << "y-view event " << (i+1);
3072 // gDirectory->Delete(xview.str().c_str());
3073 // gDirectory->Delete(yview.str().c_str());
3074 // TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3075 // TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3076 // Xview->GetYaxis()->SetLabelColor(10);
3077 // Yview->GetYaxis()->SetLabelColor(10);
3078 // //
3079 // // figures:
3080 // //
3081 // Int_t bgcolor = 10;
3082 // TPad *pd1 = new TPad("calox","This is pad1",var.xxvc-0.154*var.sfx,var.yxvc-0.3645*var.sfy,var.xxvc+0.154*var.sfx,var.yxvc-0.1200*var.sfy,bgcolor);
3083 // TPad *pd2 = new TPad("caloy","This is pad2",var.xyvc-0.154*var.sfx,var.yyvc-0.3645*var.sfy,var.xyvc+0.154*var.sfx,var.yyvc-0.1200*var.sfy,bgcolor);
3084
3085 // pd1->SetFillStyle(4000);
3086 // pd1->SetFillColor(0);
3087 // pd1->SetFrameFillStyle(4000);
3088 // pd2->SetFillStyle(4000);
3089 // pd2->SetFillColor(0);
3090 // pd2->SetFrameFillStyle(4000);
3091
3092 // TLatex *t=new TLatex();
3093 // t->SetTextFont(32);
3094 // t->SetTextColor(1);
3095 // t->SetTextSize(0.03);
3096 // t->SetTextAlign(12);
3097 // pd1->Range(0.,0.,1.,1.);
3098 // pd2->Range(0.,0.,1.,1.);
3099 // pd1->SetTicks();
3100 // pd2->SetTicks();
3101 // pd1->Draw();
3102 // pd2->Draw();
3103
3104 // pd1->cd();
3105 // gStyle->SetOptStat(0);
3106 // Xview->GetYaxis()->SetTitleOffset(0.5);
3107 // Xview->SetFillColor(bgcolor);
3108 // Xview->Fill(1.,1.,1.);
3109 // Xview->Draw("box");
3110 // pd1->Update();
3111 // pd2->cd();
3112 // gStyle->SetOptStat(0);
3113 // Yview->GetYaxis()->SetTitleOffset(0.5);
3114 // Yview->SetFillColor(bgcolor);
3115 // Yview->Fill(1.,1.,1.);
3116 // Yview->Draw("box");
3117 // pd2->Update();
3118
3119 // //
3120 // // run over views and planes
3121 // //
3122 // stringstream xvev;
3123 // stringstream yvev;
3124 // for (Int_t m = 0; m < 22; m++){
3125 // for (Int_t l = 0; l < 2; l++){
3126 // for (Int_t n = 0; n < 96; n++){
3127 // if ( calo->estrip[l][m][n] > 0.7 ) {
3128 // //
3129 // // OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course)
3130 // //
3131 // // if ( l == 0 && m == 21 ) printf(" xpos n=%i calo bottom: %f \n",n,(n*2.44-117.12)/10.);
3132 // Int_t colo;
3133 // if ( var.bw ){
3134 // colo = -1;
3135 // } else {
3136 // colo = 1;
3137 // };
3138 // ColorMIP(calo->estrip[l][m][n],colo);
3139 // if ( l == 0 && !var.nosig ) {
3140 // xvev.str("");
3141 // xvev << "x-view event " << n;
3142 // xvev << " " << m;
3143 // xvev << " " << l;
3144 // gDirectory->Delete(xvev.str().c_str());
3145 // TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3146 // Xview->SetFillColor(colo);
3147 // Xview->Fill(n,21-m,1.);
3148 // pd1->cd();
3149 // Xview->Draw("box same");
3150 // };
3151 // if ( l == 1 && !var.nosig ) {
3152 // yvev.str("");
3153 // yvev << "y-view event " << n;
3154 // yvev << " " << m;
3155 // yvev << " " << l;
3156 // gDirectory->Delete(yvev.str().c_str());
3157 // TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3158 // Yview->SetFillColor(colo);
3159 // Yview->Fill(95-n,21-m,1.);
3160 // pd2->cd();
3161 // Yview->Draw("box same");
3162 // };
3163 // };
3164 // };
3165 // };
3166 // };
3167 // pd1->Update();
3168 // pd2->Update();
3169 // var.qtot=(int)calo->qtot;
3170 // var.nstrip=(int)calo->nstrip;
3171 // }
3172
3173 // void ShowTRKL1(Int_t evno, TTree *ttr1, Variables & var, PAMevcontrol *pamgui){
3174 // //
3175 // Int_t syncro = 1;
3176 // Int_t itr = evno;
3177 // Int_t trnevents = ttr1->GetEntries();
3178 // Int_t nodata = 0;
3179 // Int_t pktnum = 0;
3180 // Int_t obt = 0;
3181 // trkcalosync: struct Tracklev1 trk;
3182 // struct CTracklev1 ev2;
3183 // settrklev1(ttr1,trk);
3184 // if ( itr >= trnevents ){
3185 // printf(" WARNING: no more tracker level1 data.\n");
3186 // pamgui->DIALOG(1," No more tracker level1 data ");
3187 // nodata = 1;
3188 // goto goon;
3189 // };
3190 // if ( !var.nosig ) ttr1->GetEntry(itr);
3191 // accesstrklev1(trk,ev2);
3192 // pktnum = var.headc;
3193 // obt = var.etime;
3194 // if ( pktnum != ev2.pkt_num1 || obt != ev2.obt1 ){
3195 // if ( pktnum > ev2.pkt_num1 || obt > ev2.obt1 ){
3196 // itr++;
3197 // if ( syncro ){
3198 // printf(" WARNING: lost sync! try to recover... \n");
3199 // pamgui->DIALOG(1," Lost sync! try to recover ");
3200 // };
3201 // syncro = 0;
3202 // goto trkcalosync;
3203 // };
3204 // if ( pktnum < ev2.pkt_num1 || obt < ev2.obt1 ){
3205 // printf(" WARNING: no tracker level2 data. \n");
3206 // pamgui->DIALOG(1," No more tracker level2 data ");
3207 // nodata = 1;
3208 // goto goon;
3209 // };
3210 // };
3211 // //
3212 // if ( !syncro ) {
3213 // printf(" ...synchronization recovered! \n");
3214 // pamgui->DIALOG(0," Synchronization recovered! ");
3215 // };
3216 // syncro = 1;
3217 // //
3218 // goon: struct Trklev1 ev;
3219 // ev.good1 = (Bool_t)ev2.good1;
3220 // ev.nev1 = ev2.nev1;
3221 // ev.pkt_type1 = ev2.pkt_type1;
3222 // ev.pkt_num1 = ev2.pkt_num1;
3223 // ev.obt1 = ev2.obt1;
3224 // ev.which_calib1 = ev2.which_calib1;
3225 // ev.nclstr1 = ev2.nclstr1;
3226 // ev.totcllength = ev2.totcllength;
3227 // for ( Int_t ii = 0 ; ii<8500; ii++){
3228 // ev.clsignal[ii] = ev2.clsignal[ii];
3229 // };
3230 // for ( Int_t ii = 0 ; ii<500 ; ii++){
3231 // ev.view[ii] = (Int_t)ev2.view[ii];
3232 // ev.ladder[ii] = (Int_t)ev2.ladder[ii];
3233 // ev.maxs[ii] = (Int_t)ev2.maxs[ii];
3234 // ev.mult[ii] = (Int_t)ev2.mult[ii];
3235 // ev.dedx[ii] = (Float_t)ev2.dedx[ii];
3236 // ev.indstart[ii] = (Int_t)ev2.indstart[ii];
3237 // ev.indmax[ii] = (Int_t)ev2.indmax[ii];
3238 // };
3239 // for ( Int_t ii = 0 ; ii<12 ; ii++){
3240 // for ( Int_t ij = 0 ; ij<24 ; ij++){
3241 // ev.cnev[ij][ii] = ev2.cnev[ii][ij];
3242 // };
3243 // };
3244 // for ( Int_t ii = 0 ; ii<12 ; ii++){
3245 // for ( Int_t ij = 0 ; ij<3072 ; ij++){
3246 // ev.sigma_matrix[ij][ii] = var.DSPsig_par[ii][ij];
3247 // };
3248 // };
3249 // //
3250 // // find the cluster, position and signal with the external fortran routine. We must pass the common.
3251 // //
3252 // if ( !nodata ){
3253 // projectlev1(ev);
3254 // } else {
3255 // ev.nclstr1 = 0;
3256 // };
3257 // //
3258 // // a matrix of pads for each view x and y
3259 // //
3260 // TPad *trkpad[12];
3261 // Int_t magcol = 0;
3262 // TPad *mag1 = 0;
3263 // TPad *mag2 = 0;
3264 // for (Int_t n = 0; n<12; n++){
3265 // stringstream spd;
3266 // spd.str("");
3267 // spd << "pd1" << n;
3268 // gDirectory->Delete(spd.str().c_str());
3269 // spd.str("");
3270 // spd << "pd2" << n;
3271 // gDirectory->Delete(spd.str().c_str());
3272 // spd.str("");
3273 // spd << "pd3" << n;
3274 // gDirectory->Delete(spd.str().c_str());
3275 // spd.str("");
3276 // spd << "pd4" << n;
3277 // gDirectory->Delete(spd.str().c_str());
3278 // spd.str("");
3279 // spd << "pd5" << n;
3280 // gDirectory->Delete(spd.str().c_str());
3281 // spd.str("");
3282 // spd << "pd6" << n;
3283 // gDirectory->Delete(spd.str().c_str());
3284 // stringstream bpd;
3285 // bpd.str("");
3286 // if ( n%2 ) {
3287 // Float_t posx = var.xxvc;
3288 // Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
3289 // spd.str("");
3290 // spd << "pd1" << n;
3291 // bpd.str("");
3292 // bpd << "bd1" << n;
3293 // trkpad[n] = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-0.081*var.sfx,posy,posx+0.081*var.sfx,posy+0.089*var.sfy,10);
3294 // trkpad[n]->SetFillStyle(4000);
3295 // trkpad[n]->SetFillColor(0);
3296 // trkpad[n]->SetFrameFillStyle(4000);
3297 // trkpad[n]->Draw();
3298 // if ( n != 1 ) {
3299 // if ( var.bw ) {
3300 // magcol = 1;
3301 // } else {
3302 // magcol = 45;
3303 // };
3304 // spd.str("");
3305 // spd << "pd2" << n;
3306 // bpd.str("");
3307 // bpd << "bd2" << n;
3308 // mag1 = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-(0.039+0.081)*var.sfx,posy+0.004*var.sfy,posx-0.081*var.sfx,posy+0.088*var.sfy,magcol);
3309 // if ( var.bw ) mag1->SetFillStyle(3001);
3310 // mag1->Draw();
3311 // spd.str("");
3312 // spd << "pd3" << n;
3313 // bpd.str("");
3314 // bpd << "bd3" << n;
3315 // mag2 = new TPad(spd.str().c_str(),bpd.str().c_str(),posx+0.081*var.sfx,posy+0.004*var.sfy,posx+(0.081+0.039)*var.sfx,posy+0.088*var.sfy,magcol);
3316 // if ( var.bw ) mag2->SetFillStyle(3001);
3317 // mag2->Draw();
3318 // };
3319 // } else {
3320 // Float_t posx = var.xyvc;
3321 // Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
3322 // spd.str("");
3323 // spd << "pd4" << n;
3324 // bpd.str("");
3325 // bpd << "bd4" << n;
3326 // trkpad[n] = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-0.07*var.sfx,posy,posx+0.07*var.sfx,posy+0.089*var.sfy,10);
3327 // trkpad[n]->SetFillStyle(4000);
3328 // trkpad[n]->SetFillColor(0);
3329 // trkpad[n]->SetFrameFillStyle(4000);
3330 // trkpad[n]->Draw();
3331 // if ( n != 0 ) {
3332 // if ( var.bw ) {
3333 // magcol = 1;
3334 // } else {
3335 // magcol = 45;
3336 // };
3337 // spd.str("");
3338 // spd << "pd5" << n;
3339 // bpd.str("");
3340 // bpd << "bd5" << n;
3341 // mag1 = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-(0.048+0.066)*var.sfx,posy+0.004*var.sfy,posx-0.066*var.sfx,posy+0.088*var.sfy,magcol);
3342 // if ( var.bw ) mag1->SetFillStyle(3001);
3343 // mag1->Draw();
3344 // spd.str("");
3345 // spd << "pd6" << n;
3346 // bpd.str("");
3347 // bpd << "bd6" << n;
3348 // mag2 = new TPad(spd.str().c_str(),bpd.str().c_str(),posx+0.066*var.sfx,posy+0.004*var.sfy,posx+(0.066+0.048)*var.sfx,posy+0.088*var.sfy,magcol);
3349 // if ( var.bw ) mag2->SetFillStyle(3001);
3350 // mag2->Draw();
3351 // };
3352 // };
3353 // };
3354 // TPad *trplv;
3355 // gDirectory->Delete("trkplv");
3356 // trplv = new TPad("trkplv","trkplv",var.xcat-0.07*var.sfx,var.ycat-0.081*var.sfy,var.xcat+0.07*var.sfx,var.ycat+0.081*var.sfy,10);
3357 // trplv->SetFillStyle(4000);
3358 // trplv->SetFillColor(0);
3359 // trplv->SetFrameFillStyle(4000);
3360 // trplv->Draw();
3361 // Int_t sigcol1 = 17;
3362 // Int_t sigcol2 = 15;
3363 // Int_t linecol = 13;
3364 // if ( var.bw ) {
3365 // sigcol1 = 17;
3366 // sigcol2 = 15;
3367 // linecol = 13;
3368 // } else {
3369 // sigcol1 = 32;
3370 // sigcol2 = 38;
3371 // linecol = 42;
3372 // };
3373 // //
3374 // TLine *linea = 0;
3375 // TLine *linea1x = 0;
3376 // TLine *linea2x = 0;
3377 // TLine *linea1y = 0;
3378 // for (Int_t l = 0; l<12; l++){
3379 // trkpad[l]->cd();
3380 // if ( l%2 ) {
3381 // trkpad[l]->Range(-8.1,0.,8.1,1000.);
3382 // linea = new TLine(-8.1,10.,8.1,10.);
3383 // linea1x = new TLine(-2.7,10.,-2.7,30.);
3384 // linea2x = new TLine(2.7,10.,2.7,30.);
3385 // } else {
3386 // trkpad[l]->Range(-7.05,0.,7.05,1000.);
3387 // linea = new TLine(-7.05,10.,7.05,10.);
3388 // linea1y = new TLine(0.,10.,0.,30.);
3389 // };
3390 // linea->SetLineWidth(2);
3391 // linea->SetLineColor(linecol);
3392 // linea->Draw();
3393 // if ( l%2 ) {
3394 // linea1x->SetLineWidth(1);
3395 // linea1x->SetLineColor(1);
3396 // linea1x->Draw();
3397 // linea2x->SetLineWidth(1);
3398 // linea2x->SetLineColor(1);
3399 // linea2x->Draw();
3400 // } else {
3401 // linea1y->SetLineWidth(1);
3402 // linea1y->SetLineColor(1);
3403 // linea1y->Draw();
3404 // };
3405 // //
3406 // };
3407 // Int_t planeno = 0;
3408 // if ( !var.nosig ){
3409 // planeno = 0;
3410 // Float_t x = 0.;
3411 // Float_t y = 0.;
3412 // for (Int_t l = 0; l<ev.nclstr1; l++){
3413 // for (Int_t m = 0; m<2; m++){
3414 // if ( ev.clz[l][m] != 0. ){
3415 // if ( ev.clz[l][m] > 20. ) planeno = 1 - m;
3416 // if ( ev.clz[l][m] < 20. && ev.clz[l][m] > 10. ) planeno = 3 - m;
3417 // if ( ev.clz[l][m] < 10. && ev.clz[l][m] > 0. ) planeno = 5 - m;
3418 // if ( ev.clz[l][m] < 0. && ev.clz[l][m] > -10. ) planeno = 7 - m;
3419 // if ( ev.clz[l][m] <-10. && ev.clz[l][m] >-20. ) planeno = 9 - m;
3420 // if ( ev.clz[l][m] < -20. ) planeno = 11 - m;
3421 // //
3422 // if ( (planeno+1)%2 ){
3423 // trkpad[planeno]->cd();
3424 // trkpad[planeno]->Range(-7.05,0.,7.05,1000.);
3425 // if ( ev.cls[l][m] != 0. ){
3426 // x = ev.clp[l][1];
3427 // y = ev.cls[l][m];
3428 // linea = new TLine(x,0.,x,y);
3429 // linea->SetLineWidth(3);
3430 // linea->SetLineColor(sigcol1);
3431 // linea->Draw();
3432 // //
3433 // x = ev.clp[l][2];
3434 // linea = new TLine(x,0.,x,y);
3435 // linea->SetLineWidth(3);
3436 // linea->SetLineColor(sigcol2);
3437 // linea->Draw();
3438 // var.ncly++;
3439 // };
3440 // } else {
3441 // trkpad[planeno]->cd();
3442 // trkpad[planeno]->Range(-8.1,0.,8.1,1000.);
3443 // if ( ev.cls[l][m] != 0. ){
3444 // x = ev.clp[l][0];
3445 // y = ev.cls[l][m];
3446 // linea = new TLine(x,0.,x,y);
3447 // linea->SetLineWidth(3);
3448 // linea->SetLineColor(sigcol2);
3449 // linea->Draw();
3450 // var.nclx++;
3451 // };
3452 // };
3453 // };
3454 // };
3455 // };
3456 // };
3457 // //
3458 // // Show track in the plane view!
3459 // //
3460 // Float_t xh[6];
3461 // Float_t yh1[6];
3462 // Float_t yh2[6];
3463 // Float_t mag[6];
3464 // Float_t xsig[6];
3465 // Float_t ysig[6];
3466 // Int_t mask[6];
3467 // for (Int_t l = 0; l<6; l++ ){
3468 // xh[l] = 0.;
3469 // yh1[l] = 0.;
3470 // yh2[l] = 0.;
3471 // mag[l] = 0.;
3472 // xsig[l] = 0.;
3473 // ysig[l] = 0.;
3474 // mask[l] = 0;
3475 // };
3476 // Int_t ncro = 0;
3477 // //
3478 // // return;
3479 // //
3480 // for (Int_t l = 0; l<ev.nclstr1; l++){
3481 // for (Int_t m = 0; m<2; m++){
3482 // if ( ev.clz[l][m] != 0. ){
3483 // if ( ev.clz[l][m] > 20. ) {
3484 // planeno = 1 - m;
3485 // ncro = 0;
3486 // };
3487 // if ( ev.clz[l][m] < 20. && ev.clz[l][m] > 10. ) {
3488 // planeno = 3 - m;
3489 // ncro = 1;
3490 // };
3491 // if ( ev.clz[l][m] < 10. && ev.clz[l][m] > 0. ) {
3492 // planeno = 5 - m;
3493 // ncro = 2;
3494 // };
3495 // if ( ev.clz[l][m] < 0. && ev.clz[l][m] > -10. ) {
3496 // planeno = 7 - m;
3497 // ncro = 3;
3498 // };
3499 // if ( ev.clz[l][m] <-10. && ev.clz[l][m] >-20. ) {
3500 // planeno = 9 - m;
3501 // ncro = 4;
3502 // };
3503 // if ( ev.clz[l][m] < -20. ) {
3504 // planeno = 11 - m;
3505 // ncro = 5;
3506 // }
3507 // //
3508 // mag[ncro] = ((float)planeno+1.)/5.;
3509 // if ( (planeno+1)%2 ){
3510 // if ( ev.cls[l][m] > ysig[ncro] ){
3511 // ysig[ncro] = ev.cls[l][m];
3512 // yh1[ncro] = ev.clp[l][1];
3513 // yh2[ncro] = ev.clp[l][2];
3514 // };
3515 // } else {
3516 // if ( ev.cls[l][m] > xsig[ncro] ){
3517 // xsig[ncro] = ev.cls[l][m];
3518 // xh[ncro] = ev.clp[l][0];
3519 // };
3520 // };
3521 // if ( ysig[ncro] > 0. && xsig[ncro] > 0. ) {
3522 // mask[ncro] = 1;
3523 // };
3524 // };
3525 // };
3526 // };
3527 // //
3528 // // Draw crosses
3529 // //
3530 // if ( var.AC ) {
3531 // trplv->cd();
3532 // trplv->Range(-7.05,-8.1,7.05,8.1);
3533 // for ( Int_t i = 0; i<6; i++){
3534 // if ( mask[i] ){
3535 // //
3536 // Float_t cdx = (0.55/mag[i])*var.sfx;
3537 // Float_t cdy = (0.55/mag[i])*var.sfy;
3538 // Float_t lwx = (0.019)*var.sfy;
3539 // Float_t lwy = (0.019)*var.sfx;
3540 // //
3541 // linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
3542 // linea->SetLineWidth((int)lwx);
3543 // linea->SetLineColor(sigcol1);
3544 // linea->Draw();
3545 // linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
3546 // linea->SetLineWidth((int)lwy);
3547 // linea->SetLineColor(sigcol1);
3548 // linea->Draw();
3549 // //
3550 // linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
3551 // linea->SetLineWidth((int)lwx);
3552 // linea->SetLineColor(sigcol2);
3553 // linea->Draw();
3554 // linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
3555 // linea->SetLineWidth((int)lwy);
3556 // linea->SetLineColor(sigcol2);
3557 // linea->Draw();
3558 // };
3559 // };
3560 // };
3561 // }
3562
3563 void ShowTOFGENL1(Int_t j, TTree *otr, Variables & var){
3564 //
3565 // the channels MAP:
3566 //
3567 Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
3568 Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
3569 Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
3570 Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
3571
3572 Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
3573 Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
3574 Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
3575 Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
3576
3577 Int_t ch21a[2] = { 0, 0};
3578 Int_t hb21a[2] = { 0, 4};
3579 Int_t ch21b[2] = { 1, 0};
3580 Int_t hb21b[2] = { 8, 6};
3581
3582 Int_t ch22a[2] = { 0, 0};
3583 Int_t hb22a[2] = { 2, 8};
3584 Int_t ch22b[2] = { 1, 0};
3585 Int_t hb22b[2] = { 10, 10};
3586
3587 Int_t ch31a[3] = { 1, 2, 2};
3588 Int_t hb31a[3] = { 6, 8, 10};
3589 Int_t ch31b[3] = { 1, 1, 1};
3590 Int_t hb31b[3] = { 4, 2, 0};
3591
3592 Int_t ch32a[3] = { 2, 2, 3};
3593 Int_t hb32a[3] = { 0, 4, 8};
3594 Int_t ch32b[3] = { 2, 2, 3};
3595 Int_t hb32b[3] = { 2, 6, 10};
3596
3597 //
3598 pamela::tof::TofEvent *tof = 0;
3599 otr->SetBranchAddress("Tof", &tof);
3600 if ( !var.nosig ) otr->GetEntry(j);
3601 //
3602 // ADC values
3603 //
3604 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
3605 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
3606 Float_t ms21a[2] = {0.,0.};
3607 Float_t ms22a[2] = {0.,0.};
3608 Float_t ms31a[3] = {0.,0.,0.};
3609 Float_t ms32a[3] = {0.,0.,0.};
3610 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
3611 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
3612 Float_t ms21b[2] = {0.,0.};
3613 Float_t ms22b[2] = {0.,0.};
3614 Float_t ms31b[3] = {0.,0.,0.};
3615 Float_t ms32b[3] = {0.,0.,0.};
3616 //
3617 Float_t xp11[8];
3618 Float_t A11[8] = {-19.,-9.6,-25.7,-13.1,-30.9,-21.1,-11.7,-15.9};
3619 Float_t B11[8] = {-2.6,-2.6,-2.3,-2.4,-2.4,-2.8,-2.75,-2.5};
3620 Float_t E11[8] = {2.6,2.6,2.6,2.6,2.6,2.6,2.6,2.6};
3621 Float_t xp12[6];
3622 Float_t A12[6] = {11.6,16.6,5.9,-22.2,-18.0,-14.2};
3623 Float_t B12[6] = {-2.309,-2.424,-1.958,-2.092,-2.241,-2.144};
3624 Float_t E12[6] = {2.6,2.6,2.6,2.6,2.6,2.6};
3625 Float_t xp21[2];
3626 Float_t A21[2] = {12.5, 21.7};
3627 Float_t B21[2] = {-1.492,-1.519};
3628 Float_t E21[2] = {2.2,2.2};
3629 Float_t xp22[2];
3630 Float_t A22[2] = {-27.0, -45.8};
3631 Float_t B22[2] = {-1.897,-1.477};
3632 Float_t E22[2] = {2.9,2.9};
3633 Float_t xp31[3];
3634 Float_t A31[3] = {-25.1, -41.4, -33.9};
3635 Float_t B31[3] = {-3.374,-3.793,-3.495};
3636 Float_t E31[3] = {1.2,1.2,1.2};
3637 Float_t xp32[3];
3638 Float_t A32[3] = {1.3, 3.9, -22.0};
3639 Float_t B32[3] = {-3.134,-3.526,-3.417};
3640 Float_t E32[3] = {2.3,2.3,2.3};
3641 //
3642 // TDC info for each PMT
3643 //
3644 Float_t mt11[2][8];
3645 Float_t mt12[2][6];
3646 Float_t mt21[2][2];
3647 Float_t mt22[2][2];
3648 Float_t mt31[2][3];
3649 Float_t mt32[2][3];
3650 Int_t noadc = 12;
3651 if ( var.bw ){
3652 noadc = 12;
3653 } else {
3654 noadc = 41;
3655 };
3656 //
3657 Int_t ii = 0;
3658 if ( var.nosig ) goto draw;
3659 for ( Int_t i = 0; i<8; i++ ) {
3660 mt11[0][i] = tof->tdc[ch11a[i]][hb11a[i]];
3661 mt11[1][i] = tof->tdc[ch11b[i]][hb11b[i]];
3662 ms11a[i] = tof->adc[ch11a[i]][hb11a[i]];
3663 ms11b[i] = tof->adc[ch11b[i]][hb11b[i]];
3664 xp11[i] = ( -A11[i] + (mt11[0][i]-mt11[1][i]) / 2. ) / B11[i] ;
3665 if ( ms11a[i] == 4095. ) {
3666 ms11a[i] = 0.;
3667 } else {
3668 ms11a[i] = 1.;
3669 };
3670 if ( ms11b[i] == 4095. ) {
3671 ms11b[i] = 0.;
3672 } else {
3673 ms11b[i] = 1.;
3674 };
3675 };
3676 for ( Int_t i = 0; i<6; i++ ) {
3677 mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]];
3678 mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]];
3679 ms12a[i] = tof->adc[ch12a[i]][hb12a[i]];
3680 ms12b[i] = tof->adc[ch12b[i]][hb12b[i]];
3681 xp12[i] = ( -A12[i] + (mt12[0][i]-mt12[1][i]) / 2. ) / B12[i] ;
3682 if ( ms12a[i] == 4095. ){
3683 ms12a[i] = 0.;
3684 } else {
3685 ms12a[i] = 1.;
3686 };
3687 if ( ms12b[i] == 4095. ){
3688 ms12b[i] = 0.;
3689 } else {
3690 ms12b[i] = 1.;
3691 };
3692 };
3693 ii = 2;
3694 for ( Int_t i = 0; i<2; i++ ) {
3695 ii--;
3696 mt21[0][ii] = tof->tdc[ch21a[i]][hb21a[i]];
3697 mt21[1][ii] = tof->tdc[ch21b[i]][hb21b[i]];
3698 ms21a[ii] = tof->adc[ch21a[i]][hb21a[i]];
3699 ms21b[ii] = tof->adc[ch21b[i]][hb21b[i]];
3700 xp21[ii] = ( -A21[ii] + (mt21[0][ii]-mt21[1][ii]) / 2. ) / B21[ii] ;
3701 if ( ms21a[ii] == 4095. ){
3702 ms21a[ii] = 0.;
3703 } else {
3704 ms21a[ii] = 1.;
3705 };
3706 if ( ms21b[ii] == 4095. ){
3707 ms21b[ii] = 0.;
3708 } else {
3709 ms21b[ii] = 1.;
3710 };
3711 };
3712 for ( Int_t i = 0; i<2; i++ ) {
3713 mt22[0][i] = tof->tdc[ch22a[i]][hb22a[i]];
3714 mt22[1][i] = tof->tdc[ch22b[i]][hb22b[i]];
3715 ms22a[i] = tof->adc[ch22a[i]][hb22a[i]];
3716 ms22b[i] = tof->adc[ch22b[i]][hb22b[i]];
3717 xp22[i] = ( -A22[i] + (mt22[0][i]-mt22[1][i]) / 2. ) / B22[i] ;
3718 if ( ms22a[i] == 4095. ){
3719 ms22a[i] = 0.;
3720 } else {
3721 ms22a[i] = 1.;
3722 };
3723 if ( ms22b[i] == 4095. ){
3724 ms22b[i] = 0.;
3725 } else {
3726 ms22b[i] = 1.;
3727 };
3728 };
3729 for ( Int_t i = 0; i<3; i++ ) {
3730 mt31[0][i] = tof->tdc[ch31a[i]][hb31a[i]];
3731 mt31[1][i] = tof->tdc[ch31b[i]][hb31b[i]];
3732 ms31a[i] = tof->adc[ch31a[i]][hb31a[i]];
3733 ms31b[i] = tof->adc[ch31b[i]][hb31b[i]];
3734 xp31[i] = ( -A31[i] + (mt31[0][i]-mt31[1][i]) / 2. ) / B31[i] ;
3735 if ( ms31a[i] == 4095. ){
3736 ms31a[i] = 0.;
3737 } else {
3738 ms31a[i] = 1.;
3739 };
3740 if ( ms31b[i] == 4095. ){
3741 ms31b[i] = 0.;
3742 } else {
3743 ms31b[i] = 1.;
3744 };
3745 };
3746 for ( Int_t i = 0; i<3; i++ ) {
3747 mt32[0][i] = tof->tdc[ch32a[i]][hb32a[i]];
3748 mt32[1][i] = tof->tdc[ch32b[i]][hb32b[i]];
3749 ms32a[i] = tof->adc[ch32a[i]][hb32a[i]];
3750 ms32b[i] = tof->adc[ch32b[i]][hb32b[i]];
3751 xp32[i] = ( -A32[i] + (mt32[0][i]-mt32[1][i]) / 2. ) / B32[i] ;
3752 if ( ms32a[i] == 4095. ){
3753 ms32a[i] = 0.;
3754 } else {
3755 ms32a[i] = 1.;
3756 };
3757 if ( ms32b[i] == 4095. ){
3758 ms32b[i] = 0.;
3759 } else {
3760 ms32b[i] = 1.;
3761 };
3762 };
3763 //
3764 draw: Int_t colo = 0;
3765 Int_t ocolo = 0;
3766 Float_t xs2x = var.xxvc;
3767 Float_t ys2x = var.yxvc + 0.36*var.sfy;
3768 Float_t xs2y = var.xyvc;
3769 Float_t ys2y = var.yyvc + 0.36*var.sfy;
3770 Float_t ws2 = 0.005;
3771 Float_t ws13 = 0.007;
3772 //
3773 // S11 X-view
3774 //
3775 Float_t s11p = 0.051;
3776 ocolo = 10;
3777 TPolyLine *ftof11x[8];
3778 for ( Int_t j=0; j<8; j++){
3779 Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
3780 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
3781 Float_t nxc[5];
3782 Float_t nyc[5];
3783 for (Int_t i = 0; i<5 ; i++) {
3784 nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
3785 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3786 };
3787 ftof11x[j] = new TPolyLine(5,nxc,nyc);
3788 ftof11x[j]->SetLineColor(1);
3789 if ( var.bw ){
3790 colo = -1;
3791 } else {
3792 colo = 1;
3793 };
3794 ColorMIP(ms11a[j]+ms11b[j],colo);
3795 //
3796 if ( colo != 10 ) ocolo = colo;
3797 //
3798 ftof11x[j]->SetFillColor(colo);
3799 ftof11x[j]->SetLineWidth(1);
3800 ftof11x[j]->Draw("f");
3801 ftof11x[j]->Draw();
3802 };
3803 //
3804 // S11 Y-view
3805 //
3806 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
3807 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
3808 Float_t nxc[5];
3809 Float_t nyc[5];
3810 for (Int_t i = 0; i<5 ; i++) {
3811 nxc[i]= xs2y + nxc1[i]*var.sfx;
3812 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3813 };
3814 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
3815 ftof11y->SetFillStyle(4000);
3816 ftof11y->SetFillColor(0);
3817 ftof11y->SetLineColor(1);
3818 ftof11y->SetLineWidth(1);
3819 ftof11y->Draw("f");
3820 ftof11y->Draw();
3821 TPolyLine *sftof11[8];
3822 for ( Int_t j=0; j<8; j++){
3823 if ( (mt11[0][j]<4095. || mt11[1][j]<4095.) && !var.nosig ){
3824 if ( ocolo == 10 ) ocolo = noadc;
3825 Float_t lowp = (xp11[j]-E11[j])/100.;
3826 Float_t higp = (xp11[j]+E11[j])/100.;
3827 if ( lowp < -0.164 ) lowp = -0.164;
3828 if ( higp > 0.164 ) higp = 0.164;
3829 if ( lowp < higp ){
3830 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3831 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
3832 Float_t nxc[5];
3833 Float_t nyc[5];
3834 for (Int_t i = 0; i<5 ; i++) {
3835 nxc[i]= xs2y + nxc1[i]*var.sfx;
3836 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3837 };
3838 sftof11[j] = new TPolyLine(5,nxc,nyc);
3839 sftof11[j]->SetLineColor(ocolo);
3840 sftof11[j]->SetFillColor(ocolo);
3841 sftof11[j]->SetLineWidth(1);
3842 sftof11[j]->Draw("f");
3843 sftof11[j]->Draw();
3844 };
3845 };
3846 };
3847
3848 //
3849 // S12 Y-view
3850 //
3851 Float_t s12p = 0.055;
3852 ocolo = 10;
3853 TPolyLine *ftof12y[6];
3854 for ( Int_t j=0; j<6; j++){
3855 Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
3856 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
3857 Float_t nxc[5];
3858 Float_t nyc[5];
3859 for (Int_t i = 0; i<5 ; i++) {
3860 nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
3861 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3862 };
3863 ftof12y[j] = new TPolyLine(5,nxc,nyc);
3864 ftof12y[j]->SetLineColor(1);
3865 if ( var.bw ){
3866 colo = -1;
3867 } else {
3868 colo = 1;
3869 };
3870 ColorMIP(ms12a[j]+ms12b[j],colo);
3871 //
3872 if ( colo != 10 ) ocolo = colo;
3873 //
3874 ftof12y[j]->SetFillColor(colo);
3875 ftof12y[j]->SetLineWidth(1);
3876 ftof12y[j]->Draw("f");
3877 ftof12y[j]->Draw();
3878 };
3879 //
3880 // S12 X-view
3881 //
3882 if ( true ){
3883 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
3884 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
3885 Float_t nxc[5];
3886 Float_t nyc[5];
3887 for (Int_t i = 0; i<5 ; i++) {
3888 nxc[i]= xs2x + nxc1[i]*var.sfx;
3889 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3890 };
3891 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
3892 ftof12x->SetLineColor(1);
3893 ftof12x->SetFillStyle(4000);
3894 ftof12x->SetFillColor(0);
3895 ftof12x->SetLineWidth(1);
3896 ftof12x->Draw("f");
3897 ftof12x->Draw();
3898 TPolyLine *sftof12[6];
3899 for ( Int_t j=0; j<6; j++){
3900 if ( (mt12[0][j]<4095. || mt12[1][j]<4095.) && !var.nosig ){
3901 if ( ocolo == 10 ) ocolo = noadc;
3902 Float_t lowp = (xp12[j]-E12[j])/100.;
3903 Float_t higp = (xp12[j]+E12[j])/100.;
3904 if ( lowp < -0.203 ) lowp = -0.203;
3905 if ( higp > 0.203 ) higp = 0.203;
3906 if ( lowp < higp ){
3907 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3908 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
3909 Float_t nxc[5];
3910 Float_t nyc[5];
3911 for (Int_t i = 0; i<5 ; i++) {
3912 nxc[i]= xs2x + nxc1[i]*var.sfx;
3913 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3914 };
3915 sftof12[j] = new TPolyLine(5,nxc,nyc);
3916 sftof12[j]->SetLineColor(ocolo);
3917 sftof12[j]->SetFillColor(ocolo);
3918 sftof12[j]->SetLineWidth(1);
3919 sftof12[j]->Draw("f");
3920 sftof12[j]->Draw();
3921 };
3922 };
3923 };
3924 };
3925 //
3926
3927 //
3928 // S21 Y-view
3929 //
3930 Float_t s21p = 0.075;
3931 ocolo = 10;
3932 TPolyLine *ftof21y[2];
3933 for ( Int_t j=0; j<2; j++){
3934 Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
3935 Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
3936 Float_t nxc[5];
3937 Float_t nyc[5];
3938 for (Int_t i = 0; i<5 ; i++) {
3939 nxc[i]= xs2y + nxc1[i]*var.sfx;
3940 nyc[i] = ys2y + nyc1[i]*var.sfy;
3941 };
3942 ftof21y[j] = new TPolyLine(5,nxc,nyc);
3943 ftof21y[j]->SetLineColor(1);
3944 if ( var.bw ){
3945 colo = -1;
3946 } else {
3947 colo = 1;
3948 };
3949 ColorMIP(ms21a[j]+ms21b[j],colo);
3950 //
3951 if ( colo != 10 ) ocolo = colo;
3952 //
3953 ftof21y[j]->SetFillColor(colo);
3954 ftof21y[j]->SetLineWidth(1);
3955 ftof21y[j]->Draw("f");
3956 ftof21y[j]->Draw();
3957 };
3958 //
3959 // S21 X-view
3960 //
3961 if ( true ){
3962 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
3963 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
3964 Float_t nxc[5];
3965 Float_t nyc[5];
3966 for (Int_t i = 0; i<5 ; i++) {
3967 nxc[i]= xs2x + nxc1[i]*var.sfx;
3968 nyc[i] = ys2x + nyc1[i]*var.sfy;
3969 };
3970 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
3971 ftof21x->SetLineColor(1);
3972 ftof21x->SetFillStyle(4000);
3973 ftof21x->SetFillColor(0);
3974 ftof21x->SetLineWidth(1);
3975 ftof21x->Draw("f");
3976 ftof21x->Draw();
3977 TPolyLine *sftof21[2];
3978 for ( Int_t j=0; j<2; j++){
3979 if ( (mt21[0][j]<4095. || mt21[1][j]<4095.) && !var.nosig ){
3980 if ( ocolo == 10 ) ocolo = noadc;
3981 Float_t lowp = (xp21[j]-E21[j])/100.;
3982 Float_t higp = (xp21[j]+E21[j])/100.;
3983 if ( lowp < -0.089 ) lowp = -0.089;
3984 if ( higp > 0.089 ) higp = 0.089;
3985 if ( lowp < higp ){
3986 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3987 Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
3988 Float_t nxc[5];
3989 Float_t nyc[5];
3990 for (Int_t i = 0; i<5 ; i++) {
3991 nxc[i]= xs2x + nxc1[i]*var.sfx;
3992 nyc[i] = ys2x + nyc1[i]*var.sfy;
3993 };
3994 sftof21[j] = new TPolyLine(5,nxc,nyc);
3995 sftof21[j]->SetLineColor(ocolo);
3996 sftof21[j]->SetFillColor(ocolo);
3997 sftof21[j]->SetLineWidth(1);
3998 sftof21[j]->Draw("f");
3999 sftof21[j]->Draw();
4000 };
4001 };
4002 };
4003 };
4004 //
4005
4006 //
4007 // S22 X-view
4008 //
4009 Float_t s22p = 0.090;
4010 ocolo = 10;
4011 TPolyLine *ftof22x[2];
4012 for ( Int_t j=0; j<2; j++){
4013 Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
4014 Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
4015 Float_t nxc[5];
4016 Float_t nyc[5];
4017 for (Int_t i = 0; i<5 ; i++) {
4018 nxc[i]= xs2x + nxc1[i]*var.sfx;
4019 nyc[i] = ys2x + nyc1[i]*var.sfy;
4020 };
4021 ftof22x[j] = new TPolyLine(5,nxc,nyc);
4022 ftof22x[j]->SetLineColor(1);
4023 if ( var.bw ){
4024 colo = -1;
4025 } else {
4026 colo = 1;
4027 };
4028 ColorMIP(ms22a[j]+ms22b[j],colo);
4029 //
4030 if ( colo != 10 ) ocolo = colo;
4031 //
4032 ftof22x[j]->SetFillColor(colo);
4033 ftof22x[j]->SetLineWidth(1);
4034 ftof22x[j]->Draw("f");
4035 ftof22x[j]->Draw();
4036 };
4037 //
4038 // S22 Y-view
4039 //
4040 if ( true ){
4041 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4042 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
4043 Float_t nxc[5];
4044 Float_t nyc[5];
4045 for (Int_t i = 0; i<5 ; i++) {
4046 nxc[i]= xs2y + nxc1[i]*var.sfx;
4047 nyc[i] = ys2y + nyc1[i]*var.sfy;
4048 };
4049 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
4050 ftof22y->SetLineColor(1);
4051 ftof22y->SetFillStyle(4000);
4052 ftof22y->SetFillColor(0);
4053 ftof22y->SetLineWidth(1);
4054 ftof22y->Draw("f");
4055 ftof22y->Draw();
4056 TPolyLine *sftof22[2];
4057 for ( Int_t j=0; j<2; j++){
4058 if ( (mt22[0][j]<4095. || mt22[1][j]<4095.) && !var.nosig ){
4059 if ( ocolo == 10 ) ocolo = noadc;
4060 Float_t lowp = (xp22[j]-E22[j])/100.;
4061 Float_t higp = (xp22[j]+E22[j])/100.;
4062 if ( lowp < -0.074 ) lowp = -0.074;
4063 if ( higp > 0.074 ) higp = 0.074;
4064 if ( lowp < higp ){
4065 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4066 Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
4067 Float_t nxc[5];
4068 Float_t nyc[5];
4069 for (Int_t i = 0; i<5 ; i++) {
4070 nxc[i]= xs2y + nxc1[i]*var.sfx;
4071 nyc[i] = ys2y + nyc1[i]*var.sfy;
4072 };
4073 sftof22[j] = new TPolyLine(5,nxc,nyc);
4074 sftof22[j]->SetLineColor(ocolo);
4075 sftof22[j]->SetFillColor(ocolo);
4076 sftof22[j]->SetLineWidth(1);
4077 sftof22[j]->Draw("f");
4078 sftof22[j]->Draw();
4079 };
4080 };
4081 };
4082 };
4083 //
4084
4085 //
4086 // S31 X-view
4087 //
4088 Float_t s31p = 0.060;
4089 ocolo = 10;
4090 TPolyLine *ftof31x[3];
4091 for ( Int_t j=0; j<3; j++){
4092 Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
4093 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4094 Float_t nxc[5];
4095 Float_t nyc[5];
4096 for (Int_t i = 0; i<5 ; i++) {
4097 nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
4098 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4099 };
4100 ftof31x[j] = new TPolyLine(5,nxc,nyc);
4101 ftof31x[j]->SetLineColor(1);
4102 if ( var.bw ){
4103 colo = -1;
4104 } else {
4105 colo = 1;
4106 };
4107 ColorMIP(ms31a[j]+ms31b[j],colo);
4108 //
4109 if ( colo != 10 ) ocolo = colo;
4110 //
4111 ftof31x[j]->SetFillColor(colo);
4112 ftof31x[j]->SetLineWidth(1);
4113 ftof31x[j]->Draw("f");
4114 ftof31x[j]->Draw();
4115 };
4116 //
4117 // S31 Y-view
4118 //
4119 if ( true ){
4120 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4121 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
4122 Float_t nxc[5];
4123 Float_t nyc[5];
4124 for (Int_t i = 0; i<5 ; i++) {
4125 nxc[i]= xs2y + nxc1[i]*var.sfx;
4126 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4127 };
4128 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
4129 ftof31y->SetLineColor(1);
4130 ftof31y->SetFillStyle(4000);
4131 ftof31y->SetFillColor(0);
4132 ftof31y->SetLineWidth(1);
4133 ftof31y->Draw("f");
4134 ftof31y->Draw();
4135 TPolyLine *sftof31[3];
4136 for ( Int_t j=0; j<3; j++){
4137 if ( (mt31[0][j]<4095. || mt31[1][j]<4095.) && !var.nosig){
4138 if ( ocolo == 10 ) ocolo = noadc;
4139 Float_t lowp = (xp31[j]-E31[j])/100.;
4140 Float_t higp = (xp31[j]+E31[j])/100.;
4141 if ( lowp < -0.074 ) lowp = -0.074;
4142 if ( higp > 0.074 ) higp = 0.074;
4143 if ( lowp < higp ){
4144 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4145 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
4146 Float_t nxc[5];
4147 Float_t nyc[5];
4148 for (Int_t i = 0; i<5 ; i++) {
4149 nxc[i]= xs2y + nxc1[i]*var.sfx;
4150 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4151 };
4152 sftof31[j] = new TPolyLine(5,nxc,nyc);
4153 sftof31[j]->SetLineColor(ocolo);
4154 sftof31[j]->SetFillColor(ocolo);
4155 sftof31[j]->SetLineWidth(1);
4156 sftof31[j]->Draw("f");
4157 sftof31[j]->Draw();
4158 };
4159 };
4160 };
4161 };
4162 //
4163
4164 //
4165 // S32 Y-view
4166 //
4167 Float_t s32p = 0.050;
4168 ocolo = 10;
4169 TPolyLine *ftof32y[3];
4170 for ( Int_t j=0; j<3; j++){
4171 Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
4172 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
4173 Float_t nxc[5];
4174 Float_t nyc[5];
4175 for (Int_t i = 0; i<5 ; i++) {
4176 nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
4177 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4178 };
4179 ftof32y[j] = new TPolyLine(5,nxc,nyc);
4180 ftof32y[j]->SetLineColor(1);
4181 if ( var.bw ){
4182 colo = -1;
4183 } else {
4184 colo = 1;
4185 };
4186 ColorMIP(ms32a[j]+ms32b[j],colo);
4187 //
4188 if ( colo != 10 ) ocolo = colo;
4189 //
4190 ftof32y[j]->SetFillColor(colo);
4191 ftof32y[j]->SetLineWidth(1);
4192 ftof32y[j]->Draw("f");
4193 ftof32y[j]->Draw();
4194 };
4195 //
4196 // S32 X-view
4197 //
4198 if ( true ){
4199 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
4200 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
4201 Float_t nxc[5];
4202 Float_t nyc[5];
4203 for (Int_t i = 0; i<5 ; i++) {
4204 nxc[i]= xs2x + nxc1[i]*var.sfx;
4205 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4206 };
4207 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
4208 ftof32x->SetLineColor(1);
4209 ftof32x->SetLineWidth(1);
4210 ftof32x->SetFillStyle(4000);
4211 ftof32x->SetFillColor(0);
4212 ftof32x->Draw("f");
4213 ftof32x->Draw();
4214 TPolyLine *sftof32[3];
4215 for ( Int_t j=0; j<3; j++){
4216 if ( (mt32[0][j]<4095. || mt32[1][j]<4095.) && !var.nosig ){
4217 if ( ocolo == 10 ) ocolo = noadc;
4218 Float_t lowp = (xp32[j]-E32[j])/100.;
4219 Float_t higp = (xp32[j]+E32[j])/100.;
4220 if ( lowp < -0.089 ) lowp = -0.089;
4221 if ( higp > 0.089 ) higp = 0.089;
4222 if ( lowp < higp ){
4223 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4224 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
4225 Float_t nxc[5];
4226 Float_t nyc[5];
4227 for (Int_t i = 0; i<5 ; i++) {
4228 nxc[i]= xs2x + nxc1[i]*var.sfx;
4229 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4230 };
4231 sftof32[j] = new TPolyLine(5,nxc,nyc);
4232 sftof32[j]->SetLineColor(ocolo);
4233 sftof32[j]->SetFillColor(ocolo);
4234 sftof32[j]->SetLineWidth(1);
4235 sftof32[j]->Draw("f");
4236 sftof32[j]->Draw();
4237 };
4238 };
4239 };
4240 };
4241 //
4242 }
4243
4244 // void ShowTOFL1(Int_t j, TTree *toftr, Variables & var, PAMevcontrol *pamgui){
4245 // //
4246 // for (Int_t i=0 ; i<5; i++){
4247 // var.beta[i] = 0.;
4248 // };
4249 // //
4250 // struct Toflev1 ntof;
4251 // settoflev1(toftr,ntof);
4252 // //
4253 // Int_t syncro = 1;
4254 // Int_t itr = j;
4255 // Int_t trnevents = toftr->GetEntries();
4256 // Int_t pktnum = 0;
4257 // Int_t obt = 0;
4258 // trkcalosync: if ( itr >= trnevents ){
4259 // printf(" WARNING: no more tof level1 data.\n");
4260 // pamgui->DIALOG(1," No more tof level1 data ");
4261 // return;
4262 // } else {
4263 // if ( !var.nosig ) toftr->GetEntry(itr);
4264 // };
4265 // pktnum = var.headc;
4266 // obt = var.etime;
4267 // if ( pktnum != ntof.pkt_num || obt != ntof.obt ){
4268 // if ( pktnum > ntof.pkt_num || obt > ntof.obt ){
4269 // itr++;
4270 // if ( syncro ){
4271 // printf(" WARNING: lost sync! try to recover... \n");
4272 // pamgui->DIALOG(1," Lost sync! try to recover ");
4273 // };
4274 // syncro = 0;
4275 // goto trkcalosync;
4276 // };
4277 // if ( pktnum < ntof.pkt_num || obt < ntof.obt ){
4278 // printf(" WARNING: no tof level1 data. \n");
4279 // pamgui->DIALOG(1," No more tof level1 data ");
4280 // return;
4281 // };
4282 // };
4283 // //
4284 // if ( !syncro ){
4285 // printf(" ...synchronization recovered! \n");
4286 // pamgui->DIALOG(0," Synchronization recovered! ");
4287 // };
4288 // syncro = 1;
4289 // //
4290 // if ( !var.nosig ) {
4291 // for (Int_t i=0 ; i<5; i++){
4292 // if ( ntof.beta[i] < 100.) var.beta[i] = ntof.beta[i];
4293 // };
4294 // };
4295 // struct CToflev1 tof;
4296 // accesstoflev1(ntof,tof);
4297 // //
4298 // // the channels MAP:
4299 // //
4300 // Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
4301 // Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
4302 // Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
4303 // Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
4304
4305 // Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
4306 // Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
4307 // Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
4308 // Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
4309
4310 // Int_t ch21a[2] = { 0, 0};
4311 // Int_t hb21a[2] = { 0, 4};
4312 // Int_t ch21b[2] = { 1, 0};
4313 // Int_t hb21b[2] = { 8, 6};
4314
4315 // Int_t ch22a[2] = { 0, 0};
4316 // Int_t hb22a[2] = { 2, 8};
4317 // Int_t ch22b[2] = { 1, 0};
4318 // Int_t hb22b[2] = { 10, 10};
4319
4320 // Int_t ch31a[3] = { 1, 2, 2};
4321 // Int_t hb31a[3] = { 6, 8, 10};
4322 // Int_t ch31b[3] = { 1, 1, 1};
4323 // Int_t hb31b[3] = { 4, 2, 0};
4324
4325 // Int_t ch32a[3] = { 2, 2, 3};
4326 // Int_t hb32a[3] = { 0, 4, 8};
4327 // Int_t ch32b[3] = { 2, 2, 3};
4328 // Int_t hb32b[3] = { 2, 6, 10};
4329
4330 // //
4331 // Float_t E11 = 2.6;
4332 // Float_t E12 = 2.6;
4333 // Float_t E21 = 2.2;
4334 // Float_t E22 = 2.9;
4335 // Float_t E31 = 1.2;
4336 // Float_t E32 = 2.3;
4337
4338 // //
4339 // // ADC values
4340 // //
4341 // Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4342 // Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
4343 // Float_t ms21a[2] = {0.,0.};
4344 // Float_t ms22a[2] = {0.,0.};
4345 // Float_t ms31a[3] = {0.,0.,0.};
4346 // Float_t ms32a[3] = {0.,0.,0.};
4347 // Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4348 // Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
4349 // Float_t ms21b[2] = {0.,0.};
4350 // Float_t ms22b[2] = {0.,0.};
4351 // Float_t ms31b[3] = {0.,0.,0.};
4352 // Float_t ms32b[3] = {0.,0.,0.};
4353 // //
4354 // Float_t xp11 = 0.;
4355 // Float_t xp12 = 0.;
4356 // Float_t xp21 = 0.;
4357 // Float_t xp22 = 0.;
4358 // Float_t xp31 = 0.;
4359 // Float_t xp32 = 0.;
4360 // //
4361 // Int_t noadc = 12;
4362 // if ( var.bw ){
4363 // noadc = 12;
4364 // } else {
4365 // noadc = 41;
4366 // };
4367 // //
4368 // Int_t ii = 2;
4369 // //
4370 // if ( var.nosig ) goto draw;
4371 // xp11 = tof.ytof[0];
4372 // for ( Int_t i = 0; i<8; i++ ) {
4373 // if ( tof.adc_c[ch11a[i]][hb11a[i]] < 1000. ){
4374 // ms11a[i] = tof.adc_c[ch11a[i]][hb11a[i]]/2.;
4375 // };
4376 // if ( tof.adc_c[ch11b[i]][hb11b[i]] < 1000. ){
4377 // ms11b[i] = tof.adc_c[ch11b[i]][hb11b[i]]/2.;
4378 // };
4379 // };
4380 // xp12 = tof.xtof[0];
4381 // for ( Int_t i = 0; i<6; i++ ) {
4382 // if ( tof.adc_c[ch12a[i]][hb12a[i]] < 1000. ) ms12a[i] = tof.adc_c[ch12a[i]][hb12a[i]]/2.;
4383 // if ( tof.adc_c[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = tof.adc_c[ch12b[i]][hb12b[i]]/2.;
4384 // };
4385 // xp21 = tof.xtof[1];
4386 // ii = 2;
4387 // for ( Int_t i = 0; i<2; i++ ) {
4388 // ii--;
4389 // if ( tof.adc_c[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = tof.adc_c[ch21a[i]][hb21a[i]]/2.;
4390 // if ( tof.adc_c[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = tof.adc_c[ch21b[i]][hb21b[i]]/2.;
4391 // };
4392 // xp22 = tof.ytof[1];
4393 // for ( Int_t i = 0; i<2; i++ ) {
4394 // if ( tof.adc_c[ch22a[i]][hb22a[i]] < 1000. ) ms22a[i] = tof.adc_c[ch22a[i]][hb22a[i]]/2.;
4395 // if ( tof.adc_c[ch22b[i]][hb22b[i]] < 1000. ) ms22b[i] = tof.adc_c[ch22b[i]][hb22b[i]]/2.;
4396 // };
4397 // xp31 = tof.ytof[2];
4398 // for ( Int_t i = 0; i<3; i++ ) {
4399 // if ( tof.adc_c[ch31a[i]][hb31a[i]] < 1000. ) ms31a[i] = tof.adc_c[ch31a[i]][hb31a[i]]/2.;
4400 // if ( tof.adc_c[ch31b[i]][hb31b[i]] < 1000. ) ms31b[i] = tof.adc_c[ch31b[i]][hb31b[i]]/2.;
4401 // };
4402 // xp32 = tof.xtof[2];
4403 // for ( Int_t i = 0; i<3; i++ ) {
4404 // if ( tof.adc_c[ch32a[i]][hb32a[i]] < 1000. ) ms32a[i] = tof.adc_c[ch32a[i]][hb32a[i]]/2.;
4405 // if ( tof.adc_c[ch32b[i]][hb32b[i]] < 1000. ) ms32b[i] = tof.adc_c[ch32b[i]][hb32b[i]]/2.;
4406 // };
4407 // //
4408 // draw:
4409 // //
4410 // Int_t colo;
4411 // Int_t ocolo;
4412 // Float_t xs2x = var.xxvc;
4413 // Float_t ys2x = var.yxvc + 0.36*var.sfy;
4414 // Float_t xs2y = var.xyvc;
4415 // Float_t ys2y = var.yyvc + 0.36*var.sfy;
4416 // Float_t ws2 = 0.005;
4417 // Float_t ws13 = 0.007;
4418 // //
4419 // // S11 X-view
4420 // //
4421 // Float_t s11p = 0.051;
4422 // ocolo = 10;
4423 // TPolyLine *ftof11x[8];
4424 // for ( Int_t j=0; j<8; j++){
4425 // Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
4426 // Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4427 // Float_t nxc[5];
4428 // Float_t nyc[5];
4429 // for (Int_t i = 0; i<5 ; i++) {
4430 // nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
4431 // nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4432 // };
4433 // ftof11x[j] = new TPolyLine(5,nxc,nyc);
4434 // ftof11x[j]->SetLineColor(1);
4435 // if ( var.bw ){
4436 // colo = -1;
4437 // } else {
4438 // colo = 1;
4439 // };
4440 // ColorTOFMIP(ms11a[j]+ms11b[j],colo);
4441 // //
4442 // if ( colo != 10 ) ocolo = colo;
4443 // //
4444 // ftof11x[j]->SetFillColor(colo);
4445 // ftof11x[j]->SetLineWidth(1);
4446 // ftof11x[j]->Draw("f");
4447 // ftof11x[j]->Draw();
4448 // };
4449 // //
4450 // // S11 Y-view
4451 // //
4452 // if ( true ){
4453 // Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
4454 // Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
4455 // Float_t nxc[5];
4456 // Float_t nyc[5];
4457 // for (Int_t i = 0; i<5 ; i++) {
4458 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4459 // nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4460 // };
4461 // TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
4462 // ftof11y->SetFillStyle(4000);
4463 // ftof11y->SetFillColor(0);
4464 // ftof11y->SetLineColor(1);
4465 // ftof11y->SetLineWidth(1);
4466 // ftof11y->Draw("f");
4467 // ftof11y->Draw();
4468 // TPolyLine *sftof11;
4469 // if ( !var.nosig ){
4470 // if ( ocolo == 10 ) ocolo = noadc;
4471 // Float_t lowp = (xp11-E11)/100.;
4472 // Float_t higp = (xp11+E11)/100.;
4473 // if ( lowp < -0.164 ) lowp = -0.164;
4474 // if ( higp > 0.164 ) higp = 0.164;
4475 // if ( lowp < higp ){
4476 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4477 // Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
4478 // Float_t nxc[5];
4479 // Float_t nyc[5];
4480 // for (Int_t i = 0; i<5 ; i++) {
4481 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4482 // nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4483 // };
4484 // sftof11 = new TPolyLine(5,nxc,nyc);
4485 // sftof11->SetLineColor(ocolo);
4486 // sftof11->SetFillColor(ocolo);
4487 // sftof11->SetLineWidth(1);
4488 // sftof11->Draw("f");
4489 // sftof11->Draw();
4490 // };
4491 // };
4492 // };
4493
4494 // //
4495 // // S12 Y-view
4496 // //
4497 // Float_t s12p = 0.055;
4498 // ocolo = 10;
4499 // TPolyLine *ftof12y[6];
4500 // for ( Int_t j=0; j<6; j++){
4501 // Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
4502 // Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
4503 // Float_t nxc[5];
4504 // Float_t nyc[5];
4505 // for (Int_t i = 0; i<5 ; i++) {
4506 // nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
4507 // nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4508 // };
4509 // ftof12y[j] = new TPolyLine(5,nxc,nyc);
4510 // ftof12y[j]->SetLineColor(1);
4511 // if ( var.bw ){
4512 // colo = -1;
4513 // } else {
4514 // colo = 1;
4515 // };
4516 // ColorTOFMIP(ms12a[j]+ms12b[j],colo);
4517 // //
4518 // if ( colo != 10 ) ocolo = colo;
4519 // //
4520 // ftof12y[j]->SetFillColor(colo);
4521 // ftof12y[j]->SetLineWidth(1);
4522 // ftof12y[j]->Draw("f");
4523 // ftof12y[j]->Draw();
4524 // };
4525 // //
4526 // // S12 X-view
4527 // //
4528 // if ( true ){
4529 // Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
4530 // Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
4531 // Float_t nxc[5];
4532 // Float_t nyc[5];
4533 // for (Int_t i = 0; i<5 ; i++) {
4534 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4535 // nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4536 // };
4537 // TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
4538 // ftof12x->SetLineColor(1);
4539 // ftof12x->SetFillStyle(4000);
4540 // ftof12x->SetFillColor(0);
4541 // ftof12x->SetLineWidth(1);
4542 // ftof12x->Draw("f");
4543 // ftof12x->Draw();
4544 // TPolyLine *sftof12;
4545 // if ( !var.nosig ){
4546 // if ( ocolo == 10 ) ocolo = noadc;
4547 // Float_t lowp = (xp12-E12)/100.;
4548 // Float_t higp = (xp12+E12)/100.;
4549 // if ( lowp < -0.203 ) lowp = -0.203;
4550 // if ( higp > 0.203 ) higp = 0.203;
4551 // if ( lowp < higp ){
4552 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4553 // Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
4554 // Float_t nxc[5];
4555 // Float_t nyc[5];
4556 // for (Int_t i = 0; i<5 ; i++) {
4557 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4558 // nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4559 // };
4560 // sftof12 = new TPolyLine(5,nxc,nyc);
4561 // sftof12->SetLineColor(ocolo);
4562 // sftof12->SetFillColor(ocolo);
4563 // sftof12->SetLineWidth(1);
4564 // sftof12->Draw("f");
4565 // sftof12->Draw();
4566 // };
4567 // };
4568 // };
4569 // //
4570
4571 // //
4572 // // S21 Y-view
4573 // //
4574 // Float_t s21p = 0.075;
4575 // ocolo = 10;
4576 // TPolyLine *ftof21y[2];
4577 // for ( Int_t j=0; j<2; j++){
4578 // Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
4579 // Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
4580 // Float_t nxc[5];
4581 // Float_t nyc[5];
4582 // for (Int_t i = 0; i<5 ; i++) {
4583 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4584 // nyc[i] = ys2y + nyc1[i]*var.sfy;
4585 // };
4586 // ftof21y[j] = new TPolyLine(5,nxc,nyc);
4587 // ftof21y[j]->SetLineColor(1);
4588 // if ( var.bw ){
4589 // colo = -1;
4590 // } else {
4591 // colo = 1;
4592 // };
4593 // ColorTOFMIP(ms21a[j]+ms21b[j],colo);
4594 // //
4595 // if ( colo != 10 ) ocolo = colo;
4596 // //
4597 // ftof21y[j]->SetFillColor(colo);
4598 // ftof21y[j]->SetLineWidth(1);
4599 // ftof21y[j]->Draw("f");
4600 // ftof21y[j]->Draw();
4601 // };
4602 // //
4603 // // S21 X-view
4604 // //
4605 // if ( true ){
4606 // Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
4607 // Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
4608 // Float_t nxc[5];
4609 // Float_t nyc[5];
4610 // for (Int_t i = 0; i<5 ; i++) {
4611 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4612 // nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
4613 // };
4614 // TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
4615 // ftof21x->SetLineColor(1);
4616 // ftof21x->SetFillStyle(4000);
4617 // ftof21x->SetFillColor(0);
4618 // ftof21x->SetLineWidth(1);
4619 // ftof21x->Draw("f");
4620 // ftof21x->Draw();
4621 // TPolyLine *sftof21;
4622 // if ( !var.nosig ){
4623 // if ( ocolo == 10 ) ocolo = noadc;
4624 // Float_t lowp = (xp21-E21)/100.;
4625 // Float_t higp = (xp21+E21)/100.;
4626 // if ( lowp < -0.089 ) lowp = -0.089;
4627 // if ( higp > 0.089 ) higp = 0.089;
4628 // if ( lowp < higp ){
4629 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4630 // Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
4631 // Float_t nxc[5];
4632 // Float_t nyc[5];
4633 // for (Int_t i = 0; i<5 ; i++) {
4634 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4635 // nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
4636 // };
4637 // sftof21 = new TPolyLine(5,nxc,nyc);
4638 // sftof21->SetLineColor(ocolo);
4639 // sftof21->SetFillColor(ocolo);
4640 // sftof21->SetLineWidth(1);
4641 // sftof21->Draw("f");
4642 // sftof21->Draw();
4643 // };
4644 // };
4645 // };
4646 // //
4647
4648 // //
4649 // // S22 X-view
4650 // //
4651 // Float_t s22p = 0.090;
4652 // ocolo = 10;
4653 // TPolyLine *ftof22x[2];
4654 // for ( Int_t j=0; j<2; j++){
4655 // Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
4656 // Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
4657 // Float_t nxc[5];
4658 // Float_t nyc[5];
4659 // for (Int_t i = 0; i<5 ; i++) {
4660 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4661 // nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
4662 // };
4663 // ftof22x[j] = new TPolyLine(5,nxc,nyc);
4664 // ftof22x[j]->SetLineColor(1);
4665 // if ( var.bw ){
4666 // colo = -1;
4667 // } else {
4668 // colo = 1;
4669 // };
4670 // ColorTOFMIP(ms22a[j]+ms22b[j],colo);
4671 // //
4672 // if ( colo != 10 ) ocolo = colo;
4673 // //
4674 // ftof22x[j]->SetFillColor(colo);
4675 // ftof22x[j]->SetLineWidth(1);
4676 // ftof22x[j]->Draw("f");
4677 // ftof22x[j]->Draw();
4678 // };
4679 // //
4680 // // S22 Y-view
4681 // //
4682 // if ( true ){
4683 // Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4684 // Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
4685 // Float_t nxc[5];
4686 // Float_t nyc[5];
4687 // for (Int_t i = 0; i<5 ; i++) {
4688 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4689 // nyc[i] = ys2y + (0.0+nyc1[i])*var.sfy;
4690 // };
4691 // TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
4692 // ftof22y->SetLineColor(1);
4693 // ftof22y->SetFillStyle(4000);
4694 // ftof22y->SetFillColor(0);
4695 // ftof22y->SetLineWidth(1);
4696 // ftof22y->Draw("f");
4697 // ftof22y->Draw();
4698 // TPolyLine *sftof22;
4699 // if ( !var.nosig ){
4700 // if ( ocolo == 10 ) ocolo = noadc;
4701 // Float_t lowp = (xp22-E22)/100.;
4702 // Float_t higp = (xp22+E22)/100.;
4703 // if ( lowp < -0.074 ) lowp = -0.074;
4704 // if ( higp > 0.074 ) higp = 0.074;
4705 // if ( lowp < higp ){
4706 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4707 // Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
4708 // Float_t nxc[5];
4709 // Float_t nyc[5];
4710 // for (Int_t i = 0; i<5 ; i++) {
4711 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4712 // nyc[i] = ys2y + (0.0+nyc1[i])*var.sfy;
4713 // };
4714 // sftof22 = new TPolyLine(5,nxc,nyc);
4715 // sftof22->SetLineColor(ocolo);
4716 // sftof22->SetFillColor(ocolo);
4717 // sftof22->SetLineWidth(1);
4718 // sftof22->Draw("f");
4719 // sftof22->Draw();
4720 // };
4721 // };
4722 // };
4723 // //
4724
4725 // //
4726 // // S31 X-view
4727 // //
4728 // Float_t s31p = 0.060;
4729 // ocolo = 10;
4730 // TPolyLine *ftof31x[3];
4731 // for ( Int_t j=0; j<3; j++){
4732 // Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
4733 // Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4734 // Float_t nxc[5];
4735 // Float_t nyc[5];
4736 // for (Int_t i = 0; i<5 ; i++) {
4737 // nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
4738 // nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4739 // };
4740 // ftof31x[j] = new TPolyLine(5,nxc,nyc);
4741 // ftof31x[j]->SetLineColor(1);
4742 // if ( var.bw ){
4743 // colo = -1;
4744 // } else {
4745 // colo = 1;
4746 // };
4747 // ColorTOFMIP(ms31a[j]+ms31b[j],colo);
4748 // //
4749 // if ( colo != 10 ) ocolo = colo;
4750 // //
4751 // ftof31x[j]->SetFillColor(colo);
4752 // ftof31x[j]->SetLineWidth(1);
4753 // ftof31x[j]->Draw("f");
4754 // ftof31x[j]->Draw();
4755 // };
4756 // //
4757 // // S31 Y-view
4758 // //
4759 // if ( true ){
4760 // Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4761 // Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
4762 // Float_t nxc[5];
4763 // Float_t nyc[5];
4764 // for (Int_t i = 0; i<5 ; i++) {
4765 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4766 // nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4767 // };
4768 // TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
4769 // ftof31y->SetLineColor(1);
4770 // ftof31y->SetFillStyle(4000);
4771 // ftof31y->SetFillColor(0);
4772 // ftof31y->SetLineWidth(1);
4773 // ftof31y->Draw("f");
4774 // ftof31y->Draw();
4775 // TPolyLine *sftof31;
4776 // if ( !var.nosig ){
4777 // if ( ocolo == 10 ) ocolo = noadc;
4778 // Float_t lowp = (xp31-E31)/100.;
4779 // Float_t higp = (xp31+E31)/100.;
4780 // if ( lowp < -0.074 ) lowp = -0.074;
4781 // if ( higp > 0.074 ) higp = 0.074;
4782 // if ( lowp < higp ){
4783 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4784 // Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
4785 // Float_t nxc[5];
4786 // Float_t nyc[5];
4787 // for (Int_t i = 0; i<5 ; i++) {
4788 // nxc[i]= xs2y + nxc1[i]*var.sfx;
4789 // nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4790 // };
4791 // sftof31 = new TPolyLine(5,nxc,nyc);
4792 // sftof31->SetLineColor(ocolo);
4793 // sftof31->SetFillColor(ocolo);
4794 // sftof31->SetLineWidth(1);
4795 // sftof31->Draw("f");
4796 // sftof31->Draw();
4797 // };
4798 // };
4799 // };
4800 // //
4801
4802 // //
4803 // // S32 Y-view
4804 // //
4805 // Float_t s32p = 0.050;
4806 // ocolo = 10;
4807 // TPolyLine *ftof32y[3];
4808 // for ( Int_t j=0; j<3; j++){
4809 // Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
4810 // Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
4811 // Float_t nxc[5];
4812 // Float_t nyc[5];
4813 // for (Int_t i = 0; i<5 ; i++) {
4814 // nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
4815 // nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4816 // };
4817 // ftof32y[j] = new TPolyLine(5,nxc,nyc);
4818 // ftof32y[j]->SetLineColor(1);
4819 // if ( var.bw ){
4820 // colo = -1;
4821 // } else {
4822 // colo = 1;
4823 // };
4824 // ColorTOFMIP(ms32a[j]+ms32b[j],colo);
4825 // //
4826 // if ( colo != 10 ) ocolo = colo;
4827 // //
4828 // ftof32y[j]->SetFillColor(colo);
4829 // ftof32y[j]->SetLineWidth(1);
4830 // ftof32y[j]->Draw("f");
4831 // ftof32y[j]->Draw();
4832 // };
4833 // //
4834 // // S32 X-view
4835 // //
4836 // if ( true ){
4837 // Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
4838 // Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
4839 // Float_t nxc[5];
4840 // Float_t nyc[5];
4841 // for (Int_t i = 0; i<5 ; i++) {
4842 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4843 // nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4844 // };
4845 // TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
4846 // ftof32x->SetLineColor(1);
4847 // ftof32x->SetLineWidth(1);
4848 // ftof32x->SetFillStyle(4000);
4849 // ftof32x->SetFillColor(0);
4850 // ftof32x->Draw("f");
4851 // ftof32x->Draw();
4852 // TPolyLine *sftof32;
4853 // if ( !var.nosig ){
4854 // if ( ocolo == 10 ) ocolo = noadc;
4855 // Float_t lowp = (xp32-E32)/100.;
4856 // Float_t higp = (xp32+E32)/100.;
4857 // if ( lowp < -0.089 ) lowp = -0.089;
4858 // if ( higp > 0.089 ) higp = 0.089;
4859 // if ( lowp < higp ){
4860 // Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4861 // Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
4862 // Float_t nxc[5];
4863 // Float_t nyc[5];
4864 // for (Int_t i = 0; i<5 ; i++) {
4865 // nxc[i]= xs2x + nxc1[i]*var.sfx;
4866 // nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4867 // };
4868 // sftof32 = new TPolyLine(5,nxc,nyc);
4869 // sftof32->SetLineColor(ocolo);
4870 // sftof32->SetFillColor(ocolo);
4871 // sftof32->SetLineWidth(1);
4872 // sftof32->Draw("f");
4873 // sftof32->Draw();
4874 // };
4875 // };
4876 // };
4877 // //
4878 // }
4879
4880 //**********************************************************************************
4881 // LEVEL2 SUBROUTINES //
4882 //**********************************************************************************
4883
4884 // void ShowTRACK(Int_t evno, TTree *ttr, Variables & var, PAMevcontrol *pamgui){
4885 // //
4886 // var.rig = 0.;
4887 // var.chi2 = 0.;
4888 // struct Tracklev2 trk;
4889 // settrklev2(ttr,trk);
4890 // //
4891 // Int_t trcol = 10;
4892 // Int_t syncro = 1;
4893 // Int_t itr = evno;
4894 // Int_t trnevents = ttr->GetEntries();
4895 // Int_t pktnum = 0;
4896 // Int_t obt = 0;
4897 // trkcalosync: if ( itr >= trnevents ){
4898 // printf(" WARNING: no more tracker level2 data.\n");
4899 // pamgui->DIALOG(1," No more tracker level2 data ");
4900 // return;
4901 // };
4902 // if ( !var.nosig ) ttr->GetEntry(itr);
4903 // pktnum = var.headc;
4904 // obt = var.etime;
4905 // if ( pktnum != trk.pkt_num || obt != trk.obt ){
4906 // if ( pktnum > trk.pkt_num || obt > trk.obt ){
4907 // itr++;
4908 // if ( syncro ) {
4909 // printf(" WARNING: lost sync! try to recover... \n");
4910 // pamgui->DIALOG(1," Lost sync! try to recover ");
4911 // };
4912 // syncro = 0;
4913 // goto trkcalosync;
4914 // };
4915 // if ( pktnum < trk.pkt_num || obt < trk.obt ){
4916 // printf(" WARNING: no tracker level2 data. \n");
4917 // pamgui->DIALOG(1," No more tracker level2 data ");
4918 // return;
4919 // };
4920 // };
4921 // //
4922 // if ( !syncro ){
4923 // printf(" ...synchronization recovered! \n");
4924 // pamgui->DIALOG(0," Synchronization recovered! ");
4925 // };
4926 // //
4927 // if ( trk.ntrk > 0 ){
4928 // Int_t l = 0;
4929 // Int_t tobeinc = 0;
4930 // while ( l<trk.ntrk ) {
4931 // //
4932 // Int_t npoint = 100;
4933 // Double_t zin[100];
4934 // Double_t xout[100];
4935 // Double_t yout[100];
4936 // Double_t al_p[5];
4937 // Int_t ifail = 0;
4938 // //
4939 // Float_t tx[100];
4940 // Float_t ty[100];
4941 // Float_t ptx1[50];
4942 // Float_t pty1[50];
4943 // Float_t ptx2[50];
4944 // Float_t pty2[50];
4945 // Float_t tx1[15];
4946 // Float_t ty1[15];
4947 // Float_t tzx[100];
4948 // Float_t tzy[100];
4949 // Float_t tzx1[15];
4950 // Float_t tzy1[15];
4951 // //
4952 // // if there is track ambiguity in y choose the track with the smaller chi2
4953 // //
4954 // if ( trk.image[l] != 0 ){
4955 // Float_t chiA = trk.chi2[l];
4956 // Float_t chiB = trk.chi2[trk.image[l]-1];
4957 // if ( chiA > chiB ) {
4958 // l = trk.image[l]-1;
4959 // tobeinc = 2;
4960 // };
4961 // tobeinc = 1;
4962 // };
4963 // for ( Int_t e = 0; e < 100 ; e++) {
4964 // xout[e] = 0.;
4965 // yout[e] = 0.;
4966 // //
4967 // tx[e] = 0.;
4968 // ty[e] = 0.;
4969 // tzx[e] = 0.;
4970 // tzy[e] = 0.;
4971 // if ( e < 50 ){
4972 // ptx1[e] = 0.;
4973 // pty1[e] = 0.;
4974 // ptx2[e] = 0.;
4975 // pty2[e] = 0.;
4976 // if ( e < 15 ){
4977 // tx1[e] = 0.;
4978 // ty1[e] = 0.;
4979 // tzx1[e] = 0.;
4980 // tzy1[e] = 0.;
4981 // };
4982 // };
4983 // //
4984 // if ( e < 5 ) {
4985 // al_p[e] = (Double_t)trk.al[l][e];
4986 // };
4987 // zin[e] = 60. - (124./99.)*(float)e;
4988 // };
4989 // //
4990 // zin[85] = -45.5;
4991 // //
4992 // ctrack(npoint,zin,xout,yout,al_p,ifail);
4993 // //
4994 // //
4995 // if ( !ifail ){
4996 // if ( l == 0 || ( l == 1 && tobeinc ==2 ) ){
4997 // if ( trk.al[l][4] != 0. ) {
4998 // var.rig = 1./trk.al[l][4];
4999 // var.chi2 = trk.chi2[l];
5000 // } else {
5001 // var.rig = 0.;
5002 // var.chi2 = 0.;
5003 // };
5004 // };
5005 // //
5006 // for ( Int_t e = 0; e < npoint ; e++) {
5007 // tx[e] = ((float)xout[e]/100.)*var.sfx + var.xxvc;
5008 // ty[e] = ((float)yout[e]/100.)*var.sfx + var.xyvc;
5009 // // printf("tx %i %f \n",e,tx[e]);
5010 // //printf("xout %i %f \n",e,xout[e]);
5011 // if ( e < 50 ) {
5012 // ptx1[e] = ((float)yout[e]/100.)*var.sfx + var.xcat;
5013 // pty1[e] = ((float)xout[e]/100.)*var.sfy + var.ycat;
5014 // } else {
5015 // ptx2[e-50] = ((float)yout[e]/100.)*var.sfx + var.xcat;
5016 // pty2[e-50] = ((float)xout[e]/100.)*var.sfy + var.ycat;
5017 // };
5018 // if ( e > 84 ) {
5019 // tx1[e-85] = ((float)xout[e]/100.)*var.nds4 + var.xxvc;
5020 // ty1[e-85] = ((float)yout[e]/100.)*var.nds4 + var.xyvc;
5021 // tzx1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5022 // tzy1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5023 // };
5024 // tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5025 // tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5026 // };
5027 // //
5028 // // From S1 to CALO
5029 // //
5030 // if ( var.bw ){
5031 // trcol = 17-l;
5032 // } else {
5033 // trcol = 50-l;
5034 // };
5035 // TPolyLine *trackx = new TPolyLine(86,tx,tzx);
5036 // trackx->SetLineColor(trcol);
5037 // trackx->SetLineWidth(1);
5038 // trackx->Draw();
5039 // TPolyLine *tracky = new TPolyLine(86,ty,tzy);
5040 // tracky->SetLineColor(trcol);
5041 // tracky->SetLineWidth(1);
5042 // tracky->Draw();
5043 // //
5044 // // ND and S4
5045 // //
5046 // if ( var.tracknds4 ){
5047 // TPolyLine *trackx1 = new TPolyLine(15,tx1,tzx1);
5048 // trackx1->SetLineColor(trcol);
5049 // trackx1->SetLineWidth(1);
5050 // trackx1->Draw();
5051 // TPolyLine *tracky1 = new TPolyLine(15,ty1,tzy1);
5052 // tracky1->SetLineColor(trcol);
5053 // tracky1->SetLineWidth(1);
5054 // tracky1->Draw();
5055 // };
5056 // //
5057 // // Plane View
5058 // //
5059 // if ( var.AC ){
5060 // TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1);
5061 // trackp1->SetLineColor(trcol);
5062 // trackp1->SetLineWidth(1);
5063 // trackp1->Draw();
5064 // TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2);
5065 // trackp2->SetLineColor(trcol);
5066 // trackp2->SetLineWidth(1);
5067 // trackp2->SetLineStyle(3);
5068 // trackp2->Draw();
5069 // };
5070 // //
5071 // // Dots on measured points
5072 // //
5073 // TEllipse *elli;
5074 // Float_t x;
5075 // Float_t y;
5076 // Float_t z1;
5077 // Float_t z2;
5078 // Int_t dcol;
5079 // if ( var.bw ){
5080 // dcol = 12;
5081 // } else {
5082 // dcol = 2;
5083 // };
5084 // for (Int_t g = 0; g<6; g++){
5085 // if ( trk.xgood[l][g] ) {
5086 // x = trk.xm[l][g]*var.sfx/100. + var.xxvc;
5087 // z1 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yxvc;
5088 // elli = new TEllipse(x,z1,0.004,0.004,0.,-180.);
5089 // elli->SetFillStyle(1001);
5090 // elli->SetFillColor(dcol);
5091 // elli->Draw();
5092 // };
5093 // if ( trk.ygood[l][g] ) {
5094 // y = trk.ym[l][g]*var.sfx/100. + var.xyvc;
5095 // z2 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yyvc;
5096 // elli = new TEllipse(y,z2,0.004,0.004,0.,-180.);
5097 // elli->SetFillStyle(1001);
5098 // elli->SetFillColor(dcol);
5099 // elli->Draw();
5100 // };
5101 // };
5102 // //
5103 // //
5104 // } else {
5105 // pamgui->DIALOG(1," Failed in determining the track! ");
5106 // printf(" WARNING: failed in determining the track! \n");
5107 // };
5108 // l++;
5109 // if ( tobeinc ) {
5110 // l++;
5111 // tobeinc = 0;
5112 // };
5113 // };
5114 // };
5115 // }
5116
5117 //**********************************************************************************
5118 // OTHER SUBROUTINES **
5119 //**********************************************************************************
5120
5121 void ShowCaloL0(TString filename, Int_t i, Calib & calib, Int_t b[4], Float_t mip[2][22][96], TTree *otr, Variables & var, Bool_t upd){
5122 struct Evento evento;
5123 Int_t tot0 = 0;
5124 Int_t tot1 = 0;
5125 Int_t tot2 = 0;
5126 Int_t nstrip = 0;
5127 Float_t qtot = 0.;
5128 pamela::calorimeter::CalorimeterEvent *de = 0;
5129 otr->SetBranchAddress("Calorimeter", &de);
5130 if ( !var.nosig ) otr->GetEntry(i);
5131 //
5132 // Define variables
5133 //
5134 Int_t etime = var.etime;
5135 Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];
5136 Int_t badstrip = 0;
5137 qtot = 0.;
5138 nstrip = 0;
5139 //
5140 // Book the histograms:
5141 //
5142 //
5143 stringstream xvev;
5144 stringstream yvev;
5145 xvev.str("");
5146 yvev.str("");
5147 xvev << "x-view event " << (i+1);
5148 yvev << "y-view event " << (i+1);
5149 gDirectory->Delete(xvev.str().c_str());
5150 gDirectory->Delete(yvev.str().c_str());
5151 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5152 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5153 Xview->GetYaxis()->SetLabelColor(10);
5154 Yview->GetYaxis()->SetLabelColor(10);
5155 //
5156 // figures:
5157 //
5158 Int_t bgcolor = 10;
5159 TPad *pd1 = new TPad("calox","This is pad1",var.xxvc-0.154*var.sfx,var.yxvc-0.3645*var.sfy,var.xxvc+0.154*var.sfx,var.yxvc-0.1200*var.sfy,bgcolor);
5160 TPad *pd2 = new TPad("caloy","This is pad2",var.xyvc-0.154*var.sfx,var.yyvc-0.3645*var.sfy,var.xyvc+0.154*var.sfx,var.yyvc-0.1200*var.sfy,bgcolor);
5161 if ( upd ){
5162
5163 pd1->SetFillStyle(4000);
5164 pd1->SetFillColor(0);
5165 pd1->SetFrameFillStyle(4000);
5166 pd2->SetFillStyle(4000);
5167 pd2->SetFillColor(0);
5168 pd2->SetFrameFillStyle(4000);
5169
5170 TLatex *t=new TLatex();
5171 t->SetTextFont(32);
5172 t->SetTextColor(1);
5173 t->SetTextSize(0.03);
5174 t->SetTextAlign(12);
5175 pd1->Range(0.,0.,1.,1.);
5176 pd2->Range(0.,0.,1.,1.);
5177 pd1->SetTicks();
5178 pd2->SetTicks();
5179 pd1->Draw();
5180 pd2->Draw();
5181
5182 pd1->cd();
5183 gStyle->SetOptStat(0);
5184 Xview->GetYaxis()->SetTitleOffset(0.5);
5185 Xview->SetFillColor(bgcolor);
5186 Xview->Fill(1.,1.,1.);
5187 Xview->Draw("box");
5188 pd1->Update();
5189 pd2->cd();
5190 gStyle->SetOptStat(0);
5191 Yview->GetYaxis()->SetTitleOffset(0.5);
5192 Yview->SetFillColor(bgcolor);
5193 Yview->Fill(1.,1.,1.);
5194 Yview->Draw("box");
5195 pd2->Update();
5196 };
5197 //
5198 // for each event check that the calibration we are using are still within calibration limits, if not call the next calibration
5199 //
5200 for (Int_t s = 0; s < 4; s++){
5201 if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){
5202 while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){
5203 printf(" CALORIMETER: \n" );
5204 printf(" - Section %i, event at time %i while old calibration time limit at %i. Use new calibration at time %i -\n",s,etime,calib.time[s][b[s]],calib.ttime[s][b[s]+1]);
5205 printf(" END CALORIMETER. \n\n" );
5206 b[s]++;
5207 CaloPede(filename,s,calib.ttime[s][b[s]],calib);
5208 };
5209 };
5210 };
5211 //
5212 // do whatever you want with data
5213 //
5214 evento.iev = de->iev;
5215 //
5216 // run over views and planes
5217 //
5218 stringstream xve;
5219 stringstream yve;
5220 for (Int_t l = 0; l < 2; l++){
5221 for (Int_t m = 0; m < 22; m++){
5222 //
5223 // determine the section number
5224 //
5225 Int_t se = 5;
5226 if (l == 0 && m%2 == 0) se = 3;
5227 if (l == 0 && m%2 != 0) se = 2;
5228 if (l == 1 && m%2 == 0) se = 1;
5229 if (l == 1 && m%2 != 0) se = 0;
5230 //
5231 // determine what kind of event we are going to analyze
5232 //
5233 bool isCOMP = 0;
5234 bool isFULL = 0;
5235 bool isRAW = 0;
5236 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
5237 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
5238 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
5239 //
5240 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
5241 //
5242 Int_t pre = -1;
5243 if ( isRAW ){
5244 for (Int_t nn = 0; nn < 96; nn++){
5245 if ( nn%16 == 0 ) pre++;
5246 evento.base[l][m][pre] = calib.calbase[l][m][pre];
5247 sdexy[l][m][nn] = evento.dexy[l][m][nn];
5248 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
5249 sdexyc[l][m][nn] = evento.dexyc[l][m][nn];
5250 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
5251 };
5252 };
5253 //
5254 // run over strips
5255 //
5256 Int_t done = 0;
5257 Int_t rdone = 0;
5258 Int_t fdone = 0;
5259 pre = -1;
5260 for (Int_t n =0 ; n < 96; n++){
5261 if ( n%16 == 0 ) {
5262 pre++;
5263 done = 0;
5264 rdone = 0;
5265 fdone = 0;
5266 };
5267 //
5268 // baseline check and calculation
5269 //
5270 if ( !isRAW ) {
5271 //
5272 // if it isn't raw and we haven't checked yet, check that the baseline is fine, if not calculate it with a relaxed algorithm.
5273 //
5274 if ( !done ){
5275 evento.base[l][m][pre] = de->base[l][m][pre] ;
5276 evento.dexyc[l][m][n] = de->dexyc[l][m][n] ;
5277 };
5278 } else {
5279 //
5280 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
5281 // if not calculate it with relaxed algorithm.
5282 //
5283 if ( !rdone ){
5284 CaloFindBaseRaw(calib,evento,l,m,pre);
5285 tot1++;
5286 rdone = 1;
5287 };
5288 };
5289 //
5290 // no suitable new baseline, use old ones
5291 //
5292 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
5293 tot0++;
5294 evento.base[l][m][pre] = calib.sbase[l][m][pre];
5295 Int_t upnn = n+16;
5296 if ( upnn > 96 ) upnn = 96;
5297 for ( Int_t nn = n; nn<upnn; nn++ ){
5298 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
5299 };
5300 CaloCompressData(calib,evento,l,m,pre);
5301 done = 1;
5302 };
5303 //
5304 // if here we don't have a valid baseline we will skip the event.
5305 //
5306 if ( evento.base[l][m][pre] == 31000. ) tot2++;
5307 //
5308 // CALIBRATION ALGORITHM
5309 //
5310 basel = evento.base[l][m][pre];
5311 ener = evento.dexyc[l][m][n];
5312 estrip[l][m][n] = 0.;
5313 if ( basel>0 && basel < 30000. && ener > 0. ){
5314 estrip[l][m][n] = (ener - calib.calped[l][m][n] - basel)/mip[l][m][n] ;
5315 //
5316 // OK, now in estrip we have the energy deposit in MIP of all the strips for this event (at the end of loops of course)
5317 //
5318 if ( upd ){
5319 xve.str("");
5320 yve.str("");
5321 xve << "x-view event " << n;
5322 xve << " " << m;
5323 xve << " " << l;
5324 yve << "y-view event " << n;
5325 yve << " " << m;
5326 yve << " " << l;
5327 gDirectory->Delete(xve.str().c_str());
5328 gDirectory->Delete(yve.str().c_str());
5329 TH2F *Xview = new TH2F(xve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5330 TH2F *Yview = new TH2F(yve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5331 if ( estrip[l][m][n] > 0.7 && !var.nosig ){
5332 Int_t colo;
5333 if ( var.bw ){
5334 colo = -1;
5335 } else {
5336 colo = 1;
5337 };
5338 ColorMIP(estrip[l][m][n],colo);
5339 Xview->SetFillColor(colo);
5340 Yview->SetFillColor(colo);
5341 if ( l == 0 ) {
5342 Xview->Fill(n,21-m,1.);
5343 pd1->cd();
5344 Xview->Draw("box same");
5345 };
5346 if ( l == 1 ) {
5347 Yview->Fill(95-n,21-m,1.);
5348 pd2->cd();
5349 Yview->Draw("box same");
5350 };
5351 };
5352 };
5353 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++;
5354 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) {
5355 qtot += estrip[l][m][n];
5356 nstrip++;
5357 };
5358 };
5359 calib.sbase[l][m][pre] = evento.base[l][m][pre];
5360 };
5361 };
5362 };
5363 if ( upd ){
5364 pd1->Update();
5365 pd2->Update();
5366 };
5367 var.qtot=(int)qtot;
5368 var.nstrip=nstrip;
5369 }
5370
5371
5372 void ShowPalette(Int_t bw){
5373 Float_t xp = 0.40;
5374 Float_t yp = 0.02;
5375 Float_t xw = 0.2325;
5376 Float_t yh = 0.19;
5377 // Float_t xp = 0.33;
5378 //Float_t yp = 0.02;
5379 //Float_t xw = 0.35;
5380 //Float_t yh = 0.19;
5381 Double_t xx[5] = {xp, xp+xw, xp+xw, xp, xp};
5382 Double_t yy[5] = {yp, yp, yp+yh, yp+yh, yp};
5383 TPolyLine *fpale = new TPolyLine(5,xx,yy);
5384 fpale->SetLineColor(1);
5385 fpale->SetLineWidth(1);
5386 fpale->Draw();
5387 TLatex *txt=new TLatex();
5388 txt->SetTextSize(0.01);
5389 txt->DrawLatex(xp+0.005,yp+yh-0.015,"PALETTE");
5390 txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, CALO, S4 [MIP]:");
5391 // Float_t xwc = (xp+0.01)/6.;
5392 Float_t xwc = (xw-0.01)/6.;
5393 Float_t axwc = xwc+0.02;
5394 Float_t yhc = 0.03;
5395 Int_t colo = 0;
5396 Float_t yc = 0.135;
5397 TPolyLine *fc1[6];
5398 if ( bw ){
5399 for ( Int_t j=0; j<6; j++){
5400 // Float_t xc = 0.335+(j*xwc);
5401 Float_t xc = 0.005+xp+(j*xwc);
5402 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
5403 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5404 fc1[j] = new TPolyLine(5,xx,yy);
5405 fc1[j]->SetLineColor(1);
5406 if ( j == 0 ) {
5407 colo = 10;
5408 };
5409 if ( j == 1 ) {
5410 colo = 17;
5411 };
5412 if ( j == 2 ) {
5413 colo = 15;
5414 };
5415 if ( j == 3 ) {
5416 colo = 14;
5417 };
5418 if ( j == 4 ) {
5419 colo = 13;
5420 };
5421 if ( j == 5 ) {
5422 colo = 12;
5423 };
5424 fc1[j]->SetFillColor(colo);
5425 fc1[j]->SetLineWidth(1);
5426 fc1[j]->Draw("f");
5427 fc1[j]->Draw();
5428 if ( j == 0 ) {
5429 txt->DrawLatex(xc+0.005,yc+0.01,"0");
5430 };
5431 if ( j == 1 ) {
5432 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
5433 };
5434 if ( j == 2 ) {
5435 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
5436 };
5437 if ( j == 3 ) {
5438 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
5439 };
5440 if ( j == 4 ) {
5441 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
5442 };
5443 if ( j == 5 ) {
5444 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
5445 };
5446 };
5447
5448 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
5449 Float_t yc = 0.08;
5450 TPolyLine *fc2[6];
5451 for ( Int_t j=0; j<6; j++){
5452 Float_t xc = 0.005+xp+(j*xwc);
5453 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
5454 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5455 fc2[j] = new TPolyLine(5,xx,yy);
5456 fc2[j]->SetLineColor(1);
5457 if ( j == 0 ) {
5458 colo = 10;
5459 };
5460 if ( j == 1 ) {
5461 colo = 17;
5462 };
5463 if ( j == 2 ) {
5464 colo = 15;
5465 };
5466 if ( j == 3 ) {
5467 colo = 14;
5468 };
5469 if ( j == 4 ) {
5470 colo = 13;
5471 };
5472 if ( j == 5 ) {
5473 colo = 12;
5474 };
5475 fc2[j]->SetFillColor(colo);
5476 fc2[j]->SetLineWidth(1);
5477 fc2[j]->Draw("f");
5478 fc2[j]->Draw();
5479 if ( j == 0 ) {
5480 txt->DrawLatex(xc+0.005,yc+0.01,"0");
5481 };
5482 if ( j == 1 ) {
5483 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
5484 };
5485 if ( j == 2 ) {
5486 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
5487 };
5488 if ( j == 3 ) {
5489 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
5490 };
5491 if ( j == 4 ) {
5492 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
5493 };
5494 if ( j == 5 ) {
5495 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
5496 };
5497 };
5498 //
5499 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
5500 yc = 0.025;
5501 TPolyLine *fc3[3];
5502 for ( Int_t j=0; j<3; j++){
5503 Float_t xc = 0.005+xp+(j*axwc);
5504 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
5505 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5506 fc3[j] = new TPolyLine(5,xx,yy);
5507 fc3[j]->SetLineColor(1);
5508 if ( j == 0 ) {
5509 colo = 10;
5510 };
5511 if ( j == 1 ) {
5512 colo = 13;
5513 };
5514 if ( j == 2 ) {
5515 colo = 12;
5516 };
5517 fc3[j]->SetFillColor(colo);
5518 fc3[j]->SetLineWidth(1);
5519 fc3[j]->Draw("f");
5520 fc3[j]->Draw();
5521 if ( j == 0 ) {
5522 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
5523 };
5524 if ( j == 1 ) {
5525 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
5526 };
5527 if ( j == 2 ) {
5528 txt->SetTextSize(0.0095);
5529 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
5530 txt->SetTextSize(0.01);
5531 };
5532 };
5533 } else {
5534 for ( Int_t j=0; j<6; j++){
5535 Float_t xc = 0.005+xp+(j*xwc);
5536 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
5537 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5538 fc1[j] = new TPolyLine(5,xx,yy);
5539 fc1[j]->SetLineColor(1);
5540 if ( j == 0 ) {
5541 colo = 10;
5542 };
5543 if ( j == 1 ) {
5544 colo = 38;
5545 };
5546 if ( j == 2 ) {
5547 colo = 4;
5548 };
5549 if ( j == 3 ) {
5550 colo = 3;
5551 };
5552 if ( j == 4 ) {
5553 colo = 2;
5554 };
5555 if ( j == 5 ) {
5556 colo = 6;
5557 };
5558 fc1[j]->SetFillColor(colo);
5559 fc1[j]->SetLineWidth(1);
5560 fc1[j]->Draw("f");
5561 fc1[j]->Draw();
5562 if ( j == 0 ) {
5563 txt->DrawLatex(xc+0.005,yc+0.01,"0");
5564 };
5565 if ( j == 1 ) {
5566 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
5567 };
5568 if ( j == 2 ) {
5569 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
5570 };
5571 if ( j == 3 ) {
5572 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
5573 };
5574 if ( j == 4 ) {
5575 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
5576 };
5577 if ( j == 5 ) {
5578 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
5579 };
5580 };
5581
5582 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
5583 Float_t yc = 0.08;
5584 TPolyLine *fc2[6];
5585 for ( Int_t j=0; j<6; j++){
5586 Float_t xc = 0.005+xp+(j*xwc);
5587 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
5588 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5589 fc2[j] = new TPolyLine(5,xx,yy);
5590 fc2[j]->SetLineColor(1);
5591 if ( j == 0 ) {
5592 colo = 10;
5593 };
5594 if ( j == 1 ) {
5595 colo = 38;
5596 };
5597 if ( j == 2 ) {
5598 colo = 4;
5599 };
5600 if ( j == 3 ) {
5601 colo = 3;
5602 };
5603 if ( j == 4 ) {
5604 colo = 2;
5605 };
5606 if ( j == 5 ) {
5607 colo = 6;
5608 };
5609 fc2[j]->SetFillColor(colo);
5610 fc2[j]->SetLineWidth(1);
5611 fc2[j]->Draw("f");
5612 fc2[j]->Draw();
5613 if ( j == 0 ) {
5614 txt->DrawLatex(xc+0.005,yc+0.01,"0");
5615 };
5616 if ( j == 1 ) {
5617 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
5618 };
5619 if ( j == 2 ) {
5620 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
5621 };
5622 if ( j == 3 ) {
5623 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
5624 };
5625 if ( j == 4 ) {
5626 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
5627 };
5628 if ( j == 5 ) {
5629 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
5630 };
5631 };
5632 //
5633 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
5634 yc = 0.025;
5635 TPolyLine *fc3[3];
5636 for ( Int_t j=0; j<3; j++){
5637 Float_t xc = 0.005+xp+(j*axwc);
5638 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
5639 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5640 fc3[j] = new TPolyLine(5,xx,yy);
5641 fc3[j]->SetLineColor(1);
5642 if ( j == 0 ) {
5643 colo = 10;
5644 };
5645 if ( j == 1 ) {
5646 colo = 2;
5647 };
5648 if ( j == 2 ) {
5649 colo = 42;
5650 };
5651 fc3[j]->SetFillColor(colo);
5652 fc3[j]->SetLineWidth(1);
5653 fc3[j]->Draw("f");
5654 fc3[j]->Draw();
5655 if ( j == 0 ) {
5656 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
5657 };
5658 if ( j == 1 ) {
5659 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
5660 };
5661 if ( j == 2 ) {
5662 txt->SetTextSize(0.0095);
5663 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
5664 txt->SetTextSize(0.01);
5665 };
5666 };
5667 };
5668 }
5669
5670 void DrawX(Float_t cx, Float_t cy, Float_t si, Variables & var){
5671 if ( true ){
5672 Float_t x[2] = {-si*var.sfx,si*var.sfx};
5673 Float_t y[2] = {-si*var.sfy,si*var.sfy};
5674 Float_t xb[2];
5675 Float_t yb[2];
5676 for (Int_t i = 0; i<2 ; i++){
5677 xb[i] = x[i]+cx;
5678 yb[i] = y[i]+cy;
5679 };
5680 TLine *x2 = new TLine(xb[0],yb[0],xb[1],yb[1]);
5681 x2->SetLineColor(1);
5682 x2->SetLineWidth(1);
5683 x2->Draw();
5684 };
5685 if ( true ){
5686 Float_t x[2] = {-si*var.sfx,si*var.sfx};
5687 Float_t y[2] = {si*var.sfy,-si*var.sfy};
5688 Float_t xa[2];
5689 Float_t ya[2];
5690 for (Int_t i = 0; i<2 ; i++){
5691 xa[i] = x[i]+cx;
5692 ya[i] = y[i]+cy;
5693 };
5694 TLine *x1 = new TLine(xa[0],ya[0],xa[1],ya[1]);
5695 x1->SetLineColor(1);
5696 x1->SetLineWidth(1);
5697 x1->Draw();
5698 };
5699 }
5700
5701 //
5702 // MAIN ROUTINE
5703 //
5704 void ShowEvent(TString filename="help", TString selfile="", Int_t ctrlword = 509, Int_t FORCELEV = -1, Int_t fromevent = 0, Int_t toevent = 0, TString outDir = ""){
5705 TString calcalibfile = "";
5706 TString startingdir = gSystem->WorkingDirectory();
5707 const char* startingdir2 = gSystem->WorkingDirectory();
5708 TString path;
5709 stringcopy(path,startingdir2,0,0);
5710 //
5711 TApplication app("app",0,0);
5712 //
5713 const char *pam_calib = pathtocalibration();
5714 stringstream calfile;
5715 calfile.str("");
5716 calfile << pam_calib << "/FCaloADC2MIP.dat";
5717 //
5718 Int_t selection = 0;
5719 Bool_t firsttime = true;
5720 //
5721 Bool_t popup = false;
5722 gROOT->GetListOfCanvases()->Delete();
5723 gDirectory->GetList()->Delete();
5724 //
5725 // here windows dimension (based on the computer screen size) and position and dimension of figures
5726 //
5727 Int_t xw, yw;
5728 UInt_t ww, hw;
5729 gVirtualX->GetWindowSize(gClient->GetRoot()->GetId(),xw,yw,ww,hw);
5730 Float_t winx = (float)ww*0.80;
5731 Float_t winy = (float)hw*0.80; // 95
5732 Float_t winrap = winx/winy;
5733 //
5734 // book the canvas
5735 //
5736 TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy);
5737 //
5738 struct Variables var;
5739 var.thefilename = filename.Data();
5740 var.thefilter = selfile.Data();
5741 var.SHOWDEC = 0;
5742 var.TOF = 0;
5743 var.AC = 0;
5744 var.TRK = 0;
5745 var.CALO = 0;
5746 var.S4 = 0;
5747 var.ND = 0;
5748 var.INFOS = 0;
5749 var.VINFOS = 0;
5750 var.PALETTE = 0;
5751 if ( ctrlword & (1<<0) ) {
5752 var.PALETTE = 1;
5753 printf("Show Palette\n");
5754 };
5755 if ( ctrlword & (1<<1) ) {
5756 var.VINFOS = 1;
5757 printf("Show Verbose Text Informations\n");
5758 };
5759 if ( ctrlword & (1<<2) ) {
5760 var.INFOS = 1;
5761 printf("Show Text Informations\n");
5762 };
5763 if ( ctrlword & (1<<3) ) {
5764 var.ND = 1;
5765 };
5766 if ( ctrlword & (1<<4) ) {
5767 var.S4 = 1;
5768 };
5769 if ( ctrlword & (1<<5) ) {
5770 var.CALO = 1;
5771 };
5772 if ( ctrlword & (1<<6) ) {
5773 var.TRK = 1;
5774 };
5775 if ( ctrlword & (1<<7) ) {
5776 var.AC = 1;
5777 };
5778 if ( ctrlword & (1<<8) ) {
5779 var.TOF = 1;
5780 };
5781 if ( ctrlword & (1<<9) ) {
5782 var.SHOWDEC = 1;
5783 fromevent = 1;
5784 toevent = 1;
5785 printf("\n ** WARNING! YOU HAVE CHOSEN TO SHOW ONLY DETECTORS AND NO SIGNALS! **\n\n");
5786 gSystem->Exec("sleep 5");
5787 };
5788 //
5789 // Pop up the GUI
5790 //
5791 PAMevcontrol *pamgui = 0;
5792 //
5793 if ( !popup ) {
5794 pamgui = new PAMevcontrol(gClient->GetRoot(),400,800,var,*figure);
5795 popup = true;
5796 };
5797 //
5798 restart:
5799 //
5800 Bool_t loadselfs = true;
5801 var.restart = false;
5802 var.waitforever = false;
5803 var.jumprog = true;
5804 var.jumpen = false;
5805 //
5806 struct Levels level;
5807 //
5808 const char *name= filename;
5809 if ( filename == "" || !strcmp(name,"help") ){
5810 var.waitforever = true;
5811 };
5812 //
5813 Float_t mip[2][22][96];
5814 Int_t okcalo = 0;
5815 //
5816 Long64_t cnevents = 0ULL;
5817 //
5818 var.goon = false;
5819 var.refresh = false;
5820 var.fl0 = false;
5821 //
5822 if ( FORCELEV == 0 ) var.fl0 = true;
5823 //
5824 // Define some variables
5825 //
5826 Int_t OBT = 0;
5827 Int_t DOBT = 0;
5828 Int_t ifout = 0;
5829 Int_t OOBT = 0;
5830 //
5831 var.bw = 0;
5832 // var.xxvc = 0.17;
5833 var.xxvc = 0.20;
5834 var.yxvc = 0.44;
5835 // var.xyvc = 0.83;
5836 var.xyvc = 0.815;
5837 var.yyvc = 0.44;
5838 //
5839 var.sfx = 0.81/winrap;
5840 var.sfy = 0.81;
5841 //
5842 //var.nds4 = 0.4;
5843 var.nds4 = var.sfx;
5844 var.xcat = 0.515;
5845 //var.xcat = 0.56;
5846 var.ycat = 0.74;
5847 //
5848 var.tracknds4 = 1;
5849 //
5850 //
5851 TLatex *text=new TLatex();
5852 stringstream testo;
5853 stringstream testo2;
5854 stringstream testo3;
5855 figure->Range(0.,0.,1.,1.);
5856 gStyle->SetOptDate(0);
5857 gStyle->SetOptStat(0);
5858 gStyle->SetLabelSize(0);
5859 gStyle->SetNdivisions(1,"X");
5860 gStyle->SetNdivisions(1,"Y");
5861 //
5862 stringstream libload;
5863 Int_t doflag = 1;
5864 Int_t thefirst = 1;
5865 Int_t trackdone1 = 0;
5866 Int_t trackdone2 = 0;
5867 Int_t seldone = 0;
5868 Float_t headc = 0.;
5869 Float_t headcold = 0.;
5870 Int_t i = 0;
5871 Int_t isOK = 0;
5872 Int_t jumpto = 0;
5873 struct Calib calib;
5874 Int_t b[4];
5875 Int_t si = 0;
5876 var.selex = false;
5877 var.alrforc = false;
5878 //
5879 // from here to refresh
5880 //
5881 refresh:
5882 //
5883 selfile = var.thefilter.Data();
5884 if ( calcalibfile == "" ) calcalibfile = filename;
5885 //
5886 if ( outDir == "" ) outDir = startingdir;
5887 //
5888 if ( var.fl0 == true ) {
5889 FORCELEV = 0;
5890 } else {
5891 if ( var.refresh ) FORCELEV = -1;
5892 };
5893 //
5894 // clear levels!
5895 //
5896 level.calo = -10;
5897 level.calol2 = -10;
5898 level.tof = -10;
5899 level.track = -10;
5900 level.track2 = -10;
5901 level.s4 = -10;
5902 level.ac = -10;
5903 level.nd = -10;
5904 //
5905 TString fififile = getFilename(filename);
5906 const char *file = fififile;
5907 //
5908 //
5909 //
5910 if ( !var.refresh ){
5911 var.SHOWDEC = 0;
5912 var.TOF = 0;
5913 var.AC = 0;
5914 var.TRK = 0;
5915 var.CALO = 0;
5916 var.S4 = 0;
5917 var.ND = 0;
5918 var.INFOS = 0;
5919 var.VINFOS = 0;
5920 var.PALETTE = 0;
5921 if ( ctrlword & (1<<0) ) {
5922 var.PALETTE = 1;
5923 printf("Show Palette\n");
5924 };
5925 if ( ctrlword & (1<<1) ) {
5926 var.VINFOS = 1;
5927 printf("Show Verbose Text Informations\n");
5928 };
5929 if ( ctrlword & (1<<2) ) {
5930 var.INFOS = 1;
5931 printf("Show Text Informations\n");
5932 };
5933 if ( ctrlword & (1<<3) ) {
5934 var.ND = 1;
5935 };
5936 if ( ctrlword & (1<<4) ) {
5937 var.S4 = 1;
5938 };
5939 if ( ctrlword & (1<<5) ) {
5940 var.CALO = 1;
5941 };
5942 if ( ctrlword & (1<<6) ) {
5943 var.TRK = 1;
5944 };
5945 if ( ctrlword & (1<<7) ) {
5946 var.AC = 1;
5947 };
5948 if ( ctrlword & (1<<8) ) {
5949 var.TOF = 1;
5950 };
5951 if ( ctrlword & (1<<9) ) {
5952 var.SHOWDEC = 1;
5953 fromevent = 1;
5954 toevent = 1;
5955 printf("\n ** WARNING! YOU HAVE CHOSEN TO SHOW ONLY DETECTORS AND NO SIGNALS! **\n\n");
5956 gSystem->Exec("sleep 5");
5957 };
5958 };
5959 if ( firsttime ){
5960 firsttime = false;
5961 if ( filename == "" ) pamgui->DIALOG(0," Insert the filename and press load to start ");
5962 };
5963 //
5964 while( var.waitforever ) {
5965 if ( !gROOT->GetListOfCanvases()->FindObject(figure) ) {
5966 pamgui->Terminate();
5967 };
5968 gSystem->ProcessEvents();
5969 };
5970 if ( var.restart ){
5971 filename = var.thefilename.Data();
5972 goto restart;
5973 };
5974 //
5975 //
5976 //
5977 if ( FORCELEV != -1 ) {
5978 printf("\n WARNING: FORCING LEVEL%i DATA \n\n",FORCELEV);
5979 if ( !var.alrforc ) {
5980 pamgui->DIALOG(1," Forcing LEVEL0 data ");
5981 var.alrforc = true;
5982 };
5983 };
5984 //
5985 // LOAD SELECTION FILE
5986 //
5987 if ( selfile == "" ){
5988 if ( !var.selex && selection ) pamgui->DIALOG(0," Selection file unloaded ");
5989 var.selex = true;
5990 selection = 0;
5991 if ( !var.refresh ) {
5992 gROOT->Reset();
5993 stringstream paminc;
5994 paminc.str("");
5995 const char *testinc = gSystem->Getenv("PAM_INC");
5996 if ( !testinc ) {
5997 const char *pam_calib = pathtocalibration();
5998 paminc << pam_calib << "../include/";
5999 } else {
6000 paminc << testinc;
6001 };
6002 stringstream carica;
6003 carica.str("");
6004 carica << paminc.str().c_str() << "/feventviewer.h";
6005 gROOT->LoadMacro(carica.str().c_str());
6006 };
6007 } else {
6008 //
6009 // if running the compiled program we must load header files for the selection macros!
6010 //
6011 if ( loadselfs ) {
6012 loadselfs = false;
6013 gROOT->Reset();
6014 stringstream paminc;
6015 paminc.str("");
6016 const char *testinc = gSystem->Getenv("PAM_INC");
6017 if ( !testinc ){
6018 const char *pam_calib = pathtocalibration();
6019 paminc << pam_calib << "../include/";
6020 } else {
6021 paminc << testinc;
6022 };
6023 stringstream carica;
6024 carica.str("");
6025 carica << paminc.str().c_str() << "/feventviewer.h";
6026 gROOT->LoadMacro(carica.str().c_str());
6027 // carica.str("");
6028 // carica << paminc.str().c_str() << "/trklev1struct.h";
6029 // gROOT->LoadMacro(carica.str().c_str());
6030 // carica.str("");
6031 // carica << paminc.str().c_str() << "/ctrkstruct.h";
6032 // gROOT->LoadMacro(carica.str().c_str());
6033 // carica.str("");
6034 // carica << paminc.str().c_str() << "/ctrkinclude.h";
6035 // gROOT->LoadMacro(carica.str().c_str());
6036 // carica.str("");
6037 // carica << paminc.str().c_str() << "/ctofstruct.h";
6038 // gROOT->LoadMacro(carica.str().c_str());
6039 // carica.str("");
6040 // carica << paminc.str().c_str() << "/ctofinclude.h";
6041 // gROOT->LoadMacro(carica.str().c_str());
6042 };
6043 //
6044 // load the selection macro
6045 //
6046 selection = gROOT->LoadMacro(selfile);
6047 if ( selection ){
6048 stringstream dialog;
6049 dialog.str("");
6050 dialog << var.thefilter.Data();
6051 dialog << " : no such file!";
6052 pamgui->DIALOG(2,dialog.str().c_str());
6053 printf("\n\n ERROR! cannot read the selection file you give me as input! \n");
6054 selection = 0;
6055 printf("\n WARNING! no selection file loaded! \n\n");
6056 pamgui->DIALOG(1," No selection file loaded! ");
6057 pamgui->clearselfi();
6058 } else {
6059 printf("\n\n Selection file loaded \n\n The first event will be shown anyway. \n\n");
6060 if ( !var.selex ) pamgui->DIALOG(0," Selection file successfully loaded ");
6061 var.selex = true;
6062 selection = 1;
6063 };
6064 };
6065 //
6066 // LOAD FILES
6067 //
6068 //
6069 Int_t trk1noev = 0;
6070 Int_t trk2noev = 0;
6071 Int_t tofnoev = 0;
6072 // open files
6073 TFile *headerFile = 0;
6074 TFile *triggerFile = 0;
6075 TFile *caloFile = 0;
6076 TFile *trackerFile = 0;
6077 TFile *trackerFile2 = 0;
6078 TFile *neutronFile = 0;
6079 TFile *acFile = 0;
6080 TFile *s4File = 0;
6081 TFile *tofFile = 0;
6082 TFile *tofFileL1 = 0;
6083 TTree *toftr = 0;
6084 TTree *otr = 0;
6085 //
6086 // check if user has given as input a correct path
6087 //
6088 ifstream myfile;
6089 myfile.open(filename.Data());
6090 if ( !myfile ){
6091 printf("ERROR: no such file, exiting...\n");
6092 stringstream hfile;
6093 hfile.str("");
6094 hfile << filename.Data();
6095 hfile << " : no such file! ";
6096 pamgui->DIALOG(2,hfile.str().c_str());
6097 var.waitforever = true;
6098 goto refresh;
6099 };
6100 myfile.close();
6101 //
6102 // ok, open header file
6103 //
6104 headerFile=new TFile(filename.Data());
6105 otr = (TTree*)headerFile->Get("Physics");
6106 //
6107 TTree *ttr = 0;
6108 TTree *ttr1 = 0;
6109 Int_t STRACK = 0;
6110 Int_t TRKLEV = 0;
6111 Int_t ACLEV = 0;
6112 TFile *trackhead = 0;
6113 TFile *trackcalibFile1 = 0;
6114 TTree *ctrk = 0;
6115 TFile *trackcalibFile2 = 0;
6116 TFile *trackerFile2b = 0;
6117 if ( var.TRK ) {
6118 if ( FORCELEV == 0 ){
6119 printf("Show the Tracker detector, LEVEL0 data \n");
6120 } else {
6121 // trackerFile = emigetFile(filename, "Physics.Level2", "Tracker");
6122 // if ( !trackerFile ){
6123 // //
6124 // trackhead = emigetFile(filename, "CalibTrk1", "Header");
6125 // ctrk = (TTree*)trackhead->Get("Pscu");
6126 // //
6127 // trackerFile = emigetFile(filename, "Physics.Level1", "Tracker");
6128 // trackcalibFile1 = emigetFile(filename, "CalibTrk1");
6129 // trackcalibFile2 = emigetFile(filename, "CalibTrk2");
6130 // //
6131 // if ( !trackerFile || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){
6132 // trackerFile = emigetFile(filename, "Tracker");
6133 // if ( !trackerFile ){
6134 // printf("WARNING: no Tracker file! \n");
6135 // pamgui->DIALOG(1," No tracker file! ");
6136 // var.TRK = 0;
6137 // } else {
6138 // otr->AddFriend("Tracker", trackerFile);
6139 printf("Show the Tracker detector, LEVEL0 data \n");
6140 TRKLEV = 0;
6141 // };
6142 // } else {
6143 // ttr1 = (TTree*)trackerFile->Get("TrkLevel1");
6144 // ctrk->AddFriend("CalibTrk1", trackcalibFile1);
6145 // ctrk->AddFriend("CalibTrk2", trackcalibFile2);
6146 // printf("Show the Tracker detector, LEVEL1 data \n");
6147 // TRKLEV = 1;
6148 // trk1noev = ttr1->GetEntries();
6149 // };
6150 // } else {
6151 // ttr = (TTree*)trackerFile->Get("TrkLevel2");
6152 // trk2noev = ttr->GetEntries();
6153 // printf("Get the track informations (LEVEL2 Tracker data!)\n");
6154 // STRACK = 1;
6155 // //
6156 // trackhead = emigetFile(filename, "CalibTrk2", "Header");
6157 // ctrk = (TTree*)trackhead->Get("Pscu");
6158 // //
6159 // trackerFile2b = emigetFile(filename, "Physics.Level1", "Tracker");
6160 // trackcalibFile1 = emigetFile(filename, "CalibTrk1");
6161 // trackcalibFile2 = emigetFile(filename, "CalibTrk2");
6162 // //
6163 // if ( !trackerFile2b || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){
6164 // printf(" WARNING: no LEVEL1 Tracker data, load LEVEL0 data \n");
6165 // trackerFile2b = emigetFile(filename, "Tracker");
6166 // if ( !trackerFile2b ){
6167 // printf("WARNING: no Tracker file! \n");
6168 // pamgui->DIALOG(1," No tracker file! ");
6169 // var.TRK = 0;
6170 // } else {
6171 // otr->AddFriend("Tracker", trackerFile2b);
6172 // printf("Show the Tracker detector, LEVEL0 data \n");
6173 // TRKLEV = 0;
6174 // };
6175 // } else {
6176 // ttr1 = (TTree*)trackerFile2b->Get("TrkLevel1");
6177 // ctrk->AddFriend("CalibTrk1", trackcalibFile1);
6178 // ctrk->AddFriend("CalibTrk2", trackcalibFile2);
6179 // ctrk = (TTree*)headerFile->Get("CalibTrk1");
6180 // ctrk->AddFriend("CalibTrk2", headerFile);
6181 // printf("Show the Tracker detector, LEVEL1 data \n");
6182 // TRKLEV = 1;
6183 // trk1noev = ttr1->GetEntries();
6184 // };
6185 // };
6186 };
6187 level.track = TRKLEV;
6188 level.track2 = STRACK;
6189 } else {
6190 level.track = -10;
6191 level.track2 = -10;
6192 };
6193 //
6194 Int_t CALOLEV = 0;
6195 if ( var.CALO ) {
6196 if ( FORCELEV == 0 ){
6197 printf("Show the Calorimeter detector, LEVEL0 data \n");
6198 CALOLEV = -1;
6199 } else {
6200 // caloFile = emigetFile(filename, "Physics.Level1", "Calorimeter");
6201 // if ( !caloFile ){
6202 // caloFile = emigetFile(filename, "Calorimeter");
6203 // if ( !caloFile ){
6204 // printf("WARNING: no calorimeter file! \n");
6205 // pamgui->DIALOG(1," No calorimeter file! ");
6206 // var.CALO = 0;
6207 // } else {
6208 // otr->AddFriend("Calorimeter", caloFile);
6209 printf("Show the Calorimeter detector, try to generate LEVEL1 data \n");
6210 // };
6211 CALOLEV = 0;
6212 // } else {
6213 // otr->AddFriend("CaloLevel1", caloFile);
6214 // printf("Show the Calorimeter detector, LEVEL1 data \n");
6215 // CALOLEV = 1;
6216 // };
6217 };
6218 level.calo = CALOLEV;
6219 level.calol2 = -10;
6220 } else {
6221 level.calo = -10;
6222 level.calol2 = -10;
6223 };
6224 //
6225 if ( var.ND ) {
6226 // neutronFile = emigetFile(filename, "Neutron");
6227 // if ( !neutronFile ){
6228 // printf("WARNING: no neutron detector file! \n");
6229 // pamgui->DIALOG(1," No neutron detector file! ");
6230 // var.ND = 0;
6231 // } else {
6232 // otr->AddFriend("Neutron", neutronFile);
6233 printf("Show the Neutron detector, LEVEL0 data \n");
6234 // };
6235 level.nd = 0;
6236 } else {
6237 level.nd = -10;
6238 };
6239 //
6240 if ( var.AC ) {
6241 if ( FORCELEV == 0 ){
6242 // acFile = emigetFile(filename, "Anticounter");
6243 // if ( !acFile ){
6244 // printf("WARNING: no AC file! \n");
6245 // pamgui->DIALOG(1," No anticounters file! ");
6246 // var.AC = 0;
6247 // } else {
6248 // otr->AddFriend("Anticounter", acFile);
6249 printf("Show the Anticoincidence detector, LEVEL 0 data\n");
6250 ACLEV = 0;
6251 // };
6252 } else {
6253 // acFile = emigetFile(filename, "Physics.Level1", "Anticounter");
6254 // if ( !acFile ){
6255 // acFile = emigetFile(filename, "Anticounter");
6256 // if ( !acFile ){
6257 // printf("WARNING: no AC file! \n");
6258 // pamgui->DIALOG(1," No anticounters file! ");
6259 // var.AC = 0;
6260 // } else {
6261 // otr->AddFriend("Anticounter", acFile);
6262 printf("Show the Anticoincidence detector, LEVEL 0 data\n");
6263 ACLEV = 0;
6264 // };
6265 // } else {
6266 // otr->AddFriend("AcLevel1", acFile);
6267 // printf("Show the Anticoincidence detector, LEVEL 1 data\n");
6268 // ACLEV = 1;
6269 // };
6270 };
6271 level.ac = ACLEV;
6272 } else {
6273 level.ac = -10;
6274 };
6275 Int_t S4LEV = 0;
6276 if ( var.S4 ) {
6277 // s4File = emigetFile(filename, "S4");
6278 // if ( !s4File ){
6279 // printf("WARNING: no S4 file! \n");
6280 // pamgui->DIALOG(1," No S4 file! ");
6281 // var.S4 = 0;
6282 // } else {
6283 // otr->AddFriend("S4", s4File);
6284 if ( FORCELEV != 0 ){
6285 printf("Show the S4 detector, try to generate LEVEL1 data \n");
6286 S4LEV = 1;
6287 } else {
6288 printf("Show the S4 detector, LEVEL0 data \n");
6289 S4LEV = 0;
6290 };
6291 // };
6292 level.s4 = S4LEV;
6293 } else {
6294 level.s4 = -10;
6295 };
6296 //
6297 Int_t TOFLEV = 0;
6298 if ( var.TOF ) {
6299 if ( FORCELEV != 0 ){
6300 // tofFileL1 = emigetFile(filename, "Physics.Level1","TofTrigger");
6301 // if ( !tofFileL1 ){
6302 // tofFile = emigetFile(filename, "Tof");
6303 // if ( !tofFile ){
6304 // printf("WARNING: no TOF file! \n");
6305 // pamgui->DIALOG(1," No TOF file! ");
6306 // printf("Show the Time of Flight detector, LEVEL0 (trigger board) data\n");
6307 // // var.TOF = 0;
6308 // TOFLEV = 0;
6309 // } else {
6310 // otr->AddFriend("Tof", tofFile);
6311 printf("Show the Time of Flight, try to generate LEVEL1 data \n");
6312 TOFLEV = 10;
6313 // };
6314 // } else {
6315 // toftr = (TTree*)tofFileL1->Get("TofLevel1");
6316 // printf("Show the Time of Flight, LEVEL1 data \n");
6317 // TOFLEV = 1;
6318 // tofnoev = toftr->GetEntries();
6319 // };
6320 } else {
6321 printf("Show the Time of Flight detector, LEVEL0 data\n");
6322 TOFLEV = 0;
6323 };
6324 level.tof = TOFLEV;
6325 } else {
6326 level.tof = -10;
6327 };
6328 //
6329 printf("\n");
6330 //
6331 pamela::PscuHeader *ph = 0;
6332 pamela::EventHeader *eh = 0;
6333 pamela::trigger::TriggerEvent *trig = 0;
6334 Long64_t nevents = otr->GetEntries();
6335 //
6336 printf(" The file contains %i physics events \n",(int)nevents);
6337 //
6338 if (nevents<=0) {
6339 headerFile->Close();
6340 // triggerFile->Close();
6341 // if ( var.TRK ) trackerFile->Close();
6342 // if ( var.CALO )caloFile->Close();
6343 // if ( var.ND ) neutronFile->Close();
6344 // if ( var.AC ) acFile->Close();
6345 // if ( var.TOF ) tofFile->Close();
6346 // if ( var.S4 ) s4File->Close();
6347 printf("The file is empty, exiting...\n");
6348 pamgui->DIALOG(0," The file contains no physics data! ");
6349 var.waitforever = true;
6350 goto refresh;
6351 }
6352 //
6353 if ( var.SHOWDEC ){
6354 var.nosig = 1;
6355 } else {
6356 var.nosig = 0;
6357 };
6358 //
6359 // READ the CALORIMETER ADC to MIP conversion table (if trying to generate level1 data)
6360 //
6361 if ( !var.refresh ){
6362 if ( !CALOLEV && var.CALO ){
6363 printf(" ADC to MIP conversion file: \n %s \n",calfile.str().c_str());
6364 FILE *f;
6365 f = fopen(calfile.str().c_str(),"rb");
6366 if ( !f ){
6367 printf(" WARNING: no calorimeter ADC to MIP file! \n Using 26 as conversion factor for all strips. \n");
6368 } else {
6369 okcalo = 1;
6370 };
6371 //
6372 for (Int_t m = 0; m < 2 ; m++ ){
6373 for (Int_t k = 0; k < 22; k++ ){
6374 for (Int_t l = 0; l < 96; l++ ){
6375 if ( okcalo ) {
6376 fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f);
6377 } else {
6378 mip[m][k][l] = 26. ;
6379 };
6380
6381 };
6382 };
6383 };
6384 if ( okcalo ) fclose(f);
6385 };
6386 };
6387 //
6388 // Check that given input are inside the boundary conditions
6389 //
6390 if ( fromevent > toevent && toevent ){
6391 printf("It must be fromevent < toevent \n");
6392 return;
6393 };
6394 if ( fromevent > nevents+1 || fromevent < 0 ) {
6395 printf("You can choose fromevent between 0 (all) and %i \n",(int)nevents+1);
6396 return;
6397 };
6398 if ( toevent > nevents+1 || toevent < 0 ) {
6399 printf("You can choose toevent between 0 (all) and %i \n",(int)nevents+1);
6400 return;
6401 };
6402 Int_t minevent = 0;
6403 Int_t maxevent = nevents - 1;
6404 if ( fromevent == 0 ) {
6405 minevent = 0;
6406 maxevent = nevents - 1;
6407 } else {
6408 minevent = fromevent - 1;
6409 if ( toevent > 0 ){
6410 maxevent = toevent-1;
6411 } else {
6412 maxevent = fromevent-1;
6413 };
6414 };
6415 //
6416 //
6417 otr->SetBranchAddress("Header", &eh);
6418 otr->GetEntry(maxevent);
6419 ph = eh->GetPscuHeader();
6420 Int_t lastevno = (int)ph->GetCounter();
6421 otr->GetEntry(minevent);
6422 ph = eh->GetPscuHeader();
6423 Int_t firstevno = (int)ph->GetCounter();
6424 if ( !var.refresh ) i = minevent;
6425 var.refresh = false;
6426 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6427 // MAIN LOOP STARTS HERE:
6428 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6429 while ( 1 ){
6430 //
6431 // update progress bar
6432 //
6433 if ( popup ) pamgui->increment((float)(i+1)*100./(float)nevents);
6434 //
6435 // clear canvas and variables
6436 //
6437 var.beta[0] = 0.;
6438 var.beta[1] = 0.;
6439 var.beta[2] = 0.;
6440 var.beta[3] = 0.;
6441 var.beta[4] = 0.;
6442 var.s4sig = 0.;
6443 var.nstrip = 0;
6444 var.qtot = 0;
6445 var.nclx = 0;
6446 var.ncly = 0;
6447 var.trup = 0;
6448 var.bkup = 0;
6449 var.bkbo = 0;
6450 var.hcas = 0;
6451 var.hcat = 0;
6452 var.hcard = 0;
6453 //
6454 // call the filter to select events (if filter file is given)
6455 //
6456 if ( jumpto ){
6457 otr->SetBranchAddress("Header", &eh);
6458 otr->GetEntry(i);
6459 ph = eh->GetPscuHeader();
6460 Int_t cjumpto = (int)ph->GetCounter();
6461 if ( cjumpto == jumpto ) jumpto = 0;
6462 if ( jumpto && (i == maxevent || i == si) ) {
6463 if ( var.jumpen && i == maxevent ) {
6464 i = -1;
6465 var.jumpen = false;
6466 } else {
6467 i = si;
6468 printf(" WARNING: NO EVENT WITH EVENT NUMBER %i \n",jumpto);
6469 stringstream dialog;
6470 dialog.str("");
6471 dialog << " No event with event number ";
6472 dialog << jumpto;
6473 pamgui->DIALOG(1,dialog.str().c_str());
6474 jumpto = 0;
6475 };
6476 };
6477 };
6478 //
6479 isOK = 0;
6480 if ( !selection || ( i == minevent && !seldone) || ( i == minevent || i == maxevent )){
6481 if ( i == minevent && selection && seldone && doflag==2) pamgui->DIALOG(1," Stop searching, first event reached ");
6482 if ( i == maxevent && selection ) pamgui->DIALOG(1," Stop searching, last event reached ");
6483 isOK = 1;
6484 seldone = 1;
6485 } else {
6486 if ( CALOLEV == 0 ) ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,false);
6487 isOK = 0;
6488 stringstream cintcom;
6489 cintcom.str("");
6490 cintcom << "Int_t *i = (Int_t*)0x" << hex;
6491 cintcom << &i;
6492 gROOT->ProcessLine(cintcom.str().c_str());
6493 gROOT->ProcessLine("Int_t a = *i;");
6494 cintcom.str("");
6495 cintcom << "TTree *otr = (TTree*)0x" << hex;
6496 cintcom << otr;
6497 gROOT->ProcessLine(cintcom.str().c_str());
6498 cintcom.str("");
6499 cintcom << "TTree *ttr = (TTree*)0x" << hex;
6500 cintcom << ttr;
6501 gROOT->ProcessLine(cintcom.str().c_str());
6502 cintcom.str("");
6503 cintcom << "struct Levels &level = (struct Levels &)0x" << hex;
6504 cintcom << &level;
6505 gROOT->ProcessLine(cintcom.str().c_str());
6506 cintcom.str("");
6507 cintcom << "struct Variables &var = (struct Variables &)0x" << hex;
6508 cintcom << &var;
6509 gROOT->ProcessLine(cintcom.str().c_str());
6510 isOK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level,(Variables &)var);");
6511 seldone = 1;
6512 printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37);
6513 fflush(stdout);
6514 };
6515 //
6516 // if the event is selected go on
6517 //
6518 if ( isOK && !jumpto ) {
6519 if ( var.doflag == 3 ) selection = 1;
6520 printf("\n");
6521 figure->SetEditable(kTRUE);
6522 figure->Clear();
6523 figure->SetFillColor(10);
6524 figure->cd();
6525 //
6526 // Get Orbital Time information and header event number
6527 //
6528 otr->SetBranchAddress("Header", &eh);
6529 if ( !var.nosig) otr->GetEntry(i);
6530 ph = eh->GetPscuHeader();
6531 headcold = headc;
6532 headc = ph->GetCounter();
6533 var.headc = (int)ph->GetCounter();
6534 OBT = ph->GetOrbitalTime();
6535 DOBT = OBT - OOBT;
6536 OOBT = OBT;
6537 if ( i == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
6538 var.etime = OBT;
6539 //
6540 // who gave the trigger?
6541 //
6542 otr->SetBranchAddress("Trigger", &trig);
6543 if ( !var.nosig) otr->GetEntry(i);
6544 Int_t calotrig = 0;
6545 if ( trig->patterntrig[0] ) calotrig = 1;
6546 Int_t toftrig = 0;
6547 if ( trig->patterntrig[2] || trig->patterntrig[3] || trig->patterntrig[4] || trig->patterntrig[5] ) toftrig = 1;
6548 Int_t s4pulser = 0;
6549 if ( trig->patterntrig[1] & (1<<0) ) s4pulser = 1;
6550 //
6551 // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.
6552 // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":
6553 //
6554 if ( !calotrig && !toftrig ) s4pulser = 1;
6555 //
6556 Int_t trigconf = trig->trigconf;
6557 stringstream trc;
6558 trc.str("");
6559 if ( trigconf & (1<<0) ) trc << "TOF1";
6560 if ( trigconf & (1<<1) ) trc << " TOF2";
6561 if ( trigconf & (1<<2) ) trc << " TOF3";
6562 if ( trigconf & (1<<3) ) trc << " TOF4";
6563 if ( trigconf & (1<<4) ) trc << " TOF5";
6564 if ( trigconf & (1<<5) ) trc << " TOF6";
6565 if ( trigconf & (1<<6) ) trc << " TOF7";
6566 if ( trigconf & (1<<7) ) trc << " S4";
6567 if ( trigconf & (1<<8) ) trc << " CALO";
6568 if ( trigconf & (1<<9) ) trc << " CALIB_ON";
6569 TString trcs(trc.str().c_str());
6570 //
6571 // show TOF
6572 //
6573 if ( var.TOF ){
6574 figure->cd();
6575 if ( TOFLEV == 0 ){
6576 ShowTOF(i,otr,var);
6577 level.tof = 0;
6578 };
6579 if ( TOFLEV == 10 ){
6580 ShowTOFGENL1(i,otr,var);
6581 level.tof = 0;
6582 };
6583 // if ( TOFLEV == 1 ){
6584 // ShowTOFL1(i,toftr,var,pamgui);
6585 // level.tof = 1;
6586 // };
6587 };
6588 //
6589 // show anticounters
6590 //
6591 if ( var.AC ){
6592 figure->cd();
6593 if ( ACLEV == 0 ){
6594 ShowAC(i,otr,var,0);
6595 level.ac = 0;
6596 };
6597 if ( ACLEV == 1 ){
6598 ShowAC(i,otr,var,1);
6599 level.ac = 1;
6600 };
6601 };
6602 //
6603 // show S4
6604 //
6605 if ( var.S4 ){
6606 figure->cd();
6607 if ( S4LEV == 0 ){
6608 ShowS4L0(i,otr,var);
6609 level.s4 = 0;
6610 };
6611 if ( S4LEV == 1 ){
6612 ShowS4L1(i,otr,var);
6613 level.s4 = 1;
6614 };
6615 };
6616 //
6617 //
6618 // show neutron detector
6619 //
6620 if ( var.ND ){
6621 figure->cd();
6622 ShowND(i,otr,var);
6623 level.nd = 0;
6624 };
6625 //
6626 // show tracker
6627 //
6628 if ( var.TRK ){
6629 //
6630 // if we have level2 data show the track
6631 //
6632 // if ( STRACK == 1 ) {
6633 // if ( i == minevent && !trackdone1 ) {
6634 // //
6635 // // Load tracker libraries to read the magnetic field and compute the paritcle trajectory
6636 // //
6637 // trackdone1 = 1;
6638 // //
6639 // // Read the magnetic field map (two files), here it goes the path AND name of one of them.
6640 // //
6641 // printf("\n\n TRACKER: loading the magnetic field maps...\n\n\n");
6642 // const char *pam_calib = pathtocalibration();
6643 // stringstream bdir;
6644 // bdir.str("");
6645 // bdir << pam_calib << ".";
6646 // creadB(bdir.str().c_str());
6647 // //
6648 // printf(" ...done! \n");
6649 // };
6650 // level.track2 = 1;
6651 // figure->cd();
6652 // ShowTRACK(i,ttr,var,pamgui);
6653 // } else {
6654 // level.track2 = 0;
6655 // };
6656 //
6657 // show level1 data
6658 //
6659 figure->cd();
6660 // if ( TRKLEV == 1 ) {
6661 // if ( i == minevent && !trackdone2 ) {
6662 // trackdone2 = 1;
6663 // //
6664 // pamela::CalibTrk1Event *te1 = 0;
6665 // ctrk->SetBranchAddress("CalibTrk1.Event", &te1);
6666 // if ( ctrk->GetEntries() > 0 ){
6667 // ctrk->GetEntry(0);
6668 // for ( Int_t ii = 0 ; ii<6 ; ii++){
6669 // for ( Int_t ij = 0 ; ij<3072 ; ij++){
6670 // var.DSPsig_par[ii][ij] = te1->DSPsig_par[ii][ij];
6671 // };
6672 // };
6673 // pamela::CalibTrk2Event *te2 = 0;
6674 // ctrk->SetBranchAddress("CalibTrk2.Event", &te2);
6675 // ctrk->GetEntry(0);
6676 // for ( Int_t ii = 6 ; ii<12 ; ii++){
6677 // for ( Int_t ij = 0 ; ij<3072 ; ij++){
6678 // var.DSPsig_par[ii][ij] = te2->DSPsig_par[ii-6][ij];
6679 // };
6680 // };
6681 // } else {
6682 // for ( Int_t ii = 0 ; ii<12 ; ii++){
6683 // for ( Int_t ij = 0 ; ij<3072 ; ij++){
6684 // if ( ii > 5 ) var.DSPsig_par[ii][ij] = 8.;
6685 // if ( ii < 6 ) var.DSPsig_par[ii][ij] = 3.;
6686 // };
6687 // };
6688 // };
6689 // };
6690 // ShowTRKL1(i,ttr1,var,pamgui);
6691 // };
6692 //
6693 // if everything fails, show at least level0 data
6694 //
6695 if ( TRKLEV == 0 ) ShowTRKL0(i,otr,var);
6696 figure->Modified();
6697 figure->Update();
6698 level.track = TRKLEV;
6699 };
6700 //
6701 // show calorimeter
6702 //
6703 if ( var.CALO ){
6704 figure->cd();
6705 //
6706 // if we have LEVEL1 data
6707 //
6708 // if ( CALOLEV == 1 ) ShowCaloL1(i,otr,var);
6709 //
6710 // if we have only LEVEL0 data try to generate event by event LEVEL1 data
6711 //
6712 if ( CALOLEV == 0 ) {
6713 if ( !thefirst ) {
6714 ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,true);
6715 } else {
6716 printf("\n\n CALORIMETER: looking for calibration data...\n");
6717 thefirst = 0;
6718 Calo1stcalib(calcalibfile,calib,b);
6719 //
6720 // check calibration
6721 //
6722 Int_t calibex = 0;
6723 Int_t stop = 0;
6724 for (Int_t s=0; s<4;s++){
6725 if ( b[s] > 4 ) b[s] = 0;
6726 stop = 0;
6727 for (Int_t d = 0; d<48; d++){
6728 if ( calib.ttime[s][d] != 0 ) calibex++;
6729 if ( calib.time[s][0] != 0 ){
6730 if ( calib.time[s][d+1] == 0 ) {
6731 if ( !stop ){
6732 stop = 1;
6733 };
6734 };
6735 };
6736 };
6737 };
6738 printf(" ...done! \n\n\n");
6739 if ( calibex < 1 ) {
6740 printf(" No calorimeter calibrations! Switching to raw mode visualitation \n Only COMPRESS and FULL mode acquisition are supported \n\n");
6741 CALOLEV = -1;
6742 } else {
6743 ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var,true);
6744 };
6745 };
6746 };
6747 //
6748 // if everything fail, show level0 data
6749 //
6750 if ( CALOLEV == -1 ) {
6751 ShowCaloRAW(i,otr,var);
6752 };
6753 if ( var.nosig ){
6754 var.qtot = 0;
6755 var.nstrip = 0;
6756 };
6757 level.calo = CALOLEV;
6758 };
6759 figure->cd();
6760 //
6761 // SHOW INFOS
6762 //
6763 if ( var.INFOS ){
6764 figure->cd();
6765 text->SetTextAngle(0);
6766 text->SetTextFont(32);
6767 text->SetTextColor(1);
6768 text->SetTextSize(0.025); // 0.02
6769 text->SetTextAlign(12);
6770 Float_t txthi = 0.47;
6771 testo.str("");
6772 testo << "File: " << file;
6773 testo << " - Event number: " << (int)headc;
6774 text->DrawLatex(0.33,txthi,testo.str().c_str());
6775 txthi -= 0.03;
6776 testo.str("");
6777 testo << "Progressive number: " << (i+1);
6778 if ( s4pulser ){
6779 testo << " - S4 trigger - ";
6780 };
6781 if ( calotrig ){
6782 testo << " - CALO trigger - ";
6783 };
6784 text->DrawLatex(0.33,txthi,testo.str().c_str());
6785 txthi -= 0.03;
6786 testo2.str("");
6787 testo2 << "On Board Time: " << (int)OBT;
6788 if ( DOBT > 0 ) {
6789 testo2 << " (delta: " << (int)DOBT;
6790 testo2 << ")";
6791 };
6792 testo2 << " [ms]";
6793 text->DrawLatex(0.33,txthi,testo2.str().c_str());
6794 txthi -= 0.03;
6795 text->SetTextSize(0.020); // 0.015
6796 const char *trc2 = trcs;
6797 testo3.str("");
6798 testo3 << "TRIGGER: " << trc2;
6799 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6800 txthi -= 0.03;
6801 testo3.str("");
6802 testo3 << "AC: CARD hit = " << var.hcard;
6803 testo3 << " CAT hit = " << var.hcat;
6804 testo3 << " CAS hit = " << var.hcas;
6805 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6806 txthi -= 0.03;
6807 testo3.str("");
6808 if ( STRACK ){
6809 testo3 << "TRK: RIG = " << setprecision(3) << var.rig;
6810 testo3 << " [GV] CHI2 = " << setprecision(3) << var.chi2;
6811 } else {
6812 testo3 << "TRK: NCLX = "<< var.nclx;
6813 testo3 << " NCLY = "<<var.ncly;
6814 };
6815 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6816 txthi -= 0.03;
6817 testo3.str("");
6818 testo3 << "CALO: NSTRIP = " << var.nstrip;
6819 testo3 << " QTOT = "<<var.qtot << " [MIP]";
6820 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6821 txthi -= 0.03;
6822 testo3.str("");
6823 testo3 << "S4: ";// << setprecision(2);
6824 testo3 << var.s4sig << " [MIP] TOF: #beta(1,...,5) = (";
6825 testo3 << setprecision(3) << var.beta[0];
6826 testo3 << ",";
6827 testo3 << setprecision(3) << var.beta[1];
6828 testo3 << ",";
6829 testo3 << setprecision(3) << var.beta[2];
6830 testo3 << ",";
6831 testo3 << setprecision(3) << var.beta[3];
6832 testo3 << ",";
6833 testo3 << setprecision(3) << var.beta[4];
6834 testo3 << ")";
6835 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6836 txthi -= 0.03;
6837 testo3.str("");
6838 testo3 << "ND: Trig: " << var.trup;
6839 testo3 << " - Bckgr: upper = " << var.bkup;
6840 testo3 << " lower = " << var.bkbo;
6841 text->DrawLatex(0.33,txthi,testo3.str().c_str());
6842 txthi -= 0.03;
6843 text->SetTextSize(0.01);
6844 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.519*var.sfy,"CPU SIDE");
6845 text->SetTextAngle(90);
6846 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE");
6847 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
6848 if ( var.AC ){
6849 text->SetTextAngle(90);
6850 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
6851 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
6852 //
6853 text->SetTextAngle(0);
6854 text->SetTextSize(0.015);
6855 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
6856 elli->Draw();
6857 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
6858 TArrow *arr;
6859 arr = new TArrow(var.xcat+0.22*var.sfx,var.ycat-0.25*var.sfy,var.xcat+0.22*var.sfx,var.ycat-0.21*var.sfy);
6860 arr->SetArrowSize(0.005);
6861 arr->Draw();
6862 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
6863 arr = new TArrow(var.xcat+0.22*var.sfx,var.ycat-0.25*var.sfy,var.xcat+0.18*var.sfx,var.ycat-0.25*var.sfy);
6864 arr->SetArrowSize(0.005);
6865 arr->Draw();
6866 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
6867 text->SetTextSize(0.01);
6868 };
6869 //
6870 // coordinates systems and x/y view labels
6871 //
6872 figure->cd();
6873 text->SetTextAngle(0);
6874 text->SetTextFont(32);
6875 text->SetTextColor(1);
6876 text->SetTextAlign(12);
6877 text->SetTextSize(0.01);
6878 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
6879 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
6880 //
6881 text->SetTextSize(0.015);
6882 text->SetTextFont(2);
6883 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
6884 text->SetTextFont(32);
6885 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
6886 TArrow *arr;
6887 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.21*var.sfx,var.yxvc-0.328*var.sfy);
6888 arr->SetArrowSize(0.005);
6889 arr->Draw();
6890 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
6891 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.25*var.sfx,var.yxvc-0.288*var.sfy);
6892 arr->SetArrowSize(0.005);
6893 arr->Draw();
6894 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
6895 //
6896 text->SetTextSize(0.015);
6897 text->SetTextFont(2);
6898 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
6899 text->SetTextFont(32);
6900 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
6901 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.2*var.sfx,var.yyvc-0.328*var.sfy);
6902 arr->SetArrowSize(0.005);
6903 arr->Draw();
6904 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
6905 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.24*var.sfx,var.yyvc-0.288*var.sfy);
6906 arr->SetArrowSize(0.005);
6907 arr->Draw();
6908 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
6909 text->SetTextSize(0.01);
6910 //
6911 /* text->SetTextSize(0.015); */
6912 /* text->SetTextFont(2); */
6913 /* DrawX(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,0.005,var); */
6914 /* text->SetTextFont(32); */
6915 /* text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.508*var.sfy,"y"); */
6916 /* TArrow *arr; */
6917 /* arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.19*var.sfx,var.yxvc-0.508*var.sfy); */
6918 /* arr->SetArrowSize(0.005); */
6919 /* arr->Draw(); */
6920 /* text->DrawLatex(var.xxvc-0.19*var.sfx,var.yxvc-0.515*var.sfy,"x"); */
6921 /* arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.23*var.sfx,var.yxvc-0.468*var.sfy); */
6922 /* arr->SetArrowSize(0.005); */
6923 /* arr->Draw(); */
6924 /* text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.468*var.sfy,"z"); */
6925 /* // */
6926 /* text->SetTextSize(0.015); */
6927 /* text->SetTextFont(2); */
6928 /* DrawX(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,0.005,var); */
6929 /* text->SetTextFont(32); */
6930 /* text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.508*var.sfy,"x"); */
6931 /* arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.18*var.sfx,var.yyvc-0.508*var.sfy); */
6932 /* arr->SetArrowSize(0.005); */
6933 /* arr->Draw(); */
6934 /* text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.511*var.sfy,"y"); */
6935 /* arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.22*var.sfx,var.yyvc-0.468*var.sfy); */
6936 /* arr->SetArrowSize(0.005); */
6937 /* arr->Draw(); */
6938 /* text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.468*var.sfy,"z"); */
6939 /* text->SetTextSize(0.01); */
6940 };
6941 //
6942 // SHOW PALETTE
6943 //
6944 if ( var.PALETTE ) ShowPalette(var.bw);
6945 //
6946 // SHOW VERBOSE INFOS
6947 //
6948 if ( var.VINFOS ){
6949 figure->cd();
6950 text->SetTextAngle(0);
6951 text->SetTextFont(32);
6952 text->SetTextColor(1);
6953 text->SetTextSize(0.01);
6954 text->SetTextAlign(12);
6955 if ( var.AC ){
6956 //
6957 // Plane view
6958 //
6959 text->SetTextAngle(90);
6960 text->DrawLatex(var.xcat+0.1*var.sfx,var.ycat-0.015*var.sfy,"CARD4");
6961 text->SetTextAngle(-90);
6962 text->DrawLatex(var.xcat-0.1*var.sfx,var.ycat+0.015*var.sfy,"CARD1");
6963 text->SetTextAngle(0);
6964 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.116*var.sfy,"CARD2");
6965 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.116*var.sfy,"CARD3");
6966 text->SetTextAngle(90);
6967 text->DrawLatex(var.xcat+0.13*var.sfx,var.ycat-0.015*var.sfy,"CAS3");
6968 text->SetTextAngle(-90);
6969 text->DrawLatex(var.xcat-0.13*var.sfx,var.ycat+0.015*var.sfy,"CAS4");
6970 text->SetTextAngle(0);
6971 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.140*var.sfy,"CAS2");
6972 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.140*var.sfy,"CAS1");
6973 text->DrawLatex(var.xcat+0.17*var.sfx,var.ycat,"CAT1");
6974 text->DrawLatex(var.xcat-0.2*var.sfx,var.ycat,"CAT2");
6975 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.198*var.sfy,"CAT3");
6976 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.198*var.sfy,"CAT4");
6977 //
6978 // X and Y views
6979 //
6980 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc-0.08*var.sfy,"CAS2");
6981 text->DrawLatex(var.xxvc+0.17*var.sfx,var.yxvc-0.08*var.sfy,"CAS1");
6982 text->DrawLatex(var.xyvc-0.192*var.sfx,var.yyvc-0.08*var.sfy,"CAS4");
6983 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.08*var.sfy,"CAS3");
6984 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.48*var.sfy,"CARD2");
6985 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.48*var.sfy,"CARD3");
6986 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.48*var.sfy,"CARD1");
6987 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.48*var.sfy,"CARD4");
6988 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.39*var.sfy,"CAT3");
6989 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.39*var.sfy,"CAT4");
6990 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2");
6991 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.39*var.sfy,"CAT1");
6992 };
6993 if ( var.CALO ){
6994 text->SetTextSize(0.020);
6995 text->SetTextAngle(90);
6996 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.290*var.sfy,"Calorimeter");
6997 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.290*var.sfy,"Calorimeter");
6998 text->SetTextSize(0.01);
6999 text->SetTextAngle(0);
7000 };
7001 if ( var.TRK ){
7002 text->SetTextSize(0.020);
7003 text->SetTextAngle(90);
7004 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc+0.080*var.sfy,"Tracker");
7005 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc+0.080*var.sfy,"Tracker");
7006 text->SetTextSize(0.01);
7007 text->SetTextAngle(0);
7008 };
7009 if ( var.ND ){
7010 text->SetTextSize(0.020);
7011 // text->SetTextAngle(90);
7012 text->DrawLatex(var.xxvc-0.25*var.sfx,var.yxvc-0.530*var.sfy,"ND");
7013 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.530*var.sfy,"ND");
7014 text->SetTextSize(0.01);
7015 text->SetTextAngle(0);
7016 };
7017 if ( var.TOF ){
7018 text->SetTextSize(0.020);
7019 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.130*var.sfy,"S3");
7020 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.350*var.sfy,"S2");
7021 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.653*var.sfy,"S1");
7022 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc-0.130*var.sfy,"S3");
7023 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.350*var.sfy,"S2");
7024 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.653*var.sfy,"S1");
7025 text->SetTextSize(0.01);
7026 };
7027 if ( var.S4 ){
7028 text->SetTextSize(0.020);
7029 text->DrawLatex(var.xxvc-0.28*var.sfx,var.yxvc-0.350*var.sfy,"S4");
7030 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.350*var.sfy,"S4");
7031 text->SetTextSize(0.01);
7032 };
7033 if ( !var.INFOS ){
7034 text->SetTextSize(0.01);
7035 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.520*var.sfy,"CPU SIDE");
7036 text->SetTextAngle(90);
7037 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE");
7038 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
7039 if ( var.AC ){
7040 text->SetTextAngle(90);
7041 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
7042 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
7043 //
7044 text->SetTextAngle(0);
7045 text->SetTextSize(0.015);
7046 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
7047 elli->Draw();
7048 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
7049 TArrow *arr;
7050 arr = new TArrow(var.xcat+0.22*var.sfx,var.ycat-0.25*var.sfy,var.xcat+0.22*var.sfx,var.ycat-0.21*var.sfy);
7051 arr->SetArrowSize(0.005);
7052 arr->Draw();
7053 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
7054 arr = new TArrow(var.xcat+0.22*var.sfx,var.ycat-0.25*var.sfy,var.xcat+0.18*var.sfx,var.ycat-0.25*var.sfy);
7055 arr->SetArrowSize(0.005);
7056 arr->Draw();
7057 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
7058 text->SetTextSize(0.01);
7059 };
7060 //
7061 // coordinates systems and x/y view labels
7062 //
7063 figure->cd();
7064 text->SetTextAngle(0);
7065 text->SetTextFont(32);
7066 text->SetTextColor(1);
7067 text->SetTextAlign(12);
7068 text->SetTextSize(0.01);
7069 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
7070 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
7071 //
7072 text->SetTextSize(0.015);
7073 text->SetTextFont(2);
7074 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
7075 text->SetTextFont(32);
7076 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
7077 TArrow *arr;
7078 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.21*var.sfx,var.yxvc-0.328*var.sfy);
7079 arr->SetArrowSize(0.005);
7080 arr->Draw();
7081 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
7082 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.25*var.sfx,var.yxvc-0.288*var.sfy);
7083 arr->SetArrowSize(0.005);
7084 arr->Draw();
7085 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
7086 //
7087 text->SetTextSize(0.015);
7088 text->SetTextFont(2);
7089 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
7090 text->SetTextFont(32);
7091 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
7092 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.2*var.sfx,var.yyvc-0.328*var.sfy);
7093 arr->SetArrowSize(0.005);
7094 arr->Draw();
7095 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
7096 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.24*var.sfx,var.yyvc-0.288*var.sfy);
7097 arr->SetArrowSize(0.005);
7098 arr->Draw();
7099 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
7100 text->SetTextSize(0.01);
7101 };
7102 };
7103 //
7104 // update figure
7105 //
7106 figure->Modified();
7107 figure->Update();
7108 figure->cd();
7109 figure->SetEditable(kFALSE);
7110 //
7111 // print infos on terminal
7112 //
7113 printf(" File: %s \n",name);
7114 if ( !s4pulser && !calotrig ){
7115 printf(" Event number: %i - Progressive number: %i \n",(int)headc,i+1);
7116 };
7117 if ( s4pulser ){
7118 printf(" Event number: %i - Progressive number: %i - S4 trigger -\n",(int)headc,i+1);
7119 };
7120 if ( calotrig ){
7121 printf(" Event number: %i - Progressive number: %i - CALO trigger -\n",(int)headc,i+1);
7122 };
7123 printf(" On Board Time: %i (delta %i) [ms]\n",OBT,DOBT);
7124 const char *trc2 = trcs;
7125 printf(" TRIGGER: %s \n",trc2);
7126 printf(" AC: CARD hit = %i CAT hit = %i CAS hit = %i \n",var.hcard,var.hcat,var.hcas);
7127 if ( STRACK ){
7128 printf(" TRK: NCLX = %i NCLY = %i RIG = %f [GV] CHI2 = %f \n",var.nclx,var.ncly,var.rig,var.chi2);
7129 } else {
7130 printf(" TRK: NCLX = %i NCLY = %i \n ",var.nclx,var.ncly);
7131 };
7132 printf(" CALO: NSTRIP = %i QTOT = %i [MIP]\n",var.nstrip,var.qtot);
7133 printf(" S4: %.2f [MIP] TOF: beta(1,...,5) = (%.2f,%.2f,%.2f,%.2f,%.2f) \n",var.s4sig,var.beta[0],var.beta[1],var.beta[2],var.beta[3],var.beta[4]);
7134 printf(" ND: Trigger: neutrons = %i - Background: upper = %i lower = %i \n",var.trup,var.bkup,var.bkbo);
7135 //
7136 // Interact with user: do you want to continue, go backward, exit or print the figure?
7137 //
7138 printf("\n\n\n\n\n\n\n\n\n\n");
7139 si = i;
7140 doflag = 1;
7141 jumpto = 0;
7142 var.i = i;
7143 var.doflag = doflag;
7144 var.jumpto = jumpto;
7145 var.nevents = nevents;
7146 var.lastevno = lastevno;
7147 var.firstevno = firstevno;
7148 //
7149 char *bw;
7150 if ( var.bw ){
7151 bw = "_bw";
7152 } else {
7153 bw = "";
7154 };
7155 TString filenm = file;
7156 const string fil = (const char*)filenm;
7157 Int_t posiz = fil.find("dw_");
7158 if ( posiz == -1 ) posiz = fil.find("DW_");
7159 Int_t posiz2 = posiz+13;
7160 TString file2;
7161 stringcopy(file2,filenm,posiz,posiz2);
7162 const char *figrec = file2;
7163 const char *outdir = outDir;
7164 stringstream figsave;
7165 figsave.str("");
7166 figsave << outdir << "/";
7167 figsave << figrec;
7168 figsave << "_ev_";
7169 figsave << (var.i+1);
7170 figsave << bw;
7171 var.svas=figsave.str().c_str();
7172 pamgui->upgrnamfi();
7173 //
7174 var.jumpen = false;
7175 // njumpen = 0;
7176 Int_t ifout = 0;
7177 while( !var.goon && !var.refresh && !var.restart ) {
7178 if ( !gROOT->GetListOfCanvases()->FindObject(figure) ) {
7179 pamgui->Terminate();
7180 };
7181 gSystem->ProcessEvents();
7182 };
7183 var.goon = false;
7184 if ( var.refresh || var.restart ){
7185 headerFile->Close();
7186 // triggerFile->Close();
7187 // if ( trackerFile ) trackerFile->Close();
7188 // if ( trackerFile2 ) trackerFile2->Close();
7189 // if ( caloFile )caloFile->Close();
7190 // if ( neutronFile ) neutronFile->Close();
7191 // if ( acFile ) acFile->Close();
7192 // if ( tofFile ) tofFile->Close();
7193 // if ( tofFileL1 ) tofFileL1->Close();
7194 // if ( s4File ) s4File->Close();
7195 // if ( trackhead ) trackhead->Close();
7196 // if ( trackcalibFile1 ) trackcalibFile1->Close();
7197 // if ( trackcalibFile2 ) trackcalibFile2->Close();
7198 // if ( trackerFile2b ) trackerFile2b->Close();
7199 if ( var.refresh ) goto refresh;
7200 if ( var.restart ){
7201 filename = var.thefilename.Data();
7202 goto restart;
7203 };
7204 };
7205 //
7206 i = var.i;
7207 doflag = var.doflag;
7208 jumpto = var.jumpto;
7209 if ( i != si ) OOBT = 1000000000;
7210 if ( maxevent < i ) {
7211 maxevent = nevents;
7212 printf("WARNING: you have chosen an event number out of the starting range.\n Range extended to %i\n\n",maxevent);
7213 };
7214 if ( ifout ) goto theend;
7215 };
7216 if ( doflag == 2 && i == 0 ) {
7217 printf("\n WARNING: Cannot go backward! Going forward. \n");
7218 doflag = 1;
7219 };
7220 if ( doflag == 2 && i>0 ) i--;
7221 if ( doflag == 1 ) i++;
7222 if ( var.doflag == 3 ) selection = 0;
7223 //
7224 // if in selection mode, print out a event progress bar:
7225 //
7226 if ( !selection || i == minevent ){
7227 // do nothing
7228 } else {
7229 if ( (maxevent-minevent) != 0 ){
7230 if((100*(i-minevent)/(maxevent-minevent))<10.){
7231 printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8);
7232 } else {
7233 printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8);
7234 };
7235 };
7236 };
7237
7238 };
7239 //
7240 // END OF THE MAIN LOOP AND OF THE MAIN PROGRAM
7241 //
7242 printf("\n");
7243 theend: if ( !ifout ) printf("\nFinished, exiting... \n\n");
7244 printf(" ...done! \n\n");
7245 return;
7246 }

  ViewVC Help
Powered by ViewVC 1.1.23