Belle II Software development
FileMetaData.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <TObject.h>
12
13#include <iosfwd>
14#include <vector>
15#include <string>
16#include <map>
17
18namespace Belle2 {
29 class FileMetaData : public TObject {
30 public:
34
37 const std::string& getLfn() const {return m_lfn;}
38
41 unsigned int getNEvents() const {return m_nEvents;}
42
45 unsigned int getNFullEvents() const {return m_nFullEvents;}
46
49 int getExperimentLow() const {return m_experimentLow;}
50
53 int getRunLow() const {return m_runLow;}
54
57 unsigned int getEventLow() const {return m_eventLow;}
58
61 int getExperimentHigh() const {return m_experimentHigh;}
62
65 int getRunHigh() const {return m_runHigh;}
66
69 unsigned int getEventHigh() const {return m_eventHigh;}
70
81 bool containsEvent(int experiment, int run, unsigned int event) const;
82
85 int getNParents() const {return m_parentLfns.size();}
86
92 const std::string& getParent(int iParent) const {return m_parentLfns[iParent];}
93
95 const std::string& getDate() const {return m_date;}
96
99 const std::string& getSite() const {return m_site;}
100
103 const std::string& getUser() const {return m_user;}
104
107 const std::string& getRandomSeed() const {return m_randomSeed;}
108
111 const std::string& getRelease() const {return m_release;}
112
115 const std::string& getSteering() const {return m_steering;}
116
119 bool isMC() const {return m_isMC;}
120
123 unsigned int getMcEvents() const {return m_mcEvents;}
124
130 const std::string& getDatabaseGlobalTag() const { return m_databaseGlobalTag; }
131
133 const std::map<std::string, std::string>& getDataDescription() const { return m_dataDescription; }
134
139 void setLfn(const std::string& lfn) {m_lfn = lfn;}
140
145 void setNEvents(unsigned int nEvents) {m_nEvents = nEvents;}
146
151 void setNFullEvents(unsigned int nEvents) {m_nFullEvents = nEvents;}
152
159 void setLow(int experiment, int run, unsigned int event) {m_experimentLow = experiment; m_runLow = run; m_eventLow = event;}
160
167 void setHigh(int experiment, int run, unsigned int event) {m_experimentHigh = experiment; m_runHigh = run; m_eventHigh = event;}
168
173 void setParents(const std::vector<std::string>& parents) {m_parentLfns = parents;}
174
182 void setCreationData(const std::string& date, const std::string& site, const std::string& user, const std::string& release)
183 {m_date = date; m_site = site; m_user = user; m_release = release;}
184
189 void setRandomSeed(const std::string& seed) {m_randomSeed = seed;}
190
195 void setSteering(const std::string& steering) {m_steering = steering;}
196
201 void setMcEvents(unsigned int nEvents) {m_mcEvents = nEvents;}
202
208 void setDatabaseGlobalTag(const std::string& globalTag) { m_databaseGlobalTag = globalTag; }
209
214 void setDataDescription(const std::string& key, const std::string& value) { m_dataDescription[key] = value; }
215
217 void removeDataDescription(const std::string& key) { m_dataDescription.erase(key); }
218
222 static void exposePythonAPI();
223
228 virtual void Print(Option_t* option = "") const override;
229
236 bool read(std::istream& input, std::string& physicalFileName);
237
244 bool write(std::ostream& output, const std::string& physicalFileName) const;
245
248 std::string getJsonStr() const;
249
250 private:
251
252 std::string m_lfn;
254 unsigned int m_nEvents;
256 unsigned int m_nFullEvents;
262 unsigned int m_eventLow;
268 unsigned int m_eventHigh;
270 std::vector<std::string> m_parentLfns;
272 std::string m_date;
274 std::string m_site;
276 std::string m_user;
278 std::string m_randomSeed;
280 std::string m_release;
282 std::string m_steering;
284 bool m_isMC;
286 unsigned int m_mcEvents;
290 std::map<std::string, std::string> m_dataDescription;
294 void declareRealData() {m_isMC = false;}
295
296 friend class SeqRootInputModule;
297 friend class RootInputModule;
298 friend class RootOutputModule;
299 friend class B2BIIMdstInputModule;
300 friend class BeamBkgHitRateMonitorModule;
301 friend class StorageRootOutputModule;
302
305 }; //class
306
308} // namespace Belle2
Module reads Belle MDST files and converts Belle_event record to Belle II EventMetaData StoreObjectPo...
A module to monitor detector hit rates of beam background Output is to a flat ntuple.
Metadata information about a file.
Definition: FileMetaData.h:29
void removeDataDescription(const std::string &key)
remove an existing data description
Definition: FileMetaData.h:217
virtual void Print(Option_t *option="") const override
Print the content of the meta data object.
Definition: FileMetaData.cc:77
const std::string & getDatabaseGlobalTag() const
Get the database global tag used when creating this file.
Definition: FileMetaData.h:130
std::string m_steering
The steering file content.
Definition: FileMetaData.h:282
unsigned int getEventHigh() const
Highest event number in highest run getter.
Definition: FileMetaData.h:69
void setLow(int experiment, int run, unsigned int event)
Lowest experiment, run and event number setter.
Definition: FileMetaData.h:159
unsigned int m_eventHigh
Highest event number in highest run.
Definition: FileMetaData.h:268
void setHigh(int experiment, int run, unsigned int event)
Highest experiment, run and event number setter.
Definition: FileMetaData.h:167
int getRunHigh() const
Highest run number getter.
Definition: FileMetaData.h:65
const std::string & getLfn() const
Logical file name getter.
Definition: FileMetaData.h:37
int getNParents() const
Get number of parent files.
Definition: FileMetaData.h:85
std::string m_randomSeed
The random seed used when producing the file.
Definition: FileMetaData.h:278
std::string m_databaseGlobalTag
Global tag in the database used for production of this file.
Definition: FileMetaData.h:288
unsigned int m_nEvents
Number of events.
Definition: FileMetaData.h:254
void setRandomSeed(const std::string &seed)
Random seed setter.
Definition: FileMetaData.h:189
const std::string & getRelease() const
Software release version getter.
Definition: FileMetaData.h:111
int getRunLow() const
Lowest run number getter.
Definition: FileMetaData.h:53
bool containsEvent(int experiment, int run, unsigned int event) const
Check whether the given event is in the covered range of events.
Definition: FileMetaData.cc:33
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
const std::string & getSteering() const
Steering file content getter.
Definition: FileMetaData.h:115
bool isMC() const
Is it generated data?.
Definition: FileMetaData.h:119
unsigned int getNEvents() const
Number of events getter.
Definition: FileMetaData.h:41
void setNFullEvents(unsigned int nEvents)
Number of full events setter.
Definition: FileMetaData.h:151
bool m_isMC
Is it generated or real data?.
Definition: FileMetaData.h:284
const std::string & getDate() const
File creation date and time getter (UTC)
Definition: FileMetaData.h:95
unsigned int m_nFullEvents
Number of full events.
Definition: FileMetaData.h:256
unsigned int m_mcEvents
Number of generated events, 0 for real data.
Definition: FileMetaData.h:286
FileMetaData()
Constructor.
Definition: FileMetaData.cc:26
unsigned int getEventLow() const
Lowest event number in lowest run getter.
Definition: FileMetaData.h:57
std::string m_lfn
Logical file name.
Definition: FileMetaData.h:252
std::map< std::string, std::string > m_dataDescription
key-value store to describe the data.
Definition: FileMetaData.h:290
int m_runLow
Lowest run number.
Definition: FileMetaData.h:260
const std::string & getSite() const
Site where the file was created getter.
Definition: FileMetaData.h:99
std::string m_release
Software release version.
Definition: FileMetaData.h:280
std::string getJsonStr() const
Get a json representation.
std::string m_date
File creation date and time (UTC).
Definition: FileMetaData.h:272
int getExperimentLow() const
Lowest experiment number getter.
Definition: FileMetaData.h:49
ClassDefOverride(FileMetaData, 11)
Metadata information about a file.
static void exposePythonAPI()
Exposes methods of the FileMetaData class to Python.
Definition: FileMetaData.cc:48
const std::map< std::string, std::string > & getDataDescription() const
get data description.
Definition: FileMetaData.h:133
bool write(std::ostream &output, const std::string &physicalFileName) const
Write file meta data in xml format to the output stream.
void setCreationData(const std::string &date, const std::string &site, const std::string &user, const std::string &release)
Creation data setter.
Definition: FileMetaData.h:182
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
unsigned int m_eventLow
Lowest event number in lowest run.
Definition: FileMetaData.h:262
const std::string & getUser() const
User who created the file getter.
Definition: FileMetaData.h:103
unsigned int getNFullEvents() const
Number of full events getter.
Definition: FileMetaData.h:45
int m_experimentLow
Lowest experiment number.
Definition: FileMetaData.h:258
const std::string & getRandomSeed() const
Random seed getter.
Definition: FileMetaData.h:107
std::string m_user
User who created the file.
Definition: FileMetaData.h:276
std::string m_site
Site where the file was created.
Definition: FileMetaData.h:274
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
int getExperimentHigh() const
Highest experiment number getter.
Definition: FileMetaData.h:61
unsigned int getMcEvents() const
Number of generated events getter.
Definition: FileMetaData.h:123
void setMcEvents(unsigned int nEvents)
Number of generated events setter.
Definition: FileMetaData.h:201
int m_experimentHigh
Highest experiment number.
Definition: FileMetaData.h:264
std::vector< std::string > m_parentLfns
LFNs of parent files.
Definition: FileMetaData.h:270
void setParents(const std::vector< std::string > &parents)
Parents setter.
Definition: FileMetaData.h:173
int m_runHigh
Highest run number.
Definition: FileMetaData.h:266
const std::string & getParent(int iParent) const
Get LFN of parent file.
Definition: FileMetaData.h:92
bool read(std::istream &input, std::string &physicalFileName)
Read file meta data in xml format from the input stream.
Module to read TTree data from file into the data store.
Write objects from DataStore into a ROOT file.
Module to read files produced by SeqRootOutputModule.
Write objects from DataStore into a ROOT file.
Abstract base class for different kinds of events.