/[PAMELA software]/eventviewer/ground/macros/EventViewer.c
ViewVC logotype

Contents of /eventviewer/ground/macros/EventViewer.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Mar 13 08:53:18 2006 UTC (18 years, 8 months ago) by mocchiut
Branch: MAIN
CVS Tags: v9r03, HEAD
Changes since 1.3: +10 -4 lines
File MIME type: text/plain
CPU consuming bug fixed

1 //-------------------------------------------------------------------------------------------------------------------------------------------------------
2 //
3 // EventViewer.c version 9.03 (2006-03-10)
4 //
5 // Shows PAMELA events - Emiliano Mocchiutti
6 //
7 //-------------------------------------------------------------------------------------------------------------------------------------------------------
8 //
9 // The only input needed is the path to the directory ("filename") created by YODA for the data file you want to analyze.
10 //
11 // Standard use:
12 //
13 // bash> EventViewer
14 //
15 // For further informations use:
16 //
17 // EventViewer --help
18 //
19 // or
20 //
21 // EventViewer --version
22 //
23 //-------------------------------------------------------------------------------------------------------------------------------------------------------
24 //
25 // Changelog:
26 //
27 // 9.02 - 9.03 (2006-03-10): Figure still editable during searching, fixed. Fixed CPU consuming.
28 //
29 // 9.01 - 9.02 (2006-03-09): Now reads tracker software output from v3r02. Small bugs fixed (figure not editable now and complete text inside the GUI if there are only files with the same name).
30 //
31 // 9.00 - 9.01 (2006-03-03): Many bugs fixed and some correction in the behaviour in some cases (many thanks to Silvio for help in developing and debugging!).
32 //
33 // 8.02 - 9.00 (2006-02-17): Added the Graphic User Interface, fixed some old bugs, many new features (on fly load and unload files and selection files, stop searching
34 // while in selection mode, on fly level0/best level switching, fork the application/no text output flag,... )
35 //
36 // 8.01 - 8.02 (2006-02-16): Don't show positions not used in determine the track. Shows S4 mip values in standard mode (not scientific notation).
37 //
38 // 8.00 - 8.01 (2006-01-10): Added tracker measured positions used to determine the track.
39 //
40 // 7.03 - 8.00 (2005-11-24): many changes to compile the macro. The code is still very redundant and heavy but some bugs were fixed and now it should be more stable.
41 // Do not require anymore the AcFunctions.h header, a clone has been written (aclev1class.h).
42 //
43 // 7.02 - 7.03 (2005-10-14): load library containing CalorimeterLevel1 class definition.
44 //
45 // 7.01 - 7.02 (2005-10-12): changed neutron detector color scale to a more realistic one.
46 //
47 // 7.00 - 7.01 (2005-10-10): simplyfied input (less parameters), added support for TOF level1 data.
48 //
49 // 6.05 - 7.00 (2005-09-21): changes to work with tracker software version 2.00.
50 //
51 // 6.04 - 6.05 (2005-08-03): changes to fix bugs related to 64 bit arch.
52 //
53 // 6.03 - 6.04 (2005-07-22): small bug in signal visualization in TOF S11 fixed.
54 //
55 // 6.02 - 6.03 (2005-07-19): use clone routines of yodaUtility.c that can be found in CaloFunctions.h and don't load anymore yodaUtility.c
56 //
57 // 6.01 - 6.02 (2005-07-12): small changes due to correction for the compilation of CaloFunctions.h.
58 //
59 // 6.00 - 6.01 (2005-07-07): AC, now it reads LEVEL1 output (hit are shown with different colour if they are not in time with trigger). Some AC related small bugs fixed.
60 // Added synchronization routines between "YODA" output and tracker output (I am assuming that everything comes out from YODA is synchronized).
61 //
62 // 5.21 - 6.00 (2005-07-06): Now it can read tracker rootples generated by the GroundDataConvert software. Some minor bugs related to tracker visualization fixed.
63 // Notice that tracker data are not synchronized yet to the "YODA" data.
64 //
65 // 5.20 - 5.21 (2005-06-29): Added some options in the interactive menu (B/W toggling, track in S4/ND toggling). Created a new include file with structures for the
66 // event viewer, changed the WhatToDO routine, now renamed in WhatToDoEV. Bug: cannot run program twice when showing track without quitting
67 // ROOT, fixed. Changed "CALO" to "Calorimeter" and "TRK" to "Tracker" in verbose infos mode. Bug: don't show trigger configuration on the text
68 // output when no infos are shown on the figure, fixed. Increased the width of the track line.
69 //
70 // 5.19 - 5.20 (2005-06-28): Bug: S4 z dimension is wrong! corrected. New filename and changes needed to upgrade to the new software architecture.
71 //
72 // 5.18 - 5.19 (2005-06-16): Bug: S4/PULSER flag is not always correct since sometimes the trigger is given by S4 but the flag is not set. Fixed (?) with a
73 // workaround, to be checked that is the best we can do.
74 //
75 // 5.17 - 5.18 (2005-06-14): Added black and white visualization (use input variable "BW" as flag). Wrong position of S4 in level0 visualization, fixed. Saved PS files do not
76 // contain the TOF information from TDC position, fixed.
77 //
78 // 5.16 - 5.17 (2005-06-08): S4 level0 and level1 splitted. Level0 shows the patterntrig variable (NB: NOT ALWAYS CORRECT!!), Level1 shows calibrated info from S4.
79 //
80 // 5.15 - 5.16 (2005-06-07): Unload libraries when exiting and change back to the starting directory. Check if the file is older than 050515_007.
81 //
82 // 5.14 - 5.15 (2005-05-17): Crashes if ADC to MIP calorimeter conversion value is zero, fixed.
83 //
84 // 5.13 - 5.14 (2005-05-13): Force level0 visualization also for the calorimeter.
85 //
86 // 5.12 - 5.13 (2005-05-10): Calorimeter Z dimension is WRONG!!! fixed.
87 //
88 // 5.11 - 5.12 (2005-05-02): OBT is On Board Time and not Orbital Time!
89 //
90 // 5.10 - 5.11 (2005-04-19): Bug fixed in the new subroutine ShowTOFL1 and changed to the old behaviour the calorimeter calibration search (it could took long time
91 // to find a good calibration with the new method expecially in the case of a directory with a single file).
92 //
93 // 5.09 - 5.10 (2005-04-18): Added ShowTOFL1 subroutine to show TOF informations instead of trigger infos. Still it possible to see trigger infos forcing level0 data.
94 //
95 // 5.08 - 5.09 (2005-04-11): Changes in the CaloShowL0 subroutine: do not calibrate more than once if there is a jump in OBT.
96 //
97 // 5.07 - 5.08 (2005-04-07): Changes in the CaloShowL0 subroutine. Changed tree name of level1 and adc2mip calorimeter data.
98 //
99 // 5.06 - 5.07 (2005-04-05): Bug in the rigidity and chi2 report in the figure, fixed.
100 //
101 // 5.05 - 5.06 (2005-03-30): Small changes in the whattodo behaviour.
102 //
103 // 5.04 - 5.05 (2005-03-23): Introduced the input variable FORCELEV to force the data level to load. For now it is possible only to force level0 data
104 // reading of calorimeter and tracker. News: the selection file name now can be anyone and must be used as input if you want
105 // to select events. Hence the "selection" integer input has become the string "selfile".
106 //
107 // 5.03 - 5.04 (2005-03-18): Small changes in the print out.
108 //
109 // 5.02 - 5.03 (2005-03-17): Cannot go backward in selection mode, fixed. Change in ShowS4 the S4 calibration parameter.
110 // New: now it is possible to jump to a certain event number and not only to progressive number.
111 //
112 // 5.01 - 5.02 (2005-03-16): Pulser information is now printed in the INFOS and S4 MIP signal (first order calibration) is represented with colours
113 // (same palette as for calorimeter).
114 //
115 // 5.00 - 5.01 (2005-03-14): Information text size increased.
116 //
117 // 4.11 - 5.00 (2005-03-11): Track visualization offset bug fixed. Reload magnetic field maps if back to the first event, fixed.
118 // Added some comments in the code. Added level2 tracker data to filter.c.
119 //
120 // 4.10 - 4.11 (2005-03-10): Tracker LEVEL1 visualization implemented. Changed the tracker directory from "magnet" to "tracker". Show LEVEL1 information
121 // even if LEVEL2 data are not present.
122 //
123 // 4.09 - 4.10 (2005-03-08): Read the calorimeter calibration file if trying to generate level 1 data.
124 //
125 // 4.08 - 4.09 (2005-03-03): S4 always shown as hit, fixed.
126 //
127 // 4.07 - 4.08 (2005-02-25): In filter mode added a progress viewer. CAS1 plane view was filled with full red colour instead of pinkish colour, fixed.
128 //
129 // 4.06 - 4.07 (2005-02-25): crashes when exiting on empty files. Fixed.
130 //
131 // 4.05 - 4.06 (2005-02-24): Changed order of input variables.
132 //
133 // 4.04 - 4.05 (2005-02-24): Changed variable definition from C/C++ style to ROOT style (int->Int_t).
134 //
135 // 4.03 - 4.04 (2005-02-23): Added the "selection" input variable. If set greater than zero the program will look for
136 // events satisfying the condition in the filter.c program. Notice that running in this configuration
137 // will not let you to go backward with events.
138 //
139 // 4.02 - 4.03 (2005-02-23): Sometimes the calorimeter was repeating an event to infinity. Fixed.
140 //
141 // 4.01 - 4.02 (2005-02-22): ROOT 4.03/02 version bug fixed (calorimeter only).
142 //
143 // 4.00 - 4.01 (2005-02-18): Calorimeter compress/full raw mode visualization didn't work. Fixed. Neutron detector data format changed, fixed accordingly.
144 //
145 // 3.04 - 4.00 (2005-02-14): Small changes in the calorimeter x/y view and in the tracker plane view geometries.
146 // Added the track visualization code once you have tracker LEVEL2 data.
147 //
148 // 3.03 - 3.04 (2005-02-10): Show not only the YODA number (progressive number) but also the EVENT NUMBER from the packet header!
149 //
150 // 3.02 - 3.03 (2005-02-08): TOF scintillators divided into A and B PMTs. Upper triangles are A PMT, lower triangles are B PMTs. S4 readout implemented:
151 // the information comes from the trigger board and the energy level is drawn out as LEVEL0 information. Some bugs in the
152 // scintillators order fixed. Changed color of shadow hit in the tracker Y-view; added small black dot on tracker ladders to
153 // indicate the detectors edges.
154 //
155 // 3.01 - 3.02 (2005-02-04): Tracker hit shown in the plane view. CAS shown in the plane view. Level0 TOF information shown in the scintillators.
156 // Bug for which it is not possible to see only the last event, fixed.
157 //
158 // 3.00 - 3.01 (2005-01-31): AC CARD view from above added. Printing bug fixed, now it calls for the WhatToDo routine in CaloFunctions.h.
159 //
160 // 2.01 - 3.00 (2005-01-21): Major changes in the program philosophy: now it will check first for higher order LEVEL data and it will use low level data
161 // only as last resurce.
162 //
163 // 2.00 - 2.01 (2005-01-18): AC cat changed, added PMTs, AC hits out of triggers are shown now in a different colour. Added "go backward" capability.
164 //
165 // 1.01 - 2.00 (2005-01-14): many changes, some cleanup of the code, detectors are in scale.
166 //
167 // 1.00 - 1.01 (2004-12-15): Include also yodaUtility.c .
168 //
169 #include <math.h>
170 #include <stdio.h>
171 //
172 #include <fstream>
173 #include <sstream>
174 #include <iostream>
175 #include <iomanip>
176 //
177 #include <TObjectTable.h>
178 #include <TGClient.h>
179 #include <TGButton.h>
180 #include <TGComboBox.h>
181 #include <TGLabel.h>
182 #include <TGTextEntry.h>
183 #include <TGFrame.h>
184 #include <TGButtonGroup.h>
185 #include <TGProgressBar.h>
186 #include <TGMsgBox.h>
187 #include <TGComboBox.h>
188 //
189 #include <TTree.h>
190 #include <TClassEdit.h>
191 #include <TObject.h>
192 #include <TList.h>
193 #include <TSystem.h>
194 #include <TSystemDirectory.h>
195 #include <TString.h>
196 #include <TFile.h>
197 #include <TClass.h>
198 #include <TCanvas.h>
199 #include <TH1.h>
200 #include <TH1F.h>
201 #include <TH2D.h>
202 #include <TLatex.h>
203 #include <TPad.h>
204 #include <TPaveLabel.h>
205 #include <TLine.h>
206 #include <TPolyLine.h>
207 #include <TChain.h>
208 #include <TApplication.h>
209 #include <TVirtualX.h>
210 #include <TGClient.h>
211 #include <TGWindow.h>
212 #include <TEllipse.h>
213 #include <TArrow.h>
214 #include <TStyle.h>
215 //
216 #include <trklev1struct.h>
217 //
218 #if !defined (__CINT__)
219 #include <event/PamelaRun.h>
220 #include <event/physics/calorimeter/CalorimeterEvent.h>
221 #include <event/physics/trigger/TriggerEvent.h>
222 #include <event/physics/tof/TofEvent.h>
223 #include <event/physics/tracker/TrackerEvent.h>
224 #include <event/physics/anticounter/AnticounterEvent.h>
225 #include <event/physics/neutronDetector/NeutronEvent.h>
226 #include <event/physics/S4/S4Event.h>
227 #include <event/CalibCalPedEvent.h>
228 #include <event/CalibTrk1Event.h>
229 #include <event/CalibTrk2Event.h>
230 #include <caloclasses.h>
231 extern const char *pathtocalibration();
232 extern void creadB(const char []);
233 extern void projectlev1(Trklev1 &);
234 extern void ctrack(int, Double_t [], Double_t [], Double_t [], Double_t [], int &);
235 #endif
236 //
237 //
238 #include <CaloFunctions.h>
239 #include <eventviewer.h>
240 //
241 #include <ctrkstruct.h>
242 #include <ctrkinclude.h>
243 #include <ctofstruct.h>
244 #include <ctofinclude.h>
245 #include <aclev1class.h>
246 //
247
248 void unload1(){
249 #if defined (__CINT__)
250 char *pam_lib=gSystem->Getenv("PAM_LIB");
251 stringstream libload1;
252 libload1.str("");
253 libload1 << pam_lib << "/libptlevel1_C";
254 gSystem->Unload(libload1.str().c_str());
255 char *pam_lib=gSystem->Getenv("PAM_LIB");
256 stringstream libload1;
257 libload1.str("");
258 libload1 << pam_lib << "/libptlevel1";
259 gSystem->Unload(libload1.str().c_str());
260 #endif
261 }
262
263 void unload2(){
264 #if defined (__CINT__)
265 char *pam_lib=gSystem->Getenv("PAM_LIB");
266 stringstream libload;
267 libload.str("");
268 libload << pam_lib << "/libreadb2maps_C";
269 gSystem->Unload(libload.str().c_str());
270 libload.str("");
271 char *pam_lib=gSystem->Getenv("PAM_LIB");
272 libload << pam_lib << "/libreadb2maps";
273 gSystem->Unload(libload.str().c_str());
274 libload.str("");
275 char *pam_lib=gSystem->Getenv("PAM_LIB");
276 libload << pam_lib << "/libtrack_C";
277 gSystem->Unload(libload.str().c_str());
278 stringstream libload;
279 libload.str("");
280 char *pam_lib=gSystem->Getenv("PAM_LIB");
281 libload << pam_lib << "/libtrack";
282 gSystem->Unload(libload.str().c_str());
283 #endif
284 }
285
286 //
287 // GUI
288 //
289
290 class PAMevcontrol : public TGMainFrame {
291
292 private:
293 TGHProgressBar *fHProg1;
294 TGTextEntry *fText2;
295 TGTextEntry *fText4;
296 TGComboBox *fCombo;
297 TCanvas *thefigure;
298 struct Variables *cvar;
299
300 public:
301 PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,struct Variables & var, TCanvas &figure);
302 virtual ~PAMevcontrol();
303 void chktof();
304 void chkac();
305 void chktrk();
306 void chkcalo();
307 void chks4();
308 void chknd();
309 void chkinfo();
310 void chknames();
311 void chkpalette();
312 void radiocolor();
313 void radiobw();
314 void radiotrack();
315 void forcel0();
316 void next();
317 void prev();
318 void stop();
319 void SetFilename();
320 void SetFilter();
321 void jumpto();
322 void radioevent();
323 void radioprog();
324 void saveas();
325 void CompleteText();
326 void Close();
327 void increment(float val);
328 void DIALOG(Int_t ty, TString warn);
329 void clearselfi();
330 void upgrnamfi();
331 void Terminate();
332 ClassDef(PAMevcontrol,0);
333 };
334
335 PAMevcontrol::PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,Variables & var, TCanvas &figure) : TGMainFrame(p, w, h){
336 //
337 SetCleanup(kDeepCleanup);
338 DontCallClose();
339 Connect("CloseWindow()","PAMevcontrol",this,"Terminate()");
340 //
341 cvar = &var;
342 thefigure = &figure;
343 //
344 TGCompositeFrame *cframe1 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
345 TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
346 TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
347 TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
348 TGGroupFrame *gf = new TGGroupFrame(cframe1, "Appearance");
349 TGGroupFrame *inputf = new TGGroupFrame(cframe2, "Input");
350 TGGroupFrame *jumpf = new TGGroupFrame(cframe3, "Jump to");
351 TGGroupFrame *savef = new TGGroupFrame(cframe4, "Save figure as");
352 //
353 TGHorizontalFrame *htexts = new TGHorizontalFrame(savef,400,800);
354 TGHorizontalFrame *htextsl = new TGHorizontalFrame(cframe4,400,800);
355 TGHorizontalFrame *htext = new TGHorizontalFrame(inputf,400,800);
356 TGHorizontalFrame *htext2 = new TGHorizontalFrame(inputf,400,800);
357 TGHorizontalFrame *htext3 = new TGHorizontalFrame(jumpf,400,800);
358 TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80);
359 TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800);
360 TGHorizontalFrame *hframe1 = new TGHorizontalFrame(gf, 280, 50);
361 TGHorizontalFrame *hframe2 = new TGHorizontalFrame(gf, 280, 40);
362 TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf, 280, 40);
363 TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf,280,10);
364 TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 40);
365 TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800);
366 //
367 TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1);
368 fText->SetText(cvar->thefilename.Data());
369 TGTextButton *Load = new TGTextButton(htext,"Load");
370 Load->Connect("Pressed()","TGTextEntry",fText,"ReturnPressed()");
371 fText->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilename()");
372 fText->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
373 htext->AddFrame(fText, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5));
374 htext->AddFrame(Load, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,0,5,5,5));
375 inputf->AddFrame(new TGLabel(inputf, new TGHotString("Filename:")));
376 inputf->AddFrame(htext, new TGLayoutHints(kLHintsExpandX));
377 //
378 fText2 = new TGTextEntry(htext2, new TGTextBuffer(20),-1);
379 fText2->SetText(cvar->thefilter.Data());
380 TGTextButton *Load2 = new TGTextButton(htext2,"Load");
381 Load2->Connect("Clicked()","TGTextEntry",fText2,"ReturnPressed()");
382 fText2->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilter()");
383 fText2->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
384 htext2->AddFrame(fText2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5));
385 htext2->AddFrame(Load2, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,0,5,5,5));
386 inputf->AddFrame(new TGLabel(inputf, new TGHotString("Selection file:")));
387 inputf->AddFrame(htext2, new TGLayoutHints(kLHintsExpandX));
388 //
389 cframe2->AddFrame(inputf,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
390 //
391 TGCheckButton *fchktof = new TGCheckButton(hframe1, "TOF");
392 fchktof->Connect("Clicked()","PAMevcontrol", this,"chktof()");
393 if ( cvar->TOF ) fchktof->SetState(kButtonDown);
394 hframe1->AddFrame(fchktof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,5,5,5));
395 //
396 TGCheckButton *fchkac = new TGCheckButton(hframe1, "AC");
397 fchkac->Connect("Clicked()","PAMevcontrol", this,"chkac()");
398 if ( cvar->AC ) fchkac->SetState(kButtonDown);
399 hframe1->AddFrame(fchkac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,25,5,5));
400 //
401 TGCheckButton *fchktrk = new TGCheckButton(hframe1, "Tracker");
402 fchktrk->Connect("Clicked()","PAMevcontrol",this,"chktrk()");
403 if ( cvar->TRK ) fchktrk->SetState(kButtonDown);
404 hframe1->AddFrame(fchktrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5));
405 //
406 gf->AddFrame(hframe1, new TGLayoutHints(kLHintsExpandX));
407 //
408 TGCheckButton *fchks4 = new TGCheckButton(hframe2, "S4");
409 fchks4->Connect("Clicked()","PAMevcontrol",this,"chks4()");
410 if ( cvar->S4 ) fchks4->SetState(kButtonDown);
411 hframe2->AddFrame(fchks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,15,5,5));
412 //
413 TGCheckButton *fchknd = new TGCheckButton(hframe2, "ND");
414 fchknd->Connect("Clicked()","PAMevcontrol",this,"chknd()");
415 if ( cvar->ND ) fchknd->SetState(kButtonDown);
416 hframe2->AddFrame(fchknd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,25,5,5));
417 //
418 TGCheckButton *fchkcalo = new TGCheckButton(hframe2, "Calorimeter");
419 fchkcalo->Connect("Clicked()","PAMevcontrol",this,"chkcalo()");
420 if ( cvar->CALO ) fchkcalo->SetState(kButtonDown);
421 hframe2->AddFrame(fchkcalo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,2,5,5));
422 //
423 gf->AddFrame(hframe2, new TGLayoutHints(kLHintsExpandX));
424 //
425 TGCheckButton *fchkinfo = new TGCheckButton(hframe3, "Infos");
426 fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");
427 if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown);
428 hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,5,5,5));
429 //
430 TGCheckButton *fchknames = new TGCheckButton(hframe3, "Names");
431 fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");
432 if ( cvar->VINFOS ) fchknames->SetState(kButtonDown);
433 hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,5,5,5));
434 TGCheckButton *fchkpalette = new TGCheckButton(hframe3, "Palette");
435 fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");
436 if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown);
437 hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5));
438 gf->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX));
439 //
440 TGVButtonGroup *group = new TGVButtonGroup(hframe4);
441 TGRadioButton *bwc0;
442 TGRadioButton *bwc1;
443 bwc0 = new TGRadioButton(group, "Colour");
444 bwc1 = new TGRadioButton(group, "B/W");
445 if ( cvar->bw ){
446 bwc1->SetState(kButtonDown);
447 } else {
448 bwc0->SetState(kButtonDown);
449 };
450 bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");
451 bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");
452 hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,1,5,5,5));
453 //
454 //
455 TGCheckButton *ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");
456 ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");
457 if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
458 hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,2,5,5));
459 TGCheckButton *ffl0 = new TGCheckButton(hframe5, "Force LEVEL0");
460 ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");
461 if ( cvar->fl0 ) ffl0->SetState(kButtonDown);
462 hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,2,5,5));
463 //
464 hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5));
465 gf->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));
466 //
467 cframe1->AddFrame(gf, new TGLayoutHints(kLHintsExpandX));
468 //
469 TGHButtonGroup *jgroup = new TGHButtonGroup(htext4);
470 TGRadioButton *jbwc0;
471 TGRadioButton *jbwc1;
472 jbwc0 = new TGRadioButton(jgroup, "event ");
473 jbwc1 = new TGRadioButton(jgroup, "progressive");
474 jbwc1->SetState(kButtonDown);
475 jbwc0->Connect("Pressed()", "PAMevcontrol",this,"radioevent()");
476 jbwc1->Connect("Pressed()", "PAMevcontrol",this,"radioprog()");
477 htext4->AddFrame(jgroup,new TGLayoutHints(kLHintsExpandX,1,1,0,0));
478 //
479 TGTextEntry *fText3 = new TGTextEntry(htext3, new TGTextBuffer(6),-1);
480 TGTextButton *Jump = new TGTextButton(htext3,"go");
481 Jump->Connect("Clicked()","TGTextEntry",fText3,"ReturnPressed()");
482 fText3->Connect("ReturnPressed()", "PAMevcontrol", this,"jumpto()");
483 htext3->AddFrame(new TGLabel(htext3, new TGHotString("number")), new TGLayoutHints(kLHintsExpandX,0,0,1,1));
484 htext3->AddFrame(fText3, new TGLayoutHints(kLHintsExpandX, 0, 8, 0, 0));
485 htext3->AddFrame(Jump, new TGLayoutHints(kLHintsExpandX,0,0,0,0));
486 jumpf->AddFrame(htext4, new TGLayoutHints(kLHintsExpandX,0,0,1,1)); //
487 jumpf->AddFrame(htext3, new TGLayoutHints(kLHintsExpandX,0,0,0,1)); //
488 //
489 cframe3->AddFrame(jumpf,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
490 //
491 fText4 = new TGTextEntry(htexts, new TGTextBuffer(18),-1);
492 TGTextButton *save = new TGTextButton(htextsl,"save");
493 save->Connect("Clicked()","TGTextEntry",fText4,"ReturnPressed()");
494 fText4->Connect("ReturnPressed()", "PAMevcontrol", this,"saveas()");
495 fText4->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
496 htexts->AddFrame(fText4, new TGLayoutHints(kLHintsExpandX, 0, 8, 1, 1));
497 //
498 fCombo = new TGComboBox(htexts, 98);
499 fCombo->AddEntry(".ps", 0);
500 fCombo->AddEntry(".eps", 1);
501 fCombo->AddEntry(".gif", 2);
502 fCombo->AddEntry(".jpg", 3);
503 fCombo->AddEntry(".tiff", 4);
504 fCombo->AddEntry(".xpm", 5);
505 fCombo->AddEntry(".pdf", 6);
506 fCombo->AddEntry(".xml", 7);
507 fCombo->AddEntry(".png", 8);
508 fCombo->AddEntry(".svg", 9);
509 fCombo->AddEntry(".root", 10);
510 fCombo->AddEntry(".C", 11);
511 fCombo->Select(0);
512 fCombo->Resize(50,23);
513 // htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsCenterX | kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX, 0, 8, 1, 1));
514 htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsExpandY | kLHintsRight, 2, 2, 2, 1));
515 //
516 htextsl->AddFrame(save, new TGLayoutHints(kLHintsExpandX,0,0,2,1));
517 savef->AddFrame(htexts, new TGLayoutHints(kLHintsExpandX,0,0,2,5));
518 // savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,5,2,5,2));
519 savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,8,0,5,2));
520 //
521 cframe4->AddFrame(savef,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
522 //
523 fHProg1 = new TGHProgressBar(hfrprog, TGProgressBar::kFancy, 260);
524 fHProg1->SetBarColor("green");
525 fHProg1->ShowPosition();
526 hfrprog->AddFrame(fHProg1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX,5,5,5,5));
527 //
528 //
529 TGTextButton *prev = new TGTextButton(hframe,"< &Back");
530 prev->Connect("Clicked()","PAMevcontrol",this,"prev()");
531 hframe->AddFrame(prev, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
532 //
533 TGTextButton *exit = new TGTextButton(hframe,"E&xit");
534 exit->Connect("Clicked()","PAMevcontrol",this,"Terminate()");
535 //,"gApplication->Terminate(0)");
536 exit->SetToolTipText("Quit the event viewer");
537 hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
538 //
539 TGTextButton *stop = new TGTextButton(hframe,"&Stop");
540 stop->Connect("Clicked()","PAMevcontrol",this,"stop()");
541 hframe->AddFrame(stop, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
542 //
543 TGTextButton *next = new TGTextButton(hframe,"&Next >");
544 next->Connect("Clicked()","PAMevcontrol",this,"next()");
545 hframe->AddFrame(next, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
546 //
547 //
548 // AddFrame(htext, new TGLayoutHints(kLHintsExpandX,2,2,15,1));
549 AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
550 AddFrame(cframe1, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
551 AddFrame(cframe3, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
552 AddFrame(cframe4, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
553 AddFrame(hfrprog, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
554 AddFrame(hframe, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,1,1,1,1));
555 // Set a name to the main frame
556 SetWindowName("PAMELA Event Viewer control panel");
557 // Map all subwindows of main frame
558 MapSubwindows();
559 // Initialize the layout algorithm
560 Resize(GetDefaultSize());
561 // Map main frame
562 MapWindow();
563 }
564
565 void PAMevcontrol::DIALOG(Int_t ty, TString warn){
566 //
567 // ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR
568 //
569 Int_t retval;
570 TString title;
571 EMsgBoxIcon mb_icon = kMBIconStop;
572 if ( ty == 0 ){
573 title="INFO";
574 mb_icon = kMBIconAsterisk;
575 };
576 if ( ty == 1 ){
577 title="WARNING!";
578 mb_icon = kMBIconExclamation;
579 };
580 if ( ty == 2 ){
581 title="ERROR!!";
582 mb_icon = kMBIconStop;
583 };
584 new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval);
585 }
586
587
588 void PAMevcontrol::SetFilename() {
589 TGTextEntry *entry = (TGTextEntry*)gTQSender;
590 TString text = entry->GetText();
591 cvar->thefilename=text.Data();
592 cvar->nevents = 0;
593 cvar->firstevno = 0;
594 cvar->lastevno = 0;
595 cvar->restart = true;
596 cvar->waitforever = false;
597 }
598
599 void PAMevcontrol::SetFilter() {
600 TGTextEntry *entry = (TGTextEntry*)gTQSender;
601 TString text = entry->GetText();
602 cvar->thefilter=text.Data();
603 cvar->i--;
604 cvar->selex = false;
605 cvar->nevents = 0;
606 cvar->firstevno = 0;
607 cvar->lastevno = 0;
608 cvar->refresh = true;
609 }
610
611 void PAMevcontrol::CompleteText() {
612 TGTextEntry *entry = (TGTextEntry*)gTQSender;
613 TString text = entry->GetText();
614 Int_t curspos = entry->GetCursorPosition();
615 Int_t ncurspos = 0;
616 TString textrem;
617 stringcopy(textrem,text,curspos,text.Length());
618 text.Resize(curspos);
619 if ( !strcmp(text.Data(),"") ) {
620 stringstream ntext;
621 ntext.str("");
622 ntext << gSystem->ExpandPathName("$HOME");
623 text = ntext.str().c_str();
624 curspos=ntext.str().length();
625 };
626 char *test = gSystem->ExpandPathName(text.Data());
627 const char *dir = gSystem->DirName(test);
628 const char *base = gSystem->BaseName(test);
629 TString lbase = base;
630 Int_t lenbase = lbase.Length();
631 TSystemDirectory *tsd = new TSystemDirectory("",dir);
632 TSystemFile *file;
633 TList *lsmatch = new TList;
634 Int_t numf = 0;
635 Int_t numgo = 0;
636 Int_t charmac = 0;
637 TString tbase;
638 Int_t k = 0;
639 stringstream newtext;
640 TSystemFile *mfile;
641 TSystemFile nfile;
642 TList *lsf = new TList;
643 const char *ctbase;
644 if ( !tsd->GetListOfFiles() ){
645 gVirtualX->Bell(0);
646 goto end;
647 };
648 lsf = tsd->GetListOfFiles();
649 file = (TSystemFile*)lsf->First();
650 //
651 while( (TSystemFile*)lsf->After(file) ){
652 numf++;
653 file = (TSystemFile*)lsf->After(file);
654 if ( !strncmp(file->GetName(),base,lenbase) ){
655 numgo++;
656 lsmatch->AddLast(file);
657 const char *ctbase = file->GetName();
658 tbase = ctbase;
659 charmac = tbase.Length();
660 };
661 };
662 newtext.str("");
663 if ( numgo > 0 ){
664 mfile = (TSystemFile*)lsmatch->First();
665 ctbase = mfile->GetName();
666 while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
667 mfile = (TSystemFile*)lsmatch->After(mfile);
668 ctbase = mfile->GetName();
669 };
670 tbase = ctbase;
671 base = ctbase;
672 charmac = tbase.Length();;
673 while( (TSystemFile*)lsmatch->After(mfile) ){
674 mfile = (TSystemFile*)lsmatch->After(mfile);
675 ctbase = mfile->GetName();
676 while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
677 mfile = (TSystemFile*)lsmatch->After(mfile);
678 ctbase = mfile->GetName();
679 };
680 tbase = ctbase;
681 k = 0;
682 for ( Int_t i=lenbase; i<=tbase.Length(); i++){
683 if ( !strncmp(tbase.Data(),base,i) && strcmp(tbase.Data(),base) ){
684 k = i;
685 };
686 };
687 if ( k <= charmac){
688 charmac = k;
689 };
690 };
691 gVirtualX->Bell(0);
692 };
693 if ( !charmac ) {
694 gVirtualX->Bell(0);
695 goto end;
696 };
697 tbase.Resize(charmac);
698 if ( !strcmp(dir,"") || !strcmp(dir,"/") ){
699 newtext << "/" << tbase.Data();
700 } else {
701 newtext << dir << "/" << tbase.Data();
702 };
703 nfile = TSystemFile(tbase.Data(),dir);
704 if ( nfile.IsDirectory() && numgo == 1 ) newtext << "/";
705 ncurspos = newtext.str().length();
706 if ( textrem.Length() ) newtext << textrem.Data();
707 entry->SetText(newtext.str().c_str());
708 entry->SetCursorPosition(ncurspos);
709 end:
710 lsf->Clear();
711 lsmatch->Clear();
712 }
713
714 void PAMevcontrol::saveas() {
715 TString text = fText4->GetText();
716 Int_t sel=fCombo->GetSelected();
717 TString ty;
718 switch (sel){
719 case (0):
720 ty = ".ps";
721 break;
722 case (1):
723 ty = ".eps";
724 break;
725 case (2):
726 ty = ".gif";
727 break;
728 case (3):
729 ty = ".jpg";
730 break;
731 case (4):
732 ty = ".tiff";
733 break;
734 case (5):
735 ty = ".xpm";
736 break;
737 case (6):
738 ty = ".pdf";
739 break;
740 case (7):
741 ty = ".xml";
742 break;
743 case (8):
744 ty = ".png";
745 break;
746 case (9):
747 ty = ".svg";
748 break;
749 case (10):
750 ty = ".root";
751 break;
752 case (11):
753 ty = ".C";
754 break;
755 };
756 if ( sel == 0 ) ty = ".ps";
757 stringstream name;
758 if ( strcmp(text.Data(),"") ){
759 name.str("");
760 name << text.Data();
761 name << ty.Data();
762 thefigure->SaveAs(name.str().c_str());
763 name.str("");
764 name << " Saved as ";
765 name << text.Data();
766 name << ty.Data();
767 DIALOG(0,name.str().c_str());
768 printf(" Saved as %s%s \n",text.Data(),ty.Data());
769 };
770 }
771
772 void PAMevcontrol::increment(float val) {
773 fHProg1->SetPosition(val);
774 fHProg1->DoRedraw();
775 gSystem->ProcessEvents();
776 }
777
778 void PAMevcontrol::forcel0() {
779 if ( cvar->fl0 ) {
780 cvar->fl0 = false;
781 } else {
782 cvar->fl0 = true;
783 };
784 cvar->alrforc = false;
785 cvar->i--;
786 cvar->nevents = 0;
787 cvar->firstevno = 0;
788 cvar->lastevno = 0;
789 cvar->refresh = true;
790 }
791
792 void PAMevcontrol::clearselfi(){
793 fText2->SetText("");
794 }
795
796 void PAMevcontrol::upgrnamfi(){
797 fText4->SetText(cvar->svas.Data());
798 fText4->SetCursorPosition(fText4->GetMaxLength());
799 }
800
801 void PAMevcontrol::jumpto() {
802 TGTextEntry *entry = (TGTextEntry*)gTQSender;
803 TString text = entry->GetText();
804 Int_t j;
805 j = atoi(text.Data());
806 if ( cvar->jumprog ){
807 if ( j < 1 || j > cvar->nevents ) {
808 printf("\n You can choose between 1 and %i \n",(int)cvar->nevents);
809 stringstream warning;
810 warning.str("");
811 warning << "You can choose between 1 and ";
812 warning << (int)cvar->nevents;
813 DIALOG(1,warning.str().c_str());
814 } else {
815 stringstream warning;
816 warning.str("");
817 warning << "Jumping to progressive number ";
818 warning << j;
819 DIALOG(0,warning.str().c_str());
820 printf("\n Jumping to progressive number %i\n\n",j);
821 cvar->i = j-2;
822 cvar->goon = true;
823 };
824 } else {
825 if ( j < cvar->firstevno || j > cvar->lastevno ) {
826 printf("\n You can choose between %i and %i \n",cvar->firstevno,cvar->lastevno);
827 stringstream warning;
828 warning.str("");
829 warning << "You can choose between ";
830 warning << cvar->firstevno;
831 warning << " and ";
832 warning << cvar->lastevno;
833 DIALOG(1,warning.str().c_str());
834 } else {
835 stringstream warning;
836 warning.str("");
837 warning << "Jumping to event number ";
838 warning << j;
839 DIALOG(0,warning.str().c_str());
840 printf("\n Jumping to event number %i\n\n",j);
841 cvar->jumpto = j;
842 cvar->jumpen = true;
843 cvar->goon = true;
844 };
845 };
846 entry->SetText("");
847 }
848
849 void PAMevcontrol::radioevent() {
850 cvar->jumprog = false;
851 }
852
853 void PAMevcontrol::radioprog() {
854 cvar->jumprog = true;
855 }
856
857 void PAMevcontrol::radiocolor() {
858 if ( !cvar->goon ){
859 if ( cvar->bw ) {
860 cvar->bw = 0;
861 cvar->i--;
862 cvar->goon = true;
863 };
864 };
865 }
866
867 void PAMevcontrol::radiobw() {
868 if ( !cvar->goon ){
869 if ( !cvar->bw ) {
870 cvar->bw = 1;
871 cvar->i--;
872 cvar->goon = true;
873 };
874 };
875 }
876
877 void PAMevcontrol::radiotrack() {
878 if ( cvar->tracknds4 ) {
879 cvar->tracknds4 = 0;
880 } else {
881 cvar->tracknds4 = 1;
882 };
883 cvar->i--;
884 cvar->goon = true;
885 }
886
887 void PAMevcontrol::chktof() {
888 if ( cvar->TOF ) {
889 cvar->TOF = 0;
890 } else {
891 cvar->TOF = 1;
892 };
893 cvar->i--;
894 cvar->nevents = 0;
895 cvar->firstevno = 0;
896 cvar->lastevno = 0;
897 cvar->refresh = true;
898 }
899
900 void PAMevcontrol::chkac() {
901 if ( cvar->AC ) {
902 cvar->AC = 0;
903 } else {
904 cvar->AC = 1;
905 };
906 cvar->i--;
907 cvar->nevents = 0;
908 cvar->firstevno = 0;
909 cvar->lastevno = 0;
910 cvar->refresh = true;
911 }
912
913 void PAMevcontrol::chktrk() {
914 if ( cvar->TRK ) {
915 cvar->TRK = 0;
916 } else {
917 cvar->TRK = 1;
918 };
919 cvar->i--;
920 cvar->nevents = 0;
921 cvar->firstevno = 0;
922 cvar->lastevno = 0;
923 cvar->refresh = true;
924 }
925
926 void PAMevcontrol::chkcalo() {
927 if ( cvar->CALO ) {
928 cvar->CALO = 0;
929 } else {
930 cvar->CALO = 1;
931 };
932 cvar->i--;
933 cvar->nevents = 0;
934 cvar->firstevno = 0;
935 cvar->lastevno = 0;
936 cvar->refresh = true;
937 }
938
939 void PAMevcontrol::chks4() {
940 if ( cvar->S4 ) {
941 cvar->S4 = 0;
942 } else {
943 cvar->S4 = 1;
944 };
945 cvar->i--;
946 cvar->nevents = 0;
947 cvar->firstevno = 0;
948 cvar->lastevno = 0;
949 cvar->refresh = true;
950 }
951
952 void PAMevcontrol::chknd() {
953 if ( cvar->ND ) {
954 cvar->ND = 0;
955 } else {
956 cvar->ND = 1;
957 };
958 cvar->i--;
959 cvar->nevents = 0;
960 cvar->firstevno = 0;
961 cvar->lastevno = 0;
962 cvar->refresh = true;
963 }
964
965 void PAMevcontrol::chkinfo() {
966 if ( cvar->INFOS ) {
967 cvar->INFOS = 0;
968 } else {
969 cvar->INFOS = 1;
970 };
971 cvar->i--;
972 cvar->goon = true;
973 }
974
975 void PAMevcontrol::chknames() {
976 if ( cvar->VINFOS ) {
977 cvar->VINFOS = 0;
978 } else {
979 cvar->VINFOS = 1;
980 };
981 cvar->i--;
982 cvar->goon = true;
983 }
984
985 void PAMevcontrol::chkpalette() {
986 if ( cvar->PALETTE ) {
987 cvar->PALETTE = 0;
988 } else {
989 cvar->PALETTE = 1;
990 };
991 cvar->i--;
992 cvar->goon = true;
993 }
994
995 void PAMevcontrol::next() {
996 if ( cvar->i == cvar->nevents-1 ) {
997 printf("This is the last event, you can't go forward! \n");
998 DIALOG(1,"This is the last event!");
999 } else {
1000 cvar->goon = true;
1001 cvar->doflag = 1;
1002 };
1003 }
1004
1005 void PAMevcontrol::stop() {
1006 DIALOG(1,"Stop searching");
1007 cvar->doflag = 3;
1008 }
1009
1010 void PAMevcontrol::prev() {
1011 if ( cvar->i > 0 ) {
1012 printf("WARNING: going backward!\n\n");
1013 cvar->doflag = 2;
1014 cvar->goon = true;
1015 } else {
1016 printf("This is the first event, you can't go backward! \n");
1017 DIALOG(1,"This is the first event!");
1018 };
1019 }
1020
1021 void PAMevcontrol::Close() {
1022 Cleanup();
1023 CloseWindow();
1024 }
1025
1026 void PAMevcontrol::Terminate() {
1027 Close();
1028 gApplication->Terminate(0);
1029 }
1030
1031 PAMevcontrol::~PAMevcontrol() {
1032 // Clean up used widgets: frames, buttons, layouthints
1033 Cleanup();
1034 delete this;
1035 }
1036
1037 //**********************************************************************************
1038 // LEVEL0 SUBROUTINES //
1039 //**********************************************************************************
1040
1041 void ShowCaloRAW(Int_t i, TTree *otr, Variables & var){
1042
1043 pamela::calorimeter::CalorimeterEvent *de = 0;
1044 otr->SetBranchAddress("Calorimeter.Event", &de);
1045 if ( !var.nosig ) otr->GetEntry(i);
1046
1047 //
1048 // Book the histograms:
1049 //
1050 //
1051 stringstream delex;
1052 delex.str("");
1053 delex << "x-view event " << (i+1);
1054 stringstream deley;
1055 deley.str("");
1056 deley << "y-view event " << (i+1);
1057 gDirectory->Delete(delex.str().c_str());
1058 gDirectory->Delete(deley.str().c_str());
1059 TH2F *Xview = new TH2F(delex.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
1060 TH2F *Yview = new TH2F(deley.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
1061 Xview->GetYaxis()->SetLabelColor(10);
1062 Yview->GetYaxis()->SetLabelColor(10);
1063 //
1064 // figures:
1065 //
1066 Int_t bgcolor = 10;
1067 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);
1068 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);
1069
1070 pd1->SetFillStyle(4000);
1071 pd1->SetFillColor(0);
1072 pd1->SetFrameFillStyle(4000);
1073 pd2->SetFillStyle(4000);
1074 pd2->SetFillColor(0);
1075 pd2->SetFrameFillStyle(4000);
1076
1077 TLatex *t=new TLatex();
1078 t->SetTextFont(32);
1079 t->SetTextColor(1);
1080 t->SetTextSize(0.03);
1081 t->SetTextAlign(12);
1082 pd1->Range(0.,0.,1.,1.);
1083 pd2->Range(0.,0.,1.,1.);
1084 pd1->SetTicks();
1085 pd2->SetTicks();
1086 pd1->Draw();
1087 pd2->Draw();
1088
1089 pd1->cd();
1090 gStyle->SetOptStat(0);
1091 Xview->GetYaxis()->SetTitleOffset(0.5);
1092 Xview->SetFillColor(bgcolor);
1093 Xview->Fill(1.,1.,1.);
1094 Xview->Draw("box");
1095 pd1->Update();
1096 pd2->cd();
1097 gStyle->SetOptStat(0);
1098 Yview->GetYaxis()->SetTitleOffset(0.5);
1099 Yview->SetFillColor(bgcolor);
1100 Yview->Fill(1.,1.,1.);
1101 Yview->Draw("box");
1102 pd2->Update();
1103
1104 //
1105 // run over views and planes
1106 //
1107 stringstream xevent;
1108 stringstream yevent;
1109 for (Int_t m = 0; m < 22; m++){
1110 for (Int_t l = 0; l < 2; l++){
1111 //
1112 // determine the section number
1113 //
1114 Int_t se = 5;
1115 if ( !l && m%2 == 0 ){
1116 se = 3;
1117 };
1118 if ( !l && m%2 != 0 ){
1119 se = 2;
1120 };
1121 if ( l && m%2 == 0 ){
1122 se = 1;
1123 };
1124 if ( l && m%2 != 0 ){
1125 se = 0;
1126 };
1127 //
1128 // determine what kind of event we are going to analyze
1129 //
1130 bool isCOMP = 0;
1131 bool isFULL = 0;
1132 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
1133 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
1134 //
1135 // run over strips
1136 //
1137 if ( isCOMP || isFULL ) {
1138 for (Int_t n = 0; n < 96; n++){
1139 if ( de->dexyc[l][m][n] > 0. && !var.nosig ){
1140 xevent.str("");
1141 yevent.str("");
1142 xevent << "x-view event " << n;
1143 xevent << " " << m;
1144 xevent << " " << l;
1145 yevent << "y-view event " << n;
1146 yevent << " " << m;
1147 yevent << " " << l;
1148 gDirectory->Delete(xevent.str().c_str());
1149 gDirectory->Delete(yevent.str().c_str());
1150 TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
1151 TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
1152 Int_t colo;
1153 if ( var.bw ){
1154 colo = 17;
1155 } else {
1156 colo = 38;
1157 };
1158 Xview->SetFillColor(colo);
1159 Yview->SetFillColor(colo);
1160 if ( l == 0 ) {
1161 Xview->Fill(n,21-m,1.);
1162 pd1->cd();
1163 Xview->Draw("box same");
1164 };
1165 if ( l == 1 ) {
1166 Yview->Fill(95-n,21-m,1.);
1167 pd2->cd();
1168 Yview->Draw("box same");
1169 };
1170 };
1171 };
1172 };
1173 };
1174 };
1175 pd1->Update();
1176 pd2->Update();
1177 var.qtot=0;
1178 var.nstrip=0;
1179 }
1180
1181 void ShowND(Int_t evno, TTree *otr, Variables & var){
1182 Int_t tmpSize;
1183 Int_t yUpperTrig = 0;
1184 Int_t yUpperBk = 0;
1185 Int_t yBottomBk = 0;
1186 pamela::neutron::NeutronEvent *ne = 0;
1187 pamela::neutron::NeutronRecord *nr = 0;
1188 otr->SetBranchAddress("Neutron.Event", &ne);
1189 //
1190 if ( !var.nosig ) otr->GetEntry(evno);
1191 //
1192 tmpSize = ne->Records->GetEntries();
1193 for (Int_t j = 0; j < tmpSize; j++){
1194 nr = (pamela::neutron::NeutronRecord*)ne->Records->At(j);
1195 yUpperTrig += (int)nr->trigPhysics;
1196 yUpperBk += (int)nr->upperBack;
1197 yBottomBk += (int)nr->bottomBack;
1198 }
1199
1200 var.trup = yUpperTrig;
1201 var.bkup = yUpperBk;
1202 var.bkbo = yBottomBk;
1203
1204 if ( var.nosig ){
1205 yUpperTrig = 0;
1206 yUpperBk = 0;
1207 yBottomBk = 0;
1208 }
1209 Int_t ucolo = 10;
1210 if ( var.bw ){
1211 if ( yUpperTrig == 1 ){
1212 ucolo = 17;
1213 }
1214 if ( yUpperTrig == 2 ){
1215 ucolo = 15;
1216 }
1217 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
1218 ucolo = 14;
1219 }
1220 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
1221 ucolo = 13;
1222 }
1223 if ( yUpperTrig >= 14 ){
1224 ucolo = 12;
1225 };
1226 } else {
1227 if ( yUpperTrig == 1 ){
1228 ucolo = 38;
1229 }
1230 if ( yUpperTrig == 2 ){
1231 ucolo = 4;
1232 }
1233 if ( yUpperTrig > 2 && yUpperTrig < 7 ){
1234 ucolo = 3;
1235 }
1236 if ( yUpperTrig > 6 && yUpperTrig < 15 ){
1237 ucolo = 2;
1238 }
1239 if ( yUpperTrig >= 14 ){
1240 ucolo = 6;
1241 };
1242 };
1243 //
1244 // figures:
1245 //
1246 if ( true ){
1247 Float_t xc1[5]={ -0.300, 0.300, 0.300, -0.300, -0.300 };
1248 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};
1249 //
1250 // Upper X-view
1251 //
1252 Float_t xc[5];
1253 Float_t yc[5];
1254 for (Int_t i = 0; i<5 ; i++) {
1255 xc[i]= var.xxvc + xc1[i]*var.nds4;
1256 yc[i] = var.yxvc + yc1[i]*var.sfy;
1257 };
1258 TPolyLine *fnd2x = new TPolyLine(5,xc,yc);
1259 fnd2x->SetLineColor(1);
1260 fnd2x->SetFillColor(ucolo);
1261 fnd2x->SetLineWidth(1);
1262 fnd2x->Draw("f");
1263 fnd2x->Draw();
1264 };
1265 if ( true ){
1266 Float_t xc1[5]={ -0.275, 0.275, 0.275, -0.275, -0.275 };
1267 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};
1268 //
1269 // Upper Y-view
1270 //
1271 Float_t xc[5];
1272 Float_t yc[5];
1273 for (Int_t i = 0; i<5 ; i++) {
1274 xc[i]= var.xyvc + xc1[i]*var.nds4;
1275 yc[i] = var.yyvc + (yc1[i]+0.075)*var.sfy;
1276 };
1277 TPolyLine *fnd2y = new TPolyLine(5,xc,yc);
1278 fnd2y->SetLineColor(1);
1279 fnd2y->SetFillColor(ucolo);
1280 fnd2y->SetLineWidth(1);
1281 fnd2y->Draw("f");
1282 fnd2y->Draw();
1283 };
1284 }
1285
1286 void ShowTRKL0(Int_t evno, TTree *otr, Variables & var){
1287 //
1288 pamela::tracker::TrackerEvent *trk = 0;
1289 otr->SetBranchAddress("Tracker.Event", &trk);
1290 if ( !var.nosig ) otr->GetEntry(evno);
1291 //
1292 // a matrix of pads for each view x and y
1293 //
1294 TPad *trkpad[12];
1295 for (Int_t n = 0; n<12; n++){
1296 stringstream spd;
1297 spd.str("");
1298 spd << "pd1" << n;
1299 gDirectory->Delete(spd.str().c_str());
1300 spd.str("");
1301 spd << "pd2" << n;
1302 gDirectory->Delete(spd.str().c_str());
1303 spd.str("");
1304 spd << "pd3" << n;
1305 gDirectory->Delete(spd.str().c_str());
1306 spd.str("");
1307 spd << "pd4" << n;
1308 gDirectory->Delete(spd.str().c_str());
1309 spd.str("");
1310 spd << "pd5" << n;
1311 gDirectory->Delete(spd.str().c_str());
1312 spd.str("");
1313 spd << "pd6" << n;
1314 gDirectory->Delete(spd.str().c_str());
1315 spd.str("");
1316 stringstream sbd;
1317 sbd.str("");
1318 Int_t magcol = 0;
1319 TPad *mag1 = 0;
1320 TPad *mag2 = 0;
1321 if ( n%2 ) {
1322 Float_t posx = var.xxvc;
1323 Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
1324 spd.str("");
1325 sbd.str("");
1326 spd << "pd1" << n;
1327 sbd << "bd1" << n;
1328 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);
1329 trkpad[n]->SetFillStyle(4000);
1330 trkpad[n]->SetFillColor(0);
1331 trkpad[n]->SetFrameFillStyle(4000);
1332 trkpad[n]->Draw();
1333 if ( n != 1 ) {
1334 if ( var.bw ) {
1335 magcol = 1;
1336 } else {
1337 magcol = 45;
1338 };
1339 spd.str("");
1340 sbd.str("");
1341 spd << "pd2" << n;
1342 sbd << "bd2" << n;
1343 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);
1344 if ( var.bw ) mag1->SetFillStyle(3001);
1345 mag1->Draw();
1346 spd.str("");
1347 sbd.str("");
1348 spd << "pd3" << n;
1349 sbd << "bd3" << n;
1350 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);
1351 if ( var.bw ) mag2->SetFillStyle(3001);
1352 mag2->Draw();
1353 };
1354 } else {
1355 Float_t posx = var.xyvc;
1356 Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
1357 spd.str("");
1358 sbd.str("");
1359 spd << "pd4" << n;
1360 sbd << "bd4" << n;
1361 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);
1362 trkpad[n]->SetFillStyle(4000);
1363 trkpad[n]->SetFillColor(0);
1364 trkpad[n]->SetFrameFillStyle(4000);
1365 trkpad[n]->Draw();
1366 if ( n != 0 ) {
1367 if ( var.bw ) {
1368 magcol = 1;
1369 } else {
1370 magcol = 45;
1371 };
1372 spd.str("");
1373 sbd.str("");
1374 spd << "pd5" << n;
1375 sbd << "bd5" << n;
1376 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);
1377 if ( var.bw ) mag1->SetFillStyle(3001);
1378 mag1->Draw();
1379 spd.str("");
1380 sbd.str("");
1381 spd << "pd6" << n;
1382 sbd << "bd6" << n;
1383 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);
1384 if ( var.bw ) mag2->SetFillStyle(3001);
1385 mag2->Draw();
1386 };
1387 };
1388 };
1389 TPad *trplv;
1390 gDirectory->Delete("trkplv");
1391 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);
1392 trplv->SetFillStyle(4000);
1393 trplv->SetFillColor(0);
1394 trplv->SetFrameFillStyle(4000);
1395 trplv->Draw();
1396 //
1397 Int_t sigcol1 = 17;
1398 Int_t sigcol2 = 15;
1399 Int_t linecol = 13;
1400 if ( var.bw ) {
1401 sigcol1 = 17;
1402 sigcol2 = 15;
1403 linecol = 13;
1404 } else {
1405 sigcol1 = 32;
1406 sigcol2 = 38;
1407 linecol = 42;
1408 };
1409 TLine *linea = 0;
1410 TLine *linea1x = 0;
1411 TLine *linea2x = 0;
1412 TLine *linea1y = 0;
1413 Float_t x = 0.;
1414 for (Int_t l = 0; l<12; l++){
1415 trkpad[l]->cd();
1416 if ( l%2 ) {
1417 trkpad[l]->Range(0.,0.,3100.,1.);
1418 linea = new TLine(0.,0.01,3100.,0.01);
1419 linea1x = new TLine(1033.,0.01,1033,0.030);
1420 linea2x = new TLine(2066.,0.01,2066,0.030);
1421 } else {
1422 trkpad[l]->Range(0.,0.,2076.,1.);
1423 linea = new TLine(0.,0.01,2076.,0.01);
1424 linea1y = new TLine(1038.,0.01,1038,0.030);
1425 };
1426 linea->SetLineWidth(2);
1427 linea->SetLineColor(linecol);
1428 linea->Draw();
1429 if ( l%2 ) {
1430 linea1x->SetLineWidth(1);
1431 linea1x->SetLineColor(1);
1432 linea1x->Draw();
1433 linea2x->SetLineWidth(1);
1434 linea2x->SetLineColor(1);
1435 linea2x->Draw();
1436 } else {
1437 linea1y->SetLineWidth(1);
1438 linea1y->SetLineColor(1);
1439 linea1y->Draw();
1440 };
1441 //
1442 Int_t planeno = trk->DSPnumber[l]-1;
1443 if ( planeno < 0 || planeno > 11 ) planeno = 0;
1444 if ( planeno >= 0 && !var.nosig ) {
1445 if ( (planeno+1)%2 ){
1446 trkpad[planeno]->cd();
1447 trkpad[planeno]->Range(0.,0.,2076.,1.);
1448 for (Int_t m = 0; m<3; m++){
1449 if ( trk->signcluster[l][m] != 0. ){
1450 if ( planeno == 10 ) {
1451 x = 1024 - trk->addrcluster[l][m];
1452 } else {
1453 x = trk->addrcluster[l][m];
1454 };
1455 linea = new TLine(14.+x,0.01,14.+x,0.3);
1456 linea->SetLineWidth(2);
1457 linea->SetLineColor(sigcol1);
1458 linea->Draw();
1459 x += 1024.;
1460 linea = new TLine(14.+x,0.01,14.+x,0.3);
1461 linea->SetLineWidth(2);
1462 linea->SetLineColor(sigcol2);
1463 linea->Draw();
1464 var.ncly++;
1465 };
1466 };
1467 } else {
1468 trkpad[planeno]->cd();
1469 trkpad[planeno]->Range(0.,0.,3100.,1.);
1470 for (Int_t m = 0; m<3; m++){
1471 if ( trk->signcluster[l][m] != 0. ){
1472 x = trk->addrcluster[l][m] + 1024. * m;
1473 linea = new TLine(14.+x,0.01,14.+x,0.3);
1474 linea->SetLineWidth(2);
1475 linea->SetLineColor(sigcol2);
1476 linea->Draw();
1477 var.nclx++;
1478 };
1479 };
1480 };
1481 };
1482 };
1483 //
1484 // Show track in the plane view!
1485 //
1486 Float_t xh[6];
1487 Float_t yh1[6];
1488 Float_t yh2[6];
1489 Float_t mag[6];
1490 for (Int_t l = 0; l<6; l++ ){
1491 xh[l] = 0.;
1492 yh1[l] = 0.;
1493 yh2[l] = 0.;
1494 mag[l] = 0.;
1495 };
1496 Int_t ncro = 0;
1497 //
1498 for (Int_t l = 0; l<12; l++ ){
1499 Float_t xsig = 0.;
1500 Float_t ysig = 0.;
1501 Int_t planeno = trk->DSPnumber[l]-1;
1502 for (Int_t e = 0; e<12;e++){
1503 Int_t planeno2 = trk->DSPnumber[e]-1;
1504 if ( planeno == planeno2-1 ){
1505 if ( planeno < 0 || planeno > 11 ) planeno = 0;
1506 if ( planeno >= 0 && !var.nosig ) {
1507 mag[ncro] = ((float)planeno+1.)/5.;
1508 if ( (planeno+1)%2 ){
1509 for (Int_t m = 0; m<3; m++){
1510 if ( trk->signcluster[l][m] != 0. ){
1511 if ( planeno == 10 ) {
1512 x = 1024 - trk->addrcluster[l][m];
1513 } else {
1514 x = trk->addrcluster[l][m];
1515 };
1516 x += 1024.;
1517 if ( trk->signcluster[l][m]> ysig ){
1518 ysig = trk->signcluster[l][m];
1519 yh1[ncro] = x-1024.;
1520 yh2[ncro] = x;
1521 };
1522 };
1523 };
1524 for (Int_t m = 0; m<3; m++){
1525 if ( trk->signcluster[e][m] != 0. ){
1526 x = trk->addrcluster[e][m] + 1024. * m;
1527 if ( trk->signcluster[e][m]> xsig && !( planeno == 0 && x > 2800) ){
1528 xsig = trk->signcluster[e][m];
1529 xh[ncro] = x;
1530 };
1531 };
1532 };
1533 } else {
1534 for (Int_t m = 0; m<3; m++){
1535 if ( trk->signcluster[l][m] != 0. ){
1536 x = trk->addrcluster[l][m] + 1024. * m;
1537 if ( trk->signcluster[l][m]> xsig && !( planeno == 0 && x > 2800) ){
1538 xsig = trk->signcluster[l][m];
1539 xh[ncro] = x;
1540 };
1541 };
1542 };
1543 if ( (planeno+1)%2 ){
1544 for (Int_t m = 0; m<3; m++){
1545 if ( trk->signcluster[e][m] != 0. ){
1546 if ( planeno == 10 ) {
1547 x = 1024 - trk->addrcluster[e][m];
1548 } else {
1549 x = trk->addrcluster[e][m];
1550 };
1551 x += 1024.;
1552 if ( trk->signcluster[e][m]> ysig ){
1553 ysig = trk->signcluster[e][m];
1554 yh1[ncro] = x-1024.;
1555 yh2[ncro] = x;
1556 };
1557 };
1558 };
1559 };
1560 };
1561 if ( ysig > 0. && xsig > 0. ) {
1562 ncro++;
1563 };
1564 };
1565 };
1566 };
1567 };
1568 //
1569 // Draw crosses
1570 //
1571 if ( ncro && var.AC ) {
1572 trplv->cd();
1573 trplv->Range(0.,0.,2076.,3100.);
1574 for ( Int_t i = 0; i<ncro; i++){
1575 //
1576 Float_t cdx = (55./mag[i])*var.sfx;
1577 Float_t cdy = (55./mag[i])*var.sfy;
1578 Float_t lwx = (1.9)*var.sfy;
1579 Float_t lwy = (1.9)*var.sfx;
1580 //
1581 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
1582 linea->SetLineWidth((int)lwx);
1583 linea->SetLineColor(sigcol1);
1584 linea->Draw();
1585 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
1586 linea->SetLineWidth((int)lwy);
1587 linea->SetLineColor(sigcol1);
1588 linea->Draw();
1589 //
1590 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
1591 linea->SetLineWidth((int)lwx);
1592 linea->SetLineColor(sigcol2);
1593 linea->Draw();
1594 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
1595 linea->SetLineWidth((int)lwy);
1596 linea->SetLineColor(sigcol2);
1597 linea->Draw();
1598 };
1599 };
1600 }
1601
1602 void ShowAC(Int_t i, TTree *otr, Variables & var, Int_t lev){
1603 //
1604 Int_t hitmapA = 0;
1605 Int_t hitmapB = 0;
1606 Int_t hitstatusA = 0;
1607 Int_t hitstatusB = 0;
1608 if ( lev == 0 ){
1609 pamela::anticounter::AnticounterEvent *ace = 0;
1610 otr->SetBranchAddress("Anticounter.Event", &ace);
1611 if ( !var.nosig ) otr->GetEntry(i);
1612 hitmapA = ace->hitmap[0];
1613 hitmapB = ace->hitmap[1];
1614 if ( lev == 0 ){
1615 hitstatusA = 65535;
1616 hitstatusB = 65535;
1617 } else {
1618 hitstatusA = ace->status[0];
1619 hitstatusB = ace->status[1];
1620 };
1621 };
1622 if ( lev == 1 ){
1623 AnticounterLevel1 *ace1 = new AnticounterLevel1();
1624 otr->SetBranchAddress("AcLevel1.Event", &ace1);
1625 if ( !var.nosig ) otr->GetEntry(i);
1626 hitmapA = ace1->hitmap[0];
1627 hitmapB = ace1->hitmap[1];
1628 if ( lev == 0 ){
1629 hitstatusA = 65535;
1630 hitstatusB = 65535;
1631 } else {
1632 hitstatusA = ace1->hitstatus[0];
1633 hitstatusB = ace1->hitstatus[1];
1634 };
1635 };
1636 //
1637 if ( var.nosig ){
1638 hitmapA = 0;
1639 hitmapB = 0;
1640 hitstatusA = 0;
1641 hitstatusB = 0;
1642 };
1643 //
1644 Float_t cas1 = 0.;
1645 Float_t cas2 = 0.;
1646 Float_t cas3 = 0.;
1647 Float_t cas4 = 0.;
1648 Float_t cas1b = 0.;
1649 Float_t cas2b = 0.;
1650 Float_t cas3b = 0.;
1651 Float_t cas4b = 0.;
1652 //
1653 Float_t cat1 = 0.;
1654 Float_t cat2 = 0.;
1655 Float_t cat3 = 0.;
1656 Float_t cat4 = 0.;
1657 Float_t cat1b = 0.;
1658 Float_t cat2b = 0.;
1659 Float_t cat3b = 0.;
1660 Float_t cat4b = 0.;
1661 //
1662 Float_t card1 = 0.;
1663 Float_t card2 = 0.;
1664 Float_t card3 = 0.;
1665 Float_t card4 = 0.;
1666 Float_t card1b = 0.;
1667 Float_t card2b = 0.;
1668 Float_t card3b = 0.;
1669 Float_t card4b = 0.;
1670 //
1671 Float_t intime = -0.25;
1672 Float_t outtime = -0.375;
1673 if ( var.bw ){
1674 intime = -0.25;
1675 outtime = -0.375;
1676 } else {
1677 intime = 1.;
1678 outtime = -4.;
1679 };
1680 //
1681 // main board
1682 //
1683 if ( hitmapA & (1<<0) ) {
1684 card4 = intime;
1685 if ( !(hitstatusA & (1<<0)) ) card4 = outtime ;
1686 var.hcard++;
1687 }
1688 if ( hitmapA & (1<<1) ) {
1689 cat2 = intime;
1690 if ( !(hitstatusA & (1<<1)) ) cat2 = outtime ;
1691 var.hcat++;
1692 }
1693 if ( hitmapA & (1<<2) ) {
1694 cas1 = intime;
1695 if ( !(hitstatusA & (1<<2)) ) cas1 = outtime ;
1696 var.hcas++;
1697 }
1698 //
1699 if ( hitmapA & (1<<4) ) {
1700 card2 = intime;
1701 if ( !(hitstatusA & (1<<4)) ) card2 = outtime ;
1702 var.hcard++;
1703 }
1704 if ( hitmapA & (1<<5) ) {
1705 cat4 = intime;
1706 if ( !(hitstatusA & (1<<5)) ) cat4 = outtime ;
1707 var.hcat++;
1708 }
1709 if ( hitmapA & (1<<6) ) {
1710 cas4 = intime;
1711 if ( !(hitstatusA & (1<<6)) ) cas4 = outtime ;
1712 var.hcas++;
1713 }
1714 //
1715 if ( hitmapA & (1<<8) ) {
1716 card3 = intime;
1717 if ( !(hitstatusA & (1<<8)) ) card3 = outtime ;
1718 var.hcard++;
1719 }
1720 if ( hitmapA & (1<<9) ) {
1721 cat3 = intime;
1722 if ( !(hitstatusA & (1<<9)) ) cat3 = outtime ;
1723 var.hcat++;
1724 }
1725 if ( hitmapA & (1<<10) ) {
1726 cas3 = intime;
1727 if ( !(hitstatusA & (1<<10)) ) cas3 = outtime ;
1728 var.hcas++;
1729 }
1730 //
1731 if ( hitmapA & (1<<12) ) {
1732 card1 = intime;
1733 if ( !(hitstatusA & (1<<12)) ) card1 = outtime ;
1734 var.hcard++;
1735 }
1736 if ( hitmapA & (1<<13) ) {
1737 cat1 = intime;
1738 if ( !(hitstatusA & (1<<13)) ) cat1 = outtime ;
1739 var.hcat++;
1740 }
1741 if ( hitmapA & (1<<14) ) {
1742 cas2 = intime;
1743 if ( !(hitstatusA & (1<<14)) ) cas2 = outtime ;
1744 var.hcas++;
1745 }
1746
1747 //
1748 // extra board
1749 //
1750 if ( hitmapB & (1<<0) ) {
1751 card4b = intime;
1752 if ( !(hitstatusB & (1<<0)) ) card4b = outtime ;
1753 var.hcard++;
1754 }
1755 if ( hitmapB & (1<<1) ) {
1756 cat2b = intime;
1757 if ( !(hitstatusB & (1<<1)) ) cat2b = outtime ;
1758 var.hcat++;
1759 }
1760 if ( hitmapB & (1<<2) ) {
1761 cas1b = intime;
1762 if ( !(hitstatusB & (1<<2)) ) cas1b = outtime;
1763 var.hcas++;
1764 }
1765 //
1766 if ( hitmapB & (1<<4) ) {
1767 card2b = intime;
1768 if ( !(hitstatusB & (1<<4)) ) card2b = outtime ;
1769 var.hcard++;
1770 }
1771 if ( hitmapB & (1<<5) ) {
1772 cat4b = intime;
1773 if ( !(hitstatusB & (1<<5)) ) cat4b = outtime ;
1774 var.hcat++;
1775 }
1776 if ( hitmapB & (1<<6) ) {
1777 cas4b = intime;
1778 if ( !(hitstatusB & (1<<6)) ) cas4b = outtime ;
1779 var.hcas++;
1780 }
1781 //
1782 if ( hitmapB & (1<<8) ) {
1783 card3b = intime;
1784 if ( !(hitstatusB & (1<<8)) ) card3b = outtime ;
1785 var.hcard++;
1786 }
1787 if ( hitmapB & (1<<9) ) {
1788 cat3b = intime;
1789 if ( !(hitstatusB & (1<<9)) ) cat3b = outtime ;
1790 var.hcat++;
1791 }
1792 if ( hitmapB & (1<<10) ) {
1793 cas3b = intime;
1794 if ( !(hitstatusB & (1<<10)) ) cas3b = outtime ;
1795 var.hcas++;
1796 }
1797 //
1798 if ( hitmapB & (1<<12) ) {
1799 card1b = intime;
1800 if ( !(hitstatusB & (1<<12)) ) card1b = outtime ;
1801 var.hcard++;
1802 }
1803 if ( hitmapB & (1<<13) ) {
1804 cat1b = intime;
1805 if ( !(hitstatusB & (1<<13)) ) cat1b = outtime ;
1806 var.hcat++;
1807 }
1808 if ( hitmapB & (1<<14) ) {
1809 cas2b = intime;
1810 if ( !(hitstatusB & (1<<14)) ) cas2b = outtime ;
1811 var.hcas++;
1812 };
1813 Int_t colo = 0;
1814 //
1815 // CAS height and width
1816 //
1817 Float_t csh = 0.194*var.sfy;
1818 Float_t csw = 0.008*var.sfx;
1819 Float_t ctw = 0.008;
1820
1821 //
1822 // CAS2 -0.039-0.081 |TRX TRY
1823 //
1824 if ( true ){
1825 Float_t xofs = var.xxvc -(0.039+0.081+0.0273)*var.sfx;
1826 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1827 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1828 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
1829 TPolyLine *fcas2 = new TPolyLine(4,x,y);
1830 fcas2->SetLineColor(1);
1831 colo = (int)(10. - cas2 * 8.);
1832 fcas2->SetFillColor(colo);
1833 fcas2->SetLineWidth(1);
1834 fcas2->Draw("f");
1835 fcas2->Draw();
1836 };
1837 if ( true ){
1838 Float_t xofs = var.xxvc -(0.039 +0.081 +0.0273)*var.sfx;
1839 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1840 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1841 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
1842 TPolyLine *fcas2b = new TPolyLine(4,x,y);
1843 fcas2b->SetLineColor(1);
1844 colo = (int)(10. - cas2b * 8.);
1845 fcas2b->SetFillColor(colo);
1846 fcas2b->SetLineWidth(1);
1847 fcas2b->Draw("f");
1848 fcas2b->Draw();
1849 };
1850 //
1851 // CAS1 -0.039+0.081 TRX| TRY
1852 //
1853 if ( true ){
1854 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
1855 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1856 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1857 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
1858 TPolyLine *fcas1 = new TPolyLine(4,x,y);
1859 fcas1->SetLineColor(1);
1860 colo = (int)(10. - cas1 * 8.);
1861 fcas1->SetFillColor(colo);
1862 fcas1->SetLineWidth(1);
1863 fcas1->Draw("f");
1864 fcas1->Draw();
1865 };
1866 if ( true ){
1867 Float_t xofs = var.xxvc + (0.039 +0.081+0.0273)*var.sfx +csw;
1868 Float_t yofs = var.yxvc + 0.09*var.sfy ;
1869 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1870 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
1871 TPolyLine *fcas1b = new TPolyLine(4,x,y);
1872 fcas1b->SetLineColor(1);
1873 colo = (int)(10. - cas1b * 8.);
1874 fcas1b->SetFillColor(colo);
1875 fcas1b->SetLineWidth(1);
1876 fcas1b->Draw("f");
1877 fcas1b->Draw();
1878 };
1879 //
1880 // CAS4 -0.039-0.081 TRX |TRY
1881 //
1882 if ( true ){
1883 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
1884 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1885 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1886 Double_t y[4] = {yofs-csh,yofs-csh,yofs+csh,yofs-csh};
1887 TPolyLine *fcas4 = new TPolyLine(4,x,y);
1888 fcas4->SetLineColor(1);
1889 colo = (int)(10. - cas4 * 8.);
1890 fcas4->SetFillColor(colo);
1891 fcas4->SetLineWidth(1);
1892 fcas4->Draw("f");
1893 fcas4->Draw();
1894 };
1895 if ( true ){
1896 Float_t xofs = var.xyvc - (0.048 +0.066 +0.0273)*var.sfx;
1897 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1898 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1899 Double_t y[4] = {yofs+csh,yofs-csh,yofs+csh,yofs+csh};
1900 TPolyLine *fcas4b = new TPolyLine(4,x,y);
1901 fcas4b->SetLineColor(1);
1902 colo = (int)(10. - cas4b * 8.);
1903 fcas4b->SetFillColor(colo);
1904 fcas4b->SetLineWidth(1);
1905 fcas4b->Draw("f");
1906 fcas4b->Draw();
1907 };
1908
1909 //
1910 // CAS3 -0.039+0.081 TRX TRY|
1911 //
1912 if ( true ){
1913 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
1914 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1915 Double_t x[4] = {xofs-csw,xofs-csw,xofs,xofs-csw};
1916 Double_t y[4] = {yofs-csh,yofs+csh,yofs-csh,yofs-csh};
1917 TPolyLine *fcas3 = new TPolyLine(4,x,y);
1918 fcas3->SetLineColor(1);
1919 colo = (int)(10. - cas3 * 8.);
1920 fcas3->SetFillColor(colo);
1921 fcas3->SetLineWidth(1);
1922 fcas3->Draw("f");
1923 fcas3->Draw();
1924 };
1925 if ( true ){
1926 Float_t xofs = var.xyvc + (0.048 +0.066+0.0273)*var.sfx +csw;
1927 Float_t yofs = var.yyvc + 0.09*var.sfy ;
1928 Double_t x[4] = {xofs-csw,xofs,xofs,xofs-csw};
1929 Double_t y[4] = {yofs+csh,yofs+csh,yofs-csh,yofs+csh};
1930 TPolyLine *fcas3b = new TPolyLine(4,x,y);
1931 fcas3b->SetLineColor(1);
1932 colo = (int)(10. - cas3b * 8.);
1933 fcas3b->SetFillColor(colo);
1934 fcas3b->SetLineWidth(1);
1935 fcas3b->Draw("f");
1936 fcas3b->Draw();
1937 };
1938
1939 //
1940 // CAT coordinate system
1941 //
1942 Float_t xcat = var.xcat;
1943 Float_t ycat = var.ycat;
1944 Float_t pmt1 = 0.0356;
1945 Float_t pmt2 = 0.038;
1946 Float_t xpmt1 = -0.149*var.sfx;
1947 Float_t ypmt1 = 0.251*var.sfy;
1948 Float_t apmt1 = atan((11.*var.sfy)/(14.*var.sfx));
1949 Float_t xpmt2 = -0.257*var.sfx;
1950 Float_t ypmt2 = 0.158*var.sfy;
1951 Float_t apmt2 = atan((11.*var.sfx)/(15.*var.sfy));
1952 //
1953 Int_t cattime = 13;
1954 Int_t catnoti = 12;
1955 if ( var.bw ){
1956 cattime = 13;
1957 catnoti = 12;
1958 } else {
1959 cattime = 2;
1960 catnoti = 42;
1961 };
1962 //
1963 if ( true ){
1964 // PMTs
1965 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.};
1966 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.};
1967 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.};
1968 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.};
1969 // SCINTs
1970 Float_t xcc1[10]={-0.149, -0.090165, -0.090165, -0.149, -0.242, -0.257, -0.212, -0.257, -0.242, -0.149};
1971 Float_t ycc1[10]={ 0.169, 0.108165, -0.108165, -0.169, -0.169, -0.158, 0., 0.158, 0.169, 0.169};
1972 Float_t xcc2[10]={-0.149, -0.149, -0.138, 0., 0.138, 0.149, 0.149, 0.090165, -0.090165, -0.149};
1973 Float_t ycc2[10]={ 0.169, 0.251, 0.265, 0.220, 0.265, 0.251, 0.169, 0.108165, 0.108165, 0.169};
1974 //
1975 // CAT sections
1976 //
1977 if ( true ){
1978 Float_t xofs = var.xxvc -0.108165*var.sfx;
1979 Float_t yofs = var.yxvc + 0.3725*var.sfy ;
1980 Double_t xx[5] = {xofs,xofs-0.112*var.sfx,xofs-0.112*var.sfx,xofs,xofs};
1981 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
1982 TPolyLine *fcat3 = new TPolyLine(5,xx,yy);
1983 fcat3->SetLineColor(1);
1984 if ( cat3 != 0. || cat3b != 0. ){
1985 if ( cat3 > 0 || cat3b > 0 || cat3 == -0.25 || cat3b == -0.25 ){
1986 colo = cattime;
1987 } else {
1988 colo = catnoti;
1989 };
1990 } else {
1991 colo = 10;
1992 };
1993 fcat3->SetFillColor(colo);
1994 fcat3->SetLineWidth(1);
1995 fcat3->Draw("f");
1996 fcat3->Draw();
1997 };
1998 if ( true ){
1999 Float_t xofs = var.xxvc +0.108165*var.sfx;
2000 Float_t yofs = var.yxvc + 0.3725 *var.sfy;
2001 Double_t xx[5] = {xofs,xofs+0.112*var.sfx,xofs+0.112*var.sfx,xofs,xofs};
2002 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
2003 TPolyLine *fcat4 = new TPolyLine(5,xx,yy);
2004 fcat4->SetLineColor(1);
2005 if ( cat4 != 0. || cat4b != 0. ){
2006 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b == -.25 ){
2007 colo = cattime;
2008 } else {
2009 colo = catnoti;
2010 };
2011 } else {
2012 colo = 10;
2013 };
2014 fcat4->SetFillColor(colo);
2015 fcat4->SetLineWidth(1);
2016 fcat4->Draw("f");
2017 fcat4->Draw();
2018 };
2019 if ( true ){
2020 Float_t xofs = var.xyvc + 0.090165*var.sfx;
2021 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
2022 Double_t xx[5] = {xofs,xofs+0.122*var.sfx,xofs+0.122*var.sfx,xofs,xofs};
2023 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
2024 TPolyLine *fcat1 = new TPolyLine(5,xx,yy);
2025 fcat1->SetLineColor(1);
2026 if ( cat1 != 0. || cat1b != 0. ){
2027 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
2028 colo = cattime;
2029 } else {
2030 colo = catnoti;
2031 };
2032 } else {
2033 colo = 10;
2034 };
2035 fcat1->SetFillColor(colo);
2036 fcat1->SetLineWidth(1);
2037 fcat1->Draw("f");
2038 fcat1->Draw();
2039 };
2040 if ( true ){
2041 Float_t xofs = var.xyvc - 0.090165*var.sfx;
2042 Float_t yofs = var.yyvc + 0.3725*var.sfy ;
2043 Double_t xx[5] = {xofs,xofs-0.122*var.sfx,xofs-0.122*var.sfx,xofs,xofs};
2044 Double_t yy[5] = {yofs,yofs,yofs+ctw,yofs+ctw,yofs};
2045 TPolyLine *fcat2 = new TPolyLine(5,xx,yy);
2046 fcat2->SetLineColor(1);
2047 if ( cat2 != 0. || cat2b != 0. ){
2048 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
2049 colo = cattime;
2050 } else {
2051 colo = catnoti;
2052 };
2053 } else {
2054 colo = 10;
2055 };
2056 fcat2->SetFillColor(colo);
2057 fcat2->SetLineWidth(1);
2058 fcat2->Draw("f");
2059 fcat2->Draw();
2060 };
2061 //
2062 // CAT1
2063 //
2064 Float_t xcc[10];
2065 Float_t ycc[10];
2066 if ( true ){
2067 for (Int_t i = 0; i<10 ; i++) {
2068 xcc[i]= xcat - xcc1[i]*var.sfx;
2069 ycc[i] = ycat + ycc1[i]*var.sfy;
2070 };
2071 TPolyLine *fcat1 = new TPolyLine(10,xcc,ycc);
2072 fcat1->SetLineColor(1);
2073 colo = 10;
2074 if ( cat1 != 0. || cat1b != 0. ) {
2075 if ( cat1 > 0 || cat1b > 0 || cat1 ==-.25 || cat1b ==-.25 ){
2076 colo = cattime;
2077 } else {
2078 colo = catnoti;
2079 };
2080 };
2081 fcat1->SetFillColor(colo);
2082 fcat1->SetLineWidth(1);
2083 fcat1->Draw("f");
2084 fcat1->Draw();
2085 };
2086 //
2087 // CAT2
2088 //
2089 if ( true ){
2090 for (Int_t i = 0; i<10 ; i++) {
2091 xcc[i]= xcat + xcc1[i]*var.sfx;
2092 ycc[i] = ycat + ycc1[i]*var.sfy;
2093 };
2094 TPolyLine *fcat2 = new TPolyLine(10,xcc,ycc);
2095 fcat2->SetLineColor(1);
2096 colo = 10;
2097 if ( cat2 != 0. || cat2b != 0. ) {
2098 if ( cat2 > 0 || cat2b > 0 || cat2 ==-.25 || cat2b ==-.25 ){
2099 colo = cattime;
2100 } else {
2101 colo = catnoti;
2102 };
2103 };
2104 fcat2->SetFillColor(colo);
2105 fcat2->SetLineWidth(1);
2106 fcat2->Draw("f");
2107 fcat2->Draw();
2108 };
2109 //
2110 // CAT3
2111 //
2112 if ( true ){
2113 for (Int_t i = 0; i<10 ; i++) {
2114 xcc[i]= xcat + xcc2[i]*var.sfx;
2115 ycc[i] = ycat - ycc2[i]*var.sfy;
2116 };
2117 TPolyLine *fcat3 = new TPolyLine(10,xcc,ycc);
2118 fcat3->SetLineColor(1);
2119 colo = 10;
2120 if ( cat3 != 0. || cat3b != 0. ) {
2121 if ( cat3 > 0 || cat3b > 0 || cat3 == -.25 || cat3b ==-.25 ){
2122 colo = cattime;
2123 } else {
2124 colo = catnoti;
2125 };
2126 };
2127 fcat3->SetFillColor(colo);
2128 fcat3->SetLineWidth(1);
2129 fcat3->Draw("f");
2130 fcat3->Draw();
2131 };
2132 //
2133 // CAT4
2134 //
2135 if ( true ){
2136 for (Int_t i = 0; i<10 ; i++) {
2137 xcc[i]= xcat + xcc2[i]*var.sfx;
2138 ycc[i] = ycat + ycc2[i]*var.sfy;
2139 };
2140 TPolyLine *fcat4 = new TPolyLine(10,xcc,ycc);
2141 fcat4->SetLineColor(1);
2142 colo = 10;
2143 if ( cat4 != 0. || cat4b != 0. ) {
2144 if ( cat4 > 0 || cat4b > 0 || cat4 == -.25 || cat4b ==-.25 ){
2145 colo = cattime;
2146 } else {
2147 colo = catnoti;
2148 };
2149 };
2150 fcat4->SetFillColor(colo);
2151 fcat4->SetLineWidth(1);
2152 fcat4->Draw("f");
2153 fcat4->Draw();
2154 };
2155 //
2156 // CAT1 PMTs
2157 //
2158 Float_t xc[5];
2159 Float_t yc[5];
2160 if ( true ){
2161 for (Int_t i = 0; i<5 ; i++) {
2162 xc[i]= xcat - xpmt2 - xc1[i];
2163 yc[i] = ycat + ypmt2 + yc1[i];
2164 };
2165 TPolyLine *fcat1 = new TPolyLine(5,xc,yc);
2166 fcat1->SetLineColor(1);
2167 colo = (int)(10. - cat1 * 8.);
2168 fcat1->SetFillColor(colo);
2169 fcat1->SetLineWidth(1);
2170 fcat1->Draw("f");
2171 fcat1->Draw();
2172 };
2173 if ( true ){
2174 for (Int_t i = 0; i<5 ; i++) {
2175 xc[i]= xcat - xpmt2 - xc1[i];
2176 yc[i] = ycat - ypmt2 - yc1[i];
2177 };
2178 TPolyLine *fcat1b = new TPolyLine(5,xc,yc);
2179 fcat1b->SetLineColor(1);
2180 colo = (int)(10. - cat1b * 8.);
2181 fcat1b->SetFillColor(colo);
2182 fcat1b->SetLineWidth(1);
2183 fcat1b->Draw("f");
2184 fcat1b->Draw();
2185 };
2186 //
2187 // CAT2 PMTs
2188 //
2189 if ( true ){
2190 for (Int_t i = 0; i<5 ; i++) {
2191 xc[i]= xcat + xpmt2 + xc1[i];
2192 yc[i] = ycat + ypmt2 + yc1[i];
2193 };
2194 TPolyLine *fcat2 = new TPolyLine(5,xc,yc);
2195 fcat2->SetLineColor(1);
2196 colo = (int)(10. - cat2 * 8.);
2197 fcat2->SetFillColor(colo);
2198 fcat2->SetLineWidth(1);
2199 fcat2->Draw("f");
2200 fcat2->Draw();
2201 };
2202 if ( true ){
2203 for (Int_t i = 0; i<5 ; i++) {
2204 xc[i]= xcat + xpmt2 + xc1[i];
2205 yc[i] = ycat - ypmt2 - yc1[i];
2206 };
2207 TPolyLine *fcat2b = new TPolyLine(5,xc,yc);
2208 fcat2b->SetLineColor(1);
2209 colo = (int)(10. - cat2b * 8.);
2210 fcat2b->SetFillColor(colo);
2211 fcat2b->SetLineWidth(1);
2212 fcat2b->Draw("f");
2213 fcat2b->Draw();
2214 };
2215 //
2216 // CAT3 PMTs
2217 //
2218 if ( true ){
2219 for (Int_t i = 0; i<5 ; i++) {
2220 xc[i]= xcat + xpmt1 + xc2[i];
2221 yc[i] = ycat - ypmt1 - yc2[i];
2222 };
2223 TPolyLine *fcat3b = new TPolyLine(5,xc,yc);
2224 fcat3b->SetLineColor(1);
2225 colo = (int)(10. - cat3b * 8.);
2226 fcat3b->SetFillColor(colo);
2227 fcat3b->SetLineWidth(1);
2228 fcat3b->Draw("f");
2229 fcat3b->Draw();
2230 };
2231 if ( true ){
2232 for (Int_t i = 0; i<5 ; i++) {
2233 xc[i]= xcat - xpmt1 - xc2[i];
2234 yc[i] = ycat - ypmt1 - yc2[i];
2235 };
2236 TPolyLine *fcat3 = new TPolyLine(5,xc,yc);
2237 fcat3->SetLineColor(1);
2238 colo = (int)(10. - cat3 * 8.);
2239 fcat3->SetFillColor(colo);
2240 fcat3->SetLineWidth(1);
2241 fcat3->Draw("f");
2242 fcat3->Draw();
2243 };
2244 //
2245 // CAT4 PMTs
2246 //
2247 if ( true ){
2248 for (Int_t i = 0; i<5 ; i++) {
2249 xc[i]= xcat + xpmt1 + xc2[i];
2250 yc[i] = ycat + ypmt1 + yc2[i];
2251 };
2252 TPolyLine *fcat4b = new TPolyLine(5,xc,yc);
2253 fcat4b->SetLineColor(1);
2254 colo = (int)(10. - cat4b * 8.);
2255 fcat4b->SetFillColor(colo);
2256 fcat4b->SetLineWidth(1);
2257 fcat4b->Draw("f");
2258 fcat4b->Draw();
2259 };
2260 if ( true ){
2261 for (Int_t i = 0; i<5 ; i++) {
2262 xc[i]= xcat - xpmt1 - xc2[i];
2263 yc[i] = ycat + ypmt1 + yc2[i];
2264 };
2265 TPolyLine *fcat4 = new TPolyLine(5,xc,yc);
2266 fcat4->SetLineColor(1);
2267 colo = (int)(10. - cat4 * 8.);
2268 fcat4->SetFillColor(colo);
2269 fcat4->SetLineWidth(1);
2270 fcat4->Draw("f");
2271 fcat4->Draw();
2272 };
2273 };
2274 if ( true ){
2275 //
2276 // CAS plane view:
2277 //
2278 Float_t xofs = -0.025;
2279 Float_t yofs = 0.039 +0.081+0.0273;
2280 Float_t csy = 0.33/2.;
2281 Float_t pmofs = 0.004;
2282 Float_t csw2 = 0.008;
2283 Float_t xc1[5] = { xofs-csy, xofs-csy, xofs+csy, xofs+csy, xofs-csy};
2284 Float_t yc1[5] = { yofs, yofs+csw2, yofs+csw2, yofs, yofs};
2285
2286 Float_t xc2[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
2287 Float_t yc2[5] = { yofs+pmofs, yofs+pmofs+csw2, yofs+pmofs+csw2, yofs+pmofs, yofs+pmofs};
2288 Float_t xc3[5] = { xofs-csy-csw2, xofs-csy-csw2, xofs-csy, xofs-csy, xofs-csy-csw2};
2289 Float_t yc3[5] = { yofs+pmofs, yofs+pmofs-csw2, yofs+pmofs-csw2, yofs+pmofs, yofs+pmofs};
2290
2291 //
2292 // CAS1
2293 //
2294 Float_t xc[5];
2295 Float_t yc[5];
2296 for (Int_t i = 0; i<5 ; i++) {
2297 xc[i]= xcat + xc1[i]*var.sfx;
2298 yc[i] = ycat + yc1[i]*var.sfy;
2299 };
2300 TPolyLine *pcass1 = new TPolyLine(5,xc,yc);
2301 pcass1->SetLineColor(1);
2302 colo = 10;
2303 if ( cas1 != 0. || cas1b != 0. ) {
2304 if ( cas1 > 0 || cas1b > 0 || cas1 ==-.25 || cas1b ==-.25){
2305 colo = cattime;
2306 } else {
2307 colo = catnoti;
2308 };
2309 };
2310 if ( colo != 10 ) pcass1->SetFillStyle(3001);
2311 pcass1->SetFillColor(colo);
2312 pcass1->SetLineWidth(1);
2313 pcass1->SetLineStyle(2);
2314 pcass1->Draw("f");
2315 pcass1->Draw();
2316 //
2317 for (Int_t i = 0; i<5 ; i++) {
2318 xc[i]= xcat + xc2[i]*var.sfx;
2319 yc[i] = ycat + yc2[i]*var.sfy;
2320 };
2321 TPolyLine *pcasp1b = new TPolyLine(5,xc,yc);
2322 pcasp1b->SetLineColor(1);
2323 colo = (int)(10. - cas1b * 8.);
2324 if ( colo != 10 ) pcasp1b->SetFillStyle(3001);
2325 pcasp1b->SetFillColor(colo);
2326 pcasp1b->SetLineWidth(1);
2327 pcasp1b->SetLineStyle(2);
2328 pcasp1b->Draw("f");
2329 pcasp1b->Draw();
2330 //
2331 for (Int_t i = 0; i<5 ; i++) {
2332 xc[i]= xcat + xc3[i]*var.sfx;
2333 yc[i] = ycat + yc3[i]*var.sfy;
2334 };
2335 TPolyLine *pcasp1 = new TPolyLine(5,xc,yc);
2336 pcasp1->SetLineColor(1);
2337 colo = (int)(10. - cas1 * 8.);
2338 if ( colo != 10 ) pcasp1->SetFillStyle(3001);
2339 pcasp1->SetFillColor(colo);
2340 pcasp1->SetLineWidth(1);
2341 pcasp1->SetLineStyle(2);
2342 pcasp1->Draw("f");
2343 pcasp1->Draw();
2344 //
2345 // CAS2
2346 //
2347 for (Int_t i = 0; i<5 ; i++) {
2348 xc[i]= xcat - xc1[i]*var.sfx;
2349 yc[i] = ycat - yc1[i]*var.sfy;
2350 };
2351 TPolyLine *pcass2 = new TPolyLine(5,xc,yc);
2352 pcass2->SetLineColor(1);
2353 colo = 10;
2354 if ( cas2 != 0. || cas2b != 0. ) {
2355 if ( cas2 > 0 || cas2b > 0 || cas2 ==-.25 || cas2b ==-.25 ){
2356 colo = cattime;
2357 } else {
2358 colo = catnoti;
2359 };
2360 };
2361 if ( colo != 10 ) pcass2->SetFillStyle(3001);
2362 pcass2->SetFillColor(colo);
2363 pcass2->SetLineWidth(1);
2364 pcass2->SetLineStyle(2);
2365 pcass2->Draw("f");
2366 pcass2->Draw();
2367 //
2368 for (Int_t i = 0; i<5 ; i++) {
2369 xc[i]= xcat - xc2[i]*var.sfx;
2370 yc[i] = ycat - yc2[i]*var.sfy;
2371 };
2372 TPolyLine *pcasp2b = new TPolyLine(5,xc,yc);
2373 pcasp2b->SetLineColor(1);
2374 colo = (int)(10. - cas2b * 8.);
2375 if ( colo != 10 ) pcasp2b->SetFillStyle(3001);
2376 pcasp2b->SetFillColor(colo);
2377 pcasp2b->SetLineWidth(1);
2378 pcasp2b->SetLineStyle(2);
2379 pcasp2b->Draw("f");
2380 pcasp2b->Draw();
2381 //
2382 for (Int_t i = 0; i<5 ; i++) {
2383 xc[i]= xcat - xc3[i]*var.sfx;
2384 yc[i] = ycat - yc3[i]*var.sfy;
2385 };
2386 TPolyLine *pcasp2 = new TPolyLine(5,xc,yc);
2387 pcasp2->SetLineColor(1);
2388 colo = (int)(10. - cas2 * 8.);
2389 pcasp2->SetFillColor(colo);
2390 if ( colo != 10 ) pcasp2->SetFillStyle(3001);
2391 pcasp2->SetLineWidth(1);
2392 pcasp2->SetLineStyle(2);
2393 pcasp2->Draw("f");
2394 pcasp2->Draw();
2395
2396 };
2397 if ( true ){
2398 Float_t xofs = 0.048 +0.066+0.0273;
2399 Float_t yofs = 0.02;
2400 Float_t csy = 0.33/2.;
2401 Float_t pmofs = 0.004;
2402 Float_t csw2 = 0.008;
2403 Float_t xc1[5] = { xofs, xofs+csw2, xofs+csw2, xofs, xofs};
2404 Float_t yc1[5] = { yofs-csy, yofs-csy, yofs+csy, yofs+csy, yofs-csy};
2405 Float_t xc2[5] = { xofs+pmofs, xofs+pmofs+csw2, xofs+pmofs+csw2, xofs+pmofs, xofs+pmofs};
2406 Float_t yc2[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
2407 Float_t xc3[5] = { xofs+pmofs, xofs+pmofs-csw2, xofs+pmofs-csw2, xofs+pmofs, xofs+pmofs};
2408 Float_t yc3[5] = { yofs+csy+csw2, yofs+csy+csw2, yofs+csy, yofs+csy, yofs+csy+csw2};
2409 //
2410 // CAS3
2411 //
2412 Float_t xc[5];
2413 Float_t yc[5];
2414 for (Int_t i = 0; i<5 ; i++) {
2415 xc[i]= xcat + xc1[i]*var.sfx;
2416 yc[i] = ycat + yc1[i]*var.sfy;
2417 };
2418 TPolyLine *pcass3 = new TPolyLine(5,xc,yc);
2419 pcass3->SetLineColor(1);
2420 colo = 10;
2421 if ( cas3 != 0. || cas3b != 0. ) {
2422 if ( cas3 > 0 || cas3b > 0 || cas3 ==-.25 || cas3b ==-.25){
2423 colo = cattime;
2424 } else {
2425 colo = catnoti;
2426 };
2427 };
2428 if ( colo != 10 ) pcass3->SetFillStyle(3001);
2429 pcass3->SetFillColor(colo);
2430 pcass3->SetLineWidth(1);
2431 pcass3->SetLineStyle(2);
2432 pcass3->Draw("f");
2433 pcass3->Draw();
2434 //
2435 for (Int_t i = 0; i<5 ; i++) {
2436 xc[i]= xcat + xc2[i]*var.sfx;
2437 yc[i] = ycat + yc2[i]*var.sfy;
2438 };
2439 TPolyLine *pcasp3b = new TPolyLine(5,xc,yc);
2440 pcasp3b->SetLineColor(1);
2441 colo = (int)(10. - cas3b * 8.);
2442 if ( colo != 10 ) pcasp3b->SetFillStyle(3001);
2443 pcasp3b->SetFillColor(colo);
2444 pcasp3b->SetLineWidth(1);
2445 pcasp3b->SetLineStyle(2);
2446 pcasp3b->Draw("f");
2447 pcasp3b->Draw();
2448 //
2449 for (Int_t i = 0; i<5 ; i++) {
2450 xc[i]= xcat + xc3[i]*var.sfx;
2451 yc[i] = ycat + yc3[i]*var.sfy;
2452 };
2453 TPolyLine *pcasp3 = new TPolyLine(5,xc,yc);
2454 pcasp3->SetLineColor(1);
2455 colo = (int)(10. - cas3 * 8.);
2456 pcasp3->SetFillColor(colo);
2457 if ( colo != 10 ) pcasp3->SetFillStyle(3001);
2458 pcasp3->SetLineWidth(1);
2459 pcasp3->SetLineStyle(2);
2460 pcasp3->Draw("f");
2461 pcasp3->Draw();
2462 //
2463 // CAS4
2464 //
2465 for (Int_t i = 0; i<5 ; i++) {
2466 xc[i]= xcat - xc1[i]*var.sfx;
2467 yc[i] = ycat - yc1[i]*var.sfy;
2468 };
2469 TPolyLine *pcass4 = new TPolyLine(5,xc,yc);
2470 pcass4->SetLineColor(1);
2471 colo = 10;
2472 if ( cas4 != 0. || cas4b != 0. ) {
2473 if ( cas4 > 0 || cas4b > 0 || cas4 ==-.25 || cas4b ==-.25 ){
2474 colo = cattime;
2475 } else {
2476 colo = catnoti;
2477 };
2478 };
2479 pcass4->SetFillColor(colo);
2480 if ( colo != 10 ) pcass4->SetFillStyle(3001);
2481 pcass4->SetLineWidth(1);
2482 pcass4->SetLineStyle(2);
2483 pcass4->Draw("f");
2484 pcass4->Draw();
2485 //
2486 for (Int_t i = 0; i<5 ; i++) {
2487 xc[i]= xcat - xc2[i]*var.sfx;
2488 yc[i] = ycat - yc2[i]*var.sfy;
2489 };
2490 TPolyLine *pcasp4 = new TPolyLine(5,xc,yc);
2491 pcasp4->SetLineColor(1);
2492 colo = (int)(10. - cas4 * 8.);
2493 pcasp4->SetFillColor(colo);
2494 if ( colo != 10 ) pcasp4->SetFillStyle(3001);
2495 pcasp4->SetLineWidth(1);
2496 pcasp4->SetLineStyle(2);
2497 pcasp4->Draw("f");
2498 pcasp4->Draw();
2499 //
2500 for (Int_t i = 0; i<5 ; i++) {
2501 xc[i]= xcat - xc3[i]*var.sfx;
2502 yc[i] = ycat - yc3[i]*var.sfy;
2503 };
2504 TPolyLine *pcasp4b = new TPolyLine(5,xc,yc);
2505 pcasp4b->SetLineColor(1);
2506 colo = (int)(10. - cas4b * 8.);
2507 pcasp4b->SetFillColor(colo);
2508 if ( colo != 10 ) pcasp4b->SetFillStyle(3001);
2509 pcasp4b->SetLineWidth(1);
2510 pcasp4b->SetLineStyle(2);
2511 pcasp4b->Draw("f");
2512 pcasp4b->Draw();
2513 };
2514 Float_t alfa = 1.2020334;
2515 Float_t lcrd = 0.1815/2.;
2516 Float_t wcrd = 0.008;
2517 if ( true ){
2518 //
2519 // CARD plane view:
2520 //
2521 Float_t xc1[5] = { -0.090165, -0.090165, -0.082165, -0.082165, -0.090165};
2522 Float_t yc1[5] = { -0.100, 0.092, 0.092, -0.100, -0.100};
2523 Float_t xc2[5] = { -0.094165, -0.094165, -0.086165, -0.086165, -0.094165};
2524 Float_t yc2[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
2525 Float_t xc3[5] = { -0.086165, -0.086165, -0.078165, -0.078165, -0.086165};
2526 Float_t yc3[5] = { 0.092, 0.100, 0.100, 0.092, 0.092};
2527 //
2528 // CARD1
2529 //
2530 Float_t xc[5];
2531 Float_t yc[5];
2532 for (Int_t i = 0; i<5 ; i++) {
2533 xc[i]= xcat + xc1[i]*var.sfx;
2534 yc[i] = ycat + yc1[i]*var.sfy;
2535 };
2536 TPolyLine *pcars1 = new TPolyLine(5,xc,yc);
2537 pcars1->SetLineColor(1);
2538 colo = 10;
2539 if ( card1 != 0. || card1b != 0. ) {
2540 if ( card1 > 0 || card1b > 0 || card1 ==-.25 || card1b ==-.25 ){
2541 colo = cattime;
2542 } else {
2543 colo = catnoti;
2544 };
2545 };
2546 pcars1->SetFillColor(colo);
2547 pcars1->SetLineWidth(1);
2548 pcars1->Draw("f");
2549 pcars1->Draw();
2550 //
2551 for (Int_t i = 0; i<5 ; i++) {
2552 xc[i]= xcat + xc2[i]*var.sfx;
2553 yc[i] = ycat + yc2[i]*var.sfy;
2554 };
2555 TPolyLine *pcarp1b = new TPolyLine(5,xc,yc);
2556 pcarp1b->SetLineColor(1);
2557 colo = (int)(10. - card1b * 8.);
2558 pcarp1b->SetFillColor(colo);
2559 pcarp1b->SetLineWidth(1);
2560 pcarp1b->Draw("f");
2561 pcarp1b->Draw();
2562 //
2563 for (Int_t i = 0; i<5 ; i++) {
2564 xc[i] = xcat + xc3[i]*var.sfx;
2565 yc[i] = ycat + yc3[i]*var.sfy;
2566 };
2567 TPolyLine *pcarp1 = new TPolyLine(5,xc,yc);
2568 pcarp1->SetLineColor(1);
2569 colo = (int)(10. - card1 * 8.);
2570 pcarp1->SetFillColor(colo);
2571 pcarp1->SetLineWidth(1);
2572 pcarp1->Draw("f");
2573 pcarp1->Draw();
2574 //
2575 // CARD4
2576 //
2577 for (Int_t i = 0; i<5 ; i++) {
2578 xc[i]= xcat - xc1[i]*var.sfx;
2579 yc[i] = ycat - yc1[i]*var.sfy;
2580 };
2581 TPolyLine *pcars4 = new TPolyLine(5,xc,yc);
2582 pcars4->SetLineColor(1);
2583 colo = 10;
2584 if ( card4 != 0. || card4b != 0. ) {
2585 if ( card4 > 0 || card4b > 0 || card4 ==-.25 || card4b ==-.25){
2586 colo = cattime;
2587 } else {
2588 colo = catnoti;
2589 };
2590 };
2591 pcars4->SetFillColor(colo);
2592 pcars4->SetLineWidth(1);
2593 pcars4->Draw("f");
2594 pcars4->Draw();
2595 //
2596 for (Int_t i = 0; i<5 ; i++) {
2597 xc[i]= xcat - xc2[i]*var.sfx;
2598 yc[i] = ycat - yc2[i]*var.sfy;
2599 };
2600 TPolyLine *pcarp4b = new TPolyLine(5,xc,yc);
2601 pcarp4b->SetLineColor(1);
2602 colo = (int)(10. - card4b * 8.);
2603 pcarp4b->SetFillColor(colo);
2604 pcarp4b->SetLineWidth(1);
2605 pcarp4b->Draw("f");
2606 pcarp4b->Draw();
2607 //
2608 for (Int_t i = 0; i<5 ; i++) {
2609 xc[i]= xcat - xc3[i]*var.sfx;
2610 yc[i] = ycat - yc3[i]*var.sfy;
2611 };
2612 TPolyLine *pcarp4 = new TPolyLine(5,xc,yc);
2613 pcarp4->SetLineColor(1);
2614 colo = (int)(10. - card4 * 8.);
2615 pcarp4->SetFillColor(colo);
2616 pcarp4->SetLineWidth(1);
2617 pcarp4->Draw("f");
2618 pcarp4->Draw();
2619 };
2620 if ( true ){
2621 Float_t xc1[5] = { -0.074, 0.074, 0.074, -0.074, -0.074};
2622 Float_t yc1[5] = { 0.108165, 0.108165, 0.100165, 0.100165, 0.108165};
2623 Float_t xc2[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
2624 Float_t yc2[5] = { 0.112165, 0.112165, 0.104165, 0.104165, 0.112165};
2625 Float_t xc3[5] = { 0.074, 0.082, 0.082, 0.074, 0.074};
2626 Float_t yc3[5] = { 0.104165, 0.104165, 0.096165, 0.096165, 0.104165};
2627 //
2628 // CARD2
2629 //
2630 Float_t xc[5];
2631 Float_t yc[5];
2632 for (Int_t i = 0; i<5 ; i++) {
2633 xc[i]= xcat - (xc1[i]-0.0025)*var.sfx;
2634 yc[i] = ycat - yc1[i]*var.sfy;
2635 };
2636 TPolyLine *pcars2 = new TPolyLine(5,xc,yc);
2637 pcars2->SetLineColor(1);
2638 colo = 10;
2639 if ( card2 != 0. || card2b != 0.) {
2640 if ( card2 > 0 || card2b > 0 || card2 ==-.25 || card2b ==-.25 ){
2641 colo = cattime;
2642 } else {
2643 colo = catnoti;
2644 };
2645 };
2646 pcars2->SetFillColor(colo);
2647 pcars2->SetLineWidth(1);
2648 pcars2->Draw("f");
2649 pcars2->Draw();
2650 //
2651 for (Int_t i = 0; i<5 ; i++) {
2652 xc[i]= xcat - (xc2[i]-0.0025)*var.sfx;
2653 yc[i] = ycat - yc2[i]*var.sfy;
2654 };
2655 TPolyLine *pcarp2 = new TPolyLine(5,xc,yc);
2656 pcarp2->SetLineColor(1);
2657 colo = (int)(10. - card2 * 8.);
2658 pcarp2->SetFillColor(colo);
2659 pcarp2->SetLineWidth(1);
2660 pcarp2->Draw("f");
2661 pcarp2->Draw();
2662 //
2663 for (Int_t i = 0; i<5 ; i++) {
2664 xc[i]= xcat - (xc3[i]-0.0025)*var.sfx;
2665 yc[i] = ycat - yc3[i]*var.sfy;
2666 };
2667 TPolyLine *pcarp2b = new TPolyLine(5,xc,yc);
2668 pcarp2b->SetLineColor(1);
2669 colo = (int)(10. - card2b * 8.);
2670 pcarp2b->SetFillColor(colo);
2671 pcarp2b->SetLineWidth(1);
2672 pcarp2b->Draw("f");
2673 pcarp2b->Draw();
2674 //
2675 // CARD3
2676 //
2677 for (Int_t i = 0; i<5 ; i++) {
2678 xc[i]= xcat + (xc1[i]-0.0025)*var.sfx;
2679 yc[i] = ycat + yc1[i]*var.sfy;
2680 };
2681 TPolyLine *pcars3 = new TPolyLine(5,xc,yc);
2682 pcars3->SetLineColor(1);
2683 colo = 10;
2684 if ( card3 != 0. || card3b != 0. ) {
2685 if ( card3 > 0 || card3b > 0 || card3==-.25 || card3b ==-.25){
2686 colo = cattime;
2687 } else {
2688 colo = catnoti;
2689 };
2690 };
2691 pcars3->SetFillColor(colo);
2692 pcars3->SetLineWidth(1);
2693 pcars3->Draw("f");
2694 pcars3->Draw();
2695 //
2696 for (Int_t i = 0; i<5 ; i++) {
2697 xc[i]= xcat + (xc2[i]-0.0025)*var.sfx;
2698 yc[i] = ycat + yc2[i]*var.sfy;
2699 };
2700 TPolyLine *pcarp3 = new TPolyLine(5,xc,yc);
2701 pcarp3->SetLineColor(1);
2702 colo = (int)(10. - card3 * 8.);
2703 pcarp3->SetFillColor(colo);
2704 pcarp3->SetLineWidth(1);
2705 pcarp3->Draw("f");
2706 pcarp3->Draw();
2707 //
2708 for (Int_t i = 0; i<5 ; i++) {
2709 xc[i]= xcat + (xc3[i]-0.0025)*var.sfx;
2710 yc[i] = ycat + yc3[i]*var.sfy;
2711 };
2712 TPolyLine *pcarp3b = new TPolyLine(5,xc,yc);
2713 pcarp3b->SetLineColor(1);
2714 colo = (int)(10. - card3b * 8.);
2715 pcarp3b->SetFillColor(colo);
2716 pcarp3b->SetLineWidth(1);
2717 pcarp3b->Draw("f");
2718 pcarp3b->Draw();
2719
2720 //
2721 // CARD - X-view
2722 //
2723 Float_t cardcx = 0.143168*var.sfx;
2724 Float_t cardcy = 0.1475*var.sfy;
2725 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
2726 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
2727 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
2728 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
2729
2730 //
2731 // CARD3 X/ Y
2732 //
2733 Float_t xcc[4];
2734 Float_t ycc[4];
2735 for (Int_t i = 0; i<4 ; i++) {
2736 xcc[i] = cardcx + var.xxvc + acrdx[i]*var.sfx;
2737 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
2738 };
2739 TPolyLine *fcard3 = new TPolyLine(4,xcc,ycc);
2740 fcard3->SetLineColor(1);
2741 colo = (int)(10. - card3 * 8.);
2742 fcard3->SetFillColor(colo);
2743 fcard3->SetLineWidth(1);
2744 fcard3->Draw("f");
2745 fcard3->Draw();
2746 //
2747 for (Int_t i = 0; i<4 ; i++) {
2748 xcc[i] = cardcx + var.xxvc + bcrdx[i]*var.sfx;
2749 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
2750 };
2751 TPolyLine *fcard3b = new TPolyLine(4,xcc,ycc);
2752 fcard3b->SetLineColor(1);
2753 colo = (int)(10. - card3b * 8.);
2754 fcard3b->SetFillColor(colo);
2755 fcard3b->SetLineWidth(1);
2756 fcard3b->Draw("f");
2757 fcard3b->Draw();
2758
2759 //
2760 // CARD2 \X Y
2761 //
2762 for (Int_t i = 0; i<4 ; i++) {
2763 xcc[i] = -cardcx + var.xxvc - acrdx[i]*var.sfx;
2764 ycc[i] = cardcy + var.yxvc + (0.36 + acrdy[i])*var.sfy;
2765 };
2766 TPolyLine *fcard2 = new TPolyLine(4,xcc,ycc);
2767 fcard2->SetLineColor(1);
2768 colo = (int)(10. - card2 * 8.);
2769 fcard2->SetFillColor(colo);
2770 fcard2->SetLineWidth(1);
2771 fcard2->Draw("f");
2772 fcard2->Draw();
2773 //
2774 for (Int_t i = 0; i<4 ; i++) {
2775 xcc[i] = -cardcx + var.xxvc - bcrdx[i]*var.sfx;
2776 ycc[i] = cardcy + var.yxvc + (0.36 + bcrdy[i])*var.sfy;
2777 };
2778 TPolyLine *fcard2b = new TPolyLine(4,xcc,ycc);
2779 fcard2b->SetLineColor(1);
2780 colo = (int)(10. - card2b * 8.);
2781 fcard2b->SetFillColor(colo);
2782 fcard2b->SetLineWidth(1);
2783 fcard2b->Draw("f");
2784 fcard2b->Draw();
2785 };
2786
2787 if ( true ){
2788 Float_t acrdx[4] = {-lcrd*cos(alfa), lcrd*cos(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)};
2789 Float_t acrdy[4] = {-lcrd*sin(alfa), lcrd*sin(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)};
2790 Float_t bcrdx[4] = { lcrd*cos(alfa), lcrd*cos(alfa)+wcrd*sin(alfa), -lcrd*cos(alfa)+wcrd*sin(alfa), lcrd*cos(alfa)};
2791 Float_t bcrdy[4] = { lcrd*sin(alfa), lcrd*sin(alfa)-wcrd*cos(alfa), -lcrd*sin(alfa)-wcrd*cos(alfa), lcrd*sin(alfa)};
2792 //
2793 // CARD - Y-view
2794 //
2795 Float_t cardcx = 0.12*var.sfx;
2796 Float_t cardcy = 0.1475*var.sfy;
2797 //
2798 // CARD4 X Y/
2799 //
2800 Float_t xcc[4];
2801 Float_t ycc[4];
2802 for (Int_t i = 0; i<4 ; i++) {
2803 xcc[i] = cardcx + var.xyvc + acrdx[i]*var.sfx;
2804 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
2805 };
2806 TPolyLine *fcard4 = new TPolyLine(4,xcc,ycc);
2807 fcard4->SetLineColor(1);
2808 colo = (int)(10. - card4 * 8.);
2809 fcard4->SetFillColor(colo);
2810 fcard4->SetLineWidth(1);
2811 fcard4->Draw("f");
2812 fcard4->Draw();
2813 //
2814 for (Int_t i = 0; i<4 ; i++) {
2815 xcc[i] = cardcx + var.xyvc + bcrdx[i]*var.sfx;
2816 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
2817 };
2818 TPolyLine *fcard4b = new TPolyLine(4,xcc,ycc);
2819 fcard4b->SetLineColor(1);
2820 colo = (int)(10. - card4b * 8.);
2821 fcard4b->SetFillColor(colo);
2822 fcard4b->SetLineWidth(1);
2823 fcard4b->Draw("f");
2824 fcard4b->Draw();
2825
2826 //
2827 // CARD1 X \Y
2828 //
2829 for (Int_t i = 0; i<4 ; i++) {
2830 xcc[i] = -cardcx + var.xyvc - acrdx[i]*var.sfx;
2831 ycc[i] = cardcy + var.yyvc + (0.36 + acrdy[i])*var.sfy;
2832 };
2833 TPolyLine *fcard1 = new TPolyLine(4,xcc,ycc);
2834 fcard1->SetLineColor(1);
2835 colo = (int)(10. - card1 * 8.);
2836 fcard1->SetFillColor(colo);
2837 fcard1->SetLineWidth(1);
2838 fcard1->Draw("f");
2839 fcard1->Draw();
2840 //
2841 for (Int_t i = 0; i<4 ; i++) {
2842 xcc[i] = -cardcx + var.xyvc - bcrdx[i]*var.sfx;
2843 ycc[i] = cardcy + var.yyvc + (0.36 + bcrdy[i])*var.sfy;
2844 };
2845 TPolyLine *fcard1b = new TPolyLine(4,xcc,ycc);
2846 fcard1b->SetLineColor(1);
2847 colo = (int)(10. - card1b * 8.);
2848 fcard1b->SetFillColor(colo);
2849 fcard1b->SetLineWidth(1);
2850 fcard1b->Draw("f");
2851 fcard1b->Draw();
2852 };
2853 }
2854
2855 void ShowTOF(Int_t j, TTree *otr, Variables & var){
2856 //
2857 // get the trigger infos
2858 //
2859 pamela::trigger::TriggerEvent *trigger = 0;
2860 otr->SetBranchAddress("Trigger.Event", &trigger);
2861 if ( !var.nosig ) otr->GetEntry(j);
2862 //
2863
2864 //
2865 // on day these variables will contain the MIP value for each paddle
2866 //
2867 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2868 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
2869 Float_t ms21a[2] = {0.,0.};
2870 Float_t ms22a[2] = {0.,0.};
2871 Float_t ms31a[3] = {0.,0.,0.};
2872 Float_t ms32a[3] = {0.,0.,0.};
2873 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
2874 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
2875 Float_t ms21b[2] = {0.,0.};
2876 Float_t ms22b[2] = {0.,0.};
2877 Float_t ms31b[3] = {0.,0.,0.};
2878 Float_t ms32b[3] = {0.,0.,0.};
2879 //
2880 // TDC info for each PMT
2881 //
2882 Float_t mt11[2][8];
2883 Float_t mt12[2][6];
2884 Float_t mt21[2][2];
2885 Float_t mt22[2][2];
2886 Float_t mt31[2][3];
2887 Float_t mt32[2][3];
2888 //
2889 Int_t S3 = 0;
2890 Int_t S2 = 0;
2891 Int_t S12 = 0;
2892 Int_t S11 = 0;
2893 if ( !var.nosig ) {
2894 S3 = trigger->patterntrig[2];
2895 S2 = trigger->patterntrig[3];
2896 S12 = trigger->patterntrig[4];
2897 S11 = trigger->patterntrig[5];
2898 };
2899 //
2900 for ( Int_t i = 0; i<8; i++ ) {
2901 if ( S11 & (1<<i) ){
2902 ms11a[i] = 1.;
2903 }
2904 if ( S11 & (1<<(i+8) ) ){
2905 ms11b[i] = 1.;
2906 }
2907 };
2908 for ( Int_t i = 0; i<6; i++ ) {
2909 if ( S12 & (1<<i) ) {
2910 ms12a[i] = 1.;
2911 }
2912 if ( S12 & (1<<(i+6)) ) {
2913 ms12b[i] = 1.;
2914 }
2915 };
2916 Int_t ii = 2;
2917 for ( Int_t i = 0; i<2; i++ ) {
2918 ii--;
2919 if ( S2 & (1<<i) ) {
2920 ms21a[ii] = 1.;
2921 }
2922 if ( S2 & (1<<(i+2)) ) {
2923 ms21b[ii] = 1.;
2924 }
2925 };
2926 for ( Int_t i = 4; i<6; i++ ) {
2927 if ( S2 & (1<<i) ) {
2928 ms22a[i-4] = 1.;
2929 }
2930 if ( S2 & (1<<(i+2)) ) {
2931 ms22b[i-4] = 1.;
2932 }
2933 };
2934 for ( Int_t i = 0; i<3; i++ ) {
2935 if ( S3 & (1<<i) ) {
2936 ms31a[i] = 1.;
2937 }
2938 if ( S3 & (1<<(i+3)) ) {
2939 ms31b[i] = 1.;
2940 }
2941 };
2942 for ( Int_t i = 6; i<9; i++ ) {
2943 if ( S3 & (1<<i) ) {
2944 ms32a[i-6] = 1.;
2945 }
2946 if ( S3 & (1<<(i+3)) ) {
2947 ms32b[i-6] = 1.;
2948 }
2949 };
2950 //
2951 Int_t colo;
2952 Int_t ocolo;
2953 Float_t xs2x = var.xxvc;
2954 Float_t ys2x = var.yxvc + 0.36*var.sfy;
2955 Float_t xs2y = var.xyvc;
2956 Float_t ys2y = var.yyvc + 0.36*var.sfy;
2957 Float_t ws2 = 0.005;
2958 Float_t ws13 = 0.007;
2959 Int_t noadc = 12;
2960 if ( var.bw ){
2961 noadc=12;
2962 } else {
2963 noadc=41;
2964 };
2965 //
2966 // S11 X-view
2967 //
2968 // A
2969 Float_t s11p = 0.051;
2970 ocolo = 10;
2971 TPolyLine *ftof11xa[8];
2972 for ( Int_t j=0; j<8; j++){
2973 Float_t xc1[4]={ (s11p*j), (s11p*j), s11p*(j+1), (s11p*j)};
2974 Float_t yc1[4]={ 0., ws13, ws13, 0.};
2975 Float_t xc[4];
2976 Float_t yc[4];
2977 for (Int_t i = 0; i<4 ; i++) {
2978 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
2979 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
2980 };
2981 ftof11xa[j] = new TPolyLine(4,xc,yc);
2982 ftof11xa[j]->SetLineColor(1);
2983 if ( var.bw ){
2984 colo = -1;
2985 } else {
2986 colo = 1;
2987 };
2988 ColorMIP(ms11a[j],colo);
2989 //
2990 if ( colo != 10 ) ocolo = colo;
2991 if ( mt11[0][j] == 4095. ) colo = noadc;
2992 //
2993 ftof11xa[j]->SetFillColor(colo);
2994 ftof11xa[j]->SetLineWidth(1);
2995 ftof11xa[j]->Draw("f");
2996 ftof11xa[j]->Draw();
2997 };
2998 // B
2999 s11p = 0.051;
3000 TPolyLine *ftof11xb[8];
3001 for ( Int_t j=0; j<8; j++){
3002 Float_t xc1[4]={ (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
3003 Float_t yc1[4]={ 0., 0., ws13, 0.};
3004 Float_t xc[4];
3005 Float_t yc[4];
3006 for (Int_t i = 0; i<4 ; i++) {
3007 xc[i]= xs2x + (-0.204+xc1[i])*var.sfx;
3008 yc[i] = ys2x + (0.295+yc1[i])*var.sfy;
3009 };
3010 ftof11xb[j] = new TPolyLine(4,xc,yc);
3011 ftof11xb[j]->SetLineColor(1);
3012 if ( var.bw ){
3013 colo = -1;
3014 } else {
3015 colo = 1;
3016 };
3017 ColorMIP(ms11b[j],colo);
3018 //
3019 if ( colo != 10 ) ocolo = colo;
3020 if ( mt11[1][j] == 4095. ) colo = noadc;
3021 //
3022 ftof11xb[j]->SetFillColor(colo);
3023 ftof11xb[j]->SetLineWidth(1);
3024 ftof11xb[j]->Draw("f");
3025 ftof11xb[j]->Draw();
3026 };
3027
3028 //
3029 // S11 Y-view
3030 //
3031 if ( true ){
3032 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
3033 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
3034 Float_t nxc[5];
3035 Float_t nyc[5];
3036 for (Int_t i = 0; i<5 ; i++) {
3037 nxc[i]= xs2y + nxc1[i]*var.sfx;
3038 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
3039 };
3040 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
3041 ftof11y->SetLineColor(1);
3042 ftof11y->SetFillColor(ocolo);
3043 ftof11y->SetLineWidth(1);
3044 ftof11y->Draw("f");
3045 ftof11y->Draw();
3046 };
3047
3048 //
3049 // S12 Y-view
3050 //
3051 // A
3052 Float_t s12p = 0.055;
3053 ocolo = 10;
3054 TPolyLine *ftof12ya[6];
3055 for ( Int_t j=0; j<6; j++){
3056 Float_t xc1[4]={ (s12p*j), s12p*(j), s12p*(j+1), (s12p*j)};
3057 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
3058 Float_t xc[4];
3059 Float_t yc[4];
3060 for (Int_t i = 0; i<4 ; i++) {
3061 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
3062 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
3063 };
3064 ftof12ya[j] = new TPolyLine(4,xc,yc);
3065 ftof12ya[j]->SetLineColor(1);
3066 if ( var.bw ){
3067 colo = -1;
3068 } else {
3069 colo = 1;
3070 };
3071 ColorMIP(ms12a[j],colo);
3072 //
3073 if ( colo != 10 ) ocolo = colo;
3074 if ( mt12[0][j] == 4095. ) colo = noadc;
3075 //
3076 ftof12ya[j]->SetFillColor(colo);
3077 ftof12ya[j]->SetLineWidth(1);
3078 ftof12ya[j]->Draw("f");
3079 ftof12ya[j]->Draw();
3080 };
3081 // B
3082 s12p = 0.055;
3083 TPolyLine *ftof12yb[6];
3084 for ( Int_t j=0; j<6; j++){
3085 Float_t xc1[4]={ (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
3086 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
3087 Float_t xc[4];
3088 Float_t yc[4];
3089 for (Int_t i = 0; i<4 ; i++) {
3090 xc[i]= xs2y + (-0.165+xc1[i])*var.sfx;
3091 yc[i] = ys2y + (0.295+yc1[i])*var.sfy;
3092 };
3093 ftof12yb[j] = new TPolyLine(4,xc,yc);
3094 ftof12yb[j]->SetLineColor(1);
3095 if ( var.bw ){
3096 colo = -1;
3097 } else {
3098 colo = 1;
3099 };
3100 ColorMIP(ms12b[j],colo);
3101 //
3102 if ( colo != 10 ) ocolo = colo;
3103 if ( mt12[1][j] == 4095. ) colo = noadc;
3104 //
3105 ftof12yb[j]->SetFillColor(colo);
3106 ftof12yb[j]->SetLineWidth(1);
3107 ftof12yb[j]->Draw("f");
3108 ftof12yb[j]->Draw();
3109 };
3110 //
3111 // S12 X-view
3112 //
3113 if ( true ){
3114 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
3115 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
3116 Float_t nxc[5];
3117 Float_t nyc[5];
3118 for (Int_t i = 0; i<5 ; i++) {
3119 nxc[i]= xs2x + nxc1[i]*var.sfx;
3120 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
3121 };
3122 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
3123 ftof12x->SetLineColor(1);
3124 ftof12x->SetFillColor(ocolo);
3125 ftof12x->SetLineWidth(1);
3126 ftof12x->Draw("f");
3127 ftof12x->Draw();
3128 };
3129
3130 //
3131 // S21 Y-view
3132 //
3133 // A
3134 Float_t s21p = 0.075;
3135 ocolo = 10;
3136 TPolyLine *ftof21ya[2];
3137 for ( Int_t j=0; j<2; j++){
3138 Float_t xc1[4]={ s21p*(j-1), s21p*(j-1), s21p*j, s21p*(j-1)};
3139 Float_t yc1[4]={ 0., ws2, ws2, 0.};
3140 Float_t xc[4];
3141 Float_t yc[4];
3142 for (Int_t i = 0; i<4 ; i++) {
3143 xc[i]= xs2y + xc1[i]*var.sfx;
3144 yc[i] = ys2y + yc1[i]*var.sfy;
3145 };
3146 ftof21ya[j] = new TPolyLine(4,xc,yc);
3147 ftof21ya[j]->SetLineColor(1);
3148 if ( var.bw ){
3149 colo = -1;
3150 } else {
3151 colo = 1;
3152 };
3153 ColorMIP(ms21a[j],colo);
3154 //
3155 if ( colo != 10 ) ocolo = colo;
3156 if ( mt21[0][j] == 4095. ) colo = noadc;
3157 //
3158 ftof21ya[j]->SetFillColor(colo);
3159 ftof21ya[j]->SetLineWidth(1);
3160 ftof21ya[j]->Draw("f");
3161 ftof21ya[j]->Draw();
3162 };
3163 // B
3164 s21p = 0.075;
3165 TPolyLine *ftof21yb[2];
3166 for ( Int_t j=0; j<2; j++){
3167 Float_t xc1[4]={ s21p*(j-1), s21p*j, s21p*j, s21p*(j-1)};
3168 Float_t yc1[4]={ 0., 0., ws2, 0.};
3169 Float_t xc[4];
3170 Float_t yc[4];
3171 for (Int_t i = 0; i<4 ; i++) {
3172 xc[i]= xs2y + xc1[i]*var.sfx;
3173 yc[i] = ys2y + yc1[i]*var.sfy;
3174 };
3175 ftof21yb[j] = new TPolyLine(4,xc,yc);
3176 ftof21yb[j]->SetLineColor(1);
3177 if ( var.bw ){
3178 colo = -1;
3179 } else {
3180 colo = 1;
3181 };
3182 ColorMIP(ms21b[j],colo);
3183 //
3184 if ( colo != 10 ) ocolo = colo;
3185 if ( mt21[1][j] == 4095. ) colo = noadc;
3186 //
3187 ftof21yb[j]->SetFillColor(colo);
3188 ftof21yb[j]->SetLineWidth(1);
3189 ftof21yb[j]->Draw("f");
3190 ftof21yb[j]->Draw();
3191 };
3192 //
3193 // S21 X-view
3194 //
3195 if ( true ){
3196 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
3197 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
3198 Float_t nxc[5];
3199 Float_t nyc[5];
3200 for (Int_t i = 0; i<5 ; i++) {
3201 nxc[i]= xs2x + nxc1[i]*var.sfx;
3202 nyc[i] = ys2x + nyc1[i]*var.sfy;
3203 };
3204 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
3205 ftof21x->SetLineColor(1);
3206 ftof21x->SetFillColor(ocolo);
3207 ftof21x->SetLineWidth(1);
3208 ftof21x->Draw("f");
3209 ftof21x->Draw();
3210 };
3211 //
3212 // S22 X-view
3213 //
3214 // A
3215 Float_t s22p = 0.090;
3216 ocolo = 10;
3217 TPolyLine *ftof22xa[2];
3218 for ( Int_t j=0; j<2; j++){
3219 Float_t xc1[4]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*(j-1)};
3220 Float_t yc1[4]={ -ws2, 0., 0., -ws2};
3221 Float_t xc[4];
3222 Float_t yc[4];
3223 for (Int_t i = 0; i<4 ; i++) {
3224 xc[i]= xs2x + xc1[i]*var.sfx;
3225 yc[i] = ys2x + yc1[i]*var.sfy;
3226 };
3227 ftof22xa[j] = new TPolyLine(4,xc,yc);
3228 ftof22xa[j]->SetLineColor(1);
3229 if ( var.bw ){
3230 colo = -1;
3231 } else {
3232 colo = 1;
3233 };
3234 ColorMIP(ms22a[j],colo);
3235 //
3236 if ( colo != 10 ) ocolo = colo;
3237 if ( mt22[0][j] == 4095. ) colo = noadc;
3238 //
3239 ftof22xa[j]->SetFillColor(colo);
3240 ftof22xa[j]->SetLineWidth(1);
3241 ftof22xa[j]->Draw("f");
3242 ftof22xa[j]->Draw();
3243 };
3244 // B
3245 s22p = 0.090;
3246 TPolyLine *ftof22xb[2];
3247 for ( Int_t j=0; j<2; j++){
3248 Float_t xc1[4]={ s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
3249 Float_t yc1[4]={ -ws2, -ws2, 0., -ws2};
3250 Float_t xc[4];
3251 Float_t yc[4];
3252 for (Int_t i = 0; i<4 ; i++) {
3253 xc[i]= xs2x + xc1[i]*var.sfx;
3254 yc[i] = ys2x + yc1[i]*var.sfy;
3255 };
3256 ftof22xb[j] = new TPolyLine(4,xc,yc);
3257 ftof22xb[j]->SetLineColor(1);
3258 if ( var.bw ){
3259 colo = -1;
3260 } else {
3261 colo = 1;
3262 };
3263 ColorMIP(ms22b[j],colo);
3264 //
3265 if ( colo != 10 ) ocolo = colo;
3266 if ( mt22[1][j] == 4095. ) colo = noadc;
3267 //
3268 ftof22xb[j]->SetFillColor(colo);
3269 ftof22xb[j]->SetLineWidth(1);
3270 ftof22xb[j]->Draw("f");
3271 ftof22xb[j]->Draw();
3272 };
3273 //
3274 // S22 Y-view
3275 //
3276 if ( true ){
3277 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
3278 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
3279 Float_t nxc[5];
3280 Float_t nyc[5];
3281 for (Int_t i = 0; i<5 ; i++) {
3282 nxc[i]= xs2y + nxc1[i]*var.sfx;
3283 nyc[i] = ys2y + nyc1[i]*var.sfy;
3284 };
3285 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
3286 ftof22y->SetLineColor(1);
3287 ftof22y->SetFillColor(ocolo);
3288 ftof22y->SetLineWidth(1);
3289 ftof22y->Draw("f");
3290 ftof22y->Draw();
3291 };
3292
3293 //
3294 // S31 X-view
3295 //
3296 // A
3297 Float_t s31p = 0.060;
3298 ocolo = 10;
3299 TPolyLine *ftof31xa[3];
3300 for ( Int_t j=0; j<3; j++){
3301 Float_t xc1[4]={ (s31p*j), (s31p*j), s31p*(j+1), (s31p*j)};
3302 Float_t yc1[4]={ 0., ws13, ws13, 0.};
3303 Float_t xc[4];
3304 Float_t yc[4];
3305 for (Int_t i = 0; i<4 ; i++) {
3306 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
3307 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
3308 };
3309 ftof31xa[j] = new TPolyLine(4,xc,yc);
3310 ftof31xa[j]->SetLineColor(1);
3311 if ( var.bw ){
3312 colo = -1;
3313 } else {
3314 colo = 1;
3315 };
3316 ColorMIP(ms31a[j],colo);
3317 //
3318 if ( colo != 10 ) ocolo = colo;
3319 if ( mt31[0][j] == 4095. ) colo = noadc;
3320 //
3321 ftof31xa[j]->SetFillColor(colo);
3322 ftof31xa[j]->SetLineWidth(1);
3323 ftof31xa[j]->Draw("f");
3324 ftof31xa[j]->Draw();
3325 };
3326 // B
3327 s31p = 0.060;
3328 TPolyLine *ftof31xb[3];
3329 for ( Int_t j=0; j<3; j++){
3330 Float_t xc1[4]={ (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
3331 Float_t yc1[4]={ 0., 0., ws13, 0.};
3332 Float_t xc[4];
3333 Float_t yc[4];
3334 for (Int_t i = 0; i<4 ; i++) {
3335 xc[i]= xs2x + (-0.090+xc1[i])*var.sfx;
3336 yc[i] = ys2x + (-0.488+yc1[i])*var.sfy;
3337 };
3338 ftof31xb[j] = new TPolyLine(4,xc,yc);
3339 ftof31xb[j]->SetLineColor(1);
3340 if ( var.bw ){
3341 colo = -1;
3342 } else {
3343 colo = 1;
3344 };
3345 ColorMIP(ms31b[j],colo);
3346 //
3347 if ( colo != 10 ) ocolo = colo;
3348 if ( mt31[1][j] == 4095. ) colo = noadc;
3349 //
3350 ftof31xb[j]->SetFillColor(colo);
3351 ftof31xb[j]->SetLineWidth(1);
3352 ftof31xb[j]->Draw("f");
3353 ftof31xb[j]->Draw();
3354 };
3355 //
3356 // S31 Y-view
3357 //
3358 if ( true ){
3359 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
3360 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
3361 Float_t nxc[5];
3362 Float_t nyc[5];
3363 for (Int_t i = 0; i<5 ; i++) {
3364 nxc[i]= xs2y + nxc1[i]*var.sfx;
3365 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
3366 };
3367 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
3368 ftof31y->SetLineColor(1);
3369 ftof31y->SetFillColor(ocolo);
3370 ftof31y->SetLineWidth(1);
3371 ftof31y->Draw("f");
3372 ftof31y->Draw();
3373 };
3374 //
3375 // S32 Y-view
3376 //
3377 Float_t s32p = 0.050;
3378 ocolo = 10;
3379 TPolyLine *ftof32ya[3];
3380 for ( Int_t j=0; j<3; j++){
3381 Float_t xc1[4]={ (s32p*j), (s32p*j), s32p*(j+1), (s32p*j)};
3382 Float_t yc1[4]={ -ws13, 0., 0., -ws13};
3383 Float_t xc[4];
3384 Float_t yc[4];
3385 for (Int_t i = 0; i<4 ; i++) {
3386 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
3387 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
3388 };
3389 ftof32ya[j] = new TPolyLine(4,xc,yc);
3390 ftof32ya[j]->SetLineColor(1);
3391 if ( var.bw ){
3392 colo = -1;
3393 } else {
3394 colo = 1;
3395 };
3396 ColorMIP(ms32a[j],colo);
3397 //
3398 if ( colo != 10 ) ocolo = colo;
3399 if ( mt32[0][j] == 4095. ) colo = noadc;
3400 //
3401 ftof32ya[j]->SetFillColor(colo);
3402 ftof32ya[j]->SetLineWidth(1);
3403 ftof32ya[j]->Draw("f");
3404 ftof32ya[j]->Draw();
3405 };
3406 s32p = 0.050;
3407 TPolyLine *ftof32yb[3];
3408 for ( Int_t j=0; j<3; j++){
3409 Float_t xc1[4]={ (s32p*j), s32p*(j+1), s32p*(j+1), (s32p*j)};
3410 Float_t yc1[4]={ -ws13, -ws13, 0., -ws13};
3411 Float_t xc[4];
3412 Float_t yc[4];
3413 for (Int_t i = 0; i<4 ; i++) {
3414 xc[i]= xs2y + (-0.075+xc1[i])*var.sfx;
3415 yc[i] = ys2y + (-0.488+yc1[i])*var.sfy;
3416 };
3417 ftof32yb[j] = new TPolyLine(4,xc,yc);
3418 ftof32yb[j]->SetLineColor(1);
3419 if ( var.bw ){
3420 colo = -1;
3421 } else {
3422 colo = 1;
3423 };
3424 ColorMIP(ms32b[j],colo);
3425 //
3426 if ( colo != 10 ) ocolo = colo;
3427 if ( mt32[1][j] == 4095. ) colo = noadc;
3428 //
3429 ftof32yb[j]->SetFillColor(colo);
3430 ftof32yb[j]->SetLineWidth(1);
3431 ftof32yb[j]->Draw("f");
3432 ftof32yb[j]->Draw();
3433 };
3434 //
3435 // S32 X-view
3436 //
3437 if ( true ){
3438 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
3439 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
3440 Float_t nxc[5];
3441 Float_t nyc[5];
3442 for (Int_t i = 0; i<5 ; i++) {
3443 nxc[i]= xs2x + nxc1[i]*var.sfx;
3444 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
3445 };
3446 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
3447 ftof32x->SetLineColor(1);
3448 ftof32x->SetFillColor(ocolo);
3449 ftof32x->SetLineWidth(1);
3450 ftof32x->Draw("f");
3451 ftof32x->Draw();
3452 };
3453 }
3454
3455 void ShowS4L0(Int_t i, TTree *otr, Variables & var){
3456
3457 pamela::trigger::TriggerEvent *trigger = 0;
3458 otr->SetBranchAddress("Trigger.Event", &trigger);
3459 if ( !var.nosig ) otr->GetEntry(i);
3460
3461 Float_t ms4[3] = {0.,0.,0.};
3462 Int_t S4 = 0;
3463 if ( !var.nosig ) {
3464 S4 = trigger->patterntrig[1];
3465 };
3466 //
3467 for ( Int_t i = 0; i<3; i++ ) {
3468 if ( S4 & (1<<0) ) ms4[i] = 1.;
3469 };
3470 //
3471 Int_t colo;
3472 Float_t xs4x = var.xxvc;
3473 Float_t ys4x = var.yxvc - 0.3250*var.sfy; //25
3474 Float_t xs4y = var.xyvc;
3475 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
3476 Float_t ws4 = 0.010;
3477
3478 //
3479 // Y-view
3480 //
3481 Float_t s4p = 0.1606667;
3482 Int_t ocolo = 0;
3483 TPolyLine *fs4y[3];
3484 for ( Int_t j=0; j<3; j++){
3485 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
3486 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3487 Float_t xc[5];
3488 Float_t yc[5];
3489 for (Int_t i = 0; i<5 ; i++) {
3490 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
3491 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
3492 };
3493 fs4y[j] = new TPolyLine(5,xc,yc);
3494 fs4y[j]->SetLineColor(1);
3495 if ( var.bw ){
3496 colo = -1;
3497 } else {
3498 colo = 1;
3499 };
3500 ColorMIP(ms4[j],colo);
3501 //
3502 if ( colo != 10 ) ocolo = colo;
3503 //
3504 fs4y[j]->SetFillColor(colo);
3505 fs4y[j]->SetLineWidth(1);
3506 fs4y[j]->Draw("f");
3507 fs4y[j]->Draw();
3508 };
3509 //
3510 // X-view
3511 //
3512 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
3513 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3514 Float_t xc[5];
3515 Float_t yc[5];
3516 for (Int_t i = 0; i<5 ; i++) {
3517 xc[i]= xs4x + xc1[i]*var.nds4;
3518 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
3519 };
3520 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
3521 fs4x->SetLineColor(1);
3522 fs4x->SetFillColor(ocolo);
3523 fs4x->SetLineWidth(1);
3524 fs4x->Draw("f");
3525 fs4x->Draw();
3526 }
3527
3528 //**********************************************************************************
3529 // LEVEL1 SUBROUTINES //
3530 //**********************************************************************************
3531
3532 void ShowS4L1(Int_t i, TTree *otr, Variables & var){
3533
3534 pamela::S4::S4Event *s4 = 0;
3535 otr->SetBranchAddress("S4.Event", &s4);
3536 if ( !var.nosig ) otr->GetEntry(i);
3537
3538 Float_t ms4[3] = {0.,0.,0.};
3539 Int_t data = 0;
3540 if ( !var.nosig ) {
3541 data = s4->S4_DATA;
3542 };
3543 //
3544 Float_t calibdata;
3545 if ( !s4->unpackError && data > 31 ){
3546 calibdata = ((Float_t)data - 32.) * 0.5;
3547 } else {
3548 calibdata = 0.;
3549 };
3550 var.s4sig = calibdata;
3551 //
3552 for ( Int_t j = 0; j<3; j++ ) {
3553 ms4[j] = calibdata;
3554 };
3555 Int_t colo;
3556 Float_t xs4x = var.xxvc;
3557 Float_t ys4x = var.yxvc - 0.3250*var.sfy;
3558 Float_t xs4y = var.xyvc;
3559 Float_t ys4y = var.yyvc - 0.3250*var.sfy;
3560 Float_t ws4 = 0.010;
3561 //
3562 // Y-view
3563 //
3564 Float_t s4p = 0.1606667;
3565 Int_t ocolo = 0;
3566 TPolyLine *fs4y[3];
3567 for ( Int_t j=0; j<3; j++){
3568 Float_t xc1[5]={ (s4p*j), s4p*(j+1), s4p*(j+1), (s4p*j), (s4p*j)};
3569 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3570 Float_t xc[5];
3571 Float_t yc[5];
3572 for (Int_t i = 0; i<5 ; i++) {
3573 xc[i]= xs4y + (-0.241+xc1[i])*var.nds4;
3574 yc[i] = ys4y + (yc1[i]-0.03)*var.sfy;
3575 };
3576 fs4y[j] = new TPolyLine(5,xc,yc);
3577 fs4y[j]->SetLineColor(1);
3578 if ( var.bw ){
3579 colo = -1;
3580 } else {
3581 colo = 1;
3582 };
3583 ColorMIP(ms4[j],colo);
3584 //
3585 if ( colo != 10 ) ocolo = colo;
3586 //
3587 fs4y[j]->SetFillColor(colo);
3588 fs4y[j]->SetLineWidth(1);
3589 fs4y[j]->Draw("f");
3590 fs4y[j]->Draw();
3591 };
3592 //
3593 // X-view
3594 //
3595 Float_t xc1[5]={ -0.241, 0.241, 0.241, -0.241, -0.241};
3596 Float_t yc1[5]={ 0., 0., ws4, ws4, 0.};
3597 Float_t xc[5];
3598 Float_t yc[5];
3599 for (Int_t i = 0; i<5 ; i++) {
3600 xc[i]= xs4x + xc1[i]*var.nds4;
3601 yc[i] = ys4x + (yc1[i]-0.03)*var.sfy;
3602 };
3603 TPolyLine *fs4x = new TPolyLine(5,xc,yc);
3604 fs4x->SetLineColor(1);
3605 fs4x->SetFillColor(ocolo);
3606 fs4x->SetLineWidth(1);
3607 fs4x->Draw("f");
3608 fs4x->Draw();
3609 }
3610
3611 void ShowCaloL1(Int_t i, TTree *otr, Variables & var){
3612 //
3613 CalorimeterLevel1 *calo = new CalorimeterLevel1();
3614 otr->SetBranchAddress("CaloLevel1.Event", &calo);
3615 if ( !var.nosig ) otr->GetEntry(i);
3616 //
3617 // Book the histograms:
3618 //
3619 //
3620 stringstream xview;
3621 stringstream yview;
3622 xview.str("");
3623 yview.str("");
3624 xview << "x-view event " << (i+1);
3625 yview << "y-view event " << (i+1);
3626 gDirectory->Delete(xview.str().c_str());
3627 gDirectory->Delete(yview.str().c_str());
3628 TH2F *Xview = new TH2F(xview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3629 TH2F *Yview = new TH2F(yview.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3630 Xview->GetYaxis()->SetLabelColor(10);
3631 Yview->GetYaxis()->SetLabelColor(10);
3632 //
3633 // figures:
3634 //
3635 Int_t bgcolor = 10;
3636 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);
3637 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);
3638
3639 pd1->SetFillStyle(4000);
3640 pd1->SetFillColor(0);
3641 pd1->SetFrameFillStyle(4000);
3642 pd2->SetFillStyle(4000);
3643 pd2->SetFillColor(0);
3644 pd2->SetFrameFillStyle(4000);
3645
3646 TLatex *t=new TLatex();
3647 t->SetTextFont(32);
3648 t->SetTextColor(1);
3649 t->SetTextSize(0.03);
3650 t->SetTextAlign(12);
3651 pd1->Range(0.,0.,1.,1.);
3652 pd2->Range(0.,0.,1.,1.);
3653 pd1->SetTicks();
3654 pd2->SetTicks();
3655 pd1->Draw();
3656 pd2->Draw();
3657
3658 pd1->cd();
3659 gStyle->SetOptStat(0);
3660 Xview->GetYaxis()->SetTitleOffset(0.5);
3661 Xview->SetFillColor(bgcolor);
3662 Xview->Fill(1.,1.,1.);
3663 Xview->Draw("box");
3664 pd1->Update();
3665 pd2->cd();
3666 gStyle->SetOptStat(0);
3667 Yview->GetYaxis()->SetTitleOffset(0.5);
3668 Yview->SetFillColor(bgcolor);
3669 Yview->Fill(1.,1.,1.);
3670 Yview->Draw("box");
3671 pd2->Update();
3672
3673 //
3674 // run over views and planes
3675 //
3676 stringstream xvev;
3677 stringstream yvev;
3678 for (Int_t m = 0; m < 22; m++){
3679 for (Int_t l = 0; l < 2; l++){
3680 for (Int_t n = 0; n < 96; n++){
3681 if ( calo->estrip[l][m][n] > 0.7 ) {
3682 //
3683 // 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)
3684 //
3685 // if ( l == 0 && m == 21 ) printf(" xpos n=%i calo bottom: %f \n",n,(n*2.44-117.12)/10.);
3686 Int_t colo;
3687 if ( var.bw ){
3688 colo = -1;
3689 } else {
3690 colo = 1;
3691 };
3692 ColorMIP(calo->estrip[l][m][n],colo);
3693 if ( l == 0 && !var.nosig ) {
3694 xvev.str("");
3695 xvev << "x-view event " << n;
3696 xvev << " " << m;
3697 xvev << " " << l;
3698 gDirectory->Delete(xvev.str().c_str());
3699 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3700 Xview->SetFillColor(colo);
3701 Xview->Fill(n,21-m,1.);
3702 pd1->cd();
3703 Xview->Draw("box same");
3704 };
3705 if ( l == 1 && !var.nosig ) {
3706 yvev.str("");
3707 yvev << "y-view event " << n;
3708 yvev << " " << m;
3709 yvev << " " << l;
3710 gDirectory->Delete(yvev.str().c_str());
3711 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
3712 Yview->SetFillColor(colo);
3713 Yview->Fill(95-n,21-m,1.);
3714 pd2->cd();
3715 Yview->Draw("box same");
3716 };
3717 };
3718 };
3719 };
3720 };
3721 pd1->Update();
3722 pd2->Update();
3723 var.qtot=(int)calo->qtot;
3724 var.nstrip=(int)calo->nstrip;
3725 }
3726
3727 void ShowTRKL1(Int_t evno, TTree *ttr1, Variables & var, PAMevcontrol *pamgui){
3728 //
3729 Int_t syncro = 1;
3730 Int_t itr = evno;
3731 Int_t trnevents = ttr1->GetEntries();
3732 Int_t nodata = 0;
3733 Int_t pktnum = 0;
3734 Int_t obt = 0;
3735 trkcalosync: struct Tracklev1 trk;
3736 struct CTracklev1 ev2;
3737 settrklev1(ttr1,trk);
3738 if ( itr >= trnevents ){
3739 printf(" WARNING: no more tracker level1 data.\n");
3740 pamgui->DIALOG(1," No more tracker level1 data ");
3741 nodata = 1;
3742 goto goon;
3743 };
3744 if ( !var.nosig ) ttr1->GetEntry(itr);
3745 accesstrklev1(trk,ev2);
3746 pktnum = var.headc;
3747 obt = var.etime;
3748 if ( pktnum != ev2.pkt_num1 || obt != ev2.obt1 ){
3749 if ( pktnum > ev2.pkt_num1 || obt > ev2.obt1 ){
3750 itr++;
3751 if ( syncro ){
3752 printf(" WARNING: lost sync! try to recover... \n");
3753 pamgui->DIALOG(1," Lost sync! try to recover ");
3754 };
3755 syncro = 0;
3756 goto trkcalosync;
3757 };
3758 if ( pktnum < ev2.pkt_num1 || obt < ev2.obt1 ){
3759 printf(" WARNING: no tracker level2 data. \n");
3760 pamgui->DIALOG(1," No more tracker level2 data ");
3761 nodata = 1;
3762 goto goon;
3763 };
3764 };
3765 //
3766 if ( !syncro ) {
3767 printf(" ...synchronization recovered! \n");
3768 pamgui->DIALOG(0," Synchronization recovered! ");
3769 };
3770 syncro = 1;
3771 //
3772 goon: struct Trklev1 ev;
3773 ev.good1 = (Bool_t)ev2.good1;
3774 ev.nev1 = ev2.nev1;
3775 ev.whic_calib1 = ev2.whic_calib1;
3776 ev.swcode1 = ev2.swcode1;
3777 ev.pkt_type1 = ev2.pkt_type1;
3778 ev.pkt_num1 = ev2.pkt_num1;
3779 ev.obt1 = ev2.obt1;
3780 ev.cpu_crc1 = (Bool_t)ev2.cpu_crc1;
3781 ev.nclstr1 = ev2.nclstr1;
3782 ev.totcllength = ev2.totcllength;
3783 for ( Int_t ii = 0 ; ii<8500; ii++){
3784 ev.clsignal[ii] = ev2.clsignal[ii];
3785 };
3786 for ( Int_t ii = 0 ; ii<500 ; ii++){
3787 ev.view[ii] = (Int_t)ev2.view[ii];
3788 ev.ladder[ii] = (Int_t)ev2.ladder[ii];
3789 ev.maxs[ii] = (Int_t)ev2.maxs[ii];
3790 ev.mult[ii] = (Int_t)ev2.mult[ii];
3791 ev.dedx[ii] = (Float_t)ev2.dedx[ii];
3792 ev.indstart[ii] = (Int_t)ev2.indstart[ii];
3793 ev.indmax[ii] = (Int_t)ev2.indmax[ii];
3794 };
3795 for ( Int_t ii = 0 ; ii<12 ; ii++){
3796 ev.crc1[ii] = ev2.crc1[ii];
3797 for ( Int_t ij = 0 ; ij<24 ; ij++){
3798 ev.cnev[ij][ii] = ev2.cnev[ii][ij];
3799 };
3800 };
3801 for ( Int_t ii = 0 ; ii<12 ; ii++){
3802 for ( Int_t ij = 0 ; ij<3072 ; ij++){
3803 ev.sigma_matrix[ij][ii] = var.DSPsig_par[ii][ij];
3804 };
3805 };
3806 //
3807 // find the cluster, position and signal with the external fortran routine. We must pass the common.
3808 //
3809 if ( !nodata ){
3810 projectlev1(ev);
3811 } else {
3812 ev.nclstr1 = 0;
3813 };
3814 //
3815 // a matrix of pads for each view x and y
3816 //
3817 TPad *trkpad[12];
3818 Int_t magcol = 0;
3819 TPad *mag1 = 0;
3820 TPad *mag2 = 0;
3821 for (Int_t n = 0; n<12; n++){
3822 stringstream spd;
3823 spd.str("");
3824 spd << "pd1" << n;
3825 gDirectory->Delete(spd.str().c_str());
3826 spd.str("");
3827 spd << "pd2" << n;
3828 gDirectory->Delete(spd.str().c_str());
3829 spd.str("");
3830 spd << "pd3" << n;
3831 gDirectory->Delete(spd.str().c_str());
3832 spd.str("");
3833 spd << "pd4" << n;
3834 gDirectory->Delete(spd.str().c_str());
3835 spd.str("");
3836 spd << "pd5" << n;
3837 gDirectory->Delete(spd.str().c_str());
3838 spd.str("");
3839 spd << "pd6" << n;
3840 gDirectory->Delete(spd.str().c_str());
3841 stringstream bpd;
3842 bpd.str("");
3843 if ( n%2 ) {
3844 Float_t posx = var.xxvc;
3845 Float_t posy = var.yxvc + (0.29 - 0.089*((n/2.)-1.))*var.sfy;
3846 spd.str("");
3847 spd << "pd1" << n;
3848 bpd.str("");
3849 bpd << "bd1" << n;
3850 trkpad[n] = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-0.081*var.sfx,posy,posx+0.081*var.sfx,posy+0.089*var.sfy,10);
3851 trkpad[n]->SetFillStyle(4000);
3852 trkpad[n]->SetFillColor(0);
3853 trkpad[n]->SetFrameFillStyle(4000);
3854 trkpad[n]->Draw();
3855 if ( n != 1 ) {
3856 if ( var.bw ) {
3857 magcol = 1;
3858 } else {
3859 magcol = 45;
3860 };
3861 spd.str("");
3862 spd << "pd2" << n;
3863 bpd.str("");
3864 bpd << "bd2" << n;
3865 mag1 = new TPad(spd.str().c_str(),bpd.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);
3866 if ( var.bw ) mag1->SetFillStyle(3001);
3867 mag1->Draw();
3868 spd.str("");
3869 spd << "pd3" << n;
3870 bpd.str("");
3871 bpd << "bd3" << n;
3872 mag2 = new TPad(spd.str().c_str(),bpd.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);
3873 if ( var.bw ) mag2->SetFillStyle(3001);
3874 mag2->Draw();
3875 };
3876 } else {
3877 Float_t posx = var.xyvc;
3878 Float_t posy = var.yyvc + (0.29 - 0.089 * (((n+1.)/2.)-1.))*var.sfy;
3879 spd.str("");
3880 spd << "pd4" << n;
3881 bpd.str("");
3882 bpd << "bd4" << n;
3883 trkpad[n] = new TPad(spd.str().c_str(),bpd.str().c_str(),posx-0.07*var.sfx,posy,posx+0.07*var.sfx,posy+0.089*var.sfy,10);
3884 trkpad[n]->SetFillStyle(4000);
3885 trkpad[n]->SetFillColor(0);
3886 trkpad[n]->SetFrameFillStyle(4000);
3887 trkpad[n]->Draw();
3888 if ( n != 0 ) {
3889 if ( var.bw ) {
3890 magcol = 1;
3891 } else {
3892 magcol = 45;
3893 };
3894 spd.str("");
3895 spd << "pd5" << n;
3896 bpd.str("");
3897 bpd << "bd5" << n;
3898 mag1 = new TPad(spd.str().c_str(),bpd.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);
3899 if ( var.bw ) mag1->SetFillStyle(3001);
3900 mag1->Draw();
3901 spd.str("");
3902 spd << "pd6" << n;
3903 bpd.str("");
3904 bpd << "bd6" << n;
3905 mag2 = new TPad(spd.str().c_str(),bpd.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);
3906 if ( var.bw ) mag2->SetFillStyle(3001);
3907 mag2->Draw();
3908 };
3909 };
3910 };
3911 TPad *trplv;
3912 gDirectory->Delete("trkplv");
3913 trplv = new TPad("trkplv","trkplv",var.xcat-0.07*var.sfx,var.ycat-0.081*var.sfy,var.xcat+0.07*var.sfx,var.ycat+0.081*var.sfy,10);
3914 trplv->SetFillStyle(4000);
3915 trplv->SetFillColor(0);
3916 trplv->SetFrameFillStyle(4000);
3917 trplv->Draw();
3918 Int_t sigcol1 = 17;
3919 Int_t sigcol2 = 15;
3920 Int_t linecol = 13;
3921 if ( var.bw ) {
3922 sigcol1 = 17;
3923 sigcol2 = 15;
3924 linecol = 13;
3925 } else {
3926 sigcol1 = 32;
3927 sigcol2 = 38;
3928 linecol = 42;
3929 };
3930 //
3931 TLine *linea = 0;
3932 TLine *linea1x = 0;
3933 TLine *linea2x = 0;
3934 TLine *linea1y = 0;
3935 for (Int_t l = 0; l<12; l++){
3936 trkpad[l]->cd();
3937 if ( l%2 ) {
3938 trkpad[l]->Range(-8.1,0.,8.1,1000.);
3939 linea = new TLine(-8.1,10.,8.1,10.);
3940 linea1x = new TLine(-2.7,10.,-2.7,30.);
3941 linea2x = new TLine(2.7,10.,2.7,30.);
3942 } else {
3943 trkpad[l]->Range(-7.05,0.,7.05,1000.);
3944 linea = new TLine(-7.05,10.,7.05,10.);
3945 linea1y = new TLine(0.,10.,0.,30.);
3946 };
3947 linea->SetLineWidth(2);
3948 linea->SetLineColor(linecol);
3949 linea->Draw();
3950 if ( l%2 ) {
3951 linea1x->SetLineWidth(1);
3952 linea1x->SetLineColor(1);
3953 linea1x->Draw();
3954 linea2x->SetLineWidth(1);
3955 linea2x->SetLineColor(1);
3956 linea2x->Draw();
3957 } else {
3958 linea1y->SetLineWidth(1);
3959 linea1y->SetLineColor(1);
3960 linea1y->Draw();
3961 };
3962 //
3963 };
3964 Int_t planeno = 0;
3965 if ( !var.nosig ){
3966 planeno = 0;
3967 Float_t x = 0.;
3968 Float_t y = 0.;
3969 for (Int_t l = 0; l<ev.nclstr1; l++){
3970 for (Int_t m = 0; m<2; m++){
3971 if ( ev.clz[l][m] != 0. ){
3972 if ( ev.clz[l][m] > 20. ) planeno = 1 - m;
3973 if ( ev.clz[l][m] < 20. && ev.clz[l][m] > 10. ) planeno = 3 - m;
3974 if ( ev.clz[l][m] < 10. && ev.clz[l][m] > 0. ) planeno = 5 - m;
3975 if ( ev.clz[l][m] < 0. && ev.clz[l][m] > -10. ) planeno = 7 - m;
3976 if ( ev.clz[l][m] <-10. && ev.clz[l][m] >-20. ) planeno = 9 - m;
3977 if ( ev.clz[l][m] < -20. ) planeno = 11 - m;
3978 //
3979 if ( (planeno+1)%2 ){
3980 trkpad[planeno]->cd();
3981 trkpad[planeno]->Range(-7.05,0.,7.05,1000.);
3982 if ( ev.cls[l][m] != 0. ){
3983 x = ev.clp[l][1];
3984 y = ev.cls[l][m];
3985 linea = new TLine(x,0.,x,y);
3986 linea->SetLineWidth(3);
3987 linea->SetLineColor(sigcol1);
3988 linea->Draw();
3989 //
3990 x = ev.clp[l][2];
3991 linea = new TLine(x,0.,x,y);
3992 linea->SetLineWidth(3);
3993 linea->SetLineColor(sigcol2);
3994 linea->Draw();
3995 var.ncly++;
3996 };
3997 } else {
3998 trkpad[planeno]->cd();
3999 trkpad[planeno]->Range(-8.1,0.,8.1,1000.);
4000 if ( ev.cls[l][m] != 0. ){
4001 x = ev.clp[l][0];
4002 y = ev.cls[l][m];
4003 linea = new TLine(x,0.,x,y);
4004 linea->SetLineWidth(3);
4005 linea->SetLineColor(sigcol2);
4006 linea->Draw();
4007 var.nclx++;
4008 };
4009 };
4010 };
4011 };
4012 };
4013 };
4014 //
4015 // Show track in the plane view!
4016 //
4017 Float_t xh[6];
4018 Float_t yh1[6];
4019 Float_t yh2[6];
4020 Float_t mag[6];
4021 Float_t xsig[6];
4022 Float_t ysig[6];
4023 Int_t mask[6];
4024 for (Int_t l = 0; l<6; l++ ){
4025 xh[l] = 0.;
4026 yh1[l] = 0.;
4027 yh2[l] = 0.;
4028 mag[l] = 0.;
4029 xsig[l] = 0.;
4030 ysig[l] = 0.;
4031 mask[l] = 0;
4032 };
4033 Int_t ncro = 0;
4034 //
4035 // return;
4036 //
4037 for (Int_t l = 0; l<ev.nclstr1; l++){
4038 for (Int_t m = 0; m<2; m++){
4039 if ( ev.clz[l][m] != 0. ){
4040 if ( ev.clz[l][m] > 20. ) {
4041 planeno = 1 - m;
4042 ncro = 0;
4043 };
4044 if ( ev.clz[l][m] < 20. && ev.clz[l][m] > 10. ) {
4045 planeno = 3 - m;
4046 ncro = 1;
4047 };
4048 if ( ev.clz[l][m] < 10. && ev.clz[l][m] > 0. ) {
4049 planeno = 5 - m;
4050 ncro = 2;
4051 };
4052 if ( ev.clz[l][m] < 0. && ev.clz[l][m] > -10. ) {
4053 planeno = 7 - m;
4054 ncro = 3;
4055 };
4056 if ( ev.clz[l][m] <-10. && ev.clz[l][m] >-20. ) {
4057 planeno = 9 - m;
4058 ncro = 4;
4059 };
4060 if ( ev.clz[l][m] < -20. ) {
4061 planeno = 11 - m;
4062 ncro = 5;
4063 }
4064 //
4065 mag[ncro] = ((float)planeno+1.)/5.;
4066 if ( (planeno+1)%2 ){
4067 if ( ev.cls[l][m] > ysig[ncro] ){
4068 ysig[ncro] = ev.cls[l][m];
4069 yh1[ncro] = ev.clp[l][1];
4070 yh2[ncro] = ev.clp[l][2];
4071 };
4072 } else {
4073 if ( ev.cls[l][m] > xsig[ncro] ){
4074 xsig[ncro] = ev.cls[l][m];
4075 xh[ncro] = ev.clp[l][0];
4076 };
4077 };
4078 if ( ysig[ncro] > 0. && xsig[ncro] > 0. ) {
4079 mask[ncro] = 1;
4080 };
4081 };
4082 };
4083 };
4084 //
4085 // Draw crosses
4086 //
4087 if ( var.AC ) {
4088 trplv->cd();
4089 trplv->Range(-7.05,-8.1,7.05,8.1);
4090 for ( Int_t i = 0; i<6; i++){
4091 if ( mask[i] ){
4092 //
4093 Float_t cdx = (0.55/mag[i])*var.sfx;
4094 Float_t cdy = (0.55/mag[i])*var.sfy;
4095 Float_t lwx = (0.019)*var.sfy;
4096 Float_t lwy = (0.019)*var.sfx;
4097 //
4098 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy);
4099 linea->SetLineWidth((int)lwx);
4100 linea->SetLineColor(sigcol1);
4101 linea->Draw();
4102 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.);
4103 linea->SetLineWidth((int)lwy);
4104 linea->SetLineColor(sigcol1);
4105 linea->Draw();
4106 //
4107 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy);
4108 linea->SetLineWidth((int)lwx);
4109 linea->SetLineColor(sigcol2);
4110 linea->Draw();
4111 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.);
4112 linea->SetLineWidth((int)lwy);
4113 linea->SetLineColor(sigcol2);
4114 linea->Draw();
4115 };
4116 };
4117 };
4118 }
4119
4120 void ShowTOFGENL1(Int_t j, TTree *otr, Variables & var){
4121 //
4122 // the channels MAP:
4123 //
4124 Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
4125 Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
4126 Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
4127 Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
4128
4129 Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
4130 Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
4131 Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
4132 Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
4133
4134 Int_t ch21a[2] = { 0, 0};
4135 Int_t hb21a[2] = { 0, 4};
4136 Int_t ch21b[2] = { 1, 0};
4137 Int_t hb21b[2] = { 8, 6};
4138
4139 Int_t ch22a[2] = { 0, 0};
4140 Int_t hb22a[2] = { 2, 8};
4141 Int_t ch22b[2] = { 1, 0};
4142 Int_t hb22b[2] = { 10, 10};
4143
4144 Int_t ch31a[3] = { 1, 2, 2};
4145 Int_t hb31a[3] = { 6, 8, 10};
4146 Int_t ch31b[3] = { 1, 1, 1};
4147 Int_t hb31b[3] = { 4, 2, 0};
4148
4149 Int_t ch32a[3] = { 2, 2, 3};
4150 Int_t hb32a[3] = { 0, 4, 8};
4151 Int_t ch32b[3] = { 2, 2, 3};
4152 Int_t hb32b[3] = { 2, 6, 10};
4153
4154 //
4155 pamela::tof::TofEvent *tof = 0;
4156 otr->SetBranchAddress("Tof.Event", &tof);
4157 if ( !var.nosig ) otr->GetEntry(j);
4158 //
4159 // ADC values
4160 //
4161 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4162 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
4163 Float_t ms21a[2] = {0.,0.};
4164 Float_t ms22a[2] = {0.,0.};
4165 Float_t ms31a[3] = {0.,0.,0.};
4166 Float_t ms32a[3] = {0.,0.,0.};
4167 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4168 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
4169 Float_t ms21b[2] = {0.,0.};
4170 Float_t ms22b[2] = {0.,0.};
4171 Float_t ms31b[3] = {0.,0.,0.};
4172 Float_t ms32b[3] = {0.,0.,0.};
4173 //
4174 Float_t xp11[8];
4175 Float_t A11[8] = {-19.,-9.6,-25.7,-13.1,-30.9,-21.1,-11.7,-15.9};
4176 Float_t B11[8] = {-2.6,-2.6,-2.3,-2.4,-2.4,-2.8,-2.75,-2.5};
4177 Float_t E11[8] = {2.6,2.6,2.6,2.6,2.6,2.6,2.6,2.6};
4178 Float_t xp12[6];
4179 Float_t A12[6] = {11.6,16.6,5.9,-22.2,-18.0,-14.2};
4180 Float_t B12[6] = {-2.309,-2.424,-1.958,-2.092,-2.241,-2.144};
4181 Float_t E12[6] = {2.6,2.6,2.6,2.6,2.6,2.6};
4182 Float_t xp21[2];
4183 Float_t A21[2] = {12.5, 21.7};
4184 Float_t B21[2] = {-1.492,-1.519};
4185 Float_t E21[2] = {2.2,2.2};
4186 Float_t xp22[2];
4187 Float_t A22[2] = {-27.0, -45.8};
4188 Float_t B22[2] = {-1.897,-1.477};
4189 Float_t E22[2] = {2.9,2.9};
4190 Float_t xp31[3];
4191 Float_t A31[3] = {-25.1, -41.4, -33.9};
4192 Float_t B31[3] = {-3.374,-3.793,-3.495};
4193 Float_t E31[3] = {1.2,1.2,1.2};
4194 Float_t xp32[3];
4195 Float_t A32[3] = {1.3, 3.9, -22.0};
4196 Float_t B32[3] = {-3.134,-3.526,-3.417};
4197 Float_t E32[3] = {2.3,2.3,2.3};
4198 //
4199 // TDC info for each PMT
4200 //
4201 Float_t mt11[2][8];
4202 Float_t mt12[2][6];
4203 Float_t mt21[2][2];
4204 Float_t mt22[2][2];
4205 Float_t mt31[2][3];
4206 Float_t mt32[2][3];
4207 Int_t noadc = 12;
4208 if ( var.bw ){
4209 noadc = 12;
4210 } else {
4211 noadc = 41;
4212 };
4213 //
4214 Int_t ii = 0;
4215 if ( var.nosig ) goto draw;
4216 for ( Int_t i = 0; i<8; i++ ) {
4217 mt11[0][i] = tof->tdc[ch11a[i]][hb11a[i]];
4218 mt11[1][i] = tof->tdc[ch11b[i]][hb11b[i]];
4219 ms11a[i] = tof->adc[ch11a[i]][hb11a[i]];
4220 ms11b[i] = tof->adc[ch11b[i]][hb11b[i]];
4221 xp11[i] = ( -A11[i] + (mt11[0][i]-mt11[1][i]) / 2. ) / B11[i] ;
4222 if ( ms11a[i] == 4095. ) {
4223 ms11a[i] = 0.;
4224 } else {
4225 ms11a[i] = 1.;
4226 };
4227 if ( ms11b[i] == 4095. ) {
4228 ms11b[i] = 0.;
4229 } else {
4230 ms11b[i] = 1.;
4231 };
4232 };
4233 for ( Int_t i = 0; i<6; i++ ) {
4234 mt12[0][i] = tof->tdc[ch12a[i]][hb12a[i]];
4235 mt12[1][i] = tof->tdc[ch12b[i]][hb12b[i]];
4236 ms12a[i] = tof->adc[ch12a[i]][hb12a[i]];
4237 ms12b[i] = tof->adc[ch12b[i]][hb12b[i]];
4238 xp12[i] = ( -A12[i] + (mt12[0][i]-mt12[1][i]) / 2. ) / B12[i] ;
4239 if ( ms12a[i] == 4095. ){
4240 ms12a[i] = 0.;
4241 } else {
4242 ms12a[i] = 1.;
4243 };
4244 if ( ms12b[i] == 4095. ){
4245 ms12b[i] = 0.;
4246 } else {
4247 ms12b[i] = 1.;
4248 };
4249 };
4250 ii = 2;
4251 for ( Int_t i = 0; i<2; i++ ) {
4252 ii--;
4253 mt21[0][ii] = tof->tdc[ch21a[i]][hb21a[i]];
4254 mt21[1][ii] = tof->tdc[ch21b[i]][hb21b[i]];
4255 ms21a[ii] = tof->adc[ch21a[i]][hb21a[i]];
4256 ms21b[ii] = tof->adc[ch21b[i]][hb21b[i]];
4257 xp21[ii] = ( -A21[ii] + (mt21[0][ii]-mt21[1][ii]) / 2. ) / B21[ii] ;
4258 if ( ms21a[ii] == 4095. ){
4259 ms21a[ii] = 0.;
4260 } else {
4261 ms21a[ii] = 1.;
4262 };
4263 if ( ms21b[ii] == 4095. ){
4264 ms21b[ii] = 0.;
4265 } else {
4266 ms21b[ii] = 1.;
4267 };
4268 };
4269 for ( Int_t i = 0; i<2; i++ ) {
4270 mt22[0][i] = tof->tdc[ch22a[i]][hb22a[i]];
4271 mt22[1][i] = tof->tdc[ch22b[i]][hb22b[i]];
4272 ms22a[i] = tof->adc[ch22a[i]][hb22a[i]];
4273 ms22b[i] = tof->adc[ch22b[i]][hb22b[i]];
4274 xp22[i] = ( -A22[i] + (mt22[0][i]-mt22[1][i]) / 2. ) / B22[i] ;
4275 if ( ms22a[i] == 4095. ){
4276 ms22a[i] = 0.;
4277 } else {
4278 ms22a[i] = 1.;
4279 };
4280 if ( ms22b[i] == 4095. ){
4281 ms22b[i] = 0.;
4282 } else {
4283 ms22b[i] = 1.;
4284 };
4285 };
4286 for ( Int_t i = 0; i<3; i++ ) {
4287 mt31[0][i] = tof->tdc[ch31a[i]][hb31a[i]];
4288 mt31[1][i] = tof->tdc[ch31b[i]][hb31b[i]];
4289 ms31a[i] = tof->adc[ch31a[i]][hb31a[i]];
4290 ms31b[i] = tof->adc[ch31b[i]][hb31b[i]];
4291 xp31[i] = ( -A31[i] + (mt31[0][i]-mt31[1][i]) / 2. ) / B31[i] ;
4292 if ( ms31a[i] == 4095. ){
4293 ms31a[i] = 0.;
4294 } else {
4295 ms31a[i] = 1.;
4296 };
4297 if ( ms31b[i] == 4095. ){
4298 ms31b[i] = 0.;
4299 } else {
4300 ms31b[i] = 1.;
4301 };
4302 };
4303 for ( Int_t i = 0; i<3; i++ ) {
4304 mt32[0][i] = tof->tdc[ch32a[i]][hb32a[i]];
4305 mt32[1][i] = tof->tdc[ch32b[i]][hb32b[i]];
4306 ms32a[i] = tof->adc[ch32a[i]][hb32a[i]];
4307 ms32b[i] = tof->adc[ch32b[i]][hb32b[i]];
4308 xp32[i] = ( -A32[i] + (mt32[0][i]-mt32[1][i]) / 2. ) / B32[i] ;
4309 if ( ms32a[i] == 4095. ){
4310 ms32a[i] = 0.;
4311 } else {
4312 ms32a[i] = 1.;
4313 };
4314 if ( ms32b[i] == 4095. ){
4315 ms32b[i] = 0.;
4316 } else {
4317 ms32b[i] = 1.;
4318 };
4319 };
4320 //
4321 draw: Int_t colo = 0;
4322 Int_t ocolo = 0;
4323 Float_t xs2x = var.xxvc;
4324 Float_t ys2x = var.yxvc + 0.36*var.sfy;
4325 Float_t xs2y = var.xyvc;
4326 Float_t ys2y = var.yyvc + 0.36*var.sfy;
4327 Float_t ws2 = 0.005;
4328 Float_t ws13 = 0.007;
4329 //
4330 // S11 X-view
4331 //
4332 Float_t s11p = 0.051;
4333 ocolo = 10;
4334 TPolyLine *ftof11x[8];
4335 for ( Int_t j=0; j<8; j++){
4336 Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
4337 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4338 Float_t nxc[5];
4339 Float_t nyc[5];
4340 for (Int_t i = 0; i<5 ; i++) {
4341 nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
4342 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4343 };
4344 ftof11x[j] = new TPolyLine(5,nxc,nyc);
4345 ftof11x[j]->SetLineColor(1);
4346 if ( var.bw ){
4347 colo = -1;
4348 } else {
4349 colo = 1;
4350 };
4351 ColorMIP(ms11a[j]+ms11b[j],colo);
4352 //
4353 if ( colo != 10 ) ocolo = colo;
4354 //
4355 ftof11x[j]->SetFillColor(colo);
4356 ftof11x[j]->SetLineWidth(1);
4357 ftof11x[j]->Draw("f");
4358 ftof11x[j]->Draw();
4359 };
4360 //
4361 // S11 Y-view
4362 //
4363 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
4364 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
4365 Float_t nxc[5];
4366 Float_t nyc[5];
4367 for (Int_t i = 0; i<5 ; i++) {
4368 nxc[i]= xs2y + nxc1[i]*var.sfx;
4369 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4370 };
4371 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
4372 ftof11y->SetFillStyle(4000);
4373 ftof11y->SetFillColor(0);
4374 ftof11y->SetLineColor(1);
4375 ftof11y->SetLineWidth(1);
4376 ftof11y->Draw("f");
4377 ftof11y->Draw();
4378 TPolyLine *sftof11[8];
4379 for ( Int_t j=0; j<8; j++){
4380 if ( (mt11[0][j]<4095. || mt11[1][j]<4095.) && !var.nosig ){
4381 if ( ocolo == 10 ) ocolo = noadc;
4382 Float_t lowp = (xp11[j]-E11[j])/100.;
4383 Float_t higp = (xp11[j]+E11[j])/100.;
4384 if ( lowp < -0.164 ) lowp = -0.164;
4385 if ( higp > 0.164 ) higp = 0.164;
4386 if ( lowp < higp ){
4387 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4388 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
4389 Float_t nxc[5];
4390 Float_t nyc[5];
4391 for (Int_t i = 0; i<5 ; i++) {
4392 nxc[i]= xs2y + nxc1[i]*var.sfx;
4393 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4394 };
4395 sftof11[j] = new TPolyLine(5,nxc,nyc);
4396 sftof11[j]->SetLineColor(ocolo);
4397 sftof11[j]->SetFillColor(ocolo);
4398 sftof11[j]->SetLineWidth(1);
4399 sftof11[j]->Draw("f");
4400 sftof11[j]->Draw();
4401 };
4402 };
4403 };
4404
4405 //
4406 // S12 Y-view
4407 //
4408 Float_t s12p = 0.055;
4409 ocolo = 10;
4410 TPolyLine *ftof12y[6];
4411 for ( Int_t j=0; j<6; j++){
4412 Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
4413 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
4414 Float_t nxc[5];
4415 Float_t nyc[5];
4416 for (Int_t i = 0; i<5 ; i++) {
4417 nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
4418 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
4419 };
4420 ftof12y[j] = new TPolyLine(5,nxc,nyc);
4421 ftof12y[j]->SetLineColor(1);
4422 if ( var.bw ){
4423 colo = -1;
4424 } else {
4425 colo = 1;
4426 };
4427 ColorMIP(ms12a[j]+ms12b[j],colo);
4428 //
4429 if ( colo != 10 ) ocolo = colo;
4430 //
4431 ftof12y[j]->SetFillColor(colo);
4432 ftof12y[j]->SetLineWidth(1);
4433 ftof12y[j]->Draw("f");
4434 ftof12y[j]->Draw();
4435 };
4436 //
4437 // S12 X-view
4438 //
4439 if ( true ){
4440 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
4441 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
4442 Float_t nxc[5];
4443 Float_t nyc[5];
4444 for (Int_t i = 0; i<5 ; i++) {
4445 nxc[i]= xs2x + nxc1[i]*var.sfx;
4446 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4447 };
4448 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
4449 ftof12x->SetLineColor(1);
4450 ftof12x->SetFillStyle(4000);
4451 ftof12x->SetFillColor(0);
4452 ftof12x->SetLineWidth(1);
4453 ftof12x->Draw("f");
4454 ftof12x->Draw();
4455 TPolyLine *sftof12[6];
4456 for ( Int_t j=0; j<6; j++){
4457 if ( (mt12[0][j]<4095. || mt12[1][j]<4095.) && !var.nosig ){
4458 if ( ocolo == 10 ) ocolo = noadc;
4459 Float_t lowp = (xp12[j]-E12[j])/100.;
4460 Float_t higp = (xp12[j]+E12[j])/100.;
4461 if ( lowp < -0.203 ) lowp = -0.203;
4462 if ( higp > 0.203 ) higp = 0.203;
4463 if ( lowp < higp ){
4464 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4465 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
4466 Float_t nxc[5];
4467 Float_t nyc[5];
4468 for (Int_t i = 0; i<5 ; i++) {
4469 nxc[i]= xs2x + nxc1[i]*var.sfx;
4470 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4471 };
4472 sftof12[j] = new TPolyLine(5,nxc,nyc);
4473 sftof12[j]->SetLineColor(ocolo);
4474 sftof12[j]->SetFillColor(ocolo);
4475 sftof12[j]->SetLineWidth(1);
4476 sftof12[j]->Draw("f");
4477 sftof12[j]->Draw();
4478 };
4479 };
4480 };
4481 };
4482 //
4483
4484 //
4485 // S21 Y-view
4486 //
4487 Float_t s21p = 0.075;
4488 ocolo = 10;
4489 TPolyLine *ftof21y[2];
4490 for ( Int_t j=0; j<2; j++){
4491 Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
4492 Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
4493 Float_t nxc[5];
4494 Float_t nyc[5];
4495 for (Int_t i = 0; i<5 ; i++) {
4496 nxc[i]= xs2y + nxc1[i]*var.sfx;
4497 nyc[i] = ys2y + nyc1[i]*var.sfy;
4498 };
4499 ftof21y[j] = new TPolyLine(5,nxc,nyc);
4500 ftof21y[j]->SetLineColor(1);
4501 if ( var.bw ){
4502 colo = -1;
4503 } else {
4504 colo = 1;
4505 };
4506 ColorMIP(ms21a[j]+ms21b[j],colo);
4507 //
4508 if ( colo != 10 ) ocolo = colo;
4509 //
4510 ftof21y[j]->SetFillColor(colo);
4511 ftof21y[j]->SetLineWidth(1);
4512 ftof21y[j]->Draw("f");
4513 ftof21y[j]->Draw();
4514 };
4515 //
4516 // S21 X-view
4517 //
4518 if ( true ){
4519 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
4520 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
4521 Float_t nxc[5];
4522 Float_t nyc[5];
4523 for (Int_t i = 0; i<5 ; i++) {
4524 nxc[i]= xs2x + nxc1[i]*var.sfx;
4525 nyc[i] = ys2x + nyc1[i]*var.sfy;
4526 };
4527 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
4528 ftof21x->SetLineColor(1);
4529 ftof21x->SetFillStyle(4000);
4530 ftof21x->SetFillColor(0);
4531 ftof21x->SetLineWidth(1);
4532 ftof21x->Draw("f");
4533 ftof21x->Draw();
4534 TPolyLine *sftof21[2];
4535 for ( Int_t j=0; j<2; j++){
4536 if ( (mt21[0][j]<4095. || mt21[1][j]<4095.) && !var.nosig ){
4537 if ( ocolo == 10 ) ocolo = noadc;
4538 Float_t lowp = (xp21[j]-E21[j])/100.;
4539 Float_t higp = (xp21[j]+E21[j])/100.;
4540 if ( lowp < -0.089 ) lowp = -0.089;
4541 if ( higp > 0.089 ) higp = 0.089;
4542 if ( lowp < higp ){
4543 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4544 Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
4545 Float_t nxc[5];
4546 Float_t nyc[5];
4547 for (Int_t i = 0; i<5 ; i++) {
4548 nxc[i]= xs2x + nxc1[i]*var.sfx;
4549 nyc[i] = ys2x + nyc1[i]*var.sfy;
4550 };
4551 sftof21[j] = new TPolyLine(5,nxc,nyc);
4552 sftof21[j]->SetLineColor(ocolo);
4553 sftof21[j]->SetFillColor(ocolo);
4554 sftof21[j]->SetLineWidth(1);
4555 sftof21[j]->Draw("f");
4556 sftof21[j]->Draw();
4557 };
4558 };
4559 };
4560 };
4561 //
4562
4563 //
4564 // S22 X-view
4565 //
4566 Float_t s22p = 0.090;
4567 ocolo = 10;
4568 TPolyLine *ftof22x[2];
4569 for ( Int_t j=0; j<2; j++){
4570 Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
4571 Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
4572 Float_t nxc[5];
4573 Float_t nyc[5];
4574 for (Int_t i = 0; i<5 ; i++) {
4575 nxc[i]= xs2x + nxc1[i]*var.sfx;
4576 nyc[i] = ys2x + nyc1[i]*var.sfy;
4577 };
4578 ftof22x[j] = new TPolyLine(5,nxc,nyc);
4579 ftof22x[j]->SetLineColor(1);
4580 if ( var.bw ){
4581 colo = -1;
4582 } else {
4583 colo = 1;
4584 };
4585 ColorMIP(ms22a[j]+ms22b[j],colo);
4586 //
4587 if ( colo != 10 ) ocolo = colo;
4588 //
4589 ftof22x[j]->SetFillColor(colo);
4590 ftof22x[j]->SetLineWidth(1);
4591 ftof22x[j]->Draw("f");
4592 ftof22x[j]->Draw();
4593 };
4594 //
4595 // S22 Y-view
4596 //
4597 if ( true ){
4598 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4599 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
4600 Float_t nxc[5];
4601 Float_t nyc[5];
4602 for (Int_t i = 0; i<5 ; i++) {
4603 nxc[i]= xs2y + nxc1[i]*var.sfx;
4604 nyc[i] = ys2y + nyc1[i]*var.sfy;
4605 };
4606 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
4607 ftof22y->SetLineColor(1);
4608 ftof22y->SetFillStyle(4000);
4609 ftof22y->SetFillColor(0);
4610 ftof22y->SetLineWidth(1);
4611 ftof22y->Draw("f");
4612 ftof22y->Draw();
4613 TPolyLine *sftof22[2];
4614 for ( Int_t j=0; j<2; j++){
4615 if ( (mt22[0][j]<4095. || mt22[1][j]<4095.) && !var.nosig ){
4616 if ( ocolo == 10 ) ocolo = noadc;
4617 Float_t lowp = (xp22[j]-E22[j])/100.;
4618 Float_t higp = (xp22[j]+E22[j])/100.;
4619 if ( lowp < -0.074 ) lowp = -0.074;
4620 if ( higp > 0.074 ) higp = 0.074;
4621 if ( lowp < higp ){
4622 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4623 Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
4624 Float_t nxc[5];
4625 Float_t nyc[5];
4626 for (Int_t i = 0; i<5 ; i++) {
4627 nxc[i]= xs2y + nxc1[i]*var.sfx;
4628 nyc[i] = ys2y + nyc1[i]*var.sfy;
4629 };
4630 sftof22[j] = new TPolyLine(5,nxc,nyc);
4631 sftof22[j]->SetLineColor(ocolo);
4632 sftof22[j]->SetFillColor(ocolo);
4633 sftof22[j]->SetLineWidth(1);
4634 sftof22[j]->Draw("f");
4635 sftof22[j]->Draw();
4636 };
4637 };
4638 };
4639 };
4640 //
4641
4642 //
4643 // S31 X-view
4644 //
4645 Float_t s31p = 0.060;
4646 ocolo = 10;
4647 TPolyLine *ftof31x[3];
4648 for ( Int_t j=0; j<3; j++){
4649 Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
4650 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4651 Float_t nxc[5];
4652 Float_t nyc[5];
4653 for (Int_t i = 0; i<5 ; i++) {
4654 nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
4655 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4656 };
4657 ftof31x[j] = new TPolyLine(5,nxc,nyc);
4658 ftof31x[j]->SetLineColor(1);
4659 if ( var.bw ){
4660 colo = -1;
4661 } else {
4662 colo = 1;
4663 };
4664 ColorMIP(ms31a[j]+ms31b[j],colo);
4665 //
4666 if ( colo != 10 ) ocolo = colo;
4667 //
4668 ftof31x[j]->SetFillColor(colo);
4669 ftof31x[j]->SetLineWidth(1);
4670 ftof31x[j]->Draw("f");
4671 ftof31x[j]->Draw();
4672 };
4673 //
4674 // S31 Y-view
4675 //
4676 if ( true ){
4677 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
4678 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
4679 Float_t nxc[5];
4680 Float_t nyc[5];
4681 for (Int_t i = 0; i<5 ; i++) {
4682 nxc[i]= xs2y + nxc1[i]*var.sfx;
4683 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4684 };
4685 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
4686 ftof31y->SetLineColor(1);
4687 ftof31y->SetFillStyle(4000);
4688 ftof31y->SetFillColor(0);
4689 ftof31y->SetLineWidth(1);
4690 ftof31y->Draw("f");
4691 ftof31y->Draw();
4692 TPolyLine *sftof31[3];
4693 for ( Int_t j=0; j<3; j++){
4694 if ( (mt31[0][j]<4095. || mt31[1][j]<4095.) && !var.nosig){
4695 if ( ocolo == 10 ) ocolo = noadc;
4696 Float_t lowp = (xp31[j]-E31[j])/100.;
4697 Float_t higp = (xp31[j]+E31[j])/100.;
4698 if ( lowp < -0.074 ) lowp = -0.074;
4699 if ( higp > 0.074 ) higp = 0.074;
4700 if ( lowp < higp ){
4701 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4702 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
4703 Float_t nxc[5];
4704 Float_t nyc[5];
4705 for (Int_t i = 0; i<5 ; i++) {
4706 nxc[i]= xs2y + nxc1[i]*var.sfx;
4707 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4708 };
4709 sftof31[j] = new TPolyLine(5,nxc,nyc);
4710 sftof31[j]->SetLineColor(ocolo);
4711 sftof31[j]->SetFillColor(ocolo);
4712 sftof31[j]->SetLineWidth(1);
4713 sftof31[j]->Draw("f");
4714 sftof31[j]->Draw();
4715 };
4716 };
4717 };
4718 };
4719 //
4720
4721 //
4722 // S32 Y-view
4723 //
4724 Float_t s32p = 0.050;
4725 ocolo = 10;
4726 TPolyLine *ftof32y[3];
4727 for ( Int_t j=0; j<3; j++){
4728 Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
4729 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
4730 Float_t nxc[5];
4731 Float_t nyc[5];
4732 for (Int_t i = 0; i<5 ; i++) {
4733 nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
4734 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
4735 };
4736 ftof32y[j] = new TPolyLine(5,nxc,nyc);
4737 ftof32y[j]->SetLineColor(1);
4738 if ( var.bw ){
4739 colo = -1;
4740 } else {
4741 colo = 1;
4742 };
4743 ColorMIP(ms32a[j]+ms32b[j],colo);
4744 //
4745 if ( colo != 10 ) ocolo = colo;
4746 //
4747 ftof32y[j]->SetFillColor(colo);
4748 ftof32y[j]->SetLineWidth(1);
4749 ftof32y[j]->Draw("f");
4750 ftof32y[j]->Draw();
4751 };
4752 //
4753 // S32 X-view
4754 //
4755 if ( true ){
4756 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
4757 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
4758 Float_t nxc[5];
4759 Float_t nyc[5];
4760 for (Int_t i = 0; i<5 ; i++) {
4761 nxc[i]= xs2x + nxc1[i]*var.sfx;
4762 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4763 };
4764 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
4765 ftof32x->SetLineColor(1);
4766 ftof32x->SetLineWidth(1);
4767 ftof32x->SetFillStyle(4000);
4768 ftof32x->SetFillColor(0);
4769 ftof32x->Draw("f");
4770 ftof32x->Draw();
4771 TPolyLine *sftof32[3];
4772 for ( Int_t j=0; j<3; j++){
4773 if ( (mt32[0][j]<4095. || mt32[1][j]<4095.) && !var.nosig ){
4774 if ( ocolo == 10 ) ocolo = noadc;
4775 Float_t lowp = (xp32[j]-E32[j])/100.;
4776 Float_t higp = (xp32[j]+E32[j])/100.;
4777 if ( lowp < -0.089 ) lowp = -0.089;
4778 if ( higp > 0.089 ) higp = 0.089;
4779 if ( lowp < higp ){
4780 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
4781 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
4782 Float_t nxc[5];
4783 Float_t nyc[5];
4784 for (Int_t i = 0; i<5 ; i++) {
4785 nxc[i]= xs2x + nxc1[i]*var.sfx;
4786 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
4787 };
4788 sftof32[j] = new TPolyLine(5,nxc,nyc);
4789 sftof32[j]->SetLineColor(ocolo);
4790 sftof32[j]->SetFillColor(ocolo);
4791 sftof32[j]->SetLineWidth(1);
4792 sftof32[j]->Draw("f");
4793 sftof32[j]->Draw();
4794 };
4795 };
4796 };
4797 };
4798 //
4799 }
4800
4801 void ShowTOFL1(Int_t j, TTree *toftr, Variables & var, PAMevcontrol *pamgui){
4802 //
4803 for (Int_t i=0 ; i<5; i++){
4804 var.beta[i] = 0.;
4805 };
4806 //
4807 struct Toflev1 ntof;
4808 settoflev1(toftr,ntof);
4809 //
4810 Int_t syncro = 1;
4811 Int_t itr = j;
4812 Int_t trnevents = toftr->GetEntries();
4813 Int_t pktnum = 0;
4814 Int_t obt = 0;
4815 trkcalosync: if ( itr >= trnevents ){
4816 printf(" WARNING: no more tof level1 data.\n");
4817 pamgui->DIALOG(1," No more tof level1 data ");
4818 return;
4819 } else {
4820 if ( !var.nosig ) toftr->GetEntry(itr);
4821 };
4822 pktnum = var.headc;
4823 obt = var.etime;
4824 if ( pktnum != ntof.pkt_num || obt != ntof.obt ){
4825 if ( pktnum > ntof.pkt_num || obt > ntof.obt ){
4826 itr++;
4827 if ( syncro ){
4828 printf(" WARNING: lost sync! try to recover... \n");
4829 pamgui->DIALOG(1," Lost sync! try to recover ");
4830 };
4831 syncro = 0;
4832 goto trkcalosync;
4833 };
4834 if ( pktnum < ntof.pkt_num || obt < ntof.obt ){
4835 printf(" WARNING: no tof level1 data. \n");
4836 pamgui->DIALOG(1," No more tof level1 data ");
4837 return;
4838 };
4839 };
4840 //
4841 if ( !syncro ){
4842 printf(" ...synchronization recovered! \n");
4843 pamgui->DIALOG(0," Synchronization recovered! ");
4844 };
4845 syncro = 1;
4846 //
4847 if ( !var.nosig ) {
4848 for (Int_t i=0 ; i<5; i++){
4849 if ( ntof.beta[i] < 100.) var.beta[i] = ntof.beta[i];
4850 };
4851 };
4852 struct CToflev1 tof;
4853 accesstoflev1(ntof,tof);
4854 //
4855 // the channels MAP:
4856 //
4857 Int_t ch11a[8] = { 3, 3, 3, 3, 0, 0, 1, 1};
4858 Int_t hb11a[8] = { 0, 2, 4, 6, 9, 11, 1, 3};
4859 Int_t ch11b[8] = { 1, 1, 1, 1, 0, 0, 0, 0};
4860 Int_t hb11b[8] = { 5, 7, 11, 9, 7, 5, 3, 1};
4861
4862 Int_t ch12a[6] = { 2, 2, 2, 2, 2, 2};
4863 Int_t hb12a[6] = { 1, 3, 5, 7, 9, 11};
4864 Int_t ch12b[6] = { 3, 3, 3, 3, 3, 3};
4865 Int_t hb12b[6] = { 11, 9, 7, 5, 3, 1};
4866
4867 Int_t ch21a[2] = { 0, 0};
4868 Int_t hb21a[2] = { 0, 4};
4869 Int_t ch21b[2] = { 1, 0};
4870 Int_t hb21b[2] = { 8, 6};
4871
4872 Int_t ch22a[2] = { 0, 0};
4873 Int_t hb22a[2] = { 2, 8};
4874 Int_t ch22b[2] = { 1, 0};
4875 Int_t hb22b[2] = { 10, 10};
4876
4877 Int_t ch31a[3] = { 1, 2, 2};
4878 Int_t hb31a[3] = { 6, 8, 10};
4879 Int_t ch31b[3] = { 1, 1, 1};
4880 Int_t hb31b[3] = { 4, 2, 0};
4881
4882 Int_t ch32a[3] = { 2, 2, 3};
4883 Int_t hb32a[3] = { 0, 4, 8};
4884 Int_t ch32b[3] = { 2, 2, 3};
4885 Int_t hb32b[3] = { 2, 6, 10};
4886
4887 //
4888 Float_t E11 = 2.6;
4889 Float_t E12 = 2.6;
4890 Float_t E21 = 2.2;
4891 Float_t E22 = 2.9;
4892 Float_t E31 = 1.2;
4893 Float_t E32 = 2.3;
4894
4895 //
4896 // ADC values
4897 //
4898 Float_t ms11a[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4899 Float_t ms12a[6] = {0.,0.,0.,0.,0.,0.};
4900 Float_t ms21a[2] = {0.,0.};
4901 Float_t ms22a[2] = {0.,0.};
4902 Float_t ms31a[3] = {0.,0.,0.};
4903 Float_t ms32a[3] = {0.,0.,0.};
4904 Float_t ms11b[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
4905 Float_t ms12b[6] = {0.,0.,0.,0.,0.,0.};
4906 Float_t ms21b[2] = {0.,0.};
4907 Float_t ms22b[2] = {0.,0.};
4908 Float_t ms31b[3] = {0.,0.,0.};
4909 Float_t ms32b[3] = {0.,0.,0.};
4910 //
4911 Float_t xp11 = 0.;
4912 Float_t xp12 = 0.;
4913 Float_t xp21 = 0.;
4914 Float_t xp22 = 0.;
4915 Float_t xp31 = 0.;
4916 Float_t xp32 = 0.;
4917 //
4918 Int_t noadc = 12;
4919 if ( var.bw ){
4920 noadc = 12;
4921 } else {
4922 noadc = 41;
4923 };
4924 //
4925 Int_t ii = 2;
4926 //
4927 if ( var.nosig ) goto draw;
4928 xp11 = tof.ytof[0];
4929 for ( Int_t i = 0; i<8; i++ ) {
4930 if ( tof.adc_c[ch11a[i]][hb11a[i]] < 1000. ){
4931 ms11a[i] = tof.adc_c[ch11a[i]][hb11a[i]]/2.;
4932 };
4933 if ( tof.adc_c[ch11b[i]][hb11b[i]] < 1000. ){
4934 ms11b[i] = tof.adc_c[ch11b[i]][hb11b[i]]/2.;
4935 };
4936 };
4937 xp12 = tof.xtof[0];
4938 for ( Int_t i = 0; i<6; i++ ) {
4939 if ( tof.adc_c[ch12a[i]][hb12a[i]] < 1000. ) ms12a[i] = tof.adc_c[ch12a[i]][hb12a[i]]/2.;
4940 if ( tof.adc_c[ch12b[i]][hb12b[i]] < 1000. ) ms12b[i] = tof.adc_c[ch12b[i]][hb12b[i]]/2.;
4941 };
4942 xp21 = tof.xtof[1];
4943 ii = 2;
4944 for ( Int_t i = 0; i<2; i++ ) {
4945 ii--;
4946 if ( tof.adc_c[ch21a[i]][hb21a[i]] < 1000. ) ms21a[ii] = tof.adc_c[ch21a[i]][hb21a[i]]/2.;
4947 if ( tof.adc_c[ch21b[i]][hb21b[i]] < 1000. ) ms21b[ii] = tof.adc_c[ch21b[i]][hb21b[i]]/2.;
4948 };
4949 xp22 = tof.ytof[1];
4950 for ( Int_t i = 0; i<2; i++ ) {
4951 if ( tof.adc_c[ch22a[i]][hb22a[i]] < 1000. ) ms22a[i] = tof.adc_c[ch22a[i]][hb22a[i]]/2.;
4952 if ( tof.adc_c[ch22b[i]][hb22b[i]] < 1000. ) ms22b[i] = tof.adc_c[ch22b[i]][hb22b[i]]/2.;
4953 };
4954 xp31 = tof.ytof[2];
4955 for ( Int_t i = 0; i<3; i++ ) {
4956 if ( tof.adc_c[ch31a[i]][hb31a[i]] < 1000. ) ms31a[i] = tof.adc_c[ch31a[i]][hb31a[i]]/2.;
4957 if ( tof.adc_c[ch31b[i]][hb31b[i]] < 1000. ) ms31b[i] = tof.adc_c[ch31b[i]][hb31b[i]]/2.;
4958 };
4959 xp32 = tof.xtof[2];
4960 for ( Int_t i = 0; i<3; i++ ) {
4961 if ( tof.adc_c[ch32a[i]][hb32a[i]] < 1000. ) ms32a[i] = tof.adc_c[ch32a[i]][hb32a[i]]/2.;
4962 if ( tof.adc_c[ch32b[i]][hb32b[i]] < 1000. ) ms32b[i] = tof.adc_c[ch32b[i]][hb32b[i]]/2.;
4963 };
4964 //
4965 draw:
4966 //
4967 Int_t colo;
4968 Int_t ocolo;
4969 Float_t xs2x = var.xxvc;
4970 Float_t ys2x = var.yxvc + 0.36*var.sfy;
4971 Float_t xs2y = var.xyvc;
4972 Float_t ys2y = var.yyvc + 0.36*var.sfy;
4973 Float_t ws2 = 0.005;
4974 Float_t ws13 = 0.007;
4975 //
4976 // S11 X-view
4977 //
4978 Float_t s11p = 0.051;
4979 ocolo = 10;
4980 TPolyLine *ftof11x[8];
4981 for ( Int_t j=0; j<8; j++){
4982 Float_t nxc1[5]={ (s11p*j), (s11p*j), s11p*(j+1), s11p*(j+1), (s11p*j)};
4983 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
4984 Float_t nxc[5];
4985 Float_t nyc[5];
4986 for (Int_t i = 0; i<5 ; i++) {
4987 nxc[i]= xs2x + (-0.204+nxc1[i])*var.sfx;
4988 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
4989 };
4990 ftof11x[j] = new TPolyLine(5,nxc,nyc);
4991 ftof11x[j]->SetLineColor(1);
4992 if ( var.bw ){
4993 colo = -1;
4994 } else {
4995 colo = 1;
4996 };
4997 ColorTOFMIP(ms11a[j]+ms11b[j],colo);
4998 //
4999 if ( colo != 10 ) ocolo = colo;
5000 //
5001 ftof11x[j]->SetFillColor(colo);
5002 ftof11x[j]->SetLineWidth(1);
5003 ftof11x[j]->Draw("f");
5004 ftof11x[j]->Draw();
5005 };
5006 //
5007 // S11 Y-view
5008 //
5009 if ( true ){
5010 Float_t nxc1[5]={ -0.165, 0.165, 0.165, -0.165, -0.165};
5011 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
5012 Float_t nxc[5];
5013 Float_t nyc[5];
5014 for (Int_t i = 0; i<5 ; i++) {
5015 nxc[i]= xs2y + nxc1[i]*var.sfx;
5016 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
5017 };
5018 TPolyLine *ftof11y = new TPolyLine(5,nxc,nyc);
5019 ftof11y->SetFillStyle(4000);
5020 ftof11y->SetFillColor(0);
5021 ftof11y->SetLineColor(1);
5022 ftof11y->SetLineWidth(1);
5023 ftof11y->Draw("f");
5024 ftof11y->Draw();
5025 TPolyLine *sftof11;
5026 if ( !var.nosig ){
5027 if ( ocolo == 10 ) ocolo = noadc;
5028 Float_t lowp = (xp11-E11)/100.;
5029 Float_t higp = (xp11+E11)/100.;
5030 if ( lowp < -0.164 ) lowp = -0.164;
5031 if ( higp > 0.164 ) higp = 0.164;
5032 if ( lowp < higp ){
5033 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5034 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
5035 Float_t nxc[5];
5036 Float_t nyc[5];
5037 for (Int_t i = 0; i<5 ; i++) {
5038 nxc[i]= xs2y + nxc1[i]*var.sfx;
5039 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
5040 };
5041 sftof11 = new TPolyLine(5,nxc,nyc);
5042 sftof11->SetLineColor(ocolo);
5043 sftof11->SetFillColor(ocolo);
5044 sftof11->SetLineWidth(1);
5045 sftof11->Draw("f");
5046 sftof11->Draw();
5047 };
5048 };
5049 };
5050
5051 //
5052 // S12 Y-view
5053 //
5054 Float_t s12p = 0.055;
5055 ocolo = 10;
5056 TPolyLine *ftof12y[6];
5057 for ( Int_t j=0; j<6; j++){
5058 Float_t nxc1[5]={ (s12p*j), (s12p*j), s12p*(j+1), s12p*(j+1), (s12p*j)};
5059 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
5060 Float_t nxc[5];
5061 Float_t nyc[5];
5062 for (Int_t i = 0; i<5 ; i++) {
5063 nxc[i]= xs2y + (-0.165+nxc1[i])*var.sfx;
5064 nyc[i] = ys2y + (0.295+nyc1[i])*var.sfy;
5065 };
5066 ftof12y[j] = new TPolyLine(5,nxc,nyc);
5067 ftof12y[j]->SetLineColor(1);
5068 if ( var.bw ){
5069 colo = -1;
5070 } else {
5071 colo = 1;
5072 };
5073 ColorTOFMIP(ms12a[j]+ms12b[j],colo);
5074 //
5075 if ( colo != 10 ) ocolo = colo;
5076 //
5077 ftof12y[j]->SetFillColor(colo);
5078 ftof12y[j]->SetLineWidth(1);
5079 ftof12y[j]->Draw("f");
5080 ftof12y[j]->Draw();
5081 };
5082 //
5083 // S12 X-view
5084 //
5085 if ( true ){
5086 Float_t nxc1[5]={ -0.204, 0.204, 0.204, -0.204, -0.204};
5087 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
5088 Float_t nxc[5];
5089 Float_t nyc[5];
5090 for (Int_t i = 0; i<5 ; i++) {
5091 nxc[i]= xs2x + nxc1[i]*var.sfx;
5092 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
5093 };
5094 TPolyLine *ftof12x = new TPolyLine(5,nxc,nyc);
5095 ftof12x->SetLineColor(1);
5096 ftof12x->SetFillStyle(4000);
5097 ftof12x->SetFillColor(0);
5098 ftof12x->SetLineWidth(1);
5099 ftof12x->Draw("f");
5100 ftof12x->Draw();
5101 TPolyLine *sftof12;
5102 if ( !var.nosig ){
5103 if ( ocolo == 10 ) ocolo = noadc;
5104 Float_t lowp = (xp12-E12)/100.;
5105 Float_t higp = (xp12+E12)/100.;
5106 if ( lowp < -0.203 ) lowp = -0.203;
5107 if ( higp > 0.203 ) higp = 0.203;
5108 if ( lowp < higp ){
5109 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5110 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
5111 Float_t nxc[5];
5112 Float_t nyc[5];
5113 for (Int_t i = 0; i<5 ; i++) {
5114 nxc[i]= xs2x + nxc1[i]*var.sfx;
5115 nyc[i] = ys2x + (0.295+nyc1[i])*var.sfy;
5116 };
5117 sftof12 = new TPolyLine(5,nxc,nyc);
5118 sftof12->SetLineColor(ocolo);
5119 sftof12->SetFillColor(ocolo);
5120 sftof12->SetLineWidth(1);
5121 sftof12->Draw("f");
5122 sftof12->Draw();
5123 };
5124 };
5125 };
5126 //
5127
5128 //
5129 // S21 Y-view
5130 //
5131 Float_t s21p = 0.075;
5132 ocolo = 10;
5133 TPolyLine *ftof21y[2];
5134 for ( Int_t j=0; j<2; j++){
5135 Float_t nxc1[5]={ s21p*(j-1), s21p*(j-1), s21p*j,s21p*j, s21p*(j-1)};
5136 Float_t nyc1[5]={ 0., ws2, ws2, 0., 0.};
5137 Float_t nxc[5];
5138 Float_t nyc[5];
5139 for (Int_t i = 0; i<5 ; i++) {
5140 nxc[i]= xs2y + nxc1[i]*var.sfx;
5141 nyc[i] = ys2y + nyc1[i]*var.sfy;
5142 };
5143 ftof21y[j] = new TPolyLine(5,nxc,nyc);
5144 ftof21y[j]->SetLineColor(1);
5145 if ( var.bw ){
5146 colo = -1;
5147 } else {
5148 colo = 1;
5149 };
5150 ColorTOFMIP(ms21a[j]+ms21b[j],colo);
5151 //
5152 if ( colo != 10 ) ocolo = colo;
5153 //
5154 ftof21y[j]->SetFillColor(colo);
5155 ftof21y[j]->SetLineWidth(1);
5156 ftof21y[j]->Draw("f");
5157 ftof21y[j]->Draw();
5158 };
5159 //
5160 // S21 X-view
5161 //
5162 if ( true ){
5163 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
5164 Float_t nyc1[5]={ 0., 0., ws2, ws2, 0.};
5165 Float_t nxc[5];
5166 Float_t nyc[5];
5167 for (Int_t i = 0; i<5 ; i++) {
5168 nxc[i]= xs2x + nxc1[i]*var.sfx;
5169 nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
5170 };
5171 TPolyLine *ftof21x = new TPolyLine(5,nxc,nyc);
5172 ftof21x->SetLineColor(1);
5173 ftof21x->SetFillStyle(4000);
5174 ftof21x->SetFillColor(0);
5175 ftof21x->SetLineWidth(1);
5176 ftof21x->Draw("f");
5177 ftof21x->Draw();
5178 TPolyLine *sftof21;
5179 if ( !var.nosig ){
5180 if ( ocolo == 10 ) ocolo = noadc;
5181 Float_t lowp = (xp21-E21)/100.;
5182 Float_t higp = (xp21+E21)/100.;
5183 if ( lowp < -0.089 ) lowp = -0.089;
5184 if ( higp > 0.089 ) higp = 0.089;
5185 if ( lowp < higp ){
5186 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5187 Float_t nyc1[5]={ 0.0015, 0.0015, ws2-0.0015, ws2-0.0015, 0.};
5188 Float_t nxc[5];
5189 Float_t nyc[5];
5190 for (Int_t i = 0; i<5 ; i++) {
5191 nxc[i]= xs2x + nxc1[i]*var.sfx;
5192 nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
5193 };
5194 sftof21 = new TPolyLine(5,nxc,nyc);
5195 sftof21->SetLineColor(ocolo);
5196 sftof21->SetFillColor(ocolo);
5197 sftof21->SetLineWidth(1);
5198 sftof21->Draw("f");
5199 sftof21->Draw();
5200 };
5201 };
5202 };
5203 //
5204
5205 //
5206 // S22 X-view
5207 //
5208 Float_t s22p = 0.090;
5209 ocolo = 10;
5210 TPolyLine *ftof22x[2];
5211 for ( Int_t j=0; j<2; j++){
5212 Float_t nxc1[5]={ s22p*(j-1), s22p*(j-1), s22p*j, s22p*j, s22p*(j-1)};
5213 Float_t nyc1[5]={ -ws2, 0., 0., -ws2, -ws2};
5214 Float_t nxc[5];
5215 Float_t nyc[5];
5216 for (Int_t i = 0; i<5 ; i++) {
5217 nxc[i]= xs2x + nxc1[i]*var.sfx;
5218 nyc[i] = ys2x + (0.0+nyc1[i])*var.sfy;
5219 };
5220 ftof22x[j] = new TPolyLine(5,nxc,nyc);
5221 ftof22x[j]->SetLineColor(1);
5222 if ( var.bw ){
5223 colo = -1;
5224 } else {
5225 colo = 1;
5226 };
5227 ColorTOFMIP(ms22a[j]+ms22b[j],colo);
5228 //
5229 if ( colo != 10 ) ocolo = colo;
5230 //
5231 ftof22x[j]->SetFillColor(colo);
5232 ftof22x[j]->SetLineWidth(1);
5233 ftof22x[j]->Draw("f");
5234 ftof22x[j]->Draw();
5235 };
5236 //
5237 // S22 Y-view
5238 //
5239 if ( true ){
5240 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
5241 Float_t nyc1[5]={ 0., 0., -ws2, -ws2, 0.};
5242 Float_t nxc[5];
5243 Float_t nyc[5];
5244 for (Int_t i = 0; i<5 ; i++) {
5245 nxc[i]= xs2y + nxc1[i]*var.sfx;
5246 nyc[i] = ys2y + (0.0+nyc1[i])*var.sfy;
5247 };
5248 TPolyLine *ftof22y = new TPolyLine(5,nxc,nyc);
5249 ftof22y->SetLineColor(1);
5250 ftof22y->SetFillStyle(4000);
5251 ftof22y->SetFillColor(0);
5252 ftof22y->SetLineWidth(1);
5253 ftof22y->Draw("f");
5254 ftof22y->Draw();
5255 TPolyLine *sftof22;
5256 if ( !var.nosig ){
5257 if ( ocolo == 10 ) ocolo = noadc;
5258 Float_t lowp = (xp22-E22)/100.;
5259 Float_t higp = (xp22+E22)/100.;
5260 if ( lowp < -0.074 ) lowp = -0.074;
5261 if ( higp > 0.074 ) higp = 0.074;
5262 if ( lowp < higp ){
5263 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5264 Float_t nyc1[5]={ -0.0015, -0.0015, -ws2+0.0015, -ws2+0.0015, -0.0015};
5265 Float_t nxc[5];
5266 Float_t nyc[5];
5267 for (Int_t i = 0; i<5 ; i++) {
5268 nxc[i]= xs2y + nxc1[i]*var.sfx;
5269 nyc[i] = ys2y + (0.0+nyc1[i])*var.sfy;
5270 };
5271 sftof22 = new TPolyLine(5,nxc,nyc);
5272 sftof22->SetLineColor(ocolo);
5273 sftof22->SetFillColor(ocolo);
5274 sftof22->SetLineWidth(1);
5275 sftof22->Draw("f");
5276 sftof22->Draw();
5277 };
5278 };
5279 };
5280 //
5281
5282 //
5283 // S31 X-view
5284 //
5285 Float_t s31p = 0.060;
5286 ocolo = 10;
5287 TPolyLine *ftof31x[3];
5288 for ( Int_t j=0; j<3; j++){
5289 Float_t nxc1[5]={ (s31p*j), (s31p*j), s31p*(j+1), s31p*(j+1), (s31p*j)};
5290 Float_t nyc1[5]={ 0., ws13, ws13, 0., 0.};
5291 Float_t nxc[5];
5292 Float_t nyc[5];
5293 for (Int_t i = 0; i<5 ; i++) {
5294 nxc[i]= xs2x + (-0.090+nxc1[i])*var.sfx;
5295 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
5296 };
5297 ftof31x[j] = new TPolyLine(5,nxc,nyc);
5298 ftof31x[j]->SetLineColor(1);
5299 if ( var.bw ){
5300 colo = -1;
5301 } else {
5302 colo = 1;
5303 };
5304 ColorTOFMIP(ms31a[j]+ms31b[j],colo);
5305 //
5306 if ( colo != 10 ) ocolo = colo;
5307 //
5308 ftof31x[j]->SetFillColor(colo);
5309 ftof31x[j]->SetLineWidth(1);
5310 ftof31x[j]->Draw("f");
5311 ftof31x[j]->Draw();
5312 };
5313 //
5314 // S31 Y-view
5315 //
5316 if ( true ){
5317 Float_t nxc1[5]={ -0.075, 0.075, 0.075, -0.075, -0.075};
5318 Float_t nyc1[5]={ 0., 0., ws13, ws13, 0.};
5319 Float_t nxc[5];
5320 Float_t nyc[5];
5321 for (Int_t i = 0; i<5 ; i++) {
5322 nxc[i]= xs2y + nxc1[i]*var.sfx;
5323 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
5324 };
5325 TPolyLine *ftof31y = new TPolyLine(5,nxc,nyc);
5326 ftof31y->SetLineColor(1);
5327 ftof31y->SetFillStyle(4000);
5328 ftof31y->SetFillColor(0);
5329 ftof31y->SetLineWidth(1);
5330 ftof31y->Draw("f");
5331 ftof31y->Draw();
5332 TPolyLine *sftof31;
5333 if ( !var.nosig ){
5334 if ( ocolo == 10 ) ocolo = noadc;
5335 Float_t lowp = (xp31-E31)/100.;
5336 Float_t higp = (xp31+E31)/100.;
5337 if ( lowp < -0.074 ) lowp = -0.074;
5338 if ( higp > 0.074 ) higp = 0.074;
5339 if ( lowp < higp ){
5340 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5341 Float_t nyc1[5]={ 0.0015, 0.0015, ws13-0.0015, ws13-0.0015, 0.0015};
5342 Float_t nxc[5];
5343 Float_t nyc[5];
5344 for (Int_t i = 0; i<5 ; i++) {
5345 nxc[i]= xs2y + nxc1[i]*var.sfx;
5346 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
5347 };
5348 sftof31 = new TPolyLine(5,nxc,nyc);
5349 sftof31->SetLineColor(ocolo);
5350 sftof31->SetFillColor(ocolo);
5351 sftof31->SetLineWidth(1);
5352 sftof31->Draw("f");
5353 sftof31->Draw();
5354 };
5355 };
5356 };
5357 //
5358
5359 //
5360 // S32 Y-view
5361 //
5362 Float_t s32p = 0.050;
5363 ocolo = 10;
5364 TPolyLine *ftof32y[3];
5365 for ( Int_t j=0; j<3; j++){
5366 Float_t nxc1[5]={ (s32p*j), (s32p*j), s32p*(j+1),s32p*(j+1), (s32p*j)};
5367 Float_t nyc1[5]={ -ws13, 0., 0., -ws13, -ws13};
5368 Float_t nxc[5];
5369 Float_t nyc[5];
5370 for (Int_t i = 0; i<5 ; i++) {
5371 nxc[i]= xs2y + (-0.075+nxc1[i])*var.sfx;
5372 nyc[i] = ys2y + (-0.488+nyc1[i])*var.sfy;
5373 };
5374 ftof32y[j] = new TPolyLine(5,nxc,nyc);
5375 ftof32y[j]->SetLineColor(1);
5376 if ( var.bw ){
5377 colo = -1;
5378 } else {
5379 colo = 1;
5380 };
5381 ColorTOFMIP(ms32a[j]+ms32b[j],colo);
5382 //
5383 if ( colo != 10 ) ocolo = colo;
5384 //
5385 ftof32y[j]->SetFillColor(colo);
5386 ftof32y[j]->SetLineWidth(1);
5387 ftof32y[j]->Draw("f");
5388 ftof32y[j]->Draw();
5389 };
5390 //
5391 // S32 X-view
5392 //
5393 if ( true ){
5394 Float_t nxc1[5]={ -0.09, 0.09, 0.09, -0.09, -0.09};
5395 Float_t nyc1[5]={ 0., 0., -ws13, -ws13, 0.};
5396 Float_t nxc[5];
5397 Float_t nyc[5];
5398 for (Int_t i = 0; i<5 ; i++) {
5399 nxc[i]= xs2x + nxc1[i]*var.sfx;
5400 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
5401 };
5402 TPolyLine *ftof32x = new TPolyLine(5,nxc,nyc);
5403 ftof32x->SetLineColor(1);
5404 ftof32x->SetLineWidth(1);
5405 ftof32x->SetFillStyle(4000);
5406 ftof32x->SetFillColor(0);
5407 ftof32x->Draw("f");
5408 ftof32x->Draw();
5409 TPolyLine *sftof32;
5410 if ( !var.nosig ){
5411 if ( ocolo == 10 ) ocolo = noadc;
5412 Float_t lowp = (xp32-E32)/100.;
5413 Float_t higp = (xp32+E32)/100.;
5414 if ( lowp < -0.089 ) lowp = -0.089;
5415 if ( higp > 0.089 ) higp = 0.089;
5416 if ( lowp < higp ){
5417 Float_t nxc1[5]={ lowp, higp, higp, lowp, lowp};
5418 Float_t nyc1[5]={ -0.0015, -0.0015, -ws13+0.0015, -ws13+0.0015, -0.0015};
5419 Float_t nxc[5];
5420 Float_t nyc[5];
5421 for (Int_t i = 0; i<5 ; i++) {
5422 nxc[i]= xs2x + nxc1[i]*var.sfx;
5423 nyc[i] = ys2x + (-0.488+nyc1[i])*var.sfy;
5424 };
5425 sftof32 = new TPolyLine(5,nxc,nyc);
5426 sftof32->SetLineColor(ocolo);
5427 sftof32->SetFillColor(ocolo);
5428 sftof32->SetLineWidth(1);
5429 sftof32->Draw("f");
5430 sftof32->Draw();
5431 };
5432 };
5433 };
5434 //
5435 }
5436
5437 //**********************************************************************************
5438 // LEVEL2 SUBROUTINES //
5439 //**********************************************************************************
5440
5441 void ShowTRACK(Int_t evno, TTree *ttr, Variables & var, PAMevcontrol *pamgui){
5442 //
5443 var.rig = 0.;
5444 var.chi2 = 0.;
5445 struct Tracklev2 trk;
5446 settrklev2(ttr,trk);
5447 //
5448 Int_t trcol = 10;
5449 Int_t syncro = 1;
5450 Int_t itr = evno;
5451 Int_t trnevents = ttr->GetEntries();
5452 Int_t pktnum = 0;
5453 Int_t obt = 0;
5454 trkcalosync: if ( itr >= trnevents ){
5455 printf(" WARNING: no more tracker level2 data.\n");
5456 pamgui->DIALOG(1," No more tracker level2 data ");
5457 return;
5458 };
5459 if ( !var.nosig ) ttr->GetEntry(itr);
5460 pktnum = var.headc;
5461 obt = var.etime;
5462 if ( pktnum != trk.pkt_num || obt != trk.obt ){
5463 if ( pktnum > trk.pkt_num || obt > trk.obt ){
5464 itr++;
5465 if ( syncro ) {
5466 printf(" WARNING: lost sync! try to recover... \n");
5467 pamgui->DIALOG(1," Lost sync! try to recover ");
5468 };
5469 syncro = 0;
5470 goto trkcalosync;
5471 };
5472 if ( pktnum < trk.pkt_num || obt < trk.obt ){
5473 printf(" WARNING: no tracker level2 data. \n");
5474 pamgui->DIALOG(1," No more tracker level2 data ");
5475 return;
5476 };
5477 };
5478 //
5479 if ( !syncro ){
5480 printf(" ...synchronization recovered! \n");
5481 pamgui->DIALOG(0," Synchronization recovered! ");
5482 };
5483 //
5484 if ( trk.ntrk > 0 ){
5485 Int_t l = 0;
5486 Int_t tobeinc = 0;
5487 while ( l<trk.ntrk ) {
5488 //
5489 Int_t npoint = 100;
5490 Double_t zin[100];
5491 Double_t xout[100];
5492 Double_t yout[100];
5493 Double_t al_p[5];
5494 Int_t ifail = 0;
5495 //
5496 Float_t tx[100];
5497 Float_t ty[100];
5498 Float_t ptx1[50];
5499 Float_t pty1[50];
5500 Float_t ptx2[50];
5501 Float_t pty2[50];
5502 Float_t tx1[15];
5503 Float_t ty1[15];
5504 Float_t tzx[100];
5505 Float_t tzy[100];
5506 Float_t tzx1[15];
5507 Float_t tzy1[15];
5508 //
5509 // if there is track ambiguity in y choose the track with the smaller chi2
5510 //
5511 if ( trk.image[l] != 0 ){
5512 Float_t chiA = trk.chi2[l];
5513 Float_t chiB = trk.chi2[trk.image[l]-1];
5514 if ( chiA > chiB ) {
5515 l = trk.image[l]-1;
5516 tobeinc = 2;
5517 };
5518 tobeinc = 1;
5519 };
5520 for ( Int_t e = 0; e < 100 ; e++) {
5521 xout[e] = 0.;
5522 yout[e] = 0.;
5523 //
5524 tx[e] = 0.;
5525 ty[e] = 0.;
5526 tzx[e] = 0.;
5527 tzy[e] = 0.;
5528 if ( e < 50 ){
5529 ptx1[e] = 0.;
5530 pty1[e] = 0.;
5531 ptx2[e] = 0.;
5532 pty2[e] = 0.;
5533 if ( e < 15 ){
5534 tx1[e] = 0.;
5535 ty1[e] = 0.;
5536 tzx1[e] = 0.;
5537 tzy1[e] = 0.;
5538 };
5539 };
5540 //
5541 if ( e < 5 ) {
5542 al_p[e] = (Double_t)trk.al[l][e];
5543 };
5544 zin[e] = 60. - (124./99.)*(float)e;
5545 };
5546 //
5547 zin[85] = -45.5;
5548 //
5549 ctrack(npoint,zin,xout,yout,al_p,ifail);
5550 //
5551 //
5552 if ( !ifail ){
5553 if ( l == 0 || ( l == 1 && tobeinc ==2 ) ){
5554 if ( trk.al[l][4] != 0. ) {
5555 var.rig = 1./trk.al[l][4];
5556 var.chi2 = trk.chi2[l];
5557 } else {
5558 var.rig = 0.;
5559 var.chi2 = 0.;
5560 };
5561 };
5562 //
5563 for ( Int_t e = 0; e < npoint ; e++) {
5564 tx[e] = ((float)xout[e]/100.)*var.sfx + var.xxvc;
5565 ty[e] = ((float)yout[e]/100.)*var.sfx + var.xyvc;
5566 // printf("tx %i %f \n",e,tx[e]);
5567 //printf("xout %i %f \n",e,xout[e]);
5568 if ( e < 50 ) {
5569 ptx1[e] = ((float)yout[e]/100.)*var.sfx + var.xcat;
5570 pty1[e] = ((float)xout[e]/100.)*var.sfy + var.ycat;
5571 } else {
5572 ptx2[e-50] = ((float)yout[e]/100.)*var.sfx + var.xcat;
5573 pty2[e-50] = ((float)xout[e]/100.)*var.sfy + var.ycat;
5574 };
5575 if ( e > 84 ) {
5576 tx1[e-85] = ((float)xout[e]/100.)*var.nds4 + var.xxvc;
5577 ty1[e-85] = ((float)yout[e]/100.)*var.nds4 + var.xyvc;
5578 tzx1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5579 tzy1[e-85] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5580 };
5581 tzx[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yxvc;
5582 tzy[e] = (0.112)*var.sfy+((float)zin[e]/100.)*var.sfy + var.yyvc;
5583 };
5584 //
5585 // From S1 to CALO
5586 //
5587 if ( var.bw ){
5588 trcol = 17-l;
5589 } else {
5590 trcol = 50-l;
5591 };
5592 TPolyLine *trackx = new TPolyLine(86,tx,tzx);
5593 trackx->SetLineColor(trcol);
5594 trackx->SetLineWidth(1);
5595 trackx->Draw();
5596 TPolyLine *tracky = new TPolyLine(86,ty,tzy);
5597 tracky->SetLineColor(trcol);
5598 tracky->SetLineWidth(1);
5599 tracky->Draw();
5600 //
5601 // ND and S4
5602 //
5603 if ( var.tracknds4 ){
5604 TPolyLine *trackx1 = new TPolyLine(15,tx1,tzx1);
5605 trackx1->SetLineColor(trcol);
5606 trackx1->SetLineWidth(1);
5607 trackx1->Draw();
5608 TPolyLine *tracky1 = new TPolyLine(15,ty1,tzy1);
5609 tracky1->SetLineColor(trcol);
5610 tracky1->SetLineWidth(1);
5611 tracky1->Draw();
5612 };
5613 //
5614 // Plane View
5615 //
5616 if ( var.AC ){
5617 TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1);
5618 trackp1->SetLineColor(trcol);
5619 trackp1->SetLineWidth(1);
5620 trackp1->Draw();
5621 TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2);
5622 trackp2->SetLineColor(trcol);
5623 trackp2->SetLineWidth(1);
5624 trackp2->SetLineStyle(3);
5625 trackp2->Draw();
5626 };
5627 //
5628 // Dots on measured points
5629 //
5630 TEllipse *elli;
5631 Float_t x;
5632 Float_t y;
5633 Float_t z1;
5634 Float_t z2;
5635 Int_t dcol;
5636 if ( var.bw ){
5637 dcol = 12;
5638 } else {
5639 dcol = 2;
5640 };
5641 for (Int_t g = 0; g<6; g++){
5642 if ( trk.xgood[l][g] ) {
5643 x = trk.xm[l][g]*var.sfx/100. + var.xxvc;
5644 z1 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yxvc;
5645 elli = new TEllipse(x,z1,0.004,0.004,0.,-180.);
5646 elli->SetFillStyle(1001);
5647 elli->SetFillColor(dcol);
5648 elli->Draw();
5649 };
5650 if ( trk.ygood[l][g] ) {
5651 y = trk.ym[l][g]*var.sfx/100. + var.xyvc;
5652 z2 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yyvc;
5653 elli = new TEllipse(y,z2,0.004,0.004,0.,-180.);
5654 elli->SetFillStyle(1001);
5655 elli->SetFillColor(dcol);
5656 elli->Draw();
5657 };
5658 };
5659 //
5660 //
5661 } else {
5662 pamgui->DIALOG(1," Failed in determining the track! ");
5663 printf(" WARNING: failed in determining the track! \n");
5664 };
5665 l++;
5666 if ( tobeinc ) {
5667 l++;
5668 tobeinc = 0;
5669 };
5670 };
5671 };
5672 }
5673
5674 //**********************************************************************************
5675 // OTHER SUBROUTINES **
5676 //**********************************************************************************
5677
5678 void ShowCaloL0(TString filename, Int_t i, Calib & calib, Int_t b[4], Float_t mip[2][22][96], TTree *otr, Variables & var){
5679 struct Evento evento;
5680 Int_t tot0 = 0;
5681 Int_t tot1 = 0;
5682 Int_t tot2 = 0;
5683 Int_t nstrip = 0;
5684 Float_t qtot = 0.;
5685 pamela::calorimeter::CalorimeterEvent *de = 0;
5686 otr->SetBranchAddress("Calorimeter.Event", &de);
5687 if ( !var.nosig ) otr->GetEntry(i);
5688 //
5689 // Define variables
5690 //
5691 Int_t etime = var.etime;
5692 Float_t estrip[2][22][96], ener, basel,sdexy[2][22][96],sdexyc[2][22][96];
5693 Int_t badstrip = 0;
5694 qtot = 0.;
5695 nstrip = 0;
5696 //
5697 // Book the histograms:
5698 //
5699 //
5700 stringstream xvev;
5701 stringstream yvev;
5702 xvev.str("");
5703 yvev.str("");
5704 xvev << "x-view event " << (i+1);
5705 yvev << "y-view event " << (i+1);
5706 gDirectory->Delete(xvev.str().c_str());
5707 gDirectory->Delete(yvev.str().c_str());
5708 TH2F *Xview = new TH2F(xvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5709 TH2F *Yview = new TH2F(yvev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5710 Xview->GetYaxis()->SetLabelColor(10);
5711 Yview->GetYaxis()->SetLabelColor(10);
5712 //
5713 // figures:
5714 //
5715 Int_t bgcolor = 10;
5716 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);
5717 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);
5718
5719 pd1->SetFillStyle(4000);
5720 pd1->SetFillColor(0);
5721 pd1->SetFrameFillStyle(4000);
5722 pd2->SetFillStyle(4000);
5723 pd2->SetFillColor(0);
5724 pd2->SetFrameFillStyle(4000);
5725
5726 TLatex *t=new TLatex();
5727 t->SetTextFont(32);
5728 t->SetTextColor(1);
5729 t->SetTextSize(0.03);
5730 t->SetTextAlign(12);
5731 pd1->Range(0.,0.,1.,1.);
5732 pd2->Range(0.,0.,1.,1.);
5733 pd1->SetTicks();
5734 pd2->SetTicks();
5735 pd1->Draw();
5736 pd2->Draw();
5737
5738 pd1->cd();
5739 gStyle->SetOptStat(0);
5740 Xview->GetYaxis()->SetTitleOffset(0.5);
5741 Xview->SetFillColor(bgcolor);
5742 Xview->Fill(1.,1.,1.);
5743 Xview->Draw("box");
5744 pd1->Update();
5745 pd2->cd();
5746 gStyle->SetOptStat(0);
5747 Yview->GetYaxis()->SetTitleOffset(0.5);
5748 Yview->SetFillColor(bgcolor);
5749 Yview->Fill(1.,1.,1.);
5750 Yview->Draw("box");
5751 pd2->Update();
5752 //
5753 // for each event check that the calibration we are using are still within calibration limits, if not call the next calibration
5754 //
5755 for (Int_t s = 0; s < 4; s++){
5756 if ( calib.ttime[s][b[s]+1] && calib.time[s][b[s]] ){
5757 while ( etime > calib.time[s][b[s]] && calib.time[s][b[s]] != 0 ){
5758 printf(" CALORIMETER: \n" );
5759 printf(" - Section %i, event at time %i while old calibration time limit at %i. Use new calibration at time %i -\n",s,etime,calib.time[s][b[s]],calib.ttime[s][b[s]+1]);
5760 printf(" END CALORIMETER. \n\n" );
5761 b[s]++;
5762 CaloPede(filename,s,calib.ttime[s][b[s]],calib);
5763 };
5764 };
5765 };
5766 //
5767 // do whatever you want with data
5768 //
5769 evento.iev = de->iev;
5770 //
5771 // run over views and planes
5772 //
5773 stringstream xve;
5774 stringstream yve;
5775 for (Int_t l = 0; l < 2; l++){
5776 for (Int_t m = 0; m < 22; m++){
5777 //
5778 // determine the section number
5779 //
5780 Int_t se = 5;
5781 if (l == 0 && m%2 == 0) se = 3;
5782 if (l == 0 && m%2 != 0) se = 2;
5783 if (l == 1 && m%2 == 0) se = 1;
5784 if (l == 1 && m%2 != 0) se = 0;
5785 //
5786 // determine what kind of event we are going to analyze
5787 //
5788 bool isCOMP = 0;
5789 bool isFULL = 0;
5790 bool isRAW = 0;
5791 if ( de->stwerr[se] & (1 << 16) ) isCOMP = 1;
5792 if ( de->stwerr[se] & (1 << 17) ) isFULL = 1;
5793 if ( de->stwerr[se] & (1 << 3) ) isRAW = 1;
5794 //
5795 // save the prevoius energy deposit and calibration in sbase, sdexy, sdexyc
5796 //
5797 Int_t pre = -1;
5798 if ( isRAW ){
5799 for (Int_t nn = 0; nn < 96; nn++){
5800 if ( nn%16 == 0 ) pre++;
5801 evento.base[l][m][pre] = calib.calbase[l][m][pre];
5802 sdexy[l][m][nn] = evento.dexy[l][m][nn];
5803 evento.dexy[l][m][nn] = de->dexy[l][m][nn] ;
5804 sdexyc[l][m][nn] = evento.dexyc[l][m][nn];
5805 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
5806 };
5807 };
5808 //
5809 // run over strips
5810 //
5811 Int_t done = 0;
5812 Int_t rdone = 0;
5813 Int_t fdone = 0;
5814 pre = -1;
5815 for (Int_t n =0 ; n < 96; n++){
5816 if ( n%16 == 0 ) {
5817 pre++;
5818 done = 0;
5819 rdone = 0;
5820 fdone = 0;
5821 };
5822 //
5823 // baseline check and calculation
5824 //
5825 if ( !isRAW ) {
5826 //
5827 // 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.
5828 //
5829 if ( !done ){
5830 evento.base[l][m][pre] = de->base[l][m][pre] ;
5831 evento.dexyc[l][m][n] = de->dexyc[l][m][n] ;
5832 };
5833 } else {
5834 //
5835 // if it is a raw event and we haven't checked yet, calculate the baseline. Then check that the baseline is fine,
5836 // if not calculate it with relaxed algorithm.
5837 //
5838 if ( !rdone ){
5839 CaloFindBaseRaw(calib,evento,l,m,pre);
5840 tot1++;
5841 rdone = 1;
5842 };
5843 };
5844 //
5845 // no suitable new baseline, use old ones
5846 //
5847 if ( !done && (evento.base[l][m][pre] == 31000. || evento.base[l][m][pre] == 0.) ){
5848 tot0++;
5849 evento.base[l][m][pre] = calib.sbase[l][m][pre];
5850 Int_t upnn = n+16;
5851 if ( upnn > 96 ) upnn = 96;
5852 for ( Int_t nn = n; nn<upnn; nn++ ){
5853 evento.dexyc[l][m][nn] = de->dexyc[l][m][nn] ;
5854 };
5855 CaloCompressData(calib,evento,l,m,pre);
5856 done = 1;
5857 };
5858 //
5859 // if here we don't have a valid baseline we will skip the event.
5860 //
5861 if ( evento.base[l][m][pre] == 31000. ) tot2++;
5862 //
5863 // CALIBRATION ALGORITHM
5864 //
5865 basel = evento.base[l][m][pre];
5866 ener = evento.dexyc[l][m][n];
5867 estrip[l][m][n] = 0.;
5868 if ( basel>0 && basel < 30000. && ener > 0. ){
5869 estrip[l][m][n] = (ener - calib.calped[l][m][n] - basel)/mip[l][m][n] ;
5870 //
5871 // 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)
5872 //
5873 xve.str("");
5874 yve.str("");
5875 xve << "x-view event " << n;
5876 xve << " " << m;
5877 xve << " " << l;
5878 yve << "y-view event " << n;
5879 yve << " " << m;
5880 yve << " " << l;
5881 gDirectory->Delete(xve.str().c_str());
5882 gDirectory->Delete(yve.str().c_str());
5883 TH2F *Xview = new TH2F(xve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5884 TH2F *Yview = new TH2F(yve.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
5885 if ( estrip[l][m][n] > 0.7 && !var.nosig ){
5886 Int_t colo;
5887 if ( var.bw ){
5888 colo = -1;
5889 } else {
5890 colo = 1;
5891 };
5892 ColorMIP(estrip[l][m][n],colo);
5893 Xview->SetFillColor(colo);
5894 Yview->SetFillColor(colo);
5895 if ( l == 0 ) {
5896 Xview->Fill(n,21-m,1.);
5897 pd1->cd();
5898 Xview->Draw("box same");
5899 };
5900 if ( l == 1 ) {
5901 Yview->Fill(95-n,21-m,1.);
5902 pd2->cd();
5903 Yview->Draw("box same");
5904 };
5905 };
5906 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] != 0 ) badstrip++;
5907 if ( estrip[l][m][n] > 0.7 && calib.calgood[l][m][n] == 0 ) {
5908 qtot += estrip[l][m][n];
5909 nstrip++;
5910 };
5911 };
5912 calib.sbase[l][m][pre] = evento.base[l][m][pre];
5913 };
5914 };
5915 };
5916 pd1->Update();
5917 pd2->Update();
5918 var.qtot=(int)qtot;
5919 var.nstrip=nstrip;
5920 }
5921
5922
5923 void ShowPalette(Int_t bw){
5924 Float_t xp = 0.40;
5925 Float_t yp = 0.02;
5926 Float_t xw = 0.2325;
5927 Float_t yh = 0.19;
5928 // Float_t xp = 0.33;
5929 //Float_t yp = 0.02;
5930 //Float_t xw = 0.35;
5931 //Float_t yh = 0.19;
5932 Double_t xx[5] = {xp, xp+xw, xp+xw, xp, xp};
5933 Double_t yy[5] = {yp, yp, yp+yh, yp+yh, yp};
5934 TPolyLine *fpale = new TPolyLine(5,xx,yy);
5935 fpale->SetLineColor(1);
5936 fpale->SetLineWidth(1);
5937 fpale->Draw();
5938 TLatex *txt=new TLatex();
5939 txt->SetTextSize(0.01);
5940 txt->DrawLatex(xp+0.005,yp+yh-0.015,"PALETTE");
5941 txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, CALO, S4 [MIP]:");
5942 // Float_t xwc = (xp+0.01)/6.;
5943 Float_t xwc = (xw-0.01)/6.;
5944 Float_t axwc = xwc+0.02;
5945 Float_t yhc = 0.03;
5946 Int_t colo = 0;
5947 Float_t yc = 0.135;
5948 TPolyLine *fc1[6];
5949 if ( bw ){
5950 for ( Int_t j=0; j<6; j++){
5951 // Float_t xc = 0.335+(j*xwc);
5952 Float_t xc = 0.005+xp+(j*xwc);
5953 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
5954 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
5955 fc1[j] = new TPolyLine(5,xx,yy);
5956 fc1[j]->SetLineColor(1);
5957 if ( j == 0 ) {
5958 colo = 10;
5959 };
5960 if ( j == 1 ) {
5961 colo = 17;
5962 };
5963 if ( j == 2 ) {
5964 colo = 15;
5965 };
5966 if ( j == 3 ) {
5967 colo = 14;
5968 };
5969 if ( j == 4 ) {
5970 colo = 13;
5971 };
5972 if ( j == 5 ) {
5973 colo = 12;
5974 };
5975 fc1[j]->SetFillColor(colo);
5976 fc1[j]->SetLineWidth(1);
5977 fc1[j]->Draw("f");
5978 fc1[j]->Draw();
5979 if ( j == 0 ) {
5980 txt->DrawLatex(xc+0.005,yc+0.01,"0");
5981 };
5982 if ( j == 1 ) {
5983 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
5984 };
5985 if ( j == 2 ) {
5986 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
5987 };
5988 if ( j == 3 ) {
5989 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
5990 };
5991 if ( j == 4 ) {
5992 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
5993 };
5994 if ( j == 5 ) {
5995 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
5996 };
5997 };
5998
5999 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
6000 Float_t yc = 0.08;
6001 TPolyLine *fc2[6];
6002 for ( Int_t j=0; j<6; j++){
6003 Float_t xc = 0.005+xp+(j*xwc);
6004 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
6005 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
6006 fc2[j] = new TPolyLine(5,xx,yy);
6007 fc2[j]->SetLineColor(1);
6008 if ( j == 0 ) {
6009 colo = 10;
6010 };
6011 if ( j == 1 ) {
6012 colo = 17;
6013 };
6014 if ( j == 2 ) {
6015 colo = 15;
6016 };
6017 if ( j == 3 ) {
6018 colo = 14;
6019 };
6020 if ( j == 4 ) {
6021 colo = 13;
6022 };
6023 if ( j == 5 ) {
6024 colo = 12;
6025 };
6026 fc2[j]->SetFillColor(colo);
6027 fc2[j]->SetLineWidth(1);
6028 fc2[j]->Draw("f");
6029 fc2[j]->Draw();
6030 if ( j == 0 ) {
6031 txt->DrawLatex(xc+0.005,yc+0.01,"0");
6032 };
6033 if ( j == 1 ) {
6034 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
6035 };
6036 if ( j == 2 ) {
6037 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
6038 };
6039 if ( j == 3 ) {
6040 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
6041 };
6042 if ( j == 4 ) {
6043 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
6044 };
6045 if ( j == 5 ) {
6046 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
6047 };
6048 };
6049 //
6050 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
6051 yc = 0.025;
6052 TPolyLine *fc3[3];
6053 for ( Int_t j=0; j<3; j++){
6054 Float_t xc = 0.005+xp+(j*axwc);
6055 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
6056 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
6057 fc3[j] = new TPolyLine(5,xx,yy);
6058 fc3[j]->SetLineColor(1);
6059 if ( j == 0 ) {
6060 colo = 10;
6061 };
6062 if ( j == 1 ) {
6063 colo = 13;
6064 };
6065 if ( j == 2 ) {
6066 colo = 12;
6067 };
6068 fc3[j]->SetFillColor(colo);
6069 fc3[j]->SetLineWidth(1);
6070 fc3[j]->Draw("f");
6071 fc3[j]->Draw();
6072 if ( j == 0 ) {
6073 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
6074 };
6075 if ( j == 1 ) {
6076 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
6077 };
6078 if ( j == 2 ) {
6079 txt->SetTextSize(0.0095);
6080 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
6081 txt->SetTextSize(0.01);
6082 };
6083 };
6084 } else {
6085 for ( Int_t j=0; j<6; j++){
6086 Float_t xc = 0.005+xp+(j*xwc);
6087 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
6088 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
6089 fc1[j] = new TPolyLine(5,xx,yy);
6090 fc1[j]->SetLineColor(1);
6091 if ( j == 0 ) {
6092 colo = 10;
6093 };
6094 if ( j == 1 ) {
6095 colo = 38;
6096 };
6097 if ( j == 2 ) {
6098 colo = 4;
6099 };
6100 if ( j == 3 ) {
6101 colo = 3;
6102 };
6103 if ( j == 4 ) {
6104 colo = 2;
6105 };
6106 if ( j == 5 ) {
6107 colo = 6;
6108 };
6109 fc1[j]->SetFillColor(colo);
6110 fc1[j]->SetLineWidth(1);
6111 fc1[j]->Draw("f");
6112 fc1[j]->Draw();
6113 if ( j == 0 ) {
6114 txt->DrawLatex(xc+0.005,yc+0.01,"0");
6115 };
6116 if ( j == 1 ) {
6117 txt->DrawLatex(xc+0.005,yc+0.01,"0 - 2");
6118 };
6119 if ( j == 2 ) {
6120 txt->DrawLatex(xc+0.005,yc+0.01,"2 - 10");
6121 };
6122 if ( j == 3 ) {
6123 txt->DrawLatex(xc+0.005,yc+0.01,"10 - 100");
6124 };
6125 if ( j == 4 ) {
6126 txt->DrawLatex(xc+0.005,yc+0.01,"100 - 500");
6127 };
6128 if ( j == 5 ) {
6129 txt->DrawLatex(xc+0.005,yc+0.01,"> 500");
6130 };
6131 };
6132
6133 txt->DrawLatex(xp+0.005,yp+yh-0.095,"ND [neutrons]:");
6134 Float_t yc = 0.08;
6135 TPolyLine *fc2[6];
6136 for ( Int_t j=0; j<6; j++){
6137 Float_t xc = 0.005+xp+(j*xwc);
6138 Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc};
6139 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
6140 fc2[j] = new TPolyLine(5,xx,yy);
6141 fc2[j]->SetLineColor(1);
6142 if ( j == 0 ) {
6143 colo = 10;
6144 };
6145 if ( j == 1 ) {
6146 colo = 38;
6147 };
6148 if ( j == 2 ) {
6149 colo = 4;
6150 };
6151 if ( j == 3 ) {
6152 colo = 3;
6153 };
6154 if ( j == 4 ) {
6155 colo = 2;
6156 };
6157 if ( j == 5 ) {
6158 colo = 6;
6159 };
6160 fc2[j]->SetFillColor(colo);
6161 fc2[j]->SetLineWidth(1);
6162 fc2[j]->Draw("f");
6163 fc2[j]->Draw();
6164 if ( j == 0 ) {
6165 txt->DrawLatex(xc+0.005,yc+0.01,"0");
6166 };
6167 if ( j == 1 ) {
6168 txt->DrawLatex(xc+0.005,yc+0.01," 1 ");
6169 };
6170 if ( j == 2 ) {
6171 txt->DrawLatex(xc+0.005,yc+0.01," 2 ");
6172 };
6173 if ( j == 3 ) {
6174 txt->DrawLatex(xc+0.005,yc+0.01," 3 - 6 ");
6175 };
6176 if ( j == 4 ) {
6177 txt->DrawLatex(xc+0.005,yc+0.01," 7 - 14 ");
6178 };
6179 if ( j == 5 ) {
6180 txt->DrawLatex(xc+0.005,yc+0.01,"> 14");
6181 };
6182 };
6183 //
6184 txt->DrawLatex(xp+0.005,yp+yh-0.15,"AC:");
6185 yc = 0.025;
6186 TPolyLine *fc3[3];
6187 for ( Int_t j=0; j<3; j++){
6188 Float_t xc = 0.005+xp+(j*axwc);
6189 Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc};
6190 Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc};
6191 fc3[j] = new TPolyLine(5,xx,yy);
6192 fc3[j]->SetLineColor(1);
6193 if ( j == 0 ) {
6194 colo = 10;
6195 };
6196 if ( j == 1 ) {
6197 colo = 2;
6198 };
6199 if ( j == 2 ) {
6200 colo = 42;
6201 };
6202 fc3[j]->SetFillColor(colo);
6203 fc3[j]->SetLineWidth(1);
6204 fc3[j]->Draw("f");
6205 fc3[j]->Draw();
6206 if ( j == 0 ) {
6207 txt->DrawLatex(xc+0.005,yc+0.01," NOT HIT ");
6208 };
6209 if ( j == 1 ) {
6210 txt->DrawLatex(xc+0.005,yc+0.01," HIT trigger");
6211 };
6212 if ( j == 2 ) {
6213 txt->SetTextSize(0.0095);
6214 txt->DrawLatex(xc+0.001,yc+0.011," HIT background");
6215 txt->SetTextSize(0.01);
6216 };
6217 };
6218 };
6219 }
6220
6221 void DrawX(Float_t cx, Float_t cy, Float_t si, Variables & var){
6222 if ( true ){
6223 Float_t x[2] = {-si*var.sfx,si*var.sfx};
6224 Float_t y[2] = {-si*var.sfy,si*var.sfy};
6225 Float_t xb[2];
6226 Float_t yb[2];
6227 for (Int_t i = 0; i<2 ; i++){
6228 xb[i] = x[i]+cx;
6229 yb[i] = y[i]+cy;
6230 };
6231 TLine *x2 = new TLine(xb[0],yb[0],xb[1],yb[1]);
6232 x2->SetLineColor(1);
6233 x2->SetLineWidth(1);
6234 x2->Draw();
6235 };
6236 if ( true ){
6237 Float_t x[2] = {-si*var.sfx,si*var.sfx};
6238 Float_t y[2] = {si*var.sfy,-si*var.sfy};
6239 Float_t xa[2];
6240 Float_t ya[2];
6241 for (Int_t i = 0; i<2 ; i++){
6242 xa[i] = x[i]+cx;
6243 ya[i] = y[i]+cy;
6244 };
6245 TLine *x1 = new TLine(xa[0],ya[0],xa[1],ya[1]);
6246 x1->SetLineColor(1);
6247 x1->SetLineWidth(1);
6248 x1->Draw();
6249 };
6250 }
6251
6252 //
6253 // MAIN ROUTINE
6254 //
6255 void ShowEvent(TString filename="help", TString selfile="", Int_t ctrlword = 509, Int_t FORCELEV = -1, Int_t fromevent = 0, Int_t toevent = 0, TString outDir = ""){
6256 TString calcalibfile = "";
6257 TString startingdir = gSystem->WorkingDirectory();
6258 const char* startingdir2 = gSystem->WorkingDirectory();
6259 TString path;
6260 stringcopy(path,startingdir2);
6261 #if defined (__CINT__)
6262 emicheckLib();
6263 const char *pamlib=gSystem->Getenv("PAM_LIB");
6264 stringstream lolib;
6265 lolib.str("");
6266 lolib << pamlib << "/EVpathtoc_c.so";
6267 gSystem->Load(lolib.str().c_str());
6268 //
6269 if (!TClassTable::GetDict("CalorimeterLevel1")){
6270 const char *pamlib2 = gSystem->ExpandPathName("$PAM_LIB");
6271 stringstream liblo;
6272 liblo.str("");
6273 liblo << pamlib2 << "/caloclasses_h.so";
6274 gSystem->Load(liblo.str().c_str());
6275 }
6276 #endif
6277 #if !defined (__CINT__)
6278 TApplication app("app",0,0);
6279 #endif
6280 const char *pam_calib = pathtocalibration();
6281 stringstream calfile;
6282 calfile.str("");
6283 calfile << pam_calib << "/CaloADC2MIP.root";
6284 Int_t selection = 0;
6285 Bool_t firsttime = true;
6286 //
6287 //
6288 restart:
6289 gROOT->GetListOfCanvases()->Delete();
6290 gDirectory->GetList()->Delete();
6291 //
6292 struct Variables var;
6293 Bool_t loadselfs = true;
6294 Bool_t popup = false;
6295 PAMevcontrol *pamgui = 0;
6296 var.restart = false;
6297 var.waitforever = false;
6298 var.jumprog = true;
6299 var.jumpen = false;
6300 // Int_t njumpen = 0;
6301 struct Levels level;
6302 //
6303 const char *name= filename;
6304 if ( filename == "" || !strcmp(name,"help") ){
6305 // ShowHelp();
6306 // return;
6307 var.waitforever = true;
6308 };
6309 //
6310 Float_t mip[2][22][96];
6311 Int_t okcalo = 0;
6312 TTree *ctree = 0;
6313 TFile *chfile;
6314 CalorimeterCalibration *ccalo = 0;
6315 Long64_t cnevents = 0;
6316 //
6317 var.goon = false;
6318 var.refresh = false;
6319 var.fl0 = false;
6320
6321 if ( FORCELEV == 0 ) var.fl0 = true;
6322 //
6323 // Define some variables
6324 //
6325 Int_t OBT = 0;
6326 Int_t DOBT = 0;
6327 Int_t ifout = 0;
6328 Int_t OOBT = 0;
6329 //
6330 // here windows dimension (based on the computer screen size) and position and dimension of figures
6331 //
6332 Int_t xw, yw;
6333 UInt_t ww, hw;
6334 gVirtualX->GetWindowSize(gClient->GetRoot()->GetId(),xw,yw,ww,hw);
6335 Float_t winx = (float)ww*0.80;
6336 Float_t winy = (float)hw*0.80; // 95
6337 Float_t winrap = winx/winy;
6338 TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy);
6339 // GetCanvas->SetBit(kNotEditable);
6340 //
6341 var.bw = 0;
6342 // var.xxvc = 0.17;
6343 var.xxvc = 0.20;
6344 var.yxvc = 0.44;
6345 // var.xyvc = 0.83;
6346 var.xyvc = 0.815;
6347 var.yyvc = 0.44;
6348 //
6349 var.sfx = 0.81/winrap;
6350 var.sfy = 0.81;
6351 //
6352 //var.nds4 = 0.4;
6353 var.nds4 = var.sfx;
6354 var.xcat = 0.515;
6355 //var.xcat = 0.56;
6356 var.ycat = 0.74;
6357 //
6358 var.tracknds4 = 1;
6359 //
6360 var.thefilename = filename.Data();
6361 var.thefilter = selfile.Data();
6362 //
6363 // book the canvas
6364 //
6365 TLatex *text=new TLatex();
6366 stringstream testo;
6367 stringstream testo2;
6368 stringstream testo3;
6369 figure->Range(0.,0.,1.,1.);
6370 gStyle->SetOptDate(0);
6371 gStyle->SetOptStat(0);
6372 gStyle->SetLabelSize(0);
6373 gStyle->SetNdivisions(1,"X");
6374 gStyle->SetNdivisions(1,"Y");
6375 //
6376 stringstream libload;
6377 Int_t doflag = 1;
6378 Int_t thefirst = 1;
6379 Int_t trackdone1 = 0;
6380 Int_t trackdone2 = 0;
6381 Int_t seldone = 0;
6382 Float_t headc = 0.;
6383 Float_t headcold = 0.;
6384 Int_t i = 0;
6385 Int_t isOK = 0;
6386 Int_t jumpto = 0;
6387 struct Calib calib;
6388 Int_t b[4];
6389 Int_t si = 0;
6390 var.selex = false;
6391 var.alrforc = false;
6392 //
6393 // from here to refresh
6394 //
6395 refresh:
6396 //
6397 selfile = var.thefilter.Data();
6398 if ( calcalibfile == "" ) calcalibfile = filename;
6399 if ( outDir == "" ) outDir = filename;
6400 //
6401 if ( var.fl0 == true ) {
6402 FORCELEV = 0;
6403 } else {
6404 if ( var.refresh ) FORCELEV = -1;
6405 };
6406 //
6407 // clear levels!
6408 //
6409 level.calo = -10;
6410 level.calol2 = -10;
6411 level.tof = -10;
6412 level.track = -10;
6413 level.track2 = -10;
6414 level.s4 = -10;
6415 level.ac = -10;
6416 level.nd = -10;
6417 //
6418 TString fififile = getFilename(filename);
6419 const char *file = fififile;
6420 //
6421 //
6422 //
6423 if ( !var.refresh ){
6424 var.SHOWDEC = 0;
6425 var.TOF = 0;
6426 var.AC = 0;
6427 var.TRK = 0;
6428 var.CALO = 0;
6429 var.S4 = 0;
6430 var.ND = 0;
6431 var.INFOS = 0;
6432 var.VINFOS = 0;
6433 var.PALETTE = 0;
6434 if ( ctrlword & (1<<0) ) {
6435 var.PALETTE = 1;
6436 printf("Show Palette\n");
6437 };
6438 if ( ctrlword & (1<<1) ) {
6439 var.VINFOS = 1;
6440 printf("Show Verbose Text Informations\n");
6441 };
6442 if ( ctrlword & (1<<2) ) {
6443 var.INFOS = 1;
6444 printf("Show Text Informations\n");
6445 };
6446 if ( ctrlword & (1<<3) ) {
6447 var.ND = 1;
6448 };
6449 if ( ctrlword & (1<<4) ) {
6450 var.S4 = 1;
6451 };
6452 if ( ctrlword & (1<<5) ) {
6453 var.CALO = 1;
6454 };
6455 if ( ctrlword & (1<<6) ) {
6456 var.TRK = 1;
6457 };
6458 if ( ctrlword & (1<<7) ) {
6459 var.AC = 1;
6460 };
6461 if ( ctrlword & (1<<8) ) {
6462 var.TOF = 1;
6463 };
6464 if ( ctrlword & (1<<9) ) {
6465 var.SHOWDEC = 1;
6466 fromevent = 1;
6467 toevent = 1;
6468 printf("\n ** WARNING! YOU HAVE CHOSEN TO SHOW ONLY DETECTORS AND NO SIGNALS! **\n\n");
6469 gSystem->Exec("sleep 5");
6470 };
6471 };
6472 //
6473 // Pop up the GUI
6474 //
6475 if ( !popup ) {
6476 pamgui = new PAMevcontrol(gClient->GetRoot(),400,800,var,*figure);
6477 popup = true;
6478 };
6479 if ( firsttime ){
6480 firsttime = false;
6481 if ( filename == "" ) pamgui->DIALOG(0," Insert the filename and press load to start ");
6482 };
6483 //
6484 while( var.waitforever ) {
6485 if ( !gROOT->GetListOfCanvases()->FindObject(figure) ) {
6486 pamgui->Close();
6487 gSystem->ProcessEvents();
6488 gApplication->Terminate(0);
6489 };
6490 gSystem->ProcessEvents();
6491 gSystem->Sleep(10);
6492 };
6493 if ( var.restart ){
6494 filename = var.thefilename.Data();
6495 pamgui->Close();
6496 goto restart;
6497 };
6498 //
6499 //
6500 //
6501 if ( FORCELEV != -1 ) {
6502 printf("\n WARNING: FORCING LEVEL%i DATA \n\n",FORCELEV);
6503 if ( !var.alrforc ) {
6504 pamgui->DIALOG(1," Forcing LEVEL0 data ");
6505 var.alrforc = true;
6506 };
6507 };
6508 //
6509 // LOAD SELECTION FILE
6510 //
6511 if ( selfile == "" ){
6512 if ( !var.selex && selection ) pamgui->DIALOG(0," Selection file unloaded ");
6513 var.selex = true;
6514 selection = 0;
6515 #if !defined (__CINT__)
6516 if ( !var.refresh ) {
6517 gROOT->Reset();
6518 stringstream paminc;
6519 paminc.str("");
6520 const char *testinc = gSystem->Getenv("PAM_INC");
6521 if ( !testinc ) {
6522 const char *pam_calib = pathtocalibration();
6523 paminc << pam_calib << "../include/";
6524 } else {
6525 paminc << testinc;
6526 };
6527 stringstream carica;
6528 carica.str("");
6529 carica << paminc.str().c_str() << "/eventviewer.h";
6530 gROOT->LoadMacro(carica.str().c_str());
6531 };
6532 #endif
6533 } else {
6534 #if !defined (__CINT__)
6535 //
6536 // if running the compiled program we must load header files for the selection macros!
6537 //
6538 // if ( !var.refresh ) {
6539 if ( loadselfs ) {
6540 loadselfs = false;
6541 gROOT->Reset();
6542 stringstream paminc;
6543 paminc.str("");
6544 const char *testinc = gSystem->Getenv("PAM_INC");
6545 if ( !testinc ){
6546 const char *pam_calib = pathtocalibration();
6547 paminc << pam_calib << "../include/";
6548 } else {
6549 paminc << testinc;
6550 };
6551 stringstream carica;
6552 carica.str("");
6553 carica << paminc.str().c_str() << "/eventviewer.h";
6554 gROOT->LoadMacro(carica.str().c_str());
6555 carica.str("");
6556 carica << paminc.str().c_str() << "/trklev1struct.h";
6557 gROOT->LoadMacro(carica.str().c_str());
6558 carica.str("");
6559 carica << paminc.str().c_str() << "/ctrkstruct.h";
6560 gROOT->LoadMacro(carica.str().c_str());
6561 carica.str("");
6562 carica << paminc.str().c_str() << "/ctrkinclude.h";
6563 gROOT->LoadMacro(carica.str().c_str());
6564 carica.str("");
6565 carica << paminc.str().c_str() << "/ctofstruct.h";
6566 gROOT->LoadMacro(carica.str().c_str());
6567 carica.str("");
6568 carica << paminc.str().c_str() << "/ctofinclude.h";
6569 gROOT->LoadMacro(carica.str().c_str());
6570 };
6571 #endif
6572 //
6573 // load the selection macro
6574 //
6575 selection = gROOT->LoadMacro(selfile);
6576 if ( selection ){
6577 stringstream dialog;
6578 dialog.str("");
6579 dialog << var.thefilter.Data();
6580 dialog << " : no such file!";
6581 pamgui->DIALOG(2,dialog.str().c_str());
6582 printf("\n\n ERROR! cannot read the selection file you give me as input! \n");
6583 selection = 0;
6584 printf("\n WARNING! no selection file loaded! \n\n");
6585 pamgui->DIALOG(1," No selection file loaded! ");
6586 pamgui->clearselfi();
6587 } else {
6588 printf("\n\n Selection file loaded \n\n The first event will be shown anyway. \n\n");
6589 if ( !var.selex ) pamgui->DIALOG(0," Selection file successfully loaded ");
6590 var.selex = true;
6591 selection = 1;
6592 };
6593 };
6594 //
6595 // LOAD FILES
6596 //
6597 //
6598 Int_t trk1noev = 0;
6599 Int_t trk2noev = 0;
6600 Int_t tofnoev = 0;
6601 // open files
6602 TFile *headerFile = 0;
6603 TFile *triggerFile = 0;
6604 TFile *caloFile = 0;
6605 TFile *trackerFile = 0;
6606 TFile *trackerFile2 = 0;
6607 TFile *neutronFile = 0;
6608 TFile *acFile = 0;
6609 TFile *s4File = 0;
6610 TFile *tofFile = 0;
6611 TFile *tofFileL1 = 0;
6612 TTree *toftr = 0;
6613 //
6614 // check if user has given as input a correct path
6615 //
6616 ifstream myfile;
6617 stringstream hfile;
6618 TString textslash;
6619 Int_t minus = 0;
6620 stringcopy(textslash,filename,filename.Length()-1,filename.Length());
6621 if ( !strcmp(textslash.Data(),"/") ){
6622 minus = 1;
6623 } else {
6624 minus = 0;
6625 };
6626 TString textrem;
6627 stringcopy(textrem,filename,filename.Length()-minus-15,filename.Length()-minus);
6628 hfile.str("");
6629 hfile << filename.Data();
6630 hfile << "/Physics/";
6631 hfile << textrem.Data();
6632 hfile << ".Physics.Header.root";
6633 myfile.open(hfile.str().c_str());
6634 if ( !myfile ){
6635 printf("ERROR: no Header file, exiting...\n");
6636 hfile << " - No header file! ";
6637 pamgui->DIALOG(2,hfile.str().c_str());
6638 var.waitforever = true;
6639 goto refresh;
6640 };
6641 myfile.close();
6642 //
6643 // ok, open header file
6644 //
6645 headerFile = emigetFile(filename, "Physics", "Header");
6646 if ( !headerFile ){
6647 printf("ERROR: no Header file, exiting...\n");
6648 pamgui->DIALOG(2," No header file! ");
6649 var.waitforever = true;
6650 goto refresh;
6651 };
6652 TTree *otr = (TTree*)headerFile->Get("Pscu");
6653 printf("Get the Header informations\n");
6654 //
6655 triggerFile = emigetFile(filename, "Trigger");
6656 if ( !triggerFile ){
6657 printf("ERROR: no Trigger file, exiting...\n");
6658 pamgui->DIALOG(2," No trigger file! ");
6659 var.waitforever = true;
6660 goto refresh;
6661 };
6662 otr->AddFriend("Trigger", triggerFile);
6663 printf("Get the Trigger informations\n");
6664 //
6665 TTree *ttr = 0;
6666 TTree *ttr1 = 0;
6667 Int_t STRACK = 0;
6668 Int_t TRKLEV = 0;
6669 Int_t ACLEV = 0;
6670 TFile *trackhead = 0;
6671 TFile *trackcalibFile1 = 0;
6672 TTree *ctrk = 0;
6673 TFile *trackcalibFile2 = 0;
6674 TFile *trackerFile2b = 0;
6675 if ( var.TRK ) {
6676 if ( FORCELEV == 0 ){
6677 trackerFile2 = emigetFile(filename, "Tracker");
6678 if ( !trackerFile2 ){
6679 printf("WARNING: no Tracker file! \n");
6680 pamgui->DIALOG(1," No tracker file! ");
6681 var.TRK = 0;
6682 } else {
6683 otr->AddFriend("Tracker", trackerFile2);
6684 printf("Show the Tracker detector, LEVEL0 data \n");
6685 TRKLEV = 0;
6686 };
6687 } else {
6688 trackerFile = emigetFile(filename, "Physics.Level2", "Tracker");
6689 if ( !trackerFile ){
6690 //
6691 trackhead = emigetFile(filename, "CalibTrk1", "Header");
6692 ctrk = (TTree*)trackhead->Get("Pscu");
6693 //
6694 trackerFile = emigetFile(filename, "Physics.Level1", "Tracker");
6695 trackcalibFile1 = emigetFile(filename, "CalibTrk1");
6696 trackcalibFile2 = emigetFile(filename, "CalibTrk2");
6697 //
6698 if ( !trackerFile || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){
6699 trackerFile = emigetFile(filename, "Tracker");
6700 if ( !trackerFile ){
6701 printf("WARNING: no Tracker file! \n");
6702 pamgui->DIALOG(1," No tracker file! ");
6703 var.TRK = 0;
6704 } else {
6705 otr->AddFriend("Tracker", trackerFile);
6706 printf("Show the Tracker detector, LEVEL0 data \n");
6707 TRKLEV = 0;
6708 };
6709 } else {
6710 ttr1 = (TTree*)trackerFile->Get("TrkLevel1");
6711 ctrk->AddFriend("CalibTrk1", trackcalibFile1);
6712 ctrk->AddFriend("CalibTrk2", trackcalibFile2);
6713 printf("Show the Tracker detector, LEVEL1 data \n");
6714 TRKLEV = 1;
6715 trk1noev = ttr1->GetEntries();
6716 };
6717 } else {
6718 ttr = (TTree*)trackerFile->Get("TrkLevel2");
6719 trk2noev = ttr->GetEntries();
6720 printf("Get the track informations (LEVEL2 Tracker data!)\n");
6721 STRACK = 1;
6722 //
6723 trackhead = emigetFile(filename, "CalibTrk2", "Header");
6724 ctrk = (TTree*)trackhead->Get("Pscu");
6725 //
6726 trackerFile2b = emigetFile(filename, "Physics.Level1", "Tracker");
6727 trackcalibFile1 = emigetFile(filename, "CalibTrk1");
6728 trackcalibFile2 = emigetFile(filename, "CalibTrk2");
6729 //
6730 if ( !trackerFile2b || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){
6731 printf(" WARNING: no LEVEL1 Tracker data, load LEVEL0 data \n");
6732 trackerFile2b = emigetFile(filename, "Tracker");
6733 if ( !trackerFile2b ){
6734 printf("WARNING: no Tracker file! \n");
6735 pamgui->DIALOG(1," No tracker file! ");
6736 var.TRK = 0;
6737 } else {
6738 otr->AddFriend("Tracker", trackerFile2b);
6739 printf("Show the Tracker detector, LEVEL0 data \n");
6740 TRKLEV = 0;
6741 };
6742 } else {
6743 ttr1 = (TTree*)trackerFile2b->Get("TrkLevel1");
6744 ctrk->AddFriend("CalibTrk1", trackcalibFile1);
6745 ctrk->AddFriend("CalibTrk2", trackcalibFile2);
6746 printf("Show the Tracker detector, LEVEL1 data \n");
6747 TRKLEV = 1;
6748 trk1noev = ttr1->GetEntries();
6749 };
6750 };
6751 };
6752 level.track = TRKLEV;
6753 level.track2 = STRACK;
6754 } else {
6755 level.track = -10;
6756 level.track2 = -10;
6757 };
6758 //
6759 Int_t CALOLEV = 0;
6760 if ( var.CALO ) {
6761 if ( FORCELEV == 0 ){
6762 caloFile = emigetFile(filename, "Calorimeter");
6763 if ( !caloFile ){
6764 printf("WARNING: no calorimeter file! \n");
6765 pamgui->DIALOG(1," No calorimeter file! ");
6766 var.CALO = 0;
6767 } else {
6768 otr->AddFriend("Calorimeter", caloFile);
6769 printf("Show the Calorimeter detector, LEVEL0 data \n");
6770 };
6771 CALOLEV = -1;
6772 } else {
6773 caloFile = emigetFile(filename, "Physics.Level1", "Calorimeter");
6774 if ( !caloFile ){
6775 caloFile = emigetFile(filename, "Calorimeter");
6776 if ( !caloFile ){
6777 printf("WARNING: no calorimeter file! \n");
6778 pamgui->DIALOG(1," No calorimeter file! ");
6779 var.CALO = 0;
6780 } else {
6781 otr->AddFriend("Calorimeter", caloFile);
6782 printf("Show the Calorimeter detector, try to generate LEVEL1 data \n");
6783 };
6784 CALOLEV = 0;
6785 } else {
6786 otr->AddFriend("CaloLevel1", caloFile);
6787 printf("Show the Calorimeter detector, LEVEL1 data \n");
6788 CALOLEV = 1;
6789 };
6790 };
6791 level.calo = CALOLEV;
6792 level.calol2 = -10;
6793 } else {
6794 level.calo = -10;
6795 level.calol2 = -10;
6796 };
6797 //
6798 if ( var.ND ) {
6799 neutronFile = emigetFile(filename, "Neutron");
6800 if ( !neutronFile ){
6801 printf("WARNING: no neutron detector file! \n");
6802 pamgui->DIALOG(1," No neutron detector file! ");
6803 var.ND = 0;
6804 } else {
6805 otr->AddFriend("Neutron", neutronFile);
6806 printf("Show the Neutron detector, LEVEL0 data \n");
6807 };
6808 level.nd = 0;
6809 } else {
6810 level.nd = -10;
6811 };
6812 //
6813 if ( var.AC ) {
6814 if ( FORCELEV == 0 ){
6815 acFile = emigetFile(filename, "Anticounter");
6816 if ( !acFile ){
6817 printf("WARNING: no AC file! \n");
6818 pamgui->DIALOG(1," No anticounters file! ");
6819 var.AC = 0;
6820 } else {
6821 otr->AddFriend("Anticounter", acFile);
6822 printf("Show the Anticoincidence detector, LEVEL 0 data\n");
6823 ACLEV = 0;
6824 };
6825 } else {
6826 acFile = emigetFile(filename, "Physics.Level1", "Anticounter");
6827 if ( !acFile ){
6828 acFile = emigetFile(filename, "Anticounter");
6829 if ( !acFile ){
6830 printf("WARNING: no AC file! \n");
6831 pamgui->DIALOG(1," No anticounters file! ");
6832 var.AC = 0;
6833 } else {
6834 otr->AddFriend("Anticounter", acFile);
6835 printf("Show the Anticoincidence detector, LEVEL 0 data\n");
6836 ACLEV = 0;
6837 };
6838 } else {
6839 otr->AddFriend("AcLevel1", acFile);
6840 printf("Show the Anticoincidence detector, LEVEL 1 data\n");
6841 ACLEV = 1;
6842 };
6843 };
6844 level.ac = ACLEV;
6845 } else {
6846 level.ac = -10;
6847 };
6848 Int_t S4LEV = 0;
6849 if ( var.S4 ) {
6850 s4File = emigetFile(filename, "S4");
6851 if ( !s4File ){
6852 printf("WARNING: no S4 file! \n");
6853 pamgui->DIALOG(1," No S4 file! ");
6854 var.S4 = 0;
6855 } else {
6856 otr->AddFriend("S4", s4File);
6857 if ( FORCELEV != 0 ){
6858 printf("Show the S4 detector, try to generate LEVEL1 data \n");
6859 S4LEV = 1;
6860 } else {
6861 printf("Show the S4 detector, LEVEL0 data \n");
6862 S4LEV = 0;
6863 };
6864 };
6865 level.s4 = S4LEV;
6866 } else {
6867 level.s4 = -10;
6868 };
6869 //
6870 Int_t TOFLEV = 0;
6871 if ( var.TOF ) {
6872 if ( FORCELEV != 0 ){
6873 tofFileL1 = emigetFile(filename, "Physics.Level1","TofTrigger");
6874 if ( !tofFileL1 ){
6875 tofFile = emigetFile(filename, "Tof");
6876 if ( !tofFile ){
6877 printf("WARNING: no TOF file! \n");
6878 pamgui->DIALOG(1," No TOF file! ");
6879 printf("Show the Time of Flight detector, LEVEL0 (trigger board) data\n");
6880 // var.TOF = 0;
6881 TOFLEV = 0;
6882 } else {
6883 otr->AddFriend("Tof", tofFile);
6884 printf("Show the Time of Flight, try to generate LEVEL1 data \n");
6885 TOFLEV = 10;
6886 };
6887 } else {
6888 toftr = (TTree*)tofFileL1->Get("TofLevel1");
6889 printf("Show the Time of Flight, LEVEL1 data \n");
6890 TOFLEV = 1;
6891 tofnoev = toftr->GetEntries();
6892 };
6893 } else {
6894 printf("Show the Time of Flight detector, LEVEL0 data\n");
6895 TOFLEV = 0;
6896 };
6897 level.tof = TOFLEV;
6898 } else {
6899 level.tof = -10;
6900 };
6901 //
6902 printf("\n");
6903 //
6904 pamela::PscuHeader *ph = 0;
6905 pamela::EventHeader *eh = 0;
6906 pamela::trigger::TriggerEvent *trig = 0;
6907 Long64_t nevents = otr->GetEntries();
6908 //
6909 printf(" The file contains %i physics events \n",(int)nevents);
6910 //
6911 if (nevents<=0) {
6912 headerFile->Close();
6913 triggerFile->Close();
6914 if ( var.TRK ) trackerFile->Close();
6915 if ( var.CALO )caloFile->Close();
6916 if ( var.ND ) neutronFile->Close();
6917 if ( var.AC ) acFile->Close();
6918 if ( var.TOF ) tofFile->Close();
6919 if ( var.S4 ) s4File->Close();
6920 printf("The file is empty, exiting...\n");
6921 pamgui->DIALOG(0," The file contains no physics data! ");
6922 var.waitforever = true;
6923 goto refresh;
6924 }
6925 //
6926 if ( var.SHOWDEC ){
6927 var.nosig = 1;
6928 } else {
6929 var.nosig = 0;
6930 };
6931 //
6932 // READ the CALORIMETER ADC to MIP conversion table (if trying to generate level1 data)
6933 //
6934 if ( !var.refresh ){
6935 if ( !CALOLEV && var.CALO ){
6936 chfile = new TFile(calfile.str().c_str(),"READ","Calorimeter CALIBRATION data");
6937 if ( chfile->IsZombie() ){
6938 printf(" WARNING: no calorimeter calibration file! \n Using 26 as conversion factor for all strips. \n");
6939 okcalo = 0;
6940 } else {
6941 okcalo = 1;
6942 ctree = (TTree*)chfile->Get("CaloADC");
6943 ctree->SetBranchAddress("Event", &ccalo);
6944 //
6945 cnevents = ctree->GetEntries();
6946 ctree->GetEntry(cnevents-1);
6947 };
6948 //
6949 if ( okcalo ) {
6950 for (Int_t m = 0; m < 2 ; m++ ){
6951 for (Int_t k = 0; k < 22; k++ ){
6952 for (Int_t l = 0; l < 96; l++ ){
6953 if ( (ccalo->fp[1][m][k][l] > 20. && ccalo->fp[1][m][k][l] < 32.) || ccalo->mask[m][k][l] == 1. ) {
6954 if ( ccalo->mip[m][k][l] != 0. ){
6955 mip[m][k][l] = ccalo->mip[m][k][l];
6956 } else {
6957 mip[m][k][l] = 26. ;
6958 };
6959 } else {
6960 mip[m][k][l] = 26. ;
6961 };
6962 };
6963 };
6964 };
6965 } else {
6966 for (Int_t m = 0; m < 2 ; m++ ){
6967 for (Int_t k = 0; k < 22; k++ ){
6968 for (Int_t l = 0; l < 96; l++ ){
6969 mip[m][k][l] = 26. ;
6970 };
6971 };
6972 };
6973 };
6974 chfile->Close();
6975 };
6976 };
6977 //
6978 // Check that given input are inside the boundary conditions
6979 //
6980 if ( fromevent > toevent && toevent ){
6981 printf("It must be fromevent < toevent \n");
6982 return;
6983 };
6984 if ( fromevent > nevents+1 || fromevent < 0 ) {
6985 printf("You can choose fromevent between 0 (all) and %i \n",(int)nevents+1);
6986 return;
6987 };
6988 if ( toevent > nevents+1 || toevent < 0 ) {
6989 printf("You can choose toevent between 0 (all) and %i \n",(int)nevents+1);
6990 return;
6991 };
6992 Int_t minevent = 0;
6993 Int_t maxevent = nevents - 1;
6994 if ( fromevent == 0 ) {
6995 minevent = 0;
6996 maxevent = nevents - 1;
6997 } else {
6998 minevent = fromevent - 1;
6999 if ( toevent > 0 ){
7000 maxevent = toevent-1;
7001 } else {
7002 maxevent = fromevent-1;
7003 };
7004 };
7005 //
7006 //
7007 otr->SetBranchAddress("Header", &eh);
7008 otr->GetEntry(maxevent);
7009 ph = eh->GetPscuHeader();
7010 Int_t lastevno = (int)ph->GetCounter();
7011 otr->GetEntry(minevent);
7012 ph = eh->GetPscuHeader();
7013 Int_t firstevno = (int)ph->GetCounter();
7014 if ( !var.refresh ) i = minevent;
7015 var.refresh = false;
7016 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7017 // MAIN LOOP STARTS HERE: run over all the events
7018 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7019 // while ( i < maxevent+1 ){
7020 while ( 1 ){
7021 //
7022 // update progress bar
7023 //
7024 if ( popup ) pamgui->increment((float)(i+1)*100./(float)nevents);
7025 //
7026 // clear canvas and variables
7027 //
7028 var.beta[0] = 0.;
7029 var.beta[1] = 0.;
7030 var.beta[2] = 0.;
7031 var.beta[3] = 0.;
7032 var.beta[4] = 0.;
7033 var.s4sig = 0.;
7034 var.nstrip = 0;
7035 var.qtot = 0;
7036 var.nclx = 0;
7037 var.ncly = 0;
7038 var.trup = 0;
7039 var.bkup = 0;
7040 var.bkbo = 0;
7041 var.hcas = 0;
7042 var.hcat = 0;
7043 var.hcard = 0;
7044 //
7045 // call the filter to select events (if filter file is given)
7046 //
7047 if ( jumpto ){
7048 otr->SetBranchAddress("Header", &eh);
7049 otr->GetEntry(i);
7050 ph = eh->GetPscuHeader();
7051 Int_t cjumpto = (int)ph->GetCounter();
7052 if ( cjumpto == jumpto ) jumpto = 0;
7053 if ( jumpto && (i == maxevent || i == si) ) {
7054 if ( var.jumpen && i == maxevent ) {
7055 i = -1;
7056 var.jumpen = false;
7057 } else {
7058 i = si;
7059 printf(" WARNING: NO EVENT WITH EVENT NUMBER %i \n",jumpto);
7060 stringstream dialog;
7061 dialog.str("");
7062 dialog << " No event with event number ";
7063 dialog << jumpto;
7064 pamgui->DIALOG(1,dialog.str().c_str());
7065 jumpto = 0;
7066 };
7067 };
7068 };
7069 //
7070 isOK = 0;
7071 if ( !selection || ( i == minevent && !seldone) || ( i == minevent || i == maxevent )){
7072 if ( i == minevent && selection && seldone && doflag==2) pamgui->DIALOG(1," Stop searching, first event reached ");
7073 if ( i == maxevent && selection ) pamgui->DIALOG(1," Stop searching, last event reached ");
7074 isOK = 1;
7075 seldone = 1;
7076 } else {
7077 isOK = 0;
7078 #if defined (__CINT__)
7079 isOK = filter(i,otr,ttr,level);
7080 #endif
7081 #if !defined (__CINT__)
7082 stringstream cintcom;
7083 cintcom.str("");
7084 cintcom << "Int_t *i = (Int_t*)0x" << hex;
7085 cintcom << &i;
7086 gROOT->ProcessLine(cintcom.str().c_str());
7087 gROOT->ProcessLine("Int_t a = *i;");
7088 cintcom.str("");
7089 cintcom << "TTree *otr = (TTree*)0x" << hex;
7090 cintcom << otr;
7091 gROOT->ProcessLine(cintcom.str().c_str());
7092 cintcom.str("");
7093 cintcom << "TTree *ttr = (TTree*)0x" << hex;
7094 cintcom << ttr;
7095 gROOT->ProcessLine(cintcom.str().c_str());
7096 cintcom.str("");
7097 cintcom << "struct Levels &level = (struct Levels &)0x" << hex;
7098 cintcom << &level;
7099 gROOT->ProcessLine(cintcom.str().c_str());
7100 isOK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level);");
7101 #endif
7102 seldone = 1;
7103 printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37);
7104 fflush(stdout);
7105 };
7106 //
7107 // if the event is selected go on
7108 //
7109 if ( isOK && !jumpto ) {
7110 if ( var.doflag == 3 ) selection = 1;
7111 printf("\n");
7112 //
7113 figure->SetEditable(kTRUE);
7114 //
7115 figure->Clear();
7116 figure->SetFillColor(10);
7117 figure->cd();
7118 //
7119 // Get Orbital Time information and header event number
7120 //
7121 otr->SetBranchAddress("Header", &eh);
7122 if ( !var.nosig) otr->GetEntry(i);
7123 ph = eh->GetPscuHeader();
7124 headcold = headc;
7125 headc = ph->GetCounter();
7126 var.headc = (int)ph->GetCounter();
7127 OBT = ph->GetOrbitalTime();
7128 DOBT = OBT - OOBT;
7129 OOBT = OBT;
7130 if ( i == minevent || DOBT < 0 || (headc-headcold-1)!=0 ) DOBT = 0;
7131 var.etime = OBT;
7132 //
7133 // who gave the trigger?
7134 //
7135 otr->SetBranchAddress("Trigger.Event", &trig);
7136 if ( !var.nosig) otr->GetEntry(i);
7137 Int_t calotrig = 0;
7138 if ( trig->patterntrig[0] ) calotrig = 1;
7139 Int_t toftrig = 0;
7140 if ( trig->patterntrig[2] || trig->patterntrig[3] || trig->patterntrig[4] || trig->patterntrig[5] ) toftrig = 1;
7141 Int_t s4pulser = 0;
7142 if ( trig->patterntrig[1] & (1<<0) ) s4pulser = 1;
7143 //
7144 // TOF and calorimeter when giving a trigger will always set this flag since the time window of the signal is greater than 100 ns.
7145 // S4 sometimes could not set the flag even if the trigger is given. This is a workaround to fix this "bug":
7146 //
7147 if ( !calotrig && !toftrig ) s4pulser = 1;
7148 //
7149 Int_t trigconf = trig->trigconf;
7150 stringstream trc;
7151 trc.str("");
7152 if ( trigconf & (1<<0) ) trc << "TOF1";
7153 if ( trigconf & (1<<1) ) trc << " TOF2";
7154 if ( trigconf & (1<<2) ) trc << " TOF3";
7155 if ( trigconf & (1<<3) ) trc << " TOF4";
7156 if ( trigconf & (1<<4) ) trc << " TOF5";
7157 if ( trigconf & (1<<5) ) trc << " TOF6";
7158 if ( trigconf & (1<<6) ) trc << " TOF7";
7159 if ( trigconf & (1<<7) ) trc << " S4";
7160 if ( trigconf & (1<<8) ) trc << " CALO";
7161 if ( trigconf & (1<<9) ) trc << " CALIB_ON";
7162 TString trcs(trc.str().c_str());
7163 //
7164 // show TOF
7165 //
7166 if ( var.TOF ){
7167 figure->cd();
7168 if ( TOFLEV == 0 ){
7169 ShowTOF(i,otr,var);
7170 level.tof = 0;
7171 };
7172 if ( TOFLEV == 10 ){
7173 ShowTOFGENL1(i,otr,var);
7174 level.tof = 0;
7175 };
7176 if ( TOFLEV == 1 ){
7177 ShowTOFL1(i,toftr,var,pamgui);
7178 level.tof = 1;
7179 };
7180 };
7181 //
7182 // show anticounters
7183 //
7184 if ( var.AC ){
7185 figure->cd();
7186 if ( ACLEV == 0 ){
7187 ShowAC(i,otr,var,0);
7188 level.ac = 0;
7189 };
7190 if ( ACLEV == 1 ){
7191 ShowAC(i,otr,var,1);
7192 level.ac = 1;
7193 };
7194 };
7195 //
7196 // show S4
7197 //
7198 if ( var.S4 ){
7199 figure->cd();
7200 if ( S4LEV == 0 ){
7201 ShowS4L0(i,otr,var);
7202 level.s4 = 0;
7203 };
7204 if ( S4LEV == 1 ){
7205 ShowS4L1(i,otr,var);
7206 level.s4 = 1;
7207 };
7208 };
7209 //
7210 //
7211 // show neutron detector
7212 //
7213 if ( var.ND ){
7214 figure->cd();
7215 ShowND(i,otr,var);
7216 level.nd = 0;
7217 };
7218 //
7219 // show tracker
7220 //
7221 if ( var.TRK ){
7222 //
7223 // if we have level2 data show the track
7224 //
7225 if ( STRACK == 1 ) {
7226 if ( i == minevent && !trackdone1 ) {
7227 //
7228 // Load tracker libraries to read the magnetic field and compute the paritcle trajectory
7229 //
7230 trackdone1 = 1;
7231 #if defined (__CINT__)
7232 printf("\n\n TRACKER: loading shared libraries...\n");
7233 const char *pam_lib=gSystem->Getenv("PAM_LIB");
7234 libload.str("");
7235 libload << pam_lib << "/libtrack";
7236 gSystem->Load(libload.str().c_str());
7237 libload.str("");
7238 libload << pam_lib << "/libtrack_C";
7239 gSystem->Load(libload.str().c_str());
7240 libload.str("");
7241 libload << pam_lib << "/libreadb2maps";
7242 gSystem->Load(libload.str().c_str());
7243 libload.str("");
7244 libload << pam_lib << "/libreadb2maps_C";
7245 gSystem->Load(libload.str().c_str());
7246 libload.str("");
7247 printf(" ...done!\n\n");
7248 #endif
7249 //
7250 // Read the magnetic field map (two files), here it goes the path AND name of one of them.
7251 //
7252 printf("\n\n TRACKER: loading the magnetic field maps...\n\n\n");
7253 const char *pam_calib = pathtocalibration();
7254 stringstream bdir;
7255 bdir.str("");
7256 bdir << pam_calib << ".";
7257 creadB(bdir.str().c_str());
7258 //
7259 printf(" ...done! \n");
7260 };
7261 level.track2 = 1;
7262 figure->cd();
7263 ShowTRACK(i,ttr,var,pamgui);
7264 } else {
7265 level.track2 = 0;
7266 };
7267 //
7268 // show level1 data
7269 //
7270 figure->cd();
7271 if ( TRKLEV == 1 ) {
7272 if ( i == minevent && !trackdone2 ) {
7273 trackdone2 = 1;
7274 #if defined (__CINT__)
7275 printf("\n\n TRACKER: loading level1 libraries...\n");
7276 const char *pam_lib=gSystem->Getenv("PAM_LIB");
7277 printf("\n Opening libptlev1.so \n");
7278 libload.str("");
7279 libload << pam_lib << "/libptlevel1";
7280 gSystem->Load(libload.str().c_str());
7281 libload.str("");
7282 printf("\n Opening libptlev1_C.so \n\n");
7283 libload.str("");
7284 libload << pam_lib << "/libptlevel1_C";
7285 gSystem->Load(libload.str().c_str());
7286 libload.str("");
7287 printf(" ...done! \n\n");
7288 #endif
7289 //
7290 pamela::CalibTrk1Event *te1 = 0;
7291 ctrk->SetBranchAddress("CalibTrk1.Event", &te1);
7292 if ( ctrk->GetEntries() > 0 ){
7293 ctrk->GetEntry(0);
7294 for ( Int_t ii = 0 ; ii<6 ; ii++){
7295 for ( Int_t ij = 0 ; ij<3072 ; ij++){
7296 var.DSPsig_par[ii][ij] = te1->DSPsig_par[ii][ij];
7297 };
7298 };
7299 pamela::CalibTrk2Event *te2 = 0;
7300 ctrk->SetBranchAddress("CalibTrk2.Event", &te2);
7301 ctrk->GetEntry(0);
7302 for ( Int_t ii = 6 ; ii<12 ; ii++){
7303 for ( Int_t ij = 0 ; ij<3072 ; ij++){
7304 var.DSPsig_par[ii][ij] = te2->DSPsig_par[ii-6][ij];
7305 };
7306 };
7307 } else {
7308 for ( Int_t ii = 0 ; ii<12 ; ii++){
7309 for ( Int_t ij = 0 ; ij<3072 ; ij++){
7310 if ( ii > 5 ) var.DSPsig_par[ii][ij] = 8.;
7311 if ( ii < 6 ) var.DSPsig_par[ii][ij] = 3.;
7312 };
7313 };
7314 };
7315 };
7316 ShowTRKL1(i,ttr1,var,pamgui);
7317 };
7318 //
7319 // if everything fails, show at least level0 data
7320 //
7321 if ( TRKLEV == 0 ) ShowTRKL0(i,otr,var);
7322 figure->Modified();
7323 figure->Update();
7324 level.track = TRKLEV;
7325 };
7326 //
7327 // show calorimeter
7328 //
7329 if ( var.CALO ){
7330 figure->cd();
7331 //
7332 // if we have LEVEL1 data
7333 //
7334 if ( CALOLEV == 1 ) ShowCaloL1(i,otr,var);
7335 //
7336 // if we have only LEVEL0 data try to generate event by event LEVEL1 data
7337 //
7338 if ( CALOLEV == 0 ) {
7339 if ( !thefirst ) {
7340 ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var);
7341 } else {
7342 printf("\n\n CALORIMETER: looking for calibration data...\n");
7343 thefirst = 0;
7344 Calo1stcalib(calcalibfile,calib,b);
7345 //
7346 // check calibration
7347 //
7348 Int_t calibex = 0;
7349 Int_t stop = 0;
7350 for (Int_t s=0; s<4;s++){
7351 if ( b[s] > 4 ) b[s] = 0;
7352 stop = 0;
7353 for (Int_t d = 0; d<48; d++){
7354 if ( calib.ttime[s][d] != 0 ) calibex++;
7355 if ( calib.time[s][0] != 0 ){
7356 if ( calib.time[s][d+1] == 0 ) {
7357 if ( !stop ){
7358 stop = 1;
7359 };
7360 };
7361 };
7362 };
7363 };
7364 printf(" ...done! \n\n\n");
7365 if ( calibex < 1 ) {
7366 printf(" No calorimeter calibrations! Switching to raw mode visualitation \n Only COMPRESS and FULL mode acquisition are supported \n\n");
7367 CALOLEV = -1;
7368 } else {
7369 ShowCaloL0(calcalibfile,i,calib,b,mip,otr,var);
7370 };
7371 };
7372 };
7373 //
7374 // if everything fail, show level0 data
7375 //
7376 if ( CALOLEV == -1 ) {
7377 ShowCaloRAW(i,otr,var);
7378 };
7379 if ( var.nosig ){
7380 var.qtot = 0;
7381 var.nstrip = 0;
7382 };
7383 level.calo = CALOLEV;
7384 };
7385 figure->cd();
7386 //
7387 // SHOW INFOS
7388 //
7389 if ( var.INFOS ){
7390 figure->cd();
7391 text->SetTextAngle(0);
7392 text->SetTextFont(32);
7393 text->SetTextColor(1);
7394 text->SetTextSize(0.025); // 0.02
7395 text->SetTextAlign(12);
7396 Float_t txthi = 0.47;
7397 testo.str("");
7398 testo << "File: " << file;
7399 testo << " - Event number: " << (int)headc;
7400 text->DrawLatex(0.33,txthi,testo.str().c_str());
7401 txthi -= 0.03;
7402 testo.str("");
7403 testo << "Progressive number: " << (i+1);
7404 if ( s4pulser ){
7405 testo << " - S4 trigger - ";
7406 };
7407 if ( calotrig ){
7408 testo << " - CALO trigger - ";
7409 };
7410 text->DrawLatex(0.33,txthi,testo.str().c_str());
7411 txthi -= 0.03;
7412 testo2.str("");
7413 testo2 << "On Board Time: " << (int)OBT;
7414 if ( DOBT > 0 ) {
7415 testo2 << " (delta: " << (int)DOBT;
7416 testo2 << ")";
7417 };
7418 testo2 << " [ms]";
7419 text->DrawLatex(0.33,txthi,testo2.str().c_str());
7420 txthi -= 0.03;
7421 text->SetTextSize(0.020); // 0.015
7422 const char *trc2 = trcs;
7423 testo3.str("");
7424 testo3 << "TRIGGER: " << trc2;
7425 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7426 txthi -= 0.03;
7427 testo3.str("");
7428 testo3 << "AC: CARD hit = " << var.hcard;
7429 testo3 << " CAT hit = " << var.hcat;
7430 testo3 << " CAS hit = " << var.hcas;
7431 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7432 txthi -= 0.03;
7433 testo3.str("");
7434 if ( STRACK ){
7435 testo3 << "TRK: RIG = " << setprecision(3) << var.rig;
7436 testo3 << " [GV] CHI2 = " << setprecision(3) << var.chi2;
7437 } else {
7438 testo3 << "TRK: NCLX = "<< var.nclx;
7439 testo3 << " NCLY = "<<var.ncly;
7440 };
7441 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7442 txthi -= 0.03;
7443 testo3.str("");
7444 testo3 << "CALO: NSTRIP = " << var.nstrip;
7445 testo3 << " QTOT = "<<var.qtot << " [MIP]";
7446 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7447 txthi -= 0.03;
7448 testo3.str("");
7449 testo3 << "S4: ";// << setprecision(2);
7450 testo3 << var.s4sig << " [MIP] TOF: #beta(1,...,5) = (";
7451 testo3 << setprecision(3) << var.beta[0];
7452 testo3 << ",";
7453 testo3 << setprecision(3) << var.beta[1];
7454 testo3 << ",";
7455 testo3 << setprecision(3) << var.beta[2];
7456 testo3 << ",";
7457 testo3 << setprecision(3) << var.beta[3];
7458 testo3 << ",";
7459 testo3 << setprecision(3) << var.beta[4];
7460 testo3 << ")";
7461 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7462 txthi -= 0.03;
7463 testo3.str("");
7464 testo3 << "ND: Trig: " << var.trup;
7465 testo3 << " - Bckgr: upper = " << var.bkup;
7466 testo3 << " lower = " << var.bkbo;
7467 text->DrawLatex(0.33,txthi,testo3.str().c_str());
7468 txthi -= 0.03;
7469 text->SetTextSize(0.01);
7470 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.519*var.sfy,"CPU SIDE");
7471 text->SetTextAngle(90);
7472 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE");
7473 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
7474 if ( var.AC ){
7475 text->SetTextAngle(90);
7476 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
7477 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
7478 //
7479 text->SetTextAngle(0);
7480 text->SetTextSize(0.015);
7481 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
7482 elli->Draw();
7483 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
7484 TArrow *arr;
7485 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);
7486 arr->SetArrowSize(0.005);
7487 arr->Draw();
7488 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
7489 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);
7490 arr->SetArrowSize(0.005);
7491 arr->Draw();
7492 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
7493 text->SetTextSize(0.01);
7494 };
7495 //
7496 // coordinates systems and x/y view labels
7497 //
7498 figure->cd();
7499 text->SetTextAngle(0);
7500 text->SetTextFont(32);
7501 text->SetTextColor(1);
7502 text->SetTextAlign(12);
7503 text->SetTextSize(0.01);
7504 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
7505 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
7506 //
7507 text->SetTextSize(0.015);
7508 text->SetTextFont(2);
7509 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
7510 text->SetTextFont(32);
7511 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
7512 TArrow *arr;
7513 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);
7514 arr->SetArrowSize(0.005);
7515 arr->Draw();
7516 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
7517 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);
7518 arr->SetArrowSize(0.005);
7519 arr->Draw();
7520 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
7521 //
7522 text->SetTextSize(0.015);
7523 text->SetTextFont(2);
7524 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
7525 text->SetTextFont(32);
7526 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
7527 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);
7528 arr->SetArrowSize(0.005);
7529 arr->Draw();
7530 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
7531 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);
7532 arr->SetArrowSize(0.005);
7533 arr->Draw();
7534 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
7535 text->SetTextSize(0.01);
7536 //
7537 /* text->SetTextSize(0.015); */
7538 /* text->SetTextFont(2); */
7539 /* DrawX(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,0.005,var); */
7540 /* text->SetTextFont(32); */
7541 /* text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.508*var.sfy,"y"); */
7542 /* TArrow *arr; */
7543 /* arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.19*var.sfx,var.yxvc-0.508*var.sfy); */
7544 /* arr->SetArrowSize(0.005); */
7545 /* arr->Draw(); */
7546 /* text->DrawLatex(var.xxvc-0.19*var.sfx,var.yxvc-0.515*var.sfy,"x"); */
7547 /* arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.23*var.sfx,var.yxvc-0.468*var.sfy); */
7548 /* arr->SetArrowSize(0.005); */
7549 /* arr->Draw(); */
7550 /* text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.468*var.sfy,"z"); */
7551 /* // */
7552 /* text->SetTextSize(0.015); */
7553 /* text->SetTextFont(2); */
7554 /* DrawX(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,0.005,var); */
7555 /* text->SetTextFont(32); */
7556 /* text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.508*var.sfy,"x"); */
7557 /* arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.18*var.sfx,var.yyvc-0.508*var.sfy); */
7558 /* arr->SetArrowSize(0.005); */
7559 /* arr->Draw(); */
7560 /* text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.511*var.sfy,"y"); */
7561 /* arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.22*var.sfx,var.yyvc-0.468*var.sfy); */
7562 /* arr->SetArrowSize(0.005); */
7563 /* arr->Draw(); */
7564 /* text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.468*var.sfy,"z"); */
7565 /* text->SetTextSize(0.01); */
7566 };
7567 //
7568 // SHOW PALETTE
7569 //
7570 if ( var.PALETTE ) ShowPalette(var.bw);
7571 //
7572 // SHOW VERBOSE INFOS
7573 //
7574 if ( var.VINFOS ){
7575 figure->cd();
7576 text->SetTextAngle(0);
7577 text->SetTextFont(32);
7578 text->SetTextColor(1);
7579 text->SetTextSize(0.01);
7580 text->SetTextAlign(12);
7581 if ( var.AC ){
7582 //
7583 // Plane view
7584 //
7585 text->SetTextAngle(90);
7586 text->DrawLatex(var.xcat+0.1*var.sfx,var.ycat-0.015*var.sfy,"CARD4");
7587 text->SetTextAngle(-90);
7588 text->DrawLatex(var.xcat-0.1*var.sfx,var.ycat+0.015*var.sfy,"CARD1");
7589 text->SetTextAngle(0);
7590 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.116*var.sfy,"CARD2");
7591 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.116*var.sfy,"CARD3");
7592 text->SetTextAngle(90);
7593 text->DrawLatex(var.xcat+0.13*var.sfx,var.ycat-0.015*var.sfy,"CAS3");
7594 text->SetTextAngle(-90);
7595 text->DrawLatex(var.xcat-0.13*var.sfx,var.ycat+0.015*var.sfy,"CAS4");
7596 text->SetTextAngle(0);
7597 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.140*var.sfy,"CAS2");
7598 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.140*var.sfy,"CAS1");
7599 text->DrawLatex(var.xcat+0.17*var.sfx,var.ycat,"CAT1");
7600 text->DrawLatex(var.xcat-0.2*var.sfx,var.ycat,"CAT2");
7601 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat-0.198*var.sfy,"CAT3");
7602 text->DrawLatex(var.xcat-0.015*var.sfx,var.ycat+0.198*var.sfy,"CAT4");
7603 //
7604 // X and Y views
7605 //
7606 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc-0.08*var.sfy,"CAS2");
7607 text->DrawLatex(var.xxvc+0.17*var.sfx,var.yxvc-0.08*var.sfy,"CAS1");
7608 text->DrawLatex(var.xyvc-0.192*var.sfx,var.yyvc-0.08*var.sfy,"CAS4");
7609 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.08*var.sfy,"CAS3");
7610 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.48*var.sfy,"CARD2");
7611 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.48*var.sfy,"CARD3");
7612 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.48*var.sfy,"CARD1");
7613 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.48*var.sfy,"CARD4");
7614 text->DrawLatex(var.xxvc-0.192*var.sfx,var.yxvc+0.39*var.sfy,"CAT3");
7615 text->DrawLatex(var.xxvc+0.155*var.sfx,var.yxvc+0.39*var.sfy,"CAT4");
7616 text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2");
7617 text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.39*var.sfy,"CAT1");
7618 };
7619 if ( var.CALO ){
7620 text->SetTextSize(0.020);
7621 text->SetTextAngle(90);
7622 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.290*var.sfy,"Calorimeter");
7623 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.290*var.sfy,"Calorimeter");
7624 text->SetTextSize(0.01);
7625 text->SetTextAngle(0);
7626 };
7627 if ( var.TRK ){
7628 text->SetTextSize(0.020);
7629 text->SetTextAngle(90);
7630 text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc+0.080*var.sfy,"Tracker");
7631 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc+0.080*var.sfy,"Tracker");
7632 text->SetTextSize(0.01);
7633 text->SetTextAngle(0);
7634 };
7635 if ( var.ND ){
7636 text->SetTextSize(0.020);
7637 // text->SetTextAngle(90);
7638 text->DrawLatex(var.xxvc-0.25*var.sfx,var.yxvc-0.530*var.sfy,"ND");
7639 text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.530*var.sfy,"ND");
7640 text->SetTextSize(0.01);
7641 text->SetTextAngle(0);
7642 };
7643 if ( var.TOF ){
7644 text->SetTextSize(0.020);
7645 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.130*var.sfy,"S3");
7646 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.350*var.sfy,"S2");
7647 text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.653*var.sfy,"S1");
7648 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc-0.130*var.sfy,"S3");
7649 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.350*var.sfy,"S2");
7650 text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.653*var.sfy,"S1");
7651 text->SetTextSize(0.01);
7652 };
7653 if ( var.S4 ){
7654 text->SetTextSize(0.020);
7655 text->DrawLatex(var.xxvc-0.28*var.sfx,var.yxvc-0.350*var.sfy,"S4");
7656 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.350*var.sfy,"S4");
7657 text->SetTextSize(0.01);
7658 };
7659 if ( !var.INFOS ){
7660 text->SetTextSize(0.01);
7661 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.520*var.sfy,"CPU SIDE");
7662 text->SetTextAngle(90);
7663 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE");
7664 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE");
7665 if ( var.AC ){
7666 text->SetTextAngle(90);
7667 text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE");
7668 text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE");
7669 //
7670 text->SetTextAngle(0);
7671 text->SetTextSize(0.015);
7672 TEllipse *elli = new TEllipse(var.xcat+0.219*var.sfx,var.ycat-0.249*var.sfy,0.003,0.003);
7673 elli->Draw();
7674 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.261*var.sfy,"z");
7675 TArrow *arr;
7676 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);
7677 arr->SetArrowSize(0.005);
7678 arr->Draw();
7679 text->DrawLatex(var.xcat+0.229*var.sfx,var.ycat-0.21*var.sfy,"x");
7680 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);
7681 arr->SetArrowSize(0.005);
7682 arr->Draw();
7683 text->DrawLatex(var.xcat+0.18*var.sfx,var.ycat-0.261*var.sfy,"y");
7684 text->SetTextSize(0.01);
7685 };
7686 //
7687 // coordinates systems and x/y view labels
7688 //
7689 figure->cd();
7690 text->SetTextAngle(0);
7691 text->SetTextFont(32);
7692 text->SetTextColor(1);
7693 text->SetTextAlign(12);
7694 text->SetTextSize(0.01);
7695 text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc+0.67*var.sfy,"X VIEW");
7696 text->DrawLatex(var.xyvc-0.025*var.sfx,var.yyvc+0.67*var.sfy,"Y VIEW");
7697 //
7698 text->SetTextSize(0.015);
7699 text->SetTextFont(2);
7700 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508
7701 text->SetTextFont(32);
7702 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y");
7703 TArrow *arr;
7704 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);
7705 arr->SetArrowSize(0.005);
7706 arr->Draw();
7707 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x");
7708 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);
7709 arr->SetArrowSize(0.005);
7710 arr->Draw();
7711 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z");
7712 //
7713 text->SetTextSize(0.015);
7714 text->SetTextFont(2);
7715 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var);
7716 text->SetTextFont(32);
7717 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x");
7718 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);
7719 arr->SetArrowSize(0.005);
7720 arr->Draw();
7721 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y");
7722 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);
7723 arr->SetArrowSize(0.005);
7724 arr->Draw();
7725 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");
7726 text->SetTextSize(0.01);
7727 };
7728 };
7729 //
7730 // update figure
7731 //
7732 figure->Modified();
7733 figure->Update();
7734 figure->cd();
7735 figure->SetEditable(kFALSE);
7736 //
7737 // print infos on terminal
7738 //
7739 printf(" File: %s \n",name);
7740 if ( !s4pulser && !calotrig ){
7741 printf(" Event number: %i - Progressive number: %i \n",(int)headc,i+1);
7742 };
7743 if ( s4pulser ){
7744 printf(" Event number: %i - Progressive number: %i - S4 trigger -\n",(int)headc,i+1);
7745 };
7746 if ( calotrig ){
7747 printf(" Event number: %i - Progressive number: %i - CALO trigger -\n",(int)headc,i+1);
7748 };
7749 printf(" On Board Time: %i (delta %i) [ms]\n",OBT,DOBT);
7750 const char *trc2 = trcs;
7751 printf(" TRIGGER: %s \n",trc2);
7752 printf(" AC: CARD hit = %i CAT hit = %i CAS hit = %i \n",var.hcard,var.hcat,var.hcas);
7753 if ( STRACK ){
7754 printf(" TRK: NCLX = %i NCLY = %i RIG = %f [GV] CHI2 = %f \n",var.nclx,var.ncly,var.rig,var.chi2);
7755 } else {
7756 printf(" TRK: NCLX = %i NCLY = %i \n ",var.nclx,var.ncly);
7757 };
7758 printf(" CALO: NSTRIP = %i QTOT = %i [MIP]\n",var.nstrip,var.qtot);
7759 printf(" S4: %.2f [MIP] TOF: beta(1,...,5) = (%.2f,%.2f,%.2f,%.2f,%.2f) \n",var.s4sig,var.beta[0],var.beta[1],var.beta[2],var.beta[3],var.beta[4]);
7760 printf(" ND: Trigger: neutrons = %i - Background: upper = %i lower = %i \n",var.trup,var.bkup,var.bkbo);
7761 //
7762 // Interact with user: do you want to continue, go backward, exit or print the figure?
7763 //
7764 printf("\n\n\n\n\n\n\n\n\n\n");
7765 si = i;
7766 doflag = 1;
7767 jumpto = 0;
7768 var.i = i;
7769 var.doflag = doflag;
7770 var.jumpto = jumpto;
7771 var.nevents = nevents;
7772 var.lastevno = lastevno;
7773 var.firstevno = firstevno;
7774 //
7775 char *bw;
7776 if ( var.bw ){
7777 bw = "_bw";
7778 } else {
7779 bw = "";
7780 };
7781 TString filenm = file;
7782 const string fil = (const char*)filenm;
7783 Int_t posiz = fil.find("dw_");
7784 if ( posiz == -1 ) posiz = fil.find("DW_");
7785 Int_t posiz2 = posiz+13;
7786 TString file2;
7787 stringcopy(file2,filenm,posiz,posiz2);
7788 const char *figrec = file2;
7789 const char *outdir = outDir;
7790 stringstream figsave;
7791 figsave.str("");
7792 figsave << outdir << "/";
7793 figsave << figrec;
7794 figsave << "_ev_";
7795 figsave << (var.i+1);
7796 figsave << bw;
7797 var.svas=figsave.str().c_str();
7798 pamgui->upgrnamfi();
7799 //
7800 var.jumpen = false;
7801 // njumpen = 0;
7802 Int_t ifout = 0;
7803 while( !var.goon && !var.refresh && !var.restart ) {
7804 if ( !gROOT->GetListOfCanvases()->FindObject(figure) ) {
7805 pamgui->Close();
7806 gSystem->ProcessEvents();
7807 gApplication->Terminate(0);
7808 };
7809 gSystem->ProcessEvents();
7810 gSystem->Sleep(10);
7811 };
7812 var.goon = false;
7813 if ( var.refresh || var.restart ){
7814 headerFile->Close();
7815 triggerFile->Close();
7816 if ( trackerFile ) trackerFile->Close();
7817 if ( trackerFile2 ) trackerFile2->Close();
7818 if ( caloFile )caloFile->Close();
7819 if ( neutronFile ) neutronFile->Close();
7820 if ( acFile ) acFile->Close();
7821 if ( tofFile ) tofFile->Close();
7822 if ( tofFileL1 ) tofFileL1->Close();
7823 if ( s4File ) s4File->Close();
7824 if ( trackhead ) trackhead->Close();
7825 if ( trackcalibFile1 ) trackcalibFile1->Close();
7826 if ( trackcalibFile2 ) trackcalibFile2->Close();
7827 if ( trackerFile2b ) trackerFile2b->Close();
7828 if ( var.refresh ) goto refresh;
7829 if ( var.restart ){
7830 filename = var.thefilename.Data();
7831 pamgui->Close();
7832 goto restart;
7833 };
7834 };
7835 //
7836 i = var.i;
7837 doflag = var.doflag;
7838 jumpto = var.jumpto;
7839 if ( i != si ) OOBT = 1000000000;
7840 if ( maxevent < i ) {
7841 maxevent = nevents;
7842 printf("WARNING: you have chosen an event number out of the starting range.\n Range extended to %i\n\n",maxevent);
7843 };
7844 if ( ifout ) goto theend;
7845 };
7846 if ( doflag == 2 && i == 0 ) {
7847 printf("\n WARNING: Cannot go backward! Going forward. \n");
7848 doflag = 1;
7849 };
7850 if ( doflag == 2 && i>0 ) i--;
7851 if ( doflag == 1 ) i++;
7852 if ( var.doflag == 3 ) selection = 0;
7853 //
7854 // if in selection mode, print out a event progress bar:
7855 //
7856 if ( !selection || i == minevent ){
7857 // do nothing
7858 } else {
7859 if ( (maxevent-minevent) != 0 ){
7860 if((100*(i-minevent)/(maxevent-minevent))<10.){
7861 printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8);
7862 } else {
7863 printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8);
7864 };
7865 };
7866 };
7867
7868 };
7869 //
7870 // END OF THE MAIN LOOP AND OF THE MAIN PROGRAM
7871 //
7872 printf("\n");
7873 theend: if ( !ifout ) printf("\nFinished, exiting... \n\n");
7874 #if defined (__CINT__)
7875 gSystem->ChangeDirectory(path);
7876 if ( trackdone2 ){
7877 unload1();
7878 };
7879 if ( trackdone1 ){
7880 unload2();
7881 };
7882 #endif
7883 printf(" ...done! \n\n");
7884 return;
7885 }

  ViewVC Help
Powered by ViewVC 1.1.23