source: trunk/MagicSoft/Mars/macros/CT1collarea.C@ 5293

Last change on this file since 5293 was 2273, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.4 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 (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
26void CT1collarea(TString filename="MC_SC4.root", TString outname="")
27{
28
29 //
30 // first we have to create our empty lists
31 //
32 MParList parlist;
33 MTaskList tasklist;
34
35 parlist.AddToList(&tasklist);
36
37 //
38 // Setup out tasks:
39 // - First we have to read the events
40 // - Then we can fill the efficiency histograms
41 //
42 MReadMarsFile reader("Events", filename);
43 reader.DisableAutoScheme();
44
45 MHMcCT1CollectionArea collarea;
46
47 MBinning binsx("BinningE");
48
49 /*
50 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};
51 const TArrayD xed;
52 xed.Set(15,xedge);
53 binsx.SetEdges(xed);
54 collarea.SetEaxis(MHMcCollectionArea::kLog10);
55 */
56
57 //
58 // SetEaxis tells MHMcCT1CollectionArea whether the variable to histogram
59 // is the Energy (argument is kEnergy) or its decimal logarithm
60 // (kLog10Energy). Of course this depends on how the energy binning is
61 // defined via the object binsx.
62 //
63 binsx.SetEdgesLog(14,300,1.e5);
64 collarea.SetEaxis(MHMcCT1CollectionArea::kLinear);
65
66
67 MBinning binsy("BinningTheta");
68 const Double_t yedge[9] = {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
69 const TArrayD yed;
70 yed.Set(9,yedge);
71 binsy.SetEdges(yed);
72
73 parlist.AddToList(&collarea);
74 parlist.AddToList(&binsx);
75 parlist.AddToList(&binsy);
76
77 tasklist.AddToList(&reader);
78
79 MF filterhadrons("HadSC.fHadronness<0.3 && {abs(MHillasSrc.fAlpha)} < 13.1");
80 tasklist.AddToList(&filterhadrons);
81
82
83 MFillH filler("MHMcCT1CollectionArea","MMcEvt");
84 filler.SetFilter(&filterhadrons);
85 tasklist.AddToList(&filler);
86
87 //
88 // set up the loop for the processing
89 //
90 MEvtLoop magic;
91 magic.SetParList(&parlist);
92
93 //
94 // Start to loop over all events
95 //
96 MProgressBar bar;
97 magic.SetProgressBar(&bar);
98 if (!magic.Eventloop())
99 return;
100
101 tasklist.PrintStatistics();
102
103 collarea.CalcEfficiency();
104
105 //
106 // Now the histogram we wanted to get out of the data is
107 // filled and can be displayed
108 //
109 collarea.DrawClone();
110
111 //
112 // Write histogram to a file in case an output
113 // filename has been supplied
114 //
115 if (outname.IsNull())
116 return;
117
118 TFile f(outname,"recreate");
119 collarea.GetHist()->Write();
120 collarea.GetHAll()->Write();
121 collarea.GetHSel()->Write();
122}
123
Note: See TracBrowser for help on using the repository browser.