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 |
|
---|
27 | void CT1collarea(TString filename="MC3.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 | binsx.SetEdges(30,2.,5.);
|
---|
49 |
|
---|
50 | MBinning binsy("BinningTheta");
|
---|
51 | const Double_t yedge[7] = {12.5, 17.5, 23.5, 29.5, 35.5, 42., 48.};
|
---|
52 | const TArrayD yed(7,yedge);
|
---|
53 | binsy.SetEdges(yed);
|
---|
54 |
|
---|
55 | parlist.AddToList(collarea);
|
---|
56 | parlist.AddToList(&binsx);
|
---|
57 | parlist.AddToList(&binsy);
|
---|
58 |
|
---|
59 | tasklist.AddToList(&reader);
|
---|
60 |
|
---|
61 | MF filterhadrons("HadNN.fHadronness<0.25");
|
---|
62 | tasklist.AddToList(&filterhadrons);
|
---|
63 |
|
---|
64 | MFillH filler("MHMcCT1CollectionArea","MMcEvt");
|
---|
65 | filler.SetFilter(&filterhadrons);
|
---|
66 | tasklist.AddToList(&filler);
|
---|
67 |
|
---|
68 | //
|
---|
69 | // set up the loop for the processing
|
---|
70 | //
|
---|
71 | MEvtLoop magic;
|
---|
72 | magic.SetParList(&parlist);
|
---|
73 |
|
---|
74 | //
|
---|
75 | // Start to loop over all events
|
---|
76 | //
|
---|
77 | MProgressBar bar;
|
---|
78 | magic.SetProgressBar(&bar);
|
---|
79 | if (!magic.Eventloop())
|
---|
80 | return;
|
---|
81 |
|
---|
82 | tasklist.PrintStatistics();
|
---|
83 |
|
---|
84 | collarea->CalcEfficiency();
|
---|
85 |
|
---|
86 | //
|
---|
87 | // Now the histogram we wanted to get out of the data is
|
---|
88 | // filled and can be displayed
|
---|
89 | //
|
---|
90 | collarea->DrawClone();
|
---|
91 |
|
---|
92 | //
|
---|
93 | // Write histogram to a file in case an output
|
---|
94 | // filename has been supplied
|
---|
95 | //
|
---|
96 | if (outname.IsNull())
|
---|
97 | return;
|
---|
98 |
|
---|
99 | TFile f(outname,"recreate");
|
---|
100 | collarea->GetHist()->Write();
|
---|
101 | collarea->GetHAll()->Write();
|
---|
102 | collarea->GetHSel()->Write();
|
---|
103 | f.Close();
|
---|
104 | }
|
---|
105 |
|
---|