source: trunk/MagicSoft/Mars/macros/triglvl2.C@ 2037

Last change on this file since 2037 was 1991, checked in by stamerra, 22 years ago
*** empty log message ***
File size: 3.9 KB
Line 
1// triglvl2.C
2// Macro to use the class MMcTriggerLvl2, which calculates the
3// 2nd level trigger (L2T) selection parameters.
4// Filters to select events using these parameter and
5// histograms with selection variables distributions are also created.
6//
7// Inputs:
8// - filename name of data file
9// - CompactNN number of NN to define a compact pixel
10// - fValue comparision value for the filter
11//
12// 23/04/2003 Added example of MFEnergySlope filter
13//
14//
15void triglvl2(char *filename = "Gamma.root")
16 // USER: Data File Name ---^
17{
18 //
19 // first we have to create our empty lists
20 //
21 MParList parlist;
22 MTaskList tasklist;
23
24 parlist.AddToList(&tasklist);
25
26 MGeomCamMagic geocam;
27 parlist.AddToList(&geocam);
28
29 // MHillas hillas;
30 // parlist.AddToList(&hillas);
31
32 // An instance of the class MMcTriggerLvl2 is created and added to the
33 // parameter list
34 MMcTriggerLvl2 cell;
35 parlist.AddToList(&cell);
36
37 // Set the number of Next Neighbourhoods that define a compact pixel
38 //
39 cell.SetCompactNN(3);
40 // USER: --^
41
42 //
43 // A filter to select events using the L2T parameters is created
44 //
45 MF lvl2filter("MMcTriggerLvl2.fLutPseudoSize > 8");
46
47 //
48 // A second filter is created using the class MFTriggerLvl2
49 //
50 MFTriggerLvl2 fTrig("MMcTriggerLvl2", '>', 8);
51 // USER: fValue to be compared --^
52
53 //
54 // A selection on the number and energy of the events
55 //
56 MF energyfilter("MMcEvt.fEnergy > 100");
57 MFEventSelector selector;
58 //selector.SetNumSelectEvts(4000);
59
60
61 // Filter to select events according to a give slope
62 MFEnergySlope eslope;
63
64 eslope.SetMcMinEnergy(50.);
65 eslope.SetMcMaxEnergy(400.);
66 eslope.SetNewSlope(-3.91);
67
68 // A filter list is created; the filters created can be added to the list
69 //
70 MFilterList flist;
71 // flist.AddToList(&energyfilter);
72 // flist.AddToList(&lvl2filter);
73 // flist.AddToList(&selector);
74 // flist.AddToList(&eslope);
75 flist.AddToList(&fTrig);
76
77
78 //
79 // Setup our tasks:
80 // - First we have to read the events
81 // - Then we can fill the efficiency histograms
82 //
83 MReadMarsFile reader("Events", filename);
84 reader.DisableAutoScheme();
85 // reader.EnableBranch("fEnergy");
86 // reader.EnableBranch("fImpact"); reader.EnableBranch("fTimeFirst[4]");
87 // reader.EnableBranch("fPixelsFirst[73][4]");
88
89 tasklist.AddToList(&reader);
90
91 //
92 // The filter list is added to the task list
93 //
94 tasklist.AddToList(&flist);
95
96 //
97 // Task to calculate and plot the effective area
98 //
99 MMcCollectionAreaCalc effi;
100 tasklist.AddToList(&effi);
101
102 //
103 // The filter list selects events for the effective area calculation
104 //
105 effi.SetFilter(&flist);
106
107 //
108 // The task to calculate the L2T parameter is added to the task list
109 //
110 MMcTriggerLvl2Calc fill("MMcTriggerLvl2","MMcTriggerLvl2");
111 tasklist.AddToList(&fill);
112
113 //
114 // Filling of histos for MHMcTriggerLvl2
115 //
116 MFillH hfill1("MHMcTriggerLvl2","MMcTriggerLvl2");
117 tasklist.AddToList(&hfill1);
118
119 //
120 // set up the loop for the processing
121 //
122 MEvtLoop magic;
123 magic.SetParList(&parlist);
124
125 //
126 // Start to loop over all events
127 //
128 MProgressBar bar;
129 magic.SetProgressBar(&bar);
130
131 if (!magic.Eventloop())
132 return;
133
134 tasklist.PrintStatistics();
135
136 //
137 // Now the histogram we wanted to get out of the data is
138 // filled and can be displayd
139 //
140 parlist.FindObject("MHMcCollectionArea")->DrawClone();
141
142 parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lps");
143 // parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
144
145 // Returns histogram of the class MHMcTriggerLvl2
146 // parlist.FindObject("MHMcTriggerLvl2")->GetHistByName("hfPseudoSize"));
147
148}
149
150
151
Note: See TracBrowser for help on using the repository browser.