Belle II Software release-09-00-02
TRGECLUnpackerModule Class Reference

A module of TRG ECL Unpacker. More...

#include <trgeclUnpackerModule.h>

Inheritance diagram for TRGECLUnpackerModule:
Collaboration diagram for TRGECLUnpackerModule:

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 TRGECLUnpackerModule ()
 Constructor.
 
virtual ~TRGECLUnpackerModule ()
 Destructor.
 
void initialize () override
 Initilizes TRGECLUnpackerModuel.
 
void event () override
 Called event by event.
 
void terminate () override
 Called when processing ended.
 
void beginRun () override
 Called when new run started.
 
void endRun () override
 Called when run ended.
 
std::string version () const
 returns version of TRGECLUnpackerModule.
 
virtual void readCOPPEREvent (RawTRG *, int, int, int)
 Read data from TRG copper.
 
virtual void checkBuffer (int *, int)
 Unpacker main function.
 
virtual void checkBuffer_v136 (int *, int)
 Unpacker main function for upto version 136.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Protected Attributes

int n_basf2evt
 Event number.
 
int etm_version = 0
 ETM Version.
 
unsigned int nodeid = 0
 Node Id.
 
int nwords = 0
 N Word.
 
int iFiness = 0
 Finess.
 
int trgtype = 0
 Trigger Type.
 

Private Member Functions

std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

StoreArray< TRGECLUnpackerStorem_TRGECLTCArray
 ECL Trigger Unpacker TC output.
 
StoreArray< TRGECLUnpackerSumStorem_TRGECLSumArray
 ECL Trigger Unpacker Summary output.
 
StoreArray< TRGECLUnpackerEvtStorem_TRGECLEvtArray
 ECL Trigger Unpacker Event output.
 
StoreArray< TRGECLClusterm_TRGECLClusterArray
 ECL Trigger Cluster output.
 
StoreObjPtr< EventLevelClusteringInfom_eventLevelClusteringInfo
 EventLevelClusteringInfo.
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

A module of TRG ECL Unpacker.

Definition at line 36 of file trgeclUnpackerModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
85 };
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition: Module.h:81
@ c_Input
This module is an input module (reads data).
Definition: Module.h:78
@ c_DontCollectStatistics
No statistics is collected for this module.
Definition: Module.h:84
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition: Module.h:82
@ c_Output
This module is an output module (writes data).
Definition: Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition: Module.h:83

Constructor & Destructor Documentation

◆ TRGECLUnpackerModule()

Constructor.

Definition at line 25 of file trgeclUnpackerModule.cc.

27{
28
29 string desc = "TRGECLUnpackerModule(" + version() + ")";
30 setDescription(desc);
32
33 B2DEBUG(20, "trgeclunpacker: Constructor done.");
34}
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
Module()
Constructor.
Definition: Module.cc:30
std::string version() const
returns version of TRGECLUnpackerModule.

◆ ~TRGECLUnpackerModule()

~TRGECLUnpackerModule ( )
virtual

Destructor.

Definition at line 36 of file trgeclUnpackerModule.cc.

36{}

Member Function Documentation

◆ beginRun()

void beginRun ( void  )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 52 of file trgeclUnpackerModule.cc.

52{}

◆ checkBuffer()

void checkBuffer ( int *  rdat,
int  nnn 
)
virtual

Unpacker main function.

Definition at line 120 of file trgeclUnpackerModule.cc.

