|
LDMX Software
|
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the output file. More...
#include <RunHeader.h>
Public Member Functions | |
| RunHeader (int runNumber) | |
| Constructor. | |
| RunHeader ()=default | |
| Default constructor. | |
| virtual | ~RunHeader () |
| Destructor. | |
| int | getRunNumber () const |
| const std::string & | getDetectorName () const |
| void | setDetectorName (const std::string &det) |
| Set the name of the detector that was used in this run. | |
| const std::string & | getSoftwareTag () const |
| const std::string & | getLdmxswVersion () const |
| const std::string & | getDescription () const |
| void | setDescription (const std::string &des) |
| Set the description of this run. | |
| int | getRunStart () const |
| Get the start time of the run in seconds since epoch. | |
| void | setRunStart (const int runStart) |
| Set the run start time in seconds since epoch. | |
| int | getRunEnd () const |
| Get the end time of the run in seconds since epoch. | |
| void | setRunEnd (const int runEnd) |
| Set the end time of the run in seconds since epoch. | |
| int | getNumTries () const |
| Get the total number of tries that were done during the production of this run. | |
| void | setNumTries (const int numTries) |
| Set the total number of tries that were done during the production of this run. | |
| bool | isCompleted () const |
| Check whether the file holding this run was closed cleanly. | |
| void | setCompleted (const bool completed) |
| Mark whether this run was completed. | |
| int | getIntParameter (const std::string &name) const |
| Get an int parameter value. | |
| const std::map< std::string, int > & | getIntParameters () const |
| Get a const reference to all int parameters. | |
| void | setIntParameter (const std::string &name, int value) |
| Set an int parameter value. | |
| float | getFloatParameter (const std::string &name) const |
| Get a float parameter value. | |
| const std::map< std::string, float > & | getFloatParameters () const |
| Get a const reference to all float parameters. | |
| void | setFloatParameter (const std::string &name, float value) |
| Set a float parameter value. | |
| std::string | getStringParameter (const std::string &name) const |
| Get a string parameter value. | |
| const std::map< std::string, std::string > & | getStringParameters () const |
| Get a const reference to all string parameters. | |
| void | setStringParameter (const std::string &name, std::string value) |
| Set a string parameter value. | |
| void | stream (std::ostream &s) const |
| Stream this object into the input ostream. | |
| void | print () const |
| Print a string desciption of this object. | |
Static Public Attributes | |
| static constexpr int | VERSION_WITH_COMPLETED {7} |
| The first class version that writes completed_. | |
Private Member Functions | |
| ClassDef (RunHeader, 7) | |
Private Attributes | |
| int | run_number_ {0} |
| Run number. | |
| std::string | detector_name_ {""} |
| Detector name. | |
| std::string | description_ {""} |
| Run description. | |
| int | run_start_ {0} |
| Run start in seconds since epoch. | |
| int | run_end_ {0} |
| Run end in seconds since epoch. | |
| int | num_tries_ {0} |
| Total number of events that were begun during the production of this run. | |
| bool | completed_ {false} |
| True only once the run finished and the file was closed cleanly. | |
| std::string | software_tag_ {GIT_SHA1} |
| git SHA-1 hash associated with the software tag used to generate this file. | |
| std::string | ldmxsw_version_ {LDMXSW_VERSION} |
| ldmx-sw software version | |
| std::map< std::string, int > | int_parameters_ |
| Map of int parameters. | |
| std::map< std::string, float > | float_parameters_ |
| Map of float parameters. | |
| std::map< std::string, std::string > | string_parameters_ |
| Map of string parameters. | |
Friends | |
| std::ostream & | operator<< (std::ostream &s, const ldmx::RunHeader &h) |
| Stream this object to an output stream. | |
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the output file.
Similar to the EventHeader, the evolution of this object has been pretty slow since the *Parameter* members have been used to hold most of the additional information (for example, a lot of the simulation configuration information). The versions of the RunHeader as defined by ROOT's serialization infrastructure are documented here.
An initial beta version now lost to the sands of time.
There are no material (serialized data) changes that are different between v2 and v3, but this version was increased because we moved the Framework repo (and thus the RunHeader source) from being within ldmx-sw to its own stand-alone repo. With an abundance of caution (and lack of understanding of what ROOT's dictionary cares about), we increased the version number.
Add the numTries_ member variable in order to store exactly how many events were started during the production of the run.
When reading a file written with v3 RunHeader using software with v4 RunHeader, the numTries_ member will keep its default value of 0. This is a nice signal value since it conveys to the user the lack of information. If the user somehow gets into the situation of reading a v4 RunHeader with v3 software, the numTries_ member is quietly ignored, maintaining the format of the v3 RunHeader in the resulting output file.
Include a member to track the ldmx-sw version
Add the completed_ member so a consumer can tell a complete file from one whose writer died partway through.
Those versions have no completed_ on disk, so reading one leaves the member at its default of false. A reader cannot tell such a run apart from one that was cut short, so it has to look at the class version of the run tree (VERSION_WITH_COMPLETED) before trusting the flag.
Definition at line 67 of file RunHeader.h.
| ldmx::RunHeader::RunHeader | ( | int | runNumber | ) |
Constructor.
| runNumber | The run number uniquely identifying this run |
Definition at line 13 of file RunHeader.cxx.
|
default |
Default constructor.
|
inlinevirtual |
|
inline |
Definition at line 115 of file RunHeader.h.
References description_.
Referenced by stream().
|
inline |
Definition at line 98 of file RunHeader.h.
References detector_name_.
Referenced by ecal::EcalGeometryProvider::onNewRun(), hcal::HcalGeometryProvider::onNewRun(), and stream().
|
inline |
Get a float parameter value.
| name | The name of the parameter. |
Definition at line 220 of file RunHeader.h.
References float_parameters_.
|
inline |
Get a const reference to all float parameters.
Definition at line 225 of file RunHeader.h.
References float_parameters_.
|
inline |
Get an int parameter value.
| name | The name of the parameter. |
Definition at line 195 of file RunHeader.h.
References int_parameters_.
|
inline |
Get a const reference to all int parameters.
Definition at line 200 of file RunHeader.h.
References int_parameters_.
|
inline |
Definition at line 112 of file RunHeader.h.
References ldmxsw_version_.
|
inline |
Get the total number of tries that were done during the production of this run.
Definition at line 155 of file RunHeader.h.
References num_tries_.
Referenced by stream().
|
inline |
Get the end time of the run in seconds since epoch.
Definition at line 140 of file RunHeader.h.
References run_end_.
|
inline |
Definition at line 95 of file RunHeader.h.
References run_number_.
Referenced by dqm::GenieTruthDQM::onNewRun(), framework::RandomNumberSeedService::onNewRun(), simcore::Simulator::onNewRun(), stream(), and packing::rawdatafile::File::writeRunHeader().
|
inline |
Get the start time of the run in seconds since epoch.
Definition at line 126 of file RunHeader.h.
References run_start_.
|
inline |
Definition at line 107 of file RunHeader.h.
References software_tag_.
|
inline |
Get a string parameter value.
| name | The name of the parameter. |
Definition at line 245 of file RunHeader.h.
References string_parameters_.
|
inline |
Get a const reference to all string parameters.
Definition at line 250 of file RunHeader.h.
References string_parameters_.
Referenced by simcore::GenieReweightProducer::onNewRun().
|
inline |
Check whether the file holding this run was closed cleanly.
False means the file is missing events, either because the job was killed or because it stopped early on a preemption signal.
Definition at line 177 of file RunHeader.h.
References completed_.
Referenced by stream().
| void ldmx::RunHeader::print | ( | ) | const |
Print a string desciption of this object.
Definition at line 32 of file RunHeader.cxx.
References stream().
Referenced by framework::RunHeaderAnalyzer::onNewRun().
|
inline |
Mark whether this run was completed.
| [in] | completed | whether the run finished cleanly |
Definition at line 187 of file RunHeader.h.
References completed_.
|
inline |
Set the description of this run.
Definition at line 118 of file RunHeader.h.
References description_.
Referenced by simcore::Simulator::beforeNewRun().
|
inline |
Set the name of the detector that was used in this run.
Definition at line 101 of file RunHeader.h.
References detector_name_.
Referenced by hcal::HcalRawDecoder::beforeNewRun(), and simcore::Simulator::beforeNewRun().
|
inline |
Set a float parameter value.
| name | The name of the parameter. |
| value | The parameter value. |
Definition at line 235 of file RunHeader.h.
References float_parameters_.
Referenced by simcore::Simulator::beforeNewRun(), simcore::biasoperators::APrimeToFCPPair::RecordConfig(), simcore::biasoperators::DarkBrem::RecordConfig(), simcore::biasoperators::ElectroNuclear::RecordConfig(), simcore::biasoperators::GammaToFCPPair::RecordConfig(), simcore::biasoperators::GammaToMuPair::RecordConfig(), simcore::biasoperators::K0LongInelastic::RecordConfig(), simcore::biasoperators::NeutronInelastic::RecordConfig(), simcore::biasoperators::PhotoNuclear::RecordConfig(), simcore::generators::MultiParticleGunPrimaryGenerator::RecordConfig(), and simcore::generators::ParticleGun::RecordConfig().
|
inline |
Set an int parameter value.
| name | The name of the parameter. |
| value | The value of the parameter. |
Definition at line 210 of file RunHeader.h.
References int_parameters_.
Referenced by simcore::Simulator::beforeNewRun(), framework::RandomNumberSeedService::onNewRun(), simcore::biasoperators::DarkBrem::RecordConfig(), simcore::biasoperators::PhotoNuclear::RecordConfig(), simcore::generators::MultiParticleGunPrimaryGenerator::RecordConfig(), and packing::rawdatafile::File::writeRunHeader().
|
inline |
Set the total number of tries that were done during the production of this run.
| [in] | numTries | the number of tries in this run |
Definition at line 167 of file RunHeader.h.
References num_tries_.
|
inline |
Set the end time of the run in seconds since epoch.
| [in] | runEnd | the end time of the run. |
Definition at line 147 of file RunHeader.h.
References run_end_.
|
inline |
Set the run start time in seconds since epoch.
| [in] | runStart | the start time of the run. |
Definition at line 133 of file RunHeader.h.
References run_start_.
|
inline |
Set a string parameter value.
| name | The name of the parameter. |
| value | The parameter value. |
Definition at line 260 of file RunHeader.h.
References string_parameters_.
Referenced by simcore::Simulator::beforeNewRun(), framework::Process::newRun(), simcore::biasoperators::APrimeToFCPPair::RecordConfig(), simcore::biasoperators::DarkBrem::RecordConfig(), simcore::biasoperators::ElectroNuclear::RecordConfig(), simcore::biasoperators::GammaToFCPPair::RecordConfig(), simcore::biasoperators::GammaToMuPair::RecordConfig(), simcore::biasoperators::K0LongInelastic::RecordConfig(), simcore::biasoperators::NeutronInelastic::RecordConfig(), simcore::biasoperators::PhotoNuclear::RecordConfig(), simcore::generators::FromScoringPlane::RecordConfig(), simcore::generators::GeneralParticleSource::RecordConfig(), simcore::generators::GenieGenerator::RecordConfig(), simcore::generators::HepMCPrimaryGenerator::RecordConfig(), simcore::generators::LHEPrimaryGenerator::RecordConfig(), simcore::generators::MultiParticleGunPrimaryGenerator::RecordConfig(), and simcore::generators::ParticleGun::RecordConfig().
| void ldmx::RunHeader::stream | ( | std::ostream & | s | ) | const |
Stream this object into the input ostream.
Includes new-line characters to separate out the different parameter maps
| [in] | s | ostream to write to |
Definition at line 15 of file RunHeader.cxx.
References float_parameters_, getDescription(), getDetectorName(), getNumTries(), getRunNumber(), int_parameters_, isCompleted(), and string_parameters_.
Referenced by print().
|
friend |
Stream this object to an output stream.
Needs to be here and labeled as friend for it to be compatible with Boost logging.
| [in] | s | ostream to write to |
| [in] | h | RunHeader to write out |
Definition at line 287 of file RunHeader.h.
|
private |
True only once the run finished and the file was closed cleanly.
Definition at line 325 of file RunHeader.h.
Referenced by isCompleted(), and setCompleted().
|
private |
Run description.
Definition at line 300 of file RunHeader.h.
Referenced by getDescription(), and setDescription().
|
private |
Detector name.
Definition at line 297 of file RunHeader.h.
Referenced by getDetectorName(), and setDetectorName().
|
private |
Map of float parameters.
Definition at line 342 of file RunHeader.h.
Referenced by getFloatParameter(), getFloatParameters(), setFloatParameter(), and stream().
|
private |
Map of int parameters.
Definition at line 339 of file RunHeader.h.
Referenced by getIntParameter(), getIntParameters(), setIntParameter(), and stream().
|
private |
ldmx-sw software version
Definition at line 336 of file RunHeader.h.
Referenced by getLdmxswVersion().
|
private |
Total number of events that were begun during the production of this run.
This value is only set at the end of processing so we can faithfully store the total number of events that were started. In the case where maxTriesPerEvent is set to 1, this will be the same as the configured maxEvents during Production Mode. If more than one try per event is allowed, this will not necessarily be maxEvents since processors could abort an event causing more than maxEvents to be started. This can be summarized by the following inequality
maxEvents <= numTries <= maxEvents*maxTriesPerEvent
Definition at line 322 of file RunHeader.h.
Referenced by getNumTries(), and setNumTries().
|
private |
Run end in seconds since epoch.
Definition at line 306 of file RunHeader.h.
Referenced by getRunEnd(), and setRunEnd().
|
private |
|
private |
Run start in seconds since epoch.
Definition at line 303 of file RunHeader.h.
Referenced by getRunStart(), and setRunStart().
|
private |
git SHA-1 hash associated with the software tag used to generate this file.
Definition at line 331 of file RunHeader.h.
Referenced by getSoftwareTag().
|
private |
Map of string parameters.
Definition at line 345 of file RunHeader.h.
Referenced by getStringParameter(), getStringParameters(), setStringParameter(), and stream().
|
staticconstexpr |
The first class version that writes completed_.
Run headers read out of a file written with an earlier version say nothing about whether their run finished.
Definition at line 75 of file RunHeader.h.
Referenced by framework::EventFile::importRunHeaders().