Belle II Software development
TRGGRLProjectsModule Class Reference

A module to simulate the Global Decision Logic. More...

#include <TRGGRLProjectsModule.h>

Inheritance diagram for TRGGRLProjectsModule:
Module PathElement

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

 TRGGRLProjectsModule ()
 Constructor.
 
virtual ~TRGGRLProjectsModule ()
 Destructor.
 
virtual void initialize () override
 Initilizes TRGGRLProjectsModule.
 
virtual void beginRun () override
 Called when new run started.
 
virtual void event () override
 Called event by event.
 
virtual void endRun () override
 Called when run ended.
 
virtual void terminate () override
 Called when processing ended.
 
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.
 

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

int _debugLevel
 returns version of TRGGRLProjectsModule.
 
std::string m_belle2phase
 choose the corresponding trigger menu of Belle2 phase
 
std::string m_configFilename
 Config. file name.
 
int m_simulationMode
 Mode for TRGGRL simulation.
 
int m_fastSimulationMode
 Switch for the fast simulation.
 
int m_firmwareSimulationMode
 Switch for the firmware simulation. 0:do nothing, 1:do everything.
 
std::string m_2DmatchCollectionName
 Name of the StoreArray holding the matched 2D tracks.
 
std::string m_phimatch_tracklist
 the matched 2d track list by phi matching
 
std::string m_3DmatchCollectionName
 Name of the StoreArray holding the matched 3D tracks.
 
std::string m_klmmatch_tracklist
 the matched 2d track list by KLM matching
 
std::string m_2DfinderCollectionName
 Name of the StoreArray holding the tracks made by the 2D finder.
 
std::string m_2DfitterCollectionName
 Name of the StoreArray holding the tracks made by the 2D fitter.
 
std::string m_3DfitterCollectionName
 Name of the StoreArray holding the tracks made by the 3D fitter.
 
std::string m_TrgGrlInformationName
 Name of the StoreArray holding projects information from grl.
 
std::string m_grlphotonlist
 Name of the StoreArray holding projects information from grlphoton.
 
std::string m_NNCollectionName
 Name of the StoreArray holding the tracks made by NN.
 
std::string m_TrgECLClusterName
 Name of the StoreArray holding the eclclusters.
 
std::string m_TrgECLTrgsName
 Name of the StoreArray holding the ecl trg result.
 
std::string m_KLMTrgSummaryName
 Name of the collection of KLM TRG.
 
std::vector< double > m_energythreshold
 the collection of energy threshold used in the projects
 
double m_eclClusterTimeWindow
 ecl cluster time window to suppress beam induced background
 
DBObjPtr< TRGGDLDBInputBitsm_InputBitsDB
 Data base of GDL input bits.
 
std::vector< std::string > m_falsebits
 convert the unit of angle from rad to degree
 
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 to simulate the Global Decision Logic.

This module requires sub-trigger simulation data (CDC, ECL, TOP, and KLM). The output is GRL response.

Definition at line 28 of file TRGGRLProjectsModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

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

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

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

c_HistogramManager 

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

c_InternalSerializer 

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

c_TerminateInAllProcesses 

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

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

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

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

Constructor & Destructor Documentation

◆ TRGGRLProjectsModule()

Constructor.

Definition at line 73 of file TRGGRLProjectsModule.cc.

