11#include <framework/core/Module.h>
12#include <framework/core/Environment.h>
13#include <framework/datastore/DataStore.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <framework/dataobjects/FileMetaData.h>
16#include <framework/dataobjects/EventMetaData.h>
26#include <daq/slc/database/DBInterface.h>
27#include <daq/slc/psql/PostgreSQLInterface.h>
64 virtual void endRun()
override;
70 virtual void event()
override;
80 virtual std::vector<std::string>
getFileNames(
bool outputFiles =
true)
override
82 B2ASSERT(
"StorageRootOutput is not an input module", outputFiles);
86 if (!outputFileArgument.empty())
239 std::string m_runType;
240 std::string m_HLTName;
244 bool m_firstEvent{
false};
245 bool m_ramdiskBuffer{
false};
static const int c_NDurabilityTypes
Number of Durability Types.
EDurability
Durability types.
@ c_Persistent
Object is available during entire execution time.
std::string consumeOutputFileOverride(const std::string &moduleName)
Return overriden output file name, or "" if none was set.
static Environment & Instance()
Static method to get a reference to the Environment instance.
const std::string & getName() const
Returns the name of the module.
Write objects from DataStore into a ROOT file.
unsigned long m_experimentLow
Lowest experiment number.
int m_expno
Variables for online storage.
std::vector< DataStore::StoreEntry * > m_entries[DataStore::c_NDurabilityTypes]
Vector of DataStore entries that are written to the output.
unsigned long m_experimentHigh
Highest experiment number.
unsigned long m_eventLow
Lowest event number in lowest run.
void fillFileMetaData()
Create and fill FileMetaData object.
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.
StorageRootOutputModule()
Constructor.
unsigned long m_runLow
Lowest run number.
int m_compressionAlgorithm
TFile compression algorithm.
virtual void event() override
Write data in c_Event DataStore maps.
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 void endRun() override
Issued by the lastEventMessage = DAQ STOP.
virtual ~StorageRootOutputModule()
Destructor.
virtual void terminate() override
Write data in the c_Persistent DataStore maps.
TTree * m_tree[DataStore::c_NDurabilityTypes]
TTree for output.
unsigned int m_nFullEvents
Number of full events (aka number of events without an error flag)
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.
TFile * m_file
TFile for output.
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.
bool m_ignoreCommandLineOverride
Ignore filename override from command line.
void closeFile()
Finalize the output file.
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.
int m_splitLevel
Branch split level.
void openFile()
Open the next output file.
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_parentLfns
Vector of parent file LFNs.
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.
StoreObjPtr< FileMetaData > m_fileMetaData
Pointer to the input file meta data.
std::string m_outputFileName
Name for output file.
Type-safe access to single objects in the data store.
Abstract base class for different kinds of events.