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 {
74
75 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
76 {
78 }
79 }
80
81
82
83 FormulaSvc ::
84 FormulaSvc ()
86 {
88 }
89
90
91
92 FormulaSvc ::
93 ~FormulaSvc ()
94 {
96
97 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
98 {
100 }
101 }
102
103
104
105 const Formula *FormulaSvc ::
106 addForm (const std::string& formula)
107 {
110
111 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
112 {
113 if (m_vars[form]->formula() == formula)
115 }
117 std::ostringstream
name;
119 m_vars.push_back (
new Formula (
name.str(), formula, m_tree));
121 }
122
123
124
125 const char *FormulaSvc ::
126 GetName () const
127 {
130 }
131
132
133
135 changeInput (bool )
136 {
138
140
141 try
142 {
144 m_tree->ResetBit (TTree::kForceRead);
145
146 for (std::size_t form = 0, end =
m_vars.size(); form != end; ++ form)
147 m_vars[form]->reset (m_tree);
148 } catch (...)
149 {
151 throw;
152 }
153
154 return EL::StatusCode::SUCCESS;
155 }
156
157
158
160 execute ()
161 {
163 if (wk()->treeEntry() != wk()->
tree()->GetReadEvent())
164 wk()->tree()->LoadTree (wk()->treeEntry());
166 return EL::StatusCode::SUCCESS;
167 }
168}
#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