| 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 12/2000 <mailto:tbretz@uni-sw.gwdg.de>
|
|---|
| 19 | ! Florian Goebel 07/2004
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | Bool_t HandleInput()
|
|---|
| 28 | {
|
|---|
| 29 | TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
|
|---|
| 30 | while (1)
|
|---|
| 31 | {
|
|---|
| 32 | //
|
|---|
| 33 | // While reading the input process gui events asynchronously
|
|---|
| 34 | //
|
|---|
| 35 | timer.TurnOn();
|
|---|
| 36 | TString input = Getline("Type 'q' to exit, <return> to go on: ");
|
|---|
| 37 | timer.TurnOff();
|
|---|
| 38 |
|
|---|
| 39 | if (input=="q\n")
|
|---|
| 40 | return kFALSE;
|
|---|
| 41 |
|
|---|
| 42 | if (input=="\n")
|
|---|
| 43 | return kTRUE;
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 | return kFALSE;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | const TString defname = "/.magic/magicserv01/MAGIC/rootdata2/2004_04_22/20040422_23211_D_Mrk421_E.root";
|
|---|
| 50 | const TString defpedname = "/.magic/magicserv01/MAGIC/rootdata2/2004_04_22/20040422_23209_P_Mrk421_E.root";
|
|---|
| 51 |
|
|---|
| 52 | void ScanExtractSignalABCorr(const TString fname = defname, const TString pedname = defpedname) {
|
|---|
| 53 |
|
|---|
| 54 | MParList plist_ped;
|
|---|
| 55 |
|
|---|
| 56 | MTaskList tlist_ped;
|
|---|
| 57 | plist_ped.AddToList(&tlist_ped);
|
|---|
| 58 |
|
|---|
| 59 | MPedestalCam pedcam;
|
|---|
| 60 | plist_ped.AddToList(&pedcam);
|
|---|
| 61 |
|
|---|
| 62 | MReadMarsFile read("Events", pedname);
|
|---|
| 63 | read.DisableAutoScheme();
|
|---|
| 64 |
|
|---|
| 65 | MGeomApply geomapl_ped;
|
|---|
| 66 | MGeomCamMagic geomcam_ped;
|
|---|
| 67 |
|
|---|
| 68 | MPedCalcFromLoGain pedcalc_ped;
|
|---|
| 69 | pedcalc_ped.SetPedestalUpdate(kFALSE);
|
|---|
| 70 |
|
|---|
| 71 | tlist_ped.AddToList(&read);
|
|---|
| 72 | tlist_ped.AddToList(&geomapl_ped);
|
|---|
| 73 | tlist_ped.AddToList(&pedcalc_ped);
|
|---|
| 74 |
|
|---|
| 75 | MEvtLoop evtloop_ped;
|
|---|
| 76 | evtloop_ped.SetParList(&plist_ped);
|
|---|
| 77 |
|
|---|
| 78 | if (!evtloop_ped.Eventloop())
|
|---|
| 79 | return;
|
|---|
| 80 |
|
|---|
| 81 | tlist_ped.PrintStatistics();
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 | // now the event loop for the signal reconstruction with pedestals subtracted
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | MParList plist;
|
|---|
| 88 | MTaskList tlist;
|
|---|
| 89 | // MPedestalCam pedcam;
|
|---|
| 90 | plist.AddToList(&pedcam);
|
|---|
| 91 |
|
|---|
| 92 | MRawEvtData evtdata;
|
|---|
| 93 | plist.AddToList(&evtdata);
|
|---|
| 94 |
|
|---|
| 95 | MArrivalTimeCam timecam;
|
|---|
| 96 | plist.AddToList(&timecam);
|
|---|
| 97 |
|
|---|
| 98 | MExtractedSignalCam sigcam;
|
|---|
| 99 | plist.AddToList(&sigcam);
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | plist.AddToList(&tlist);
|
|---|
| 103 |
|
|---|
| 104 | MReadMarsFile read("Events", fname);
|
|---|
| 105 | read.DisableAutoScheme();
|
|---|
| 106 |
|
|---|
| 107 | MGeomApply geomapl;
|
|---|
| 108 | MArrivalTimeCalc timetime;
|
|---|
| 109 |
|
|---|
| 110 | MExtractSignalABcorr sigsig;
|
|---|
| 111 | sigsig.SetRange(5,7,5,7);
|
|---|
| 112 |
|
|---|
| 113 | tlist.AddToList(&read);
|
|---|
| 114 | tlist.AddToList(&geomapl);
|
|---|
| 115 | tlist.AddToList(&sigsig);
|
|---|
| 116 | tlist.AddToList(&timetime);
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 | MEvtLoop evtloop;
|
|---|
| 121 | evtloop.SetParList(&plist);
|
|---|
| 122 |
|
|---|
| 123 | if (!evtloop.PreProcess())
|
|---|
| 124 | return;
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 | MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
|
|---|
| 128 |
|
|---|
| 129 | MHCamera display;
|
|---|
| 130 | TCanvas c("Events", "Real Events", 600, 600);
|
|---|
| 131 | c.SetBorderMode(0);
|
|---|
| 132 | c.Divide(1,1);
|
|---|
| 133 |
|
|---|
| 134 | MHCamera display_time;
|
|---|
| 135 | TCanvas c_time("Events_time", "Events Time", 600, 600);
|
|---|
| 136 | c_time.SetBorderMode(0);
|
|---|
| 137 | c_time.Divide(1,1);
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 | display.SetGeometry(*geomcam);
|
|---|
| 141 | display.SetPrettyPalette();
|
|---|
| 142 | c.cd(1);
|
|---|
| 143 | display.Draw();
|
|---|
| 144 | gPad->cd(1);
|
|---|
| 145 |
|
|---|
| 146 | display_time.SetGeometry(*geomcam);
|
|---|
| 147 | display_time.SetPrettyPalette();
|
|---|
| 148 | c_time.cd(1);
|
|---|
| 149 | display_time.Draw();
|
|---|
| 150 | gPad->cd(1);
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | // Use this if you don't want the event to be autoscaled
|
|---|
| 154 | //display.SetMinimum(0);
|
|---|
| 155 | //display.SetMaximum(100);
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 | while (tlist.Process()) {
|
|---|
| 159 | cout << "Event #" << read.GetNumEntry() ":" << endl;
|
|---|
| 160 |
|
|---|
| 161 | display.SetCamContent(sigcam,0);
|
|---|
| 162 | display.SetCamError(sigcam,1);
|
|---|
| 163 |
|
|---|
| 164 | c.GetPad(1)->GetPad(1)->Modified(); //vielleicht fehler? 1->i ??
|
|---|
| 165 | c.GetPad(1)->GetPad(1)->Update();
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 | display_time.SetCamContent(timecam,0);
|
|---|
| 169 | display_time.SetCamError(timecam,1);
|
|---|
| 170 | c_time.GetPad(1)->GetPad(1)->Modified(); //vielleicht fehler? 1->i ??
|
|---|
| 171 | c_time.GetPad(1)->GetPad(1)->Update();
|
|---|
| 172 |
|
|---|
| 173 | if (!HandleInput())
|
|---|
| 174 | break;
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 | evtloop.PostProcess();
|
|---|
| 178 |
|
|---|
| 179 | TCanvas c("Events", "Real Events", 600, 600);
|
|---|
| 180 | c.SetBorderMode(0);
|
|---|
| 181 | c.Divide(1,1);
|
|---|
| 182 | c.cd(1);
|
|---|
| 183 |
|
|---|
| 184 | chargevpixel->Draw();
|
|---|
| 185 |
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|