BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Comparison utility functions. More...
Functions | |
std::vector< Result * > | Files (TFile *f1, TFile *f2) |
Compare two files. | |
void | Directories (TDirectory *d1, TDirectory *d2, std::vector< Result * > &results) |
void | Histograms (TH1 *h1, TH1 *h2, std::vector< Result * > &results) |
Compare two histogams. | |
void | Trees (TTree *t1, TTree *t2, std::vector< Result * > &results) |
Compare two TTrees. | |
void | Optics (TTree *t1, TTree *t2, std::vector< Result * > &results) |
void | EventTree (TTree *t1, TTree *t2, std::vector< Result * > &results, const std::vector< std::string > &samplerNames, const std::vector< std::string > &samplerCNames, const std::vector< std::string > &samplerSNames) |
void | Sampler (BDSOutputROOTEventSampler< double > *e1, BDSOutputROOTEventSampler< double > *e2, ResultEvent *results) |
void | Sampler (BDSOutputROOTEventSampler< float > *e1, BDSOutputROOTEventSampler< float > *e2, ResultEvent *results) |
template<typename T > | |
bool | Diff (const std::vector< T > &v1, std::vector< T > &v2, int i) |
Return true if they're different. | |
template<> | |
bool | Diff (const std::vector< bool > &v1, std::vector< bool > &v2, int i) |
template<typename T > | |
bool | Diff (T v1, T v2) |
template<> | |
bool | Diff (bool v1, bool v2) |
void | PrintNoMatching (std::string className, std::string objectName) |
bool | Summarise (const std::vector< Result * > &results) |
Loop over results and print any failed ones. Returns true if all passed. | |
bool | StringStartsWith (std::string aString, std::string prefix) |
Check whether a string is prefixed with another string. | |
bool | IsInVector (std::string key, const std::vector< std::string > &vec) |
bool | NanOrInf (const double &val) |
bool | GTEZero (const double &val) |
bool | LTZero (const double &val) |
Variables | |
static const double | Chi2Tolerance = 40 |
static const double | TreeTolerance = 0.05 |
static const double | OpticsSimgaTolerance = 10 |
static const double | EventTreeTolerance = 1e-10 |
bool | hasPrimaries |
Bool for checking if primaries were written to file. | |
Comparison utility functions.
bool Compare::Diff | ( | bool | v1, |
bool | v2 | ||
) |
Definition at line 91 of file Compare.hh.
bool Compare::Diff | ( | const std::vector< bool > & | v1, |
std::vector< bool > & | v2, | ||
int | i | ||
) |
Definition at line 86 of file Compare.hh.
bool Compare::Diff | ( | const std::vector< T > & | v1, |
std::vector< T > & | v2, | ||
int | i | ||
) |
Return true if they're different.
Definition at line 84 of file Compare.hh.
bool Compare::Diff | ( | T | v1, |
T | v2 | ||
) |
Definition at line 89 of file Compare.hh.
void Compare::Directories | ( | TDirectory * | d1, |
TDirectory * | d2, | ||
std::vector< Result * > & | results | ||
) |
Compare two directories by changing into d1 and inspecting all objects. The results are recorded via a reference to a results vector. The original directory is changed back to at the end of the method.
Definition at line 61 of file Compare.cc.
References Directories(), hasPrimaries, Histograms(), Options::options, PrintNoMatching(), Options::SetBranchAddress(), and Trees().
Referenced by Directories(), and Files().
void Compare::EventTree | ( | TTree * | t1, |
TTree * | t2, | ||
std::vector< Result * > & | results, | ||
const std::vector< std::string > & | samplerNames, | ||
const std::vector< std::string > & | samplerCNames, | ||
const std::vector< std::string > & | samplerSNames | ||
) |
Definition at line 419 of file Compare.cc.
std::vector< Result * > Compare::Files | ( | TFile * | f1, |
TFile * | f2 | ||
) |
Compare two files.
Definition at line 53 of file Compare.cc.
References Directories().
|
inline |
Definition at line 107 of file Compare.hh.
void Compare::Histograms | ( | TH1 * | h1, |
TH1 * | h2, | ||
std::vector< Result * > & | results | ||
) |
Compare two histogams.
Definition at line 134 of file Compare.cc.
References Result::name, Result::objtype, and Result::passed.
Referenced by Directories().
bool Compare::IsInVector | ( | std::string | key, |
const std::vector< std::string > & | vec | ||
) |
Definition at line 595 of file Compare.cc.
|
inline |
Definition at line 108 of file Compare.hh.
|
inline |
Definition at line 105 of file Compare.hh.
void Compare::Optics | ( | TTree * | t1, |
TTree * | t2, | ||
std::vector< Result * > & | results | ||
) |
Compare an optics TTree specifically. This relies on the known variable names in the tree and naming scheme.
Definition at line 265 of file Compare.cc.
References Result::name, Result::objtype, and Result::passed.
Referenced by Trees().
void Compare::PrintNoMatching | ( | std::string | className, |
std::string | objectName | ||
) |
Simply print out feedback warning that a matching object wasn't found and no comparison is being done.
Definition at line 576 of file Compare.cc.
Referenced by Directories().
void Compare::Sampler | ( | BDSOutputROOTEventSampler< double > * | e1, |
BDSOutputROOTEventSampler< double > * | e2, | ||
ResultEvent * | results | ||
) |
Definition at line 489 of file Compare.cc.
bool Compare::StringStartsWith | ( | std::string | aString, |
std::string | prefix | ||
) |
Check whether a string is prefixed with another string.
Definition at line 581 of file Compare.cc.
void Compare::Trees | ( | TTree * | t1, |
TTree * | t2, | ||
std::vector< Result * > & | results | ||
) |
Compare two TTrees.
Definition at line 183 of file Compare.cc.
References Result::name, Result::objtype, Optics(), Result::passed, Model::SamplerNames(), and Model::SetBranchAddress().
Referenced by Directories().
|
static |
Definition at line 42 of file Compare.hh.
|
static |
Definition at line 45 of file Compare.hh.
bool Compare::hasPrimaries |
Bool for checking if primaries were written to file.
Definition at line 111 of file Compare.hh.
Referenced by Directories().
|
static |
Definition at line 44 of file Compare.hh.
|
static |
Definition at line 43 of file Compare.hh.