/[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.38 - (show annotations) (download)
Tue Nov 4 11:14:53 2014 UTC (10 years, 1 month ago) by mocchiut
Branch: MAIN
CVS Tags: v10RED
Changes since 1.37: +4 -2 lines
TStreamerInfo->GetLenghts() changed for ROOT>5.34.14, use this EV version if you have latest ROOT installed

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

  ViewVC Help
Powered by ViewVC 1.1.23