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-2008
|
---|
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 | // Core
|
---|
38 | #include "MLog.h"
|
---|
39 | #include "MLogManip.h"
|
---|
40 |
|
---|
41 | #include "MDirIter.h"
|
---|
42 | #include "MParList.h"
|
---|
43 | #include "MTaskList.h"
|
---|
44 | #include "MEvtLoop.h"
|
---|
45 |
|
---|
46 | #include "MStatusDisplay.h"
|
---|
47 |
|
---|
48 | // Histograms
|
---|
49 | #include "MHSectorVsTime.h"
|
---|
50 | #include "MHEffectiveOnTime.h"
|
---|
51 | #include "MHCamEvent.h"
|
---|
52 | #include "MBinning.h"
|
---|
53 |
|
---|
54 | ///NEEWWWW
|
---|
55 | #include "MH3.h"
|
---|
56 |
|
---|
57 | // Tasks
|
---|
58 | #include "MReadReports.h"
|
---|
59 | #include "MReadMarsFile.h"
|
---|
60 | #include "MContinue.h"
|
---|
61 | #include "MGeomApply.h"
|
---|
62 | #include "MEventRateCalc.h"
|
---|
63 | #include "MImgCleanStd.h"
|
---|
64 | #include "MSrcPosCalc.h"
|
---|
65 | #include "MSrcPosCorrect.h"
|
---|
66 | #include "MHillasCalc.h"
|
---|
67 | #include "MMuonSearchParCalc.h"
|
---|
68 | #include "MMuonCalibParCalc.h"
|
---|
69 | #include "MFillH.h"
|
---|
70 | #include "MWriteRootFile.h"
|
---|
71 |
|
---|
72 | // Filter
|
---|
73 | #include "MFDataPhrase.h"
|
---|
74 | #include "MFTriggerPattern.h"
|
---|
75 | #include "MFilterList.h"
|
---|
76 | #include "MFDataMember.h"
|
---|
77 | #include "MFDeltaT.h"
|
---|
78 | #include "MFSoftwareTrigger.h"
|
---|
79 |
|
---|
80 | // Parameter container
|
---|
81 | #include "MMuonSetup.h"
|
---|
82 | #include "MObservatory.h"
|
---|
83 | //#include "MTriggerPattern.h"
|
---|
84 | #include "MPointingPosCalc.h"
|
---|
85 |
|
---|
86 | ClassImp(MJStar);
|
---|
87 |
|
---|
88 | using namespace std;
|
---|
89 |
|
---|
90 | // --------------------------------------------------------------------------
|
---|
91 | //
|
---|
92 | // Default constructor.
|
---|
93 | //
|
---|
94 | // Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE
|
---|
95 | //
|
---|
96 | MJStar::MJStar(const char *name, const char *title) : fMuonAnalysis(kTRUE)
|
---|
97 | {
|
---|
98 | fName = name ? name : "MJStar";
|
---|
99 | fTitle = title ? title : "Standard analysis and reconstruction";
|
---|
100 | }
|
---|
101 |
|
---|
102 | Bool_t MJStar::CheckEnvLocal()
|
---|
103 | {
|
---|
104 | DisableMuonAnalysis(!GetEnv("MuonAnalysis", fMuonAnalysis));
|
---|
105 | return kTRUE;
|
---|
106 | }
|
---|
107 |
|
---|
108 | Bool_t MJStar::WriteResult()
|
---|
109 | {
|
---|
110 | if (fPathOut.IsNull())
|
---|
111 | {
|
---|
112 | *fLog << inf << "No output path specified via SetPathOut - no output written." << endl;
|
---|
113 | return kTRUE;
|
---|
114 | }
|
---|
115 |
|
---|
116 | TObjArray cont;
|
---|
117 | cont.Add(const_cast<TEnv*>(GetEnv()));
|
---|
118 | cont.Add(const_cast<MSequence*>(&fSequence));
|
---|
119 |
|
---|
120 | TNamed cmdline("CommandLine", fCommandLine.Data());
|
---|
121 | cont.Add(&cmdline);
|
---|
122 |
|
---|
123 | if (fDisplay)
|
---|
124 | {
|
---|
125 | TString title = "-- Star: ";
|
---|
126 | title += fSequence.GetSequence();
|
---|
127 | title += " --";
|
---|
128 | fDisplay->SetTitle(title, kFALSE);
|
---|
129 |
|
---|
130 | cont.Add(fDisplay);
|
---|
131 | }
|
---|
132 |
|
---|
133 | const TString oname = Form("star%08d.root", fSequence.GetSequence());
|
---|
134 | return WriteContainer(cont, oname, "RECREATE");
|
---|
135 | }
|
---|
136 |
|
---|
137 | Bool_t MJStar::Process()
|
---|
138 | {
|
---|
139 | if (!fSequence.IsValid())
|
---|
140 | {
|
---|
141 | *fLog << err << "ERROR - Sequence invalid!" << endl;
|
---|
142 | return kFALSE;
|
---|
143 | }
|
---|
144 |
|
---|
145 | // --------------------------------------------------------------------------------
|
---|
146 |
|
---|
147 | *fLog << inf;
|
---|
148 | fLog->Separator(GetDescriptor());
|
---|
149 | *fLog << "Calculate image parameters of sequence ";
|
---|
150 | *fLog << fSequence.GetFileName() << endl;
|
---|
151 | *fLog << endl;
|
---|
152 |
|
---|
153 | if (!CheckEnv())
|
---|
154 | return kFALSE;
|
---|
155 |
|
---|
156 | // --------------------------------------------------------------------------------
|
---|
157 |
|
---|
158 | MDirIter iter;
|
---|
159 | if (fSequence.GetRuns(iter, MSequence::kCalibrated)<=0)
|
---|
160 | {
|
---|
161 | *fLog << err << "ERROR - Sequence valid but without files." << endl;
|
---|
162 | return kFALSE;
|
---|
163 | }
|
---|
164 |
|
---|
165 | // Setup Parlist
|
---|
166 | MParList plist;
|
---|
167 | plist.AddToList(this); // take care of fDisplay!
|
---|
168 |
|
---|
169 | MObservatory obs;
|
---|
170 | plist.AddToList(&obs);
|
---|
171 |
|
---|
172 | MMuonSetup muonsetup;
|
---|
173 | plist.AddToList(&muonsetup);
|
---|
174 |
|
---|
175 | // Setup binnings for muon analysis
|
---|
176 | MBinning bins1("BinningRadius");
|
---|
177 | MBinning bins2("BinningArcWidth");
|
---|
178 | MBinning bins3("BinningRingBroadening");
|
---|
179 | MBinning bins4("BinningSizeVsArcRadius");
|
---|
180 | MBinning bins5("BinningMuonWidth");
|
---|
181 | MBinning bins6("BinningArcPhi");
|
---|
182 | MBinning binsd("BinningDist");
|
---|
183 | plist.AddToList(&bins1);
|
---|
184 | plist.AddToList(&bins2);
|
---|
185 | plist.AddToList(&bins3);
|
---|
186 | plist.AddToList(&bins4);
|
---|
187 | plist.AddToList(&bins5);
|
---|
188 | plist.AddToList(&bins6);
|
---|
189 | plist.AddToList(&binsd);
|
---|
190 |
|
---|
191 |
|
---|
192 | // Setup Tasklist
|
---|
193 | MTaskList tlist;
|
---|
194 | plist.AddToList(&tlist);
|
---|
195 |
|
---|
196 | MReadReports readreal;
|
---|
197 | readreal.AddTree("Events", "MTime.", MReadReports::kMaster);
|
---|
198 | readreal.AddTree("Drive", MReadReports::kRequired);
|
---|
199 | readreal.AddTree("Starguider", MReadReports::kRequired);
|
---|
200 | readreal.AddTree("Camera", MReadReports::kRequired);
|
---|
201 | readreal.AddTree("Currents");
|
---|
202 | readreal.AddTree("CC");
|
---|
203 | readreal.AddTree("Rec");
|
---|
204 | readreal.AddTree("Trigger");
|
---|
205 | readreal.AddTree("Pyrometer");
|
---|
206 | readreal.AddFiles(iter);
|
---|
207 |
|
---|
208 | MReadMarsFile readmc("Events");
|
---|
209 | readmc.DisableAutoScheme();
|
---|
210 | readmc.AddFiles(iter);
|
---|
211 |
|
---|
212 | // ------------------ Setup general tasks ----------------
|
---|
213 |
|
---|
214 | MFDeltaT fdeltat;
|
---|
215 | MContinue cont(&fdeltat, "FilterDeltaT", "Filter events with wrong timing");
|
---|
216 | cont.SetInverted();
|
---|
217 |
|
---|
218 | MGeomApply apply; // Only necessary to craete geometry
|
---|
219 | MEventRateCalc rate;
|
---|
220 | rate.SetNumEvents(1200);
|
---|
221 |
|
---|
222 | MFSoftwareTrigger swtrig;
|
---|
223 | MContinue contsw(&swtrig, "FilterSwTrigger", "Software trigger");
|
---|
224 | contsw.SetInverted();
|
---|
225 |
|
---|
226 | MImgCleanStd clean;
|
---|
227 | clean.SetNamePedPhotCam("MPedPhotFromExtractorRndm");
|
---|
228 |
|
---|
229 | MSrcPosCalc poscalc;
|
---|
230 | MHillasCalc hcalc;
|
---|
231 | hcalc.Disable(MHillasCalc::kCalcConc);
|
---|
232 |
|
---|
233 | // ------------------ Setup histograms and fill tasks ----------------
|
---|
234 | MHCamEvent evt0a(0, "Cleaned", "Average signal after Cleaning;;S [phe]");
|
---|
235 | MHCamEvent evt0c(0, "Sparkless", "Average signal after Cleaning and Spark cuts;;S [phe]");
|
---|
236 | MHCamEvent evt0d(0, "Sparks", "Average signal after Cleaning for Spark cuts;;S [phe]");
|
---|
237 | MHCamEvent evt0b(0, "UsedPix", "Fraction of Events in which Pixels are used;;Fraction");
|
---|
238 | evt0a.SetErrorSpread(kFALSE);
|
---|
239 | evt0b.SetErrorSpread(kFALSE);
|
---|
240 | evt0c.SetErrorSpread(kFALSE);
|
---|
241 | evt0d.SetErrorSpread(kFALSE);
|
---|
242 | evt0b.SetThreshold(0);
|
---|
243 |
|
---|
244 | MFillH fillvs("MHRate", "MTime", "FillEventRate");
|
---|
245 | MFillH fillp1("MHPointing", "MTimeDrive", "FillDrive");
|
---|
246 | MFillH fillp2("MHPointing", "MTimeStarguider", "FillStarguider");
|
---|
247 | fillp1.SetBit(MFillH::kDoNotDisplay);
|
---|
248 | fillp1.SetBit(MFillH::kCanSkip);
|
---|
249 | fillp2.SetBit(MFillH::kCanSkip);
|
---|
250 |
|
---|
251 | // Needed in parameter list for ReadEnv
|
---|
252 | MHEffectiveOnTime hontime;
|
---|
253 | plist.AddToList(&hontime);
|
---|
254 |
|
---|
255 | MFillH fill0a(&evt0a, "MSignalCam", "FillSignalCam");
|
---|
256 | MFillH fill0b(&evt0b, "MSignalCam", "FillCntUsedPixels");
|
---|
257 | MFillH fill0c(&evt0c, "MSignalCam", "FillSignalCamSparkless");
|
---|
258 | MFillH fill0d(&evt0d, "MSignalCam", "FillSignalCamSparks");
|
---|
259 | MFillH fill1("MHHillas", "MHillas", "FillHillas");
|
---|
260 | MFillH fill2("MHHillasExt", "", "FillHillasExt");
|
---|
261 | MFillH fill3("MHHillasSrc", "MHillasSrc", "FillHillasSrc");
|
---|
262 | MFillH fill4("MHImagePar", "MImagePar", "FillImagePar");
|
---|
263 | MFillH fill5("MHNewImagePar", "MNewImagePar", "FillNewImagePar");
|
---|
264 | MFillH fill9("MHEffectiveOnTime", "MTime", "FillEffOnTime");
|
---|
265 |
|
---|
266 | //fillvs.SetNameTab("Rate");
|
---|
267 | fill9.SetNameTab("EffOnTime");
|
---|
268 | fill0c.SetNameTab("Sparkless");
|
---|
269 | fill0d.SetNameTab("Sparks");
|
---|
270 |
|
---|
271 | // FIXME: This should be replaced by a cut working for all triggers!
|
---|
272 | MTriggerPattern par; // An empty trigger pattern for older files
|
---|
273 | plist.AddToList(&par); // without MTriggerPattern stored in the file
|
---|
274 |
|
---|
275 | // For the effective on-time calculation and the muon statistics
|
---|
276 | // we don't want SUM-only events
|
---|
277 | MFTriggerPattern fsum;
|
---|
278 | fsum.SetDefault(kTRUE);
|
---|
279 | fsum.DenyAll();
|
---|
280 | fsum.RequireTriggerLvl1();
|
---|
281 | fsum.AllowTriggerLvl2();
|
---|
282 | fsum.AllowSumTrigger();
|
---|
283 | fill9.SetFilter(&fsum);
|
---|
284 |
|
---|
285 | // Plot the trigger pattern rates vs. run-number
|
---|
286 | MH3 hrate("MRawRunHeader.GetFileID", "MTriggerPattern.GetUnprescaled");
|
---|
287 | if (fSequence.IsMonteCarlo())
|
---|
288 | hrate.SetWeight("100./MMcRunHeader.fNumSimulatedShowers");
|
---|
289 | else
|
---|
290 | hrate.SetWeight("1./TMath::Max(MRawRunHeader.GetRunLength,1)");
|
---|
291 | hrate.SetName("Rate");
|
---|
292 | hrate.SetTitle("Event rate after cleaning [Hz];File Id;Trigger Type;");
|
---|
293 | hrate.InitLabels(MH3::kLabelsX);
|
---|
294 | hrate.DefaultLabelY("ERROR");
|
---|
295 | hrate.DefineLabelY( 0, "0"); // 0: No pattern
|
---|
296 | hrate.DefineLabelY( 1, "Trig"); // 1: Lvl1
|
---|
297 | hrate.DefineLabelY( 4, "Trig"); // 4: Lvl2
|
---|
298 | hrate.DefineLabelY( 5, "Trig"); // Lvl2+Lvl1
|
---|
299 | hrate.DefineLabelY(32, "Sum"); // 32: Sum
|
---|
300 | hrate.DefineLabelY(33, "Trig"); // Sum+Lvl1
|
---|
301 | hrate.DefineLabelY(36, "Trig"); // Sum+Lvl2
|
---|
302 | hrate.DefineLabelY(37, "Trig"); // Sum+Lvl1+Lvl2
|
---|
303 |
|
---|
304 | MFillH frate(&hrate, "", "FillRate");
|
---|
305 | frate.SetDrawOption("box");
|
---|
306 |
|
---|
307 | // ------------------ Setup write task ----------------
|
---|
308 |
|
---|
309 | // Effective on-time need its own not to be skipped by (eg) image cleaning
|
---|
310 | // Muons needs its own to have a unique SetReadyToSave
|
---|
311 | const TString rule(Form("s/(([0-9]+_)?(M[12]_)?[0-9.]+)_Y_(.*[.]root)$/%s\\/$1_I_$4/", Esc(fPathOut).Data()));
|
---|
312 | MWriteRootFile write( 2, rule, fOverwrite?"RECREATE":"NEW", "Image parameters");
|
---|
313 | MWriteRootFile writet(2, rule, fOverwrite?"RECREATE":"NEW", "Image parameters"); // EffectiveOnTime
|
---|
314 | MWriteRootFile writem(2, rule, fOverwrite?"RECREATE":"NEW", "Image parameters"); // Muons
|
---|
315 | writem.SetName("WriteMuons");
|
---|
316 |
|
---|
317 | // Data
|
---|
318 | write.AddContainer("MHillas", "Events");
|
---|
319 | write.AddContainer("MHillasExt", "Events");
|
---|
320 | write.AddContainer("MHillasSrc", "Events");
|
---|
321 | write.AddContainer("MImagePar", "Events");
|
---|
322 | write.AddContainer("MNewImagePar", "Events");
|
---|
323 | write.AddContainer("MRawEvtHeader", "Events");
|
---|
324 | write.AddContainer("MPointingPos", "Events");
|
---|
325 | write.AddContainer("MTriggerPattern", "Events");
|
---|
326 |
|
---|
327 | // Run Header
|
---|
328 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
329 | // write.AddContainer("MBadPixelsCam", "RunHeaders");
|
---|
330 | write.AddContainer("MGeomCam", "RunHeaders");
|
---|
331 | write.AddContainer("MObservatory", "RunHeaders");
|
---|
332 |
|
---|
333 | // Muon Setup
|
---|
334 | write.AddContainer("BinningRadius", "RunHeaders");
|
---|
335 | write.AddContainer("BinningArcWidth", "RunHeaders");
|
---|
336 | write.AddContainer("BinningRingBroadening", "RunHeaders");
|
---|
337 | write.AddContainer("BinningSizeVsArcRadius", "RunHeaders");
|
---|
338 | write.AddContainer("MMuonSetup", "RunHeaders");
|
---|
339 |
|
---|
340 | if (fSequence.IsMonteCarlo())
|
---|
341 | {
|
---|
342 | // Monte Carlo Data
|
---|
343 | write.AddContainer("MMcEvt", "Events");
|
---|
344 | write.AddContainer("MMcTrig", "Events", kFALSE);
|
---|
345 | write.AddContainer("MCorsikaEvtHeader", "Events", kFALSE);
|
---|
346 | write.AddContainer("MSrcPosCam", "Events");
|
---|
347 | // Monte Carlo Run Headers
|
---|
348 | write.AddContainer("MMcRunHeader", "RunHeaders");
|
---|
349 | write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE);
|
---|
350 | write.AddContainer("MMcFadcHeader", "RunHeaders", kFALSE);
|
---|
351 | write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE);
|
---|
352 | write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
|
---|
353 | write.AddContainer("MCorsikaRunHeader", "RunHeaders", kFALSE);
|
---|
354 | }
|
---|
355 | else
|
---|
356 | {
|
---|
357 | // Event time
|
---|
358 | write.AddContainer("MTime", "Events");
|
---|
359 |
|
---|
360 | // Slow-control trees with time information
|
---|
361 | write.AddTree("Drive");
|
---|
362 | write.AddTree("Starguider", kFALSE);
|
---|
363 | write.AddTree("Pyrometer", kFALSE);
|
---|
364 | writet.AddContainer("MEffectiveOnTime", "EffectiveOnTime");
|
---|
365 | writet.AddContainer("MTimeEffectiveOnTime", "EffectiveOnTime");
|
---|
366 | }
|
---|
367 |
|
---|
368 | // What to write in muon tree
|
---|
369 | writem.AddContainer("MMuonSearchPar", "Muons");
|
---|
370 | writem.AddContainer("MMuonCalibPar", "Muons");
|
---|
371 | writem.AddContainer("MHillas", "Muons");
|
---|
372 | writem.AddContainer("MHillasExt", "Muons");
|
---|
373 | writem.AddContainer("MHillasSrc", "Muons");
|
---|
374 | writem.AddContainer("MImagePar", "Muons");
|
---|
375 | writem.AddContainer("MNewImagePar", "Muons");
|
---|
376 | writem.AddContainer("MRawEvtHeader", "Muons");
|
---|
377 | writem.AddContainer("MPointingPos", "Muons");
|
---|
378 | if (fSequence.IsMonteCarlo())
|
---|
379 | {
|
---|
380 | // Monte Carlo Data
|
---|
381 | writem.AddContainer("MMcEvt", "Muons");
|
---|
382 | writem.AddContainer("MMcTrig", "Muons", kFALSE);
|
---|
383 | }
|
---|
384 |
|
---|
385 | if (fSequence.IsMonteCarlo())
|
---|
386 | {
|
---|
387 | if (fMuonAnalysis)
|
---|
388 | writem.AddCopySource("OriginalMC");
|
---|
389 | else
|
---|
390 | write.AddCopySource("OriginalMC");
|
---|
391 | }
|
---|
392 |
|
---|
393 | MTaskList tlist2("Events");
|
---|
394 | tlist2.AddToList(&apply);
|
---|
395 | if (!fSequence.IsMonteCarlo())
|
---|
396 | tlist2.AddToList(&cont);
|
---|
397 | tlist2.AddToList(&contsw);
|
---|
398 | if (!fSequence.IsMonteCarlo())
|
---|
399 | {
|
---|
400 | // Calibration events don't enter star at all.
|
---|
401 | tlist2.AddToList(&rate);
|
---|
402 | tlist2.AddToList(&fillvs);
|
---|
403 | tlist2.AddToList(&fsum);
|
---|
404 | tlist2.AddToList(&fill9);
|
---|
405 | tlist2.AddToList(&writet);
|
---|
406 | }
|
---|
407 |
|
---|
408 | // Spark cut:
|
---|
409 | // This cut is a little bit different from the default cut in the
|
---|
410 | // ganymed.rc, because the cut in ganymed.rc also suppresses a
|
---|
411 | // little background, while the cut here only shows sparks
|
---|
412 | MFDataPhrase fsparks("log10(MNewImagePar.fConcCOG)<-0.45*(log10(MHillas.fSize)-2.5)-0.24", "SparkCut");
|
---|
413 | //fill0b.SetFilter(&fsparks);
|
---|
414 | fill0c.SetFilter(&fsparks);
|
---|
415 |
|
---|
416 | // Inverted spark cut (need not to be a member of the task list
|
---|
417 | // because it fsparks is
|
---|
418 | MFilterList fnsparks(&fsparks);
|
---|
419 | fill0d.SetFilter(&fnsparks);
|
---|
420 |
|
---|
421 | tlist2.AddToList(&clean);
|
---|
422 | tlist2.AddToList(&poscalc);
|
---|
423 |
|
---|
424 | MFillH fillsp("MHSrcPosCam", "MSrcPosCam", "FillSrcPosCam");
|
---|
425 | fillsp.SetNameTab("Src");
|
---|
426 | if (fSequence.IsMonteCarlo())
|
---|
427 | tlist2.AddToList(&fillsp);
|
---|
428 |
|
---|
429 |
|
---|
430 | tlist2.AddToList(&hcalc);
|
---|
431 | tlist2.AddToList(&fsparks);
|
---|
432 | tlist2.AddToList(&fill0a);
|
---|
433 | tlist2.AddToList(&fill0c);
|
---|
434 | tlist2.AddToList(&fill0d);
|
---|
435 | tlist2.AddToList(&fill0b);
|
---|
436 | tlist2.AddToList(&frate);
|
---|
437 | tlist2.AddToList(&fill1);
|
---|
438 | tlist2.AddToList(&fill2);
|
---|
439 | tlist2.AddToList(&fill3);
|
---|
440 | tlist2.AddToList(&fill4);
|
---|
441 | tlist2.AddToList(&fill5);
|
---|
442 |
|
---|
443 | // ----------------------- Muon Analysis ----------------------
|
---|
444 | // Filter to start muon analysis
|
---|
445 | MFDataPhrase fmuon1("MHillas.fSize>150 && MNewImagePar.fConcCOG<0.1", "MuonPreCut");
|
---|
446 | // Filter to calculate further muon parameters
|
---|
447 | MFDataPhrase fmuon2("(MMuonSearchPar.fRadius*MGeomCam.fConvMm2Deg>0.6) && (MMuonSearchPar.fRadius*MGeomCam.fConvMm2Deg<1.35) &&"
|
---|
448 | "(MMuonSearchPar.fDeviation*MGeomCam.fConvMm2Deg<0.152)", "MuonSearchCut");
|
---|
449 | // Filter to fill the MHMuonPar
|
---|
450 | MFDataPhrase fmuon3("(MMuonCalibPar.fArcPhi>190) && (MMuonSearchPar.fDeviation*MGeomCam.fConvMm2Deg<0.118) &&"
|
---|
451 | "(MMuonCalibPar.fArcWidth<0.20) && (MMuonCalibPar.fArcWidth>0.04) &&"
|
---|
452 | "MMuonCalibPar.fRelTimeSigma<1.5",
|
---|
453 | "MuonFinalCut");
|
---|
454 | // Filter to write Muons to Muon tree
|
---|
455 | MFDataMember fmuon4("MMuonCalibPar.fArcPhi", '>', -0.5, "MuonWriteCut");
|
---|
456 | writem.SetFilter(&fmuon4);
|
---|
457 |
|
---|
458 | MMuonSearchParCalc muscalc;
|
---|
459 | muscalc.SetFilter(&fmuon1);
|
---|
460 |
|
---|
461 | MMuonCalibParCalc mcalc;
|
---|
462 | mcalc.SetFilter(&fmuon2);
|
---|
463 |
|
---|
464 | MFillH fillmuon("MHSingleMuon", "", "FillMuon");
|
---|
465 | MFillH fillmpar("MHMuonPar", "", "FillMuonPar");
|
---|
466 | fillmuon.SetFilter(&fmuon2);
|
---|
467 | fillmpar.SetFilter(&fmuon3);
|
---|
468 | fillmuon.SetBit(MFillH::kDoNotDisplay);
|
---|
469 |
|
---|
470 | if (fMuonAnalysis)
|
---|
471 | {
|
---|
472 | tlist2.AddToList(&fmuon1);
|
---|
473 | tlist2.AddToList(&muscalc);
|
---|
474 | tlist2.AddToList(&fmuon2);
|
---|
475 | tlist2.AddToList(&fillmuon);
|
---|
476 | tlist2.AddToList(&mcalc);
|
---|
477 | tlist2.AddToList(&fmuon3);
|
---|
478 | tlist2.AddToList(&fillmpar);
|
---|
479 | tlist2.AddToList(&fmuon4);
|
---|
480 | tlist2.AddToList(&writem);
|
---|
481 | }
|
---|
482 |
|
---|
483 | // ------------------------------------------------------------
|
---|
484 |
|
---|
485 | // Initialize histogram
|
---|
486 | MHSectorVsTime histdc, histrms;
|
---|
487 | histdc.SetNameTime("MTimeCamera");
|
---|
488 | histdc.SetTitle("Average DC currents of all pixels vs time;;<I> [nA]");
|
---|
489 | histdc.SetMinimum(0);
|
---|
490 | histdc.SetMaximum(10);
|
---|
491 | histrms.SetNameTime("MTimeCamera");
|
---|
492 | histrms.SetTitle("Average pedestal rms of all pixels vs time;;<\\sigma_{p}> [phe]");
|
---|
493 | histrms.SetType(5);
|
---|
494 | histrms.SetMinimum(0);
|
---|
495 | histrms.SetMaximum(10);
|
---|
496 |
|
---|
497 | /*
|
---|
498 | // Define area index [0=inner, 1=outer]
|
---|
499 | // TArrayI inner(1); inner[0] = 0; histdc.SetAreaIndex(inner);
|
---|
500 | */
|
---|
501 |
|
---|
502 | // Task to fill the histogram
|
---|
503 | MFillH filldc(&histdc, "MCameraDC", "FillDC");
|
---|
504 | MFillH fillrms(&histrms, "MPedPhotFromExtractorRndm", "FillPedRms");
|
---|
505 | //MFillH filltst("MHTest", "MTime", "FillTest");
|
---|
506 | filldc.SetNameTab("Currents");
|
---|
507 | fillrms.SetNameTab("MeanRms");
|
---|
508 | //filltst.SetNameTab("Test");
|
---|
509 |
|
---|
510 | MFillH fillw1("MHWeather", "MTimeCC", "FillWeather");
|
---|
511 | MFillH fillw2("MHWeather", "MTimePyrometer", "FillPyrometer");
|
---|
512 | fillw2.SetBit(MFillH::kDoNotDisplay);
|
---|
513 | fillw2.SetBit(MFillH::kCanSkip);
|
---|
514 |
|
---|
515 | // instantiate camera histogram containers
|
---|
516 | MHCamEvent evtdt(0, "Thresholds", "Average Discriminator Thresholds;;DT [au]");
|
---|
517 | plist.AddToList(&evtdt);
|
---|
518 |
|
---|
519 | // instantiate fill tasks
|
---|
520 | MFillH filldt1("Thresholds", "MCameraTH", "FillDT-CC");
|
---|
521 | MFillH filldt2("Thresholds", "MCameraTH", "FillDT-Rec");
|
---|
522 | filldt1.SetNameTab("DT");
|
---|
523 | filldt2.SetBit(MFillH::kDoNotDisplay);
|
---|
524 | filldt2.SetBit(MFillH::kCanSkip);
|
---|
525 | filldt1.SetBit(MFillH::kCanSkip);
|
---|
526 |
|
---|
527 | MHSectorVsTime histipr;
|
---|
528 |
|
---|
529 | histipr.SetNameTime("MTimeTrigger");
|
---|
530 | histipr.SetTitle("Mean of all IPR;;<IPR> [Hz]");
|
---|
531 | histipr.SetMinimum(0);
|
---|
532 | //histipr.SetUseMedian();
|
---|
533 |
|
---|
534 | // Task to fill the histogram
|
---|
535 | MFillH fillipr(&histipr, "MTriggerIPR", "FillIPR");
|
---|
536 | fillipr.SetNameTab("IPR");
|
---|
537 |
|
---|
538 | MPointingPosCalc pcalc;
|
---|
539 |
|
---|
540 | // ------------------------------------------------------------
|
---|
541 |
|
---|
542 | tlist.AddToList(fSequence.IsMonteCarlo() ? (MTask*)&readmc : (MTask*)&readreal);
|
---|
543 | tlist.AddToList(&pcalc, fSequence.IsMonteCarlo() ? "Events" : "Drive");
|
---|
544 | //tlist.AddToList(&filltst, "Events");
|
---|
545 | tlist.AddToList(&tlist2, "Events");
|
---|
546 | if (!fSequence.IsMonteCarlo())
|
---|
547 | {
|
---|
548 | // initiate task list
|
---|
549 | tlist.AddToList(&fillw1, "CC");
|
---|
550 | tlist.AddToList(&fillw2, "Pyrometer");
|
---|
551 | tlist.AddToList(&fillp1, "Drive");
|
---|
552 | tlist.AddToList(&fillp2, "Starguider");
|
---|
553 | tlist.AddToList(&fillrms, "Camera");
|
---|
554 | tlist.AddToList(&filldc, "Camera");
|
---|
555 | tlist.AddToList(&fillipr, "Trigger");
|
---|
556 | tlist.AddToList(&filldt1, "CC"); // Old files: Receiver information in CC-Tree (Mars<=2.0)
|
---|
557 | tlist.AddToList(&filldt2, "Rec"); // New files: Receiver information in Rec-Tree (Mars >2.0)
|
---|
558 | }
|
---|
559 | if (!HasNullOut())
|
---|
560 | tlist.AddToList(&write);
|
---|
561 |
|
---|
562 | // Create and setup the eventloop
|
---|
563 | MEvtLoop evtloop(fName);
|
---|
564 | evtloop.SetParList(&plist);
|
---|
565 | evtloop.SetDisplay(fDisplay);
|
---|
566 | evtloop.SetLogStream(fLog);
|
---|
567 | if (!SetupEnv(evtloop))
|
---|
568 | return kFALSE;
|
---|
569 |
|
---|
570 | // Execute first analysis
|
---|
571 | if (!evtloop.Eventloop(fMaxEvents))
|
---|
572 | {
|
---|
573 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
574 | return kFALSE;
|
---|
575 | }
|
---|
576 |
|
---|
577 | if (!WriteResult())
|
---|
578 | return kFALSE;
|
---|
579 |
|
---|
580 | *fLog << all << GetDescriptor() << ": Done." << endl << endl << endl;;
|
---|
581 |
|
---|
582 | return kTRUE;
|
---|
583 | }
|
---|