121{
122
123 int version_check = (rdat[0] >> 12) & 0xf;
124 if (version_check != 15) return;
125
126 // Checksum variable
127 unsigned char check_sum = (rdat[nnn - 1] >> 24) & 0xFF;
128 unsigned char data_sum = 0;
129 unsigned char kdat[4] = {0};
130 for (int j = nnn - 2; j > -1; j--) {
131 kdat[0] = rdat[j] & 0xff;
132 kdat[1] = (rdat[j] >> 8) & 0xff;
133 kdat[2] = (rdat[j] >> 16) & 0xff;
134 kdat[3] = (rdat[j] >> 24) & 0xff;
135 for (int k = 0; k < 4; k++) {
136 data_sum = data_sum + kdat[k];
137 }
138 }
139
140 int flag_checksum = 0;
141
142 if (check_sum == data_sum) {
143 flag_checksum = 0;
144 } else {
145 flag_checksum = 1;
146 }
147
148 // Information
149 int l1_revo = rdat[0] & 0x7ff;
150 int i = 0;
151 int window_num = 0;
152
153 // Summary
154 /* cppcheck-suppress variableScope */
155 int summary_data = 0;
156 int summary_recon = 0;
157 /* cppcheck-suppress variableScope */
158 int summary_revo = 0;
159 /* cppcheck-suppress variableScope */
160 bool summary_trg = false;
161 /* cppcheck-suppress variableScope */
162 int data_win = 0;
163
164 // TC
165 /* cppcheck-suppress variableScope */
166 int ntc_win = 0;
167 bool tc_trg = false;
168 // TC info
169 int tc_id = 0;
170 int tc_t = 0;
171 int tc_e = 0;
172 int conv_tc_t = 0;
173 int win3_revo = -9999;
174
175 vector<unsigned> sum_data;
176 vector<vector<unsigned>> sum_info;
177
178 vector<int> tc_data;
179 vector<vector<int>> tc_info;
180 vector<vector<int>> tc_info_FE1;
181 vector<vector<int>> tc_info_FE2;
182 vector<vector<int>> tc_info_BE1;
183 vector<vector<int>> tc_info_BE2;
184
185 // Unpacking ---->
186 while (i < nnn - 2) {
187 summary_data = rdat[i + 1];
188 summary_trg = (summary_data >> 23) & 0x1;
189 summary_revo = (summary_data >> 16) & 0x7f;
190 ntc_win = summary_data & 0x3ff;
191 if (ntc_win == 0) {
192 tc_trg = false;
193 } else {
194 tc_trg = true;
195 }
196 data_win = window_num;
197 if (window_num == 3) win3_revo = summary_revo;
198
199 if (summary_trg == true) { // Summary on
200
201 sum_data.push_back(data_win);
202 sum_data.push_back(summary_revo);
203 for (int j = 0; j < 12; j++) {
204 summary_recon =
205 (((rdat[i + j + 2] >> 0) & 0xFF) << 24) +
206 (((rdat[i + j + 2] >> 8) & 0xFF) << 16) +
207 (((rdat[i + j + 2] >> 16) & 0xFF) << 8) +
208 (((rdat[i + j + 2] >> 24) & 0xFF) << 0);
209 sum_data.push_back(summary_recon);
210 }
211 sum_info.push_back(sum_data);
212 sum_data.clear();
213 i = i + 14;
214
215 if (tc_trg == true) { // summary on & TC on
216 for (int j = 0; j < ntc_win; j++) {
217 tc_id = (rdat[i + j] >> 20) & 0x3FF;
218 tc_t = (rdat[i + j] >> 12) & 0x7F;
219 tc_e = rdat[i + j] & 0xFFF;
220 conv_tc_t = (data_win - 3) * 128 + tc_t;
221
222 // TC vector
223 tc_data.push_back(tc_id);
224 tc_data.push_back(conv_tc_t);
225 tc_data.push_back(tc_e);
226 tc_data.push_back(data_win);
227 if (tc_id < 81) {
228 if (tc_id > 75) {
229 tc_info_FE1.push_back(tc_data);
230 } else {
231 tc_info_FE2.push_back(tc_data);
232 }
233 } else if (tc_id > 512) {
234 if (tc_id > 572) {
235 tc_info_BE1.push_back(tc_data);
236 } else {
237 tc_info_BE2.push_back(tc_data);
238 }
239 } else {
240 tc_info.push_back(tc_data);
241 }
242 tc_data.clear();
243 }
244 i = i + ntc_win - 1;
245 }
246
247 } else { // Summary off
248 if (tc_trg == true) { // summary off & TC on
249 for (int j = 0; j < ntc_win; j++) {
250 tc_id = (rdat[i + j + 2] >> 20) & 0x3FF;
251 tc_t = (rdat[i + j + 2] >> 12) & 0x7F;
252 conv_tc_t = (data_win - 3) * 128 + tc_t;
253 tc_e = rdat[i + j + 2] & 0xFFF;
254
255 // TC vector
256 tc_data.push_back(tc_id);
257 tc_data.push_back(conv_tc_t);
258 tc_data.push_back(tc_e);
259 tc_data.push_back(data_win);
260 if (tc_id < 81) {
261 if (tc_id > 75) {
262 tc_info_FE1.push_back(tc_data);
263 } else {
264 tc_info_FE2.push_back(tc_data);
265 }
266 } else if (tc_id > 512) {
267 if (tc_id > 572) {
268 tc_info_BE1.push_back(tc_data);
269 } else {
270 tc_info_BE2.push_back(tc_data);
271 }
272 } else {
273 tc_info.push_back(tc_data);
274 }
275 tc_data.clear();
276 }
277 i = i + ntc_win + 1;
278 } else { // Summary off & TC off
279 i = i + 1;
280 }
281 }
282 window_num++;
283 }
284
285 // <---- Unpacking
286
287 // Summary
288 /* cppcheck-suppress variableScope */
289 int sum_num_ord = 0;
290 /* cppcheck-suppress variableScope */
291 int sum_num = 0;
292 /* cppcheck-suppress variableScope */
293 int sum_revo = 0;
294 int cl_theta[6] = {0};
295 int cl_phi[6] = {0};
296 int cl_time[6] = { -9999};
297 int cl_energy[6] = {0};
298 int cl_1gev[6] = {0};
299 int cl_2gev[6] = {0};
300 int cl_bha[6] = {0};
301 int ncl = 0;
302 int low_multi = 0;
303 int b2bhabha_v = 0;
304 int b2bhabha_s = 0;
305 int mumu = 0;
306 int prescale = 0;
307 int icn_over = 0;
308 int bg_veto = 0;
309 int icn = 0;
310 int etot_type = 0;
311 int etot = 0;
312 int b1_type = 0;
313 int b1bhabha = 0;
314 int physics = 0;
315 int time_type = 0;
316 int time = 0;
317 int ecl_bst = 0;
318
319 int m_sumNum = 0;
320
321 TrgEclDataBase database;
322 TrgEclMapping mapping;
323
324 vector<int> cl_1d;
325 vector<vector<int>> cl_2d;
326
327 vector<int> evt_1d_vector;
328 vector<vector<int>> evt_2d_vector;
329
330 // Store Summary
331 int sum_size = sum_info.size();
332 if (sum_size != 0) {
333 for (int j = 0; j < sum_size; j++) {
334 sum_num = sum_info[j][0];
335 sum_revo = sum_info[j][1];
336 // TRG
337 time = (sum_info[j][2]) & 0x7F;
338 time_type = (sum_info[j][2] >> 7) & 0x7;
339 physics = (sum_info[j][2] >> 10) & 0x1;
340 b1bhabha = (sum_info[j][2] >> 11) & 0x1;
341 b1_type = (sum_info[j][2] >> 12) & 0x3FFF;
342 etot = ((sum_info[j][3] & 0x7F) << 6) + ((sum_info[j][2] >> 26) & 0x3F);
343 etot_type = (sum_info[j][3] >> 7) & 0x7;
344 icn = (sum_info[j][3] >> 10) & 0x7F;
345 bg_veto = (sum_info[j][3] >> 17) & 0x7;
346 icn_over = (sum_info[j][3] >> 20) & 0x1;
347 b2bhabha_v = (sum_info[j][3] >> 21) & 0x1;
348 low_multi = (((sum_info[j][4] >> 6) & 0x3) << 12) + ((sum_info[j][4] & 0x3) << 10) + ((sum_info[j][3] >> 22) & 0x3FF);
349 b2bhabha_s = (sum_info[j][4] >> 2) & 0x1;
350 mumu = (sum_info[j][4] >> 3) & 0x1;
351 prescale = (sum_info[j][4] >> 4) & 0x1;
352 ecl_bst = (sum_info[j][4] >> 5) & 0x1;
353 // CL
354 cl_energy[0] = (sum_info[j][5]) & 0xFFF;
355 cl_time[0] = (sum_info[j][5] >> 12) & 0xFF;
356 cl_phi[0] = (sum_info[j][5] >> 20) & 0xFF;
357 cl_theta[0] = ((sum_info[j][6] & 0x7) << 4) + ((sum_info[j][5] >> 28) & 0xF);
358
359 cl_energy[1] = (sum_info[j][6] >> 3) & 0xFFF;
360 cl_time[1] = (sum_info[j][6] >> 15) & 0xFF;
361 cl_phi[1] = (sum_info[j][6] >> 23) & 0xFF;
362 cl_theta[1] = ((sum_info[j][7] & 0x3F) << 1) + ((sum_info[j][6] >> 31) & 0x1);
363
364 cl_energy[2] = (sum_info[j][7] >> 6) & 0xFFF;
365 cl_time[2] = (sum_info[j][7] >> 18) & 0xFF;
366 cl_phi[2] = ((sum_info[j][8] & 0x3) << 6) + ((sum_info[j][7] >> 26) & 0x3F);
367 cl_theta[2] = (sum_info[j][8] >> 2) & 0x7F;
368
369 cl_energy[3] = (sum_info[j][8] >> 9) & 0xFFF;
370 cl_time[3] = (sum_info[j][8] >> 21) & 0xFF;
371 cl_phi[3] = ((sum_info[j][9] & 0x1F) << 3) + ((sum_info[j][8] >> 29) & 0x7);
372 cl_theta[3] = (sum_info[j][9] >> 5) & 0x7F;
373
374 cl_energy[4] = (sum_info[j][ 9] >> 12) & 0xFFF;
375 cl_time[4] = (sum_info[j][ 9] >> 24) & 0xFF;
376 cl_phi[4] = (sum_info[j][10]) & 0xFF;
377 cl_theta[4] = (sum_info[j][10] >> 8) & 0x7F;
378
379 cl_energy[5] = (sum_info[j][10] >> 15) & 0xFFF;
380 cl_time[5] = ((sum_info[j][11] & 0x7) << 5) + ((sum_info[j][10] >> 27) & 0x1F);
381 cl_phi[5] = (sum_info[j][11] >> 3) & 0xFF;
382 cl_theta[5] = (sum_info[j][11] >> 11) & 0x7F;
383
384 // CL others
385 for (int k = 0; k < 6; k++) {
386 cl_1gev[k] = (sum_info[j][12] >> k) & 0x1;
387 cl_2gev[k] = (sum_info[j][12] >> (k + 6)) & 0x1;
388 cl_bha[k] = (sum_info[j][12] >> (k + 12)) & 0x1;
389 }
390 ncl = (sum_info[j][13]) & 0x7;
391
392 m_TRGECLSumArray.appendNew();
393 m_sumNum = m_TRGECLSumArray.getEntries() - 1;
394 m_TRGECLSumArray[m_sumNum]->setEventId(n_basf2evt);
395 m_TRGECLSumArray[m_sumNum]->setSumNum(sum_num);
396 m_TRGECLSumArray[m_sumNum]->setSumRevo(sum_revo);
397 m_TRGECLSumArray[m_sumNum]->setCLTheta(cl_theta);
398 m_TRGECLSumArray[m_sumNum]->setCLPhi(cl_phi);
399 m_TRGECLSumArray[m_sumNum]->setCLTime(cl_time);
400 m_TRGECLSumArray[m_sumNum]->setCLEnergy(cl_energy);
401 m_TRGECLSumArray[m_sumNum]->setCLF1GeV(cl_1gev);
402 m_TRGECLSumArray[m_sumNum]->setCLF2GeV(cl_2gev);
403 m_TRGECLSumArray[m_sumNum]->setCLFBha(cl_bha);
404 m_TRGECLSumArray[m_sumNum]->setNCL(ncl);
405 m_TRGECLSumArray[m_sumNum]->setICN(icn);
406 m_TRGECLSumArray[m_sumNum]->setICNOver(icn_over);
407 m_TRGECLSumArray[m_sumNum]->setLowMulti(low_multi);
408 m_TRGECLSumArray[m_sumNum]->set3DBhabhaV(b2bhabha_v);
409 m_TRGECLSumArray[m_sumNum]->set3DBhabhaS(b2bhabha_s);
410 m_TRGECLSumArray[m_sumNum]->setMumu(mumu);
411 m_TRGECLSumArray[m_sumNum]->setPrescale(prescale);
412 m_TRGECLSumArray[m_sumNum]->set2DBhabha(b1bhabha);
413 m_TRGECLSumArray[m_sumNum]->setBhabhaType(b1_type);
414 m_TRGECLSumArray[m_sumNum]->setPhysics(physics);
415 m_TRGECLSumArray[m_sumNum]->setBG(bg_veto);
416 m_TRGECLSumArray[m_sumNum]->setEtot(etot);
417 m_TRGECLSumArray[m_sumNum]->setEtotType(etot_type);
418 m_TRGECLSumArray[m_sumNum]->setECLBST(ecl_bst);
419 m_TRGECLSumArray[m_sumNum]->setTime(time);
420 m_TRGECLSumArray[m_sumNum]->setTimeType(time_type);
421
422 for (int k = 0; k < 6; k++) {
423 cl_1d.push_back(cl_theta[k]);
424 cl_1d.push_back(cl_phi[k]);
425 cl_1d.push_back(cl_time[k]);
426 cl_1d.push_back(cl_energy[k]);
427 cl_1d.push_back(cl_1gev[k]);
428 cl_1d.push_back(cl_2gev[k]);
429 cl_1d.push_back(cl_bha[k]);
430 cl_2d.push_back(cl_1d);
431 cl_1d.clear();
432 }
433 sort(cl_2d.begin(), cl_2d.end(),
434 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[3] > aa2[3];});
435
436 if (sum_num == -9999) {
437 sum_num_ord = -9999;
438 } else if (sum_num <= 3) {
439 sum_num_ord = 2 * abs(sum_num - 3);
440 } else {
441 sum_num_ord = (sum_num * 2) - 7;
442 }
443 evt_1d_vector.push_back(sum_num_ord);
444 evt_1d_vector.push_back(sum_revo);
445 evt_1d_vector.push_back(sum_num);
446 evt_1d_vector.push_back(time);
447 for (int k = 0; k < 6; k++) {
448 for (int l = 0; l < 7; l++) {
449 evt_1d_vector.push_back(cl_2d[k][l]);
450 }
451 }
452 cl_2d.clear();
453 evt_1d_vector.push_back(ncl);
454 evt_1d_vector.push_back(low_multi);
455 evt_1d_vector.push_back(b2bhabha_v);
456 evt_1d_vector.push_back(b2bhabha_s);
457 evt_1d_vector.push_back(mumu);
458 evt_1d_vector.push_back(prescale);
459 evt_1d_vector.push_back(icn);
460 evt_1d_vector.push_back(icn_over);
461 evt_1d_vector.push_back(etot_type);
462 evt_1d_vector.push_back(etot);
463 evt_1d_vector.push_back(ecl_bst);
464 evt_1d_vector.push_back(b1_type);
465 evt_1d_vector.push_back(b1bhabha);
466 evt_1d_vector.push_back(physics);
467 evt_1d_vector.push_back(time_type);
468 evt_2d_vector.push_back(evt_1d_vector);
469 evt_1d_vector.clear();
470 }
471 } else {
472 for (int k = 0; k < 6; k++) {
473 cl_theta[k] = 0;
474 cl_phi[k] = 0;
475 cl_time[k] = -9999;
476 cl_energy[k] = 0;
477 cl_1gev[k] = 0;
478 cl_2gev[k] = 0;
479 cl_bha[k] = 0;
480 }
481 ncl = 0;
482 low_multi = 0;
483 b2bhabha_v = 0;
484 b2bhabha_s = 0;
485 mumu = 0;
486 prescale = 0;
487 icn_over = 0;
488 bg_veto = 0;
489 icn = 0;
490 etot_type = 0;
491 etot = 0;
492 ecl_bst = 0;
493 b1_type = 0;
494 b1bhabha = 0;
495 physics = 0;
496 time_type = 0;
497 time = -9999;
498
499 m_TRGECLSumArray.appendNew();
500 m_sumNum = m_TRGECLSumArray.getEntries() - 1;
501 m_TRGECLSumArray[m_sumNum]->setEventId(n_basf2evt);
502 m_TRGECLSumArray[m_sumNum]->setSumNum(0);
503 m_TRGECLSumArray[m_sumNum]->setCLTheta(cl_theta);
504 m_TRGECLSumArray[m_sumNum]->setCLPhi(cl_phi);
505 m_TRGECLSumArray[m_sumNum]->setCLTime(cl_time);
506 m_TRGECLSumArray[m_sumNum]->setCLEnergy(cl_energy);
507 m_TRGECLSumArray[m_sumNum]->setCLF1GeV(cl_1gev);
508 m_TRGECLSumArray[m_sumNum]->setCLF2GeV(cl_2gev);
509 m_TRGECLSumArray[m_sumNum]->setCLFBha(cl_bha);
510 m_TRGECLSumArray[m_sumNum]->setNCL(ncl);
511 m_TRGECLSumArray[m_sumNum]->setICN(icn);
512 m_TRGECLSumArray[m_sumNum]->setICNOver(icn_over);
513 m_TRGECLSumArray[m_sumNum]->setLowMulti(low_multi);
514 m_TRGECLSumArray[m_sumNum]->set3DBhabhaV(b2bhabha_v);
515 m_TRGECLSumArray[m_sumNum]->set3DBhabhaS(b2bhabha_s);
516 m_TRGECLSumArray[m_sumNum]->setMumu(mumu);
517 m_TRGECLSumArray[m_sumNum]->setPrescale(prescale);
518 m_TRGECLSumArray[m_sumNum]->set2DBhabha(b1bhabha);
519 m_TRGECLSumArray[m_sumNum]->setBhabhaType(b1_type);
520 m_TRGECLSumArray[m_sumNum]->setPhysics(physics);
521 m_TRGECLSumArray[m_sumNum]->setBG(bg_veto);
522 m_TRGECLSumArray[m_sumNum]->setEtot(etot);
523 m_TRGECLSumArray[m_sumNum]->setEtotType(etot_type);
524 m_TRGECLSumArray[m_sumNum]->setECLBST(ecl_bst);
525 m_TRGECLSumArray[m_sumNum]->setTime(time);
526 m_TRGECLSumArray[m_sumNum]->setTimeType(time_type);
527 }
528
529 // TC & TRG
530 tc_info.insert(tc_info.end(), tc_info_FE1.begin(), tc_info_FE1.end());
531 tc_info.insert(tc_info.end(), tc_info_FE2.begin(), tc_info_FE2.end());
532 tc_info.insert(tc_info.end(), tc_info_BE1.begin(), tc_info_BE1.end());
533 tc_info.insert(tc_info.end(), tc_info_BE2.begin(), tc_info_BE2.end());
534
535 int m_evtNum = 0;
536
537 int m_tcNum = 0;
538 /* cppcheck-suppress variableScope */
539 int m_tcid = 0;
540 /* cppcheck-suppress variableScope */
541 int m_time = -9999;
542 /* cppcheck-suppress variableScope */
543 int m_energy = 0;
544 /* cppcheck-suppress variableScope */
545 int m_win = 0;
546 /* cppcheck-suppress variableScope */
547 int m_revo = 0;
548 /* cppcheck-suppress variableScope */
549 int m_caltime = -9999;
550
551 int tot_ntc = tc_info.size();
552 /* cppcheck-suppress variableScope */
553 int evt_ntc = 0;
554 /* cppcheck-suppress variableScope */
555 int evt_revo = -9999;
556 /* cppcheck-suppress variableScope */
557 int evt_win = 0;
558 /* cppcheck-suppress variableScope */
559 int evt_timing = -9999; // most energetic
560 int evt_cl_theta[6] = {0};
561 int evt_cl_phi[6] = {0};
562 int evt_cl_time[6] = { -9999};
563 int evt_cl_energy[6] = {0};
564 int evt_cl_1gev[6] = {0};
565 int evt_cl_2gev[6] = {0};
566 int evt_cl_bha[6] = {0};
567 /* cppcheck-suppress variableScope */
568 int evt_ncl = 0;
569 /* cppcheck-suppress variableScope */
570 int evt_low_multi = 0;
571 /* cppcheck-suppress variableScope */
572 int evt_b2bhabha_v = 0;
573 /* cppcheck-suppress variableScope */
574 int evt_b2bhabha_s = 0;
575 /* cppcheck-suppress variableScope */
576 int evt_mumu = 0;
577 /* cppcheck-suppress variableScope */
578 int evt_prescale = 0;
579 /* cppcheck-suppress variableScope */
580 int evt_icn = 0;
581 /* cppcheck-suppress variableScope */
582 int evt_icn_over = 0;
583 /* cppcheck-suppress variableScope */
584 int evt_etot_type = 0;
585 /* cppcheck-suppress variableScope */
586 int evt_etot = 0;
587 /* cppcheck-suppress variableScope */
588 int evt_ecl_bst = 0;
589 /* cppcheck-suppress variableScope */
590 int evt_b1_type = 0;
591 /* cppcheck-suppress variableScope */
592 int evt_b1bhabha = 0;
593 /* cppcheck-suppress variableScope */
594 int evt_physics = 0;
595 /* cppcheck-suppress variableScope */
596 int evt_time_type = 0;
597 /* cppcheck-suppress variableScope */
598 int evt_etot_all = 0;
599 /* cppcheck-suppress variableScope */
600 int evt_time_min = 0;
601 /* cppcheck-suppress variableScope */
602 int evt_time_max = 0;
603 /* cppcheck-suppress variableScope */
604 int evt_time_win = 0;
605 /* cppcheck-suppress variableScope */
606 int etot_i = 0;
607 /* cppcheck-suppress variableScope */
608 int etot_c = 0;
609 /* cppcheck-suppress variableScope */
610 int etot_f = 0;
611 /* cppcheck-suppress variableScope */
612 int cl_tcid = 0;
613 /* cppcheck-suppress variableScope */
614 int cl_thetaid = 0;
615 /* cppcheck-suppress variableScope */
616 int cl_phiid = 0;
617 /* cppcheck-suppress variableScope */
618 int m_clNum = 0;
619
620
621 int evt_v_size = evt_2d_vector.size();
622 if (evt_v_size != 0) {
623 // Sort window : 3 => 4 => 2 => 5 => 1 => 6 => 7
624 sort(evt_2d_vector.begin(), evt_2d_vector.end(),
625 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[0] < aa2[0];});
626 }
627
628 if (tot_ntc != 0 && flag_checksum == 0 && nnn > 7) {
629 if (evt_v_size == 0) {
630 // Find most energetic TC timing
631 sort(tc_info.begin(), tc_info.end(),
632 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[2] > aa2[2];});
633 evt_revo = win3_revo;
634 evt_win = tc_info[0][3];
635 evt_timing = tc_info[0][1];
636 for (int k = 0; k < 6; k++) {
637 evt_cl_theta[k] = 0;
638 evt_cl_phi[k] = 0;
639 evt_cl_time[k] = 0;
640 evt_cl_energy[k] = 0;
641 evt_cl_1gev[k] = 0;
642 evt_cl_2gev[k] = 0;
643 evt_cl_bha[k] = 0;
644 }
645 evt_ncl = 0;
646 evt_low_multi = 0;
647 evt_b2bhabha_v = 0;
648 evt_b2bhabha_s = 0;
649 evt_mumu = 0;
650 evt_prescale = 0;
651 evt_icn = 0;
652 evt_icn_over = 0;
653 evt_etot_type = 0;
654 evt_etot = 0;
655 evt_ecl_bst = 0;
656 evt_b1_type = 0;
657 evt_b1bhabha = 0;
658 evt_physics = 0;
659 evt_time_type = 0;
660 } else {
661 evt_revo = evt_2d_vector[0][1];
662 evt_win = evt_2d_vector[0][2];
663 evt_timing = evt_2d_vector[0][3];
664 for (int k = 0; k < 6; k++) {
665 evt_cl_theta[k] = evt_2d_vector[0][ 4 + k * 7];
666 evt_cl_phi[k] = evt_2d_vector[0][ 5 + k * 7];
667 evt_cl_time[k] = evt_2d_vector[0][ 6 + k * 7];
668 evt_cl_energy[k] = evt_2d_vector[0][ 7 + k * 7];
669 evt_cl_1gev[k] = evt_2d_vector[0][ 8 + k * 7];
670 evt_cl_2gev[k] = evt_2d_vector[0][ 9 + k * 7];
671 evt_cl_bha[k] = evt_2d_vector[0][10 + k * 7];
672 }
673 evt_ncl = evt_2d_vector[0][46];
674 evt_low_multi = evt_2d_vector[0][47];
675 evt_b2bhabha_v = evt_2d_vector[0][48];
676 evt_b2bhabha_s = evt_2d_vector[0][49];
677 evt_mumu = evt_2d_vector[0][50];
678 evt_prescale = evt_2d_vector[0][51];
679 evt_icn = evt_2d_vector[0][52];
680 evt_icn_over = evt_2d_vector[0][53];
681 evt_etot_type = evt_2d_vector[0][54];
682 evt_etot = evt_2d_vector[0][55];
683 evt_ecl_bst = evt_2d_vector[0][56];
684 evt_b1_type = evt_2d_vector[0][57];
685 evt_b1bhabha = evt_2d_vector[0][58];
686 evt_physics = evt_2d_vector[0][59];
687 evt_time_type = evt_2d_vector[0][60];
688 }
689 // Sort by TC number
690 sort(tc_info.begin(), tc_info.end(),
691 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[0] < aa2[0];});
692
693 for (int ii = 0; ii < tot_ntc; ii++) {
694 m_tcid = tc_info[ii][0];
695 m_time = tc_info[ii][1];
696 m_energy = tc_info[ii][2];
697 m_win = tc_info[ii][3];
698 m_revo = win3_revo;
699 m_caltime = m_time - ((evt_win - 3) * 128 + evt_timing);
700 m_TRGECLTCArray.appendNew();
701 m_tcNum = m_TRGECLTCArray.getEntries() - 1;
702 m_TRGECLTCArray[m_tcNum]->setEventId(n_basf2evt);
703 m_TRGECLTCArray[m_tcNum]->setTCId(m_tcid);
704 m_TRGECLTCArray[m_tcNum]->setTCTime(m_time);
705 m_TRGECLTCArray[m_tcNum]->setTCCALTime(m_caltime);
706 m_TRGECLTCArray[m_tcNum]->setHitWin(m_win);
707 m_TRGECLTCArray[m_tcNum]->setRevoFAM(m_revo);
708 m_TRGECLTCArray[m_tcNum]->setTCEnergy(m_energy);
709 m_TRGECLTCArray[m_tcNum]->setChecksum(flag_checksum);
710
711 if (m_win == evt_win || m_win == evt_win + 1) evt_ntc++;
712 if (m_win == evt_win - 1) {
713 etot_i += m_energy;
714 }
715 if (m_win == evt_win) {
716 etot_c += m_energy;
717 }
718 if (m_win == evt_win + 1) {
719 etot_f += m_energy;
720 }
721 }
722
723 if (etot_i == 0 && etot_f == 0) {
724 evt_etot_all = etot_c;
725 evt_time_min = - evt_timing;
726 evt_time_max = 256 - evt_timing;
727 evt_time_win = 1;
728 } else if (etot_i >= etot_f) {
729 evt_etot_all = etot_c + etot_i;
730 evt_time_min = -128 - evt_timing;
731 evt_time_max = 128 - evt_timing;
732 evt_time_win = -1;
733 } else {
734 evt_etot_all = etot_c + etot_f;
735 evt_time_min = - evt_timing;
736 evt_time_max = 256 - evt_timing;
737 evt_time_win = 1;
738 }
739
740 for (int icluster = 0; icluster < 6; icluster++) {
741 if (evt_cl_energy[icluster] == 0 || evt_cl_theta[icluster] == 0 || evt_cl_phi[icluster] == 0) {continue;}
742 cl_tcid = mapping.getTCIdFromPosition(evt_cl_theta[icluster], evt_cl_phi[icluster]);
743 if (cl_tcid == 0) {continue;}
744 cl_thetaid = mapping.getTCThetaIdFromTCId(cl_tcid);
745 cl_phiid = mapping.getTCPhiIdFromTCId(cl_tcid);
746
747 m_TRGECLClusterArray.appendNew();
748 m_clNum = m_TRGECLClusterArray.getEntries() - 1;
749 m_TRGECLClusterArray[m_clNum]->setEventId(n_basf2evt);
750 m_TRGECLClusterArray[m_clNum]->setClusterId(icluster);
751 m_TRGECLClusterArray[m_clNum]->setEventRevo(evt_revo);
752
753 m_TRGECLClusterArray[m_clNum]->setMaxTCId(cl_tcid); // center of Cluster
754 m_TRGECLClusterArray[m_clNum]->setMaxThetaId(cl_thetaid);
755 m_TRGECLClusterArray[m_clNum]->setMaxPhiId(cl_phiid);
756 m_TRGECLClusterArray[m_clNum]->setClusterId(icluster);
757 m_TRGECLClusterArray[m_clNum]->setEnergyDep((double)evt_cl_energy[icluster] * 5.25); // MeV
758 double cl_timing = -1000;
759 for (int i_tc = 0; i_tc < tot_ntc; i_tc++) {
760 if (cl_tcid == tc_info[i_tc][0]) {
761 cl_timing = tc_info[i_tc][1];
762 break;
763 }
764 }
765 m_TRGECLClusterArray[m_clNum]->setTimeAve(cl_timing);
766 m_TRGECLClusterArray[m_clNum]->setPositionX(mapping.getTCPosition(cl_tcid).X());
767 m_TRGECLClusterArray[m_clNum]->setPositionY(mapping.getTCPosition(cl_tcid).Y());
768 m_TRGECLClusterArray[m_clNum]->setPositionZ(mapping.getTCPosition(cl_tcid).Z());
769 }
770 m_TRGECLEvtArray.appendNew();
771 m_evtNum = m_TRGECLEvtArray.getEntries() - 1;
772 m_TRGECLEvtArray[m_evtNum]->setEventId(n_basf2evt);
773 m_TRGECLEvtArray[m_evtNum]->setETM(etm_version);
774 m_TRGECLEvtArray[m_evtNum]->setL1Revo(l1_revo);
775 m_TRGECLEvtArray[m_evtNum]->setEvtRevo(evt_revo);
776 m_TRGECLEvtArray[m_evtNum]->setEvtWin(evt_win);
777 m_TRGECLEvtArray[m_evtNum]->setEvtTime(evt_timing);
778 m_TRGECLEvtArray[m_evtNum]->setNTC(evt_ntc);
779 m_TRGECLEvtArray[m_evtNum]->setCLTheta(evt_cl_theta);
780 m_TRGECLEvtArray[m_evtNum]->setCLPhi(evt_cl_phi);
781 m_TRGECLEvtArray[m_evtNum]->setCLTime(evt_cl_time);
782 m_TRGECLEvtArray[m_evtNum]->setCLEnergy(evt_cl_energy);
783 m_TRGECLEvtArray[m_evtNum]->setCLF1GeV(evt_cl_1gev);
784 m_TRGECLEvtArray[m_evtNum]->setCLF2GeV(evt_cl_2gev);
785 m_TRGECLEvtArray[m_evtNum]->setCLFBha(evt_cl_bha);
786 m_TRGECLEvtArray[m_evtNum]->setNCL(evt_ncl);
787 m_TRGECLEvtArray[m_evtNum]->setLowMulti(evt_low_multi);
788 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaV(evt_b2bhabha_v);
789 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaS(evt_b2bhabha_s);
790 m_TRGECLEvtArray[m_evtNum]->setMumu(evt_mumu);
791 m_TRGECLEvtArray[m_evtNum]->setPrescale(evt_prescale);
792 m_TRGECLEvtArray[m_evtNum]->setICN(evt_icn);
793 m_TRGECLEvtArray[m_evtNum]->setICNOver(evt_icn_over);
794 m_TRGECLEvtArray[m_evtNum]->setEtotType(evt_etot_type);
795 m_TRGECLEvtArray[m_evtNum]->setEtot(evt_etot);
796 m_TRGECLEvtArray[m_evtNum]->setECLBST(evt_ecl_bst);
797 m_TRGECLEvtArray[m_evtNum]->set2DBhabha(evt_b1bhabha);
798 m_TRGECLEvtArray[m_evtNum]->setBhabhaType(evt_b1_type);
799 m_TRGECLEvtArray[m_evtNum]->setPhysics(evt_physics);
800 m_TRGECLEvtArray[m_evtNum]->setTimeType(evt_time_type);
801 m_TRGECLEvtArray[m_evtNum]->setCheckSum(flag_checksum);
802 m_TRGECLEvtArray[m_evtNum]->setEvtExist(1);
803 m_TRGECLEvtArray[m_evtNum]->setTRGTYPE(trgtype);
804 m_TRGECLEvtArray[m_evtNum]->setEtotAll(evt_etot_all);
805 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMin(evt_time_min);
806 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMax(evt_time_max);
807 m_TRGECLEvtArray[m_evtNum]->setEvtTimeWin(evt_time_win);
808 } else {
809 m_TRGECLTCArray.appendNew();
810 m_tcNum = m_TRGECLTCArray.getEntries() - 1;
811 m_TRGECLTCArray[m_tcNum]->setEventId(n_basf2evt);
812 m_TRGECLTCArray[m_tcNum]->setTCId(0);
813 m_TRGECLTCArray[m_tcNum]->setTCTime(-9999);
814 m_TRGECLTCArray[m_tcNum]->setTCCALTime(-9999);
815 m_TRGECLTCArray[m_tcNum]->setHitWin(-9999);
816 m_TRGECLTCArray[m_tcNum]->setRevoFAM(-9999);
817 m_TRGECLTCArray[m_tcNum]->setTCEnergy(0);
818 m_TRGECLTCArray[m_tcNum]->setChecksum(flag_checksum);
819
820 m_TRGECLEvtArray.appendNew();
821 m_evtNum = m_TRGECLEvtArray.getEntries() - 1;
822 m_TRGECLEvtArray[m_evtNum]->setEventId(n_basf2evt);
823 m_TRGECLEvtArray[m_evtNum]->setETM(etm_version);
824 m_TRGECLEvtArray[m_evtNum]->setL1Revo(-9999);
825 m_TRGECLEvtArray[m_evtNum]->setEvtTime(-9999);
826 m_TRGECLEvtArray[m_evtNum]->setEvtRevo(-9999);
827 m_TRGECLEvtArray[m_evtNum]->setEvtWin(-9999);
828 m_TRGECLEvtArray[m_evtNum]->setNTC(0);
829 for (int k = 0; k < 6; k++) {
830 evt_cl_theta[k] = 0;
831 evt_cl_phi[k] = 0;
832 evt_cl_time[k] = -9999;
833 evt_cl_energy[k] = 0;
834 evt_cl_1gev[k] = 0;
835 evt_cl_2gev[k] = 0;
836 evt_cl_bha[k] = 0;
837 }
838 m_TRGECLEvtArray[m_evtNum]->setCLTheta(evt_cl_theta);
839 m_TRGECLEvtArray[m_evtNum]->setCLPhi(evt_cl_phi);
840 m_TRGECLEvtArray[m_evtNum]->setCLTime(evt_cl_time);
841 m_TRGECLEvtArray[m_evtNum]->setCLEnergy(evt_cl_energy);
842 m_TRGECLEvtArray[m_evtNum]->setCLF1GeV(evt_cl_1gev);
843 m_TRGECLEvtArray[m_evtNum]->setCLF2GeV(evt_cl_2gev);
844 m_TRGECLEvtArray[m_evtNum]->setCLFBha(evt_cl_bha);
845 m_TRGECLEvtArray[m_evtNum]->setNCL(0);
846 m_TRGECLEvtArray[m_evtNum]->setLowMulti(0);
847 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaV(0);
848 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaS(0);
849 m_TRGECLEvtArray[m_evtNum]->setMumu(0);
850 m_TRGECLEvtArray[m_evtNum]->setPrescale(0);
851 m_TRGECLEvtArray[m_evtNum]->setICN(0);
852 m_TRGECLEvtArray[m_evtNum]->setICNOver(0);
853 m_TRGECLEvtArray[m_evtNum]->setEtotType(0);
854 m_TRGECLEvtArray[m_evtNum]->setEtot(0);
855 m_TRGECLEvtArray[m_evtNum]->setECLBST(0);
856 m_TRGECLEvtArray[m_evtNum]->set2DBhabha(0);
857 m_TRGECLEvtArray[m_evtNum]->setBhabhaType(0);
858 m_TRGECLEvtArray[m_evtNum]->setPhysics(0);
859 m_TRGECLEvtArray[m_evtNum]->setTimeType(0);
860 m_TRGECLEvtArray[m_evtNum]->setCheckSum(flag_checksum);
861 m_TRGECLEvtArray[m_evtNum]->setEvtExist(0);
862 m_TRGECLEvtArray[m_evtNum]->setTRGTYPE(trgtype);
863 m_TRGECLEvtArray[m_evtNum]->setEtotAll(0);
864 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMin(-9999);
865 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMax(-9999);
866 m_TRGECLEvtArray[m_evtNum]->setEvtTimeWin(0);
867 }
868
869 return;
870}
StoreArray< TRGECLUnpackerSumStore > m_TRGECLSumArray
ECL Trigger Unpacker Summary output.
StoreArray< TRGECLUnpackerStore > m_TRGECLTCArray
ECL Trigger Unpacker TC output.
StoreArray< TRGECLUnpackerEvtStore > m_TRGECLEvtArray
ECL Trigger Unpacker Event output.
StoreArray< TRGECLCluster > m_TRGECLClusterArray
ECL Trigger Cluster output.
class TrgEclDataBase;
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
int getTCIdFromPosition(int, int)
get TCId from phi and theta position(LSB = 1.4)
ROOT::Math::XYZVector getTCPosition(int)
TC position (cm)
int getTCPhiIdFromTCId(int)
get [TC Phi ID] from [TC ID]

