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

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

◆ 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: