ATLAS Offline Software
UnitTestSkim.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 // Please feel free to contact me (krumnack@iastate.edu) for bug
11 // reports, feature suggestions, praise and complaints.
12 
13 
14 //
15 // includes
16 //
17 
19 
20 #include <TTree.h>
21 #include <RootCoreUtils/Assert.h>
22 #include <EventLoop/StatusCode.h>
23 #include <EventLoop/IWorker.h>
25 
26 //
27 // method implementations
28 //
29 
30 namespace EL
31 {
33  testInvariant () const
34  {
35  RCU_INVARIANT (this != 0);
36  }
37 
38 
39 
42  {
43  RCU_NEW_INVARIANT (this);
44  }
45 
46 
47 
49  changeInput (bool /*firstFile*/)
50  {
51  RCU_CHANGE_INVARIANT (this);
52  wk()->tree()->SetBranchAddress ("el_n", &el_n);
53  return StatusCode::SUCCESS;
54  }
55 
56 
57 
59  initialize ()
60  {
61  RCU_CHANGE_INVARIANT (this);
62 
63  m_skim = getNTupleSvc (wk(), "output");
64  m_skim->tree()->Branch ("el_n2", &el_n2, "el_n2/I");
65 
66  return StatusCode::SUCCESS;
67  }
68 
69 
70 
72  execute ()
73  {
74  RCU_CHANGE_INVARIANT (this);
75 
76  wk()->tree()->GetEntry (wk()->treeEntry());
77  el_n2 = el_n * el_n;
78 
79  return StatusCode::SUCCESS;
80  }
81 }
EL::UnitTestSkim::el_n2
Int_t el_n2
description: the member we write from
Definition: UnitTestSkim.h:100
EL::UnitTestSkim::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
Definition: UnitTestSkim.cxx:33
UnitTestSkim.h
Assert.h
EL::NTupleSvc::tree
TTree * tree() const
returns: the tree we are writing out guarantee: no-fail requires(soft): initialize() has been called ...
NTupleSvc.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::Algorithm::wk
IWorker * wk() const
description: the worker that is controlling us guarantee: no-fail
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
EL::UnitTestSkim::UnitTestSkim
UnitTestSkim()
effects: standard default constructor guarantee: strong failures: out of memory I
Definition: UnitTestSkim.cxx:41
EL::UnitTestSkim::m_skim
NTupleSvc * m_skim
description: the output algorithm we use
Definition: UnitTestSkim.h:92
EL::UnitTestSkim::execute
virtual StatusCode execute()
effects: process the next event guarantee: basic failures: algorithm dependent rationale: the virtual...
Definition: UnitTestSkim.cxx:72
EL::UnitTestSkim::changeInput
virtual StatusCode changeInput(bool firstFile)
effects: do all changes to work with a new input file, e.g.
Definition: UnitTestSkim.cxx:49
StatusCode.h
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition: Assert.h:231
EL::UnitTestSkim::initialize
virtual StatusCode initialize()
effects: do everything that needs to be done before running the algorithm, e.g.
Definition: UnitTestSkim.cxx:59
IWorker.h
EL::UnitTestSkim::el_n
Int_t el_n
description: the member we read into
Definition: UnitTestSkim.h:96
EL::IWorker::tree
virtual TTree * tree() const =0
description: the tree we are running on guarantee: no-fail
EL::getNTupleSvc
NTupleSvc * getNTupleSvc(IWorker *worker, const std::string &outputStream, const std::string &treeName="")
effects: get the skimming algorithm for the given output for this worker guarantee: strong failures: ...
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233