Belle II Software  release-08-01-10
FileMetaData Class Reference

Metadata information about a file. More...

#include <FileMetaData.h>

Inheritance diagram for FileMetaData:
Collaboration diagram for FileMetaData:

Public Member Functions

 FileMetaData ()
 Constructor.
 
const std::string & getLfn () const
 Logical file name getter.
 
unsigned int getNEvents () const
 Number of events getter.
 
unsigned int getNFullEvents () const
 Number of full events getter.
 
int getExperimentLow () const
 Lowest experiment number getter.
 
int getRunLow () const
 Lowest run number getter.
 
unsigned int getEventLow () const
 Lowest event number in lowest run getter.
 
int getExperimentHigh () const
 Highest experiment number getter.
 
int getRunHigh () const
 Highest run number getter.
 
unsigned int getEventHigh () const
 Highest event number in highest run getter.
 
bool containsEvent (int experiment, int run, unsigned int event) const
 Check whether the given event is in the covered range of events. More...
 
int getNParents () const
 Get number of parent files.
 
const std::string & getParent (int iParent) const
 Get LFN of parent file. More...
 
const std::string & getDate () const
 File creation date and time getter (UTC)
 
const std::string & getSite () const
 Site where the file was created getter.
 
const std::string & getUser () const
 User who created the file getter.
 
const std::string & getRandomSeed () const
 Random seed getter.
 
const std::string & getRelease () const
 Software release version getter.
 
const std::string & getSteering () const
 Steering file content getter.
 
bool isMC () const
 Is it generated data?.
 
unsigned int getMcEvents () const
 Number of generated events getter.
 
const std::string & getDatabaseGlobalTag () const
 Get the database global tag used when creating this file. More...
 
const std::map< std::string, std::string > & getDataDescription () const
 get data description. More...
 
void setLfn (const std::string &lfn)
 Setter for LFN. More...
 
void setNEvents (unsigned int nEvents)
 Number of events setter. More...
 
void setNFullEvents (unsigned int nEvents)
 Number of full events setter. More...
 
void setLow (int experiment, int run, unsigned int event)
 Lowest experiment, run and event number setter. More...
 
void setHigh (int experiment, int run, unsigned int event)
 Highest experiment, run and event number setter. More...
 
void setParents (const std::vector< std::string > &parents)
 Parents setter. More...
 
void setCreationData (const std::string &date, const std::string &site, const std::string &user, const std::string &release)
 Creation data setter. More...
 
void setRandomSeed (const std::string &seed)
 Random seed setter. More...
 
void setSteering (const std::string &steering)
 Steering file content setter. More...
 
void setMcEvents (unsigned int nEvents)
 Number of generated events setter. More...
 
void setDatabaseGlobalTag (const std::string &globalTag)
 Set the database global tag used when creating this file. More...
 
void setDataDescription (const std::string &key, const std::string &value)
 describe the data, if the key exists contents will be overwritten. More...
 
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. More...
 
bool read (std::istream &input, std::string &physicalFileName)
 Read file meta data in xml format from the input stream. More...
 
bool write (std::ostream &output, const std::string &physicalFileName) const
 Write file meta data in xml format to the output stream. More...
 
std::string getJsonStr () const
 Get a json representation.
 

Static Public Member Functions

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

Private Member Functions

void declareRealData ()
 Declare that this is not generated, but real data.
 
 ClassDefOverride (FileMetaData, 11)
 Metadata information about a file.
 

Private Attributes

std::string m_lfn
 Logical file name. More...
 
unsigned int m_nEvents
 Number of events. More...
 
unsigned int m_nFullEvents
 Number of full events. More...
 
int m_experimentLow
 Lowest experiment number. More...
 
int m_runLow
 Lowest run number. More...
 
unsigned int m_eventLow
 Lowest event number in lowest run. More...
 
int m_experimentHigh
 Highest experiment number. More...
 
int m_runHigh
 Highest run number. More...
 
unsigned int m_eventHigh
 Highest event number in highest run. More...
 
std::vector< std::string > m_parentLfns
 LFNs of parent files. More...
 
std::string m_date
 File creation date and time (UTC). More...
 
std::string m_site
 Site where the file was created. More...
 
std::string m_user
 User who created the file. More...
 
std::string m_randomSeed
 The random seed used when producing the file.
 
std::string m_release
 Software release version. More...
 
std::string m_steering
 The steering file content. More...
 
bool m_isMC
 Is it generated or real data?. More...
 
unsigned int m_mcEvents
 Number of generated events, 0 for real data. More...
 
