1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Antonio Stamerra 1/2003 <mailto:antono.stamerra@pi.infn.it>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MTriggerLvl2Calc //
|
---|
28 | // This is a task to calculate the 2nd level trigger selection //
|
---|
29 | // parameters //
|
---|
30 | // //
|
---|
31 | // Input containers: //
|
---|
32 | // MMcTriggerLvl2 //
|
---|
33 | // //
|
---|
34 | /////////////////////////////////////////////////////////////////////////////
|
---|
35 |
|
---|
36 | #include "MMcTriggerLvl2Calc.h"
|
---|
37 | #include "MMcTriggerLvl2.h"
|
---|
38 | #include "MHMcTriggerLvl2.h"
|
---|
39 |
|
---|
40 | #include "MParList.h"
|
---|
41 | #include "MLog.h"
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | //#include "MMcEvt.hxx"
|
---|
45 | #include "MMcTrig.hxx"
|
---|
46 | #include "MRawRunHeader.h"
|
---|
47 |
|
---|
48 | #include "MGeomCam.h"
|
---|
49 |
|
---|
50 | ClassImp(MMcTriggerLvl2Calc);
|
---|
51 |
|
---|
52 | using namespace std;
|
---|
53 |
|
---|
54 | // --------------------------------------------------------------------------
|
---|
55 | //
|
---|
56 | // Default constructor
|
---|
57 | //
|
---|
58 | //
|
---|
59 | MMcTriggerLvl2Calc::MMcTriggerLvl2Calc(const char *name, const char *title)
|
---|
60 | {
|
---|
61 | fName = name ? name : "MMcTriggerLvl2Calc";
|
---|
62 | fTitle = title ? title : "Task to Fill the MMcTriggerLvl2 object";
|
---|
63 | }
|
---|
64 |
|
---|
65 | // --------------------------------------------------------------------------
|
---|
66 | //
|
---|
67 | // Check for the run type. Return kTRUE if it is a MC run or if there
|
---|
68 | // is no MC run header (old camera files) kFALSE in case of a different
|
---|
69 | // run type
|
---|
70 | //
|
---|
71 | Bool_t MMcTriggerLvl2Calc::IsMCRun(MParList *pList) const
|
---|
72 | {
|
---|
73 | const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
---|
74 | if (!run)
|
---|
75 | {
|
---|
76 | *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
|
---|
77 | return kTRUE;
|
---|
78 | }
|
---|
79 |
|
---|
80 | return run->IsMonteCarloRun();
|
---|
81 | }
|
---|
82 |
|
---|
83 | // --------------------------------------------------------------------------
|
---|
84 | //
|
---|
85 | // Check for the runtype.
|
---|
86 | // Search for .
|
---|
87 | //
|
---|
88 | Bool_t MMcTriggerLvl2Calc::ReInit(MParList *pList)
|
---|
89 | {
|
---|
90 | return kTRUE;
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 | // --------------------------------------------------------------------------
|
---|
96 | //
|
---|
97 | // PreProcess
|
---|
98 | // Check the exxistence of the MMcTriggerLvl2 containers and the correct
|
---|
99 | // setting of the fCompactNN that defines a compact pixel
|
---|
100 | //
|
---|
101 | Int_t MMcTriggerLvl2Calc::PreProcess (MParList *pList)
|
---|
102 | {
|
---|
103 |
|
---|
104 | // fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindObject("MMcTriggerLvl2");
|
---|
105 | fMMcTriggerLvl2 = (MMcTriggerLvl2*)pList->FindCreateObj("MMcTriggerLvl2");
|
---|
106 | if (!fMMcTriggerLvl2)
|
---|
107 | {
|
---|
108 | *fLog << err << dbginf << "MMcTriggerLvl2 not found... exit." << endl;
|
---|
109 | return kFALSE;
|
---|
110 | }
|
---|
111 |
|
---|
112 | fMHMcTriggerLvl2 = (MHMcTriggerLvl2*)pList->FindCreateObj("MHMcTriggerLvl2");
|
---|
113 | if (!fMHMcTriggerLvl2)
|
---|
114 | {
|
---|
115 | *fLog << err << dbginf << "MHMcTriggerLvl2 not found... exit." << endl;
|
---|
116 | return kFALSE;
|
---|
117 | }
|
---|
118 |
|
---|
119 | // Check if the variable fCompactNN has been correctly set;
|
---|
120 | // accepted values for fCompactNN are (up to now) 2 and 3.
|
---|
121 | if (fMMcTriggerLvl2->GetCompactNN()<2 || fMMcTriggerLvl2->GetCompactNN()>3)
|
---|
122 | {
|
---|
123 | *fLog << err << dbginf << "fCompactNN is not correctly set ("<<fMMcTriggerLvl2->GetCompactNN() <<") ... exit" <<endl;
|
---|
124 | return kFALSE;
|
---|
125 | }
|
---|
126 | else
|
---|
127 | *fLog << "Compact pixel is set with at least "<<fMMcTriggerLvl2->GetCompactNN() << " NN" <<endl;
|
---|
128 |
|
---|
129 | //------------------------------------------------------------
|
---|
130 | //
|
---|
131 | // If it is no MC file skip this function...
|
---|
132 | //
|
---|
133 | if (!IsMCRun(pList))
|
---|
134 | {
|
---|
135 | *fLog << inf << "Reading a data file...skipping the rest of PreProcess()" << endl;
|
---|
136 | return kTRUE;
|
---|
137 | }
|
---|
138 |
|
---|
139 | //
|
---|
140 | // Check all necessary containers in case of a MC run
|
---|
141 | //
|
---|
142 | fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
---|
143 | if (!fMcEvt)
|
---|
144 | {
|
---|
145 | *fLog << err << dbginf << "MMcEvt not found... exit." << endl;
|
---|
146 | return kFALSE;
|
---|
147 | }
|
---|
148 |
|
---|
149 | fMcTrig = (MMcTrig*)pList->FindObject("MMcTrig");
|
---|
150 | if (!fMcTrig)
|
---|
151 | {
|
---|
152 | *fLog << err << dbginf << "MMcTrig not found... exit." << endl;
|
---|
153 | return kFALSE;
|
---|
154 | }
|
---|
155 |
|
---|
156 | fCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
157 | if (!fCam)
|
---|
158 | {
|
---|
159 | *fLog << err << "MGeomCam not found (no geometry information available)... aborting." << endl;
|
---|
160 | return kFALSE;
|
---|
161 | }
|
---|
162 | // Check if fCam is a Magic geometry: only MGeomCamMagic geometry and
|
---|
163 | // geometries with 577 pixels are now accepted by MMcTriggerLvl2
|
---|
164 | if (fCam->GetNumPixels()!= 577)
|
---|
165 | {
|
---|
166 | *fLog << warn << "MGeomCam has a wrong geometry; only MAGIC geometry (577 pixels) is accepted by now... the Task is skipped." <<endl;
|
---|
167 | return kSKIP;
|
---|
168 | }
|
---|
169 |
|
---|
170 | return kTRUE;
|
---|
171 |
|
---|
172 | }
|
---|
173 |
|
---|
174 |
|
---|
175 | // --------------------------------------------------------------------------
|
---|
176 | //
|
---|
177 | // Process
|
---|
178 | //
|
---|
179 | //
|
---|
180 | Int_t MMcTriggerLvl2Calc::Process()
|
---|
181 | {
|
---|
182 | // fMMcTriggerLvl2->GetEnergy(fMcEvt);
|
---|
183 |
|
---|
184 | fMMcTriggerLvl2->SetLv1(fMcTrig);
|
---|
185 |
|
---|
186 | fMMcTriggerLvl2->CalcCompactPixels(fCam);
|
---|
187 |
|
---|
188 | fMMcTriggerLvl2->Calc();
|
---|
189 |
|
---|
190 | fMMcTriggerLvl2->CalcTriggerPattern(fCam);
|
---|
191 |
|
---|
192 | return kTRUE;
|
---|
193 | }
|
---|
194 |
|
---|
195 |
|
---|
196 | // --------------------------------------------------------------------------
|
---|
197 | //
|
---|
198 | // PostProcess : Display the histogram
|
---|
199 | // !to be fixed: create an histogram class!
|
---|
200 | //
|
---|
201 | Int_t MMcTriggerLvl2Calc::PostProcess()
|
---|
202 | {
|
---|
203 |
|
---|
204 | return kTRUE;
|
---|
205 | }
|
---|
206 |
|
---|
207 |
|
---|
208 |
|
---|
209 |
|
---|