LDMX Software
Public Member Functions | Private Attributes | List of all members
ecal::test::isCloseEnough Class Reference

Our custom energy checker which makes sure that the input energy is "close enough" to the truth energy. More...

Public Member Functions

 isCloseEnough (double const &truth, double const &abs_diff, double const &rel_diff)
 Constructor.
 
bool match (const double &daq_energy) const override
 Performs the test for this matcher.
 
virtual std::string describe () const override
 Describes matcher for printing to terminal.
 

Private Attributes

double truth_
 correct (sim-level) energy [MeV]
 
const double max_absolute_diff_
 maximum absolute energy difference [MeV]
 
const double max_relative_diff_
 maximum relative energy difference
 

Detailed Description

Our custom energy checker which makes sure that the input energy is "close enough" to the truth energy.

Definition at line 95 of file EcalDigiPipelineTest.cxx.

Constructor & Destructor Documentation

◆ isCloseEnough()

ecal::test::isCloseEnough::isCloseEnough ( double const &  truth,
double const &  abs_diff,
double const &  rel_diff 
)
inline

Constructor.

Sets the truth level energy

Definition at line 112 of file EcalDigiPipelineTest.cxx.

114 : truth_{truth},
115 max_absolute_diff_{abs_diff},
116 max_relative_diff_{rel_diff} {}
const double max_relative_diff_
maximum relative energy difference
double truth_
correct (sim-level) energy [MeV]
const double max_absolute_diff_
maximum absolute energy difference [MeV]

Member Function Documentation

◆ describe()

virtual std::string ecal::test::isCloseEnough::describe ( ) const
inlineoverridevirtual

Describes matcher for printing to terminal.

Definition at line 133 of file EcalDigiPipelineTest.cxx.

133 {
134 std::ostringstream ss;
135 ss << "is within an absolute difference of " << max_absolute_diff_
136 << "MeV OR a relative difference of " << max_relative_diff_ << " with "
137 << truth_ << " MeV.";
138 return ss.str();
139 }

References max_absolute_diff_, max_relative_diff_, and truth_.

◆ match()

bool ecal::test::isCloseEnough::match ( const double &  daq_energy) const
inlineoverride

Performs the test for this matcher.

We check that the input energy is either within the absolute difference or the relative difference.

Definition at line 125 of file EcalDigiPipelineTest.cxx.

125 {
126 return (daq_energy == Approx(truth_).epsilon(max_relative_diff_) or
127 daq_energy == Approx(truth_).margin(max_absolute_diff_));
128 }

References max_absolute_diff_, max_relative_diff_, and truth_.

Member Data Documentation

◆ max_absolute_diff_

const double ecal::test::isCloseEnough::max_absolute_diff_
private

maximum absolute energy difference [MeV]

Definition at line 101 of file EcalDigiPipelineTest.cxx.

Referenced by describe(), and match().

◆ max_relative_diff_

const double ecal::test::isCloseEnough::max_relative_diff_
private

maximum relative energy difference

Definition at line 104 of file EcalDigiPipelineTest.cxx.

Referenced by describe(), and match().

◆ truth_

double ecal::test::isCloseEnough::truth_
private

correct (sim-level) energy [MeV]

Definition at line 98 of file EcalDigiPipelineTest.cxx.

Referenced by describe(), and match().


The documentation for this class was generated from the following file: