Belle II Software development
StorageRootOutputModule Class Reference

Write objects from DataStore into a ROOT file. More...

#include <StorageRootOutputModule.h>

Inheritance diagram for StorageRootOutputModule:
Module PathElement

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

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

Private Member Functions

void closeFile ()
 Finalize the output file.
 
void openFile ()
 Open the next output file.
 
void fillTree (DataStore::EDurability durability)
 Fill TTree.
 
void fillFileMetaData ()
 Create and fill FileMetaData object.
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

std::string m_outputFileName
 Name for output file.
 
std::vector< std::string > m_branchNames [DataStore::c_NDurabilityTypes]
 Array for names of branches that should be written out.
 
std::vector< std::string > m_additionalBranchNames [DataStore::c_NDurabilityTypes]
 Array of names of branches that should be written out although they are not flagged for writeout.
 
std::vector< std::string > m_excludeBranchNames [DataStore::c_NDurabilityTypes]
 Array for names of branches that should NOT be written out.
 
int m_compressionAlgorithm {0}
 TFile compression algorithm.
 
int m_compressionLevel {1}
 TFile compression level.
 
int m_splitLevel
 Branch split level.
 
int m_autoflush
 Number of entries (if >0) or number of bytes (if <0) after which to flush all baskets to disk.
 
int m_autosave
 Number of entries (if >0) or number of bytes (if <0) after which write the tree metadata to disk.
 
int m_basketsize
 basket size for each branch in the file in bytes
 
bool m_updateFileCatalog
 Flag to enable or disable the update of the metadata catalog.
 
bool m_ignoreCommandLineOverride
 Ignore filename override from command line.
 
std::optional< uint64_t > m_outputSplitSize {std::nullopt}
 Maximum output file size in MB.
 
int m_fileIndex {0}
 Keep track of the file index: if we split files than we add '.f{fileIndex:05d}' in front of the ROOT extension.
 
unsigned int m_nFullEvents {0}
 Number of full events (aka number of events without an error flag)
 
TFile * m_file
 TFile for output.
 
TTree * m_tree [DataStore::c_NDurabilityTypes]
 TTree for output.
 
std::vector< DataStore::StoreEntry * > m_entries [DataStore::c_NDurabilityTypes]
 Vector of DataStore entries that are written to the output.
 
std::vector< std::string > m_parentLfns
 Vector of parent file LFNs.
 
std::map< std::string, std::string > m_additionalDataDescription
 Map of additional metadata to be added to the output file.
 
unsigned long m_experimentLow
 Lowest experiment number.
 
unsigned long m_runLow
 Lowest run number.
 
unsigned long m_eventLow
 Lowest event number in lowest run.
 
unsigned long m_experimentHigh
 Highest experiment number.
 
unsigned long m_runHigh
 Highest run number.
 
unsigned long m_eventHigh
 Highest event number in highest run.
 
bool m_buildIndex {false}
 Whether or not we want to build an event index.
 
bool m_keepParents {false}
 Whether to keep parents same as that of input file.
 
bool m_regularFile {true}
 Whether this is a regular, local file where we can actually create directories.
 
StoreObjPtr< EventMetaDatam_eventMetaData
 Pointer to the event meta data.
 
StoreObjPtr< FileMetaDatam_fileMetaData {"", DataStore::c_Persistent}
 Pointer to the input file meta data.
 
FileMetaDatam_outputFileMetaData
 File meta data stored in the output file.
 
int m_expno
 Variables for online storage.
 
int m_runno
 
DBInterfacem_db
 
std::string m_runType
 
std::string m_HLTName
 
std::string m_disk
 
int m_nDisk
 
int m_processNumber
 
bool m_firstEvent {false}
 
bool m_ramdiskBuffer {false}
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

Write objects from DataStore into a ROOT file.

You can use the RootInputModule to read the data back in.

See also
DataStore::EDurability

Definition at line 40 of file StorageRootOutputModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

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

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

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

c_HistogramManager 

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

c_InternalSerializer 

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

c_TerminateInAllProcesses 

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

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

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

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

Constructor & Destructor Documentation

◆ StorageRootOutputModule()

Constructor.

Definition at line 54 of file StorageRootOutputModule.cc.