◆ checkBuffer_v136()

void checkBuffer_v136 ( int *  rdat,
int  nnn 
)
virtual

Unpacker main function for upto version 136.

Definition at line 872 of file trgeclUnpackerModule.cc.

873{
874
875 int version_check = (rdat[0] >> 12) & 0xf;
876 if (version_check != 15) return;
877
878 // Checksum variable
879 unsigned char check_sum = (rdat[nnn - 1] >> 24) & 0xFF;
880 unsigned char data_sum = 0;
881 unsigned char kdat[4] = {0};
882 for (int j = nnn - 2; j > -1; j--) {
883 kdat[0] = rdat[j] & 0xff;
884 kdat[1] = (rdat[j] >> 8) & 0xff;
885 kdat[2] = (rdat[j] >> 16) & 0xff;
886 kdat[3] = (rdat[j] >> 24) & 0xff;
887 for (int k = 0; k < 4; k++) {
888 data_sum = data_sum + kdat[k];
889 }
890 }
891
892 int flag_checksum = 0;
893
894 if (check_sum == data_sum) {
895 flag_checksum = 0;
896 } else {
897 flag_checksum = 1;
898 }
899
900 // Information
901 int l1_revo = rdat[0] & 0x7ff;
902 int i = 0;
903 int window_num = 0;
904
905 // Summary
906 /* cppcheck-suppress variableScope */
907 int summary_data = 0;
908 /* cppcheck-suppress variableScope */
909 int summary_revo = 0;
910 /* cppcheck-suppress variableScope */
911 bool summary_trg = false;
912 /* cppcheck-suppress variableScope */
913 int data_win = 0;
914
915 // TC
916 /* cppcheck-suppress variableScope */
917 int ntc_win = 0;
918 bool tc_trg = false;
919 // TC info
920 int tc_id = 0;
921 int tc_t = 0;
922 int tc_e = 0;
923 int conv_tc_t = 0;
924 int win3_revo = -9999;
925
926 vector<unsigned> sum_data;
927 vector<vector<unsigned>> sum_info; //TODO can these be unsigned? (required for bit shifts shifts)
928
929 vector<int> tc_data;
930 vector<vector<int>> tc_info;
931 vector<vector<int>> tc_info_FE1;
932 vector<vector<int>> tc_info_FE2;
933 vector<vector<int>> tc_info_BE1;
934 vector<vector<int>> tc_info_BE2;
935
936 // Unpacking ---->
937 while (i < nnn - 2) {
938 summary_data = rdat[i + 1];
939 summary_trg = (summary_data >> 23) & 0x1;
940 summary_revo = (summary_data >> 16) & 0x7f;
941 ntc_win = summary_data & 0x3ff;
942 if (ntc_win == 0) {
943 tc_trg = false;
944 } else {
945 tc_trg = true;
946 }
947 data_win = window_num;
948 if (window_num == 3) win3_revo = summary_revo;
949
950 if (summary_trg == true) { // Summary on
951
952 sum_data.push_back(data_win);
953 sum_data.push_back(summary_revo);
954 for (int j = 0; j < 9; j++) {
955 sum_data.push_back(rdat[i + j + 2]);
956 }
957 sum_info.push_back(sum_data);
958 sum_data.clear();
959 i = i + 11;
960
961 if (tc_trg == true) { // summary on & TC on
962 for (int j = 0; j < ntc_win; j++) {
963 tc_id = (rdat[i + j] >> 20) & 0x3FF;
964 tc_t = (rdat[i + j] >> 12) & 0x7F;
965 tc_e = rdat[i + j] & 0xFFF;
966 conv_tc_t = (data_win - 3) * 128 + tc_t;
967
968 // TC vector
969 tc_data.push_back(tc_id);
970 tc_data.push_back(conv_tc_t);
971 tc_data.push_back(tc_e);
972 tc_data.push_back(data_win);
973 if (tc_id < 81) {
974 if (tc_id > 75) {
975 tc_info_FE1.push_back(tc_data);
976 } else {
977 tc_info_FE2.push_back(tc_data);
978 }
979 } else if (tc_id > 512) {
980 if (tc_id > 572) {
981 tc_info_BE1.push_back(tc_data);
982 } else {
983 tc_info_BE2.push_back(tc_data);
984 }
985 } else {
986 tc_info.push_back(tc_data);
987 }
988 tc_data.clear();
989 }
990 i = i + ntc_win - 1;
991 }
992
993 } else { // Summary off
994 if (tc_trg == true) { // summary off & TC on
995 for (int j = 0; j < ntc_win; j++) {
996 tc_id = (rdat[i + j + 2] >> 20) & 0x3FF;
997 tc_t = (rdat[i + j + 2] >> 12) & 0x7F;
998 conv_tc_t = (data_win - 3) * 128 + tc_t;
999 tc_e = rdat[i + j + 2] & 0xFFF;
1000
1001 // TC vector
1002 tc_data.push_back(tc_id);
1003 tc_data.push_back(conv_tc_t);
1004 tc_data.push_back(tc_e);
1005 tc_data.push_back(data_win);
1006 if (tc_id < 81) {
1007 if (tc_id > 75) {
1008 tc_info_FE1.push_back(tc_data);
1009 } else {
1010 tc_info_FE2.push_back(tc_data);
1011 }
1012 } else if (tc_id > 512) {
1013 if (tc_id > 572) {
1014 tc_info_BE1.push_back(tc_data);
1015 } else {
1016 tc_info_BE2.push_back(tc_data);
1017 }
1018 } else {
1019 tc_info.push_back(tc_data);
1020 }
1021 tc_data.clear();
1022 }
1023 i = i + ntc_win + 1;
1024 } else { // Summary off & TC off
1025 i = i + 1;
1026 }
1027 }
1028 window_num++;
1029 }
1030
1031 // <---- Unpacking
1032
1033 // Summary
1034 /* cppcheck-suppress variableScope */
1035 int sum_num = 0;
1036 /* cppcheck-suppress variableScope */
1037 int sum_revo = 0;
1038 int cl_theta[6] = {0};
1039 int cl_phi[6] = {0};
1040 int cl_time[6] = { -9999};
1041 int cl_energy[6] = {0};
1042 int ncl = 0;
1043 int low_multi = 0;
1044 int b2bhabha_v = 0;
1045 int b2bhabha_s = 0;
1046 int mumu = 0;
1047 int prescale = 0;
1048 int icn_over = 0;
1049 int bg_veto = 0;
1050 int icn = 0;
1051 int etot_type = 0;
1052 int etot = 0;
1053 int b1_type = 0;
1054 int b1bhabha = 0;
1055 int physics = 0;
1056 int time_type = 0;
1057 int time = 0;
1058 int ecl_bst = 0;
1059
1060 int m_sumNum = 0;
1061
1062 TrgEclDataBase database;
1063 TrgEclMapping mapping;
1064
1065 vector<int> cl_1d;
1066 vector<vector<int>> cl_2d;
1067
1068 vector<int> evt_1d_vector;
1069 vector<vector<int>> evt_2d_vector;
1070
1071 // Store Summary
1072 int sum_size = sum_info.size();
1073 if (sum_size != 0) {
1074 for (int j = 0; j < sum_size; j++) {
1075 sum_num = sum_info[j][0];
1076 sum_revo = sum_info[j][1];
1077 if (etm_version >= 128) {
1078 ecl_bst = (sum_info[j][2] >> 26) & 0x1;
1079 }
1080 if (etm_version > 119) {
1081 cl_theta[5] = (sum_info[j][2] >> 19) & 0x7f;
1082 cl_phi[5] = (sum_info[j][2] >> 11) & 0xff;
1083 cl_time[5] = (sum_info[j][2] >> 3) & 0xff;
1084 cl_energy[5] = ((sum_info[j][2] & 0x7) << 9) + ((sum_info[j][3] >> 23) & 0x1ff);
1085
1086 cl_theta[4] = (sum_info[j][3] >> 16) & 0x7f;
1087 cl_phi[4] = (sum_info[j][3] >> 8) & 0xff;
1088 cl_time[4] = (sum_info[j][3]) & 0xff;
1089 cl_energy[4] = (sum_info[j][4] >> 20) & 0xfff;
1090
1091 cl_theta[3] = (sum_info[j][4] >> 13) & 0x7f;
1092 cl_phi[3] = (sum_info[j][4] >> 5) & 0xff;
1093 cl_time[3] = ((sum_info[j][4] & 0x1f) << 3) + ((sum_info[j][5] >> 29) & 0x7);
1094 cl_energy[3] = (sum_info[j][5] >> 17) & 0xfff;
1095
1096 cl_theta[2] = (sum_info[j][5] >> 10) & 0x7f;
1097 cl_phi[2] = (sum_info[j][5] >> 2) & 0xff;
1098 cl_time[2] = ((sum_info[j][5] & 0x3) << 6) + ((sum_info[j][6] >> 26) & 0x3f);
1099 cl_energy[2] = (sum_info[j][6] >> 14) & 0xfff;
1100
1101 cl_theta[1] = (sum_info[j][6] >> 7) & 0x7f;
1102 cl_phi[1] = ((sum_info[j][6] & 0x7f) << 1) + ((sum_info[j][7] >> 31) & 0x1);
1103 cl_time[1] = (sum_info[j][7] >> 23) & 0xff;
1104 cl_energy[1] = (sum_info[j][7] >> 11) & 0xfff;
1105
1106 cl_theta[0] = (sum_info[j][7] >> 4) & 0x7f;
1107 cl_phi[0] = ((sum_info[j][7] & 0xf) << 4) + ((sum_info[j][8] >> 28) & 0xf);
1108 cl_time[0] = (sum_info[j][8] >> 20) & 0xff;
1109 cl_energy[0] = (sum_info[j][8] >> 8) & 0xfff;
1110
1111 ncl = (sum_info[j][8] >> 5) & 0x7;
1112
1113 prescale = (sum_info[j][8] >> 4) & 0x1;
1114 mumu = (sum_info[j][8] >> 3) & 0x1;
1115 b2bhabha_s = (sum_info[j][8] >> 2) & 0x1;
1116 if (etm_version >= 135) {
1117 low_multi = (((sum_info[j][2] >> 27) & 0x3) << 12) + ((sum_info[j][8] & 0x3) << 10) + ((sum_info[j][9] >> 22) & 0x3ff);
1118 } else {
1119 low_multi = ((sum_info[j][8] & 0x3) << 10) + ((sum_info[j][9] >> 22) & 0x3ff);
1120 }
1121 b2bhabha_v = (sum_info[j][9] >> 21) & 0x1;
1122 icn_over = (sum_info[j][9] >> 20) & 0x1;
1123 bg_veto = (sum_info[j][9] >> 17) & 0x7;
1124 icn = (sum_info[j][9] >> 10) & 0x7f;
1125 etot_type = (sum_info[j][9] >> 7) & 0x7;
1126 etot = ((sum_info[j][9] & 0x7f) << 6) + ((sum_info[j][10] >> 26) & 0x3f);
1127 b1_type = (sum_info[j][10] >> 12) & 0x3fff;
1128 b1bhabha = (sum_info[j][10] >> 11) & 0x1;
1129 physics = (sum_info[j][10] >> 10) & 0x1;
1130 time_type = (sum_info[j][10] >> 7) & 0x7;
1131 time = (sum_info[j][10]) & 0x7f;
1132 } else {
1133 cl_theta[5] = (sum_info[j][2] >> 24) & 0x7f;
1134 cl_phi[5] = (sum_info[j][2] >> 16) & 0xff;
1135 cl_time[5] = (sum_info[j][2] >> 8) & 0xff;
1136 cl_energy[5] = ((sum_info[j][2] & 0xff) << 4) + ((sum_info[j][3] >> 28) & 0xf);
1137
1138 cl_theta[4] = (sum_info[j][3] >> 21) & 0x7f;
1139 cl_phi[4] = (sum_info[j][3] >> 13) & 0xff;
1140 cl_time[4] = (sum_info[j][3] >> 5) & 0xff;
1141 cl_energy[4] = ((sum_info[j][3] & 0x1f) << 7) + ((sum_info[j][4] >> 25) & 0x7f);
1142
1143 cl_theta[3] = (sum_info[j][4] >> 18) & 0x7f;
1144 cl_phi[3] = (sum_info[j][4] >> 10) & 0xff;
1145 cl_time[3] = (sum_info[j][4] >> 2) & 0xff;
1146 cl_energy[3] = ((sum_info[j][4] & 0x3) << 10) + ((sum_info[j][5] >> 22) & 0x3ff);
1147
1148 cl_theta[2] = (sum_info[j][5] >> 15) & 0x7f;
1149 cl_phi[2] = (sum_info[j][5] >> 7) & 0xff;
1150 cl_time[2] = ((sum_info[j][5] & 0x7f) << 1) + ((sum_info[j][6] >> 31) & 0x1);
1151 cl_energy[2] = (sum_info[j][6] >> 19) & 0xfff;
1152
1153 cl_theta[1] = (sum_info[j][6] >> 12) & 0x7f;
1154 cl_phi[1] = (sum_info[j][6] >> 4) & 0xff;
1155 cl_time[1] = ((sum_info[j][6] & 0xf) << 4) + ((sum_info[j][7] >> 28) & 0xf);
1156 cl_energy[1] = (sum_info[j][7] >> 16) & 0xfff;
1157
1158 cl_theta[0] = (sum_info[j][7] >> 9) & 0x7f;
1159 cl_phi[0] = (sum_info[j][7] >> 1) & 0xff;
1160 cl_time[0] = ((sum_info[j][7] & 0x1) << 7) + ((sum_info[j][8] >> 25) & 0x7f);
1161 cl_energy[0] = (sum_info[j][8] >> 13) & 0xfff;
1162
1163 ncl = (sum_info[j][8] >> 10) & 0x7;
1164
1165 low_multi = ((sum_info[j][8] & 0x3ff) << 2) + ((sum_info[j][9] >> 30) & 0x3);
1166 b2bhabha_v = (sum_info[j][9] >> 29) & 0x1;
1167 icn_over = (sum_info[j][9] >> 28) & 0x1;
1168 bg_veto = (sum_info[j][9] >> 25) & 0x7;
1169 icn = (sum_info[j][9] >> 18) & 0x7f;
1170 etot_type = (sum_info[j][9] >> 15) & 0x7;
1171 etot = (sum_info[j][9] >> 2) & 0x1fff;
1172
1173 b1_type = ((sum_info[j][9] & 0x3) << 12) + ((sum_info[j][10] >> 20) & 0xfff);
1174 b1bhabha = (sum_info[j][10] >> 19) & 0x1;
1175 physics = (sum_info[j][10] >> 18) & 0x1;
1176 time_type = (sum_info[j][10] >> 15) & 0x7;
1177 time = (sum_info[j][10] >> 8) & 0x7f;
1178
1179 b2bhabha_s = 0;
1180 mumu = 0;
1181 prescale = 0;
1182 }
1183
1184 m_TRGECLSumArray.appendNew();
1185 m_sumNum = m_TRGECLSumArray.getEntries() - 1;
1186 m_TRGECLSumArray[m_sumNum]->setEventId(n_basf2evt);
1187 m_TRGECLSumArray[m_sumNum]->setSumNum(sum_num);
1188 m_TRGECLSumArray[m_sumNum]->setSumRevo(sum_revo);
1189 m_TRGECLSumArray[m_sumNum]->setCLTheta(cl_theta);
1190 m_TRGECLSumArray[m_sumNum]->setCLPhi(cl_phi);
1191 m_TRGECLSumArray[m_sumNum]->setCLTime(cl_time);
1192 m_TRGECLSumArray[m_sumNum]->setCLEnergy(cl_energy);
1193 m_TRGECLSumArray[m_sumNum]->setNCL(ncl);
1194 m_TRGECLSumArray[m_sumNum]->setICN(icn);
1195 m_TRGECLSumArray[m_sumNum]->setICNOver(icn_over);
1196 m_TRGECLSumArray[m_sumNum]->setLowMulti(low_multi);
1197 m_TRGECLSumArray[m_sumNum]->set3DBhabhaV(b2bhabha_v);
1198 m_TRGECLSumArray[m_sumNum]->set3DBhabhaS(b2bhabha_s);
1199 m_TRGECLSumArray[m_sumNum]->setMumu(mumu);
1200 m_TRGECLSumArray[m_sumNum]->setPrescale(prescale);
1201 m_TRGECLSumArray[m_sumNum]->set2DBhabha(b1bhabha);
1202 m_TRGECLSumArray[m_sumNum]->setBhabhaType(b1_type);
1203 m_TRGECLSumArray[m_sumNum]->setPhysics(physics);
1204 m_TRGECLSumArray[m_sumNum]->setBG(bg_veto);
1205 m_TRGECLSumArray[m_sumNum]->setEtot(etot);
1206 m_TRGECLSumArray[m_sumNum]->setEtotType(etot_type);
1207 m_TRGECLSumArray[m_sumNum]->setECLBST(ecl_bst);
1208 m_TRGECLSumArray[m_sumNum]->setTime(time);
1209 m_TRGECLSumArray[m_sumNum]->setTimeType(time_type);
1210
1211 for (int k = 0; k < 6; k++) {
1212 cl_1d.push_back(cl_theta[k]);
1213 cl_1d.push_back(cl_phi[k]);
1214 cl_1d.push_back(cl_time[k]);
1215 cl_1d.push_back(cl_energy[k]);
1216 cl_2d.push_back(cl_1d);
1217 cl_1d.clear();
1218 }
1219 sort(cl_2d.begin(), cl_2d.end(),
1220 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[3] > aa2[3];});
1221
1222 evt_1d_vector.push_back(abs(sum_num - 3));
1223 evt_1d_vector.push_back(sum_revo);
1224 evt_1d_vector.push_back(sum_num);
1225 evt_1d_vector.push_back(time);
1226 for (int k = 0; k < 6; k++) {
1227 evt_1d_vector.push_back(cl_2d[k][0]);
1228 evt_1d_vector.push_back(cl_2d[k][1]);
1229 evt_1d_vector.push_back(cl_2d[k][2]);
1230 evt_1d_vector.push_back(cl_2d[k][3]);
1231 }
1232 cl_2d.clear();
1233 evt_1d_vector.push_back(ncl);
1234 evt_1d_vector.push_back(low_multi);
1235 evt_1d_vector.push_back(b2bhabha_v);
1236 evt_1d_vector.push_back(b2bhabha_s);
1237 evt_1d_vector.push_back(mumu);
1238 evt_1d_vector.push_back(prescale);
1239 evt_1d_vector.push_back(icn);
1240 evt_1d_vector.push_back(icn_over);
1241 evt_1d_vector.push_back(etot_type);
1242 evt_1d_vector.push_back(etot);
1243 evt_1d_vector.push_back(ecl_bst);
1244 evt_1d_vector.push_back(b1_type);
1245 evt_1d_vector.push_back(b1bhabha);
1246 evt_1d_vector.push_back(physics);
1247 evt_1d_vector.push_back(time_type);
1248 evt_2d_vector.push_back(evt_1d_vector);
1249 evt_1d_vector.clear();
1250 }
1251 } else {
1252
1253 for (int k = 0; k < 6; k++) {
1254 cl_theta[k] = 0;
1255 cl_phi[k] = 0;
1256 cl_time[k] = -9999;
1257 cl_energy[k] = 0;
1258 }
1259 ncl = 0;
1260 low_multi = 0;
1261 b2bhabha_v = 0;
1262 b2bhabha_s = 0;
1263 mumu = 0;
1264 prescale = 0;
1265 icn_over = 0;
1266 bg_veto = 0;
1267 icn = 0;
1268 etot_type = 0;
1269 etot = 0;
1270 ecl_bst = 0;
1271 b1_type = 0;
1272 b1bhabha = 0;
1273 physics = 0;
1274 time_type = 0;
1275 time = -9999;
1276
1277 m_TRGECLSumArray.appendNew();
1278 m_sumNum = m_TRGECLSumArray.getEntries() - 1;
1279 m_TRGECLSumArray[m_sumNum]->setEventId(n_basf2evt);
1280 m_TRGECLSumArray[m_sumNum]->setSumNum(0);
1281 m_TRGECLSumArray[m_sumNum]->setCLTheta(cl_theta);
1282 m_TRGECLSumArray[m_sumNum]->setCLPhi(cl_phi);
1283 m_TRGECLSumArray[m_sumNum]->setCLTime(cl_time);
1284 m_TRGECLSumArray[m_sumNum]->setCLEnergy(cl_energy);
1285 m_TRGECLSumArray[m_sumNum]->setNCL(ncl);
1286 m_TRGECLSumArray[m_sumNum]->setICN(icn);
1287 m_TRGECLSumArray[m_sumNum]->setICNOver(icn_over);
1288 m_TRGECLSumArray[m_sumNum]->setLowMulti(low_multi);
1289 m_TRGECLSumArray[m_sumNum]->set3DBhabhaV(b2bhabha_v);
1290 m_TRGECLSumArray[m_sumNum]->set3DBhabhaS(b2bhabha_s);
1291 m_TRGECLSumArray[m_sumNum]->setMumu(mumu);
1292 m_TRGECLSumArray[m_sumNum]->setPrescale(prescale);
1293 m_TRGECLSumArray[m_sumNum]->set2DBhabha(b1bhabha);
1294 m_TRGECLSumArray[m_sumNum]->setBhabhaType(b1_type);
1295 m_TRGECLSumArray[m_sumNum]->setPhysics(physics);
1296 m_TRGECLSumArray[m_sumNum]->setBG(bg_veto);
1297 m_TRGECLSumArray[m_sumNum]->setEtot(etot);
1298 m_TRGECLSumArray[m_sumNum]->setEtotType(etot_type);
1299 m_TRGECLSumArray[m_sumNum]->setECLBST(ecl_bst);
1300 m_TRGECLSumArray[m_sumNum]->setTime(time);
1301 m_TRGECLSumArray[m_sumNum]->setTimeType(time_type);
1302 }
1303
1304 // TC & TRG
1305 tc_info.insert(tc_info.end(), tc_info_FE1.begin(), tc_info_FE1.end());
1306 tc_info.insert(tc_info.end(), tc_info_FE2.begin(), tc_info_FE2.end());
1307 tc_info.insert(tc_info.end(), tc_info_BE1.begin(), tc_info_BE1.end());
1308 tc_info.insert(tc_info.end(), tc_info_BE2.begin(), tc_info_BE2.end());
1309
1310 int m_evtNum = 0;
1311
1312 int m_tcNum = 0;
1313 /* cppcheck-suppress variableScope */
1314 int m_tcid = 0;
1315 /* cppcheck-suppress variableScope */
1316 int m_time = -9999;
1317 /* cppcheck-suppress variableScope */
1318 int m_energy = 0;
1319 /* cppcheck-suppress variableScope */
1320 int m_win = 0;
1321 /* cppcheck-suppress variableScope */
1322 int m_revo = 0;
1323 /* cppcheck-suppress variableScope */
1324 int m_caltime = -9999;
1325
1326 int tot_ntc = tc_info.size();
1327 /* cppcheck-suppress variableScope */
1328 int evt_ntc = 0;
1329 /* cppcheck-suppress variableScope */
1330 int evt_revo = -9999;
1331 /* cppcheck-suppress variableScope */
1332 int evt_win = 0;
1333 /* cppcheck-suppress variableScope */
1334 int evt_timing = -9999;
1335 int evt_cl_theta[6] = {0};
1336 int evt_cl_phi[6] = {0};
1337 int evt_cl_time[6] = { -9999};
1338 int evt_cl_energy[6] = {0};
1339 /* cppcheck-suppress variableScope */
1340 int evt_ncl = 0;
1341 /* cppcheck-suppress variableScope */
1342 int evt_low_multi = 0;
1343 /* cppcheck-suppress variableScope */
1344 int evt_b2bhabha_v = 0;
1345 /* cppcheck-suppress variableScope */
1346 int evt_b2bhabha_s = 0;
1347 /* cppcheck-suppress variableScope */
1348 int evt_mumu = 0;
1349 /* cppcheck-suppress variableScope */
1350 int evt_prescale = 0;
1351 /* cppcheck-suppress variableScope */
1352 int evt_icn = 0;
1353 /* cppcheck-suppress variableScope */
1354 int evt_icn_over = 0;
1355 /* cppcheck-suppress variableScope */
1356 int evt_etot_type = 0;
1357 /* cppcheck-suppress variableScope */
1358 int evt_etot = 0;
1359 /* cppcheck-suppress variableScope */
1360 int evt_ecl_bst = 0;
1361 /* cppcheck-suppress variableScope */
1362 int evt_b1_type = 0;
1363 /* cppcheck-suppress variableScope */
1364 int evt_b1bhabha = 0;
1365 /* cppcheck-suppress variableScope */
1366 int evt_physics = 0;
1367 /* cppcheck-suppress variableScope */
1368 int evt_time_type = 0;
1369 /* cppcheck-suppress variableScope */
1370 int evt_etot_all = 0;
1371 /* cppcheck-suppress variableScope */
1372 int evt_time_min = 0;
1373 /* cppcheck-suppress variableScope */
1374 int evt_time_max = 0;
1375 /* cppcheck-suppress variableScope */
1376 int evt_time_win = 0;
1377 /* cppcheck-suppress variableScope */
1378 int etot_i = 0;
1379 /* cppcheck-suppress variableScope */
1380 int etot_c = 0;
1381 /* cppcheck-suppress variableScope */
1382 int etot_f = 0;
1383 /* cppcheck-suppress variableScope */
1384 int cl_tcid = 0;
1385 /* cppcheck-suppress variableScope */
1386 int cl_thetaid = 0;
1387 /* cppcheck-suppress variableScope */
1388 int cl_phiid = 0;
1389 /* cppcheck-suppress variableScope */
1390 int m_clNum = 0;
1391
1392
1393 int evt_v_size = evt_2d_vector.size();
1394 if (evt_v_size != 0) {
1395 // Sort window : 3 => 4 => 2 => 5 => 1 => 6 => 7
1396 sort(evt_2d_vector.begin(), evt_2d_vector.end(),
1397 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[0] < aa2[0];});
1398 }
1399
1400 if (tot_ntc != 0 && flag_checksum == 0 && nnn > 7) {
1401 if (evt_v_size == 0) {
1402 // Find most energetic TC timing
1403 sort(tc_info.begin(), tc_info.end(),
1404 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[2] > aa2[2];});
1405 evt_revo = win3_revo;
1406 evt_win = tc_info[0][3];
1407 evt_timing = tc_info[0][1];
1408 for (int k = 0; k < 6; k++) {
1409 evt_cl_theta[k] = 0;
1410 evt_cl_phi[k] = 0;
1411 evt_cl_time[k] = 0;
1412 evt_cl_energy[k] = 0;
1413 }
1414 evt_ncl = 0;
1415 evt_low_multi = 0;
1416 evt_b2bhabha_v = 0;
1417 evt_b2bhabha_s = 0;
1418 evt_mumu = 0;
1419 evt_prescale = 0;
1420 evt_icn = 0;
1421 evt_icn_over = 0;
1422 evt_etot_type = 0;
1423 evt_etot = 0;
1424 evt_ecl_bst = 0;
1425 evt_b1_type = 0;
1426 evt_b1bhabha = 0;
1427 evt_physics = 0;
1428 evt_time_type = 0;
1429 } else {
1430 evt_revo = evt_2d_vector[0][1];
1431 evt_win = evt_2d_vector[0][2];
1432 evt_timing = evt_2d_vector[0][3];
1433 for (int k = 0; k < 6; k++) {
1434 evt_cl_theta[k] = evt_2d_vector[0][4 + k * 4];
1435 evt_cl_phi[k] = evt_2d_vector[0][5 + k * 4];
1436 evt_cl_time[k] = evt_2d_vector[0][6 + k * 4];
1437 evt_cl_energy[k] = evt_2d_vector[0][7 + k * 4];
1438 }
1439 evt_ncl = evt_2d_vector[0][28];
1440 evt_low_multi = evt_2d_vector[0][29];
1441 evt_b2bhabha_v = evt_2d_vector[0][30];
1442 evt_b2bhabha_s = evt_2d_vector[0][31];
1443 evt_mumu = evt_2d_vector[0][32];
1444 evt_prescale = evt_2d_vector[0][33];
1445 evt_icn = evt_2d_vector[0][34];
1446 evt_icn_over = evt_2d_vector[0][35];
1447 evt_etot_type = evt_2d_vector[0][36];
1448 evt_etot = evt_2d_vector[0][37];
1449 evt_ecl_bst = evt_2d_vector[0][38];
1450 evt_b1_type = evt_2d_vector[0][39];
1451 evt_b1bhabha = evt_2d_vector[0][40];
1452 evt_physics = evt_2d_vector[0][41];
1453 evt_time_type = evt_2d_vector[0][42];
1454 }
1455 // Sort by TC number
1456 sort(tc_info.begin(), tc_info.end(),
1457 [](const vector<int>& aa1, const vector<int>& aa2) {return aa1[0] < aa2[0];});
1458
1459 for (int ii = 0; ii < tot_ntc; ii++) {
1460 m_tcid = tc_info[ii][0];
1461 m_time = tc_info[ii][1];
1462 m_energy = tc_info[ii][2];
1463 m_win = tc_info[ii][3];
1464 m_revo = win3_revo;
1465 m_caltime = m_time - ((evt_win - 3) * 128 + evt_timing);
1466 m_TRGECLTCArray.appendNew();
1467 m_tcNum = m_TRGECLTCArray.getEntries() - 1;
1468 m_TRGECLTCArray[m_tcNum]->setEventId(n_basf2evt);
1469 m_TRGECLTCArray[m_tcNum]->setTCId(m_tcid);
1470 m_TRGECLTCArray[m_tcNum]->setTCTime(m_time);
1471 m_TRGECLTCArray[m_tcNum]->setTCCALTime(m_caltime);
1472 m_TRGECLTCArray[m_tcNum]->setHitWin(m_win);
1473 m_TRGECLTCArray[m_tcNum]->setRevoFAM(m_revo);
1474 m_TRGECLTCArray[m_tcNum]->setTCEnergy(m_energy);
1475 m_TRGECLTCArray[m_tcNum]->setChecksum(flag_checksum);
1476
1477 if (m_win == evt_win || m_win == evt_win + 1) evt_ntc++;
1478 if (m_win == evt_win - 1) {
1479 etot_i += m_energy;
1480 }
1481 if (m_win == evt_win) {
1482 etot_c += m_energy;
1483 }
1484 if (m_win == evt_win + 1) {
1485 etot_f += m_energy;
1486 }
1487 }
1488
1489 if (etot_i == 0 && etot_f == 0) {
1490 evt_etot_all = etot_c;
1491 evt_time_min = - evt_timing;
1492 evt_time_max = 256 - evt_timing;
1493 evt_time_win = 1;
1494 } else if (etot_i >= etot_f) {
1495 evt_etot_all = etot_c + etot_i;
1496 evt_time_min = -128 - evt_timing;
1497 evt_time_max = 128 - evt_timing;
1498 evt_time_win = -1;
1499 } else {
1500 evt_etot_all = etot_c + etot_f;
1501 evt_time_min = - evt_timing;
1502 evt_time_max = 256 - evt_timing;
1503 evt_time_win = 1;
1504 }
1505
1506 for (int icluster = 0; icluster < 6; icluster++) {
1507 if (evt_cl_energy[icluster] == 0 || evt_cl_theta[icluster] == 0 || evt_cl_phi[icluster] == 0) {continue;}
1508 cl_tcid = mapping.getTCIdFromPosition(evt_cl_theta[icluster], evt_cl_phi[icluster]);
1509 if (cl_tcid == 0) {continue;}
1510 cl_thetaid = mapping.getTCThetaIdFromTCId(cl_tcid);
1511 cl_phiid = mapping.getTCPhiIdFromTCId(cl_tcid);
1512
1513 m_TRGECLClusterArray.appendNew();
1514 m_clNum = m_TRGECLClusterArray.getEntries() - 1;
1515 m_TRGECLClusterArray[m_clNum]->setEventId(n_basf2evt);
1516 m_TRGECLClusterArray[m_clNum]->setClusterId(icluster);
1517 m_TRGECLClusterArray[m_clNum]->setEventRevo(evt_revo);
1518
1519 m_TRGECLClusterArray[m_clNum]->setMaxTCId(cl_tcid); // center of Cluster
1520 m_TRGECLClusterArray[m_clNum]->setMaxThetaId(cl_thetaid);
1521 m_TRGECLClusterArray[m_clNum]->setMaxPhiId(cl_phiid);
1522 m_TRGECLClusterArray[m_clNum]->setClusterId(icluster);
1523 m_TRGECLClusterArray[m_clNum]->setEnergyDep((double)evt_cl_energy[icluster] * 5.25); // MeV
1524 double cl_timing = -1000;
1525 for (int i_tc = 0; i_tc < tot_ntc; i_tc++) {
1526 if (cl_tcid == tc_info[i_tc][0]) {
1527 cl_timing = tc_info[i_tc][1];
1528 break;
1529 }
1530 }
1531 m_TRGECLClusterArray[m_clNum]->setTimeAve(cl_timing);
1532 m_TRGECLClusterArray[m_clNum]->setPositionX(mapping.getTCPosition(cl_tcid).X());
1533 m_TRGECLClusterArray[m_clNum]->setPositionY(mapping.getTCPosition(cl_tcid).Y());
1534 m_TRGECLClusterArray[m_clNum]->setPositionZ(mapping.getTCPosition(cl_tcid).Z());
1535 }
1536 m_TRGECLEvtArray.appendNew();
1537 m_evtNum = m_TRGECLEvtArray.getEntries() - 1;
1538 m_TRGECLEvtArray[m_evtNum]->setEventId(n_basf2evt);
1539 m_TRGECLEvtArray[m_evtNum]->setETM(etm_version);
1540 m_TRGECLEvtArray[m_evtNum]->setL1Revo(l1_revo);
1541 m_TRGECLEvtArray[m_evtNum]->setEvtRevo(evt_revo);
1542 m_TRGECLEvtArray[m_evtNum]->setEvtWin(evt_win);
1543 m_TRGECLEvtArray[m_evtNum]->setEvtTime(evt_timing);
1544 m_TRGECLEvtArray[m_evtNum]->setNTC(evt_ntc);
1545 m_TRGECLEvtArray[m_evtNum]->setCLTheta(evt_cl_theta);
1546 m_TRGECLEvtArray[m_evtNum]->setCLPhi(evt_cl_phi);
1547 m_TRGECLEvtArray[m_evtNum]->setCLTime(evt_cl_time);
1548 m_TRGECLEvtArray[m_evtNum]->setCLEnergy(evt_cl_energy);
1549 m_TRGECLEvtArray[m_evtNum]->setNCL(evt_ncl);
1550 m_TRGECLEvtArray[m_evtNum]->setLowMulti(evt_low_multi);
1551 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaV(evt_b2bhabha_v);
1552 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaS(evt_b2bhabha_s);
1553 m_TRGECLEvtArray[m_evtNum]->setMumu(evt_mumu);
1554 m_TRGECLEvtArray[m_evtNum]->setPrescale(evt_prescale);
1555 m_TRGECLEvtArray[m_evtNum]->setICN(evt_icn);
1556 m_TRGECLEvtArray[m_evtNum]->setICNOver(evt_icn_over);
1557 m_TRGECLEvtArray[m_evtNum]->setEtotType(evt_etot_type);
1558 m_TRGECLEvtArray[m_evtNum]->setEtot(evt_etot);
1559 m_TRGECLEvtArray[m_evtNum]->setECLBST(evt_ecl_bst);
1560 m_TRGECLEvtArray[m_evtNum]->set2DBhabha(evt_b1bhabha);
1561 m_TRGECLEvtArray[m_evtNum]->setBhabhaType(evt_b1_type);
1562 m_TRGECLEvtArray[m_evtNum]->setPhysics(evt_physics);
1563 m_TRGECLEvtArray[m_evtNum]->setTimeType(evt_time_type);
1564 m_TRGECLEvtArray[m_evtNum]->setCheckSum(flag_checksum);
1565 m_TRGECLEvtArray[m_evtNum]->setEvtExist(1);
1566 m_TRGECLEvtArray[m_evtNum]->setTRGTYPE(trgtype);
1567 m_TRGECLEvtArray[m_evtNum]->setEtotAll(evt_etot_all);
1568 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMin(evt_time_min);
1569 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMax(evt_time_max);
1570 m_TRGECLEvtArray[m_evtNum]->setEvtTimeWin(evt_time_win);
1571 } else {
1572 m_TRGECLTCArray.appendNew();
1573 m_tcNum = m_TRGECLTCArray.getEntries() - 1;
1574 m_TRGECLTCArray[m_tcNum]->setEventId(n_basf2evt);
1575 m_TRGECLTCArray[m_tcNum]->setTCId(0);
1576 m_TRGECLTCArray[m_tcNum]->setTCTime(-9999);
1577 m_TRGECLTCArray[m_tcNum]->setTCCALTime(-9999);
1578 m_TRGECLTCArray[m_tcNum]->setHitWin(-9999);
1579 m_TRGECLTCArray[m_tcNum]->setRevoFAM(-9999);
1580 m_TRGECLTCArray[m_tcNum]->setTCEnergy(0);
1581 m_TRGECLTCArray[m_tcNum]->setChecksum(flag_checksum);
1582
1583 m_TRGECLEvtArray.appendNew();
1584 m_evtNum = m_TRGECLEvtArray.getEntries() - 1;
1585 m_TRGECLEvtArray[m_evtNum]->setEventId(n_basf2evt);
1586 m_TRGECLEvtArray[m_evtNum]->setETM(etm_version);
1587 m_TRGECLEvtArray[m_evtNum]->setL1Revo(-9999);
1588 m_TRGECLEvtArray[m_evtNum]->setEvtTime(-9999);
1589 m_TRGECLEvtArray[m_evtNum]->setEvtRevo(-9999);
1590 m_TRGECLEvtArray[m_evtNum]->setEvtWin(-9999);
1591 m_TRGECLEvtArray[m_evtNum]->setNTC(0);
1592 for (int k = 0; k < 6; k++) {
1593 evt_cl_theta[k] = 0;
1594 evt_cl_phi[k] = 0;
1595 evt_cl_time[k] = -9999;
1596 evt_cl_energy[k] = 0;
1597 }
1598 m_TRGECLEvtArray[m_evtNum]->setCLTheta(evt_cl_theta);
1599 m_TRGECLEvtArray[m_evtNum]->setCLPhi(evt_cl_phi);
1600 m_TRGECLEvtArray[m_evtNum]->setCLTime(evt_cl_time);
1601 m_TRGECLEvtArray[m_evtNum]->setCLEnergy(evt_cl_energy);
1602 m_TRGECLEvtArray[m_evtNum]->setNCL(0);
1603 m_TRGECLEvtArray[m_evtNum]->setLowMulti(0);
1604 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaV(0);
1605 m_TRGECLEvtArray[m_evtNum]->set3DBhabhaS(0);
1606 m_TRGECLEvtArray[m_evtNum]->setMumu(0);
1607 m_TRGECLEvtArray[m_evtNum]->setPrescale(0);
1608 m_TRGECLEvtArray[m_evtNum]->setICN(0);
1609 m_TRGECLEvtArray[m_evtNum]->setICNOver(0);
1610 m_TRGECLEvtArray[m_evtNum]->setEtotType(0);
1611 m_TRGECLEvtArray[m_evtNum]->setEtot(0);
1612 m_TRGECLEvtArray[m_evtNum]->setECLBST(0);
1613 m_TRGECLEvtArray[m_evtNum]->set2DBhabha(0);
1614 m_TRGECLEvtArray[m_evtNum]->setBhabhaType(0);
1615 m_TRGECLEvtArray[m_evtNum]->setPhysics(0);
1616 m_TRGECLEvtArray[m_evtNum]->setTimeType(0);
1617 m_TRGECLEvtArray[m_evtNum]->setCheckSum(flag_checksum);
1618 m_TRGECLEvtArray[m_evtNum]->setEvtExist(0);
1619 m_TRGECLEvtArray[m_evtNum]->setTRGTYPE(trgtype);
1620 m_TRGECLEvtArray[m_evtNum]->setEtotAll(0);
1621 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMin(-9999);
1622 m_TRGECLEvtArray[m_evtNum]->setEvtTimeMax(-9999);
1623 m_TRGECLEvtArray[m_evtNum]->setEvtTimeWin(0);
1624 }
1625
1626 return;
1627}

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
182 newModule->m_moduleParamList.setParameters(getParamList());
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
const ModuleParamList & getParamList() const
Return module param list.
Definition: Module.h:363
const std::string & getName() const
Returns the name of the module.
Definition: Module.h:187
const std::string & getType() const
Returns the type of the module (i.e.
Definition: Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition: Module.h:512
LogConfig m_logConfig
The log system configuration of the module.
Definition: Module.h:514
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition: Module.h:521
std::string m_package
Package this module is found in (may be empty).
Definition: Module.h:510
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:43

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

426{ beginRun(); }
virtual void beginRun()
Called when entering a new run.
Definition: Module.h:147

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

439{ endRun(); }
virtual void endRun()
This method is called if the current run ends.
Definition: Module.h:166

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

432{ event(); }
virtual void event()
This method is the core of the module.
Definition: Module.h:157

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

420{ initialize(); }
virtual void initialize()
Initialize the Module.
Definition: Module.h:109

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

445{ terminate(); }
virtual void terminate()
This method is called at the end of the event processing.
Definition: Module.h:176

◆ endRun()

void endRun ( void  )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 53 of file trgeclUnpackerModule.cc.

53{}

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition: Module.h:519
bool m_hasReturnValue
True, if the return value is set.
Definition: Module.h:518

◆ event()

void event ( void  )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 54 of file trgeclUnpackerModule.cc.

55{
56
57 StoreArray<RawTRG> raw_trgarray;
58
59 for (int i = 0; i < raw_trgarray.getEntries(); i++) { // # of readout boards
60 iFiness = i;
61 for (int j = 0; j < raw_trgarray[i]->GetNumEntries(); j++) { // Basically 1 entry
62 nodeid = raw_trgarray[i]->GetNodeID(j);
63 trgtype = raw_trgarray[i]->GetTRGType(j);
64 n_basf2evt = raw_trgarray[i]->GetEveNo(j);
65 if (nodeid == 0x13000001) {
66 for (int ch = 0; ch < raw_trgarray[i]->GetMaxNumOfCh(j); ch++) { // ch in a readout board
67 nwords = raw_trgarray[i]->GetDetectorNwords(j, ch);
68 if (nwords == 0) {
69 continue; // This channel might be masked.
70 } else if (nwords < 9) {
71 B2ERROR("Consistecy error in unpacker.");
72 B2ERROR("data length " << nwords << " nWord " << nwords);
73 B2ERROR("Node ID " << nodeid << ", Finness ID " << iFiness);
74 continue;
75 }
76 readCOPPEREvent(raw_trgarray[i], j, nwords, ch);
77 }
78 }
79 }
80 }
81
82 // Count number of trigger cells in each ECL region for EventLevelClusteringInfo
83 uint16_t nTCsPerRegion[3] = {};
84 const int firstBarrelId = 81; // First TCId in the barrel
85 const int lastBarrelId = 512; // Last TCId in the barrel
86 for (auto& trgeclhit : m_TRGECLTCArray) {
87 const int tcId = trgeclhit.getTCId();
88 if (tcId < firstBarrelId) {
89 nTCsPerRegion[0]++;
90 } else if (tcId > lastBarrelId) {
91 nTCsPerRegion[2]++;
92 } else {
93 nTCsPerRegion[1]++;
94 }
95 }
96
97 // Store
99 m_eventLevelClusteringInfo->setNECLTriggerCellsFWD(nTCsPerRegion[0]);
100 m_eventLevelClusteringInfo->setNECLTriggerCellsBarrel(nTCsPerRegion[1]);
101 m_eventLevelClusteringInfo->setNECLTriggerCellsBWD(nTCsPerRegion[2]);
102
103}
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
virtual void readCOPPEREvent(RawTRG *, int, int, int)
Read data from TRG copper.
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
EventLevelClusteringInfo.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional pathes */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">"
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "=="
@ c_ST
Smaller than: "<"
Base class for Modules.
Definition: Module.h:72
LogConfig & getLogConfig()
Returns the log system configuration.
Definition: Module.h:225
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition: Module.cc:79
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition: Module.cc:90
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
void setLogConfig(const LogConfig &logConfig)
Set the log system configuration.
Definition: Module.h:230
const std::string & getDescription() const
Returns the description of the module.
Definition: Module.h:202
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition: Module.cc:85
bool hasCondition() const
Returns true if at least one condition was set for the module.
Definition: Module.h:311
const std::string & getPackage() const
Returns the package this module is in.
Definition: Module.h:197
void setName(const std::string &name)
Set the name of the module.
Definition: Module.h:214
bool hasProperties(unsigned int propertyFlags) const
Returns true if all specified property flags are available in this module.
Definition: Module.cc:160
std::string getPathString() const override
return the module name.
Definition: Module.cc:192

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 314 of file Module.h.

315 {
316 if (m_conditions.empty()) {
317 return nullptr;
318 } else {
319 return &m_conditions.front();
320 }
321 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).


Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

202{return m_description;}
std::string m_description
The description of the module.
Definition: Module.h:511

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool  outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

135 {
136 return std::vector<std::string>();
137 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

506{ return std::list<ModulePtr>(); }

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

187{return m_name;}
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition: Module.h:508

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition: Module.h:516

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition: Module.h:509

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 311 of file Module.h.

311{ return not m_conditions.empty(); };

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string &  expression,
const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void  )
overridevirtual

Initilizes TRGECLUnpackerModuel.

Reimplemented from Module.

Definition at line 42 of file trgeclUnpackerModule.cc.

43{
44 m_TRGECLSumArray.registerInDataStore();
45 m_TRGECLTCArray.registerInDataStore();
46 m_TRGECLEvtArray.registerInDataStore();
47 m_TRGECLClusterArray.registerInDataStore();
48 m_eventLevelClusteringInfo.registerInDataStore();
49
50}

◆ readCOPPEREvent()

void readCOPPEREvent ( RawTRG raw_copper,
int  i,
int  nnn,
int  ch 
)
virtual

Read data from TRG copper.

Definition at line 105 of file trgeclUnpackerModule.cc.

106{
107 /* cppcheck-suppress variableScope */
108 int* rdat;
109 if (raw_copper->GetDetectorNwords(i, ch) > 0) {
110 rdat = raw_copper->GetDetectorBuffer(i, ch);
111 etm_version = ((rdat[0] >> 16) & 0xffff);
112 if (etm_version > 136) {
113 checkBuffer(rdat, nnn);
114 } else {
115 checkBuffer_v136(rdat, nnn);
116 }
117 }
118}
virtual void checkBuffer_v136(int *, int)
Unpacker main function for upto version 136.
virtual void checkBuffer(int *, int)
Unpacker main function.
int GetDetectorNwords(int n, int finesse_num)
get Detector buffer length
Definition: RawCOPPER.h:657
int * GetDetectorBuffer(int n, int finesse_num)
get Detector buffer
Definition: RawCOPPER.h:681

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string &  description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition: LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition: LogConfig.cc:25

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string &  name,
const boost::python::object &  pyObj 
)
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
Class for logging debug, info and error messages.
Definition: LogSystem.h:46
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition: LogSystem.h:191
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict &  dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition: Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setType()