std::string m_databaseGlobalTag
 Global tag in the database used for production of this file.
 
std::map< std::string, std::string > m_dataDescription
 key-value store to describe the data. More...
 

Friends

class SeqRootInputModule
 
class RootInputModule
 
class RootOutputModule
 
class B2BIIMdstInputModule
 
class BeamBkgHitRateMonitorModule
 
class StorageRootOutputModule
 

Detailed Description

Metadata information about a file.

See BELLE2-NOTE-TE-2015-028: Event, File, and Dataset Metadata for a detailed definition. Available at: https://docs.belle2.org/record/287?ln=en

Definition at line 29 of file FileMetaData.h.

Member Function Documentation

◆ containsEvent()

bool containsEvent ( int  experiment,
int  run,
unsigned int  event 
) const

Check whether the given event is in the covered range of events.

Note
This does not guarantee that the event is in the file, only that the file contains a range of exp/run/event numbers that would make it plausible.
Parameters
experimentThe experiment number of the event.
runThe run number of the event.
eventThe event number of the event.

Definition at line 33 of file FileMetaData.cc.

34 {
35  if (experiment < m_experimentLow) return false;
36  if (experiment == m_experimentLow) {
37  if (run < m_runLow) return false;
38  if ((run == m_runLow) && (event < m_eventLow)) return false;
39  }
40  if (experiment > m_experimentHigh) return false;
41  if (experiment == m_experimentHigh) {
42  if (run > m_runHigh) return false;
43  if ((run == m_runHigh) && (event > m_eventHigh)) return false;
44  }
45  return true;
46 }
unsigned int m_eventHigh
Highest event number in highest run.
Definition: FileMetaData.h:268
int m_runLow
Lowest run number.
Definition: FileMetaData.h:260
unsigned int m_eventLow
Lowest event number in lowest run.
Definition: FileMetaData.h:262
int m_experimentLow
Lowest experiment number.
Definition: FileMetaData.h:258
int m_experimentHigh
Highest experiment number.
Definition: FileMetaData.h:264
int m_runHigh
Highest run number.
Definition: FileMetaData.h:266

◆ getDatabaseGlobalTag()

const std::string& getDatabaseGlobalTag ( ) const
inline

Get the database global tag used when creating this file.

If more then one global tag was used by multiple conditions database instances all are concatenated using ',' as separation. If no conditions database was used an empty string is returned

Definition at line 130 of file FileMetaData.h.

130 { return m_databaseGlobalTag; }
std::string m_databaseGlobalTag
Global tag in the database used for production of this file.
Definition: FileMetaData.h:288

◆ getDataDescription()

const std::map<std::string, std::string>& getDataDescription ( ) const
inline

get data description.

(Keys and values to be defined by the computing group)

Definition at line 133 of file FileMetaData.h.

◆ getParent()

const std::string& getParent ( int  iParent) const
inline

Get LFN of parent file.

Note
Not range-checked!
Parameters
iParentThe number of the parent file.

Definition at line 92 of file FileMetaData.h.

◆ Print()

void Print ( Option_t *  option = "") const
overridevirtual

Print the content of the meta data object.

Parameters
optionUse "all" to print everything, except steering file. Use "steering" for printing (only) steering file. "json" for machine-readable output

Definition at line 77 of file FileMetaData.cc.

◆ read()

bool read ( std::istream &  input,
std::string &  physicalFileName 
)

Read file meta data in xml format from the input stream.

Parameters
inputThe input stream.
physicalFileNameThe physical file name. Will be set on return.
Returns
True if metadata could be read

Definition at line 109 of file FileMetaData.cc.

◆ setCreationData()

void setCreationData ( const std::string &  date,
const std::string &  site,
const std::string &  user,
const std::string &  release 
)
inline

Creation data setter.

Parameters
dateThe creation date and time.
siteThe site where the file was created.
userThe user who created the file.
releaseThe software release.

Definition at line 182 of file FileMetaData.h.

◆ setDatabaseGlobalTag()

void setDatabaseGlobalTag ( const std::string &  globalTag)
inline

Set the database global tag used when creating this file.

If more then one global tag was used by multiple conditions database instances all should be concatenated using ',' as separation. If no conditions database was used an empty string should be set.

Definition at line 208 of file FileMetaData.h.

◆ setDataDescription()

void setDataDescription ( const std::string &  key,
const std::string &  value 
)
inline

describe the data, if the key exists contents will be overwritten.

(Keys and values to be defined by the computing group)

Definition at line 214 of file FileMetaData.h.

◆ setHigh()