54 : Module(), m_file(nullptr), m_tree{0}, m_experimentLow(1), m_runLow(0),
56{
57 //Set module properties
58 setDescription("Writes DataStore objects into a .root file. Data is stored in a TTree 'tree' for event-dependent and in 'persistent' for peristent data. You can use RootInput to read the files back into basf2.");
60
61 //Parameter definition
62 addParam("outputFileName", m_outputFileName, "Name of the output file. Can be overridden using the -o argument to basf2.",
63 string("RootOutput.root"));
64 addParam("ignoreCommandLineOverride", m_ignoreCommandLineOverride,
65 "Ignore override of file name via command line argument -o. Useful if you have multiple output modules in one path.", false);
66 addParam("compressionLevel", m_compressionLevel,
67 "0 for no, 1 for low, 9 for high compression. Level 1 usually reduces size by >50%, higher levels have no noticeable effect. On typical hard disks, disabling compression reduces write time by 10-20 %, but almost doubles read time, so you probably should leave this turned on.",
69 addParam("compressionAlgorithm", m_compressionAlgorithm,
70 "Set the Compression algorithm. Recommended values are 0 for default, 1 for zlib and 4 for lz4\n\n"
71 ".. versionadded:: release-03-00-00", m_compressionAlgorithm);
72 addParam("splitLevel", m_splitLevel,
73 "Branch split level: determines up to which depth object members will be saved in separate sub-branches in the tree. For arrays or objects with custom streamers, -1 is used instead to ensure the streamers are used. The default (99) usually gives the highest read performance with RootInput.",
74 99);
75 addParam("updateFileCatalog", m_updateFileCatalog, R"DOC(
76Flag that specifies whether the file metadata catalog is updated or created.
77This is only necessary in special cases and can always be done afterwards using
78``b2file-catalog-add filename.root``"
79
80(You can also set the ``BELLE2_FILECATALOG`` environment variable to NONE to get
81the same effect as setting this to false))DOC", false);
82
83 vector<string> emptyvector;
85 "Names of event durability branches to be saved. Empty means all branches. Objects with c_DontWriteOut flag added here will also be saved. (EventMetaData is always saved)",
86 emptyvector);
88 "Names of persistent durability branches to be saved. Empty means all branches. Objects with c_DontWriteOut flag added here will also be saved. (FileMetaData is always saved)",
89 emptyvector);
91 "Add additional event branch names without the need to specify all branchnames.",
92 emptyvector);
94 "Add additional persistent branch names without the need to specify all branchnames.",
95 emptyvector);
97 "Names of event durability branches NOT to be saved. Branches also in branchNames are not saved.", emptyvector);
99 "Names of persistent durability branches NOT to be saved. Branches also in branchNamesPersistent are not saved.", emptyvector);
100 addParam("autoFlushSize", m_autoflush,
101 "Value for TTree SetAutoFlush(): a positive value tells ROOT to flush all baskets to disk after n entries, a negative value to flush after -n bytes",
102 -10000000);
103 addParam("autoSaveSize", m_autosave,
104 "Value for TTree SetAutoSave(): a positive value tells ROOT to write the TTree metadata after n entries, a negative value to write the metadata after -n bytes",
105 -10000000);
106 addParam("basketSize", m_basketsize, "Basketsize for Branches in the Tree in bytes", 32000);
107 addParam("additionalDataDescription", m_additionalDataDescription, "Additional dictionary of "
108 "name->value pairs to be added to the file metadata to describe the data",
110 addParam("buildIndex", m_buildIndex, "Build Event Index for faster finding of events by exp/run/event number", m_buildIndex);
111 addParam("keepParents", m_keepParents, "Keep parents files of input files, input files will not be added as output file's parents",
113 addParam("outputSplitSize", m_outputSplitSize, R"DOC(
114If given split the output file once the file has reached the given size in MB.
115If set the filename will end in ``.f{index:05d}.root``. So if for example
116``outputFileName`` is set to "RootOutput.root" then the files will be named
117``RootOutput.f00000.root``, ``RootOutput.f00001.root``,
118``RootOutput.f00002.root``, ...
119
120All created output files are complete and independent files and can
121subsequently processed completely independent.
122
123Note:
124 The output files will be approximately of the size given by
125 ``outputSplitSize`` but they will be slightly larger since
126 additional information has to be written at the end of the file. If necessary
127 please account for this. Also, using ``buildIndex=False`` might be beneficial
128 to reduce the overshoot.
129
130Warning:
131 This will set the amount of generated events stored in the file metadata to
132 zero as it is not possible to determine which fraction ends up in which
133 output file.
134
135.. versionadded:: release-03-00-00
136)DOC", m_outputSplitSize);
137
139
140 // Parameters for online storage
141 addParam("runType", m_runType, "Run type", string("null"));
142 addParam("HLTName", m_HLTName, "HLT name", string("HLT00"));
143 addParam("nDisk", m_nDisk, "The number of paratitions", 3);
144 addParam("skipFirstEvent", m_firstEvent, "Boolean to skip the first event or not. "
145 "If the module is used inside the hbasf2, like HLT storage, the first event need to be skipped.", m_firstEvent);
146 addParam("ramdiskBuffer", m_ramdiskBuffer, "Boolean to make small ramdisk buffer setup. "
147 "If this is false, assuming the buffer disks are large SSD.", m_ramdiskBuffer);
148}
149
150
152
154{
155 //ROOT has a default maximum size of 100GB for trees??? For larger trees it creates a new file and does other things that finally produce crashes.
156 //Let's set this to 100PB, that should last a bit longer.
157 TTree::SetMaxTreeSize(1000 * 1000 * 100000000000LL);
158
159 //make sure we have event meta data
160 m_eventMetaData.isRequired();
161
162 //check outputSplitSize
163 if (m_outputSplitSize) {
164 if (*m_outputSplitSize == 0) B2ERROR("outputSplitSize must be set to a positive value");
165 // Warn is splitsize is >= 1TB ... because this seems weirdly like size was given in bytes
166 if (*m_outputSplitSize >= 1024*1024) B2WARNING("outputSplitSize set to " << *m_outputSplitSize << " MB, please make sure the units are correct");
167 // convert to bytes
168 *m_outputSplitSize *= 1024 * 1024;
169 }
170
171 getFileNames();
172
173 // Now check if the file has a protocol like file:// or http:// in front
174 std::regex protocol("^([A-Za-z]*)://");
175 if(std::smatch m; std::regex_search(m_outputFileName, m, protocol)) {
176 if(m[1] == "file") {
177 // file protocol: treat as local and just remove it from the filename
178 m_outputFileName = std::regex_replace(m_outputFileName, protocol, "");
179 } else {
180 // any other protocol: not local, don't create directories
181 m_regularFile = false;
182 }
183 }
184 // For online storage
185 // Do not open file in basf2 initialize
186 // openFile();
187
188 ConfigFile config("slowcontrol");
189 PostgreSQLInterface *db = new PostgreSQLInterface(config.get("database.host"),
190 config.get("database.dbname"),
191 config.get("database.user"),
192 config.get("database.password"),
193 config.getInt("database.port"));
194 m_db = db;
195}
Metadata information about a file.
Definition: FileMetaData.h:29
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
Module()
Constructor.
Definition: Module.cc:30
unsigned long m_experimentLow
Lowest experiment number.
unsigned long m_experimentHigh
Highest experiment number.
unsigned long m_eventLow
Lowest event number in lowest run.
int m_autosave
Number of entries (if >0) or number of bytes (if <0) after which write the tree metadata to disk.
bool m_regularFile
Whether this is a regular, local file where we can actually create directories.
unsigned long m_runLow
Lowest run number.
int m_compressionAlgorithm
TFile compression algorithm.
bool m_buildIndex
Whether or not we want to build an event index.
bool m_keepParents
Whether to keep parents same as that of input file.
virtual ~StorageRootOutputModule()
Destructor.
TTree * m_tree[DataStore::c_NDurabilityTypes]
TTree for output.
unsigned long m_runHigh
Highest run number.
StoreObjPtr< EventMetaData > m_eventMetaData
Pointer to the event meta data.
std::vector< std::string > m_excludeBranchNames[DataStore::c_NDurabilityTypes]
Array for names of branches that should NOT be written out.
int m_basketsize
basket size for each branch in the file in bytes
std::vector< std::string > m_additionalBranchNames[DataStore::c_NDurabilityTypes]
Array of names of branches that should be written out although they are not flagged for writeout.
virtual void initialize() override
Setting up of various stuff.
FileMetaData * m_outputFileMetaData
File meta data stored in the output file.
bool m_ignoreCommandLineOverride
Ignore filename override from command line.
std::optional< uint64_t > m_outputSplitSize
Maximum output file size in MB.
int m_compressionLevel
TFile compression level.
int m_autoflush
Number of entries (if >0) or number of bytes (if <0) after which to flush all baskets to disk.
bool m_updateFileCatalog
Flag to enable or disable the update of the metadata catalog.
unsigned long m_eventHigh
Highest event number in highest run.
std::map< std::string, std::string > m_additionalDataDescription
Map of additional metadata to be added to the output file.
std::vector< std::string > m_branchNames[DataStore::c_NDurabilityTypes]
Array for names of branches that should be written out.
virtual std::vector< std::string > getFileNames(bool outputFiles=true) override
Set the used output file, taking into account -o argument to basf2.
std::string m_outputFileName
Name for output file.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
const std::string c_SteerExcludeBranchNames[]
Steering parameter names for m_excludeBranchNames.
const std::string c_SteerBranchNames[]
Steering parameter names for m_branchNames.
const std::string c_SteerAdditionalBranchNames[]
Steering parameter names for m_additionalBranchNames.

◆ ~StorageRootOutputModule()

virtual ~StorageRootOutputModule ( )
virtual

Destructor.

Deletion of objects, that were created in the Constructor.

Member Function Documentation

◆ beginRun()

virtual void beginRun ( void  )
inlinevirtualinherited

Called when entering a new run.

Called at the beginning of each run, the method gives you the chance to change run dependent constants like alignment parameters, etc.

This method can be implemented by subclasses.

Reimplemented in ARICHBackgroundModule, BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, EventsOfDoomBusterModule, CosmicsAlignmentValidationModule, EnergyBiasCorrectionModule, ChargedPidMVAModule, ChargedPidMVAMulticlassModule, CurlTaggerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, ParticleVertexFitterModule, PhotonEfficiencySystematicsModule, TagVertexModule, TreeFitterModule, arichBtestModule, ARICHDigitizerModule, ARICHDQMModule, ARICHRateCalModule, ARICHReconstructorModule, B2BIIMCParticlesMonitorModule, B2BIIConvertBeamParamsModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCRTestModule, cdcDQM7Module, CDCDQMModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, ElapsedTimeModule, DeSerializerPXDModule, GenRawSendModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageSerializerModule, IPDQMModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDMVAModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMConnectedRegionsModule, ECLDQMEXTENDEDModule, ECLDQMOutOfTimeDigitsModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLLOMModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, HistoModule, SubEventModule, SwitchDataStoreModule, EventInfoPrinterModule, EventLimiterModule, IoVDependentConditionModule, ProgressModule, RandomBarrierModule, GearboxModule, HistoManagerModule, StatisticsSummaryModule, SeqRootInputModule, SeqRootOutputModule, RxModule, TxModule, EvtGenDecayModule, EvtGenInputModule, OverrideGenerationFlagsModule, KKGenInputModule, CreateFieldMapModule, ExportGeometryModule, SoftwareTriggerModule, SoftwareTriggerHLTDQMModule, StatisticsTimingHLTDQMModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterAnaModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDigitTimeShifterModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, MVAExpertModule, MVAMultipleExpertsModule, MVAPrototypeModule, AWESOMEBasicModule, PXDBackgroundModule, PXDRawDQMChipsModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDClusterizerModule, Convert2RawDetModule, CDCDedxDQMModule, CDCDedxValidationModule, EventT0DQMModule, EventT0ValidationModule, DataWriterModule, ECLExpertModule, KLMExpertModule, KlongValidationModule, KLMMuonIDDNNExpertModule, FullSimModule, MaterialScanModule, SVDBackgroundModule, SVDClusterCalibrationsMonitorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsCheckModule, SVDLocalCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDTimeCalibrationsMonitorModule, SVDDQMHitTimeModule, svdDumpModule, SVDPackerModule, SVDB4CommissioningPlotsModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDMaxStripTTreeModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPerformanceTTreeModule, SVDShaperDigitsFromTracksModule, SVDClusterizerModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDMissingAPVsClusterCreatorModule, SVDRecoDigitCreatorModule, SVD3SamplesEmulatorModule, SVDDigitizerModule, SVDEventInfoSetterModule, SVDTriggerQualityGeneratorModule, SVDSpacePointCreatorModule, SVDTimeGroupingModule, SVDUnpackerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelMaskerModule, TOPChannelT0MCModule, TOPDigitizerModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPDQMModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTimeRecalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, DQMHistoModuleBase, SVDEventT0EstimatorModule, ExtModule, FlipQualityModule, BeamSpotMonitorModule, KinkFinderModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, PXDROIFinderModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, TrackCreatorModule, TrackFinderMCTruthRecoTracksModule, EffPlotsModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, TrackQualityEstimatorMVAModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDSimpleClusterizerModule, QualityEstimatorVXDModule, VXDQETrainingDataCollectorModule, VXDQualityEstimatorMVAModule, SectorMapBootstrapModule, SegmentNetworkProducerModule, TrackFinderVXDBasicPathFinderModule, TrackFinderVXDCellOMatModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNDFinderModule, CDCTriggerTSFModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, CDCTriggerUnpackerModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLEventTimingDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, VXDMisalignmentModule, DQMHistAnalysisARICHModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTrackingHLTModule, DQMHistAnalysisTRGECLModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, DAQMonitorModule, DelayDQMModule, V0ObjectsDQMModule, ECLDQMInjectionModule, PyModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDDAQDQMModule, PXDDQMClustersModule, PXDDQMCorrModule, PXDDQMEfficiencyModule, PXDDQMEfficiencySelftrackModule, PXDDQMExpressRecoModule, PXDGatedDHCDQMModule, PXDGatedModeDQMModule, PXDInjectionDQMModule, PXDRawDQMCorrModule, PXDRawDQMModule, PXDROIDQMModule, PXDTrackClusterDQMModule, PXDDigitizerModule, PXDPackerModule, PXDUnpackerModule, TTDDQMModule, SVDDQMClustersOnTrackModule, SVDDQMDoseModule, SVDDQMExpressRecoModule, SVDDQMInjectionModule, SVDUnpackerDQMModule, PXDclusterFilterModule, PXDdigiFilterModule, PXDROIFinderAnalysisModule, TrackingAbortDQMModule, VXDDQMExpressRecoModule, vxdDigitMaskingModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisTRGModule, DQMHistInjectionModule, and DQMHistOutputToEPICSModule.

Definition at line 147 of file Module.h.

147{};

◆ clone()

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

Create an independent copy of this module.

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

Implements PathElement.

Definition at line 179 of file Module.cc.

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

◆ closeFile()

void closeFile ( )
private

Finalize the output file.

Definition at line 543 of file StorageRootOutputModule.cc.

544{
545 if(!m_file) return;
546
548
549 //fill Persistent data
551
552 //write the trees
553 TDirectory* dir = gDirectory;
554 m_file->cd();
555 for (int durability = 0; durability < DataStore::c_NDurabilityTypes; ++durability) {
556 if (m_tree[durability]) {
557 B2DEBUG(30, "Write TTree " << c_treeNames[durability]);
558 m_tree[durability]->Write(c_treeNames[durability].c_str(), TObject::kWriteDelete);
559 delete m_tree[durability];
560 }
561 m_tree[durability] = nullptr;
562 }
563 dir->cd();
564
565 const std::string filename = m_file->GetName();
566 if (m_outputSplitSize) {
567 B2INFO(getName() << ": Finished writing file." << LogVar("filename", filename));
568 }
569
570 // Before deleting m_file, store file list in online storage file list DB table
571 const std::filesystem::path filename_path{filename};
572 std::string filename_notmp = m_file->GetName();
573 filename_notmp.erase(0, 7); // remove "/buffer" in front of full path
574 const std::filesystem::path filename_notmp_path{filename_notmp};
575 try {
576 m_db->connect();
577 m_db->execute("UPDATE datafiles_root SET "
578 "correct_close = TRUE, "
579 "will_merge = %s ,"
580 "nevents = %lu, "
581 "nfullevents = %lu, "
582 "size = %lu, "
583 "time_close = '%s' "
584 "WHERE name = '%s' AND host = '%s';",
585 ((boost::optional<uint64_t>)(m_file->GetSize()*2) < m_outputSplitSize || m_ramdiskBuffer) ? "true" : "false",
587 (boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time())+std::string("+09")).c_str(),
588 filename_path.filename().c_str(), m_HLTName.c_str());
589 } catch (const DBHandlerException &e) {
590 B2WARNING(e.what());
591 }
592 m_db->close();
593
594 delete m_file;
595 m_file = nullptr;
596
597 // and now add it to the metadata service as it's fully written
599
600 // reset some variables
601 for (auto & entry : m_entries) {
602 entry.clear();
603 }
604 m_parentLfns.clear();
605 m_experimentLow = 1;
607 m_runLow = 0;
608 m_runHigh = 0;
609 m_eventLow = 0;
610 m_eventHigh = 0;
611 // and increase index of next file
612 ++m_fileIndex;
613
614 // Call system(/usr/bin/rsync) for online storage ramdisk buffer cleanup
615 if (m_ramdiskBuffer) {
616 const std::string rsync_cmd = std::string("/usr/bin/rsync -a --remove-source-files --recursive ") + filename + std::string(" ") + filename_notmp_path.parent_path().generic_string() + std::string("/ &");
617 B2INFO(getName() << ": system(" << rsync_cmd << ")");
618 system(rsync_cmd.c_str());
619 }
620}
static const int c_NDurabilityTypes
Number of Durability Types.
Definition: DataStore.h:63
@ c_Persistent
Object is available during entire execution time.
Definition: DataStore.h:60
unsigned int getNEvents() const
Number of events getter.
Definition: FileMetaData.h:41
unsigned int getNFullEvents() const
Number of full events getter.
Definition: FileMetaData.h:45
void addRootOutputFile(const std::string &fileName, const FileMetaData *metaData=nullptr)
Add the metadata of a root output file.
static MetadataService & Instance()
Static method to get a reference to the MetadataService instance.
std::vector< DataStore::StoreEntry * > m_entries[DataStore::c_NDurabilityTypes]
Vector of DataStore entries that are written to the output.
void fillFileMetaData()
Create and fill FileMetaData object.
int m_fileIndex
Keep track of the file index: if we split files than we add '.f{fileIndex:05d}' in front of the ROOT ...
void fillTree(DataStore::EDurability durability)
Fill TTree.
std::vector< std::string > m_parentLfns
Vector of parent file LFNs.
Class to store variables with their name which were sent to the logging service.
const std::string c_treeNames[]
Names of trees.

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

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

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

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

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

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

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

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

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

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

