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

Last change on this file since 2264 was 2261, checked in by moralejo, 22 years ago
*** empty log message ***
File size: 3.2 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
26
27void CT1collarea(TString filename="MC_SC4.root", TString outname="")
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 = new MHMcCT1CollectionArea();
46
47 MBinning binsx("BinningE");
48
49 // binsx.SetEdges(30,2.,5.);
50 // Double_t xedge[10] =
51 // {2.50515, 2.69897, 2.89763, 3.09691, 3.30103, 3.49969, 3.69984, 3.89982, 4.10003, 4.29994};
52
53
54 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};
55
56 const TArrayD xed;
57 xed.Set(15,xedge);
58 binsx.SetEdges(xed);
59
60 MBinning binsy("BinningTheta");
61 const Double_t yedge[9] = {0.0, 17.5, 23.5, 29.5, 35.5, 42., 50., 60., 70.};
62 const TArrayD yed;
63 yed.Set(9,yedge);
64 binsy.SetEdges(yed);
65
66 parlist.AddToList(collarea);
67 parlist.AddToList(&binsx);
68 parlist.AddToList(&binsy);
69
70 tasklist.AddToList(&reader);
71
72 MF filterhadrons("HadSC.fHadronness<0.3 && {abs(MHillasSrc.fAlpha)} < 13.1");
73 tasklist.AddToList(&filterhadrons);
74
75
76 MFillH filler("MHMcCT1CollectionArea","MMcEvt");
77 filler.SetFilter(&filterhadrons);
78 tasklist.AddToList(&filler);
79
80 //
81 // set up the loop for the processing
82 //
83 MEvtLoop magic;
84 magic.SetParList(&parlist);
85
86 //
87 // Start to loop over all events
88 //
89 MProgressBar bar;
90 magic.SetProgressBar(&bar);
91 if (!magic.Eventloop())
92 return;
93
94 tasklist.PrintStatistics();
95
96 collarea->CalcEfficiency();
97
98 //
99 // Now the histogram we wanted to get out of the data is
100 // filled and can be displayed
101 //
102 collarea->DrawClone();
103
104 //
105 // Write histogram to a file in case an output
106 // filename has been supplied
107 //
108 if (outname.IsNull())
109 return;
110
111 TFile f(outname,"recreate");
112 collarea->GetHist()->Write();
113 collarea->GetHAll()->Write();
114 collarea->GetHSel()->Write();
115 f.Close();
116}
117
Note: See TracBrowser for help on using the repository browser.