/[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.29 - (show annotations) (download)
Tue Aug 11 13:03:42 2009 UTC (15 years, 5 months ago) by mocchiut
Branch: MAIN
Changes since 1.28: +7 -0 lines
Compilation warnings and errors with gcc >= 4.3 fixed

1 #include <math.h>
2 #include <stdio.h>
3 //
4 #include <iostream>
5 #include <iomanip>
6 #include <fstream>
7 #if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
8 char* operator+( std::streampos&, char* );
9 #endif
10 //
11 #include <TObjectTable.h>
12 #include <TGClient.h>
13 #include <TGButton.h>
14 #include <TGComboBox.h>
15 #include <TGLabel.h>
16 #include <TGTextEntry.h>
17 #include <TGFrame.h>
18 #include <TGButtonGroup.h>
19 #include <TGProgressBar.h>
20 #include <TGMsgBox.h>
21 #include <TGComboBox.h>
22 //
23 #include <TTree.h>
24 #include <TClassEdit.h>
25 #include <TObject.h>
26 #include <TList.h>
27 #include <TSystem.h>
28 #include <TSystemDirectory.h>
29 #include <TString.h>
30 #include <TFile.h>
31 #include <TClass.h>
32 #include <TCanvas.h>
33 #include <TH1.h>
34 #include <TH1F.h>
35 #include <TH2D.h>
36 #include <TLatex.h>
37 #include <TPad.h>
38 #include <TPaveLabel.h>
39 #include <TLine.h>
40 #include <TPolyLine.h>
41 #include <TChain.h>
42 #include <TApplication.h>
43 #include <TVirtualX.h>
44 #include <TGClient.h>
45 #include <TGWindow.h>
46 #include <TEllipse.h>
47 #include <TArrow.h>
48 #include <TStyle.h>
49 #include <TStreamerElement.h>
50 #include <TRealData.h>
51 //
52 #include <PamelaRun.h>
53 #include <physics/calorimeter/CalorimeterEvent.h>
54 #include <physics/trigger/TriggerEvent.h>
55 #include <physics/tof/TofEvent.h>
56 #include <physics/tracker/TrackerEvent.h>
57 #include <physics/anticounter/AnticounterEvent.h>
58 #include <physics/neutronDetector/NeutronEvent.h>
59 #include <physics/S4/S4Event.h>
60 #include <CalibCalPedEvent.h>
61 #include <CalibTrk1Event.h>
62 #include <CalibTrk2Event.h>
63 //
64 #include <FEVpathtoc.h>
65 //
66 #include <PamLevel2.h>
67 //
68 #include <FEVpamevcontrol.h>
69 #include <FEVdetector.h>
70 #include <FEventViewer.h>
71 #include <feventvstruct.h>
72 #include <color.h>
73 //
74 extern Bool_t existfile(TString);
75 //
76
77 using namespace std;
78
79 FEVdetector::FEVdetector(TString filename, TString selfile, Int_t &mainctrlword, TCanvas &figure){
80 var.thefilename = filename.Data();
81 var.thefilter = selfile.Data();
82 ctrlword = &mainctrlword;
83 thefigure = &figure;
84 checkctrlword();
85 var.selex = false;
86 var.showall = false;
87
88 var.showsi = false;
89 var.shownd = false;
90 var.shows4 = false;
91 var.showorb = false;
92 var.showtof = false;
93 var.showtrg = false;
94 var.showtrk = false;
95 var.showcal = false;
96 var.showrun = false;
97 var.showac = false;
98 }
99
100 void FEVdetector::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 memset(mt11,0,2*8*sizeof(Float_t));
1989 memset(mt12,0,2*6*sizeof(Float_t));
1990 memset(mt21,0,2*2*sizeof(Float_t));
1991 memset(mt22,0,2*2*sizeof(Float_t));
1992 memset(mt31,0,2*3*sizeof(Float_t));
1993 memset(mt32,0,2*3*sizeof(Float_t));
1994 //
1995 Int_t S3 = 0;
1996 Int_t S2 = 0;
1997 Int_t S12 = 0;
1998 Int_t S11 = 0;
1999 S3 = trigger->patterntrig[2];
2000 S2 = trigger->patterntrig[3];
2001 S12 = trigger->patterntrig[4];
2002 S11 = trigger->patterntrig[5];
2003 //
2004 for ( Int_t i = 0; i<8; i++ ) {
2005 if ( S11 & (1<<i) ){
2006 ms11a[i] = 1.;
2007 }
2008 if ( S11 & (1<<(i+8) ) ){
2009 ms11b[i] = 1.;
2010 }
2011 };
2012 for ( Int_t i = 0; i<6; i++ ) {
2013 if ( S12 & (1<<i) ) {
2014 ms12a[i] = 1.;
2015 }
2016 if ( S12 & (1<<(i+6)) ) {
2017 ms12b[i] = 1.;
2018 }
2019 };
2020 Int_t ii = 2;
2021 for ( Int_t i = 0; i<2; i++ ) {
2022 ii--;
2023 if ( S2 & (1<<i) ) {
2024 ms21a[ii] = 1.;
2025 }
2026 if ( S2 & (1<<(i+2)) ) {
2027 ms21b[ii] = 1.;
2028 }
2029 };
2030 for ( Int_t i = 4; i<6; i++ ) {
2031 if ( S2 & (1<<i) ) {
2032 ms22a[i-4] = 1.;
2033 }
2034 if ( S2 & (1<<(i+2)) ) {
2035 ms22b[i-4] = 1.;
2036 }
2037 };
2038 for ( Int_t i = 0; i<3; i++ ) {
2039 if ( S3 & (1<<i) ) {
2040 ms31a[i] = 1.;
2041 }
2042 if ( S3 & (1<<(i+3)) ) {
2043 ms31b[i] = 1.;
2044 }
2045 };
2046 for ( Int_t i = 6; i<9; i++ ) {
2047 if ( S3 & (1<<i) ) {
2048 ms32a[i-6] = 1.;
2049 }
2050 if ( S3 & (1<<(i+3)) ) {
2051 ms32b[i-6] = 1.;
2052 }
2053 };
2054 //
2055 Int_t colo;
2056 Int_t ocolo;
2057 Float_t xs2x = var.xxvc;
2058 Float_t ys2x = var.yxvc + 0.36*var.sfy;
2059 Float_t xs2y = var.xyvc;
2060 Float_t ys2y = var.yyvc + 0.36*var.sfy;
2061 Float_t ws2 = 0.005;
2062 Float_t ws13 = 0.007;
2063 Int_t noadc = 12;
2064 if ( var.bw ){
2065 noadc=12;
2066 } else {
2067 noadc=41;
2068 };
2069 //
2070 // S11 X-view
2071 //
2072 // A
2073 Float_t s11p = 0.051;
2074 ocolo = 10;
2075 TPolyLine *ftof11xa[8];
2076 for ( Int_t j=0; j<8; j++){
2077 Float_t xc1[4]={ (s11p*j), (s11p*j), s11p*(j+1), (s11p*j)};
2078 Float_t yc1[4]={ 0., ws13, ws13, 0.};
2079 Float_t xc[4];
2080 Float_t yc[4];
2081 for (Int_t i = 0; i<4 ; i++) {
2082 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
2083 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
2084 };
2085 ftof11xa[j] = new TPolyLine(4,xc,yc);
2086 ftof11xa[j]->SetLineColor(1);
2087 if ( var.bw ){
2088 colo = -1;
2089 } else {
2090 colo = 1;
2091 };
2092 ColorMIP(ms11a[j],colo);
2093 //
2094 if ( colo != 10 ) ocolo = colo;
2095 if ( mt11[0][j] == 4095. ) colo = noadc;
2096 //
2097 ftof11xa[j]->SetFillColor(colo);
2098 ftof11xa[j]->SetLineWidth(1);
2099 ftof11xa[j]->Draw("f");
2100 ftof11xa[j]->Draw();
2101 };
2102 // B
2103 s11p = 0.051;
2104 TPolyLine *ftof11xb[8];
2105 for ( Int_t j=0; j<8; j++){
2106 Float_t xc1[4]={ (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
2107 Float_t yc1[4]={ 0., 0., ws13, 0.};
2108 Float_t xc[4];
2109 Float_t yc[4];
2110 for (Int_t i = 0; i<4 ; i++) {
2111 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
2112 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
2113 };
2114 ftof11xb[j] = new TPolyLine(4,xc,yc);
2115 ftof11xb[j]->SetLineColor(1);
2116 if ( var.bw ){
2117 colo = -1;
2118 } else {
2119 colo = 1;
2120 };
2121 ColorMIP(ms11b[j],colo);
2122 //
2123 if ( colo != 10 ) ocolo = colo;
2124 if ( mt11[1][j] == 4095. ) colo = noadc;
2125 //
2126 ftof11xb[j]->SetFillColor(colo);
2127 ftof11xb[j]->SetLineWidth(1);
2128 ftof11xb[j]->Draw("f");
2129 ftof11xb[j]->Draw();
2130 };
2131
2132 //
2133 // S11 Y-view
2134 //
2135 if ( true ){
2136 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
2137 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2138 Float_t nxc[5];
2139 Float_t nyc[5];
2140 for (Int_t i = 0; i<5 ; i++) {
2141 nxc[i]= xs2y + nxc1[i]*var.sfx;
2142 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2143 };
2144 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
2145 ftof11y->SetLineColor(1);
2146 ftof11y->SetFillColor(ocolo);
2147 ftof11y->SetLineWidth(1);
2148 ftof11y->Draw("f");
2149 ftof11y->Draw();
2150 };
2151
2152 //
2153 // S12 Y-view
2154 //
2155 // A
2156 Float_t s12p = 0.055;
2157 ocolo = 10;
2158 TPolyLine *ftof12ya[6];
2159 rj=6;
2160 for ( Int_t j=0; j<6; j++){
2161 rj--;
2162 Float_t xc1[4]={ (s12p*j), s12p*(j), s12p*(j+1), (s12p*j)};
2163 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
2164 Float_t xc[4];
2165 Float_t yc[4];
2166 for (Int_t i = 0; i<4 ; i++) {
2167 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
2168 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
2169 };
2170 ftof12ya[j] = new TPolyLine(4,xc,yc);
2171 ftof12ya[j]->SetLineColor(1);
2172 if ( var.bw ){
2173 colo = -1;
2174 } else {
2175 colo = 1;
2176 };
2177 ColorMIP(ms12a[rj],colo);
2178 //
2179 if ( colo != 10 ) ocolo = colo;
2180 if ( mt12[0][rj] == 4095. ) colo = noadc;
2181 //
2182 ftof12ya[j]->SetFillColor(colo);
2183 ftof12ya[j]->SetLineWidth(1);
2184 ftof12ya[j]->Draw("f");
2185 ftof12ya[j]->Draw();
2186 };
2187 // B
2188 s12p = 0.055;
2189 TPolyLine *ftof12yb[6];
2190 rj=6;
2191 for ( Int_t j=0; j<6; j++){
2192 rj--;
2193 Float_t xc1[4]={ (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
2194 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
2195 Float_t xc[4];
2196 Float_t yc[4];
2197 for (Int_t i = 0; i<4 ; i++) {
2198 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
2199 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
2200 };
2201 ftof12yb[j] = new TPolyLine(4,xc,yc);
2202 ftof12yb[j]->SetLineColor(1);
2203 if ( var.bw ){
2204 colo = -1;
2205 } else {
2206 colo = 1;
2207 };
2208 ColorMIP(ms12b[rj],colo);
2209 //
2210 if ( colo != 10 ) ocolo = colo;
2211 if ( mt12[1][rj] == 4095. ) colo = noadc;
2212 //
2213 ftof12yb[j]->SetFillColor(colo);
2214 ftof12yb[j]->SetLineWidth(1);
2215 ftof12yb[j]->Draw("f");
2216 ftof12yb[j]->Draw();
2217 };
2218 //
2219 // S12 X-view
2220 //
2221 if ( true ){
2222 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
2223 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2224 Float_t nxc[5];
2225 Float_t nyc[5];
2226 for (Int_t i = 0; i<5 ; i++) {
2227 nxc[i]= xs2x + nxc1[i]*var.sfx;
2228 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2229 };
2230 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
2231 ftof12x->SetLineColor(1);
2232 ftof12x->SetFillColor(ocolo);
2233 ftof12x->SetLineWidth(1);
2234 ftof12x->Draw("f");
2235 ftof12x->Draw();
2236 };
2237
2238 //
2239 // S21 Y-view
2240 //
2241 // A
2242 Float_t s21p = 0.075;
2243 ocolo = 10;
2244 TPolyLine *ftof21ya[2];
2245 rj=2;
2246 for ( Int_t j=0; j<2; j++){
2247 rj--;
2248 Float_t xc1[4]={ s21p*(j-1), s21p*(j-1), s21p*j, s21p*(j-1)};
2249 Float_t yc1[4]={ 0., ws2, ws2, 0.};
2250 Float_t xc[4];
2251 Float_t yc[4];
2252 for (Int_t i = 0; i<4 ; i++) {
2253 xc[i]= xs2y + xc1[i]*var.sfx;
2254 yc[i] = ys2y + yc1[i]*var.sfy;
2255 };
2256 ftof21ya[j] = new TPolyLine(4,xc,yc);
2257 ftof21ya[j]->SetLineColor(1);
2258 if ( var.bw ){
2259 colo = -1;
2260 } else {
2261 colo = 1;
2262 };
2263 ColorMIP(ms21a[rj],colo);
2264 //
2265 if ( colo != 10 ) ocolo = colo;
2266 if ( mt21[0][rj] == 4095. ) colo = noadc;
2267 //
2268 ftof21ya[j]->SetFillColor(colo);
2269 ftof21ya[j]->SetLineWidth(1);
2270 ftof21ya[j]->Draw("f");
2271 ftof21ya[j]->Draw();
2272 };
2273 // B
2274 s21p = 0.075;
2275 TPolyLine *ftof21yb[2];
2276 rj=2;
2277 for ( Int_t j=0; j<2; j++){
2278 rj--;
2279 Float_t xc1[4]={ s21p*(j-1), s21p*j, s21p*j, s21p*(j-1)};
2280 Float_t yc1[4]={ 0., 0., ws2, 0.};
2281 Float_t xc[4];
2282 Float_t yc[4];
2283 for (Int_t i = 0; i<4 ; i++) {
2284 xc[i]= xs2y + xc1[i]*var.sfx;
2285 yc[i] = ys2y + yc1[i]*var.sfy;
2286 };
2287 ftof21yb[j] = new TPolyLine(4,xc,yc);
2288 ftof21yb[j]->SetLineColor(1);
2289 if ( var.bw ){
2290 colo = -1;
2291 } else {
2292 colo = 1;
2293 };
2294 ColorMIP(ms21b[rj],colo);
2295 //
2296 if ( colo != 10 ) ocolo = colo;
2297 if ( mt21[1][rj] == 4095. ) colo = noadc;
2298 //
2299 ftof21yb[j]->SetFillColor(colo);
2300 ftof21yb[j]->SetLineWidth(1);
2301 ftof21yb[j]->Draw("f");
2302 ftof21yb[j]->Draw();
2303 };
2304 //
2305 // S21 X-view
2306 //
2307 if ( true ){
2308 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2309 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
2310 Float_t nxc[5];
2311 Float_t nyc[5];
2312 for (Int_t i = 0; i<5 ; i++) {
2313 nxc[i]= xs2x + nxc1[i]*var.sfx;
2314 nyc[i] = ys2x + nyc1[i]*var.sfy;
2315 };
2316 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
2317 ftof21x->SetLineColor(1);
2318 ftof21x->SetFillColor(ocolo);
2319 ftof21x->SetLineWidth(1);
2320 ftof21x->Draw("f");
2321 ftof21x->Draw();
2322 };
2323 //
2324 // S22 X-view
2325 //
2326 // A
2327 Float_t s22p = 0.090;
2328 ocolo = 10;
2329 TPolyLine *ftof22xa[2];
2330 for ( Int_t j=0; j<2; j++){
2331 Float_t xc1[4]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*(j-1)};
2332 Float_t yc1[4]={ -ws2, 0., 0., -ws2};
2333 Float_t xc[4];
2334 Float_t yc[4];
2335 for (Int_t i = 0; i<4 ; i++) {
2336 xc[i]= xs2x + xc1[i]*var.sfx;
2337 yc[i] = ys2x + yc1[i]*var.sfy;
2338 };
2339 ftof22xa[j] = new TPolyLine(4,xc,yc);
2340 ftof22xa[j]->SetLineColor(1);
2341 if ( var.bw ){
2342 colo = -1;
2343 } else {
2344 colo = 1;
2345 };
2346 ColorMIP(ms22a[j],colo);
2347 //
2348 if ( colo != 10 ) ocolo = colo;
2349 if ( mt22[0][j] == 4095. ) colo = noadc;
2350 //
2351 ftof22xa[j]->SetFillColor(colo);
2352 ftof22xa[j]->SetLineWidth(1);
2353 ftof22xa[j]->Draw("f");
2354 ftof22xa[j]->Draw();
2355 };
2356 // B
2357 s22p = 0.090;
2358 TPolyLine *ftof22xb[2];
2359 for ( Int_t j=0; j<2; j++){
2360 Float_t xc1[4]={ s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
2361 Float_t yc1[4]={ -ws2, -ws2, 0., -ws2};
2362 Float_t xc[4];
2363 Float_t yc[4];
2364 for (Int_t i = 0; i<4 ; i++) {
2365 xc[i]= xs2x + xc1[i]*var.sfx;
2366 yc[i] = ys2x + yc1[i]*var.sfy;
2367 };
2368 ftof22xb[j] = new TPolyLine(4,xc,yc);
2369 ftof22xb[j]->SetLineColor(1);
2370 if ( var.bw ){
2371 colo = -1;
2372 } else {
2373 colo = 1;
2374 };
2375 ColorMIP(ms22b[j],colo);
2376 //
2377 if ( colo != 10 ) ocolo = colo;
2378 if ( mt22[1][j] == 4095. ) colo = noadc;
2379 //
2380 ftof22xb[j]->SetFillColor(colo);
2381 ftof22xb[j]->SetLineWidth(1);
2382 ftof22xb[j]->Draw("f");
2383 ftof22xb[j]->Draw();
2384 };
2385 //
2386 // S22 Y-view
2387 //
2388 if ( true ){
2389 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2390 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
2391 Float_t nxc[5];
2392 Float_t nyc[5];
2393 for (Int_t i = 0; i<5 ; i++) {
2394 nxc[i]= xs2y + nxc1[i]*var.sfx;
2395 nyc[i] = ys2y + nyc1[i]*var.sfy;
2396 };
2397 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
2398 ftof22y->SetLineColor(1);
2399 ftof22y->SetFillColor(ocolo);
2400 ftof22y->SetLineWidth(1);
2401 ftof22y->Draw("f");
2402 ftof22y->Draw();
2403 };
2404
2405 //
2406 // S31 X-view
2407 //
2408 // A
2409 Float_t s31p = 0.060;
2410 ocolo = 10;
2411 TPolyLine *ftof31xa[3];
2412 rj=3;
2413 for ( Int_t j=0; j<3; j++){
2414 rj--;
2415 Float_t xc1[4]={ (s31p*j), (s31p*j), s31p*(j+1), (s31p*j)};
2416 Float_t yc1[4]={ 0., ws13, ws13, 0.};
2417 Float_t xc[4];
2418 Float_t yc[4];
2419 for (Int_t i = 0; i<4 ; i++) {
2420 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
2421 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
2422 };
2423 ftof31xa[j] = new TPolyLine(4,xc,yc);
2424 ftof31xa[j]->SetLineColor(1);
2425 if ( var.bw ){
2426 colo = -1;
2427 } else {
2428 colo = 1;
2429 };
2430 ColorMIP(ms31a[rj],colo);
2431 //
2432 if ( colo != 10 ) ocolo = colo;
2433 if ( mt31[0][rj] == 4095. ) colo = noadc;
2434 //
2435 ftof31xa[j]->SetFillColor(colo);
2436 ftof31xa[j]->SetLineWidth(1);
2437 ftof31xa[j]->Draw("f");
2438 ftof31xa[j]->Draw();
2439 };
2440 // B
2441 s31p = 0.060;
2442 TPolyLine *ftof31xb[3];
2443 rj=3;
2444 for ( Int_t j=0; j<3; j++){
2445 rj--;
2446 Float_t xc1[4]={ (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
2447 Float_t yc1[4]={ 0., 0., ws13, 0.};
2448 Float_t xc[4];
2449 Float_t yc[4];
2450 for (Int_t i = 0; i<4 ; i++) {
2451 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
2452 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
2453 };
2454 ftof31xb[j] = new TPolyLine(4,xc,yc);
2455 ftof31xb[j]->SetLineColor(1);
2456 if ( var.bw ){
2457 colo = -1;
2458 } else {
2459 colo = 1;
2460 };
2461 ColorMIP(ms31b[rj],colo);
2462 //
2463 if ( colo != 10 ) ocolo = colo;
2464 if ( mt31[1][rj] == 4095. ) colo = noadc;
2465 //
2466 ftof31xb[j]->SetFillColor(colo);
2467 ftof31xb[j]->SetLineWidth(1);
2468 ftof31xb[j]->Draw("f");
2469 ftof31xb[j]->Draw();
2470 };
2471 //
2472 // S31 Y-view
2473 //
2474 if ( true ){
2475 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
2476 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2477 Float_t nxc[5];
2478 Float_t nyc[5];
2479 for (Int_t i = 0; i<5 ; i++) {
2480 nxc[i]= xs2y + nxc1[i]*var.sfx;
2481 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
2482 };
2483 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
2484 ftof31y->SetLineColor(1);
2485 ftof31y->SetFillColor(ocolo);
2486 ftof31y->SetLineWidth(1);
2487 ftof31y->Draw("f");
2488 ftof31y->Draw();
2489 };
2490 //
2491 // S32 Y-view
2492 //
2493 Float_t s32p = 0.050;
2494 ocolo = 10;
2495 TPolyLine *ftof32ya[3];
2496 rj=3;
2497 for ( Int_t j=0; j<3; j++){
2498 rj--;
2499 Float_t xc1[4]={ (s32p*j), (s32p*j), s32p*(j+1), (s32p*j)};
2500 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
2501 Float_t xc[4];
2502 Float_t yc[4];
2503 for (Int_t i = 0; i<4 ; i++) {
2504 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
2505 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
2506 };
2507 ftof32ya[j] = new TPolyLine(4,xc,yc);
2508 ftof32ya[j]->SetLineColor(1);
2509 if ( var.bw ){
2510 colo = -1;
2511 } else {
2512 colo = 1;
2513 };
2514 ColorMIP(ms32a[rj],colo);
2515 //
2516 if ( colo != 10 ) ocolo = colo;
2517 if ( mt32[0][rj] == 4095. ) colo = noadc;
2518 //
2519 ftof32ya[j]->SetFillColor(colo);
2520 ftof32ya[j]->SetLineWidth(1);
2521 ftof32ya[j]->Draw("f");
2522 ftof32ya[j]->Draw();
2523 };
2524 s32p = 0.050;
2525 TPolyLine *ftof32yb[3];
2526 rj=3;
2527 for ( Int_t j=0; j<3; j++){
2528 rj--;
2529 Float_t xc1[4]={ (s32p*j), s32p*(j+1), s32p*(j+1), (s32p*j)};
2530 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
2531 Float_t xc[4];
2532 Float_t yc[4];
2533 for (Int_t i = 0; i<4 ; i++) {
2534 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
2535 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
2536 };
2537 ftof32yb[j] = new TPolyLine(4,xc,yc);
2538 ftof32yb[j]->SetLineColor(1);
2539 if ( var.bw ){
2540 colo = -1;
2541 } else {
2542 colo = 1;
2543 };
2544 ColorMIP(ms32b[rj],colo);
2545 //
2546 if ( colo != 10 ) ocolo = colo;
2547 if ( mt32[1][rj] == 4095. ) colo = noadc;
2548 //
2549 ftof32yb[j]->SetFillColor(colo);
2550 ftof32yb[j]->SetLineWidth(1);
2551 ftof32yb[j]->Draw("f");
2552 ftof32yb[j]->Draw();
2553 };
2554 //
2555 // S32 X-view
2556 //
2557 if ( true ){
2558 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
2559 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
2560 Float_t nxc[5];
2561 Float_t nyc[5];
2562 for (Int_t i = 0; i<5 ; i++) {
2563 nxc[i]= xs2x + nxc1[i]*var.sfx;
2564 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
2565 };
2566 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
2567 ftof32x->SetLineColor(1);
2568 ftof32x->SetFillColor(ocolo);
2569 ftof32x->SetLineWidth(1);
2570 ftof32x->Draw("f");
2571 ftof32x->Draw();
2572 };
2573 return;
2574 };
2575 //
2576 // CALIBRATED DATA (LEVEL -1 and 2)
2577 //
2578 // the channels MAP:
2579 //
2580 Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
2581 Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
2582 Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
2583 Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
2584
2585 Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
2586 Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
2587 Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
2588 Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
2589
2590 Int_t ch21a[2] = { 0, 0};
2591 Int_t hb21a[2] = { 0, 4};
2592 Int_t ch21b[2] = { 1, 0};
2593 Int_t hb21b[2] = { 8, 6};
2594
2595 Int_t ch22a[2] = { 0, 0};
2596 Int_t hb22a[2] = { 2, 8};
2597 Int_t ch22b[2] = { 1, 0};
2598 Int_t hb22b[2] = { 10, 10};
2599
2600 Int_t ch31a[3] = { 1, 2, 2};
2601 Int_t hb31a[3] = { 6, 8, 10};
2602 Int_t ch31b[3] = { 1, 1, 1};
2603 Int_t hb31b[3] = { 4, 2, 0};
2604
2605 Int_t ch32a[3] = { 2, 2, 3};
2606 Int_t hb32a[3] = { 0, 4, 8};
2607 Int_t ch32b[3] = { 2, 2, 3};
2608 Int_t hb32b[3] = { 2, 6, 10};
2609 //
2610 // ADC values
2611 //
2612 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2613 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
2614 Float_t ms21a[2] = {0.,0.};
2615 Float_t ms22a[2] = {0.,0.};
2616 Float_t ms31a[3] = {0.,0.,0.};
2617 Float_t ms32a[3] = {0.,0.,0.};
2618 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2619 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
2620 Float_t ms21b[2] = {0.,0.};
2621 Float_t ms22b[2] = {0.,0.};
2622 Float_t ms31b[3] = {0.,0.,0.};
2623 Float_t ms32b[3] = {0.,0.,0.};
2624 //
2625 // default calibrations
2626 //
2627 Float_t xp11[8];
2628 Float_t A11[8] = {-19.,-9.6,-25.7,-13.1,-30.9,-21.1,-11.7,-15.9};
2629 Float_t B11[8] = {-2.6,-2.6,-2.3,-2.4,-2.4,-2.8,-2.75,-2.5};
2630 Float_t E11[8] = {2.6,2.6,2.6,2.6,2.6,2.6,2.6,2.6};
2631 Float_t xp12[6];
2632 Float_t A12[6] = {11.6,16.6,5.9,-22.2,-18.0,-14.2};
2633 Float_t B12[6] = {-2.309,-2.424,-1.958,-2.092,-2.241,-2.144};
2634 Float_t E12[6] = {2.6,2.6,2.6,2.6,2.6,2.6};
2635 Float_t xp21[2];
2636 Float_t A21[2] = {12.5, 21.7};
2637 Float_t B21[2] = {-1.492,-1.519};
2638 Float_t E21[2] = {2.2,2.2};
2639 Float_t xp22[2];
2640 Float_t A22[2] = {-27.0, -45.8};
2641 Float_t B22[2] = {-1.897,-1.477};
2642 Float_t E22[2] = {2.9,2.9};
2643 Float_t xp31[3];
2644 Float_t A31[3] = {-25.1, -41.4, -33.9};
2645 Float_t B31[3] = {-3.374,-3.793,-3.495};
2646 Float_t E31[3] = {1.2,1.2,1.2};
2647 Float_t xp32[3];
2648 Float_t A32[3] = {1.3, 3.9, -22.0};
2649 Float_t B32[3] = {-3.134,-3.526,-3.417};
2650 Float_t E32[3] = {2.3,2.3,2.3};
2651 //
2652 // TDC info for each PMT
2653 //
2654 Float_t mt11[2][8];
2655 Float_t mt12[2][6];
2656 Float_t mt21[2][2];
2657 Float_t mt22[2][2];
2658 Float_t mt31[2][3];
2659 Float_t mt32[2][3];
2660 Int_t noadc = 12;
2661 if ( var.bw ){
2662 noadc = 12;
2663 } else {
2664 noadc = 41;
2665 };
2666 //
2667 Int_t ii = 0;
2668 if ( level.file == -1 ){
2669 for ( Int_t i = 0; i<8; i++ ) {
2670 mt11[0][i] = tof->tdc[ch11a[i]][hb11a[i]];
2671 mt11[1][i] = tof->tdc[ch11b[i]][hb11b[i]];
2672 ms11a[i] = tof->adc[ch11a[i]][hb11a[i]];
2673 ms11b[i] = tof->adc[ch11b[i]][hb11b[i]];
2674 xp11[i] = ( -A11[i] + (mt11[0][i]-mt11[1][i]) / 2. ) / B11[i] ;
2675 if ( ms11a[i] == 4095. ) {
2676 ms11a[i] = 0.;
2677 } else {
2678 ms11a[i] = 1.;
2679 };
2680 if ( ms11b[i] == 4095. ) {
2681 ms11b[i] = 0.;
2682 } else {
2683 ms11b[i] = 1.;
2684 };
2685 };
2686 for ( Int_t i = 0; i<6; i++ ) {
2687 mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]];
2688 mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]];
2689 ms12a[i] = tof->adc[ch12a[i]][hb12a[i]];
2690 ms12b[i] = tof->adc[ch12b[i]][hb12b[i]];
2691 xp12[i] = ( -A12[i] + (mt12[0][i]-mt12[1][i]) / 2. ) / B12[i] ;
2692 if ( ms12a[i] == 4095. ){
2693 ms12a[i] = 0.;
2694 } else {
2695 ms12a[i] = 1.;
2696 };
2697 if ( ms12b[i] == 4095. ){
2698 ms12b[i] = 0.;
2699 } else {
2700 ms12b[i] = 1.;
2701 };
2702 };
2703 ii = 2;
2704 for ( Int_t i = 0; i<2; i++ ) {
2705 ii--;
2706 mt21[0][ii] = tof->tdc[ch21a[i]][hb21a[i]];
2707 mt21[1][ii] = tof->tdc[ch21b[i]][hb21b[i]];
2708 ms21a[ii] = tof->adc[ch21a[i]][hb21a[i]];
2709 ms21b[ii] = tof->adc[ch21b[i]][hb21b[i]];
2710 xp21[ii] = ( -A21[ii] + (mt21[0][ii]-mt21[1][ii]) / 2. ) / B21[ii] ;
2711 if ( ms21a[ii] == 4095. ){
2712 ms21a[ii] = 0.;
2713 } else {
2714 ms21a[ii] = 1.;
2715 };
2716 if ( ms21b[ii] == 4095. ){
2717 ms21b[ii] = 0.;
2718 } else {
2719 ms21b[ii] = 1.;
2720 };
2721 };
2722 for ( Int_t i = 0; i<2; i++ ) {
2723 mt22[0][i] = tof->tdc[ch22a[i]][hb22a[i]];
2724 mt22[1][i] = tof->tdc[ch22b[i]][hb22b[i]];
2725 ms22a[i] = tof->adc[ch22a[i]][hb22a[i]];
2726 ms22b[i] = tof->adc[ch22b[i]][hb22b[i]];
2727 xp22[i] = ( -A22[i] + (mt22[0][i]-mt22[1][i]) / 2. ) / B22[i] ;
2728 if ( ms22a[i] == 4095. ){
2729 ms22a[i] = 0.;
2730 } else {
2731 ms22a[i] = 1.;
2732 };
2733 if ( ms22b[i] == 4095. ){
2734 ms22b[i] = 0.;
2735 } else {
2736 ms22b[i] = 1.;
2737 };
2738 };
2739 for ( Int_t i = 0; i<3; i++ ) {
2740 mt31[0][i] = tof->tdc[ch31a[i]][hb31a[i]];
2741 mt31[1][i] = tof->tdc[ch31b[i]][hb31b[i]];
2742 ms31a[i] = tof->adc[ch31a[i]][hb31a[i]];
2743 ms31b[i] = tof->adc[ch31b[i]][hb31b[i]];
2744 xp31[i] = ( -A31[i] + (mt31[0][i]-mt31[1][i]) / 2. ) / B31[i] ;
2745 if ( ms31a[i] == 4095. ){
2746 ms31a[i] = 0.;
2747 } else {
2748 ms31a[i] = 1.;
2749 };
2750 if ( ms31b[i] == 4095. ){
2751 ms31b[i] = 0.;
2752 } else {
2753 ms31b[i] = 1.;
2754 };
2755 };
2756 for ( Int_t i = 0; i<3; i++ ) {
2757 mt32[0][i] = tof->tdc[ch32a[i]][hb32a[i]];
2758 mt32[1][i] = tof->tdc[ch32b[i]][hb32b[i]];
2759 ms32a[i] = tof->adc[ch32a[i]][hb32a[i]];
2760 ms32b[i] = tof->adc[ch32b[i]][hb32b[i]];
2761 xp32[i] = ( -A32[i] + (mt32[0][i]-mt32[1][i]) / 2. ) / B32[i] ;
2762 if ( ms32a[i] == 4095. ){
2763 ms32a[i] = 0.;
2764 } else {
2765 ms32a[i] = 1.;
2766 };
2767 if ( ms32b[i] == 4095. ){
2768 ms32b[i] = 0.;
2769 } else {
2770 ms32b[i] = 1.;
2771 };
2772 };
2773 };
2774 //
2775 //
2776 //
2777 Bool_t repeat = true;
2778 Int_t numtr = 1;
2779 // Int_t numtr = 0;
2780 Int_t repuntil = 0;
2781 //
2782 //
2783 var.tofraw = 0;
2784 //
2785 if ( level.file == 2 ) repuntil = L2->GetToFLevel2()->ntrk();
2786 // printf("repuntil = %i \n",repuntil);
2787 //if ( level.file == 2 ) repuntil = L2->GetTrkLevel2()->GetNTracks();
2788 //repuntil = L2->GetNTracks();
2789 //
2790 while ( repeat ){
2791 // printf("B repuntil = %i \n",repuntil);
2792 if ( level.file == 2 ){
2793 //
2794 //
2795 //
2796 ToFTrkVar *ptt = 0;
2797 // PamTrack *ptrack = 0;
2798 Float_t adc[4][12];
2799 Float_t tdc[4][12];
2800 memset(adc,0,4*12*sizeof(Float_t));
2801 memset(tdc,0,4*12*sizeof(Float_t));
2802 //
2803 //
2804 // if ( repuntil == 0 || var.tofraw ){
2805 if ( repuntil == 1 || var.tofraw ){
2806 numtr = 0;
2807 ptt = L2->GetToFLevel2()->GetToFTrkVar(0);
2808 repeat = false;
2809 } else {
2810 //
2811 //
2812 if ( numtr >= repuntil-1 ) repeat = false;
2813 //
2814 // printf(" numtr is %i \n",numtr);
2815 ptt = L2->GetToFLevel2()->GetToFTrkVar(numtr);
2816 //ptrack = L2->GetTrack(numtr);
2817 //ptt = ptrack->GetToFTrack();
2818 };
2819 //
2820 xp11[0] = 0.;
2821 xp12[0] = 0.;
2822 xp21[0] = 0.;
2823 xp22[0] = 0.;
2824 xp31[0] = 0.;
2825 xp32[0] = 0.;
2826 //
2827 //
2828 //
2829 ii = 2;
2830 //
2831 Int_t myseq = ptt->trkseqno + 1;
2832 L2->GetToFLevel2()->GetMatrix(myseq,adc,tdc);
2833 //
2834 // printf(" qua \n");
2835 //
2836 for ( Int_t i = 0; i<8; i++ ) {
2837 if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
2838 ms11a[i] = adc[ch11a[i]][hb11a[i]];
2839 };
2840 if ( adc[ch11b[i]][hb11b[i]] < 1000. ){
2841 ms11b[i] = adc[ch11b[i]][hb11b[i]];
2842 };
2843 // xp11[i] = 0.;
2844 };
2845
2846 Int_t nmtof = 0;
2847 Float_t mtof = 0.;
2848 var.beta[4] = 0.;
2849 if ( ptt->beta[12] != 0. && ptt->beta[12] != 100. ){
2850 var.beta[4] = ptt->beta[12];
2851 } else {
2852 for (Int_t tf = 0; tf<12 ;tf++){
2853 if ( ptt->beta[tf] != 0. && ptt->beta[tf] != 100.){
2854 mtof += ptt->beta[tf];
2855 nmtof++;
2856 };
2857 };
2858 if ( nmtof ){
2859 var.beta[4] = mtof/nmtof;
2860 } else {
2861 var.beta[4] = 0.;
2862 };
2863 };
2864 ii = 2;
2865 //
2866 for ( Int_t i = 0; i<8; i++ ) {
2867 if ( adc[ch11a[i]][hb11a[i]] < 1000. ){
2868 ms11a[i] = adc[ch11a[i]][hb11a[i]];
2869 };
2870 if ( adc[ch11b[i]][hb11b[i]] < 1000. ){
2871 ms11b[i] = adc[ch11b[i]][hb11b[i]];
2872 };
2873 xp11[i] = 0.;
2874 };
2875 //
2876 xp11[0] = ptt->ytofpos[0];
2877 //
2878 for ( Int_t i = 0; i<6; i++ ) {
2879 if ( adc[ch12a[i]][hb12a[i]] < 1000. ) ms12a[i] = adc[ch12a[i]][hb12a[i]];
2880 if ( adc[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = adc[ch12b[i]][hb12b[i]];
2881 xp12[i] = 0.;
2882 };
2883 //
2884 xp12[0] = ptt->xtofpos[0];
2885 //
2886 ii = 2;
2887 for ( Int_t i = 0; i<2; i++ ) {
2888 ii--;
2889 if ( adc[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = adc[ch21a[i]][hb21a[i]];
2890 if ( adc[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = adc[ch21b[i]][hb21b[i]];
2891 xp21[i] = 0.;
2892 };
2893 xp21[0] = ptt->xtofpos[1];
2894 //
2895 for ( Int_t i = 0; i<2; i++ ) {
2896 if ( adc[ch22a[i]][hb22a[i]] < 1000. ) ms22a[i] = adc[ch22a[i]][hb22a[i]];
2897 if ( adc[ch22b[i]][hb22b[i]] < 1000. ) ms22b[i] = adc[ch22b[i]][hb22b[i]];
2898 xp22[i] = 0.;
2899 };
2900 xp22[0] = ptt->ytofpos[1];
2901 //
2902 for ( Int_t i = 0; i<3; i++ ) {
2903 if ( adc[ch31a[i]][hb31a[i]] < 1000. ) ms31a[i] = adc[ch31a[i]][hb31a[i]];
2904 if ( adc[ch31b[i]][hb31b[i]] < 1000. ) ms31b[i] = adc[ch31b[i]][hb31b[i]];
2905 xp31[i] = 0.;
2906 };
2907 xp31[0] = ptt->ytofpos[2];
2908 //
2909 for ( Int_t i = 0; i<3; i++ ) {
2910 if ( adc[ch32a[i]][hb32a[i]] < 1000. ) ms32a[i] = adc[ch32a[i]][hb32a[i]];
2911 if ( adc[ch32b[i]][hb32b[i]] < 1000. ) ms32b[i] = adc[ch32b[i]][hb32b[i]];
2912 xp32[i] = 0.;
2913 };
2914 xp32[0] = ptt->xtofpos[2];
2915 //
2916 numtr++;
2917 //numtr = repuntil+10;
2918 // repeat = false;
2919 // printf("pre drawingdrawing... %i %i\n",numtr,ptt->trkseqno);
2920 //
2921 }; // end if level2
2922 //
2923 //
2924 // drawtof:
2925 //
2926 // printf("drawingdrawing... %i \n",repuntil);
2927 //
2928 Int_t colo = 0;
2929 Int_t ocolo = 0;
2930 Float_t xs2x = var.xxvc;
2931 Float_t ys2x = var.yxvc + 0.36*var.sfy;
2932 Float_t xs2y = var.xyvc;
2933 Float_t ys2y = var.yyvc + 0.36*var.sfy;
2934 Float_t ws2 = 0.005;
2935 Float_t ws13 = 0.007;
2936 //
2937 // S11 X-view
2938 //
2939 Float_t s11p = 0.051;
2940 ocolo = 10;
2941 TPolyLine *ftof11x[8];
2942 for ( Int_t j=0; j<8; j++){
2943 Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
2944 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
2945 Float_t nxc[5];
2946 Float_t nyc[5];
2947 for (Int_t i = 0; i<5 ; i++) {
2948 nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
2949 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
2950 };
2951 ftof11x[j] = new TPolyLine(5,nxc,nyc);
2952 ftof11x[j]->SetLineColor(1);
2953 if ( var.bw ){
2954 colo = -1;
2955 } else {
2956 colo = 1;
2957 };
2958 if ( level.file == -1 ){
2959 ColorMIP(ms11a[j]+ms11b[j],colo);
2960 } else {
2961 ColorTOFMIP(ms11a[j]+ms11b[j],colo);
2962 };
2963 //
2964 if ( colo != 10 ) ocolo = colo;
2965 //
2966 ftof11x[j]->SetFillColor(colo);
2967 ftof11x[j]->SetLineWidth(1);
2968 ftof11x[j]->Draw("f");
2969 ftof11x[j]->Draw();
2970 };
2971 //
2972 // S11 Y-view
2973 //
2974 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
2975 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
2976 Float_t nxc[5];
2977 Float_t nyc[5];
2978 for (Int_t i = 0; i<5 ; i++) {
2979 nxc[i]= xs2y + nxc1[i]*var.sfx;
2980 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
2981 };
2982 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
2983 ftof11y->SetFillStyle(4000);
2984 ftof11y->SetFillColor(0);
2985 ftof11y->SetLineColor(1);
2986 ftof11y->SetLineWidth(1);
2987 ftof11y->Draw("f");
2988 ftof11y->Draw();
2989 TPolyLine *sftof11[8];
2990 tt = 1;
2991 rj=1;
2992 if ( level.file == -1 ){
2993 tt = 8;
2994 rj = 8;
2995 };
2996 for ( Int_t j=0; j<tt; j++){
2997 rj--;
2998 if ( (mt11[0][rj]<4095. || mt11[1][rj]<4095.)){
2999 if ( ocolo == 10 ) ocolo = noadc;
3000 Float_t lowp = -(xp11[rj]+E11[rj])/100.;
3001 Float_t higp = -(xp11[rj]-E11[rj])/100.;
3002 if ( lowp < -0.164 ) lowp = -0.164;
3003 if ( higp > 0.164 ) higp = 0.164;
3004 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp11[rj] != 0.))){
3005 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3006 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
3007 Float_t nxc[5];
3008 Float_t nyc[5];
3009 for (Int_t i = 0; i<5 ; i++) {
3010 nxc[i]= xs2y + nxc1[i]*var.sfx;
3011 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3012 };
3013 sftof11[j] = new TPolyLine(5,nxc,nyc);
3014 sftof11[j]->SetLineColor(ocolo);
3015 sftof11[j]->SetFillColor(ocolo);
3016 sftof11[j]->SetLineWidth(1);
3017 sftof11[j]->Draw("f");
3018 sftof11[j]->Draw();
3019 };
3020 };
3021 };
3022
3023 //
3024 // S12 Y-view
3025 //
3026 Float_t s12p = 0.055;
3027 ocolo = 10;
3028 TPolyLine *ftof12y[6];
3029 rj = 6;
3030 for ( Int_t j=0; j<6; j++){
3031 rj--;
3032 Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
3033 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
3034 Float_t nxc[5];
3035 Float_t nyc[5];
3036 for (Int_t i = 0; i<5 ; i++) {
3037 nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
3038 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3039 };
3040 ftof12y[j] = new TPolyLine(5,nxc,nyc);
3041 ftof12y[j]->SetLineColor(1);
3042 if ( var.bw ){
3043 colo = -1;
3044 } else {
3045 colo = 1;
3046 };
3047 if ( level.file == -1 ){
3048 ColorMIP(ms12a[rj]+ms12b[rj],colo);
3049 } else {
3050 ColorTOFMIP(ms12a[rj]+ms12b[rj],colo);
3051 };
3052 //
3053 if ( colo != 10 ) ocolo = colo;
3054 //
3055 ftof12y[j]->SetFillColor(colo);
3056 ftof12y[j]->SetLineWidth(1);
3057 ftof12y[j]->Draw("f");
3058 ftof12y[j]->Draw();
3059 };
3060 //
3061 // S12 X-view
3062 //
3063 if ( true ){
3064 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
3065 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
3066 Float_t nxc[5];
3067 Float_t nyc[5];
3068 for (Int_t i = 0; i<5 ; i++) {
3069 nxc[i]= xs2x + nxc1[i]*var.sfx;
3070 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3071 };
3072 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
3073 ftof12x->SetLineColor(1);
3074 ftof12x->SetFillStyle(4000);
3075 ftof12x->SetFillColor(0);
3076 ftof12x->SetLineWidth(1);
3077 ftof12x->Draw("f");
3078 ftof12x->Draw();
3079 TPolyLine *sftof12[6];
3080 tt = 1;
3081 if ( level.file == -1 ) tt = 6;
3082 for (Int_t j=0; j<tt; j++){
3083 // for ( Int_t j=0; j<6; j++){
3084 if ( (mt12[0][j]<4095. || mt12[1][j]<4095.) ){
3085 if ( ocolo == 10 ) ocolo = noadc;
3086 Float_t lowp = (xp12[j]-E12[j])/100.;
3087 Float_t higp = (xp12[j]+E12[j])/100.;
3088 if ( lowp < -0.203 ) lowp = -0.203;
3089 if ( higp > 0.203 ) higp = 0.203;
3090 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp12[j] != 0.))){
3091 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3092 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
3093 Float_t nxc[5];
3094 Float_t nyc[5];
3095 for (Int_t i = 0; i<5 ; i++) {
3096 nxc[i]= xs2x + nxc1[i]*var.sfx;
3097 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3098 };
3099 sftof12[j] = new TPolyLine(5,nxc,nyc);
3100 sftof12[j]->SetLineColor(ocolo);
3101 sftof12[j]->SetFillColor(ocolo);
3102 sftof12[j]->SetLineWidth(1);
3103 sftof12[j]->Draw("f");
3104 sftof12[j]->Draw();
3105 };
3106 };
3107 };
3108 };
3109 //
3110
3111 //
3112 // S21 Y-view
3113 //
3114 Float_t s21p = 0.075;
3115 ocolo = 10;
3116 TPolyLine *ftof21y[2];
3117 rj=2;
3118 for ( Int_t j=0; j<2; j++){
3119 rj--;
3120 Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
3121 Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
3122 Float_t nxc[5];
3123 Float_t nyc[5];
3124 for (Int_t i = 0; i<5 ; i++) {
3125 nxc[i]= xs2y + nxc1[i]*var.sfx;
3126 nyc[i] = ys2y + nyc1[i]*var.sfy;
3127 };
3128 ftof21y[j] = new TPolyLine(5,nxc,nyc);
3129 ftof21y[j]->SetLineColor(1);
3130 if ( var.bw ){
3131 colo = -1;
3132 } else {
3133 colo = 1;
3134 };
3135 if ( level.file == -1 ){
3136 ColorMIP(ms21a[rj]+ms21b[rj],colo);
3137 } else {
3138 ColorTOFMIP(ms21a[rj]+ms21b[rj],colo);
3139 };
3140 //
3141 if ( colo != 10 ) ocolo = colo;
3142 //
3143 ftof21y[j]->SetFillColor(colo);
3144 ftof21y[j]->SetLineWidth(1);
3145 ftof21y[j]->Draw("f");
3146 ftof21y[j]->Draw();
3147 };
3148 //
3149 // S21 X-view
3150 //
3151 if ( true ){
3152 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
3153 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
3154 Float_t nxc[5];
3155 Float_t nyc[5];
3156 for (Int_t i = 0; i<5 ; i++) {
3157 nxc[i]= xs2x + nxc1[i]*var.sfx;
3158 nyc[i] = ys2x + nyc1[i]*var.sfy;
3159 };
3160 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
3161 ftof21x->SetLineColor(1);
3162 ftof21x->SetFillStyle(4000);
3163 ftof21x->SetFillColor(0);
3164 ftof21x->SetLineWidth(1);
3165 ftof21x->Draw("f");
3166 ftof21x->Draw();
3167 TPolyLine *sftof21[2];
3168 tt = 1;
3169 if ( level.file == -1 ) tt = 2;
3170 for ( Int_t j=0; j<tt; j++){
3171 // for ( Int_t j=0; j<2; j++){
3172 if ( (mt21[0][j]<4095. || mt21[1][j]<4095.) ){
3173 if ( ocolo == 10 ) ocolo = noadc;
3174 Float_t lowp = (xp21[j]-E21[j])/100.;
3175 Float_t higp = (xp21[j]+E21[j])/100.;
3176 if ( lowp < -0.089 ) lowp = -0.089;
3177 if ( higp > 0.089 ) higp = 0.089;
3178 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp21[j] != 0.))){
3179 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3180 Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
3181 Float_t nxc[5];
3182 Float_t nyc[5];
3183 for (Int_t i = 0; i<5 ; i++) {
3184 nxc[i]= xs2x + nxc1[i]*var.sfx;
3185 nyc[i] = ys2x + nyc1[i]*var.sfy;
3186 };
3187 sftof21[j] = new TPolyLine(5,nxc,nyc);
3188 sftof21[j]->SetLineColor(ocolo);
3189 sftof21[j]->SetFillColor(ocolo);
3190 sftof21[j]->SetLineWidth(1);
3191 sftof21[j]->Draw("f");
3192 sftof21[j]->Draw();
3193 };
3194 };
3195 };
3196 };
3197 //
3198
3199 //
3200 // S22 X-view
3201 //
3202 Float_t s22p = 0.090;
3203 ocolo = 10;
3204 TPolyLine *ftof22x[2];
3205 for ( Int_t j=0; j<2; j++){
3206 Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
3207 Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
3208 Float_t nxc[5];
3209 Float_t nyc[5];
3210 for (Int_t i = 0; i<5 ; i++) {
3211 nxc[i]= xs2x + nxc1[i]*var.sfx;
3212 nyc[i] = ys2x + nyc1[i]*var.sfy;
3213 };
3214 ftof22x[j] = new TPolyLine(5,nxc,nyc);
3215 ftof22x[j]->SetLineColor(1);
3216 if ( var.bw ){
3217 colo = -1;
3218 } else {
3219 colo = 1;
3220 };
3221 if ( level.file == -1 ){
3222 ColorMIP(ms22a[j]+ms22b[j],colo);
3223 } else {
3224 ColorTOFMIP(ms22a[j]+ms22b[j],colo);
3225 };
3226 //
3227 if ( colo != 10 ) ocolo = colo;
3228 //
3229 ftof22x[j]->SetFillColor(colo);
3230 ftof22x[j]->SetLineWidth(1);
3231 ftof22x[j]->Draw("f");
3232 ftof22x[j]->Draw();
3233 };
3234 //
3235 // S22 Y-view
3236 //
3237 if ( true ){
3238 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
3239 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
3240 Float_t nxc[5];
3241 Float_t nyc[5];
3242 for (Int_t i = 0; i<5 ; i++) {
3243 nxc[i]= xs2y + nxc1[i]*var.sfx;
3244 nyc[i] = ys2y + nyc1[i]*var.sfy;
3245 };
3246 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
3247 ftof22y->SetLineColor(1);
3248 ftof22y->SetFillStyle(4000);
3249 ftof22y->SetFillColor(0);
3250 ftof22y->SetLineWidth(1);
3251 ftof22y->Draw("f");
3252 ftof22y->Draw();
3253 TPolyLine *sftof22[2];
3254 tt = 1;
3255 rj = 1;
3256 if ( level.file == -1 ){
3257 tt = 2;
3258 rj = 2;
3259 };
3260 for (Int_t j=0; j<tt; j++){
3261 rj--;
3262 // for ( Int_t j=0; j<2; j++){
3263 if ( (mt22[0][rj]<4095. || mt22[1][rj]<4095.) ){
3264 if ( ocolo == 10 ) ocolo = noadc;
3265 Float_t lowp = -(xp22[rj]+E22[rj])/100.;
3266 Float_t higp = -(xp22[rj]-E22[rj])/100.;
3267 if ( lowp < -0.074 ) lowp = -0.074;
3268 if ( higp > 0.074 ) higp = 0.074;
3269 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp22[rj] != 0.))){
3270 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3271 Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
3272 Float_t nxc[5];
3273 Float_t nyc[5];
3274 for (Int_t i = 0; i<5 ; i++) {
3275 nxc[i]= xs2y + nxc1[i]*var.sfx;
3276 nyc[i] = ys2y + nyc1[i]*var.sfy;
3277 };
3278 sftof22[j] = new TPolyLine(5,nxc,nyc);
3279 sftof22[j]->SetLineColor(ocolo);
3280 sftof22[j]->SetFillColor(ocolo);
3281 sftof22[j]->SetLineWidth(1);
3282 sftof22[j]->Draw("f");
3283 sftof22[j]->Draw();
3284 };
3285 };
3286 };
3287 };
3288 //
3289 //daquiinbasso
3290 //
3291 // S31 X-view
3292 //
3293 Float_t s31p = 0.060;
3294 ocolo = 10;
3295 TPolyLine *ftof31x[3];
3296 for ( Int_t j=0; j<3; j++){
3297 Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
3298 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
3299 Float_t nxc[5];
3300 Float_t nyc[5];
3301 for (Int_t i = 0; i<5 ; i++) {
3302 nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
3303 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
3304 };
3305 ftof31x[j] = new TPolyLine(5,nxc,nyc);
3306 ftof31x[j]->SetLineColor(1);
3307 if ( var.bw ){
3308 colo = -1;
3309 } else {
3310 colo = 1;
3311 };
3312 if ( level.file == -1 ){
3313 ColorMIP(ms31a[j]+ms31b[j],colo);
3314 } else {
3315 ColorTOFMIP(ms31a[j]+ms31b[j],colo);
3316 };
3317 //
3318 if ( colo != 10 ) ocolo = colo;
3319 //
3320 ftof31x[j]->SetFillColor(colo);
3321 ftof31x[j]->SetLineWidth(1);
3322 ftof31x[j]->Draw("f");
3323 ftof31x[j]->Draw();
3324 };
3325 //
3326 // S31 Y-view
3327 //
3328 if ( true ){
3329 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
3330 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
3331 Float_t nxc[5];
3332 Float_t nyc[5];
3333 for (Int_t i = 0; i<5 ; i++) {
3334 nxc[i]= xs2y + nxc1[i]*var.sfx;
3335 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
3336 };
3337 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
3338 ftof31y->SetLineColor(1);
3339 ftof31y->SetFillStyle(4000);
3340 ftof31y->SetFillColor(0);
3341 ftof31y->SetLineWidth(1);
3342 ftof31y->Draw("f");
3343 ftof31y->Draw();
3344 TPolyLine *sftof31[3];
3345 tt = 1;
3346 rj = 1;
3347 if ( level.file == -1 ){
3348 tt = 3;
3349 rj = 3;
3350 };
3351 for (Int_t j=0; j<tt; j++){
3352 rj--;
3353 // for ( Int_t j=0; j<3; j++){
3354 if ( (mt31[0][rj]<4095. || mt31[1][rj]<4095.)){
3355 if ( ocolo == 10 ) ocolo = noadc;
3356 Float_t lowp = -(xp31[rj]+E31[rj])/100.;
3357 Float_t higp = -(xp31[rj]-E31[rj])/100.;
3358 if ( lowp < -0.074 ) lowp = -0.074;
3359 if ( higp > 0.074 ) higp = 0.074;
3360 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp31[rj] != 0.))){
3361 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3362 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
3363 Float_t nxc[5];
3364 Float_t nyc[5];
3365 for (Int_t i = 0; i<5 ; i++) {
3366 nxc[i]= xs2y + nxc1[i]*var.sfx;
3367 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
3368 };
3369 sftof31[j] = new TPolyLine(5,nxc,nyc);
3370 sftof31[j]->SetLineColor(ocolo);
3371 sftof31[j]->SetFillColor(ocolo);
3372 sftof31[j]->SetLineWidth(1);
3373 sftof31[j]->Draw("f");
3374 sftof31[j]->Draw();
3375 };
3376 };
3377 };
3378 };
3379 //
3380
3381 //
3382 // S32 Y-view
3383 //
3384 Float_t s32p = 0.050;
3385 ocolo = 10;
3386 TPolyLine *ftof32y[3];
3387 rj = 3;
3388 for ( Int_t j=0; j<3; j++){
3389 rj--;
3390 Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
3391 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
3392 Float_t nxc[5];
3393 Float_t nyc[5];
3394 for (Int_t i = 0; i<5 ; i++) {
3395 nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
3396 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
3397 };
3398 ftof32y[j] = new TPolyLine(5,nxc,nyc);
3399 ftof32y[j]->SetLineColor(1);
3400 if ( var.bw ){
3401 colo = -1;
3402 } else {
3403 colo = 1;
3404 };
3405 if ( level.file == -1 ){
3406 ColorMIP(ms32a[rj]+ms32b[rj],colo);
3407 } else {
3408 ColorTOFMIP(ms32a[rj]+ms32b[rj],colo);
3409 };
3410 //
3411 if ( colo != 10 ) ocolo = colo;
3412 //
3413 ftof32y[j]->SetFillColor(colo);
3414 ftof32y[j]->SetLineWidth(1);
3415 ftof32y[j]->Draw("f");
3416 ftof32y[j]->Draw();
3417 };
3418 //
3419 // S32 X-view
3420 //
3421 if ( true ){
3422 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
3423 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
3424 Float_t nxc[5];
3425 Float_t nyc[5];
3426 for (Int_t i = 0; i<5 ; i++) {
3427 nxc[i]= xs2x + nxc1[i]*var.sfx;
3428 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
3429 };
3430 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
3431 ftof32x->SetLineColor(1);
3432 ftof32x->SetLineWidth(1);
3433 ftof32x->SetFillStyle(4000);
3434 ftof32x->SetFillColor(0);
3435 ftof32x->Draw("f");
3436 ftof32x->Draw();
3437 TPolyLine *sftof32[3];
3438 tt = 1;
3439 if ( level.file == -1 ) tt = 3;
3440 for (Int_t j=0; j<tt; j++){
3441 // for ( Int_t j=0; j<3; j++){
3442 if ( (mt32[0][j]<4095. || mt32[1][j]<4095.) ){
3443 if ( ocolo == 10 ) ocolo = noadc;
3444 Float_t lowp = (xp32[j]-E32[j])/100.;
3445 Float_t higp = (xp32[j]+E32[j])/100.;
3446 if ( lowp < -0.089 ) lowp = -0.089;
3447 if ( higp > 0.089 ) higp = 0.089;
3448 if ( lowp < higp && ( level.file == -1 || (level.file == 2 && xp32[j] != 0.))){
3449 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
3450 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
3451 Float_t nxc[5];
3452 Float_t nyc[5];
3453 for (Int_t i = 0; i<5 ; i++) {
3454 nxc[i]= xs2x + nxc1[i]*var.sfx;
3455 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
3456 };
3457 sftof32[j] = new TPolyLine(5,nxc,nyc);
3458 sftof32[j]->SetLineColor(ocolo);
3459 sftof32[j]->SetFillColor(ocolo);
3460 sftof32[j]->SetLineWidth(1);
3461 sftof32[j]->Draw("f");
3462 sftof32[j]->Draw();
3463 };
3464 };
3465 };
3466 };
3467 //
3468 if ( level.file == -1 || numtr >= repuntil ) repeat = false;
3469 //
3470 };
3471 //
3472 }
3473
3474
3475 void FEVdetector::ShowAC(){
3476 //
3477 //
3478 //
3479 if ( !var.AC ) return;
3480 //
3481 Int_t hitmapA = 0;
3482 Int_t hitmapB = 0;
3483 Int_t hitstatusA = 0;
3484 Int_t hitstatusB = 0;
3485 //
3486 // level0 and level-1 do not give infos about out of trigger events
3487 //
3488 if ( level.file == 0 || level.file == -1 ){
3489 hitmapA = ace->hitmap[0];
3490 hitmapB = ace->hitmap[1];
3491 hitstatusA = 65535;
3492 hitstatusB = 65535;
3493 };
3494 //
3495 // full infos from ac
3496 //
3497 if ( level.file == 2 ){
3498 hitmapA = L2->GetAcLevel2()->hitmap[0];
3499 hitmapB = L2->GetAcLevel2()->hitmap[1];
3500 hitstatusA = L2->GetAcLevel2()->hitstatus[0];
3501 hitstatusB = L2->GetAcLevel2()->hitstatus[1];
3502 };
3503 //
3504 //
3505 //
3506 Float_t cas1 = 0.;
3507 Float_t cas2 = 0.;
3508 Float_t cas3 = 0.;
3509 Float_t cas4 = 0.;
3510 Float_t cas1b = 0.;
3511 Float_t cas2b = 0.;
3512 Float_t cas3b = 0.;
3513 Float_t cas4b = 0.;
3514 //
3515 Float_t cat1 = 0.;
3516 Float_t cat2 = 0.;
3517 Float_t cat3 = 0.;
3518 Float_t cat4 = 0.;
3519 Float_t cat1b = 0.;
3520 Float_t cat2b = 0.;
3521 Float_t cat3b = 0.;
3522 Float_t cat4b = 0.;
3523 //
3524 Float_t card1 = 0.;
3525 Float_t card2 = 0.;
3526 Float_t card3 = 0.;
3527 Float_t card4 = 0.;
3528 Float_t card1b = 0.;
3529 Float_t card2b = 0.;
3530 Float_t card3b = 0.;
3531 Float_t card4b = 0.;
3532 //
3533 Float_t intime = -0.25;
3534 Float_t outtime = -0.375;
3535 if ( var.bw ){
3536 intime = -0.25;
3537 outtime = -0.375;
3538 } else {
3539 intime = 1.;
3540 outtime = -4.;
3541 };
3542 //
3543 // main board
3544 //
3545 if ( hitmapA & (1<<0) ) {
3546 card4 = intime;
3547 if ( !(hitstatusA & (1<<0)) ) card4 = outtime ;
3548 var.hcard++;
3549 }
3550 if ( hitmapA & (1<<1) ) {
3551 cat2 = intime;
3552 if ( !(hitstatusA & (1<<1)) ) cat2 = outtime ;
3553 var.hcat++;
3554 }
3555 if ( hitmapA & (1<<2) ) {
3556 cas1 = intime;
3557 if ( !(hitstatusA & (1<<2)) ) cas1 = outtime ;
3558 var.hcas++;
3559 }
3560 //
3561 if ( hitmapA & (1<<4) ) {
3562 card2 = intime;
3563 if ( !(hitstatusA & (1<<4)) ) card2 = outtime ;
3564 var.hcard++;
3565 }
3566 if ( hitmapA & (1<<5) ) {
3567 cat4 = intime;
3568 if ( !(hitstatusA & (1<<5)) ) cat4 = outtime ;
3569 var.hcat++;
3570 }
3571 if ( hitmapA & (1<<6) ) {
3572 cas4 = intime;
3573 if ( !(hitstatusA & (1<<6)) ) cas4 = outtime ;
3574 var.hcas++;
3575 }
3576 //
3577 if ( hitmapA & (1<<8) ) {
3578 card3 = intime;
3579 if ( !(hitstatusA & (1<<8)) ) card3 = outtime ;
3580 var.hcard++;
3581 }
3582 if ( hitmapA & (1<<9) ) {
3583 cat3 = intime;
3584 if ( !(hitstatusA & (1<<9)) ) cat3 = outtime ;
3585 var.hcat++;
3586 }
3587 if ( hitmapA & (1<<10) ) {
3588 cas3 = intime;
3589 if ( !(hitstatusA & (1<<10)) ) cas3 = outtime ;
3590 var.hcas++;
3591 }
3592 //
3593 if ( hitmapA & (1<<12) ) {
3594 card1 = intime;
3595 if ( !(hitstatusA & (1<<12)) ) card1 = outtime ;
3596 var.hcard++;
3597 }
3598 if ( hitmapA & (1<<13) ) {
3599 cat1 = intime;
3600 if ( !(hitstatusA & (1<<13)) ) cat1 = outtime ;
3601 var.hcat++;
3602 }
3603 if ( hitmapA & (1<<14) ) {
3604 cas2 = intime;
3605 if ( !(hitstatusA & (1<<14)) ) cas2 = outtime ;
3606 var.hcas++;
3607 }
3608 //
3609 // extra board
3610 //
3611 if ( hitmapB & (1<<0) ) {
3612 card4b = intime;
3613 if ( !(hitstatusB & (1<<0)) ) card4b = outtime ;
3614 var.hcard++;
3615 }
3616 if ( hitmapB & (1<<1) ) {
3617 cat2b = intime;
3618 if ( !(hitstatusB & (1<<1)) ) cat2b = outtime ;
3619 var.hcat++;
3620 }
3621 if ( hitmapB & (1<<2) ) {
3622 cas1b = intime;
3623 if ( !(hitstatusB & (1<<2)) ) cas1b = outtime;
3624 var.hcas++;
3625 }
3626 //
3627 if ( hitmapB & (1<<4) ) {
3628 card2b = intime;
3629 if ( !(hitstatusB & (1<<4)) ) card2b = outtime ;
3630 var.hcard++;
3631 }
3632 if ( hitmapB & (1<<5) ) {
3633 cat4b = intime;
3634 if ( !(hitstatusB & (1<<5)) ) cat4b = outtime ;
3635 var.hcat++;
3636 }
3637 if ( hitmapB & (1<<6) ) {
3638 cas4b = intime;
3639 if ( !(hitstatusB & (1<<6)) ) cas4b = outtime ;
3640 var.hcas++;
3641 }
3642 //
3643 if ( hitmapB & (1<<8) ) {
3644 card3b = intime;
3645 if ( !(hitstatusB & (1<<8)) ) card3b = outtime ;
3646 var.hcard++;
3647 }
3648 if ( hitmapB & (1<<9) ) {
3649 cat3b = intime;
3650 if ( !(hitstatusB & (1<<9)) ) cat3b = outtime ;
3651 var.hcat++;
3652 }
3653 if ( hitmapB & (1<<10) ) {
3654 cas3b = intime;
3655 if ( !(hitstatusB & (1<<10)) ) cas3b = outtime ;
3656 var.hcas++;
3657 }
3658 //
3659 if ( hitmapB & (1<<12) ) {
3660 card1b = intime;
3661 if ( !(hitstatusB & (1<<12)) ) card1b = outtime ;
3662 var.hcard++;
3663 }
3664 if ( hitmapB & (1<<13) ) {
3665 cat1b = intime;
3666 if ( !(hitstatusB & (1<<13)) ) cat1b = outtime ;
3667 var.hcat++;
3668 }
3669 if ( hitmapB & (1<<14) ) {
3670 cas2b = intime;
3671 if ( !(hitstatusB & (1<<14)) ) cas2b = outtime ;
3672 var.hcas++;
3673 };
3674 Int_t colo = 0;
3675 //
3676 // CAS height and width
3677 //
3678 Float_t csh = 0.194*var.sfy;
3679 Float_t csw = 0.008*var.sfx;
3680 Float_t ctw = 0.008;
3681
3682 //
3683 // CAS2 -0.039-0.081 |TRX TRY
3684 //
3685 if ( true ){
3686 Float_t xofs = var.xxvc -(0.039+0.081+0.0273)*var.sfx;
3687 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3688 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3689 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
3690 TPolyLine *fcas2 = new TPolyLine(4,x,y);
3691 fcas2->SetLineColor(1);
3692 colo = (int)(10. - cas2 * 8.);
3693 fcas2->SetFillColor(colo);
3694 fcas2->SetLineWidth(1);
3695 fcas2->Draw("f");
3696 fcas2->Draw();
3697 };
3698 if ( true ){
3699 Float_t xofs = var.xxvc -(0.039 +0.081 +0.0273)*var.sfx;
3700 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3701 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3702 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
3703 TPolyLine *fcas2b = new TPolyLine(4,x,y);
3704 fcas2b->SetLineColor(1);
3705 colo = (int)(10. - cas2b * 8.);
3706 fcas2b->SetFillColor(colo);
3707 fcas2b->SetLineWidth(1);
3708 fcas2b->Draw("f");
3709 fcas2b->Draw();
3710 };
3711 //
3712 // CAS1 -0.039+0.081 TRX| TRY
3713 //
3714 if ( true ){
3715 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
3716 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3717 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3718 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
3719 TPolyLine *fcas1 = new TPolyLine(4,x,y);
3720 fcas1->SetLineColor(1);
3721 colo = (int)(10. - cas1 * 8.);
3722 fcas1->SetFillColor(colo);
3723 fcas1->SetLineWidth(1);
3724 fcas1->Draw("f");
3725 fcas1->Draw();
3726 };
3727 if ( true ){
3728 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
3729 Float_t yofs = var.yxvc + 0.09*var.sfy ;
3730 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3731 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
3732 TPolyLine *fcas1b = new TPolyLine(4,x,y);
3733 fcas1b->SetLineColor(1);
3734 colo = (int)(10. - cas1b * 8.);
3735 fcas1b->SetFillColor(colo);
3736 fcas1b->SetLineWidth(1);
3737 fcas1b->Draw("f");
3738 fcas1b->Draw();
3739 };
3740 //
3741 // CAS4 -0.039-0.081 TRX |TRY
3742 //
3743 if ( true ){
3744 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
3745 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3746 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3747 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
3748 TPolyLine *fcas4 = new TPolyLine(4,x,y);
3749 fcas4->SetLineColor(1);
3750 colo = (int)(10. - cas4 * 8.);
3751 fcas4->SetFillColor(colo);
3752 fcas4->SetLineWidth(1);
3753 fcas4->Draw("f");
3754 fcas4->Draw();
3755 };
3756 if ( true ){
3757 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
3758 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3759 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3760 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
3761 TPolyLine *fcas4b = new TPolyLine(4,x,y);
3762 fcas4b->SetLineColor(1);
3763 colo = (int)(10. - cas4b * 8.);
3764 fcas4b->SetFillColor(colo);
3765 fcas4b->SetLineWidth(1);
3766 fcas4b->Draw("f");
3767 fcas4b->Draw();
3768 };
3769
3770 //
3771 // CAS3 -0.039+0.081 TRX TRY|
3772 //
3773 if ( true ){
3774 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
3775 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3776 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
3777 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
3778 TPolyLine *fcas3 = new TPolyLine(4,x,y);
3779 fcas3->SetLineColor(1);
3780 colo = (int)(10. - cas3 * 8.);
3781 fcas3->SetFillColor(colo);
3782 fcas3->SetLineWidth(1);
3783 fcas3->Draw("f");
3784 fcas3->Draw();
3785 };
3786 if ( true ){
3787 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
3788 Float_t yofs = var.yyvc + 0.09*var.sfy ;
3789 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
3790 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
3791 TPolyLine *fcas3b = new TPolyLine(4,x,y);
3792 fcas3b->SetLineColor(1);
3793 colo = (int)(10. - cas3b * 8.);
3794 fcas3b->SetFillColor(colo);
3795 fcas3b->SetLineWidth(1);
3796 fcas3b->Draw("f");
3797 fcas3b->Draw();
3798 };
3799
3800 //
3801 // CAT coordinate system
3802 //
3803 Float_t xcat = var.xcat;
3804 Float_t ycat = var.ycat;
3805 Float_t pmt1 = 0.0356;
3806 Float_t pmt2 = 0.038;
3807 Float_t xpmt1 = -0.149*var.sfx;
3808 Float_t ypmt1 = 0.251*var.sfy;
3809 Float_t apmt1 = atan((11.*var.sfy)/(14.*var.sfx));
3810 Float_t xpmt2 = -0.257*var.sfx;
3811 Float_t ypmt2 = 0.158*var.sfy;
3812 Float_t apmt2 = atan((11.*var.sfx)/(15.*var.sfy));
3813 //
3814 Int_t cattime = 13;
3815 Int_t catnoti = 12;
3816 if ( var.bw ){
3817 cattime = 13;
3818 catnoti = 12;
3819 } else {
3820 cattime = 2;
3821 catnoti = 42;
3822 };
3823 //
3824 if ( true ){
3825 // PMTs
3826 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.};
3827 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.};
3828 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.};
3829 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.};
3830 // SCINTs
3831 Float_t xcc1[10]={-0.149, -0.090165, -0.090165, -0.149, -0.242, -0.257, -0.212, -0.257, -0.242, -0.149};
3832 Float_t ycc1[10]={ 0.169, 0.108165, -0.108165, -0.169, -0.169, -0.158, 0., 0.158, 0.169, 0.169};
3833 Float_t xcc2[10]={-0.149, -0.149, -0.138, 0., 0.138, 0.149, 0.149, 0.090165, -0.090165, -0.149};
3834 Float_t ycc2[10]={ 0.169, 0.251, 0.265, 0.220, 0.265, 0.251, 0.169, 0.108165, 0.108165, 0.169};
3835 //
3836 // CAT sections
3837 //
3838 if ( true ){
3839 Float_t xofs = var.xxvc -0.108165*var.sfx;
3840 Float_t yofs = var.yxvc + 0.3725*var.sfy ;
3841 Double_t xx[5] = {xofs,xofs-0.112*var.sfx,xofs-0.112*var.sfx,xofs,xofs};
3842 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3843 TPolyLine *fcat3 = new TPolyLine(5,xx,yy);
3844 fcat3->SetLineColor(1);
3845 if ( cat3 != 0. || cat3b != 0. ){
3846 if ( cat3 > 0 || cat3b > 0 || cat3 == -0.25 || cat3b == -0.25 ){
3847 colo = cattime;
3848 } else {
3849 colo = catnoti;
3850 };
3851 } else {
3852 colo = 10;
3853 };
3854 fcat3->SetFillColor(colo);
3855 fcat3->SetLineWidth(1);
3856 fcat3->Draw("f");
3857 fcat3->Draw();
3858 };
3859 if ( true ){
3860 Float_t xofs = var.xxvc +0.108165*var.sfx;
3861 Float_t yofs = var.yxvc + 0.3725 *var.sfy;
3862 Double_t xx[5] = {xofs,xofs+0.112*var.sfx,xofs+0.112*var.sfx,xofs,xofs};
3863 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3864 TPolyLine *fcat4 = new TPolyLine(5,xx,yy);
3865 fcat4->SetLineColor(1);
3866 if ( cat4 != 0. || cat4b != 0. ){
3867 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b == -.25 ){
3868 colo = cattime;
3869 } else {
3870 colo = catnoti;
3871 };
3872 } else {
3873 colo = 10;
3874 };
3875 fcat4->SetFillColor(colo);
3876 fcat4->SetLineWidth(1);
3877 fcat4->Draw("f");
3878 fcat4->Draw();
3879 };
3880 if ( true ){
3881 Float_t xofs = var.xyvc + 0.090165*var.sfx;
3882 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
3883 Double_t xx[5] = {xofs,xofs+0.122*var.sfx,xofs+0.122*var.sfx,xofs,xofs};
3884 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3885 TPolyLine *fcat1 = new TPolyLine(5,xx,yy);
3886 fcat1->SetLineColor(1);
3887 if ( cat1 != 0. || cat1b != 0. ){
3888 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
3889 colo = cattime;
3890 } else {
3891 colo = catnoti;
3892 };
3893 } else {
3894 colo = 10;
3895 };
3896 fcat1->SetFillColor(colo);
3897 fcat1->SetLineWidth(1);
3898 fcat1->Draw("f");
3899 fcat1->Draw();
3900 };
3901 if ( true ){
3902 Float_t xofs = var.xyvc - 0.090165*var.sfx;
3903 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
3904 Double_t xx[5] = {xofs,xofs-0.122*var.sfx,xofs-0.122*var.sfx,xofs,xofs};
3905 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
3906 TPolyLine *fcat2 = new TPolyLine(5,xx,yy);
3907 fcat2->SetLineColor(1);
3908 if ( cat2 != 0. || cat2b != 0. ){
3909 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
3910 colo = cattime;
3911 } else {
3912 colo = catnoti;
3913 };
3914 } else {
3915 colo = 10;
3916 };
3917 fcat2->SetFillColor(colo);
3918 fcat2->SetLineWidth(1);
3919 fcat2->Draw("f");
3920 fcat2->Draw();
3921 };
3922 //
3923 // CAT1
3924 //
3925 Float_t xcc[10];
3926 Float_t ycc[10];
3927 if ( true ){
3928 for (Int_t i = 0; i<10 ; i++) {
3929 xcc[i]= xcat - xcc1[i]*var.sfx;
3930 ycc[i] = ycat + ycc1[i]*var.sfy;
3931 };
3932 TPolyLine *fcat1 = new TPolyLine(10,xcc,ycc);
3933 fcat1->SetLineColor(1);
3934 colo = 10;
3935 if ( cat1 != 0. || cat1b != 0. ) {
3936 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
3937 colo = cattime;
3938 } else {
3939 colo = catnoti;
3940 };
3941 };
3942 fcat1->SetFillColor(colo);
3943 fcat1->SetLineWidth(1);
3944 fcat1->Draw("f");
3945 fcat1->Draw();
3946 };
3947 //
3948 // CAT2
3949 //
3950 if ( true ){
3951 for (Int_t i = 0; i<10 ; i++) {
3952 xcc[i]= xcat + xcc1[i]*var.sfx;
3953 ycc[i] = ycat + ycc1[i]*var.sfy;
3954 };
3955 TPolyLine *fcat2 = new TPolyLine(10,xcc,ycc);
3956 fcat2->SetLineColor(1);
3957 colo = 10;
3958 if ( cat2 != 0. || cat2b != 0. ) {
3959 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
3960 colo = cattime;
3961 } else {
3962 colo = catnoti;
3963 };
3964 };
3965 fcat2->SetFillColor(colo);
3966 fcat2->SetLineWidth(1);
3967 fcat2->Draw("f");
3968 fcat2->Draw();
3969 };
3970 //
3971 // CAT3
3972 //
3973 if ( true ){
3974 for (Int_t i = 0; i<10 ; i++) {
3975 xcc[i]= xcat + xcc2[i]*var.sfx;
3976 ycc[i] = ycat - ycc2[i]*var.sfy;
3977 };
3978 TPolyLine *fcat3 = new TPolyLine(10,xcc,ycc);
3979 fcat3->SetLineColor(1);
3980 colo = 10;
3981 if ( cat3 != 0. || cat3b != 0. ) {
3982 if ( cat3 > 0 || cat3b > 0 || cat3 == -.25 || cat3b ==-.25 ){
3983 colo = cattime;
3984 } else {
3985 colo = catnoti;
3986 };
3987 };
3988 fcat3->SetFillColor(colo);
3989 fcat3->SetLineWidth(1);
3990 fcat3->Draw("f");
3991 fcat3->Draw();
3992 };
3993 //
3994 // CAT4
3995 //
3996 if ( true ){
3997 for (Int_t i = 0; i<10 ; i++) {
3998 xcc[i]= xcat + xcc2[i]*var.sfx;
3999 ycc[i] = ycat + ycc2[i]*var.sfy;
4000 };
4001 TPolyLine *fcat4 = new TPolyLine(10,xcc,ycc);
4002 fcat4->SetLineColor(1);
4003 colo = 10;
4004 if ( cat4 != 0. || cat4b != 0. ) {
4005 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b ==-.25 ){
4006 colo = cattime;
4007 } else {
4008 colo = catnoti;
4009 };
4010 };
4011 fcat4->SetFillColor(colo);
4012 fcat4->SetLineWidth(1);
4013 fcat4->Draw("f");
4014 fcat4->Draw();
4015 };
4016 //
4017 // CAT1 PMTs
4018 //
4019 Float_t xc[5];
4020 Float_t yc[5];
4021 if ( true ){
4022 for (Int_t i = 0; i<5 ; i++) {
4023 xc[i]= xcat - xpmt2 - xc1[i];
4024 yc[i] = ycat + ypmt2 + yc1[i];
4025 };
4026 TPolyLine *fcat1 = new TPolyLine(5,xc,yc);
4027 fcat1->SetLineColor(1);
4028 colo = (int)(10. - cat1 * 8.);
4029 fcat1->SetFillColor(colo);
4030 fcat1->SetLineWidth(1);
4031 fcat1->Draw("f");
4032 fcat1->Draw();
4033 };
4034 if ( true ){
4035 for (Int_t i = 0; i<5 ; i++) {
4036 xc[i]= xcat - xpmt2 - xc1[i];
4037 yc[i] = ycat - ypmt2 - yc1[i];
4038 };
4039 TPolyLine *fcat1b = new TPolyLine(5,xc,yc);
4040 fcat1b->SetLineColor(1);
4041 colo = (int)(10. - cat1b * 8.);
4042 fcat1b->SetFillColor(colo);
4043 fcat1b->SetLineWidth(1);
4044 fcat1b->Draw("f");
4045 fcat1b->Draw();
4046 };
4047 //
4048 // CAT2 PMTs
4049 //
4050 if ( true ){
4051 for (Int_t i = 0; i<5 ; i++) {
4052 xc[i]= xcat + xpmt2 + xc1[i];
4053 yc[i] = ycat + ypmt2 + yc1[i];
4054 };
4055 TPolyLine *fcat2 = new TPolyLine(5,xc,yc);
4056 fcat2->SetLineColor(1);
4057 colo = (int)(10. - cat2 * 8.);
4058 fcat2->SetFillColor(colo);
4059 fcat2->SetLineWidth(1);
4060 fcat2->Draw("f");
4061 fcat2->Draw();
4062 };
4063 if ( true ){
4064 for (Int_t i = 0; i<5 ; i++) {
4065 xc[i]= xcat + xpmt2 + xc1[i];
4066 yc[i] = ycat - ypmt2 - yc1[i];
4067 };
4068 TPolyLine *fcat2b = new TPolyLine(5,xc,yc);
4069 fcat2b->SetLineColor(1);
4070 colo = (int)(10. - cat2b * 8.);
4071 fcat2b->SetFillColor(colo);
4072 fcat2b->SetLineWidth(1);
4073 fcat2b->Draw("f");
4074 fcat2b->Draw();
4075 };
4076 //
4077 // CAT3 PMTs
4078 //
4079 if ( true ){
4080 for (Int_t i = 0; i<5 ; i++) {
4081 xc[i]= xcat + xpmt1 + xc2[i];
4082 yc[i] = ycat - ypmt1 - yc2[i];
4083 };
4084 TPolyLine *fcat3b = new TPolyLine(5,xc,yc);
4085 fcat3b->SetLineColor(1);
4086 colo = (int)(10. - cat3b * 8.);
4087 fcat3b->SetFillColor(colo);
4088 fcat3b->SetLineWidth(1);
4089 fcat3b->Draw("f");
4090 fcat3b->Draw();
4091 };
4092 if ( true ){
4093 for (Int_t i = 0; i<5 ; i++) {
4094 xc[i]= xcat - xpmt1 - xc2[i];
4095 yc[i] = ycat - ypmt1 - yc2[i];
4096 };
4097 TPolyLine *fcat3 = new TPolyLine(5,xc,yc);
4098 fcat3->SetLineColor(1);
4099 colo = (int)(10. - cat3 * 8.);
4100 fcat3->SetFillColor(colo);
4101 fcat3->SetLineWidth(1);
4102 fcat3->Draw("f");
4103 fcat3->Draw();
4104 };
4105 //
4106 // CAT4 PMTs
4107 //
4108 if ( true ){
4109 for (Int_t i = 0; i<5 ; i++) {
4110 xc[i]= xcat + xpmt1 + xc2[i];
4111 yc[i] = ycat + ypmt1 + yc2[i];
4112 };
4113 TPolyLine *fcat4b = new TPolyLine(5,xc,yc);
4114 fcat4b->SetLineColor(1);
4115 colo = (int)(10. - cat4b * 8.);
4116 fcat4b->SetFillColor(colo);
4117 fcat4b->SetLineWidth(1);
4118 fcat4b->Draw("f");
4119 fcat4b->Draw();
4120 };
4121 if ( true ){
4122 for (Int_t i = 0; i<5 ; i++) {
4123 xc[i]= xcat - xpmt1 - xc2[i];
4124 yc[i] = ycat + ypmt1 + yc2[i];
4125 };
4126 TPolyLine *fcat4 = new TPolyLine(5,xc,yc);
4127 fcat4->SetLineColor(1);
4128 colo = (int)(10. - cat4 * 8.);
4129 fcat4->SetFillColor(colo);
4130 fcat4->SetLineWidth(1);
4131 fcat4->Draw("f");
4132 fcat4->Draw();
4133 };
4134 };
4135 if ( true ){
4136 //
4137 // CAS plane view:
4138 //
4139 Float_t xofs = -0.025;
4140 Float_t yofs = 0.039 +0.081+0.0273;
4141 Float_t csy = 0.33/2.;
4142 Float_t pmofs = 0.004;
4143 Float_t csw2 = 0.008;
4144 Float_t xc1[5] = { xofs-csy, xofs-csy, xofs+csy, xofs+csy, xofs-csy};
4145 Float_t yc1[5] = { yofs, yofs+csw2, yofs+csw2, yofs, yofs};
4146
4147 Float_t xc2[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
4148 Float_t yc2[5] = { yofs+pmofs, yofs+pmofs+csw2, yofs+pmofs+csw2, yofs+pmofs, yofs+pmofs};
4149 Float_t xc3[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
4150 Float_t yc3[5] = { yofs+pmofs, yofs+pmofs-csw2, yofs+pmofs-csw2, yofs+pmofs, yofs+pmofs};
4151
4152 //
4153 // CAS1
4154 //
4155 Float_t xc[5];
4156 Float_t yc[5];
4157 for (Int_t i = 0; i<5 ; i++) {
4158 xc[i]= xcat + xc1[i]*var.sfx;
4159 yc[i] = ycat + yc1[i]*var.sfy;
4160 };
4161 TPolyLine *pcass1 = new TPolyLine(5,xc,yc);
4162 pcass1->SetLineColor(1);
4163 colo = 10;
4164 if ( cas1 != 0. || cas1b != 0. ) {
4165 if ( cas1 > 0 || cas1b > 0 || cas1 ==-.25 || cas1b ==-.25){
4166 colo = cattime;
4167 } else {
4168 colo = catnoti;
4169 };
4170 };
4171 if ( colo != 10 ) pcass1->SetFillStyle(3001);
4172 pcass1->SetFillColor(colo);
4173 pcass1->SetLineWidth(1);
4174 pcass1->SetLineStyle(2);
4175 pcass1->Draw("f");
4176 pcass1->Draw();
4177 //
4178 for (Int_t i = 0; i<5 ; i++) {
4179 xc[i]= xcat + xc2[i]*var.sfx;
4180 yc[i] = ycat + yc2[i]*var.sfy;
4181 };
4182 TPolyLine *pcasp1b = new TPolyLine(5,xc,yc);
4183 pcasp1b->SetLineColor(1);
4184 colo = (int)(10. - cas1b * 8.);
4185 if ( colo != 10 ) pcasp1b->SetFillStyle(3001);
4186 pcasp1b->SetFillColor(colo);
4187 pcasp1b->SetLineWidth(1);
4188 pcasp1b->SetLineStyle(2);
4189 pcasp1b->Draw("f");
4190 pcasp1b->Draw();
4191 //
4192 for (Int_t i = 0; i<5 ; i++) {
4193 xc[i]= xcat + xc3[i]*var.sfx;
4194 yc[i] = ycat + yc3[i]*var.sfy;
4195 };
4196 TPolyLine *pcasp1 = new TPolyLine(5,xc,yc);
4197 pcasp1->SetLineColor(1);
4198 colo = (int)(10. - cas1 * 8.);
4199 if ( colo != 10 ) pcasp1->SetFillStyle(3001);
4200 pcasp1->SetFillColor(colo);
4201 pcasp1->SetLineWidth(1);
4202 pcasp1->SetLineStyle(2);
4203 pcasp1->Draw("f");
4204 pcasp1->Draw();
4205 //
4206 // CAS2
4207 //
4208 for (Int_t i = 0; i<5 ; i++) {
4209 xc[i]= xcat - xc1[i]*var.sfx;
4210 yc[i] = ycat - yc1[i]*var.sfy;
4211 };
4212 TPolyLine *pcass2 = new TPolyLine(5,xc,yc);
4213 pcass2->SetLineColor(1);
4214 colo = 10;
4215 if ( cas2 != 0. || cas2b != 0. ) {
4216 if ( cas2 > 0 || cas2b > 0 || cas2 ==-.25 || cas2b ==-.25 ){
4217 colo = cattime;
4218 } else {
4219 colo = catnoti;
4220 };
4221 };
4222 if ( colo != 10 ) pcass2->SetFillStyle(3001);
4223 pcass2->SetFillColor(colo);
4224 pcass2->SetLineWidth(1);
4225 pcass2->SetLineStyle(2);
4226 pcass2->Draw("f");
4227 pcass2->Draw();
4228 //
4229 for (Int_t i = 0; i<5 ; i++) {
4230 xc[i]= xcat - xc2[i]*var.sfx;
4231 yc[i] = ycat - yc2[i]*var.sfy;
4232 };
4233 TPolyLine *pcasp2b = new TPolyLine(5,xc,yc);
4234 pcasp2b->SetLineColor(1);
4235 colo = (int)(10. - cas2b * 8.);
4236 if ( colo != 10 ) pcasp2b->SetFillStyle(3001);
4237 pcasp2b->SetFillColor(colo);
4238 pcasp2b->SetLineWidth(1);
4239 pcasp2b->SetLineStyle(2);
4240 pcasp2b->Draw("f");
4241 pcasp2b->Draw();
4242 //
4243 for (Int_t i = 0; i<5 ; i++) {
4244 xc[i]= xcat - xc3[i]*var.sfx;
4245 yc[i] = ycat - yc3[i]*var.sfy;
4246 };
4247 TPolyLine *pcasp2 = new TPolyLine(5,xc,yc);
4248 pcasp2->SetLineColor(1);
4249 colo = (int)(10. - cas2 * 8.);
4250 pcasp2->SetFillColor(colo);
4251 if ( colo != 10 ) pcasp2->SetFillStyle(3001);
4252 pcasp2->SetLineWidth(1);
4253 pcasp2->SetLineStyle(2);
4254 pcasp2->Draw("f");
4255 pcasp2->Draw();
4256
4257 };
4258 if ( true ){
4259 Float_t xofs = 0.048 +0.066+0.0273;
4260 Float_t yofs = 0.02;
4261 Float_t csy = 0.33/2.;
4262 Float_t pmofs = 0.004;
4263 Float_t csw2 = 0.008;
4264 Float_t xc1[5] = { xofs, xofs+csw2, xofs+csw2, xofs, xofs};
4265 Float_t yc1[5] = { yofs-csy, yofs-csy, yofs+csy, yofs+csy, yofs-csy};
4266 Float_t xc2[5] = { xofs+pmofs, xofs+pmofs+csw2, xofs+pmofs+csw2, xofs+pmofs, xofs+pmofs};
4267 Float_t yc2[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
4268 Float_t xc3[5] = { xofs+pmofs, xofs+pmofs-csw2, xofs+pmofs-csw2, xofs+pmofs, xofs+pmofs};
4269 Float_t yc3[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
4270 //
4271 // CAS3
4272 //
4273 Float_t xc[5];
4274 Float_t yc[5];
4275 for (Int_t i = 0; i<5 ; i++) {
4276 xc[i]= xcat + xc1[i]*var.sfx;
4277 yc[i] = ycat + yc1[i]*var.sfy;
4278 };
4279 TPolyLine *pcass3 = new TPolyLine(5,xc,yc);
4280 pcass3->SetLineColor(1);
4281 colo = 10;
4282 if ( cas3 != 0. || cas3b != 0. ) {
4283 if ( cas3 > 0 || cas3b > 0 || cas3 ==-.25 || cas3b ==-.25){
4284 colo = cattime;
4285 } else {
4286 colo = catnoti;
4287 };
4288 };
4289 if ( colo != 10 ) pcass3->SetFillStyle(3001);
4290 pcass3->SetFillColor(colo);
4291 pcass3->SetLineWidth(1);
4292 pcass3->SetLineStyle(2);
4293 pcass3->Draw("f");
4294 pcass3->Draw();
4295 //
4296 for (Int_t i = 0; i<5 ; i++) {
4297 xc[i]= xcat + xc2[i]*var.sfx;
4298 yc[i] = ycat + yc2[i]*var.sfy;
4299 };
4300 TPolyLine *pcasp3b = new TPolyLine(5,xc,yc);
4301 pcasp3b->SetLineColor(1);
4302 colo = (int)(10. - cas3b * 8.);
4303 if ( colo != 10 ) pcasp3b->SetFillStyle(3001);
4304 pcasp3b->SetFillColor(colo);
4305 pcasp3b->SetLineWidth(1);
4306 pcasp3b->SetLineStyle(2);
4307 pcasp3b->Draw("f");
4308 pcasp3b->Draw();
4309 //
4310 for (Int_t i = 0; i<5 ; i++) {
4311 xc[i]= xcat + xc3[i]*var.sfx;
4312 yc[i] = ycat + yc3[i]*var.sfy;
4313 };
4314 TPolyLine *pcasp3 = new TPolyLine(5,xc,yc);
4315 pcasp3->SetLineColor(1);
4316 colo = (int)(10. - cas3 * 8.);
4317 pcasp3->SetFillColor(colo);
4318 if ( colo != 10 ) pcasp3->SetFillStyle(3001);
4319 pcasp3->SetLineWidth(1);
4320 pcasp3->SetLineStyle(2);
4321 pcasp3->Draw("f");
4322 pcasp3->Draw();
4323 //
4324 // CAS4
4325 //
4326 for (Int_t i = 0; i<5 ; i++) {
4327 xc[i]= xcat - xc1[i]*var.sfx;
4328 yc[i] = ycat - yc1[i]*var.sfy;
4329 };
4330 TPolyLine *pcass4 = new TPolyLine(5,xc,yc);
4331 pcass4->SetLineColor(1);
4332 colo = 10;
4333 if ( cas4 != 0. || cas4b != 0. ) {
4334 if ( cas4 > 0 || cas4b > 0 || cas4 ==-.25 || cas4b ==-.25 ){
4335 colo = cattime;
4336 } else {
4337 colo = catnoti;
4338 };
4339 };
4340 pcass4->SetFillColor(colo);
4341 if ( colo != 10 ) pcass4->SetFillStyle(3001);
4342 pcass4->SetLineWidth(1);
4343 pcass4->SetLineStyle(2);
4344 pcass4->Draw("f");
4345 pcass4->Draw();
4346 //
4347 for (Int_t i = 0; i<5 ; i++) {
4348 xc[i]= xcat - xc2[i]*var.sfx;
4349 yc[i] = ycat - yc2[i]*var.sfy;
4350 };
4351 TPolyLine *pcasp4 = new TPolyLine(5,xc,yc);
4352 pcasp4->SetLineColor(1);
4353 colo = (int)(10. - cas4 * 8.);
4354 pcasp4->SetFillColor(colo);
4355 if ( colo != 10 ) pcasp4->SetFillStyle(3001);
4356 pcasp4->SetLineWidth(1);
4357 pcasp4->SetLineStyle(2);
4358 pcasp4->Draw("f");
4359 pcasp4->Draw();
4360 //
4361 for (Int_t i = 0; i<5 ; i++) {
4362 xc[i]= xcat - xc3[i]*var.sfx;
4363 yc[i] = ycat - yc3[i]*var.sfy;
4364 };
4365 TPolyLine *pcasp4b = new TPolyLine(5,xc,yc);
4366 pcasp4b->SetLineColor(1);
4367 colo = (int)(10. - cas4b * 8.);
4368 pcasp4b->SetFillColor(colo);
4369 if ( colo != 10 ) pcasp4b->SetFillStyle(3001);
4370 pcasp4b->SetLineWidth(1);
4371 pcasp4b->SetLineStyle(2);
4372 pcasp4b->Draw("f");
4373 pcasp4b->Draw();
4374 };
4375 // Float_t alfax = 1.2020334;
4376 Float_t alfax = 1.22157778;
4377 Float_t alfay = 1.27393111;
4378 Float_t lcrd = 0.1815/2.;
4379 Float_t wcrd = 0.008;
4380 if ( true ){
4381 //
4382 // CARD plane view:
4383 //
4384 Float_t xc1[5] = { -0.090165, -0.090165, -0.082165, -0.082165, -0.090165};
4385 Float_t yc1[5] = { -0.100, 0.092, 0.092, -0.100, -0.100};
4386 Float_t xc2[5] = { -0.094165, -0.094165, -0.086165, -0.086165, -0.094165};
4387 Float_t yc2[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
4388 Float_t xc3[5] = { -0.086165, -0.086165, -0.078165, -0.078165, -0.086165};
4389 Float_t yc3[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
4390 //
4391 // CARD1
4392 //
4393 Float_t xc[5];
4394 Float_t yc[5];
4395 for (Int_t i = 0; i<5 ; i++) {
4396 xc[i]= xcat + xc1[i]*var.sfx;
4397 yc[i] = ycat + yc1[i]*var.sfy;
4398 };
4399 TPolyLine *pcars1 = new TPolyLine(5,xc,yc);
4400 pcars1->SetLineColor(1);
4401 colo = 10;
4402 if ( card1 != 0. || card1b != 0. ) {
4403 if ( card1 > 0 || card1b > 0 || card1 ==-.25 || card1b ==-.25 ){
4404 colo = cattime;
4405 } else {
4406 colo = catnoti;
4407 };
4408 };
4409 pcars1->SetFillColor(colo);
4410 pcars1->SetLineWidth(1);
4411 pcars1->Draw("f");
4412 pcars1->Draw();
4413 //
4414 for (Int_t i = 0; i<5 ; i++) {
4415 xc[i]= xcat + xc2[i]*var.sfx;
4416 yc[i] = ycat + yc2[i]*var.sfy;
4417 };
4418 TPolyLine *pcarp1b = new TPolyLine(5,xc,yc);
4419 pcarp1b->SetLineColor(1);
4420 colo = (int)(10. - card1b * 8.);
4421 pcarp1b->SetFillColor(colo);
4422 pcarp1b->SetLineWidth(1);
4423 pcarp1b->Draw("f");
4424 pcarp1b->Draw();
4425 //
4426 for (Int_t i = 0; i<5 ; i++) {
4427 xc[i] = xcat + xc3[i]*var.sfx;
4428 yc[i] = ycat + yc3[i]*var.sfy;
4429 };
4430 TPolyLine *pcarp1 = new TPolyLine(5,xc,yc);
4431 pcarp1->SetLineColor(1);
4432 colo = (int)(10. - card1 * 8.);
4433 pcarp1->SetFillColor(colo);
4434 pcarp1->SetLineWidth(1);
4435 pcarp1->Draw("f");
4436 pcarp1->Draw();
4437 //
4438 // CARD4
4439 //
4440 for (Int_t i = 0; i<5 ; i++) {
4441 xc[i]= xcat - xc1[i]*var.sfx;
4442 yc[i] = ycat - yc1[i]*var.sfy;
4443 };
4444 TPolyLine *pcars4 = new TPolyLine(5,xc,yc);
4445 pcars4->SetLineColor(1);
4446 colo = 10;
4447 if ( card4 != 0. || card4b != 0. ) {
4448 if ( card4 > 0 || card4b > 0 || card4 ==-.25 || card4b ==-.25){
4449 colo = cattime;
4450 } else {
4451 colo = catnoti;
4452 };
4453 };
4454 pcars4->SetFillColor(colo);
4455 pcars4->SetLineWidth(1);
4456 pcars4->Draw("f");
4457 pcars4->Draw();
4458 //
4459 for (Int_t i = 0; i<5 ; i++) {
4460 xc[i]= xcat - xc2[i]*var.sfx;
4461 yc[i] = ycat - yc2[i]*var.sfy;
4462 };
4463 TPolyLine *pcarp4b = new TPolyLine(5,xc,yc);
4464 pcarp4b->SetLineColor(1);
4465 colo = (int)(10. - card4b * 8.);
4466 pcarp4b->SetFillColor(colo);
4467 pcarp4b->SetLineWidth(1);
4468 pcarp4b->Draw("f");
4469 pcarp4b->Draw();
4470 //
4471 for (Int_t i = 0; i<5 ; i++) {
4472 xc[i]= xcat - xc3[i]*var.sfx;
4473 yc[i] = ycat - yc3[i]*var.sfy;
4474 };
4475 TPolyLine *pcarp4 = new TPolyLine(5,xc,yc);
4476 pcarp4->SetLineColor(1);
4477 colo = (int)(10. - card4 * 8.);
4478 pcarp4->SetFillColor(colo);
4479 pcarp4->SetLineWidth(1);
4480 pcarp4->Draw("f");
4481 pcarp4->Draw();
4482 };
4483 if ( true ){
4484 Float_t xc1[5] = { -0.074, 0.074, 0.074, -0.074, -0.074};
4485 Float_t yc1[5] = { 0.108165, 0.108165, 0.100165, 0.100165, 0.108165};
4486 Float_t xc2[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
4487 Float_t yc2[5] = { 0.112165, 0.112165, 0.104165, 0.104165, 0.112165};
4488 Float_t xc3[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
4489 Float_t yc3[5] = { 0.104165, 0.104165, 0.096165, 0.096165, 0.104165};
4490 //
4491 // CARD2
4492 //
4493 Float_t xc[5];
4494 Float_t yc[5];
4495 for (Int_t i = 0; i<5 ; i++) {
4496 xc[i]= xcat - (xc1[i]-0.0025)*var.sfx;
4497 yc[i] = ycat - yc1[i]*var.sfy;
4498 };
4499 TPolyLine *pcars2 = new TPolyLine(5,xc,yc);
4500 pcars2->SetLineColor(1);
4501 colo = 10;
4502 if ( card2 != 0. || card2b != 0.) {
4503 if ( card2 > 0 || card2b > 0 || card2 ==-.25 || card2b ==-.25 ){
4504 colo = cattime;
4505 } else {
4506 colo = catnoti;
4507 };
4508 };
4509 pcars2->SetFillColor(colo);
4510 pcars2->SetLineWidth(1);
4511 pcars2->Draw("f");
4512 pcars2->Draw();
4513 //
4514 for (Int_t i = 0; i<5 ; i++) {
4515 xc[i]= xcat - (xc2[i]-0.0025)*var.sfx;
4516 yc[i] = ycat - yc2[i]*var.sfy;
4517 };
4518 TPolyLine *pcarp2 = new TPolyLine(5,xc,yc);
4519 pcarp2->SetLineColor(1);
4520 colo = (int)(10. - card2 * 8.);
4521 pcarp2->SetFillColor(colo);
4522 pcarp2->SetLineWidth(1);
4523 pcarp2->Draw("f");
4524 pcarp2->Draw();
4525 //
4526 for (Int_t i = 0; i<5 ; i++) {
4527 xc[i]= xcat - (xc3[i]-0.0025)*var.sfx;
4528 yc[i] = ycat - yc3[i]*var.sfy;
4529 };
4530 TPolyLine *pcarp2b = new TPolyLine(5,xc,yc);
4531 pcarp2b->SetLineColor(1);
4532 colo = (int)(10. - card2b * 8.);
4533 pcarp2b->SetFillColor(colo);
4534 pcarp2b->SetLineWidth(1);
4535 pcarp2b->Draw("f");
4536 pcarp2b->Draw();
4537 //
4538 // CARD3
4539 //
4540 for (Int_t i = 0; i<5 ; i++) {
4541 xc[i]= xcat + (xc1[i]-0.0025)*var.sfx;
4542 yc[i] = ycat + yc1[i]*var.sfy;
4543 };
4544 TPolyLine *pcars3 = new TPolyLine(5,xc,yc);
4545 pcars3->SetLineColor(1);
4546 colo = 10;
4547 if ( card3 != 0. || card3b != 0. ) {
4548 if ( card3 > 0 || card3b > 0 || card3==-.25 || card3b ==-.25){
4549 colo = cattime;
4550 } else {
4551 colo = catnoti;
4552 };
4553 };
4554 pcars3->SetFillColor(colo);
4555 pcars3->SetLineWidth(1);
4556 pcars3->Draw("f");
4557 pcars3->Draw();
4558 //
4559 for (Int_t i = 0; i<5 ; i++) {
4560 xc[i]= xcat + (xc2[i]-0.0025)*var.sfx;
4561 yc[i] = ycat + yc2[i]*var.sfy;
4562 };
4563 TPolyLine *pcarp3 = new TPolyLine(5,xc,yc);
4564 pcarp3->SetLineColor(1);
4565 colo = (int)(10. - card3 * 8.);
4566 pcarp3->SetFillColor(colo);
4567 pcarp3->SetLineWidth(1);
4568 pcarp3->Draw("f");
4569 pcarp3->Draw();
4570 //
4571 for (Int_t i = 0; i<5 ; i++) {
4572 xc[i]= xcat + (xc3[i]-0.0025)*var.sfx;
4573 yc[i] = ycat + yc3[i]*var.sfy;
4574 };
4575 TPolyLine *pcarp3b = new TPolyLine(5,xc,yc);
4576 pcarp3b->SetLineColor(1);
4577 colo = (int)(10. - card3b * 8.);
4578 pcarp3b->SetFillColor(colo);
4579 pcarp3b->SetLineWidth(1);
4580 pcarp3b->Draw("f");
4581 pcarp3b->Draw();
4582
4583 //
4584 // CARD - X-view
4585 //
4586 // Float_t cardcx = 0.143168*var.sfx;
4587 //Float_t cardcy = 0.1475*var.sfy;
4588 //
4589 // Float_t cardcx = 0.153168*var.sfx;
4590 //
4591 Float_t cardcx = (0.19123*(1.-lcrd*cos(alfax)))*var.sfx;
4592 // Float_t cardcy = 0.1575*var.sfy;
4593 Float_t cardcy = (0.179212*(1.-lcrd*sin(alfax)))*var.sfy;
4594 Float_t acrdx[4] = {-lcrd*cos(alfax), lcrd*cos(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)};
4595 Float_t acrdy[4] = {-lcrd*sin(alfax), lcrd*sin(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)};
4596 Float_t bcrdx[4] = { lcrd*cos(alfax), lcrd*cos(alfax)+wcrd*sin(alfax), -lcrd*cos(alfax)+wcrd*sin(alfax), lcrd*cos(alfax)};
4597 Float_t bcrdy[4] = { lcrd*sin(alfax), lcrd*sin(alfax)-wcrd*cos(alfax), -lcrd*sin(alfax)-wcrd*cos(alfax), lcrd*sin(alfax)};
4598
4599 //
4600 // CARD3 X/ Y
4601 //
4602 Float_t xcc[4];
4603 Float_t ycc[4];
4604 for (Int_t i = 0; i<4 ; i++) {
4605 xcc[i] = cardcx + var.xxvc + acrdx[i]*var.sfx;
4606 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
4607 };
4608 TPolyLine *fcard3 = new TPolyLine(4,xcc,ycc);
4609 fcard3->SetLineColor(1);
4610 colo = (int)(10. - card3 * 8.);
4611 fcard3->SetFillColor(colo);
4612 fcard3->SetLineWidth(1);
4613 fcard3->Draw("f");
4614 fcard3->Draw();
4615 //
4616 for (Int_t i = 0; i<4 ; i++) {
4617 xcc[i] = cardcx + var.xxvc + bcrdx[i]*var.sfx;
4618 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
4619 };
4620 TPolyLine *fcard3b = new TPolyLine(4,xcc,ycc);
4621 fcard3b->SetLineColor(1);
4622 colo = (int)(10. - card3b * 8.);
4623 fcard3b->SetFillColor(colo);
4624 fcard3b->SetLineWidth(1);
4625 fcard3b->Draw("f");
4626 fcard3b->Draw();
4627
4628 //
4629 // CARD2 \X Y
4630 //
4631 for (Int_t i = 0; i<4 ; i++) {
4632 xcc[i] = -cardcx + var.xxvc - acrdx[i]*var.sfx;
4633 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
4634 };
4635 TPolyLine *fcard2 = new TPolyLine(4,xcc,ycc);
4636 fcard2->SetLineColor(1);
4637 colo = (int)(10. - card2 * 8.);
4638 fcard2->SetFillColor(colo);
4639 fcard2->SetLineWidth(1);
4640 fcard2->Draw("f");
4641 fcard2->Draw();
4642 //
4643 for (Int_t i = 0; i<4 ; i++) {
4644 xcc[i] = -cardcx + var.xxvc - bcrdx[i]*var.sfx;
4645 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
4646 };
4647 TPolyLine *fcard2b = new TPolyLine(4,xcc,ycc);
4648 fcard2b->SetLineColor(1);
4649 colo = (int)(10. - card2b * 8.);
4650 fcard2b->SetFillColor(colo);
4651 fcard2b->SetLineWidth(1);
4652 fcard2b->Draw("f");
4653 fcard2b->Draw();
4654 };
4655
4656 if ( true ){
4657 Float_t acrdx[4] = {-lcrd*cos(alfay), lcrd*cos(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)};
4658 Float_t acrdy[4] = {-lcrd*sin(alfay), lcrd*sin(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)};
4659 Float_t bcrdx[4] = { lcrd*cos(alfay), lcrd*cos(alfay)+wcrd*sin(alfay), -lcrd*cos(alfay)+wcrd*sin(alfay), lcrd*cos(alfay)};
4660 Float_t bcrdy[4] = { lcrd*sin(alfay), lcrd*sin(alfay)-wcrd*cos(alfay), -lcrd*sin(alfay)-wcrd*cos(alfay), lcrd*sin(alfay)};
4661 //
4662 // CARD - Y-view
4663 //
4664 // Float_t cardcx = 0.12*var.sfx;
4665 Float_t cardcx = (0.16014*(1.-lcrd*cos(alfay)))*var.sfx;
4666 // Float_t cardcy = 0.178818*var.sfy;
4667 Float_t cardcy = (0.178818*(1.-lcrd*sin(alfay)))*var.sfy;
4668 // Float_t cardcy = 0.1475*var.sfy;
4669 //
4670 // CARD4 X Y/
4671 //
4672 Float_t xcc[4];
4673 Float_t ycc[4];
4674 for (Int_t i = 0; i<4 ; i++) {
4675 xcc[i] = cardcx + var.xyvc + acrdx[i]*var.sfx;
4676 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
4677 };
4678 TPolyLine *fcard4 = new TPolyLine(4,xcc,ycc);
4679 fcard4->SetLineColor(1);
4680 colo = (int)(10. - card4 * 8.);
4681 fcard4->SetFillColor(colo);
4682 fcard4->SetLineWidth(1);
4683 fcard4->Draw("f");
4684 fcard4->Draw();
4685 //
4686 for (Int_t i = 0; i<4 ; i++) {
4687 xcc[i] = cardcx + var.xyvc + bcrdx[i]*var.sfx;
4688 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
4689 };
4690 TPolyLine *fcard4b = new TPolyLine(4,xcc,ycc);
4691 fcard4b->SetLineColor(1);
4692 colo = (int)(10. - card4b * 8.);
4693 fcard4b->SetFillColor(colo);
4694 fcard4b->SetLineWidth(1);
4695 fcard4b->Draw("f");
4696 fcard4b->Draw();
4697
4698 //
4699 // CARD1 X \Y
4700 //
4701 for (Int_t i = 0; i<4 ; i++) {
4702 xcc[i] = -cardcx + var.xyvc - acrdx[i]*var.sfx;
4703 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
4704 };
4705 TPolyLine *fcard1 = new TPolyLine(4,xcc,ycc);
4706 fcard1->SetLineColor(1);
4707 colo = (int)(10. - card1 * 8.);
4708 fcard1->SetFillColor(colo);
4709 fcard1->SetLineWidth(1);
4710 fcard1->Draw("f");
4711 fcard1->Draw();
4712 //
4713 for (Int_t i = 0; i<4 ; i++) {
4714 xcc[i] = -cardcx + var.xyvc - bcrdx[i]*var.sfx;
4715 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
4716 };
4717 TPolyLine *fcard1b = new TPolyLine(4,xcc,ycc);
4718 fcard1b->SetLineColor(1);
4719 colo = (int)(10. - card1b * 8.);
4720 fcard1b->SetFillColor(colo);
4721 fcard1b->SetLineWidth(1);
4722 fcard1b->Draw("f");
4723 fcard1b->Draw();
4724 };
4725 }
4726
4727 void FEVdetector::ShowS4(Bool_t upd){
4728 //
4729 //
4730 //
4731 if ( !var.S4 ) return;
4732 //
4733 Float_t calibdata;
4734 Int_t data = 0;
4735 Float_t ms4[3] = {0.,0.,0.};
4736 Int_t S4 = 0;
4737 //
4738 // Level0 data
4739 //
4740 if ( level.file == 0 ){
4741 S4 = trigger->patterntrig[1];
4742 //
4743 for ( Int_t i = 0; i<3; i++ ) {
4744 if ( S4 & (1<<0) ) ms4[i] = 1.;
4745 };
4746 };
4747 //
4748 // Rough calibration of data
4749 //
4750 if ( level.file == -1 ){
4751 if ( !s4->unpackError && data > 31 ){
4752 data = s4->S4_DATA;
4753 calibdata = ((Float_t)data - 32.) * 0.5;
4754 } else {
4755 calibdata = 0.;
4756 };
4757 //
4758 for ( Int_t j = 0; j<3; j++ ) {
4759 ms4[j] = calibdata;
4760 };
4761 };
4762 //
4763 // Level2 data
4764 //
4765 if ( level.file == 2 ){
4766 for ( Int_t j = 0; j<3; j++ ) {
4767 if ( L2->GetS4Level2()->S4adc != 32. ) ms4[j] = L2->GetS4Level2()->S4calibrated;
4768 };
4769 };
4770 //
4771 var.s4sig = ms4[0];
4772 //
4773 if ( !upd ) return;
4774 //
4775 Int_t colo;
4776 Float_t xs4x = var.xxvc;
4777 Float_t ys4x = var.yxvc - 0.3250*var.sfy;
4778 Float_t xs4y = var.xyvc;
4779 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
4780 Float_t ws4 = 0.010;
4781 //
4782 // Y-view
4783 //
4784 Float_t s4p = 0.1606667;
4785 Int_t ocolo = 0;
4786 TPolyLine *fs4y[3];
4787 for ( Int_t j=0; j<3; j++){
4788 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
4789 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
4790 Float_t xc[5];
4791 Float_t yc[5];
4792 for (Int_t i = 0; i<5 ; i++) {
4793 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
4794 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
4795 };
4796 fs4y[j] = new TPolyLine(5,xc,yc);
4797 fs4y[j]->SetLineColor(1);
4798 if ( var.bw ){
4799 colo = -1;
4800 } else {
4801 colo = 1;
4802 };
4803 ColorMIP(ms4[j],colo);
4804 //
4805 if ( colo != 10 ) ocolo = colo;
4806 //
4807 fs4y[j]->SetFillColor(colo);
4808 fs4y[j]->SetLineWidth(1);
4809 fs4y[j]->Draw("f");
4810 fs4y[j]->Draw();
4811 };
4812 //
4813 // X-view
4814 //
4815 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
4816 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
4817 Float_t xc[5];
4818 Float_t yc[5];
4819 for (Int_t i = 0; i<5 ; i++) {
4820 xc[i]= xs4x + xc1[i]*var.nds4;
4821 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
4822 };
4823 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
4824 fs4x->SetLineColor(1);
4825 fs4x->SetFillColor(ocolo);
4826 fs4x->SetLineWidth(1);
4827 fs4x->Draw("f");
4828 fs4x->Draw();
4829 }
4830
4831 void FEVdetector::ShowND(){
4832 //
4833 //
4834 //
4835 if ( !var.ND ) return;
4836 //
4837 Int_t tmpSize;
4838 Int_t yUpperTrig = 0;
4839 Int_t yUpperBk = 0;
4840 Int_t yBottomBk = 0;
4841 if ( level.file == 0 || level.file == -1 ){
4842 //
4843 tmpSize = ne->Records->GetEntries();
4844 for (Int_t j = 0; j < tmpSize; j++){
4845 nr = (pamela::neutron::NeutronRecord*)ne->Records->At(j);
4846 yUpperTrig += (int)nr->trigPhysics;
4847 yUpperBk += (int)nr->upperBack;
4848 yBottomBk += (int)nr->bottomBack;
4849 };
4850 };
4851 if ( level.file == 2 ){
4852 yUpperTrig = (Int_t)L2->GetNDLevel2()->trigPhysics;
4853 yUpperBk = (Int_t)L2->GetNDLevel2()->upperBack;
4854 yBottomBk = (Int_t)L2->GetNDLevel2()->bottomBack;
4855 };
4856 //
4857 var.trup = yUpperTrig;
4858 var.bkup = yUpperBk;
4859 var.bkbo = yBottomBk;
4860 //
4861 Int_t ucolo = 10;
4862 if ( var.bw ){
4863 if ( yUpperTrig == 1 ){
4864 ucolo = 17;
4865 }
4866 if ( yUpperTrig == 2 ){
4867 ucolo = 15;
4868 }
4869 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
4870 ucolo = 14;
4871 }
4872 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
4873 ucolo = 13;
4874 }
4875 if ( yUpperTrig >= 14 ){
4876 ucolo = 12;
4877 };
4878 } else {
4879 if ( yUpperTrig == 1 ){
4880 ucolo = 38;
4881 }
4882 if ( yUpperTrig == 2 ){
4883 ucolo = 4;
4884 }
4885 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
4886 ucolo = 3;
4887 }
4888 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
4889 ucolo = 2;
4890 }
4891 if ( yUpperTrig >= 14 ){
4892 ucolo = 6;
4893 };
4894 };
4895 //
4896 // figures:
4897 //
4898 if ( true ){
4899 Float_t xc1[5]={ -0.300, 0.300, 0.300, -0.300, -0.300 };
4900 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};
4901 //
4902 // Upper X-view
4903 //
4904 Float_t xc[5];
4905 Float_t yc[5];
4906 for (Int_t i = 0; i<5 ; i++) {
4907 xc[i]= var.xxvc + xc1[i]*var.nds4;
4908 yc[i] = var.yxvc + yc1[i]*var.sfy;
4909 };
4910 TPolyLine *fnd2x = new TPolyLine(5,xc,yc);
4911 fnd2x->SetLineColor(1);
4912 fnd2x->SetFillColor(ucolo);
4913 fnd2x->SetLineWidth(1);
4914 fnd2x->Draw("f");
4915 fnd2x->Draw();
4916 };
4917 if ( true ){
4918 Float_t xc1[5]={ -0.275, 0.275, 0.275, -0.275, -0.275 };
4919 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};
4920 //
4921 // Upper Y-view
4922 //
4923 Float_t xc[5];
4924 Float_t yc[5];
4925 for (Int_t i = 0; i<5 ; i++) {
4926 xc[i]= var.xyvc + xc1[i]*var.nds4;
4927 yc[i] = var.yyvc + (yc1[i]+0.075)*var.sfy;
4928 };
4929 TPolyLine *fnd2y = new TPolyLine(5,xc,yc);
4930 fnd2y->SetLineColor(1);
4931 fnd2y->SetFillColor(ucolo);
4932 fnd2y->SetLineWidth(1);
4933 fnd2y->Draw("f");
4934 fnd2y->Draw();
4935 };
4936 }
4937
4938
4939 void FEVdetector::ShowTRK(Bool_t upd){
4940 //
4941 //
4942 //
4943 if ( !var.TRK ) return;
4944 //
4945 // a matrix of pads for each view x and y
4946 //
4947 var.rig = 0.;
4948 var.chi2 = 0.;
4949 TPad *trkpad[12];
4950 for (Int_t n = 0; n<12; n++){
4951 stringstream spd;
4952 spd.str("");
4953 spd << "pd1" << n;
4954 gDirectory->Delete(spd.str().c_str());
4955 spd.str("");
4956 spd << "pd2" << n;
4957 gDirectory->Delete(spd.str().c_str());
4958 spd.str("");
4959 spd << "pd3" << n;
4960 gDirectory->Delete(spd.str().c_str());
4961 spd.str("");
4962 spd << "pd4" << n;
4963 gDirectory->Delete(spd.str().c_str());
4964 spd.str("");
4965 spd << "pd5" << n;
4966 gDirectory->Delete(spd.str().c_str());
4967 spd.str("");
4968 spd << "pd6" << n;
4969 gDirectory->Delete(spd.str().c_str());
4970 spd.str("");
4971 stringstream sbd;
4972 sbd.str("");
4973 Int_t magcol = 0;
4974 TPad *mag1 = 0;
4975 TPad *mag2 = 0;
4976 if ( n%2 ) {
4977 Float_t posx = var.xxvc;
4978 Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
4979 spd.str("");
4980 sbd.str("");
4981 spd << "pd1" << n;
4982 sbd << "bd1" << n;
4983 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);
4984 trkpad[n]->SetFillStyle(4000);
4985 trkpad[n]->SetFillColor(0);
4986 trkpad[n]->SetFrameFillStyle(4000);
4987 if ( upd ) trkpad[n]->Draw();
4988 if ( n != 1 ) {
4989 if ( var.bw ) {
4990 magcol = 1;
4991 } else {
4992 magcol = 45;
4993 };
4994 spd.str("");
4995 sbd.str("");
4996 spd << "pd2" << n;
4997 sbd << "bd2" << n;
4998 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);
4999 if ( var.bw ) mag1->SetFillStyle(3001);
5000 if ( upd ) mag1->Draw();
5001 spd.str("");
5002 sbd.str("");
5003 spd << "pd3" << n;
5004 sbd << "bd3" << n;
5005 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);
5006 if ( var.bw ) mag2->SetFillStyle(3001);
5007 if ( upd ) mag2->Draw();
5008 };
5009 } else {
5010 Float_t posx = var.xyvc;
5011 Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
5012 spd.str("");
5013 sbd.str("");
5014 spd << "pd4" << n;
5015 sbd << "bd4" << n;
5016 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);
5017 trkpad[n]->SetFillStyle(4000);
5018 trkpad[n]->SetFillColor(0);
5019 trkpad[n]->SetFrameFillStyle(4000);
5020 if ( upd ) trkpad[n]->Draw();
5021 if ( n != 0 ) {
5022 if ( var.bw ) {
5023 magcol = 1;
5024 } else {
5025 magcol = 45;
5026 };
5027 spd.str("");
5028 sbd.str("");
5029 spd << "pd5" << n;
5030 sbd << "bd5" << n;
5031 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);
5032 if ( var.bw ) mag1->SetFillStyle(3001);
5033 if ( upd ) mag1->Draw();
5034 spd.str("");
5035 sbd.str("");
5036 spd << "pd6" << n;
5037 sbd << "bd6" << n;
5038 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);
5039 if ( var.bw ) mag2->SetFillStyle(3001);
5040 if ( upd ) mag2->Draw();
5041 };
5042 };
5043 };
5044 TPad *trplv;
5045 gDirectory->Delete("trkplv");
5046 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);
5047 trplv->SetFillStyle(4000);
5048 trplv->SetFillColor(0);
5049 trplv->SetFrameFillStyle(4000);
5050 if ( upd ) trplv->Draw();
5051 //
5052 Int_t sigcol1 = 17;
5053 Int_t sigcol2 = 15;
5054 Int_t linecol = 13;
5055 if ( var.bw ) {
5056 sigcol1 = 17;
5057 sigcol2 = 15;
5058 linecol = 13;
5059 } else {
5060 sigcol1 = 32;
5061 sigcol2 = 38;
5062 linecol = 42;
5063 };
5064 TLine *linea = 0;
5065 TLine *linea1x = 0;
5066 TLine *linea2x = 0;
5067 TLine *linea1y = 0;
5068 Float_t x = 0.;
5069 for (Int_t l = 0; l<12; l++){
5070 trkpad[l]->cd();
5071 if ( l%2 ) {
5072 if ( level.file == 2 ){
5073 trkpad[l]->Range(-8.1,0.,8.1,8.);
5074 linea = new TLine(-8.1,0.01,8.1,0.01);
5075 linea1x = new TLine(-2.7,0.01,-2.7,0.030);
5076 linea2x = new TLine(2.7,0.01,2.7,0.030);
5077 } else {
5078 trkpad[l]->Range(0.,0.,3100.,1.);
5079 linea = new TLine(0.,0.01,3100.,0.01);
5080 linea1x = new TLine(1033.,0.01,1033,0.030);
5081 linea2x = new TLine(2066.,0.01,2066,0.030);
5082 };
5083 } else {
5084 if ( level.file == 2 ){
5085 trkpad[l]->Range(-7.05,0.,7.05,8.);
5086 linea = new TLine(-7.05,0.01,7.05,0.01);
5087 linea1y = new TLine(0.,0.01,0.,0.030);
5088 } else {
5089 trkpad[l]->Range(0.,0.,2076.,1.);
5090 linea = new TLine(0.,0.01,2076.,0.01);
5091 linea1y = new TLine(1038.,0.01,1038,0.030);
5092 };
5093 };
5094 linea->SetLineWidth(2);
5095 linea->SetLineColor(linecol);
5096 if ( upd ) linea->Draw();
5097 if ( l%2 ) {
5098 linea1x->SetLineWidth(1);
5099 linea1x->SetLineColor(1);
5100 if ( upd ) linea1x->Draw();
5101 linea2x->SetLineWidth(1);
5102 linea2x->SetLineColor(1);
5103 if ( upd ) linea2x->Draw();
5104 } else {
5105 linea1y->SetLineWidth(1);
5106 linea1y->SetLineColor(1);
5107 if ( upd ) linea1y->Draw();
5108 };
5109 //
5110 // LEVEL0 or LEVEL-1
5111 //
5112 if ( level.file == 0 || level.file == -1 ){
5113 Int_t planeno = trk->DSPnumber[l]-1;
5114 if ( planeno < 0 || planeno > 11 ) planeno = 0;
5115 if ( planeno >= 0 && !var.nosig ) {
5116 if ( (planeno+1)%2 ){
5117 trkpad[planeno]->cd();
5118 trkpad[planeno]->Range(0.,0.,2076.,1.);
5119 for (Int_t m = 0; m<3; m++){
5120 if ( trk->signcluster[l][m] != 0. ){
5121 if ( planeno == 10 ) {
5122 x = trk->addrcluster[l][m];
5123 } else {
5124 x = 1024 - trk->addrcluster[l][m];
5125 };
5126 linea = new TLine(14.+x,0.01,14.+x,0.3);
5127 linea->SetLineWidth(2);
5128 linea->SetLineColor(sigcol1);
5129 if ( upd ) linea->Draw();
5130 x += 1024.;
5131 linea = new TLine(14.+x,0.01,14.+x,0.3);
5132 linea->SetLineWidth(2);
5133 linea->SetLineColor(sigcol2);
5134 if ( upd ) linea->Draw();
5135 var.ncly++;
5136 };
5137 };
5138 } else {
5139 trkpad[planeno]->cd();
5140 trkpad[planeno]->Range(0.,0.,3100.,1.);
5141 for (Int_t m = 0; m<3; m++){
5142 if ( trk->signcluster[l][m] != 0. ){
5143 x = trk->addrcluster[l][m] + 1024. * m;
5144 linea = new TLine(14.+x,0.01,14.+x,0.3);
5145 linea->SetLineWidth(2);
5146 linea->SetLineColor(sigcol2);
5147 if ( upd ) linea->Draw();
5148 var.nclx++;
5149 };
5150 };
5151 };
5152 };
5153 };
5154 //
5155 if ( !upd ) return;
5156 //
5157 if ( level.file == 2 ){
5158 //
5159 // singlets X
5160 //
5161 for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){
5162 TClonesArray &t = *(L2->GetTrkLevel2()->SingletX);
5163 TrkSinglet *singlet = (TrkSinglet*)t[sing];
5164 x = (singlet->coord[0]+singlet->coord[1])/2.;
5165 //
5166 Float_t xsig = singlet->sgnl;
5167 if ( xsig > 8. ) xsig = 8.;
5168 //
5169 Int_t planepad = (singlet->plane * 2) - 1;
5170 trkpad[planepad]->cd();
5171 trkpad[planepad]->Range(-8.1,0.,8.1,8.);
5172 if ( var.bw ){
5173 sigcol2 = -1;
5174 } else {
5175 sigcol2 = 1;
5176 };
5177 ColorTRKMIP(singlet->sgnl,sigcol2,0);
5178 linea = new TLine(x,0.01,x,xsig);
5179 linea->SetLineWidth(2);
5180 linea->SetLineColor(sigcol2);
5181 linea->Draw();
5182 };
5183 //
5184 // singlets Y
5185 //
5186 for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){
5187 TClonesArray &t = *(L2->GetTrkLevel2()->SingletY);
5188 TrkSinglet *singlet = (TrkSinglet*)t[sing];
5189 //
5190 Int_t planepad = (singlet->plane - 1)* 2;
5191 trkpad[planepad]->cd();
5192 trkpad[planepad]->Range(-7.05,0.,7.05,8.);
5193 for (Int_t img=0; img<2; img++){
5194 x = -singlet->coord[img];
5195 Float_t xsig = singlet->sgnl;
5196 if ( xsig > 8. ) xsig = 8.;
5197 //
5198 if ( var.bw ){
5199 sigcol2 = -1;
5200 } else {
5201 sigcol2 = 1;
5202 };
5203 Int_t coloimg = img;
5204 //
5205 // last Y plane is reversed!
5206 //
5207 if ( planepad == 10 ){
5208 if ( img ){
5209 coloimg = 0;
5210 } else {
5211 coloimg = 1;
5212 };
5213 };
5214 ColorTRKMIP(singlet->sgnl,sigcol2,coloimg);
5215 linea = new TLine(x,0.01,x,xsig);
5216 linea->SetLineWidth(2);
5217 linea->SetLineColor(sigcol2);
5218 linea->Draw();
5219 };
5220 };
5221 //
5222 // Measured point relative to tracks and tracks
5223 // + dots on measured points
5224 //
5225 Int_t dcol;
5226 if ( var.bw ){
5227 dcol = 12;
5228 } else {
5229 dcol = 2;
5230 };
5231 //
5232 if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){
5233 for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5234 PamTrack *ptrack= L2->GetTrack(nt);
5235 TrkTrack *track = ptrack->GetTrkTrack();
5236 if ( nt == 0 ){
5237 var.rig = 0.;
5238 if ( track->al[4] != 0. ) var.rig = 1./track->al[4];
5239 var.chi2 = track->chi2;
5240 };
5241 for (Int_t plane = 0; plane<6; plane++){
5242 //
5243 // X view
5244 //
5245 Int_t planepad = (plane * 2) + 1;
5246 trkpad[planepad]->cd();
5247 trkpad[planepad]->Range(-8.1,0.,8.1,8.);
5248 //
5249 x = track->xm[plane];
5250 Float_t xsig = fabs(track->dedx_x[plane]);
5251 if ( track->XGood(plane) ){
5252 //if ( x > -100 ){
5253 if ( xsig > 8. ) xsig = 8.;
5254 if ( var.bw ){
5255 sigcol2 = -1;
5256 } else {
5257 sigcol2 = 1;
5258 };
5259 ColorTRKMIP(fabs(track->dedx_x[plane]),sigcol2,0);
5260 linea = new TLine(x,0.01,x,xsig);
5261 linea->SetLineWidth(2);
5262 linea->SetLineColor(sigcol2);
5263 linea->Draw();
5264 Float_t tx[5] = {x-0.3, x+0.3, x+0.3, x-0.3, x-0.3};
5265 Float_t tz[5] = {0., 0., 0.5, 0.5, 0.};
5266 TPolyLine *tlinea = new TPolyLine(5,tx,tz);
5267 tlinea->SetLineWidth(1);
5268 tlinea->SetLineColor(dcol);
5269 tlinea->SetFillColor(dcol);
5270 tlinea->Draw("f");
5271 tlinea->Draw();
5272 };
5273 //
5274 // Y view
5275 //
5276 planepad = plane * 2;
5277 trkpad[planepad]->cd();
5278 trkpad[planepad]->Range(-7.05,0.,7.05,8.);
5279 x = -track->ym[plane];
5280 xsig = fabs(track->dedx_y[plane]);
5281 if ( track->YGood(plane) ){
5282 // if ( x > -100 ){
5283 if ( xsig > 8. ) xsig = 8.;
5284 if ( var.bw ){
5285 sigcol2 = -1;
5286 } else {
5287 sigcol2 = 1;
5288 };
5289 ColorTRKMIP(fabs(track->dedx_y[plane]),sigcol2,0);
5290 linea = new TLine(x,0.01,x,xsig);
5291 linea->SetLineWidth(2);
5292 linea->SetLineColor(sigcol2);
5293 linea->Draw();
5294 Float_t tx[5] = {x-0.3, x+0.3, x+0.3, x-0.3, x-0.3};
5295 Float_t tz[5] = {0., 0., 0.5, 0.5, 0.};
5296 TPolyLine *tlinea = new TPolyLine(5,tx,tz);
5297 tlinea->SetLineColor(dcol);
5298 tlinea->SetFillColor(dcol);
5299 tlinea->SetLineWidth(1);
5300 tlinea->Draw("f");
5301 tlinea->Draw();
5302 };
5303 };
5304 };// loop on tracks
5305 };
5306 };
5307 //
5308 };
5309 //
5310 // Show track in the plane view!
5311 //
5312 if ( var.AC ){
5313 Float_t xh[6];
5314 Float_t yh1[6];
5315 Float_t yh2[6];
5316 Float_t mag[6];
5317 for (Int_t l = 0; l<6; l++ ){
5318 xh[l] = 0.;
5319 yh1[l] = 0.;
5320 yh2[l] = 0.;
5321 mag[l] = 0.;
5322 };
5323 Int_t ncro = 0;
5324 //
5325 // LEVEL2
5326 //
5327 if ( level.file == 2 ){
5328 //
5329 // first of all plot crosses relatives to tracks
5330 //
5331 if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){
5332 // for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5333 // TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);
5334 for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5335 PamTrack *ptrack= L2->GetTrack(nt);
5336 TrkTrack *track = ptrack->GetTrkTrack();
5337 //
5338 for (Int_t plane = 0; plane<6; plane++){
5339 //
5340 x = track->xm[plane];
5341 Float_t y = -track->ym[plane];
5342 Float_t xsig = fabs(track->dedx_x[plane]);
5343 Float_t ysig = fabs(track->dedx_y[plane]);
5344 // if ( x > -100 && y > -100. ){
5345 if ( track->XGood(plane) && track->YGood(plane) ){
5346 if ( var.bw ){
5347 sigcol1 = -1;
5348 sigcol2 = -1;
5349 } else {
5350 sigcol1 = 1;
5351 sigcol2 = 1;
5352 };
5353 ColorTRKMIP(xsig,sigcol1,0);
5354 ColorTRKMIP(ysig,sigcol2,0);
5355 //
5356 // Draw crosses
5357 //
5358 trplv->cd();
5359 trplv->Range(-7.05,-8.1,7.05,8.1);
5360 //
5361 Float_t mg = ((float)plane+1.)/5.;
5362 Float_t cdx = (0.55/mg)*var.sfx;
5363 Float_t cdy = (0.55/mg)*var.sfy;
5364 Float_t lwx = (0.019)*var.sfy;
5365 Float_t lwy = (0.019)*var.sfx;
5366 //
5367 linea = new TLine(y-lwx/2.,x-cdy,y-lwx/2.,x+cdy);
5368 linea->SetLineWidth(1);
5369 linea->SetLineColor(sigcol1);
5370 linea->Draw();
5371 linea = new TLine(y-cdx,x-lwy/2.,y+cdx,x-lwy/2.);
5372 linea->SetLineWidth(1);
5373 linea->SetLineColor(sigcol2);
5374 linea->Draw();
5375 //
5376 };
5377 };
5378 };
5379 };
5380 //
5381 // try to plot crosses relative to singlets
5382 //
5383 if ( L2->GetTrkLevel2()->nclsx() > 0 && L2->GetTrkLevel2()->nclsy() > 0 ){
5384 for (Int_t plane = 1; plane<7; plane++){
5385 //
5386 // count how many singlet in the x and y view for this plane:
5387 //
5388 Int_t totsx = 0;
5389 Int_t totsy = 0;
5390 TArrayI *orderx = new TArrayI(5000);
5391 TArrayI *ordery = new TArrayI(5000);
5392 TArrayF *arrax = new TArrayF(5000);
5393 TArrayF *array1 = new TArrayF(5000);
5394 TArrayF *array2 = new TArrayF(5000);
5395 TArrayF *sigarrax = new TArrayF(5000);
5396 TArrayF *sigarray = new TArrayF(5000);
5397 for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsx(); sing++){
5398 TClonesArray &t = *(L2->GetTrkLevel2()->SingletX);
5399 TrkSinglet *singlet = (TrkSinglet*)t[sing];
5400 if ( singlet->plane == plane ){
5401 arrax->AddAt(((singlet->coord[0]+singlet->coord[1])/2.),totsx);
5402 sigarrax->AddAt(singlet->sgnl,totsx);
5403 if ( totsx == 0 || ( totsx > 0 && singlet->sgnl < sigarrax->At(orderx->At(totsx-1))) ){
5404 orderx->AddAt(totsx,totsx);
5405 } else {
5406 for (Int_t ord = totsx-1; ord >= 0; ord--){
5407 if ( singlet->sgnl < sigarrax->At(orderx->At(ord)) || ord == 0){
5408 if ( singlet->sgnl < sigarrax->At(orderx->At(ord)) ){
5409 for (Int_t reord = totsx; reord>(ord+1); reord--){
5410 orderx->AddAt(orderx->At(reord-1),reord);
5411 };
5412 orderx->AddAt(totsx,ord+1);
5413 break;
5414 } else {
5415 for (Int_t reord = totsx; reord>0; reord--){
5416 orderx->AddAt(orderx->At(reord-1),reord);
5417 };
5418 orderx->AddAt(totsx,0);
5419 break;
5420 };
5421 };
5422 };
5423 };
5424 totsx++;
5425 };
5426 };
5427 for (Int_t sing = 0; sing < L2->GetTrkLevel2()->nclsy(); sing++){
5428 TClonesArray &t = *(L2->GetTrkLevel2()->SingletY);
5429 TrkSinglet *singlet = (TrkSinglet*)t[sing];
5430 if ( singlet->plane == plane ){
5431 array1->AddAt(singlet->coord[0],totsy);
5432 array2->AddAt(singlet->coord[1],totsy);
5433 sigarray->AddAt(singlet->sgnl,totsy);
5434 if ( totsy == 0 || ( totsy > 0 && singlet->sgnl < sigarray->At(ordery->At(totsy-1))) ){
5435 ordery->AddAt(totsy,totsy);
5436 } else {
5437 for (Int_t ord = totsy-1; ord >= 0; ord--){
5438 if ( singlet->sgnl < sigarray->At(ordery->At(ord)) || ord == 0){
5439 if ( singlet->sgnl < sigarray->At(ordery->At(ord)) ){
5440 for (Int_t reord = totsy; reord>(ord+1); reord--){
5441 ordery->AddAt(ordery->At(reord-1),reord);
5442 };
5443 ordery->AddAt(totsy,ord+1);
5444 break;
5445 } else {
5446 for (Int_t reord = totsy; reord>0; reord--){
5447 ordery->AddAt(ordery->At(reord-1),reord);
5448 };
5449 ordery->AddAt(totsy,0);
5450 break;
5451 };
5452 };
5453 };
5454 };
5455 totsy++;
5456 };
5457 };
5458 //
5459 if ( totsx && totsy ){
5460 for (Int_t sing = 0; sing < min(totsx,totsy); sing++){
5461 //
5462 x = arrax->At(orderx->At(sing));
5463 Float_t y1 = -array1->At(ordery->At(sing));
5464 Float_t y2 = -array2->At(ordery->At(sing));
5465 Float_t xsig = sigarrax->At(orderx->At(sing));
5466 Float_t ysig = sigarray->At(ordery->At(sing));
5467 if ( x > -100 && y1 > -100. ){
5468 if ( var.bw ){
5469 sigcol1 = -1;
5470 sigcol2 = -1;
5471 } else {
5472 sigcol1 = 1;
5473 sigcol2 = 1;
5474 };
5475 Int_t img = 0;
5476 if ( plane == 6 ) img = 1;
5477 ColorTRKMIP(xsig,sigcol1,img);
5478 ColorTRKMIP(ysig,sigcol2,img);
5479 //
5480 // Draw crosses
5481 //
5482 trplv->cd();
5483 trplv->Range(-7.05,-8.1,7.05,8.1);
5484 //
5485 Float_t mg = ((float)plane)/5.;
5486 Float_t cdx = (0.55/mg)*var.sfx;
5487 Float_t cdy = (0.55/mg)*var.sfy;
5488 Float_t lwx = (0.019)*var.sfy;
5489 Float_t lwy = (0.019)*var.sfx;
5490 //
5491 linea = new TLine(y1-lwx/2.,x-cdy,y1-lwx/2.,x+cdy);
5492 linea->SetLineWidth(1);
5493 linea->SetLineColor(sigcol1);
5494 linea->Draw();
5495 linea = new TLine(y1-cdx,x-lwy/2.,y1+cdx,x-lwy/2.);
5496 linea->SetLineWidth(1);
5497 linea->SetLineColor(sigcol2);
5498 linea->Draw();
5499 //
5500 };
5501 if ( x > -100 && y2 > -100. ){
5502 if ( var.bw ){
5503 sigcol1 = -1;
5504 sigcol2 = -1;
5505 } else {
5506 sigcol1 = 1;
5507 sigcol2 = 1;
5508 };
5509 Int_t img = 1;
5510 if ( plane == 6 ) img = 0;
5511 ColorTRKMIP(xsig,sigcol1,img);
5512 ColorTRKMIP(ysig,sigcol2,img);
5513 //
5514 // Draw crosses
5515 //
5516 trplv->cd();
5517 trplv->Range(-7.05,-8.1,7.05,8.1);
5518 //
5519 Float_t mg = ((float)plane)/5.;
5520 Float_t cdx = (0.55/mg)*var.sfx;
5521 Float_t cdy = (0.55/mg)*var.sfy;
5522 Float_t lwx = (0.019)*var.sfy;
5523 Float_t lwy = (0.019)*var.sfx;
5524 //
5525 linea = new TLine(y2-lwx/2.,x-cdy,y2-lwx/2.,x+cdy);
5526 linea->SetLineWidth(1);
5527 linea->SetLineColor(sigcol1);
5528 linea->Draw();
5529 linea = new TLine(y2-cdx,x-lwy/2.,y2+cdx,x-lwy/2.);
5530 linea->SetLineWidth(1);
5531 linea->SetLineColor(sigcol2);
5532 linea->Draw();
5533 };
5534 };
5535 };
5536 };
5537 };
5538 };
5539 //
5540 // LEVEL0 or LEVEL-1
5541 //
5542 if ( level.file == 0 || level.file == -1 ){
5543 for (Int_t l = 0; l<12; l++ ){
5544 Float_t xsig = 0.;
5545 Float_t ysig = 0.;
5546 Int_t planeno = trk->DSPnumber[l]-1;
5547 for (Int_t e = 0; e<12;e++){
5548 Int_t planeno2 = trk->DSPnumber[e]-1;
5549 if ( planeno == planeno2-1 ){
5550 if ( planeno < 0 || planeno > 11 ) planeno = 0;
5551 if ( planeno >= 0 && !var.nosig ) {
5552 mag[ncro] = ((float)planeno+1.)/5.;
5553 if ( (planeno+1)%2 ){
5554 for (Int_t m = 0; m<3; m++){
5555 if ( trk->signcluster[l][m] != 0. ){
5556 if ( planeno == 10 ) {
5557 x = trk->addrcluster[l][m];
5558 } else {
5559 x = 1024 - trk->addrcluster[l][m];
5560 };
5561 x += 1024.;
5562 if ( trk->signcluster[l][m]> ysig ){
5563 ysig = trk->signcluster[l][m];
5564 yh1[ncro] = x - 1024.;
5565 yh2[ncro] = x;
5566 };
5567 };
5568 };
5569 for (Int_t m = 0; m<3; m++){
5570 if ( trk->signcluster[e][m] != 0. ){
5571 x = trk->addrcluster[e][m] + 1024. * m;
5572 if ( trk->signcluster[e][m]> xsig ){
5573 xsig = trk->signcluster[e][m];
5574 xh[ncro] = x;
5575 };
5576 };
5577 };
5578 } else {
5579 for (Int_t m = 0; m<3; m++){
5580 if ( trk->signcluster[l][m] != 0. ){
5581 x = trk->addrcluster[l][m] + 1024. * m;
5582 if ( trk->signcluster[l][m]> xsig ){
5583 xsig = trk->signcluster[l][m];
5584 xh[ncro] = x;
5585 };
5586 };
5587 };
5588 if ( (planeno+1)%2 ){
5589 for (Int_t m = 0; m<3; m++){
5590 if ( trk->signcluster[e][m] != 0. ){
5591 if ( planeno == 10 ) {
5592 x = trk->addrcluster[e][m];
5593 } else {
5594 x = 1024 - trk->addrcluster[e][m];
5595 };
5596 x += 1024.;
5597 if ( trk->signcluster[e][m]> ysig ){
5598 ysig = trk->signcluster[e][m];
5599 yh1[ncro] = x - 1024.;
5600 yh2[ncro] = x;
5601 };
5602 };
5603 };
5604 };
5605 };
5606 if ( ysig > 0. && xsig > 0. ) {
5607 ncro++;
5608 };
5609 };
5610 };
5611 };
5612 };
5613 //
5614 // Draw crosses
5615 //
5616 if ( ncro && var.AC ) {
5617 trplv->cd();
5618 trplv->Range(0.,0.,2076.,3100.);
5619 for ( Int_t i = 0; i<ncro; i++){
5620 //
5621 Float_t cdx = (55./mag[i])*var.sfx;
5622 Float_t cdy = (55./mag[i])*var.sfy;
5623 Float_t lwx = (1.9)*var.sfy;
5624 Float_t lwy = (1.9)*var.sfx;
5625 //
5626 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
5627 linea->SetLineWidth((int)lwx);
5628 linea->SetLineColor(sigcol1);
5629 linea->Draw();
5630 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
5631 linea->SetLineWidth((int)lwy);
5632 linea->SetLineColor(sigcol1);
5633 linea->Draw();
5634 //
5635 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
5636 linea->SetLineWidth((int)lwx);
5637 linea->SetLineColor(sigcol2);
5638 linea->Draw();
5639 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
5640 linea->SetLineWidth((int)lwy);
5641 linea->SetLineColor(sigcol2);
5642 linea->Draw();
5643 };
5644 };
5645 };
5646 };
5647 }
5648
5649 void FEVdetector::ShowTrack(){
5650 //
5651 if ( level.file != 2 ) return;
5652 //
5653 //
5654 //
5655 if ( var.CALO && var.CALOT ){
5656 if ( L2->GetCaloLevel2()->npcfit[0] > 0 && L2->GetCaloLevel2()->npcfit[1] > 0 ){
5657 Float_t calx[22];
5658 Float_t caly[22];
5659 Float_t calzx[22];
5660 Float_t calzy[22];
5661 Float_t zpiano[22];
5662 zpiano[0] = (CTZ+118.)*var.sfy/1000.;
5663 for (Int_t plane = 1; plane < 22; plane++){
5664 if ( !(plane%2) ){
5665 zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.;
5666 }else {
5667 zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.;
5668 };
5669 };
5670 for (Int_t plane = 0; plane < 22; plane++){
5671 calx[plane] = (L2->GetCaloLevel2()->cbar[plane][0]/100.)*var.sfx + var.xxvc;;
5672 caly[plane] = (-L2->GetCaloLevel2()->cbar[plane][1]/100.)*var.sfx + var.xyvc;
5673 // calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;
5674 calzx[plane] = zpiano[plane] + var.yxvc;
5675 calzy[plane] = zpiano[plane] + var.yyvc;
5676 // printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]);
5677 };
5678 //
5679 // Calorimeter track
5680 //
5681 Int_t trcol = 30;
5682 if ( var.bw ){
5683 trcol = 14;
5684 } else {
5685 trcol = 44;
5686 };
5687 thefigure->cd();
5688 TPolyLine *trakx = new TPolyLine(22,calx,calzx);
5689 trakx->SetLineColor(trcol);
5690 if ( L2->GetCaloLevel2()->fitmode[0] == 1 ) trakx->SetLineStyle(3);
5691 if ( L2->GetCaloLevel2()->fitmode[0] == 2 ) trakx->SetLineStyle(4);
5692 trakx->SetLineWidth(2);
5693 trakx->Draw();
5694 TPolyLine *traky = new TPolyLine(22,caly,calzy);
5695 traky->SetLineColor(trcol);
5696 if ( L2->GetCaloLevel2()->fitmode[1] == 1 ) traky->SetLineStyle(3);
5697 if ( L2->GetCaloLevel2()->fitmode[1] == 2 ) traky->SetLineStyle(4);
5698 traky->SetLineWidth(2);
5699 traky->Draw();
5700 };
5701 if ( L2->GetCaloLevel2()->npcfit[2] > 0 ){
5702 Float_t calx[22];
5703 Float_t caly[22];
5704 Float_t calzx[22];
5705 Float_t calzy[22];
5706 Float_t zpiano[22];
5707 zpiano[0] = (CTZ+118.)*var.sfy/1000.;
5708 for (Int_t plane = 1; plane < 22; plane++){
5709 if ( !(plane%2) ){
5710 zpiano[plane] = zpiano[plane-1] - 8.09*var.sfy/1000.;
5711 }else {
5712 zpiano[plane] = zpiano[plane-1] - 10.09*var.sfy/1000.;
5713 };
5714 };
5715 //
5716 //
5717 CaloTrkVar *ctra = L2->GetCaloStoredTrack(-1);
5718 //
5719 for (Int_t plane = 0; plane < 22; plane++){
5720 calx[plane] = (ctra->tbar[plane][0]/100.)*var.sfx + var.xxvc;;
5721 caly[plane] = (-ctra->tbar[plane][1]/100.)*var.sfx + var.xyvc;
5722 // calzx[plane] = zpiano[plane] -5.81*var.sfy/1000. + var.yxvc;
5723 calzx[plane] = zpiano[plane] + var.yxvc;
5724 calzy[plane] = zpiano[plane] + var.yyvc;
5725 // printf(" calx %f caly %f calzx %f calzy %f \n",calx[plane],caly[plane],calzx[plane],calzy[plane]);
5726 };
5727 //
5728 // Calorimeter track
5729 //
5730 Int_t trcol = 30;
5731 if ( var.bw ){
5732 trcol = 16;
5733 } else {
5734 trcol = 46;
5735 };
5736 thefigure->cd();
5737 TPolyLine *trakx = new TPolyLine(22,calx,calzx);
5738 trakx->SetLineColor(trcol);
5739 trakx->SetLineStyle(3);
5740 trakx->SetLineWidth(2);
5741 trakx->Draw();
5742 TPolyLine *traky = new TPolyLine(22,caly,calzy);
5743 traky->SetLineColor(trcol);
5744 traky->SetLineStyle(3);
5745 traky->SetLineWidth(2);
5746 traky->Draw();
5747 };
5748 };
5749 //
5750 if ( !var.TRK ) return;
5751 //
5752 if ( L2->GetTrkLevel2()->GetNTracks() > 0 ){
5753 for (Int_t nt = 0; nt < L2->GetTrkLevel2()->GetNTracks(); nt++){
5754
5755 // TrkTrack *track = L2->GetTrkLevel2()->GetTrack(nt);
5756 // printf("qui \n");
5757 PamTrack *ptrack = L2->GetTrack(nt);
5758 TrkTrack *track = ptrack->GetTrkTrack();
5759 // printf("qua \n");
5760 Int_t npoint = 100;
5761 Float_t zin[100];
5762 Double_t xout[100];
5763 Double_t yout[100];
5764 Int_t ifail = 0;
5765 Int_t trcol = 10;
5766 //
5767 Float_t tx[100];
5768 Float_t ty[100];
5769 Float_t ptx1[50];
5770 Float_t pty1[50];
5771 Float_t ptx2[50];
5772 Float_t pty2[50];
5773 Float_t tx1[15];
5774 Float_t ty1[15];
5775 Float_t tzx[100];
5776 Float_t tzy[100];
5777 Float_t tzx1[15];
5778 Float_t tzy1[15];
5779 //
5780 for ( Int_t e = 0; e < 100 ; e++) {
5781 xout[e] = 0.;
5782 yout[e] = 0.;
5783 //
5784 tx[e] = 0.;
5785 ty[e] = 0.;
5786 tzx[e] = 0.;
5787 tzy[e] = 0.;
5788 if ( e < 50 ){
5789 ptx1[e] = 0.;
5790 pty1[e] = 0.;
5791 ptx2[e] = 0.;
5792 pty2[e] = 0.;
5793 if ( e < 15 ){
5794 tx1[e] = 0.;
5795 ty1[e] = 0.;
5796 tzx1[e] = 0.;
5797 tzy1[e] = 0.;
5798 };
5799 };
5800 //
5801 zin[e] = 60. - (124./99.)*(float)e;
5802 };
5803 //
5804 zin[85] = -45.5;
5805 //
5806 Trajectory *tr = new Trajectory(npoint,zin);
5807 //
5808 // ifail = track->DoTrack2(tr);
5809 ifail = track->DoTrack(tr);
5810 //
5811 if ( !ifail ){
5812 for ( Int_t e = 0; e < npoint ; e++) {
5813 tx[e] = ((float)tr->x[e]/100.)*var.sfx + var.xxvc;
5814 ty[e] = (-(float)tr->y[e]/100.)*var.sfx + var.xyvc;
5815 if ( e < 50 ) {
5816 ptx1[e] = (-(float)tr->y[e]/100.)*var.sfx + var.xcat;
5817 pty1[e] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5818 } else {
5819 ptx2[e-50] = (-(float)tr->y[e]/100.)*var.sfx + var.xcat;
5820 pty2[e-50] = ((float)tr->x[e]/100.)*var.sfy + var.ycat;
5821 };
5822 if ( e > 84 ) {
5823 tx1[e-85] = ((float)tr->x[e]/100.)*var.nds4 + var.xxvc;
5824 ty1[e-85] = (-(float)tr->y[e]/100.)*var.nds4 + var.xyvc;
5825 tzx1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5826 tzy1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5827 };
5828 tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5829 tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5830 // printf("tx[e] %f ty [e] %f tzx %f tzy %f \n",tx[e],ty[e],tzx[e],tzy[e]);
5831 };
5832 //
5833 // From S1 to CALO
5834 //
5835 if ( var.bw ){
5836 trcol = 17-nt;
5837 } else {
5838 trcol = 50-nt;
5839 };
5840 thefigure->cd();
5841 TPolyLine *trackx = new TPolyLine(86,tx,tzx);
5842 trackx->SetLineColor(trcol);
5843 trackx->SetLineWidth(1);
5844 trackx->Draw();
5845 TPolyLine *tracky = new TPolyLine(86,ty,tzy);
5846 tracky->SetLineColor(trcol);
5847 tracky->SetLineWidth(1);
5848 tracky->Draw();
5849 //
5850 // ND and S4
5851 //
5852 if ( var.tracknds4 ){
5853 TPolyLine *trackx1 = new TPolyLine(15,tx1,tzx1);
5854 trackx1->SetLineColor(trcol);
5855 trackx1->SetLineWidth(1);
5856 trackx1->Draw();
5857 TPolyLine *tracky1 = new TPolyLine(15,ty1,tzy1);
5858 tracky1->SetLineColor(trcol);
5859 tracky1->SetLineWidth(1);
5860 tracky1->Draw();
5861 };
5862 //
5863 // Plane View
5864 //
5865 if ( var.AC ){
5866 TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1);
5867 trackp1->SetLineColor(trcol);
5868 trackp1->SetLineWidth(1);
5869 trackp1->Draw();
5870 TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2);
5871 trackp2->SetLineColor(trcol);
5872 trackp2->SetLineWidth(1);
5873 trackp2->SetLineStyle(3);
5874 trackp2->Draw();
5875 };
5876
5877 } else {
5878 pamgui->DIALOG(1," Failed in determining the track! ");
5879 printf(" WARNING: failed in determining the track! \n");
5880 };
5881 };
5882 };
5883 }
5884
5885 void FEVdetector::ShowCalo(Bool_t upd){
5886 //
5887 //
5888 //
5889 if ( !var.CALO ) return;
5890 //
5891 var.qtot = 0;
5892 var.nstrip = 0;
5893 //
5894 if ( level.file == 0 ){
5895 //
5896 // Book the histograms:
5897 //
5898 //
5899 stringstream delex;
5900 delex.str("");
5901 delex << "x-view event " << (thisentry+1);
5902 stringstream deley;
5903 deley.str("");
5904 deley << "y-view event " << (thisentry+1);
5905 gDirectory->Delete(delex.str().c_str());
5906 gDirectory->Delete(deley.str().c_str());
5907 TH2F *Xview = new TH2F(delex.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5908 TH2F *Yview = new TH2F(deley.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5909 Xview->GetYaxis()->SetLabelColor(10);
5910 Yview->GetYaxis()->SetLabelColor(10);
5911 //
5912 // figures:
5913 //
5914 Int_t bgcolor = 10;
5915 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);
5916 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);
5917
5918 pd1->SetFillStyle(4000);
5919 pd1->SetFillColor(0);
5920 pd1->SetFrameFillStyle(4000);
5921 pd2->SetFillStyle(4000);
5922 pd2->SetFillColor(0);
5923 pd2->SetFrameFillStyle(4000);
5924
5925 TLatex *t=new TLatex();
5926 t->SetTextFont(32);
5927 t->SetTextColor(1);
5928 t->SetTextSize(0.03);
5929 t->SetTextAlign(12);
5930 pd1->Range(0.,0.,1.,1.);
5931 pd2->Range(0.,0.,1.,1.);
5932 pd1->SetTicks();
5933 pd2->SetTicks();
5934 pd1->Draw();
5935 pd2->Draw();
5936
5937 pd1->cd();
5938 gStyle->SetOptStat(0);
5939 Xview->GetYaxis()->SetTitleOffset(0.5);
5940 Xview->SetFillColor(bgcolor);
5941 Xview->Fill(1.,1.,1.);
5942 Xview->Draw("box");
5943 pd1->Update();
5944 pd2->cd();
5945 gStyle->SetOptStat(0);
5946 Yview->GetYaxis()->SetTitleOffset(0.5);
5947 Yview->SetFillColor(bgcolor);
5948 Yview->Fill(1.,1.,1.);
5949 Yview->Draw("box");
5950 pd2->Update();
5951
5952 //
5953 // run over views and planes
5954 //
5955 stringstream xevent;
5956 stringstream yevent;
5957 Float_t sdexy[2][22][96];
5958 Float_t sdexyc[2][22][96];
5959 //
5960 for (Int_t m = 0; m < 22; m++){
5961 for (Int_t l = 0; l < 2; l++){
5962 //
5963 // determine the section number
5964 //
5965 Int_t se = 5;
5966 if ( !l && m%2 == 0 ) se = 3;
5967 if ( !l && m%2 != 0 ) se = 2;
5968 if ( l && m%2 != 0 ) se = 1;
5969 if ( l && m%2 == 0 ) se = 0;
5970 //
5971 // determine what kind of event we are going to analyze
5972 //
5973 bool isCOMP = 0;
5974 bool isFULL = 0;
5975 bool isRAW = 0;
5976 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
5977 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
5978 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
5979 //
5980 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
5981 //
5982 Int_t pre = -1;
5983 if ( isRAW ){
5984 for (Int_t nn = 0; nn < 96; nn++){
5985 if ( nn%16 == 0 ) pre++;
5986 evento.base[l][m][pre] = calib.calbase[l][m][pre];
5987 sdexy[l][m][nn] = evento.dexy[l][m][nn];
5988 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
5989 sdexyc[l][m][nn] = evento.dexy[l][m][nn];
5990 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
5991 };
5992 };
5993 //
5994 // run over strips
5995 //
5996 Int_t done = 0;
5997 Int_t rdone = 0;
5998 Int_t fdone = 0;
5999 pre = -1;
6000 for (Int_t n =0 ; n < 96; n++){
6001 if ( n%16 == 0 ) {
6002 pre++;
6003 done = 0;
6004 rdone = 0;
6005 fdone = 0;
6006 };
6007 //
6008 // baseline check and calculation
6009 //
6010 if ( isRAW ) {
6011 //
6012 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
6013 // if not calculate it with relaxed algorithm.
6014 //
6015 if ( !rdone ){
6016 CaloFindBaseRaw(l,m,pre);
6017 rdone = 1;
6018 };
6019 //
6020 // no suitable new baseline, use old ones
6021 //
6022 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
6023 evento.base[l][m][pre] = calib.sbase[l][m][pre];
6024 Int_t upnn = n+16;
6025 if ( upnn > 96 ) upnn = 96;
6026 for ( Int_t nn = n; nn<upnn; nn++ ){
6027 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
6028 };
6029 done = 1;
6030 };
6031 if ( !fdone ){
6032 CaloCompressData(l,m,pre);
6033 fdone = 1;
6034 };
6035 };
6036 //
6037 if ( de->dexyc[l][m][n] > 0. || ( isRAW && evento.dexyc[l][m][n] > 0. )){
6038 xevent.str("");
6039 yevent.str("");
6040 xevent << "x-view event " << n;
6041 xevent << " " << m;
6042 xevent << " " << l;
6043 yevent << "y-view event " << n;
6044 yevent << " " << m;
6045 yevent << " " << l;
6046 gDirectory->Delete(xevent.str().c_str());
6047 gDirectory->Delete(yevent.str().c_str());
6048 TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6049 TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6050 Int_t colo;
6051 if ( var.bw ){
6052 colo = 17;
6053 } else {
6054 colo = 38;
6055 };
6056 Xview->SetFillColor(colo);
6057 Yview->SetFillColor(colo);
6058 if ( l == 0 ) {
6059 Xview->Fill(n,21-m,1.);
6060 pd1->cd();
6061 Xview->Draw("box same");
6062 };
6063 if ( l == 1 ) {
6064 Yview->Fill(95-n,21-m,1.);
6065 pd2->cd();
6066 Yview->Draw("box same");
6067 };
6068 };
6069 };
6070 };
6071 };
6072 pd1->Update();
6073 pd2->Update();
6074 var.qtot=0;
6075 var.nstrip=0;
6076 };
6077 //
6078 if ( level.file == -1 ){
6079 Float_t qtot;
6080 Int_t nstrip;
6081 //
6082 // Define variables
6083 //
6084 UInt_t etime = var.etime;
6085 Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];
6086 Int_t badstrip = 0;
6087 qtot = 0.;
6088 nstrip = 0;
6089 //
6090 // Book the histograms:
6091 //
6092 //
6093 stringstream xvev;
6094 stringstream yvev;
6095 xvev.str("");
6096 yvev.str("");
6097 xvev << "x-view event " << (thisentry+1);
6098 yvev << "y-view event " << (thisentry+1);
6099 gDirectory->Delete(xvev.str().c_str());
6100 gDirectory->Delete(yvev.str().c_str());
6101 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6102 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6103 Xview->GetYaxis()->SetLabelColor(10);
6104 Yview->GetYaxis()->SetLabelColor(10);
6105 //
6106 // figures:
6107 //
6108 Int_t bgcolor = 10;
6109 gDirectory->Delete("caloy");
6110 gDirectory->Delete("calox");
6111 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);
6112 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);
6113 if ( upd ){
6114
6115 pd1->SetFillStyle(4000);
6116 pd1->SetFillColor(0);
6117 pd1->SetFrameFillStyle(4000);
6118 pd2->SetFillStyle(4000);
6119 pd2->SetFillColor(0);
6120 pd2->SetFrameFillStyle(4000);
6121
6122 TLatex *t=new TLatex();
6123 t->SetTextFont(32);
6124 t->SetTextColor(1);
6125 t->SetTextSize(0.03);
6126 t->SetTextAlign(12);
6127 pd1->Range(0.,0.,1.,1.);
6128 pd2->Range(0.,0.,1.,1.);
6129 pd1->SetTicks();
6130 pd2->SetTicks();
6131 pd1->Draw();
6132 pd2->Draw();
6133
6134 pd1->cd();
6135 gStyle->SetOptStat(0);
6136 Xview->GetYaxis()->SetTitleOffset(0.5);
6137 Xview->SetFillColor(bgcolor);
6138 Xview->Fill(1.,1.,1.);
6139 Xview->Draw("box");
6140 pd1->Update();
6141 pd2->cd();
6142 gStyle->SetOptStat(0);
6143 Yview->GetYaxis()->SetTitleOffset(0.5);
6144 Yview->SetFillColor(bgcolor);
6145 Yview->Fill(1.,1.,1.);
6146 Yview->Draw("box");
6147 pd2->Update();
6148 };
6149 //
6150 // for each event check that the calibration we are using are still within calibration limits, if not call the next calibration
6151 //
6152 for (Int_t s = 0; s < 4; s++){
6153 if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){
6154 while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){
6155 printf(" CALORIMETER: \n" );
6156 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]);
6157 printf(" END CALORIMETER. \n\n" );
6158 b[s]++;
6159 CaloPede(s);
6160 };
6161 };
6162 };
6163 //
6164 // run over views and planes
6165 //
6166 stringstream xve;
6167 stringstream yve;
6168 for (Int_t l = 0; l < 2; l++){
6169 for (Int_t m = 0; m < 22; m++){
6170 //
6171 // determine the section number
6172 //
6173 Int_t se = 5;
6174 if (l == 0 && m%2 == 0) se = 3;
6175 if (l == 0 && m%2 != 0) se = 2;
6176 if (l == 1 && m%2 != 0) se = 1;
6177 if (l == 1 && m%2 == 0) se = 0;
6178 //
6179 // determine what kind of event we are going to analyze
6180 //
6181 bool isCOMP = 0;
6182 bool isFULL = 0;
6183 bool isRAW = 0;
6184 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
6185 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
6186 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
6187 //
6188 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
6189 //
6190 Int_t pre = -1;
6191 if ( isRAW ){
6192 for (Int_t nn = 0; nn < 96; nn++){
6193 if ( nn%16 == 0 ) pre++;
6194 evento.base[l][m][pre] = calib.calbase[l][m][pre];
6195 sdexy[l][m][nn] = evento.dexy[l][m][nn];
6196 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
6197 sdexyc[l][m][nn] = evento.dexy[l][m][nn];
6198 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
6199 };
6200 };
6201 //
6202 // run over strips
6203 //
6204 Int_t done = 0;
6205 Int_t rdone = 0;
6206 Int_t fdone = 0;
6207 pre = -1;
6208 for (Int_t n =0 ; n < 96; n++){
6209 if ( n%16 == 0 ) {
6210 pre++;
6211 done = 0;
6212 rdone = 0;
6213 fdone = 0;
6214 };
6215 //
6216 // baseline check and calculation
6217 //
6218 if ( !isRAW ) {
6219 //
6220 // 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.
6221 //
6222 if ( !done ){
6223 evento.base[l][m][pre] = de->base[l][m][pre] ;
6224 evento.dexyc[l][m][n] = de->dexyc[l][m][n] ;
6225 };
6226 } else {
6227 //
6228 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
6229 // if not calculate it with relaxed algorithm.
6230 //
6231 if ( !rdone ){
6232 CaloFindBaseRaw(l,m,pre);
6233 rdone = 1;
6234 };
6235 };
6236 //
6237 // no suitable new baseline, use old ones
6238 //
6239 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
6240 evento.base[l][m][pre] = calib.sbase[l][m][pre];
6241 Int_t upnn = n+16;
6242 if ( upnn > 96 ) upnn = 96;
6243 for ( Int_t nn = n; nn<upnn; nn++ ){
6244 if ( !isRAW ){
6245 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
6246 } else {
6247 evento.dexyc[l][m][nn] = de->dexy[l][m][nn] ;
6248 };
6249 };
6250 CaloCompressData(l,m,pre);
6251 done = 1;
6252 };
6253 //
6254 // CALIBRATION ALGORITHM
6255 //
6256 basel = evento.base[l][m][pre];
6257 ener = evento.dexyc[l][m][n];
6258 estrip[l][m][n] = 0.;
6259 if ( basel>0 && basel < 30000. && ener > 0. ){
6260 estrip[l][m][n] = (ener - calib.calped[l][m][n] - basel)/mip[l][m][n] ;
6261 //
6262 // 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)
6263 //
6264 if ( upd ){
6265 xve.str("");
6266 yve.str("");
6267 xve << "x-view event " << n;
6268 xve << " " << m;
6269 xve << " " << l;
6270 yve << "y-view event " << n;
6271 yve << " " << m;
6272 yve << " " << l;
6273 gDirectory->Delete(xve.str().c_str());
6274 gDirectory->Delete(yve.str().c_str());
6275 TH2F *Xview = new TH2F(xve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6276 TH2F *Yview = new TH2F(yve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6277 if ( estrip[l][m][n] > 0.7 && !var.nosig ){
6278 Int_t colo;
6279 if ( var.bw ){
6280 colo = -1;
6281 } else {
6282 colo = 1;
6283 };
6284 ColorMIP(estrip[l][m][n],colo);
6285 Xview->SetFillColor(colo);
6286 Yview->SetFillColor(colo);
6287 if ( l == 0 ) {
6288 Xview->Fill(n,21-m,1.);
6289 pd1->cd();
6290 Xview->Draw("box same");
6291 };
6292 if ( l == 1 ) {
6293 Yview->Fill(96-n,21-m,1.);
6294 pd2->cd();
6295 Yview->Draw("box same");
6296 };
6297 };
6298 };
6299 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++;
6300 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) {
6301 qtot += estrip[l][m][n];
6302 nstrip++;
6303 };
6304 };
6305 calib.sbase[l][m][pre] = evento.base[l][m][pre];
6306 };
6307 };
6308 };
6309 if ( upd ){
6310 pd1->Update();
6311 pd2->Update();
6312 };
6313 var.qtot=(int)qtot;
6314 var.nstrip=nstrip;
6315 };
6316 //
6317 if ( level.file == 2 ){
6318 //
6319 // Book the histograms:
6320 //
6321 //
6322 stringstream xview;
6323 stringstream yview;
6324 xview.str("");
6325 yview.str("");
6326 xview << "x-view event " << (thisentry+1);
6327 yview << "y-view event " << (thisentry+1);
6328 gDirectory->Delete(xview.str().c_str());
6329 gDirectory->Delete(yview.str().c_str());
6330 TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6331 TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6332 Xview->GetYaxis()->SetLabelColor(10);
6333 Yview->GetYaxis()->SetLabelColor(10);
6334 //
6335 // figures:
6336 //
6337 Int_t bgcolor = 10;
6338 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);
6339 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);
6340
6341 pd1->SetFillStyle(4000);
6342 pd1->SetFillColor(0);
6343 pd1->SetFrameFillStyle(4000);
6344 pd2->SetFillStyle(4000);
6345 pd2->SetFillColor(0);
6346 pd2->SetFrameFillStyle(4000);
6347
6348 TLatex *t=new TLatex();
6349 t->SetTextFont(32);
6350 t->SetTextColor(1);
6351 t->SetTextSize(0.03);
6352 t->SetTextAlign(12);
6353 pd1->Range(0.,0.,1.,1.);
6354 pd2->Range(0.,0.,1.,1.);
6355 pd1->SetTicks();
6356 pd2->SetTicks();
6357 pd1->Draw();
6358 pd2->Draw();
6359
6360 pd1->cd();
6361 gStyle->SetOptStat(0);
6362 Xview->GetYaxis()->SetTitleOffset(0.5);
6363 Xview->SetFillColor(bgcolor);
6364 Xview->Fill(1.,1.,1.);
6365 Xview->Draw("box");
6366 pd1->Update();
6367 pd2->cd();
6368 gStyle->SetOptStat(0);
6369 Yview->GetYaxis()->SetTitleOffset(0.5);
6370 Yview->SetFillColor(bgcolor);
6371 Yview->Fill(1.,1.,1.);
6372 Yview->Draw("box");
6373 pd2->Update();
6374
6375 //
6376 // run over views and planes
6377 //
6378 stringstream xvev;
6379 stringstream yvev;
6380 for (Int_t ii = 0; ii < L2->GetCaloLevel2()->nstrip; ii++){
6381 Int_t colo;
6382 Int_t l;
6383 Int_t m;
6384 Int_t n;
6385 Bool_t satura = false;
6386 Float_t mip = L2->GetCaloLevel1()->DecodeEstrip(ii,l,m,n,satura);
6387 if ( var.bw ){
6388 colo = -1;
6389 } else {
6390 colo = 1;
6391 };
6392 ColorMIP(mip,colo);
6393 if ( l == 0 ) {
6394 xvev.str("");
6395 xvev << "x-view event " << n;
6396 xvev << " " << m;
6397 xvev << " " << l;
6398 gDirectory->Delete(xvev.str().c_str());
6399 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6400 if ( satura ){
6401 Xview->SetFillColor(kBlack);
6402 } else {
6403 Xview->SetFillColor(colo);
6404 };
6405 Xview->Fill(n,21-m,1.);
6406 pd1->cd();
6407 Xview->Draw("box same");
6408 };
6409 if ( l == 1 ) {
6410 yvev.str("");
6411 yvev << "y-view event " << n;
6412 yvev << " " << m;
6413 yvev << " " << l;
6414 gDirectory->Delete(yvev.str().c_str());
6415 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
6416 if ( satura ){
6417 Yview->SetFillColor(kBlack);
6418 } else {
6419 Yview->SetFillColor(colo);
6420 };
6421 Yview->Fill(96-n,21-m,1.);
6422 pd2->cd();
6423 Yview->Draw("box same");
6424 };
6425 };
6426 pd1->Update();
6427 pd2->Update();
6428 var.qtot=(int)L2->GetCaloLevel2()->qtot;
6429 var.nstrip=(int)L2->GetCaloLevel2()->nstrip;
6430 };
6431 }
6432
6433 void FEVdetector::Calo1stcalib(){
6434 Float_t estrip[2][22][96];
6435 //
6436 // this is the value of the mip for each strip. To be changed when we will have the real values
6437 //
6438 for (Int_t s=0; s<4;s++){
6439 for (Int_t d = 0; d<50; d++){
6440 calib.ttime[s][d] = 0 ;
6441 if ( d < 49 ) calib.time[s][d] = 0 ;
6442 };
6443 };
6444 defcalib = false;
6445 //
6446 retry:
6447 //
6448 for (Int_t m = 0; m < 2 ; m++ ){
6449 for (Int_t k = 0; k < 22; k++ ){
6450 for (Int_t l = 0; l < 96; l++ ){
6451 calib.calped[m][k][l] = 0. ;
6452 estrip[m][k][l] = 0.;
6453 };
6454 };
6455 }
6456 //
6457 // first of all find the calibrations in the file
6458 //
6459 OLDCaloFindCalibs();
6460 //
6461 // print on the screen the results:
6462 //
6463 printf(" ---------------------------------------------------------- \n \n");
6464 Int_t calibex = 0;
6465 for (Int_t s=0; s<4;s++){
6466 Int_t stop = 0;
6467 for (Int_t d = 0; d<48; d++){
6468 if ( calib.ttime[s][d] != 0 ) calibex++;
6469 if ( calib.time[s][0] != 0 ){
6470 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]);
6471 if ( calib.time[s][d+1] != 0 ) {
6472 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]);
6473 } else {
6474 if ( !stop ){
6475 printf(" Section %i from time %u use calibration at time %u \n",s,calib.time[s][d],calib.ttime[s][d+1]);
6476 stop = 1;
6477 };
6478 };
6479 } else {
6480 if ( calib.ttime[s][d] != 0 ) printf(" Section %i from time 0 use calibration at time %u \n",s,calib.ttime[s][d]);
6481 };
6482 };
6483 printf("\n");
6484 };
6485 printf(" ---------------------------------------------------------- \n");
6486 if ( calibex < 1 ) {
6487 printf("No full calibration data in this file\n");
6488 printf(" Using default calibration \n");
6489 defcalib = true;
6490 goto retry;
6491 };
6492 //
6493 // calibrate before starting
6494 //
6495 for (Int_t s = 0; s < 4; s++){
6496 b[s]=0;
6497 CaloPede(s);
6498 };
6499 }
6500
6501 int FEVdetector::OLDCaloFindCalibs(){
6502 for (Int_t s = 0; s < 4; s++){
6503 for (Int_t d = 1; d<50; d++){
6504 calib.ttime[s][d] = 0;
6505 if ( d < 49 ) calib.time[s][d] = 0;
6506 };
6507 };
6508 TString calibfile;
6509 if ( defcalib ){
6510 const char *pam_calib = pathtocalibration();
6511 stringstream calfile;
6512 calfile.str("");
6513 calfile << pam_calib << "/cal-param/FCaloDefaultCalib.root";
6514 calibfile = calfile.str().c_str();
6515 } else {
6516 calibfile = var.thefilename;
6517 };
6518 if ( !existfile(calibfile) ) return(1);
6519 //
6520 printf(" Using for calibrations file %s \n",calibfile.Data());
6521 //
6522 TFile *File = new TFile(calibfile.Data());
6523 TTree *tr = (TTree*)File->Get("CalibCalPed");
6524 pamela::CalibCalPedEvent *ce = 0;
6525 pamela::PscuHeader *cph = 0;
6526 pamela::EventHeader *ceh = 0;
6527 tr->SetBranchAddress("Header", &ceh);
6528 tr->SetBranchAddress("CalibCalPed", &ce);
6529 Long64_t ncalibs = tr->GetEntries();
6530 Int_t inter;
6531 for (Int_t s = 0; s < 4; s++){
6532 for (Int_t d = 1; d<50; d++){
6533 calib.ttime[s][d] = 0;
6534 if ( d < 49 ) calib.time[s][d] = 0;
6535 };
6536 };
6537 for (Int_t s = 0; s < 4; s++){
6538 inter = 0;
6539 for (Int_t c = 0; c < ncalibs; c++){
6540 tr->GetEntry(c);
6541 cph = ceh->GetPscuHeader();
6542 calib.ttime[s][inter] = 0;
6543 if ( ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
6544 //calib.ttime[s][inter] = cph->GetOrbitalTime();
6545 calib.ttime[s][inter] = (UInt_t)cph->OrbitalTime;
6546 inter++;
6547 } else {
6548 if ( ce->cstwerr[s] != 0 && ce->cperror[s] != 0 ) {
6549 printf(" ERROR: entry %i stwerr %X perror %f \n",c,ce->cstwerr[s],ce->cperror[s]);
6550 };
6551 };
6552 };
6553 if ( inter == 0 ){
6554 printf(" ERROR: no suitable calibration for section %i in this file!\n",s);
6555 };
6556 for (Int_t d = 1; d<50; d++){
6557 if ( calib.ttime[s][d] != 0 ) {
6558 calib.time[s][d-1] = calib.ttime[s][d-1] + (int)((calib.ttime[s][d] - calib.ttime[s][d-1])/2.);
6559 } else {
6560 if ( d == 1 ) {
6561 calib.time[s][d-1] = 0;
6562 };
6563 };
6564 };
6565 };
6566 File->Close();
6567 return(0);
6568 }
6569
6570 int FEVdetector::CaloPede(Int_t s){
6571 //
6572 UInt_t atime = calib.ttime[s][b[s]];
6573 TString calibfile;
6574 if ( defcalib ){
6575 const char *pam_calib = pathtocalibration();
6576 stringstream calfile;
6577 calfile.str("");
6578 calfile << pam_calib << "/cal-param/FCaloDefaultCalib.root";
6579 calibfile = calfile.str().c_str();
6580 } else {
6581 calibfile = var.thefilename;
6582 };
6583 if ( !existfile(calibfile) ) return(3);
6584 //
6585 TFile *File = new TFile(calibfile.Data());
6586 TTree *tr = (TTree*)File->Get("CalibCalPed");
6587 //
6588 pamela::CalibCalPedEvent *ce = 0;
6589 pamela::PscuHeader *cph = 0;
6590 pamela::EventHeader *ceh = 0;
6591 tr->SetBranchAddress("Header", &ceh);
6592 tr->SetBranchAddress("CalibCalPed", &ce);
6593 //
6594 Long64_t ncalibs = tr->GetEntries();
6595 for (Int_t ci = 0; ci < ncalibs ; ci++){
6596 tr->GetEntry(ci);
6597 cph = ceh->GetPscuHeader();
6598 //if ( atime == cph->GetOrbitalTime()){
6599 if ( atime == (UInt_t)cph->OrbitalTime){
6600 // calib.iev = ce->iev;
6601 if (ce->cstwerr[s] != 0 && ce->cperror[s] == 0 ) {
6602 for ( Int_t d=0 ; d<11 ;d++ ){
6603 Int_t pre = -1;
6604 for ( Int_t j=0; j<96 ;j++){
6605 if ( j%16 == 0 ) pre++;
6606 if ( s == 2 ){
6607 calib.calped[0][2*d+1][j] = ce->calped[3][d][j];
6608 calib.cstwerr[3] = ce->cstwerr[3];
6609 calib.cperror[3] = ce->cperror[3];
6610 calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j];
6611 calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre];
6612 calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j];
6613 calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre];
6614 calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre];
6615 };
6616 if ( s == 3 ){
6617 calib.calped[0][2*d][j] = ce->calped[1][d][j];
6618 calib.cstwerr[1] = ce->cstwerr[1];
6619 calib.cperror[1] = ce->cperror[1];
6620 calib.calgood[0][2*d][j] = ce->calgood[1][d][j];
6621 calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre];
6622 calib.calrms[0][2*d][j] = ce->calrms[1][d][j];
6623 calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre];
6624 calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre];
6625 };
6626 if ( s == 0 ){
6627 calib.calped[1][2*d][j] = ce->calped[0][d][j];
6628 calib.cstwerr[0] = ce->cstwerr[0];
6629 calib.cperror[0] = ce->cperror[0];
6630 calib.calgood[1][2*d][j] = ce->calgood[0][d][j];
6631 calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre];
6632 calib.calrms[1][2*d][j] = ce->calrms[0][d][j];
6633 calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre];
6634 calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre];
6635 };
6636 if ( s == 1 ){
6637 calib.calped[1][2*d+1][j] = ce->calped[2][d][j];
6638 calib.cstwerr[2] = ce->cstwerr[2];
6639 calib.cperror[2] = ce->cperror[2];
6640 calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j];
6641 calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre];
6642 calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j];
6643 calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre];
6644 calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre];
6645 };
6646 };
6647 };
6648 };
6649 };
6650 };
6651 File->Close();
6652 return(0);
6653 }
6654
6655 void FEVdetector::CaloFindBaseRaw(Int_t l, Int_t m, Int_t pre){
6656 Float_t minstrip = 100000.;
6657 Float_t rms = 0.;
6658 evento.base[l][m][pre] = 0.;
6659 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
6660 if ( calib.calgood[l][m][e] == 0. && evento.dexy[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexy[l][m][e] > 0.) {
6661 minstrip = evento.dexy[l][m][e]-calib.calped[l][m][e];
6662 rms = calib.calthr[l][m][pre];
6663 };
6664 };
6665 if ( minstrip != 100000. ) {
6666 Float_t strip6s = 0.;
6667 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
6668 if ( (evento.dexy[l][m][e]-calib.calped[l][m][e]) >= minstrip && (evento.dexy[l][m][e]-calib.calped[l][m][e]) <= (minstrip+rms) ) {
6669 strip6s += 1.;
6670 evento.base[l][m][pre] += (evento.dexy[l][m][e] - calib.calped[l][m][e]);
6671 };
6672 //
6673 // compression
6674 //
6675 if ( abs((int)(evento.dexy[l][m][e]-calib.calped[l][m][e])) <= (minstrip+rms) ) {
6676 evento.dexyc[l][m][e] = 0.;
6677 } else {
6678 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
6679 };
6680 };
6681 if ( strip6s >= 9. ){
6682 Double_t arro = evento.base[l][m][pre]/strip6s;
6683 Float_t deci = 1000.*((float)arro - float(int(arro)));
6684 if ( deci < 500. ) {
6685 arro = double(int(arro));
6686 } else {
6687 arro = 1. + double(int(arro));
6688 };
6689 evento.base[l][m][pre] = arro;
6690 } else {
6691 evento.base[l][m][pre] = 31000.;
6692 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
6693 evento.dexyc[l][m][e] = evento.dexy[l][m][e];
6694 };
6695 };
6696 } else {
6697 evento.base[l][m][pre] = 31000.;
6698 };
6699 }
6700
6701 void FEVdetector::CaloCompressData(Int_t l, Int_t m, Int_t pre){
6702 Float_t minstrip = 100000.;
6703 Float_t rms = 0.;
6704 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
6705 if ( calib.calgood[l][m][e] == 0. && evento.dexyc[l][m][e]-calib.calped[l][m][e] < minstrip && evento.dexyc[l][m][e] > 0.) {
6706 minstrip = evento.dexyc[l][m][e]-calib.calped[l][m][e];
6707 rms = calib.calthr[l][m][pre];
6708 };
6709 };
6710 //
6711 // compression
6712 //
6713 if ( minstrip < evento.base[l][m][pre] && minstrip != 100000.){
6714 for (Int_t e = pre*16; e < (pre+1)*16 ; e++){
6715 if ( evento.dexyc[l][m][e]-calib.calped[l][m][e] <= (minstrip+rms) ) evento.dexyc[l][m][e] = 0.;
6716 };
6717 };
6718 }

  ViewVC Help
Powered by ViewVC 1.1.23