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

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