/[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.18 - (show annotations) (download)
Fri Mar 30 11:16:43 2007 UTC (17 years, 9 months ago) by mocchiut
Branch: MAIN
Changes since 1.17: +41 -28 lines
Yet another small upgrade

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

  ViewVC Help
Powered by ViewVC 1.1.23