Belle II Software  release-08-01-10
framework
Collaboration diagram for framework:

Modules

 framework data objects
 
 framework modules
 

Classes

class  CreateConsistencyInfoModule
 If you want to merge two events with the 'MergeDataStoreModule', it might be necessary to make sure that this combination of events make sense. More...
 
class  DataFlowVisualization
 class to visualize data flow between modules. More...
 
class  Environment
 This class stores all environment information required to run the framework, such as module or data filepaths, number of processes to be used in parallel processing etc. More...
 
class  EventProcessor
 provides the core event processing loop. More...
 
class  FileCatalog
 This class provides an interface to the file (metadata) catalog. More...
 
class  HistoModule
 HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions to be managed by HistoManager. More...
 
class  InputController
 A static class to control supported input modules. More...
 
class  MemoryPool< T, chunkSize >
 Class to provide a constant access time memory pool for one kind of objects. More...
 
class  MergeDataStoreModule
 Internal module used by Path.add_independent_merge_path(). More...
 
class  MetadataService
 This class provides a service for writing metadata about the basf2 execution and about output files to a json file. More...
 
class  Module
 Base class for Modules. More...
 
class  ModuleProxyBase
 The base module proxy class is used to create new instances of a module. More...
 
class  ModuleCondition
 Wraps a condition set on a Module instance. More...
 
class  ModuleManager
 The ModuleManager Class. More...
 
class  ModuleParam< T >
 A single parameter of the module. More...
 
class  ModuleParamBase
 Base class for module parameter. More...
 
class  ModuleParamInfoPython
 Class to store basic information about a parameter. More...
 
class  ModuleParamList
 The Module parameter list class. More...
 
class  ModuleStatistics
 Keep track of time and memory consumption during processing. More...
 
class  MRUCache< KEY, VALUE >
 Class implementing a generic Most Recently Used cache. More...
 
class  Path
 Implements a path consisting of Module and/or Path objects. More...
 
class  PathElement
 Base for classes that can be elements of a Path. More...
 
class  PathIterator
 Iterator over a Path (returning Module pointers). More...
 
class  ProcessStatistics
 Class to collect call statistics for all modules. More...
 
class  PyModule
 Python wrapper for Belle2::Module. More...
 
class  RandomGenerator
 Fast Random number Generator using on xorshift1024* [arXiv:1402.6246]. More...
 
class  RandomNumbers
 The class for handling the random number generation. More...
 
class  SteerRootInputModule
 Internal module used by Path.add_independent_merge_path(). More...
 
class  SubEventModule
 Framework-internal module that implements the functionality of Path::forEach() as well as Path::doWhile(). More...
 
class  SwitchDataStoreModule
 Internal module used by Path.add_independent_path(). More...
 
class  Database
 Singleton base class for the low-level interface to the database. More...
 
class  DBAccessorBase
 Base class for DBObjPtr and DBArray for easier common treatment. More...
 
class  DBArray< T >
 Class for accessing arrays of objects in the database. More...
 
class  OptionalDBArray< T >
 Optional DBArray: This class behaves the same as the DBArray except that it will not raise errors when an object could not be found in the database. More...
 
class  DBImportArray< T >
 Class for importing array of objects to the database. More...
 
class  DBImportBase
 Base class for importing objects to the database. More...
 
class  DBImportObjPtr< T >
 Class for importing a single object to the database. More...
 
class  DBObjPtr< T >
 Class for accessing objects in the database. More...
 
class  OptionalDBObjPtr< T >
 Optional DBObjPtr: This class behaves the same as the DBObjPtr except that it will not raise errors when an object could not be found in the database. More...
 
class  DBPointer< T, KEY, METHOD, NAME >
 Class for pointing to an element in an array stored in the database. More...
 
class  DBStore
 Singleton class to cache database objects. More...
 
class  DBStoreEntry
 Class to hold one entry from the ConditionsDB in the DBStore. More...
 
class  EventDependency
 Class for handling changing conditions as a function of event number. More...
 
class  IntervalOfValidity
 A class that describes the interval of experiments/runs for which an object in the database is valid. More...
 
class  IntraRunDependency
 Base class for handling changing conditions during a run. More...
 
class  PayloadFile
 A wrapper class for payload files used by the Database and DBStore classes. More...
 
class  DBObjPtr< PayloadFile >
 Specialization of DBObjPtr in case of PayloadFiles. More...
 
class  RelationVector< T >
 Class for type safe access to objects that are referred to in relations. More...
 
class  DataStore
 In the store you can park objects that have to be accessed by various modules. More...
 
class  DependencyMap
 Collect information about the dependencies between modules. More...
 
class  StoreArray< T >
 Accessor to arrays stored in the data store. More...
 
class  RelationArray
 Low-level class to create/modify relations between StoreArrays. More...
 
struct  RelationEntry
 Struct for relations. More...
 
class  RelationIndex< FROM, TO >
 Provides access to fast ( O(log n) ) bi-directional lookups on a specified relation. More...
 
class  RelationIndexBase
 Baseclass for all RelationIndexContainers. More...
 
class  RelationIndexContainer< FROM, TO >
 Class to store a bidirectional index between two StoreArrays. More...
 
class  RelationIndexManager
 Manager to keep a cache of existing RelationIndexContainers. More...
 
class  RelationsInterface< BASE >
 Defines interface for accessing relations of objects in StoreArray. More...
 
class  RelationVectorBase
 base class for RelationVector<T> More...
 
class  SelectSubsetBase
 Type-independent implementation details of SelectSubset. More...
 
class  SelectSubset< StoredClass >
 Class to create a subset of a given StoreArray together with the relations with other StoreArrays. More...
 
class  StoreAccessorBase
 Base class for StoreObjPtr and StoreArray for easier common treatment. More...
 
struct  StoreEntry
 Wraps a stored array/object, stored under unique (name, durability) key. More...
 
class  StoreObjPtr< T >
 Type-safe access to single objects in the data store. More...
 
class  BeamParameters
 This class contains the nominal beam parameters and the parameters used for smearing of the primary vertex and the beam energy and momentum. More...
 
class  BunchStructure
 Class to store the fill pattern of colliding bunches. More...
 
class  HardwareClockSettings
 Database object containing the nominal accelerator RF value and the prescales to derive the clock frequencies of the sub-detectors. More...
 
class  MagneticField
 Magnetic field map. More...
 
class  MagneticFieldComponent
 Abstract base class for BField components. More...
 
class  MagneticFieldComponentConstant
 Describe one component of the Geometry. More...
 
class  RunInfo
 Database object for Run Information. More...
 
class  Const
 This class provides a set of constants for the framework. More...
 
class  Gearbox
 Singleton class responsible for loading detector parameters from an XML file. More...
 
struct  InputHandlerFactory< T >
 Helper class to easily register new input handlers. More...
 
class  GearDir
 GearDir is the basic class used for accessing the parameter store. More...
 
class  Unit
 The Unit class. More...
 
class  B2Vector3< DataType >
 A fast and root compatible alternative to TVector3. More...
 
class  BFieldManager
 Bfield manager to obtain the magnetic field at any point. More...
 
class  LogConfig
 The LogConfig class. More...
 
class  LogConnectionBase
 Abstract base class for the different types of log connections. More...
 
class  LogConnectionConsole
 Implements a log connection to an IO Stream. More...
 
class  LogConnectionFilter
 Implements a log connection that filters repeated messages. More...
 
class  LogConnectionJSON
 Implements a log connection to stdout but with messages formatted as json objects to allow easy parsing by other tools, say jupyter notebooks. More...
 
class  LogConnectionTxtFile
 Implements a log connection to a text file. More...
 
class  LogConnectionUDP
 Log Connection to send the log message as JSON to a UDP server. More...
 
class  LogMessage
 The LogMessage class. More...
 
class  LogMethod
 The LogMethod class. More...
 
class  LogSystem
 Class for logging debug, info and error messages. More...
 
class  EvtGenDatabasePDG
 Replacement for TDatabasePDG that is filled from EvtGen's evt.pdl. More...
 
class  EvtGenParticlePDG
 Helper class for setting additional TParticlePDG members and storing the ones it doesn't have yet. More...
 
class  AsyncWrapper
 Wraps a given Module to execute it asynchronously. More...
 
class  DataStoreStreamer
 Stream/restore DataStore objects to/from EvtMessage. More...
 
struct  EvtHeader
 Header structure of streamed object list. More...
 
class  EvtMessage
 Class to manage streamed object. More...
 
class  GlobalProcHandler
 A class to manage processes for parallel processing. More...
 
class  MapMergeable< T >
 Wrap an STL map to make it mergeable. More...
 
class  Mergeable
 Abstract base class for objects that can be merged. More...
 
class  CharBuffer
 dynamic character buffer that knows its size. More...
 
class  InMessage
 Reusable Message class derived from TMessage (for reading only) More...
 
class  MsgHandler
 A class to encode/decode an EvtMessage. More...
 
class  PathUtils
 Helper utils for path arithmetics needed in the pEventProcessor. More...
 
class  pEventProcessor
 This class provides the core event processing loop for parallel processing. More...
 
class  ProcessMonitor
 Class to monitor all started framework processes (input, workers, output), kill them if requested and handle the signals from the OS. More...
 
class  ProcHandler
 A class to manage processes for parallel processing. More...
 
class  RbTupleManager
 Class to manage histograms defined in registered modules. More...
 
struct  RingBufInfo
 Internal metadata structure for RingBuffer. More...
 
class  RingBuffer
 Class to manage a Ring Buffer placed in an IPC shared memory. More...
 
class  RootMergeable< T >
 Wrap a root histogram or TNtuple to make it mergeable. More...
 
class  RxModule
 Module to decode data store contents from RingBuffer. More...
 
class  SemaphoreLocker
 Handles creation, locking and unlocking of System V semaphores. More...
 
class  SeqFile
 A class to manage I/O for a chain of blocked files. More...
 
class  SetMergeable< T >
 Wrap an STL set to make it mergeable. More...
 
class  TxModule
 Module for encoding data store contents into a RingBuffer. More...
 
class  ZMQEventProcessor
 This class provides the core event processing loop for parallel processing with ZMQ. More...
 
class  ZMQConfirmedInput
 Input part of a confirmed connection. More...
 
class  ZMQConfirmedOutput
 Output part of a confirmed connection. More...
 
class  ZMQConnection
 Base class for every connection with virtual functions to be implemented: More...
 
class  ZMQConnectionOverSocket
 Specialized connection over a ZMQ socket. More...
 
class  ZMQLoadBalancedInput
 Input part of a load-balanced connection. More...
 
class  ZMQLoadBalancedOutput
 Output part of a load-balanced connection. More...
 
class  ZMQNullConnection
 Connection doing just nothing: without the capability to pull, send or receive. Useful for template interfaces. More...
 
class  ZMQRawInput
 Input connection allowing to speak with non-zmq sockets via a ZMQ_STREAM socket. More...
 
class  ZMQRawOutput
 Output connection to speak to non-zmq sockets via a ZMQ_STREAM socket. More...
 
class  ZMQSimpleConnection
 Connection type to be used for answering simple requests, e.g. More...
 
class  ZMQIdMessage
 A message with the socket ID. Needed in input<->worker communication. More...
 
class  ZMQMessageFactory
 Helper class for creating new ID/No-ID messages. More...
 
class  ZMQMessageHelper
 Internal helper for creating ZMQ messages (should not be used otherwise). More...
 
class  ZMQModuleMessage< AMessageFrameNumber >
 A general message with as many parts as given as template argument. More...
 
class  ZMQNoIdMessage
 A message without an associated socket ID. Is used in most cases. More...
 
class  ProcessedEventBackup
 Storage item for the event backup storing the event message, the time stamp and the event meta data. More...
 
class  ProcessedEventsBackupList
 List-like structure for storing and retaining event backups. More...
 
class  ZMQRxOutputModule
 Module connecting the worker path with the output path on the output side. More...
 
class  ZMQRxWorkerModule
 Module connecting the input path with the worker path on the worker side. More...
 
class  ZMQTxInputModule
 Module connecting the input path with the worker path on the input side. More...
 
class  ZMQTxWorkerModule
 Module connecting the worker path with the output path on the worker side. More...
 
class  ZMQClient
 A helper class for communicating over ZMQ. Includes a multicast and (if needed) also a data socket. More...
 
class  EventMetaDataSerialization
 Helper class for (de)serializing the event meta data used for the event backup transferral. More...
 
class  StreamHelper
 Helper class for data store serialization. More...
 
class  ZMQAddressUtils
 Summary of some address helpers. More...
 
class  ZMQLogger
 Base class for the ZMQ connection to help monitor and log certain values. More...
 
class  ZMQParent
 A helper class for creating ZMQ sockets keeping track of the ZMQ context and terminating it if needed. More...
 
class  Framework
 This class combines all subsystems of the framework, and exports the main interface to Python. More...
 
class  LogPythonInterface
 Thin wrapper to expose a usable interface to the logging framework in python. More...
 
class  ProcessStatisticsPython
 Python interface for ProcessStatistics. More...
 
class  PyDBArray
 Class to access a DB Array from Python. More...
 
class  PyDBObj
 Class to access a DBObjPtr from Python. More...
 
class  PyStoreArray
 A (simplified) python wrapper for StoreArray. More...
 
class  PyStoreObj
 a (simplified) python wrapper for StoreObjPtr. More...
 
class  AbstractBooleanNode< AVariableManager >
 A parsed cut-string naturally has a tree shape which incorporates the infomation of operator precedence and evaluation order of the statements. More...
 
class  AbstractExpressionNode< AVariableManager >
 AbstractExpressionNode Superclass for all nodes which host expressions. More...
 
class  BaseAngle
 Class to compare if two angles are compatible withing a given error range. More...
 
class  ThetaAngle
 
class  PhiAngle
 
class  ObjArrayIterator< ArrayType, ValueType >
 Optimizes class to iterate over TObjArray and classes inheriting from it. More...
 
class  ArrayIterator< ArrayType, ValueType >
 Generic iterator class for arrays, allowing use of STL algorithms, range-based for etc. More...
 
class  CalcMeanCov< N, RealType >
 Class to calculate mean and and covariance between a number of parameters on running data without storing the actual values, also for weighted entries. More...
 
class  ConditionalGaussGenerator
 Class implementing n-dimensional random number generator from Gaussian distribution where the first component of the vector is generated first (using some external source) and the remaining components are generated based on the value of the first component. More...
 
struct  Visitor< operation >
 This is a class template which takes a template class operation as template argument. More...
 
struct  EqualVisitor
 Seperate Visitor struct for equal_to comparison of variant<double, int bool>. More...
 