73 : Module()
74{
75 // Set module properties
76
77 // string desc = "TRGGRLProjectsModule(" + version() + ")";
78 setDescription("TRGGRLProjectsModule");
80
81 addParam("DebugLevel", _debugLevel, "TRGGRL debug level", _debugLevel);
82 addParam("ConfigFile",
84 "The filename of CDC trigger config file",
86 addParam("SimulationMode",
88 "TRGGRL simulation switch",
89 1);
90 addParam("FastSimulationMode",
92 "TRGGRL fast simulation mode",
94 addParam("FirmwareSimulationMode",
96 "TRGGRL firmware simulation mode",
98 addParam("2DfinderCollection", m_2DfinderCollectionName,
99 "Name of the StoreArray holding the tracks made by the 2D finder to be used as input.",
100 string("TRGCDC2DFinderTracks"));
101 addParam("3DfitterCollection", m_3DfitterCollectionName,
102 "Name of the StoreArray holding the tracks made by the 3D fitter to be used as input.",
103 string("TRGCDC3DFitterTracks"));
104 addParam("NNCollection", m_NNCollectionName,
105 "Name of the StoreArray holding the tracks made by the neural network (NN).",
106 string("TRGCDCNeuroTracks"));
107 addParam("2DmatchCollection", m_2DmatchCollectionName,
108 "Name of the StoreArray holding the macthed tracks and clusters made by the 2D fitter.",
109 string("TRG2DMatchTracks"));
110 addParam("PhimatchCollection", m_phimatch_tracklist, "the 2d tracklist with associated cluster", std::string("TRGPhiMatchTracks"));
111 addParam("KLMmatchCollection", m_klmmatch_tracklist, "the 2d tracklist with KLM", std::string("TRGKLMMatchTracks"));
112 addParam("KLMTrgSummaryCollection", m_KLMTrgSummaryName, "Name of the StoreObjPtr holding the information of KLM trigger",
113 std::string("KLMTrgSummary"));
114 addParam("3DmatchCollection", m_3DmatchCollectionName,
115 "Name of the StoreArray holding the matched 3D NN tracks and clusters made",
116 string("TRG3DMatchTracks"));
117 addParam("TrgGrlInformation", m_TrgGrlInformationName,
118 "Name of the StoreArray holding the information of tracks and clusters from cdc ecl klm.",
119 string("TRGGRLObjects"));
120 addParam("TRGECLClusters", m_TrgECLClusterName,
121 "Name of the StoreArray holding the information of trigger ecl clusters ",
122 string("TRGECLClusters"));
123 addParam("TRGECLTrgs", m_TrgECLTrgsName,
124 "Name of the StoreArray holding the information of ecl trigger",
125 string("TRGECLTrgs"));
126 addParam("GRLphotonCollection", m_grlphotonlist, "the isolated cluster list", std::string("TRGGRLPhotons"));
127 addParam("ECLClusterTimeWindow", m_eclClusterTimeWindow,
128 "The time window of the signal eclclusters",
129 100.0);
130 addParam("ClusEngThreshold", m_energythreshold, "The energy threshold of clusters", {0.1, 0.3, 1.0, 2.0});
131}
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
Module()
Constructor.
Definition: Module.cc:30
std::string m_configFilename
Config. file name.
std::string m_KLMTrgSummaryName
Name of the collection of KLM TRG.
int m_fastSimulationMode
Switch for the fast simulation.
std::string m_TrgECLTrgsName
Name of the StoreArray holding the ecl trg result.
int m_simulationMode
Mode for TRGGRL simulation.
std::string m_2DmatchCollectionName
Name of the StoreArray holding the matched 2D tracks.
std::string m_3DfitterCollectionName
Name of the StoreArray holding the tracks made by the 3D fitter.
int _debugLevel
returns version of TRGGRLProjectsModule.
int m_firmwareSimulationMode
Switch for the firmware simulation. 0:do nothing, 1:do everything.
std::string m_TrgECLClusterName
Name of the StoreArray holding the eclclusters.
std::string m_phimatch_tracklist
the matched 2d track list by phi matching
double m_eclClusterTimeWindow
ecl cluster time window to suppress beam induced background
std::string m_2DfinderCollectionName
Name of the StoreArray holding the tracks made by the 2D finder.
std::string m_NNCollectionName
Name of the StoreArray holding the tracks made by NN.
std::string m_klmmatch_tracklist
the matched 2d track list by KLM matching
std::string m_TrgGrlInformationName
Name of the StoreArray holding projects information from grl.
std::string m_grlphotonlist
Name of the StoreArray holding projects information from grlphoton.
std::vector< double > m_energythreshold
the collection of energy threshold used in the projects
std::string m_3DmatchCollectionName
Name of the StoreArray holding the matched 3D tracks.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

◆ ~TRGGRLProjectsModule()

virtual ~TRGGRLProjectsModule ( )
inlinevirtual

Destructor.

Definition at line 37 of file TRGGRLProjectsModule.h.

37{};

Member Function Documentation

◆ beginRun()

void beginRun ( void  )
overridevirtual

Called when new run started.

Reimplemented from Module.

Definition at line 176 of file TRGGRLProjectsModule.cc.

177{
178 B2DEBUG(20, "TRGGDLModule ... beginRun called ");
179 m_falsebits.clear();
180 //...GDL config. name...
181}
std::vector< std::string > m_falsebits
convert the unit of angle from rad to degree

◆ clone()

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

Create an independent copy of this module.

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

Implements PathElement.

Definition at line 179 of file Module.cc.

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

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

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

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

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

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

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

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

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

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

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

◆ endRun()

void endRun ( void  )
overridevirtual

Called when run ended.

Reimplemented from Module.

Definition at line 996 of file TRGGRLProjectsModule.cc.

997{
998 B2DEBUG(20, "TRGGRLProjectsModule ... endRun called ");
999 if (m_falsebits.size() > 0) {
1000 for (const std::string& bitname : m_falsebits) {
1001 B2WARNING("Unknown bitname" << LogVar("bitname", bitname));
1002 }
1003 }
1004}
Class to store variables with their name which were sent to the logging service.

◆ evalCondition()

bool evalCondition ( ) const
inherited

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

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

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

Definition at line 96 of file Module.cc.

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

◆ event()

void event ( void  )
overridevirtual

Called event by event.

Reimplemented from Module.

Definition at line 184 of file TRGGRLProjectsModule.cc.

185{
186 //cout << "TRGGRLProjects event " << iEvent << endl;
187 //iEvent++;
188
189 //---------------------------------------------------------------------
190 //..Read in the necessary arrays
191 StoreArray<TRGECLTrg> trgArray;
192 //StoreArray<MCParticle> MCParticleArray;
201 StoreObjPtr<BinnedEventT0> m_eventTime;
203 //trgInfo.create();
204 //---------------------------------------------------------------------
205 //..Use only clusters within 100 ns of event timing (from ECL).
206 int ntrgArray = trgArray.getEntries();
207 double EventTiming = -9999.;
208 if (ntrgArray > 0) {EventTiming = trgArray[0]->getEventTiming();}
209 std::vector<int> selTC;
210 std::vector<int> selTheta;
211 std::vector<float> selE;
212 for (int ic = 0; ic < eclTrgClusterArray.getEntries(); ic++) {
213 double tcT = abs(eclTrgClusterArray[ic]->getTimeAve() - EventTiming);
214 if (tcT < 100.) {
215 int TC = eclTrgClusterArray[ic]->getMaxTCId();
216 selTC.push_back(TC);
217 selTheta.push_back(TCThetaID[TC - 1]);
218 selE.push_back(eclTrgClusterArray[ic]->getEnergyDep());
219 }
220 }
221
222 //---------------------------------------------------------------------
223 //..Trigger objects from CDC alone
224 // nTrk3D nTrkZ10 nTrkZ25
225 int nTrk2D = cdc2DTrkArray.getEntries();
226 int nTrk3D = cdc3DTrkArray.getEntries();
227 int nTrkZ10 = 0;
228 int nTrkZ25 = 0;
229 int nTrkZ35 = 0;
230 for (int itrk = 0; itrk < nTrk3D; itrk++) {
231 double z0 = cdc3DTrkArray[itrk]->getZ0();
232 if (abs(z0) < 10.) {nTrkZ10++;}
233 if (abs(z0) < 25.) {nTrkZ25++;}
234 if (abs(z0) < 35.) {nTrkZ35++;}
235 }
236 int nTrkNN = cdcNNTrkArray.getEntries();
237 int nTrkNNSTT = 0;
238 int nTrkNNSTT6 = 0;
239 int nTrkNNSTT5 = 0;
240 int nTrkNNSTT4 = 0;
241 int nTrkNN20 = 0;
242 int nTrkNN40 = 0;
243 for (int itrk = 0; itrk < nTrkNN; itrk++) {
244 double z0 = cdcNNTrkArray[itrk]->getZ0();
245
246 double omega = 100 * cdcNNTrkArray[itrk]->getOmega();
247 int omega_bin = omega / 0.044;
248 omega = omega_bin * 0.044;
249
250 double cottheta = cdcNNTrkArray[itrk]->getCotTheta();
251 double theta = 0;
252 if (cottheta != 0)theta = atan(1. / cottheta);
253 int theta_bin = theta / 0.098125;
254 theta = theta_bin * 0.098125;
255 int p = abs(10 * 0.3 * 1.5 / omega / sin(theta)); //0.1GeV unit
256
257 double pt = cdcNNTrkArray[itrk]->getPt();
258 double p_abs = cdcNNTrkArray[itrk]->getPt() / sin(theta);
259 B2DEBUG(20, "NN momentum " << omega << " " << theta * 180 / 3.14 << " " << p * 0.1 << " " << p_abs << " " << pt);
260
261 if (abs(z0) < 15. && p > 7) {nTrkNNSTT++;}
262 if (abs(z0) < 15. && p > 6) {nTrkNNSTT6++;}
263 if (abs(z0) < 15. && p > 5) {nTrkNNSTT5++;}
264 if (abs(z0) < 15. && p > 4) {nTrkNNSTT4++;}
265 if (abs(z0) < 20.) {nTrkNN20++;}
266 if (abs(z0) < 40.) {nTrkNN40++;}
267 }
268
269 trgInfo->setN3Dfittertrk(nTrk3D);
270 trgInfo->setN3DfittertrkZ10(nTrkZ10);
271 trgInfo->setN3DfittertrkZ25(nTrkZ25);
272 trgInfo->setN3DfittertrkZ35(nTrkZ35);
273 trgInfo->setNNNtrk(nTrkNN);
274 trgInfo->setNNNtrkZ20(nTrkNN20);
275 trgInfo->setNNNtrkZ40(nTrkNN40);
276 trgInfo->setNNNtrkSTT(nTrkNNSTT);
277 //---------------------------------------------------------------------
278 //..Trigger objects using single ECL clusters
279 // nClust n300MeV n2GeV n2GeV414 n2GeV231516 n2GeV117 n1GeV415 n1GeV2316 n1GeV117
280 int nClust = selTC.size();
281 int n300MeV = 0;
282 int n2GeV = 0;
283 int n2GeV414 = 0;
284 int n2GeV231516 = 0;
285 int n2GeV117 = 0;
286 int n1GeV415 = 0;
287 int n1GeV2316 = 0;
288 int n1GeV117 = 0;
289 for (int ic = 0; ic < nClust; ic++) {
290 if (selE[ic] > 0.3) {n300MeV++;}
291 float thresh = TC1GeV[selTC[ic] - 1];
292 if (selE[ic] > (thresh + thresh)) {
293 n2GeV++;
294 if (selTheta[ic] >= 4 && selTheta[ic] <= 14) {n2GeV414++;}
295 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 15 || selTheta[ic] == 16) {n2GeV231516++;}
296 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n2GeV117++;}
297 }
298 if (selE[ic] > thresh) {
299 if (selTheta[ic] >= 4 && selTheta[ic] <= 15) {n1GeV415++;}
300 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 16) {n1GeV2316++;}
301 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n1GeV117++;}
302 }
303 }
304 trgInfo->setNcluster(nClust);
305 trgInfo->setNhigh300cluster(n300MeV);
306 trgInfo->setNhigh1GeVcluster415(n1GeV415);
307 trgInfo->setNhigh1GeVcluster2316(n1GeV2316);
308 trgInfo->setNhigh1GeVcluster117(n1GeV117);
309 trgInfo->setNhigh2GeVcluster(n2GeV);
310 trgInfo->setNhigh2GeVcluster414(n2GeV414);
311 trgInfo->setNhigh2GeVcluster231516(n2GeV231516);
312 trgInfo->setNhigh2GeVcluster117(n2GeV117);
313
314 //---------------------------------------------------------------------
315 //..Trigger objects using back-to-back ECL clusters, plus Bhabha vetoes
316 // nPhiPairHigh nPhiPairLow n3DPair nECLBhabha nTrkBhabha
317 int nPhiPairHigh = 0;
318 int nPhiPairLow = 0;
319 int n3DPair = 0;
320 int nECLBhabha = 0;
321 int nTrkBhabha = 0;
322 for (int i0 = 0; i0 < nClust - 1; i0++) {
323 for (int i1 = i0 + 1; i1 < nClust; i1++) {
324
325 //..back to back in phi
326 float dphi = abs(TCPhiCOM[selTC[i1] - 1] - TCPhiCOM[selTC[i0] - 1]);
327 if (dphi > 180.) {dphi = 360 - dphi;}
328 if (dphi > 170. && selE[i0] > 0.25 && selE[i1] > 0.25) {nPhiPairHigh++;}
329 if (dphi > 170. && (selE[i0] < 0.25 || selE[i1] < 0.25)) {nPhiPairLow++;}
330
331 //..3D
332 float thetaSum = TCThetaCOM[selTC[i0] - 1] + TCThetaCOM[selTC[i1] - 1];
333 if (dphi > 160. && thetaSum > 160. && thetaSum < 200.) {n3DPair++;}
334
335 //..ecl Bhabha
336 if (dphi > 160. && thetaSum > 165. && thetaSum < 190. && selE[i0] > 3.*TC1GeV[selTC[i0] - 1] && selE[i1] > 3.*TC1GeV[selTC[i1] - 1]
337 && (selE[i0] > 4.5 * TC1GeV[selTC[i0] - 1] || selE[i1] > 4.5 * TC1GeV[selTC[i1] - 1])) {
338 nECLBhabha++;
339
340 //..Bhabha also using the CDC
341 bool c0matched = false;
342 bool c1matched = false;
343 for (int itrk = 0; itrk < nTrk3D; itrk++) {
344 double phiTrk = cdc3DTrkArray[itrk]->getPhi0() * radtodeg;
345 double ptTrk = cdc3DTrkArray[itrk]->getTransverseMomentum(1.5);
346 float dphi0 = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
347 if (dphi0 > 180.) {dphi0 = 360. - dphi0;}
348 float dphi1 = abs(phiTrk - TCPhiLab[selTC[i1] - 1]);
349 if (dphi1 > 180.) {dphi1 = 360. - dphi1;}
350 if (ptTrk > 1. && dphi0 < 15.) {c0matched = true;}
351 if (ptTrk > 1. && dphi1 < 15.) {c1matched = true;}
352 }
353 if (c0matched && c1matched) {nTrkBhabha++;}
354 }
355 }
356 }
357
358 trgInfo->setBhabhaVeto(nTrkBhabha);
359 trgInfo->seteclBhabhaVeto(nECLBhabha);
360 trgInfo->setPairHigh(nPhiPairHigh);
361 trgInfo->setPairLow(nPhiPairLow);
362 trgInfo->set3DPair(n3DPair);
363
364
365 //---------------------------------------------------------------------
366 //..Trigger objects using 1 track and at least 1 cluster
367 // nSameHem1Trk nOppHem1Trk
368 int nSameHem1Trk = 0;
369 int nOppHem1Trk = 0;
370 if (nTrk3D == 1) {
371 double phiTrk = cdc3DTrkArray[0]->getPhi0() * radtodeg;
372 double cotTrk = cdc3DTrkArray[0]->getCotTheta();
373 for (int i0 = 0; i0 < nClust; i0++) {
374 float dphi = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
375 if (dphi > 180.) {dphi = 360. - dphi;}
376 float dCot = cotTrk - TCcotThetaLab[selTC[i0] - 1];
377 if (dphi > 80.) {nOppHem1Trk++;}
378 if (dphi < 80. && (dCot < -0.8 || dCot > 0.6)) {nSameHem1Trk++;}
379 }
380 }
381
382 trgInfo->setNSameHem1Trk(nSameHem1Trk);
383 trgInfo->setNOppHem1Trk(nOppHem1Trk);
384
385 //---------------------------------------------------------------------
386 //..Trk b2b
387 int Trk_b2b_1to3 = 0;
388 int Trk_b2b_1to5 = 0;
389 int Trk_b2b_1to7 = 0;
390 int Trk_b2b_1to9 = 0;
391 int Trk_open90 = 0;
392 int Trk_open30 = 0;
393 for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
394
395 int phi_i_itrk = (int)((cdc2DTrkArray[itrk]->getPhi0()) * (180 / M_PI) / 10);
396
397 for (int jtrk = 0; jtrk < cdc2DTrkArray.getEntries(); jtrk++) {
398 if (itrk <= jtrk) continue;
399
400 int phi_i_jtrk = (int)((cdc2DTrkArray[jtrk]->getPhi0()) * (180 / M_PI) / 10);
401 if (abs(phi_i_itrk - phi_i_jtrk) >= 17 && abs(phi_i_itrk - phi_i_jtrk) <= 19) {Trk_b2b_1to3 = 1;}
402 if (abs(phi_i_itrk - phi_i_jtrk) >= 16 && abs(phi_i_itrk - phi_i_jtrk) <= 20) {Trk_b2b_1to5 = 1;}
403 if (abs(phi_i_itrk - phi_i_jtrk) >= 15 && abs(phi_i_itrk - phi_i_jtrk) <= 21) {Trk_b2b_1to7 = 1;}
404 if (abs(phi_i_itrk - phi_i_jtrk) >= 14 && abs(phi_i_itrk - phi_i_jtrk) <= 22) {Trk_b2b_1to9 = 1;}
405 if (abs(phi_i_itrk - phi_i_jtrk) >= 9 && abs(phi_i_itrk - phi_i_jtrk) <= 27) {Trk_open90 = 1;}
406 if (abs(phi_i_itrk - phi_i_jtrk) >= 3 && abs(phi_i_itrk - phi_i_jtrk) <= 33) {Trk_open30 = 1;}
407 }
408 }
409 trgInfo->setTrk_b2b_1to3(Trk_b2b_1to3);
410 trgInfo->setTrk_b2b_1to5(Trk_b2b_1to5);
411 trgInfo->setTrk_b2b_1to7(Trk_b2b_1to7);
412 trgInfo->setTrk_b2b_1to9(Trk_b2b_1to9);
413 trgInfo->setTrk_open90(Trk_open90);
414 trgInfo->setTrk_open30(Trk_open30);
415
416 //---------------------------------------------------------------------
417 //..cluster b2b
418 int cluster_b2b_1to3 = 0;
419 int cluster_b2b_1to5 = 0;
420 int cluster_b2b_1to7 = 0;
421 int cluster_b2b_1to9 = 0;
422 for (int iclu = 0; iclu < eclTrgClusterArray.getEntries(); iclu++) {
423
424 double x_iclu = eclTrgClusterArray[iclu]->getPositionX();
425 double y_iclu = eclTrgClusterArray[iclu]->getPositionY();
426
427 int phi_iclu = 0;
428 if (x_iclu >= 0 && y_iclu >= 0) {phi_iclu = (int)(atan(y_iclu / x_iclu) * (180.0 / M_PI) / 10);}
429 else if (x_iclu < 0 && y_iclu >= 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
430 else if (x_iclu < 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
431 else if (x_iclu >= 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 360.0) / 10);}
432
433 for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
434 if (iclu <= jclu) continue;
435
436 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
437 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
438
439 int phi_jclu = 0;
440 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
441 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
442 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
443 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
444
445 if (abs(phi_iclu - phi_jclu) >= 17 && abs(phi_iclu - phi_jclu) <= 19) {cluster_b2b_1to3 = 1;}
446 if (abs(phi_iclu - phi_jclu) >= 16 && abs(phi_iclu - phi_jclu) <= 20) {cluster_b2b_1to5 = 1;}
447 if (abs(phi_iclu - phi_jclu) >= 15 && abs(phi_iclu - phi_jclu) <= 21) {cluster_b2b_1to7 = 1;}
448 if (abs(phi_iclu - phi_jclu) >= 14 && abs(phi_iclu - phi_jclu) <= 22) {cluster_b2b_1to9 = 1;}
449 }
450 }
451 trgInfo->setcluster_b2b_1to3(cluster_b2b_1to3);
452 trgInfo->setcluster_b2b_1to5(cluster_b2b_1to5);
453 trgInfo->setcluster_b2b_1to7(cluster_b2b_1to7);
454 trgInfo->setcluster_b2b_1to9(cluster_b2b_1to9);
455
456
457 //---------------------------------------------------------------------
458 //..eed, fed
459
460 int eed = 0, fed = 0;
461 if (cdc2DTrkArray.getEntries() == 2 && trackphimatch.getEntries() == 2 && cluster_b2b_1to5 == 1) {eed = 1;}
462 if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && cluster_b2b_1to5 == 1) {fed = 1;}
463 trgInfo->seteed(eed);
464 trgInfo->setfed(fed);
465
466 //---------------------------------------------------------------------
467 //..Track-cluster b2b
468 int Trkcluster_b2b_1to3 = 0;
469 int Trkcluster_b2b_1to5 = 0;
470 int Trkcluster_b2b_1to7 = 0;
471 int Trkcluster_b2b_1to9 = 0;
472 for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
473 double _r = 1.0 / cdc2DTrkArray[itrk]->getOmega() ;
474 double _phi = cdc2DTrkArray[itrk]->getPhi0() ;
475 double phi_p = acos(126.0 / (2 * fabs(_r)));
476 int charge = 0;
477 if (_r > 0) {charge = 1;}
478 else if (_r < 0) {charge = -1;}
479 else {charge = 0;}
480
481 double phi_CDC = 0.0;
482 if (charge == 1) {
483 phi_CDC = _phi + phi_p - 0.5 * M_PI;
484 } else if (charge == -1) {
485 phi_CDC = _phi - phi_p + 0.5 * M_PI;
486 } else {
487 phi_CDC = _phi;
488 }
489
490 if (phi_CDC > 2 * M_PI) {phi_CDC = phi_CDC - 2 * M_PI;}
491 else if (phi_CDC < 0) {phi_CDC = phi_CDC + 2 * M_PI;}
492 int phi_itrk = (int)(phi_CDC * (180.0 / M_PI) / 10);
493
494 for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
495
496 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
497 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
498
499 int phi_jclu = 0;
500 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
501 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
502 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
503 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
504
505 if (abs(phi_itrk - phi_jclu) >= 17 && abs(phi_itrk - phi_jclu) <= 19) {Trkcluster_b2b_1to3 = 1;}
506 if (abs(phi_itrk - phi_jclu) >= 16 && abs(phi_itrk - phi_jclu) <= 20) {Trkcluster_b2b_1to5 = 1;}
507 if (abs(phi_itrk - phi_jclu) >= 15 && abs(phi_itrk - phi_jclu) <= 21) {Trkcluster_b2b_1to7 = 1;}
508 if (abs(phi_itrk - phi_jclu) >= 14 && abs(phi_itrk - phi_jclu) <= 22) {Trkcluster_b2b_1to9 = 1;}
509 }
510 }
511
512 trgInfo->setTrkcluster_b2b_1to3(Trkcluster_b2b_1to3);
513 trgInfo->setTrkcluster_b2b_1to5(Trkcluster_b2b_1to5);
514 trgInfo->setTrkcluster_b2b_1to7(Trkcluster_b2b_1to7);
515 trgInfo->setTrkcluster_b2b_1to9(Trkcluster_b2b_1to9);
516
517 //---------------------------------------------------------------------
518 //..fp, eeb, fep
519
520 int fp = 0;
521 if (cdc2DTrkArray.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fp = 1;}
522 trgInfo->setfp(fp);
523
524 int eeb = 0;
525 if (trackphimatch.getEntries() == 2 && Trk_b2b_1to5 == 1) {eeb = 1;}
526 trgInfo->seteeb(eeb);
527
528 int fep = 0;
529 if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fep = 1;}
530 trgInfo->setfep(fep);
531
532
533 //---------------------------------------------------------------------
534 //..Get input bits from StoreArray<TRGECLTrg> trgArray
535 //..Bit order is hard-coded in trg/ecl/src/TrgEclMaster.cc
536
537 int ECLtoGDL[4] = {0, 0, 0, 0};
538 if (ntrgArray > 0) {
539 ECLtoGDL[0] = trgArray[0]->getECLtoGDL(0);
540 ECLtoGDL[1] = trgArray[0]->getECLtoGDL(1);
541 ECLtoGDL[2] = trgArray[0]->getECLtoGDL(2);
542 ECLtoGDL[3] = trgArray[0]->getECLtoGDL(3);
543 }
544
545 // elow: 47
546 bool elow = (ECLtoGDL[1] & (1 << (47 - 32 * 1))) != 0;
547 // ehigh: 48
548 bool ehigh = (ECLtoGDL[1] & (1 << (48 - 32 * 1))) != 0;
549 // elum: 49
550 bool elum = (ECLtoGDL[1] & (1 << (49 - 32 * 1))) != 0;
551 // ecl_bha: 19
552 bool ecl_bha = (ECLtoGDL[0] & (1 << (19 - 32 * 0))) != 0;
553 // bha_type0: 20
554 bool bha_type0 = (ECLtoGDL[0] & (1 << (20 - 32 * 0))) != 0;
555 // bha_type1: 21
556 bool bha_type1 = (ECLtoGDL[0] & (1 << (21 - 32 * 0))) != 0;
557 // bha_type2: 22
558 bool bha_type2 = (ECLtoGDL[0] & (1 << (22 - 32 * 0))) != 0;
559 // bha_type3: 23
560 bool bha_type3 = (ECLtoGDL[0] & (1 << (23 - 32 * 0))) != 0;
561 // bha_type4: 24
562 bool bha_type4 = (ECLtoGDL[0] & (1 << (24 - 32 * 0))) != 0;
563 // bha_type5: 25
564 bool bha_type5 = (ECLtoGDL[0] & (1 << (25 - 32 * 0))) != 0;
565 // bha_type6: 26
566 bool bha_type6 = (ECLtoGDL[0] & (1 << (26 - 32 * 0))) != 0;
567 // bha_type7: 27
568 bool bha_type7 = (ECLtoGDL[0] & (1 << (27 - 32 * 0))) != 0;
569 // bha_type8: 28
570 bool bha_type8 = (ECLtoGDL[0] & (1 << (28 - 32 * 0))) != 0;
571 // bha_type9: 29
572 bool bha_type9 = (ECLtoGDL[0] & (1 << (29 - 32 * 0))) != 0;
573 // bha_type10: 30
574 bool bha_type10 = (ECLtoGDL[0] & (1 << (30 - 32 * 0))) != 0;
575 // bha_type11: 31
576 bool bha_type11 = (ECLtoGDL[0] & (1u << (31 - 32 * 0))) != 0;
577 // bha_type12: 32
578 bool bha_type12 = (ECLtoGDL[1] & (1 << (32 - 32 * 1))) != 0;
579 // bha_type13: 33
580 bool bha_type13 = (ECLtoGDL[1] & (1 << (33 - 32 * 1))) != 0;
581
582 bool nclst_0 = (eclTrgClusterArray.getEntries() & (1 << 0)) != 0;
583 bool nclst_1 = (eclTrgClusterArray.getEntries() & (1 << 1)) != 0;
584 bool nclst_2 = (eclTrgClusterArray.getEntries() & (1 << 2)) != 0;
585 bool nclst_3 = (eclTrgClusterArray.getEntries() & (1 << 3)) != 0;
586
587 // ecl_bg_0: 57
588 bool ecl_bg_0 = (ECLtoGDL[1] & (1 << (57 - 32 * 1))) != 0;
589 // ecl_bg_1: 58
590 bool ecl_bg_1 = (ECLtoGDL[1] & (1 << (58 - 32 * 1))) != 0;
591 // ecl_bg_2: 59
592 bool ecl_bg_2 = (ECLtoGDL[1] & (1 << (59 - 32 * 1))) != 0;
593
594 bool ecl_active = ntrgArray > 0;
595
596 // ecl_timing_fwd: 15
597 bool ecl_timing_fwd = (ECLtoGDL[0] & (1 << (15 - 32 * 0))) != 0;
598 // ecl_timing_brl: 16
599 bool ecl_timing_brl = (ECLtoGDL[0] & (1 << (16 - 32 * 0))) != 0;
600 // ecl_timing_bwd: 17
601 bool ecl_timing_bwd = (ECLtoGDL[0] & (1 << (17 - 32 * 0))) != 0;
602 // ecl_phys: 18
603 bool ecl_phys = (ECLtoGDL[0] & (1 << (18 - 32 * 0))) != 0;
604 // ecl_oflo: 60
605 bool ecl_oflo = (ECLtoGDL[1] & (1 << (60 - 32 * 1))) != 0;
606 // ecl_3dbha: 61
607 bool ecl_3dbha = (ECLtoGDL[1] & (1 << (61 - 32 * 1))) != 0;
608 // ecl_lml_0: 62
609 bool ecl_lml_0 = (ECLtoGDL[1] & (1 << (62 - 32 * 1))) != 0;
610 // ecl_lml_1: 63
611 bool ecl_lml_1 = (ECLtoGDL[1] & (1u << (63 - 32 * 1))) != 0;
612 // ecl_lml_2: 64
613 bool ecl_lml_2 = (ECLtoGDL[2] & (1 << (64 - 32 * 2))) != 0;
614 // ecl_lml_3: 65
615 bool ecl_lml_3 = (ECLtoGDL[2] & (1 << (65 - 32 * 2))) != 0;
616 // ecl_lml_4: 66
617 bool ecl_lml_4 = (ECLtoGDL[2] & (1 << (66 - 32 * 2))) != 0;
618 // ecl_lml_5: 67
619 bool ecl_lml_5 = (ECLtoGDL[2] & (1 << (67 - 32 * 2))) != 0;
620 // ecl_lml_6: 68
621 bool ecl_lml_6 = (ECLtoGDL[2] & (1 << (68 - 32 * 2))) != 0;
622 // ecl_lml_7: 69
623 bool ecl_lml_7 = (ECLtoGDL[2] & (1 << (69 - 32 * 2))) != 0;
624 // ecl_lml_8: 70
625 bool ecl_lml_8 = (ECLtoGDL[2] & (1 << (70 - 32 * 2))) != 0;
626 // ecl_lml_9: 71
627 bool ecl_lml_9 = (ECLtoGDL[2] & (1 << (71 - 32 * 2))) != 0;
628 // ecl_lml_10: 72
629 bool ecl_lml_10 = (ECLtoGDL[2] & (1 << (72 - 32 * 2))) != 0;
630 // ecl_lml_11: 73
631 bool ecl_lml_11 = (ECLtoGDL[2] & (1 << (73 - 32 * 2))) != 0;
632 // ecl_lml_11: 78
633 bool ecl_lml_12 = (ECLtoGDL[2] & (1 << (78 - 32 * 2))) != 0;
634 // ecl_lml_11: 79
635 bool ecl_lml_13 = (ECLtoGDL[2] & (1 << (79 - 32 * 2))) != 0;
636 // ecl_mumu: 75
637 bool ecl_mumu = (ECLtoGDL[2] & (1 << (75 - 32 * 2))) != 0;
638 // ecl_bst: 77
639 bool ecl_bst = (ECLtoGDL[2] & (1 << (77 - 32 * 2))) != 0;
640 // ecl_pur: 74
641 bool ecl_bhapur = (ECLtoGDL[2] & (1 << (74 - 32 * 2))) != 0;
642 //3D Bhabha Veto Intrk: 86
643 bool bha_intrk = (ECLtoGDL[2] & (1 << (86 - 32 * 2))) != 0;
644 //3D Bhabha selection theta flag: 87-88
645 bool bha_theta_0 = (ECLtoGDL[2] & (1 << (87 - 32 * 2))) != 0;
646 bool bha_theta_1 = (ECLtoGDL[2] & (1 << (88 - 32 * 2))) != 0;
647 //ecltaub2b
648 bool ecltaub2b = (ECLtoGDL[2] & (1 << (89 - 32 * 2))) != 0;
649 bool ecltaub2b2 = (ECLtoGDL[2] & (1 << (93 - 32 * 2))) != 0;
650 bool ecltaub2b3 = (ECLtoGDL[2] & (1 << (94 - 32 * 2))) != 0;
651 // ehigh1-3
652 bool ehigh1 = (ECLtoGDL[2] & (1 << (90 - 32 * 2))) != 0;
653 bool ehigh2 = (ECLtoGDL[2] & (1 << (91 - 32 * 2))) != 0;
654 bool ehigh3 = (ECLtoGDL[2] & (1 << (92 - 32 * 2))) != 0;
655 bool ehigh4 = (ECLtoGDL[2] & (1u << (95 - 32 * 2))) != 0;
656
657 //---------------------------------------------------------------------
658 //..Other input bits
659
660 bool cdc_active = false;
661 if (m_eventTime->hasBinnedEventT0(Const::CDC)) {
662 if (m_eventTime->getBinnedEventT0(Const::CDC) != 0) { cdc_active = true; }
663 }
664
665 //KLM alone bits from klmtrg summary----------------------------------
666 int n_klm_barrel = klmtrgsummary->getBKLM_n_trg_sectors();
667 bool klm_hit = n_klm_barrel > 0;
668 bool klm_0 = (n_klm_barrel & (1 << 0)) != 0;
669 bool klm_1 = (n_klm_barrel & (1 << 1)) != 0;
670 bool klm_2 = (n_klm_barrel & (1 << 2)) != 0;
671 int n_eklm_barrel = klmtrgsummary->getEKLM_n_trg_sectors();
672 bool eklm_hit = n_eklm_barrel > 0;
673 bool eklm_0 = (n_eklm_barrel & (1 << 0)) != 0;
674 bool eklm_1 = (n_eklm_barrel & (1 << 1)) != 0;
675 bool eklm_2 = (n_eklm_barrel & (1 << 2)) != 0;
676 int klmb2b = klmtrgsummary->getBKLM_back_to_back_flag();
677 int eklmb2b = klmtrgsummary->getEKLM_back_to_back_flag();
678
679 //KLM/CDC/ECL matching bits-------------------------------------------
680 bool cdcklm_0 = (trackKLMmatch.getEntries() == 1);
681 bool cdcklm_1 = (trackKLMmatch.getEntries() > 1);
682 bool cdcklm_2 = (trackKLMmatch.getEntries() == 3);
683 bool cdcklm_3 = (trackKLMmatch.getEntries() > 3);
684 int n_seklm = trgInfo->getNsklm();
685 //int n_seklm_fwd = trgInfo->getNsklm_fwd();
686 //int n_seklm_bwd = trgInfo->getNsklm_bwd();
687 int n_ieklm = trgInfo->getNiklm();
688 bool ecleklm = (trgInfo->getNeecleklm() > 0);
689
690 bool cdcecl_0 = (trackphimatch.getEntries() == 1);
691 bool cdcecl_1 = (trackphimatch.getEntries() == 2);
692 bool cdcecl_2 = (trackphimatch.getEntries() == 3);
693 bool cdcecl_3 = (trackphimatch.getEntries() > 3);
694 bool trkbha1 = ecl_3dbha && (trackphimatch.getEntries() == 1);
695 bool trkbha2 = ecl_3dbha && (trackphimatch.getEntries() == 2);
696
697
698
699 int n_c2gev = 0;
700 for (int i = 0; i < trackphimatch.getEntries(); i++) {
701 if (trackphimatch[i]->get_e() >= 2.0) {n_c2gev++;}
702 }
703
704 bool c2gev_0 = (n_c2gev == 1);
705 bool c2gev_1 = (n_c2gev == 2);
706 bool c2gev_2 = (n_c2gev == 3);
707 bool c2gev_3 = (n_c2gev > 3);
708
709 int N_clst1 = 0, N_clst2 = 0;
710 for (int i = 0 ; i < grlphoton.getEntries() ; i++) {
711 if (grlphoton[i]->get_e() > 1.0) { N_clst1++; }
712 if (grlphoton[i]->get_e() > 2.0) { N_clst2++; }
713 }
714
715 bool nclst1_0 = (N_clst1 == 1);
716 bool nclst1_1 = (N_clst1 == 2);
717 bool nclst1_2 = (N_clst1 == 3);
718 bool nclst1_3 = (N_clst1 > 3);
719
720 bool nclst2_0 = (N_clst2 == 1);
721 bool nclst2_1 = (N_clst2 == 2);
722 bool nclst2_2 = (N_clst2 == 3);
723 bool nclst2_3 = (N_clst2 > 3);
724
725 int N_ST = trgInfo->getNshorttrk();
726 int N_ST_fwd = trgInfo->getNshorttrk_fwd();
727 int N_ST_bwd = trgInfo->getNshorttrk_bwd();
728 int s2s3 = trgInfo->gets2s3();
729 int s2s5 = trgInfo->gets2s5();
730 int s2so = trgInfo->gets2so();
731 int s2f3 = trgInfo->gets2f3();
732 int s2f5 = trgInfo->gets2f5();
733 int s2fo = trgInfo->gets2fo();
734 int s2f30 = trgInfo->gets2f30();
735 int s2s30 = trgInfo->gets2s30();
736 int bwdsb = trgInfo->getbwdsb();
737 int bwdnb = trgInfo->getbwdnb();
738 int fwdsb = trgInfo->getfwdsb();
739 int fwdnb = trgInfo->getfwdnb();
740 int brlfb = trgInfo->getbrlfb();
741 int brlnb = trgInfo->getbrlnb();
742 int N_IT = trgInfo->getNinnertrk();
743 int i2fo = trgInfo->geti2fo();
744 int i2io = trgInfo->geti2io();
745 int n_secl = trgInfo->getNsecl();
746 int n_iecl = trgInfo->getNiecl();
747
748 bool ecltaunn = trgInfo->getTauNN();
749
750 //std::cout << "klm " << klm_hit << " " << klm_0 << " " << klm_1 << " " << klm_2 << " " << klmb2b << std::endl;
751 //std::cout << "eklm " << eklm_hit << " " << eklm_0 << " " << eklm_1 << " " << eklm_2 << " " << eklmb2b << std::endl;
752 //std::cout << "2dklm " << nTrk2D << " " << cdcklm_0 << " " << cdcklm_1 << std::endl;
753 //std::cout << "sklm " << N_ST << " " << n_seklm << " " << n_seklm_fwd << " " << n_seklm_bwd << std::endl;
754 //std::cout << "tiklm " << N_IT << " " << n_ieklm << " " << trgInfo->getNiecl() << std::endl;
755 //std::cout << "eclklm " << trgInfo->getNeecleklm() << std::endl;
756
757
758 //---------------------------------------------------------------------
759 //..Filling InputBits
760 //..Naming is based on trg/gdl/dbobjects/log/
761
762
763 if (!m_InputBitsDB)B2INFO("no database of gdl input bits");
764
765 int N_InputBits = m_InputBitsDB->getninbit();
766
767 for (int i = 0; i < N_InputBits; i++) {
768 std::string bitname(m_InputBitsDB->getinbitname(i));
769
770 bool bit = false;
771 if (bitname == "t3_0") {bit = nTrkZ35 == 1;}
772 else if (bitname == "t3_1") {bit = nTrkZ35 == 2;}
773 else if (bitname == "t3_2") {bit = nTrkZ35 == 3;}
774 else if (bitname == "t3_3") {bit = nTrkZ35 > 3;}
775 else if (bitname == "ty_0") {bit = nTrkNN20 == 1;}
776 else if (bitname == "ty_1") {bit = nTrkNN20 == 2;}
777 else if (bitname == "ty_2") {bit = nTrkNN20 == 3;}
778 else if (bitname == "ty_3") {bit = nTrkNN20 > 3;}
779 else if (bitname == "typ") {bit = nTrkNNSTT > 0;}
780 else if (bitname == "typ6") {bit = nTrkNNSTT6 > 0;}
781 else if (bitname == "typ5") {bit = nTrkNNSTT5 > 0;}
782 else if (bitname == "typ4") {bit = nTrkNNSTT4 > 0;}
783 else if (bitname == "t2_0") {bit = nTrk2D == 1;}
784 else if (bitname == "t2_1") {bit = nTrk2D == 2;}
785 else if (bitname == "t2_2") {bit = nTrk2D == 3;}
786 else if (bitname == "t2_3") {bit = nTrk2D > 3;}
787 else if (bitname == "ts_0") {bit = N_ST == 1;}
788 else if (bitname == "ts_1") {bit = N_ST == 2;}
789 else if (bitname == "ts_2") {bit = N_ST == 3;}
790 else if (bitname == "ts_3") {bit = N_ST > 3;}
791 else if (bitname == "fwd_s") {bit = N_ST_fwd > 0;}
792 else if (bitname == "bwd_s") {bit = N_ST_bwd > 0;}
793 else if (bitname == "cdc_open90") {bit = Trk_open90 == 1;}
794 else if (bitname == "f2f30") {bit = Trk_open30 == 1;}
795 else if (bitname == "cdc_active") {bit = cdc_active;}
796 else if (bitname == "cdc_b2b3") {bit = Trk_b2b_1to3;}
797 else if (bitname == "cdc_b2b5") {bit = Trk_b2b_1to5;}
798 else if (bitname == "cdc_b2b7") {bit = Trk_b2b_1to7;}
799 else if (bitname == "cdc_b2b9") {bit = Trk_b2b_1to9;}
800 else if (bitname == "s2s3") {bit = s2s3 > 0;}
801 else if (bitname == "s2s5") {bit = s2s5 > 0;}
802 else if (bitname == "s2so") {bit = s2so > 0;}
803 else if (bitname == "s2f3") {bit = s2f3 > 0;}
804 else if (bitname == "s2f5") {bit = s2f5 > 0;}
805 else if (bitname == "s2fo") {bit = s2fo > 0;}
806 else if (bitname == "s2f30") {bit = s2f30;}
807 else if (bitname == "s2s30") {bit = s2s30;}
808 else if (bitname == "bwdsb") {bit = bwdsb > 0;}
809 else if (bitname == "bwdnb") {bit = bwdnb > 0;}
810 else if (bitname == "fwdsb") {bit = fwdsb > 0;}
811 else if (bitname == "fwdnb") {bit = fwdnb > 0;}
812 else if (bitname == "brlfb1") {bit = brlfb == 1;}
813 else if (bitname == "brlfb2") {bit = brlfb == 2;}
814 else if (bitname == "brlnb1") {bit = brlnb == 1;}
815 else if (bitname == "brlnb2") {bit = brlnb == 2;}
816 else if (bitname == "seklm_0") {bit = n_seklm == 1;}
817 else if (bitname == "seklm_1") {bit = n_seklm > 1;}
818 else if (bitname == "ieklm") {bit = n_ieklm > 0;}
819 else if (bitname == "secl") {bit = n_secl > 0;}
820 else if (bitname == "iecl") {bit = n_iecl > 0;}
821 else if (bitname == "iecl_0") {bit = n_iecl == 1;}
822 else if (bitname == "iecl_1") {bit = n_iecl > 1;}
823 else if (bitname == "ti") {bit = N_IT > 0;}
824 else if (bitname == "i2fo") {bit = i2fo > 0;}
825 else if (bitname == "i2io") {bit = i2io > 0;}
826 else if (bitname == "ehigh") {bit = ehigh;}
827 else if (bitname == "elow") {bit = elow;}
828 else if (bitname == "elum") {bit = elum;}
829 else if (bitname == "ecl_bha") {bit = ecl_bha;}
830 else if (bitname == "bha_type_0") {bit = bha_type0;}
831 else if (bitname == "bha_type_1") {bit = bha_type1;}
832 else if (bitname == "bha_type_2") {bit = bha_type2;}
833 else if (bitname == "bha_type_3") {bit = bha_type3;}
834 else if (bitname == "bha_type_4") {bit = bha_type4;}
835 else if (bitname == "bha_type_5") {bit = bha_type5;}
836 else if (bitname == "bha_type_6") {bit = bha_type6;}
837 else if (bitname == "bha_type_7") {bit = bha_type7;}
838 else if (bitname == "bha_type_8") {bit = bha_type8;}
839 else if (bitname == "bha_type_9") {bit = bha_type9;}
840 else if (bitname == "bha_type_10") {bit = bha_type10;}
841 else if (bitname == "bha_type_11") {bit = bha_type11;}
842 else if (bitname == "bha_type_12") {bit = bha_type12;}
843 else if (bitname == "bha_type_13") {bit = bha_type13;}
844 else if (bitname == "clst_0") {bit = nclst_0;}
845 else if (bitname == "clst_1") {bit = nclst_1;}
846 else if (bitname == "clst_2") {bit = nclst_2;}
847 else if (bitname == "clst_3") {bit = nclst_3;}
848 else if (bitname == "ecl_bg_0") {bit = ecl_bg_0;}
849 else if (bitname == "ecl_bg_1") {bit = ecl_bg_1;}
850 else if (bitname == "ecl_bg_2") {bit = ecl_bg_2;}
851 else if (bitname == "ecl_active") {bit = ecl_active;}
852 else if (bitname == "ecl_timing_fwd") {bit = ecl_timing_fwd;}
853 else if (bitname == "ecl_timing_brl") {bit = ecl_timing_brl;}
854 else if (bitname == "ecl_timing_bwd") {bit = ecl_timing_bwd;}
855 else if (bitname == "ecl_phys") {bit = ecl_phys;}
856 else if (bitname == "ecl_oflo") {bit = ecl_oflo;}
857 else if (bitname == "ecl_3dbha") {bit = ecl_3dbha;}
858 else if (bitname == "bha_veto") {bit = ecl_3dbha;}
859 else if (bitname == "ecl_lml_0") {bit = ecl_lml_0;}
860 else if (bitname == "ecl_lml_1") {bit = ecl_lml_1;}
861 else if (bitname == "ecl_lml_2") {bit = ecl_lml_2;}
862 else if (bitname == "ecl_lml_3") {bit = ecl_lml_3;}
863 else if (bitname == "ecl_lml_4") {bit = ecl_lml_4;}
864 else if (bitname == "ecl_lml_5") {bit = ecl_lml_5;}
865 else if (bitname == "ecl_lml_6") {bit = ecl_lml_6;}
866 else if (bitname == "ecl_lml_7") {bit = ecl_lml_7;}
867 else if (bitname == "ecl_lml_8") {bit = ecl_lml_8;}
868 else if (bitname == "ecl_lml_9") {bit = ecl_lml_9;}
869 else if (bitname == "ecl_lml_10") {bit = ecl_lml_10;}
870 else if (bitname == "ecl_lml_11") {bit = ecl_lml_11;}
871 else if (bitname == "ecl_lml_12") {bit = ecl_lml_12;}
872 else if (bitname == "ecl_lml_13") {bit = ecl_lml_13;}
873 else if (bitname == "ecl_mumu") {bit = ecl_mumu;}
874 else if (bitname == "ecl_bst") {bit = ecl_bst;}
875 else if (bitname == "ecl_taub2b") {bit = ecltaub2b;}
876 else if (bitname == "ecl_taub2b2") {bit = ecltaub2b2;}
877 else if (bitname == "ecl_taub2b3") {bit = ecltaub2b3;}
878 else if (bitname == "ehigh1") {bit = ehigh1;}
879 else if (bitname == "ehigh2") {bit = ehigh2;}
880 else if (bitname == "ehigh3") {bit = ehigh3;}
881 else if (bitname == "ehigh4") {bit = ehigh4;}
882
883 else if (bitname == "klm_hit") {bit = klm_hit;}
884 else if (bitname == "klm_0") {bit = klm_0;}
885 else if (bitname == "klm_1") {bit = klm_1;}
886 else if (bitname == "klm_2") {bit = klm_2;}
887 else if (bitname == "klmb2b") {bit = klmb2b;}
888 else if (bitname == "eklm_hit") {bit = eklm_hit;}
889 else if (bitname == "eklm_0") {bit = eklm_0;}
890 else if (bitname == "eklm_1") {bit = eklm_1;}
891 else if (bitname == "eklm_2") {bit = eklm_2;}
892 else if (bitname == "eklmb2b") {bit = eklmb2b;}
893 else if (bitname == "ecleklm") {bit = ecleklm;}
894 else if (bitname == "revo") {bit = false;}
895 else if (bitname == "her_kick") {bit = false;}
896 else if (bitname == "ler_kick") {bit = false;}
897 else if (bitname == "bha_delay") {bit = false;}
898 else if (bitname == "pseud_rand") {bit = false;}
899 else if (bitname == "plsin") {bit = false;}
900 else if (bitname == "poissonin") {bit = false;}
901 else if (bitname == "periodin") {bit = false;}
902 else if (bitname == "veto") {bit = false;}
903 else if (bitname == "samhem") {bit = nSameHem1Trk > 0;}
904 else if (bitname == "opohem") {bit = nOppHem1Trk > 0;}
905 else if (bitname == "n1gev_0") {bit = nclst1_0;}
906 else if (bitname == "n1gev_1") {bit = nclst1_1;}
907 else if (bitname == "n1gev_2") {bit = nclst1_2;}
908 else if (bitname == "n1gev_3") {bit = nclst1_3;}
909 else if (bitname == "n2gev_0") {bit = nclst2_0;}
910 else if (bitname == "n2gev_1") {bit = nclst2_1;}
911 else if (bitname == "n2gev_2") {bit = nclst2_2;}
912 else if (bitname == "n2gev_3") {bit = nclst2_3;}
913 else if (bitname == "cdcecl_0") {bit = cdcecl_0;}
914 else if (bitname == "cdcecl_1") {bit = cdcecl_1;}
915 else if (bitname == "cdcecl_2") {bit = cdcecl_2;}
916 else if (bitname == "cdcecl_3") {bit = cdcecl_3;}
917 else if (bitname == "c2gev_0") {bit = c2gev_0;}
918 else if (bitname == "c2gev_1") {bit = c2gev_1;}
919 else if (bitname == "c2gev_2") {bit = c2gev_2;}
920 else if (bitname == "c2gev_3") {bit = c2gev_3;}
921 else if (bitname == "cdcklm_0") {bit = cdcklm_0;}
922 else if (bitname == "cdcklm_1") {bit = cdcklm_1;}
923 else if (bitname == "cdcklm_2") {bit = cdcklm_2;}
924 else if (bitname == "cdcklm_3") {bit = cdcklm_3;}
925 else if (bitname == "d3") {bit = cluster_b2b_1to3 > 0;}
926 else if (bitname == "d5") {bit = cluster_b2b_1to5 > 0;}
927 else if (bitname == "d7") {bit = cluster_b2b_1to7 > 0;}
928 else if (bitname == "d9") {bit = cluster_b2b_1to9 > 0;}
929 else if (bitname == "p3") {bit = Trkcluster_b2b_1to3 > 0;}
930 else if (bitname == "p5") {bit = Trkcluster_b2b_1to5 > 0;}
931 else if (bitname == "p7") {bit = Trkcluster_b2b_1to7 > 0;}
932 else if (bitname == "p9") {bit = Trkcluster_b2b_1to9 > 0;}
933 else if (bitname == "trkfit") {bit = false;}
934 else if (bitname == "injv") {bit = false;}
935 else if (bitname == "nimin0") {bit = false;}
936 else if (bitname == "nimin1") {bit = false;}
937 else if (bitname == "track") {bit = nTrk2D > 0;}
938 else if (bitname == "bha_intrk") {bit = bha_intrk;}
939 else if (bitname == "bha_theta_0") {bit = bha_theta_0;}
940 else if (bitname == "bha_theta_1") {bit = bha_theta_1;}
941 else if (bitname == "ecl_bhapur") {bit = ecl_bhapur;}
942
943 //GRL related bits, not perfect. To do: judge bhabha cluster or not correctly
944 else if (bitname == "trkbha1") {bit = trkbha1;}
945 else if (bitname == "trkbha2") {bit = trkbha2;}
946
947 //GRL related bits, not ready
948 else if (bitname == "ta_0") {bit = false;}
949 else if (bitname == "ta_1") {bit = false;}
950 else if (bitname == "ta_2") {bit = false;}
951 else if (bitname == "ta_3") {bit = false;}
952 else if (bitname == "trkflt") {bit = false;}
953 else if (bitname == "tsf0b2b") {bit = false;}
954 else if (bitname == "tsf1b2b") {bit = false;}
955 else if (bitname == "tsf2b2b") {bit = false;}
956 else if (bitname == "grlgg1") {bit = false;}
957 else if (bitname == "grlgg2") {bit = false;}
958
959 //KLM TOP ECL not ready
960 else if (bitname == "ecl_bhauni") {bit = false;}
961 else if (bitname == "cdctop_0") {bit = false;}
962 else if (bitname == "cdctop_1") {bit = false;}
963 else if (bitname == "cdctop_2") {bit = false;}
964 else if (bitname == "cdctop_3") {bit = false;}
965 else if (bitname == "top_0") {bit = false;}
966 else if (bitname == "top_1") {bit = false;}
967 else if (bitname == "top_2") {bit = false;}
968 else if (bitname == "top_bb") {bit = false;}
969 else if (bitname == "top_active") {bit = false;}
970
971 //other trigger bits
972 else if (bitname == "itsfb2b") {bit = false;}
973 else if (bitname == "inp156") {bit = false;}
974 else if (bitname == "inp157") {bit = false;}
975 else if (bitname == "inp158") {bit = false;}
976 else if (bitname == "inp159") {bit = false;}
977
978 //new tau bit
979 else if (bitname == "ecl_taunn") {bit = ecltaunn;}
980
981 //DITTO: please don't change the WARNING message below.
982 //If you change it, please update the test trg_tsim_check_warnings.py accordingly.
983 //else B2WARNING("Unknown bitname" << LogVar("bitname", bitname));
984 else {
985 bit = false;
986 bool notcontain = std::find(m_falsebits.begin(), m_falsebits.end(), bitname) == m_falsebits.end();
987 if (notcontain) m_falsebits.push_back(bitname);
988 }
989
990 trgInfo->setInputBits(i, bit);
991 }
992
993}
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
DBObjPtr< TRGGDLDBInputBits > m_InputBitsDB
Data base of GDL input bits.
double atan(double a)
atan for double
Definition: beamHelpers.h:34
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

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

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

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

