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

Last change on this file since 8353 was 8339, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 22.9 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.58 2007-03-01 17:39:59 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 pedsub->SetNamePedestalCam();
311 //MCalibrationRelTimeCalc *tcalc = new MCalibrationRelTimeCalc;
312
313 // MC
314 mcupd->SetFilter(f1);
315 //trcal->SetFilter(f1);
316
317 // TaskList
318 tlist->AddToList(f1);
319 tlist->AddToList(pcopy);
320 tlist->AddToList(pdnsb);
321
322 tlist->AddToList(decode);
323
324 tlist->AddToList(pedsub);
325
326 tlist->AddToList(nanal); // Calculated MPedPhotCam
327 tlist->AddToList(taskenv1); // Calculates MExtractedSignalCam, MArrivalTimeCam
328 tlist->AddToList(mcupd);
329 tlist->AddToList(calib); // MExtractedSignalCam --> MSignalCam
330
331 //tlist->AddToList(bcalc); // Produce MBadPixelsCam
332 //tlist->AddToList(btreat); // Treat MBadPixelsCam
333 }
334
335 tlist->AddToList(fill01);
336 tlist->AddToList(clean);
337 tlist->AddToList(fill02);
338 if (type==2)
339 tlist->AddToList(fill03);
340 tlist->AddToList(fill04);
341 tlist->AddToList(fill06a);
342 tlist->AddToList(fill06b);
343 tlist->AddToList(fill10);
344 if (type==2)
345 {
346 MFillH *fill07 = new MFillH(evt07, "MRawEvtData", "MFillH7");
347 MFillH *fill08 = new MFillH(evt08, "MArrivalTimeCam", "MFillH8");
348 tlist->AddToList(fill07);
349 tlist->AddToList(fill08);
350
351 //tlist->AddToList(trcal);
352 //tlist->AddToList(fill09);
353 }
354 if (type==1)
355 {
356 MFillH *fill08 = new MFillH(evt08, "MSignalCam", "MFillH8");
357 MFillH *fill09 = new MFillH(evt09, "MSignalCam", "MFillH9");
358 tlist->AddToList(fill08);
359 tlist->AddToList(fill09);
360 }
361 tlist->AddToList(hcalc);
362
363 // --------------------------------------------------
364 // Muon Analysis
365 MMuonSearchParCalc *muscalc = new MMuonSearchParCalc;
366 MMuonCalibParCalc *mcalc = new MMuonCalibParCalc;
367 MFillH *fillmuon = new MFillH("MHSingleMuon", "", "FillMuon");
368 fillmuon->SetNameTab("Muon");
369 tlist->AddToList(muscalc);
370 tlist->AddToList(fillmuon);
371 tlist->AddToList(mcalc);
372
373 // --------------------------------------------------
374 // Cut to steer the display
375 MContinue *cont0=new MContinue("", "Cut");
376 cont0->SetAllowEmpty();
377 tlist->AddToList(cont0);
378
379 //
380 // Now distribute Display to all tasks
381 //
382 fEvtLoop = new MEvtLoop(gSystem->BaseName(fname));
383 fEvtLoop->SetOwner();
384 fEvtLoop->SetParList(plist);
385 fEvtLoop->SetDisplay(this);
386 fEvtLoop->ReadEnv("mars.rc");
387
388}
389
390// --------------------------------------------------------------------------
391//
392// Add the top part of the frame: This is filename and treename display
393//
394void MEventDisplay::AddTopFramePart1(TGCompositeFrame *frame,
395 const char *filename,
396 const char *treename)
397{
398 //
399 // --- the top1 part of the window ---
400 //
401 TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 1, 1);
402 fList->Add(top1);
403
404 //
405 // create gui elements
406 //
407 TGLabel *file = new TGLabel(top1, new TGString(Form("%s#%s", filename, treename)));
408 fList->Add(file);
409
410 //
411 // layout and add gui elements in/to frame
412 //
413 TGLayoutHints *laystd = new TGLayoutHints(kLHintsCenterX, 5, 5);
414 fList->Add(laystd);
415
416 top1->AddFrame(file, laystd);
417
418 //
419 // --- the top1 part of the window ---
420 //
421 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
422 fList->Add(top2);
423
424 //
425 // layout and add frames
426 //
427 TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5);
428 fList->Add(laytop1);
429 frame->AddFrame(top1, laytop1);
430 frame->AddFrame(top2, laytop1);
431}
432
433// --------------------------------------------------------------------------
434//
435// Add the second part of the top frame: This are the event number controls
436//
437void MEventDisplay::AddTopFramePart2(TGCompositeFrame *frame)
438{
439 //
440 // --- the top2 part of the window ---
441 //
442 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
443 fList->Add(top2);
444
445 //
446 // Create the gui elements
447 //
448 TGTextButton *prevevt = new TGTextButton(top2, " << ", kEvtPrev);
449 prevevt->Associate(this);
450
451 TGLabel *evtnr = new TGLabel(top2, new TGString("Event:"));
452
453 TGTextEntry *entry=new TGTextEntry(top2, new TGTextBuffer(100), kEvtNumber);
454 entry->Resize(60, entry->GetDefaultHeight());
455 entry->Associate(this);
456
457 fNumOfEvts = new TGLabel(top2, "of .");
458
459 TGTextButton *nextevt = new TGTextButton (top2, " >> ", kEvtNext);
460 nextevt->Associate(this);
461
462 //
463 // Add gui elements to 'atotodel'
464 //
465 fList->Add(prevevt);
466 fList->Add(evtnr);
467 fList->Add(entry);
468 fList->Add(fNumOfEvts);
469 fList->Add(nextevt);
470
471 //
472 // add the gui elements to the frame
473 //
474 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5);
475 fList->Add(laystd);
476
477 top2->AddFrame(prevevt, laystd);
478 top2->AddFrame(evtnr, laystd);
479 top2->AddFrame(entry, laystd);
480 top2->AddFrame(fNumOfEvts, laystd);
481 top2->AddFrame(nextevt, laystd);
482
483 TGLayoutHints *laystd2 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5, 5);
484 fList->Add(laystd2);
485 frame->AddFrame(top2, laystd2);
486
487 //
488 // Add trailing line...
489 //
490 TGHorizontal3DLine *line = new TGHorizontal3DLine(frame);
491 TGLayoutHints *layline = new TGLayoutHints(kLHintsExpandX);
492 fList->Add(line);
493 fList->Add(layline);
494 frame->AddFrame(line, layline);
495}
496
497// --------------------------------------------------------------------------
498//
499// Add the user frame part of the display
500//
501void MEventDisplay::AddUserFrame(const char* filename)
502{
503 fUserFrame->ChangeOptions(kHorizontalFrame);
504
505 TGCompositeFrame *vf1 = new TGVerticalFrame(fUserFrame, 1, 1);
506 TGCompositeFrame *vf2 = new TGVerticalFrame(fUserFrame, 1, 1);
507
508 AddTopFramePart1(vf1, filename, "Events");
509 AddTopFramePart2(vf1);
510
511 // create root embedded canvas and add it to the tab
512 TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas("Slices", vf2, vf1->GetDefaultHeight()*3/2, vf1->GetDefaultHeight(), 0);
513 vf2->AddFrame(ec);
514 fList->Add(ec);
515
516 // set background and border mode of the canvas
517 fCanvas = ec->GetCanvas();
518 fCanvas->SetBorderMode(0);
519 gROOT->GetListOfCanvases()->Add(fCanvas);
520 //fCanvas->SetBorderSize(1);
521 //fCanvas->SetBit(kNoContextMenu);
522 //fCanvas->SetFillColor(16);
523
524 TGLayoutHints *lay = new TGLayoutHints(kLHintsExpandX);
525 fUserFrame->AddFrame(vf1, lay);
526 fUserFrame->AddFrame(vf2);
527}
528
529// --------------------------------------------------------------------------
530//
531// Checks if the event number is valid, and if so reads the new event
532// and updates the display
533//
534void MEventDisplay::ReadinEvent(Int_t dir)
535{
536 MParList *plist = (MParList*) fEvtLoop->GetParList();
537 MTaskList *tlist = (MTaskList*) fEvtLoop->GetTaskList();
538 MGeomCam *geom = (MGeomCam*) plist->FindObject("MGeomCam");
539 MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");
540
541 //
542 // Read first event.
543 //
544 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
545
546 const Int_t num = reader->GetNumEntry();
547
548 Int_t rc;
549 do
550 {
551 if (dir<0 && !reader->DecEventNum())
552 {
553 reader->SetEventNum(num);
554 return;
555 }
556 if (dir>0 && !reader->IncEventNum())
557 {
558 reader->SetEventNum(num);
559 return;
560 }
561
562 rc = tlist->Process();
563 if (rc==kFALSE || rc==kERROR)
564 return;
565
566 reader->DecEventNum();
567
568 // Define other continue conditions
569 if (raw && raw->GetNumPixels()<1)
570 rc = kCONTINUE;
571
572 } while (rc==kCONTINUE && dir!=0);
573
574 //
575 // Cleare the 'FADC canvas'
576 //
577 fCanvas->Clear();
578 fCanvas->Modified();
579 fCanvas->Update();
580
581 //
582 // Print parameters
583 //
584 *fLog << all;
585 fLog->Separator(Form("Entry %d", reader->GetNumEntry()+1));
586 ((MHillas*) plist->FindObject("MHillas"))->Print(*geom);
587 ((MHillasExt*) plist->FindObject("MHillasExt"))->Print(*geom);
588 ((MHillasSrc*) plist->FindObject("MHillasSrc"))->Print(*geom);
589 plist->FindObject("MImagePar")->Print();
590 ((MNewImagePar*)plist->FindObject("MNewImagePar"))->Print(*geom);
591 plist->FindObject("MMuonCalibPar")->Print();
592 ((MMuonSearchPar*)plist->FindObject("MMuonSearchPar"))->Print(*geom);
593
594 //
595 // UpdateDisplay
596 //
597 gStyle->SetOptStat(1101);
598 Update();
599
600 TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
601 entry->SetText(Form("%d", reader->GetNumEntry()+1));
602}
603
604// --------------------------------------------------------------------------
605//
606// Read first event to get display booted
607//
608void MEventDisplay::ReadFirstEvent()
609{
610 const Int_t rc = fEvtLoop->PreProcess();
611 if (rc==kFALSE || rc==kERROR)
612 return;
613
614 UnLock();
615
616 //
617 // Get parlist
618 //
619 MParList *plist = (MParList*)fEvtLoop->GetParList();
620
621 //
622 // Add Geometry tab
623 //
624 AddGeometryTabs();
625
626 //
627 // Now read event...
628 //
629 // FIXME: Can we safly replace ReadinEvent() by RedinEvent(1)?
630 ReadinEvent();
631
632
633 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
634 TGString *txt = new TGString(Form("of %d", reader->GetEntries()));
635 fNumOfEvts->SetText(txt);
636
637 //
638 // Draw ellipse on top of all pads
639 //
640 TObject *hillas1 = plist->FindObject("MHillas");
641 TObject *hillas2 = plist->FindObject("MHillasSrc");
642 TObject *hillas3 = plist->FindObject("MHillasExt");
643 TObject *hmuon = plist->FindObject("MMuonSearchPar");
644 for (int i=1; i<7;i++)
645 {
646 TCanvas *c = GetCanvas(i);
647 c->GetPad(1)->cd(1);
648 hmuon->Draw();
649 hillas1->Draw();
650 hillas2->Draw();
651 hillas3->Draw();
652 }
653}
654
655// --------------------------------------------------------------------------
656//
657// Adds the geometry tab
658//
659void MEventDisplay::AddGeometryTabs()
660{
661 MGeomCam *geom = (MGeomCam*)fEvtLoop->GetParList()->FindObject("MGeomCam");
662 if (!geom)
663 return;
664
665 TCanvas &c1=AddTab("Geometry");
666
667 MHCamera *cam = new MHCamera(*geom);
668 cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
669 cam->Draw("pixelindex");
670
671 c1.Modified();
672 c1.Update();
673
674 TCanvas &c2=AddTab("Sectors");
675
676 cam = new MHCamera(*geom);
677 cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend|kCanDelete);
678 cam->Draw("sectorindex");
679
680 c2.Modified();
681 c2.Update();
682}
683
684// --------------------------------------------------------------------------
685//
686// ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
687//
688// Processes information from all GUI items.
689// Selecting an item usually generates an event with 4 parameters.
690// The first two are packed into msg (first and second bytes).
691// The other two are parm1 and parm2.
692//
693Bool_t MEventDisplay::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
694{
695 switch (GET_MSG(msg))
696 {
697 case kC_TEXTENTRY:
698 switch(GET_SUBMSG(msg))
699 {
700 case kTE_ENTER:
701 switch(GET_SUBMSG(msg))
702 {
703 case kTE_ENTER:
704 {
705 TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
706 MReadTree *reader = (MReadTree*)fEvtLoop->FindTask("MRead");
707 if (reader->SetEventNum(atoi(entry->GetText())-1))
708 ReadinEvent();
709 }
710 return kTRUE;
711 }
712 return kTRUE;
713 }
714 break;
715
716 case kC_COMMAND:
717 switch (GET_SUBMSG(msg))
718 {
719 case kCM_TAB:
720 {
721 //
722 // Set name for 'FADC canvas'. The name is the anchor for MHCamera.
723 // and clear the canvas
724 TCanvas *c = GetCanvas(mp1);
725 if (!c)
726 break;
727 MHEvent *o = (MHEvent*)fEvtLoop->GetParList()->FindObject(c->GetName());
728 if (!o)
729 break;
730 fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(), c->GetPad(1)->GetPad(1)));
731 }
732 break;
733
734 case kCM_BUTTON:
735 switch (mp1)
736 {
737 case kEvtPrev:
738 ReadinEvent(-1);
739 return kTRUE;
740
741 case kEvtNext:
742 ReadinEvent(+1);
743 return kTRUE;
744 }
745 return kTRUE;
746 }
747 break;
748 }
749
750 return MStatusDisplay::ProcessMessage(msg, mp1, mp2);
751}
Note: See TracBrowser for help on using the repository browser.