void setType ( const std::string &  type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ terminate()

void terminate ( void  )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 38 of file trgeclUnpackerModule.cc.

39{
40}

◆ version()

string version ( ) const

returns version of TRGECLUnpackerModule.

Definition at line 20 of file trgeclUnpackerModule.cc.

21{
22 return string("4.02");
23}

Member Data Documentation

◆ etm_version

int etm_version = 0
protected

ETM Version.

Definition at line 77 of file trgeclUnpackerModule.h.

◆ iFiness

int iFiness = 0
protected

Finess.

Definition at line 83 of file trgeclUnpackerModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_eventLevelClusteringInfo

StoreObjPtr<EventLevelClusteringInfo> m_eventLevelClusteringInfo
private

EventLevelClusteringInfo.

Definition at line 98 of file trgeclUnpackerModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 508 of file Module.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 510 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 512 of file Module.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_TRGECLClusterArray

StoreArray<TRGECLCluster> m_TRGECLClusterArray
private

ECL Trigger Cluster output.

Definition at line 95 of file trgeclUnpackerModule.h.

◆ m_TRGECLEvtArray

StoreArray<TRGECLUnpackerEvtStore> m_TRGECLEvtArray
private

ECL Trigger Unpacker Event output.

Definition at line 93 of file trgeclUnpackerModule.h.

◆ m_TRGECLSumArray

StoreArray<TRGECLUnpackerSumStore> m_TRGECLSumArray
private

ECL Trigger Unpacker Summary output.

Definition at line 91 of file trgeclUnpackerModule.h.

◆ m_TRGECLTCArray

StoreArray<TRGECLUnpackerStore> m_TRGECLTCArray
private

ECL Trigger Unpacker TC output.

Definition at line 89 of file trgeclUnpackerModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ n_basf2evt

int n_basf2evt
protected

Event number.

Definition at line 75 of file trgeclUnpackerModule.h.

◆ nodeid

unsigned int nodeid = 0
protected

Node Id.

Definition at line 79 of file trgeclUnpackerModule.h.

◆ nwords

int nwords = 0
protected

N Word.

Definition at line 81 of file trgeclUnpackerModule.h.

◆ trgtype

int trgtype = 0
protected

Trigger Type.

Definition at line 85 of file trgeclUnpackerModule.h.


The documentation for this class was generated from the following files: