RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
Functions | Variables
runinfo Namespace Reference

Run metadata helpers for the test programs. More...

Functions

UInt_t SeedFromJob (Int_t jobIndex, Long64_t seed=-1)
 Seed of one job.
 
TString GitSHA ()
 Git revision the binary was built from.
 
void WriteCommon (UInt_t seed, Double_t dt, const char *integrator, Long64_t nevents, const char *inspectorCriteria)
 Write the parameters every run shares.
 
Write one key/value pair

Writes a TNamed(key, value) into the current directory (gDirectory) with the key key, overwriting an earlier entry of that name. Does nothing if there is no current directory. Call before closing the file.

void Write (const char *key, const char *value)
 
void Write (const char *key, Double_t value)
 
void Write (const char *key, Long64_t value)
 

Variables

const UInt_t kDefaultSeed = 65539
 Seed used when no seed is given on the command line (job index 0).
 

Detailed Description

Run metadata helpers for the test programs.

The parameters of a run are stored in the current ROOT file (gDirectory) as TNamed objects (name = key, title = value), so that a result file always tells how it was produced. Read them back with file->Get<TNamed>("seed")->GetTitle().

Function Documentation

◆ GitSHA()

TString runinfo::GitSHA ( )

Git revision the binary was built from.

Returns
the short SHA that CMake passes as the macro RP_GIT_SHA, or "unknown" if that macro is not defined (no git, or no .git directory)

Definition at line 15 of file runinfo.cpp.

◆ SeedFromJob()

UInt_t runinfo::SeedFromJob ( Int_t  jobIndex,
Long64_t  seed = -1 
)

Seed of one job.

The explicit seed if given (seed >= 0), otherwise kDefaultSeed + jobIndex, so parallel jobs with different indices never share a seed and a rerun of the same index is reproducible.

Parameters
jobIndexindex of the job (for example the Condor process number)
seedexplicit seed, or a negative value (default -1) for none; an explicit seed is truncated to 32 bits
Returns
the seed

Definition at line 10 of file runinfo.cpp.

◆ Write() [1/3]

void runinfo::Write ( const char *  key,
const char *  value 
)
Parameters
keyname of the entry
valuetext stored as title

Definition at line 19 of file runinfo.cpp.

◆ Write() [2/3]

void runinfo::Write ( const char *  key,
Double_t  value 
)
Parameters
keyname of the entry
valuenumber, stored as text with 17 significant digits ("%.17g")

Definition at line 26 of file runinfo.cpp.

◆ Write() [3/3]

void runinfo::Write ( const char *  key,
Long64_t  value 
)
Parameters
keyname of the entry
valueinteger, stored as decimal text

Definition at line 30 of file runinfo.cpp.

◆ WriteCommon()

void runinfo::WriteCommon ( UInt_t  seed,
Double_t  dt,
const char *  integrator,
Long64_t  nevents,
const char *  inspectorCriteria 
)

Write the parameters every run shares.

Writes the keys seed, dt, integrator, nevents, inspectors and git_sha (the last one is added automatically from GitSHA()) into the current ROOT directory.

Parameters
seedrandom seed of the run
dttime step in fm/c
integratorintegrator name (for example event::GetIntegratorName())
neventsnumber of events
inspectorCriteriatext describing the inspector criteria

Definition at line 34 of file runinfo.cpp.

Variable Documentation

◆ kDefaultSeed

const UInt_t runinfo::kDefaultSeed = 65539

Seed used when no seed is given on the command line (job index 0).

Definition at line 18 of file runinfo.hpp.