LDMX Software
framework::test::IsGoodHistogramFile Class Reference

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 correct_get_entries_
 Correct number of entries.
 

Detailed Description

Definition at line 194 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 205 of file FunctionalCoreTest.cxx.

int correct_get_entries_
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 232 of file FunctionalCoreTest.cxx.

232 {
233 std::ostringstream ss;
234 ss << "has the histogram 'TestAnalyzer/test_hist_' with the number of "
235 "entries "
237 return ss.str();
238 }

References correct_get_entries_.

◆ 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 214 of file FunctionalCoreTest.cxx.

214 {
215 // Open file
216 TFile* f = TFile::Open(filename.c_str());
217 if (!f) return false;
218 TDirectory* d = (TDirectory*)f->Get("TestAnalyzer");
219 if (!d) return false;
220 TH1F* h = (TH1F*)d->Get("test_hist_");
221 if (!h) return false;
222
223 return (h->GetEntries() == correct_get_entries_);
224 }

References correct_get_entries_.

Member Data Documentation

◆ correct_get_entries_

int framework::test::IsGoodHistogramFile::correct_get_entries_
private

Correct number of entries.

Definition at line 197 of file FunctionalCoreTest.cxx.

Referenced by describe(), and match().


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