◆ getAllConditionPaths()

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

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

Definition at line 150 of file Module.cc.

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

◆ getAllConditions()

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

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 314 of file Module.h.

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

◆ getConditionPath()

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

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


Definition at line 113 of file Module.cc.

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

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

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

◆ getFileNames()

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

Return a list of output filenames for this modules.

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

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

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

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

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

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

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

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

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

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

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

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

Definition at line 187 of file Module.h.

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

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

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

Returns a python list of all parameters.

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

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

Definition at line 279 of file Module.cc.

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

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

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

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

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

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 311 of file Module.h.

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

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

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

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

Definition at line 160 of file Module.cc.

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

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

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

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

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

Definition at line 166 of file Module.cc.

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

◆ if_false()

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

A simplified version to add a condition to the module.

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

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

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

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

Definition at line 85 of file Module.cc.

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

◆ if_true()

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

A simplified version to set the condition of the module.

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

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

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

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

Definition at line 90 of file Module.cc.

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

◆ if_value()

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

Add a condition to the module.

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

See https://confluence.desy.de/display/BI/Software+ModCondTut or ModuleCondition for a description of the syntax.

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

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

Definition at line 79 of file Module.cc.

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

◆ initialize()

void initialize ( void  )
overridevirtual

Initilizes TRGGRLProjectsModule.

