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

241 {
242 std::ostringstream ss;
243 ss << "has the histogram 'TestAnalyzer/test_hist_' with the number of "
244 "entries "
246 return ss.str();
247 }

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

223 {
224 // Open file
225 TFile* f = TFile::Open(filename.c_str());
226 if (!f) return false;
227 TDirectory* d = (TDirectory*)f->Get("TestAnalyzer");
228 if (!d) return false;
229 TH1F* h = (TH1F*)d->Get("test_hist_");
230 if (!h) return false;
231
232 return (h->GetEntries() == correct_get_entries_);
233 }

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

Referenced by describe(), and match().


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