◆ endRun()

void endRun ( void  )
overridevirtual

Issued by the lastEventMessage = DAQ STOP.

Closing output file

Reimplemented from Module.

Definition at line 198 of file StorageRootOutputModule.cc.

198 {
199 if (m_file) {
200 closeFile();
201 while (m_file) closeFile(); // I hope that this will not be failed
202 m_fileIndex = 0;
203 }
204}
void closeFile()
Finalize the output file.

◆ evalCondition()

bool evalCondition ( ) const
inherited

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

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

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

Definition at line 96 of file Module.cc.

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

◆ event()

void event ( void  )
overridevirtual

Write data in c_Event DataStore maps.

Loops over all objects in event maps (in the first call of the function) and writes them to event-TTree.

Reimplemented from Module.

Definition at line 365 of file StorageRootOutputModule.cc.

366{
367 // Many safety guards and features for online storage
368 // Skip the first event which is the ZMQ init message
369 if (m_firstEvent) {
370 m_firstEvent = false;
371 return;
372 }
373
374 // Exp/run number should be increased
375 if ((m_expno > m_eventMetaData->getExperiment()) ||
376 (m_expno == m_eventMetaData->getExperiment() && m_runno > m_eventMetaData->getRun())) {
377 return;
378 }
379
380 // Close file and set file index to 0 if exp/run number is changed
381 if (m_file) {
382 if (m_expno != m_eventMetaData->getExperiment() || m_runno != m_eventMetaData->getRun()) {
383 closeFile();
384 while (m_file) closeFile(); // I hope that this will not be failed
385 m_fileIndex = 0;
386 }
387 }
388
389 // Open file with automatic naming
390 if (!m_file) {
391 m_expno = m_eventMetaData->getExperiment();
392 m_runno = m_eventMetaData->getRun();
393 m_processNumber = atoi(getName().substr(0, getName().find(std::string("_"))).c_str());
394 m_disk = StringUtil::form("disk%02d", (m_processNumber%m_nDisk)+1);
395 m_outputFileName = StringUtil::form("/rawdata/%s/belle/Raw/%4.4d/%5.5d/%s.%4.4d.%5.5d.%s.p%02d.root",
396 m_disk.c_str(), m_expno, m_runno, m_runType.c_str(),
397 m_expno, m_runno, m_HLTName.c_str(), m_processNumber);
398 }
399
400 // if we closed after last event ... make a new one
401 if (!m_file) openFile();
402
403 if (!m_keepParents) {
404 if (m_fileMetaData) {
405 m_eventMetaData->setParentLfn(m_fileMetaData->getLfn());
406 }
407 }
408
409 //fill Event data
411
412 if (m_fileMetaData) {
413 if (m_keepParents) {
414 for (int iparent = 0; iparent < m_fileMetaData->getNParents(); iparent++) {
415 string lfn = m_fileMetaData->getParent(iparent);
416 if (!lfn.empty() && (m_parentLfns.empty() || (m_parentLfns.back() != lfn))) {
417 m_parentLfns.push_back(lfn);
418 }
419 }
420 } else {
421 string lfn = m_fileMetaData->getLfn();
422 if (!lfn.empty() && (m_parentLfns.empty() || (m_parentLfns.back() != lfn))) {
423 m_parentLfns.push_back(lfn);
424 }
425 }
426 }
427
428 // keep track of file level metadata
429 unsigned long experiment = m_eventMetaData->getExperiment();
430 unsigned long run = m_eventMetaData->getRun();
431 unsigned long event = m_eventMetaData->getEvent();
432 if (m_experimentLow > m_experimentHigh) { //starting condition
433 m_experimentLow = m_experimentHigh = experiment;
434 m_runLow = m_runHigh = run;
436 } else {
437 if ((experiment < m_experimentLow) || ((experiment == m_experimentLow) && ((run < m_runLow) || ((run == m_runLow)
438 && (event < m_eventLow))))) {
439 m_experimentLow = experiment;
440 m_runLow = run;
442 }
443 if ((experiment > m_experimentHigh) || ((experiment == m_experimentHigh) && ((run > m_runHigh) || ((run == m_runHigh)
444 && (event > m_eventHigh))))) {
445 m_experimentHigh = experiment;
446 m_runHigh = run;
448 }
449 }
450
451 // check if the event is a full event or not: if yes, increase the counter
452 if (m_eventMetaData->getErrorFlag() == 0) // no error flag -> this is a full event
454
455 // check if we need to split the file
456 if (m_outputSplitSize and (uint64_t)m_file->GetEND() > *m_outputSplitSize) {
457 // close file and open new one
458 B2INFO(getName() << ": Output size limit reached, closing file ...");
459 closeFile();
460 // Introduce while for online storage (can be removed?)
461 while (m_file) closeFile();
462 }
463}
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:59
int m_expno
Variables for online storage.
virtual void event() override
Write data in c_Event DataStore maps.
unsigned int m_nFullEvents
Number of full events (aka number of events without an error flag)
void openFile()
Open the next output file.
StoreObjPtr< FileMetaData > m_fileMetaData
Pointer to the input file meta data.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

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

