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

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