38{
39
40
41
42
43 const std::string FormulaSvc::name = "MultiDraw";
44
45
46
47 std::string
dbg (
const FormulaSvc& ,
unsigned )
48 {
49 return "FormulaSvc";
50 }
51
52
53
55 {
56 if (!
job.algsHas (FormulaSvc::name))
57 job.algsAdd (
new FormulaSvc);
58 }
59
60
61
63 {
65
67 =
dynamic_cast<FormulaSvc*
>(worker->
getAlg (FormulaSvc::name));
68 if (svc == 0)
71 }
72
73
74
75 void FormulaSvc ::
76 testInvariant () const
77 {
79
80 for (std::size_t form = 0, end = m_vars.size(); form != end; ++ form)
81 {
83 }
84 }
85
86
87
88 FormulaSvc ::
89 FormulaSvc ()
90 : m_tree (0)
91 {
93 }
94
95
96
97 FormulaSvc ::
98 ~FormulaSvc ()
99 {
101
102 for (std::size_t form = 0, end = m_vars.size(); form != end; ++ form)
103 {
104 delete m_vars[form];
105 }
106 }
107
108
109
110 const Formula *FormulaSvc ::
111 addForm (const std::string& formula)
112 {
115
116 for (std::size_t form = 0, end = m_vars.size(); form != end; ++ form)
117 {
118 if (m_vars[form]->formula() == formula)
119 return m_vars[form];
120 }
122 std::ostringstream
name;
123 name <<
"var" << m_vars.size();
124 m_vars.push_back (
new Formula (
name.str(), formula, m_tree));
125 return m_vars.back();
126 }
127
128
129
130 const char *FormulaSvc ::
131 GetName () const
132 {
135 }
136
137
138
140 changeInput (bool )
141 {
143
144 m_tree = 0;
145
146 try
147 {
148 m_tree = wk()->tree();
149 m_tree->ResetBit (TTree::kForceRead);
150
151 for (std::size_t form = 0, end = m_vars.size(); form != end; ++ form)
152 m_vars[form]->reset (m_tree);
153 } catch (...)
154 {
155 m_tree = 0;
156 throw;
157 }
158
159 return EL::StatusCode::SUCCESS;
160 }
161
162
163
165 execute ()
166 {
168 if (wk()->treeEntry() != wk()->
tree()->GetReadEvent())
169 wk()->tree()->LoadTree (wk()->treeEntry());
171 return EL::StatusCode::SUCCESS;
172 }
173}
#define RCU_DESTROY_INVARIANT(x)
#define RCU_CHANGE_INVARIANT(x)
#define RCU_NEW_INVARIANT(x)
#define RCU_REQUIRE_SOFT(x)
#define RCU_READ_INVARIANT(x)
#define RCU_THROW_MSG(message)
the interface for algorithms to access IWorker
virtual EL::Algorithm * getAlg(const std::string &name) const =0
effects: returns the algorithms with the given name or NULL if there is none guarantee: strong failur...
::StatusCode StatusCode
StatusCode definition for legacy code.
AthROOTErrorHandlerSvc * svc
FormulaSvc * formulas(EL::IWorker *worker)
returns: the formula service for this worker guarantee: strong failures: formula service not configur...
void useFormulas(EL::Job &job)
effects: register the formula service for this job guarantee: strong failures: out of memory I