◆ fillFileMetaData()

void fillFileMetaData ( )
private

Create and fill FileMetaData object.

Definition at line 465 of file StorageRootOutputModule.cc.

466{
467 bool isMC = (m_fileMetaData) ? m_fileMetaData->isMC() : true;
468
469 // For online storage, force to declareRealData()
470 // I wonder why the no file meta data is associated with isMC == true
471 isMC = false;
472
475
477 //create an index for the event tree
478 TTree* tree = m_tree[DataStore::c_Event];
479 unsigned long numEntries = tree->GetEntries();
481 if (m_buildIndex && numEntries > 0) {
482 if (numEntries > 10000000) {
483 //10M events correspond to about 240MB for the TTreeIndex object. for more than ~45M entries this causes crashes, broken files :(
484 B2WARNING("Not building TTree index because of large number of events. The index object would conflict with ROOT limits on object size and cause problems.");
485 } else if (tree->GetBranch("EventMetaData")) {
486 tree->SetBranchAddress("EventMetaData", nullptr);
488 }
489 }
490
491 m_outputFileMetaData->setNEvents(numEntries);
493 //starting condition so apparently no events at all
494 m_outputFileMetaData->setLow(-1, -1, 0);
495 m_outputFileMetaData->setHigh(-1, -1, 0);
496 } else {
499 }
500 }
501
502 //fill more file level metadata
507 auto mcEvents = Environment::Instance().getNumberOfMCEvents();
508 if(m_outputSplitSize and mcEvents > 0) {
509 if(m_fileIndex == 0) B2WARNING("Number of MC Events cannot be saved when splitting output files by size, setting to 0");
510 mcEvents = 0;
511 }
514 for (const auto& item : m_additionalDataDescription) {
515 m_outputFileMetaData->setDataDescription(item.first, item.second);
516 }
517 // Set the LFN to the filename: if it's a URL to directly, otherwise make sure it's absolute
518 std::string lfn = m_file->GetName();
519 if(m_regularFile) {
520 lfn = std::filesystem::absolute(lfn).string();
521 }
522 // Format LFN if BELLE2_LFN_FORMATSTRING is set
523 std::string format = EnvironmentVariables::get("BELLE2_LFN_FORMATSTRING", "");
524 if (!format.empty()) {
525 auto format_filename = boost::python::import("B2Tools.format").attr("format_filename");
526 lfn = boost::python::extract<std::string>(format_filename(format, m_outputFileName, m_outputFileMetaData->getJsonStr()));
527 }
529 //register the file in the catalog
532 }
533}
unsigned int getNumberOfMCEvents() const
Number of generated events (from EventInfoSetter).
Definition: Environment.h:106
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28
static FileCatalog & Instance()
Static method to get a reference to the FileCatalog instance.
Definition: FileCatalog.cc:23
virtual bool registerFile(const std::string &fileName, FileMetaData &metaData, const std::string &oldLFN="")
Register a file in the (local) file catalog.
Definition: FileCatalog.cc:90
void setLow(int experiment, int run, unsigned int event)
Lowest experiment, run and event number setter.
Definition: FileMetaData.h:159
void setHigh(int experiment, int run, unsigned int event)
Highest experiment, run and event number setter.
Definition: FileMetaData.h:167
void setRandomSeed(const std::string &seed)
Random seed setter.
Definition: FileMetaData.h:189
void setSteering(const std::string &steering)
Steering file content setter.
Definition: FileMetaData.h:195
void declareRealData()
Declare that this is not generated, but real data.
Definition: FileMetaData.h:294
void setNFullEvents(unsigned int nEvents)
Number of full events setter.
Definition: FileMetaData.h:151
std::string getJsonStr() const
Get a json representation.
void setDatabaseGlobalTag(const std::string &globalTag)
Set the database global tag used when creating this file.
Definition: FileMetaData.h:208
void setLfn(const std::string &lfn)
Setter for LFN.
Definition: FileMetaData.h:139
void setDataDescription(const std::string &key, const std::string &value)
describe the data, if the key exists contents will be overwritten.
Definition: FileMetaData.h:214
void setNEvents(unsigned int nEvents)
Number of events setter.
Definition: FileMetaData.h:145
void setMcEvents(unsigned int nEvents)
Number of generated events setter.
Definition: FileMetaData.h:201
void setParents(const std::vector< std::string > &parents)
Parents setter.
Definition: FileMetaData.h:173
static std::string getSeed()
Get the random number generator seed.
Definition: RandomNumbers.h:92
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 Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42
void setCreationData(FileMetaData &metadata)
Fill the creation info of a file meta data: site, user, data.
void buildIndex(TTree *tree)
Build TTreeIndex on tree (assumes EventMetaData branch exists there).

