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

Last change on this file since 1956 was 1920, checked in by stamerra, 22 years ago
*** empty log message ***
File size: 3.4 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//
12void triglvl2(char *filename = "Gamma.root")
13 // USER: Data File Name ---^
14{
15 //
16 // first we have to create our empty lists
17 //
18 MParList parlist;
19 MTaskList tasklist;
20
21 parlist.AddToList(&tasklist);
22
23 // An instance of the class MMcTriggerLvl2 is created and added to the
24 // parameter list
25 MMcTriggerLvl2 cell;
26 parlist.AddToList(&cell);
27
28 // Set the number of Next Neighbourhoods that define a compact pixel
29 //
30 cell.SetCompactNN(3);
31 // USER: --^
32
33 //
34 // A filter to select events using the L2T parameters is created
35 //
36 MF lvl2filter("MMcTriggerLvl2.fLutPseudoSize > 8");
37 // MF lvl2filter("MMcTriggerLvl2.fSizeBiggerCell > 16");
38
39 //
40 // A second filter is created using the class MFTriggerLvl2
41 //
42 MFTriggerLvl2 fTrig1("MMcTriggerLvl2", '>', 8);
43 // USER: fValue to be compared --^
44
45 //
46 // A selection on the number and energy of the events
47 //
48 MF energyfilter("MMcEvt.fEnergy > 100");
49 MFEventSelector selector;
50 selector.SetNumSelectEvts(4000);
51
52 // A filter list is created; the filters created can be added to the list
53 //
54 MFilterList flist;
55 // flist.AddToList(&energyfilter);
56 // flist.AddToList(&lvl2filter);
57 // flist.AddToList(&selector);
58 flist.AddToList(&fTrig1);
59
60 //
61 // Setup our tasks:
62 // - First we have to read the events
63 // - Then we can fill the efficiency histograms
64 //
65 MReadMarsFile reader("Events", filename);
66 reader.DisableAutoScheme();
67 // reader.EnableBranch("fEnergy");
68 // reader.EnableBranch("fImpact"); reader.EnableBranch("fTimeFirst[4]");
69 // reader.EnableBranch("fPixelsFirst[73][4]");
70
71 tasklist.AddToList(&reader);
72
73 //
74 // Task to calculate and plot the effective area
75 //
76 MMcCollectionAreaCalc effi;
77 tasklist.AddToList(&effi);
78
79 //
80 // The filter list selects events for the effective area calculation
81 //
82 effi.SetFilter(&flist);
83
84 //
85 // The filter list is added to the task list
86 //
87 tasklist.AddToList(&flist);
88
89 //
90 // The task to calculate the L2T parameter is added to the task list
91 //
92 MMcTriggerLvl2Calc fill("MMcTriggerLvl2","MMcTriggerLvl2");
93 tasklist.AddToList(&fill);
94
95 //
96 // set up the loop for the processing
97 //
98 MEvtLoop magic;
99 magic.SetParList(&parlist);
100
101 //
102 // Start to loop over all events
103 //
104 MProgressBar bar;
105 magic.SetProgressBar(&bar);
106
107 if (!magic.Eventloop())
108 return;
109
110 tasklist.PrintStatistics();
111
112 //
113 // Now the histogram we wanted to get out of the data is
114 // filled and can be displayd
115 //
116 parlist.FindObject("MHMcCollectionArea")->DrawClone();
117
118 parlist.FindObject("MHMcTriggerLvl2")->DrawClone("lps");
119 parlist.FindObject("MHMcTriggerLvl2")->DrawClone();
120
121 // Returns histogram of the class MHMcTriggerLvl2
122 //parlist.FindObject("MHMcTriggerLvl2")->GetHistByName("hfPseudoSize");
123
124
125
126}
Note: See TracBrowser for help on using the repository browser.