Reimplemented from Module.

Definition at line 135 of file TRGGRLProjectsModule.cc.

136{
137 radtodeg = 180. / TMath::Pi();
138 //..Trigger ThetaID for each trigger cell. Could be replaced by getMaxThetaId() for newer MC
139 TrgEclMapping* eclMapping = new TrgEclMapping();
140 for (int tc = 1; tc <= 576; tc++) {
141 TCThetaID.push_back(eclMapping->getTCThetaIdFromTCId(tc));
142 }
143
144 //-----------------------------------------------------------------------------------------
145 //..ECL look up tables
146 PCmsLabTransform boostrotate;
147 for (int tc = 1; tc <= 576; tc++) {
148
149 //..Four vector of a 1 GeV lab photon at this TC
150 ROOT::Math::XYZVector CellPosition = eclMapping->getTCPosition(tc);
151 ROOT::Math::PxPyPzEVector CellLab;
152 CellLab.SetPx(CellPosition.X() / CellPosition.R());
153 CellLab.SetPy(CellPosition.Y() / CellPosition.R());
154 CellLab.SetPz(CellPosition.Z() / CellPosition.R());
155 CellLab.SetE(1.);
156
157 //..cotan Theta and phi in lab
158 TCPhiLab.push_back(CellPosition.Phi()*radtodeg);
159 double tantheta = tan(CellPosition.Theta());
160 TCcotThetaLab.push_back(1. / tantheta);
161
162 //..Corresponding 4 vector in the COM frame
163 ROOT::Math::PxPyPzEVector CellCOM = boostrotate.rotateLabToCms() * CellLab;
164 TCThetaCOM.push_back(CellCOM.Theta()*radtodeg);
165 TCPhiCOM.push_back(CellCOM.Phi()*radtodeg);
166
167 //..Scale to give 1 GeV in the COM frame
168 TC1GeV.push_back(1. / CellCOM.E());
169 }
170
171 //m_TRGGRLInfo.registerInDataStore(m_TrgGrlInformationName);
172 delete eclMapping;
173}
Class to hold Lorentz transformations from/to CMS and boost vector.
const ROOT::Math::LorentzRotation rotateLabToCms() const
Returns Lorentz transformation from Lab to CMS.
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
ROOT::Math::XYZVector getTCPosition(int)
TC position (cm)

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

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

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

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

