/[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.16 - (show annotations) (download)
Tue Mar 20 12:49:55 2007 UTC (17 years, 8 months ago) by mocchiut
Branch: MAIN
Changes since 1.15: +109 -27 lines
Development version do not use

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

  ViewVC Help
Powered by ViewVC 1.1.23