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

  ViewVC Help
Powered by ViewVC 1.1.23