/[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.2 - (show annotations) (download)
Wed Mar 22 15:05:27 2006 UTC (18 years, 8 months ago) by mocchiut
Branch: MAIN
CVS Tags: v1r02
Changes since 1.1: +19 -47 lines
Read calorimeter ADC2MIP calib data, fix installation bug

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

  ViewVC Help
Powered by ViewVC 1.1.23