source: trunk/MagicSoft/Mars/macros/getRate.C@ 949

Last change on this file since 949 was 948, checked in by tbretz, 23 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!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26void getRate(int dim=0, char *filename = "/big0/Maggi/CamData/Gamma/gamma_15_on.root" )
27{
28 // This macro has two input parameter:
29 // dim : = 0 -> root file with 1 trigger condition.
30 // > 0 -> number of trigger condition to be analised
31 // in multi conditon file.
32 // < 0 -> selects the -dim trigger condition.
33 //
34 // first we have to create our empty lists
35 //
36 MParList parlist;
37 MTaskList tasklist;
38
39 //
40 // Setup the parameter list.
41 // - we do not need to create any other container. All of them
42 // are created automatically without loss - we don't have to
43 // access them-
44 //
45 // - we need to create MHMcRate only. The other containers
46 // are created automatically without loss - we don't have to
47 // access them-
48 // - MHMcRate must be created by us because we need the pointer
49 // to it and if it would get created automatically it would also be
50 // deleted automatically
51 // - Actually, depending on using a single trigger option MonteCarlo
52 // file or a multyple trigger option, a MHMcRate or an array of
53 // MHMcRate are needed.
54 //
55 parlist.AddToList(&tasklist);
56
57 //
58 // You don't have to add the MHMcRate container here by hand.
59 // But if you want to print or display these containers later on
60 // it is necessary (Rem: No printing or displaying is done in this
61 // macro yet)
62 //
63 TObjArray *hists = new TObjArray(MParList::CreateObjList("MHMcRate", dim));
64
65 //
66 // Check if the list really contains the right number of histograms
67 //
68 if (hists->GetEntriesFast() != dim)
69 return;
70
71 //
72 // Add the histograms to the paramater list.
73 //
74 parlist.AddToList(hists);
75
76 //
77 // Setup out tasks:
78 // - First we have to read the events
79 // - Then we can calculate rates, for what the number of
80 // triggered showers from a empty reflector file for the
81 // analised trigger conditions should be set (BgR[])
82 //
83 MReadTree reader("Events", filename);
84 tasklist.AddToList(&reader);
85
86 Float_t BgR[10]={660,4,0,0,0,0,0,0,0,0};
87 cout << "Number of Trigger conditions: " << dim << endl;
88
89 MMcTriggerRateCalc rate(dim, 14, BgR, 100000, 2.75, 10.91e-2);
90 tasklist.AddToList(&rate);
91
92 //
93 // set up the loop for the processing
94 //
95 MEvtLoop magic;
96 magic.SetParList(&parlist);
97
98 //
99 // Start to loop over all events
100 //
101 magic.Eventloop();
102
103}
Note: See TracBrowser for help on using the repository browser.