/[PAMELA software]/eventviewer/flight/src/FEVdetector.cpp
ViewVC logotype

Annotation of /eventviewer/flight/src/FEVdetector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.35 - (hide annotations) (download)
Wed Jan 11 16:27:31 2012 UTC (12 years, 11 months ago) by mocchiut
Branch: MAIN
Changes since 1.34: +257 -0 lines
Pattern trigger configuration added to display

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

  ViewVC Help
Powered by ViewVC 1.1.23