1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2005
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 |
|
---|
26 | void threshold()
|
---|
27 | {
|
---|
28 | //
|
---|
29 | // This macro fill the container MHMcEnergies using the task
|
---|
30 | // MMcThresholdCalc and shows the results.
|
---|
31 | //
|
---|
32 | MParList parlist;
|
---|
33 |
|
---|
34 | MTaskList tasklist;
|
---|
35 | parlist.AddToList(&tasklist);
|
---|
36 |
|
---|
37 | // Setup reading task
|
---|
38 | MReadMarsFile read("Events");
|
---|
39 | read.DisableAutoScheme();
|
---|
40 |
|
---|
41 | // Setup files to read or monte carlo dataset to be read
|
---|
42 | MDataSet set("~/Software/montecarlo-onoff-lza.txt");
|
---|
43 | set.AddFilesOn(read);
|
---|
44 |
|
---|
45 | // If you want to get the threshold after cuts setup your cuts
|
---|
46 | TArrayD cuts(8);
|
---|
47 | cuts[0]= 1.3245;
|
---|
48 | cuts[1]= 0.2087;
|
---|
49 | cuts[2]= 0.2292;
|
---|
50 | cuts[3]= 5.2552;
|
---|
51 | cuts[4]= 0.09893;
|
---|
52 | cuts[5]= -0.08295;
|
---|
53 | cuts[6]= 8.2957;
|
---|
54 | cuts[7]= 0.8677;
|
---|
55 |
|
---|
56 | MFMagicCuts mcuts;
|
---|
57 | mcuts.SetThetaCut(MFMagicCuts::kOn);
|
---|
58 | mcuts.SetVariables(cuts);
|
---|
59 |
|
---|
60 | MContinue cont(&mcuts);
|
---|
61 | cont.SetInverted();
|
---|
62 |
|
---|
63 | // Setup the threshold histogram to be filled
|
---|
64 | MFillH fill("MHThreshold", "", "FillThreshold");
|
---|
65 | fill.SetNameTab("Threshold");
|
---|
66 |
|
---|
67 | // If you like to change your input spectrum use this...
|
---|
68 | MMcSpectrumWeight weight;
|
---|
69 | weight.SetNewSlope(-3.5);
|
---|
70 | fill.SetWeight();
|
---|
71 |
|
---|
72 | // Setup your tasklist
|
---|
73 | tasklist.AddToList(&read); // read data
|
---|
74 | tasklist.AddToList(&cont); // skip background events
|
---|
75 | tasklist.AddToList(&weight); // caluclate spectral weight
|
---|
76 | tasklist.AddToList(&fill); // fill histogram
|
---|
77 |
|
---|
78 | // Setup the display
|
---|
79 | MStatusDisplay *d = new MStatusDisplay;
|
---|
80 |
|
---|
81 | // Setup your eventloop
|
---|
82 | MEvtLoop loop("Threshold");
|
---|
83 | loop.SetParList(&parlist);
|
---|
84 | loop.SetDisplay(d);
|
---|
85 |
|
---|
86 | // Start your analysis
|
---|
87 | if (!loop.Eventloop())
|
---|
88 | return;
|
---|
89 | }
|
---|