Belle II Software prerelease-10-00-00a
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
 Initializes 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,
80 c_ParallelProcessingCertified = 4,
81 c_HistogramManager = 8,
82 c_InternalSerializer = 16,
83 c_TerminateInAllProcesses = 32,
84 c_DontCollectStatistics = 64,
85 };
@ c_Output
Output Process.
Definition ProcHelper.h:19
@ c_Input
Input Process.
Definition ProcHelper.h:17

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
@ 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
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 54 of file trgeclUnpackerModule.cc.

54{}

◆ checkBuffer()

void checkBuffer ( int * rdat,
int nnn )
virtual

Unpacker main function.

Definition at line 122 of file trgeclUnpackerModule.cc.

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

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

◆ 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{
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.
void setParameters(const ModuleParamList &params)
Set values for parameters from other parameter list.
const ModuleParamList & getParamList() const
Return module param list.
Definition Module.h:362
const std::string & getName() const
Returns the name of the module.
Definition Module.h:186
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:511
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition Module.h:515
void setName(const std::string &name)
Set the name of the module.
Definition Module.h:213
LogConfig m_logConfig
The log system configuration of the module.
Definition Module.h:513
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition Module.h:520
std::string m_package
Package this module is found in (may be empty).
Definition Module.h:509
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 425 of file Module.h.

425{ beginRun(); }

◆ 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 438 of file Module.h.

438{ endRun(); }

◆ 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 431 of file Module.h.

431{ event(); }

◆ 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 419 of file Module.h.

419{ initialize(); }

◆ 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 444 of file Module.h.

444{ terminate(); }

◆ endRun()

void endRun ( void )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 55 of file trgeclUnpackerModule.cc.

55{}

◆ 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:518
bool m_hasReturnValue
True, if the return value is set.
Definition Module.h:517

◆ event()

void event ( void )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 56 of file trgeclUnpackerModule.cc.

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

◆ 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 323 of file Module.h.

324 {
325 return m_conditions;
326 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 313 of file Module.h.

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

◆ 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 201 of file Module.h.

201{return m_description;}

◆ 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, RootOutputModule, and StorageRootOutputModule.

Definition at line 133 of file Module.h.

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

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 224 of file Module.h.

224{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 505 of file Module.h.

505{ 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 186 of file Module.h.

186{return m_name;}

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 196 of file Module.h.

196{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.

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 362 of file Module.h.

362{ 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 380 of file Module.h.

380{ 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:508

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 310 of file Module.h.

310{ 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 377 of file Module.h.

377{ 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

Initializes 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 // This object is registered by few packages. Let's be agnostic about the
49 // execution order of the modules: the first package run registers the module
50 m_eventLevelClusteringInfo.isOptional() ? m_eventLevelClusteringInfo.isRequired() :
51 m_eventLevelClusteringInfo.registerInDataStore();
52}

◆ readCOPPEREvent()

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

Read data from TRG copper.

Definition at line 107 of file trgeclUnpackerModule.cc.

108{
109 /* cppcheck-suppress variableScope */
110 int* rdat;
111 if (raw_copper->GetDetectorNwords(i, ch) > 0) {
112 rdat = raw_copper->GetDetectorBuffer(i, ch);
113 etm_version = ((rdat[0] >> 16) & 0xffff);
114 if (etm_version > 136) {
115 checkBuffer(rdat, nnn);
116 } else {
117 checkBuffer_v136(rdat, nnn);
118 }
119 }
120}
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}
std::string m_description
The description of the module.
Definition Module.h:510

◆ setLogConfig()

void setLogConfig ( const LogConfig & logConfig)
inlineinherited

Set the log system configuration.

Definition at line 229 of file Module.h.

229{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 213 of file Module.h.

213{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList & params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 500 of file Module.h.

500{ 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}
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:200
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition LogSystem.cc:28
LogConfig & getLogConfig()
Returns the log system configuration.
Definition Module.h:224
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition Module.h:507
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 520 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 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 517 of file Module.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 513 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 515 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 507 of file Module.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 509 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 511 of file Module.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 518 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 508 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: