/[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.12 - (show annotations) (download)
Wed Feb 28 09:29:55 2007 UTC (17 years, 9 months ago) by mocchiut
Branch: MAIN
Changes since 1.11: +418 -67 lines
Started adding routines for data printout handling

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

  ViewVC Help
Powered by ViewVC 1.1.23