source: trunk/MagicSoft/Mars/macros/trigrate.C@ 988

Last change on this file since 988 was 988, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.6 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 trigrate(int dim=0, char *filename = "data/camera.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(MParList::CreateObjList("MHMcRate", dim));
64 hists.SetOwner();
65
66 //
67 // Check if the list really contains the right number of histograms
68 //
69 if (hists.GetEntriesFast() != dim && dim)
70 return;
71
72 //
73 // Add the histograms to the paramater list.
74 //
75 parlist.AddToList(&hists);
76
77 //
78 // Setup out tasks:
79 // - First we have to read the events
80 // - Then we can calculate rates, for what the number of
81 // triggered showers from a empty reflector file for the
82 // analised trigger conditions should be set (BgR[])
83 //
84 MReadTree reader("Events", filename);
85 reader.UseLeaf("fImpact");
86 reader.UseLeaf("fEnergy");
87 reader.UseLeaf("fPhi");
88 reader.UseLeaf("fTheta");
89 reader.UseLeaf("fNumFirstLevel");
90 reader.UseLeaf("fPhotElfromShower");
91 tasklist.AddToList(&reader);
92
93 Float_t BgR[10]={660, 4, 0, 0, 0, 0, 0, 0, 0, 0};
94 cout << "Number of Trigger conditions: " << dim << endl;
95
96 MMcTriggerRateCalc rate(dim, 14, BgR, 100000);
97 tasklist.AddToList(&rate);
98
99 //
100 // set up the loop for the processing
101 //
102 MEvtLoop magic;
103 magic.SetParList(&parlist);
104
105 //
106 // Start to loop over all events
107 //
108 if (!magic.Eventloop())
109 return;
110
111 hists.Print();
112}
Note: See TracBrowser for help on using the repository browser.