#include <EventLoopTest/UnitTestAlg2.h>
#include <EventLoop/Job.h>
#include <EventLoop/OutputStream.h>
#include <EventLoop/Worker.h>
#include <RootCoreUtils/Assert.h>
#include <RootCoreUtils/ThrowMsg.h>
#include <TEfficiency.h>
#include <TFile.h>
#include <TH1.h>
#include <TTree.h>
#include <TObjString.h>
#include <AsgMessaging/MsgStream.h>
#include <AsgMessaging/MsgStreamMacros.h>
Go to the source code of this file.
◆ ClassImp()
Definition at line 38 of file UnitTestAlg2.cxx.
43 testInvariant ()
const
51 UnitTestAlg2 (
const std::string&
name,
52 ISvcLocator* pSvcLocator)
53 : AnaAlgorithm (
name, pSvcLocator),
58 m_hasInitialize (false)
61 declareProperty (
"string_property", m_string_property,
"test string property");
74 getCallbacks()->Fill (CB_INITIALIZE);
80 ANA_CHECK (book (TEfficiency (
"efficiency",
"dummy efficiency hist", 50, 0, 50)));
81 (void) hist<TEfficiency> (
"efficiency");
82 (void) histeff (
"efficiency");
84 ANA_CHECK (book (
TH1F ((m_name +
"2_2").c_str(), m_name.c_str(), 50, 0, 50)));
85 ANA_CHECK (book (
TH1F (
"file_executes_2",
"file executes", 1, 0, 1)));
87 ANA_CHECK (book (
TH1F (
"test_property",
"test_property", 1, 0, 1)));
88 hist(
"test_property")->Fill (0.5, m_property);
96 wk()->addOutput (
new TH1F (m_name.c_str(), m_name.c_str(),
100 TFile *
file = wk()->getOutputFile (
"out");
101 m_tree =
new TTree (
"tree2",
"test output");
102 m_tree->SetDirectory (
file);
103 m_tree->Branch (m_name.c_str(), &m_value, (m_name +
"/I").c_str());
105 m_hasInitialize =
true;
106 return ::StatusCode::SUCCESS;
116 getCallbacks()->Fill (CB_EXECUTE);
124 m_branch = wk()->tree()->GetBranch (m_name.c_str());
127 m_branch->SetAddress (&m_value);
131 m_branch->GetEntry (wk()->treeEntry());
132 hist(m_name)->Fill (m_value);
136 msg().setLevel (MSG::INFO);
140 return ::StatusCode::SUCCESS;
150 getCallbacks()->Fill (CB_FINALIZE);
153 wk()->addOutput (
new TH1F (
"beta/dir/hist2",
"directory test", 10, 0, 10));
154 wk()->addOutputList (
"alpha2",
new TObjString (
"alpha2"));
155 return ::StatusCode::SUCCESS;
163 if (m_callbacks ==
nullptr)
165 m_callbacks =
new TH1F (
"callbacks2",
"callbacks", CB_FINALIZE + 1,
167 wk()->addOutput (m_callbacks);