35 testInvariant ()
const
43 UnitTestAlg1 (
const std::string& branchName)
49 m_hasInitialize (
false),
50 m_hasHistInitialize (
false)
64 OutputStream out (
"out");
68 OutputStream out (
"out_empty");
71 return StatusCode::SUCCESS;
77 changeInput (
bool firstFile)
82 getCallbacks()->Fill (CB_CHANGE_INPUT_FIRST);
84 getCallbacks()->Fill (CB_CHANGE_INPUT_OTHER);
87 m_branch = wk()->tree()->GetBranch (m_name.c_str());
90 m_branch->SetAddress (&m_value);
92 m_fileName = wk()->inputFile()->GetName();
93 return StatusCode::SUCCESS;
103 getCallbacks()->Fill (CB_HIST_INITIALIZE);
107 book (TH1F ((m_name +
"2").c_str(), m_name.c_str(), 50, 0, 50));
108 book (TH1F (
"file_executes",
"file executes", 1, 0, 1));
109 m_hasHistInitialize =
true;
110 return StatusCode::SUCCESS;
120 getCallbacks()->Fill (CB_INITIALIZE);
134 wk()->addOutput (
new TH1F (m_name.c_str(), m_name.c_str(),
138 TFile *
file = wk()->getOutputFile (
"out");
139 m_tree =
new TTree (
"tree",
"test output");
140 m_tree->SetDirectory (
file);
141 m_tree->Branch (m_name.c_str(), &m_value, (m_name +
"/I").c_str());
143 m_hasInitialize =
true;
144 return StatusCode::SUCCESS;
154 getCallbacks()->Fill (CB_FILE_EXECUTE);
157 hist (
"file_executes")->Fill (0);
158 return StatusCode::SUCCESS;
168 getCallbacks()->Fill (CB_EXECUTE);
172 m_branch->GetEntry (wk()->treeEntry());
173 hist(m_name)->Fill (m_value);
177 setMsgLevel (MSG::INFO);
181 return StatusCode::SUCCESS;
191 getCallbacks()->Fill (CB_FINALIZE);
194 wk()->addOutput (
new TH1F (
"beta/dir/hist",
"directory test", 10, 0, 10));
195 wk()->addOutputList (
"alpha",
new TObjString (
"alpha"));
196 return StatusCode::SUCCESS;
206 getCallbacks()->Fill (CB_HIST_FINALIZE);
209 wk()->addOutput (
new TH1F (
"beta/dir/hist",
"directory test", 10, 0, 10));
210 wk()->addOutputList (
"alpha",
new TObjString (
"alpha"));
211 return StatusCode::SUCCESS;
219 if (m_callbacks ==
nullptr)
221 m_callbacks =
new TH1F (
"callbacks",
"callbacks", CB_HIST_FINALIZE + 1,
222 0, CB_HIST_FINALIZE + 1);
223 wk()->addOutput (m_callbacks);