◆ setDescription()

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

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

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

Definition at line 73 of file Module.cc.

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

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

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

◆ setName()

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

Set the name of the module.

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

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

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

Implements a method for setting boost::python objects.

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

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

Definition at line 234 of file Module.cc.

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

◆ setParamPythonDict()

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

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

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

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

Definition at line 249 of file Module.cc.

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

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

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

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

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

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

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

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

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

◆ setType()

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

Set the module type.

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

Definition at line 48 of file Module.cc.

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

◆ terminate()

void terminate ( void  )
overridevirtual

Called when processing ended.

Reimplemented from Module.

Definition at line 1008 of file TRGGRLProjectsModule.cc.

1009{
1010
1011}

Member Data Documentation

◆ _debugLevel

int _debugLevel
private

returns version of TRGGRLProjectsModule.

Debug level.

Definition at line 64 of file TRGGRLProjectsModule.h.

◆ m_2DfinderCollectionName

std::string m_2DfinderCollectionName
private

Name of the StoreArray holding the tracks made by the 2D finder.

Definition at line 92 of file TRGGRLProjectsModule.h.

◆ m_2DfitterCollectionName

std::string m_2DfitterCollectionName
private

Name of the StoreArray holding the tracks made by the 2D fitter.

Definition at line 94 of file TRGGRLProjectsModule.h.

