RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
runinfo.cpp
Go to the documentation of this file.
1#include "runinfo.hpp"
2
3#include "TDirectory.h"
4#include "TNamed.h"
5
6#ifndef RP_GIT_SHA
7#define RP_GIT_SHA "unknown"
8#endif
9
10UInt_t runinfo::SeedFromJob(Int_t jobIndex, Long64_t seed){
11 if(seed >= 0) return (UInt_t) seed;
12 return kDefaultSeed + (UInt_t) jobIndex;
13}
14
16 return TString(RP_GIT_SHA);
17}
18
19void runinfo::Write(const char* key, const char* value){
20 if(!gDirectory) return;
21 TNamed info(key, value);
22 // Write() keeps the key even though the stack object dies here.
23 info.Write(key, TObject::kOverwrite);
24}
25
26void runinfo::Write(const char* key, Double_t value){
27 Write(key, TString::Format("%.17g", value).Data());
28}
29
30void runinfo::Write(const char* key, Long64_t value){
31 Write(key, TString::Format("%lld", value).Data());
32}
33
34void runinfo::WriteCommon(UInt_t seed, Double_t dt, const char* integrator,
35 Long64_t nevents, const char* inspectorCriteria){
36 Write("seed", (Long64_t) seed);
37 Write("dt", dt);
38 Write("integrator", integrator);
39 Write("nevents", nevents);
40 Write("inspectors", inspectorCriteria);
41 Write("git_sha", GitSHA().Data());
42}
UInt_t SeedFromJob(Int_t jobIndex, Long64_t seed=-1)
Seed of one job.
Definition runinfo.cpp:10
const UInt_t kDefaultSeed
Seed used when no seed is given on the command line (job index 0).
Definition runinfo.hpp:18
TString GitSHA()
Git revision the binary was built from.
Definition runinfo.cpp:15
void WriteCommon(UInt_t seed, Double_t dt, const char *integrator, Long64_t nevents, const char *inspectorCriteria)
Write the parameters every run shares.
Definition runinfo.cpp:34
void Write(const char *key, const char *value)
Definition runinfo.cpp:19
#define RP_GIT_SHA
Definition runinfo.cpp:7
Run metadata helpers: store how a result file was produced inside the file.