1 | #include "MLogManip.h"
|
---|
2 |
|
---|
3 | /*****************************************************************
|
---|
4 |
|
---|
5 | DISPLAY -- Display calibrated data
|
---|
6 |
|
---|
7 | datafile:
|
---|
8 | A calibarted root file which came out of callist,
|
---|
9 | e.g. 20170727_006_C.root
|
---|
10 |
|
---|
11 | lvl1, lvl2:
|
---|
12 | Lower (1) and higher (2) cleaning level
|
---|
13 |
|
---|
14 |
|
---|
15 | To run the macro from the command line (assuming you are in a directory
|
---|
16 | Mars/build where you have built your Mars environment) ou can do
|
---|
17 |
|
---|
18 | root ../hawc/display.C\(\"filename_C.root\"\)
|
---|
19 |
|
---|
20 | or from within root
|
---|
21 |
|
---|
22 | [0] .x ../hawc/display.C("filename_C.root")
|
---|
23 |
|
---|
24 |
|
---|
25 | You will get a status display. You can step through the events
|
---|
26 | either by selecting Loop/SingleStep from the menu bar or
|
---|
27 | by pressing the space key in the status window.
|
---|
28 |
|
---|
29 | Note that as a default (see below in the code), events which
|
---|
30 | do not survive image cleaning are skipped.
|
---|
31 |
|
---|
32 | ******************************************************************/
|
---|
33 | int display(const char *datafile, Double_t lvl1=7.8, Double_t lvl2=3.9, const char *outpath=".")
|
---|
34 | {
|
---|
35 | // The delta t [ns/deg] for the image cleaning
|
---|
36 | double deltat = 17.5;
|
---|
37 |
|
---|
38 | // --------------------------------------------------------
|
---|
39 |
|
---|
40 | gLog.Separator("Star");
|
---|
41 | gLog << all << "Calculate image parameters of sequence ";
|
---|
42 | gLog << datafile << endl;
|
---|
43 | gLog << endl;
|
---|
44 |
|
---|
45 | // ------------------------------------------------------
|
---|
46 |
|
---|
47 | // Allocate/open the status display
|
---|
48 | MStatusDisplay *d = new MStatusDisplay;
|
---|
49 | d->SetLoopStep();
|
---|
50 |
|
---|
51 | // Instantiate the list of tasks
|
---|
52 | MTaskList tlist;
|
---|
53 |
|
---|
54 | // Instantiate the list of parameter containers
|
---|
55 | MParList plist2;
|
---|
56 | plist2.AddToList(&tlist);
|
---|
57 |
|
---|
58 | // Instatiate the event loop
|
---|
59 | MEvtLoop loop;
|
---|
60 | loop.SetDisplay(d);
|
---|
61 | loop.SetParList(&plist2);
|
---|
62 |
|
---|
63 | // Instantiate the reading task
|
---|
64 | MReadMarsFile read("Events");
|
---|
65 | read.DisableAutoScheme();
|
---|
66 | read.AddFile(datafile);
|
---|
67 |
|
---|
68 | // Instantiate the task which takes care of the size of all containers
|
---|
69 | MGeomApply apply;
|
---|
70 |
|
---|
71 | // Instantiate the image cleaning
|
---|
72 |
|
---|
73 | // This is the most simple image cleaning possible, standard
|
---|
74 | // tail cut based on absolute amplitudes
|
---|
75 | // MImgCleanStd clean(lvl1, lvl2);
|
---|
76 | // clean.SetMethod(MImgCleanStd::kAbsolute);
|
---|
77 | // clean.SetPostCleanType(3);
|
---|
78 |
|
---|
79 | // Instantiate the image cleaning as described in the TRAC
|
---|
80 | MImgCleanTime clean;
|
---|
81 | clean.SetMinCount(0);
|
---|
82 | clean.SetMinSize(50);
|
---|
83 | clean.SetDeltaT(17.5);
|
---|
84 |
|
---|
85 | // Instantiate the calculation of the image parameters
|
---|
86 | MHillasCalc hcalc;
|
---|
87 | hcalc.Disable(MHillasCalc::kCalcConc);
|
---|
88 |
|
---|
89 | // Instantiate all the displays
|
---|
90 | MHEvent evt01a(MHEvent::kEvtSignalDensity);
|
---|
91 | MHEvent evt01b(MHEvent::kEvtArrTime);
|
---|
92 | MHEvent evt02a(MHEvent::kEvtSignalDensity);
|
---|
93 | MHEvent evt02b(MHEvent::kEvtArrTimeCleaned);
|
---|
94 | MHEvent evt03 (MHEvent::kEvtIslandIndex);
|
---|
95 |
|
---|
96 | evt01a.SetName("CalibSig");
|
---|
97 | evt01b.SetName("CalibTm");
|
---|
98 | evt02a.SetName("CleanSig");
|
---|
99 | evt02b.SetName("CleanTm");
|
---|
100 | evt03 .SetName("IslandIdx");
|
---|
101 |
|
---|
102 | evt01a.SetMinimum(0);
|
---|
103 | evt01b.SetMinimum(0);
|
---|
104 | evt01b.SetMaximum(250);
|
---|
105 | evt02a.SetMinimum(0);
|
---|
106 |
|
---|
107 | // Instantiate the tasks to fill the displays
|
---|
108 | MFillH fill01a(&evt01a, "MSignalCam", "MFillH1b");
|
---|
109 | MFillH fill01b(&evt01b, "MSignalCam", "MFillH1b");
|
---|
110 | MFillH fill02a(&evt02a, "MSignalCam", "MFillH2a");
|
---|
111 | MFillH fill02b(&evt02b, "MSignalCam", "MFillH2b");
|
---|
112 | MFillH fill03 (&evt03, "MSignalCam", "MFillH3");
|
---|
113 |
|
---|
114 | // Instantiate printing the hillas parameters
|
---|
115 | MPrint print("MHillas");
|
---|
116 |
|
---|
117 | // Setup the task list
|
---|
118 | tlist.AddToList(&read);
|
---|
119 | tlist.AddToList(&apply);
|
---|
120 |
|
---|
121 | tlist.AddToList(&fill01a);
|
---|
122 | tlist.AddToList(&fill01b);
|
---|
123 | tlist.AddToList(&clean);
|
---|
124 |
|
---|
125 | // Remove the two following tasks from the loop
|
---|
126 | // if you want to see all events not just the ones
|
---|
127 | // which survived image cleaning successfully
|
---|
128 | tlist.AddToList(&hcalc);
|
---|
129 | tlist.AddToList(&print);
|
---|
130 |
|
---|
131 | // All those which come after MHillasCalc display the ellipse
|
---|
132 | tlist.AddToList(&fill02a);
|
---|
133 | tlist.AddToList(&fill02b);
|
---|
134 | tlist.AddToList(&fill03);
|
---|
135 |
|
---|
136 | // Run the eventloop
|
---|
137 | if (!loop.Eventloop())
|
---|
138 | return 3;
|
---|
139 |
|
---|
140 | // Check if the display was closed (deleted) by the user
|
---|
141 | if (!loop.GetDisplay())
|
---|
142 | return 4;
|
---|
143 |
|
---|
144 | // ============================================================
|
---|
145 |
|
---|
146 | return 0;
|
---|
147 | }
|
---|