/[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.8 - (show annotations) (download)
Fri Feb 2 14:35:57 2007 UTC (17 years, 10 months ago) by mocchiut
Branch: MAIN
Changes since 1.7: +1 -1 lines
compilation bug under slc3 fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23