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

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