class  UnaryBooleanNode< AVariableManager >
 Nodeclass with a single AbstractBooleanNode as child. More...
 
class  BinaryBooleanNode< AVariableManager >
 Nodeclass with two AbstractBooleanNode as children and a Boolean Operator (AND, OR) Check() method evaluates the child nodes and returns the result of the boolean operation. More...
 
class  UnaryRelationalNode< AVariableManager >
 Nodeclass with a single AbstractExpressioNode as child. More...
 
class  BinaryRelationalNode< AVariableManager >
 BooleanNode which has two AbstractExpressionNodes nodes and a ComparisonOperator. More...
 
class  TernaryRelationalNode< AVariableManager >
 BooleanNode which has three AbstractExpressionNodes nodes and two ComparisonOperator. More...
 
class  UnaryExpressionNode< AVariableManager >
 UnaryExpressionNode Node class with a single expression node as child. More...
 
class  BinaryExpressionNode< AVariableManager >
 BinaryExpressionNode Node which connects two expression nodes with an arithemtic operation. More...
 
class  DataNode< AVariableManager, T >
 Template class for storing the Constants (int, double, bool) of the Cutstring. More...
 
class  IdentifierNode< AVariableManager >
 Class which stores the name of a variable. More...
 
class  FunctionNode< AVariableManager >
 FunctionNode Node class for handling MetaVariables in cuts. More...
 
class  EnvironmentVariables
 Utility functions related to environment variables. More...
 
class  FileSystem
 Utility functions related to filename validation and filesystem access. More...
 
class  FormulaParserBase
 Base class with the non-templated part of the formula parser. More...
 
class  FormulaParser< VariableConstructor >
 FormulaParser to parse a text formula like "a + b * c ^ d" where the separate parts can be either variables (with and without arguments) or numbers. More...
 
struct  StringFormulaConstructor
 Example struct to be used with the FormulaParser to create a string representation of the formula, mainly for testing and debugging. More...
 
class  GeneralCut< AVariableManager >
 This class implements a common way to implement cut/selection functionality for arbitrary objects. More...
 
class  KeyValuePrinter
 create human-readable or JSON output for key value pairs. More...
 
