| 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 Cherenkov 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 | ! Author(s): Daniel Mazin, 05/2004 <mailto:mazin@imppmu.mpg.de>
|
|---|
| 18 | !
|
|---|
| 19 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 20 | !
|
|---|
| 21 | !
|
|---|
| 22 | \* ======================================================================== */
|
|---|
| 23 |
|
|---|
| 24 | // Daniel Mazin 14.05.2004 mazin@mppmu.mpg.de
|
|---|
| 25 | //**********************************************************
|
|---|
| 26 | // this macro is a short form of the macro ONOFFAnalysis.C
|
|---|
| 27 | // three jobs are executed:
|
|---|
| 28 | // 1) image cleaning
|
|---|
| 29 | // 2) calculation of hillas parameters
|
|---|
| 30 | // 3) writing the root file
|
|---|
| 31 | //**********************************************************
|
|---|
| 32 |
|
|---|
| 33 | gROOT->Reset();
|
|---|
| 34 |
|
|---|
| 35 | //************************************************************************
|
|---|
| 36 | void cleaninghillas(const char *onfile,
|
|---|
| 37 | const char *offfile,
|
|---|
| 38 | TString typeInput,
|
|---|
| 39 | TString inPath,
|
|---|
| 40 | TString outPath,
|
|---|
| 41 | TString sourcename)
|
|---|
| 42 | {
|
|---|
| 43 |
|
|---|
| 44 | TString fileON = inPath;
|
|---|
| 45 | fileON += onfile;
|
|---|
| 46 | fileON += ".root";
|
|---|
| 47 |
|
|---|
| 48 | TString fileOFF = inPath;
|
|---|
| 49 | fileOFF += offfile;
|
|---|
| 50 | fileOFF += ".root";
|
|---|
| 51 |
|
|---|
| 52 | // name of input root file
|
|---|
| 53 | if (typeInput == "ON")
|
|---|
| 54 | TString filenamein(fileON);
|
|---|
| 55 | else if (typeInput == "OFF")
|
|---|
| 56 | TString filenamein(fileOFF);
|
|---|
| 57 |
|
|---|
| 58 | // name of output root file
|
|---|
| 59 | if (typeInput == "ON")
|
|---|
| 60 | TString file(onfile);
|
|---|
| 61 | else if (typeInput == "OFF")
|
|---|
| 62 | TString file(offfile);
|
|---|
| 63 |
|
|---|
| 64 | TString outNameImage = outPath;
|
|---|
| 65 | outNameImage += sourcename;
|
|---|
| 66 | outNameImage += "Hillas";
|
|---|
| 67 | outNameImage += typeInput;
|
|---|
| 68 | outNameImage += ".root";
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | // set up the task list:
|
|---|
| 72 | //-----------------------------------------------------------
|
|---|
| 73 | MTaskList tliston;
|
|---|
| 74 | MParList pliston;
|
|---|
| 75 |
|
|---|
| 76 | MObservatory observ;
|
|---|
| 77 | pliston.AddToList(&observ);
|
|---|
| 78 |
|
|---|
| 79 | MPointingPos mpos;
|
|---|
| 80 | pliston.AddToList(&mpos);
|
|---|
| 81 |
|
|---|
| 82 | MMcEvt mmc;
|
|---|
| 83 | pliston.AddToList(&mmc);
|
|---|
| 84 |
|
|---|
| 85 | char *sourceName = "MSrcPosCam";
|
|---|
| 86 | MSrcPosCam source(sourceName);
|
|---|
| 87 |
|
|---|
| 88 | // geometry is needed in MHHillas... classes
|
|---|
| 89 | MGeomCam *fGeom =
|
|---|
| 90 | (MGeomCam*)pliston->FindCreateObj("MGeomCamMagic", "MGeomCam");
|
|---|
| 91 |
|
|---|
| 92 | //-------------------------------------------
|
|---|
| 93 | // create the tasks which should be executed
|
|---|
| 94 | //
|
|---|
| 95 |
|
|---|
| 96 | MReadMarsFile read("Events", filenamein);
|
|---|
| 97 | read.DisableAutoScheme();
|
|---|
| 98 |
|
|---|
| 99 | MGeomApply apply;
|
|---|
| 100 |
|
|---|
| 101 | // NOTE: MMcEvt is used temporary. MPointingPos should be used as soon as synchronisation is working
|
|---|
| 102 | //
|
|---|
| 103 | // the following task is used to fill in a MMcEvt container with Theta and Phi values
|
|---|
| 104 | // for each event using an ascii file (which is generated from central control report file)
|
|---|
| 105 | // PLEASE NOTE: only needed if a derotation around the center of the camera is planned
|
|---|
| 106 | // to be performed afterwords
|
|---|
| 107 | MSourcePosfromStarPos sourcefromstar;
|
|---|
| 108 |
|
|---|
| 109 | if (typeInput == "ON")
|
|---|
| 110 | {
|
|---|
| 111 | sourcefromstar.AddFile("~mazin/mars/MarsCVS/Mars/positionsON", 0);
|
|---|
| 112 | }
|
|---|
| 113 | else if (typeInput == "OFF")
|
|---|
| 114 | {
|
|---|
| 115 | sourcefromstar.AddFile("~mazin/mars/MarsCVS/Mars/positionsOFF", 0);
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 | // -----------------------------------------------------
|
|---|
| 121 | // image cleaning -------------------------------------
|
|---|
| 122 | // -----------------------------------------------------
|
|---|
| 123 | MSigmabarCalc sigbar;
|
|---|
| 124 |
|
|---|
| 125 | MBlindPixelsCalc2 blind;
|
|---|
| 126 | blind.SetUseInterpolation();
|
|---|
| 127 | blind.SetCheckPedestalRms();
|
|---|
| 128 | blind.SetName("BlindAfterPadding");
|
|---|
| 129 |
|
|---|
| 130 | MFSelBasic selbasic;
|
|---|
| 131 | MContinue contbasic(&selbasic);
|
|---|
| 132 | contbasic.SetName("SelBasic");
|
|---|
| 133 |
|
|---|
| 134 | // MImgCleanStd clean(3.0, 2.5); // Crab 27th old calibr (Hendrik)
|
|---|
| 135 | MImgCleanStd clean(4.0, 3.0);
|
|---|
| 136 | // clean.SetMethod(MImgCleanStd::kDemocratic);
|
|---|
| 137 | clean.SetCleanRings(1);
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 | // -----------------------------------------------------
|
|---|
| 141 | // calculation of image parameters ---------------------
|
|---|
| 142 | // -----------------------------------------------------
|
|---|
| 143 | TString fHilName = "MHillas";
|
|---|
| 144 | TString fHilNameExt = "MHillasExt";
|
|---|
| 145 | TString fHilNameSrc = "MHillasSrc";
|
|---|
| 146 | TString fImgParName = "MNewImagePar";
|
|---|
| 147 |
|
|---|
| 148 | MHillasCalc hcalc;
|
|---|
| 149 | hcalc.SetNameHillas(fHilName);
|
|---|
| 150 | hcalc.SetNameHillasExt(fHilNameExt);
|
|---|
| 151 | hcalc.SetNameNewImgPar(fImgParName);
|
|---|
| 152 |
|
|---|
| 153 | MHillasSrcCalc hsrccalc(sourceName, fHilNameSrc);
|
|---|
| 154 | hsrccalc.SetInput(fHilName);
|
|---|
| 155 |
|
|---|
| 156 | MFSelStandard selstandard(fHilNameSrc);
|
|---|
| 157 | selstandard.SetHillasName(fHilName);
|
|---|
| 158 | selstandard.SetImgParName(fImgParName);
|
|---|
| 159 | // selstandard.SetCuts(usedpixelsmax, corepixelsmin, sizemin, distmin, distmax, lengthmin, widthmin);
|
|---|
| 160 | selstandard.SetCuts(200, 5, 200, 0.0, 5.0, 0.07, 0.05);
|
|---|
| 161 | MContinue contstandard(&selstandard);
|
|---|
| 162 | contstandard.SetName("SelStandard");
|
|---|
| 163 |
|
|---|
| 164 | // -----------------------------------------------------
|
|---|
| 165 | // write root file
|
|---|
| 166 | // -----------------------------------------------------
|
|---|
| 167 | MWriteRootFile write(outNameImage);
|
|---|
| 168 |
|
|---|
| 169 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
|---|
| 170 | //write.AddContainer("MTime", "Events");
|
|---|
| 171 | write.AddContainer("MPointingPos", "Events");
|
|---|
| 172 | //write.AddContainer("ThetaOrig", "Events");
|
|---|
| 173 | write.AddContainer("MSrcPosCam", "Events");
|
|---|
| 174 | write.AddContainer("MSigmabar", "Events");
|
|---|
| 175 | write.AddContainer("MHillas", "Events");
|
|---|
| 176 | write.AddContainer("MHillasExt", "Events");
|
|---|
| 177 | write.AddContainer("MHillasSrc", "Events");
|
|---|
| 178 | write.AddContainer("MNewImagePar", "Events");
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | //*****************************
|
|---|
| 182 | // entries in MParList
|
|---|
| 183 |
|
|---|
| 184 | pliston.AddToList(&tliston);
|
|---|
| 185 | pliston.AddToList(&observ);
|
|---|
| 186 |
|
|---|
| 187 | pliston.AddToList(&source);
|
|---|
| 188 |
|
|---|
| 189 | //*****************************
|
|---|
| 190 | // entries in MTaskList
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 | tliston.AddToList(&read);
|
|---|
| 194 | tliston.AddToList(&apply);
|
|---|
| 195 | tliston.AddToList(&sourcefromstar);
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 | tliston.AddToList(&sigbar);
|
|---|
| 199 | tliston.AddToList(&blind);
|
|---|
| 200 | tliston.AddToList(&contbasic);
|
|---|
| 201 |
|
|---|
| 202 | tliston.AddToList(&clean);
|
|---|
| 203 |
|
|---|
| 204 | tliston.AddToList(&hcalc);
|
|---|
| 205 | tliston.AddToList(&hsrccalc);
|
|---|
| 206 | tliston.AddToList(&contstandard);
|
|---|
| 207 | tliston.AddToList(&write);
|
|---|
| 208 |
|
|---|
| 209 | //*****************************
|
|---|
| 210 |
|
|---|
| 211 | //-------------------------------------------
|
|---|
| 212 | // Execute event loop
|
|---|
| 213 | //
|
|---|
| 214 | MProgressBar bar;
|
|---|
| 215 | MEvtLoop evtloop;
|
|---|
| 216 | evtloop.SetParList(&pliston);
|
|---|
| 217 | //evtloop.ReadEnv(env, "", printEnv);
|
|---|
| 218 | evtloop.SetProgressBar(&bar);
|
|---|
| 219 | // evtloop.Write();
|
|---|
| 220 |
|
|---|
| 221 | Int_t maxevents = -1;
|
|---|
| 222 | //Int_t maxevents = 1000;
|
|---|
| 223 | if ( !evtloop.Eventloop(maxevents) )
|
|---|
| 224 | return;
|
|---|
| 225 |
|
|---|
| 226 | tliston.PrintStatistics(0, kTRUE);
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|