ATLAS Offline Software
Formula.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 MULTI_DRAW_FORMULA_H
6 #define MULTI_DRAW_FORMULA_H
7 
8 // - 2012.
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 //protect
24 #include <MultiDraw/Global.h>
25 
26 #include <string>
27 #include <Rtypes.h>
28 
29 class TTree;
30 class TTreeFormula;
31 class TTreeFormulaManager;
32 
33 namespace MD
34 {
35  class Formula
36  {
37  //
38  // public interface
39  //
40 
43  public:
44  void testInvariant () const;
45 
46 
49  public:
50  Formula ();
51 
52 
56  public:
57  Formula (const std::string& name, const std::string& formula, TTree *tree);
58 
59 
62  public:
63  ~Formula ();
64 
65 
71  public:
72  void reset (TTree *tree);
73 
74 
77  public:
78  const std::string& formula () const;
79 
80 
83  public:
84  bool valid () const;
85 
86 
91  public:
92  int ndim () const;
93 
94 
100  public:
101  std::size_t ndata () const;
102 
103 
110  public:
111  Double_t value (std::size_t data) const;
112 
113 
114 
115  //
116  // private interface
117  //
118 
120  private:
121  std::string m_formula;
122 
124  private:
125  std::string m_name;
126 
128  private:
129  TTree *m_tree;
130 
132  private:
133  TTreeFormula *m_form;
134 
136  private:
137  TTreeFormulaManager *m_manager;
138 
141  private:
142  int m_ndim;
143 
145  private:
146  mutable Long64_t m_entry;
147 
149  private:
150  mutable Int_t m_ndata;
151 
153  private:
154  mutable std::vector<Double_t> m_cache;
155 
157  private:
158  mutable std::vector<bool> m_read;
159 
160 
162  private:
163  Formula (const Formula& that);
164  Formula& operator = (const Formula& that);
165  };
166 }
167 
168 #endif
MD::Formula::formula
const std::string & formula() const
description: the formula used guarantee: no-fail
Definition: Formula.cxx:140
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
MD::Formula::m_form
TTreeFormula * m_form
description the formula used
Definition: Formula.h:133
MD::Formula
Definition: Formula.h:36
Global.h
MD
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition: AlgCFlow.h:31
MD::Formula::m_name
std::string m_name
description: the name we use for the formula
Definition: Formula.h:125
MD::Formula::m_ndim
int m_ndim
description: the number of array dimensions we need to loop over, or -1 if we are in error
Definition: Formula.h:142
tree
TChain * tree
Definition: tile_monitor.h:30
MD::Formula::valid
bool valid() const
returns: whether the formula is valid guarantee: no-fail
Definition: Formula.cxx:149
MD::Formula::value
Double_t value(std::size_t data) const
returns: the result of evaluating the formula with the given index for the given data entry guarantee...
Definition: Formula.cxx:201
MD::Formula::ndata
std::size_t ndata() const
returns: the number of data entries for the formula with the given index guarantee: strong failures: ...
Definition: Formula.cxx:168
MD::Formula::Formula
Formula(const Formula &that)
rationale: to avoid broken objects
MD::Formula::~Formula
~Formula()
effects: standard destructor guarantee: no-fail
Definition: Formula.cxx:92
MD::Formula::m_cache
std::vector< Double_t > m_cache
description: the cache of data entries
Definition: Formula.h:154
MD::Formula::m_formula
std::string m_formula
description: members directly corresponding to accessors
Definition: Formula.h:121
MD::Formula::ndim
int ndim() const
returns: the number of unspecified array dimensions for the given formula guarantee: no-fail requires...
Definition: Formula.cxx:158
MD::Formula::m_entry
Long64_t m_entry
description: the last entry we read
Definition: Formula.h:146
MD::Formula::m_manager
TTreeFormulaManager * m_manager
description: the manager used
Definition: Formula.h:137
MD::Formula::operator=
Formula & operator=(const Formula &that)
MD::Formula::m_read
std::vector< bool > m_read
description: whether we read the given data entry
Definition: Formula.h:158
MD::Formula::Formula
Formula()
effects: standard default constructor guarantee: no-fail
Definition: Formula.cxx:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MD::Formula::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
Definition: Formula.cxx:37
MD::Formula::m_tree
TTree * m_tree
description: the tree we are connected to
Definition: Formula.h:129
MD::Formula::reset
void reset(TTree *tree)
effects: reset this formula to a new tree guarantee: strong failures: out of memory II failures: TTre...
Definition: Formula.cxx:103
MD::Formula::m_ndata
Int_t m_ndata
description: the number of data entries
Definition: Formula.h:150