| 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, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2007 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | //  MJStar | 
|---|
| 28 | // | 
|---|
| 29 | // Resource file entries are case sensitive! | 
|---|
| 30 | // | 
|---|
| 31 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 32 | #include "MJStar.h" | 
|---|
| 33 |  | 
|---|
| 34 | #include <TEnv.h> | 
|---|
| 35 | #include <TFile.h> | 
|---|
| 36 |  | 
|---|
| 37 | #include "MLog.h" | 
|---|
| 38 | #include "MLogManip.h" | 
|---|
| 39 |  | 
|---|
| 40 | #include "MDirIter.h" | 
|---|
| 41 | #include "MParList.h" | 
|---|
| 42 | #include "MTaskList.h" | 
|---|
| 43 | #include "MEvtLoop.h" | 
|---|
| 44 |  | 
|---|
| 45 | #include "MStatusDisplay.h" | 
|---|
| 46 |  | 
|---|
| 47 | #include "MHSectorVsTime.h" | 
|---|
| 48 | #include "MHCamEvent.h" | 
|---|
| 49 | #include "MBinning.h" | 
|---|
| 50 |  | 
|---|
| 51 | #include "MReadReports.h" | 
|---|
| 52 | #include "MReadMarsFile.h" | 
|---|
| 53 | #include "MFDataPhrase.h" | 
|---|
| 54 | #include "MFilterList.h" | 
|---|
| 55 | #include "MFDataMember.h" | 
|---|
| 56 | #include "MFDeltaT.h" | 
|---|
| 57 | #include "MFSoftwareTrigger.h" | 
|---|
| 58 | #include "MContinue.h" | 
|---|
| 59 | #include "MGeomApply.h" | 
|---|
| 60 | #include "MEventRateCalc.h" | 
|---|
| 61 | #include "MImgCleanStd.h" | 
|---|
| 62 | #include "MSrcPosCalc.h" | 
|---|
| 63 | #include "MSrcPosCorrect.h" | 
|---|
| 64 | #include "MHillasCalc.h" | 
|---|
| 65 | #include "MMuonSearchParCalc.h" | 
|---|
| 66 | #include "MMuonCalibParCalc.h" | 
|---|
| 67 | #include "MFillH.h" | 
|---|
| 68 | #include "MWriteRootFile.h" | 
|---|
| 69 |  | 
|---|
| 70 | #include "MMuonSetup.h" | 
|---|
| 71 | #include "MObservatory.h" | 
|---|
| 72 | #include "MPointingPosCalc.h" | 
|---|
| 73 |  | 
|---|
| 74 | ClassImp(MJStar); | 
|---|
| 75 |  | 
|---|
| 76 | using namespace std; | 
|---|
| 77 |  | 
|---|
| 78 | // -------------------------------------------------------------------------- | 
|---|
| 79 | // | 
|---|
| 80 | // Default constructor. | 
|---|
| 81 | // | 
|---|
| 82 | // Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE | 
|---|
| 83 | // | 
|---|
| 84 | MJStar::MJStar(const char *name, const char *title) : fMuonAnalysis(kTRUE) | 
|---|
| 85 | { | 
|---|
| 86 | fName  = name  ? name  : "MJStar"; | 
|---|
| 87 | fTitle = title ? title : "Standard analysis and reconstruction"; | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | Bool_t MJStar::CheckEnvLocal() | 
|---|
| 91 | { | 
|---|
| 92 | DisableMuonAnalysis(!GetEnv("MuonAnalysis", fMuonAnalysis)); | 
|---|
| 93 | return kTRUE; | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|
| 96 | Bool_t MJStar::WriteResult() | 
|---|
| 97 | { | 
|---|
| 98 | if (fPathOut.IsNull()) | 
|---|
| 99 | { | 
|---|
| 100 | *fLog << inf << "No output path specified via SetPathOut - no output written." << endl; | 
|---|
| 101 | return kTRUE; | 
|---|
| 102 | } | 
|---|
| 103 |  | 
|---|
| 104 | const TString oname = Form("%s/star%08d.root", (const char*)fPathOut, fSequence.GetSequence()); | 
|---|
| 105 |  | 
|---|
| 106 | *fLog << inf << "Writing to file: " << oname << endl; | 
|---|
| 107 |  | 
|---|
| 108 | TFile file(oname, "RECREATE"); | 
|---|
| 109 |  | 
|---|
| 110 | *fLog << inf << " - MStatusDisplay..." << flush; | 
|---|
| 111 | if (fDisplay && fDisplay->Write()<=0) | 
|---|
| 112 | { | 
|---|
| 113 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl; | 
|---|
| 114 | return kFALSE; | 
|---|
| 115 | } | 
|---|
| 116 | *fLog << inf << "ok." << endl; | 
|---|
| 117 |  | 
|---|
| 118 | return kTRUE; | 
|---|
| 119 | } | 
|---|
| 120 |  | 
|---|
| 121 | Bool_t MJStar::Process(Bool_t ismc) | 
|---|
| 122 | { | 
|---|
| 123 | if (!fSequence.IsValid()) | 
|---|
| 124 | { | 
|---|
| 125 | *fLog << err << "ERROR - Sequence invalid!" << endl; | 
|---|
| 126 | return kFALSE; | 
|---|
| 127 | } | 
|---|
| 128 |  | 
|---|
| 129 | //if (!CheckEnv()) | 
|---|
| 130 | //    return kFALSE; | 
|---|
| 131 |  | 
|---|
| 132 | CheckEnv(); | 
|---|
| 133 |  | 
|---|
| 134 | // -------------------------------------------------------------------------------- | 
|---|
| 135 |  | 
|---|
| 136 | *fLog << inf; | 
|---|
| 137 | fLog->Separator(GetDescriptor()); | 
|---|
| 138 | *fLog << "Calculate image parameters of sequence "; | 
|---|
| 139 | *fLog << fSequence.GetFileName() << endl; | 
|---|
| 140 | *fLog << endl; | 
|---|
| 141 |  | 
|---|
| 142 | // -------------------------------------------------------------------------------- | 
|---|
| 143 |  | 
|---|
| 144 | MDirIter iter; | 
|---|
| 145 | if (fSequence.SetupDatRuns(iter, MSequence::kCalibrated)<=0) | 
|---|
| 146 | return kFALSE; | 
|---|
| 147 |  | 
|---|
| 148 | // Setup Parlist | 
|---|
| 149 | MParList plist; | 
|---|
| 150 | plist.AddToList(this); // take care of fDisplay! | 
|---|
| 151 |  | 
|---|
| 152 | MObservatory obs; | 
|---|
| 153 | plist.AddToList(&obs); | 
|---|
| 154 |  | 
|---|
| 155 | MMuonSetup muonsetup; | 
|---|
| 156 | plist.AddToList(&muonsetup); | 
|---|
| 157 |  | 
|---|
| 158 | // Setup binnings for muon analysis | 
|---|
| 159 | MBinning bins1("BinningRadius"); | 
|---|
| 160 | MBinning bins2("BinningArcWidth"); | 
|---|
| 161 | MBinning bins3("BinningRingBroadening"); | 
|---|
| 162 | MBinning bins4("BinningSizeVsArcRadius"); | 
|---|
| 163 | MBinning bins5("BinningMuonWidth"); | 
|---|
| 164 | MBinning bins6("BinningArcPhi"); | 
|---|
| 165 | plist.AddToList(&bins1); | 
|---|
| 166 | plist.AddToList(&bins2); | 
|---|
| 167 | plist.AddToList(&bins3); | 
|---|
| 168 | plist.AddToList(&bins4); | 
|---|
| 169 | plist.AddToList(&bins5); | 
|---|
| 170 | plist.AddToList(&bins6); | 
|---|
| 171 |  | 
|---|
| 172 |  | 
|---|
| 173 | // Setup Tasklist | 
|---|
| 174 | MTaskList tlist; | 
|---|
| 175 | plist.AddToList(&tlist); | 
|---|
| 176 |  | 
|---|
| 177 | MReadReports readreal; | 
|---|
| 178 | readreal.AddTree("Events", "MTime.", MReadReports::kMaster); | 
|---|
| 179 | readreal.AddTree("Drive",            MReadReports::kRequired); | 
|---|
| 180 | readreal.AddTree("Starguider",       MReadReports::kRequired); | 
|---|
| 181 | readreal.AddTree("Currents",         MReadReports::kRequired); | 
|---|
| 182 | readreal.AddTree("CC"); | 
|---|
| 183 | readreal.AddFiles(iter); | 
|---|
| 184 |  | 
|---|
| 185 | MReadMarsFile readmc("Events"); | 
|---|
| 186 | readmc.DisableAutoScheme(); | 
|---|
| 187 | readmc.AddFiles(iter); | 
|---|
| 188 |  | 
|---|
| 189 | // ------------------ Setup general tasks ---------------- | 
|---|
| 190 |  | 
|---|
| 191 | MFDeltaT               fdeltat; | 
|---|
| 192 | MContinue              cont(&fdeltat, "FilterDeltaT", "Filter events with wrong timing"); | 
|---|
| 193 | cont.SetInverted(); | 
|---|
| 194 |  | 
|---|
| 195 | MGeomApply             apply; // Only necessary to craete geometry | 
|---|
| 196 | MEventRateCalc         rate; | 
|---|
| 197 | rate.SetNumEvents(1200); | 
|---|
| 198 |  | 
|---|
| 199 | MFSoftwareTrigger swtrig; | 
|---|
| 200 | MContinue contsw(&swtrig, "FilterSwTrigger", "Software trigger"); | 
|---|
| 201 | contsw.SetInverted(); | 
|---|
| 202 |  | 
|---|
| 203 | MImgCleanStd           clean; | 
|---|
| 204 | clean.SetNamePedPhotCam("MPedPhotFromExtractorRndm"); | 
|---|
| 205 |  | 
|---|
| 206 | MSrcPosCalc poscalc; | 
|---|
| 207 | MHillasCalc hcalc; | 
|---|
| 208 | hcalc.Disable(MHillasCalc::kCalcConc); | 
|---|
| 209 |  | 
|---|
| 210 | // ------------------ Setup histograms and fill tasks ---------------- | 
|---|
| 211 | MHCamEvent evt0a(0, "Cleaned",   "Average signal after Cleaning;;S [\\gamma]"); | 
|---|
| 212 | MHCamEvent evt0c(0, "Sparkless", "Average signal after Cleaning and Spark cuts;;S [\\gamma]"); | 
|---|
| 213 | MHCamEvent evt0d(0, "Sparks",    "Average signal after Cleaning for Spark cuts;;S [\\gamma]"); | 
|---|
| 214 | MHCamEvent evt0b(0, "UsedPix",   "Fraction of Events in which Pixels are used;;Fraction"); | 
|---|
| 215 | evt0a.SetErrorSpread(kFALSE); | 
|---|
| 216 | evt0b.SetErrorSpread(kFALSE); | 
|---|
| 217 | evt0c.SetErrorSpread(kFALSE); | 
|---|
| 218 | evt0d.SetErrorSpread(kFALSE); | 
|---|
| 219 | evt0b.SetThreshold(0); | 
|---|
| 220 |  | 
|---|
| 221 | MFillH fillvs("MHRate",           "MTime",           "FillEventRate"); | 
|---|
| 222 | MFillH fillp1("MHPointing",       "MTimeDrive",      "FillDrive"); | 
|---|
| 223 | MFillH fillp2("MHPointing",       "MTimeStarguider", "FillStarguider"); | 
|---|
| 224 | fillp1.SetBit(MFillH::kDoNotDisplay); | 
|---|
| 225 | fillp1.SetBit(MFillH::kCanSkip); | 
|---|
| 226 | fillp2.SetBit(MFillH::kCanSkip); | 
|---|
| 227 |  | 
|---|
| 228 | MFillH fill0a(&evt0a,             "MSignalCam",      "FillSignalCam"); | 
|---|
| 229 | MFillH fill0b(&evt0b,             "MSignalCam",      "FillCntUsedPixels"); | 
|---|
| 230 | MFillH fill0c(&evt0c,             "MSignalCam",      "FillSignalCamSparkless"); | 
|---|
| 231 | MFillH fill0d(&evt0d,             "MSignalCam",      "FillSignalCamSparks"); | 
|---|
| 232 | MFillH fill1("MHHillas",          "MHillas",         "FillHillas"); | 
|---|
| 233 | MFillH fill2("MHHillasExt",       "",                "FillHillasExt"); | 
|---|
| 234 | MFillH fill3("MHHillasSrc",       "MHillasSrc",      "FillHillasSrc"); | 
|---|
| 235 | MFillH fill4("MHImagePar",        "MImagePar",       "FillImagePar"); | 
|---|
| 236 | MFillH fill5("MHNewImagePar",     "MNewImagePar",    "FillNewImagePar"); | 
|---|
| 237 | MFillH fill9("MHEffectiveOnTime", "MTime",           "FillEffOnTime"); | 
|---|
| 238 |  | 
|---|
| 239 | //fillvs.SetNameTab("Rate"); | 
|---|
| 240 | fill9.SetNameTab("EffOnTime"); | 
|---|
| 241 | fill0c.SetNameTab("Sparkless"); | 
|---|
| 242 | fill0d.SetNameTab("Sparks"); | 
|---|
| 243 |  | 
|---|
| 244 | // ------------------ Setup write task ---------------- | 
|---|
| 245 |  | 
|---|
| 246 | // Effective on-time need its own not to be skipped by (eg) image cleaning | 
|---|
| 247 | // Muons needs its own to have a unique SetReadyToSave | 
|---|
| 248 | const TString rule(Form("%s{s/_Y_/_I_}", fPathOut.Data())); | 
|---|
| 249 | MWriteRootFile write( 2, rule, fOverwrite?"RECREATE":"NEW"); | 
|---|
| 250 | MWriteRootFile writet(2, rule, fOverwrite?"RECREATE":"NEW"); // EffectiveOnTime | 
|---|
| 251 | MWriteRootFile writem(2, rule, fOverwrite?"RECREATE":"NEW"); // Muons | 
|---|
| 252 | writem.SetName("WriteMuons"); | 
|---|
| 253 |  | 
|---|
| 254 | // Data | 
|---|
| 255 | write.AddContainer("MHillas",                   "Events"); | 
|---|
| 256 | write.AddContainer("MHillasExt",                "Events"); | 
|---|
| 257 | write.AddContainer("MHillasSrc",                "Events"); | 
|---|
| 258 | write.AddContainer("MImagePar",                 "Events"); | 
|---|
| 259 | write.AddContainer("MNewImagePar",              "Events"); | 
|---|
| 260 | write.AddContainer("MRawEvtHeader",             "Events"); | 
|---|
| 261 | write.AddContainer("MPointingPos",              "Events"); | 
|---|
| 262 |  | 
|---|
| 263 | // Run Header | 
|---|
| 264 | write.AddContainer("MRawRunHeader",             "RunHeaders"); | 
|---|
| 265 | write.AddContainer("MBadPixelsCam",             "RunHeaders"); | 
|---|
| 266 | write.AddContainer("MGeomCam",                  "RunHeaders"); | 
|---|
| 267 | write.AddContainer("MObservatory",              "RunHeaders"); | 
|---|
| 268 |  | 
|---|
| 269 | // Muon Setup | 
|---|
| 270 | write.AddContainer("BinningRadius",             "RunHeaders"); | 
|---|
| 271 | write.AddContainer("BinningArcWidth",           "RunHeaders"); | 
|---|
| 272 | write.AddContainer("BinningRingBroadening",     "RunHeaders"); | 
|---|
| 273 | write.AddContainer("BinningSizeVsArcRadius",    "RunHeaders"); | 
|---|
| 274 | write.AddContainer("MMuonSetup",                "RunHeaders"); | 
|---|
| 275 |  | 
|---|
| 276 | if (ismc) | 
|---|
| 277 | { | 
|---|
| 278 | // Monte Carlo Data | 
|---|
| 279 | write.AddContainer("MMcEvt",                "Events"); | 
|---|
| 280 | write.AddContainer("MMcTrig",               "Events"); | 
|---|
| 281 | // Monte Carlo Run Headers | 
|---|
| 282 | write.AddContainer("MMcRunHeader",          "RunHeaders"); | 
|---|
| 283 | write.AddContainer("MMcTrigHeader",         "RunHeaders"); | 
|---|
| 284 | write.AddContainer("MMcFadcHeader",         "RunHeaders"); | 
|---|
| 285 | write.AddContainer("MMcConfigRunHeader",    "RunHeaders"); | 
|---|
| 286 | write.AddContainer("MMcCorsikaRunHeader",   "RunHeaders"); | 
|---|
| 287 | } | 
|---|
| 288 | else | 
|---|
| 289 | { | 
|---|
| 290 | write.AddContainer("MTime",                 "Events"); | 
|---|
| 291 | // Drive | 
|---|
| 292 | write.AddContainer("MReportDrive",          "Drive"); | 
|---|
| 293 | write.AddContainer("MTimeDrive",            "Drive"); | 
|---|
| 294 | // Starguider | 
|---|
| 295 | write.AddContainer("MReportStarguider",     "Starguider", kFALSE); | 
|---|
| 296 | write.AddContainer("MTimeStarguider",       "Starguider", kFALSE); | 
|---|
| 297 | // Effective On Time | 
|---|
| 298 | writet.AddContainer("MEffectiveOnTime",     "EffectiveOnTime"); | 
|---|
| 299 | writet.AddContainer("MTimeEffectiveOnTime", "EffectiveOnTime"); | 
|---|
| 300 | } | 
|---|
| 301 |  | 
|---|
| 302 | // What to write in muon tree | 
|---|
| 303 | writem.AddContainer("MMuonSearchPar",           "Muons"); | 
|---|
| 304 | writem.AddContainer("MMuonCalibPar",            "Muons"); | 
|---|
| 305 | writem.AddContainer("MHillas",                  "Muons"); | 
|---|
| 306 | writem.AddContainer("MHillasExt",               "Muons"); | 
|---|
| 307 | writem.AddContainer("MHillasSrc",               "Muons"); | 
|---|
| 308 | writem.AddContainer("MImagePar",                "Muons"); | 
|---|
| 309 | writem.AddContainer("MNewImagePar",             "Muons"); | 
|---|
| 310 | writem.AddContainer("MRawEvtHeader",            "Muons"); | 
|---|
| 311 | writem.AddContainer("MPointingPos",             "Muons"); | 
|---|
| 312 | if (ismc) | 
|---|
| 313 | { | 
|---|
| 314 | // Monte Carlo Data | 
|---|
| 315 | writem.AddContainer("MMcEvt",               "Muons"); | 
|---|
| 316 | writem.AddContainer("MMcTrig",              "Muons"); | 
|---|
| 317 | } | 
|---|
| 318 |  | 
|---|
| 319 | if (ismc) | 
|---|
| 320 | if (fMuonAnalysis) | 
|---|
| 321 | writem.AddCopySource("OriginalMC"); | 
|---|
| 322 | else | 
|---|
| 323 | write.AddCopySource("OriginalMC"); | 
|---|
| 324 |  | 
|---|
| 325 | MTaskList tlist2("Events"); | 
|---|
| 326 | tlist2.AddToList(&apply); | 
|---|
| 327 | if (!ismc) | 
|---|
| 328 | tlist2.AddToList(&cont); | 
|---|
| 329 | tlist2.AddToList(&contsw); | 
|---|
| 330 | if (!ismc) | 
|---|
| 331 | { | 
|---|
| 332 | // Calibration events don't enter star at all. | 
|---|
| 333 | tlist2.AddToList(&rate); | 
|---|
| 334 | tlist2.AddToList(&fillvs); | 
|---|
| 335 | tlist2.AddToList(&fill9); | 
|---|
| 336 | tlist2.AddToList(&writet); | 
|---|
| 337 | } | 
|---|
| 338 |  | 
|---|
| 339 | // Spark cut | 
|---|
| 340 | MFDataPhrase fsparks("log10(MNewImagePar.fConc1) < (-0.371)*log10(MHillas.fSize) + 0.596", "SparkCut"); | 
|---|
| 341 | fill0c.SetFilter(&fsparks); | 
|---|
| 342 |  | 
|---|
| 343 | // Inverted spark cut (need not to be a member of the task list | 
|---|
| 344 | // because it fsparks is | 
|---|
| 345 | MFilterList fnsparks(&fsparks); | 
|---|
| 346 | fill0d.SetFilter(&fnsparks); | 
|---|
| 347 |  | 
|---|
| 348 | tlist2.AddToList(&clean); | 
|---|
| 349 | tlist2.AddToList(&poscalc); | 
|---|
| 350 | tlist2.AddToList(&hcalc); | 
|---|
| 351 | tlist2.AddToList(&fsparks); | 
|---|
| 352 | tlist2.AddToList(&fill0a); | 
|---|
| 353 | tlist2.AddToList(&fill0c); | 
|---|
| 354 | tlist2.AddToList(&fill0d); | 
|---|
| 355 | tlist2.AddToList(&fill0b); | 
|---|
| 356 | tlist2.AddToList(&fill1); | 
|---|
| 357 | tlist2.AddToList(&fill2); | 
|---|
| 358 | tlist2.AddToList(&fill3); | 
|---|
| 359 | tlist2.AddToList(&fill4); | 
|---|
| 360 | tlist2.AddToList(&fill5); | 
|---|
| 361 |  | 
|---|
| 362 | // ----------------------- Muon Analysis ---------------------- | 
|---|
| 363 | // Filter to start muon analysis | 
|---|
| 364 | MFDataPhrase fmuon1("MHillas.fSize>150", "MuonPreCut"); | 
|---|
| 365 | // Filter to calculate further muon parameters | 
|---|
| 366 | MFDataPhrase fmuon2("(MMuonSearchPar.fRadius>180) && (MMuonSearchPar.fRadius<400) &&" | 
|---|
| 367 | "(MMuonSearchPar.fDeviation<45)", "MuonSearchCut"); | 
|---|
| 368 | // Filter to fill the MHMuonPar | 
|---|
| 369 | MFDataPhrase fmuon3("(MMuonCalibPar.fArcPhi>190) && (MMuonSearchPar.fDeviation<35) &&" | 
|---|
| 370 | "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04)", | 
|---|
| 371 | "MuonFinalCut"); | 
|---|
| 372 | // Filter to write Muons to Muon tree | 
|---|
| 373 | MFDataMember fmuon4("MMuonCalibPar.fArcPhi", '>', -0.5, "MuonWriteCut"); | 
|---|
| 374 | writem.SetFilter(&fmuon4); | 
|---|
| 375 |  | 
|---|
| 376 | MMuonSearchParCalc muscalc; | 
|---|
| 377 | muscalc.SetFilter(&fmuon1); | 
|---|
| 378 |  | 
|---|
| 379 | MMuonCalibParCalc mcalc; | 
|---|
| 380 | mcalc.SetFilter(&fmuon2); | 
|---|
| 381 |  | 
|---|
| 382 | MFillH fillmuon("MHSingleMuon", "", "FillMuon"); | 
|---|
| 383 | MFillH fillmpar("MHMuonPar",    "", "FillMuonPar"); | 
|---|
| 384 | fillmuon.SetFilter(&fmuon2); | 
|---|
| 385 | fillmpar.SetFilter(&fmuon3); | 
|---|
| 386 | fillmuon.SetBit(MFillH::kDoNotDisplay); | 
|---|
| 387 |  | 
|---|
| 388 | if (fMuonAnalysis) | 
|---|
| 389 | { | 
|---|
| 390 | tlist2.AddToList(&fmuon1); | 
|---|
| 391 | tlist2.AddToList(&muscalc); | 
|---|
| 392 | tlist2.AddToList(&fmuon2); | 
|---|
| 393 | tlist2.AddToList(&fillmuon); | 
|---|
| 394 | tlist2.AddToList(&mcalc); | 
|---|
| 395 | tlist2.AddToList(&fmuon3); | 
|---|
| 396 | tlist2.AddToList(&fillmpar); | 
|---|
| 397 | tlist2.AddToList(&fmuon4); | 
|---|
| 398 | tlist2.AddToList(&writem); | 
|---|
| 399 | } | 
|---|
| 400 |  | 
|---|
| 401 | // ------------------------------------------------------------ | 
|---|
| 402 |  | 
|---|
| 403 | // Initialize histogram | 
|---|
| 404 | MHSectorVsTime histdc, histrms; | 
|---|
| 405 | histdc.SetNameTime("MTimeCurrents"); | 
|---|
| 406 | histdc.SetTitle("Mean of all DC Currents;;<I> [nA]"); | 
|---|
| 407 | histdc.SetMinimum(0); | 
|---|
| 408 | histdc.SetMaximum(10); | 
|---|
| 409 | histrms.SetNameTime("MTimeCurrents"); | 
|---|
| 410 | histrms.SetTitle("Mean pedestal rms of all pixels;;<\\sigma_{p}> [phe]"); | 
|---|
| 411 | histrms.SetType(5); | 
|---|
| 412 | histrms.SetMinimum(0); | 
|---|
| 413 | histrms.SetMaximum(10); | 
|---|
| 414 |  | 
|---|
| 415 | /* | 
|---|
| 416 | // Define area index [0=inner, 1=outer] | 
|---|
| 417 | // TArrayI inner(1); inner[0] = 0; histdc.SetAreaIndex(inner); | 
|---|
| 418 | */ | 
|---|
| 419 |  | 
|---|
| 420 | // Task to fill the histogram | 
|---|
| 421 | MFillH filldc(&histdc,   "MCameraDC",                 "FillDC"); | 
|---|
| 422 | MFillH fillrms(&histrms, "MPedPhotFromExtractorRndm", "FillPedRms"); | 
|---|
| 423 | //MFillH filltst("MHTest", "MTime", "FillTest"); | 
|---|
| 424 | filldc.SetNameTab("Currents"); | 
|---|
| 425 | fillrms.SetNameTab("MeanRms"); | 
|---|
| 426 | //filltst.SetNameTab("Test"); | 
|---|
| 427 |  | 
|---|
| 428 | MFillH fillw("MHWeather", "MTimeCC", "FillWeather"); | 
|---|
| 429 |  | 
|---|
| 430 | MPointingPosCalc pcalc; | 
|---|
| 431 |  | 
|---|
| 432 | // ------------------------------------------------------------ | 
|---|
| 433 |  | 
|---|
| 434 | tlist.AddToList(ismc ? (MTask*)&readmc : (MTask*)&readreal); | 
|---|
| 435 | tlist.AddToList(&pcalc,  ismc ? "Events" : "Drive"); | 
|---|
| 436 | //tlist.AddToList(&filltst, "Events"); | 
|---|
| 437 | tlist.AddToList(&tlist2, "Events"); | 
|---|
| 438 | if (!ismc) | 
|---|
| 439 | { | 
|---|
| 440 | tlist.AddToList(&fillw,   "CC"); | 
|---|
| 441 | tlist.AddToList(&fillp1,  "Drive"); | 
|---|
| 442 | tlist.AddToList(&fillp2,  "Starguider"); | 
|---|
| 443 | tlist.AddToList(&filldc,  "Currents"); | 
|---|
| 444 | tlist.AddToList(&fillrms, "Currents"); | 
|---|
| 445 | } | 
|---|
| 446 | tlist.AddToList(&write); | 
|---|
| 447 |  | 
|---|
| 448 | // Create and setup the eventloop | 
|---|
| 449 | MEvtLoop evtloop(fName); | 
|---|
| 450 | evtloop.SetParList(&plist); | 
|---|
| 451 | evtloop.SetDisplay(fDisplay); | 
|---|
| 452 | evtloop.SetLogStream(fLog); | 
|---|
| 453 | if (!SetupEnv(evtloop)) | 
|---|
| 454 | return kFALSE; | 
|---|
| 455 |  | 
|---|
| 456 | // Execute first analysis | 
|---|
| 457 | if (!evtloop.Eventloop(fMaxEvents)) | 
|---|
| 458 | { | 
|---|
| 459 | *fLog << err << GetDescriptor() << ": Failed." << endl; | 
|---|
| 460 | return kFALSE; | 
|---|
| 461 | } | 
|---|
| 462 |  | 
|---|
| 463 | if (!WriteResult()) | 
|---|
| 464 | return kFALSE; | 
|---|
| 465 |  | 
|---|
| 466 | *fLog << all << GetDescriptor() << ": Done." << endl; | 
|---|
| 467 | *fLog << endl << endl; | 
|---|
| 468 |  | 
|---|
| 469 | return kTRUE; | 
|---|
| 470 | } | 
|---|