BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Functions | Variables
Compare Namespace Reference

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.
 

Detailed Description

Comparison utility functions.

Author
Stewart Boogert

Function Documentation

◆ Diff() [1/4]

template<>
bool Compare::Diff ( bool  v1,
bool  v2 
)

Definition at line 91 of file Compare.hh.

◆ Diff() [2/4]

template<>
bool Compare::Diff ( const std::vector< bool > &  v1,
std::vector< bool > &  v2,
int  i 
)

Definition at line 86 of file Compare.hh.

◆ Diff() [3/4]

template<typename T >
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.

◆ Diff() [4/4]

template<typename T >
bool Compare::Diff ( v1,
v2 
)

Definition at line 89 of file Compare.hh.

◆ Directories()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EventTree()

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.

◆ Files()

std::vector< Result * > Compare::Files ( TFile *  f1,
TFile *  f2 
)

Compare two files.

Definition at line 53 of file Compare.cc.

References Directories().

Here is the call graph for this function:

◆ GTEZero()

bool Compare::GTEZero ( const double &  val)
inline

Definition at line 107 of file Compare.hh.

◆ Histograms()

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().

Here is the caller graph for this function:

◆ IsInVector()

bool Compare::IsInVector ( std::string  key,
const std::vector< std::string > &  vec 
)

Definition at line 595 of file Compare.cc.

◆ LTZero()

bool Compare::LTZero ( const double &  val)
inline

Definition at line 108 of file Compare.hh.

◆ NanOrInf()

bool Compare::NanOrInf ( const double &  val)
inline

Definition at line 105 of file Compare.hh.

◆ Optics()

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().

Here is the caller graph for this function:

◆ PrintNoMatching()

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().

Here is the caller graph for this function:

◆ Sampler()

void Compare::Sampler ( BDSOutputROOTEventSampler< double > *  e1,
BDSOutputROOTEventSampler< double > *  e2,
ResultEvent results 
)

Definition at line 489 of file Compare.cc.

◆ StringStartsWith()

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.

◆ Trees()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ Chi2Tolerance

const double Compare::Chi2Tolerance = 40
static

Definition at line 42 of file Compare.hh.

◆ EventTreeTolerance

const double Compare::EventTreeTolerance = 1e-10
static

Definition at line 45 of file Compare.hh.

◆ hasPrimaries

bool Compare::hasPrimaries

Bool for checking if primaries were written to file.

Definition at line 111 of file Compare.hh.

Referenced by Directories().

◆ OpticsSimgaTolerance

const double Compare::OpticsSimgaTolerance = 10
static

Definition at line 44 of file Compare.hh.

◆ TreeTolerance

const double Compare::TreeTolerance = 0.05
static

Definition at line 43 of file Compare.hh.