class  MakeROOTCompatible
 Helper class for converting strings into a ROOT-friendly format (e.g. More...
 
class  MultivariateNormalGenerator
 Class to generate normal distributed, correlated random numbers given the mean values and the covariance matrix of all dimensions. More...
 
class  NodeFactory
 Wrapper class for static node compile functions. More...
 
class  BoostPythonModuleProxy
 Proxy class to register python modules (the things you can 'import'). More...
 
class  RootFileCreationManager
 This single instance class takes track of all open ROOT files open in "create" mode, usually meant for all the ntuple output modules. More...
 
class  ScopeGuard
 Simple ScopeGuard to execute a function at the end of the object lifetime. More...
 
struct  TRandomWrapper
 Wrap TRandom to be useable as a uniform random number generator with STL algorithms like std::shuffle. More...
 
class  SHA3Hash
 Simple interface to calculate SHA3 hash sum (FIPS 202 draft) with fixed size from given data inputs. More...
 
class  ShakeHash
 Simple interface to calculate SHAKE256 hash sum (FIPS 202 draft) with variable size from given data inputs. More...
 

Macros

#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
 Macro that defines an exception with the given message template. More...
 
#define _PACKAGE_   ""
 make sure REG_MODULE works outside the normal build system
 
#define REG_MODULE(moduleName)
 Register the given module (without 'Module' suffix) with the framework. More...
 
#define B2_GEARBOX_REGISTER_INPUTHANDLER(classname, prefix)    InputHandlerFactory<classname> Gearbox_InputHandlerFactory_##classname(prefix)
 Helper macro to easily register new input handlers. More...
 
#define DEFINE_UNIT_NAME(var, value, name)   const double Unit::var = Unit::registerConversion(name,value)
 Define a new Unit given a name for the conversion table.
 
#define DEFINE_UNIT(var, value)   DEFINE_UNIT_NAME(var,value,#var)
 Define a new Unit and take the variable name as name for the conversion table.
 
#define REGISTER_PYTHON_MODULE(moduleName)   Belle2::BoostPythonModuleProxy boostPythonModuleProxy##moduleName(#moduleName, PyInit_##moduleName);
 Register a python module to make available when loading the library. More...
 
#define REGISTER_PYTHON_MODULE_AUTOIMPORT(moduleName)   Belle2::BoostPythonModuleProxy boostPythonModuleProxy##moduleName(#moduleName, PyInit_##moduleName, true);
 Identical to REGISTER_PYTHON_MODULE(), but will also import the module into the global namespace after loading it. More...
 
#define B2INFO_MEASURE_TIME(txt, ...)
 Print an INFO message txt followed by the time it took to execute the statment given as second argument. More...
 
#define branch_unlikely(x)   (x)
 A macro to tell the compiler that the argument x will be very likely be false. More...
 
#define branch_likely(x)   (x)
 Usage: More...
 

Typedefs

typedef std::shared_ptr< ModuleModulePtr
 Defines a pointer to a module object as a boost shared pointer.
 
typedef std::list< ModulePtrModulePtrList
 Defines a std::list of shared module pointers.
 
using ModuleParamPtr = std::shared_ptr< ModuleParamBase >
 Defines a pointer to a module parameter as a boost shared pointer. *‍/.
 
typedef std::shared_ptr< PathPathPtr
 Defines a pointer to a path object as a boost shared pointer.
 
typedef RelationsInterface< TObject > RelationsObject
 Provides interface for getting/adding relations to objects in StoreArrays. More...
 
typedef std::pair< std::string, DataStore::EDurabilityAccessorParams
 Pair of parameters needed to find an object in the DataStore.
 
typedef B2Vector3< double > B2Vector3D
 typedef for common usage with double
 
typedef B2Vector3< float > B2Vector3F
 typedef for common usage with float
 

Enumerations

enum  ERecordType {
  MSG_EVENT ,
  MSG_BEGIN_RUN ,
  MSG_END_RUN ,
  MSG_TERMINATE ,
  MSG_NORECORD ,
  MSG_STREAMERINFO
}
 What type of message is this? More...
 
enum class  ProcType {
  c_Input = 'i' ,
  c_Worker = 'w' ,
  c_Output = 'o' ,
  c_Proxy = 'p' ,
  c_Monitor = 'm' ,
  c_Init = '0' ,
  c_Stopped = 's'
}
 Type of the process used for storing and mapping the child processes in the process handler. More...
 
enum class  EMessageTypes {
  c_confirmMessage = 'c' ,
  c_helloMessage = 'h' ,
  c_deleteWorkerMessage = 'd' ,
  c_lastEventMessage = 'l' ,
  c_readyMessage = 'r' ,
  c_terminateMessage = 'x' ,
  c_rawDataMessage = 'u' ,
  c_compressedDataMessage = 'v' ,
  c_eventMessage = 'w' ,
  c_goodbyeMessage = 'g' ,
  c_statisticMessage = 's' ,
  c_killWorkerMessage = 'k' ,
  c_monitoringMessage = 'm' ,
  c_newRunMessage = 'n'
}
 Type the messages can have.
 
enum  ZMQAddressType {
  c_input ,
  c_output ,
  c_pub ,
  c_sub ,
  c_control
}
 The type of a ZMQ socket address (which socket to use) More...
 
enum class  NodeType : int {
  UnaryBooleanNode ,
  BinaryBooleanNode ,
  UnaryRelationalNode ,
  BinaryRelationalNode ,
  TernaryRelationalNode ,
  UnaryExpressionNode ,
  BinaryExpressionNode ,
  FunctionNode ,
  IdentifierNode ,
  DoubleNode ,
  IntegerNode ,
  BooleanNode
}
 Enum of possible Nodes in parsing tree. More...
 
enum class  BooleanOperator : int {
  AND ,
  OR
}
 Enum for decoding the boolean operator type. More...
 
enum class  ComparisonOperator : int {
  EQUALEQUAL ,
  GREATEREQUAL ,
  LESSEQUAL ,
  GREATER ,
  LESS ,
  NOTEQUAL
}
 Enum for decoding the comparison operator type. More...
 
enum class  ArithmeticOperation : int {
  PLUS ,
  MINUS ,
  PRODUCT ,
  DIVISION ,
  POWER
}
 Enum for decoding the comparison operator type. More...
 

Functions

template<class T >
boost::python::object createROOTObjectPyCopy (const T &instance)
 Create a python wrapped copy from a class instance which has a ROOT dictionary. More...
 
std::istream & operator>> (std::istream &input, IntervalOfValidity &iov)
 
std::ostream & operator<< (std::ostream &output, const IntervalOfValidity &iov)
 
 ADD_BITMASK_OPERATORS (DataStore::EStoreFlags)
 Add bitmask operators to DataStore::EStoreFlags.
 
 DEFINE_UNIT (cm, 1.)
 Standard units with the value = 1. More...
 
 DEFINE_UNIT (ns, 1.)
 Standard of [time].
 
 DEFINE_UNIT (GHz, 1.)
 Standard of [frequency].
 
 DEFINE_UNIT (rad, 1.)
 Standard of [angle].
 
 DEFINE_UNIT (GeV, 1.)
 Standard of [energy, momentum, mass].
 
 DEFINE_UNIT (K, 1.)
 Standard of [temperature].
 
 DEFINE_UNIT (e, 1.)
 Standard of [electric charge].
 
 DEFINE_UNIT_NAME (g_cm3, 1., "g/cm3")
 Practical units with the value = 1. More...
 
 DEFINE_UNIT (km, Unit::cm *1e5)
 Derived units. More...
 
 DEFINE_UNIT (m, Unit::cm *1e2)
 [meters]
 
 DEFINE_UNIT (mm, Unit::m *1e-3)
 [millimeters]
 
 DEFINE_UNIT (um, Unit::m *1e-6)
 [micrometers]
 
 DEFINE_UNIT (nm, Unit::m *1e-9)
 [nanometers]
 
 DEFINE_UNIT (pm, Unit::m *1e-12)
 [picometers]
 
 DEFINE_UNIT (fm, Unit::m *1e-15)
 [femtometers]
 
 DEFINE_UNIT (m2, Unit::m *Unit::m)
 [square meters]
 
 DEFINE_UNIT (cm2, Unit::cm *Unit::cm)
 [square centimeters]
 
 DEFINE_UNIT (mm2, Unit::mm *Unit::mm)
 [square millimeters]
 
 DEFINE_UNIT (b, Unit::m2 *1e-28)
 [barn]
 
 DEFINE_UNIT (mb, Unit::b *1e-3)
 [millibarn]
 
 DEFINE_UNIT (ub, Unit::b *1e-6)
 [microbarn]
 
 DEFINE_UNIT (nb, Unit::b *1e-9)
 [nanobarn]
 
 DEFINE_UNIT (pb, Unit::b *1e-12)
 [picobarn]
 
 DEFINE_UNIT (fb, Unit::b *1e-15)
 [femtobarn]
 
 DEFINE_UNIT (ab, Unit::b *1e-18)
 [attobarn]
 
 DEFINE_UNIT (m3, Unit::m *Unit::m *Unit::m)
 [cubic meters]
 
 DEFINE_UNIT (cm3, Unit::cm *Unit::cm *Unit::cm)
 [cubic centimeters]
 
 DEFINE_UNIT (mm3, Unit::mm *Unit::mm *Unit::mm)
 [cubic millimeters]
 
 DEFINE_UNIT (s, Unit::ns *1e9)
 [second]
 
 DEFINE_UNIT (ms, Unit::s *1e-3)
 [millisecond]
 
 DEFINE_UNIT (us, Unit::s *1e-6)
 [microsecond]
 
 DEFINE_UNIT (ps, Unit::s *1e-12)
 [picosecond]
 
 DEFINE_UNIT (fs, Unit::s *1e-15)
 [femtosecond]
 
 DEFINE_UNIT (Hz, Unit::GHz *1e-9)
 [Hertz]
 
 DEFINE_UNIT (kHz, Unit::GHz *1e-6)
 [Kilohertz]
 
 DEFINE_UNIT (MHz, Unit::GHz *1e-3)
 [Megahertz]
 
 DEFINE_UNIT (mHz, Unit::GHz *1e-12)
 [Millihertz]
 
 DEFINE_UNIT (mrad, Unit::rad *1e-3)
 [millirad]
 
 DEFINE_UNIT (deg, TMath::DegToRad())
 degree to radians
 
 DEFINE_UNIT (eV, Unit::GeV *1e-9)
 [electronvolt]
 
 DEFINE_UNIT (keV, Unit::eV *1e3)
 [kiloelectronvolt]
 
 DEFINE_UNIT (MeV, Unit::eV *1e6)
 [megaelectronvolt]
 
 DEFINE_UNIT (TeV, Unit::eV *1e12)
 [teraelectronvolt]
 
 DEFINE_UNIT (J, 1.0/TMath::Qe() *Unit::eV)
 [joule]
 
 DEFINE_UNIT (V, Unit::eV/Unit::e)
 Standard of [voltage].
 
 DEFINE_UNIT (C, 1.0/TMath::Qe() *Unit::e)
 [Coulomb]
 
 DEFINE_UNIT (fC, Unit::C/1.0e15)
 [femtoCoulomb]
 
 DEFINE_UNIT (T, Unit::V *Unit::s/Unit::m2)
 [Tesla]
 
 DEFINE_UNIT (mT, Unit::T *1e-3)
 [millitesla]
 
 DEFINE_UNIT (Gauss, Unit::T *1e-4)
 [Gauss]
 
 DEFINE_UNIT (kGauss, Unit::Gauss *1e3)
 [kiloGauss]
 
 DEFINE_UNIT_NAME (mg_cm3, Unit::g_cm3 *1e-3, "mg/cm3")
 [mg/cm^3]
 
 DEFINE_UNIT_NAME (kg_cm3, Unit::g_cm3 *1e3, "kg/cm3")
 [kg/cm^3]
 
 DEFINE_UNIT_NAME (g_mm3, Unit::g_cm3/Unit::mm3, "g/mm3")
 [g/mm^3]
 
 DEFINE_UNIT_NAME (mg_mm3, Unit::mg_cm3/Unit::mm3, "mg/mm3")
 [mg/mm^3]
 
 DEFINE_UNIT_NAME (kg_mm3, Unit::kg_cm3/Unit::mm3, "kg/mm3")
 [kg/mm^3]
 
template<typename DataType >
Bool_t operator== (const TVector3 &a, const B2Vector3< DataType > &b)
 non-memberfunction Comparison for equality with a TVector3
 
template<typename DataType >
Bool_t operator!= (const TVector3 &a, const B2Vector3< DataType > &b)
 non-memberfunction Comparison for equality with a TVector3
 
template<typename DataType >
B2Vector3< DataType > operator* (DataType a, const B2Vector3< DataType > &p)
 non-memberfunction Scaling of 3-vectors with a real number
 
template<typename DataType >
B2Vector3< DataType > operator+ (const TVector3 &a, const B2Vector3< DataType > &b)
 non-memberfunction for adding a TVector3 to a B2Vector3
 
template<typename DataType >
B2Vector3< DataType > operator- (const TVector3 &a, const B2Vector3< DataType > &b)
 non-memberfunction for substracting a TVector3 from a B2Vector3
 
template<typename DataType >
B2Vector3< DataType > operator+ (const B2Vector3< DataType > &a, const TVector3 &b)
 non-memberfunction for adding a B2Vector3 to a TVector3
 
template<typename DataType >
B2Vector3< DataType > operator- (const B2Vector3< DataType > &a, const TVector3 &b)
 non-memberfunction for substracting a B2Vector3 from a TVector3
 
template<typename DataType >
B2Vector3< DataType > operator+ (const ROOT::Math::XYZVector &a, const B2Vector3< DataType > &b)
 non-memberfunction for adding a XYZVector to a B2Vector3
 
template<typename DataType >
B2Vector3< DataType > operator- (const ROOT::Math::XYZVector &a, const B2Vector3< DataType > &b)
 non-memberfunction for substracting a XYZVector from a B2Vector3
 
template<typename DataType >
B2Vector3< DataType > operator+ (const B2Vector3< DataType > &a, const ROOT::Math::XYZVector &b)
 non-memberfunction for adding a B2Vector3 to a XYZVector
 
template<typename DataType >
B2Vector3< DataType > operator- (const B2Vector3< DataType > &a, const ROOT::Math::XYZVector &b)
 non-memberfunction for substracting a B2Vector3 from a XYZVector
 
void injectBooleanOperatorToStream (std::ostream &stream, const BooleanOperator &boperator)
 Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the BooleanOperator given. More...
 
void injectComparisonOperatorToStream (std::ostream &stream, const ComparisonOperator &coperator)
 Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the ComparisonOperator given. More...
 
void injectArithmeticOperatorToStream (std::ostream &stream, const ArithmeticOperation &aoperation)
 Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the ComparisonOperator given. More...
 
template<typename T >
convertString (const std::string &str)
 Converts a string to type T (one of float, double, long double, int, long int, unsigned long int). More...
 
unsigned long int findMatchedParenthesis (std::string str, char open='[', char close=']')
 Returns position of the matched closing parenthesis if the first character in the given string contains an opening parenthesis. More...
 
std::vector< std::string > splitOnDelimiterAndConserveParenthesis (std::string str, char delimiter, char open, char close)
 Split into std::vector on delimiter ignoring delimiters between parenthesis.
 
unsigned long int findIgnoringParenthesis (std::string str, std::string pattern, unsigned int begin=0)
 Returns the position of a pattern in a string ignoring everything that is in parenthesis.
 
bool almostEqualFloat (const float &a, const float &b)
 Helper function to test if two floats are almost equal.
 
bool almostEqualDouble (const double &a, const double &b)
 Helper function to test if two doubles are almost equal. More...
 
std::set< int64_t > generate_number_sequence (const std::string &str)
 Generate a sequence of numbers defined by a string. More...
 
template<>
float convertString (const std::string &str)
 Converts a string to float. More...
 
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. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module. More...
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter. More...
 
static std::string TypeInfo ()
 Static function to generate a string description for the parameter type. More...
 
 ModuleParam (T &paramVariable, const std::string &description="", bool force=false)
 Constructor. More...
 
virtual ~ModuleParam ()
 Destructor.
 
void setValue (const T &value)
 Sets the value of a parameter. More...
 
void setDefaultValue (const T &defaultValue)
 Sets the default value of a parameter. More...
 
T & getValue ()
 Returns the value of the parameter. More...
 
T & getDefaultValue ()
 Returns the default value of the parameter. More...
 
virtual void setValueFromPythonObject (const boost::python::object &pyObject) final
 Implements a method for setting boost::python objects. More...
 
virtual void setValueToPythonObject (boost::python::object &pyObject, bool defaultValues=false) const final
 Returns a python object containing the value or the default value of the given parameter. More...
 
virtual void setValueFromParam (const ModuleParamBase &param) final
 Set value from other ModuleParam of same type.
 
void resetValue ()
 Resets the parameter value by assigning the default value to the parameter value.
 
template<typename T >
void addParameter (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module list. More...
 
template<typename T >
void addParameter (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module list. More...
 
template<typename T >
void setParameter (const std::string &name, const T &value)
 Sets the value of a parameter given by its name. More...
 
template<typename T >
ModuleParam< T > & getParameter (const std::string &name) const
 Returns a reference to a parameter. More...
 
template<typename PythonObject >
void setParamPython (const std::string &name, const PythonObject &pyObj)
 Implements a method for setting boost::python objects. More...
 
template<typename PythonObject >
void getParamValuesPython (const std::string &name, PythonObject &pyOutput, bool defaultValues) const
 Returns a python object containing the value or default value of the given parameter. More...
 
uint64_t random64 ()
 Generate one 64bit unsigned integer between 0 and UINT64_MAX (both inclusive). More...
 
void RndmArray (Int_t n, Float_t *array)
 Fill an array of floats with random values in (0,1), both limits excluded. More...
 
void RndmArray (Int_t n, Double_t *array)
 Fill an array of doubles with random values in (0,1), both limits excluded. More...
 
void RndmArray (Int_t n, ULong64_t *array)
 Fill an array of unsigned 64bit integers with random values in [0, UINT64_MAX], both limits included. More...
 
void RndmArray (Int_t n, UInt_t *array)
 Fill an array of unsigned integers with random values in [0, UINT32_MAX], both limits included. More...
 
double random01 ()
 Generate a random double value between 0 and 1, both limits excluded. More...
 
static DatabaseInstance ()
 Instance of a singleton Database.
 
 ~Database ()
 Hidden destructor, as it is a singleton.
 
static void reset (bool keepConfig=false)
 Reset the database instance. More...
 
ScopeGuard createScopedUpdateSession ()
 Make sure we have efficient http pipelinging during initialize/beginRun but don't keep session alive for full processing time. More...
 
std::pair< TObject *, IntervalOfValiditygetData (const EventMetaData &event, const std::string &name)
 Request an object from the database. More...
 
bool getData (const EventMetaData &event, std::vector< DBQuery > &query)
 Request multiple objects from the database. More...
 
bool storeData (std::list< DBImportQuery > &query)
 Store multiple objects in the database. More...
 
bool storeData (const std::string &name, TObject *object, const IntervalOfValidity &iov)
 Store an object in the database. More...
 
std::string getGlobalTags ()
 Return the global tags used by the database. More...
 
void nextMetadataProvider ()
 Enable the next metadataprovider in the list.
 
void initialize (const EDatabaseState target=c_Ready)
 Initialize the database connection settings on first use.
 
static void exposePythonAPI ()
 Exposes setGlobalTag function of the Database class to Python.
 
 ~DBStore ()
 Destructor.
 
static DBStoreInstance ()
 Instance of a singleton DBStore. More...
 
DBStoreEntrygetEntry (DBStoreEntry::EPayloadType payloadType, const std::string &name, const TClass *objClass, bool array, bool required=true)
 Returns the entry with the requested name in the DBStore. More...
 
void update ()
 Updates all objects that are outside their interval of validity. More...
 
void update (const EventMetaData &event)
 Updates all objects that are outside their interval of validity. More...
 
void performUpdate (const EventMetaData &event)
 The main code that does an update, factored out so it can be used by both update and update(event).
 
void updateEvent ()
 Updates all intra-run dependent objects. More...
 
void updateEvent (const unsigned int eventNumber)
 Updates all intra-run dependent objects. More...
 
void performUpdateEvent (const EventMetaData &event)
 The main code that does an updateEvent. More...
 
void reset (bool keepEntries=false)
 Invalidate all payloads. More...
 
std::set< std::string > getAllEntryNames ()
 Return the names of all the payloads stored in the database at the time of this function is called. More...
 
void addConstantOverride (const std::string &name, TObject *obj, bool oneRun=false)
 Add constant override payload. More...
 
static DBStoreEntry fromObject (const std::string &name, const TObject *obj, bool isRequired)
 Construct a new DBStoreEntry with a requested name and an object directly. More...
 
 ~DBStoreEntry ()
 Clean up memory. More...
 
void updateObject (const EventMetaData &event)
 update the payload object according to the new event information. More...
 
void resetPayload ()
 reset the payload to nothing
 
void updatePayload (unsigned int revision, const IntervalOfValidity &iov, const std::string &filename, const std::string &checksum, const std::string &globaltag, const EventMetaData &event)
 Update the payload information for this entry and if appropriate open the new file and extract the object as needed. More...
 
void loadPayload (const EventMetaData &event)
 Actual load the payload from file after all info is set.
 
void overrideObject (TObject *obj, const IntervalOfValidity &iov)
 Set an override object in case we want to use a different object then actually provided by the database. More...
 
void notifyAccessors (bool onDestruction=false)
 Notify all the registered accessors.
 
bool checkType (EPayloadType type, const TClass *objClass, bool array, bool inverse=false) const
 Check if a given TClass is compatible with the type of this entry.
 
bool checkType (const TObject *object) const
 Check if a given TObject instance is compatible with the type of this entry.
 
template<class FunctionFrom , class FunctionTo >
void consolidate (const FunctionFrom &replaceFrom=FunctionFrom(), const FunctionTo &replaceTo=FunctionTo(), EConsolidationAction action=c_doNothing)
 Consolidate RelationElements. More...
 
void rebuild (bool force=false)
 Rebuild the index. More...
 
std::map< int, int > copySetWithRelations (std::function< bool(const StoredClass *)> f)
 Selects the elements, fill the subset and copies all the relations in which the set is involved.
 
void copyRelationsToSelf ()
 Copy any set -> set relations between selected objects.
 
void select (const std::function< bool(const StoredClass *)> &f)
 This method is the actual worker. More...
 
ROOT::Math::XYZVector getField (const ROOT::Math::XYZVector &pos) const
 Calculate the magnetic field at a given position. More...
 
void setBucket (unsigned i)
 Sets the fill status of RF bucket to true. More...
 
bool getBucket (int i) const
 Returns the fill status of RF bucket. More...
 
unsigned getNumOfFilledBuckets () const
 Returns the number of filled buckets. More...
 
unsigned generateBucketNumber () const
 Generates RF bucket number according to the fill pattern. More...
 
 Gearbox ()
 Singleton: private constructor.
 
 ~Gearbox ()
 Free structures on destruction.
 
static GearboxgetInstance ()
 Return reference to the Gearbox instance.
 
gearbox::InputContextopenXmlUri (const std::string &uri) const
 Function to be called when libxml requests a new input uri to be opened.
 
void setBackends (const std::vector< std::string > &backends)
 Select the backends to use to find resources. More...
 
void clearBackends ()
 Clear list of backends.
 
void open (const std::string &name="Belle2.xml", size_t cacheSize=c_DefaultCacheSize)
 Open connection to backend and parse tree. More...
 
void close ()
 Free internal structures of previously parsed tree and clear cache.
 
void overridePathValue (const PathOverride &poverride)
 Change the value of a given path expression.
 
PathValue getPathValue (const std::string &path) const
 Return the (cached) value of a given path.
 
virtual const TObject * getTObject (const std::string &path) const noexcept(false) override
 Get the parameter path as a TObject. More...
 
GearDir getDetectorComponent (const std::string &component)
 Return GearDir representing a given DetectorComponent. More...
 
static double convertValue (double value, const std::string &unitString)
 Converts a floating point value to the standard framework unit. More...
 
static double convertValueToUnit (double value, const std::string &unitString)
 Converts a floating point value from the standard framework unit to the given unit. More...
 
static double registerConversion (const std::string &name, double value)
 registers the name and value of a conversion in s_conversionFactors.
 
B2Vector3< DataType > & operator= (const B2Vector3< DataType > &b)
 Assignment via B2Vector3.
 
B2Vector3< DataType > & operator= (const TVector3 &b)
 Assignment via TVector3.
 
B2Vector3< DataType > & operator= (const ROOT::Math::XYZVector &b)
 Assignment via XYZVector.
 
B2Vector3< DataType > & operator+= (const B2Vector3< DataType > &b)
 addition
 
B2Vector3< DataType > & operator-= (const B2Vector3< DataType > &b)
 subtraction
 
B2Vector3< DataType > & operator*= (DataType a)
 scaling with real numbers More...
 
void SetXYZ (const TVector3 &tVec)
 set all coordinates using a reference to TVector3
 
void SetXYZ (const TVector3 *tVec)
 set all coordinates using a pointer to TVector3
 
void SetXYZ (const ROOT::Math::XYZVector &xyzVec)
 set all coordinates using a reference to XYZVector
 
void SetXYZ (const ROOT::Math::XYZVector *xyzVec)
 set all coordinates using a pointer to XYZVector
 
void GetXYZ (TVector3 *tVec) const
 directly copies coordinates to a TVector3
 
void GetXYZ (ROOT::Math::XYZVector *xyzVec) const
 directly copies coordinates to a XYZVector
 
TVector3 GetTVector3 () const
 returns a TVector3 containing the same coordinates
 
ROOT::Math::XYZVector GetXYZVector () const
 returns a XYZVector containing the same coordinates More...
 
DataType at (unsigned i) const
 safe member access (with boundary check!) More...
 
static std::string name ()
 Returns the name of the B2Vector. More...
 
ROOT::Math::XYZVector calculate (const ROOT::Math::XYZVector &pos) const
 Calculate the field value at a given position and return it. More...
 
static void getField (const double *pos, double *field)
 return the magnetic field at a given position. More...
 
const LogConfiggetCurrentLogConfig (const char *package=nullptr) const
 Returns the current LogConfig object used by the logging system. More...
 
bool isLevelEnabled (LogConfig::ELogLevel level, int debugLevel=0, const char *package=nullptr) const
 Returns true if the given log level is allowed by the log system (i.e. More...
 
 LogConnectionJSON (bool complete=false)
 The constructor. More...
 
bool sendMessage (const LogMessage &message) override
 Sends a log message. More...
 
std::string __repr__ () const
 Return a string repesentation of this particle to be used when printing the particle in python.
 
template<class AZMQClient >
void sendToSocket (const AZMQClient &socket)
 Publish this event backup directly to the given client.
 
template<class AZMQClient >
void sendWorkerBackupEvents (unsigned int worker, const AZMQClient &socket)
 Send all backups of a given worker directly to the multicast and delete them.
 
template<class AMulticastAnswer , class ASocketAnswer >
int poll (unsigned int timeout, AMulticastAnswer multicastAnswer, ASocketAnswer socketAnswer) const
 Poll both the multicast and the data socket until, either: More...
 
template<class ASocketAnswer >
int pollSocket (unsigned int timeout, ASocketAnswer socketAnswer) const
 Poll method to only the data socket. More...
 
template<class AMulticastAnswer >
int pollMulticast (unsigned int timeout, AMulticastAnswer multicastAnswer) const
 Poll method to only the multicast socket. More...
 
template<class AClass >
void log (const std::string &key, const AClass &value)
 Store a value under a certain key. Different types of values can be stored, namely long, double or string. Mixtures are not allowed for a given key.
 
template<size_t MAX_SIZE = 100>
void average (const std::string &key, double value)
 Instead of storeing the double value directly under the given key, store the average of the last MAX_SIZE values.
 
template<size_t AVERAGE_SIZE = 2000>
void timeit (const std::string &key)
 Measure the rate of calls with the same key every AVERAGE_SIZE calls (and also display the last time AVERAGE_SIZE was reached under <key>_last_measurement)
 
template<int AZMQType>
std::unique_ptr< zmq::socket_t > createSocket (const std::string &socketAddress, bool bind)
 Create a socket of the given type with the given address and bind or not bind it. More...
 
template<int AZMQType>
std::unique_ptr< zmq::socket_t > createSocket (const std::string &socketAddress)
 Create a socket of the given type while deciding on the bind behaviour via the address. More...
 
template<class AZMQMessage >
static void send (std::unique_ptr< zmq::socket_t > &socket, AZMQMessage message)
 Send a given message over the given created socket. You need to move in the message for zero-copy.
 
template<class value_type >
bool setMeanCov (const TVectorT< value_type > &mean, const TMatrixTBase< value_type > &cov)
 set mean and covariance matrix from ROOT vector/matrix objects, e.g. More...
 
template<class value_type >
bool setMeanCov (const ROOT::Math::XYZVector &mean, const TMatrixTBase< value_type > &cov)
 set the mean and covariance for the distribution. More...
 
 SHA3Hash (EHashMode length)
 Constructor initializing the hash structure with a given output size.
 
 ~SHA3Hash ()
 destructor freeing the memory
 
void clear ()
 reinit the hash structure to create a new hash sum
 
void update (int n, unsigned char *buff)
 update the internal state by adding n bytes of data from buff
 
void getHash (unsigned char *buff)
 obtain the hash value into buff. More...
 
std::vector< unsigned char > getHash ()
 obtain the hash value as a vector of unsigned char
 
 ShakeHash (EHashMode mode)
 constructor initializing the hash structure
 
 ~ShakeHash ()
 destructor freeing the memory
 
void clear ()
 reinit the hash structure to create a new hash sum
 
void update (int n, unsigned char *buff)
 update the internal state by adding n bytes of data from buff
 
void getHash (int n, unsigned char *buff)
 obtain the hash value with a length of n bytes into buff
 
static bool isSet (const std::string &name)
 Check if a value is set in the database.
 
static std::string get (const std::string &name, const std::string &fallback="")
 Get the value of an environment variable or the given fallback value if the variable is not set.
 
static std::vector< std::string > getList (const std::string &name, const std::vector< std::string > &fallback={}, const std::string &separators=" \t\n\r")
 Get a list of values from an environment variable or the given fallback list if the variable is not set. More...
 
static std::vector< std::string > getOrCreateList (const std::string &name, const std::string &fallback, const std::string &separators=" \t\n\r")
 Get a list of values from an environment variable or the given fallback string if the variable is not set. More...
 
static std::string expand (const std::string &text)
 Modify the given string and replace every occurence of $NAME or ${NAME} with the value of the environment variable NAME. More...
 
static char operatorToChar (EOperator op) noexcept
 Convert operator code to character.
 
static double applyOperator (EOperator op, double a, double b)
 Apply operator on two values.
 
static ENumberStatus checkNumber (ENumberStatus current, char next)
 Check if a string literal with a given number status continues to be a valid number if next is appended to it.
 
static void assertOperatorUsable (size_t stacksize)
 Make sure we have enough operands to use an operator.
 
void addOperator (EOperator op)
 Add an operator to the internal state, convert them to reverse polish notation using the shunting yard algorithm and execute them as they become available.
 
void flushPendingOperators ()
 Flush all pending operators at the end of processing.
 
void flushCurrentVariable ()
 Flush the currently parsed variable name and add it to the state either as variable or number.
 
EOperator checkForOperator (char next)
 Check if the next character is a operator.
 
void processString (const std::string &formula)
 Process the given formula and store the final state.
 
void raiseError (const std::runtime_error &e)
 Format the given runtime_error with context information and rethrow a new one.
 
std::shared_ptr< TFile > getFile (std::string, bool ignoreErrors=false)
 Get a file with a specific name, if is does not exist it will be created. More...
 
static RootFileCreationManagergetInstance ()
 Interface for the FileManager.
 

Variables

std::string DBPointer_defaultName = ""
 Use default name for array in DBPointer.
 
static constexpr auto XYZToTVector
 Helper function to convert XYZVector to TVector3. More...
 
static std::map< std::string, double > s_conversionFactors
 Map to be able to convert between units using string representations of the unit name.
 

Detailed Description

Macro Definition Documentation

◆ B2_GEARBOX_REGISTER_INPUTHANDLER

#define B2_GEARBOX_REGISTER_INPUTHANDLER (   classname,
  prefix 
)     InputHandlerFactory<classname> Gearbox_InputHandlerFactory_##classname(prefix)

Helper macro to easily register new input handlers.

It will create a factory function for the InputHandler and register it with the Gearbox instance

Parameters
classnameClassname to create factory for
prefixPrefix to register the handler for, e.g. "file" to register a handler responsible for uris starting with file:

Definition at line 256 of file Gearbox.h.

◆ B2INFO_MEASURE_TIME

#define B2INFO_MEASURE_TIME (   txt,
  ... 
)
Value:
{\
std::stringstream __b2_timer_str__;\
__b2_timer_str__ << txt;\
::Belle2::Utils::Timer __b2_timer__(__b2_timer_str__.str());\
{__VA_ARGS__;}\
}
Small helper class that prints its lifetime when destroyed.
Definition: Utils.h:79

Print an INFO message txt followed by the time it took to execute the statment given as second argument.

Care should be taken not to define variables in this call since they will be scoped and thus unavaiable after the macro

Definition at line 102 of file Utils.h.

◆ BELLE2_DEFINE_EXCEPTION

#define BELLE2_DEFINE_EXCEPTION (   ClassName,
  Message 
)
Value:
class ClassName : public std::runtime_error { \
public: \
ClassName(): std::runtime_error(""), m_format(Message) { } \
~ClassName() noexcept {} \
virtual const char * what() const noexcept override { \
m_finalStr = m_format.str();\
return m_finalStr.c_str();\
}\
template <class T> ClassName& operator<<(const T& param) {\
m_format % param;\
return *this;\
}\
private:\
boost::format m_format;\
mutable std::string m_finalStr;\
};
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)