◆ fillTree()

void fillTree ( DataStore::EDurability  durability)
private

Fill TTree.

Write the objects from the DataStore to the output TTree.

Parameters
durabilitySpecifies map and tree to be used.

Definition at line 623 of file StorageRootOutputModule.cc.

624{
625 if (!m_tree[durability]) return;
626
627 TTree& tree = *m_tree[durability];
628 for(auto* entry: m_entries[durability]) {
629 // Check for entries whose object was not created and mark them as invalid.
630 // We still have to write them in the file due to the structure we have. This could be done better
631 if (!entry->ptr) {
632 entry->object->SetBit(kInvalidObject);
633 }
634 //FIXME: Do we need this? in theory no but it crashes in parallel processing otherwise ¯\_(ツ)_/¯
635 if (entry->name == "FileMetaData") {
636 tree.SetBranchAddress(entry->name.c_str(), &m_outputFileMetaData);
637 } else {
638 tree.SetBranchAddress(entry->name.c_str(), &entry->object);
639 }
640 }
641 tree.Fill();
642 for (auto* entry: m_entries[durability]) {
643 entry->object->ResetBit(kInvalidObject);
644 }
645
646 const bool writeError = m_file->TestBit(TFile::kWriteError);
647 if (writeError) {
648 //m_file deleted first so we have a chance of closing it (though that will probably fail)
649 const std::string filename = m_file->GetName();
650 delete m_file;
651 B2FATAL("A write error occured while saving '" << filename << "', please check if enough disk space is available.");
652 }
653}

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

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

