ATLAS Offline Software
UnitTestAlg1.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_ALG1_H
6 #define EVENT_LOOP_UNIT_TEST_ALG1_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 UnitTestAlg1 : public Algorithm
34  {
35  //
36  // public interface
37  //
38 
41  public:
42  void testInvariant () const;
43 
44 
49  public:
50  UnitTestAlg1 (const std::string& branchName = "el_n");
51 
52 
54  public:
55  bool makeOutput;
56 
57 
59  public:
60  enum CallBack
61  {
70  };
71 
72 
73 
74  //
75  // interface inherited from Algorithm
76  //
77 
86  private:
87  virtual StatusCode setupJob (Job& job) override;
88 
89 
95  private:
96  virtual StatusCode changeInput (bool firstFile) override;
97 
98 
109  private:
110  virtual StatusCode initialize () override;
111 
112  private:
113  virtual StatusCode histInitialize () override;
114 
115 
120  private:
121  virtual StatusCode execute () override;
122 
123 
130  private:
131  virtual StatusCode fileExecute () override;
132 
133 
141  private:
142  virtual StatusCode finalize () override;
143 
144 
151  private:
152  virtual StatusCode histFinalize () override;
153 
154 
155 
156  //
157  // private interface
158  //
159 
161  private:
162  std::string m_name;
163 
165  private:
166  TBranch *m_branch;
167 
169  private:
170  Int_t m_value;
171 
173  private:
174  // TH1 *m_hist; //!
175 
177  private:
178  TTree *m_tree;
179 
181  private:
182  std::string m_fileName;
183 
185  private:
187 
189  private:
191 
192  private:
193  unsigned m_calls = 0;
194 
195  private:
196  TH1 *m_callbacks = nullptr;
197 
198  private:
200 
201 #pragma GCC diagnostic push
202 #pragma GCC diagnostic ignored "-Wpragmas"
203 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
204 #pragma GCC diagnostic ignored "-Winconsistent-missing-override"
206 #pragma GCC diagnostic pop
207  };
208 }
209 
210 #endif
EL::UnitTestAlg1::CB_CHANGE_INPUT_OTHER
@ CB_CHANGE_INPUT_OTHER
Definition: UnitTestAlg1.h:63
EL::UnitTestAlg1::CB_EXECUTE
@ CB_EXECUTE
Definition: UnitTestAlg1.h:66
EL::UnitTestAlg1::m_value
Int_t m_value
description: the value we are reading from the branch
Definition: UnitTestAlg1.h:170
EL::UnitTestAlg1::fileExecute
virtual StatusCode fileExecute() override
effects: do all the processing that needs to be done once per file guarantee: basic failures: algorit...
EL::UnitTestAlg1::m_hasInitialize
bool m_hasInitialize
whether initialize has been called
Definition: UnitTestAlg1.h:186
EL::UnitTestAlg1::finalize
virtual StatusCode finalize() override
effects: do everything that needs to be done after completing work on this worker guarantee: basic fa...
EL::UnitTestAlg1::m_callbacks
TH1 * m_callbacks
Definition: UnitTestAlg1.h:196
EL::UnitTestAlg1::UnitTestAlg1
UnitTestAlg1(const std::string &branchName="el_n")
effects: standard constructor.
EL::Algorithm
Definition: Algorithm.h:22
EL::UnitTestAlg1::histFinalize
virtual StatusCode histFinalize() override
effects: this is a post-initialization routine that is called after finalize has been called.
EL::UnitTestAlg1::m_hasHistInitialize
bool m_hasHistInitialize
whether histInitialize has been called
Definition: UnitTestAlg1.h:190
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Algorithm.h
EL::UnitTestAlg1::CallBack
CallBack
the various callbacks we use
Definition: UnitTestAlg1.h:61
EL::UnitTestAlg1::setupJob
virtual StatusCode setupJob(Job &job) override
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
EL::UnitTestAlg1::makeOutput
bool makeOutput
description: whether I create an output n-tuple
Definition: UnitTestAlg1.h:55
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::UnitTestAlg1::initialize
virtual StatusCode initialize() override
effects: do everything that needs to be done before running the algorithm, e.g.
EL::UnitTestAlg1::CB_HIST_INITIALIZE
@ CB_HIST_INITIALIZE
Definition: UnitTestAlg1.h:65
EL::UnitTestAlg1::execute
virtual StatusCode execute() override
effects: process the next event guarantee: basic failures: algorithm dependent rationale: the virtual...
EL::UnitTestAlg1::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
EL::UnitTestAlg1::CB_FINALIZE
@ CB_FINALIZE
Definition: UnitTestAlg1.h:68
EL::UnitTestAlg1::m_fileName
std::string m_fileName
the name of the file (for testing changeInput)
Definition: UnitTestAlg1.h:182
EL::UnitTestAlg1::m_branch
TBranch * m_branch
description: the branch we are using
Definition: UnitTestAlg1.h:166
EL::UnitTestAlg1
Definition: UnitTestAlg1.h:34
EL::UnitTestAlg1::CB_CHANGE_INPUT_FIRST
@ CB_CHANGE_INPUT_FIRST
Definition: UnitTestAlg1.h:62
EL::UnitTestAlg1::CB_INITIALIZE
@ CB_INITIALIZE
Definition: UnitTestAlg1.h:64
EL::UnitTestAlg1::m_tree
TTree * m_tree
description: the histogram we are creating
Definition: UnitTestAlg1.h:178
EL::UnitTestAlg1::histInitialize
virtual StatusCode histInitialize() override
effects: this is a pre-initialization routine that is called before changeInput is called.
TH1
Definition: rootspy.cxx:268
EL::UnitTestAlg1::CB_FILE_EXECUTE
@ CB_FILE_EXECUTE
Definition: UnitTestAlg1.h:67
EL::Job
Definition: Job.h:51
EL::UnitTestAlg1::m_calls
unsigned m_calls
Definition: UnitTestAlg1.h:193
test_interactive_athena.job
job
Definition: test_interactive_athena.py:6
EL::UnitTestAlg1::m_name
std::string m_name
description: the name of the variable we are using
Definition: UnitTestAlg1.h:162
EL::UnitTestAlg1::CB_HIST_FINALIZE
@ CB_HIST_FINALIZE
Definition: UnitTestAlg1.h:69
EL::UnitTestAlg1::ClassDef
ClassDef(UnitTestAlg1, 1)
Global.h
EL::UnitTestAlg1::changeInput
virtual StatusCode changeInput(bool firstFile) override
effects: do all changes to work with a new input file, e.g.
EL::UnitTestAlg1::getCallbacks
TH1 * getCallbacks()