Macro that defines an exception with the given message template.

Use the macro inside your class (header file) and specify a class name for your exception, plus a format string that contains a description of what went wrong:

BELLE2_DEFINE_EXCEPTION(ModuleNotCreatedError, "Could not create module: %1%")
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.

When throwing, simply create an instance of this class, use operator<< to fill any placeholders (n%) specified, and pass this to the throw keyword:

throw (ModuleNotCreatedError() << moduleName);

Exceptions defined using this macro inherit from std::runtime_error, and can be queried using their what() member.

Definition at line 36 of file FrameworkExceptions.h.

◆ branch_likely

#define branch_likely (   x)    (x)

Usage:

if (branch_unlikely(my_number > 10)) {
  // executed only rarely
} else {
  // executed very often
}

Definition at line 133 of file Utils.h.

◆ branch_unlikely

#define branch_unlikely (   x)    (x)

A macro to tell the compiler that the argument x will be very likely be false.

This could result in optimized code as the compiler can reorder the code to reduce conditional jumps during execution. Due to the high efficiency of todays branch prediction systems the effect is probably small.

Warning
Use of this macro should be accompanied by a comment documenting the (significant) performance gains that justify its use. (Please make sure you compile in 'opt' mode.)
See also

Definition at line 134 of file Utils.h.

◆ REG_MODULE

