33{
34
35
36
37
38 const std::string FormulaSvc::name = "MultiDraw";
39
40
41
42 std::string
dbg (
const FormulaSvc& ,
unsigned )
43 {
44 return "FormulaSvc";
45 }
46
47
48
50 {
51 if (!
job.algsHas (FormulaSvc::name))
52 job.algsAdd (
new FormulaSvc);
53 }
54
55
56
58 {
60
62 =
dynamic_cast<FormulaSvc*
>(worker->
getAlg (FormulaSvc::name));
63 if (svc == 0)
64 throw std::runtime_error ("Job not configured for FormulaSvc support");
66 }
67
68
69
70 void FormulaSvc ::
71 testInvariant () const
72 {
73 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
74 {
76 }
77 }
78
79
80
81 FormulaSvc ::
82 FormulaSvc ()
84 {
86 }
87
88
89
90 FormulaSvc ::
91 ~FormulaSvc ()
92 {
94
95 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
96 {
98 }
99 }
100
101
102
103 const Formula *FormulaSvc ::
104 addForm (const std::string& formula)
105 {
108
109 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
110 {
111 if (m_vars[form]->formula() == formula)
113 }
115 std::ostringstream
name;
117 m_vars.push_back (
new Formula (
name.str(), formula, m_tree));
119 }
120
121
122
123 const char *FormulaSvc ::
124 GetName () const
125 {
128 }
129
130
131
133 changeInput (bool )
134 {
136
138
139 try
140 {
142 m_tree->ResetBit (TTree::kForceRead);
143
144 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
145 m_vars[form]->reset (m_tree);
146 } catch (...)
147 {
149 throw;
150 }
151
152 return EL::StatusCode::SUCCESS;
153 }
154
155
156
158 execute ()
159 {
161 if (wk()->treeEntry() != wk()->
tree()->GetReadEvent())
162 wk()->tree()->LoadTree (wk()->treeEntry());
164 return EL::StatusCode::SUCCESS;
165 }
166}
#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)
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...
ID3PD * m_tree
Pointer to the ID3PD object used.
Vars m_vars
All booked variables.
::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