/[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.1.1.1 - (show annotations) (download) (vendor branch)
Mon Mar 20 10:36:48 2006 UTC (18 years, 8 months ago) by mocchiut
Branch: FEventViewer
CVS Tags: v1r00, start
Changes since 1.1: +0 -0 lines
First flight release (limited capabilities)

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

  ViewVC Help
Powered by ViewVC 1.1.23