◆ getAllConditionPaths()

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

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

Definition at line 150 of file Module.cc.

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

◆ getAllConditions()

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

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 314 of file Module.h.

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

◆ getConditionPath()

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

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


Definition at line 113 of file Module.cc.

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

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

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

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool  outputFiles = true)
inlineoverridevirtual

Set the used output file, taking into account -o argument to basf2.

Reimplemented from Module.

Definition at line 80 of file StorageRootOutputModule.h.

81 {
82 B2ASSERT("StorageRootOutput is not an input module", outputFiles);
84 // This will warn if already consumed which is what we want
85 std::string outputFileArgument = Environment::Instance().consumeOutputFileOverride(getName());
86 if (!outputFileArgument.empty())
87 m_outputFileName = outputFileArgument;
89 }
90 return {m_outputFileName};
91 }
std::string consumeOutputFileOverride(const std::string &moduleName)
Return overriden output file name, or "" if none was set.
Definition: Environment.cc:67

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

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

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

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

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

Definition at line 187 of file Module.h.

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

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

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

Returns a python list of all parameters.

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

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

Definition at line 279 of file Module.cc.

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

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

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

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

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

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 311 of file Module.h.

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

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

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

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

Definition at line 160 of file Module.cc.

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

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

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

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

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

Definition at line 166 of file Module.cc.

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

◆ if_false()

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

A simplified version to add a condition to the module.

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

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

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

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

Definition at line 85 of file Module.cc.

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

◆ if_true()

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

A simplified version to set the condition of the module.

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

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

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

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

Definition at line 90 of file Module.cc.

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

◆ if_value()

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

Add a condition to the module.

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

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

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

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

Definition at line 79 of file Module.cc.

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

◆ initialize()

virtual void initialize ( )
overridevirtual

Setting up of various stuff.

Opens a file and creates TTree(s)

Reimplemented from Module.

◆ openFile()

void openFile ( )
private

Open the next output file.

Definition at line 206 of file StorageRootOutputModule.cc.