#define REG_MODULE (   moduleName)
Value:
namespace { struct ModuleProxy##moduleName: public ModuleProxyBase { \
ModuleProxy##moduleName(): ModuleProxyBase(#moduleName, "" _PACKAGE_) {} \
virtual ::Belle2::Module* createInstance() const override final { return new moduleName##Module(); } \
} proxy##moduleName##Module; }
#define _PACKAGE_
make sure REG_MODULE works outside the normal build system
Definition: Module.h:643

Register the given module (without 'Module' suffix) with the framework.

Definition at line 650 of file Module.h.

◆ REGISTER_PYTHON_MODULE

#define REGISTER_PYTHON_MODULE (   moduleName)    Belle2::BoostPythonModuleProxy boostPythonModuleProxy##moduleName(#moduleName, PyInit_##moduleName);

Register a python module to make available when loading the library.

Use it by defining your module via BOOST_PYTHON_MODULE(name), then call REGISTER_PYTHON_MODULE(name) with the same name.

After the library has been loaded, you can use 'import name' to import the defined objects.

Definition at line 36 of file RegisterPythonModule.h.

◆ REGISTER_PYTHON_MODULE_AUTOIMPORT

#define REGISTER_PYTHON_MODULE_AUTOIMPORT (   moduleName)    Belle2::BoostPythonModuleProxy boostPythonModuleProxy##moduleName(#moduleName, PyInit_##moduleName, true);

Identical to REGISTER_PYTHON_MODULE(), but will also import the module into the global namespace after loading it.

This might be useful to allow extra definitions for individual basf2 modules, consider for example:

//in MyTestModule.h (preferably as a member of your Module class):
enum class Shape {
Sphere,
Cube
};
//in MyTestModule.cc
#include <boost/python.hpp>
#include <framework/utilities/RegisterPythonModule.h>
//...
using namespace boost::python;
BOOST_PYTHON_MODULE(MyTest)
{
//export enum to python, e.g. Shape::Sphere becomes Shape.Sphere
enum_<Shape>("Shape")
.value("Sphere", Shape::Sphere)
.value("Cube", Shape::Cube)
;
}
#define REGISTER_PYTHON_MODULE_AUTOIMPORT(moduleName)
Identical to REGISTER_PYTHON_MODULE(), but will also import the module into the global namespace afte...

In a steering file, the type MyTest.Sphere is available immediately after register_module('MyTest').

Definition at line 74 of file RegisterPythonModule.h.

Typedef Documentation

◆ RelationsObject

Provides interface for getting/adding relations to objects in StoreArrays.

See RelationsInterface for details.

Definition at line 441 of file RelationsObject.h.

Enumeration Type Documentation

◆ ArithmeticOperation

enum ArithmeticOperation : int
strong

Enum for decoding the comparison operator type.

For encoding scheme in python

See also
a_operator_types in yacc.py

Definition at line 141 of file AbstractNodes.h.

141  : int {
142  PLUS,
143  MINUS,
144  PRODUCT,
145  DIVISION,
146  POWER
147  };

◆ BooleanOperator

enum BooleanOperator : int
strong

Enum for decoding the boolean operator type.

For encoding scheme in python

See also
b_operator_types in yacc.py

Definition at line 119 of file AbstractNodes.h.

◆ ComparisonOperator

enum ComparisonOperator : int
strong

Enum for decoding the comparison operator type.

For encoding scheme in python

See also
c_operator_types in yacc.py

Definition at line 128 of file AbstractNodes.h.

◆ ERecordType

What type of message is this?

Note: for parallel processing, the only type that can work is MSG_EVENT. Other messages would need to be sent once to each process, which would result in all kinds of race conditions.

Definition at line 25 of file EvtMessage.h.

25 { MSG_EVENT, MSG_BEGIN_RUN, MSG_END_RUN, MSG_TERMINATE, MSG_NORECORD, MSG_STREAMERINFO };

◆ NodeType

enum NodeType : int
strong

Enum of possible Nodes in parsing tree.

NodeTypes in python are encoded with the corresponding dict

See also
node_types in yacc.py

Definition at line 100 of file AbstractNodes.h.

◆ ProcType

enum ProcType
strong

Type of the process used for storing and mapping the child processes in the process handler.

Enumerator
c_Input 

Input Process.

c_Worker 

Worker/Reconstruction Process.

c_Output 

Output Process.

c_Proxy 

Multicast Proxy Process.

c_Monitor 

Monitoring Process.

c_Init 

Before the forks, the process is in init state.

c_Stopped 

The process is stopped/killed.

Definition at line 16 of file ProcHelper.h.

16  {
17  c_Input = 'i',
18  c_Worker = 'w',
19  c_Output = 'o',
20  c_Proxy = 'p',
21  c_Monitor = 'm',
22  c_Init = '0',
23  c_Stopped = 's'
24  };
@ c_Proxy
Multicast Proxy Process.
@ c_Output
Output Process.
@ c_Worker
Worker/Reconstruction Process.
@ c_Monitor
Monitoring Process.
@ c_Input
Input Process.
@ c_Stopped
The process is stopped/killed.
@ c_Init
Before the forks, the process is in init state.

◆ ZMQAddressType

The type of a ZMQ socket address (which socket to use)

Enumerator
c_output 

Input socket.

c_pub 

Output socket.

c_sub 

Multicast publish socket.

c_control 

Multicast subscribe socket.

Multicast control socket

Definition at line 18 of file ZMQAddressUtils.h.

18  {
19  c_input,
20  c_output,
21  c_pub,
22  c_sub,
23  c_control
24  };
@ c_sub
Multicast publish socket.
@ c_control
Multicast subscribe socket.
@ c_pub
Output socket.
@ c_output
Input socket.

Function Documentation

◆ addConstantOverride()

void addConstantOverride ( const std::string &  name,
TObject *  obj,
bool  oneRun = false 
)

Add constant override payload.

This payload will be valid for all possible iov and will be used instead of values from the database.

Parameters
nameName under which the object will be accessible
objPointer to the object to be used. Ownership will be transfered to the DBStore.
oneRunif true the override will only be in effect for this one run, not for any other runs
Warning
don't use this if you do not know exactly what you are doing. This is meant mainly for beamparameters

Definition at line 204 of file DBStore.cc.

205  {
206  IntervalOfValidity iov = IntervalOfValidity::always();
207  if (oneRun) {
208  int exp, run;
209  if (m_manualEvent) {
210  exp = m_manualEvent->getExperiment();
211  run = m_manualEvent->getRun();
212  } else {
213  exp = m_storeEvent->getExperiment();
214  run = m_storeEvent->getRun();
215  }
216  iov = IntervalOfValidity(exp, run, exp, run);
217  }
218  // Add the DBStore entry
219  auto iter = m_dbEntries.find(name);
220  if (iter == end(m_dbEntries)) {
221  iter = m_dbEntries.emplace(name, DBStoreEntry::fromObject(name, obj, true)).first;
222  }
223  DBStoreEntry& dbEntry = iter->second;
224  dbEntry.overrideObject(obj, iov);
225  // we need to remove this entry from the intraRunDependencies list now.
226  // Otherwise it will reset the object on the next event call
227  m_intraRunDependencies.erase(&dbEntry);
228  B2WARNING("An override for DBEntry " << name << " was created.");
229  }
StoreObjPtr< EventMetaData > m_storeEvent
StoreObjPtr for the EventMetaData to get the current experiment and run from the DataStore.
Definition: DBStore.h:174
std::set< DBStoreEntry * > m_intraRunDependencies
List of intra-run dependent conditions.
Definition: DBStore.h:169
std::optional< EventMetaData > m_manualEvent
Optional EventMetaData variable.
Definition: DBStore.h:181
std::unordered_map< std::string, DBStoreEntry > m_dbEntries
Map names to DBEntry objects.
Definition: DBStore.h:166
static IntervalOfValidity always()
Function that returns an interval of validity that is always valid, c.f.
static DBStoreEntry fromObject(const std::string &name, const TObject *obj, bool isRequired)
Construct a new DBStoreEntry with a requested name and an object directly.
Definition: DBStoreEntry.cc:37

◆ addParam() [1/2]

void addParam ( const std::string &  name,
T &  paramVariable,
const std::string &  description 
)
protected

Adds a new enforced parameter to the module.

This method has to be called in the constructor of the module. The user has to set the value for this parameter in the steering file.

Parameters
nameThe unique name of the parameter.
paramVariableThe member variable of the module to which the value from the steering file is written.
descriptionA description of the parameter.

Definition at line 567 of file Module.h.

568  {
569  m_moduleParamList.addParameter(name, paramVariable, description);
570  }
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition: Module.h:516
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ addParam() [2/2]

void addParam ( const std::string &  name,
T &  paramVariable,
const std::string &  description,
const T &  defaultValue 
)
protected

Adds a new parameter to the module.

This method has to be called in the constructor of the module.

Parameters
nameThe unique name of the parameter.
paramVariableThe member variable of the module to which the value from the steering file is written.
descriptionA description of the parameter.
defaultValueThe default value of the parameter which is used if there was no value given in the steering file.

Definition at line 560 of file Module.h.

◆ addParameter() [1/2]

void addParameter ( const std::string &  name,
T &  paramVariable,
const std::string &  description 
)

Adds a new enforced parameter to the module list.

A parameter consists of a reference pointing to a member variable in the module which stores and allows fast access to the parameter value. In addition the type of the parameter is saved and a description is given. This parameter has to be set by the user in the steering file.

Parameters
nameThe unique name of the parameter.
paramVariableReference to the variable which stores the parameter value.
descriptionAn description of the parameter.

Definition at line 50 of file ModuleParamList.templateDetails.h.

53  {
54  ModuleParamPtr newParam(new ModuleParam<T>(paramVariable, description, true));
55 
56  // Check if a parameter with the given name already exists
57  std::map<std::string, ModuleParamPtr>::iterator mapIter;
58  mapIter = m_paramMap.find(name);
59 
60  if (mapIter == m_paramMap.end()) {
61  m_paramMap.insert(std::make_pair(name, newParam));
62  } else {
63  B2ERROR("A parameter with the name '" + name +
64  "' already exists! The name of a module parameter must be unique within a module.");
65  }
66  }
std::map< std::string, ModuleParamPtr > m_paramMap
Stores the module parameters together with a string name as key.
std::shared_ptr< ModuleParamBase > ModuleParamPtr
Defines a pointer to a module parameter as a boost shared pointer. *‍/.

◆ addParameter() [2/2]

void addParameter ( const std::string &  name,
T &  paramVariable,
const std::string &  description,
const T &  defaultValue 
)

Adds a new parameter to the module list.

A parameter consists of a reference pointing to a member variable in the module which stores and allows fast access to the parameter value. In addition the type of the parameter is saved and a description is given.

Parameters
nameThe unique name of the parameter.
paramVariableReference to the variable which stores the parameter value.
descriptionAn description of the parameter.
defaultValueThe default value of the parameter.

Definition at line 28 of file ModuleParamList.templateDetails.h.

◆ almostEqualDouble()

bool almostEqualDouble ( const double &  a,
const double &  b 
)

Helper function to test if two doubles are almost equal.

Forward declaration of function defined in framework/utilities/GeneralCut.cc.

Definition at line 26 of file CutHelpers.cc.

27  {
28  static_assert(sizeof(double) == sizeof(int64_t));
29  // cppcheck-suppress invalidPointerCast
30  return std::fabs(*(int64_t*)&a - * (int64_t*)&b) <= 2 or (a == b);
31  }

◆ at()

DataType at ( unsigned  i) const

safe member access (with boundary check!)

safe member access (with boundary check!) should always be used!

Definition at line 751 of file B2Vector3.h.

752  {
753  switch (i) {
754  case 0:
756  case 1:
758  case 2:
760  }
761  B2FATAL(this->name() << "::access operator: given index (i=" << i << ") is out of bounds!");
762  return 0.;
763  }
DataType m_coordinates[3]
Make sure that we only have floating point vectors.
Definition: B2Vector3.h:45
static std::string name()
Returns the name of the B2Vector.
Definition: B2Vector3.h:767

◆ calculate()

ROOT::Math::XYZVector calculate ( const ROOT::Math::XYZVector &  pos) const
inlineprivate

Calculate the field value at a given position and return it.

Parameters
posposition where to evaluate the magnetic field
Returns
magnetic field value at position pos

Definition at line 85 of file BFieldManager.h.

86  {
87  if (!m_magfield) B2FATAL("Could not load magnetic field configuration from database");
88  return m_magfield->getField(pos);
89  };
DBObjPtr< MagneticField > m_magfield
Pointer to the actual magnetic field in the database.
Definition: BFieldManager.h:82

◆ consolidate()

void consolidate ( const FunctionFrom &  replaceFrom = FunctionFrom(),
const FunctionTo &  replaceTo = FunctionTo(),
EConsolidationAction  action = c_doNothing 
)

Consolidate RelationElements.

This function will loop over the relation and "compress" it by merging all elements with the same fromIndex.

The optional arguments can be used to replace indices in the relation, mainly useful in the simulation to replace the Geant4 TrackID with the index of the MCParticle at the end of the event

The Function objects should return a new (index,bool) pair for every index in the old relation. The returned index will be used as the new index in the relation and the bool pair indicates whether the original element got re-attributed or if it is just an index reordering. If it the original element got re-attributed the behaviour depends on the value of action, see EConsolidationAction

Warning: If action is set to c_negativeWeight and there is more than one element having the same from->to index pair after transformation the behaviour is undefined as the two elements get merged. It could happen that a negative and a positive weight get summed up, leaving the weight rather meaningless

See also
Identity, ReplaceMap, ReplaceVec, EConsolidationAction
Parameters
replaceFromFunction object containing replacements for the from indices
replaceToFunction object containing replacements for the to indices
actionAction to be performed when the old element got removed

Definition at line 466 of file RelationArray.h.

467  {
468  if (!isValid()) {
469  B2ERROR("Cannot consolidate an invalid relation (" << m_name << ")");
470  return;
471  }
472  typedef std::map<index_type, weight_type> element_t;
473  typedef std::map<index_type, element_t > buffer_t;
474  buffer_t buffer;
475 
476  //Fill all existing elements in a nested map, adding the weights of
477  //duplicate elements
478  index_type lastFromIndex(0);
479  buffer_t::iterator lastFromIter = buffer.end();
480  unsigned int nElements = (*m_relations)->getEntries();
481  TClonesArray& elements = (*m_relations)->elements();
482  for (unsigned int i = 0; i < nElements; ++i) {
483  RelationElement& element = *static_cast<RelationElement*>(elements[i]);
484  //Replace from index
485  consolidation_type from = replaceFrom(element.getFromIndex());
486 
487  //Ignore whole element if original element got deleted
488  if (action == c_deleteElement && from.second) continue;
489 
490  //Check if the fromIndex is the same as the last one and reuse
491  //iterator if possible
492  if (from.first != lastFromIndex || lastFromIter == buffer.end()) {
493  lastFromIter = buffer.insert(make_pair(from.first, element_t())).first;
494  lastFromIndex = from.first;
495  }
496  //Loop over all elements of this relationelement and add them to the map
497  size_t size = element.getSize();
498  for (size_t j = 0; j < size; ++j) {
499  //Replace to Index
500  consolidation_type to = replaceTo(element.getToIndex(j));
501  //Ignore whole element if original element got deleted
502  if (action == c_deleteElement && to.second) continue;
503  double weight = element.getWeight(j);
504  //Original from or to element got deleted. Do whatever is specified by action
505  //Warning: if there is more than one element pointing to the same
506  //from->to element after transformation the negative weight option is
507  //not safe as we sum a positive and a negative weight when
508  //consolidating.
509  if (from.second || to.second) {
510  if (action == c_zeroWeight) {
511  weight = 0;
512  } else if (action == c_negativeWeight && weight > 0) {
513  weight = -weight;
514  }
515  }
516  //add the weight to the new from->to index pair
517  lastFromIter->second[to.first] += weight;
518  }
519  }
520  //Clear the existing relation
521  elements.Delete();
522  //Fill the map into the relation
523  for (buffer_t::iterator iter = buffer.begin(); iter != buffer.end(); ++iter) {
524  add(iter->first, iter->second.begin(), iter->second.end());
525  }
526  }
bool isValid() const
Check whether the object was created.
std::pair< index_type, bool > consolidation_type
Typedef declaring the return value of any consolidation mapping.
Definition: RelationArray.h:88
RelationElement::index_type index_type
Typedef to simplify use of correct index_type.
Definition: RelationArray.h:68
@ c_negativeWeight
Flip the sign of the weight to become negative if the original element got re-attributed.
Definition: RelationArray.h:79
@ c_zeroWeight
Set the weight of the relation to 0 if the original element got re-attributed.
Definition: RelationArray.h:80
@ c_deleteElement
Delete the whole relation element if the original element got re-attributed.
Definition: RelationArray.h:81
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
std::string m_name
Store name under which this object/array is saved.

◆ convertString() [1/2]

T Belle2::convertString ( const std::string &  str)

Converts a string to type T (one of float, double, long double, int, long int, unsigned long int).

Throws std::invalid_argument on conversion errors, out_of_range if T cannot hold the given value. You can catch both possible exception types of the function (invalid_argument and out_of_range) using the base class logic_error

Converts a string to type T (one of float, double, long double, int, long int, unsigned long int).

Converts a string to unsigned long int.

Converts a string to long int.

Converts a string to int.

Converts a string to long double.

Converts a string to double.

Parameters
strstring which is converted to float
Returns
converted float
Parameters
strstring which is converted to double
Returns
converted double
Parameters
strstring which is converted to long double
Returns
converted long double
Parameters
strstring which is converted to int
Returns
converted int
Parameters
strstring which is converted to long int
Returns
converted long int
Parameters
strstring which is converted to unsigned long int
Returns
converted unsigned long int

Definition at line 24 of file Conversion.cc.

25  {
26  std::string::size_type n;
27  float number = std::stof(str, &n);
28  if (n != str.size()) {
29  throw std::invalid_argument("Could only parse a part of the given string " + str);
30  }
31  return number;
32  }

◆ convertString() [2/2]

unsigned long int convertString ( const std::string &  str)

Converts a string to float.

Converts a string to type T (one of float, double, long double, int, long int, unsigned long int).

Converts a string to unsigned long int.

Converts a string to long int.

Converts a string to int.

Converts a string to long double.

Converts a string to double.

Parameters
strstring which is converted to float
Returns
converted float
Parameters
strstring which is converted to double
Returns
converted double
Parameters
strstring which is converted to long double
Returns
converted long double
Parameters
strstring which is converted to int
Returns
converted int
Parameters
strstring which is converted to long int
Returns
converted long int
Parameters
strstring which is converted to unsigned long int
Returns
converted unsigned long int

Definition at line 24 of file Conversion.cc.

◆ convertValue()

double convertValue ( double  value,
const std::string &  unitString 
)
static

Converts a floating point value to the standard framework unit.

If the given unit is not found, the value is returned unchanged (and an error printed).

Parameters
valueThe value which should be converted.
unitStringThe string of the unit of the specified value.
Returns
The value converted to the standard unit.

Definition at line 129 of file UnitConst.cc.

130  {
131  auto it = s_conversionFactors.find(unitString);
132  if (it == s_conversionFactors.end()) {
133  B2ERROR("Could not find conversion factor for unit " << unitString << ", assuming 1.0");
134  return value;
135  }
136  return it->second * value;
137  }
static std::map< std::string, double > s_conversionFactors
Map to be able to convert between units using string representations of the unit name.
Definition: Unit.h:163

◆ convertValueToUnit()

double convertValueToUnit ( double  value,
const std::string &  unitString 
)
static

Converts a floating point value from the standard framework unit to the given unit.

If the given unit is not found, the value is returned unchanged (and an error printed).

Parameters
valueThe value which should be converted.
unitStringThe string of the unit of the specified value.
Returns
The value converted to the given unit.

Definition at line 139 of file UnitConst.cc.

◆ createROOTObjectPyCopy()

boost::python::object Belle2::createROOTObjectPyCopy ( const T &  instance)

Create a python wrapped copy from a class instance which has a ROOT dictionary.

This piece of dark magic creates a python object referencing a ROOT object the same way as you would see it in the ROOT python module.

It will create a copy of the object using the copy constructor which is then owned by python.

Definition at line 26 of file PyObjROOTUtils.h.

27  {
28  const char* classname = instance.IsA()->GetName();
29  void* addr = new T(instance);
30  PyObject* obj = TPython::CPPInstance_FromVoidPtr(addr, classname, true);
31  return boost::python::object(boost::python::handle<>(obj));
32  }

◆ createScopedUpdateSession()

ScopeGuard createScopedUpdateSession ( )

Make sure we have efficient http pipelinging during initialize/beginRun but don't keep session alive for full processing time.

This will return an object which keeps the session open as long as it is alive.

Definition at line 62 of file Database.cc.

63  {
64  // make sure we reread testing text files in case they got updated
65  for (auto& testing : m_testingPayloads) {
66  testing.reset();
67  }
68  // and return a downloader session guard for the downloader we use
70  }
ScopeGuard ensureSession()
Make sure there's an active session and return a ScopeGuard object that closes the session on destruc...
Definition: Downloader.h:43
static Downloader & getDefaultInstance()
Return the default instance.
Definition: Downloader.cc:133
std::vector< Conditions::TestingPayloadStorage > m_testingPayloads
optional list of testing payload storages to look for existing payloads
Definition: Database.h:244

◆ createSocket() [1/2]

std::unique_ptr< zmq::socket_t > createSocket ( const std::string &  socketAddress)

Create a socket of the given type while deciding on the bind behaviour via the address.

An address in the form "tcp://ast:<port>" (with ast = *) means the socket is bound to a local interface. An address in the from "tcp://<host>:<port>" means it connects to the given host.

If you want to fore a given bind behaviour (and fail if the address is invalid), use the function above.

Definition at line 141 of file ZMQParent.h.

142  {
143  // We only check for "*" in the full address for now. This is fine, as neither a valid hostname nor a valid
144  // port number can ever contain a "*".
145  if (socketAddress.find("*") != std::string::npos) {
146  return createSocket<AZMQType>(socketAddress, true);
147  } else {
148  return createSocket<AZMQType>(socketAddress, false);
149  }
150  }

◆ createSocket() [2/2]

std::unique_ptr< zmq::socket_t > createSocket ( const std::string &  socketAddress,
bool  bind 
)

Create a socket of the given type with the given address and bind or not bind it.

Typical socket types are ZMQ_ROUTER, ZMQ_DEALER and ZMQ_STREAM.

The address needs to be in the form "tcp://ast:<port>" (with ast = *) if you want to bind to a local interface or "tcp://<host>:<port>" if you want to connect. Use the convenience function below if you want the program to decide based on your address and use this function if you want the program to force a specific bind behaviour (it will raise an exception if given an invalid address).

Definition at line 105 of file ZMQParent.h.

◆ DEFINE_UNIT() [1/2]

Belle2::DEFINE_UNIT ( cm  ,
1.   
)

Standard units with the value = 1.

Standard of [length]

◆ DEFINE_UNIT() [2/2]

Belle2::DEFINE_UNIT ( km  ,
Unit::cm 1e5 
)

Derived units.

[kilometers]

◆ DEFINE_UNIT_NAME()

Belle2::DEFINE_UNIT_NAME ( g_cm3  ,
1.  ,
"g/cm3"   
)

Practical units with the value = 1.

These units are NOT consistent with the other standard units. Please use them carefully. Standard of [density]

◆ expand()

std::string expand ( const std::string &  text)
static

Modify the given string and replace every occurence of $NAME or ${NAME} with the value of the environment variable NAME.

Variables which are not found are returned unchanged

Definition at line 60 of file EnvironmentVariables.cc.

61  {
62  // we could implement this ourselves ... but that seems like a waste of
63  // time since there's a perfectly good implementation available.
64  namespace py = boost::python;
65  py::object path = py::import("os.path");
66  return py::extract<std::string>(path.attr("expandvars")(text));
67  }

◆ findMatchedParenthesis()

unsigned long int findMatchedParenthesis ( std::string  str,
char  open = '[',
char  close = ']' 
)

Returns position of the matched closing parenthesis if the first character in the given string contains an opening parenthesis.

Otherwise return 0.

Definition at line 33 of file CutHelpers.cc.

◆ fromObject()

DBStoreEntry fromObject ( const std::string &  name,
const TObject *  obj,
bool  isRequired 
)
static

Construct a new DBStoreEntry with a requested name and an object directly.

The constructor arguments type, objClass and isArray will be filled correctly by looking at obj

Parameters
namename of the payload, ususally the class name of the payload but can be any string identifying the payload in the database
objinstance of an object representing the correct type
isRequiredif false don't emit errors if the payload cannot be found for any run
Returns
new DBStoreEntry instance with the correct name and types set

Definition at line 37 of file DBStoreEntry.cc.

38  {
39  assert(obj);
40  bool isArray = dynamic_cast<const TClonesArray*>(obj) != nullptr;
41  TClass* objClass = isArray ? (dynamic_cast<const TClonesArray*>(obj)->GetClass()) : (obj->IsA());
42  return DBStoreEntry(c_Object, name, objClass, isArray, isRequired);
43  }
@ c_Object
A ROOT file containing a object with the name of the DBStoreEntry.
Definition: DBStoreEntry.h:56
DBStoreEntry(EPayloadType type, const std::string &name, const TClass *objClass, bool isArray, bool isRequired)
Construct a new DBStoreEntry.
Definition: DBStoreEntry.h:68
bool isRequired() const
check whether this payload is required for operation
Definition: DBStoreEntry.h:115
bool isArray() const
get whether this payload is an array of objects or a single objects
Definition: DBStoreEntry.h:113

◆ generate_number_sequence()

std::set< int64_t > generate_number_sequence ( const std::string &  str)

Generate a sequence of numbers defined by a string.

The syntax looks like this: sequence = interval,interval,interval,... interval = begin:end number

For instance. 3,23:27,101 Would generate the following sequence of numbers 3,23,24,25,26,27,101

If intervals overlap the number is only returned once, so the following string 27,24:28,26:29 yields 24,25,26,27,28,29

Negative numbers and intervals are supported as well -3:3 yields -3,-2,-1,0,1,2,3

But reversed intervals are considered empty 5:3 yields an empty sequence

Returns a std::set, which contains the number sequence, each number (as stated above) occurs only once (obviously, since it's a set) and the numbers are ordered using the default Compare operator less<int> of std::set.

Definition at line 20 of file NumberSequence.cc.

21  {
22  // Tokenize input
23  std::vector<std::string> tokens;
24  unsigned int lastdelimiter = 0;
25  for (unsigned int i = 0; i < str.size(); ++i) {
26  if (str[i] == ',') {
27  tokens.push_back(str.substr(lastdelimiter, i - lastdelimiter));
28  lastdelimiter = i + 1;
29  }
30  }
31  std::string last = str.substr(lastdelimiter);
32  if (last.size() != 0) {
33  tokens.push_back(last);
34  }
35 
36  // Convert tokens into intervals
37  std::vector<std::pair<int64_t, int64_t>> intervals;
38  intervals.reserve(tokens.size());
39  for (const auto& token : tokens) {
40  size_t interval_marker_position = token.find(':');
41  // Single number
42  if (interval_marker_position == std::string::npos) {
43  int64_t number = std::stol(token);
44  intervals.emplace_back(number, number);
45  } else {
46  int64_t interval_begin = std::stol(token.substr(0, interval_marker_position));
47  int64_t interval_end = std::stol(token.substr(interval_marker_position + 1));
48  intervals.emplace_back(interval_begin, interval_end);
49  }
50  }
51 
52  // Convert tokens into number sequence
53  std::set<int64_t> sequence;
54  for (const auto& interval : intervals) {
55  for (int64_t number = interval.first; number <= interval.second; ++number)
56  sequence.insert(number);
57  }
58 
59  return sequence;
60  }

◆ generateBucketNumber()

unsigned generateBucketNumber ( ) const

Generates RF bucket number according to the fill pattern.

Returns
bucket number

Definition at line 47 of file BunchStructure.cc.

48  {
49  if (m_fillPattern.empty()) return (gRandom->Integer(c_RFBuckets / 2) * 2);
50 
51  if (m_filledBuckets.empty()) {
52  for (unsigned i = 0; i < c_RFBuckets; ++i) {
53  if (m_fillPattern[i]) m_filledBuckets.push_back(i);
54  }
55  }
56 
57  int index = gRandom->Integer(m_filledBuckets.size());
58  return m_filledBuckets[index];
59  }
std::vector< unsigned > m_filledBuckets
cache for the filled bucket numbers
std::vector< bool > m_fillPattern
fill pattern, true means the bucket is filled

◆ getAllEntryNames()

std::set< std::string > getAllEntryNames ( )

Return the names of all the payloads stored in the database at the time of this function is called.

This is equivalent to getting all the payloads' names used by the current basf2 process.

Definition at line 196 of file DBStore.cc.

◆ getBucket()

bool getBucket ( int  i) const

Returns the fill status of RF bucket.

Parameters
ibucket number (modulo c_RFBuckets applied internally)
Returns
true if bucket is filled

Definition at line 29 of file BunchStructure.cc.

◆ getCurrentLogConfig()

const LogConfig & getCurrentLogConfig ( const char *  package = nullptr) const
inline

Returns the current LogConfig object used by the logging system.

Will use the configuration of the current package, if available, or the current module, if available, or, otherwise, the global configuration.

The idea is that a module can call functions in a different package, and the log configuration for that package will be used.

Definition at line 258 of file LogSystem.h.

259  {
260  //module specific config?
262  return *m_moduleLogConfig;
263  }
264  //package specific config?
265  if (package && !m_packageLogConfigs.empty()) {
266  // cppcheck-suppress stlIfFind ; cppcheck doesn't like scoped variables in if statements
267  if (auto it = m_packageLogConfigs.find(package); it != m_packageLogConfigs.end()) {
268  const LogConfig& logConfig = it->second;
269  if (logConfig.getLogLevel() != LogConfig::c_Default)
270  return logConfig;
271  }
272  }
273  //global config
274  return m_logConfig;
275  }
ELogLevel getLogLevel() const
Returns the configured log level.
Definition: LogConfig.h:91
@ c_Default
Default: use globally configured log level.
Definition: LogConfig.h:32
std::map< std::string, LogConfig > m_packageLogConfigs
Stores the log configuration objects for packages.
Definition: LogSystem.h:213
LogConfig m_logConfig
The global log system configuration.
Definition: LogSystem.h:207
const LogConfig * m_moduleLogConfig
log config of current module
Definition: LogSystem.h:209

◆ getData() [1/2]

std::pair< TObject *, IntervalOfValidity > getData ( const EventMetaData event,
const std::string &  name 
)

Request an object from the database.

Parameters
eventThe metadata of the event for which the object should be valid.
nameName that identifies the object in the database.
Returns
A pair containing the object and the iov for which it is valid. Ownership will be given to the caller
Warning
The returned object has to be deleted by the caller

Definition at line 72 of file Database.cc.

◆ getData() [2/2]

bool getData ( const EventMetaData event,
std::vector< DBQuery > &  query 
)

Request multiple objects from the database.

Parameters
eventThe metadata of the event for which the objects should be valid.
queryA list of DBQuery entries that contains the names of the objects to be retrieved. On return the object and iov fields are filled.

Definition at line 81 of file Database.cc.

◆ getDefaultValue()

T & getDefaultValue

Returns the default value of the parameter.

Returns
The default value of the parameter.

Definition at line 56 of file ModuleParam.templateDetails.h.

57  {
58  return m_defaultValue;
59  }
T m_defaultValue
The default value of the parameter.
Definition: ModuleParam.h:121

◆ getDetectorComponent()

GearDir getDetectorComponent ( const std::string &  component)

Return GearDir representing a given DetectorComponent.

Parameters
componentName of the DetectorComponent (e.g. IR, PXD)

Definition at line 314 of file Gearbox.cc.

315  {
316  return GearDir("/Detector/DetectorComponent[@name='" + component + "']/Content");
317  }

◆ getEntry()

DBStoreEntry * getEntry ( DBStoreEntry::EPayloadType  payloadType,
const std::string &  name,
const TClass *  objClass,
bool  array,
bool  required = true 
)

Returns the entry with the requested name in the DBStore.

If the DBStore entry does not exist yet it is added to the map.

If the DBStore map already contains an object under the key with a DIFFERENT type than the given type one, an error will be reported.

Parameters
payloadTypeType of the payload. Usually c_Object.
nameName under which the object is stored in the database (and in the DBStore).
objClassThe class of the object.
arrayWhether it is a TClonesArray or not.
requiredIf true emit errors if the object cannot be found
Returns
DBEntry, or nullptr if the requested type does not match the one in the DBStore

Definition at line 34 of file DBStore.cc.

◆ getField() [1/2]

void getField ( const double *  pos,
double *  field 
)
inlinestatic

return the magnetic field at a given position.

Parameters
[in]posposition in framework units, needs to be of at least size 3
[out]fieldmagnetic field field value at position pos in framework units

Definition at line 91 of file BFieldManager.h.

◆ getField() [2/2]

ROOT::Math::XYZVector getField ( const ROOT::Math::XYZVector &  pos) const
inline

Calculate the magnetic field at a given position.

Parameters
posposition where the field should be evaluated in framework units.
Returns
magnetic field at pos in framework units.
Warning
The returned field is in basf2 units which is NOT Tesla. If you need the field strength in a fixed unit please divide the returned value by Unit::T or similar.

Definition at line 67 of file MagneticField.h.

68  {
69  ROOT::Math::XYZVector field;
70  for (auto c : m_components) {
71  if (c->inside(pos)) {
72  // is it an exclusive component? If so return the field
73  if (c->isExclusive()) return c->getField(pos);
74  // else add it to what we already have
75  field += c->getField(pos);
76  }
77  }
78  return field;
79  }
std::vector< MagneticFieldComponent * > m_components
Magnetic field components to evaluate the field.
Definition: MagneticField.h:62

◆ getFile()

std::shared_ptr< TFile > getFile ( std::string  fileName,
bool  ignoreErrors = false 
)

Get a file with a specific name, if is does not exist it will be created.

If the file cannot be created and opened an error is emitted and you get an empty shared_ptr. If you don't want an error to be emitted you can provide ignoreErrors=true as second argument.

WARNING: When you get this file it is probably not set as current directory so before you use it you have to call file->cd();

Definition at line 33 of file RootFileCreationManager.cc.

34  {
35  std::shared_ptr<TFile> ptr = m_files[fileName].lock();
36  if (!ptr) {
37  // make sure stupid gDirectory is not modified ... that means that users
38  // have to ptr->cd() but plays nice with other modules which might not
39  // set their cd() correctly.
40  TDirectory::TContext gDirectoryGuard;
41  // Create shared ptr for the file which will correctly close it when the last user disconnects.
42  ptr = std::shared_ptr<TFile>(TFile::Open(fileName.c_str(), "RECREATE"), TFile_Deleter);
43  // Check if the file is actually open ... otherwise no use in returning it
44  if (!ptr || !ptr->IsOpen()) {
45  if (!ignoreErrors) B2ERROR("Could not create file " << std::quoted(fileName));
46  return nullptr;
47  }
48  //remember this ...
49  m_files[fileName] = ptr;
50  }
51  return ptr;
52  }
std::map< std::string, std::weak_ptr< TFile > > m_files
store for the open files

◆ getGlobalTags()

std::string getGlobalTags ( )

Return the global tags used by the database.

If no conditions database is configured return an empty string. If more then one database is configured return all global tags concatenated by ','

Definition at line 154 of file Database.cc.

◆ getHash()

void getHash ( unsigned char *  buff)

obtain the hash value into buff.

buff must be large enough for the chosen hash size. The values of EHashLength correspond to the number of required bytes, e.g. unsigned char hashValue[c_SHA3_512];

Definition at line 62 of file Hash.cc.

63  {
64  Keccak_HashFinal(m_instance, buff);
65  }
KeccakHashInstance * m_instance
memory structure to calculate the hash value
Definition: Hash.h:51

◆ getList()

std::vector< std::string > getList ( const std::string &  name,
const std::vector< std::string > &  fallback = {},
const std::string &  separators = " \t\n\r" 
)
static

Get a list of values from an environment variable or the given fallback list if the variable is not set.

By default the value of the environment variable is split by whitespace (" \t\n\r") but a different list of characters can be supplied, for example ":" for path lists or ", " for comma or space separated values

Definition at line 36 of file EnvironmentVariables.cc.

◆ getNumOfFilledBuckets()

unsigned getNumOfFilledBuckets ( ) const

Returns the number of filled buckets.

Returns
the number of filled buckets

Definition at line 39 of file BunchStructure.cc.

◆ getOrCreateList()

std::vector< std::string > getOrCreateList ( const std::string &  name,
const std::string &  fallback,
const std::string &  separators = " \t\n\r" 
)
static

Get a list of values from an environment variable or the given fallback string if the variable is not set.

By default the value of the environment variable is split by whitespace (" \t\n\r") but a different list of characters can be supplied, for example ":" for path lists or ", " for comma or space separated values

In case the variable is not set this function will convert the fallback string to a list using the same rules as would apply for the envirnoment value itself.

Definition at line 48 of file EnvironmentVariables.cc.

◆ getParam()

ModuleParam< T > & getParam ( const std::string &  name) const

Returns a reference to a parameter.

The returned parameter has already the correct type.

Throws an exception of type ModuleParameterNotFoundError if a parameter with the given name does not exist. Throws an exception of type ModuleParameterTypeError if the parameter type of does not match to the template parameter.

Parameters
nameThe unique name of the parameter.
Returns
A reference to a module parameter having the correct type.

Definition at line 573 of file Module.h.

◆ getParameter()

ModuleParam< T > & getParameter ( const std::string &  name) const

Returns a reference to a parameter.

The returned parameter has already the correct type.

Throws an exception of type ModuleParameterNotFoundError if a parameter with the given name does not exist. Throws an exception of type ModuleParameterTypeError if the parameter type of does not match to the template parameter.

Parameters
nameThe unique name of the parameter.
Returns
A reference to a module parameter having the correct type.

Definition at line 80 of file ModuleParamList.templateDetails.h.

◆ getParamValuesPython()

void getParamValuesPython ( const std::string &  name,
PythonObject &  pyOutput,
bool  defaultValues 
) const

Returns a python object containing the value or default value of the given parameter.

Calls according to the parameter type a specialized converter in PyObjConvUtils.h

Parameters
nameThe unique name of the parameter.
pyOutputReference to the output object containing the parameter value or default values.
defaultValuesIf true returns a list of default values otherwise a list of the parameter values.

Definition at line 112 of file ModuleParamList.templateDetails.h.

◆ getTObject()

const TObject * getTObject ( const std::string &  path) const
overridevirtualnoexcept

Get the parameter path as a TObject.

Exceptions
gearbox::PathEmptyErrorif path is empty or does not exist
gearbox::TObjectConversionErrorif the value could not be deserialized
Parameters
pathPath of the parameter to get
Returns
pointer to object, owned and managed by gearbox. Object will be deleted once it is no longer valid (e.g. after the current run if it belongs to this run)

Implements Interface.

Definition at line 295 of file Gearbox.cc.

◆ getValue()

T & getValue

Returns the value of the parameter.

Returns
The value of the parameter.

Definition at line 50 of file ModuleParam.templateDetails.h.

◆ GetXYZVector()

ROOT::Math::XYZVector GetXYZVector

returns a XYZVector containing the same coordinates

returns a ROOT::Math::XYZVector containing the same coordinates

Definition at line 738 of file B2Vector3.h.

◆ injectArithmeticOperatorToStream()

void injectArithmeticOperatorToStream ( std::ostream &  stream,
const ArithmeticOperation aoperation 
)

Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the ComparisonOperator given.

For decompiling/printing we want the corresponding character of the operator e.g " + " for ArithmeticOperator::PLUS print() redirects to std::cout, decompile() should redirect to a std::stringstream Both streams subclass std::ostream. This allows the use of these functions in both cases.

Definition at line 57 of file AbstractNodes.cc.

58  {
59  switch (aoperation) {
60  case ArithmeticOperation::PLUS:
61  stream << " + ";
62  break;
63  case ArithmeticOperation::MINUS:
64  stream << " - ";
65  break;
66  case ArithmeticOperation::PRODUCT:
67  stream << " * ";
68  break;
69  case ArithmeticOperation::DIVISION:
70  stream << " / ";
71  break;
72  case ArithmeticOperation::POWER:
73  stream << " ** ";
74  break;
75  default:
76  throw std::runtime_error("Invalid ArithmeticOperator provided to injectArithmeticOperatorToStream.");
77  }
78  }

◆ injectBooleanOperatorToStream()

void injectBooleanOperatorToStream ( std::ostream &  stream,
const BooleanOperator boperator 
)

Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the BooleanOperator given.

For decompiling/printing we want the corresponding character of the operator e.g " and " for BooleanOperator::AND print() redirects to std::cout, decompile() should redirect to a std::stringstream Both streams subclass std::ostream. This allows the use of these functions in both cases.

Definition at line 17 of file AbstractNodes.cc.

◆ injectComparisonOperatorToStream()

void injectComparisonOperatorToStream ( std::ostream &  stream,
const ComparisonOperator coperator 
)

Helper functions for AbstractBooleanNode and AbstractExpressionNode print() and decompile() members Shifts the correct characters into the ostream, depending on the ComparisonOperator given.

For decompiling/printing we want the corresponding character of the operator e.g " == " for ComparisonOperator::EQUALEQUAL print() redirects to std::cout, decompile() should redirect to a std::stringstream Both streams subclass std::ostream. This allows the use of these functions in both cases.

Definition at line 31 of file AbstractNodes.cc.

◆ Instance()

DBStore & Instance ( )
static

Instance of a singleton DBStore.

This method is used to access the DBStore directly. It is used internally in the DBStore accessor classes.

Definition at line 28 of file DBStore.cc.

◆ isLevelEnabled()

bool isLevelEnabled ( LogConfig::ELogLevel  level,
int  debugLevel = 0,
const char *  package = nullptr 
) const
inline

Returns true if the given log level is allowed by the log system (i.e.

>= the system level).

Parameters
levelThe log level which should be compared with the log level of the log system
debugLevelThe level for debug messages. Only used for the debug level.
packageCurrent package (e.g. framework). NULL for package-independent config.

Definition at line 277 of file LogSystem.h.

◆ LogConnectionJSON()

LogConnectionJSON ( bool  complete = false)
explicit

The constructor.

Parameters
completeif true ignore the LogInfo settings and output all parts of the message (like file, line, etc.)

Definition at line 19 of file LogConnectionJSON.cc.

19  : m_console{STDOUT_FILENO, false}, m_complete{complete}
20  {
21  }
LogConnectionConsole m_console
LogConnection to the console we use to dispatch the json objects.
bool m_complete
If true ignore the log message format settings and output everything.

◆ ModuleParam()

ModuleParam ( T &  paramVariable,
const std::string &  description = "",
bool  force = false 
)
explicit

Constructor.

A parameter consists of a reference pointing to a member variable in the module which stores and allows fast access to the parameter value. In addition the type of the parameter is saved and optionally a description can be given.

Parameters
paramVariableReference to the variable which stores the parameter value.
descriptionThe optional description of the parameter.
forceIf true the parameter has to be set by the user in the steering file.

Definition at line 28 of file ModuleParam.templateDetails.h.

◆ name()

std::string name
static

Returns the name of the B2Vector.

Returns a less readable (but more compatible) name of the B2Vector3.

Definition at line 767 of file B2Vector3.h.

◆ open()

void open ( const std::string &  name = "Belle2.xml",
size_t  cacheSize = c_DefaultCacheSize 
)

Open connection to backend and parse tree.

Parameters
nameName of the tree to parse
cacheSizemaximum cache size in entries

Definition at line 133 of file Gearbox.cc.

◆ operator*=()

B2Vector3< DataType > & operator*= ( DataType  a)

scaling with real numbers

multiplication with a real number

Definition at line 652 of file B2Vector3.h.

◆ operator<<()

std::ostream& Belle2::operator<< ( std::ostream &  output,
const IntervalOfValidity iov 
)
Parameters
outputThe output stream.
iovThe IntervalOfValidity object.

Definition at line 194 of file IntervalOfValidity.cc.

195  {
196  output << iov.m_experimentLow << "," << iov.m_runLow << "," << iov.m_experimentHigh << "," << iov.m_runHigh;
197 
198  return output;
199  }

◆ operator>>()

std::istream& Belle2::operator>> ( std::istream &  input,
IntervalOfValidity iov 
)
Parameters
inputThe input stream.
iovThe InervalOfValidity object.

Definition at line 150 of file IntervalOfValidity.cc.

◆ overrideObject()

void overrideObject ( TObject *  obj,
const IntervalOfValidity iov 
)
private

Set an override object in case we want to use a different object then actually provided by the database.

Parameters
objInstance to use as payload, this entry will take over ownership.
iovinterval how long this object should be valid

Definition at line 159 of file DBStoreEntry.cc.

◆ performUpdateEvent()

void performUpdateEvent ( const EventMetaData event)
private

The main code that does an updateEvent.

Factored out so it can be used by both updateEvent and updateEvent(eventNumber).

Definition at line 169 of file DBStore.cc.

◆ poll()

int poll ( unsigned int  timeout,
AMulticastAnswer  multicastAnswer,
ASocketAnswer  socketAnswer 
) const

Poll both the multicast and the data socket until, either:

