/[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.21 - (show annotations) (download)
Thu Nov 8 11:05:34 2007 UTC (17 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.20: +56 -19 lines
Bugs fixed and new features implemented - now can only work with PamLevel2 'AUTO' version

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

  ViewVC Help
Powered by ViewVC 1.1.23