207{
208 // Since we open a new file, we also have to reset the number of full events
209 m_nFullEvents = 0;
210 // Continue with opening the file
211 TDirectory* dir = gDirectory;
212 std::filesystem::path out{m_outputFileName};
213 if (m_outputSplitSize) {
214 // Mangle the filename to add the fNNNNN part. However we need to be
215 // careful since the file name could be non-local and have some options or
216 // anchor information attached (like
217 // http://mydomain.org/filename.root?foo=bar#baz). So use "TUrl" *sigh* to
218 // do the parsing and only replace the extension of the file part.
219 TUrl fileUrl(m_outputFileName.c_str(), m_regularFile);
220 std::filesystem::path file{fileUrl.GetFile()};
221 file.replace_extension((boost::format("f%05d.root") % m_fileIndex).str());
222 fileUrl.SetFile(file.c_str());
223 // In case of regular files we don't want the protocol or anything, just the file
224 out = m_regularFile? fileUrl.GetFileAndOptions() : fileUrl.GetUrl();
225 }
226
227 // For online storage buffer disks
228 std::filesystem::path out_notmp = out;
229 out = std::filesystem::path{std::string("/buffer") + out.generic_string()};
230
231 m_file = TFile::Open(out.c_str(), "RECREATE", "basf2 Event File");
232 if ((!m_file || m_file->IsZombie()) && m_regularFile) {
233 //try creating necessary directories since this is a local file
234 auto dirpath = out.parent_path();
235
236 if (std::filesystem::create_directories(dirpath)) {
237 B2INFO("Created missing directory " << dirpath << ".");
238 //try again
239 m_file = TFile::Open(out.c_str(), "RECREATE", "basf2 Event File");
240 }
241
242 }
243
244 // Retry file open for online storage, with ramdisk, may not be needed
245 int openCounter = 0;
246 while (!m_file || m_file->IsZombie()) {
247 m_file = TFile::Open(out.c_str(), "RECREATE", "basf2 Event File");
248 B2INFO("process(" << m_processNumber << "), Try open: " << ++openCounter);
249 }
250
251 if (!m_file || m_file->IsZombie()) {
252 B2FATAL("Couldn't open file " << out << " for writing!");
253 }
254 m_file->SetCompressionAlgorithm(m_compressionAlgorithm);
255 m_file->SetCompressionLevel(m_compressionLevel);
256
257 for (int durability = 0; durability < DataStore::c_NDurabilityTypes; durability++) {
259 set<string> branchList;
260 for (const auto& pair : map)
261 branchList.insert(pair.first);
262 //skip branches the user doesn't want
263 branchList = filterBranches(branchList, m_branchNames[durability], m_excludeBranchNames[durability], durability);
264
265 //create the tree and branches
266 m_tree[durability] = new TTree(c_treeNames[durability].c_str(), c_treeNames[durability].c_str());
267 m_tree[durability]->SetAutoFlush(m_autoflush);
268 m_tree[durability]->SetAutoSave(m_autosave);
269 for (auto & iter : map) {
270 const std::string& branchName = iter.first;
271 //skip transient entries (allow overriding via branchNames)
272 if (iter.second.dontWriteOut
273 && find(m_branchNames[durability].begin(), m_branchNames[durability].end(), branchName) == m_branchNames[durability].end()
274 && find(m_additionalBranchNames[durability].begin(), m_additionalBranchNames[durability].end(),
275 branchName) == m_additionalBranchNames[durability].end())
276 continue;
277 //skip branches the user doesn't want
278 if (branchList.count(branchName) == 0) {
279 //make sure FileMetaData and EventMetaData are always included in the output
280 if (((branchName != "FileMetaData") || (durability == DataStore::c_Event)) &&
281 ((branchName != "EventMetaData") || (durability == DataStore::c_Persistent))) {
282 continue;
283 }
284 }
285
286 // Warn for anything other than FileMetaData and ProcessStatistics ...
287 if(durability == DataStore::c_Persistent and m_outputSplitSize and m_fileIndex==0 and
288 (branchName != "FileMetaData" and branchName != "ProcessStatistics")) {
289 B2WARNING("Persistent branches might not be stored as expected when splitting the output by size" << LogVar("branch", branchName));
290 }
291
292 TClass* entryClass = iter.second.objClass;
293
294 //I want to do this in the input module, but I apparently I cannot disable reading those branches.
295 //isabling reading the branch by not calling SetBranchAddress() for it results in the following crashes. Calling SetBranchStatus(..., 0) doesn't help, either.
296 //reported to ROOT devs, let's see if it gets fixed.
297 //
298 //HasDictionary() is a new function in root 6
299 //using it instead of GetClassInfo() avoids having to parse header files (and
300 //the associated memory cost)
301 if (!entryClass->HasDictionary()) {
302 if (m_fileIndex == 0) {
303 B2WARNING("No dictionary found, object will not be saved (This is probably an obsolete class that is still present in the input file.)"
304 << LogVar("class", entryClass->GetName()) << LogVar("branch", branchName));
305 }
306 continue;
307 }
308
309 if (!hasStreamer(entryClass)) {
310 B2ERROR("The version number in the ClassDef() macro must be at least 1 to enable I/O!" << LogVar("class", entryClass->GetName()));
311 }
312
313 int splitLevel = m_splitLevel;
314 if (hasCustomStreamer(entryClass)) {
315 B2DEBUG(38, "Class has custom streamer, setting split level -1 for this branch." << LogVar("class", entryClass->GetName()));
316
317 splitLevel = -1;
318 if (iter.second.isArray) {
319 //for arrays, we also don't want TClonesArray to go around our streamer
320 static_cast<TClonesArray*>(iter.second.object)->BypassStreamer(kFALSE);
321 }
322 }
323 m_tree[durability]->Branch(branchName.c_str(), &iter.second.object, m_basketsize, splitLevel);
324 m_entries[durability].push_back(&iter.second);
325 B2DEBUG(39, "The branch " << branchName << " was created.");
326
327 //Tell DataStore that we are using this entry
328 if (m_fileIndex == 0) {
330 iter.second.isArray));
331 }
332 }
333 }
334
335 // set the address of the FileMetaData branch for the output to a separate one from the input
336 TBranch* fileMetaDataBranch = m_tree[DataStore::c_Persistent]->GetBranch("FileMetaData");
337 if (fileMetaDataBranch) {
338 fileMetaDataBranch->SetAddress(&m_outputFileMetaData);
339 } else {
341 }
342
343 dir->cd();
344 if (m_outputSplitSize) {
345 B2INFO(getName() << ": Opened " << (m_fileIndex > 0 ? "new " : "") << "file for writing" << LogVar("filename", out));
346 }
347
348 // Insert file entry into the DAQ DB while open new file, online storage feature
349 try {
350 m_db->connect();
351 m_db->execute("INSERT INTO datafiles_root "
352 "(name, path, host, disk, runtype, expno, runno, compression_level, compression_algorithm, time_open, "
353 "size, nevents, nfullevents, correct_close, renamed, used_for_merge, removed) "
354 "VALUES ('%s', '%s', '%s', '%s','%s', %d, %d, %d, %d, '%s', 0, 0, 0, FALSE, FALSE, FALSE, FALSE);",
355 out_notmp.filename().c_str(), out_notmp.c_str(), m_HLTName.c_str(), m_disk.c_str(),
356 m_runType.c_str(), m_expno, m_runno,
358 (boost::posix_time::to_iso_extended_string(boost::posix_time::microsec_clock::local_time())+std::string("+09")).c_str());
359 } catch (const DBHandlerException &e) {
360 B2WARNING(e.what());
361 }
362}
StoreEntryMap & getStoreEntryMap(EDurability durability)
Get a reference to the object/array map.
Definition: DataStore.h:325
EDurability
Durability types.
Definition: DataStore.h:58
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
bool optionalInput(const StoreAccessorBase &accessor)
Register the given object/array as an optional input.
Definition: DataStore.cc:739
std::map< std::string, StoreEntry > StoreEntryMap
Map for StoreEntries.
Definition: DataStore.h:87
Base class for StoreObjPtr and StoreArray for easier common treatment.
bool hasCustomStreamer(const TClass *cl)
Returns true if and only if 'cl' has a user-defined streamer.
std::set< std::string > filterBranches(const std::set< std::string > &branchesToFilter, const std::vector< std::string > &branches, const std::vector< std::string > &excludeBranches, int durability, bool quiet=false)
Given a list of input branches and lists of branches to include/exclude, returns a list of branches t...
bool hasStreamer(const TClass *cl)
Returns true if and only if 'cl' or one of its bases has I/O streamers.

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

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

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

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

◆ setDescription()

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

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

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

Definition at line 73 of file Module.cc.

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

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

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

◆ setName()

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

Set the name of the module.

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

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

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

Implements a method for setting boost::python objects.

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

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

Definition at line 234 of file Module.cc.

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

◆ setParamPythonDict()

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

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

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

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

Definition at line 249 of file Module.cc.

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

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

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

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

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

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

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

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

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

◆ setType()

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

Set the module type.

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

Definition at line 48 of file Module.cc.

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

◆ terminate()

void terminate ( void  )
overridevirtual

Write data in the c_Persistent DataStore maps.

Loops over all objects in persistent maps and writes them to persistent-TTree. Finally the TTree(s) is/are written out.

Reimplemented from Module.

Definition at line 536 of file StorageRootOutputModule.cc.

537{
538 closeFile();
539 // Introduce while for online storage (can be removed?)
540 while (m_file) closeFile();
541}

Member Data Documentation

◆ m_additionalBranchNames

std::vector<std::string> m_additionalBranchNames[DataStore::c_NDurabilityTypes]
private

Array of names of branches that should be written out although they are not flagged for writeout.

And usually ignored, use to writeout RestOfEvent.

Definition at line 131 of file StorageRootOutputModule.h.

◆ m_additionalDataDescription

std::map<std::string, std::string> m_additionalDataDescription
private

Map of additional metadata to be added to the output file.

Definition at line 193 of file StorageRootOutputModule.h.

