/[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.13 - (show annotations) (download)
Tue Mar 6 10:22:59 2007 UTC (17 years, 10 months ago) by mocchiut
Branch: MAIN
Changes since 1.12: +17 -8 lines
Bug in ToF visualization with L2 data fixed

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

  ViewVC Help
Powered by ViewVC 1.1.23