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

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