◆ m_autoflush

int m_autoflush
private

Number of entries (if >0) or number of bytes (if <0) after which to flush all baskets to disk.

Definition at line 153 of file StorageRootOutputModule.h.

◆ m_autosave

int m_autosave
private

Number of entries (if >0) or number of bytes (if <0) after which write the tree metadata to disk.

Definition at line 156 of file StorageRootOutputModule.h.

◆ m_basketsize

int m_basketsize
private

basket size for each branch in the file in bytes

Definition at line 159 of file StorageRootOutputModule.h.

◆ m_branchNames

std::vector<std::string> m_branchNames[DataStore::c_NDurabilityTypes]
private

Array for names of branches that should be written out.

Empty vectors result in all branches of the specific durability being written. These vectors can be configured in the steering file.

Definition at line 126 of file StorageRootOutputModule.h.

◆ m_buildIndex

bool m_buildIndex {false}
private

Whether or not we want to build an event index.

Definition at line 220 of file StorageRootOutputModule.h.

◆ m_compressionAlgorithm

int m_compressionAlgorithm {0}
private

TFile compression algorithm.


Definition at line 141 of file StorageRootOutputModule.h.

◆ m_compressionLevel

int m_compressionLevel {1}
private

TFile compression level.


Definition at line 144 of file StorageRootOutputModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_db

DBInterface* m_db
private

Definition at line 237 of file StorageRootOutputModule.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_disk

std::string m_disk
private

Definition at line 240 of file StorageRootOutputModule.h.

◆ m_entries

std::vector<DataStore::StoreEntry*> m_entries[DataStore::c_NDurabilityTypes]
private

Vector of DataStore entries that are written to the output.

Definition at line 187 of file StorageRootOutputModule.h.

◆ m_eventHigh

unsigned long m_eventHigh
private

Highest event number in highest run.

Definition at line 217 of file StorageRootOutputModule.h.

◆ m_eventLow

unsigned long m_eventLow
private

Lowest event number in lowest run.

Definition at line 205 of file StorageRootOutputModule.h.

◆ m_eventMetaData

StoreObjPtr<EventMetaData> m_eventMetaData
private

Pointer to the event meta data.

Definition at line 229 of file StorageRootOutputModule.h.

◆ m_excludeBranchNames

std::vector<std::string> m_excludeBranchNames[DataStore::c_NDurabilityTypes]
private

Array for names of branches that should NOT be written out.

This takes precedence over m_branchNames, so if a branch is in both m_branchNames[d] and m_excludeBranchNames[d], it is not saved.

Definition at line 138 of file StorageRootOutputModule.h.

◆ m_experimentHigh

unsigned long m_experimentHigh
private

Highest experiment number.

Definition at line 209 of file StorageRootOutputModule.h.

◆ m_experimentLow

unsigned long m_experimentLow
private

Lowest experiment number.

Definition at line 197 of file StorageRootOutputModule.h.

◆ m_expno

int m_expno
private

Variables for online storage.

Definition at line 236 of file StorageRootOutputModule.h.

◆ m_file

TFile* m_file
private

TFile for output.

Definition at line 181 of file StorageRootOutputModule.h.

◆ m_fileIndex

int m_fileIndex {0}
private

Keep track of the file index: if we split files than we add '.f{fileIndex:05d}' in front of the ROOT extension.

Definition at line 175 of file StorageRootOutputModule.h.

◆ m_fileMetaData

StoreObjPtr<FileMetaData> m_fileMetaData {"", DataStore::c_Persistent}
private

Pointer to the input file meta data.

Definition at line 231 of file StorageRootOutputModule.h.

◆ m_firstEvent

bool m_firstEvent {false}
private

Definition at line 243 of file StorageRootOutputModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_HLTName

std::string m_HLTName
private

Definition at line 239 of file StorageRootOutputModule.h.

◆ m_ignoreCommandLineOverride

bool m_ignoreCommandLineOverride
private

Ignore filename override from command line.

Definition at line 166 of file StorageRootOutputModule.h.

◆ m_keepParents

bool m_keepParents {false}
private

Whether to keep parents same as that of input file.

Definition at line 223 of file StorageRootOutputModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

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

Definition at line 508 of file Module.h.

◆ m_nDisk

int m_nDisk
private

Definition at line 241 of file StorageRootOutputModule.h.

◆ m_nFullEvents

unsigned int m_nFullEvents {0}
private

Number of full events (aka number of events without an error flag)

Definition at line 178 of file StorageRootOutputModule.h.

◆ m_outputFileMetaData

FileMetaData* m_outputFileMetaData
private

File meta data stored in the output file.

Definition at line 233 of file StorageRootOutputModule.h.

◆ m_outputFileName

std::string m_outputFileName
private

Name for output file.

This string is steerable. Best practice: Let it end on .root

Definition at line 119 of file StorageRootOutputModule.h.

◆ m_outputSplitSize

std::optional<uint64_t> m_outputSplitSize {std::nullopt}
private

Maximum output file size in MB.

If not set we don't split. Otherwise we split if the event tree in output file has reached the given size in MB

Definition at line 170 of file StorageRootOutputModule.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 510 of file Module.h.

◆ m_parentLfns

std::vector<std::string> m_parentLfns
private

Vector of parent file LFNs.

Definition at line 190 of file StorageRootOutputModule.h.

◆ m_processNumber

int m_processNumber
private

Definition at line 242 of file StorageRootOutputModule.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

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

Definition at line 512 of file Module.h.

◆ m_ramdiskBuffer

bool m_ramdiskBuffer {false}
private

Definition at line 244 of file StorageRootOutputModule.h.

◆ m_regularFile

bool m_regularFile {true}
private

Whether this is a regular, local file where we can actually create directories.

Definition at line 226 of file StorageRootOutputModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_runHigh

unsigned long m_runHigh
private

Highest run number.

Definition at line 213 of file StorageRootOutputModule.h.

◆ m_runLow

unsigned long m_runLow
private

Lowest run number.

Definition at line 201 of file StorageRootOutputModule.h.

◆ m_runno

int m_runno
private

Definition at line 236 of file StorageRootOutputModule.h.

◆ m_runType

std::string m_runType
private

Definition at line 238 of file StorageRootOutputModule.h.

◆ m_splitLevel

int m_splitLevel
private

Branch split level.

Set the branch split level.

Definition at line 150 of file StorageRootOutputModule.h.

◆ m_tree

TTree* m_tree[DataStore::c_NDurabilityTypes]
private

TTree for output.

Definition at line 184 of file StorageRootOutputModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_updateFileCatalog

bool m_updateFileCatalog
private

Flag to enable or disable the update of the metadata catalog.

Definition at line 162 of file StorageRootOutputModule.h.


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