source: trunk/MagicSoft/Mars/mmain/MEventDisplay.cc@ 7771

Last change on this file since 7771 was 7771, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 22.5 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz, 10/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24#include "MEventDisplay.h"
25
26//
27// C-lib
28//
29#include <stdlib.h> // atoi
30
31//
32// root
33//
34#include <TFile.h> // TFile
35#include <TTree.h> // TTree
36#include <TList.h> // TList::Add
37#include <TStyle.h> // gStyle->SetOptStat
38#include <TCanvas.h> // TCanvas::cd
39#include <TSystem.h> // TSystem::BaseName
40
41//
42// root GUI
43//
44#include <TGLabel.h> // TGLabel
45#include <TGButton.h> // TGPictureButton
46#include <TG3DLine.h> // TGHorizontal3DLine
47#include <TGTextEntry.h> // TGTextEntry
48#include <TGButtonGroup.h> // TGVButtonGroup
49#include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas
50
51//
52// General
53//
54#include "MGList.h" // MGList
55
56#include "MLog.h"
57#include "MLogManip.h"
58
59#include "MParList.h" // MParList::AddToList
60#include "MEvtLoop.h" // MEvtLoop::GetParList
61#include "MTaskList.h" // MTaskList::AddToList
62
63//
64// Tasks
65//
66#include "MReadMarsFile.h" // MReadMarsFile
67#include "MGeomApply.h" // MGeomApply
68#include "MFDataMember.h" // MFDataMember
69#include "MMcPedestalCopy.h" // MMcPedestalCopy
70#include "MMcPedestalNSBAdd.h" // MMcPedestalNSBAdd
71
72#include "MSignalCalc.h" // MPedestalCalc
73#include "MTaskEnv.h" // MTaskEnv
74#include "MExtractTimeAndChargeDigitalFilter.h"
75#include "MImgCleanStd.h" // MImgCleanStd
76#include "MHillasCalc.h" // MHillasCalc
77#include "MCalibrationRelTimeCalc.h" // MCalibrationRelTimeCalc
78#include "MCalibrationPatternDecode.h" // MCalibrationPatternDecode
79#include "MPrint.h"
80#include "MBadPixelsCalc.h" // MBadPixelsCalc
81#include "MBadPixelsTreat.h" // MBadPixelsTreat
82#include "MFillH.h" // MFillH
83#include "MExtractSignal.h" // MExtractsignal
84#include "MMcCalibrationUpdate.h" // MMcCalibrationUpdate
85#include "MCalibrateData.h" // MCalibrateData
86#include "MMuonSearchParCalc.h" // MMuonSearchParCalc
87#include "MMuonCalibParCalc.h" // MMuonCalibParCalc
88#include "MContinue.h" // MContinue
89//#include "MMcTriggerLvl2Calc.h" // MMcTriggerLvl2Calc
90
91//
92// Container
93//
94#include "MHillas.h" // MHillas::Print(const MGeomCam&)
95#include "MHillasExt.h" // MHillasExt::Print(const MGeomCam&)
96#include "MHillasSrc.h" // MHillasSrc::Print(const MGeomCam&)
97#include "MImagePar.h" // MImagePar::Print(const MGeomCam&)
98#include "MNewImagePar.h" // MNewImagePar::Print(const MGeomCam&)
99#include "MHEvent.h" // MHEvent
100#include "MHCamera.h" // MHCamera
101#include "MRawEvtData.h" // MRawEvtData
102#include "MArrivalTimeCam.h" // MArrivalTimeCam
103#include "MBadPixelsCam.h" // MBadPixelsCam
104#include "MPedPhotCam.h" // MPedPhotCam
105#include "MCalibrationChargeCam.h" // MCalibrationChargeCam
106#include "MMuonSearchPar.h" // MMuonCalibPar
107//#include "MMcTriggerLvl2.h" // MMcTriggerLvl2
108
109using namespace std;
110
111ClassImp(MEventDisplay);
112
113// --------------------------------------------------------------------------
114//
115// Constructor.
116//
117MEventDisplay::MEventDisplay(const char *fname) : MStatusDisplay(), fEvtLoop(0)
118{
119 //
120 // Setup Task list for hillas calculation
121 //
122 SetupTaskList("Events", fname);
123
124 //
125 // Add MEventDisplay GUI elements to the display
126 //
127 AddUserFrame(fname);
128
129 //
130 // Show new part of the window, resize to correct aspect ratio
131 //
132 // FIXME: This should be done by MStatusDisplay automatically
133 Resize(GetWidth(), GetHeight() + fUserFrame->GetDefaultHeight());
134 SetWindowName("Event Display");
135 MapSubwindows();
136
137 //
138 // Readin first event and display it
139 //
140 if (fEvtLoop)
141 ReadFirstEvent();
142
143 SetNoContextMenu(kFALSE);
144}
145
146// --------------------------------------------------------------------------
147//
148// Destructor: PostProcess eventloop, delete eventloop with all containers
149//
150MEventDisplay::~MEventDisplay()
151{
152 if (fEvtLoop)
153 {
154 fEvtLoop->PostProcess();
155 delete fEvtLoop;
156 }
157}
158
159Int_t MEventDisplay::GetFileType(const char *tree, const char *fname) const
160{
161 TFile f(fname, "READ");
162 TTree *t = (TTree*)f.Get(tree);
163 if (!t)
164 return -1;
165
166 if (t->FindBranch("MSignalCam."))
167 return 1;
168
169 if (t->FindBranch("MRawEvtData."))
170 return 2;
171
172 return -2;
173}
174
175// --------------------------------------------------------------------------
176//
177// Setup Task and parameter list for hillas calculation,
178// preprocess tasks and read in first event (process)
179//
180void MEventDisplay::SetupTaskList(const char *tname, const char *fname)
181{
182// MCalibrationChargeCam *ccam=0;
183// MPedPhotCam *pcam=0;
184
185 MBadPixelsCam *badpix = new MBadPixelsCam;
186
187 const Int_t type = GetFileType(tname, fname);
188 switch (type)
189 {
190 case 1: gLog << all << "Calibrated Data File detected..." << endl; break;
191 case 2: gLog << all << "Raw Data File detected..." << endl; break;
192 case -2: gLog << err << "File type unknown... abort." << endl; return;
193 case -1: gLog << err << "Tree " << tname << " not found... abort." << endl; return;
194 }
195
196 //
197 // Setup an empty job, with a reader task only.
198 // All tasks and parameter containers are deleted automatically
199 // (via SetOwner())
200 //
201 MTaskList *tlist = new MTaskList;
202 tlist->SetOwner();
203
204 MReadMarsFile *read = new MReadMarsFile(tname, fname);
205 read->DisableAutoScheme();
206 tlist->AddToList(read);
207
208 MGeomApply *apl = new MGeomApply;
209 tlist->AddToList(apl);
210
211 MParList *plist = new MParList;
212 plist->SetOwner();
213 plist->AddToList(tlist);
214 plist->AddToList(badpix);
215
216 //MArrivalTime *atime = new MArrivalTime;
217 //plist->AddToList(atime);
218
219 MHEvent *evt01 = new MHEvent(MHEvent::kEvtSignalDensity);
220 MHEvent *evt02 = new MHEvent(MHEvent::kEvtSignalDensity);
221 MHEvent *evt03 = new MHEvent(type==1?MHEvent::kEvtPedPhot:MHEvent::kEvtPedestal);
222 MHEvent *evt04 = new MHEvent(type==1?MHEvent::kEvtPedPhotRMS:MHEvent::kEvtPedestalRMS);
223 MHEvent *evt06a= new MHEvent(MHEvent::kEvtCleaningData);
224 MHEvent *evt06b= new MHEvent(MHEvent::kEvtCleaningLevels);
225 MHEvent *evt07 = new MHEvent(MHEvent::kEvtIdxMax);
226 MHEvent *evt08 = new MHEvent(MHEvent::kEvtArrTime);
227 MHEvent *evt09 = new MHEvent(MHEvent::kEvtArrTimeCleaned);
228 //MHEvent *evt09 = new MHEvent(MHEvent::kEvtTrigPix);
229 MHEvent *evt10 = new MHEvent(MHEvent::kEvtIslandIndex);
230
231 evt01->SetName("Signal");
232 evt02->SetName("Cleaned");
233 evt03->SetName("Ped");
234 evt04->SetName("PedRMS");
235 evt06a->SetName("CleanData");
236 evt06b->SetName("Levels");
237 evt07->SetName("MaxSliceIdx");
238 evt08->SetName("ArrTime");
239 evt09->SetName("Time");
240 evt10->SetName("Islands");
241
242 evt01->SetMinimum(0);
243 evt03->SetMinimum(0);
244 evt04->SetMinimum(0);
245 evt06a->SetMinimum(0);
246
247 // This makes sure, that the containers are deleted...
248 plist->AddToList(evt01);
249 plist->AddToList(evt02);
250 plist->AddToList(evt03);
251 plist->AddToList(evt04);
252 plist->AddToList(evt06a);
253 plist->AddToList(evt06b);
254 plist->AddToList(evt07);
255 plist->AddToList(evt08);
256 plist->AddToList(evt09);
257 plist->AddToList(evt10);
258
259 MExtractTimeAndChargeDigitalFilter *digf = new MExtractTimeAndChargeDigitalFilter;
260 digf->SetNameWeightsFile("msignal/cosmics_weights46.dat");
261
262 MTaskEnv *taskenv1=new MTaskEnv("ExtractSignal");
263 taskenv1->SetDefault(digf);
264 taskenv1->SetOwner();
265
266 MSignalCalc *nanal = new MSignalCalc;
267 MFillH *fill01 = new MFillH(evt01, "MSignalCam", "MFillH01");
268 MImgCleanStd *clean = new MImgCleanStd;
269 MFillH *fill02 = new MFillH(evt02, "MSignalCam", "MFillH02");
270 MFillH *fill03 = new MFillH(evt03, type==1?"MPedPhotFundamental":"MPedestalCam", "MFillH03");
271 MFillH *fill04 = new MFillH(evt04, type==1?"MPedPhotFromExtractorRndm":"MPedestalCam", "MFillH04");
272 MFillH *fill06a = new MFillH(evt06a, "MCameraData", "MFillH06a");
273 MFillH *fill06b = new MFillH(evt06b, "MCameraData", "MFillH06b");
274 MHillasCalc *hcalc = new MHillasCalc;
275 //MMcTriggerLvl2Calc *trcal = new MMcTriggerLvl2Calc;
276 //MFillH *fill09 = new MFillH(evt09, "MMcTriggerLvl2", "MFillH09");
277 MFillH *fill10 = new MFillH(evt10, "MSignalCam", "MFillH10");
278
279 MBadPixelsCalc *bcalc = new MBadPixelsCalc;
280 MBadPixelsTreat *btreat = new MBadPixelsTreat;
281 btreat->SetProcessTimes(kFALSE);
282 if (type==1)
283 {
284 bcalc->SetNamePedPhotCam("MPedPhotFromExtractor");
285 btreat->AddNamePedPhotCam("MPedPhotFromExtractorRndm");
286 clean->SetNamePedPhotCam("MPedPhotFromExtractorRndm");
287 }
288
289 // If no pedestal or no calibration file is availble
290 if (type==2)
291 {
292 MFilter *f1=new MFDataMember("MRawRunHeader.fRunType", '>', 255.5);
293 f1->SetName("MFMonteCarlo");
294
295 MMcPedestalCopy *pcopy = new MMcPedestalCopy;
296 MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd;
297
298 MCalibrationPatternDecode *decode = new MCalibrationPatternDecode;
299
300 MMcCalibrationUpdate* mcupd = new MMcCalibrationUpdate;
301 mcupd->SetOuterPixelsGainScaling(kFALSE);
302
303 MCalibrateData* calib = new MCalibrateData;
304 calib->SetCalibrationMode(MCalibrateData::kFlatCharge);
305 calib->SetPedestalFlag(MCalibrateData::kEvent);
306
307 //MCalibrationRelTimeCalc *tcalc = new MCalibrationRelTimeCalc;
308
309 // MC
310 mcupd->SetFilter(f1);
311 //trcal->SetFilter(f1);
312
313 // TaskList
314 tlist->AddToList(f1);
315 tlist->AddToList(pcopy);
316 tlist->AddToList(pdnsb);
317
318 tlist->AddToList(decode);
319
320 tlist->AddToList(nanal); // Calculated MPedPhotCam
321 tlist->AddToList(taskenv1); // Calculates MExtractedSignalCam, MArrivalTimeCam
322 tlist->AddToList(mcupd);
323 tlist->AddToList(calib); // MExtractedSignalCam --> MSignalCam
324
325 tlist->AddToList(bcalc); // Produce MBadPixelsCam
326 tlist->AddToList(btreat); // Treat MBadPixelsCam
327 }
328
329 tlist->AddToList(fill01);
330 tlist->AddToList(clean);
331 tlist->AddToList(fill02);
332 tlist->AddToList(fill03);
333 tlist->AddToList(fill04);
334 tlist->AddToList(fill06a);
335 tlist->AddToList(fill06b);
336 tlist->AddToList(fill10);
337 if (type==2)
338 {
339 MFillH *fill07 = new MFillH(evt07, "MRawEvtData", "MFillH7");
340 MFillH *fill08 = new MFillH(evt08, "MArrivalTimeCam", "MFillH8");
341 tlist->AddToList(fill07);
342 tlist->AddToList(fill08);
343
344 //tlist->AddToList(trcal);
345 //tlist->AddToList(fill09);
346 }
347 if (type==1)
348 {
349 MFillH *fill08 = new MFillH(evt08, "MSignalCam", "MFillH8");
350 MFillH *fill09 = new MFillH(evt09, "MSignalCam", "MFillH9");
351 tlist->AddToList(fill08);
352 tlist->AddToList(fill09);
353 }
354 tlist->AddToList(hcalc);
355
356 // --------------------------------------------------
357 // Muon Analysis
358 MMuonSearchParCalc *muscalc = new MMuonSearchParCalc;
359 MMuonCalibParCalc *mcalc = new MMuonCalibParCalc;
360 MFillH *fillmuon = new MFillH("MHSingleMuon", "", "FillMuon");
361 fillmuon->SetNameTab("Muon");
362 tlist->AddToList(muscalc);
363 tlist->AddToList(fillmuon);
364 tlist->AddToList(mcalc);
365
366 // --------------------------------------------------
367 // Cut to steer the display
368 MContinue *cont0=new MContinue("", "Cut");
369 cont0->SetAllowEmpty();
370 tlist->AddToList(cont0);
371
372 //
373 // Now distribute Display to all tasks
374 //
375 fEvtLoop = new MEvtLoop(gSystem->BaseName(fname));
376 fEvtLoop->SetOwner();
377 fEvtLoop->SetParList(plist);
378 fEvtLoop->SetDisplay(this);
379 fEvtLoop->ReadEnv("mars.rc");
380
381}
382
383// --------------------------------------------------------------------------
384//
385// Add the top part of the frame: This is filename and treename display
386//
387void MEventDisplay::AddTopFramePart1(TGCompositeFrame *frame,
388 const char *filename,
389 const char *treename)
390{
391 //
392 // --- the top1 part of the window ---
393 //
394 TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 1, 1);
395 fList->Add(top1);
396
397 //
398 // create gui elements
399 //
400 TGLabel *file = new TGLabel(top1, new TGString(Form("%s#%s", filename, treename)));
401 fList->Add(file);
402
403 //
404 // layout and add gui elements in/to frame
405 //
406 TGLayoutHints *laystd = new TGLayoutHints(kLHintsCenterX, 5, 5);
407 fList->Add(laystd);
408
409 top1->AddFrame(file, laystd);
410
411 //
412 // --- the top1 part of the window ---
413 //
414 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
415 fList->Add(top2);
416
417 //
418 // layout and add frames
419 //
420 TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5);
421 fList->Add(laytop1);
422 frame->AddFrame(top1, laytop1);
423 frame->AddFrame(top2, laytop1);
424}
425
426// --------------------------------------------------------------------------
427//
428// Add the second part of the top frame: This are the event number controls
429//
430void MEventDisplay::AddTopFramePart2(TGCompositeFrame *frame)
431{
432 //
433 // --- the top2 part of the window ---
434 //
435 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
436 fList->Add(top2);
437
438 //
439 // Create the gui elements
440 //
441 TGTextButton *prevevt = new TGTextButton(top2, " << ", kEvtPrev);
442 prevevt->Associate(this);
443
444 TGLabel *evtnr = new TGLabel(top2, new TGString("Event:"));
445
446 TGTextEntry *entry=new TGTextEntry(top2, new TGTextBuffer(100), kEvtNumber);
447 entry->Resize(60, entry->GetDefaultHeight());
448 entry->Associate(this);
449
450 fNumOfEvts = new TGLabel(top2, "of .");
451
452 TGTextButton *nextevt = new TGTextButton (top2, " >> ", kEvtNext);
453 nextevt->Associate(this);
454
455 //
456 // Add gui elements to 'atotodel'
457 //
458 fList->Add(prevevt);
459 fList->Add(evtnr);
460 fList->Add(entry);
461 fList->Add(fNumOfEvts);
462 fList->Add(nextevt);
463
464 //
465 // add the gui elements to the frame
466 //
467 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5);
468 fList->Add(laystd);
469
470 top2->AddFrame(prevevt, laystd);
471 top2->AddFrame(evtnr, laystd);
472 top2->AddFrame(entry, laystd);
473 top2->AddFrame(fNumOfEvts, laystd);
474 top2->AddFrame(nextevt, laystd);
475
476 TGLayoutHints *laystd2 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5, 5);
477 fList->Add(laystd2);
478 frame->AddFrame(top2, laystd2);
479
480 //
481 // Add trailing line...
482 //
483 TGHorizontal3DLine *line = new TGHorizontal3DLine(frame);
484 TGLayoutHints *layline = new TGLayoutHints(kLHintsExpandX);
485 fList->Add(line);
486 fList->Add(layline);
487 frame->AddFrame(line, layline);
488}
489
490// --------------------------------------------------------------------------
491//
492// Add the user frame part of the display
493//
494void MEventDisplay::AddUserFrame(const char* filename)
495{
496 fUserFrame->ChangeOptions(kHorizontalFrame);
497
498 TGCompositeFrame *vf1 = new TGVerticalFrame(fUserFrame, 1, 1);
499 TGCompositeFrame *vf2 = new TGVerticalFrame(fUserFrame, 1, 1);
500
501 AddTopFramePart1(vf1, filename, "Events");
502 AddTopFramePart2(vf1);
503
504 // create root embedded canvas and add it to the tab
505 TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas("Slices", vf2, vf1->GetDefaultHeight()*3/2, vf1->GetDefaultHeight(), 0);
506 vf2->AddFrame(ec);
507 fList->Add(ec);
508
509 // set background and border mode of the canvas
510 fCanvas = ec->GetCanvas();
511 fCanvas->SetBorderMode(0);
512 gROOT->GetListOfCanvases()->Add(fCanvas);
513 //fCanvas->SetBorderSize(1);
514 //fCanvas->SetBit(kNoContextMenu);
515 //fCanvas->SetFillColor(16);
516
517 TGLayoutHints *lay = new TGLayoutHints(kLHintsExpandX);
518 fUserFrame->AddFrame(vf1, lay);
519 fUserFrame->AddFrame(vf2);
520}
521
522// --------------------------------------------------------------------------
523//
524// Checks if the event number is valid, and if so reads the new event
525// and updates the display
526//
527void MEventDisplay::ReadinEvent(Int_t dir)
528{
529 MParList *plist = (MParList*) fEvtLoop->GetParList();
530 MTaskList *tlist = (MTaskList*) fEvtLoop->GetTaskList();
531 MGeomCam *geom = (MGeomCam*) plist->FindObject("MGeomCam");
532 MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");
533
534 //
535 // Read first event.
536 //
537 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
538
539 const Int_t num = reader->GetNumEntry();
540
541 Int_t rc;
542 do
543 {
544 if (dir<0 && !reader->DecEventNum())
545 {
546 reader->SetEventNum(num);
547 return;
548 }
549 if (dir>0 && !reader->IncEventNum())
550 {
551 reader->SetEventNum(num);
552 return;
553 }
554
555 rc = tlist->Process();
556 if (rc==kFALSE || rc==kERROR)
557 return;
558
559 reader->DecEventNum();
560
561 // Define other continue conditions
562 if (raw && raw->GetNumPixels()<1)
563 rc = kCONTINUE;
564
565 } while (rc==kCONTINUE && dir!=0);
566
567 //
568 // Cleare the 'FADC canvas'
569 //
570 fCanvas->Clear();
571 fCanvas->Modified();
572 fCanvas->Update();
573
574 //
575 // Print parameters
576 //
577 *fLog << all;
578 fLog->Separator(Form("Entry %d", reader->GetNumEntry()+1));
579 ((MHillas*) plist->FindObject("MHillas"))->Print(*geom);
580 ((MHillasExt*) plist->FindObject("MHillasExt"))->Print(*geom);
581 ((MHillasSrc*) plist->FindObject("MHillasSrc"))->Print(*geom);
582 plist->FindObject("MImagePar")->Print();
583 ((MNewImagePar*)plist->FindObject("MNewImagePar"))->Print(*geom);
584 plist->FindObject("MMuonCalibPar")->Print();
585 ((MMuonSearchPar*)plist->FindObject("MMuonSearchPar"))->Print(*geom);
586
587 //
588 // UpdateDisplay
589 //
590 gStyle->SetOptStat(1101);
591 Update();
592
593 TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
594 entry->SetText(Form("%d", reader->GetNumEntry()+1));
595}
596
597// --------------------------------------------------------------------------
598//
599// Read first event to get display booted
600//
601void MEventDisplay::ReadFirstEvent()
602{
603 const Int_t rc = fEvtLoop->PreProcess();
604 if (rc==kFALSE || rc==kERROR)
605 return;
606
607 UnLock();
608
609 //
610 // Get parlist
611 //
612 MParList *plist = (MParList*)fEvtLoop->GetParList();
613
614 //
615 // Add Geometry tab
616 //
617 AddGeometryTabs();
618
619 //
620 // Now read event...
621 //
622 // FIXME: Can we safly replace ReadinEvent() by RedinEvent(1)?
623 ReadinEvent();
624
625
626 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
627 TGString *txt = new TGString(Form("of %d", reader->GetEntries()));
628 fNumOfEvts->SetText(txt);
629
630 //
631 // Draw ellipse on top of all pads
632 //
633 TObject *hillas1 = plist->FindObject("MHillas");
634 TObject *hillas2 = plist->FindObject("MHillasSrc");
635 TObject *hillas3 = plist->FindObject("MHillasExt");
636 TObject *hmuon = plist->FindObject("MMuonSearchPar");
637 for (int i=1; i<7;i++)
638 {
639 TCanvas *c = GetCanvas(i);
640 c->GetPad(1)->cd(1);
641 hmuon->Draw();
642 hillas1->Draw();
643 hillas2->Draw();
644 hillas3->Draw();
645 }
646}
647
648// --------------------------------------------------------------------------
649//
650// Adds the geometry tab
651//
652void MEventDisplay::AddGeometryTabs()
653{
654 MGeomCam *geom = (MGeomCam*)fEvtLoop->GetParList()->FindObject("MGeomCam");
655 if (!geom)
656 return;
657
658 TCanvas &c1=AddTab("Geometry");
659
660 MHCamera *cam = new MHCamera(*geom);
661 cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
662 cam->Draw("pixelindex");
663
664 c1.Modified();
665 c1.Update();
666
667 TCanvas &c2=AddTab("Sectors");
668
669 cam = new MHCamera(*geom);
670 cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
671 cam->Draw("sectorindex");
672
673 c2.Modified();
674 c2.Update();
675}
676
677// --------------------------------------------------------------------------
678//
679// ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
680//
681// Processes information from all GUI items.
682// Selecting an item usually generates an event with 4 parameters.
683// The first two are packed into msg (first and second bytes).
684// The other two are parm1 and parm2.
685//
686Bool_t MEventDisplay::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
687{
688 switch (GET_MSG(msg))
689 {
690 case kC_TEXTENTRY:
691 switch(GET_SUBMSG(msg))
692 {
693 case kTE_ENTER:
694 switch(GET_SUBMSG(msg))
695 {
696 case kTE_ENTER:
697 {
698 TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
699 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
700 if (reader->SetEventNum(atoi(entry->GetText())-1))
701 ReadinEvent();
702 }
703 return kTRUE;
704 }
705 return kTRUE;
706 }
707 break;
708
709 case kC_COMMAND:
710 switch (GET_SUBMSG(msg))
711 {
712 case kCM_TAB:
713 {
714 //
715 // Set name for 'FADC canvas'. The name is the anchor for MHCamera.
716 // and clear the canvas
717 TCanvas *c = GetCanvas(mp1);
718 if (!c)
719 break;
720 MHEvent *o = (MHEvent*)fEvtLoop->GetParList()->FindObject(c->GetName());
721 if (!o)
722 break;
723 fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(), c->GetPad(1)->GetPad(1)));
724 }
725 break;
726
727 case kCM_BUTTON:
728 switch (mp1)
729 {
730 case kEvtPrev:
731 ReadinEvent(-1);
732 return kTRUE;
733
734 case kEvtNext:
735 ReadinEvent(+1);
736 return kTRUE;
737 }
738 return kTRUE;
739 }
740 break;
741 }
742
743 return MStatusDisplay::ProcessMessage(msg, mp1, mp2);
744}
Note: See TracBrowser for help on using the repository browser.