80 {
81 const EventContext &ctx = Gaudi::Hive::currentContext();
82
83
86
88 << eventInfo->runNumber() << ","
89 << eventInfo->eventNumber() << ":"
90 << eventInfo->timeStamp() << "]" );
91
92
93
94 if (1 != eventInfo->eventNumber()) {
95 ATH_MSG_DEBUG(
"Event NOT selected for creating conditions objects " );
96 return StatusCode::SUCCESS;
97 } else {
99 }
100
101
103
104
106
107
108 std::string
folder(
"/TILE/ONL01/FILTER/");
112
113
114 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
115 spec->extend(
"TileCalibBlobOfc",
"blob");
116
117
118 CondAttrListCollection* attrListColl = new CondAttrListCollection(true);
119
120 float zeroPhase(0.0);
121 TileOfcWeightsStruct weights;
124
125
130
131 std::vector<float>
phases;
133
134
135 coral::AttributeList ofcList(*spec);
136 coral::Blob&
blob = ofcList[
"TileCalibBlobOfc"].data<coral::Blob>();
137
139
142 }
143
144 int nPhases =
phases.size();
146
148 coolChannelCreated[drawerIdx] = true;
150
152
155
156 for (float phase : phases) {
158 for (int isam = 0; isam < ndig; isam++) {
162 if (objVersion == 3) {
165 }
166 }
167
168
170
171 msg(MSG::DEBUG) <<
" N Samples " << ndig
173 << " drawerIdx " << drawerIdx
176
177 msg(MSG::DEBUG) <<
"gain " <<
gain <<
" w_a, phase " <<
phase <<
" ";
178 for (int isam = 0; isam < ndig; ++isam)
179 msg(MSG::DEBUG) <<
" " << weights.
w_a[isam];
181
182 msg(MSG::DEBUG) <<
"gain " <<
gain <<
" w_b, phase " <<
phase <<
" ";
183 for (int isam = 0; isam < ndig; isam++)
184 msg(MSG::DEBUG) <<
" " << weights.
w_b[isam];
186
188 msg(MSG::DEBUG) <<
"gain " <<
gain <<
" w_c, phase " <<
phase <<
" ";
189 for (int isam = 0; isam < ndig; isam++)
190 msg(MSG::DEBUG) <<
" " << weights.
w_c[isam];
192 }
193
194 msg(MSG::DEBUG) <<
"gain " <<
gain <<
" g, phase " <<
phase <<
" ";
195 for (int isam = 0; isam < ndig; isam++)
196 msg(MSG::DEBUG) <<
" " << weights.
g[isam];
198
199 }
200
201 }
202 }
203
204
205 }
206
207
208 attrListColl->
add(drawerIdx, ofcList);
209
210
211 attrListColl->
add(drawerIdx, range);
212
214
215 }
216
217
220 if (coolChannelCreated[coolChannel]) continue;
221
222 coral::AttributeList ofcList(*spec);
223
224 attrListColl->
add(coolChannel, ofcList);
225 attrListColl->
add(coolChannel, range);
226 }
227 }
228
229 } else {
230
232
233
234 coral::AttributeList ofcList(*spec);
235 coral::Blob&
blob = ofcList[
"TileCalibBlobOfc"].data<coral::Blob>();
236
237
239
241 phases[channel] = (
float)
channel;
242
246 drawerOfc->setPhases(drawerIdx, 0, phases);
247
249
251
254 << " drawerIdx " << drawerIdx
255 << " channel " << channel
256 << " gain " << gain
257 << " phase " << phase );
258
261 << " ros " << ros
262 << " drawer " << drawer
263 << " channel " << channel
264 << " drawerIdx " << drawerIdx
265 << " gain " << gain
266 << " phase = " << phase );
267
268 double w_a_sum = 0, w_b_sum = 0, w_c_sum = 0;
269 for (int isam = 0; isam < ndig; isam++) {
272 <<
" w_a " << weights.
w_a[isam]
273 <<
" w_b " << weights.
w_b[isam]
274 <<
" w_c " << weights.
w_c[isam]
275 <<
" g " << weights.
g[isam] );
276
277 } else {
279 <<
" w_a " << weights.
w_a[isam]
280 <<
" w_b " << weights.
w_b[isam]
281 <<
" g " << weights.
g[isam] );
282
283 }
284
285 w_a_sum += weights.
w_a[isam];
286 w_b_sum += weights.
w_b[isam];
287 w_c_sum += weights.
w_c[isam];
288
289 drawerOfc->setOfc(0, drawerIdx, gain, channel, isam, weights.
w_a[isam]);
290 drawerOfc->setOfc(1, drawerIdx, gain, channel, isam, weights.
w_b[isam]);
292 drawerOfc->setOfc(2, drawerIdx, gain, channel, isam, weights.
w_c[isam]);
293 drawerOfc->setOfc(3, drawerIdx, gain, channel, isam, weights.
g[isam]);
294 } else {
295 drawerOfc->setOfc(2, drawerIdx, gain, channel, isam, weights.
g[isam]);
296 }
297 }
298
299 if (
m_of2)
ATH_MSG_DEBUG(
" *** SUM: a,b,c " << w_a_sum <<
" " << w_b_sum <<
" " << w_c_sum );
300
301 }
302 }
303
304
305 attrListColl->
add(drawerIdx, ofcList);
306
307
308 attrListColl->
add(drawerIdx, range);
309
310 }
311 }
313 }
314
315
316 coral::AttributeList attrList(*spec);
317 coral::Blob&
blob = attrList[
"TileCalibBlobOfc"].data<coral::Blob>();
323
325
327
328
330
331
332
333
335
337
338 return StatusCode::SUCCESS;
339}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
static const TileCalibDrawerCmt * getInstance(const coral::Blob &blob)
Returns a pointer to a const TileCalibDrawerCmt.
static TileCalibDrawerOfc * getInstance(coral::Blob &blob, uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
Returns a pointer to a non-const TileCalibDrawerOfc.
static const unsigned int MAX_DRAWERIDX
Maximal drawer index.
static const unsigned int MAX_ROS
Number of ROSs.
static const unsigned int MAX_GAIN
Number of gains per channel.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
static unsigned int getCommentChannel()
Returns the COOL channel number for the comment channel.
static const unsigned int MAX_CHAN
Number of channels in drawer.
std::set< std::string > m_folders
ToolHandle< ITileCondToolOfc > m_tileCondToolOfc
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ToolHandle< TileCondToolTiming > m_tileToolTiming
std::vector< unsigned int > m_drawerIdxs
StatusCode printCondObjects()
std::string getenv(const std::string &variableName)
get an environment variable