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 are also created.
|
---|
5 | //
|
---|
6 | void triglvl2(char *filename = "Gamma.root")
|
---|
7 | {
|
---|
8 | //
|
---|
9 | // first we have to create our empty lists
|
---|
10 | //
|
---|
11 | MParList parlist;
|
---|
12 | MTaskList tasklist;
|
---|
13 |
|
---|
14 | parlist.AddToList(&tasklist);
|
---|
15 |
|
---|
16 | // An instance of the class MMcTriggerLvl2 is created and added to the
|
---|
17 | // parameter list
|
---|
18 | MMcTriggerLvl2 cell;
|
---|
19 | parlist.AddToList(&cell);
|
---|
20 |
|
---|
21 | //
|
---|
22 | // A filter to select events using the L2T parameters is created
|
---|
23 | //
|
---|
24 | // MF lvl2filter("MMcTriggerLvl2.fLutPseudoSize > 6");
|
---|
25 | MF lvl2filter("MMcTriggerLvl2.fSizeBiggerCell > 16");
|
---|
26 | // A second filter is created using the class MFTriggerLvl2
|
---|
27 | MFTriggerLvl2 fTrig1("MMcTriggerLvl2", '>', 6);
|
---|
28 | // this is the value to be compared --^
|
---|
29 |
|
---|
30 | //
|
---|
31 | // A selection on the number and energy of the events
|
---|
32 | //
|
---|
33 | MF energyfilter("MMcEvt.fEnergy > 10");
|
---|
34 | MFEventSelector selector;
|
---|
35 | selector.SetNumSelectEvts(4000);
|
---|
36 |
|
---|
37 | // A filter list is created; the filters created can be added to the list
|
---|
38 | //
|
---|
39 | MFilterList flist;
|
---|
40 | flist.AddToList(&energyfilter);
|
---|
41 | flist.AddToList(&lvl2filter);
|
---|
42 | flist.AddToList(&selector);
|
---|
43 | flist.AddToList(&fTrig1);
|
---|
44 |
|
---|
45 | //
|
---|
46 | // Setup our tasks:
|
---|
47 | // - First we have to read the events
|
---|
48 | // - Then we can fill the efficiency histograms
|
---|
49 | //
|
---|
50 | MReadMarsFile reader("Events", filename);
|
---|
51 | reader.DisableAutoScheme();
|
---|
52 | // reader.EnableBranch("fEnergy");
|
---|
53 | // reader.EnableBranch("fImpact"); reader.EnableBranch("fTimeFirst[4]");
|
---|
54 | // reader.EnableBranch("fPixelsFirst[73][4]");
|
---|
55 |
|
---|
56 | tasklist.AddToList(&reader);
|
---|
57 |
|
---|
58 | //
|
---|
59 | // The task to calculate the L2T parameter is added to the task list
|
---|
60 | //
|
---|
61 | MMcTriggerLvl2Calc fill("MMcTriggerLvl2","MMcTriggerLvl2");
|
---|
62 | tasklist.AddToList(&fill);
|
---|
63 |
|
---|
64 | //
|
---|
65 | // Task to calculate and plot the effective area
|
---|
66 | //
|
---|
67 | MMcCollectionAreaCalc effi;
|
---|
68 | tasklist.AddToList(&effi);
|
---|
69 | //
|
---|
70 | // The filter list selects events for the effective area calculation
|
---|
71 | //
|
---|
72 | effi.SetFilter(&flist);
|
---|
73 |
|
---|
74 | //
|
---|
75 | // The filter list is added to the task list
|
---|
76 | //
|
---|
77 | tasklist.AddToList(&flist);
|
---|
78 |
|
---|
79 | //
|
---|
80 | // set up the loop for the processing
|
---|
81 | //
|
---|
82 | MEvtLoop magic;
|
---|
83 | magic.SetParList(&parlist);
|
---|
84 |
|
---|
85 | //
|
---|
86 | // Start to loop over all events
|
---|
87 | //
|
---|
88 | MProgressBar bar;
|
---|
89 | magic.SetProgressBar(&bar);
|
---|
90 |
|
---|
91 | if (!magic.PreProcess())
|
---|
92 | return;
|
---|
93 |
|
---|
94 | if (!magic.Eventloop())
|
---|
95 | return;
|
---|
96 |
|
---|
97 | tasklist.PrintStatistics();
|
---|
98 | //
|
---|
99 | // Now the histogram we wanted to get out of the data is
|
---|
100 | // filled and can be displayd
|
---|
101 | //
|
---|
102 | parlist.FindObject("MHMcCollectionArea")->DrawClone();
|
---|
103 |
|
---|
104 | magic.PostProcess();
|
---|
105 |
|
---|
106 | }
|
---|