| 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, 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // Status - Example how to use the MStatusDisplay
|
|---|
| 28 | //
|
|---|
| 29 | // Use a camera file as input
|
|---|
| 30 | //
|
|---|
| 31 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 32 |
|
|---|
| 33 | void status(const char *fname="cosmics.root")
|
|---|
| 34 | {
|
|---|
| 35 | //
|
|---|
| 36 | // Update frequency by default = 1Hz
|
|---|
| 37 | //
|
|---|
| 38 | MStatusDisplay *d = new MStatusDisplay;
|
|---|
| 39 |
|
|---|
| 40 | // Set update time to 5s
|
|---|
| 41 | // d->SetUpdateTime(5000);
|
|---|
| 42 |
|
|---|
| 43 | // Disable online update
|
|---|
| 44 | // d->SetUpdateTime(-1);
|
|---|
| 45 |
|
|---|
| 46 | d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
|
|---|
| 47 | gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
|
|---|
| 48 | //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
|
|---|
| 49 |
|
|---|
| 50 | //
|
|---|
| 51 | // Create a empty Parameter List and an empty Task List
|
|---|
| 52 | // The tasklist is identified in the eventloop by its name
|
|---|
| 53 | //
|
|---|
| 54 | MParList plist;
|
|---|
| 55 |
|
|---|
| 56 | MTaskList tlist;
|
|---|
| 57 | plist.AddToList(&tlist);
|
|---|
| 58 |
|
|---|
| 59 | //
|
|---|
| 60 | // The geometry container must be created by yourself to make sure
|
|---|
| 61 | // that you don't choose a wrong geometry by mistake
|
|---|
| 62 | //
|
|---|
| 63 | MGeomCamMagic geomcam;
|
|---|
| 64 | plist.AddToList(&geomcam);
|
|---|
| 65 |
|
|---|
| 66 | //
|
|---|
| 67 | // Now setup the tasks and tasklist:
|
|---|
| 68 | // ---------------------------------
|
|---|
| 69 | //
|
|---|
| 70 | MReadMarsFile read("Events");
|
|---|
| 71 | read.DisableAutoScheme();
|
|---|
| 72 |
|
|---|
| 73 | // ------------- user change -----------------
|
|---|
| 74 | read.AddFile(fname);
|
|---|
| 75 |
|
|---|
| 76 | MMcPedestalCopy pcopy;
|
|---|
| 77 | MMcPedestalNSBAdd pnsb;
|
|---|
| 78 | MCerPhotCalc ncalc;
|
|---|
| 79 |
|
|---|
| 80 | MBlindPixelCalc blind;
|
|---|
| 81 | blind.SetUseInterpolation();
|
|---|
| 82 |
|
|---|
| 83 | MSigmabarCalc sgcal;
|
|---|
| 84 | MImgCleanStd clean;
|
|---|
| 85 | MHillasCalc hcalc;
|
|---|
| 86 | MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
|
|---|
| 87 | MCT1SupercutsCalc calc1;
|
|---|
| 88 |
|
|---|
| 89 | // -------------------------------------------
|
|---|
| 90 | MFillH hfill0("Uncleaned [MHCamEvent]", "MCerPhotEvt");
|
|---|
| 91 | MFillH hfill1("MHHillas", "MHillas");
|
|---|
| 92 | MFillH hfill2("MHHillasExt");
|
|---|
| 93 | MFillH hfill3("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
|
|---|
| 94 | MFillH hfill4("MHHillasSrc","MHillasSrc");
|
|---|
| 95 | MFillH hfill5("MHNewImagePar","MNewImagePar");
|
|---|
| 96 | MFillH hfill6("MHStarMap", "MHillas");
|
|---|
| 97 | MFillH hfill7("Cleaned [MHCamEvent]", "MCerPhotEvt");
|
|---|
| 98 | MFillH hfill8("MHHadronness", "MHadronness");
|
|---|
| 99 | MFillH hfill9("MHSigmaTheta");
|
|---|
| 100 |
|
|---|
| 101 | tlist.AddToList(&read);
|
|---|
| 102 | tlist.AddToList(&pcopy);
|
|---|
| 103 | tlist.AddToList(&pnsb);
|
|---|
| 104 | tlist.AddToList(&ncalc);
|
|---|
| 105 | tlist.AddToList(&hfill0);
|
|---|
| 106 | tlist.AddToList(&blind);
|
|---|
| 107 | //tlist.AddToList(&sgcal);
|
|---|
| 108 | tlist.AddToList(&clean);
|
|---|
| 109 | tlist.AddToList(&hcalc);
|
|---|
| 110 | tlist.AddToList(&scalc);
|
|---|
| 111 | //tlist.AddToList(&calc1);
|
|---|
| 112 | tlist.AddToList(&hfill1);
|
|---|
| 113 | tlist.AddToList(&hfill2);
|
|---|
| 114 | tlist.AddToList(&hfill3);
|
|---|
| 115 | tlist.AddToList(&hfill4);
|
|---|
| 116 | tlist.AddToList(&hfill5);
|
|---|
| 117 | tlist.AddToList(&hfill6);
|
|---|
| 118 | tlist.AddToList(&hfill7);
|
|---|
| 119 | //tlist.AddToList(&hfill8);
|
|---|
| 120 |
|
|---|
| 121 | MEvtLoop evtloop;
|
|---|
| 122 | evtloop.SetParList(&plist);
|
|---|
| 123 | evtloop.SetDisplay(d);
|
|---|
| 124 |
|
|---|
| 125 | //
|
|---|
| 126 | // Execute your analysis
|
|---|
| 127 | //
|
|---|
| 128 | if (!evtloop.Eventloop())
|
|---|
| 129 | return;
|
|---|
| 130 |
|
|---|
| 131 | tlist.PrintStatistics();
|
|---|
| 132 |
|
|---|
| 133 | //
|
|---|
| 134 | // Make sure the display hasn't been deleted by the user while the
|
|---|
| 135 | // eventloop was running.
|
|---|
| 136 | //
|
|---|
| 137 | if ((d = evtloop.GetDisplay()))
|
|---|
| 138 | {
|
|---|
| 139 | // Save data in a postscriptfile (status.ps)
|
|---|
| 140 | d->SaveAsPS();
|
|---|
| 141 | /*
|
|---|
| 142 | * ----------- Write status to a root file ------------
|
|---|
| 143 | *
|
|---|
| 144 | TFile file("status.root", "RECREATE");
|
|---|
| 145 | d->Write();
|
|---|
| 146 | file.Close();
|
|---|
| 147 | delete d;
|
|---|
| 148 | */
|
|---|
| 149 | }
|
|---|
| 150 | /*
|
|---|
| 151 | * ----------- Read status from a root file ------------
|
|---|
| 152 | *
|
|---|
| 153 | TFile file2("status.root", "READ");
|
|---|
| 154 | MStatusDisplay *d2 = new MStatusDisplay;
|
|---|
| 155 | d2->Read();
|
|---|
| 156 | */
|
|---|
| 157 | }
|
|---|