◆ m_2DmatchCollectionName

std::string m_2DmatchCollectionName
private

Name of the StoreArray holding the matched 2D tracks.

Definition at line 84 of file TRGGRLProjectsModule.h.

◆ m_3DfitterCollectionName

std::string m_3DfitterCollectionName
private

Name of the StoreArray holding the tracks made by the 3D fitter.

Definition at line 96 of file TRGGRLProjectsModule.h.

◆ m_3DmatchCollectionName

std::string m_3DmatchCollectionName
private

Name of the StoreArray holding the matched 3D tracks.

Definition at line 88 of file TRGGRLProjectsModule.h.

◆ m_belle2phase

std::string m_belle2phase
private

choose the corresponding trigger menu of Belle2 phase

Definition at line 67 of file TRGGRLProjectsModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_configFilename

std::string m_configFilename
private

Config. file name.

Definition at line 70 of file TRGGRLProjectsModule.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_eclClusterTimeWindow

double m_eclClusterTimeWindow
private

ecl cluster time window to suppress beam induced background

Definition at line 113 of file TRGGRLProjectsModule.h.

◆ m_energythreshold

std::vector<double> m_energythreshold
private

the collection of energy threshold used in the projects

Definition at line 111 of file TRGGRLProjectsModule.h.

◆ m_falsebits

