/[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.27 - (show annotations) (download)
Fri Jun 12 12:37:27 2009 UTC (15 years, 6 months ago) by mocchiut
Branch: MAIN
Changes since 1.26: +7 -2 lines
Crash on refresh/reload fixed (perhaps)

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

  ViewVC Help
Powered by ViewVC 1.1.23