/[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.25 - (show annotations) (download)
Thu Nov 29 15:53:10 2007 UTC (17 years ago) by mocchiut
Branch: MAIN
CVS Tags: v3r00, v2r02
Changes since 1.24: +102 -64 lines
Y-view inversion (major) bug fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23