ATLAS Offline Software
UnitTestAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef EVENT_LOOP_UNIT_TEST_ALG_H
6 #define EVENT_LOOP_UNIT_TEST_ALG_H
7 
8 //
9 // Distributed under the Boost Software License, Version 1.0.
10 // (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 // Please feel free to contact me (krumnack@iastate.edu) for bug
14 // reports, feature suggestions, praise and complaints.
15 
16 
20 
21 
22 
23 #include <EventLoopTest/Global.h>
24 
25 #include <EventLoop/Algorithm.h>
26 
27 class TBranch;
28 class TH1;
29 class TTree;
30 
31 namespace EL
32 {
33  class UnitTestAlg : public Algorithm
34  {
35  //
36  // public interface
37  //
38 
41  public:
42  void testInvariant () const;
43 
44 
49  public:
50  UnitTestAlg (const std::string& branchName = "el_n");
51 
52 
54  public:
55  bool makeOutput;
56 
57 
58 
59  //
60  // interface inherited from Algorithm
61  //
62 
71  private:
72  virtual StatusCode setupJob (Job& job) override;
73 
74 
80  private:
81  virtual StatusCode changeInput (bool firstFile) override;
82 
83 
94  private:
95  virtual StatusCode initialize () override;
96 
97  private:
98  virtual StatusCode histInitialize () override;
99 
100 
105  private:
106  virtual StatusCode execute () override;
107 
108 
115  private:
116  virtual StatusCode fileExecute () override;
117 
118 
126  private:
127  virtual StatusCode finalize () override;
128 
129 
136  private:
137  virtual StatusCode histFinalize () override;
138 
139 
140 
141  //
142  // private interface
143  //
144 
146  private:
147  std::string m_name;
148 
150  private:
151  TBranch *m_branch;
152 
154  private:
155  Int_t m_value;
156 
158  private:
159  // TH1 *m_hist; //!
160 
162  private:
163  TTree *m_tree;
164 
166  private:
167  std::string m_fileName;
168 
170  private:
172 
174  private:
176 
177  private:
178  unsigned m_calls = 0;
179 
180 #pragma GCC diagnostic push
181 #pragma GCC diagnostic ignored "-Wpragmas"
182 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
183 #pragma GCC diagnostic ignored "-Winconsistent-missing-override"
185 #pragma GCC diagnostic pop
186  };
187 }
188 
189 #endif
EL::UnitTestAlg::fileExecute
virtual StatusCode fileExecute() override
effects: do all the processing that needs to be done once per file guarantee: basic failures: algorit...
EL::UnitTestAlg::histFinalize
virtual StatusCode histFinalize() override
effects: this is a post-initialization routine that is called after finalize has been called.
EL::UnitTestAlg::histInitialize
virtual StatusCode histInitialize() override
effects: this is a pre-initialization routine that is called before changeInput is called.
EL::UnitTestAlg::changeInput
virtual StatusCode changeInput(bool firstFile) override
effects: do all changes to work with a new input file, e.g.
EL::UnitTestAlg::ClassDef
ClassDef(UnitTestAlg, 1)
EL::UnitTestAlg::m_hasInitialize
bool m_hasInitialize
whether initialize has been called
Definition: UnitTestAlg.h:171
EL::UnitTestAlg::makeOutput
bool makeOutput
description: whether I create an output n-tuple
Definition: UnitTestAlg.h:55
EL::UnitTestAlg::execute
virtual StatusCode execute() override
effects: process the next event guarantee: basic failures: algorithm dependent rationale: the virtual...
EL::UnitTestAlg::m_tree
TTree * m_tree
description: the histogram we are creating
Definition: UnitTestAlg.h:163
EL::Algorithm
Definition: Algorithm.h:22
EL::UnitTestAlg::finalize
virtual StatusCode finalize() override
effects: do everything that needs to be done after completing work on this worker guarantee: basic fa...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Algorithm.h
EL::UnitTestAlg::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
EL::UnitTestAlg::m_branch
TBranch * m_branch
description: the branch we are using
Definition: UnitTestAlg.h:151
EL::UnitTestAlg::setupJob
virtual StatusCode setupJob(Job &job) override
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::UnitTestAlg::m_value
Int_t m_value
description: the value we are reading from the branch
Definition: UnitTestAlg.h:155
EL::UnitTestAlg::m_hasHistInitialize
bool m_hasHistInitialize
whether histInitialize has been called
Definition: UnitTestAlg.h:175
EL::UnitTestAlg::m_fileName
std::string m_fileName
the name of the file (for testing changeInput)
Definition: UnitTestAlg.h:167
EL::UnitTestAlg::initialize
virtual StatusCode initialize() override
effects: do everything that needs to be done before running the algorithm, e.g.
TH1
Definition: rootspy.cxx:268
EL::UnitTestAlg::m_calls
unsigned m_calls
Definition: UnitTestAlg.h:178
EL::UnitTestAlg::UnitTestAlg
UnitTestAlg(const std::string &branchName="el_n")
effects: standard constructor.
EL::Job
Definition: Job.h:51
test_interactive_athena.job
job
Definition: test_interactive_athena.py:6
Global.h
EL::UnitTestAlg
Definition: UnitTestAlg.h:34
EL::UnitTestAlg::m_name
std::string m_name
description: the name of the variable we are using
Definition: UnitTestAlg.h:147