1 | // $Id: ESimuEventViewer.cc 2924 2011-06-12 20:22:13Z mabl $ |
---|
2 | // Author: Alessandro Thea 2005/05/31 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: ESimuEventViewer * |
---|
8 | * Package: <packagename> * |
---|
9 | * Coordinator: <coordinator> * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | //_____________________________________________________________________________ |
---|
14 | // |
---|
15 | // ESimuEventViewer |
---|
16 | // |
---|
17 | // <extensive class description> |
---|
18 | // |
---|
19 | // Config file parameters |
---|
20 | // ====================== |
---|
21 | // |
---|
22 | // <parameter name>: <parameter description> |
---|
23 | // -Valid options: <available options> |
---|
24 | // |
---|
25 | |
---|
26 | #include <iostream> |
---|
27 | |
---|
28 | #include "ESimuEventViewer.hh" |
---|
29 | #include "EShowerPainter.hh" |
---|
30 | #include "EShowerHistoPainter.hh" |
---|
31 | #include "EAtmosphereHistoPainter.hh" |
---|
32 | #include "ESinglePhotonsPainter.hh" |
---|
33 | #include "EFocalSurfacePainter.hh" |
---|
34 | #include "EFocalSurface3DPainter.hh" |
---|
35 | #include "ETriggerPainter.hh" |
---|
36 | #include "EDetectorHistoPainter.hh" |
---|
37 | #include "EDetectorPhotonsPainter.hh" |
---|
38 | #include "EOpticsPhotonsPainter.hh" |
---|
39 | #include "Etypes.hh" |
---|
40 | #include "EEvent.hh" |
---|
41 | #include "ERunParameters.hh" |
---|
42 | #include "ETruth.hh" |
---|
43 | #include "EDetStatus.hh" |
---|
44 | #include "EGeometry.hh" |
---|
45 | #include "ESystemOfUnits.hh" |
---|
46 | #include "EShower.hh" |
---|
47 | #include "EAtmosphere.hh" |
---|
48 | #include <TCanvas.h> |
---|
49 | #include <TCut.h> |
---|
50 | #include <TEventList.h> |
---|
51 | #include <TFile.h> |
---|
52 | #include <TG3DLine.h> |
---|
53 | #include <TGButton.h> |
---|
54 | #include <TGComboBox.h> |
---|
55 | #include <TGDockableFrame.h> |
---|
56 | #include <TGFileDialog.h> |
---|
57 | #include <TGLabel.h> |
---|
58 | #include <TGString.h> |
---|
59 | #include <TGTextBuffer.h> |
---|
60 | #include <TGTextEntry.h> |
---|
61 | #include <TH1.h> |
---|
62 | #include <TTree.h> |
---|
63 | #include <TEllipse.h> |
---|
64 | #include <TMarker.h> |
---|
65 | #include <TLegend.h> |
---|
66 | #include "KeySymbols.h" |
---|
67 | |
---|
68 | using namespace std; |
---|
69 | |
---|
70 | ClassImp(ESimuEventViewer) |
---|
71 | |
---|
72 | enum ESimyEventViewerCommands{ |
---|
73 | |
---|
74 | kCheckPainter1, |
---|
75 | kCheckPainter2, |
---|
76 | kCheckPainter3, |
---|
77 | kCheckPainter4, |
---|
78 | kCheckPainter5, |
---|
79 | kCheckPainter6, |
---|
80 | |
---|
81 | kButtonNextEvent, |
---|
82 | kButtonPrevEvent, |
---|
83 | kButtonApplyCut, |
---|
84 | |
---|
85 | kComboNevents=999999 |
---|
86 | |
---|
87 | }; |
---|
88 | |
---|
89 | //using namespace sou; |
---|
90 | using namespace TMath; |
---|
91 | using namespace sou; |
---|
92 | |
---|
93 | const Float_t kHdetector = 420*km; |
---|
94 | const Float_t kFoV = 30*deg; |
---|
95 | |
---|
96 | //_____________________________________________________________________________ |
---|
97 | ESimuEventViewer::ESimuEventViewer( const char* name=0 ) : EGViewer(kTRUE, "ESimuViewer") { |
---|
98 | // |
---|
99 | // Constructor |
---|
100 | // |
---|
101 | CreateViewer(); |
---|
102 | MapWindow(); |
---|
103 | |
---|
104 | fShowerPainter = 0; |
---|
105 | fShowerHistoPainter = 0; |
---|
106 | fAtmosphereHistoPainter = 0; |
---|
107 | fSinglePhotonsPainter = 0; |
---|
108 | fFocalSurfacePainter = 0; |
---|
109 | fFocalSurface3DPainter = 0; |
---|
110 | fTriggerPainter = 0; |
---|
111 | fFocalSurfaceHistoPainter = 0; |
---|
112 | fDetectorPhotonsPainter = 0; |
---|
113 | fOpticsPhotonsPainter = 0; |
---|
114 | |
---|
115 | fEventList = 0; |
---|
116 | fEvTree = 0; |
---|
117 | fEvent = 0; |
---|
118 | fTruth = 0; |
---|
119 | fRunPars = 0; |
---|
120 | |
---|
121 | fCurrentEventId = -1; |
---|
122 | fCurrentEvent = -1; |
---|
123 | fForceLoading = kTRUE; |
---|
124 | |
---|
125 | //FIXME |
---|
126 | //Custom style would be better |
---|
127 | // |
---|
128 | gStyle->SetOptStat(0); |
---|
129 | // gStyle->SetOptTitle(0); |
---|
130 | gStyle->SetTitleFont(72,""); |
---|
131 | gStyle->SetTitleFontSize(0.045); |
---|
132 | gStyle->SetPadTopMargin(0.09); |
---|
133 | gStyle->SetPadBottomMargin(0.09); |
---|
134 | gStyle->SetPadLeftMargin(0.09); |
---|
135 | gStyle->SetPadRightMargin(0.09); |
---|
136 | gStyle->SetPadBorderMode(0); |
---|
137 | |
---|
138 | |
---|
139 | if ( !(name && !Open(name)) || !OpenDialog() ) |
---|
140 | return; |
---|
141 | } |
---|
142 | |
---|
143 | //_____________________________________________________________________________ |
---|
144 | ESimuEventViewer::~ESimuEventViewer() { |
---|
145 | // |
---|
146 | // Destructor |
---|
147 | // |
---|
148 | |
---|
149 | ClearPainters(); |
---|
150 | SafeDelete(fEvent); |
---|
151 | SafeDelete(fEvTree); |
---|
152 | } |
---|
153 | |
---|
154 | //______________________________________________________________________________ |
---|
155 | void ESimuEventViewer::DoError(int level, const char *location, const char *fmt, va_list va) const |
---|
156 | { |
---|
157 | // Interface to ErrorHandler (protected). |
---|
158 | |
---|
159 | SetStatusText(Form(fmt,va),0); |
---|
160 | ::ErrorHandler(level, Form("%s::%s", ClassName(), location), fmt, va); |
---|
161 | } |
---|
162 | |
---|
163 | |
---|
164 | //______________________________________________________________________________ |
---|
165 | void ESimuEventViewer::CreateViewer() { |
---|
166 | // |
---|
167 | // Update the user frame and remap the window |
---|
168 | // |
---|
169 | |
---|
170 | // save current width and height |
---|
171 | UInt_t w = GetWidth(); |
---|
172 | UInt_t h = GetHeight(); |
---|
173 | |
---|
174 | gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n), |
---|
175 | kKeyControlMask, kTRUE); |
---|
176 | gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_p), |
---|
177 | kKeyControlMask, kTRUE); |
---|
178 | |
---|
179 | AddUserFrame(); |
---|
180 | // Layout(); |
---|
181 | MapSubwindows(); |
---|
182 | |
---|
183 | ShowTabList(kFALSE); |
---|
184 | ShowEditor(kFALSE); |
---|
185 | |
---|
186 | // reset the windows size to the correct value. |
---|
187 | Resize(w,h); |
---|
188 | } |
---|
189 | |
---|
190 | //______________________________________________________________________________ |
---|
191 | void ESimuEventViewer::ApplyBarCut() { |
---|
192 | // |
---|
193 | // |
---|
194 | // |
---|
195 | |
---|
196 | ApplyCut(fEventCut->GetText()); |
---|
197 | } |
---|
198 | |
---|
199 | //______________________________________________________________________________ |
---|
200 | void ESimuEventViewer::ApplyCut( const char* selection ) { |
---|
201 | // |
---|
202 | // |
---|
203 | // |
---|
204 | |
---|
205 | UpdateEventList(selection); |
---|
206 | fEventCut->SetText(selection); |
---|
207 | |
---|
208 | if ( LoadEvent() ) |
---|
209 | UpdateTabs(); |
---|
210 | |
---|
211 | } |
---|
212 | //______________________________________________________________________________ |
---|
213 | void ESimuEventViewer::ApplyCut( const TCut& selection ) { |
---|
214 | // |
---|
215 | // |
---|
216 | // |
---|
217 | |
---|
218 | ApplyCut(selection.GetTitle()); |
---|
219 | } |
---|
220 | |
---|
221 | //______________________________________________________________________________ |
---|
222 | const char* ESimuEventViewer::GetCut() const { |
---|
223 | // |
---|
224 | // |
---|
225 | // |
---|
226 | return fEventCut->GetText(); |
---|
227 | } |
---|
228 | |
---|
229 | //______________________________________________________________________________ |
---|
230 | void ESimuEventViewer::UpdateEventList( const TCut& selection ) { |
---|
231 | // |
---|
232 | // Update the eventlist according the cut |
---|
233 | // |
---|
234 | |
---|
235 | UpdateEventList( selection.GetTitle() ); |
---|
236 | } |
---|
237 | |
---|
238 | //______________________________________________________________________________ |
---|
239 | void ESimuEventViewer::UpdateEventList( const char* selection ) { |
---|
240 | // |
---|
241 | // Update the eventlist according the cut |
---|
242 | // |
---|
243 | |
---|
244 | if ( !fEvTree ) return; |
---|
245 | |
---|
246 | if ( !fEventList ) fEventList = new TEventList("simuEventList"); |
---|
247 | |
---|
248 | fEvTree->Draw(">>simuEventList",selection); |
---|
249 | |
---|
250 | fEventCombo->RemoveEntries(0,fEventCombo->GetNumberOfEntries()-1); |
---|
251 | for (Int_t i(0); i<fEventList->GetN(); i++) |
---|
252 | fEventCombo->AddEntry(Form("%lld",fEventList->GetEntry(i)),i); |
---|
253 | |
---|
254 | |
---|
255 | fForceLoading = kTRUE; |
---|
256 | } |
---|
257 | |
---|
258 | //______________________________________________________________________________ |
---|
259 | void ESimuEventViewer::AddUserFrame() { |
---|
260 | // |
---|
261 | // Add the Event toolbar |
---|
262 | // |
---|
263 | TGLabel* label; |
---|
264 | |
---|
265 | fEventBar = new TGDockableFrame( fUserFrame, -1, kHorizontalFrame ); |
---|
266 | fEventBar->Connect("Docked()","ESimuEventViewer",this,"Layout()"); |
---|
267 | fEventBar->Connect("Undocked()","ESimuEventViewer",this,"Layout()"); |
---|
268 | fEventBar->EnableHide(kFALSE); |
---|
269 | // fList->Add(fEventBar); FIXME: WHY??!?!? |
---|
270 | TGLayoutHints* lay = new TGLayoutHints(kLHintsExpandX ,0,0,1,0); |
---|
271 | fList->Add(lay); |
---|
272 | |
---|
273 | // |
---|
274 | // Radio Buttons |
---|
275 | // |
---|
276 | // TGLayoutHints* laygh = new TGLayoutHints(kLHintsNormal | kLHintsExpandX,0,0,0,0); |
---|
277 | // fList->Add(laygh); |
---|
278 | // |
---|
279 | // TGGroupFrame* gh = new TGGroupFrame(fEventBar,"Active Painters",kHorizontalFrame); |
---|
280 | // fList->Add(gh); |
---|
281 | // |
---|
282 | // gh->SetLayoutManager(new TGMatrixLayout(gh, 0, 2, 10)); |
---|
283 | // |
---|
284 | // TGCheckButton* radio = new TGCheckButton(gh,"FocalSurface",kCheckPainter1); |
---|
285 | // radio->SetState(kButtonDown); |
---|
286 | // gh->AddFrame(radio); |
---|
287 | // fList->Add(radio); |
---|
288 | // |
---|
289 | // radio = new TGCheckButton(gh,"FocalSurface3D",kCheckPainter2); |
---|
290 | // radio->SetState(kButtonDown); |
---|
291 | // gh->AddFrame(radio); |
---|
292 | // fList->Add(radio); |
---|
293 | // |
---|
294 | // radio = new TGCheckButton(gh,"SignalNoiseProfile",kCheckPainter4); |
---|
295 | // radio->SetState(kButtonDown); |
---|
296 | // gh->AddFrame(radio); |
---|
297 | // fList->Add(radio); |
---|
298 | // |
---|
299 | // radio = new TGCheckButton(gh,"Histos",kCheckPainter4); |
---|
300 | // radio->SetState(kButtonDown); |
---|
301 | // gh->AddFrame(radio); |
---|
302 | // fList->Add(radio); |
---|
303 | // |
---|
304 | // gh->Resize(); |
---|
305 | // |
---|
306 | // fEventBar->AddFrame(gh,laygh); |
---|
307 | // |
---|
308 | // First horizontal frame |
---|
309 | // |
---|
310 | |
---|
311 | TGLayoutHints* layh = new TGLayoutHints(kLHintsNormal | kLHintsExpandX ); |
---|
312 | fList->Add(layh); |
---|
313 | |
---|
314 | TGHorizontalFrame* h = new TGHorizontalFrame(fEventBar); |
---|
315 | fList->Add(h); |
---|
316 | |
---|
317 | // |
---|
318 | // buttons |
---|
319 | // |
---|
320 | |
---|
321 | TGTextButton* b; |
---|
322 | TGLayoutHints* layb; |
---|
323 | |
---|
324 | layb = new TGLayoutHints(kLHintsNormal ,2,2,3,2); |
---|
325 | fList->Add(layb); |
---|
326 | |
---|
327 | b = new TGTextButton(h, " Prev ", kButtonPrevEvent); |
---|
328 | b->Associate(this); |
---|
329 | b->SetToolTipText("Previous Event"); |
---|
330 | fList->Add(b); |
---|
331 | |
---|
332 | h->AddFrame(b,layb); |
---|
333 | |
---|
334 | b = new TGTextButton(h, " Next ", kButtonNextEvent); |
---|
335 | b->Associate(this); |
---|
336 | b->SetToolTipText("Next Event"); |
---|
337 | fList->Add(b); |
---|
338 | |
---|
339 | layb = new TGLayoutHints(kLHintsNormal ,2,4,3,2); |
---|
340 | fList->Add(layb); |
---|
341 | |
---|
342 | h->AddFrame(b,layb); |
---|
343 | |
---|
344 | label = new TGLabel(h,"Event"); |
---|
345 | fList->Add(label); |
---|
346 | |
---|
347 | TGLayoutHints* laylbl = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 4, 2, 2); |
---|
348 | fList->Add(laylbl); |
---|
349 | |
---|
350 | h->AddFrame(label, laylbl); |
---|
351 | |
---|
352 | // |
---|
353 | // Event combo |
---|
354 | // |
---|
355 | TGLayoutHints* laycombo = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 4, 4, 2, 2); |
---|
356 | fList->Add(laycombo); |
---|
357 | fEventCombo = new TGComboBox(h, kComboNevents); |
---|
358 | fEventCombo->Associate(this); |
---|
359 | |
---|
360 | h->AddFrame(fEventCombo, laycombo); |
---|
361 | |
---|
362 | fList->Add(fEventCombo); |
---|
363 | |
---|
364 | fEventCombo->Resize(50,20); |
---|
365 | |
---|
366 | fEventBar->AddFrame(h,layh); |
---|
367 | |
---|
368 | // |
---|
369 | // second horizontal frame |
---|
370 | // |
---|
371 | h = new TGHorizontalFrame(fEventBar); |
---|
372 | fList->Add(h); |
---|
373 | |
---|
374 | // |
---|
375 | // Cuts |
---|
376 | // |
---|
377 | label = new TGLabel(h,"Cut"); |
---|
378 | fList->Add(label); |
---|
379 | |
---|
380 | h->AddFrame(label, laylbl); |
---|
381 | |
---|
382 | fEventCut = new TGTextEntry(h, new TGTextBuffer(15),-1); |
---|
383 | h->AddFrame(fEventCut, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,5,5,5,5)); |
---|
384 | fList->Add(fEventCut); |
---|
385 | |
---|
386 | fEventCut->SetMaxLength(255); |
---|
387 | fEventCut->SetAlignment(kTextLeft); |
---|
388 | fEventCut->SetText(""); |
---|
389 | fEventCut->Resize(220,fEventCut->GetDefaultHeight()); |
---|
390 | fEventCut->Resize(300,20); |
---|
391 | fEventCut->Connect("ReturnPressed()","ESimuEventViewer",this,"ApplyBarCut()"); |
---|
392 | |
---|
393 | b = new TGTextButton(h, " Apply ", kButtonApplyCut); |
---|
394 | b->Associate(this); |
---|
395 | b->SetToolTipText("Apply Cut"); |
---|
396 | fList->Add(b); |
---|
397 | |
---|
398 | layb = new TGLayoutHints(kLHintsNormal ,2,4,3,2); |
---|
399 | |
---|
400 | fList->Add(layb); |
---|
401 | |
---|
402 | h->AddFrame(b,layb); |
---|
403 | fEventBar->AddFrame(h,layh); |
---|
404 | |
---|
405 | // |
---|
406 | // Line3D |
---|
407 | // |
---|
408 | fUserFrame->AddFrame(fEventBar,lay); |
---|
409 | |
---|
410 | TGLayoutHints *lay3D = new TGLayoutHints(kLHintsExpandX); |
---|
411 | fList->Add(lay3D); |
---|
412 | |
---|
413 | TGHorizontal3DLine *line = new TGHorizontal3DLine(fUserFrame); |
---|
414 | fList->Add(line); |
---|
415 | |
---|
416 | fUserFrame->AddFrame(line, lay3D); |
---|
417 | |
---|
418 | fUserFrame->Layout(); |
---|
419 | fUserFrame->MapSubwindows(); |
---|
420 | |
---|
421 | // fEventBar->EnableUndock(kFALSE); |
---|
422 | |
---|
423 | } |
---|
424 | |
---|
425 | //______________________________________________________________________________ |
---|
426 | Bool_t ESimuEventViewer::Open( const char* name ) { |
---|
427 | |
---|
428 | if (!name) |
---|
429 | return kFALSE; |
---|
430 | |
---|
431 | TFile *f = new TFile(name); |
---|
432 | if ( f->IsZombie() ) { |
---|
433 | delete f; |
---|
434 | Printf("Unable to open %s",name); |
---|
435 | |
---|
436 | return kFALSE; |
---|
437 | } |
---|
438 | |
---|
439 | Printf("%s successfully opened.", name); |
---|
440 | |
---|
441 | TTree *etree = (TTree*)gDirectory->Get("etree"); |
---|
442 | if ( !etree ) { |
---|
443 | Printf("etree not found"); |
---|
444 | return kFALSE; |
---|
445 | } |
---|
446 | |
---|
447 | fEvTree = etree; |
---|
448 | |
---|
449 | Printf("etree found with %d events stored.", (Int_t)fEvTree->GetEntries()); |
---|
450 | |
---|
451 | Int_t n = fEventCombo->GetNumberOfEntries(); |
---|
452 | if ( n != 0 ) |
---|
453 | fEventCombo->RemoveEntries(0,n-1); |
---|
454 | |
---|
455 | cout << "UpdateEventList" << endl; |
---|
456 | UpdateEventList(); |
---|
457 | |
---|
458 | cout << "LoadEvent" << endl; |
---|
459 | if ( LoadEvent() ) { |
---|
460 | UpdateTabs(); |
---|
461 | } |
---|
462 | |
---|
463 | return kTRUE; |
---|
464 | } |
---|
465 | |
---|
466 | //______________________________________________________________________________ |
---|
467 | Bool_t ESimuEventViewer::OpenDialog() { |
---|
468 | // |
---|
469 | // |
---|
470 | // |
---|
471 | |
---|
472 | if ( fEvent ) { |
---|
473 | delete fEvent; |
---|
474 | fEvent = 0; |
---|
475 | } |
---|
476 | |
---|
477 | TGFileInfo* info = new TGFileInfo(); |
---|
478 | |
---|
479 | new TGFileDialog(gClient->GetRoot(), 0, kFDOpen, info); |
---|
480 | if ( info->fFilename ) |
---|
481 | return Open( info->fFilename ); |
---|
482 | |
---|
483 | return kFALSE; |
---|
484 | } |
---|
485 | |
---|
486 | //______________________________________________________________________________ |
---|
487 | Bool_t ESimuEventViewer::LoadEvent( Int_t i ) { |
---|
488 | |
---|
489 | if (!fEvTree) { |
---|
490 | Info("LoadEvent","fEvTree not defined."); |
---|
491 | return kFALSE; |
---|
492 | } |
---|
493 | |
---|
494 | if ( i >= fEventList->GetN() ) { |
---|
495 | Info("LoadEvent","Entry id %d is greater than the maximum number of selected events (%d)", |
---|
496 | i,fEventList->GetN()); |
---|
497 | return kFALSE; |
---|
498 | } |
---|
499 | |
---|
500 | if ( !fEvent ) { |
---|
501 | fEvent = new EEvent; |
---|
502 | fEvent->SetBranches(fEvTree, kTRUE); |
---|
503 | } |
---|
504 | |
---|
505 | Long64_t entry = fEventList->GetEntry(i); |
---|
506 | |
---|
507 | if ( fCurrentEvent == entry && !fForceLoading ) |
---|
508 | return kFALSE; |
---|
509 | |
---|
510 | fRunPars = fEvent->GetRunPars(); |
---|
511 | |
---|
512 | ClearPainters(); |
---|
513 | |
---|
514 | Printf("Entry %lld, %d bytes read",entry, fEvTree->GetEntry(entry)); |
---|
515 | |
---|
516 | BuildPainters(); |
---|
517 | |
---|
518 | fCurrentEventId = i; |
---|
519 | |
---|
520 | fEventCombo->Select(fCurrentEventId); |
---|
521 | fCurrentEvent = entry; |
---|
522 | |
---|
523 | fForceLoading = kFALSE; |
---|
524 | return kTRUE; |
---|
525 | } |
---|
526 | |
---|
527 | //______________________________________________________________________________ |
---|
528 | void ESimuEventViewer::BuildPainters() { |
---|
529 | |
---|
530 | //EAtmosphere *atmosphere = fEvent->GetAtmosphere(); |
---|
531 | EShower *shower = fEvent->GetShower(); |
---|
532 | EDetector *detector = fEvent->GetDetector(); |
---|
533 | // EChipTrackTrigger *trigger = fEvent->GetChipTrackTrigger(); |
---|
534 | ERunParameters *runpars = fEvent->GetRunPars(); |
---|
535 | fTruth = fEvent->GetTruth(); |
---|
536 | EGeometry *det_geo; |
---|
537 | |
---|
538 | // Double_t gtulength = runpars->GetPmtData().GetGtuLength(); |
---|
539 | if (!fEvent->GetGeometry()) { |
---|
540 | EGeometry *det_geo1 = new EGeometry(); |
---|
541 | det_geo1->SetPos(TVector3(0.,0.,430.*km)); |
---|
542 | det_geo1->SetRadius(1250.*mm); |
---|
543 | det_geo = (EGeometry*)det_geo1; |
---|
544 | } else { |
---|
545 | det_geo = (EGeometry*)fEvent->GetGeometry(); |
---|
546 | } |
---|
547 | |
---|
548 | |
---|
549 | Info("BuildPainters","Building painters"); |
---|
550 | if(shower && shower->GetNumSteps() > 0 && det_geo && detector) { |
---|
551 | fShowerPainter = new EShowerPainter( shower ); |
---|
552 | fShowerHistoPainter = new EShowerHistoPainter( shower, det_geo, detector ); |
---|
553 | } |
---|
554 | // if(atmosphere && atmosphere->GetNumBunches() > 0 ) |
---|
555 | // fAtmosphereHistoPainter = new EAtmosphereHistoPainter( atmosphere, det_geo, gtulength, fTruth, shower ); |
---|
556 | // if(atmosphere && atmosphere->GetNumSingles() > 1) |
---|
557 | // fSinglePhotonsPainter = new ESinglePhotonsPainter( atmosphere ); |
---|
558 | if(detector) { |
---|
559 | fFocalSurfacePainter = new EFocalSurfacePainter( detector, runpars ); |
---|
560 | fFocalSurface3DPainter = new EFocalSurface3DPainter( detector, runpars ); |
---|
561 | } |
---|
562 | if(detector && detector->GetNumPhotons() ) { |
---|
563 | // fDetectorPhotonsPainter = new EDetectorPhotonsPainter( detector ); |
---|
564 | // fOpticsPhotonsPainter = new EOpticsPhotonsPainter( detector ); |
---|
565 | fFocalSurfaceHistoPainter = new EDetectorHistoPainter( detector, runpars ); |
---|
566 | } |
---|
567 | // if(detector && trigger) |
---|
568 | // fTriggerPainter = new ETriggerPainter( detector, runpars, trigger); |
---|
569 | } |
---|
570 | |
---|
571 | //______________________________________________________________________________ |
---|
572 | void ESimuEventViewer::ClearPainters() { |
---|
573 | |
---|
574 | Printf("Clearing painters"); |
---|
575 | SafeDelete(fShowerPainter); |
---|
576 | SafeDelete(fShowerHistoPainter); |
---|
577 | SafeDelete(fAtmosphereHistoPainter); |
---|
578 | SafeDelete(fSinglePhotonsPainter); |
---|
579 | SafeDelete(fDetectorPhotonsPainter); |
---|
580 | SafeDelete(fOpticsPhotonsPainter); |
---|
581 | SafeDelete(fFocalSurfacePainter); |
---|
582 | SafeDelete(fFocalSurface3DPainter); |
---|
583 | SafeDelete(fFocalSurfaceHistoPainter); |
---|
584 | SafeDelete(fTriggerPainter); |
---|
585 | fTruth = 0; // NOT delete, it belongs to the tree. |
---|
586 | |
---|
587 | //RemoveTabs(); |
---|
588 | } |
---|
589 | |
---|
590 | |
---|
591 | //______________________________________________________________________________ |
---|
592 | void ESimuEventViewer::UpdateTabs() { |
---|
593 | // |
---|
594 | // Refresh canvases |
---|
595 | // |
---|
596 | TCanvas* c; |
---|
597 | if ( fTruth && !(fTruth->IsZombie()) ) { |
---|
598 | c = FindAddTab("Summary"); |
---|
599 | c->Clear(); |
---|
600 | c->cd(); |
---|
601 | DrawTruth(); |
---|
602 | c->Modified(); |
---|
603 | c->Update(); |
---|
604 | } else { |
---|
605 | RemoveTab("Summary"); |
---|
606 | } |
---|
607 | |
---|
608 | if ( kFALSE && fShowerPainter && !(fShowerPainter->IsZombie()) ) { |
---|
609 | c = FindAddTab("Shower"); |
---|
610 | c->Clear(); |
---|
611 | c->cd(); |
---|
612 | c->Divide(3); |
---|
613 | TVirtualPad* c1 = c->cd(1); |
---|
614 | c1->SetPad(0.,0.,0.75,1); |
---|
615 | fShowerPainter->Draw(); |
---|
616 | gPad->Modified(); |
---|
617 | gPad->Update(); |
---|
618 | |
---|
619 | TVirtualPad* c2 = c->cd(2); |
---|
620 | c2->SetPad(0.75,0.,1.,0.5); |
---|
621 | fShowerPainter->DrawXY(); |
---|
622 | gPad->Modified(); |
---|
623 | gPad->Update(); |
---|
624 | |
---|
625 | TVirtualPad* c3 = c->cd(3); |
---|
626 | c3->SetPad(0.75,0.5,1.,1.); |
---|
627 | fShowerPainter->DrawXYZ(); |
---|
628 | gPad->Modified(); |
---|
629 | gPad->Update(); |
---|
630 | |
---|
631 | } else { |
---|
632 | RemoveTab("Shower"); |
---|
633 | } |
---|
634 | |
---|
635 | if ( fFocalSurfacePainter && !(fFocalSurfacePainter->IsZombie()) ){ |
---|
636 | |
---|
637 | c = FindAddTab("FocalSurface"); |
---|
638 | c->Clear(); |
---|
639 | c->Divide(6); |
---|
640 | |
---|
641 | TVirtualPad* c1 = c->cd(1); |
---|
642 | c1->SetPad(0.,0.,0.75,1); |
---|
643 | fFocalSurfacePainter->Draw(); |
---|
644 | |
---|
645 | gPad->Modified(); |
---|
646 | gPad->Update(); |
---|
647 | |
---|
648 | gPad->Modified(); |
---|
649 | gPad->Update(); |
---|
650 | |
---|
651 | TVirtualPad* c2 = c->cd(2); |
---|
652 | |
---|
653 | |
---|
654 | c2->SetPad(0.75,0.75,1,1); |
---|
655 | c2->SetTopMargin(0.05); |
---|
656 | c2->SetBottomMargin(0.15); |
---|
657 | c2->SetLeftMargin(0.15); |
---|
658 | c2->SetRightMargin(0.05); |
---|
659 | |
---|
660 | |
---|
661 | TH1F* hits = fFocalSurfacePainter->GetHitsHist(); |
---|
662 | TStyle* sty = new TStyle; |
---|
663 | sty->SetHistLineWidth(2); |
---|
664 | sty->SetHistLineColor(213); |
---|
665 | sty->SetHistFillColor(214); |
---|
666 | sty->SetLabelSize(0.12,"X"); |
---|
667 | sty->SetLabelSize(0.12,"Y"); |
---|
668 | sty->SetNdivisions(7,"X"); |
---|
669 | sty->SetNdivisions(7,"Y"); |
---|
670 | fFocalSurfacePainter->SetHitsHistStyle(sty); |
---|
671 | fFocalSurfacePainter->UpdateHist(kTRUE); |
---|
672 | |
---|
673 | hits->SetBit(TH1::kNoTitle); |
---|
674 | hits->Draw(); |
---|
675 | c1->Connect("Modified()","TPad",c2,"Modified()"); |
---|
676 | |
---|
677 | gPad->Modified(); |
---|
678 | gPad->Update(); |
---|
679 | |
---|
680 | TVirtualPad* c3 = c->cd(3); |
---|
681 | c3->SetPad(0.75,0.5,1.,0.75); |
---|
682 | c3->SetTopMargin(0.05); |
---|
683 | c3->SetBottomMargin(0.15); |
---|
684 | c3->SetLeftMargin(0.15); |
---|
685 | c3->SetRightMargin(0.05); |
---|
686 | |
---|
687 | TH1F* prof = (TH1F*)fFocalSurfacePainter->GetSigProfile()->DrawCopy(); |
---|
688 | if (prof) { |
---|
689 | TStyle* savestyle = gStyle; |
---|
690 | gStyle = sty; |
---|
691 | prof->UseCurrentStyle(); |
---|
692 | gStyle = savestyle; |
---|
693 | prof->SetBit(TH1::kNoTitle); |
---|
694 | } |
---|
695 | |
---|
696 | c3->Modified(); |
---|
697 | c3->Update(); |
---|
698 | |
---|
699 | TVirtualPad* c4 = c->cd(4); |
---|
700 | c4->SetPad(0.75,0.25,1.,0.5); |
---|
701 | c4->SetTopMargin(0.05); |
---|
702 | c4->SetBottomMargin(0.15); |
---|
703 | c4->SetLeftMargin(0.15); |
---|
704 | c4->SetRightMargin(0.05); |
---|
705 | |
---|
706 | prof = (TH1F*)fFocalSurfacePainter->GetSigMaxProfile()->DrawCopy(); |
---|
707 | if (prof) { |
---|
708 | TStyle* savestyle = gStyle; |
---|
709 | gStyle = sty; |
---|
710 | prof->UseCurrentStyle(); |
---|
711 | gStyle = savestyle; |
---|
712 | prof->SetBit(TH1::kNoTitle); |
---|
713 | |
---|
714 | } |
---|
715 | |
---|
716 | c4->Modified(); |
---|
717 | c4->Update(); |
---|
718 | |
---|
719 | TVirtualPad* c5 = c->cd(5); |
---|
720 | c5->SetPad(0.75,0.,0.875,0.25); |
---|
721 | Double_t rFS = 1250; |
---|
722 | Double_t rView = rFS*1.1; |
---|
723 | c5->DrawFrame( -rView, -rView, rView, rView ); |
---|
724 | |
---|
725 | TEllipse *el = new TEllipse(0., 0., rFS, rFS, 0, 360); |
---|
726 | el->SetLineWidth(1); |
---|
727 | el->SetBit(kCanDelete); |
---|
728 | el->Draw(); |
---|
729 | |
---|
730 | TVector3 vc = fFocalSurfacePainter->GetViewCenter(); |
---|
731 | |
---|
732 | TMarker* p = new TMarker(vc.X(),vc.Y(),20); |
---|
733 | p->SetMarkerColor(kRed); |
---|
734 | p->SetBit(kCanDelete); |
---|
735 | p->Draw(); |
---|
736 | |
---|
737 | TText* txt = new TText(-rView,rView,"Focal Surface"); |
---|
738 | txt->SetTextAlign(13); |
---|
739 | txt->SetTextSize(0.15); |
---|
740 | txt->Draw(); |
---|
741 | |
---|
742 | c5->Modified(); |
---|
743 | c5->Update(); |
---|
744 | |
---|
745 | TVirtualPad* c6 = c->cd(6); |
---|
746 | c6->SetPad(0.875,0.,1.,0.25); |
---|
747 | Double_t rFoV = kHdetector*Tan(kFoV); |
---|
748 | rView = rFoV*1.1; |
---|
749 | c6->DrawFrame( -rView, -rView, rView, rView ); |
---|
750 | |
---|
751 | el = new TEllipse(0., 0., rFoV, rFoV, 0, 360); |
---|
752 | el->SetLineWidth(1); |
---|
753 | el->SetBit(kCanDelete); |
---|
754 | el->Draw(); |
---|
755 | |
---|
756 | vc = fTruth->GetTrueShowerMaxPos(); |
---|
757 | |
---|
758 | p = new TMarker(vc.X(),vc.Y(),20); |
---|
759 | p->SetMarkerColor(kRed); |
---|
760 | p->SetBit(kCanDelete); |
---|
761 | p->Draw(); |
---|
762 | |
---|
763 | txt = new TText(-rView,rView,"Field of View"); |
---|
764 | txt->SetTextAlign(13); |
---|
765 | txt->SetTextSize(0.15); |
---|
766 | txt->Draw(); |
---|
767 | |
---|
768 | c6->Modified(); |
---|
769 | c6->Update(); |
---|
770 | } else { |
---|
771 | RemoveTab("FocalSurface"); |
---|
772 | } |
---|
773 | |
---|
774 | if ( fFocalSurface3DPainter && !(fFocalSurface3DPainter->IsZombie()) ){ |
---|
775 | |
---|
776 | c = FindAddTab("FocalSurface3D"); |
---|
777 | c->Clear(); |
---|
778 | |
---|
779 | fFocalSurface3DPainter->SetDrawCode(1); |
---|
780 | fFocalSurface3DPainter->Update(); |
---|
781 | fFocalSurface3DPainter->Draw(); |
---|
782 | c->Modified(); |
---|
783 | c->Update(); |
---|
784 | |
---|
785 | c->Modified(); |
---|
786 | c->Update(); |
---|
787 | } else { |
---|
788 | RemoveTab("FocalSurface3D"); |
---|
789 | } |
---|
790 | |
---|
791 | if ( fFocalSurfacePainter && !(fFocalSurfacePainter->IsZombie()) ) { |
---|
792 | c = FindAddTab("SignalNoiseProfile"); |
---|
793 | c->Clear(); |
---|
794 | c->cd(); |
---|
795 | c->Divide(3,2); |
---|
796 | |
---|
797 | Style_t fill = 3001; |
---|
798 | |
---|
799 | TVirtualPad* c1 = c->cd(1); |
---|
800 | c1->SetPad(0., 0.5, 0.25, 0.75); |
---|
801 | TH1F* hHmaxProf = (TH1F*)fFocalSurfacePainter->GetHitsMaxProfile()->DrawCopy(); |
---|
802 | Float_t max = hHmaxProf->GetMaximum(); |
---|
803 | hHmaxProf->UseCurrentStyle(); |
---|
804 | hHmaxProf->SetFillStyle(fill); |
---|
805 | hHmaxProf->SetLineColor(kBlue); |
---|
806 | hHmaxProf->SetFillColor(kBlue); |
---|
807 | |
---|
808 | TVirtualPad* c2 = c->cd(2); |
---|
809 | c2->SetPad(0., 0.25, 0.25, 0.5); |
---|
810 | TH1F* hSmaxProf = (TH1F*)fFocalSurfacePainter->GetSigMaxProfile()->DrawCopy(); |
---|
811 | hSmaxProf->UseCurrentStyle(); |
---|
812 | hSmaxProf->SetFillStyle(fill); |
---|
813 | hSmaxProf->SetLineColor(kBlue); |
---|
814 | hSmaxProf->SetFillColor(kBlue); |
---|
815 | hSmaxProf->SetMaximum(max); |
---|
816 | |
---|
817 | |
---|
818 | TVirtualPad* c3 = c->cd(3); |
---|
819 | c3->SetPad(0.25, 0.75, 0.5, 1.00); |
---|
820 | TH1F* hNminProf = (TH1F*)fFocalSurfacePainter->GetNoiseMinProfile()->DrawCopy(); |
---|
821 | hNminProf->UseCurrentStyle(); |
---|
822 | hNminProf->SetFillStyle(fill); |
---|
823 | hNminProf->SetLineColor(kBlue); |
---|
824 | hNminProf->SetFillColor(kBlue); |
---|
825 | hNminProf->SetMaximum(max); |
---|
826 | |
---|
827 | TVirtualPad* c4 = c->cd(4); |
---|
828 | c4->SetPad(0.50, 0.75, 0.75, 1.00); |
---|
829 | TH1F* hNmaxProf = (TH1F*)fFocalSurfacePainter->GetNoiseMaxProfile()->DrawCopy(); |
---|
830 | hNmaxProf->UseCurrentStyle(); |
---|
831 | hNmaxProf->SetFillStyle(fill); |
---|
832 | hNmaxProf->SetLineColor(kBlue); |
---|
833 | hNmaxProf->SetFillColor(kBlue); |
---|
834 | hNmaxProf->SetMaximum(max); |
---|
835 | |
---|
836 | TVirtualPad* c5 = c->cd(5); |
---|
837 | c5->SetPad(0.75, 0.75, 1.00, 1.00); |
---|
838 | TH1F* hNmeanProf = (TH1F*)fFocalSurfacePainter->GetNoiseMeanProfile()->DrawCopy(); |
---|
839 | hNmeanProf->UseCurrentStyle(); |
---|
840 | hNmeanProf->SetFillStyle(fill); |
---|
841 | hNmeanProf->SetLineColor(kBlue); |
---|
842 | hNmeanProf->SetFillColor(kBlue); |
---|
843 | hNmeanProf->SetMaximum(max); |
---|
844 | |
---|
845 | TVirtualPad* c6 = c->cd(6); |
---|
846 | c6->SetPad(0.25, 0.00, 1.00, 0.75); |
---|
847 | |
---|
848 | TH1F* hitsH = (TH1F*)hHmaxProf->DrawCopy(); |
---|
849 | hitsH->SetFillColor(2); |
---|
850 | hitsH->SetFillStyle(0); |
---|
851 | hitsH->SetLineWidth(2); |
---|
852 | hitsH->SetLineWidth(2); |
---|
853 | |
---|
854 | TH1F* meanH = (TH1F*)hNmeanProf->DrawCopy("E2same"); |
---|
855 | meanH->SetFillColor(43); |
---|
856 | meanH->SetFillStyle(3002); |
---|
857 | meanH->SetLineColor(4); |
---|
858 | meanH->SetLineWidth(2); |
---|
859 | |
---|
860 | TH1F* minH = (TH1F*)hNminProf->DrawCopy("same"); |
---|
861 | minH->SetFillColor(8); |
---|
862 | minH->SetFillStyle(0); |
---|
863 | minH->SetLineColor(8); |
---|
864 | minH->SetLineWidth(2); |
---|
865 | |
---|
866 | TH1F* maxH = (TH1F*)hNmaxProf->DrawCopy("same"); |
---|
867 | maxH->SetFillColor(2); |
---|
868 | maxH->SetFillStyle(0); |
---|
869 | maxH->SetLineColor(2); |
---|
870 | maxH->SetLineWidth(2); |
---|
871 | |
---|
872 | //Float_t max = Max(hSmaxProf->GetMaximum(), hNmaxProf->GetMaximum()); |
---|
873 | //hSmaxProf->SetMaximum(max); |
---|
874 | //hNmaxProf->SetMaximum(max); |
---|
875 | //hNmaxProf->SetTitle("Max noise per GTU"); |
---|
876 | |
---|
877 | c->Modified(); |
---|
878 | c->Update(); |
---|
879 | |
---|
880 | |
---|
881 | /* TLegend* leg = new TLegend(0.8, 0.8, 0.9, 0.9); |
---|
882 | leg->AddEntry(hHmaxProf, "Total", "f"); |
---|
883 | leg->AddEntry(hNmaxProf, "Background", "f"); |
---|
884 | leg->AddEntry(hSmaxProf, "Signal", "f"); |
---|
885 | leg->Draw(); */ |
---|
886 | |
---|
887 | } else { |
---|
888 | RemoveTab("Shower"); |
---|
889 | } |
---|
890 | |
---|
891 | if ( fFocalSurfaceHistoPainter && !(fFocalSurfaceHistoPainter->IsZombie()) ) { |
---|
892 | c = FindAddTab("Histos"); |
---|
893 | c->Clear(); |
---|
894 | c->cd(); |
---|
895 | fFocalSurfaceHistoPainter->DoGtuPhotonsHisto(c); |
---|
896 | c->Modified(); |
---|
897 | c->Update(); |
---|
898 | } else { |
---|
899 | RemoveTab("Histos"); |
---|
900 | } |
---|
901 | } |
---|
902 | |
---|
903 | //______________________________________________________________________________ |
---|
904 | void ESimuEventViewer::DrawTruth() { |
---|
905 | |
---|
906 | TPaveText* tpave; |
---|
907 | |
---|
908 | // first column |
---|
909 | tpave = new TPaveText(0.025,0.025,0.475,1.,""); |
---|
910 | tpave->SetTextAlign(13); |
---|
911 | tpave->SetTextFont(52); |
---|
912 | tpave->SetTextColor(kBlack); |
---|
913 | tpave->SetFillStyle(0); |
---|
914 | tpave->SetBorderSize(0); |
---|
915 | tpave->AddText(""); |
---|
916 | tpave->AddText("This event was simulated with:"); |
---|
917 | tpave->AddText(""); |
---|
918 | tpave->AddLine(); |
---|
919 | // Energy, Theta, Phi |
---|
920 | tpave->AddText(Form("E : %.4e MeV",fTruth->GetTrueEnergy()/1.)); |
---|
921 | tpave->AddText(Form("#theta : %.2f deg",fTruth->GetTrueTheta()*RadToDeg())); |
---|
922 | tpave->AddText(Form("#varphi : %.2f deg",fTruth->GetTruePhi()*RadToDeg())); |
---|
923 | // line of sight-incident direction angle |
---|
924 | TVector3 dir = (fTruth->GetTrueEarthImpact()-fTruth->GetTrueInitPos()).Unit(); |
---|
925 | TVector3 pos = fTruth->GetTrueShowerMaxPos()-TVector3(0,0,420*sou::km); |
---|
926 | Float_t fovdir = RadToDeg()*ACos((pos.Unit()).Dot(dir)); |
---|
927 | tpave->AddText(Form("#alpha : %.2f deg",fovdir)); |
---|
928 | |
---|
929 | tpave->AddText(""); |
---|
930 | tpave->AddText(Form("X_{1} : %.2f g/cm^{2}",fTruth->GetTrueX1()*cm2/g)); |
---|
931 | tpave->AddText(Form("#vec{P}_{init} : (%.2f,%.2f,%.2f) km", |
---|
932 | fTruth->GetTrueInitPos().X()/km, fTruth->GetTrueInitPos().Y()/km, |
---|
933 | fTruth->GetTrueInitPos().Z()/km)); |
---|
934 | tpave->AddText(""); |
---|
935 | tpave->AddText(Form("X_{max} : %.2f g/cm^{2}",fTruth->GetTrueShowerXMax()*cm2/g)); |
---|
936 | tpave->AddText(Form("#vec{P}_{max} : (%.2f,%.2f,%.2f) km", |
---|
937 | fTruth->GetTrueShowerMaxPos().X()/km, fTruth->GetTrueShowerMaxPos().Y()/km, |
---|
938 | fTruth->GetTrueShowerMaxPos().Z()/km)); |
---|
939 | |
---|
940 | tpave->AddText(""); |
---|
941 | tpave->AddText(Form("Age_{earth} : %.2f",fTruth->GetTrueEarthAge())); |
---|
942 | tpave->AddText(Form("#vec{P}_{earth} : (%.2f,%.2f,%.2f) km", |
---|
943 | fTruth->GetTrueEarthImpact().X()/km,fTruth->GetTrueEarthImpact().Y()/km, |
---|
944 | fTruth->GetTrueEarthImpact().Z()/km)); |
---|
945 | tpave->AddText(""); |
---|
946 | tpave->AddText(Form("L_{Shower} : %.2f km", |
---|
947 | (fTruth->GetTrueEarthImpact()-fTruth->GetTrueInitPos()).Mag()/km)); |
---|
948 | if ( fTruth->GetTrueHclouds() > 0 ) |
---|
949 | tpave->AddText(Form("H_{clouds} : %.2f km", fTruth->GetTrueHclouds()/km)); |
---|
950 | else |
---|
951 | tpave->AddText(Form("H_{clouds} : None")); |
---|
952 | tpave->AddText(""); |
---|
953 | tpave->AddText(""); |
---|
954 | tpave->AddText(""); |
---|
955 | tpave->AddText(""); |
---|
956 | tpave->Draw(); |
---|
957 | |
---|
958 | // second column |
---|
959 | const EDetStatus *fStatus = fEvent->GetDetector()->GetStatus(); |
---|
960 | if ( !fStatus || !fStatus->GetNumPhotons() ) return; |
---|
961 | tpave = new TPaveText(.525,0.025,.975,1.,""); |
---|
962 | tpave->SetTextAlign(13); |
---|
963 | tpave->SetTextFont(52); |
---|
964 | tpave->SetTextColor(kBlack); |
---|
965 | tpave->SetFillStyle(0); |
---|
966 | tpave->SetBorderSize(0); |
---|
967 | tpave->AddText(""); |
---|
968 | tpave->AddText("Detector summary"); |
---|
969 | tpave->AddText(""); |
---|
970 | tpave->AddLine(); |
---|
971 | tpave->AddText(Form("Number of photons: %d", fStatus->GetNumPhotons())); |
---|
972 | tpave->AddText(Form(" #diamond Lost: %d", fStatus->GetPhotonHistory(kUndefined))); |
---|
973 | tpave->AddText(Form(" #diamond Not inside detector: %d", fStatus->GetPhotonHistory(kNotInside))); |
---|
974 | tpave->AddText(Form(" #diamond Baffle: %d", fStatus->GetPhotonHistory(kBaffle))); |
---|
975 | tpave->AddText(Form(" #diamond Optics: %d", fStatus->GetPhotonHistory(kOptics))); |
---|
976 | tpave->AddText(Form(" #diamond Walls: %d", fStatus->GetPhotonHistory(kWalls))); |
---|
977 | tpave->AddText(Form(" #diamond Focal Plane: %d", fStatus->GetPhotonHistory(kFocalPlane))); |
---|
978 | tpave->AddText(Form(" #diamond Reflected: %d", fStatus->GetPhotonHistory(kEarth))); |
---|
979 | tpave->AddText(""); |
---|
980 | tpave->AddText(Form("Number of Fee: %d", fEvent->GetDetector()->GetNumFee())); |
---|
981 | tpave->AddText(Form("#diamond with signals: %d", fStatus->GetNumSignals())); |
---|
982 | tpave->AddText(Form("#diamond with hits (in pixels with signal): %d", fStatus->GetNumHits())); |
---|
983 | tpave->AddText(Form("#diamond only background hits: %d", fStatus->GetNumBkg())); |
---|
984 | tpave->AddText(""); |
---|
985 | tpave->AddText(Form("GTUs with signal: %d", fStatus->GetNumGtu())); |
---|
986 | tpave->AddText(""); |
---|
987 | tpave->AddText(Form("#nu^{bkg}_{min}: %.2f p.e.#upoint pixel^{-1}#upoint #mus^{-1}", fRunPars->GetMinNightGlowRate())); |
---|
988 | tpave->AddText(Form("#nu^{bkg}_{max}: %.2f p.e.#upoint pixel^{-1}#upoint #mus^{-1}", fRunPars->GetMaxNightGlowRate())); |
---|
989 | tpave->Draw(); |
---|
990 | |
---|
991 | } |
---|
992 | |
---|
993 | //______________________________________________________________________________ |
---|
994 | void ESimuEventViewer::NextEvent() { |
---|
995 | // |
---|
996 | // Jump to the previous event |
---|
997 | // |
---|
998 | if ( fCurrentEventId >= fEventList->GetN() ) |
---|
999 | return; |
---|
1000 | |
---|
1001 | if ( LoadEvent( fCurrentEventId+1 ) ) |
---|
1002 | UpdateTabs(); |
---|
1003 | } |
---|
1004 | |
---|
1005 | |
---|
1006 | //______________________________________________________________________________ |
---|
1007 | void ESimuEventViewer::PrevEvent() { |
---|
1008 | // |
---|
1009 | // Jump to the next event |
---|
1010 | // |
---|
1011 | if ( fCurrentEventId <= 0 ) |
---|
1012 | return; |
---|
1013 | |
---|
1014 | if ( LoadEvent( fCurrentEventId-1 ) ) |
---|
1015 | UpdateTabs(); |
---|
1016 | |
---|
1017 | } |
---|
1018 | |
---|
1019 | //______________________________________________________________________________ |
---|
1020 | Bool_t ESimuEventViewer::ProcessMessageCommand(Long_t submsg, Long_t mp1, Long_t mp2) { |
---|
1021 | // |
---|
1022 | // |
---|
1023 | // |
---|
1024 | |
---|
1025 | switch (submsg) { |
---|
1026 | case kCM_BUTTON: |
---|
1027 | switch (mp1) { |
---|
1028 | case kButtonNextEvent: |
---|
1029 | NextEvent(); |
---|
1030 | return kTRUE; |
---|
1031 | case kButtonPrevEvent: |
---|
1032 | PrevEvent(); |
---|
1033 | return kTRUE; |
---|
1034 | case kButtonApplyCut: |
---|
1035 | ApplyBarCut(); |
---|
1036 | return kTRUE; |
---|
1037 | } |
---|
1038 | case kCM_COMBOBOX: // 7 |
---|
1039 | if (mp1==kComboNevents) { |
---|
1040 | LoadEvent(mp2); |
---|
1041 | UpdateTabs(); |
---|
1042 | } |
---|
1043 | return kTRUE; |
---|
1044 | } |
---|
1045 | |
---|
1046 | return EGViewer::ProcessMessageCommand(submsg, mp1, mp2); |
---|
1047 | } |
---|
1048 | |
---|
1049 | //______________________________________________________________________________ |
---|
1050 | Bool_t ESimuEventViewer::HandleKey(Event_t* event) { |
---|
1051 | // |
---|
1052 | // Handle keybord commands |
---|
1053 | // |
---|
1054 | // |
---|
1055 | |
---|
1056 | if ((event->fType == kGKeyPress) && (event->fState & kKeyControlMask)) { |
---|
1057 | UInt_t keysym; |
---|
1058 | char str[2]; |
---|
1059 | |
---|
1060 | gVirtualX->LookupString(event, str, sizeof(str), keysym); |
---|
1061 | |
---|
1062 | switch ( keysym ) { |
---|
1063 | case kKey_n: |
---|
1064 | NextEvent(); |
---|
1065 | return kTRUE; |
---|
1066 | case kKey_p: |
---|
1067 | PrevEvent(); |
---|
1068 | return kTRUE; |
---|
1069 | } |
---|
1070 | } |
---|
1071 | |
---|
1072 | return EGViewer::HandleKey(event); |
---|
1073 | } |
---|
1074 | |
---|
1075 | |
---|