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

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