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

Runs a variety of checks to make sure the histogram in the input filename is what we expect it to be. More...

Public Member Functions

 isGoodHistogramFile (int const &n)
 Constructor.
 
bool match (const std::string &filename) const override
 Performs the test for this matcher.
 
virtual std::string describe () const override
 Describe this matcher in a helpful, human-readable way.
 

Private Attributes

int correctGetEntries_
 Correct number of entries.
 

Detailed Description

Runs a variety of checks to make sure the histogram in the input filename is what we expect it to be.

Does NOT check that the entries in the histogram are correct, just makes sure that there is the correct number.

Does check:

Definition at line 173 of file FunctionalCoreTest.cxx.

Constructor & Destructor Documentation

◆ isGoodHistogramFile()

framework::test::isGoodHistogramFile::isGoodHistogramFile ( int const &  n)
inline

Constructor.

Sets the correct event indices

Definition at line 184 of file FunctionalCoreTest.cxx.

184: correctGetEntries_(n) {}
int correctGetEntries_
Correct number of entries.

Member Function Documentation

◆ describe()

virtual std::string framework::test::isGoodHistogramFile::describe ( ) const
inlineoverridevirtual

Describe this matcher in a helpful, human-readable way.

This string is written as if stating a fact about the object it is matching.

Definition at line 211 of file FunctionalCoreTest.cxx.

211 {
212 std::ostringstream ss;
213 ss << "has the histogram 'TestAnalyzer/test_hist_' with the number of "
214 "entries "
216 return ss.str();
217 }

References correctGetEntries_.

◆ match()

bool framework::test::isGoodHistogramFile::match ( const std::string &  filename) const
inlineoverride

Performs the test for this matcher.

Opens up the histogram file and makes sure of a few things.

  • The histogram 'test_hist_' is in the 'TestAnalyzer' directory
  • The histogram has the correct number of entries

Definition at line 193 of file FunctionalCoreTest.cxx.

193 {
194 // Open file
195 TFile* f = TFile::Open(filename.c_str());
196 if (!f) return false;
197 TDirectory* d = (TDirectory*)f->Get("TestAnalyzer");
198 if (!d) return false;
199 TH1F* h = (TH1F*)d->Get("test_hist_");
200 if (!h) return false;
201
202 return (h->GetEntries() == correctGetEntries_);
203 }

References correctGetEntries_.

Member Data Documentation

◆ correctGetEntries_

int framework::test::isGoodHistogramFile::correctGetEntries_
private

Correct number of entries.

Definition at line 176 of file FunctionalCoreTest.cxx.

Referenced by describe(), and match().


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