std::vector<std::string> m_falsebits
private

convert the unit of angle from rad to degree

the collection of unknown bits (not ready in TSIM)

Definition at line 121 of file TRGGRLProjectsModule.h.

◆ m_fastSimulationMode

int m_fastSimulationMode
private

Switch for the fast simulation.

0:do everything, 1:stop after the track segment simulation. Default is 0.

Definition at line 78 of file TRGGRLProjectsModule.h.

◆ m_firmwareSimulationMode

int m_firmwareSimulationMode
private

Switch for the firmware simulation. 0:do nothing, 1:do everything.

Definition at line 81 of file TRGGRLProjectsModule.h.

◆ m_grlphotonlist

std::string m_grlphotonlist
private

Name of the StoreArray holding projects information from grlphoton.

Definition at line 100 of file TRGGRLProjectsModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_InputBitsDB

DBObjPtr<TRGGDLDBInputBits> m_InputBitsDB
private

Data base of GDL input bits.

Definition at line 115 of file TRGGRLProjectsModule.h.

◆ m_klmmatch_tracklist

std::string m_klmmatch_tracklist
private

the matched 2d track list by KLM matching

Definition at line 90 of file TRGGRLProjectsModule.h.

◆ m_KLMTrgSummaryName

std::string m_KLMTrgSummaryName
private

