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/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2007
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MJCut
|
---|
28 | //
|
---|
29 | /////////////////////////////////////////////////////////////////////////////
|
---|
30 | #include "MJCut.h"
|
---|
31 |
|
---|
32 | // Root
|
---|
33 | #include <TEnv.h>
|
---|
34 | #include <TFile.h>
|
---|
35 |
|
---|
36 | // Environment
|
---|
37 | #include "MLog.h"
|
---|
38 | #include "MLogManip.h"
|
---|
39 |
|
---|
40 | // Eventloop
|
---|
41 | #include "MParList.h"
|
---|
42 | #include "MTaskList.h"
|
---|
43 | #include "MEvtLoop.h"
|
---|
44 |
|
---|
45 | // Display
|
---|
46 | #include "MStatusDisplay.h"
|
---|
47 |
|
---|
48 | // Tasks
|
---|
49 | #include "MReadReports.h"
|
---|
50 | #include "MReadMarsFile.h"
|
---|
51 | #include "MPrint.h"
|
---|
52 | #include "MContinue.h"
|
---|
53 | #include "MTaskEnv.h"
|
---|
54 | #include "MPointingDevCalc.h"
|
---|
55 | #include "MParameterCalc.h"
|
---|
56 | #include "MSrcPosRndm.h"
|
---|
57 | #include "MSrcPosCalc.h"
|
---|
58 | #include "MSrcPosCorrect.h"
|
---|
59 | #include "MHillasCalc.h"
|
---|
60 | #include "MFillH.h"
|
---|
61 | #include "MWriteRootFile.h"
|
---|
62 |
|
---|
63 | // Filter
|
---|
64 | //#include "MFDataMember.h"
|
---|
65 |
|
---|
66 | // Fit signal environment
|
---|
67 | #include "../mhflux/MAlphaFitter.h"
|
---|
68 | #include "../mhflux/MHAlpha.h"
|
---|
69 |
|
---|
70 | // Containers
|
---|
71 | #include "MH3.h"
|
---|
72 | #include "MBinning.h"
|
---|
73 | #include "MDataSet.h"
|
---|
74 | #include "MParameters.h"
|
---|
75 | #include "MPointingPos.h"
|
---|
76 | #include "MObservatory.h"
|
---|
77 | #include "MHSrcPosCam.h"
|
---|
78 |
|
---|
79 | ClassImp(MJCut);
|
---|
80 |
|
---|
81 | using namespace std;
|
---|
82 |
|
---|
83 | // --------------------------------------------------------------------------
|
---|
84 | //
|
---|
85 | // Default constructor. Set defaults for fStoreSummary, fStoreresult,
|
---|
86 | // fWriteOnly, fFullDisplay to kFALSE and initialize
|
---|
87 | // /*fEstimateEnergy and*/ fCalcHadronness with NULL.
|
---|
88 | //
|
---|
89 | MJCut::MJCut(const char *name, const char *title)
|
---|
90 | : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE),
|
---|
91 | fFullDisplay(kTRUE),
|
---|
92 | fRndmSrcPos(kFALSE), fNameHist("MHThetaSq"),
|
---|
93 | fCalcHadronness(0), fCalcDisp(0), fEstimateEnergy(0)
|
---|
94 | {
|
---|
95 | fName = name ? name : "MJCut";
|
---|
96 | fTitle = title ? title : "Standard program to perform g/h-separation cuts";
|
---|
97 | }
|
---|
98 |
|
---|
99 | // --------------------------------------------------------------------------
|
---|
100 | //
|
---|
101 | // Destructor. Delete fEstimateEnergy and fCalcHadronness if != NULL
|
---|
102 | //
|
---|
103 | MJCut::~MJCut()
|
---|
104 | {
|
---|
105 | if (fEstimateEnergy)
|
---|
106 | delete fEstimateEnergy;
|
---|
107 | if (fCalcHadronness)
|
---|
108 | delete fCalcHadronness;
|
---|
109 | if (fCalcDisp)
|
---|
110 | delete fCalcDisp;
|
---|
111 | }
|
---|
112 |
|
---|
113 | // --------------------------------------------------------------------------
|
---|
114 | //
|
---|
115 | // Set the name of the summary file (events after cut0)
|
---|
116 | // If you give a name the storage of this file is enabled implicitly.
|
---|
117 | // If you give no filename the storage is neither enabled nor disabled,
|
---|
118 | // but the storage file name is reset.
|
---|
119 | // If no filename is set the default filename is used.
|
---|
120 | // You can explicitly enable or disable the storage using EnableStoreOf*()
|
---|
121 | // The default argument is no filename.
|
---|
122 | //
|
---|
123 | void MJCut::SetNameSummaryFile(const char *name)
|
---|
124 | {
|
---|
125 | fNameSummary=name;
|
---|
126 | if (!fNameSummary.IsNull())
|
---|
127 | EnableStorageOfSummary();
|
---|
128 | }
|
---|
129 |
|
---|
130 | // --------------------------------------------------------------------------
|
---|
131 | //
|
---|
132 | // Set the name of the summary file (events after cut3)
|
---|
133 | // If you give a name the storage of this file is enabled implicitly.
|
---|
134 | // If you give no filename the storage is neither enabled nor disabled,
|
---|
135 | // but the storage file name is reset.
|
---|
136 | // If no filename is set the default filename is used.
|
---|
137 | // You can explicitly enable or disable the storage using EnableStoreOf*()
|
---|
138 | // The default argument is no filename.
|
---|
139 | //
|
---|
140 | void MJCut::SetNameResultFile(const char *name)
|
---|
141 | {
|
---|
142 | fNameResult=name;
|
---|
143 | if (!fNameResult.IsNull())
|
---|
144 | EnableStorageOfResult();
|
---|
145 | }
|
---|
146 |
|
---|
147 | // --------------------------------------------------------------------------
|
---|
148 | //
|
---|
149 | // Setup a task estimating the energy. The given task is cloned.
|
---|
150 | //
|
---|
151 | /*
|
---|
152 | void MJCut::SetEnergyEstimator(const MTask *task)
|
---|
153 | {
|
---|
154 | if (fEstimateEnergy)
|
---|
155 | delete fEstimateEnergy;
|
---|
156 | fEstimateEnergy = task ? (MTask*)task->Clone() : 0;
|
---|
157 | }
|
---|
158 | */
|
---|
159 |
|
---|
160 | // --------------------------------------------------------------------------
|
---|
161 | //
|
---|
162 | // Setup a task calculating the hadronness. The given task is cloned.
|
---|
163 | //
|
---|
164 | void MJCut::SetHadronnessCalculator(const MTask *task)
|
---|
165 | {
|
---|
166 | if (fCalcHadronness)
|
---|
167 | delete fCalcHadronness;
|
---|
168 | fCalcHadronness = task ? (MTask*)task->Clone() : 0;
|
---|
169 | }
|
---|
170 |
|
---|
171 | // --------------------------------------------------------------------------
|
---|
172 | //
|
---|
173 | // Setup a task calculating disp. The given task is cloned.
|
---|
174 | //
|
---|
175 | void MJCut::SetDispCalculator(const MTask *task)
|
---|
176 | {
|
---|
177 | if (fCalcDisp)
|
---|
178 | delete fCalcDisp;
|
---|
179 | fCalcDisp = task ? (MTask*)task->Clone() : 0;
|
---|
180 | }
|
---|
181 |
|
---|
182 | // --------------------------------------------------------------------------
|
---|
183 | //
|
---|
184 | // Setup a task estimating the eneryg. The given task is cloned.
|
---|
185 | //
|
---|
186 | void MJCut::SetEnergyEstimator(const MTask *task)
|
---|
187 | {
|
---|
188 | if (fEstimateEnergy)
|
---|
189 | delete fEstimateEnergy;
|
---|
190 | fEstimateEnergy = task ? (MTask*)task->Clone() : 0;
|
---|
191 | }
|
---|
192 |
|
---|
193 | // --------------------------------------------------------------------------
|
---|
194 | //
|
---|
195 | // return fOutputPath+"/ganymed%08d.root", num
|
---|
196 | //
|
---|
197 | TString MJCut::GetOutputFile(UInt_t num) const
|
---|
198 | {
|
---|
199 | TString p(fPathOut);
|
---|
200 | p += "/";
|
---|
201 | p += fNameOutput.IsNull() ? Form("ganymed%08d.root", num) : fNameOutput.Data();
|
---|
202 | gSystem->ExpandPathName(p);
|
---|
203 | return p;
|
---|
204 | }
|
---|
205 |
|
---|
206 | /*
|
---|
207 | Bool_t MJCut::ReadTasks(const char *fname, MTask* &env1, MTask* &env2) const
|
---|
208 | {
|
---|
209 | // const TString fname = Form("%s/calib%08d.root", fPathIn.Data(), fSequence.GetSequence());
|
---|
210 |
|
---|
211 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
212 |
|
---|
213 | TFile file(fname, "READ");
|
---|
214 | if (!file.IsOpen())
|
---|
215 | {
|
---|
216 | *fLog << err << dbginf << "ERROR - Could not open file " << fname << endl;
|
---|
217 | return kFALSE;
|
---|
218 | }
|
---|
219 |
|
---|
220 | TObject *o = file.Get("EstimateEnergy");
|
---|
221 | if (o && !o->InheritsFrom(MTask::Class()))
|
---|
222 | {
|
---|
223 | *fLog << err << dbginf << "ERROR - EstimateEnergy read from " << fname << " doesn't inherit from MTask!" << endl;
|
---|
224 | return kFALSE;
|
---|
225 | }
|
---|
226 | env1 = o ? (MTask*)o->Clone() : FNULL;
|
---|
227 |
|
---|
228 | o = file.Get("CalcHadronness");
|
---|
229 | if (o && !o->InheritsFrom(MTask::Class()))
|
---|
230 | {
|
---|
231 | *fLog << err << dbginf << "ERROR - CalcHadronness read from " << fname << " doesn't inherit from MTask!" << endl;
|
---|
232 | return kFALSE;
|
---|
233 | }
|
---|
234 | env2 = o ? (MTask*)o->Clone() : NULL;
|
---|
235 |
|
---|
236 | return kTRUE;
|
---|
237 | }
|
---|
238 | */
|
---|
239 |
|
---|
240 | // --------------------------------------------------------------------------
|
---|
241 | //
|
---|
242 | // Write the tasks in cont to the file corresponding to analysis number num,
|
---|
243 | // see GetOutputFile()
|
---|
244 | //
|
---|
245 | Bool_t MJCut::WriteTasks(UInt_t num, TObjArray &cont) const
|
---|
246 | {
|
---|
247 | if (fPathOut.IsNull())
|
---|
248 | {
|
---|
249 | *fLog << inf << "No output path specified via SetPathOut - no output written." << endl;
|
---|
250 | return kTRUE;
|
---|
251 | }
|
---|
252 |
|
---|
253 | const TString oname(GetOutputFile(num));
|
---|
254 |
|
---|
255 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
256 |
|
---|
257 | TFile *file = 0;
|
---|
258 | if (fNameResult.IsNull() && fStoreResult)
|
---|
259 | {
|
---|
260 | file = (TFile*)gROOT->GetListOfFiles()->FindObject(oname);
|
---|
261 | if (file)
|
---|
262 | file->cd();
|
---|
263 | }
|
---|
264 | else
|
---|
265 | file = TFile::Open(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCut", 9);
|
---|
266 |
|
---|
267 | if (!file)
|
---|
268 | {
|
---|
269 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
---|
270 | return kFALSE;
|
---|
271 | }
|
---|
272 |
|
---|
273 | const Bool_t rc = WriteContainer(cont);
|
---|
274 |
|
---|
275 | if (!(fNameResult.IsNull() && fStoreResult))
|
---|
276 | delete file;
|
---|
277 |
|
---|
278 | return rc;
|
---|
279 | }
|
---|
280 |
|
---|
281 | // --------------------------------------------------------------------------
|
---|
282 | //
|
---|
283 | // Write the result plots and other results to the file corresponding to
|
---|
284 | // analysis number num, see GetOutputFile()
|
---|
285 | //
|
---|
286 | Bool_t MJCut::WriteResult(const MParList &plist, const MDataSet &set) const
|
---|
287 | {
|
---|
288 | TObjArray arr;
|
---|
289 |
|
---|
290 | // Save all MBinnings
|
---|
291 | TIter Next(plist);
|
---|
292 | TObject *o=0;
|
---|
293 | while ((o=Next()))
|
---|
294 | if (o->InheritsFrom(MBinning::Class()))
|
---|
295 | arr.Add(o);
|
---|
296 |
|
---|
297 | // Save also the result, not only the setup
|
---|
298 | const MHAlpha *halpha = (MHAlpha*)plist.FindObject("Hist", "MHAlpha");
|
---|
299 | if (halpha)
|
---|
300 | arr.Add((TObject*)(&halpha->GetAlphaFitter()));
|
---|
301 |
|
---|
302 | // Save also the dataset
|
---|
303 | arr.Add(const_cast<MDataSet*>(&set));
|
---|
304 |
|
---|
305 | const Int_t num = set.GetNumAnalysis();
|
---|
306 | const TString fname(fNameOutput.IsNull() ? Form("ganymed%08d.root", num) : fNameOutput.Data());
|
---|
307 |
|
---|
308 | // If requested, write to already open output file
|
---|
309 | if (fNameResult.IsNull() && fStoreResult)
|
---|
310 | {
|
---|
311 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(fname);
|
---|
312 | if (file)
|
---|
313 | {
|
---|
314 | file->cd();
|
---|
315 | return WriteContainer(arr);
|
---|
316 | }
|
---|
317 | }
|
---|
318 |
|
---|
319 | return WriteContainer(arr, fname, "UPDATE");
|
---|
320 | }
|
---|
321 |
|
---|
322 | // --------------------------------------------------------------------------
|
---|
323 | //
|
---|
324 | // MJCut allows to setup several option by a resource file:
|
---|
325 | // MJCut.WriteSummary: yes, no
|
---|
326 | // MJCut.SummaryFile: filename
|
---|
327 | // MJCut.WriteResult: yes, no
|
---|
328 | // MJCut.ResultFile: filename
|
---|
329 | // MJCut.HistName: MHAlpha
|
---|
330 | //
|
---|
331 | Bool_t MJCut::CheckEnvLocal()
|
---|
332 | {
|
---|
333 | const TString f0(GetEnv("SummaryFile", ""));
|
---|
334 | const TString f1(GetEnv("ResultFile", ""));
|
---|
335 | if (!f0.IsNull())
|
---|
336 | SetNameSummaryFile(f0);
|
---|
337 | if (!f1.IsNull())
|
---|
338 | SetNameResultFile(f1);
|
---|
339 |
|
---|
340 | EnableStorageOfSummary(GetEnv("SummaryFile", fStoreSummary));
|
---|
341 | EnableStorageOfResult(GetEnv("ResultFile", fStoreResult));
|
---|
342 | EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay));
|
---|
343 | EnableRandomSrcPos(GetEnv("RandomSourcePosition", fRndmSrcPos));
|
---|
344 | //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction));
|
---|
345 |
|
---|
346 | SetNameHist(GetEnv("NameHist", fNameHist));
|
---|
347 | SetNameHistFS(GetEnv("NameHistFS", fNameHistFS));
|
---|
348 |
|
---|
349 | return kTRUE;
|
---|
350 | }
|
---|
351 |
|
---|
352 | // --------------------------------------------------------------------------
|
---|
353 | //
|
---|
354 | // Setup write to write:
|
---|
355 | // container tree optional?
|
---|
356 | // -------------- ---------- -----------
|
---|
357 | // "MHillas" to "Events"
|
---|
358 | // "MHillasSrc" to "Events"
|
---|
359 | // "Hadronness" to "Events" yes
|
---|
360 | // "MEnergyEst" to "Events" yes
|
---|
361 | // "DataType" to "Events"
|
---|
362 | //
|
---|
363 | void MJCut::SetupWriter(MWriteRootFile *write, const char *name) const
|
---|
364 | {
|
---|
365 | if (!write)
|
---|
366 | return;
|
---|
367 |
|
---|
368 | write->SetName(name);
|
---|
369 | write->AddContainer("MHillas", "Events");
|
---|
370 | write->AddContainer("MHillasSrc", "Events");
|
---|
371 | write->AddContainer("MHillasExt", "Events");
|
---|
372 | write->AddContainer("MPointingPos", "Events");
|
---|
373 | write->AddContainer("MHillasSrcAnti", "Events", kFALSE);
|
---|
374 | write->AddContainer("MImagePar", "Events", kFALSE);
|
---|
375 | write->AddContainer("MNewImagePar", "Events", kFALSE);
|
---|
376 | write->AddContainer("MNewImagePar2", "Events", kFALSE);
|
---|
377 | write->AddContainer("Hadronness", "Events", kFALSE);
|
---|
378 | write->AddContainer("MSrcPosCam", "Events", kFALSE);
|
---|
379 | write->AddContainer("MSrcPosAnti", "Events", kFALSE);
|
---|
380 | write->AddContainer("ThetaSquared", "Events", kFALSE);
|
---|
381 | write->AddContainer("OpticalAxis", "Events", kFALSE);
|
---|
382 | write->AddContainer("Disp", "Events", kFALSE);
|
---|
383 | write->AddContainer("MEnergyEst", "Events", kFALSE);
|
---|
384 | write->AddContainer("MTime", "Events", kFALSE);
|
---|
385 | write->AddContainer("MMcEvt", "Events", kFALSE);
|
---|
386 | write->AddContainer("DataType", "Events");
|
---|
387 | write->AddContainer("RunNumber", "Events");
|
---|
388 | write->AddContainer("EvtNumber", "Events");
|
---|
389 | // write->AddContainer("MMuonSearchPar", "Events", kFALSE);
|
---|
390 | // write->AddContainer("MMuonCalibPar", "Events", kFALSE);
|
---|
391 | }
|
---|
392 |
|
---|
393 | // --------------------------------------------------------------------------
|
---|
394 | //
|
---|
395 | // Create a new instance of an object with name name of class
|
---|
396 | // type fNameHist in parlist. It must derive from MHAlpha.
|
---|
397 | // Call ForceUsingSize for it and return its pointer.
|
---|
398 | // If something fails NULL is returned.
|
---|
399 | //
|
---|
400 | MHAlpha *MJCut::CreateNewHist(MParList &plist, const char *name) const
|
---|
401 | {
|
---|
402 | TClass *cls = gROOT->GetClass(fNameHist);
|
---|
403 | if (!cls)
|
---|
404 | {
|
---|
405 | *fLog << err << "Class " << fNameHist << " not found in dictionary... abort." << endl;
|
---|
406 | return NULL;
|
---|
407 | }
|
---|
408 | if (!cls->InheritsFrom(MHAlpha::Class()))
|
---|
409 | {
|
---|
410 | *fLog << err << "Class " << fNameHist << " doesn't inherit from MHAlpha... abort." << endl;
|
---|
411 | return NULL;
|
---|
412 | }
|
---|
413 |
|
---|
414 | const TString objname(Form("Hist%s", name));
|
---|
415 | MHAlpha *h = (MHAlpha*)plist.FindCreateObj(fNameHist, objname);
|
---|
416 | if (!h)
|
---|
417 | return NULL;
|
---|
418 |
|
---|
419 | h->ForceUsingSize();
|
---|
420 |
|
---|
421 | return h;
|
---|
422 | }
|
---|
423 |
|
---|
424 | // --------------------------------------------------------------------------
|
---|
425 | //
|
---|
426 | // Create a new instance of an object with name name of class
|
---|
427 | // type fNameHistFS in parlist. It must derive from MHFalseSource
|
---|
428 | // If something fails NULL is returned.
|
---|
429 | //
|
---|
430 | MH *MJCut::CreateNewHistFS(MParList &plist, const char *name) const
|
---|
431 | {
|
---|
432 | const TString cname(fNameHistFS.IsNull()?"MHFalseSource":fNameHistFS.Data());
|
---|
433 |
|
---|
434 | TClass *cls = gROOT->GetClass(cname);
|
---|
435 | if (!cls)
|
---|
436 | {
|
---|
437 | *fLog << err << "Class " << cname << " not found in dictionary... abort." << endl;
|
---|
438 | return NULL;
|
---|
439 | }
|
---|
440 | if (!cls->InheritsFrom("MHFalseSource"))
|
---|
441 | {
|
---|
442 | *fLog << err << "Class " << cname << " doesn't inherit from MHFalseSource... abort." << endl;
|
---|
443 | return NULL;
|
---|
444 | }
|
---|
445 |
|
---|
446 | const TString objname(Form("FS%s", name));
|
---|
447 | return (MH*)plist.FindCreateObj(cname, objname);
|
---|
448 | }
|
---|
449 |
|
---|
450 | Bool_t MJCut::FillSrcPosCam(const MDataSet &set, MPointingPos &source, MHSrcPosCam &hsrcpos)
|
---|
451 | {
|
---|
452 | *fLog << inf;
|
---|
453 | fLog->Separator(GetDescriptor());
|
---|
454 | *fLog << "Filling MHSrcPosCam " << set.GetName() << endl;
|
---|
455 | *fLog << endl;
|
---|
456 |
|
---|
457 | // --------------------------------------------------------------------------------
|
---|
458 |
|
---|
459 | // Setup Parlist
|
---|
460 | MParList plist;
|
---|
461 | plist.AddToList(this); // take care of fDisplay!
|
---|
462 |
|
---|
463 | // Setup Tasklist
|
---|
464 | MTaskList tlist;
|
---|
465 | plist.AddToList(&tlist);
|
---|
466 |
|
---|
467 | // La Palma Magic1, Possible source position
|
---|
468 | MObservatory obs;
|
---|
469 | plist.AddToList(&obs);
|
---|
470 | plist.AddToList(&source);
|
---|
471 |
|
---|
472 | // Initialize default binnings
|
---|
473 | // MBinning bins1(18, 0, 90, "BinningSrcPosCam", "lin");
|
---|
474 | // plist.AddToList(&bins1);
|
---|
475 |
|
---|
476 | // ------------- Loop Off Data --------------------
|
---|
477 | MReadReports read;
|
---|
478 |
|
---|
479 | read.EnableAutoScheme();
|
---|
480 | read.AddToBranchList("MTimeEffectiveOnTime.*");
|
---|
481 | read.AddToBranchList("MEffectiveOnTime.*");
|
---|
482 |
|
---|
483 | read.AddTree("Events", "MTime.", MReadReports::kMaster);
|
---|
484 | read.AddTree("Drive", MReadReports::kRequired);
|
---|
485 | read.AddTree("Starguider", MReadReports::kRequired);
|
---|
486 | read.AddTree("EffectiveOnTime");
|
---|
487 |
|
---|
488 | if (!set.AddFilesOn(read))
|
---|
489 | return kFALSE;
|
---|
490 |
|
---|
491 | MFillH fill(&hsrcpos, "MSrcPosCam", "FillSrcPosCam");
|
---|
492 | fill.SetNameTab("SrcPos");
|
---|
493 |
|
---|
494 | // How to get source position from off- and on-data?
|
---|
495 | MSrcPosCorrect scor;
|
---|
496 | MSrcPosCalc scalc;
|
---|
497 | scalc.SetMode(MSrcPosCalc::kDefault);
|
---|
498 |
|
---|
499 | MPointingDevCalc devcalc;
|
---|
500 |
|
---|
501 | tlist.AddToList(&read);
|
---|
502 | tlist.AddToList(&devcalc, "Starguider");
|
---|
503 | tlist.AddToList(&scalc, "Events");
|
---|
504 | tlist.AddToList(&scor, "Events");
|
---|
505 | tlist.AddToList(&fill, "Events");
|
---|
506 |
|
---|
507 | // by setting it here it is distributed to all consecutive tasks
|
---|
508 | tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
|
---|
509 |
|
---|
510 | // Create and setup the eventloop
|
---|
511 | MEvtLoop evtloop(fName);
|
---|
512 | evtloop.SetParList(&plist);
|
---|
513 | evtloop.SetDisplay(fDisplay);
|
---|
514 | evtloop.SetLogStream(fLog);
|
---|
515 | if (!SetupEnv(evtloop))
|
---|
516 | return kFALSE;
|
---|
517 |
|
---|
518 | // Execute first analysis
|
---|
519 | if (!evtloop.Eventloop(fMaxEvents))
|
---|
520 | {
|
---|
521 | *fLog << err << GetDescriptor() << ": Processing of on-sequences to fill SrcPosCam failed." << endl;
|
---|
522 | return kFALSE;
|
---|
523 | }
|
---|
524 |
|
---|
525 | if (!evtloop.GetDisplay())
|
---|
526 | {
|
---|
527 | *fLog << err << GetDescriptor() << ": Execution stopped by user." << endl;
|
---|
528 | return kFALSE;
|
---|
529 | }
|
---|
530 |
|
---|
531 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
---|
532 | *fLog << endl << endl;
|
---|
533 |
|
---|
534 | return kTRUE;
|
---|
535 | }
|
---|
536 |
|
---|
537 | Int_t MJCut::Process(const MDataSet &set)
|
---|
538 | {
|
---|
539 | if (!set.IsValid())
|
---|
540 | {
|
---|
541 | *fLog << err << "ERROR - DataSet invalid!" << endl;
|
---|
542 | return kFALSE;
|
---|
543 | }
|
---|
544 |
|
---|
545 | CheckEnv();
|
---|
546 |
|
---|
547 | // --------------------------------------------------------------------------------
|
---|
548 |
|
---|
549 | // Possible source position (eg. Wobble Mode)
|
---|
550 | MPointingPos source("MSourcePos");
|
---|
551 | if (set.HasSource())
|
---|
552 | {
|
---|
553 | if (!set.GetSourcePos(source))
|
---|
554 | return -1;
|
---|
555 | *fLog << all;
|
---|
556 | source.Print("RaDec");
|
---|
557 | }
|
---|
558 | else
|
---|
559 | *fLog << all << "No source position applied..." << endl;
|
---|
560 |
|
---|
561 | MParList plist;
|
---|
562 |
|
---|
563 | MHSrcPosCam hsrcpos(set.IsWobbleMode());
|
---|
564 | if (!set.IsWobbleMode() && source.IsInitialized() && fRndmSrcPos)
|
---|
565 | {
|
---|
566 | if (!FillSrcPosCam(set, source, hsrcpos))
|
---|
567 | return -2;
|
---|
568 | plist.AddToList(&hsrcpos);
|
---|
569 | }
|
---|
570 |
|
---|
571 | // --------------------------------------------------------------------------------
|
---|
572 |
|
---|
573 | *fLog << inf;
|
---|
574 | fLog->Separator(GetDescriptor());
|
---|
575 | *fLog << "Perform cuts for data set " << set.GetName() << endl;
|
---|
576 | *fLog << endl;
|
---|
577 |
|
---|
578 | // --------------------------------------------------------------------------------
|
---|
579 |
|
---|
580 | // Setup Parlist
|
---|
581 | plist.AddToList(this); // take care of fDisplay!
|
---|
582 |
|
---|
583 | MParameterI par("DataType");
|
---|
584 | plist.AddToList(&par);
|
---|
585 |
|
---|
586 | // Setup Tasklist
|
---|
587 | MTaskList tlist;
|
---|
588 | plist.AddToList(&tlist);
|
---|
589 |
|
---|
590 | // La Palma Magic1
|
---|
591 | MObservatory obs;
|
---|
592 | plist.AddToList(&obs);
|
---|
593 |
|
---|
594 | if (source.IsInitialized())
|
---|
595 | plist.AddToList(&source);
|
---|
596 |
|
---|
597 | // Initialize default binnings
|
---|
598 | MBinning bins1( 18, 0, 90, "BinningAlpha", "lin");
|
---|
599 | MBinning bins2( 15, 10, 1e6 , "BinningSize", "log");
|
---|
600 | MBinning bins3( 67, -0.005, 0.665, "BinningTheta", "asin");
|
---|
601 | //MBinning binsT(150, 0, 150, "BinningDeltaT", "lin");
|
---|
602 | MBinning bins4("BinningFalseSource");
|
---|
603 | MBinning bins5("BinningWidth");
|
---|
604 | MBinning bins6("BinningLength");
|
---|
605 | MBinning bins7("BinningDist");
|
---|
606 | MBinning bins8("BinningMaxDist");
|
---|
607 | MBinning bins9("BinningM3Long");
|
---|
608 | MBinning bins0("BinningConc1");
|
---|
609 | plist.AddToList(&bins1);
|
---|
610 | plist.AddToList(&bins2);
|
---|
611 | plist.AddToList(&bins3);
|
---|
612 | plist.AddToList(&bins4);
|
---|
613 | plist.AddToList(&bins5);
|
---|
614 | plist.AddToList(&bins6);
|
---|
615 | plist.AddToList(&bins7);
|
---|
616 | plist.AddToList(&bins8);
|
---|
617 | plist.AddToList(&bins9);
|
---|
618 | plist.AddToList(&bins0);
|
---|
619 | //plist.AddToList(&binsT);
|
---|
620 |
|
---|
621 | // --------------------------------------------------------------------------------
|
---|
622 |
|
---|
623 | // Setup fitter and histograms
|
---|
624 | MAlphaFitter fit;
|
---|
625 | plist.AddToList(&fit);
|
---|
626 | if (set.IsWobbleMode())
|
---|
627 | fit.SetScaleMode(MAlphaFitter::kNone);
|
---|
628 |
|
---|
629 | MHAlpha *halphaoff = CreateNewHist(plist, "Off");
|
---|
630 | MFillH falpha(halphaoff, "", "FillHist");
|
---|
631 | MH *hfsoff = CreateNewHistFS(plist, "Off");
|
---|
632 | MFillH ffs(hfsoff, "MHillas", "FillFS");
|
---|
633 |
|
---|
634 | // FIXME: If fPathIn read cuts and energy estimator from file!
|
---|
635 | MContinue cont0("", "Cut0");
|
---|
636 | MContinue cont1("", "Cut1");
|
---|
637 | MContinue cont2("", "Cut2");
|
---|
638 | MContinue cont3("", "Cut3");
|
---|
639 | cont0.SetAllowEmpty();
|
---|
640 | cont1.SetAllowEmpty();
|
---|
641 | cont2.SetAllowEmpty();
|
---|
642 | cont3.SetAllowEmpty();
|
---|
643 |
|
---|
644 | // ------------- Loop Off Data --------------------
|
---|
645 | MReadReports readoffdata;
|
---|
646 | readoffdata.AddTree("Events", "MTime.", MReadReports::kMaster);
|
---|
647 | readoffdata.AddTree("Drive", MReadReports::kRequired);
|
---|
648 | readoffdata.AddTree("Starguider", MReadReports::kRequired);
|
---|
649 | readoffdata.AddTree("EffectiveOnTime");
|
---|
650 |
|
---|
651 | MReadMarsFile readoffmc("Events");
|
---|
652 | readoffmc.DisableAutoScheme();
|
---|
653 |
|
---|
654 | MRead &readoff = set.IsMonteCarlo() ? (MRead&)readoffmc : (MRead&)readoffdata;
|
---|
655 | const Bool_t setrc = set.IsWobbleMode() ? set.AddFilesOn(readoff) : set.AddFilesOff(readoff);
|
---|
656 | if (!setrc && set.HasOffSequences())
|
---|
657 | {
|
---|
658 | *fLog << err << "MDataSet::AddFiles" << (set.IsWobbleMode()?"On":"Off") << " failed." << endl;
|
---|
659 | return kFALSE;
|
---|
660 | }
|
---|
661 |
|
---|
662 | const TString path(Form("%s/", fPathOut.Data()));
|
---|
663 | TString fname0(path);
|
---|
664 | TString fname1(path);
|
---|
665 | fname0 += fNameSummary.IsNull() ? (TString) Form("ganymed%08d-summary.root", set.GetNumAnalysis()) : fNameSummary;
|
---|
666 | fname1 += fNameResult.IsNull() ? (TString) Form("ganymed%08d.root", set.GetNumAnalysis()) : fNameResult;
|
---|
667 |
|
---|
668 | MWriteRootFile *write0 = CanStoreSummary() ? new MWriteRootFile(fPathOut.IsNull()?0:fname0.Data(), fOverwrite?"RECREATE":"NEW") : 0;
|
---|
669 | MWriteRootFile *write1 = CanStoreResult() ? new MWriteRootFile(fPathOut.IsNull()?0:fname1.Data(), fOverwrite?"RECREATE":"NEW") : 0;
|
---|
670 | SetupWriter(write0, "WriteAfterCut0");
|
---|
671 | SetupWriter(write1, "WriteAfterCut3");
|
---|
672 |
|
---|
673 | MTaskEnv taskenv2("CalcHadronness");
|
---|
674 | taskenv2.SetDefault(fCalcHadronness);
|
---|
675 |
|
---|
676 | MTaskEnv taskenv3("CalcDisp");
|
---|
677 | taskenv3.SetDefault(fCalcDisp);
|
---|
678 |
|
---|
679 | MTaskEnv taskenv4("EstimateEnergy");
|
---|
680 | taskenv4.SetDefault(fEstimateEnergy);
|
---|
681 |
|
---|
682 | MParameterCalc setevtnum("MRawEvtHeader.fDAQEvtNumber", "SetEvtNumber");
|
---|
683 | setevtnum.SetNameParameter("EvtNumber");
|
---|
684 |
|
---|
685 | MParameterCalc setrunnum("MRawRunHeader.fRunNumber", "SetRunNumber");
|
---|
686 | setrunnum.SetNameParameter("RunNumber");
|
---|
687 |
|
---|
688 | // MFillH fill0a("OnPos [MHSrcPosCam]", "MSrcPosCam", "FillSrcPosCam");
|
---|
689 | MFillH fill1a("MHHillasOffPre [MHHillas]", "MHillas", "FillHillasPre");
|
---|
690 | MFillH fill2a("MHHillasOffPost [MHHillas]", "MHillas", "FillHillasPost");
|
---|
691 | MFillH fill3a("MHVsSizeOffPost [MHVsSize]", "MHillasSrc", "FillVsSizePost");
|
---|
692 | MFillH fill4a("MHHilExtOffPost [MHHillasExt]", "MHillasSrc", "FillHilExtPost");
|
---|
693 | MFillH fill5a("MHHilSrcOffPost [MHHillasSrc]", "MHillasSrc", "FillHilSrcPost");
|
---|
694 | MFillH fill6a("MHImgParOffPost [MHImagePar]", "MImagePar", "FillImgParPost");
|
---|
695 | MFillH fill7a("MHNewParOffPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost");
|
---|
696 | //MFillH fill9a("MHEffOffTime [MHEffectiveOnTime]", "MTime", "FillEffOnTime");
|
---|
697 | fill1a.SetNameTab("PreCut");
|
---|
698 | fill2a.SetNameTab("PostCut");
|
---|
699 | fill3a.SetNameTab("VsSize");
|
---|
700 | fill4a.SetNameTab("HilExt");
|
---|
701 | fill5a.SetNameTab("HilSrc");
|
---|
702 | fill6a.SetNameTab("ImgPar");
|
---|
703 | fill7a.SetNameTab("NewPar");
|
---|
704 | //fill9a.SetNameTab("EffOffT");
|
---|
705 |
|
---|
706 | //MFDataMember fbin("Bin.fVal", '>', 0);
|
---|
707 | //fill9a.SetFilter(&fbin);
|
---|
708 |
|
---|
709 | MPrint print2("MEffectiveOnTime");
|
---|
710 | print2.EnableSkip();
|
---|
711 |
|
---|
712 | // How to get source position from off- and on-data?
|
---|
713 | MSrcPosCalc scalc;
|
---|
714 | scalc.SetMode(set.IsWobbleMode()?MSrcPosCalc::kWobble:MSrcPosCalc::kOffData); /********************/
|
---|
715 |
|
---|
716 | MSrcPosCorrect scor;
|
---|
717 |
|
---|
718 | MHillasCalc hcalc;
|
---|
719 | MHillasCalc hcalc2("MHillasCalcAnti");
|
---|
720 | hcalc.SetFlags(MHillasCalc::kCalcHillasSrc);
|
---|
721 | hcalc2.SetFlags(MHillasCalc::kCalcHillasSrc);
|
---|
722 | hcalc2.SetNameHillasSrc("MHillasSrcAnti");
|
---|
723 | hcalc2.SetNameSrcPosCam("MSrcPosAnti");
|
---|
724 |
|
---|
725 | MSrcPosRndm srcrndm;
|
---|
726 |
|
---|
727 | MTaskList tlist2;
|
---|
728 | tlist2.AddToList(&scalc);
|
---|
729 | tlist2.AddToList(&scor);
|
---|
730 | tlist2.AddToList(&srcrndm);
|
---|
731 | //if (fRndmSrcPos && !set.IsWobbleMode())
|
---|
732 | // tlist2.AddToList(&fill0a);
|
---|
733 | tlist2.AddToList(&hcalc);
|
---|
734 | if (set.IsWobbleMode())
|
---|
735 | tlist2.AddToList(&hcalc2);
|
---|
736 | //tlist2.AddToList(&taskenv1);
|
---|
737 | tlist2.AddToList(&cont0);
|
---|
738 | tlist2.AddToList(&taskenv2);
|
---|
739 | tlist2.AddToList(&taskenv3);
|
---|
740 | tlist2.AddToList(&setrunnum);
|
---|
741 | tlist2.AddToList(&setevtnum);
|
---|
742 | if (write0)
|
---|
743 | tlist2.AddToList(write0);
|
---|
744 | if (!fWriteOnly)
|
---|
745 | tlist2.AddToList(&fill1a);
|
---|
746 | tlist2.AddToList(&cont1);
|
---|
747 | if (!fWriteOnly && (!set.IsWobbleMode() || !fNameHistFS.IsNull()))
|
---|
748 | tlist2.AddToList(&ffs);
|
---|
749 | tlist2.AddToList(&cont2);
|
---|
750 | if (!fWriteOnly)
|
---|
751 | {
|
---|
752 | tlist2.AddToList(&fill2a);
|
---|
753 | if (fFullDisplay)
|
---|
754 | {
|
---|
755 | tlist2.AddToList(&fill3a);
|
---|
756 | tlist2.AddToList(&fill4a);
|
---|
757 | tlist2.AddToList(&fill5a);
|
---|
758 | tlist2.AddToList(&fill6a);
|
---|
759 | tlist2.AddToList(&fill7a);
|
---|
760 | }
|
---|
761 | }
|
---|
762 | if (!fWriteOnly)
|
---|
763 | {
|
---|
764 | tlist2.AddToList(&falpha);
|
---|
765 | /* if (!fIsMonteCarlo)
|
---|
766 | {
|
---|
767 | tlist2.AddToList(&fbin);
|
---|
768 | tlist2.AddToList(&fill9a);
|
---|
769 | } */
|
---|
770 | }
|
---|
771 | tlist2.AddToList(&cont3);
|
---|
772 | tlist2.AddToList(&taskenv4);
|
---|
773 |
|
---|
774 | if (write1)
|
---|
775 | tlist2.AddToList(write1);
|
---|
776 |
|
---|
777 | MPointingDevCalc devcalc;
|
---|
778 |
|
---|
779 | tlist.AddToList(&readoff);
|
---|
780 | if (gLog.GetDebugLevel()>4)
|
---|
781 | tlist.AddToList(&print2, "EffectiveOnTime");
|
---|
782 | tlist.AddToList(&devcalc, "Starguider");
|
---|
783 | tlist.AddToList(&tlist2, "Events");
|
---|
784 |
|
---|
785 | // by setting it here it is distributed to all consecutive tasks
|
---|
786 | tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
|
---|
787 |
|
---|
788 | par.SetVal(0);
|
---|
789 |
|
---|
790 | // Create and setup the eventloop
|
---|
791 | MEvtLoop evtloop(fName);
|
---|
792 | evtloop.SetParList(&plist);
|
---|
793 | evtloop.SetDisplay(fDisplay);
|
---|
794 | evtloop.SetLogStream(fLog);
|
---|
795 | if (!SetupEnv(evtloop))
|
---|
796 | return kFALSE;
|
---|
797 |
|
---|
798 | TObjArray cont;
|
---|
799 | cont.Add(&cont0);
|
---|
800 | cont.Add(&cont1);
|
---|
801 | cont.Add(&cont2);
|
---|
802 | cont.Add(&cont3);
|
---|
803 | //if (taskenv1.GetTask())
|
---|
804 | // cont.Add(taskenv1.GetTask());
|
---|
805 | if (taskenv2.GetTask())
|
---|
806 | cont.Add(taskenv2.GetTask());
|
---|
807 | if (taskenv3.GetTask())
|
---|
808 | cont.Add(taskenv3.GetTask());
|
---|
809 |
|
---|
810 | if (!WriteTasks(set.GetNumAnalysis(), cont))
|
---|
811 | return kFALSE;
|
---|
812 |
|
---|
813 | if (set.HasOffSequences() || set.IsWobbleMode())
|
---|
814 | {
|
---|
815 | // Execute first analysis
|
---|
816 | if (!evtloop.Eventloop(fMaxEvents))
|
---|
817 | {
|
---|
818 | *fLog << err << GetDescriptor() << ": Processing of off-sequences failed." << endl;
|
---|
819 | return -3;
|
---|
820 | }
|
---|
821 |
|
---|
822 | if (!evtloop.GetDisplay())
|
---|
823 | {
|
---|
824 | *fLog << err << GetDescriptor() << ": Execution stopped by user." << endl;
|
---|
825 | return kFALSE;
|
---|
826 | }
|
---|
827 |
|
---|
828 | //plist.FindObject("MTimeEffectiveOnTime")->Clear();
|
---|
829 | }
|
---|
830 | else
|
---|
831 | {
|
---|
832 | // This is the simplest way to remove the two object from the parlist
|
---|
833 | delete halphaoff;
|
---|
834 | delete hfsoff;
|
---|
835 | }
|
---|
836 |
|
---|
837 | // ------------- Loop On Data --------------------
|
---|
838 | MReadReports readondata;
|
---|
839 | readondata.AddTree("Events", "MTime.", MReadReports::kMaster);
|
---|
840 | readondata.AddTree("Drive", MReadReports::kRequired);
|
---|
841 | readondata.AddTree("Starguider", MReadReports::kRequired);
|
---|
842 | readondata.AddTree("EffectiveOnTime");
|
---|
843 |
|
---|
844 | MReadMarsFile readonmc("Events");
|
---|
845 | readonmc.DisableAutoScheme();
|
---|
846 |
|
---|
847 | MRead &readon = set.IsMonteCarlo() ? (MRead&)readonmc : (MRead&)readondata;
|
---|
848 | if (!set.AddFilesOn(readon))
|
---|
849 | return kFALSE;
|
---|
850 |
|
---|
851 | scalc.SetMode(MSrcPosCalc::kDefault);
|
---|
852 |
|
---|
853 | MFillH fill1b("MHHillasOnPre [MHHillas]", "MHillas", "FillHillasPre");
|
---|
854 | MFillH fill2b("MHHillasOnPost [MHHillas]", "MHillas", "FillHillasPost");
|
---|
855 | MFillH fill3b("MHVsSizeOnPost [MHVsSize]", "MHillasSrc", "FillVsSizePost");
|
---|
856 | MFillH fill4b("MHHilExtOnPost [MHHillasExt]", "MHillasSrc", "FillHilExtPost");
|
---|
857 | MFillH fill5b("MHHilSrcOnPost [MHHillasSrc]", "MHillasSrc", "FillHilSrcPost");
|
---|
858 | MFillH fill6b("MHImgParOnPost [MHImagePar]", "MImagePar", "FillImgParPost");
|
---|
859 | MFillH fill7b("MHNewParOnPost [MHNewImagePar]", "MNewImagePar", "FillNewParPost");
|
---|
860 | //MFillH fill9b("MHEffOnTime [MHEffectiveOnTime]", "MTime", "FillEffOnTime");
|
---|
861 | fill1b.SetNameTab("PreCut");
|
---|
862 | fill2b.SetNameTab("PostCut");
|
---|
863 | fill3b.SetNameTab("VsSize");
|
---|
864 | fill4b.SetNameTab("HilExt");
|
---|
865 | fill5b.SetNameTab("HilSrc");
|
---|
866 | fill6b.SetNameTab("ImgPar");
|
---|
867 | fill7b.SetNameTab("NewPar");
|
---|
868 | //fill9b.SetNameTab("EffOnT");
|
---|
869 | fill1b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
870 | fill2b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
871 | fill3b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
872 | fill4b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
873 | fill5b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
874 | fill6b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
875 | fill7b.SetDrawOption(set.HasOffSequences()||set.IsWobbleMode()?"same":"");
|
---|
876 |
|
---|
877 | //fill9b.SetFilter(&fbin);
|
---|
878 |
|
---|
879 | /*
|
---|
880 | MHVsTime hvs("MEffectiveOnTime.fVal");
|
---|
881 | hvs.SetTitle("Effective On-Time vs. Time;;T_{on}");
|
---|
882 | MFillH fillvs(&hvs, "MTimeEffectiveOnTime", "FillOnTime");
|
---|
883 | fillvs.SetNameTab("OnTime");
|
---|
884 | */
|
---|
885 | MH3 hvs("MPointingPos.fZd");
|
---|
886 | hvs.SetName("Theta");
|
---|
887 | hvs.SetTitle("Effective On-Time vs. Zenith Angle;\\Theta [\\circ];T_{on} [s]");
|
---|
888 | MFillH fillvs(&hvs, "", "FillOnTime");
|
---|
889 | if (!set.IsMonteCarlo())
|
---|
890 | fillvs.SetWeight("MEffectiveOnTime");
|
---|
891 | fillvs.SetNameTab("OnTime");
|
---|
892 |
|
---|
893 | /*
|
---|
894 | MParameterD weight;
|
---|
895 | weight.SetVal(-1);
|
---|
896 | fill2a.SetWeight(&weight);
|
---|
897 | fill3a.SetWeight(&weight);
|
---|
898 | fill4a.SetWeight(&weight);
|
---|
899 | fill5a.SetWeight(&weight);
|
---|
900 | fill6a.SetWeight(&weight);
|
---|
901 | fill7a.SetWeight(&weight);
|
---|
902 | if (fSubstraction)
|
---|
903 | {
|
---|
904 | fill2a.SetNameTab("PostCut-");
|
---|
905 | fill3a.SetNameTab("VsSize-");
|
---|
906 | fill4a.SetNameTab("HilExt-");
|
---|
907 | fill5a.SetNameTab("HilSrc-");
|
---|
908 | fill6a.SetNameTab("ImgPar-");
|
---|
909 | fill7a.SetNameTab("NewPar-");
|
---|
910 | }
|
---|
911 | */
|
---|
912 | MHAlpha *halphaon=CreateNewHist(plist);
|
---|
913 | MFillH falpha2(halphaon, "", "FillHist");
|
---|
914 | MH *hfs=CreateNewHistFS(plist);
|
---|
915 | MFillH ffs2(hfs, "MHillas", "FillFS");
|
---|
916 | MFillH fillphi("MHPhi", "", "FillPhi");
|
---|
917 | fillphi.SetDrawOption("anticut");
|
---|
918 |
|
---|
919 | tlist.Replace(&readon);
|
---|
920 | if (fRndmSrcPos && !set.IsWobbleMode())
|
---|
921 | {
|
---|
922 | // tlist2.RemoveFromList(&fill0a);
|
---|
923 | tlist2.RemoveFromList(&srcrndm);
|
---|
924 | }
|
---|
925 |
|
---|
926 | MFillH fillsrc(&hsrcpos, "MSrcPosCam", "FillSrcPosCam");
|
---|
927 | fillsrc.SetNameTab("SrcPos");
|
---|
928 | if (set.IsWobbleMode())
|
---|
929 | tlist2.AddToListBefore(&fillsrc, &hcalc);
|
---|
930 |
|
---|
931 | if (!fWriteOnly)
|
---|
932 | {
|
---|
933 | tlist2.Replace(&fill1b);
|
---|
934 | /* if (fIsWobble)
|
---|
935 | {
|
---|
936 | tlist2.AddToListAfter(&fill2b, &fill2a);
|
---|
937 | tlist2.AddToListAfter(&fill3b, &fill3a);
|
---|
938 | }
|
---|
939 | else
|
---|
940 | */
|
---|
941 | tlist2.Replace(&fill2b);
|
---|
942 | if (fFullDisplay)
|
---|
943 | {
|
---|
944 | tlist2.Replace(&fill3b);
|
---|
945 | tlist2.Replace(&fill4b);
|
---|
946 | tlist2.Replace(&fill5b);
|
---|
947 | tlist2.Replace(&fill6b);
|
---|
948 | tlist2.Replace(&fill7b);
|
---|
949 | }
|
---|
950 | tlist2.Replace(&falpha2);
|
---|
951 | //if (!fIsMonteCarlo)
|
---|
952 | // tlist2.Replace(&fill9b);
|
---|
953 | if (!set.IsWobbleMode() || !fNameHist.IsNull())
|
---|
954 | tlist2.Replace(&ffs2);
|
---|
955 | if (set.IsWobbleMode())
|
---|
956 | {
|
---|
957 | tlist2.AddToListAfter(&fillphi, &falpha2);
|
---|
958 | if (!fNameHist.IsNull())
|
---|
959 | tlist2.RemoveFromList(&ffs);
|
---|
960 | }
|
---|
961 |
|
---|
962 | if (!set.IsMonteCarlo())
|
---|
963 | tlist.AddToList(&fillvs, "EffectiveOnTime");
|
---|
964 | else
|
---|
965 | tlist2.AddToListBefore(&fillvs, &scalc);
|
---|
966 | }
|
---|
967 |
|
---|
968 | // by setting it here it is distributed to all consecutive tasks
|
---|
969 | tlist.SetAccelerator(MTask::kAccDontReset|MTask::kAccDontTime);
|
---|
970 |
|
---|
971 | par.SetVal(1);
|
---|
972 |
|
---|
973 | // Execute first analysis
|
---|
974 | if (!evtloop.Eventloop(fMaxEvents))
|
---|
975 | {
|
---|
976 | *fLog << err << GetDescriptor() << ": Processing of on-sequences failed." << endl;
|
---|
977 | return -4;
|
---|
978 | }
|
---|
979 |
|
---|
980 | if (write0)
|
---|
981 | delete write0;
|
---|
982 | if (write1)
|
---|
983 | delete write1;
|
---|
984 |
|
---|
985 | // FIXME: Perform fit and plot energy dependant alpha plots
|
---|
986 | // and fit result to new tabs!
|
---|
987 | if (!WriteResult(plist, set))
|
---|
988 | return kFALSE;
|
---|
989 |
|
---|
990 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
---|
991 | *fLog << endl << endl;
|
---|
992 |
|
---|
993 | return kTRUE;
|
---|
994 | }
|
---|