/[PAMELA software]/eventviewer/flight/src/FEVdetector.cpp
ViewVC logotype

Contents of /eventviewer/flight/src/FEVdetector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Oct 24 13:18:24 2006 UTC (18 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.2: +1 -0 lines
Added libTrkLevel1.so to Makefile

1 #include <math.h>
2 #include <stdio.h>
3 //
4 #include <iostream>
5 #include <iomanip>
6 #include <fstream>
7 #if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
8 char* operator+( std::streampos&, char* );
9 #endif
10 //
11 #include <TObjectTable.h>
12 #include <TGClient.h>
13 #include <TGButton.h>
14 #include <TGComboBox.h>
15 #include <TGLabel.h>
16 #include <TGTextEntry.h>
17 #include <TGFrame.h>
18 #include <TGButtonGroup.h>
19 #include <TGProgressBar.h>
20 #include <TGMsgBox.h>
21 #include <TGComboBox.h>
22 //
23 #include <TTree.h>
24 #include <TClassEdit.h>
25 #include <TObject.h>
26 #include <TList.h>
27 #include <TSystem.h>
28 #include <TSystemDirectory.h>
29 #include <TString.h>
30 #include <TFile.h>
31 #include <TClass.h>
32 #include <TCanvas.h>
33 #include <TH1.h>
34 #include <TH1F.h>
35 #include <TH2D.h>
36 #include <TLatex.h>
37 #include <TPad.h>
38 #include <TPaveLabel.h>
39 #include <TLine.h>
40 #include <TPolyLine.h>
41 #include <TChain.h>
42 #include <TApplication.h>
43 #include <TVirtualX.h>
44 #include <TGClient.h>
45 #include <TGWindow.h>
46 #include <TEllipse.h>
47 #include <TArrow.h>
48 #include <TStyle.h>
49 //
50 #include <PamelaRun.h>
51 #include <physics/calorimeter/CalorimeterEvent.h>
52 #include <physics/trigger/TriggerEvent.h>
53 #include <physics/tof/TofEvent.h>
54 #include <physics/tracker/TrackerEvent.h>
55 #include <physics/anticounter/AnticounterEvent.h>
56 #include <physics/neutronDetector/NeutronEvent.h>
57 #include <physics/S4/S4Event.h>
58 #include <CalibCalPedEvent.h>
59 #include <CalibTrk1Event.h>
60 #include <CalibTrk2Event.h>
61 //
62 #include <FEVpathtoc.h>
63 //
64 #include <PamLevel2.h>
65 //
66 #include <FEVpamevcontrol.h>
67 #include <FEVdetector.h>
68 #include <FEventViewer.h>
69 #include <feventvstruct.h>
70 //
71 extern Bool_t existfile(TString);
72 //
73
74 using namespace std;
75
76 FEVdetector::FEVdetector(TString filename, TString selfile, Int_t &mainctrlword, TCanvas &figure){
77 var.thefilename = filename.Data();
78 var.thefilter = selfile.Data();
79 ctrlword = &mainctrlword;
80 thefigure = &figure;
81 checkctrlword();
82 var.selex = false;
83 }
84
85 void FEVdetector::checkctrlword(){
86 var.SHOWDEC = 0;
87 var.TOF = 0;
88 var.AC = 0;
89 var.TRK = 0;
90 var.CALO = 0;
91 var.S4 = 0;
92 var.ND = 0;
93 var.INFOS = 0;
94 var.VINFOS = 0;
95 var.PALETTE = 0;
96 if ( *ctrlword & (1<<0) ) {
97 var.PALETTE = 1;
98 };
99 if ( *ctrlword & (1<<1) ) {
100 var.VINFOS = 1;
101 };
102 if ( *ctrlword & (1<<2) ) {
103 var.INFOS = 1;
104 };
105 if ( *ctrlword & (1<<3) ) {
106 var.ND = 1;
107 };
108 if ( *ctrlword & (1<<4) ) {
109 var.S4 = 1;
110 };
111 if ( *ctrlword & (1<<5) ) {
112 var.CALO = 1;
113 };
114 if ( *ctrlword & (1<<6) ) {
115 var.TRK = 1;
116 };
117 if ( *ctrlword & (1<<7) ) {
118 var.AC = 1;
119 };
120 if ( *ctrlword & (1<<8) ) {
121 var.TOF = 1;
122 };
123 }
124
125 void FEVdetector::GetWindow(){
126 otr->GetEntry(maxevent);
127 if ( level.file < 2 ){
128 ph = eh->GetPscuHeader();
129 lastevno = (int)ph->Counter;
130 } else {
131 lastevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file!
132 };
133 otr->GetEntry(minevent);
134 if ( level.file < 2 ){
135 ph = eh->GetPscuHeader();
136 firstevno = (int)ph->Counter;
137 } else {
138 firstevno = oinfoL2->pkt_num; // to be changed as soon as we will have pkt_counter in the level2 file!
139 };
140 }
141
142 void FEVdetector::ClearVariables(){
143 var.beta[0] = 0.;
144 var.beta[1] = 0.;
145 var.beta[2] = 0.;
146 var.beta[3] = 0.;
147 var.beta[4] = 0.;
148 var.s4sig = 0.;
149 var.nstrip = 0;
150 var.qtot = 0;
151 var.nclx = 0;
152 var.ncly = 0;
153 var.trup = 0;
154 var.bkup = 0;
155 var.bkbo = 0;
156 var.hcas = 0;
157 var.hcat = 0;
158 var.hcard = 0;
159 }
160
161 void FEVdetector::GetEntry(Int_t i){
162 thisentry = i;
163 otr->GetEntry(i);
164 }
165
166 void FEVdetector::SetEntry(Int_t i){
167 thisentry = i;
168 }
169
170 int FEVdetector::GetCounter(){
171 if ( level.file < 2 ){
172 ph = eh->GetPscuHeader();
173 return((int)ph->Counter);
174 } else {
175 // return(thisentry); // to be changed as soon as we will have pkt_counter in the level2 file!
176 return((int)oinfoL2->pkt_num); // to be changed as soon as we will have pkt_counter in the level2 file!
177 };
178 }
179
180 void FEVdetector::SetGUIPtr(PAMevcontrol &mainpamgui){
181 pamgui = &mainpamgui;
182 }
183
184 void FEVdetector::DrawX(Float_t cx, Float_t cy, Float_t si, Variables & var){
185 Float_t x[2] = {-si*var.sfx,si*var.sfx};
186 Float_t y[2] = {-si*var.sfy,si*var.sfy};
187 Float_t xb[2];
188 Float_t yb[2];
189 for (Int_t i = 0; i<2 ; i++){
190 xb[i] = x[i]+cx;
191 yb[i] = y[i]+cy;
192 };
193 TLine *x2 = new TLine(xb[0],yb[0],xb[1],yb[1]);
194 x2->SetLineColor(1);
195 x2->SetLineWidth(1);
196 x2->Draw();
197 //
198 Float_t nx[2] = {-si*var.sfx,si*var.sfx};
199 Float_t ny[2] = {si*var.sfy,-si*var.sfy};
200 Float_t xa[2];
201 Float_t ya[2];
202 for (Int_t i = 0; i<2 ; i++){
203 xa[i] = nx[i]+cx;
204 ya[i] = ny[i]+cy;
205 };
206 TLine *x1 = new TLine(xa[0],ya[0],xa[1],ya[1]);
207 x1->SetLineColor(1);
208 x1->SetLineWidth(1);
209 x1->Draw();
210 }
211
212 void FEVdetector::ColorMIP(Float_t mip, int& colo){
213 if ( colo > 0 ){
214 colo = 10;
215 if ( mip > 0.7 ) colo = 38;
216 if ( mip > 2. ) colo = 4;
217 if ( mip > 10. ) colo = 3;
218 if ( mip > 100. ) colo = 2;
219 if ( mip > 500. ) colo = 6;
220 } else {
221 colo = 10;
222 if ( mip > 0.7 ) colo = 17;
223 if ( mip > 2. ) colo = 15;
224 if ( mip > 10. ) colo = 14;
225 if ( mip > 100. ) colo = 13;
226 if ( mip > 500. ) colo = 12;
227 };
228 }
229
230 void FEVdetector::ColorTOFMIP(Float_t mip, int& colo){
231 if ( colo > 0 ){
232 colo = 10;
233 if ( mip > 0. ) colo = 38;
234 if ( mip > 2. ) colo = 4;
235 if ( mip > 10. ) colo = 3;
236 if ( mip > 100. ) colo = 2;
237 if ( mip > 500. ) colo = 6;
238 } else {
239 colo = 10;
240 if ( mip > 0. ) colo = 17;
241 if ( mip > 2. ) colo = 15;
242 if ( mip > 10. ) colo = 14;
243 if ( mip > 100. ) colo = 13;
244 if ( mip > 500. ) colo = 12;
245 };
246 }
247
248 void FEVdetector::ColorTRKMIP(Float_t mip, int& colo, Int_t img){
249 if ( !img ){
250 if ( colo > 0 ){
251 colo = 10;
252 if ( mip > 0. ) colo = 38;
253 if ( mip > 2. ) colo = 4;
254 if ( mip > 10. ) colo = 3;
255 if ( mip > 100. ) colo = 2;
256 if ( mip > 500. ) colo = 6;
257 } else {
258 colo = 10;
259 if ( mip > 0. ) colo = 17;
260 if ( mip > 2. ) colo = 15;
261 if ( mip > 10. ) colo = 14;
262 if ( mip > 100. ) colo = 13;
263 if ( mip > 500. ) colo = 12;
264 };
265 } else {
266 if ( colo > 0 ){
267 colo = 10;
268 if ( mip > 0. ) colo = 41;
269 if ( mip > 2. ) colo = 42;
270 if ( mip > 10. ) colo = 43;
271 if ( mip > 100. ) colo = 44;
272 if ( mip > 500. ) colo = 45;
273 } else {
274 colo = 10;
275 if ( mip > 0. ) colo = 17;
276 if ( mip > 2. ) colo = 15;
277 if ( mip > 10. ) colo = 14;
278 if ( mip > 100. ) colo = 13;
279 if ( mip > 500. ) colo = 12;
280 };
281 };
282 }
283
284 void FEVdetector::GetGeneralInfo(){
285 //
286 // Get Orbital Time information and header event number
287 //
288 if ( level.file < 2 ){
289 ph = eh->GetPscuHeader();
290 headcold = headc;
291 headc = ph->Counter;
292 var.headc = (int)ph->Counter;
293 OBT = ph->OrbitalTime;
294 DOBT = OBT - OOBT;
295 OOBT = OBT;
296 if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
297 var.etime = OBT;
298 //
299 // who gave the trigger?
300 //
301 calotrig = 0;
302 if ( trigger->patterntrig[0] ) calotrig = 1;
303 toftrig = 0;
304 if ( trigger->patterntrig[2] || trigger->patterntrig[3] || trigger->patterntrig[4] || trigger->patterntrig[5] ) toftrig = 1;
305 s4pulser = 0;
306 if ( trigger->patterntrig[1] & (1<<0) ) s4pulser = 1;
307 //
308 // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.
309 // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":
310 //
311 if ( !calotrig && !toftrig ) s4pulser = 1;
312 //
313 Int_t trigconf = trigger->trigconf;
314 stringstream trc;
315 trc.str("");
316 if ( trigconf & (1<<0) ) trc << "TOF1";
317 if ( trigconf & (1<<1) ) trc << " TOF2";
318 if ( trigconf & (1<<2) ) trc << " TOF3";
319 if ( trigconf & (1<<3) ) trc << " TOF4";
320 if ( trigconf & (1<<4) ) trc << " TOF5";
321 if ( trigconf & (1<<5) ) trc << " TOF6";
322 if ( trigconf & (1<<6) ) trc << " TOF7";
323 if ( trigconf & (1<<7) ) trc << " S4";
324 if ( trigconf & (1<<8) ) trc << " CALO";
325 if ( trigconf & (1<<9) ) trc << " CALIB_ON";
326 trcs = (TString)trc.str().c_str();
327 } else {
328 headcold = headc;
329 headc = oinfoL2->pkt_num; // to be changed as soon as we will have obt in the level2 file!
330 OBT = oinfoL2->OBT; // to be changed as soon as we will have obt in the level2 file!
331 DOBT = OBT - OOBT;
332 OOBT = OBT;
333 if ( thisentry == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
334 var.etime = OBT;
335 //
336 // who gave the trigger?
337 //
338 calotrig = 0;
339 if ( L2->patterntrig[0] ) calotrig = 1;
340 toftrig = 0;
341 if ( L2->patterntrig[2] || L2->patterntrig[3] || L2->patterntrig[4] || L2->patterntrig[5] ) toftrig = 1;
342 s4pulser = 0;
343 if ( L2->patterntrig[1] & (1<<0) ) s4pulser = 1;
344 //
345 // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.
346 // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":
347 //
348 if ( !calotrig && !toftrig ) s4pulser = 1;
349 //
350 Int_t trigconf = L2->trigconf;
351 stringstream trc;
352 trc.str("");
353 if ( trigconf & (1<<0) ) trc << "TOF1";
354 if ( trigconf & (1<<1) ) trc << " TOF2";
355 if ( trigconf & (1<<2) ) trc << " TOF3";
356 if ( trigconf & (1<<3) ) trc << " TOF4";
357 if ( trigconf & (1<<4) ) trc << " TOF5";
358 if ( trigconf & (1<<5) ) trc << " TOF6";
359 if ( trigconf & (1<<6) ) trc << " TOF7";
360 if ( trigconf & (1<<7) ) trc << " S4";
361 if ( trigconf & (1<<8) ) trc << " CALO";
362 if ( trigconf & (1<<9) ) trc << " CALIB_ON";
363 trcs = (TString)trc.str().c_str();
364 };
365 }
366
367
368 int FEVdetector::SelectEvent(){
369 //
370 //
371 //
372 Int_t isOK = 1;
373 Bool_t insel = var.selex;
374 Bool_t ispktnum = false;
375 //
376 if ( var.doflag == 3 ){
377 thisentry = si;
378 var.jumpto = 0;
379 var.jumpen = false;
380 insel = false;
381 };
382 //
383 if ( var.jumpto ){
384 ispktnum = true;
385 isOK = 0;
386 Int_t cjumpto = GetCounter();
387 if ( cjumpto == var.jumpto ){
388 var.jumpto = 0;
389 var.jumpen = false;
390 isOK = 1;
391 };
392 if ( var.jumpto && (thisentry == maxevent || thisentry == si) ) {
393 if ( var.jumpen && thisentry == maxevent ) {
394 thisentry = -1;
395 var.jumpen = false;
396 } else {
397 var.jumpen = false;
398 thisentry = si;
399 printf(" WARNING: NO EVENT WITH PACKET NUMBER %i \n",var.jumpto);
400 stringstream dialog;
401 dialog.str("");
402 dialog << " No event with packet number ";
403 dialog << var.jumpto;
404 pamgui->DIALOG(1,dialog.str().c_str());
405 var.jumpto = 0;
406 isOK = 1;
407 };
408 };
409 };
410 if ( insel && !ispktnum ){
411 isOK = 0;
412 //
413 // check if we have reached the first or last event
414 //
415 if ( thisentry == minevent || thisentry == maxevent ){
416 isOK = 1;
417 if ( thisentry == minevent && var.doflag==2 ) pamgui->DIALOG(1," Stop searching, first event reached ");
418 if ( thisentry == maxevent && var.doflag==1 ) pamgui->DIALOG(1," Stop searching, last event reached ");
419 } else {
420 //
421 // if level = -1 determine higher level variables and store them in structure "var"
422 //
423 if ( level.file == -1 ){
424 thefigure->cd();
425 ShowS4(false);
426 thefigure->cd();
427 ShowTRK(false);
428 thefigure->cd();
429 ShowCalo(false);
430 };
431 //
432 // here we pass to the interpreter pointer to the L2 pointer or the data tree and the structure of other variables
433 //
434 stringstream cintcom;
435 //
436 if ( level.file == 2 ){
437 cintcom.str("");
438 cintcom << "PamLevel2 *L2 = (PamLevel2*)0x" << hex;
439 cintcom << L2;
440 gROOT->ProcessLine(cintcom.str().c_str());
441 } else {
442 cintcom.str("");
443 cintcom << "TTree *otr = (TTree*)0x" << hex;
444 cintcom << otr;
445 gROOT->ProcessLine(cintcom.str().c_str());
446 //
447 cintcom.str("");
448 cintcom << "struct Variables &var = (struct Variables &)0x" << hex;
449 cintcom << &var;
450 gROOT->ProcessLine(cintcom.str().c_str());
451 };
452 //
453 // call the selection routine for the correct level
454 //
455 if ( level.file == 0 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,0,(Variables &)var);");
456 //
457 if ( level.file == -1 ) isOK = gApplication->ProcessLine("filter((TTree *)otr,-1,(Variables &)var);");
458 //
459 if ( level.file == 2 ) isOK = gApplication->ProcessLine("filter((PamLevel2 *)L2,2);");
460 //
461 // progress bar in text window
462 //
463 printf("Scanning data: %d%c done",100*(thisentry-minevent)/(maxevent-minevent),37);
464 fflush(stdout);
465 };
466 };
467 //
468 return(isOK);
469 //
470 }
471
472 void FEVdetector::Load(TTree &mainotr, TFile &mainfile){
473 file = &mainfile;
474 otr = &mainotr;
475 L2 = new PamLevel2();
476 //
477 if ( level.file == 2 ){
478 otr = L2->LoadPamTrees(file);
479 // ********************
480 // load magnetic field
481 // ********************
482 const char *pam_calib = pathtocalibration();
483 //
484 stringstream magfie;
485 magfie.str("");
486 // magfie << "/localdisk/mocchiut/test/calib/trk-param/field_param-0/";
487 magfie << pam_calib;
488 magfie << "/trk-param/field_param-0/";
489 //
490 L2->LoadField(magfie.str().c_str());
491 } else {
492 //
493 // load calorimeter ADC2MIP conversion file
494 //
495 const char *pam_calib = pathtocalibration();
496 stringstream calfile;
497 calfile.str("");
498 calfile << pam_calib << "/cal-param/FCaloADC2MIP.dat";
499 //
500 FILE *f = 0;
501 printf("\n Using ADC to MIP conversion file: \n %s \n",calfile.str().c_str());
502 f = fopen(calfile.str().c_str(),"rb");
503 if ( !f ){
504 printf(" CALORIMETER - ERROR: no ADC to MIP file! using 26.0 for all strips\n");
505 for (Int_t m = 0; m < 2 ; m++ ){
506 for (Int_t k = 0; k < 22; k++ ){
507 for (Int_t l = 0; l < 96; l++ ){
508 mip[m][k][l] = 26.;
509 };
510 };
511 };
512 } else {
513 //
514 for (Int_t m = 0; m < 2 ; m++ ){
515 for (Int_t k = 0; k < 22; k++ ){
516 for (Int_t l = 0; l < 96; l++ ){
517 fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f);
518 };
519 };
520 };
521 fclose(f);
522 };
523 //
524 // if not level2 file we must look for at least one calorimeter calibration
525 //
526 Calo1stcalib();
527 //
528 };
529 //
530
531 //
532 trigger = new pamela::trigger::TriggerEvent();
533 eh = new pamela::EventHeader();
534 ph = new pamela::PscuHeader();
535 oinfoL2 = new OrbitalInfo();
536 runinfo = new ItoRunInfo(file);
537 //
538 de = new pamela::calorimeter::CalorimeterEvent();
539 trk = new pamela::tracker::TrackerEvent();
540 ne = new pamela::neutron::NeutronEvent();
541 ace = new pamela::anticounter::AnticounterEvent();
542 s4 = new pamela::S4::S4Event();
543 tof = new pamela::tof::TofEvent();
544 //
545 if ( level.file == 0 || level.file == -1 ){
546 otr->SetBranchAddress("Trigger", &trigger);
547 otr->SetBranchAddress("Header", &eh);
548 };
549 if ( level.file == 2 ){
550 otr->AddFriend("OrbitalInfo", file);
551 otr->SetBranchAddress("OrbitalInfo", &oinfoL2);
552 runinfo->Read(0ULL);
553 };
554 //
555 if ( var.TRK ) {
556 if ( level.file == 0 || level.file == -1 ){
557 printf("Show the Tracker detector, LEVEL0 data \n");
558 otr->SetBranchAddress("Tracker", &trk);
559 };
560 if ( level.file == 2 ){
561 printf("Show the Tracker detector, LEVEL1 data \n");
562 printf("Get the track informations (LEVEL2 Tracker data)\n");
563 };
564 };
565 //
566 if ( var.CALO ) {
567 if ( level.file == 0 ){
568 printf("Show the Calorimeter detector, LEVEL0 data \n");
569 otr->SetBranchAddress("Calorimeter", &de);
570 };
571 if ( level.file == -1 ){
572 otr->SetBranchAddress("Calorimeter", &de);
573 printf("Show the Calorimeter detector, rough calibration of data \n");
574 };
575 if ( level.file == 2 ){
576 printf("Show the Calorimeter detector, LEVEL2 data \n");
577 };
578 };
579 //
580 if ( var.ND ) {
581 if ( level.file == 0 || level.file == -1 ){
582 printf("Show the Neutron Detector, LEVEL0 data \n");
583 otr->SetBranchAddress("Neutron", &ne);
584 };
585 if ( level.file == 2 ){
586 printf("Show the Neutron Detector, LEVEL2 data \n");
587 };
588 };
589 //
590 if ( var.AC ) {
591 if ( level.file == 0 || level.file == -1 ){
592 printf("Show the Anticounters detector, LEVEL0 data \n");
593 otr->SetBranchAddress("Anticounter", &ace);
594 };
595 if ( level.file == 2 ){
596 printf("Show the Anticounter Detector, LEVEL2 data \n");
597 };
598 };
599 //
600 if ( var.S4 ) {
601 if ( level.file == 0 ){
602 printf("Show the S4 detector, LEVEL0 data \n");
603 };
604 if ( level.file == -1 ){
605 otr->SetBranchAddress("S4", &s4);
606 printf("Show the S4 detector, rough calibration of data \n");
607 };
608 if ( level.file == 2 ){
609 printf("Show the S4 detector, LEVEL2 data \n");
610 };
611 };
612 //
613 if ( var.TOF ) {
614 if ( level.file == 0 ){
615 printf("Show the Time of Flight detector, LEVEL0 data \n");
616 };
617 if ( level.file == -1 ){
618 otr->SetBranchAddress("Tof", &tof);
619 printf("Show the Time of Flight detector, rough calibration of data \n");
620 };
621 if ( level.file == 2 ){
622 printf("Show the Time of Flight detector, LEVEL2 data \n");
623 };
624 };
625 //
626 }
627
628 void FEVdetector::DisplayEvent(){
629 TLatex *text=new TLatex();
630 stringstream testo;
631 stringstream testo2;
632 stringstream testo3;
633 //
634 //
635 //
636 thefigure->Clear();
637 //
638 // show TOF
639 //
640 thefigure->cd();
641 ShowTOF();
642 //
643 // show anticounters
644 //
645 thefigure->cd();
646 ShowAC();
647 //
648 // show S4
649 //
650 thefigure->cd();
651 ShowS4(true);
652 //
653 // show neutron detector
654 //
655 thefigure->cd();
656 ShowND();
657 //
658 // show track
659 //
660 thefigure->cd();
661 ShowTrack();
662 //
663 // show tracker
664 //
665 thefigure->cd();
666 ShowTRK(true);
667 //
668 // show calorimeter
669 //
670 thefigure->cd();
671 ShowCalo(true);
672 //
673 // SHOW INFOS
674 //
675 if ( var.INFOS ){
676 thefigure->cd();
677 text->SetTextAngle(0);
678 text->SetTextFont(32);
679 text->SetTextColor(1);
680 text->SetTextSize(0.025); // 0.02
681 text->SetTextAlign(12);
682 Float_t txthi = 0.47;
683 testo.str("");
684 testo << "File: " << gSystem->BaseName(var.thefilename.Data());
685 // testo << "File: " << file;
686 testo << " - Pkt_num: " << (int)headc;
687 text->DrawLatex(0.33,txthi,testo.str().c_str());
688 txthi -= 0.03;
689 testo.str("");
690 testo << "Progressive number: " << (thisentry+1);
691 if ( s4pulser ){
692 testo << " - S4 trigger - ";
693 };
694 if ( calotrig ){
695 testo << " - CALO trigger - ";
696 };
697 text->DrawLatex(0.33,txthi,testo.str().c_str());
698 txthi -= 0.03;
699 testo2.str("");
700 testo2 << "On Board Time: " << (int)OBT;
701 if ( DOBT > 0 ) {
702 testo2 << " (delta: " << (int)DOBT;
703 testo2 << ")";
704 };
705 testo2 << " [ms]";
706 text->DrawLatex(0.33,txthi,testo2.str().c_str());
707 txthi -= 0.03;
708 text->SetTextSize(0.020); // 0.015
709 const char *trc2 = trcs;
710 testo3.str("");
711 testo3 << "TRIGGER: " << trc2;
712 text->DrawLatex(0.33,txthi,testo3.str().c_str());
713 txthi -= 0.03;
714 testo3.str("");
715 testo3 << "AC: CARD hit = " << var.hcard;
716 testo3 << " CAT hit = " << var.hcat;
717 testo3 << " CAS hit = " << var.hcas;
718 text->DrawLatex(0.33,txthi,testo3.str().c_str());
719 txthi -= 0.03;
720 testo3.str("");
721 if ( level.file == 2 ){
722 testo3 << "TRK: RIG = " << setprecision(3) << var.rig;
723 testo3 << " [GV] CHI2 = " << setprecision(3) << var.chi2;
724 } else {
725 testo3 << "TRK: NCLX = "<< var.nclx;
726 testo3 << " NCLY = "<<var.ncly;
727 };
728 text->DrawLatex(0.33,txthi,testo3.str().c_str());
729 txthi -= 0.03;
730 testo3.str("");
731 testo3 << "CALO: NSTRIP = " << var.nstrip;
732 testo3 << " QTOT = "<<var.qtot << " [MIP]";
733 text->DrawLatex(0.33,txthi,testo3.str().c_str());
734 txthi -= 0.03;
735 testo3.str("");
736 testo3 << "S4: ";// << setprecision(2);
737 testo3 << var.s4sig << " [MIP] TOF: #beta = ";
738 testo3 << setprecision(3) << var.beta[4];
739 text->DrawLatex(0.33,txthi,testo3.str().c_str());
740 txthi -= 0.03;
741 testo3.str("");
742 testo3 << "ND: Trig: " << var.trup;
743 testo3 << " - Bckgr: upper = " << var.bkup;
744 testo3 << " lower = " << var.bkbo;
745 text->DrawLatex(0.33,txthi,testo3.str().c_str());
746 txthi -= 0.03;
747 text->SetTextSize(0.01);
748 text->DrawLatex(var.xxvc-0.040*var.sfx,var.yxvc-0.519*var.sfy,"SATELLITE (CPU) SIDE");
749 text->SetTextAngle(90);
750 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.065*var.sfy,"SATELLITE (CPU) SIDE");
751 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
752 if ( var.AC ){
753 text->SetTextAngle(90);
754 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
755 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
756 //
757 text->SetTextAngle(0);
758 text->SetTextSize(0.015);
759 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
760 elli->Draw();
761 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
762 TArrow *arr;
763 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);
764 arr->SetArrowSize(0.005);
765 arr->Draw();
766 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
767 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);
768 arr->SetArrowSize(0.005);
769 arr->Draw();
770 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
771 text->SetTextSize(0.01);
772 };
773 //
774 // coordinates systems and x/y view labels
775 //
776 thefigure->cd();
777 text->SetTextAngle(0);
778 text->SetTextFont(32);
779 text->SetTextColor(1);
780 text->SetTextAlign(12);
781 text->SetTextSize(0.01);
782 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
783 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
784 //
785 text->SetTextSize(0.015);
786 text->SetTextFont(2);
787 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
788 text->SetTextFont(32);
789 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
790 TArrow *arr;
791 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);
792 arr->SetArrowSize(0.005);
793 arr->Draw();
794 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
795 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);
796 arr->SetArrowSize(0.005);
797 arr->Draw();
798 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
799 //
800 text->SetTextSize(0.015);
801 text->SetTextFont(2);
802 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
803 text->SetTextFont(32);
804 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
805 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);
806 arr->SetArrowSize(0.005);
807 arr->Draw();
808 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
809 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);
810 arr->SetArrowSize(0.005);
811 arr->Draw();
812 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
813 text->SetTextSize(0.01);
814 //
815 };
816 //
817 // SHOW PALETTE
818 //
819 thefigure->cd();
820 if ( var.PALETTE ) ShowPalette();
821 //
822 // SHOW VERBOSE INFOS
823 //
824 if ( var.VINFOS ){
825 thefigure->cd();
826 text->SetTextAngle(0);
827 text->SetTextFont(32);
828 text->SetTextColor(1);
829 text->SetTextSize(0.01);
830 text->SetTextAlign(12);
831 if ( var.AC ){
832 //
833 // Plane view
834 //
835 text->SetTextAngle(90);
836 text->DrawLatex(var.xcat+0.1*var.sfx,var.ycat-0.015*var.sfy,"CARD4");
837 text->SetTextAngle(-90);
838 text->DrawLatex(var.xcat-0.1*var.sfx,var.ycat+0.015*var.sfy,"CARD1");
839 text->SetTextAngle(0);
840 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.116*var.sfy,"CARD2");
841 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.116*var.sfy,"CARD3");
842 text->SetTextAngle(90);
843 text->DrawLatex(var.xcat+0.13*var.sfx,var.ycat-0.015*var.sfy,"CAS3");
844 text->SetTextAngle(-90);
845 text->DrawLatex(var.xcat-0.13*var.sfx,var.ycat+0.015*var.sfy,"CAS4");
846 text->SetTextAngle(0);
847 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.140*var.sfy,"CAS2");
848 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.140*var.sfy,"CAS1");
849 text->DrawLatex(var.xcat+0.17*var.sfx,var.ycat,"CAT1");
850 text->DrawLatex(var.xcat-0.2*var.sfx,var.ycat,"CAT2");
851 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.198*var.sfy,"CAT3");
852 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.198*var.sfy,"CAT4");
853 //
854 // X and Y views
855 //
856 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc-0.08*var.sfy,"CAS2");
857 text->DrawLatex(var.xxvc+0.17*var.sfx,var.yxvc-0.08*var.sfy,"CAS1");
858 text->DrawLatex(var.xyvc-0.192*var.sfx,var.yyvc-0.08*var.sfy,"CAS4");
859 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.08*var.sfy,"CAS3");
860 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.48*var.sfy,"CARD2");
861 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.48*var.sfy,"CARD3");
862 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.48*var.sfy,"CARD1");
863 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.48*var.sfy,"CARD4");
864 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.39*var.sfy,"CAT3");
865 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.39*var.sfy,"CAT4");
866 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2");
867 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.39*var.sfy,"CAT1");
868 };
869 if ( var.CALO ){
870 text->SetTextSize(0.020);
871 text->SetTextAngle(90);
872 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.290*var.sfy,"Calorimeter");
873 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.290*var.sfy,"Calorimeter");
874 text->SetTextSize(0.01);
875 text->SetTextAngle(0);
876 };
877 if ( var.TRK ){
878 text->SetTextSize(0.020);
879 text->SetTextAngle(90);
880 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc+0.080*var.sfy,"Tracker");
881 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc+0.080*var.sfy,"Tracker");
882 text->SetTextSize(0.01);
883 text->SetTextAngle(0);
884 };
885 if ( var.ND ){
886 text->SetTextSize(0.020);
887 // text->SetTextAngle(90);
888 text->DrawLatex(var.xxvc-0.25*var.sfx,var.yxvc-0.530*var.sfy,"ND");
889 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.530*var.sfy,"ND");
890 text->SetTextSize(0.01);
891 text->SetTextAngle(0);
892 };
893 if ( var.TOF ){
894 text->SetTextSize(0.020);
895 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.130*var.sfy,"S3");
896 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.350*var.sfy,"S2");
897 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.653*var.sfy,"S1");
898 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc-0.130*var.sfy,"S3");
899 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.350*var.sfy,"S2");
900 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.653*var.sfy,"S1");
901 text->SetTextSize(0.01);
902 };
903 if ( var.S4 ){
904 text->SetTextSize(0.020);
905 text->DrawLatex(var.xxvc-0.28*var.sfx,var.yxvc-0.350*var.sfy,"S4");
906 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.350*var.sfy,"S4");
907 text->SetTextSize(0.01);
908 };
909 if ( !var.INFOS ){
910 text->SetTextSize(0.01);
911 text->DrawLatex(var.xxvc-0.040*var.sfx,var.yxvc-0.520*var.sfy,"SATELLITE (CPU) SIDE");
912 text->SetTextAngle(90);
913 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.065*var.sfy,"SATELLITE (CPU) SIDE");
914 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
915 if ( var.AC ){
916 text->SetTextAngle(90);
917 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
918 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
919 //
920 text->SetTextAngle(0);
921 text->SetTextSize(0.015);
922 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
923 elli->Draw();
924 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
925 TArrow *arr;
926 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);
927 arr->SetArrowSize(0.005);
928 arr->Draw();
929 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
930 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);
931 arr->SetArrowSize(0.005);
932 arr->Draw();
933 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
934 text->SetTextSize(0.01);
935 };
936 //
937 // coordinates systems and x/y view labels
938 //
939 thefigure->cd();
940 text->SetTextAngle(0);
941 text->SetTextFont(32);
942 text->SetTextColor(1);
943 text->SetTextAlign(12);
944 text->SetTextSize(0.01);
945 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
946 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
947 //
948 text->SetTextSize(0.015);
949 text->SetTextFont(2);
950 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
951 text->SetTextFont(32);
952 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
953 TArrow *arr;
954 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);
955 arr->SetArrowSize(0.005);
956 arr->Draw();
957 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
958 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);
959 arr->SetArrowSize(0.005);
960 arr->Draw();
961 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
962 //
963 text->SetTextSize(0.015);
964 text->SetTextFont(2);
965 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
966 text->SetTextFont(32);
967 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
968 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);
969 arr->SetArrowSize(0.005);
970 arr->Draw();
971 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
972 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);
973 arr->SetArrowSize(0.005);
974 arr->Draw();
975 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
976 text->SetTextSize(0.01);
977 };
978 };
979 //
980 //
981 // update figure
982 //
983 thefigure->cd();
984 thefigure->Modified();
985 thefigure->Update();
986 thefigure->cd();
987 thefigure->SetEditable(kFALSE);
988 //
989 // print infos on terminal
990 //
991 printf(" File: %s \n",var.thefilename.Data());
992 if ( !s4pulser && !calotrig ){
993 printf(" Pkt_num: %i - Progressive number: %i \n",(int)headc,thisentry+1);
994 };
995 if ( s4pulser ){
996 printf(" Pkt_num: %i - Progressive number: %i - S4 trigger -\n",(int)headc,thisentry+1);
997 };
998 if ( calotrig ){
999 printf(" Pkt_num: %i - Progressive number: %i - CALO trigger -\n",(int)headc,thisentry+1);
1000 };
1001 printf(" On Board Time: %i (delta %i) [ms]\n",OBT,DOBT);
1002 const char *trc2 = trcs;
1003 printf(" TRIGGER: %s \n",trc2);
1004 printf(" AC: CARD hit = %i CAT hit = %i CAS hit = %i \n",var.hcard,var.hcat,var.hcas);
1005 if ( level.file == 2 ){
1006 printf(" TRK: NCLX = %i NCLY = %i RIG = %f [GV] CHI2 = %f \n",var.nclx,var.ncly,var.rig,var.chi2);
1007 } else {
1008 printf(" TRK: NCLX = %i NCLY = %i \n ",var.nclx,var.ncly);
1009 };
1010 printf(" CALO: NSTRIP = %i QTOT = %i [MIP]\n",var.nstrip,var.qtot);
1011 printf(" S4: %.2f [MIP] TOF: beta = %.2f \n",var.s4sig,var.beta[4]);
1012 printf(" ND: Trigger: neutrons = %i - Background: upper = %i lower = %i \n",var.trup,var.bkup,var.bkbo);
1013 //
1014 }
1015
1016 //
1017 // THE PALETTE
1018 //
1019 void FEVdetector::ShowPalette(){
1020 Float_t xp = 0.40;
1021 Float_t yp = 0.02;
1022 Float_t xw = 0.2325;
1023 Float_t yh = 0.19;
1024 Double_t xx[5] = {xp, xp+xw, xp+xw, xp, xp};
1025 Double_t yy[5] = {yp, yp, yp+yh, yp+yh, yp};
1026 TPolyLine *fpale = new TPolyLine(5,xx,yy);
1027 fpale->SetLineColor(1);
1028 fpale->SetLineWidth(1);
1029 fpale->Draw();
1030 TLatex *txt=new TLatex();
1031 txt->SetTextSize(0.01);
1032 txt->DrawLatex(xp+0.005,yp+yh-0.015,"PALETTE");
1033 if ( level.file == -1 ) txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, CALO, S4 [MIP]:");
1034 if ( level.file == 2 ) txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, TRK, CALO, S4 [MIP]:");
1035 Float_t xwc = (xw-0.01)/6.;
1036 Float_t axwc = xwc+0.02;
1037 Float_t yhc = 0.03;
1038 Int_t colo = 0;
1039 Float_t yc = 0.135;
1040 TPolyLine *fc1[6];
1041 if ( var.bw ){
1042 if ( level.file != 0 ){
1043 for ( Int_t j=0; j<6; j++){
1044 Float_t xc = 0.005+xp+(j*xwc);
1045 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
1046 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1047 fc1[j] = new TPolyLine(5,xx,yy);
1048 fc1[j]->SetLineColor(1);
1049 if ( j == 0 ) {
1050 colo = 10;
1051 };
1052 if ( j == 1 ) {
1053 colo = 17;
1054 };
1055 if ( j == 2 ) {
1056 colo = 15;
1057 };
1058 if ( j == 3 ) {
1059 colo = 14;
1060 };
1061 if ( j == 4 ) {
1062 colo = 13;
1063 };
1064 if ( j == 5 ) {
1065 colo = 12;
1066 };
1067 fc1[j]->SetFillColor(colo);
1068 fc1[j]->SetLineWidth(1);
1069 fc1[j]->Draw("f");
1070 fc1[j]->Draw();
1071 if ( j == 0 ) {
1072 txt->DrawLatex(xc+0.005,yc+0.01,"0");
1073 };
1074 if ( j == 1 ) {
1075 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
1076 };
1077 if ( j == 2 ) {
1078 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
1079 };
1080 if ( j == 3 ) {
1081 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
1082 };
1083 if ( j == 4 ) {
1084 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
1085 };
1086 if ( j == 5 ) {
1087 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
1088 };
1089 };
1090 };
1091 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
1092 Float_t yc = 0.08;
1093 TPolyLine *fc2[6];
1094 for ( Int_t j=0; j<6; j++){
1095 Float_t xc = 0.005+xp+(j*xwc);
1096 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
1097 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1098 fc2[j] = new TPolyLine(5,xx,yy);
1099 fc2[j]->SetLineColor(1);
1100 if ( j == 0 ) {
1101 colo = 10;
1102 };
1103 if ( j == 1 ) {
1104 colo = 17;
1105 };
1106 if ( j == 2 ) {
1107 colo = 15;
1108 };
1109 if ( j == 3 ) {
1110 colo = 14;
1111 };
1112 if ( j == 4 ) {
1113 colo = 13;
1114 };
1115 if ( j == 5 ) {
1116 colo = 12;
1117 };
1118 fc2[j]->SetFillColor(colo);
1119 fc2[j]->SetLineWidth(1);
1120 fc2[j]->Draw("f");
1121 fc2[j]->Draw();
1122 if ( j == 0 ) {
1123 txt->DrawLatex(xc+0.005,yc+0.01,"0");
1124 };
1125 if ( j == 1 ) {
1126 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
1127 };
1128 if ( j == 2 ) {
1129 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
1130 };
1131 if ( j == 3 ) {
1132 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
1133 };
1134 if ( j == 4 ) {
1135 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
1136 };
1137 if ( j == 5 ) {
1138 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
1139 };
1140 };
1141 //
1142 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
1143 yc = 0.025;
1144 TPolyLine *fc3[3];
1145 for ( Int_t j=0; j<3; j++){
1146 Float_t xc = 0.005+xp+(j*axwc);
1147 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
1148 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1149 fc3[j] = new TPolyLine(5,xx,yy);
1150 fc3[j]->SetLineColor(1);
1151 if ( j == 0 ) {
1152 colo = 10;
1153 };
1154 if ( j == 1 ) {
1155 colo = 13;
1156 };
1157 if ( j == 2 ) {
1158 colo = 12;
1159 };
1160 fc3[j]->SetFillColor(colo);
1161 fc3[j]->SetLineWidth(1);
1162 fc3[j]->Draw("f");
1163 fc3[j]->Draw();
1164 if ( j == 0 ) {
1165 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
1166 };
1167 if ( j == 1 ) {
1168 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
1169 };
1170 if ( j == 2 ) {
1171 txt->SetTextSize(0.0095);
1172 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
1173 txt->SetTextSize(0.01);
1174 };
1175 };
1176 } else {
1177 if ( level.file != 0 ){
1178 for ( Int_t j=0; j<6; j++){
1179 Float_t xc = 0.005+xp+(j*xwc);
1180 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
1181 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1182 fc1[j] = new TPolyLine(5,xx,yy);
1183 fc1[j]->SetLineColor(1);
1184 if ( j == 0 ) {
1185 colo = 10;
1186 };
1187 if ( j == 1 ) {
1188 colo = 38;
1189 };
1190 if ( j == 2 ) {
1191 colo = 4;
1192 };
1193 if ( j == 3 ) {
1194 colo = 3;
1195 };
1196 if ( j == 4 ) {
1197 colo = 2;
1198 };
1199 if ( j == 5 ) {
1200 colo = 6;
1201 };
1202 fc1[j]->SetFillColor(colo);
1203 fc1[j]->SetLineWidth(1);
1204 fc1[j]->Draw("f");
1205 fc1[j]->Draw();
1206 if ( j == 0 ) {
1207 txt->DrawLatex(xc+0.005,yc+0.01,"0");
1208 };
1209 if ( j == 1 ) {
1210 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
1211 };
1212 if ( j == 2 ) {
1213 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
1214 };
1215 if ( j == 3 ) {
1216 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
1217 };
1218 if ( j == 4 ) {
1219 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
1220 };
1221 if ( j == 5 ) {
1222 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
1223 };
1224 };
1225 };
1226 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
1227 Float_t yc = 0.08;
1228 TPolyLine *fc2[6];
1229 for ( Int_t j=0; j<6; j++){
1230 Float_t xc = 0.005+xp+(j*xwc);
1231 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
1232 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1233 fc2[j] = new TPolyLine(5,xx,yy);
1234 fc2[j]->SetLineColor(1);
1235 if ( j == 0 ) {
1236 colo = 10;
1237 };
1238 if ( j == 1 ) {
1239 colo = 38;
1240 };
1241 if ( j == 2 ) {
1242 colo = 4;
1243 };
1244 if ( j == 3 ) {
1245 colo = 3;
1246 };
1247 if ( j == 4 ) {
1248 colo = 2;
1249 };
1250 if ( j == 5 ) {
1251 colo = 6;
1252 };
1253 fc2[j]->SetFillColor(colo);
1254 fc2[j]->SetLineWidth(1);
1255 fc2[j]->Draw("f");
1256 fc2[j]->Draw();
1257 if ( j == 0 ) {
1258 txt->DrawLatex(xc+0.005,yc+0.01,"0");
1259 };
1260 if ( j == 1 ) {
1261 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
1262 };
1263 if ( j == 2 ) {
1264 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
1265 };
1266 if ( j == 3 ) {
1267 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
1268 };
1269 if ( j == 4 ) {
1270 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
1271 };
1272 if ( j == 5 ) {
1273 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
1274 };
1275 };
1276 //
1277 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
1278 yc = 0.025;
1279 TPolyLine *fc3[3];
1280 for ( Int_t j=0; j<3; j++){
1281 Float_t xc = 0.005+xp+(j*axwc);
1282 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
1283 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
1284 fc3[j] = new TPolyLine(5,xx,yy);
1285 fc3[j]->SetLineColor(1);
1286 if ( j == 0 ) {
1287 colo = 10;
1288 };
1289 if ( j == 1 ) {
1290 colo = 2;
1291 };
1292 if ( j == 2 ) {
1293 colo = 42;
1294 };
1295 fc3[j]->SetFillColor(colo);
1296 fc3[j]->SetLineWidth(1);
1297 fc3[j]->Draw("f");
1298 fc3[j]->Draw();
1299 if ( j == 0 ) {
1300 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
1301 };
1302 if ( j == 1 ) {
1303 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
1304 };
1305 if ( j == 2 ) {
1306 txt->SetTextSize(0.0095);
1307 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
1308 txt->SetTextSize(0.01);
1309 };
1310 };
1311 };
1312 }
1313
1314 //
1315 // THE TOF
1316 //
1317 void FEVdetector::ShowTOF(){
1318 //
1319 //
1320 //
1321 if ( !var.TOF ) return;
1322 //
1323 Int_t tt = 0;
1324 //
1325 // force level0, i.e. show patterntrig variable!
1326 //
1327 if ( level.file == 0 ){
1328 //
1329 // on day these variables will contain the MIP value for each paddle
1330 //
1331 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
1332 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
1333 Float_t ms21a[2] = {0.,0.};
1334 Float_t ms22a[2] = {0.,0.};
1335 Float_t ms31a[3] = {0.,0.,0.};
1336 Float_t ms32a[3] = {0.,0.,0.};
1337 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
1338 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
1339 Float_t ms21b[2] = {0.,0.};
1340 Float_t ms22b[2] = {0.,0.};
1341 Float_t ms31b[3] = {0.,0.,0.};
1342 Float_t ms32b[3] = {0.,0.,0.};
1343 //
1344 // TDC info for each PMT
1345 //
1346 Float_t mt11[2][8];
1347 Float_t mt12[2][6];
1348 Float_t mt21[2][2];
1349 Float_t mt22[2][2];
1350 Float_t mt31[2][3];
1351 Float_t mt32[2][3];
1352 //
1353 Int_t S3 = 0;
1354 Int_t S2 = 0;
1355 Int_t S12 = 0;
1356 Int_t S11 = 0;
1357 S3 = trigger->patterntrig[2];
1358 S2 = trigger->patterntrig[3];
1359 S12 = trigger->patterntrig[4];
1360 S11 = trigger->patterntrig[5];
1361 //
1362 for ( Int_t i = 0; i<8; i++ ) {
1363 if ( S11 & (1<<i) ){
1364 ms11a[i] = 1.;
1365 }
1366 if ( S11 & (1<<(i+8) ) ){
1367 ms11b[i] = 1.;
1368 }
1369 };
1370 for ( Int_t i = 0; i<6; i++ ) {
1371 if ( S12 & (1<<i) ) {
1372 ms12a[i] = 1.;
1373 }
1374 if ( S12 & (1<<(i+6)) ) {
1375 ms12b[i] = 1.;
1376 }
1377 };
1378 Int_t ii = 2;
1379 for ( Int_t i = 0; i<2; i++ ) {
1380 ii--;
1381 if ( S2 & (1<<i) ) {
1382 ms21a[ii] = 1.;
1383 }
1384 if ( S2 & (1<<(i+2)) ) {
1385 ms21b[ii] = 1.;
1386 }
1387 };
1388 for ( Int_t i = 4; i<6; i++ ) {
1389 if ( S2 & (1<<i) ) {
1390 ms22a[i-4] = 1.;
1391 }
1392 if ( S2 & (1<<(i+2)) ) {
1393 ms22b[i-4] = 1.;
1394 }
1395 };
1396 for ( Int_t i = 0; i<3; i++ ) {
1397 if ( S3 & (1<<i) ) {
1398 ms31a[i] = 1.;
1399 }
1400 if ( S3 & (1<<(i+3)) ) {
1401 ms31b[i] = 1.;
1402 }
1403 };
1404 for ( Int_t i = 6; i<9; i++ ) {
1405 if ( S3 & (1<<i) ) {
1406 ms32a[i-6] = 1.;
1407 }
1408 if ( S3 & (1<<(i+3)) ) {
1409 ms32b[i-6] = 1.;
1410 }
1411 };
1412 //
1413 Int_t colo;
1414 Int_t ocolo;
1415 Float_t xs2x = var.xxvc;
1416 Float_t ys2x = var.yxvc + 0.36*var.sfy;
1417 Float_t xs2y = var.xyvc;
1418 Float_t ys2y = var.yyvc + 0.36*var.sfy;
1419 Float_t ws2 = 0.005;
1420 Float_t ws13 = 0.007;
1421 Int_t noadc = 12;
1422 if ( var.bw ){
1423 noadc=12;
1424 } else {
1425 noadc=41;
1426 };
1427 //
1428 // S11 X-view
1429 //
1430 // A
1431 Float_t s11p = 0.051;
1432 ocolo = 10;
1433 TPolyLine *ftof11xa[8];
1434 for ( Int_t j=0; j<8; j++){
1435 Float_t xc1[4]={ (s11p*j), (s11p*j), s11p*(j+1), (s11p*j)};
1436 Float_t yc1[4]={ 0., ws13, ws13, 0.};
1437 Float_t xc[4];
1438 Float_t yc[4];
1439 for (Int_t i = 0; i<4 ; i++) {
1440 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
1441 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
1442 };
1443 ftof11xa[j] = new TPolyLine(4,xc,yc);
1444 ftof11xa[j]->SetLineColor(1);
1445 if ( var.bw ){
1446 colo = -1;
1447 } else {
1448 colo = 1;
1449 };
1450 ColorMIP(ms11a[j],colo);
1451 //
1452 if ( colo != 10 ) ocolo = colo;
1453 if ( mt11[0][j] == 4095. ) colo = noadc;
1454 //
1455 ftof11xa[j]->SetFillColor(colo);
1456 ftof11xa[j]->SetLineWidth(1);
1457 ftof11xa[j]->Draw("f");
1458 ftof11xa[j]->Draw();
1459 };
1460 // B
1461 s11p = 0.051;
1462 TPolyLine *ftof11xb[8];
1463 for ( Int_t j=0; j<8; j++){
1464 Float_t xc1[4]={ (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
1465 Float_t yc1[4]={ 0., 0., ws13, 0.};
1466 Float_t xc[4];
1467 Float_t yc[4];
1468 for (Int_t i = 0; i<4 ; i++) {
1469 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
1470 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
1471 };
1472 ftof11xb[j] = new TPolyLine(4,xc,yc);
1473 ftof11xb[j]->SetLineColor(1);
1474 if ( var.bw ){
1475 colo = -1;
1476 } else {
1477 colo = 1;
1478 };
1479 ColorMIP(ms11b[j],colo);
1480 //
1481 if ( colo != 10 ) ocolo = colo;
1482 if ( mt11[1][j] == 4095. ) colo = noadc;
1483 //
1484 ftof11xb[j]->SetFillColor(colo);
1485 ftof11xb[j]->SetLineWidth(1);
1486 ftof11xb[j]->Draw("f");
1487 ftof11xb[j]->Draw();
1488 };
1489
1490 //
1491 // S11 Y-view
1492 //
1493 if ( true ){
1494 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
1495 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
1496 Float_t nxc[5];
1497 Float_t nyc[5];
1498 for (Int_t i = 0; i<5 ; i++) {
1499 nxc[i]= xs2y + nxc1[i]*var.sfx;
1500 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
1501 };
1502 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
1503 ftof11y->SetLineColor(1);
1504 ftof11y->SetFillColor(ocolo);
1505 ftof11y->SetLineWidth(1);
1506 ftof11y->Draw("f");
1507 ftof11y->Draw();
1508 };
1509
1510 //
1511 // S12 Y-view
1512 //
1513 // A
1514 Float_t s12p = 0.055;
1515 ocolo = 10;
1516 TPolyLine *ftof12ya[6];
1517 for ( Int_t j=0; j<6; j++){
1518 Float_t xc1[4]={ (s12p*j), s12p*(j), s12p*(j+1), (s12p*j)};
1519 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
1520 Float_t xc[4];
1521 Float_t yc[4];
1522 for (Int_t i = 0; i<4 ; i++) {
1523 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
1524 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
1525 };
1526 ftof12ya[j] = new TPolyLine(4,xc,yc);
1527 ftof12ya[j]->SetLineColor(1);
1528 if ( var.bw ){
1529 colo = -1;
1530 } else {
1531 colo = 1;
1532 };
1533 ColorMIP(ms12a[j],colo);
1534 //
1535 if ( colo != 10 ) ocolo = colo;
1536 if ( mt12[0][j] == 4095. ) colo = noadc;
1537 //
1538 ftof12ya[j]->SetFillColor(colo);
1539 ftof12ya[j]->SetLineWidth(1);
1540 ftof12ya[j]->Draw("f");
1541 ftof12ya[j]->Draw();
1542 };
1543 // B
1544 s12p = 0.055;
1545 TPolyLine *ftof12yb[6];
1546 for ( Int_t j=0; j<6; j++){
1547 Float_t xc1[4]={ (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
1548 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
1549 Float_t xc[4];
1550 Float_t yc[4];
1551 for (Int_t i = 0; i<4 ; i++) {
1552 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
1553 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
1554 };
1555 ftof12yb[j] = new TPolyLine(4,xc,yc);
1556 ftof12yb[j]->SetLineColor(1);
1557 if ( var.bw ){
1558 colo = -1;
1559 } else {
1560 colo = 1;
1561 };
1562 ColorMIP(ms12b[j],colo);
1563 //
1564 if ( colo != 10 ) ocolo = colo;
1565 if ( mt12[1][j] == 4095. ) colo = noadc;
1566 //
1567 ftof12yb[j]->SetFillColor(colo);
1568 ftof12yb[j]->SetLineWidth(1);
1569 ftof12yb[j]->Draw("f");
1570 ftof12yb[j]->Draw();
1571 };
1572 //
1573 // S12 X-view
1574 //
1575 if ( true ){
1576 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
1577 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
1578 Float_t nxc[5];
1579 Float_t nyc[5];
1580 for (Int_t i = 0; i<5 ; i++) {
1581 nxc[i]= xs2x + nxc1[i]*var.sfx;
1582 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
1583 };
1584 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
1585 ftof12x->SetLineColor(1);
1586 ftof12x->SetFillColor(ocolo);
1587 ftof12x->SetLineWidth(1);
1588 ftof12x->Draw("f");
1589 ftof12x->Draw();
1590 };
1591
1592 //
1593 // S21 Y-view
1594 //
1595 // A
1596 Float_t s21p = 0.075;
1597 ocolo = 10;
1598 TPolyLine *ftof21ya[2];
1599 for ( Int_t j=0; j<2; j++){
1600 Float_t xc1[4]={ s21p*(j-1), s21p*(j-1), s21p*j, s21p*(j-1)};
1601 Float_t yc1[4]={ 0., ws2, ws2, 0.};
1602 Float_t xc[4];
1603 Float_t yc[4];
1604 for (Int_t i = 0; i<4 ; i++) {
1605 xc[i]= xs2y + xc1[i]*var.sfx;
1606 yc[i] = ys2y + yc1[i]*var.sfy;
1607 };
1608 ftof21ya[j] = new TPolyLine(4,xc,yc);
1609 ftof21ya[j]->SetLineColor(1);
1610 if ( var.bw ){
1611 colo = -1;
1612 } else {
1613 colo = 1;
1614 };
1615 ColorMIP(ms21a[j],colo);
1616 //
1617 if ( colo != 10 ) ocolo = colo;
1618 if ( mt21[0][j] == 4095. ) colo = noadc;
1619 //
1620 ftof21ya[j]->SetFillColor(colo);
1621 ftof21ya[j]->SetLineWidth(1);
1622 ftof21ya[j]->Draw("f");
1623 ftof21ya[j]->Draw();
1624 };
1625 // B
1626 s21p = 0.075;
1627 TPolyLine *ftof21yb[2];
1628 for ( Int_t j=0; j<2; j++){
1629 Float_t xc1[4]={ s21p*(j-1), s21p*j, s21p*j, s21p*(j-1)};
1630 Float_t yc1[4]={ 0., 0., ws2, 0.};
1631 Float_t xc[4];
1632 Float_t yc[4];
1633 for (Int_t i = 0; i<4 ; i++) {
1634 xc[i]= xs2y + xc1[i]*var.sfx;
1635 yc[i] = ys2y + yc1[i]*var.sfy;
1636 };
1637 ftof21yb[j] = new TPolyLine(4,xc,yc);
1638 ftof21yb[j]->SetLineColor(1);
1639 if ( var.bw ){
1640 colo = -1;
1641 } else {
1642 colo = 1;
1643 };
1644 ColorMIP(ms21b[j],colo);
1645 //
1646 if ( colo != 10 ) ocolo = colo;
1647 if ( mt21[1][j] == 4095. ) colo = noadc;
1648 //
1649 ftof21yb[j]->SetFillColor(colo);
1650 ftof21yb[j]->SetLineWidth(1);
1651 ftof21yb[j]->Draw("f");
1652 ftof21yb[j]->Draw();
1653 };
1654 //
1655 // S21 X-view
1656 //
1657 if ( true ){
1658 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
1659 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
1660 Float_t nxc[5];
1661 Float_t nyc[5];
1662 for (Int_t i = 0; i<5 ; i++) {
1663 nxc[i]= xs2x + nxc1[i]*var.sfx;
1664 nyc[i] = ys2x + nyc1[i]*var.sfy;
1665 };
1666 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
1667 ftof21x->SetLineColor(1);
1668 ftof21x->SetFillColor(ocolo);
1669 ftof21x->SetLineWidth(1);
1670 ftof21x->Draw("f");
1671 ftof21x->Draw();
1672 };
1673 //
1674 // S22 X-view
1675 //
1676 // A
1677 Float_t s22p = 0.090;
1678 ocolo = 10;
1679 TPolyLine *ftof22xa[2];
1680 for ( Int_t j=0; j<2; j++){
1681 Float_t xc1[4]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*(j-1)};
1682 Float_t yc1[4]={ -ws2, 0., 0., -ws2};
1683 Float_t xc[4];
1684 Float_t yc[4];
1685 for (Int_t i = 0; i<4 ; i++) {
1686 xc[i]= xs2x + xc1[i]*var.sfx;
1687 yc[i] = ys2x + yc1[i]*var.sfy;
1688 };
1689 ftof22xa[j] = new TPolyLine(4,xc,yc);
1690 ftof22xa[j]->SetLineColor(1);
1691 if ( var.bw ){
1692 colo = -1;
1693 } else {
1694 colo = 1;
1695 };
1696 ColorMIP(ms22a[j],colo);
1697 //
1698 if ( colo != 10 ) ocolo = colo;
1699 if ( mt22[0][j] == 4095. ) colo = noadc;
1700 //
1701 ftof22xa[j]->SetFillColor(colo);
1702 ftof22xa[j]->SetLineWidth(1);
1703 ftof22xa[j]->Draw("f");
1704 ftof22xa[j]->Draw();
1705 };
1706 // B
1707 s22p = 0.090;
1708 TPolyLine *ftof22xb[2];
1709 for ( Int_t j=0; j<2; j++){
1710 Float_t xc1[4]={ s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
1711 Float_t yc1[4]={ -ws2, -ws2, 0., -ws2};
1712 Float_t xc[4];
1713 Float_t yc[4];
1714 for (Int_t i = 0; i<4 ; i++) {
1715 xc[i]= xs2x + xc1[i]*var.sfx;
1716 yc[i] = ys2x + yc1[i]*var.sfy;
1717 };
1718 ftof22xb[j] = new TPolyLine(4,xc,yc);
1719 ftof22xb[j]->SetLineColor(1);
1720 if ( var.bw ){
1721 colo = -1;
1722 } else {
1723 colo = 1;
1724 };
1725 ColorMIP(ms22b[j],colo);
1726 //
1727 if ( colo != 10 ) ocolo = colo;
1728 if ( mt22[1][j] == 4095. ) colo = noadc;
1729 //
1730 ftof22xb[j]->SetFillColor(colo);
1731 ftof22xb[j]->SetLineWidth(1);
1732 ftof22xb[j]->Draw("f");
1733 ftof22xb[j]->Draw();
1734 };
1735 //
1736 // S22 Y-view
1737 //
1738 if ( true ){
1739 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
1740 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
1741 Float_t nxc[5];
1742 Float_t nyc[5];
1743 for (Int_t i = 0; i<5 ; i++) {
1744 nxc[i]= xs2y + nxc1[i]*var.sfx;
1745 nyc[i] = ys2y + nyc1[i]*var.sfy;
1746 };
1747 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
1748 ftof22y->SetLineColor(1);
1749 ftof22y->SetFillColor(ocolo);
1750 ftof22y->SetLineWidth(1);
1751 ftof22y->Draw("f");
1752 ftof22y->Draw();
1753 };
1754
1755 //
1756 // S31 X-view
1757 //
1758 // A
1759 Float_t s31p = 0.060;
1760 ocolo = 10;
1761 TPolyLine *ftof31xa[3];
1762 for ( Int_t j=0; j<3; j++){
1763 Float_t xc1[4]={ (s31p*j), (s31p*j), s31p*(j+1), (s31p*j)};
1764 Float_t yc1[4]={ 0., ws13, ws13, 0.};
1765 Float_t xc[4];
1766 Float_t yc[4];
1767 for (Int_t i = 0; i<4 ; i++) {
1768 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
1769 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
1770 };
1771 ftof31xa[j] = new TPolyLine(4,xc,yc);
1772 ftof31xa[j]->SetLineColor(1);
1773 if ( var.bw ){
1774 colo = -1;
1775 } else {
1776 colo = 1;
1777 };
1778 ColorMIP(ms31a[j],colo);
1779 //
1780 if ( colo != 10 ) ocolo = colo;
1781 if ( mt31[0][j] == 4095. ) colo = noadc;
1782 //
1783 ftof31xa[j]->SetFillColor(colo);
1784 ftof31xa[j]->SetLineWidth(1);
1785 ftof31xa[j]->Draw("f");
1786 ftof31xa[j]->Draw();
1787 };
1788 // B
1789 s31p = 0.060;
1790 TPolyLine *ftof31xb[3];
1791 for ( Int_t j=0; j<3; j++){
1792 Float_t xc1[4]={ (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
1793 Float_t yc1[4]={ 0., 0., ws13, 0.};
1794 Float_t xc[4];
1795 Float_t yc[4];
1796 for (Int_t i = 0; i<4 ; i++) {
1797 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
1798 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
1799 };
1800 ftof31xb[j] = new TPolyLine(4,xc,yc);
1801 ftof31xb[j]->SetLineColor(1);
1802 if ( var.bw ){
1803 colo = -1;
1804 } else {
1805 colo = 1;
1806 };
1807 ColorMIP(ms31b[j],colo);
1808 //
1809 if ( colo != 10 ) ocolo = colo;
1810 if ( mt31[1][j] == 4095. ) colo = noadc;
1811 //
1812 ftof31xb[j]->SetFillColor(colo);
1813 ftof31xb[j]->SetLineWidth(1);
1814 ftof31xb[j]->Draw("f");
1815 ftof31xb[j]->Draw();
1816 };
1817 //
1818 // S31 Y-view
1819 //
1820 if ( true ){
1821 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
1822 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
1823 Float_t nxc[5];
1824 Float_t nyc[5];
1825 for (Int_t i = 0; i<5 ; i++) {
1826 nxc[i]= xs2y + nxc1[i]*var.sfx;
1827 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
1828 };
1829 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
1830 ftof31y->SetLineColor(1);
1831 ftof31y->SetFillColor(ocolo);
1832 ftof31y->SetLineWidth(1);
1833 ftof31y->Draw("f");
1834 ftof31y->Draw();
1835 };
1836 //
1837 // S32 Y-view
1838 //
1839 Float_t s32p = 0.050;
1840 ocolo = 10;
1841 TPolyLine *ftof32ya[3];
1842 for ( Int_t j=0; j<3; j++){
1843 Float_t xc1[4]={ (s32p*j), (s32p*j), s32p*(j+1), (s32p*j)};
1844 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
1845 Float_t xc[4];
1846 Float_t yc[4];
1847 for (Int_t i = 0; i<4 ; i++) {
1848 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
1849 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
1850 };
1851 ftof32ya[j] = new TPolyLine(4,xc,yc);
1852 ftof32ya[j]->SetLineColor(1);
1853 if ( var.bw ){
1854 colo = -1;
1855 } else {
1856 colo = 1;
1857 };
1858 ColorMIP(ms32a[j],colo);
1859 //
1860 if ( colo != 10 ) ocolo = colo;
1861 if ( mt32[0][j] == 4095. ) colo = noadc;
1862 //
1863 ftof32ya[j]->SetFillColor(colo);
1864 ftof32ya[j]->SetLineWidth(1);
1865 ftof32ya[j]->Draw("f");
1866 ftof32ya[j]->Draw();
1867 };
1868 s32p = 0.050;
1869 TPolyLine *ftof32yb[3];
1870 for ( Int_t j=0; j<3; j++){
1871 Float_t xc1[4]={ (s32p*j), s32p*(j+1), s32p*(j+1), (s32p*j)};
1872 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
1873 Float_t xc[4];
1874 Float_t yc[4];
1875 for (Int_t i = 0; i<4 ; i++) {
1876 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
1877 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
1878 };
1879 ftof32yb[j] = new TPolyLine(4,xc,yc);
1880 ftof32yb[j]->SetLineColor(1);
1881 if ( var.bw ){
1882 colo = -1;
1883 } else {
1884 colo = 1;
1885 };
1886 ColorMIP(ms32b[j],colo);
1887 //
1888 if ( colo != 10 ) ocolo = colo;
1889 if ( mt32[1][j] == 4095. ) colo = noadc;
1890 //
1891 ftof32yb[j]->SetFillColor(colo);
1892 ftof32yb[j]->SetLineWidth(1);
1893 ftof32yb[j]->Draw("f");
1894 ftof32yb[j]->Draw();
1895 };
1896 //
1897 // S32 X-view
1898 //
1899 if ( true ){
1900 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
1901 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
1902 Float_t nxc[5];
1903 Float_t nyc[5];
1904 for (Int_t i = 0; i<5 ; i++) {
1905 nxc[i]= xs2x + nxc1[i]*var.sfx;
1906 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
1907 };
1908 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
1909 ftof32x->SetLineColor(1);
1910 ftof32x->SetFillColor(ocolo);
1911 ftof32x->SetLineWidth(1);
1912 ftof32x->Draw("f");
1913 ftof32x->Draw();
1914 };
1915 return;
1916 };
1917 //
1918 // CALIBRATED DATA (LEVEL -1 and 2)
1919 //
1920 // the channels MAP:
1921 //
1922 Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
1923 Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
1924 Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
1925 Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
1926
1927 Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
1928 Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
1929 Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
1930 Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
1931
1932 Int_t ch21a[2] = { 0, 0};
1933 Int_t hb21a[2] = { 0, 4};
1934 Int_t ch21b[2] = { 1, 0};
1935 Int_t hb21b[2] = { 8, 6};
1936
1937 Int_t ch22a[2] = { 0, 0};
1938 Int_t hb22a[2] = { 2, 8};
1939 Int_t ch22b[2] = { 1, 0};
1940 Int_t hb22b[2] = { 10, 10};
1941
1942 Int_t ch31a[3] = { 1, 2, 2};
1943 Int_t hb31a[3] = { 6, 8, 10};
1944 Int_t ch31b[3] = { 1, 1, 1};
1945 Int_t hb31b[3] = { 4, 2, 0};
1946
1947 Int_t ch32a[3] = { 2, 2, 3};
1948 Int_t hb32a[3] = { 0, 4, 8};
1949 Int_t ch32b[3] = { 2, 2, 3};
1950 Int_t hb32b[3] = { 2, 6, 10};
1951 //
1952 // ADC values
1953 //
1954 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
1955 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
1956 Float_t ms21a[2] = {0.,0.};
1957 Float_t ms22a[2] = {0.,0.};
1958 Float_t ms31a[3] = {0.,0.,0.};
1959 Float_t ms32a[3] = {0.,0.,0.};
1960 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
1961 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
1962 Float_t ms21b[2] = {0.,0.};
1963 Float_t ms22b[2] = {0.,0.};
1964 Float_t ms31b[3] = {0.,0.,0.};
1965 Float_t ms32b[3] = {0.,0.,0.};
1966 //
1967 // default calibrations
1968 //
1969 Float_t xp11[8];
1970 Float_t A11[8] = {-19.,-9.6,-25.7,-13.1,-30.9,-21.1,-11.7,-15.9};
1971 Float_t B11[8] = {-2.6,-2.6,-2.3,-2.4,-2.4,-2.8,-2.75,-2.5};
1972 Float_t E11[8] = {2.6,2.6,2.6,2.6,2.6,2.6,2.6,2.6};
1973 Float_t xp12[6];
1974 Float_t A12[6] = {11.6,16.6,5.9,-22.2,-18.0,-14.2};
1975 Float_t B12[6] = {-2.309,-2.424,-1.958,-2.092,-2.241,-2.144};
1976 Float_t E12[6] = {2.6,2.6,2.6,2.6,2.6,2.6};
1977 Float_t xp21[2];
1978 Float_t A21[2] = {12.5, 21.7};
1979 Float_t B21[2] = {-1.492,-1.519};
1980 Float_t E21[2] = {2.2,2.2};
1981 Float_t xp22[2];
1982 Float_t A22[2] = {-27.0, -45.8};
1983 Float_t B22[2] = {-1.897,-1.477};
1984 Float_t E22[2] = {2.9,2.9};
1985 Float_t xp31[3];
1986 Float_t A31[3] = {-25.1, -41.4, -33.9};
1987 Float_t B31[3] = {-3.374,-3.793,-3.495};
1988 Float_t E31[3] = {1.2,1.2,1.2};
1989 Float_t xp32[3];
1990 Float_t A32[3] = {1.3, 3.9, -22.0};
1991 Float_t B32[3] = {-3.134,-3.526,-3.417};
1992 Float_t E32[3] = {2.3,2.3,2.3};
1993 //
1994 // TDC info for each PMT
1995 //
1996 Float_t mt11[2][8];
1997 Float_t mt12[2][6];
1998 Float_t mt21[2][2];
1999 Float_t mt22[2][2];
2000 Float_t mt31[2][3];
2001 Float_t mt32[2][3];
2002 Int_t noadc = 12;
2003 if ( var.bw ){
2004 noadc = 12;
2005 } else {
2006 noadc = 41;
2007 };
2008 //
2009 Int_t ii = 0;
2010 if ( level.file == -1 ){
2011 for ( Int_t i = 0; i<8; i++ ) {
2012 mt11[0][i] = tof->tdc[ch11a[i]][hb11a[i]];
2013 mt11[1][i] = tof->tdc[ch11b[i]][hb11b[i]];
2014 ms11a[i] = tof->adc[ch11a[i]][hb11a[i]];
2015 ms11b[i] = tof->adc[ch11b[i]][hb11b[i]];
2016 xp11[i] = ( -A11[i] + (mt11[0][i]-mt11[1][i]) / 2. ) / B11[i] ;
2017 if ( ms11a[i] == 4095. ) {
2018 ms11a[i] = 0.;
2019 } else {
2020 ms11a[i] = 1.;
2021 };
2022 if ( ms11b[i] == 4095. ) {
2023 ms11b[i] = 0.;
2024 } else {
2025 ms11b[i] = 1.;
2026 }; };
2027 for ( Int_t i = 0; i<6; i++ ) {
2028 mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]];
2029 mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]];
2030 ms12a[i] = tof->adc[ch12a[i]][hb12a[i]];
2031 ms12b[i] = tof->adc[ch12b[i]][hb12b[i]];
2032 xp12[i] = ( -A12[i] + (mt12[0][i]-mt12[1][i]) / 2. ) / B12[i] ;
2033 if ( ms12a[i] == 4095. ){
2034 ms12a[i] = 0.;
2035 } else {
2036 ms12a[i] = 1.;
2037 };
2038 if ( ms12b[i] == 4095. ){
2039 ms12b[i] = 0.;
2040 } else {
2041 ms12b[i] = 1.;
2042 };
2043 };
2044 ii = 2;
2045 for ( Int_t i = 0; i<2; i++ ) {
2046 ii--;
2047 mt21[0][ii] = tof->tdc[ch21a[i]][hb21a[i]];
2048 mt21[1][ii] = tof->tdc[ch21b[i]][hb21b[i]];
2049 ms21a[ii] = tof->adc[ch21a[i]][hb21a[i]];
2050 ms21b[ii] = tof->adc[ch21b[i]][hb21b[i]];
2051 xp21[ii] = ( -A21[ii] + (mt21[0][ii]-mt21[1][ii]) / 2. ) / B21[ii] ;
2052 if ( ms21a[ii] == 4095. ){
2053 ms21a[ii] = 0.;
2054 } else {
2055 ms21a[ii] = 1.;
2056 };
2057 if ( ms21b[ii] == 4095. ){
2058 ms21b[ii] = 0.;
2059 } else {
2060 ms21b[ii] = 1.;
2061 };
2062 };
2063 for ( Int_t i = 0; i<2; i++ ) {
2064 mt22[0][i] = tof->tdc[ch22a[i]][hb22a[i]];
2065 mt22[1][i] = tof->tdc[ch22b[i]][hb22b[i]];
2066 ms22a[i] = tof->adc[ch22a[i]][hb22a[i]];
2067 ms22b[i] = tof->adc[ch22b[i]][hb22b[i]];
2068 xp22[i] = ( -A22[i] + (mt22[0][i]-mt22[1][i]) / 2. ) / B22[i] ;
2069 if ( ms22a[i] == 4095. ){
2070 ms22a[i] = 0.;
2071 } else {
2072 ms22a[i] = 1.;
2073 };
2074 if ( ms22b[i] == 4095. ){
2075 ms22b[i] = 0.;
2076 } else {
2077 ms22b[i] = 1.;
2078 };
2079 };
2080 for ( Int_t i = 0; i<3; i++ ) {
2081 mt31[0][i] = tof->tdc[ch31a[i]][hb31a[i]];
2082 mt31[1][i] = tof->tdc[ch31b[i]][hb31b[i]];
2083 ms31a[i] = tof->adc[ch31a[i]][hb31a[i]];
2084 ms31b[i] = tof->adc[ch31b[i]][hb31b[i]];
2085 xp31[i] = ( -A31[i] + (mt31[0][i]-mt31[1][i]) / 2. ) / B31[i] ;
2086 if ( ms31a[i] == 4095. ){
2087 ms31a[i] = 0.;
2088 } else {
2089 ms31a[i] = 1.;
2090 };
2091 if ( ms31b[i] == 4095. ){
2092 ms31b[i] = 0.;
2093 } else {
2094 ms31b[i] = 1.;
2095 };
2096 };
2097 for ( Int_t i = 0; i<3; i++ ) {
2098 mt32[0][i] = tof->tdc[ch32a[i]][hb32a[i]];
2099 mt32[1][i] = tof->tdc[ch32b[i]][hb32b[i]];
2100 ms32a[i] = tof->adc[ch32a[i]][hb32a[i]];
2101 ms32b[i] = tof->adc[ch32b[i]][hb32b[i]];
2102 xp32[i] = ( -A32[i] + (mt32[0][i]-mt32[1][i]) / 2. ) / B32[i] ;
2103 if ( ms32a[i] == 4095. ){
2104 ms32a[i] = 0.;
2105 } else {
2106 ms32a[i] = 1.;
2107 };
2108 if ( ms32b[i] == 4095. ){
2109 ms32b[i] = 0.;
2110 } else {
2111 ms32b[i] = 1.;
2112 };
2113 };
2114 };
2115 //
2116 //
2117 //
2118 Bool_t repeat = true;
2119 Int_t numtr = 1;
2120 Int_t repuntil = 0;
2121 //
2122 //
2123 var.tofraw = 0;
2124 //
2125 repuntil = L2->ToFLevel2::ntrk();
2126 // printf("repuntil = %i \n",repuntil);
2127 //repuntil = L2->GetNTracks();
2128 //
2129 while ( repeat ){
2130 // printf("B repuntil = %i \n",repuntil);
2131 if ( level.file == 2 ){
2132 //
2133 //
2134 //
2135 ToFTrkVar *ptt = 0;
2136 //
2137 //
2138 if ( repuntil == 1 || var.tofraw ){
2139 numtr = 0;
2140 ptt = L2->GetToFTrkVar(0);
2141 repeat = false;
2142 } else {
2143 //
2144 //
2145 if ( numtr >= repuntil-1 ) repeat = false;
2146 //
2147 ptt = L2->GetToFTrkVar(numtr);
2148 };
2149 //
2150 xp11[0] = 0.;
2151 xp12[0] = 0.;
2152 xp21[0] = 0.;
2153 xp22[0] = 0.;
2154 xp31[0] = 0.;
2155 xp32[0] = 0.;
2156 //
2157 //
2158 //
2159 ii = 2;
2160 //
2161 Float_t adc[4][12];
2162 Float_t tdc[4][12];
2163 L2->GetMatrix(numtr,adc,tdc);
2164
2165 //
2166 for ( Int_t i = 0; i<8; i++ ) {
2167 if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
2168 ms11a[i] = adc[ch11a[i]][hb11a[i]];
2169 };
2170 if ( adc[ch11b[i]][hb11b[i]] < 1000. ){
2171 ms11b[i] = adc[ch11b[i]][hb11b[i]];
2172 };
2173 // xp11[i] = 0.;
2174 };
2175
2176 Int_t nmtof = 0;
2177 Float_t mtof = 0.;
2178 var.beta[4] = 0.;
2179 if ( ptt->beta[12] != 0. && ptt->beta[12] != 100. ){
2180 var.beta[4] = ptt->beta[12];
2181 } else {
2182 for (Int_t tf = 0; tf<12 ;tf++){
2183 if ( ptt->beta[tf] != 0. && ptt->beta[tf] != 100.){
2184 mtof += ptt->beta[tf];
2185 nmtof++;
2186 };
2187 };
2188 if ( nmtof ){
2189 var.beta[4] = mtof/nmtof;
2190 } else {
2191 var.beta[4] = 0.;
2192 };
2193 };
2194 ii = 2;
2195 //
2196 for ( Int_t i = 0; i<8; i++ ) {
2197 if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
2198 ms11a[i] = adc[ch11a[i]][hb11a[i]];
2199 };
2200 if ( adc[ch11b[i]][hb11b[i]] < 1000. ){
2201 ms11b[i] = adc[ch11b[i]][hb11b[i]];
2202 };
2203 xp11[i] = 0.;
2204 };
2205 //
2206 xp11[0] = ptt->ytofpos[0];
2207 //
2208 for ( Int_t i = 0; i<6; i++ ) {
2209 if ( adc[ch12a[i]][hb12a[i]] < 1000. ) ms12a[i] = adc[ch12a[i]][hb12a[i]];
2210 if ( adc[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = adc[ch12b[i]][hb12b[i]];
2211 xp12[i] = 0.;
2212 };
2213 //
2214 xp12[0] = ptt->xtofpos[0];
2215 //
2216 ii = 2;
2217 for ( Int_t i = 0; i<2; i++ ) {
2218 ii--;
2219 if ( adc[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = adc[ch21a[i]][hb21a[i]];
2220 if ( adc[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = adc[ch21b[i]][hb21b[i]];
2221 xp21[i] = 0.;
2222 };
2223 xp21[0] = ptt->xtofpos[1];
2224 //
2225 for ( Int_t i = 0; i<2; i++ ) {
2226 if ( adc[ch22a[i]][hb22a[i]] < 1000. ) ms22a[i] = adc[ch22a[i]][hb22a[i]];
2227 if ( adc[ch22b[i]][hb22b[i]] < 1000. ) ms22b[i] = adc[ch22b[i]][hb22b[i]];
2228 xp22[i] = 0.;
2229 };
2230 xp22[0] = ptt->ytofpos[1];
2231 //
2232 for ( Int_t i = 0; i<3; i++ ) {
2233 if ( adc[ch31a[i]][hb31a[i]] < 1000. ) ms31a[i] = adc[ch31a[i]][hb31a[i]];
2234 if ( adc[ch31b[i]][hb31b[i]] < 1000. ) ms31b[i] = adc[ch31b[i]][hb31b[i]];
2235 xp31[i] = 0.;
2236 };
2237 xp31[0] = ptt->ytofpos[2];
2238 //
2239 for ( Int_t i = 0; i<3; i++ ) {
2240 if ( adc[ch32a[i]][hb32a[i]] < 1000. ) ms32a[i] = adc[ch32a[i]][hb32a[i]];
2241 if ( adc[ch32b[i]][hb32b[i]] < 1000. ) ms32b[i] = adc[ch32b[i]][hb32b[i]];
2242 xp32[i] = 0.;
2243 };
2244 xp32[0] = ptt->xtofpos[2];
2245 //
2246 numtr++;
2247 //numtr = repuntil+10;
2248 // repeat = false;
2249 // printf("pre drawingdrawing... %i %i\n",numtr,ptt->trkseqno);
2250 //
2251 }; // end if level2
2252 //
2253 //
2254 // drawtof:
2255 //
2256 // printf("drawingdrawing... %i \n",repuntil);
2257 //
2258 Int_t colo = 0;
2259 Int_t ocolo = 0;
2260 Float_t xs2x = var.xxvc;
2261 Float_t ys2x = var.yxvc + 0.36*var.sfy;
2262 Float_t xs2y = var.xyvc;
2263 Float_t ys2y = var.yyvc + 0.36*var.sfy;
2264 Float_t ws2 = 0.005;
2265 Float_t ws13 = 0.007;
2266 //
2267 // S11 X-view
2268 //
2269 Float_t s11p = 0.051;
2270 ocolo = 10;
2271 TPolyLine *ftof11x[8];
2272 for ( Int_t j=0; j<8; j++){
2273 Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
2274 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
2275 Float_t nxc[5];
2276 Float_t nyc[5];
2277 for (Int_t i = 0; i<5 ; i++) {
2278 nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
2279 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2280 };
2281 ftof11x[j] = new TPolyLine(5,nxc,nyc);
2282 ftof11x[j]->SetLineColor(1);
2283 if ( var.bw ){
2284 colo = -1;
2285 } else {
2286 colo = 1;
2287 };
2288 if ( level.file == -1 ){
2289 ColorMIP(ms11a[j]+ms11b[j],colo);
2290 } else {
2291 ColorTOFMIP(ms11a[j]+ms11b[j],colo);
2292 };
2293 //
2294 if ( colo != 10 ) ocolo = colo;
2295 //
2296 ftof11x[j]->SetFillColor(colo);
2297 ftof11x[j]->SetLineWidth(1);
2298 ftof11x[j]->Draw("f");
2299 ftof11x[j]->Draw();
2300 };
2301 //
2302 // S11 Y-view
2303 //
2304 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
2305 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2306 Float_t nxc[5];
2307 Float_t nyc[5];
2308 for (Int_t i = 0; i<5 ; i++) {
2309 nxc[i]= xs2y + nxc1[i]*var.sfx;
2310 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2311 };
2312 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
2313 ftof11y->SetFillStyle(4000);
2314 ftof11y->SetFillColor(0);
2315 ftof11y->SetLineColor(1);
2316 ftof11y->SetLineWidth(1);
2317 ftof11y->Draw("f");
2318 ftof11y->Draw();
2319 TPolyLine *sftof11[8];
2320 tt = 1;
2321 if ( level.file == -1 ) tt = 8;
2322 for ( Int_t j=0; j<tt; j++){
2323 if ( (mt11[0][j]<4095. || mt11[1][j]<4095.)){
2324 if ( ocolo == 10 ) ocolo = noadc;
2325 Float_t lowp = (xp11[j]-E11[j])/100.;
2326 Float_t higp = (xp11[j]+E11[j])/100.;
2327 if ( lowp < -0.164 ) lowp = -0.164;
2328 if ( higp > 0.164 ) higp = 0.164;
2329 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp11[j] != 0.))){
2330 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2331 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
2332 Float_t nxc[5];
2333 Float_t nyc[5];
2334 for (Int_t i = 0; i<5 ; i++) {
2335 nxc[i]= xs2y + nxc1[i]*var.sfx;
2336 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2337 };
2338 sftof11[j] = new TPolyLine(5,nxc,nyc);
2339 sftof11[j]->SetLineColor(ocolo);
2340 sftof11[j]->SetFillColor(ocolo);
2341 sftof11[j]->SetLineWidth(1);
2342 sftof11[j]->Draw("f");
2343 sftof11[j]->Draw();
2344 };
2345 };
2346 };
2347
2348 //
2349 // S12 Y-view
2350 //
2351 Float_t s12p = 0.055;
2352 ocolo = 10;
2353 TPolyLine *ftof12y[6];
2354 for ( Int_t j=0; j<6; j++){
2355 Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
2356 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
2357 Float_t nxc[5];
2358 Float_t nyc[5];
2359 for (Int_t i = 0; i<5 ; i++) {
2360 nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
2361 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2362 };
2363 ftof12y[j] = new TPolyLine(5,nxc,nyc);
2364 ftof12y[j]->SetLineColor(1);
2365 if ( var.bw ){
2366 colo = -1;
2367 } else {
2368 colo = 1;
2369 };
2370 if ( level.file == -1 ){
2371 ColorMIP(ms12a[j]+ms12b[j],colo);
2372 } else {
2373 ColorTOFMIP(ms12a[j]+ms12b[j],colo);
2374 };
2375 //
2376 if ( colo != 10 ) ocolo = colo;
2377 //
2378 ftof12y[j]->SetFillColor(colo);
2379 ftof12y[j]->SetLineWidth(1);
2380 ftof12y[j]->Draw("f");
2381 ftof12y[j]->Draw();
2382 };
2383 //
2384 // S12 X-view
2385 //
2386 if ( true ){
2387 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
2388 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2389 Float_t nxc[5];
2390 Float_t nyc[5];
2391 for (Int_t i = 0; i<5 ; i++) {
2392 nxc[i]= xs2x + nxc1[i]*var.sfx;
2393 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2394 };
2395 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
2396 ftof12x->SetLineColor(1);
2397 ftof12x->SetFillStyle(4000);
2398 ftof12x->SetFillColor(0);
2399 ftof12x->SetLineWidth(1);
2400 ftof12x->Draw("f");
2401 ftof12x->Draw();
2402 TPolyLine *sftof12[6];
2403 tt = 1;
2404 if ( level.file == -1 ) tt = 6;
2405 for (Int_t j=0; j<tt; j++){
2406 // for ( Int_t j=0; j<6; j++){
2407 if ( (mt12[0][j]<4095. || mt12[1][j]<4095.) ){
2408 if ( ocolo == 10 ) ocolo = noadc;
2409 Float_t lowp = (xp12[j]-E12[j])/100.;
2410 Float_t higp = (xp12[j]+E12[j])/100.;
2411 if ( lowp < -0.203 ) lowp = -0.203;
2412 if ( higp > 0.203 ) higp = 0.203;
2413 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp12[j] != 0.))){
2414 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2415 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
2416 Float_t nxc[5];
2417 Float_t nyc[5];
2418 for (Int_t i = 0; i<5 ; i++) {
2419 nxc[i]= xs2x + nxc1[i]*var.sfx;
2420 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2421 };
2422 sftof12[j] = new TPolyLine(5,nxc,nyc);
2423 sftof12[j]->SetLineColor(ocolo);
2424 sftof12[j]->SetFillColor(ocolo);
2425 sftof12[j]->SetLineWidth(1);
2426 sftof12[j]->Draw("f");
2427 sftof12[j]->Draw();
2428 };
2429 };
2430 };
2431 };
2432 //
2433
2434 //
2435 // S21 Y-view
2436 //
2437 Float_t s21p = 0.075;
2438 ocolo = 10;
2439 TPolyLine *ftof21y[2];
2440 for ( Int_t j=0; j<2; j++){
2441 Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
2442 Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
2443 Float_t nxc[5];
2444 Float_t nyc[5];
2445 for (Int_t i = 0; i<5 ; i++) {
2446 nxc[i]= xs2y + nxc1[i]*var.sfx;
2447 nyc[i] = ys2y + nyc1[i]*var.sfy;
2448 };
2449 ftof21y[j] = new TPolyLine(5,nxc,nyc);
2450 ftof21y[j]->SetLineColor(1);
2451 if ( var.bw ){
2452 colo = -1;
2453 } else {
2454 colo = 1;
2455 };
2456 if ( level.file == -1 ){
2457 ColorMIP(ms21a[j]+ms21b[j],colo);
2458 } else {
2459 ColorTOFMIP(ms21a[j]+ms21b[j],colo);
2460 };
2461 //
2462 if ( colo != 10 ) ocolo = colo;
2463 //
2464 ftof21y[j]->SetFillColor(colo);
2465 ftof21y[j]->SetLineWidth(1);
2466 ftof21y[j]->Draw("f");
2467 ftof21y[j]->Draw();
2468 };
2469 //
2470 // S21 X-view
2471 //
2472 if ( true ){
2473 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2474 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
2475 Float_t nxc[5];
2476 Float_t nyc[5];
2477 for (Int_t i = 0; i<5 ; i++) {
2478 nxc[i]= xs2x + nxc1[i]*var.sfx;
2479 nyc[i] = ys2x + nyc1[i]*var.sfy;
2480 };
2481 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
2482 ftof21x->SetLineColor(1);
2483 ftof21x->SetFillStyle(4000);
2484 ftof21x->SetFillColor(0);
2485 ftof21x->SetLineWidth(1);
2486 ftof21x->Draw("f");
2487 ftof21x->Draw();
2488 TPolyLine *sftof21[2];
2489 tt = 1;
2490 if ( level.file == -1 ) tt = 2;
2491 for ( Int_t j=0; j<tt; j++){
2492 // for ( Int_t j=0; j<2; j++){
2493 if ( (mt21[0][j]<4095. || mt21[1][j]<4095.) ){
2494 if ( ocolo == 10 ) ocolo = noadc;
2495 Float_t lowp = (xp21[j]-E21[j])/100.;
2496 Float_t higp = (xp21[j]+E21[j])/100.;
2497 if ( lowp < -0.089 ) lowp = -0.089;
2498 if ( higp > 0.089 ) higp = 0.089;
2499 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp21[j] != 0.))){
2500 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2501 Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
2502 Float_t nxc[5];
2503 Float_t nyc[5];
2504 for (Int_t i = 0; i<5 ; i++) {
2505 nxc[i]= xs2x + nxc1[i]*var.sfx;
2506 nyc[i] = ys2x + nyc1[i]*var.sfy;
2507 };
2508 sftof21[j] = new TPolyLine(5,nxc,nyc);
2509 sftof21[j]->SetLineColor(ocolo);
2510 sftof21[j]->SetFillColor(ocolo);
2511 sftof21[j]->SetLineWidth(1);
2512 sftof21[j]->Draw("f");
2513 sftof21[j]->Draw();
2514 };
2515 };
2516 };
2517 };
2518 //
2519
2520 //
2521 // S22 X-view
2522 //
2523 Float_t s22p = 0.090;
2524 ocolo = 10;
2525 TPolyLine *ftof22x[2];
2526 for ( Int_t j=0; j<2; j++){
2527 Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
2528 Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
2529 Float_t nxc[5];
2530 Float_t nyc[5];
2531 for (Int_t i = 0; i<5 ; i++) {
2532 nxc[i]= xs2x + nxc1[i]*var.sfx;
2533 nyc[i] = ys2x + nyc1[i]*var.sfy;
2534 };
2535 ftof22x[j] = new TPolyLine(5,nxc,nyc);
2536 ftof22x[j]->SetLineColor(1);
2537 if ( var.bw ){
2538 colo = -1;
2539 } else {
2540 colo = 1;
2541 };
2542 if ( level.file == -1 ){
2543 ColorMIP(ms22a[j]+ms22b[j],colo);
2544 } else {
2545 ColorTOFMIP(ms22a[j]+ms22b[j],colo);
2546 };
2547 //
2548 if ( colo != 10 ) ocolo = colo;
2549 //
2550 ftof22x[j]->SetFillColor(colo);
2551 ftof22x[j]->SetLineWidth(1);
2552 ftof22x[j]->Draw("f");
2553 ftof22x[j]->Draw();
2554 };
2555 //
2556 // S22 Y-view
2557 //
2558 if ( true ){
2559 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2560 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
2561 Float_t nxc[5];
2562 Float_t nyc[5];
2563 for (Int_t i = 0; i<5 ; i++) {
2564 nxc[i]= xs2y + nxc1[i]*var.sfx;
2565 nyc[i] = ys2y + nyc1[i]*var.sfy;
2566 };
2567 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
2568 ftof22y->SetLineColor(1);
2569 ftof22y->SetFillStyle(4000);
2570 ftof22y->SetFillColor(0);
2571 ftof22y->SetLineWidth(1);
2572 ftof22y->Draw("f");
2573 ftof22y->Draw();
2574 TPolyLine *sftof22[2];
2575 tt = 1;
2576 if ( level.file == -1 ) tt = 2;
2577 for (Int_t j=0; j<tt; j++){
2578 // for ( Int_t j=0; j<2; j++){
2579 if ( (mt22[0][j]<4095. || mt22[1][j]<4095.) ){
2580 if ( ocolo == 10 ) ocolo = noadc;
2581 Float_t lowp = (xp22[j]-E22[j])/100.;
2582 Float_t higp = (xp22[j]+E22[j])/100.;
2583 if ( lowp < -0.074 ) lowp = -0.074;
2584 if ( higp > 0.074 ) higp = 0.074;
2585 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp22[j] != 0.))){
2586 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2587 Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
2588 Float_t nxc[5];
2589 Float_t nyc[5];
2590 for (Int_t i = 0; i<5 ; i++) {
2591 nxc[i]= xs2y + nxc1[i]*var.sfx;
2592 nyc[i] = ys2y + nyc1[i]*var.sfy;
2593 };
2594 sftof22[j] = new TPolyLine(5,nxc,nyc);
2595 sftof22[j]->SetLineColor(ocolo);
2596 sftof22[j]->SetFillColor(ocolo);
2597 sftof22[j]->SetLineWidth(1);
2598 sftof22[j]->Draw("f");
2599 sftof22[j]->Draw();
2600 };
2601 };
2602 };
2603 };
2604 //
2605
2606 //
2607 // S31 X-view
2608 //
2609 Float_t s31p = 0.060;
2610 ocolo = 10;
2611 TPolyLine *ftof31x[3];
2612 for ( Int_t j=0; j<3; j++){
2613 Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
2614 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
2615 Float_t nxc[5];
2616 Float_t nyc[5];
2617 for (Int_t i = 0; i<5 ; i++) {
2618 nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
2619 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
2620 };
2621 ftof31x[j] = new TPolyLine(5,nxc,nyc);
2622 ftof31x[j]->SetLineColor(1);
2623 if ( var.bw ){
2624 colo = -1;
2625 } else {
2626 colo = 1;
2627 };
2628 if ( level.file == -1 ){
2629 ColorMIP(ms31a[j]+ms31b[j],colo);
2630 } else {
2631 ColorTOFMIP(ms31a[j]+ms31b[j],colo);
2632 };
2633 //
2634 if ( colo != 10 ) ocolo = colo;
2635 //
2636 ftof31x[j]->SetFillColor(colo);
2637 ftof31x[j]->SetLineWidth(1);
2638 ftof31x[j]->Draw("f");
2639 ftof31x[j]->Draw();
2640 };
2641 //
2642 // S31 Y-view
2643 //
2644 if ( true ){
2645 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2646 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2647 Float_t nxc[5];
2648 Float_t nyc[5];
2649 for (Int_t i = 0; i<5 ; i++) {
2650 nxc[i]= xs2y + nxc1[i]*var.sfx;
2651 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
2652 };
2653 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
2654 ftof31y->SetLineColor(1);
2655 ftof31y->SetFillStyle(4000);
2656 ftof31y->SetFillColor(0);
2657 ftof31y->SetLineWidth(1);
2658 ftof31y->Draw("f");
2659 ftof31y->Draw();
2660 TPolyLine *sftof31[3];
2661 tt = 1;
2662 if ( level.file == -1 ) tt = 3;
2663 for (Int_t j=0; j<tt; j++){
2664 // for ( Int_t j=0; j<3; j++){
2665 if ( (mt31[0][j]<4095. || mt31[1][j]<4095.)){
2666 if ( ocolo == 10 ) ocolo = noadc;
2667 Float_t lowp = (xp31[j]-E31[j])/100.;
2668 Float_t higp = (xp31[j]+E31[j])/100.;
2669 if ( lowp < -0.074 ) lowp = -0.074;
2670 if ( higp > 0.074 ) higp = 0.074;
2671 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp31[j] != 0.))){
2672 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2673 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
2674 Float_t nxc[5];
2675 Float_t nyc[5];
2676 for (Int_t i = 0; i<5 ; i++) {
2677 nxc[i]= xs2y + nxc1[i]*var.sfx;
2678 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
2679 };
2680 sftof31[j] = new TPolyLine(5,nxc,nyc);
2681 sftof31[j]->SetLineColor(ocolo);
2682 sftof31[j]->SetFillColor(ocolo);
2683 sftof31[j]->SetLineWidth(1);
2684 sftof31[j]->Draw("f");
2685 sftof31[j]->Draw();
2686 };
2687 };
2688 };
2689 };
2690 //
2691
2692 //
2693 // S32 Y-view
2694 //
2695 Float_t s32p = 0.050;
2696 ocolo = 10;
2697 TPolyLine *ftof32y[3];
2698 for ( Int_t j=0; j<3; j++){
2699 Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
2700 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
2701 Float_t nxc[5];
2702 Float_t nyc[5];
2703 for (Int_t i = 0; i<5 ; i++) {
2704 nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
2705 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
2706 };
2707 ftof32y[j] = new TPolyLine(5,nxc,nyc);
2708 ftof32y[j]->SetLineColor(1);
2709 if ( var.bw ){
2710 colo = -1;
2711 } else {
2712 colo = 1;
2713 };
2714 if ( level.file == -1 ){
2715 ColorMIP(ms32a[j]+ms32b[j],colo);
2716 } else {
2717 ColorTOFMIP(ms32a[j]+ms32b[j],colo);
2718 };
2719 //
2720 if ( colo != 10 ) ocolo = colo;
2721 //
2722 ftof32y[j]->SetFillColor(colo);
2723 ftof32y[j]->SetLineWidth(1);
2724 ftof32y[j]->Draw("f");
2725 ftof32y[j]->Draw();
2726 };
2727 //
2728 // S32 X-view
2729 //
2730 if ( true ){
2731 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2732 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2733 Float_t nxc[5];
2734 Float_t nyc[5];
2735 for (Int_t i = 0; i<5 ; i++) {
2736 nxc[i]= xs2x + nxc1[i]*var.sfx;
2737 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
2738 };
2739 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
2740 ftof32x->SetLineColor(1);
2741 ftof32x->SetLineWidth(1);
2742 ftof32x->SetFillStyle(4000);
2743 ftof32x->SetFillColor(0);
2744 ftof32x->Draw("f");
2745 ftof32x->Draw();
2746 TPolyLine *sftof32[3];
2747 tt = 1;
2748 if ( level.file == -1 ) tt = 3;
2749 for (Int_t j=0; j<tt; j++){
2750 // for ( Int_t j=0; j<3; j++){
2751 if ( (mt32[0][j]<4095. || mt32[1][j]<4095.) ){
2752 if ( ocolo == 10 ) ocolo = noadc;
2753 Float_t lowp = (xp32[j]-E32[j])/100.;
2754 Float_t higp = (xp32[j]+E32[j])/100.;
2755 if ( lowp < -0.089 ) lowp = -0.089;
2756 if ( higp > 0.089 ) higp = 0.089;
2757 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp32[j] != 0.))){
2758 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
2759 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
2760 Float_t nxc[5];
2761 Float_t nyc[5];
2762 for (Int_t i = 0; i<5 ; i++) {
2763 nxc[i]= xs2x + nxc1[i]*var.sfx;
2764 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
2765 };
2766 sftof32[j] = new TPolyLine(5,nxc,nyc);
2767 sftof32[j]->SetLineColor(ocolo);
2768 sftof32[j]->SetFillColor(ocolo);
2769 sftof32[j]->SetLineWidth(1);
2770 sftof32[j]->Draw("f");
2771 sftof32[j]->Draw();
2772 };
2773 };
2774 };
2775 };
2776 //
2777 if ( level.file == -1 || numtr >= repuntil ) repeat = false;
2778 //
2779 };
2780 //
2781 }
2782
2783
2784 void FEVdetector::ShowAC(){
2785 //
2786 //
2787 //
2788 if ( !var.AC ) return;
2789 //
2790 Int_t hitmapA = 0;
2791 Int_t hitmapB = 0;
2792 Int_t hitstatusA = 0;
2793 Int_t hitstatusB = 0;
2794 //
2795 // level0 and level-1 do not give infos about out of trigger events
2796 //
2797 if ( level.file == 0 || level.file == -1 ){
2798 hitmapA = ace->hitmap[0];
2799 hitmapB = ace->hitmap[1];
2800 hitstatusA = 65535;
2801 hitstatusB = 65535;
2802 };
2803 //
2804 // full infos from ac
2805 //
2806 if ( level.file == 2 ){
2807 hitmapA = L2->hitmap[0];
2808 hitmapB = L2->hitmap[1];
2809 hitstatusA = L2->hitstatus[0];
2810 hitstatusB = L2->hitstatus[1];
2811 };
2812 //
2813 //
2814 //
2815 Float_t cas1 = 0.;
2816 Float_t cas2 = 0.;
2817 Float_t cas3 = 0.;
2818 Float_t cas4 = 0.;
2819 Float_t cas1b = 0.;
2820 Float_t cas2b = 0.;
2821 Float_t cas3b = 0.;
2822 Float_t cas4b = 0.;
2823 //
2824 Float_t cat1 = 0.;
2825 Float_t cat2 = 0.;
2826 Float_t cat3 = 0.;
2827 Float_t cat4 = 0.;
2828 Float_t cat1b = 0.;
2829 Float_t cat2b = 0.;
2830 Float_t cat3b = 0.;
2831 Float_t cat4b = 0.;
2832 //
2833 Float_t card1 = 0.;
2834 Float_t card2 = 0.;
2835 Float_t card3 = 0.;
2836 Float_t card4 = 0.;
2837 Float_t card1b = 0.;
2838 Float_t card2b = 0.;
2839 Float_t card3b = 0.;
2840 Float_t card4b = 0.;
2841 //
2842 Float_t intime = -0.25;
2843 Float_t outtime = -0.375;
2844 if ( var.bw ){
2845 intime = -0.25;
2846 outtime = -0.375;
2847 } else {
2848 intime = 1.;
2849 outtime = -4.;
2850 };
2851 //
2852 // main board
2853 //
2854 if ( hitmapA & (1<<0) ) {
2855 card4 = intime;
2856 if ( !(hitstatusA & (1<<0)) ) card4 = outtime ;
2857 var.hcard++;
2858 }
2859 if ( hitmapA & (1<<1) ) {
2860 cat2 = intime;
2861 if ( !(hitstatusA & (1<<1)) ) cat2 = outtime ;
2862 var.hcat++;
2863 }
2864 if ( hitmapA & (1<<2) ) {
2865 cas1 = intime;
2866 if ( !(hitstatusA & (1<<2)) ) cas1 = outtime ;
2867 var.hcas++;
2868 }
2869 //
2870 if ( hitmapA & (1<<4) ) {
2871 card2 = intime;
2872 if ( !(hitstatusA & (1<<4)) ) card2 = outtime ;
2873 var.hcard++;
2874 }
2875 if ( hitmapA & (1<<5) ) {
2876 cat4 = intime;
2877 if ( !(hitstatusA & (1<<5)) ) cat4 = outtime ;
2878 var.hcat++;
2879 }
2880 if ( hitmapA & (1<<6) ) {
2881 cas4 = intime;
2882 if ( !(hitstatusA & (1<<6)) ) cas4 = outtime ;
2883 var.hcas++;
2884 }
2885 //
2886 if ( hitmapA & (1<<8) ) {
2887 card3 = intime;
2888 if ( !(hitstatusA & (1<<8)) ) card3 = outtime ;
2889 var.hcard++;
2890 }
2891 if ( hitmapA & (1<<9) ) {
2892 cat3 = intime;
2893 if ( !(hitstatusA & (1<<9)) ) cat3 = outtime ;
2894 var.hcat++;
2895 }
2896 if ( hitmapA & (1<<10) ) {
2897 cas3 = intime;
2898 if ( !(hitstatusA & (1<<10)) ) cas3 = outtime ;
2899 var.hcas++;
2900 }
2901 //
2902 if ( hitmapA & (1<<12) ) {
2903 card1 = intime;
2904 if ( !(hitstatusA & (1<<12)) ) card1 = outtime ;
2905 var.hcard++;
2906 }
2907 if ( hitmapA & (1<<13) ) {
2908 cat1 = intime;
2909 if ( !(hitstatusA & (1<<13)) ) cat1 = outtime ;
2910 var.hcat++;
2911 }
2912 if ( hitmapA & (1<<14) ) {
2913 cas2 = intime;
2914 if ( !(hitstatusA & (1<<14)) ) cas2 = outtime ;
2915 var.hcas++;
2916 }
2917 //
2918 // extra board
2919 //
2920 if ( hitmapB & (1<<0) ) {
2921 card4b = intime;
2922 if ( !(hitstatusB & (1<<0)) ) card4b = outtime ;
2923 var.hcard++;
2924 }
2925 if ( hitmapB & (1<<1) ) {
2926 cat2b = intime;
2927 if ( !(hitstatusB & (1<<1)) ) cat2b = outtime ;
2928 var.hcat++;
2929 }
2930 if ( hitmapB & (1<<2) ) {
2931 cas1b = intime;
2932 if ( !(hitstatusB & (1<<2)) ) cas1b = outtime;
2933 var.hcas++;
2934 }
2935 //
2936 if ( hitmapB & (1<<4) ) {
2937 card2b = intime;
2938 if ( !(hitstatusB & (1<<4)) ) card2b = outtime ;
2939 var.hcard++;
2940 }
2941 if ( hitmapB & (1<<5) ) {
2942 cat4b = intime;
2943 if ( !(hitstatusB & (1<<5)) ) cat4b = outtime ;
2944 var.hcat++;
2945 }
2946 if ( hitmapB & (1<<6) ) {
2947 cas4b = intime;
2948 if ( !(hitstatusB & (1<<6)) ) cas4b = outtime ;
2949 var.hcas++;
2950 }
2951 //
2952 if ( hitmapB & (1<<8) ) {
2953 card3b = intime;
2954 if ( !(hitstatusB & (1<<8)) ) card3b = outtime ;
2955 var.hcard++;
2956 }
2957 if ( hitmapB & (1<<9) ) {
2958 cat3b = intime;
2959 if ( !(hitstatusB & (1<<9)) ) cat3b = outtime ;
2960 var.hcat++;
2961 }
2962 if ( hitmapB & (1<<10) ) {
2963 cas3b = intime;
2964 if ( !(hitstatusB & (1<<10)) ) cas3b = outtime ;
2965 var.hcas++;
2966 }
2967 //
2968 if ( hitmapB & (1<<12) ) {
2969 card1b = intime;
2970 if ( !(hitstatusB & (1<<12)) ) card1b = outtime ;
2971 var.hcard++;
2972 }
2973 if ( hitmapB & (1<<13) ) {
2974 cat1b = intime;
2975 if ( !(hitstatusB & (1<<13)) ) cat1b = outtime ;
2976 var.hcat++;
2977 }
2978 if ( hitmapB & (1<<14) ) {
2979 cas2b = intime;
2980 if ( !(hitstatusB & (1<<14)) ) cas2b = outtime ;
2981 var.hcas++;
2982 };
2983 Int_t colo = 0;
2984 //
2985 // CAS height and width
2986 //
2987 Float_t csh = 0.194*var.sfy;
2988 Float_t csw = 0.008*var.sfx;
2989 Float_t ctw = 0.008;
2990
2991 //
2992 // CAS2 -0.039-0.081 |TRX TRY
2993 //
2994 if ( true ){
2995 Float_t xofs = var.xxvc -(0.039+0.081+0.0273)*var.sfx;
2996 Float_t yofs = var.yxvc + 0.09*var.sfy ;
2997 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
2998 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
2999 TPolyLine *fcas2 = new TPolyLine(4,x,y);
3000 fcas2->SetLineColor(1);
3001 colo = (int)(10. - cas2 * 8.);
3002 fcas2->SetFillColor(colo);
3003 fcas2->SetLineWidth(1);
3004 fcas2->Draw("f");
3005 fcas2->Draw();
3006 };
3007 if ( true ){
3008 Float_t xofs = var.xxvc -(0.039 +0.081 +0.0273)*var.sfx;
3009 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3010 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3011 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
3012 TPolyLine *fcas2b = new TPolyLine(4,x,y);
3013 fcas2b->SetLineColor(1);
3014 colo = (int)(10. - cas2b * 8.);
3015 fcas2b->SetFillColor(colo);
3016 fcas2b->SetLineWidth(1);
3017 fcas2b->Draw("f");
3018 fcas2b->Draw();
3019 };
3020 //
3021 // CAS1 -0.039+0.081 TRX| TRY
3022 //
3023 if ( true ){
3024 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
3025 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3026 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3027 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
3028 TPolyLine *fcas1 = new TPolyLine(4,x,y);
3029 fcas1->SetLineColor(1);
3030 colo = (int)(10. - cas1 * 8.);
3031 fcas1->SetFillColor(colo);
3032 fcas1->SetLineWidth(1);
3033 fcas1->Draw("f");
3034 fcas1->Draw();
3035 };
3036 if ( true ){
3037 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
3038 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3039 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3040 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
3041 TPolyLine *fcas1b = new TPolyLine(4,x,y);
3042 fcas1b->SetLineColor(1);
3043 colo = (int)(10. - cas1b * 8.);
3044 fcas1b->SetFillColor(colo);
3045 fcas1b->SetLineWidth(1);
3046 fcas1b->Draw("f");
3047 fcas1b->Draw();
3048 };
3049 //
3050 // CAS4 -0.039-0.081 TRX |TRY
3051 //
3052 if ( true ){
3053 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
3054 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3055 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3056 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
3057 TPolyLine *fcas4 = new TPolyLine(4,x,y);
3058 fcas4->SetLineColor(1);
3059 colo = (int)(10. - cas4 * 8.);
3060 fcas4->SetFillColor(colo);
3061 fcas4->SetLineWidth(1);
3062 fcas4->Draw("f");
3063 fcas4->Draw();
3064 };
3065 if ( true ){
3066 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
3067 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3068 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3069 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
3070 TPolyLine *fcas4b = new TPolyLine(4,x,y);
3071 fcas4b->SetLineColor(1);
3072 colo = (int)(10. - cas4b * 8.);
3073 fcas4b->SetFillColor(colo);
3074 fcas4b->SetLineWidth(1);
3075 fcas4b->Draw("f");
3076 fcas4b->Draw();
3077 };
3078
3079 //
3080 // CAS3 -0.039+0.081 TRX TRY|
3081 //
3082 if ( true ){
3083 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
3084 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3085 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3086 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
3087 TPolyLine *fcas3 = new TPolyLine(4,x,y);
3088 fcas3->SetLineColor(1);
3089 colo = (int)(10. - cas3 * 8.);
3090 fcas3->SetFillColor(colo);
3091 fcas3->SetLineWidth(1);
3092 fcas3->Draw("f");
3093 fcas3->Draw();
3094 };
3095 if ( true ){
3096 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
3097 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3098 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3099 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
3100 TPolyLine *fcas3b = new TPolyLine(4,x,y);
3101 fcas3b->SetLineColor(1);
3102 colo = (int)(10. - cas3b * 8.);
3103 fcas3b->SetFillColor(colo);
3104 fcas3b->SetLineWidth(1);
3105 fcas3b->Draw("f");
3106 fcas3b->Draw();
3107 };
3108
3109 //
3110 // CAT coordinate system
3111 //
3112 Float_t xcat = var.xcat;
3113 Float_t ycat = var.ycat;
3114 Float_t pmt1 = 0.0356;
3115 Float_t pmt2 = 0.038;
3116 Float_t xpmt1 = -0.149*var.sfx;
3117 Float_t ypmt1 = 0.251*var.sfy;
3118 Float_t apmt1 = atan((11.*var.sfy)/(14.*var.sfx));
3119 Float_t xpmt2 = -0.257*var.sfx;
3120 Float_t ypmt2 = 0.158*var.sfy;
3121 Float_t apmt2 = atan((11.*var.sfx)/(15.*var.sfy));
3122 //
3123 Int_t cattime = 13;
3124 Int_t catnoti = 12;
3125 if ( var.bw ){
3126 cattime = 13;
3127 catnoti = 12;
3128 } else {
3129 cattime = 2;
3130 catnoti = 42;
3131 };
3132 //
3133 if ( true ){
3134 // PMTs
3135 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.};
3136 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.};
3137 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.};
3138 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.};
3139 // SCINTs
3140 Float_t xcc1[10]={-0.149, -0.090165, -0.090165, -0.149, -0.242, -0.257, -0.212, -0.257, -0.242, -0.149};
3141 Float_t ycc1[10]={ 0.169, 0.108165, -0.108165, -0.169, -0.169, -0.158, 0., 0.158, 0.169, 0.169};
3142 Float_t xcc2[10]={-0.149, -0.149, -0.138, 0., 0.138, 0.149, 0.149, 0.090165, -0.090165, -0.149};
3143 Float_t ycc2[10]={ 0.169, 0.251, 0.265, 0.220, 0.265, 0.251, 0.169, 0.108165, 0.108165, 0.169};
3144 //
3145 // CAT sections
3146 //
3147 if ( true ){
3148 Float_t xofs = var.xxvc -0.108165*var.sfx;
3149 Float_t yofs = var.yxvc + 0.3725*var.sfy ;
3150 Double_t xx[5] = {xofs,xofs-0.112*var.sfx,xofs-0.112*var.sfx,xofs,xofs};
3151 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3152 TPolyLine *fcat3 = new TPolyLine(5,xx,yy);
3153 fcat3->SetLineColor(1);
3154 if ( cat3 != 0. || cat3b != 0. ){
3155 if ( cat3 > 0 || cat3b > 0 || cat3 == -0.25 || cat3b == -0.25 ){
3156 colo = cattime;
3157 } else {
3158 colo = catnoti;
3159 };
3160 } else {
3161 colo = 10;
3162 };
3163 fcat3->SetFillColor(colo);
3164 fcat3->SetLineWidth(1);
3165 fcat3->Draw("f");
3166 fcat3->Draw();
3167 };
3168 if ( true ){
3169 Float_t xofs = var.xxvc +0.108165*var.sfx;
3170 Float_t yofs = var.yxvc + 0.3725 *var.sfy;
3171 Double_t xx[5] = {xofs,xofs+0.112*var.sfx,xofs+0.112*var.sfx,xofs,xofs};
3172 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3173 TPolyLine *fcat4 = new TPolyLine(5,xx,yy);
3174 fcat4->SetLineColor(1);
3175 if ( cat4 != 0. || cat4b != 0. ){
3176 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b == -.25 ){
3177 colo = cattime;
3178 } else {
3179 colo = catnoti;
3180 };
3181 } else {
3182 colo = 10;
3183 };
3184 fcat4->SetFillColor(colo);
3185 fcat4->SetLineWidth(1);
3186 fcat4->Draw("f");
3187 fcat4->Draw();
3188 };
3189 if ( true ){
3190 Float_t xofs = var.xyvc + 0.090165*var.sfx;
3191 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
3192 Double_t xx[5] = {xofs,xofs+0.122*var.sfx,xofs+0.122*var.sfx,xofs,xofs};
3193 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3194 TPolyLine *fcat1 = new TPolyLine(5,xx,yy);
3195 fcat1->SetLineColor(1);
3196 if ( cat1 != 0. || cat1b != 0. ){
3197 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
3198 colo = cattime;
3199 } else {
3200 colo = catnoti;
3201 };
3202 } else {
3203 colo = 10;
3204 };
3205 fcat1->SetFillColor(colo);
3206 fcat1->SetLineWidth(1);
3207 fcat1->Draw("f");
3208 fcat1->Draw();
3209 };
3210 if ( true ){
3211 Float_t xofs = var.xyvc - 0.090165*var.sfx;
3212 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
3213 Double_t xx[5] = {xofs,xofs-0.122*var.sfx,xofs-0.122*var.sfx,xofs,xofs};
3214 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3215 TPolyLine *fcat2 = new TPolyLine(5,xx,yy);
3216 fcat2->SetLineColor(1);
3217 if ( cat2 != 0. || cat2b != 0. ){
3218 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
3219 colo = cattime;
3220 } else {
3221 colo = catnoti;
3222 };
3223 } else {
3224 colo = 10;
3225 };
3226 fcat2->SetFillColor(colo);
3227 fcat2->SetLineWidth(1);
3228 fcat2->Draw("f");
3229 fcat2->Draw();
3230 };
3231 //
3232 // CAT1
3233 //
3234 Float_t xcc[10];
3235 Float_t ycc[10];
3236 if ( true ){
3237 for (Int_t i = 0; i<10 ; i++) {
3238 xcc[i]= xcat - xcc1[i]*var.sfx;
3239 ycc[i] = ycat + ycc1[i]*var.sfy;
3240 };
3241 TPolyLine *fcat1 = new TPolyLine(10,xcc,ycc);
3242 fcat1->SetLineColor(1);
3243 colo = 10;
3244 if ( cat1 != 0. || cat1b != 0. ) {
3245 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
3246 colo = cattime;
3247 } else {
3248 colo = catnoti;
3249 };
3250 };
3251 fcat1->SetFillColor(colo);
3252 fcat1->SetLineWidth(1);
3253 fcat1->Draw("f");
3254 fcat1->Draw();
3255 };
3256 //
3257 // CAT2
3258 //
3259 if ( true ){
3260 for (Int_t i = 0; i<10 ; i++) {
3261 xcc[i]= xcat + xcc1[i]*var.sfx;
3262 ycc[i] = ycat + ycc1[i]*var.sfy;
3263 };
3264 TPolyLine *fcat2 = new TPolyLine(10,xcc,ycc);
3265 fcat2->SetLineColor(1);
3266 colo = 10;
3267 if ( cat2 != 0. || cat2b != 0. ) {
3268 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
3269 colo = cattime;
3270 } else {
3271 colo = catnoti;
3272 };
3273 };
3274 fcat2->SetFillColor(colo);
3275 fcat2->SetLineWidth(1);
3276 fcat2->Draw("f");
3277 fcat2->Draw();
3278 };
3279 //
3280 // CAT3
3281 //
3282 if ( true ){
3283 for (Int_t i = 0; i<10 ; i++) {
3284 xcc[i]= xcat + xcc2[i]*var.sfx;
3285 ycc[i] = ycat - ycc2[i]*var.sfy;
3286 };
3287 TPolyLine *fcat3 = new TPolyLine(10,xcc,ycc);
3288 fcat3->SetLineColor(1);
3289 colo = 10;
3290 if ( cat3 != 0. || cat3b != 0. ) {
3291 if ( cat3 > 0 || cat3b > 0 || cat3 == -.25 || cat3b ==-.25 ){
3292 colo = cattime;
3293 } else {
3294 colo = catnoti;
3295 };
3296 };
3297 fcat3->SetFillColor(colo);
3298 fcat3->SetLineWidth(1);
3299 fcat3->Draw("f");
3300 fcat3->Draw();
3301 };
3302 //
3303 // CAT4
3304 //
3305 if ( true ){
3306 for (Int_t i = 0; i<10 ; i++) {
3307 xcc[i]= xcat + xcc2[i]*var.sfx;
3308 ycc[i] = ycat + ycc2[i]*var.sfy;
3309 };
3310 TPolyLine *fcat4 = new TPolyLine(10,xcc,ycc);
3311 fcat4->SetLineColor(1);
3312 colo = 10;
3313 if ( cat4 != 0. || cat4b != 0. ) {
3314 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b ==-.25 ){
3315 colo = cattime;
3316 } else {
3317 colo = catnoti;
3318 };
3319 };
3320 fcat4->SetFillColor(colo);
3321 fcat4->SetLineWidth(1);
3322 fcat4->Draw("f");
3323 fcat4->Draw();
3324 };
3325 //
3326 // CAT1 PMTs
3327 //
3328 Float_t xc[5];
3329 Float_t yc[5];
3330 if ( true ){
3331 for (Int_t i = 0; i<5 ; i++) {
3332 xc[i]= xcat - xpmt2 - xc1[i];
3333 yc[i] = ycat + ypmt2 + yc1[i];
3334 };
3335 TPolyLine *fcat1 = new TPolyLine(5,xc,yc);
3336 fcat1->SetLineColor(1);
3337 colo = (int)(10. - cat1 * 8.);
3338 fcat1->SetFillColor(colo);
3339 fcat1->SetLineWidth(1);
3340 fcat1->Draw("f");
3341 fcat1->Draw();
3342 };
3343 if ( true ){
3344 for (Int_t i = 0; i<5 ; i++) {
3345 xc[i]= xcat - xpmt2 - xc1[i];
3346 yc[i] = ycat - ypmt2 - yc1[i];
3347 };
3348 TPolyLine *fcat1b = new TPolyLine(5,xc,yc);
3349 fcat1b->SetLineColor(1);
3350 colo = (int)(10. - cat1b * 8.);
3351 fcat1b->SetFillColor(colo);
3352 fcat1b->SetLineWidth(1);
3353 fcat1b->Draw("f");
3354 fcat1b->Draw();
3355 };
3356 //
3357 // CAT2 PMTs
3358 //
3359 if ( true ){
3360 for (Int_t i = 0; i<5 ; i++) {
3361 xc[i]= xcat + xpmt2 + xc1[i];
3362 yc[i] = ycat + ypmt2 + yc1[i];
3363 };
3364 TPolyLine *fcat2 = new TPolyLine(5,xc,yc);
3365 fcat2->SetLineColor(1);
3366 colo = (int)(10. - cat2 * 8.);
3367 fcat2->SetFillColor(colo);
3368 fcat2->SetLineWidth(1);
3369 fcat2->Draw("f");
3370 fcat2->Draw();
3371 };
3372 if ( true ){
3373 for (Int_t i = 0; i<5 ; i++) {
3374 xc[i]= xcat + xpmt2 + xc1[i];
3375 yc[i] = ycat - ypmt2 - yc1[i];
3376 };
3377 TPolyLine *fcat2b = new TPolyLine(5,xc,yc);
3378 fcat2b->SetLineColor(1);
3379 colo = (int)(10. - cat2b * 8.);
3380 fcat2b->SetFillColor(colo);
3381 fcat2b->SetLineWidth(1);
3382 fcat2b->Draw("f");
3383 fcat2b->Draw();
3384 };
3385 //
3386 // CAT3 PMTs
3387 //
3388 if ( true ){
3389 for (Int_t i = 0; i<5 ; i++) {
3390 xc[i]= xcat + xpmt1 + xc2[i];
3391 yc[i] = ycat - ypmt1 - yc2[i];
3392 };
3393 TPolyLine *fcat3b = new TPolyLine(5,xc,yc);
3394 fcat3b->SetLineColor(1);
3395 colo = (int)(10. - cat3b * 8.);
3396 fcat3b->SetFillColor(colo);
3397 fcat3b->SetLineWidth(1);
3398 fcat3b->Draw("f");
3399 fcat3b->Draw();
3400 };
3401 if ( true ){
3402 for (Int_t i = 0; i<5 ; i++) {
3403 xc[i]= xcat - xpmt1 - xc2[i];
3404 yc[i] = ycat - ypmt1 - yc2[i];
3405 };
3406 TPolyLine *fcat3 = new TPolyLine(5,xc,yc);
3407 fcat3->SetLineColor(1);
3408 colo = (int)(10. - cat3 * 8.);
3409 fcat3->SetFillColor(colo);
3410 fcat3->SetLineWidth(1);
3411 fcat3->Draw("f");
3412 fcat3->Draw();
3413 };
3414 //
3415 // CAT4 PMTs
3416 //
3417 if ( true ){
3418 for (Int_t i = 0; i<5 ; i++) {
3419 xc[i]= xcat + xpmt1 + xc2[i];
3420 yc[i] = ycat + ypmt1 + yc2[i];
3421 };
3422 TPolyLine *fcat4b = new TPolyLine(5,xc,yc);
3423 fcat4b->SetLineColor(1);
3424 colo = (int)(10. - cat4b * 8.);
3425 fcat4b->SetFillColor(colo);
3426 fcat4b->SetLineWidth(1);
3427 fcat4b->Draw("f");
3428 fcat4b->Draw();
3429 };
3430 if ( true ){
3431 for (Int_t i = 0; i<5 ; i++) {
3432 xc[i]= xcat - xpmt1 - xc2[i];
3433 yc[i] = ycat + ypmt1 + yc2[i];
3434 };
3435 TPolyLine *fcat4 = new TPolyLine(5,xc,yc);
3436 fcat4->SetLineColor(1);
3437 colo = (int)(10. - cat4 * 8.);
3438 fcat4->SetFillColor(colo);
3439 fcat4->SetLineWidth(1);
3440 fcat4->Draw("f");
3441 fcat4->Draw();
3442 };
3443 };
3444 if ( true ){
3445 //
3446 // CAS plane view:
3447 //
3448 Float_t xofs = -0.025;
3449 Float_t yofs = 0.039 +0.081+0.0273;
3450 Float_t csy = 0.33/2.;
3451 Float_t pmofs = 0.004;
3452 Float_t csw2 = 0.008;
3453 Float_t xc1[5] = { xofs-csy, xofs-csy, xofs+csy, xofs+csy, xofs-csy};
3454 Float_t yc1[5] = { yofs, yofs+csw2, yofs+csw2, yofs, yofs};
3455
3456 Float_t xc2[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
3457 Float_t yc2[5] = { yofs+pmofs, yofs+pmofs+csw2, yofs+pmofs+csw2, yofs+pmofs, yofs+pmofs};
3458 Float_t xc3[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
3459 Float_t yc3[5] = { yofs+pmofs, yofs+pmofs-csw2, yofs+pmofs-csw2, yofs+pmofs, yofs+pmofs};
3460
3461 //
3462 // CAS1
3463 //
3464 Float_t xc[5];
3465 Float_t yc[5];
3466 for (Int_t i = 0; i<5 ; i++) {
3467 xc[i]= xcat + xc1[i]*var.sfx;
3468 yc[i] = ycat + yc1[i]*var.sfy;
3469 };
3470 TPolyLine *pcass1 = new TPolyLine(5,xc,yc);
3471 pcass1->SetLineColor(1);
3472 colo = 10;
3473 if ( cas1 != 0. || cas1b != 0. ) {
3474 if ( cas1 > 0 || cas1b > 0 || cas1 ==-.25 || cas1b ==-.25){
3475 colo = cattime;
3476 } else {
3477 colo = catnoti;
3478 };
3479 };
3480 if ( colo != 10 ) pcass1->SetFillStyle(3001);
3481 pcass1->SetFillColor(colo);
3482 pcass1->SetLineWidth(1);
3483 pcass1->SetLineStyle(2);
3484 pcass1->Draw("f");
3485 pcass1->Draw();
3486 //
3487 for (Int_t i = 0; i<5 ; i++) {
3488 xc[i]= xcat + xc2[i]*var.sfx;
3489 yc[i] = ycat + yc2[i]*var.sfy;
3490 };
3491 TPolyLine *pcasp1b = new TPolyLine(5,xc,yc);
3492 pcasp1b->SetLineColor(1);
3493 colo = (int)(10. - cas1b * 8.);
3494 if ( colo != 10 ) pcasp1b->SetFillStyle(3001);
3495 pcasp1b->SetFillColor(colo);
3496 pcasp1b->SetLineWidth(1);
3497 pcasp1b->SetLineStyle(2);
3498 pcasp1b->Draw("f");
3499 pcasp1b->Draw();
3500 //
3501 for (Int_t i = 0; i<5 ; i++) {
3502 xc[i]= xcat + xc3[i]*var.sfx;
3503 yc[i] = ycat + yc3[i]*var.sfy;
3504 };
3505 TPolyLine *pcasp1 = new TPolyLine(5,xc,yc);
3506 pcasp1->SetLineColor(1);
3507 colo = (int)(10. - cas1 * 8.);
3508 if ( colo != 10 ) pcasp1->SetFillStyle(3001);
3509 pcasp1->SetFillColor(colo);
3510 pcasp1->SetLineWidth(1);
3511 pcasp1->SetLineStyle(2);
3512 pcasp1->Draw("f");
3513 pcasp1->Draw();
3514 //
3515 // CAS2
3516 //
3517 for (Int_t i = 0; i<5 ; i++) {
3518 xc[i]= xcat - xc1[i]*var.sfx;
3519 yc[i] = ycat - yc1[i]*var.sfy;
3520 };
3521 TPolyLine *pcass2 = new TPolyLine(5,xc,yc);
3522 pcass2->SetLineColor(1);
3523 colo = 10;
3524 if ( cas2 != 0. || cas2b != 0. ) {
3525 if ( cas2 > 0 || cas2b > 0 || cas2 ==-.25 || cas2b ==-.25 ){
3526 colo = cattime;
3527 } else {
3528 colo = catnoti;
3529 };
3530 };
3531 if ( colo != 10 ) pcass2->SetFillStyle(3001);
3532 pcass2->SetFillColor(colo);
3533 pcass2->SetLineWidth(1);
3534 pcass2->SetLineStyle(2);
3535 pcass2->Draw("f");
3536 pcass2->Draw();
3537 //
3538 for (Int_t i = 0; i<5 ; i++) {
3539 xc[i]= xcat - xc2[i]*var.sfx;
3540 yc[i] = ycat - yc2[i]*var.sfy;
3541 };
3542 TPolyLine *pcasp2b = new TPolyLine(5,xc,yc);
3543 pcasp2b->SetLineColor(1);
3544 colo = (int)(10. - cas2b * 8.);
3545 if ( colo != 10 ) pcasp2b->SetFillStyle(3001);
3546 pcasp2b->SetFillColor(colo);
3547 pcasp2b->SetLineWidth(1);
3548 pcasp2b->SetLineStyle(2);
3549 pcasp2b->Draw("f");
3550 pcasp2b->Draw();
3551 //
3552 for (Int_t i = 0; i<5 ; i++) {
3553 xc[i]= xcat - xc3[i]*var.sfx;
3554 yc[i] = ycat - yc3[i]*var.sfy;
3555 };
3556 TPolyLine *pcasp2 = new TPolyLine(5,xc,yc);
3557 pcasp2->SetLineColor(1);
3558 colo = (int)(10. - cas2 * 8.);
3559 pcasp2->SetFillColor(colo);
3560 if ( colo != 10 ) pcasp2->SetFillStyle(3001);
3561 pcasp2->SetLineWidth(1);
3562 pcasp2->SetLineStyle(2);
3563 pcasp2->Draw("f");
3564 pcasp2->Draw();
3565
3566 };
3567 if ( true ){
3568 Float_t xofs = 0.048 +0.066+0.0273;
3569 Float_t yofs = 0.02;
3570 Float_t csy = 0.33/2.;
3571 Float_t pmofs = 0.004;
3572 Float_t csw2 = 0.008;
3573 Float_t xc1[5] = { xofs, xofs+csw2, xofs+csw2, xofs, xofs};
3574 Float_t yc1[5] = { yofs-csy, yofs-csy, yofs+csy, yofs+csy, yofs-csy};
3575 Float_t xc2[5] = { xofs+pmofs, xofs+pmofs+csw2, xofs+pmofs+csw2, xofs+pmofs, xofs+pmofs};
3576 Float_t yc2[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
3577 Float_t xc3[5] = { xofs+pmofs, xofs+pmofs-csw2, xofs+pmofs-csw2, xofs+pmofs, xofs+pmofs};
3578 Float_t yc3[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
3579 //
3580 // CAS3
3581 //
3582 Float_t xc[5];
3583 Float_t yc[5];
3584 for (Int_t i = 0; i<5 ; i++) {
3585 xc[i]= xcat + xc1[i]*var.sfx;
3586 yc[i] = ycat + yc1[i]*var.sfy;
3587 };
3588 TPolyLine *pcass3 = new TPolyLine(5,xc,yc);
3589 pcass3->SetLineColor(1);
3590 colo = 10;
3591 if ( cas3 != 0. || cas3b != 0. ) {
3592 if ( cas3 > 0 || cas3b > 0 || cas3 ==-.25 || cas3b ==-.25){
3593 colo = cattime;
3594 } else {
3595 colo = catnoti;
3596 };
3597 };
3598 if ( colo != 10 ) pcass3->SetFillStyle(3001);
3599 pcass3->SetFillColor(colo);
3600 pcass3->SetLineWidth(1);
3601 pcass3->SetLineStyle(2);
3602 pcass3->Draw("f");
3603 pcass3->Draw();
3604 //
3605 for (Int_t i = 0; i<5 ; i++) {
3606 xc[i]= xcat + xc2[i]*var.sfx;
3607 yc[i] = ycat + yc2[i]*var.sfy;
3608 };
3609 TPolyLine *pcasp3b = new TPolyLine(5,xc,yc);
3610 pcasp3b->SetLineColor(1);
3611 colo = (int)(10. - cas3b * 8.);
3612 if ( colo != 10 ) pcasp3b->SetFillStyle(3001);
3613 pcasp3b->SetFillColor(colo);
3614 pcasp3b->SetLineWidth(1);
3615 pcasp3b->SetLineStyle(2);
3616 pcasp3b->Draw("f");
3617 pcasp3b->Draw();
3618 //
3619 for (Int_t i = 0; i<5 ; i++) {
3620 xc[i]= xcat + xc3[i]*var.sfx;
3621 yc[i] = ycat + yc3[i]*var.sfy;
3622 };
3623 TPolyLine *pcasp3 = new TPolyLine(5,xc,yc);
3624 pcasp3->SetLineColor(1);
3625 colo = (int)(10. - cas3 * 8.);
3626 pcasp3->SetFillColor(colo);
3627 if ( colo != 10 ) pcasp3->SetFillStyle(3001);
3628 pcasp3->SetLineWidth(1);
3629 pcasp3->SetLineStyle(2);
3630 pcasp3->Draw("f");
3631 pcasp3->Draw();
3632 //
3633 // CAS4
3634 //
3635 for (Int_t i = 0; i<5 ; i++) {
3636 xc[i]= xcat - xc1[i]*var.sfx;
3637 yc[i] = ycat - yc1[i]*var.sfy;
3638 };
3639 TPolyLine *pcass4 = new TPolyLine(5,xc,yc);
3640 pcass4->SetLineColor(1);
3641 colo = 10;
3642 if ( cas4 != 0. || cas4b != 0. ) {
3643 if ( cas4 > 0 || cas4b > 0 || cas4 ==-.25 || cas4b ==-.25 ){
3644 colo = cattime;
3645 } else {
3646 colo = catnoti;
3647 };
3648 };
3649 pcass4->SetFillColor(colo);
3650 if ( colo != 10 ) pcass4->SetFillStyle(3001);
3651 pcass4->SetLineWidth(1);
3652 pcass4->SetLineStyle(2);
3653 pcass4->Draw("f");
3654 pcass4->Draw();
3655 //
3656 for (Int_t i = 0; i<5 ; i++) {
3657 xc[i]= xcat - xc2[i]*var.sfx;
3658 yc[i] = ycat - yc2[i]*var.sfy;
3659 };
3660 TPolyLine *pcasp4 = new TPolyLine(5,xc,yc);
3661 pcasp4->SetLineColor(1);
3662 colo = (int)(10. - cas4 * 8.);
3663 pcasp4->SetFillColor(colo);
3664 if ( colo != 10 ) pcasp4->SetFillStyle(3001);
3665 pcasp4->SetLineWidth(1);
3666 pcasp4->SetLineStyle(2);
3667 pcasp4->Draw("f");
3668 pcasp4->Draw();
3669 //
3670 for (Int_t i = 0; i<5 ; i++) {
3671 xc[i]= xcat - xc3[i]*var.sfx;
3672 yc[i] = ycat - yc3[i]*var.sfy;
3673 };
3674 TPolyLine *pcasp4b = new TPolyLine(5,xc,yc);
3675 pcasp4b->SetLineColor(1);
3676 colo = (int)(10. - cas4b * 8.);
3677 pcasp4b->SetFillColor(colo);
3678 if ( colo != 10 ) pcasp4b->SetFillStyle(3001);
3679 pcasp4b->SetLineWidth(1);
3680 pcasp4b->SetLineStyle(2);
3681 pcasp4b->Draw("f");
3682 pcasp4b->Draw();
3683 };
3684 Float_t alfa = 1.2020334;
3685 Float_t lcrd = 0.1815/2.;
3686 Float_t wcrd = 0.008;
3687 if ( true ){
3688 //
3689 // CARD plane view:
3690 //
3691 Float_t xc1[5] = { -0.090165, -0.090165, -0.082165, -0.082165, -0.090165};
3692 Float_t yc1[5] = { -0.100, 0.092, 0.092, -0.100, -0.100};
3693 Float_t xc2[5] = { -0.094165, -0.094165, -0.086165, -0.086165, -0.094165};
3694 Float_t yc2[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
3695 Float_t xc3[5] = { -0.086165, -0.086165, -0.078165, -0.078165, -0.086165};
3696 Float_t yc3[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
3697 //
3698 // CARD1
3699 //
3700 Float_t xc[5];
3701 Float_t yc[5];
3702 for (Int_t i = 0; i<5 ; i++) {
3703 xc[i]= xcat + xc1[i]*var.sfx;
3704 yc[i] = ycat + yc1[i]*var.sfy;
3705 };
3706 TPolyLine *pcars1 = new TPolyLine(5,xc,yc);
3707 pcars1->SetLineColor(1);
3708 colo = 10;
3709 if ( card1 != 0. || card1b != 0. ) {
3710 if ( card1 > 0 || card1b > 0 || card1 ==-.25 || card1b ==-.25 ){
3711 colo = cattime;
3712 } else {
3713 colo = catnoti;
3714 };
3715 };
3716 pcars1->SetFillColor(colo);
3717 pcars1->SetLineWidth(1);
3718 pcars1->Draw("f");
3719 pcars1->Draw();
3720 //
3721 for (Int_t i = 0; i<5 ; i++) {
3722 xc[i]= xcat + xc2[i]*var.sfx;
3723 yc[i] = ycat + yc2[i]*var.sfy;
3724 };
3725 TPolyLine *pcarp1b = new TPolyLine(5,xc,yc);
3726 pcarp1b->SetLineColor(1);
3727 colo = (int)(10. - card1b * 8.);
3728 pcarp1b->SetFillColor(colo);
3729 pcarp1b->SetLineWidth(1);
3730 pcarp1b->Draw("f");
3731 pcarp1b->Draw();
3732 //
3733 for (Int_t i = 0; i<5 ; i++) {
3734 xc[i] = xcat + xc3[i]*var.sfx;
3735 yc[i] = ycat + yc3[i]*var.sfy;
3736 };
3737 TPolyLine *pcarp1 = new TPolyLine(5,xc,yc);
3738 pcarp1->SetLineColor(1);
3739 colo = (int)(10. - card1 * 8.);
3740 pcarp1->SetFillColor(colo);
3741 pcarp1->SetLineWidth(1);
3742 pcarp1->Draw("f");
3743 pcarp1->Draw();
3744 //
3745 // CARD4
3746 //
3747 for (Int_t i = 0; i<5 ; i++) {
3748 xc[i]= xcat - xc1[i]*var.sfx;
3749 yc[i] = ycat - yc1[i]*var.sfy;
3750 };
3751 TPolyLine *pcars4 = new TPolyLine(5,xc,yc);
3752 pcars4->SetLineColor(1);
3753 colo = 10;
3754 if ( card4 != 0. || card4b != 0. ) {
3755 if ( card4 > 0 || card4b > 0 || card4 ==-.25 || card4b ==-.25){
3756 colo = cattime;
3757 } else {
3758 colo = catnoti;
3759 };
3760 };
3761 pcars4->SetFillColor(colo);
3762 pcars4->SetLineWidth(1);
3763 pcars4->Draw("f");
3764 pcars4->Draw();
3765 //
3766 for (Int_t i = 0; i<5 ; i++) {
3767 xc[i]= xcat - xc2[i]*var.sfx;
3768 yc[i] = ycat - yc2[i]*var.sfy;
3769 };
3770 TPolyLine *pcarp4b = new TPolyLine(5,xc,yc);
3771 pcarp4b->SetLineColor(1);
3772 colo = (int)(10. - card4b * 8.);
3773 pcarp4b->SetFillColor(colo);
3774 pcarp4b->SetLineWidth(1);
3775 pcarp4b->Draw("f");
3776 pcarp4b->Draw();
3777 //
3778 for (Int_t i = 0; i<5 ; i++) {
3779 xc[i]= xcat - xc3[i]*var.sfx;
3780 yc[i] = ycat - yc3[i]*var.sfy;
3781 };
3782 TPolyLine *pcarp4 = new TPolyLine(5,xc,yc);
3783 pcarp4->SetLineColor(1);
3784 colo = (int)(10. - card4 * 8.);
3785 pcarp4->SetFillColor(colo);
3786 pcarp4->SetLineWidth(1);
3787 pcarp4->Draw("f");
3788 pcarp4->Draw();
3789 };
3790 if ( true ){
3791 Float_t xc1[5] = { -0.074, 0.074, 0.074, -0.074, -0.074};
3792 Float_t yc1[5] = { 0.108165, 0.108165, 0.100165, 0.100165, 0.108165};
3793 Float_t xc2[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
3794 Float_t yc2[5] = { 0.112165, 0.112165, 0.104165, 0.104165, 0.112165};
3795 Float_t xc3[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
3796 Float_t yc3[5] = { 0.104165, 0.104165, 0.096165, 0.096165, 0.104165};
3797 //
3798 // CARD2
3799 //
3800 Float_t xc[5];
3801 Float_t yc[5];
3802 for (Int_t i = 0; i<5 ; i++) {
3803 xc[i]= xcat - (xc1[i]-0.0025)*var.sfx;
3804 yc[i] = ycat - yc1[i]*var.sfy;
3805 };
3806 TPolyLine *pcars2 = new TPolyLine(5,xc,yc);
3807 pcars2->SetLineColor(1);
3808 colo = 10;
3809 if ( card2 != 0. || card2b != 0.) {
3810 if ( card2 > 0 || card2b > 0 || card2 ==-.25 || card2b ==-.25 ){
3811 colo = cattime;
3812 } else {
3813 colo = catnoti;
3814 };
3815 };
3816 pcars2->SetFillColor(colo);
3817 pcars2->SetLineWidth(1);
3818 pcars2->Draw("f");
3819 pcars2->Draw();
3820 //
3821 for (Int_t i = 0; i<5 ; i++) {
3822 xc[i]= xcat - (xc2[i]-0.0025)*var.sfx;
3823 yc[i] = ycat - yc2[i]*var.sfy;
3824 };
3825 TPolyLine *pcarp2 = new TPolyLine(5,xc,yc);
3826 pcarp2->SetLineColor(1);
3827 colo = (int)(10. - card2 * 8.);
3828 pcarp2->SetFillColor(colo);
3829 pcarp2->SetLineWidth(1);
3830 pcarp2->Draw("f");
3831 pcarp2->Draw();
3832 //
3833 for (Int_t i = 0; i<5 ; i++) {
3834 xc[i]= xcat - (xc3[i]-0.0025)*var.sfx;
3835 yc[i] = ycat - yc3[i]*var.sfy;
3836 };
3837 TPolyLine *pcarp2b = new TPolyLine(5,xc,yc);
3838 pcarp2b->SetLineColor(1);
3839 colo = (int)(10. - card2b * 8.);
3840 pcarp2b->SetFillColor(colo);
3841 pcarp2b->SetLineWidth(1);
3842 pcarp2b->Draw("f");
3843 pcarp2b->Draw();
3844 //
3845 // CARD3
3846 //
3847 for (Int_t i = 0; i<5 ; i++) {
3848 xc[i]= xcat + (xc1[i]-0.0025)*var.sfx;
3849 yc[i] = ycat + yc1[i]*var.sfy;
3850 };
3851 TPolyLine *pcars3 = new TPolyLine(5,xc,yc);
3852 pcars3->SetLineColor(1);
3853 colo = 10;
3854 if ( card3 != 0. || card3b != 0. ) {
3855 if ( card3 > 0 || card3b > 0 || card3==-.25 || card3b ==-.25){
3856 colo = cattime;
3857 } else {
3858 colo = catnoti;
3859 };
3860 };
3861 pcars3->SetFillColor(colo);
3862 pcars3->SetLineWidth(1);
3863 pcars3->Draw("f");
3864 pcars3->Draw();
3865 //
3866 for (Int_t i = 0; i<5 ; i++) {
3867 xc[i]= xcat + (xc2[i]-0.0025)*var.sfx;
3868 yc[i] = ycat + yc2[i]*var.sfy;
3869 };
3870 TPolyLine *pcarp3 = new TPolyLine(5,xc,yc);
3871 pcarp3->SetLineColor(1);
3872 colo = (int)(10. - card3 * 8.);
3873 pcarp3->SetFillColor(colo);
3874 pcarp3->SetLineWidth(1);
3875 pcarp3->Draw("f");
3876 pcarp3->Draw();
3877 //
3878 for (Int_t i = 0; i<5 ; i++) {
3879 xc[i]= xcat + (xc3[i]-0.0025)*var.sfx;
3880 yc[i] = ycat + yc3[i]*var.sfy;
3881 };
3882 TPolyLine *pcarp3b = new TPolyLine(5,xc,yc);
3883 pcarp3b->SetLineColor(1);
3884 colo = (int)(10. - card3b * 8.);
3885 pcarp3b->SetFillColor(colo);
3886 pcarp3b->SetLineWidth(1);
3887 pcarp3b->Draw("f");
3888 pcarp3b->Draw();
3889
3890 //
3891 // CARD - X-view
3892 //
3893 // Float_t cardcx = 0.143168*var.sfx;
3894 //Float_t cardcy = 0.1475*var.sfy;
3895 Float_t cardcx = 0.153168*var.sfx;
3896 Float_t cardcy = 0.1575*var.sfy;
3897 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
3898 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
3899 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
3900 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
3901
3902 //
3903 // CARD3 X/ Y
3904 //
3905 Float_t xcc[4];
3906 Float_t ycc[4];
3907 for (Int_t i = 0; i<4 ; i++) {
3908 xcc[i] = cardcx + var.xxvc + acrdx[i]*var.sfx;
3909 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
3910 };
3911 TPolyLine *fcard3 = new TPolyLine(4,xcc,ycc);
3912 fcard3->SetLineColor(1);
3913 colo = (int)(10. - card3 * 8.);
3914 fcard3->SetFillColor(colo);
3915 fcard3->SetLineWidth(1);
3916 fcard3->Draw("f");
3917 fcard3->Draw();
3918 //
3919 for (Int_t i = 0; i<4 ; i++) {
3920 xcc[i] = cardcx + var.xxvc + bcrdx[i]*var.sfx;
3921 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
3922 };
3923 TPolyLine *fcard3b = new TPolyLine(4,xcc,ycc);
3924 fcard3b->SetLineColor(1);
3925 colo = (int)(10. - card3b * 8.);
3926 fcard3b->SetFillColor(colo);
3927 fcard3b->SetLineWidth(1);
3928 fcard3b->Draw("f");
3929 fcard3b->Draw();
3930
3931 //
3932 // CARD2 \X Y
3933 //
3934 for (Int_t i = 0; i<4 ; i++) {
3935 xcc[i] = -cardcx + var.xxvc - acrdx[i]*var.sfx;
3936 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
3937 };
3938 TPolyLine *fcard2 = new TPolyLine(4,xcc,ycc);
3939 fcard2->SetLineColor(1);
3940 colo = (int)(10. - card2 * 8.);
3941 fcard2->SetFillColor(colo);
3942 fcard2->SetLineWidth(1);
3943 fcard2->Draw("f");
3944 fcard2->Draw();
3945 //
3946 for (Int_t i = 0; i<4 ; i++) {
3947 xcc[i] = -cardcx + var.xxvc - bcrdx[i]*var.sfx;
3948 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
3949 };
3950 TPolyLine *fcard2b = new TPolyLine(4,xcc,ycc);
3951 fcard2b->SetLineColor(1);
3952 colo = (int)(10. - card2b * 8.);
3953 fcard2b->SetFillColor(colo);
3954 fcard2b->SetLineWidth(1);
3955 fcard2b->Draw("f");
3956 fcard2b->Draw();
3957 };
3958
3959 if ( true ){
3960 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
3961 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
3962 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
3963 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
3964 //
3965 // CARD - Y-view
3966 //
3967 Float_t cardcx = 0.12*var.sfx;
3968 Float_t cardcy = 0.1475*var.sfy;
3969 //
3970 // CARD4 X Y/
3971 //
3972 Float_t xcc[4];
3973 Float_t ycc[4];
3974 for (Int_t i = 0; i<4 ; i++) {
3975 xcc[i] = cardcx + var.xyvc + acrdx[i]*var.sfx;
3976 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
3977 };
3978 TPolyLine *fcard4 = new TPolyLine(4,xcc,ycc);
3979 fcard4->SetLineColor(1);
3980 colo = (int)(10. - card4 * 8.);
3981 fcard4->SetFillColor(colo);
3982 fcard4->SetLineWidth(1);
3983 fcard4->Draw("f");
3984 fcard4->Draw();
3985 //
3986 for (Int_t i = 0; i<4 ; i++) {
3987 xcc[i] = cardcx + var.xyvc + bcrdx[i]*var.sfx;
3988 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
3989 };
3990 TPolyLine *fcard4b = new TPolyLine(4,xcc,ycc);
3991 fcard4b->SetLineColor(1);
3992 colo = (int)(10. - card4b * 8.);
3993 fcard4b->SetFillColor(colo);
3994 fcard4b->SetLineWidth(1);
3995 fcard4b->Draw("f");
3996 fcard4b->Draw();
3997
3998 //
3999 // CARD1 X \Y
4000 //
4001 for (Int_t i = 0; i<4 ; i++) {
4002 xcc[i] = -cardcx + var.xyvc - acrdx[i]*var.sfx;
4003 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
4004 };
4005 TPolyLine *fcard1 = new TPolyLine(4,xcc,ycc);
4006 fcard1->SetLineColor(1);
4007 colo = (int)(10. - card1 * 8.);
4008 fcard1->SetFillColor(colo);
4009 fcard1->SetLineWidth(1);
4010 fcard1->Draw("f");
4011 fcard1->Draw();
4012 //
4013 for (Int_t i = 0; i<4 ; i++) {
4014 xcc[i] = -cardcx + var.xyvc - bcrdx[i]*var.sfx;
4015 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
4016 };
4017 TPolyLine *fcard1b = new TPolyLine(4,xcc,ycc);
4018 fcard1b->SetLineColor(1);
4019 colo = (int)(10. - card1b * 8.);
4020 fcard1b->SetFillColor(colo);
4021 fcard1b->SetLineWidth(1);
4022 fcard1b->Draw("f");
4023 fcard1b->Draw();
4024 };
4025 }
4026
4027 void FEVdetector::ShowS4(Bool_t upd){
4028 //
4029 //
4030 //
4031 if ( !var.S4 ) return;
4032 //
4033 Float_t calibdata;
4034 Int_t data = 0;
4035 Float_t ms4[3] = {0.,0.,0.};
4036 Int_t S4 = 0;
4037 //
4038 // Level0 data
4039 //
4040 if ( level.file == 0 ){
4041 S4 = trigger->patterntrig[1];
4042 //
4043 for ( Int_t i = 0; i<3; i++ ) {
4044 if ( S4 & (1<<0) ) ms4[i] = 1.;
4045 };
4046 };
4047 //
4048 // Rough calibration of data
4049 //
4050 if ( level.file == -1 ){
4051 if ( !s4->unpackError && data > 31 ){
4052 data = s4->S4_DATA;
4053 calibdata = ((Float_t)data - 32.) * 0.5;
4054 } else {
4055 calibdata = 0.;
4056 };
4057 //
4058 for ( Int_t j = 0; j<3; j++ ) {
4059 ms4[j] = calibdata;
4060 };
4061 };
4062 //
4063 // Level2 data
4064 //
4065 if ( level.file == 2 ){
4066 for ( Int_t j = 0; j<3; j++ ) {
4067 if ( L2->S4adc != 32. ) ms4[j] = L2->S4calibrated;
4068 };
4069 };
4070 //
4071 var.s4sig = ms4[0];
4072 //
4073 if ( !upd ) return;
4074 //
4075 Int_t colo;
4076 Float_t xs4x = var.xxvc;
4077 Float_t ys4x = var.yxvc - 0.3250*var.sfy;
4078 Float_t xs4y = var.xyvc;
4079 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
4080 Float_t ws4 = 0.010;
4081 //
4082 // Y-view
4083 //
4084 Float_t s4p = 0.1606667;
4085 Int_t ocolo = 0;
4086 TPolyLine *fs4y[3];
4087 for ( Int_t j=0; j<3; j++){
4088 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
4089 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
4090 Float_t xc[5];
4091 Float_t yc[5];
4092 for (Int_t i = 0; i<5 ; i++) {
4093 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
4094 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
4095 };
4096 fs4y[j] = new TPolyLine(5,xc,yc);
4097 fs4y[j]->SetLineColor(1);
4098 if ( var.bw ){
4099 colo = -1;
4100 } else {
4101 colo = 1;
4102 };
4103 ColorMIP(ms4[j],colo);
4104 //
4105 if ( colo != 10 ) ocolo = colo;
4106 //
4107 fs4y[j]->SetFillColor(colo);
4108 fs4y[j]->SetLineWidth(1);
4109 fs4y[j]->Draw("f");
4110 fs4y[j]->Draw();
4111 };
4112 //
4113 // X-view
4114 //
4115 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
4116 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
4117 Float_t xc[5];
4118 Float_t yc[5];
4119 for (Int_t i = 0; i<5 ; i++) {
4120 xc[i]= xs4x + xc1[i]*var.nds4;
4121 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
4122 };
4123 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
4124 fs4x->SetLineColor(1);
4125 fs4x->SetFillColor(ocolo);
4126 fs4x->SetLineWidth(1);
4127 fs4x->Draw("f");
4128 fs4x->Draw();
4129 }
4130
4131 void FEVdetector::ShowND(){
4132 //
4133 //
4134 //
4135 if ( !var.ND ) return;
4136 //
4137 Int_t tmpSize;
4138 Int_t yUpperTrig = 0;
4139 Int_t yUpperBk = 0;
4140 Int_t yBottomBk = 0;
4141 if ( level.file == 0 || level.file == -1 ){
4142 //
4143 tmpSize = ne->Records->GetEntries();
4144 for (Int_t j = 0; j < tmpSize; j++){
4145 nr = (pamela::neutron::NeutronRecord*)ne->Records->At(j);
4146 yUpperTrig += (int)nr->trigPhysics;
4147 yUpperBk += (int)nr->upperBack;
4148 yBottomBk += (int)nr->bottomBack;
4149 };
4150 };
4151 if ( level.file == 2 ){
4152 yUpperTrig = (Int_t)L2->trigPhysics;
4153 yUpperBk = (Int_t)L2->upperBack;
4154 yBottomBk = (Int_t)L2->bottomBack;
4155 };
4156 //
4157 var.trup = yUpperTrig;
4158 var.bkup = yUpperBk;
4159 var.bkbo = yBottomBk;
4160 //
4161 Int_t ucolo = 10;
4162 if ( var.bw ){
4163 if ( yUpperTrig == 1 ){
4164 ucolo = 17;
4165 }
4166 if ( yUpperTrig == 2 ){
4167 ucolo = 15;
4168 }
4169 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
4170 ucolo = 14;
4171 }
4172 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
4173 ucolo = 13;
4174 }
4175 if ( yUpperTrig >= 14 ){
4176 ucolo = 12;
4177 };
4178 } else {
4179 if ( yUpperTrig == 1 ){
4180 ucolo = 38;
4181 }
4182 if ( yUpperTrig == 2 ){
4183 ucolo = 4;
4184 }
4185 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
4186 ucolo = 3;
4187 }
4188 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
4189 ucolo = 2;
4190 }
4191 if ( yUpperTrig >= 14 ){
4192 ucolo = 6;
4193 };
4194 };
4195 //
4196 // figures:
4197 //
4198 if ( true ){
4199 Float_t xc1[5]={ -0.300, 0.300, 0.300, -0.300, -0.300 };
4200 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};
4201 //
4202 // Upper X-view
4203 //
4204 Float_t xc[5];
4205 Float_t yc[5];
4206 for (Int_t i = 0; i<5 ; i++) {
4207 xc[i]= var.xxvc + xc1[i]*var.nds4;
4208 yc[i] = var.yxvc + yc1[i]*var.sfy;
4209 };
4210 TPolyLine *fnd2x = new TPolyLine(5,xc,yc);
4211 fnd2x->SetLineColor(1);
4212 fnd2x->SetFillColor(ucolo);
4213 fnd2x->SetLineWidth(1);
4214 fnd2x->Draw("f");
4215 fnd2x->Draw();
4216 };
4217 if ( true ){
4218 Float_t xc1[5]={ -0.275, 0.275, 0.275, -0.275, -0.275 };
4219 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};
4220 //
4221 // Upper Y-view
4222 //
4223 Float_t xc[5];
4224 Float_t yc[5];
4225 for (Int_t i = 0; i<5 ; i++) {
4226 xc[i]= var.xyvc + xc1[i]*var.nds4;
4227 yc[i] = var.yyvc + (yc1[i]+0.075)*var.sfy;
4228 };
4229 TPolyLine *fnd2y = new TPolyLine(5,xc,yc);
4230 fnd2y->SetLineColor(1);
4231 fnd2y->SetFillColor(ucolo);
4232 fnd2y->SetLineWidth(1);
4233 fnd2y->Draw("f");
4234 fnd2y->Draw();
4235 };
4236 }
4237
4238
4239 void FEVdetector::ShowTRK(Bool_t upd){
4240 //
4241 //
4242 //
4243 if ( !var.TRK ) return;
4244 //
4245 // a matrix of pads for each view x and y
4246 //
4247 var.rig = 0.;
4248 var.chi2 = 0.;
4249 TPad *trkpad[12];
4250 for (Int_t n = 0; n<12; n++){
4251 stringstream spd;
4252 spd.str("");
4253 spd << "pd1" << n;
4254 gDirectory->Delete(spd.str().c_str());
4255 spd.str("");
4256 spd << "pd2" << n;
4257 gDirectory->Delete(spd.str().c_str());
4258 spd.str("");
4259 spd << "pd3" << n;
4260 gDirectory->Delete(spd.str().c_str());
4261 spd.str("");
4262 spd << "pd4" << n;
4263 gDirectory->Delete(spd.str().c_str());
4264 spd.str("");
4265 spd << "pd5" << n;
4266 gDirectory->Delete(spd.str().c_str());
4267 spd.str("");
4268 spd << "pd6" << n;
4269 gDirectory->Delete(spd.str().c_str());
4270 spd.str("");
4271 stringstream sbd;
4272 sbd.str("");
4273 Int_t magcol = 0;
4274 TPad *mag1 = 0;
4275 TPad *mag2 = 0;
4276 if ( n%2 ) {
4277 Float_t posx = var.xxvc;
4278 Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
4279 spd.str("");
4280 sbd.str("");
4281 spd << "pd1" << n;
4282 sbd << "bd1" << n;
4283 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);
4284 trkpad[n]->SetFillStyle(4000);
4285 trkpad[n]->SetFillColor(0);
4286 trkpad[n]->SetFrameFillStyle(4000);
4287 if ( upd ) trkpad[n]->Draw();
4288 if ( n != 1 ) {
4289 if ( var.bw ) {
4290 magcol = 1;
4291 } else {
4292 magcol = 45;
4293 };
4294 spd.str("");
4295 sbd.str("");
4296 spd << "pd2" << n;
4297 sbd << "bd2" << n;
4298 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);
4299 if ( var.bw ) mag1->SetFillStyle(3001);
4300 if ( upd ) mag1->Draw();
4301 spd.str("");
4302 sbd.str("");
4303 spd << "pd3" << n;
4304 sbd << "bd3" << n;
4305 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);
4306 if ( var.bw ) mag2->SetFillStyle(3001);
4307 if ( upd ) mag2->Draw();
4308 };
4309 } else {
4310 Float_t posx = var.xyvc;
4311 Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
4312 spd.str("");
4313 sbd.str("");
4314 spd << "pd4" << n;
4315 sbd << "bd4" << n;
4316 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);
4317 trkpad[n]->SetFillStyle(4000);
4318 trkpad[n]->SetFillColor(0);
4319 trkpad[n]->SetFrameFillStyle(4000);
4320 if ( upd ) trkpad[n]->Draw();
4321 if ( n != 0 ) {
4322 if ( var.bw ) {
4323 magcol = 1;
4324 } else {
4325 magcol = 45;
4326 };
4327 spd.str("");
4328 sbd.str("");
4329 spd << "pd5" << n;
4330 sbd << "bd5" << n;
4331 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);
4332 if ( var.bw ) mag1->SetFillStyle(3001);
4333 if ( upd ) mag1->Draw();
4334 spd.str("");
4335 sbd.str("");
4336 spd << "pd6" << n;
4337 sbd << "bd6" << n;
4338 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);
4339 if ( var.bw ) mag2->SetFillStyle(3001);
4340 if ( upd ) mag2->Draw();
4341 };
4342 };
4343 };
4344 TPad *trplv;
4345 gDirectory->Delete("trkplv");
4346 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);
4347 trplv->SetFillStyle(4000);
4348 trplv->SetFillColor(0);
4349 trplv->SetFrameFillStyle(4000);
4350 if ( upd ) trplv->Draw();
4351 //
4352 Int_t sigcol1 = 17;
4353 Int_t sigcol2 = 15;
4354 Int_t linecol = 13;
4355 if ( var.bw ) {
4356 sigcol1 = 17;
4357 sigcol2 = 15;
4358 linecol = 13;
4359 } else {
4360 sigcol1 = 32;
4361 sigcol2 = 38;
4362 linecol = 42;
4363 };
4364 TLine *linea = 0;
4365 TLine *linea1x = 0;
4366 TLine *linea2x = 0;
4367 TLine *linea1y = 0;
4368 Float_t x = 0.;
4369 for (Int_t l = 0; l<12; l++){
4370 trkpad[l]->cd();
4371 if ( l%2 ) {
4372 if ( level.file == 2 ){
4373 trkpad[l]->Range(-8.1,0.,8.1,8.);
4374 linea = new TLine(-8.1,0.01,8.1,0.01);
4375 linea1x = new TLine(-2.7,0.01,-2.7,0.030);
4376 linea2x = new TLine(2.7,0.01,2.7,0.030);
4377 } else {
4378 trkpad[l]->Range(0.,0.,3100.,1.);
4379 linea = new TLine(0.,0.01,3100.,0.01);
4380 linea1x = new TLine(1033.,0.01,1033,0.030);
4381 linea2x = new TLine(2066.,0.01,2066,0.030);
4382 };
4383 } else {
4384 if ( level.file == 2 ){
4385 trkpad[l]->Range(-7.05,0.,7.05,8.);
4386 linea = new TLine(-7.05,0.01,7.05,0.01);
4387 linea1y = new TLine(0.,0.01,0.,0.030);
4388 } else {
4389 trkpad[l]->Range(0.,0.,2076.,1.);
4390 linea = new TLine(0.,0.01,2076.,0.01);
4391 linea1y = new TLine(1038.,0.01,1038,0.030);
4392 };
4393 };
4394 linea->SetLineWidth(2);
4395 linea->SetLineColor(linecol);
4396 if ( upd ) linea->Draw();
4397 if ( l%2 ) {
4398 linea1x->SetLineWidth(1);
4399 linea1x->SetLineColor(1);
4400 if ( upd ) linea1x->Draw();
4401 linea2x->SetLineWidth(1);
4402 linea2x->SetLineColor(1);
4403 if ( upd ) linea2x->Draw();
4404 } else {
4405 linea1y->SetLineWidth(1);
4406 linea1y->SetLineColor(1);
4407 if ( upd ) linea1y->Draw();
4408 };
4409 //
4410 // LEVEL0 or LEVEL-1
4411 //
4412 if ( level.file == 0 || level.file == -1 ){
4413 Int_t planeno = trk->DSPnumber[l]-1;
4414 if ( planeno < 0 || planeno > 11 ) planeno = 0;
4415 if ( planeno >= 0 && !var.nosig ) {
4416 if ( (planeno+1)%2 ){
4417 trkpad[planeno]->cd();
4418 trkpad[planeno]->Range(0.,0.,2076.,1.);
4419 for (Int_t m = 0; m<3; m++){
4420 if ( trk->signcluster[l][m] != 0. ){
4421 if ( planeno == 10 ) {
4422 x = 1024 - trk->addrcluster[l][m];
4423 } else {
4424 x = trk->addrcluster[l][m];
4425 };
4426 linea = new TLine(14.+x,0.01,14.+x,0.3);
4427 linea->SetLineWidth(2);
4428 linea->SetLineColor(sigcol1);
4429 if ( upd ) linea->Draw();
4430 x += 1024.;
4431 linea = new TLine(14.+x,0.01,14.+x,0.3);
4432 linea->SetLineWidth(2);
4433 linea->SetLineColor(sigcol2);
4434 if ( upd ) linea->Draw();
4435 var.ncly++;
4436 };
4437 };
4438 } else {
4439 trkpad[planeno]->cd();
4440 trkpad[planeno]->Range(0.,0.,3100.,1.);
4441 for (Int_t m = 0; m<3; m++){
4442 if ( trk->signcluster[l][m] != 0. ){
4443 x = trk->addrcluster[l][m] + 1024. * m;
4444 linea = new TLine(14.+x,0.01,14.+x,0.3);
4445 linea->SetLineWidth(2);
4446 linea->SetLineColor(sigcol2);
4447 if ( upd ) linea->Draw();
4448 var.nclx++;
4449 };
4450 };
4451 };
4452 };
4453 };
4454 //
4455 if ( !upd ) return;
4456 //
4457 if ( level.file == 2 ){
4458 //
4459 // singlets X
4460 //
4461 for (Int_t sing = 0; sing < L2->nclsx(); sing++){
4462 TClonesArray &t = *(L2->SingletX);
4463 TrkSinglet *singlet = (TrkSinglet*)t[sing];
4464 x = (singlet->coord[0]+singlet->coord[1])/2.;
4465 //
4466 Float_t xsig = singlet->sgnl;
4467 if ( xsig > 8. ) xsig = 8.;
4468 //
4469 Int_t planepad = (singlet->plane * 2) - 1;
4470 trkpad[planepad]->cd();
4471 trkpad[planepad]->Range(-8.1,0.,8.1,8.);
4472 if ( var.bw ){
4473 sigcol2 = -1;
4474 } else {
4475 sigcol2 = 1;
4476 };
4477 ColorTRKMIP(singlet->sgnl,sigcol2,0);
4478 linea = new TLine(x,0.01,x,xsig);
4479 linea->SetLineWidth(2);
4480 linea->SetLineColor(sigcol2);
4481 linea->Draw();
4482 };
4483 //
4484 // singlets Y
4485 //
4486 for (Int_t sing = 0; sing < L2->nclsy(); sing++){
4487 TClonesArray &t = *(L2->SingletY);
4488 TrkSinglet *singlet = (TrkSinglet*)t[sing];
4489 //
4490 Int_t planepad = (singlet->plane - 1)* 2;
4491 trkpad[planepad]->cd();
4492 trkpad[planepad]->Range(-7.05,0.,7.05,8.);
4493 for (Int_t img=0; img<2; img++){
4494 x = singlet->coord[img];
4495 Float_t xsig = singlet->sgnl;
4496 if ( xsig > 8. ) xsig = 8.;
4497 //
4498 if ( var.bw ){
4499 sigcol2 = -1;
4500 } else {
4501 sigcol2 = 1;
4502 };
4503 Int_t coloimg = img;
4504 //
4505 // last Y plane is reversed!
4506 //
4507 if ( planepad == 10 ){
4508 if ( img ){
4509 coloimg = 0;
4510 } else {
4511 coloimg = 1;
4512 };
4513 };
4514 ColorTRKMIP(singlet->sgnl,sigcol2,coloimg);
4515 linea = new TLine(x,0.01,x,xsig);
4516 linea->SetLineWidth(2);
4517 linea->SetLineColor(sigcol2);
4518 linea->Draw();
4519 };
4520 };
4521 //
4522 // Measured point relative to tracks and tracks
4523 // + dots on measured points
4524 //
4525 Int_t dcol;
4526 if ( var.bw ){
4527 dcol = 12;
4528 } else {
4529 dcol = 2;
4530 };
4531 //
4532 if ( L2->GetNTracks() > 0 ){
4533 for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){
4534 TrkTrack *track = L2->GetTrack(nt);
4535 if ( nt == 0 ){
4536 var.rig = 0.;
4537 if ( track->al[4] != 0. ) var.rig = 1./track->al[4];
4538 var.chi2 = track->chi2;
4539 };
4540 for (Int_t plane = 0; plane<6; plane++){
4541 //
4542 // X view
4543 //
4544 Int_t planepad = (plane * 2) + 1;
4545 trkpad[planepad]->cd();
4546 trkpad[planepad]->Range(-8.1,0.,8.1,8.);
4547 //
4548 x = track->xm[plane];
4549 Float_t xsig = track->dedx_x[plane];
4550 if ( track->xgood[plane] ){
4551 //if ( x > -100 ){
4552 if ( xsig > 8. ) xsig = 8.;
4553 if ( var.bw ){
4554 sigcol2 = -1;
4555 } else {
4556 sigcol2 = 1;
4557 };
4558 ColorTRKMIP(track->dedx_x[plane],sigcol2,0);
4559 linea = new TLine(x,0.01,x,xsig);
4560 linea->SetLineWidth(2);
4561 linea->SetLineColor(sigcol2);
4562 linea->Draw();
4563 Float_t tx[5] = {x-0.3, x+0.3, x+0.3, x-0.3, x-0.3};
4564 Float_t tz[5] = {0., 0., 0.5, 0.5, 0.};
4565 TPolyLine *tlinea = new TPolyLine(5,tx,tz);
4566 tlinea->SetLineWidth(1);
4567 tlinea->SetLineColor(dcol);
4568 tlinea->SetFillColor(dcol);
4569 tlinea->Draw("f");
4570 tlinea->Draw();
4571 };
4572 //
4573 // Y view
4574 //
4575 planepad = plane * 2;
4576 trkpad[planepad]->cd();
4577 trkpad[planepad]->Range(-7.05,0.,7.05,8.);
4578 x = track->ym[plane];
4579 xsig = track->dedx_y[plane];
4580 if ( track->ygood[plane] ){
4581 // if ( x > -100 ){
4582 if ( xsig > 8. ) xsig = 8.;
4583 if ( var.bw ){
4584 sigcol2 = -1;
4585 } else {
4586 sigcol2 = 1;
4587 };
4588 ColorTRKMIP(track->dedx_y[plane],sigcol2,0);
4589 linea = new TLine(x,0.01,x,xsig);
4590 linea->SetLineWidth(2);
4591 linea->SetLineColor(sigcol2);
4592 linea->Draw();
4593 Float_t tx[5] = {x-0.3, x+0.3, x+0.3, x-0.3, x-0.3};
4594 Float_t tz[5] = {0., 0., 0.5, 0.5, 0.};
4595 TPolyLine *tlinea = new TPolyLine(5,tx,tz);
4596 tlinea->SetLineColor(dcol);
4597 tlinea->SetFillColor(dcol);
4598 tlinea->SetLineWidth(1);
4599 tlinea->Draw("f");
4600 tlinea->Draw();
4601 };
4602 };
4603 };// loop on tracks
4604 };
4605 };
4606 //
4607 };
4608 //
4609 // Show track in the plane view!
4610 //
4611 if ( var.AC ){
4612 Float_t xh[6];
4613 Float_t yh1[6];
4614 Float_t yh2[6];
4615 Float_t mag[6];
4616 for (Int_t l = 0; l<6; l++ ){
4617 xh[l] = 0.;
4618 yh1[l] = 0.;
4619 yh2[l] = 0.;
4620 mag[l] = 0.;
4621 };
4622 Int_t ncro = 0;
4623 //
4624 // LEVEL2
4625 //
4626 if ( level.file == 2 ){
4627 //
4628 // first of all plot crosses relatives to tracks
4629 //
4630 if ( L2->GetNTracks() > 0 ){
4631 for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){
4632 TrkTrack *track = L2->GetTrack(nt);
4633 for (Int_t plane = 0; plane<6; plane++){
4634 //
4635 x = track->xm[plane];
4636 Float_t y = track->ym[plane];
4637 Float_t xsig = track->dedx_x[plane];
4638 Float_t ysig = track->dedx_y[plane];
4639 // if ( x > -100 && y > -100. ){
4640 if ( track->xgood[plane] && track->ygood[plane] ){
4641 if ( var.bw ){
4642 sigcol1 = -1;
4643 sigcol2 = -1;
4644 } else {
4645 sigcol1 = 1;
4646 sigcol2 = 1;
4647 };
4648 ColorTRKMIP(xsig,sigcol1,0);
4649 ColorTRKMIP(ysig,sigcol2,0);
4650 //
4651 // Draw crosses
4652 //
4653 trplv->cd();
4654 trplv->Range(-7.05,-8.1,7.05,8.1);
4655 //
4656 Float_t mg = ((float)plane+1.)/5.;
4657 Float_t cdx = (0.55/mg)*var.sfx;
4658 Float_t cdy = (0.55/mg)*var.sfy;
4659 Float_t lwx = (0.019)*var.sfy;
4660 Float_t lwy = (0.019)*var.sfx;
4661 //
4662 linea = new TLine(y-lwx/2.,x-cdy,y-lwx/2.,x+cdy);
4663 linea->SetLineWidth(1);
4664 linea->SetLineColor(sigcol1);
4665 linea->Draw();
4666 linea = new TLine(y-cdx,x-lwy/2.,y+cdx,x-lwy/2.);
4667 linea->SetLineWidth(1);
4668 linea->SetLineColor(sigcol2);
4669 linea->Draw();
4670 //
4671 };
4672 };
4673 };
4674 };
4675 //
4676 // try to plot crosses relative to singlets
4677 //
4678 if ( L2->nclsx() > 0 && L2->nclsy() > 0 ){
4679 for (Int_t plane = 1; plane<7; plane++){
4680 //
4681 // count how many singlet in the x and y view for this plane:
4682 //
4683 Int_t totsx = 0;
4684 Int_t totsy = 0;
4685 TArrayI *orderx = new TArrayI(5000);
4686 TArrayI *ordery = new TArrayI(5000);
4687 TArrayF *arrax = new TArrayF(5000);
4688 TArrayF *array1 = new TArrayF(5000);
4689 TArrayF *array2 = new TArrayF(5000);
4690 TArrayF *sigarrax = new TArrayF(5000);
4691 TArrayF *sigarray = new TArrayF(5000);
4692 for (Int_t sing = 0; sing < L2->nclsx(); sing++){
4693 TClonesArray &t = *(L2->SingletX);
4694 TrkSinglet *singlet = (TrkSinglet*)t[sing];
4695 if ( singlet->plane == plane ){
4696 arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx);
4697 sigarrax->AddAt(singlet->sgnl,totsx);
4698 if ( totsx == 0 || ( totsx > 0 && singlet->sgnl < sigarrax->At(orderx->At(totsx-1))) ){
4699 orderx->AddAt(totsx,totsx);
4700 } else {
4701 for (Int_t ord = totsx-1; ord >= 0; ord--){
4702 if ( singlet->sgnl < sigarrax->At(orderx->At(ord)) || ord == 0){
4703 if ( singlet->sgnl < sigarrax->At(orderx->At(ord)) ){
4704 for (Int_t reord = totsx; reord>(ord+1); reord--){
4705 orderx->AddAt(orderx->At(reord-1),reord);
4706 };
4707 orderx->AddAt(totsx,ord+1);
4708 break;
4709 } else {
4710 for (Int_t reord = totsx; reord>0; reord--){
4711 orderx->AddAt(orderx->At(reord-1),reord);
4712 };
4713 orderx->AddAt(totsx,0);
4714 break;
4715 };
4716 };
4717 };
4718 };
4719 totsx++;
4720 };
4721 };
4722 for (Int_t sing = 0; sing < L2->nclsy(); sing++){
4723 TClonesArray &t = *(L2->SingletY);
4724 TrkSinglet *singlet = (TrkSinglet*)t[sing];
4725 if ( singlet->plane == plane ){
4726 array1->AddAt(singlet->coord[0],totsy);
4727 array2->AddAt(singlet->coord[1],totsy);
4728 sigarray->AddAt(singlet->sgnl,totsy);
4729 if ( totsy == 0 || ( totsy > 0 && singlet->sgnl < sigarray->At(ordery->At(totsy-1))) ){
4730 ordery->AddAt(totsy,totsy);
4731 } else {
4732 for (Int_t ord = totsy-1; ord >= 0; ord--){
4733 if ( singlet->sgnl < sigarray->At(ordery->At(ord)) || ord == 0){
4734 if ( singlet->sgnl < sigarray->At(ordery->At(ord)) ){
4735 for (Int_t reord = totsy; reord>(ord+1); reord--){
4736 ordery->AddAt(ordery->At(reord-1),reord);
4737 };
4738 ordery->AddAt(totsy,ord+1);
4739 break;
4740 } else {
4741 for (Int_t reord = totsy; reord>0; reord--){
4742 ordery->AddAt(ordery->At(reord-1),reord);
4743 };
4744 ordery->AddAt(totsy,0);
4745 break;
4746 };
4747 };
4748 };
4749 };
4750 totsy++;
4751 };
4752 };
4753 //
4754 if ( totsx && totsy ){
4755 for (Int_t sing = 0; sing < min(totsx,totsy); sing++){
4756 //
4757 x = arrax->At(orderx->At(sing));
4758 Float_t y1 = array1->At(ordery->At(sing));
4759 Float_t y2 = array2->At(ordery->At(sing));
4760 Float_t xsig = sigarrax->At(orderx->At(sing));
4761 Float_t ysig = sigarray->At(ordery->At(sing));
4762 if ( x > -100 && y1 > -100. ){
4763 if ( var.bw ){
4764 sigcol1 = -1;
4765 sigcol2 = -1;
4766 } else {
4767 sigcol1 = 1;
4768 sigcol2 = 1;
4769 };
4770 Int_t img = 0;
4771 if ( plane == 6 ) img = 1;
4772 ColorTRKMIP(xsig,sigcol1,img);
4773 ColorTRKMIP(ysig,sigcol2,img);
4774 //
4775 // Draw crosses
4776 //
4777 trplv->cd();
4778 trplv->Range(-7.05,-8.1,7.05,8.1);
4779 //
4780 Float_t mg = ((float)plane)/5.;
4781 Float_t cdx = (0.55/mg)*var.sfx;
4782 Float_t cdy = (0.55/mg)*var.sfy;
4783 Float_t lwx = (0.019)*var.sfy;
4784 Float_t lwy = (0.019)*var.sfx;
4785 //
4786 linea = new TLine(y1-lwx/2.,x-cdy,y1-lwx/2.,x+cdy);
4787 linea->SetLineWidth(1);
4788 linea->SetLineColor(sigcol1);
4789 linea->Draw();
4790 linea = new TLine(y1-cdx,x-lwy/2.,y1+cdx,x-lwy/2.);
4791 linea->SetLineWidth(1);
4792 linea->SetLineColor(sigcol2);
4793 linea->Draw();
4794 //
4795 };
4796 if ( x > -100 && y2 > -100. ){
4797 if ( var.bw ){
4798 sigcol1 = -1;
4799 sigcol2 = -1;
4800 } else {
4801 sigcol1 = 1;
4802 sigcol2 = 1;
4803 };
4804 Int_t img = 1;
4805 if ( plane == 6 ) img = 0;
4806 ColorTRKMIP(xsig,sigcol1,img);
4807 ColorTRKMIP(ysig,sigcol2,img);
4808 //
4809 // Draw crosses
4810 //
4811 trplv->cd();
4812 trplv->Range(-7.05,-8.1,7.05,8.1);
4813 //
4814 Float_t mg = ((float)plane)/5.;
4815 Float_t cdx = (0.55/mg)*var.sfx;
4816 Float_t cdy = (0.55/mg)*var.sfy;
4817 Float_t lwx = (0.019)*var.sfy;
4818 Float_t lwy = (0.019)*var.sfx;
4819 //
4820 linea = new TLine(y2-lwx/2.,x-cdy,y2-lwx/2.,x+cdy);
4821 linea->SetLineWidth(1);
4822 linea->SetLineColor(sigcol1);
4823 linea->Draw();
4824 linea = new TLine(y2-cdx,x-lwy/2.,y2+cdx,x-lwy/2.);
4825 linea->SetLineWidth(1);
4826 linea->SetLineColor(sigcol2);
4827 linea->Draw();
4828 };
4829 };
4830 };
4831 };
4832 };
4833 };
4834 //
4835 // LEVEL0 or LEVEL-1
4836 //
4837 if ( level.file == 0 || level.file == -1 ){
4838 for (Int_t l = 0; l<12; l++ ){
4839 Float_t xsig = 0.;
4840 Float_t ysig = 0.;
4841 Int_t planeno = trk->DSPnumber[l]-1;
4842 for (Int_t e = 0; e<12;e++){
4843 Int_t planeno2 = trk->DSPnumber[e]-1;
4844 if ( planeno == planeno2-1 ){
4845 if ( planeno < 0 || planeno > 11 ) planeno = 0;
4846 if ( planeno >= 0 && !var.nosig ) {
4847 mag[ncro] = ((float)planeno+1.)/5.;
4848 if ( (planeno+1)%2 ){
4849 for (Int_t m = 0; m<3; m++){
4850 if ( trk->signcluster[l][m] != 0. ){
4851 if ( planeno == 10 ) {
4852 x = 1024 - trk->addrcluster[l][m];
4853 } else {
4854 x = trk->addrcluster[l][m];
4855 };
4856 x += 1024.;
4857 if ( trk->signcluster[l][m]> ysig ){
4858 ysig = trk->signcluster[l][m];
4859 yh1[ncro] = x-1024.;
4860 yh2[ncro] = x;
4861 };
4862 };
4863 };
4864 for (Int_t m = 0; m<3; m++){
4865 if ( trk->signcluster[e][m] != 0. ){
4866 x = trk->addrcluster[e][m] + 1024. * m;
4867 if ( trk->signcluster[e][m]> xsig ){
4868 xsig = trk->signcluster[e][m];
4869 xh[ncro] = x;
4870 };
4871 };
4872 };
4873 } else {
4874 for (Int_t m = 0; m<3; m++){
4875 if ( trk->signcluster[l][m] != 0. ){
4876 x = trk->addrcluster[l][m] + 1024. * m;
4877 if ( trk->signcluster[l][m]> xsig ){
4878 xsig = trk->signcluster[l][m];
4879 xh[ncro] = x;
4880 };
4881 };
4882 };
4883 if ( (planeno+1)%2 ){
4884 for (Int_t m = 0; m<3; m++){
4885 if ( trk->signcluster[e][m] != 0. ){
4886 if ( planeno == 10 ) {
4887 x = 1024 - trk->addrcluster[e][m];
4888 } else {
4889 x = trk->addrcluster[e][m];
4890 };
4891 x += 1024.;
4892 if ( trk->signcluster[e][m]> ysig ){
4893 ysig = trk->signcluster[e][m];
4894 yh1[ncro] = x-1024.;
4895 yh2[ncro] = x;
4896 };
4897 };
4898 };
4899 };
4900 };
4901 if ( ysig > 0. && xsig > 0. ) {
4902 ncro++;
4903 };
4904 };
4905 };
4906 };
4907 };
4908 //
4909 // Draw crosses
4910 //
4911 if ( ncro && var.AC ) {
4912 trplv->cd();
4913 trplv->Range(0.,0.,2076.,3100.);
4914 for ( Int_t i = 0; i<ncro; i++){
4915 //
4916 Float_t cdx = (55./mag[i])*var.sfx;
4917 Float_t cdy = (55./mag[i])*var.sfy;
4918 Float_t lwx = (1.9)*var.sfy;
4919 Float_t lwy = (1.9)*var.sfx;
4920 //
4921 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
4922 linea->SetLineWidth((int)lwx);
4923 linea->SetLineColor(sigcol1);
4924 linea->Draw();
4925 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
4926 linea->SetLineWidth((int)lwy);
4927 linea->SetLineColor(sigcol1);
4928 linea->Draw();
4929 //
4930 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
4931 linea->SetLineWidth((int)lwx);
4932 linea->SetLineColor(sigcol2);
4933 linea->Draw();
4934 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
4935 linea->SetLineWidth((int)lwy);
4936 linea->SetLineColor(sigcol2);
4937 linea->Draw();
4938 };
4939 };
4940 };
4941 };
4942 }
4943
4944 void FEVdetector::ShowTrack(){
4945 //
4946 //
4947 //
4948 if ( !var.TRK || level.file != 2 ) return;
4949 //
4950 if ( L2->GetNTracks() > 0 ){
4951 for (Int_t nt = 0; nt < L2->GetNTracks(); nt++){
4952 TrkTrack *track = L2->GetTrack(nt);
4953 Int_t npoint = 100;
4954 Float_t zin[100];
4955 Double_t xout[100];
4956 Double_t yout[100];
4957 Int_t ifail = 0;
4958 Int_t trcol = 10;
4959 //
4960 Float_t tx[100];
4961 Float_t ty[100];
4962 Float_t ptx1[50];
4963 Float_t pty1[50];
4964 Float_t ptx2[50];
4965 Float_t pty2[50];
4966 Float_t tx1[15];
4967 Float_t ty1[15];
4968 Float_t tzx[100];
4969 Float_t tzy[100];
4970 Float_t tzx1[15];
4971 Float_t tzy1[15];
4972 //
4973 for ( Int_t e = 0; e < 100 ; e++) {
4974 xout[e] = 0.;
4975 yout[e] = 0.;
4976 //
4977 tx[e] = 0.;
4978 ty[e] = 0.;
4979 tzx[e] = 0.;
4980 tzy[e] = 0.;
4981 if ( e < 50 ){
4982 ptx1[e] = 0.;
4983 pty1[e] = 0.;
4984 ptx2[e] = 0.;
4985 pty2[e] = 0.;
4986 if ( e < 15 ){
4987 tx1[e] = 0.;
4988 ty1[e] = 0.;
4989 tzx1[e] = 0.;
4990 tzy1[e] = 0.;
4991 };
4992 };
4993 //
4994 zin[e] = 60. - (124./99.)*(float)e;
4995 };
4996 //
4997 zin[85] = -45.5;
4998 //
4999 Trajectory *tr = new Trajectory(npoint,zin);
5000 //
5001 ifail = track->DoTrack2(tr);
5002 //
5003 if ( !ifail ){
5004 for ( Int_t e = 0; e < npoint ; e++) {
5005 tx[e] = ((float)tr->x[e]/100.)*var.sfx + var.xxvc;
5006 ty[e] = ((float)tr->y[e]/100.)*var.sfx + var.xyvc;
5007 if ( e < 50 ) {
5008 ptx1[e] = ((float)tr->y[e]/100.)*var.sfx + var.xcat;
5009 pty1[e] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5010 } else {
5011 ptx2[e-50] = ((float)tr->y[e]/100.)*var.sfx + var.xcat;
5012 pty2[e-50] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5013 };
5014 if ( e > 84 ) {
5015 tx1[e-85] = ((float)tr->x[e]/100.)*var.nds4 + var.xxvc;
5016 ty1[e-85] = ((float)tr->y[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-nt;
5028 } else {
5029 trcol = 50-nt;
5030 };
5031 thefigure->cd();
5032 TPolyLine *trackx = new TPolyLine(86,tx,tzx);
5033 trackx->SetLineColor(trcol);
5034 trackx->SetLineWidth(1);
5035 trackx->Draw();
5036 TPolyLine *tracky = new TPolyLine(86,ty,tzy);
5037 tracky->SetLineColor(trcol);
5038 tracky->SetLineWidth(1);
5039 tracky->Draw();
5040 //
5041 // ND and S4
5042 //
5043 if ( var.tracknds4 ){
5044 TPolyLine *trackx1 = new TPolyLine(15,tx1,tzx1);
5045 trackx1->SetLineColor(trcol);
5046 trackx1->SetLineWidth(1);
5047 trackx1->Draw();
5048 TPolyLine *tracky1 = new TPolyLine(15,ty1,tzy1);
5049 tracky1->SetLineColor(trcol);
5050 tracky1->SetLineWidth(1);
5051 tracky1->Draw();
5052 };
5053 //
5054 // Plane View
5055 //
5056 if ( var.AC ){
5057 TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1);
5058 trackp1->SetLineColor(trcol);
5059 trackp1->SetLineWidth(1);
5060 trackp1->Draw();
5061 TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2);
5062 trackp2->SetLineColor(trcol);
5063 trackp2->SetLineWidth(1);
5064 trackp2->SetLineStyle(3);
5065 trackp2->Draw();
5066 };
5067
5068 } else {
5069 pamgui->DIALOG(1," Failed in determining the track! ");
5070 printf(" WARNING: failed in determining the track! \n");
5071 };
5072 };
5073 };
5074 }
5075
5076 void FEVdetector::ShowCalo(Bool_t upd){
5077 //
5078 //
5079 //
5080 if ( !var.CALO ) return;
5081 //
5082 var.qtot = 0;
5083 var.nstrip = 0;
5084 //
5085 if ( level.file == 0 ){
5086 //
5087 // Book the histograms:
5088 //
5089 //
5090 stringstream delex;
5091 delex.str("");
5092 delex << "x-view event " << (thisentry+1);
5093 stringstream deley;
5094 deley.str("");
5095 deley << "y-view event " << (thisentry+1);
5096 gDirectory->Delete(delex.str().c_str());
5097 gDirectory->Delete(deley.str().c_str());
5098 TH2F *Xview = new TH2F(delex.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5099 TH2F *Yview = new TH2F(deley.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5100 Xview->GetYaxis()->SetLabelColor(10);
5101 Yview->GetYaxis()->SetLabelColor(10);
5102 //
5103 // figures:
5104 //
5105 Int_t bgcolor = 10;
5106 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);
5107 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);
5108
5109 pd1->SetFillStyle(4000);
5110 pd1->SetFillColor(0);
5111 pd1->SetFrameFillStyle(4000);
5112 pd2->SetFillStyle(4000);
5113 pd2->SetFillColor(0);
5114 pd2->SetFrameFillStyle(4000);
5115
5116 TLatex *t=new TLatex();
5117 t->SetTextFont(32);
5118 t->SetTextColor(1);
5119 t->SetTextSize(0.03);
5120 t->SetTextAlign(12);
5121 pd1->Range(0.,0.,1.,1.);
5122 pd2->Range(0.,0.,1.,1.);
5123 pd1->SetTicks();
5124 pd2->SetTicks();
5125 pd1->Draw();
5126 pd2->Draw();
5127
5128 pd1->cd();
5129 gStyle->SetOptStat(0);
5130 Xview->GetYaxis()->SetTitleOffset(0.5);
5131 Xview->SetFillColor(bgcolor);
5132 Xview->Fill(1.,1.,1.);
5133 Xview->Draw("box");
5134 pd1->Update();
5135 pd2->cd();
5136 gStyle->SetOptStat(0);
5137 Yview->GetYaxis()->SetTitleOffset(0.5);
5138 Yview->SetFillColor(bgcolor);
5139 Yview->Fill(1.,1.,1.);
5140 Yview->Draw("box");
5141 pd2->Update();
5142
5143 //
5144 // run over views and planes
5145 //
5146 stringstream xevent;
5147 stringstream yevent;
5148 Float_t sdexy[2][22][96];
5149 Float_t sdexyc[2][22][96];
5150 //
5151 for (Int_t m = 0; m < 22; m++){
5152 for (Int_t l = 0; l < 2; l++){
5153 //
5154 // determine the section number
5155 //
5156 Int_t se = 5;
5157 if ( !l && m%2 == 0 ) se = 3;
5158 if ( !l && m%2 != 0 ) se = 2;
5159 if ( l && m%2 == 0 ) se = 1;
5160 if ( l && m%2 != 0 ) se = 0;
5161 //
5162 // determine what kind of event we are going to analyze
5163 //
5164 bool isCOMP = 0;
5165 bool isFULL = 0;
5166 bool isRAW = 0;
5167 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
5168 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
5169 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
5170 //
5171 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
5172 //
5173 Int_t pre = -1;
5174 if ( isRAW ){
5175 for (Int_t nn = 0; nn < 96; nn++){
5176 if ( nn%16 == 0 ) pre++;
5177 evento.base[l][m][pre] = calib.calbase[l][m][pre];
5178 sdexy[l][m][nn] = evento.dexy[l][m][nn];
5179 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
5180 sdexyc[l][m][nn] = evento.dexy[l][m][nn];
5181 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
5182 };
5183 };
5184 //
5185 // run over strips
5186 //
5187 Int_t done = 0;
5188 Int_t rdone = 0;
5189 Int_t fdone = 0;
5190 pre = -1;
5191 for (Int_t n =0 ; n < 96; n++){
5192 if ( n%16 == 0 ) {
5193 pre++;
5194 done = 0;
5195 rdone = 0;
5196 fdone = 0;
5197 };
5198 //
5199 // baseline check and calculation
5200 //
5201 if ( isRAW ) {
5202 //
5203 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
5204 // if not calculate it with relaxed algorithm.
5205 //
5206 if ( !rdone ){
5207 CaloFindBaseRaw(l,m,pre);
5208 rdone = 1;
5209 };
5210 //
5211 // no suitable new baseline, use old ones
5212 //
5213 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
5214 evento.base[l][m][pre] = calib.sbase[l][m][pre];
5215 Int_t upnn = n+16;
5216 if ( upnn > 96 ) upnn = 96;
5217 for ( Int_t nn = n; nn<upnn; nn++ ){
5218 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
5219 };
5220 done = 1;
5221 };
5222 if ( !fdone ){
5223 CaloCompressData(l,m,pre);
5224 fdone = 1;
5225 };
5226 };
5227 //
5228 if ( de->dexyc[l][m][n] > 0. || ( isRAW && evento.dexyc[l][m][n] > 0. )){
5229 xevent.str("");
5230 yevent.str("");
5231 xevent << "x-view event " << n;
5232 xevent << " " << m;
5233 xevent << " " << l;
5234 yevent << "y-view event " << n;
5235 yevent << " " << m;
5236 yevent << " " << l;
5237 gDirectory->Delete(xevent.str().c_str());
5238 gDirectory->Delete(yevent.str().c_str());
5239 TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5240 TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5241 Int_t colo;
5242 if ( var.bw ){
5243 colo = 17;
5244 } else {
5245 colo = 38;
5246 };
5247 Xview->SetFillColor(colo);
5248 Yview->SetFillColor(colo);
5249 if ( l == 0 ) {
5250 Xview->Fill(n,21-m,1.);
5251 pd1->cd();
5252 Xview->Draw("box same");
5253 };
5254 if ( l == 1 ) {
5255 Yview->Fill(n,21-m,1.);
5256 pd2->cd();
5257 Yview->Draw("box same");
5258 };
5259 };
5260 };
5261 };
5262 };
5263 pd1->Update();
5264 pd2->Update();
5265 var.qtot=0;
5266 var.nstrip=0;
5267 };
5268 //
5269 if ( level.file == -1 ){
5270 Float_t qtot;
5271 Int_t nstrip;
5272 //
5273 // Define variables
5274 //
5275 Int_t etime = var.etime;
5276 Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];
5277 Int_t badstrip = 0;
5278 qtot = 0.;
5279 nstrip = 0;
5280 //
5281 // Book the histograms:
5282 //
5283 //
5284 stringstream xvev;
5285 stringstream yvev;
5286 xvev.str("");
5287 yvev.str("");
5288 xvev << "x-view event " << (thisentry+1);
5289 yvev << "y-view event " << (thisentry+1);
5290 gDirectory->Delete(xvev.str().c_str());
5291 gDirectory->Delete(yvev.str().c_str());
5292 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5293 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5294 Xview->GetYaxis()->SetLabelColor(10);
5295 Yview->GetYaxis()->SetLabelColor(10);
5296 //
5297 // figures:
5298 //
5299 Int_t bgcolor = 10;
5300 gDirectory->Delete("caloy");
5301 gDirectory->Delete("calox");
5302 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);
5303 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);
5304 if ( upd ){
5305
5306 pd1->SetFillStyle(4000);
5307 pd1->SetFillColor(0);
5308 pd1->SetFrameFillStyle(4000);
5309 pd2->SetFillStyle(4000);
5310 pd2->SetFillColor(0);
5311 pd2->SetFrameFillStyle(4000);
5312
5313 TLatex *t=new TLatex();
5314 t->SetTextFont(32);
5315 t->SetTextColor(1);
5316 t->SetTextSize(0.03);
5317 t->SetTextAlign(12);
5318 pd1->Range(0.,0.,1.,1.);
5319 pd2->Range(0.,0.,1.,1.);
5320 pd1->SetTicks();
5321 pd2->SetTicks();
5322 pd1->Draw();
5323 pd2->Draw();
5324
5325 pd1->cd();
5326 gStyle->SetOptStat(0);
5327 Xview->GetYaxis()->SetTitleOffset(0.5);
5328 Xview->SetFillColor(bgcolor);
5329 Xview->Fill(1.,1.,1.);
5330 Xview->Draw("box");
5331 pd1->Update();
5332 pd2->cd();
5333 gStyle->SetOptStat(0);
5334 Yview->GetYaxis()->SetTitleOffset(0.5);
5335 Yview->SetFillColor(bgcolor);
5336 Yview->Fill(1.,1.,1.);
5337 Yview->Draw("box");
5338 pd2->Update();
5339 };
5340 //
5341 // for each event check that the calibration we are using are still within calibration limits, if not call the next calibration
5342 //
5343 for (Int_t s = 0; s < 4; s++){
5344 if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){
5345 while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){
5346 printf(" CALORIMETER: \n" );
5347 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]);
5348 printf(" END CALORIMETER. \n\n" );
5349 b[s]++;
5350 CaloPede(s);
5351 };
5352 };
5353 };
5354 //
5355 // run over views and planes
5356 //
5357 stringstream xve;
5358 stringstream yve;
5359 for (Int_t l = 0; l < 2; l++){
5360 for (Int_t m = 0; m < 22; m++){
5361 //
5362 // determine the section number
5363 //
5364 Int_t se = 5;
5365 if (l == 0 && m%2 == 0) se = 3;
5366 if (l == 0 && m%2 != 0) se = 2;
5367 if (l == 1 && m%2 == 0) se = 1;
5368 if (l == 1 && m%2 != 0) se = 0;
5369 //
5370 // determine what kind of event we are going to analyze
5371 //
5372 bool isCOMP = 0;
5373 bool isFULL = 0;
5374 bool isRAW = 0;
5375 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
5376 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
5377 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
5378 //
5379 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
5380 //
5381 Int_t pre = -1;
5382 if ( isRAW ){
5383 for (Int_t nn = 0; nn < 96; nn++){
5384 if ( nn%16 == 0 ) pre++;
5385 evento.base[l][m][pre] = calib.calbase[l][m][pre];
5386 sdexy[l][m][nn] = evento.dexy[l][m][nn];
5387 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
5388 sdexyc[l][m][nn] = evento.dexy[l][m][nn];
5389 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
5390 };
5391 };
5392 //
5393 // run over strips
5394 //
5395 Int_t done = 0;
5396 Int_t rdone = 0;
5397 Int_t fdone = 0;
5398 pre = -1;
5399 for (Int_t n =0 ; n < 96; n++){
5400 if ( n%16 == 0 ) {
5401 pre++;
5402 done = 0;
5403 rdone = 0;
5404 fdone = 0;
5405 };
5406 //
5407 // baseline check and calculation
5408 //
5409 if ( !isRAW ) {
5410 //
5411 // 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.
5412 //
5413 if ( !done ){
5414 evento.base[l][m][pre] = de->base[l][m][pre] ;
5415 evento.dexyc[l][m][n] = de->dexyc[l][m][n] ;
5416 };
5417 } else {
5418 //
5419 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
5420 // if not calculate it with relaxed algorithm.
5421 //
5422 if ( !rdone ){
5423 CaloFindBaseRaw(l,m,pre);
5424 rdone = 1;
5425 };
5426 };
5427 //
5428 // no suitable new baseline, use old ones
5429 //
5430 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
5431 evento.base[l][m][pre] = calib.sbase[l][m][pre];
5432 Int_t upnn = n+16;
5433 if ( upnn > 96 ) upnn = 96;
5434 for ( Int_t nn = n; nn<upnn; nn++ ){
5435 if ( !isRAW ){
5436 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
5437 } else {
5438 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
5439 };
5440 };
5441 CaloCompressData(l,m,pre);
5442 done = 1;
5443 };
5444 //
5445 // CALIBRATION ALGORITHM
5446 //
5447 basel = evento.base[l][m][pre];
5448 ener = evento.dexyc[l][m][n];
5449 estrip[l][m][n] = 0.;
5450 if ( basel>0 && basel < 30000. && ener > 0. ){
5451 estrip[l][m][n] = (ener - calib.calped[l][m][n] - basel)/mip[l][m][n] ;
5452 //
5453 // 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)
5454 //
5455 if ( upd ){
5456 xve.str("");
5457 yve.str("");
5458 xve << "x-view event " << n;
5459 xve << " " << m;
5460 xve << " " << l;
5461 yve << "y-view event " << n;
5462 yve << " " << m;
5463 yve << " " << l;
5464 gDirectory->Delete(xve.str().c_str());
5465 gDirectory->Delete(yve.str().c_str());
5466 TH2F *Xview = new TH2F(xve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5467 TH2F *Yview = new TH2F(yve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5468 if ( estrip[l][m][n] > 0.7 && !var.nosig ){
5469 Int_t colo;
5470 if ( var.bw ){
5471 colo = -1;
5472 } else {
5473 colo = 1;
5474 };
5475 ColorMIP(estrip[l][m][n],colo);
5476 Xview->SetFillColor(colo);
5477 Yview->SetFillColor(colo);
5478 if ( l == 0 ) {
5479 Xview->Fill(n,21-m,1.);
5480 pd1->cd();
5481 Xview->Draw("box same");
5482 };
5483 if ( l == 1 ) {
5484 Yview->Fill(n,21-m,1.);
5485 pd2->cd();
5486 Yview->Draw("box same");
5487 };
5488 };
5489 };
5490 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++;
5491 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) {
5492 qtot += estrip[l][m][n];
5493 nstrip++;
5494 };
5495 };
5496 calib.sbase[l][m][pre] = evento.base[l][m][pre];
5497 };
5498 };
5499 };
5500 if ( upd ){
5501 pd1->Update();
5502 pd2->Update();
5503 };
5504 var.qtot=(int)qtot;
5505 var.nstrip=nstrip;
5506 };
5507 //
5508 if ( level.file == 2 ){
5509 //
5510 // Book the histograms:
5511 //
5512 //
5513 stringstream xview;
5514 stringstream yview;
5515 xview.str("");
5516 yview.str("");
5517 xview << "x-view event " << (thisentry+1);
5518 yview << "y-view event " << (thisentry+1);
5519 gDirectory->Delete(xview.str().c_str());
5520 gDirectory->Delete(yview.str().c_str());
5521 TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5522 TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5523 Xview->GetYaxis()->SetLabelColor(10);
5524 Yview->GetYaxis()->SetLabelColor(10);
5525 //
5526 // figures:
5527 //
5528 Int_t bgcolor = 10;
5529 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);
5530 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);
5531
5532 pd1->SetFillStyle(4000);
5533 pd1->SetFillColor(0);
5534 pd1->SetFrameFillStyle(4000);
5535 pd2->SetFillStyle(4000);
5536 pd2->SetFillColor(0);
5537 pd2->SetFrameFillStyle(4000);
5538
5539 TLatex *t=new TLatex();
5540 t->SetTextFont(32);
5541 t->SetTextColor(1);
5542 t->SetTextSize(0.03);
5543 t->SetTextAlign(12);
5544 pd1->Range(0.,0.,1.,1.);
5545 pd2->Range(0.,0.,1.,1.);
5546 pd1->SetTicks();
5547 pd2->SetTicks();
5548 pd1->Draw();
5549 pd2->Draw();
5550
5551 pd1->cd();
5552 gStyle->SetOptStat(0);
5553 Xview->GetYaxis()->SetTitleOffset(0.5);
5554 Xview->SetFillColor(bgcolor);
5555 Xview->Fill(1.,1.,1.);
5556 Xview->Draw("box");
5557 pd1->Update();
5558 pd2->cd();
5559 gStyle->SetOptStat(0);
5560 Yview->GetYaxis()->SetTitleOffset(0.5);
5561 Yview->SetFillColor(bgcolor);
5562 Yview->Fill(1.,1.,1.);
5563 Yview->Draw("box");
5564 pd2->Update();
5565
5566 //
5567 // run over views and planes
5568 //
5569 stringstream xvev;
5570 stringstream yvev;
5571 for (Int_t ii = 0; ii < L2->nstrip; ii++){
5572 Int_t colo;
5573 Int_t l;
5574 Int_t m;
5575 Int_t n;
5576 Float_t mip = L2->DecodeEstrip(ii,l,m,n);
5577 if ( var.bw ){
5578 colo = -1;
5579 } else {
5580 colo = 1;
5581 };
5582 ColorMIP(mip,colo);
5583 if ( l == 0 ) {
5584 xvev.str("");
5585 xvev << "x-view event " << n;
5586 xvev << " " << m;
5587 xvev << " " << l;
5588 gDirectory->Delete(xvev.str().c_str());
5589 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5590 Xview->SetFillColor(colo);
5591 Xview->Fill(n,21-m,1.);
5592 pd1->cd();
5593 Xview->Draw("box same");
5594 };
5595 if ( l == 1 ) {
5596 yvev.str("");
5597 yvev << "y-view event " << n;
5598 yvev << " " << m;
5599 yvev << " " << l;
5600 gDirectory->Delete(yvev.str().c_str());
5601 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5602 Yview->SetFillColor(colo);
5603 Yview->Fill(n,21-m,1.);
5604 pd2->cd();
5605 Yview->Draw("box same");
5606 };
5607 };
5608 pd1->Update();
5609 pd2->Update();
5610 var.qtot=(int)L2->qtot;
5611 var.nstrip=(int)L2->nstrip;
5612 };
5613 }
5614
5615 void FEVdetector::Calo1stcalib(){
5616 Float_t estrip[2][22][96];
5617 //
5618 // this is the value of the mip for each strip. To be changed when we will have the real values
5619 //
5620 for (Int_t s=0; s<4;s++){
5621 for (Int_t d = 0; d<50; d++){
5622 calib.ttime[s][d] = 0 ;
5623 if ( d < 49 ) calib.time[s][d] = 0 ;
5624 };
5625 };
5626 defcalib = false;
5627 //
5628 retry:
5629 //
5630 for (Int_t m = 0; m < 2 ; m++ ){
5631 for (Int_t k = 0; k < 22; k++ ){
5632 for (Int_t l = 0; l < 96; l++ ){
5633 calib.calped[m][k][l] = 0. ;
5634 estrip[m][k][l] = 0.;
5635 };
5636 };
5637 }
5638 //
5639 // first of all find the calibrations in the file
5640 //
5641 OLDCaloFindCalibs();
5642 //
5643 // print on the screen the results:
5644 //
5645 printf(" ---------------------------------------------------------- \n \n");
5646 Int_t calibex = 0;
5647 for (Int_t s=0; s<4;s++){
5648 Int_t stop = 0;
5649 for (Int_t d = 0; d<48; d++){
5650 if ( calib.ttime[s][d] != 0 ) calibex++;
5651 if ( calib.time[s][0] != 0 ){
5652 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]);
5653 if ( calib.time[s][d+1] != 0 ) {
5654 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]);
5655 } else {
5656 if ( !stop ){
5657 printf(" Section %i from time %i use calibration at time %i \n",s,calib.time[s][d],calib.ttime[s][d+1]);
5658 stop = 1;
5659 };
5660 };
5661 } else {
5662 if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %i \n",s,calib.ttime[s][d]);
5663 };
5664 };
5665 printf("\n");
5666 };
5667 printf(" ---------------------------------------------------------- \n");
5668 if ( calibex < 1 ) {
5669 printf("No full calibration data in this file\n");
5670 printf(" Using default calibration \n");
5671 defcalib = true;
5672 goto retry;
5673 };
5674 //
5675 // calibrate before starting
5676 //
5677 for (Int_t s = 0; s < 4; s++){
5678 b[s]=0;
5679 CaloPede(s);
5680 };
5681 }
5682
5683 int FEVdetector::OLDCaloFindCalibs(){
5684 for (Int_t s = 0; s < 4; s++){
5685 for (Int_t d = 1; d<50; d++){
5686 calib.ttime[s][d] = 0;
5687 if ( d < 49 ) calib.time[s][d] = 0;
5688 };
5689 };
5690 TString calibfile;
5691 if ( defcalib ){
5692 const char *pam_calib = pathtocalibration();
5693 stringstream calfile;
5694 calfile.str("");
5695 calfile << pam_calib << "/cal-param/FCaloDefaultCalib.root";
5696 calibfile = calfile.str().c_str();
5697 } else {
5698 calibfile = var.thefilename;
5699 };
5700 if ( !existfile(calibfile) ) return(1);
5701 //
5702 printf(" Using for calibrations file %s \n",calibfile.Data());
5703 //
5704 TFile *File = new TFile(calibfile.Data());
5705 TTree *tr = (TTree*)File->Get("CalibCalPed");
5706 pamela::CalibCalPedEvent *ce = 0;
5707 pamela::PscuHeader *cph = 0;
5708 pamela::EventHeader *ceh = 0;
5709 tr->SetBranchAddress("Header", &ceh);
5710 tr->SetBranchAddress("CalibCalPed", &ce);
5711 Long64_t ncalibs = tr->GetEntries();
5712 Int_t inter;
5713 for (Int_t s = 0; s < 4; s++){
5714 for (Int_t d = 1; d<50; d++){
5715 calib.ttime[s][d] = 0;
5716 if ( d < 49 ) calib.time[s][d] = 0;
5717 };
5718 };
5719 for (Int_t s = 0; s < 4; s++){
5720 inter = 0;
5721 for (Int_t c = 0; c < ncalibs; c++){
5722 tr->GetEntry(c);
5723 cph = ceh->GetPscuHeader();
5724 calib.ttime[s][inter] = 0;
5725 if ( ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
5726 //calib.ttime[s][inter] = cph->GetOrbitalTime();
5727 calib.ttime[s][inter] = cph->OrbitalTime;
5728 inter++;
5729 } else {
5730 if ( ce->cstwerr[s] != 0 && ce->cperror[s] != 0 ) {
5731 printf(" ERROR: entry %i stwerr %X perror %f \n",c,ce->cstwerr[s],ce->cperror[s]);
5732 };
5733 };
5734 };
5735 if ( inter == 0 ){
5736 printf(" ERROR: no suitable calibration for section %i in this file!\n",s);
5737 };
5738 for (Int_t d = 1; d<50; d++){
5739 if ( calib.ttime[s][d] != 0 ) {
5740 calib.time[s][d-1] = calib.ttime[s][d-1] + (int)((calib.ttime[s][d] - calib.ttime[s][d-1])/2.);
5741 } else {
5742 if ( d == 1 ) {
5743 calib.time[s][d-1] = 0;
5744 };
5745 };
5746 };
5747 };
5748 File->Close();
5749 return(0);
5750 }
5751
5752 int FEVdetector::CaloPede(Int_t s){
5753 //
5754 UInt_t atime = calib.ttime[s][b[s]];
5755 TString calibfile;
5756 if ( defcalib ){
5757 const char *pam_calib = pathtocalibration();
5758 stringstream calfile;
5759 calfile.str("");
5760 calfile << pam_calib << "/cal-param/FCaloDefaultCalib.root";
5761 calibfile = calfile.str().c_str();
5762 } else {
5763 calibfile = var.thefilename;
5764 };
5765 if ( !existfile(calibfile) ) return(3);
5766 //
5767 TFile *File = new TFile(calibfile.Data());
5768 TTree *tr = (TTree*)File->Get("CalibCalPed");
5769 //
5770 pamela::CalibCalPedEvent *ce = 0;
5771 pamela::PscuHeader *cph = 0;
5772 pamela::EventHeader *ceh = 0;
5773 tr->SetBranchAddress("Header", &ceh);
5774 tr->SetBranchAddress("CalibCalPed", &ce);
5775 //
5776 Long64_t ncalibs = tr->GetEntries();
5777 for (Int_t ci = 0; ci < ncalibs ; ci++){
5778 tr->GetEntry(ci);
5779 cph = ceh->GetPscuHeader();
5780 //if ( atime == cph->GetOrbitalTime()){
5781 if ( atime == cph->OrbitalTime){
5782 // calib.iev = ce->iev;
5783 if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
5784 for ( Int_t d=0 ; d<11 ;d++ ){
5785 Int_t pre = -1;
5786 for ( Int_t j=0; j<96 ;j++){
5787 if ( j%16 == 0 ) pre++;
5788 if ( s == 2 ){
5789 calib.calped[0][2*d+1][j] = ce->calped[3][d][j];
5790 calib.cstwerr[3] = ce->cstwerr[3];
5791 calib.cperror[3] = ce->cperror[3];
5792 calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j];
5793 calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre];
5794 calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j];
5795 calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre];
5796 calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre];
5797 };
5798 if ( s == 3 ){
5799 calib.calped[0][2*d][j] = ce->calped[1][d][j];
5800 calib.cstwerr[1] = ce->cstwerr[1];
5801 calib.cperror[1] = ce->cperror[1];
5802 calib.calgood[0][2*d][j] = ce->calgood[1][d][j];
5803 calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre];
5804 calib.calrms[0][2*d][j] = ce->calrms[1][d][j];
5805 calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre];
5806 calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre];
5807 };
5808 if ( s == 0 ){
5809 calib.calped[1][2*d][j] = ce->calped[0][d][j];
5810 calib.cstwerr[0] = ce->cstwerr[0];
5811 calib.cperror[0] = ce->cperror[0];
5812 calib.calgood[1][2*d][j] = ce->calgood[0][d][j];
5813 calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre];
5814 calib.calrms[1][2*d][j] = ce->calrms[0][d][j];
5815 calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre];
5816 calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre];
5817 };
5818 if ( s == 1 ){
5819 calib.calped[1][2*d+1][j] = ce->calped[2][d][j];
5820 calib.cstwerr[2] = ce->cstwerr[2];
5821 calib.cperror[2] = ce->cperror[2];
5822 calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j];
5823 calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre];
5824 calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j];
5825 calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre];
5826 calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre];
5827 };
5828 };
5829 };
5830 };
5831 };
5832 };
5833 File->Close();
5834 return(0);
5835 }
5836
5837 void FEVdetector::CaloFindBaseRaw(Int_t l, Int_t m, Int_t pre){
5838 Float_t minstrip = 100000.;
5839 Float_t rms = 0.;
5840 evento.base[l][m][pre] = 0.;
5841 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
5842 if ( calib.calgood[l][m][e] == 0. && evento.dexy[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexy[l][m][e] > 0.) {
5843 minstrip = evento.dexy[l][m][e]-calib.calped[l][m][e];
5844 rms = calib.calthr[l][m][pre];
5845 };
5846 };
5847 if ( minstrip != 100000. ) {
5848 Float_t strip6s = 0.;
5849 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
5850 if ( (evento.dexy[l][m][e]-calib.calped[l][m][e]) >= minstrip && (evento.dexy[l][m][e]-calib.calped[l][m][e]) <= (minstrip+rms) ) {
5851 strip6s += 1.;
5852 evento.base[l][m][pre] += (evento.dexy[l][m][e] - calib.calped[l][m][e]);
5853 };
5854 //
5855 // compression
5856 //
5857 if ( abs((int)(evento.dexy[l][m][e]-calib.calped[l][m][e])) <= (minstrip+rms) ) {
5858 evento.dexyc[l][m][e] = 0.;
5859 } else {
5860 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
5861 };
5862 };
5863 if ( strip6s >= 9. ){
5864 Double_t arro = evento.base[l][m][pre]/strip6s;
5865 Float_t deci = 1000.*((float)arro - float(int(arro)));
5866 if ( deci < 500. ) {
5867 arro = double(int(arro));
5868 } else {
5869 arro = 1. + double(int(arro));
5870 };
5871 evento.base[l][m][pre] = arro;
5872 } else {
5873 evento.base[l][m][pre] = 31000.;
5874 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
5875 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
5876 };
5877 };
5878 } else {
5879 evento.base[l][m][pre] = 31000.;
5880 };
5881 }
5882
5883 void FEVdetector::CaloCompressData(Int_t l, Int_t m, Int_t pre){
5884 Float_t minstrip = 100000.;
5885 Float_t rms = 0.;
5886 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
5887 if ( calib.calgood[l][m][e] == 0. && evento.dexyc[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexyc[l][m][e] > 0.) {
5888 minstrip = evento.dexyc[l][m][e]-calib.calped[l][m][e];
5889 rms = calib.calthr[l][m][pre];
5890 };
5891 };
5892 //
5893 // compression
5894 //
5895 if ( minstrip < evento.base[l][m][pre] && minstrip != 100000.){
5896 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
5897 if ( evento.dexyc[l][m][e]-calib.calped[l][m][e] <= (minstrip+rms) ) evento.dexyc[l][m][e] = 0.;
5898 };
5899 };
5900 }

  ViewVC Help
Powered by ViewVC 1.1.23