| 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 <TList.h> // TList::Add
|
|---|
| 35 | #include <TStyle.h> // gStyle->SetOptStat
|
|---|
| 36 | #include <TCanvas.h> // TCanvas::cd
|
|---|
| 37 |
|
|---|
| 38 | //
|
|---|
| 39 | // root GUI
|
|---|
| 40 | //
|
|---|
| 41 | #include <TGLabel.h> // TGLabel
|
|---|
| 42 | #include <TGButton.h> // TGPictureButton
|
|---|
| 43 | #include <TG3DLine.h> // TGHorizontal3DLine
|
|---|
| 44 | #include <TGTextEntry.h> // TGTextEntry
|
|---|
| 45 | #include <TGButtonGroup.h> // TGVButtonGroup
|
|---|
| 46 | #include <TRootEmbeddedCanvas.h> // TRootEmbeddedCanvas
|
|---|
| 47 |
|
|---|
| 48 | //
|
|---|
| 49 | // General
|
|---|
| 50 | //
|
|---|
| 51 | #include "MGList.h" // MGList
|
|---|
| 52 |
|
|---|
| 53 | #include "MParList.h" // MParList::AddToList
|
|---|
| 54 | #include "MEvtLoop.h" // MEvtLoop::GetParList
|
|---|
| 55 | #include "MTaskList.h" // MTaskList::AddToList
|
|---|
| 56 |
|
|---|
| 57 | //
|
|---|
| 58 | // Tasks
|
|---|
| 59 | //
|
|---|
| 60 | #include "MReadMarsFile.h" // MReadMarsFile
|
|---|
| 61 | #include "MGeomApply.h" // MGeomApply
|
|---|
| 62 | #include "MMcPedestalCopy.h" // MMcPedestalCopy
|
|---|
| 63 | #include "MMcPedestalNSBAdd.h" // MMcPedestalNSBAdd
|
|---|
| 64 | #include "MCerPhotCalc.h" // MCerPhotCalc
|
|---|
| 65 | #include "MImgCleanStd.h" // MImgCleanStd
|
|---|
| 66 | #include "MHillasCalc.h" // MHillasCalc
|
|---|
| 67 | #include "MHillasSrcCalc.h" // MHillasSrcCalc
|
|---|
| 68 | #include "MBlindPixelCalc.h" // MBlindPixelCalc
|
|---|
| 69 | #include "MFillH.h" // MFillH
|
|---|
| 70 |
|
|---|
| 71 | //
|
|---|
| 72 | // Container
|
|---|
| 73 | //
|
|---|
| 74 | #include "MHEvent.h" // MHEvent
|
|---|
| 75 | #include "MHCamera.h" // MHCamera
|
|---|
| 76 | #include "MRawEvtData.h" // MRawEvtData
|
|---|
| 77 |
|
|---|
| 78 | ClassImp(MEventDisplay);
|
|---|
| 79 |
|
|---|
| 80 | // --------------------------------------------------------------------------
|
|---|
| 81 | //
|
|---|
| 82 | // Constructor.
|
|---|
| 83 | //
|
|---|
| 84 | MEventDisplay::MEventDisplay(const char *filename) : MStatusDisplay()
|
|---|
| 85 | {
|
|---|
| 86 | //
|
|---|
| 87 | // Setup Task list for hillas calculation
|
|---|
| 88 | //
|
|---|
| 89 | SetupTaskList("Events", filename);
|
|---|
| 90 |
|
|---|
| 91 | //
|
|---|
| 92 | // Add MEventDisplay GUI elements to the display
|
|---|
| 93 | //
|
|---|
| 94 | AddUserFrame(filename);
|
|---|
| 95 |
|
|---|
| 96 | //
|
|---|
| 97 | // Show new part of the window, resize to correct aspect ratio
|
|---|
| 98 | //
|
|---|
| 99 | // FIXME: This should be done by MStatusDisplay automatically
|
|---|
| 100 | Resize(GetWidth(), GetHeight() + fUserFrame->GetDefaultHeight());
|
|---|
| 101 | SetWindowName("Event Display");
|
|---|
| 102 | MapSubwindows();
|
|---|
| 103 |
|
|---|
| 104 | //
|
|---|
| 105 | // Readin foirst event and display it
|
|---|
| 106 | //
|
|---|
| 107 | ReadFirstEvent();
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | // --------------------------------------------------------------------------
|
|---|
| 111 | //
|
|---|
| 112 | // Destructor: PostProcess eventloop, delete eventloop with all containers
|
|---|
| 113 | //
|
|---|
| 114 | MEventDisplay::~MEventDisplay()
|
|---|
| 115 | {
|
|---|
| 116 | fEvtLoop->PostProcess();
|
|---|
| 117 | delete fEvtLoop;
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | // --------------------------------------------------------------------------
|
|---|
| 121 | //
|
|---|
| 122 | // Return reading task
|
|---|
| 123 | //
|
|---|
| 124 | MReadTree *MEventDisplay::GetReader() const
|
|---|
| 125 | {
|
|---|
| 126 | MParList *plist = (MParList*)fEvtLoop->GetParList();
|
|---|
| 127 | MTaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");
|
|---|
| 128 | MReadTree *reader = (MReadTree*)tlist->FindObject("MRead");
|
|---|
| 129 | return reader;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | // --------------------------------------------------------------------------
|
|---|
| 133 | //
|
|---|
| 134 | // Setup Task and parameter list for hillas calculation,
|
|---|
| 135 | // preprocess tasks and read in first event (process)
|
|---|
| 136 | //
|
|---|
| 137 | void MEventDisplay::SetupTaskList(const char *tname, const char *fname)
|
|---|
| 138 | {
|
|---|
| 139 | //
|
|---|
| 140 | // Setup an empty job, with a reader task only.
|
|---|
| 141 | // All tasks and parameter containers are deleted automatically
|
|---|
| 142 | // (via SetOwner())
|
|---|
| 143 | //
|
|---|
| 144 | MTaskList *tlist = new MTaskList;
|
|---|
| 145 | tlist->SetOwner();
|
|---|
| 146 |
|
|---|
| 147 | MReadMarsFile *read = new MReadMarsFile(tname, fname);
|
|---|
| 148 | read->DisableAutoScheme();
|
|---|
| 149 | tlist->AddToList(read);
|
|---|
| 150 |
|
|---|
| 151 | MGeomApply *apl = new MGeomApply;
|
|---|
| 152 | tlist->AddToList(apl);
|
|---|
| 153 |
|
|---|
| 154 | MParList *plist = new MParList;
|
|---|
| 155 | plist->SetOwner();
|
|---|
| 156 | plist->AddToList(tlist);
|
|---|
| 157 |
|
|---|
| 158 | fEvtLoop = new MEvtLoop;
|
|---|
| 159 | fEvtLoop->SetOwner();
|
|---|
| 160 | fEvtLoop->SetParList(plist);
|
|---|
| 161 |
|
|---|
| 162 | MHEvent *evt1 = new MHEvent(MHEvent::kEvtSignal);
|
|---|
| 163 | MHEvent *evt2 = new MHEvent(MHEvent::kEvtSignal);
|
|---|
| 164 | MHEvent *evt3 = new MHEvent(MHEvent::kEvtPedestal);
|
|---|
| 165 | MHEvent *evt4 = new MHEvent(MHEvent::kEvtPedestalRMS);
|
|---|
| 166 | MHEvent *evt5 = new MHEvent(MHEvent::kEvtRelativeSignal);
|
|---|
| 167 | MHEvent *evt6 = new MHEvent(MHEvent::kEvtCleaningLevels);
|
|---|
| 168 | evt1->SetName("Signal");
|
|---|
| 169 | evt2->SetName("Cleaned");
|
|---|
| 170 | evt3->SetName("Pedestal");
|
|---|
| 171 | evt4->SetName("PedRMS");
|
|---|
| 172 | evt5->SetName("Signal/PedRMS");
|
|---|
| 173 | evt6->SetName("CleanLevels");
|
|---|
| 174 | plist->AddToList(evt1);
|
|---|
| 175 | plist->AddToList(evt2);
|
|---|
| 176 | plist->AddToList(evt3);
|
|---|
| 177 | plist->AddToList(evt4);
|
|---|
| 178 | plist->AddToList(evt5);
|
|---|
| 179 | plist->AddToList(evt6);
|
|---|
| 180 |
|
|---|
| 181 | MMcPedestalCopy *pcopy = new MMcPedestalCopy;
|
|---|
| 182 | MMcPedestalNSBAdd *pdnsb = new MMcPedestalNSBAdd;
|
|---|
| 183 | MCerPhotCalc *ncalc = new MCerPhotCalc;
|
|---|
| 184 | MFillH *fill1 = new MFillH(evt1, "MCerPhotEvt", "MFillH1");
|
|---|
| 185 | MImgCleanStd *clean = new MImgCleanStd;
|
|---|
| 186 | MFillH *fill2 = new MFillH(evt2, "MCerPhotEvt", "MFillH2");
|
|---|
| 187 | MFillH *fill3 = new MFillH(evt3, "MPedestalCam", "MFillH3");
|
|---|
| 188 | MFillH *fill4 = new MFillH(evt4, "MPedestalCam", "MFillH4");
|
|---|
| 189 | MFillH *fill5 = new MFillH(evt5, "MCameraData", "MFillH5");
|
|---|
| 190 | MFillH *fill6 = new MFillH(evt6, "MCameraData", "MFillH6");
|
|---|
| 191 | MBlindPixelCalc *blind = new MBlindPixelCalc;
|
|---|
| 192 | MHillasCalc *hcalc = new MHillasCalc;
|
|---|
| 193 | MHillasSrcCalc *scalc = new MHillasSrcCalc;
|
|---|
| 194 |
|
|---|
| 195 | tlist->AddToList(pcopy);
|
|---|
| 196 | tlist->AddToList(pdnsb);
|
|---|
| 197 | tlist->AddToList(ncalc);
|
|---|
| 198 | tlist->AddToList(fill1);
|
|---|
| 199 | tlist->AddToList(clean);
|
|---|
| 200 | tlist->AddToList(fill2);
|
|---|
| 201 | tlist->AddToList(fill3);
|
|---|
| 202 | tlist->AddToList(fill4);
|
|---|
| 203 | tlist->AddToList(fill5);
|
|---|
| 204 | tlist->AddToList(fill6);
|
|---|
| 205 | tlist->AddToList(blind);
|
|---|
| 206 | tlist->AddToList(hcalc);
|
|---|
| 207 | tlist->AddToList(scalc);
|
|---|
| 208 |
|
|---|
| 209 | //
|
|---|
| 210 | // Now distribute Display to all tasks
|
|---|
| 211 | //
|
|---|
| 212 | tlist->SetDisplay(this);
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | // --------------------------------------------------------------------------
|
|---|
| 216 | //
|
|---|
| 217 | // Add the top part of the frame: This is filename and treename display
|
|---|
| 218 | //
|
|---|
| 219 | void MEventDisplay::AddTopFramePart1(TGCompositeFrame *frame,
|
|---|
| 220 | const char *filename,
|
|---|
| 221 | const char *treename)
|
|---|
| 222 | {
|
|---|
| 223 | //
|
|---|
| 224 | // --- the top1 part of the window ---
|
|---|
| 225 | //
|
|---|
| 226 | TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 1, 1);
|
|---|
| 227 | fList->Add(top1);
|
|---|
| 228 |
|
|---|
| 229 | //
|
|---|
| 230 | // create gui elements
|
|---|
| 231 | //
|
|---|
| 232 | TGLabel *file = new TGLabel(top1, new TGString(Form("%s#%s", filename, treename)));
|
|---|
| 233 | fList->Add(file);
|
|---|
| 234 |
|
|---|
| 235 | //
|
|---|
| 236 | // layout and add gui elements in/to frame
|
|---|
| 237 | //
|
|---|
| 238 | TGLayoutHints *laystd = new TGLayoutHints(kLHintsCenterX, 5, 5);
|
|---|
| 239 | fList->Add(laystd);
|
|---|
| 240 |
|
|---|
| 241 | top1->AddFrame(file, laystd);
|
|---|
| 242 |
|
|---|
| 243 | //
|
|---|
| 244 | // --- the top1 part of the window ---
|
|---|
| 245 | //
|
|---|
| 246 | TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
|
|---|
| 247 | fList->Add(top2);
|
|---|
| 248 |
|
|---|
| 249 | //
|
|---|
| 250 | // layout and add frames
|
|---|
| 251 | //
|
|---|
| 252 | TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5);
|
|---|
| 253 | fList->Add(laytop1);
|
|---|
| 254 | frame->AddFrame(top1, laytop1);
|
|---|
| 255 | frame->AddFrame(top2, laytop1);
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | // --------------------------------------------------------------------------
|
|---|
| 259 | //
|
|---|
| 260 | // Add the second part of the top frame: This are the event number controls
|
|---|
| 261 | //
|
|---|
| 262 | void MEventDisplay::AddTopFramePart2(TGCompositeFrame *frame)
|
|---|
| 263 | {
|
|---|
| 264 | //
|
|---|
| 265 | // --- the top2 part of the window ---
|
|---|
| 266 | //
|
|---|
| 267 | TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 1, 1);
|
|---|
| 268 | fList->Add(top2);
|
|---|
| 269 |
|
|---|
| 270 | //
|
|---|
| 271 | // Create the gui elements
|
|---|
| 272 | //
|
|---|
| 273 | TGTextButton *prevevt = new TGTextButton(top2, " << ", kEvtPrev);
|
|---|
| 274 | prevevt->Associate(this);
|
|---|
| 275 |
|
|---|
| 276 | TGLabel *evtnr = new TGLabel(top2, new TGString("Event:"));
|
|---|
| 277 |
|
|---|
| 278 | TGTextEntry *entry=new TGTextEntry(top2, new TGTextBuffer(100), kEvtNumber);
|
|---|
| 279 | entry->Resize(60, entry->GetDefaultHeight());
|
|---|
| 280 | entry->Associate(this);
|
|---|
| 281 |
|
|---|
| 282 | fNumOfEvts = new TGLabel(top2, "of .");
|
|---|
| 283 |
|
|---|
| 284 | TGTextButton *nextevt = new TGTextButton (top2, " >> ", kEvtNext);
|
|---|
| 285 | nextevt->Associate(this);
|
|---|
| 286 |
|
|---|
| 287 | //
|
|---|
| 288 | // Add gui elements to 'atotodel'
|
|---|
| 289 | //
|
|---|
| 290 | fList->Add(prevevt);
|
|---|
| 291 | fList->Add(evtnr);
|
|---|
| 292 | fList->Add(entry);
|
|---|
| 293 | fList->Add(fNumOfEvts);
|
|---|
| 294 | fList->Add(nextevt);
|
|---|
| 295 |
|
|---|
| 296 | //
|
|---|
| 297 | // add the gui elements to the frame
|
|---|
| 298 | //
|
|---|
| 299 | TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft|kLHintsCenterY, 5, 5);
|
|---|
| 300 | fList->Add(laystd);
|
|---|
| 301 |
|
|---|
| 302 | top2->AddFrame(prevevt, laystd);
|
|---|
| 303 | top2->AddFrame(evtnr, laystd);
|
|---|
| 304 | top2->AddFrame(entry, laystd);
|
|---|
| 305 | top2->AddFrame(fNumOfEvts, laystd);
|
|---|
| 306 | top2->AddFrame(nextevt, laystd);
|
|---|
| 307 |
|
|---|
| 308 | TGLayoutHints *laystd2 = new TGLayoutHints(kLHintsCenterX, 5, 5, 5, 5);
|
|---|
| 309 | fList->Add(laystd2);
|
|---|
| 310 | frame->AddFrame(top2, laystd2);
|
|---|
| 311 |
|
|---|
| 312 | //
|
|---|
| 313 | // Add trailing line...
|
|---|
| 314 | //
|
|---|
| 315 | TGHorizontal3DLine *line = new TGHorizontal3DLine(frame);
|
|---|
| 316 | TGLayoutHints *layline = new TGLayoutHints(kLHintsExpandX);
|
|---|
| 317 | fList->Add(line);
|
|---|
| 318 | fList->Add(layline);
|
|---|
| 319 | frame->AddFrame(line, layline);
|
|---|
| 320 | }
|
|---|
| 321 |
|
|---|
| 322 | // --------------------------------------------------------------------------
|
|---|
| 323 | //
|
|---|
| 324 | // Add the user frame part of the display
|
|---|
| 325 | //
|
|---|
| 326 | void MEventDisplay::AddUserFrame(const char* filename)
|
|---|
| 327 | {
|
|---|
| 328 | fUserFrame->ChangeOptions(kHorizontalFrame);
|
|---|
| 329 |
|
|---|
| 330 | TGCompositeFrame *vf1 = new TGVerticalFrame(fUserFrame, 1, 1);
|
|---|
| 331 | TGCompositeFrame *vf2 = new TGVerticalFrame(fUserFrame, 1, 1);
|
|---|
| 332 |
|
|---|
| 333 | AddTopFramePart1(vf1, filename, "Events");
|
|---|
| 334 | AddTopFramePart2(vf1);
|
|---|
| 335 |
|
|---|
| 336 | // create root embedded canvas and add it to the tab
|
|---|
| 337 | TRootEmbeddedCanvas *ec = new TRootEmbeddedCanvas("Slices", vf2, vf1->GetDefaultHeight()*3/2, vf1->GetDefaultHeight(), 0);
|
|---|
| 338 | vf2->AddFrame(ec);
|
|---|
| 339 | fList->Add(ec);
|
|---|
| 340 |
|
|---|
| 341 | // set background and border mode of the canvas
|
|---|
| 342 | fCanvas = ec->GetCanvas();
|
|---|
| 343 | fCanvas->SetBorderMode(0);
|
|---|
| 344 | gROOT->GetListOfCanvases()->Add(fCanvas);
|
|---|
| 345 | //fCanvas->SetBorderSize(1);
|
|---|
| 346 | //fCanvas->SetBit(kNoContextMenu);
|
|---|
| 347 | //fCanvas->SetFillColor(16);
|
|---|
| 348 |
|
|---|
| 349 | TGLayoutHints *lay = new TGLayoutHints(kLHintsExpandX);
|
|---|
| 350 | fUserFrame->AddFrame(vf1, lay);
|
|---|
| 351 | fUserFrame->AddFrame(vf2);
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | // --------------------------------------------------------------------------
|
|---|
| 355 | //
|
|---|
| 356 | // Checks if the event number is valid, and if so reads the new event
|
|---|
| 357 | // and updates the display
|
|---|
| 358 | //
|
|---|
| 359 | void MEventDisplay::ReadinEvent(Int_t dir)
|
|---|
| 360 | {
|
|---|
| 361 | MParList *plist = (MParList*)fEvtLoop->GetParList();
|
|---|
| 362 | MTaskList *tlist = (MTaskList*)plist->FindObject("MTaskList");
|
|---|
| 363 | MRawEvtData *raw = (MRawEvtData*)plist->FindObject("MRawEvtData");
|
|---|
| 364 | if (!raw)
|
|---|
| 365 | return;
|
|---|
| 366 |
|
|---|
| 367 | //
|
|---|
| 368 | // Read first event.
|
|---|
| 369 | //
|
|---|
| 370 | MReadTree *reader = GetReader();
|
|---|
| 371 |
|
|---|
| 372 | const Int_t num = reader->GetNumEntry();
|
|---|
| 373 |
|
|---|
| 374 | do
|
|---|
| 375 | {
|
|---|
| 376 | if (dir<0 && !reader->DecEventNum())
|
|---|
| 377 | {
|
|---|
| 378 | reader->SetEventNum(num);
|
|---|
| 379 | return;
|
|---|
| 380 | }
|
|---|
| 381 | if (dir>0 && !reader->IncEventNum())
|
|---|
| 382 | {
|
|---|
| 383 | reader->SetEventNum(num);
|
|---|
| 384 | return;
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 | if (!tlist->Process())
|
|---|
| 388 | return;
|
|---|
| 389 |
|
|---|
| 390 | reader->DecEventNum();
|
|---|
| 391 |
|
|---|
| 392 | } while (raw->GetNumPixels()<1 && dir!=0);
|
|---|
| 393 |
|
|---|
| 394 | //
|
|---|
| 395 | // Cleare the 'FADC canvas'
|
|---|
| 396 | //
|
|---|
| 397 | fCanvas->Clear();
|
|---|
| 398 | fCanvas->Modified();
|
|---|
| 399 | fCanvas->Update();
|
|---|
| 400 |
|
|---|
| 401 | //
|
|---|
| 402 | // Print parameters
|
|---|
| 403 | //
|
|---|
| 404 | plist->FindObject("MHillas")->Print();
|
|---|
| 405 | plist->FindObject("MHillasExt")->Print();
|
|---|
| 406 | plist->FindObject("MHillasSrc")->Print();
|
|---|
| 407 | plist->FindObject("MNewImagePar")->Print();
|
|---|
| 408 |
|
|---|
| 409 | //
|
|---|
| 410 | // UpdateDisplay
|
|---|
| 411 | //
|
|---|
| 412 | gStyle->SetOptStat(1101);
|
|---|
| 413 | Update();
|
|---|
| 414 |
|
|---|
| 415 | TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
|
|---|
| 416 | entry->SetText(Form("%d", reader->GetNumEntry()+1));
|
|---|
| 417 | }
|
|---|
| 418 |
|
|---|
| 419 | // --------------------------------------------------------------------------
|
|---|
| 420 | //
|
|---|
| 421 | // Read first event to get display booted
|
|---|
| 422 | //
|
|---|
| 423 | void MEventDisplay::ReadFirstEvent()
|
|---|
| 424 | {
|
|---|
| 425 | if (!fEvtLoop->PreProcess())
|
|---|
| 426 | return;
|
|---|
| 427 |
|
|---|
| 428 | //
|
|---|
| 429 | // Get parlist
|
|---|
| 430 | //
|
|---|
| 431 | MParList *plist = (MParList*)fEvtLoop->GetParList();
|
|---|
| 432 |
|
|---|
| 433 | //
|
|---|
| 434 | // Add Geometry tab
|
|---|
| 435 | //
|
|---|
| 436 | MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam");
|
|---|
| 437 |
|
|---|
| 438 | TCanvas &c=AddTab("Geometry");
|
|---|
| 439 |
|
|---|
| 440 | c.SetFillColor(16);
|
|---|
| 441 |
|
|---|
| 442 | MHCamera *cam = new MHCamera(*geom);
|
|---|
| 443 | cam->SetBit(TH1::kNoStats|MHCamera::kNoLegend);
|
|---|
| 444 | cam->Draw();
|
|---|
| 445 | cam->DrawPixelIndices();
|
|---|
| 446 | fList->Add(cam);
|
|---|
| 447 |
|
|---|
| 448 | c.Modified();
|
|---|
| 449 | c.Update();
|
|---|
| 450 |
|
|---|
| 451 | //
|
|---|
| 452 | // Now read event...
|
|---|
| 453 | //
|
|---|
| 454 | ReadinEvent();
|
|---|
| 455 |
|
|---|
| 456 | TGString *txt = new TGString(Form("of %d.", GetReader()->GetEntries()));
|
|---|
| 457 | fNumOfEvts->SetText(txt);
|
|---|
| 458 |
|
|---|
| 459 | //
|
|---|
| 460 | // Set name for 'FADC canvas'. The name is the anchor for MHCamera.
|
|---|
| 461 | // and clear the canvas
|
|---|
| 462 | //
|
|---|
| 463 | MHEvent *o = (MHEvent*)plist->FindObject("Signal");
|
|---|
| 464 | fCanvas->SetName(Form("%p;%p;PixelContent", o->GetHist(),
|
|---|
| 465 | GetCanvas(1)->GetPad(1)->GetPad(1)));
|
|---|
| 466 |
|
|---|
| 467 | //
|
|---|
| 468 | // Draw ellipse on top of all pads
|
|---|
| 469 | //
|
|---|
| 470 | TObject *hillas = plist->FindObject("MHillas");
|
|---|
| 471 | for (int i=1; i<7;i++)
|
|---|
| 472 | {
|
|---|
| 473 | TCanvas *c = GetCanvas(i);
|
|---|
| 474 | c->GetPad(1)->cd(1);
|
|---|
| 475 | hillas->Draw();
|
|---|
| 476 | }
|
|---|
| 477 | }
|
|---|
| 478 |
|
|---|
| 479 | // --------------------------------------------------------------------------
|
|---|
| 480 | //
|
|---|
| 481 | // Adds the geometry tab
|
|---|
| 482 | //
|
|---|
| 483 | void MEventDisplay::AddGeometryTab()
|
|---|
| 484 | {
|
|---|
| 485 | MGeomCam *geom = (MGeomCam*)fEvtLoop->GetParList()->FindObject("MGeomCam");
|
|---|
| 486 | if (!geom)
|
|---|
| 487 | return;
|
|---|
| 488 |
|
|---|
| 489 | TCanvas &c=AddTab("Geometry");
|
|---|
| 490 |
|
|---|
| 491 | MHCamera *cam = new MHCamera(*geom);
|
|---|
| 492 | cam->SetBit(TH1::kNoStats);
|
|---|
| 493 | cam->Draw();
|
|---|
| 494 | cam->DrawPixelIndices();
|
|---|
| 495 | fList->Add(cam);
|
|---|
| 496 |
|
|---|
| 497 | c.Modified();
|
|---|
| 498 | c.Update();
|
|---|
| 499 | }
|
|---|
| 500 |
|
|---|
| 501 | // --------------------------------------------------------------------------
|
|---|
| 502 | //
|
|---|
| 503 | // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
|
|---|
| 504 | //
|
|---|
| 505 | // Processes information from all GUI items.
|
|---|
| 506 | // Selecting an item usually generates an event with 4 parameters.
|
|---|
| 507 | // The first two are packed into msg (first and second bytes).
|
|---|
| 508 | // The other two are parm1 and parm2.
|
|---|
| 509 | //
|
|---|
| 510 | Bool_t MEventDisplay::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
|
|---|
| 511 | {
|
|---|
| 512 | switch (GET_MSG(msg))
|
|---|
| 513 | {
|
|---|
| 514 | case kC_TEXTENTRY:
|
|---|
| 515 | switch(GET_SUBMSG(msg))
|
|---|
| 516 | {
|
|---|
| 517 | case kTE_ENTER:
|
|---|
| 518 | switch(GET_SUBMSG(msg))
|
|---|
| 519 | {
|
|---|
| 520 | case kTE_ENTER:
|
|---|
| 521 | {
|
|---|
| 522 | TGTextEntry *entry = (TGTextEntry*)fList->FindWidget(kEvtNumber);
|
|---|
| 523 | if (GetReader()->SetEventNum(atoi(entry->GetText())-1))
|
|---|
| 524 | ReadinEvent();
|
|---|
| 525 | }
|
|---|
| 526 | return kTRUE;
|
|---|
| 527 | }
|
|---|
| 528 | return kTRUE;
|
|---|
| 529 | }
|
|---|
| 530 | break;
|
|---|
| 531 |
|
|---|
| 532 | case kC_COMMAND:
|
|---|
| 533 | switch (GET_SUBMSG(msg))
|
|---|
| 534 | {
|
|---|
| 535 | case kCM_BUTTON:
|
|---|
| 536 | switch (parm1)
|
|---|
| 537 | {
|
|---|
| 538 | case kEvtPrev:
|
|---|
| 539 | ReadinEvent(-1);
|
|---|
| 540 | return kTRUE;
|
|---|
| 541 |
|
|---|
| 542 | case kEvtNext:
|
|---|
| 543 | ReadinEvent(+1);
|
|---|
| 544 | return kTRUE;
|
|---|
| 545 | }
|
|---|
| 546 | return kTRUE;
|
|---|
| 547 | }
|
|---|
| 548 | break;
|
|---|
| 549 | }
|
|---|
| 550 | return MStatusDisplay::ProcessMessage(msg, parm1, parm2);
|
|---|
| 551 | }
|
|---|