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 (tbretz@uni-sw.gwdg.de)
|
---|
19 | ! Author(s): Abelardo Moralejo 4/2003 <mailto:moralejo@pd.infn.it>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | #include "/home/magic/Mars/mhistmc/MHMcCT1CollectionArea.h"
|
---|
27 |
|
---|
28 | void CT1collarea(TString filename="MC_SC4.root", TString outname="")
|
---|
29 | {
|
---|
30 |
|
---|
31 | //
|
---|
32 | // first we have to create our empty lists
|
---|
33 | //
|
---|
34 | MParList parlist;
|
---|
35 | MTaskList tasklist;
|
---|
36 |
|
---|
37 | parlist.AddToList(&tasklist);
|
---|
38 |
|
---|
39 | //
|
---|
40 | // Setup out tasks:
|
---|
41 | // - First we have to read the events
|
---|
42 | // - Then we can fill the efficiency histograms
|
---|
43 | //
|
---|
44 | MReadMarsFile reader("Events", filename);
|
---|
45 | reader.DisableAutoScheme();
|
---|
46 |
|
---|
47 | MHMcCT1CollectionArea* collarea = new MHMcCT1CollectionArea();
|
---|
48 |
|
---|
49 | MBinning binsx("BinningE");
|
---|
50 |
|
---|
51 | /*
|
---|
52 | Double_t xedge[15] = {2.47712, 2.64345, 2.82607, 3., 3.17609, 3.35218, 3.52892, 3.70415, 3.88024, 4.05652, 4.23274, 4.40875, 4.58478, 4.76080, 4.90309};
|
---|
53 | const TArrayD xed;
|
---|
54 | xed.Set(15,xedge);
|
---|
55 | binsx.SetEdges(xed);
|
---|
56 | collarea->SetEaxis(kLog10Energy);
|
---|
57 | */
|
---|
58 |
|
---|
59 | //
|
---|
60 | // SetEaxis tells MHMcCT1CollectionArea whether the variable to histogram
|
---|
61 | // is the Energy (argument is kEnergy) or its decimal logarithm
|
---|
62 | // (kLog10Energy). Of course this depends on how the energy binning is
|
---|
63 | // defined via the object binsx.
|
---|
64 | //
|
---|
65 | binsx.SetEdgesLog(14,300,1.e5);
|
---|
66 | collarea->SetEaxis(kEnergy);
|
---|
67 |
|
---|
68 |
|
---|
69 | MBinning binsy("BinningTheta");
|
---|
70 | const Double_t yedge[9] = {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
|
---|
71 | const TArrayD yed;
|
---|
72 | yed.Set(9,yedge);
|
---|
73 | binsy.SetEdges(yed);
|
---|
74 |
|
---|
75 | parlist.AddToList(collarea);
|
---|
76 | parlist.AddToList(&binsx);
|
---|
77 | parlist.AddToList(&binsy);
|
---|
78 |
|
---|
79 | tasklist.AddToList(&reader);
|
---|
80 |
|
---|
81 | MF filterhadrons("HadSC.fHadronness<0.3 && {abs(MHillasSrc.fAlpha)} < 13.1");
|
---|
82 | tasklist.AddToList(&filterhadrons);
|
---|
83 |
|
---|
84 |
|
---|
85 | MFillH filler("MHMcCT1CollectionArea","MMcEvt");
|
---|
86 | filler.SetFilter(&filterhadrons);
|
---|
87 | tasklist.AddToList(&filler);
|
---|
88 |
|
---|
89 | //
|
---|
90 | // set up the loop for the processing
|
---|
91 | //
|
---|
92 | MEvtLoop magic;
|
---|
93 | magic.SetParList(&parlist);
|
---|
94 |
|
---|
95 | //
|
---|
96 | // Start to loop over all events
|
---|
97 | //
|
---|
98 | MProgressBar bar;
|
---|
99 | magic.SetProgressBar(&bar);
|
---|
100 | if (!magic.Eventloop())
|
---|
101 | return;
|
---|
102 |
|
---|
103 | tasklist.PrintStatistics();
|
---|
104 |
|
---|
105 | collarea->CalcEfficiency();
|
---|
106 |
|
---|
107 | //
|
---|
108 | // Now the histogram we wanted to get out of the data is
|
---|
109 | // filled and can be displayed
|
---|
110 | //
|
---|
111 | collarea->DrawClone();
|
---|
112 |
|
---|
113 | //
|
---|
114 | // Write histogram to a file in case an output
|
---|
115 | // filename has been supplied
|
---|
116 | //
|
---|
117 | if (outname.IsNull())
|
---|
118 | return;
|
---|
119 |
|
---|
120 | TFile f(outname,"recreate");
|
---|
121 | collarea->GetHist()->Write();
|
---|
122 | collarea->GetHAll()->Write();
|
---|
123 | collarea->GetHSel()->Write();
|
---|
124 | f.Close();
|
---|
125 | }
|
---|
126 |
|
---|