source: branches/Mars_McMismatchStudy/macros/tutorials/threshold.C@ 18558

Last change on this file since 18558 was 8113, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 2.6 KB
Line 
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
26void 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.22;
49 cuts[2]= 0.215;
50 cuts[3]= 5.486;
51 cuts[4]= 0.0897;
52 cuts[5]= -0.07;
53 cuts[6]= 8.2957;
54 cuts[7]= 0.8677;
55
56 MFMagicCuts mcuts;
57 mcuts.SetThetaCut(MFMagicCuts::kOn);
58 mcuts.SetHadronnessCut(MFMagicCuts::kArea);
59 mcuts.SetVariables(cuts);
60
61 MContinue cont(&mcuts);
62 cont.SetInverted();
63
64 // Setup the threshold histogram to be filled
65 MFillH fill("MHThreshold", "", "FillThreshold");
66 fill.SetNameTab("Threshold");
67
68 // If you like to change your input spectrum use this...
69 MMcSpectrumWeight weight;
70 weight.SetNewSlope(-3.5);
71 fill.SetWeight();
72
73 // Setup your tasklist
74 tasklist.AddToList(&read); // read data
75 tasklist.AddToList(&cont); // skip background events
76 tasklist.AddToList(&weight); // caluclate spectral weight
77 tasklist.AddToList(&fill); // fill histogram
78
79 // Setup the display
80 MStatusDisplay *d = new MStatusDisplay;
81
82 // Setup your eventloop
83 MEvtLoop loop("Threshold");
84 loop.SetParList(&parlist);
85 loop.SetDisplay(d);
86
87 // Start your analysis
88 if (!loop.Eventloop())
89 return;
90}
Note: See TracBrowser for help on using the repository browser.