Name of the collection of KLM TRG.

Definition at line 109 of file TRGGRLProjectsModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

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

Definition at line 508 of file Module.h.

◆ m_NNCollectionName

std::string m_NNCollectionName
private

Name of the StoreArray holding the tracks made by NN.

Definition at line 103 of file TRGGRLProjectsModule.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 510 of file Module.h.

◆ m_phimatch_tracklist

std::string m_phimatch_tracklist
private

the matched 2d track list by phi matching

Definition at line 86 of file TRGGRLProjectsModule.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

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

Definition at line 512 of file Module.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_simulationMode

int m_simulationMode
private

Mode for TRGGRL simulation.

0th bit : fast simulation switch, 1st bit : firmware simulation switch.

Definition at line 74 of file TRGGRLProjectsModule.h.

◆ m_TrgECLClusterName

std::string m_TrgECLClusterName
private

Name of the StoreArray holding the eclclusters.

Definition at line 105 of file TRGGRLProjectsModule.h.

◆ m_TrgECLTrgsName

std::string m_TrgECLTrgsName
private

Name of the StoreArray holding the ecl trg result.

Definition at line 107 of file TRGGRLProjectsModule.h.

◆ m_TrgGrlInformationName

std::string m_TrgGrlInformationName
private

Name of the StoreArray holding projects information from grl.

Definition at line 98 of file TRGGRLProjectsModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.


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