/[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.36 - (hide annotations) (download)
Fri Apr 13 08:07:30 2012 UTC (12 years, 8 months ago) by mocchiut
Branch: MAIN
Changes since 1.35: +5 -0 lines
Level0 bug fixed, SVL cutoff added to legend

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

  ViewVC Help
Powered by ViewVC 1.1.23