  • the timeout is raised. The method will return with 0.
  • a message came to the multicast socket. Then, the multicastAnswer will be called with the socket as an argument. If this method returns true, the polling will go on like before. If it returns false, the polling will be stopped. The return value of this function is 1.
  • a message came to the data socket. See above.

A note on the order: if there are messages on both the data socket and the multicast socket, first all messages to the multicast socket will be answered and then all messages to the data socket.

Definition at line 113 of file ZMQClient.h.

114  {
115  B2ASSERT("Can only run this on started clients", m_subSocket and m_socket);
116  bool repeat = true;
117  int pollResult;
118  do {
119  pollResult = pollSocketVector(m_pollSocketPtrList, timeout);
120  if (pollResult & 1) {
121  // The multicast is the first entry.
122  // Get all entries if possible, but do not block anymore.
123  std::vector<zmq::socket_t*> vector = {m_subSocket.get()};
124  while (pollSocketVector(vector, 0) and repeat) {
125  repeat = multicastAnswer(m_subSocket);
126  }
127  }
128 
129  if (pollResult & 2) {
130  // Get all entries if possible, but do not block anymore.
131  std::vector<zmq::socket_t*> vector = {m_socket.get()};
132  while (pollSocketVector(vector, 0) and repeat) {
133  repeat = socketAnswer(m_socket);
134  }
135  }
136  } while (repeat and pollResult);
137 
138  return pollResult;
139  }
std::unique_ptr< zmq::socket_t > m_subSocket
ZMQ sub socket.
Definition: ZMQClient.h:107
static int pollSocketVector(const std::vector< zmq::socket_t * > &socketList, int timeout)
Internal poll function.
Definition: ZMQClient.cc:118
std::vector< zmq::socket_t * > m_pollSocketPtrList
Will use this vector for polling.
Definition: ZMQClient.h:102
std::unique_ptr< zmq::socket_t > m_socket
ZMQ socket.
Definition: ZMQClient.h:109

◆ pollMulticast()

int pollMulticast ( unsigned int  timeout,
AMulticastAnswer  multicastAnswer 
) const

Poll method to only the multicast socket.

Basically the same as the poll function to both sockets, except: If the answer function returns false, the polling will stop as above, BUT: it will first answer all messages that are already in the socket!

Definition at line 162 of file ZMQClient.h.

◆ pollSocket()

int pollSocket ( unsigned int  timeout,
ASocketAnswer  socketAnswer 
) const

Poll method to only the data socket.

Basically the same as the poll function to both sockets, except: If the answer function returns false, the polling will stop as above, BUT: it will first answer all messages that are already in the socket!

Definition at line 142 of file ZMQClient.h.

◆ random01()

double random01 ( )
inline

Generate a random double value between 0 and 1, both limits excluded.

Returns
value in (0,1)

Definition at line 240 of file RandomGenerator.h.

241  {
242  // There are two possibilities to generate a uniform double between 0 and
243  // 1: multiply the integer by a constant or exploit the double
244  // representation and use some bit shift magic. We have both implementation
245  // here and they seem to produce the exact same output so we stick with the
246  // more readable one but leave the bitshift solution just in case
247 #ifdef RANDOM_IEEE754
248  //Generate a double in (0,1) using magic bit hackery with doubles: The
249  //memory layout of a IEEE754 double precision floating point variable
250  //is [sign(1)|exponent(11)|fraction(52)] with values in parentheses
251  //being the number of bits. The actual value is then
252  //-1^{sign} * (1.fraction) * 2^{exponent-1023}. Setting sign to 0 the
253  //exponent to 1023 will thus return a value between 1 (inclusive) and 2
254  //(exclusive). So we shift the 64bit integer to the right by 12 bits
255  //(which gives as zeros for sign and exponent) and logical or this with
256  //the correct binary representation of the exponent
257 
258  //To do this we use a union to modify the binary representation using
259  //an integer and then return the double value
260  union { uint64_t i; double d; } x;
261  x.i = random64() >> 12;
262  //This is a bit academic but we want (0,1) so if we happen to get
263  //exactly zero we try again. Chance is 1 in 2^52
264  if (x.i == 0) return random01();
265  x.i |= 0x3FF0000000000000ULL;
266  return x.d - 1.0;
267 #else
268  //Generate a double (0,1) the traditional way by multiplying it with a
269  //constant. As doubles only have a precision of 52 bits we need to
270  //remove the 12 leading bits from our random int value
271  const uint64_t x = random64() >> 12;
272  //This is a bit academic but we want (0,1) so if we happen to get
273  //exactly zero we try again. Chance is 1 in 2^52
274  if (!x) return random01();
275  //return x / 2^{52};
276  return x * 2.220446049250313080847263336181640625e-16;
277 #endif
278  }
double random01()
Generate a random double value between 0 and 1, both limits excluded.
uint64_t random64()
Generate one 64bit unsigned integer between 0 and UINT64_MAX (both inclusive).

◆ random64()

uint64_t random64 ( )
inline

Generate one 64bit unsigned integer between 0 and UINT64_MAX (both inclusive).

Returns
random value in [0, UINT64_MAX]

Definition at line 200 of file RandomGenerator.h.

◆ rebuild()

void rebuild ( bool  force = false)
protected

Rebuild the index.

Parameters
forceif force is true, the index will be rebuild even if the RelationArray says that it has not been modified

Definition at line 156 of file RelationIndexContainer.h.

157  {
159  if (!m_valid) {
160  B2DEBUG(100, "Relation " << m_storeRel.getName() << " does not exist, cannot build index");
161  m_index.clear();
164  return;
165  }
166 
167  //Check if relation has been modified since we created the index
168  //If not, keep old contents
169  if (!force && !m_storeRel.getModified()) return;
170 
171  B2DEBUG(100, "Building index for " << m_storeRel.getName());
172 
173  //Reset modification flag
174  m_storeRel.setModified(false);
175 
176  m_index.clear();
177 
178  //Get related StoreArrays
181  const StoreArray<FROM> storeFrom(m_storeFrom.first, m_storeFrom.second);
182  const StoreArray<TO> storeTo(m_storeTo.first, m_storeTo.second);
183 
184  //Get number of entries in relation and stores (also checks template type versus DataStore contents)
185  const RelationElement::index_type nFrom = storeFrom.getEntries();
186  const RelationElement::index_type nTo = storeTo.getEntries();
187  const unsigned int nRel = m_storeRel.getEntries();
188 
189  //Loop over all RelationElements and add them to index
190  for (unsigned int i = 0; i < nRel; ++i) {
191  const RelationElement& r = m_storeRel[i];
192  RelationElement::index_type idxFrom = r.getFromIndex();
193  if (idxFrom >= nFrom)
194  B2FATAL("Relation " << m_storeRel.getName() << " is inconsistent: from-index (" << idxFrom << ") out of range");
195  const FROM* from = storeFrom[idxFrom];
196 
197  //Loop over index and weight vector at once
198  const auto& indices = r.getToIndices();
199  const auto& weights = r.getWeights();
200  auto itIdx = indices.begin();
201  auto itWgt = weights.begin();
202  const auto& idxEnd = indices.end();
203  for (; itIdx != idxEnd; ++itIdx, ++itWgt) {
204  const RelationElement::index_type idxTo = *itIdx;
205  if (idxTo >= nTo)
206  B2FATAL("Relation " << m_storeRel.getName() << " is inconsistent: to-index (" << idxTo << ") out of range");
207  const TO* to = storeTo[idxTo];
208  m_index.insert(Element(idxFrom, idxTo, from, to, *itWgt));
209  }
210  }
211  }
bool getModified() const
Get modified flag of underlying container.
const AccessorParams & getFromAccessorParams() const
Return the AccessorParams the attached relation points from.
const AccessorParams & getToAccessorParams() const
Return the AccessorParams the attached relation points to.
void setModified(bool modified)
Set modified flag of underlying container.
int getEntries() const
Get the number of elements.
unsigned int index_type
type used for indices.
RelationArray m_storeRel
the underlying relation.
AccessorParams m_storeFrom
AccessorParams of the StoreArray the relation points from.
bool m_valid
Indicate wether the relation is valid.
ElementIndex m_index
Instance of the index.
AccessorParams m_storeTo
AccessorParams of the StoreArray the relation points to.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
std::pair< std::string, DataStore::EDurability > AccessorParams
Pair of parameters needed to find an object in the DataStore.

◆ reset() [1/2]

void reset ( bool  keepConfig = false)
static

Reset the database instance.

Parameters
keepConfigif true the configuration object itself is not resetted so that initializing the database again will result in the same configuration as before. This is useful when running process multiple times.

Definition at line 50 of file Database.cc.

◆ reset() [2/2]

void reset ( bool  keepEntries = false)

Invalidate all payloads.

Parameters
keepEntriesKeep the existing entries so that future calls to update the database will try to obtain the payloads which were registered so far.

Definition at line 177 of file DBStore.cc.

◆ RndmArray() [1/4]

void RndmArray ( Int_t  n,
Double_t *  array 
)
inline

Fill an array of doubles with random values in (0,1), both limits excluded.

Parameters
nnumber of doubles to generate
arraypointer to an array where the numbers should be stored

Definition at line 219 of file RandomGenerator.h.

◆ RndmArray() [2/4]

void RndmArray ( Int_t  n,
Float_t *  array 
)
inline

Fill an array of floats with random values in (0,1), both limits excluded.

Parameters
nnumber of floats to generate
arraypointer to an array where the numbers should be stored

Definition at line 212 of file RandomGenerator.h.

◆ RndmArray() [3/4]

void RndmArray ( Int_t  n,
UInt_t *  array 
)
inline

Fill an array of unsigned integers with random values in [0, UINT32_MAX], both limits included.

Parameters
nnumber of ints to generate
arraypointer to an array where the numbers should be stored

Definition at line 231 of file RandomGenerator.h.

◆ RndmArray() [4/4]

void RndmArray ( Int_t  n,
ULong64_t *  array 
)
inline

Fill an array of unsigned 64bit integers with random values in [0, UINT64_MAX], both limits included.

Parameters
nnumber of ints to generate
arraypointer to an array where the numbers should be stored

Definition at line 225 of file RandomGenerator.h.

◆ select()

void select ( const std::function< bool(const StoredClass *)> &  f)

This method is the actual worker.

It selects the elements, fill the subset and all the relations in which the subset is involved.

Parameters
fthe pointer to the function (or a nameless lambda expression) returning true for the elements to be selected and false for the others.

Definition at line 414 of file SelectSubset.h.

415  {
417 
418  if (m_inheritToSelf) {
420  }
421 
422  if (m_reduceExistingSet) {
424  }
425  }
bool m_inheritToSelf
If true, relations from set objects to set objects are copied.
Definition: SelectSubset.h:58
bool m_reduceExistingSet
If true, non-selected candidates are removed from m_set, m_subset only exists temporarily.
Definition: SelectSubset.h:60
void swapSetsAndDestroyOriginal()
Swap set and subset (+relations), and keep only the reduced set.
Definition: SelectSubset.cc:14
std::map< int, int > copySetWithRelations(std::function< bool(const StoredClass *)> f)
Selects the elements, fill the subset and copies all the relations in which the set is involved.
Definition: SelectSubset.h:351
void copyRelationsToSelf()
Copy any set -> set relations between selected objects.
Definition: SelectSubset.h:390

◆ sendMessage()

bool sendMessage ( const LogMessage message)
overridevirtual

Sends a log message.

Parameters
messageThe log message object.
Returns
Returns true if the message could be send.

Implements LogConnectionBase.

Definition at line 23 of file LogConnectionJSON.cc.

◆ setBackends()

void setBackends ( const std::vector< std::string > &  backends)

Select the backends to use to find resources.

Parameters
backendslist of URIs identifying the backends starting with the handler prefix followed by a colon, the rest is handler specific

Definition at line 99 of file Gearbox.cc.

◆ setBucket()

void setBucket ( unsigned  i)

Sets the fill status of RF bucket to true.

Parameters
ibucket number (modulo c_RFBuckets applied internally)

Definition at line 20 of file BunchStructure.cc.

◆ setDefaultValue()

void setDefaultValue ( const T &  defaultValue)

Sets the default value of a parameter.

Parameters
defaultValueThe parameter default value of the parameter.

Definition at line 42 of file ModuleParam.templateDetails.h.

◆ setMeanCov() [1/2]

bool setMeanCov ( const ROOT::Math::XYZVector &  mean,
const TMatrixTBase< value_type > &  cov 
)

set the mean and covariance for the distribution.

Parameters
meanVector of mean values
covMatrix containing the covariance values
Returns
true if covariance could be decomposited, false otherwise

Definition at line 190 of file MultivariateNormalGenerator.h.

192  {
193  TVectorT<value_type> tmean(3);
194  tmean[0] = mean.X();
195  tmean[1] = mean.Y();
196  tmean[2] = mean.Z();
197  return setMeanCov(tmean, cov);
198  }
bool setMeanCov(int n, const double *mean, const double *cov)
set the mean and covariance for the distribution with array interface: mean and covariance are passed...

◆ setMeanCov() [2/2]

bool setMeanCov ( const TVectorT< value_type > &  mean,
const TMatrixTBase< value_type > &  cov 
)

set mean and covariance matrix from ROOT vector/matrix objects, e.g.

TMatrixD, TMatrixF, TMatrixDSym and so forth

Parameters
meanVector of mean values
covMatrix containing the covariance values
Returns
true if covariance could be decomposited, false otherwise

Definition at line 176 of file MultivariateNormalGenerator.h.

◆ setParameter()

void setParameter ( const std::string &  name,
const T &  value 
)

Sets the value of a parameter given by its name.

A template based method which is invoked by the module.

Parameters
nameThe unique name of the parameter.
valueThe parameter value which should be assigned to the parameter given by its name.

Definition at line 69 of file ModuleParamList.templateDetails.h.

◆ setParamPython()

void setParamPython ( const std::string &  name,
const PythonObject &  pyObj 
)

Implements a method for setting boost::python objects.

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

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

Definition at line 104 of file ModuleParamList.templateDetails.h.

◆ setValue()

void setValue ( const T &  value)

Sets the value of a parameter.

Parameters
valueThe parameter value which should be assigned to the parameter.

Definition at line 35 of file ModuleParam.templateDetails.h.

◆ setValueFromPythonObject()

void setValueFromPythonObject ( const boost::python::object &  pyObject)
finalvirtual

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 by PyObjConvUtils::convertPythonObject.

Parameters
pyObjectThe object which should be converted and stored as the parameter value.

Implements ModuleParamBase.

Definition at line 62 of file ModuleParam.templateDetails.h.

◆ setValueToPythonObject()

void setValueToPythonObject ( boost::python::object &  pyObject,
bool  defaultValues = false 
) const
finalvirtual

Returns a python object containing the value or the default value of the given parameter.

Parameters
pyObjectReference to the python object which is set to the parameter value.
defaultValuesIf true returns default value otherwise parameter value.

Implements ModuleParamBase.

Definition at line 68 of file ModuleParam.templateDetails.h.

◆ storeData() [1/2]

bool storeData ( const std::string &  name,
TObject *  object,
const IntervalOfValidity iov 
)

Store an object in the database.

Parameters
nameName that identifies the object in the database.
objectThe object that should be stored in the database.
iovThe interval of validity of the the object.
Returns
True if the storage of the object succeeded.

Definition at line 141 of file Database.cc.

◆ storeData() [2/2]

bool storeData ( std::list< DBImportQuery > &  query)

Store multiple objects in the database.

Parameters
queryA list of DBImportQuery entries that contains the objects, their names, and their intervals of validity.
Returns
True if the storage of the object succeeded.

Definition at line 134 of file Database.cc.

◆ TypeInfo()

std::string TypeInfo
static

Static function to generate a string description for the parameter type.

This string will be used to identify the contained type and guaranties some level of type safety in this type erasure.

Definition at line 22 of file ModuleParam.templateDetails.h.

◆ update() [1/2]

void update ( )

Updates all objects that are outside their interval of validity.

This method is called by the framework for each new run.

Definition at line 79 of file DBStore.cc.

◆ update() [2/2]

void update ( const EventMetaData event)

Updates all objects that are outside their interval of validity.

This method is for calling the DBStore manually using an EventMetaData object instead of relying on the DataStore containing one.

Definition at line 97 of file DBStore.cc.

◆ updateEvent() [1/2]

void updateEvent ( )

Updates all intra-run dependent objects.

This method is called by the framework for each event.

Definition at line 142 of file DBStore.cc.

◆ updateEvent() [2/2]

void updateEvent ( const unsigned int  eventNumber)

Updates all intra-run dependent objects.

This method is for specifying the event number to update to manually. Updates the m_manualEvent to use the event number given in the argument, before performing the intra-run update. This doesn't alter/use the DataStore EventMetaData.

Definition at line 153 of file DBStore.cc.

◆ updateObject()

void updateObject ( const EventMetaData event)
private

update the payload object according to the new event information.

If the payload has no intra run dependency this does nothing, otherwise it will load the appropirate object for the given event and call the update notifications on changes to the object.

Definition at line 55 of file DBStoreEntry.cc.

◆ updatePayload()

void updatePayload ( unsigned int  revision,
const IntervalOfValidity iov,
const std::string &  filename,
const std::string &  checksum,
const std::string &  globaltag,
const EventMetaData event 
)
private

Update the payload information for this entry and if appropriate open the new file and extract the object as needed.

If another version is already loaded the object will be deleted and the file closed.

If neither revision or filename change we assume the payload is not modified and will not update anything and not call any update notifications.

Parameters
revisionnew revision of the payload
iovnew interval of validity for the payload
filenamefilename for the payload
checksumchecksum of the payload
globaltagglobaltag name (or testing payloads path) from which the payload is picked
eventEventMetaData object

Definition at line 83 of file DBStoreEntry.cc.

◆ ~DBStoreEntry()

Clean up memory.

Some of the members are raw pointers to limit the include burden on this class as it will be included by anyone using Conditions data

Definition at line 45 of file DBStoreEntry.cc.

Variable Documentation

◆ XYZToTVector

constexpr auto XYZToTVector
staticconstexpr
Initial value:
= [](const ROOT::Math::XYZVector& a)
{
return TVector3(a.X(), a.Y(), a.Z());
}

Helper function to convert XYZVector to TVector3.

Definition at line 24 of file VectorUtil.h.