/[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.28 - (show annotations) (download)
Mon Jun 22 09:30:01 2009 UTC (15 years, 6 months ago) by mocchiut
Branch: MAIN
Changes since 1.27: +47 -10 lines
Possible bug in TRK cluster visualization fixed, new transient windows appearance

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

  ViewVC Help
Powered by ViewVC 1.1.23