void setHigh ( int  experiment,
int  run,
unsigned int  event 
)
inline

Highest experiment, run and event number setter.

Parameters
experimentThe highest experiment number.
runThe highest run number.
eventThe highest event number of the highest run.

Definition at line 167 of file FileMetaData.h.

◆ setLfn()

void setLfn ( const std::string &  lfn)
inline

Setter for LFN.

Parameters
lfnThe logical file name.

Definition at line 139 of file FileMetaData.h.

◆ setLow()

void setLow ( int  experiment,
int  run,
unsigned int  event 
)
inline

Lowest experiment, run and event number setter.

Parameters
experimentThe lowest experiment number.
runThe lowest run number.
eventThe lowest event number of the lowest run.

Definition at line 159 of file FileMetaData.h.

◆ setMcEvents()

void setMcEvents ( unsigned int  nEvents)
inline

Number of generated events setter.

Parameters
nEventsThe number of generated events.

Definition at line 201 of file FileMetaData.h.

◆ setNEvents()

void setNEvents ( unsigned int  nEvents)
inline

Number of events setter.

Parameters
nEventsThe number of events.

Definition at line 145 of file FileMetaData.h.

◆ setNFullEvents()

void setNFullEvents ( unsigned int  nEvents)
inline

Number of full events setter.

Parameters
nEventsThe number of full events.

Definition at line 151 of file FileMetaData.h.

◆ setParents()

void setParents ( const std::vector< std::string > &  parents)
inline

Parents setter.

Parameters
parentsThe vector of parent IDs.

Definition at line 173 of file FileMetaData.h.

◆ setRandomSeed()

void setRandomSeed ( const std::string &  seed)
inline

Random seed setter.

Parameters
seedThe random seed.

Definition at line 189 of file FileMetaData.h.

◆ setSteering()

void setSteering ( const std::string &  steering)
inline

Steering file content setter.

Parameters
steeringThe content of the steering file.

Definition at line 195 of file FileMetaData.h.

◆ write()

bool write ( std::ostream &  output,
const std::string &  physicalFileName 
) const

Write file meta data in xml format to the output stream.

Parameters
outputThe output stream.
physicalFileNameThe physical file name.
Returns
True if metadata could be written

Definition at line 157 of file FileMetaData.cc.

Member Data Documentation

◆ m_dataDescription

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

key-value store to describe the data.

(for use by the computing group)

Definition at line 290 of file FileMetaData.h.

◆ m_date

std::string m_date
private

File creation date and time (UTC).


Definition at line 272 of file FileMetaData.h.

◆ m_eventHigh

unsigned int m_eventHigh
private

Highest event number in highest run.


Definition at line 268 of file FileMetaData.h.

◆ m_eventLow

unsigned int m_eventLow
private

Lowest event number in lowest run.


Definition at line 262 of file FileMetaData.h.

◆ m_experimentHigh

int m_experimentHigh
private

Highest experiment number.


Definition at line 264 of file FileMetaData.h.

◆ m_experimentLow

int m_experimentLow
private

Lowest experiment number.


Definition at line 258 of file FileMetaData.h.

◆ m_isMC

bool m_isMC
private

Is it generated or real data?.


Definition at line 284 of file FileMetaData.h.

◆ m_lfn

std::string m_lfn
private

Logical file name.


Definition at line 252 of file FileMetaData.h.

◆ m_mcEvents

unsigned int m_mcEvents
private

Number of generated events, 0 for real data.


Definition at line 286 of file FileMetaData.h.

◆ m_nEvents

unsigned int m_nEvents
private

Number of events.


Definition at line 254 of file FileMetaData.h.

◆ m_nFullEvents

unsigned int m_nFullEvents
private

Number of full events.


Definition at line 256 of file FileMetaData.h.

◆ m_parentLfns

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

LFNs of parent files.


Definition at line 270 of file FileMetaData.h.

◆ m_release

std::string m_release
private

Software release version.


Definition at line 280 of file FileMetaData.h.

◆ m_runHigh

int m_runHigh
private

Highest run number.


Definition at line 266 of file FileMetaData.h.

◆ m_runLow

int m_runLow
private

Lowest run number.


Definition at line 260 of file FileMetaData.h.

◆ m_site

std::string m_site
private

Site where the file was created.


Definition at line 274 of file FileMetaData.h.

◆ m_steering

std::string m_steering
private

The steering file content.


Definition at line 282 of file FileMetaData.h.

◆ m_user

std::string m_user
private

User who created the file.


Definition at line 276 of file FileMetaData.h.


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