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 {
23
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 setRelease(const std::string& release) {m_release = release;}
196
201 void setSteering(const std::string& steering) {m_steering = steering;}
202
207 void setMcEvents(unsigned int nEvents) {m_mcEvents = nEvents;}
208
214 void setDatabaseGlobalTag(const std::string& globalTag) { m_databaseGlobalTag = globalTag; }
215
220 void setDataDescription(const std::string& key, const std::string& value) { m_dataDescription[key] = value; }
221
223 void removeDataDescription(const std::string& key) { m_dataDescription.erase(key); }
224
228 static void exposePythonAPI();
229
234 virtual void Print(Option_t* option = "") const override;
235
242 bool read(std::istream& input, std::string& physicalFileName);
243
250 bool write(std::ostream& output, const std::string& physicalFileName) const;
251
254 std::string getJsonStr() const;
255
256 private:
257
258 std::string m_lfn;
259
260 unsigned int m_nEvents;
261
262 unsigned int m_nFullEvents;
263
265
267
268 unsigned int m_eventLow;
269
271
273
274 unsigned int m_eventHigh;
275
276 std::vector<std::string> m_parentLfns;
277
278 std::string m_date;
279
280 std::string m_site;
281
282 std::string m_user;
283
284 std::string m_randomSeed;
285
286 std::string m_release;
287
288 std::string m_steering;
289
290 bool m_isMC;
291
292 unsigned int m_mcEvents;
293
295
296 std::map<std::string, std::string> m_dataDescription;
297
300 void declareRealData() {m_isMC = false;}
301
302 friend class SeqRootInputModule;
303 friend class RootInputModule;
304 friend class RootOutputModule;
305 friend class B2BIIMdstInputModule;
306 friend class BeamBkgHitRateMonitorModule;
307 friend class StorageRootOutputModule;
308 friend class VariablesToNtupleModule;
309
311
312 }; //class
313
315} // 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.
void removeDataDescription(const std::string &key)
remove an existing data description
virtual void Print(Option_t *option="") const override
Print the content of the meta data object.
const std::string & getDatabaseGlobalTag() const
Get the database global tag used when creating this file.
std::string m_steering
The steering file content.
unsigned int getEventHigh() const
Highest event number in highest run getter.
void setLow(int experiment, int run, unsigned int event)
Lowest experiment, run and event number setter.
unsigned int m_eventHigh
Highest event number in highest run.
void setHigh(int experiment, int run, unsigned int event)
Highest experiment, run and event number setter.
int getRunHigh() const
Highest run number getter.
const std::string & getLfn() const
Logical file name getter.
int getNParents() const
Get number of parent files.
std::string m_randomSeed
The random seed used when producing the file.
std::string m_databaseGlobalTag
Global tag in the database used for production of this file.
unsigned int m_nEvents
Number of events.
void setRandomSeed(const std::string &seed)
Random seed setter.
const std::string & getRelease() const
Software release version getter.
int getRunLow() const
Lowest run number getter.
bool containsEvent(int experiment, int run, unsigned int event) const
Check whether the given event is in the covered range of events.
void setSteering(const std::string &steering)
Steering file content setter.
void declareRealData()
Declare that this is not generated, but real data.
const std::string & getSteering() const
Steering file content getter.
bool isMC() const
Is it generated data?
unsigned int getNEvents() const
Number of events getter.
void setNFullEvents(unsigned int nEvents)
Number of full events setter.
bool m_isMC
Is it generated or real data?
const std::string & getDate() const
File creation date and time getter (UTC)
unsigned int m_nFullEvents
Number of full events.
unsigned int m_mcEvents
Number of generated events, 0 for real data.
FileMetaData()
Constructor.
unsigned int getEventLow() const
Lowest event number in lowest run getter.
std::string m_lfn
Logical file name.
std::map< std::string, std::string > m_dataDescription
key-value store to describe the data.
int m_runLow
Lowest run number.
const std::string & getSite() const
Site where the file was created getter.
std::string m_release
Software release version.
std::string getJsonStr() const
Get a json representation.
std::string m_date
File creation date and time (UTC).
int getExperimentLow() const
Lowest experiment number getter.
ClassDefOverride(FileMetaData, 11)
Metadata information about a file.
static void exposePythonAPI()
Exposes methods of the FileMetaData class to Python.
const std::map< std::string, std::string > & getDataDescription() const
get data description.
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.
void setDatabaseGlobalTag(const std::string &globalTag)
Set the database global tag used when creating this file.
void setLfn(const std::string &lfn)
Setter for LFN.
unsigned int m_eventLow
Lowest event number in lowest run.
const std::string & getUser() const
User who created the file getter.
unsigned int getNFullEvents() const
Number of full events getter.
int m_experimentLow
Lowest experiment number.
const std::string & getRandomSeed() const
Random seed getter.
std::string m_user
User who created the file.
std::string m_site
Site where the file was created.
void setDataDescription(const std::string &key, const std::string &value)
describe the data, if the key exists contents will be overwritten.
void setNEvents(unsigned int nEvents)
Number of events setter.
int getExperimentHigh() const
Highest experiment number getter.
void setRelease(const std::string &release)
Release version setter.
unsigned int getMcEvents() const
Number of generated events getter.
void setMcEvents(unsigned int nEvents)
Number of generated events setter.
int m_experimentHigh
Highest experiment number.
std::vector< std::string > m_parentLfns
LFNs of parent files.
void setParents(const std::vector< std::string > &parents)
Parents setter.
int m_runHigh
Highest run number.
const std::string & getParent(int iParent) const
Get LFN of parent file.
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.
Module to calculate variables specified by the user for a given ParticleList and save them into a ROO...
Abstract base class for different kinds of events.