ATLAS Offline Software
Loading...
Searching...
No Matches
LArConditionsTestAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
14
16
19
22#include "LArElecCalib/ILArOFC.h"
23
25
27
29// CONSTRUCTOR:
31
32LArConditionsTestAlg::LArConditionsTestAlg(const std::string& name, ISvcLocator* pSvcLocator) :
33 AthAlgorithm(name,pSvcLocator)
34{
35}
36
38// DESTRUCTOR:
40
43
45// INITIALIZE:
47
49{
50 ATH_MSG_DEBUG ( " TestCondObjs flag = " << m_testCondObjs );
51 ATH_MSG_DEBUG ( " ReadCondObjs flag = " << m_readCondObjs );
52 ATH_MSG_DEBUG ( " WriteCondObjs flag = " << m_writeCondObjs );
53 ATH_MSG_DEBUG ( " WriteCorrections flag = " << m_writeCorrections );
54 ATH_MSG_DEBUG ( " ApplyCorrections flag = " << m_applyCorrections );
55 ATH_MSG_DEBUG ( " TestReadDBDirect flag = " << m_testReadDB );
56 ATH_MSG_DEBUG ( " Testbeam flag = " << m_TB );
57
58 ATH_CHECK( detStore()->retrieve(m_onlineID) );
59
60 const CaloCell_ID* calocell_id = nullptr;
61 ATH_CHECK( detStore()->retrieve(calocell_id) );
62
63 ATH_MSG_DEBUG ( "initialize done" );
64 return StatusCode::SUCCESS;
65}
66
68// EXECUTE:
70
71StatusCode LArConditionsTestAlg::execute(const EventContext& /*ctx*/)
72{
73 if(m_testCondObjs){
74
75 // create cache
77 }
78
79
80 if(m_TB){
81 const ILArOFC* ofc = nullptr;
82 ATH_CHECK( detStore()->retrieve(ofc, "LArOFC") );
83
84 const ILArRamp* ramp = nullptr;
85 ATH_CHECK( detStore()->retrieve(ramp, "LArRamp") );
86 }
87
88 return StatusCode::SUCCESS;
89}
90
91
93// FINALIZE:
94// Note that it is NOT NECESSARY to run the finalize of individual
95// sub-algorithms. The framework takes care of it.
97
99{
101 return StatusCode::SUCCESS;
102}
103
104
105// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
106
107StatusCode
109{
110 // StatusCode sc;
111 ATH_MSG_INFO ("in createCompareObjects()" );
112
113 // Create set of ids, LArRampComplete::LArCondObj
114
115 std::vector<HWIdentifier>::const_iterator chanIt = m_onlineID->channel_begin();
116 std::vector<HWIdentifier>::const_iterator chanEnd = m_onlineID->channel_end();
117 int ichan = -1;
118 int icorr = 0;
119 float vramp = 0;
120 int gain = 0;
121 for (; chanIt != chanEnd; ++chanIt, ++ichan) {
122 // add channels with downscale factor
123 if (ichan % 1000 != 5) continue;
124
125 // Create ramp with 3 vRamp elements
126 LArRampPTmp ramp((*chanIt), gain);
127 ramp.m_vRamp.push_back(vramp);
128 vramp += 1.0;
129 ramp.m_vRamp.push_back(vramp);
130 vramp += 1.0;
131 ramp.m_vRamp.push_back(vramp);
132 vramp += 1.0;
133 // add to cache
134 m_rampCache.push_back(ramp);
135
136 // Change gain each time
137 gain = (gain == 2) ? 0 : gain + 1;
138
140 // Create downscaled corrections
141 ++icorr;
142 if (icorr % 10 != 5) continue;
143 // Just change sign of ramp values
144 for (unsigned int i = 0; i < 3; ++i)ramp.m_vRamp[i] = -ramp.m_vRamp[i];
145 m_rampCorrections.push_back(std::move(ramp));
146 }
147 }
148
149 // Print out cache and corrections
150 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
151 ATH_MSG_DEBUG ("Cache: chan, gain, ramps "
152 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
153 << m_rampCache[i].m_gain << " "
154 << m_rampCache[i].m_vRamp[0] << " "
155 << m_rampCache[i].m_vRamp[1] << " "
156 << m_rampCache[i].m_vRamp[2] << " " );
157 }
158 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
159 ATH_MSG_DEBUG ("Corrections: chan, gain, ramps "
160 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
161 << m_rampCorrections[i].m_gain << " "
162 << m_rampCorrections[i].m_vRamp[0] << " "
163 << m_rampCorrections[i].m_vRamp[1] << " "
164 << m_rampCorrections[i].m_vRamp[2] << " " );
165 }
166
167 ATH_MSG_DEBUG ( "End of create comparison objects " );
168 return StatusCode::SUCCESS;
169}
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
172
173inline bool operator == (const LArRampComplete::LArCondObj& r1, const LArRampPTmp& r2)
174{
175 // Comparison of two LArRampComplete::LArCondObj objects
176 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
177 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
178 if (r1.m_vRamp[i] != r2.m_vRamp[i]) return (false);
179 }
180 return (true);
181}
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
184
186{
187 // Comparison of two LArRampComplete::LArCondObj objects
188 if (r1.m_vRamp.size() != r2.m_vRamp.size()) return (false);
189 for (unsigned int i = 0; i < r1.m_vRamp.size(); ++i) {
190 if (r1.m_vRamp[i] != -r2.m_vRamp[i]) return (false);
191 }
192 return (true);
193}
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
196
197inline bool operator != (const LArRampComplete::LArCondObj& r1, const LArRampPTmp& r2)
198{
199 if(r1 == r2)return (false);
200 return (true);
201}
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
205
208{
209 ATH_MSG_INFO ("in testCondObjects()" );
210
211 static std::atomic<bool> first = true;
212 if (!first) {
213 ATH_MSG_INFO ("Multiple entries - returning" );
214 return StatusCode::SUCCESS;
215 }
216 first = false;
217
218 typedef LArRampMC::CONTAINER CONTAINER;
219 typedef CONTAINER::chan_const_iterator chan_const_iterator;
220 typedef CONTAINER::iov_const_iterator iov_const_iterator;
221
224
225 const LArRampMC* ramps = 0;
226
227 // Create SingleGroup
228 if (m_readCondObjs) {
229 const ILArRamp* iramps = 0;
230 ATH_CHECK( detStore()->retrieve(iramps, "/LArCalorimeter/LArTests/LArRampsSingleGroup") );
231 ATH_MSG_INFO ( "Retrieved ramps for LArRampsSingleGroup " );
232 ramps = dynamic_cast<const LArRampMC*>(iramps);
233 if (!ramps) {
234 ATH_MSG_ERROR ("Could not dynamic cast ILArRamp to LArRampMC" );
235 return( StatusCode::FAILURE);
236 }
237 }
238 else {
239 LArRampMC* ramps_rw = new LArRampMC;
240 ramps = ramps_rw;
241 ATH_MSG_INFO ( "Created ramps for LArRampsSingleGroup " );
243 ATH_CHECK( ramps_rw->initialize() );
244 }
245
246 ATH_CHECK( testEachCondObject(ramps) );
247 ATH_MSG_INFO ( "Succeeded SingleGroup test " );
248
249 if (!m_readCondObjs) {
250 // Save in DetectorStore
251 ATH_CHECK( detStore()->record(ramps, "/LArCalorimeter/LArTests/LArRampsSingleGroup") );
252
254 if (ramps) {
255 ATH_MSG_DEBUG ( "Total number of conditions objects"
256 << ramps->totalNumberOfConditions() );
257 }
258 if (!m_writeCondObjs) {
259 // Remove conditions objects if not writing out
260 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
261 if (!ramps_rw) {
262 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
263 return StatusCode::FAILURE;
264 }
265 ramps_rw->removeConditions();
266 ATH_MSG_DEBUG ( "Removed conditions objects" );
267 }
268 ATH_MSG_DEBUG ( "Total number of conditions objects "
269 << ramps->totalNumberOfConditions() );
270 ATH_MSG_DEBUG ( "Total number of correction objects"
271 << ramps->totalNumberOfCorrections() );
272 }
273
274 // Create SubDetectorGrouping
275 if (m_readCondObjs) {
276 const ILArRamp* iramps = 0;
277 ATH_CHECK( detStore()->retrieve(iramps, "/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping") );
278 ATH_MSG_INFO ( "Retrieved ramps for LArRampsSubDetectorGrouping " );
279 ramps = dynamic_cast<const LArRampMC*>(iramps);
280 if (!ramps) {
281 ATH_MSG_ERROR ("Could not dynamic cast ILArRamp to LArRampMC" );
282 return( StatusCode::FAILURE);
283 }
284 }
285 else {
286 LArRampMC* ramps_rw = new LArRampMC;
287 ramps = ramps_rw;
288 //ramps_rw->setGroupingType(LArConditionsContainerBase::SubDetectorGrouping);
289 ATH_CHECK( ramps_rw->initialize() );
290 }
291
292 ATH_CHECK( testEachCondObject(ramps) );
293 ATH_MSG_INFO ( "Succeeded SubDetectorGrouping test " );
294
295 if (!m_readCondObjs) {
296 // Save in DetectorStore
297 ATH_CHECK( detStore()->record(ramps, "/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping") );
299 if (ramps) {
300 ATH_MSG_DEBUG ( "Total number of conditions objects"
301 << ramps->totalNumberOfConditions() );
302 }
303 if (!m_writeCondObjs) {
304 // Remove conditions objects if not writing out
305 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
306 if (!ramps_rw) {
307 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
308 return StatusCode::FAILURE;
309 }
310 ramps_rw->removeConditions();
311 ATH_MSG_DEBUG ( "Removed conditions objects" );
312 }
313 ATH_MSG_DEBUG ( "Total number of conditions objects "
314 << ramps->totalNumberOfConditions() );
315 ATH_MSG_DEBUG ( "Total number of correction objects"
316 << ramps->totalNumberOfConditions() );
317 }
318
319 // Create FeedThroughGrouping
320 if (m_readCondObjs) {
321 const ILArRamp* iramps = 0;
322 ATH_CHECK( detStore()->retrieve(iramps, "/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping") );
323 ATH_MSG_INFO ( "Retrieved ramps for LArRampsFeedThroughGrouping " );
324 ramps = dynamic_cast<const LArRampMC*>(iramps);
325 if (!ramps) {
326 ATH_MSG_ERROR ("Could not dynamic cast ILArRamp to LArRampMC" );
327 return( StatusCode::FAILURE);
328 }
329 }
330 else {
331 LArRampMC* ramps_rw = new LArRampMC;
332 ramps = ramps_rw;
334 ATH_CHECK( ramps_rw->initialize() );
335 }
336
337 ATH_CHECK( testEachCondObject(ramps) );
338 ATH_MSG_INFO ( "Succeeded FeedThroughGrouping test " );
339
340 if (!m_readCondObjs) {
341 // Save in DetectorStore
342 ATH_CHECK( detStore()->record(ramps, "/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping") );
344 if (ramps) {
345 ATH_MSG_DEBUG ( "Total number of conditions objects"
346 << ramps->totalNumberOfConditions() );
347 }
348 if (!m_writeCondObjs) {
349 // Remove conditions objects if not writing out
350 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
351 if (!ramps_rw) {
352 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
353 return StatusCode::FAILURE;
354 }
355 ramps_rw->removeConditions();
356 ATH_MSG_DEBUG ( "Removed conditions objects" );
357 }
358 ATH_MSG_DEBUG ( "Total number of conditions objects "
359 << ramps->totalNumberOfConditions() );
360 ATH_MSG_DEBUG ( "Total number of correction objects"
361 << ramps->totalNumberOfCorrections() );
362 }
363
364 ATH_MSG_DEBUG ( "Statistics for LArRampsFeedThroughGrouping " );
365 ATH_MSG_DEBUG ( "Number of channels, iovs "
366 << ramps->chan_size() << " " << ramps->iov_size() );
367
368 iov_const_iterator iovIt = ramps->iov_begin();
369 iov_const_iterator iovEnd = ramps->iov_end ();
370 msg() << MSG::DEBUG << "IOVs found: ";
371 for (; iovIt != iovEnd; ++iovIt) {
372 msg() << MSG::DEBUG << (*iovIt) << ", ";
373 }
374 msg() << MSG::DEBUG << endmsg;
375
376 chan_const_iterator chIt = ramps->chan_begin();
377 chan_const_iterator chEnd = ramps->chan_end ();
378 for (; chIt != chEnd; ++chIt) {
379 ATH_MSG_DEBUG ( "Channel: " << (*chIt)
380 << " number of conditions: " << ramps->conditionsPerChannel((*chIt)) );
381 }
382
383 for (unsigned int i = 0; i < ramps->nGroups(); ++i) {
384 ATH_MSG_DEBUG ( "Group: " << i
385 << " number of conditions: " << ramps->conditionsPerGroup(i) );
386 }
387 ATH_MSG_DEBUG ("");
388
389 for (unsigned int i = 0; i < ramps->nGains(); ++i) {
390 ATH_MSG_DEBUG ( "Gain: " << i
391 << " number of conditions: " << ramps->conditionsPerGain(i) );
392 }
393 ATH_MSG_DEBUG ( "Total number of conditions objects "
394 << ramps->totalNumberOfConditions() );
395 ATH_MSG_DEBUG ( "Total number of correction objects "
396 << ramps->totalNumberOfCorrections() );
397
398
399 ATH_MSG_DEBUG ( "End of testCondObjects " );
400
401 return StatusCode::SUCCESS;
402}
403
404// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
405
406StatusCode
407LArConditionsTestAlg::testEachCondObject ATLAS_NOT_THREAD_SAFE (const LArRampMC* ramps)
408{
409 ATH_MSG_INFO ("in testEachCondObject()" );
410 bool error = false;
411
412 typedef LArRampMC::CONTAINER CONTAINER;
413 //typedef CONTAINER::ConstCorrectionIt ConstCorrectionIt;
414
415 // Cast into r/w for tests
416 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
417 if (!ramps_rw) {
418 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
419 return StatusCode::FAILURE;
420 }
421
422 if (ramps_rw->correctionsApplied())
423 ATH_CHECK(ramps_rw->undoCorrections());
424
425 if (!m_readCondObjs) {
426 if (m_writeCondObjs) {
427
428 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
429 ATH_MSG_DEBUG ("setPdata for chan, chan id, gain " << i << " "
430 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
431 << m_rampCache[i].m_gain << " " );
432
433 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
435 ramp.m_vRamp = m_rampCache[i].m_vRamp;
436
437 ramps_rw->setPdata(m_rampCache[i].m_channelID,
438 ramp,
439 m_rampCache[i].m_gain);
440 }
441 }
442
443 ATH_MSG_DEBUG ( "Finished conditions, now write corrections " );
444
445 if (m_writeCorrections) {
446 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
447
448 ATH_MSG_DEBUG ("insert corr for chan, chan id, gain " << i << " "
449 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
450 << m_rampCorrections[i].m_gain << " " );
451
452 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
454 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
455
456 ATH_CHECK( ramps_rw->insertCorrection(m_rampCorrections[i].m_channelID,
457 ramp,
458 m_rampCorrections[i].m_gain) );
459 }
460 }
461 }
462
463 ATH_MSG_DEBUG ("Number of channels, iovs "
464 << ramps->chan_size() << " " << ramps->iov_size() );
465
466 CONTAINER::chan_const_iterator chanIt1 = ramps->chan_begin();
467 CONTAINER::chan_const_iterator endChan1 = ramps->chan_end ();
468 for (unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++i) {
469 const CONTAINER::Subset* subset = ramps->at(i);
470 ATH_MSG_DEBUG ( "Index " << i
471 << " channel " << subset->channel()
472 << " gain " << subset->gain()
473 << " groupingType " << subset->groupingType()
474 << " subsetSize " << subset->subsetSize()
475 << " correctionVecSize " << subset->correctionVecSize() );
476 if ((*chanIt1) != subset->channel()) {
477 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
478 << i
479 << " multchan " << (*chanIt1)
480 << " subset " << subset->channel() );
481 error = true;
482 }
483 }
484
485 ATH_MSG_DEBUG ("Number of channels, iovs, subsets "
486 << ramps->chan_size() << " "
487 << ramps->iov_size() << " "
488 << ramps->size() << " " );
489
490 ATH_MSG_DEBUG ("Compare LArRampMC with cache " );
491 // Now loop over ramps and compare with cache
492 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
493
494 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCache[i].m_channelID,
495 m_rampCache[i].m_gain);
496 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
497 m_rampCache[i].m_gain);
498
499 if (!rampP.isEmpty()) {
500 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
501 << coolChannel << " "
502 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
503 << m_rampCache[i].m_gain << " "
504 << rampP.m_vRamp[0] << " "
505 << rampP.m_vRamp[1] << " "
506 << rampP.m_vRamp[2] << " " );
507 }
508 else {
509 ATH_MSG_DEBUG ("New : isEmpty " );
510 }
511 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
512 << coolChannel << " "
513 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
514 << m_rampCache[i].m_gain << " "
515 << m_rampCache[i].m_vRamp[0] << " "
516 << m_rampCache[i].m_vRamp[1] << " "
517 << m_rampCache[i].m_vRamp[2] << " "
518 << " Compare = " << (rampP == m_rampCache[i]) );
519 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
520 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
521 error = true;
522 }
523 }
524
525
526 // Now loop over ramps using generic iterator and compare with cache
527 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator " );
528 CONTAINER::ConstConditionsMapIterator rampIt;
529 CONTAINER::ConstConditionsMapIterator rampEnd;
530 for (unsigned int gain = 0; gain < 3; ++gain) {
531 rampIt = ramps->begin(gain);
532 rampEnd = ramps->end (gain);
533 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
534 // cache is not in order for gains, select the current gain
535 if (gain != m_rampCache[i].m_gain) continue;
537 HWIdentifier rampId;
538 while(rampIt != rampEnd) {
539 rampP = *rampIt;
540 rampId = rampIt.channelId();
541 ++rampIt;
542 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
543 }
544 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
545 m_rampCache[i].m_gain);
546 if (!rampP.isEmpty()) {
547 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
548 << coolChannel << " "
549 << m_onlineID->show_to_string(rampId) << " "
550 << m_rampCache[i].m_gain << " "
551 << rampP.m_vRamp[0] << " "
552 << rampP.m_vRamp[1] << " "
553 << rampP.m_vRamp[2] << " " );
554 }
555 else {
556 ATH_MSG_DEBUG ("New : isEmpty " );
557 }
558 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
559 << coolChannel << " "
560 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
561 << m_rampCache[i].m_gain << " "
562 << m_rampCache[i].m_vRamp[0] << " "
563 << m_rampCache[i].m_vRamp[1] << " "
564 << m_rampCache[i].m_vRamp[2] << " "
565 << " Compare = " << (rampP == m_rampCache[i]) );
566 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
567 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
568 error = true;
569 }
570 }
571 }
572
573
574
575 // Now loop over ramps in pieces using the selector on febids to
576 // iterate and compare with cache
577 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator and febid selection " );
578 // Loop over cache and divide the febids into three sets, where
579 // each set is an array of size 3 for the separate gains
580 std::vector<unsigned int> ids1[3];
581 std::vector<unsigned int> ids2[3];
582 std::vector<unsigned int> ids3[3];
583 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
584 if (i < m_rampCache.size()/3) {
585 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
586 ids1[m_rampCache[i].m_gain].push_back(id);
587 }
588 else if (i < 2*m_rampCache.size()/3) {
589 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
590 ids2[m_rampCache[i].m_gain].push_back(id);
591 }
592 else {
593 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
594 ids3[m_rampCache[i].m_gain].push_back(id);
595 }
596 }
597
598 for (unsigned int gain = 0; gain < 3; ++gain) {
599 for (unsigned int febSet = 0; febSet < 3; ++febSet) {
600 unsigned int i0 = 0;
601 unsigned int iend = m_rampCache.size()/3;
602 if (febSet < m_rampCache.size()/3) {
603 rampIt = ramps->begin(gain, ids1[gain]);
604 msg() << MSG::DEBUG <<"FebID vec 1 : ";
605 for (unsigned int i = 0; i < ids1[gain].size(); ++i) {
606 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids1[gain][i]))
607 << " ";
608 }
609 msg() << MSG::DEBUG << endmsg;
610 }
611 else if (febSet < 2*m_rampCache.size()/3) {
612 rampIt = ramps->begin(gain, ids2[gain]);
613 i0 = m_rampCache.size()/3 + 1;
614 iend = 2*m_rampCache.size()/3;
615 msg() << MSG::DEBUG <<"FebID vec 2 : ";
616 for (unsigned int i = 0; i < ids2[gain].size(); ++i) {
617 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids2[gain][i]))
618 << " ";
619 }
620 msg() << MSG::DEBUG << endmsg;
621 }
622 else {
623 rampIt = ramps->begin(gain, ids3[gain]);
624 i0 = 2*m_rampCache.size()/3 + 1;
625 iend = m_rampCache.size();
626 msg() << MSG::DEBUG <<"FebID vec 3 : ";
627 for (unsigned int i = 0; i < ids3[gain].size(); ++i) {
628 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids3[gain][i]))
629 << " ";
630 }
631 msg() << MSG::DEBUG << endmsg;
632 }
633
634 rampEnd = ramps->end (gain);
635 ATH_MSG_DEBUG ("After ramps->end " );
636 for (unsigned int i = i0; i < iend; ++i) {
637 // cache is not in order for gains, select the current gain
638 if (gain != m_rampCache[i].m_gain) continue;
640 HWIdentifier rampId;
641
642 ATH_MSG_DEBUG ("Looking for "
643 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) );
644
645 // Skip the empty channels
646 while(rampIt != rampEnd) {
647 rampP = *rampIt;
648 rampId = rampIt.channelId();
649 ++rampIt;
650 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
651 }
652 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
653 m_rampCache[i].m_gain);
654 if (!rampP.isEmpty()) {
655 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
656 << coolChannel << " "
657 << m_onlineID->show_to_string(rampId) << " "
658 << m_rampCache[i].m_gain << " "
659 << rampP.m_vRamp[0] << " "
660 << rampP.m_vRamp[1] << " "
661 << rampP.m_vRamp[2] << " " );
662 }
663 else {
664 ATH_MSG_DEBUG ("New : isEmpty " );
665 }
666 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
667 << coolChannel << " "
668 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
669 << m_rampCache[i].m_gain << " "
670 << m_rampCache[i].m_vRamp[0] << " "
671 << m_rampCache[i].m_vRamp[1] << " "
672 << m_rampCache[i].m_vRamp[2] << " "
673 << " Compare = " << (rampP == m_rampCache[i]) );
674 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
675 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
676 error = true;
677 }
678 }
679 }
680 }
681
682 ATH_MSG_DEBUG ("Compare LArRampMC with corrections " );
683
684 if (m_applyCorrections) {
685 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
686 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
687 m_rampCorrections[i].m_gain);
688 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
689 m_rampCorrections[i].m_gain);
690 if (!rampP.isEmpty()) {
691 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
692 << coolChannel << " "
693 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
694 << m_rampCorrections[i].m_gain << " "
695 << rampP.m_vRamp[0] << " "
696 << rampP.m_vRamp[1] << " "
697 << rampP.m_vRamp[2] << " " );
698 }
699 else {
700 ATH_MSG_DEBUG ("New : isEmpty " );
701 }
702
703 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
704 << coolChannel << " "
705 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
706 << m_rampCorrections[i].m_gain << " "
707 << m_rampCorrections[i].m_vRamp[0] << " "
708 << m_rampCorrections[i].m_vRamp[1] << " "
709 << m_rampCorrections[i].m_vRamp[2] << " "
710 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
711 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
712
713 ATH_MSG_ERROR ("Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
714 error = true;
715 }
716 }
717
718
719 ATH_MSG_DEBUG ("Apply corrections and compare LArRampMC with corrections " );
720 ATH_CHECK( ramps_rw->applyCorrections() );
721 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
722
723 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
724 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
725 m_rampCorrections[i].m_gain);
726 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
727 m_rampCorrections[i].m_gain);
728 if (!rampP.isEmpty()) {
729 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
730 << coolChannel << " "
731 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
732 << m_rampCorrections[i].m_gain << " "
733 << rampP.m_vRamp[0] << " "
734 << rampP.m_vRamp[1] << " "
735 << rampP.m_vRamp[2] << " " );
736 }
737 else {
738 ATH_MSG_DEBUG ("New : isEmpty " );
739 }
740 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
741 << coolChannel << " "
742 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
743 << m_rampCorrections[i].m_gain << " "
744 << m_rampCorrections[i].m_vRamp[0] << " "
745 << m_rampCorrections[i].m_vRamp[1] << " "
746 << m_rampCorrections[i].m_vRamp[2] << " "
747 << " Compare = " << (rampP == m_rampCorrections[i]) );
748 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
749 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
750 error = true;
751 }
752 }
753
754 ATH_MSG_DEBUG ("Undo corrections and compare LArRampMC with corrections " );
755 ATH_CHECK( ramps_rw->undoCorrections() );
756 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
757
758 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
759 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
760 m_rampCorrections[i].m_gain);
761 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
762 m_rampCorrections[i].m_gain);
763 if (!rampP.isEmpty()) {
764 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
765 << coolChannel << " "
766 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
767 << m_rampCorrections[i].m_gain << " "
768 << rampP.m_vRamp[0] << " "
769 << rampP.m_vRamp[1] << " "
770 << rampP.m_vRamp[2] << " " );
771 }
772 else {
773 ATH_MSG_DEBUG ("New : isEmpty " );
774 }
775 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
776 << coolChannel << " "
777 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
778 << m_rampCorrections[i].m_gain << " "
779 << m_rampCorrections[i].m_vRamp[0] << " "
780 << m_rampCorrections[i].m_vRamp[1] << " "
781 << m_rampCorrections[i].m_vRamp[2] << " "
782 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
783 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
784
785 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
786 error = true;
787 }
788 }
789
790 ATH_MSG_DEBUG ("2nd Apply corrections and compare LArRampMC with corrections " );
791 ATH_CHECK( ramps_rw->applyCorrections() );
792 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
793
794 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
795 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
796 m_rampCorrections[i].m_gain);
797 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
798 m_rampCorrections[i].m_gain);
799 if (!rampP.isEmpty()) {
800 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
801 << coolChannel << " "
802 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
803 << m_rampCorrections[i].m_gain << " "
804 << rampP.m_vRamp[0] << " "
805 << rampP.m_vRamp[1] << " "
806 << rampP.m_vRamp[2] << " " );
807 }
808 else {
809 ATH_MSG_DEBUG ("New : isEmpty " );
810 }
811 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
812 << coolChannel << " "
813 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
814 << m_rampCorrections[i].m_gain << " "
815 << m_rampCorrections[i].m_vRamp[0] << " "
816 << m_rampCorrections[i].m_vRamp[1] << " "
817 << m_rampCorrections[i].m_vRamp[2] << " "
818 << " Compare = " << (rampP == m_rampCorrections[i]) );
819 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
820 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
821 error = true;
822 }
823 }
824
825 ATH_MSG_DEBUG ("2nd Undo corrections and compare LArRampMC with corrections " );
826 ATH_CHECK( ramps_rw->undoCorrections() );
827 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
828
829 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
830 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
831 m_rampCorrections[i].m_gain);
832 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
833 m_rampCorrections[i].m_gain);
834 if (!rampP.isEmpty()) {
835 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
836 << coolChannel << " "
837 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
838 << m_rampCorrections[i].m_gain << " "
839 << rampP.m_vRamp[0] << " "
840 << rampP.m_vRamp[1] << " "
841 << rampP.m_vRamp[2] << " " );
842 }
843 else {
844 ATH_MSG_DEBUG ("New : isEmpty " );
845 }
846 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
847 << coolChannel << " "
848 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
849 << m_rampCorrections[i].m_gain << " "
850 << m_rampCorrections[i].m_vRamp[0] << " "
851 << m_rampCorrections[i].m_vRamp[1] << " "
852 << m_rampCorrections[i].m_vRamp[2] << " "
853 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
854 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
855
856 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
857 error = true;
858 }
859 }
860 }
861
862
863 /*
864 log << MSG::DEBUG <<"Find each correction "
865 << endmsg;
866
867 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
868 HWIdentifier id = m_rampCorrections[i].m_channelID;
869 unsigned int gain = m_rampCorrections[i].m_gain;
870
871 ConstCorrectionIt it = ramps->findCorrection(id, gain);
872 // May not have any corrections
873 if (it != ramps->correctionsEnd(gain)) {
874
875 unsigned int coolChannel = ramps->coolChannel(id, gain);
876 HWIdentifier id1((*it).first);
877 LArRampComplete::LArCondObj rampP = (*it).second;
878 if (id != id1 || rampP != m_rampCorrections[i]) {
879 log << MSG::ERROR <<"Correction retrieved with findCorrection does not match: "
880 << " i = " << i << endmsg;
881 error = true;
882 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
883 << coolChannel << " "
884 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
885 << m_rampCorrections[i].m_gain << " "
886 << rampP.m_vRamp[0] << " "
887 << rampP.m_vRamp[1] << " "
888 << rampP.m_vRamp[2] << " "
889 << endmsg;
890 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
891 << coolChannel << " "
892 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
893 << m_rampCorrections[i].m_gain << " "
894 << m_rampCorrections[i].m_vRamp[0] << " "
895 << m_rampCorrections[i].m_vRamp[1] << " "
896 << m_rampCorrections[i].m_vRamp[2] << " "
897 << " Compare = " << (rampP == m_rampCorrections[i])
898 << endmsg;
899 }
900 }
901 else {
902 log << MSG::DEBUG <<"No corrections found "
903 << endmsg;
904 }
905 }
906 log << MSG::DEBUG <<"End - Find each correction "
907 << endmsg;
908
909
910 // Count the number of corrections per gain
911 unsigned int gains[3] = {0,0,0};
912 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
913 unsigned int gain = m_rampCorrections[i].m_gain;
914 gains[gain]++;
915 }
916 for (unsigned int i = 0; i < 3; ++i) {
917 if (gains[i] != ramps->correctionsSize(i)) {
918 log << MSG::ERROR <<"Number of corrections not same as number inserted: "
919 << gains[i] << " "
920 << ramps->correctionsSize(i) << " gain " << i
921 << endmsg;
922 error = true;
923 }
924
925 // Check that each correction is the same using container iterator
926 unsigned int nit = 0;
927 ConstCorrectionIt it = ramps->correctionsBegin(i);
928 ConstCorrectionIt end = ramps->correctionsEnd(i);
929 unsigned int icorr = 0;
930 for (; it != end && icorr < m_rampCorrections.size(); ++it, ++nit, ++icorr) {
931 while (m_rampCorrections[icorr].m_gain != i) ++icorr;
932 HWIdentifier id = m_rampCorrections[icorr].m_channelID;
933 unsigned int gain = m_rampCorrections[icorr].m_gain;
934 unsigned int coolChannel = ramps->coolChannel(id, gain);
935 HWIdentifier id1((*it).first);
936 LArRampComplete::LArCondObj rampP = (*it).second;
937 if (id != id1 || rampP != m_rampCorrections[icorr]) {
938 log << MSG::ERROR <<"Correction retrieved with iterator does not match: "
939 << " gain = " << i
940 << " icorr = " << icorr
941 << " nit = " << nit
942 << endmsg;
943 error = true;
944 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
945 << coolChannel << " "
946 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
947 << m_rampCorrections[icorr].m_gain << " "
948 << rampP.m_vRamp[0] << " "
949 << rampP.m_vRamp[1] << " "
950 << rampP.m_vRamp[2] << " "
951 << endmsg;
952 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
953 << coolChannel << " "
954 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
955 << m_rampCorrections[icorr].m_gain << " "
956 << m_rampCorrections[icorr].m_vRamp[0] << " "
957 << m_rampCorrections[icorr].m_vRamp[1] << " "
958 << m_rampCorrections[icorr].m_vRamp[2] << " "
959 << " Compare = " << (rampP == m_rampCorrections[icorr])
960 << endmsg;
961 }
962 }
963 }
964
965 removed.
966 */
967
968 ATH_MSG_DEBUG ("Number of channels, iovs "
969 << ramps->chan_size() << " " << ramps->iov_size() );
970
971 std::set<unsigned int> channelNumbers;
972 CONTAINER::chan_const_iterator chanIt = ramps->chan_begin();
973 CONTAINER::chan_const_iterator endChan = ramps->chan_end ();
974 for (unsigned int i = 0; chanIt != endChan; ++chanIt, ++i) {
975 const CONTAINER::Subset* subset = ramps->at(i);
976 ATH_MSG_DEBUG ( "Index " << i
977 << " channel " << subset->channel()
978 << " gain " << subset->gain()
979 << " groupingType " << subset->groupingType()
980 << " subsetSize " << subset->subsetSize()
981 << " correctionVecSize " << subset->correctionVecSize() );
982 if ((*chanIt) != subset->channel()) {
983 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
984 << i
985 << " multchan " << (*chanIt)
986 << " subset " << subset->channel() );
987 error = true;
988 }
989 if (!(channelNumbers.insert(subset->channel()).second)) {
990 ATH_MSG_ERROR ( "Duplicate channel number - Index " << i
991 << " channel " << subset->channel() );
992 error = true;
993 }
994 }
995 ATH_MSG_DEBUG ( "Channel numbers size " << channelNumbers.size()
996 << " ramps size " << ramps->chan_size() );
997
998 if (error) {
999 ATH_MSG_ERROR ("Failing check of LArRamp - see above" );
1000 return (StatusCode::FAILURE);
1001 }
1002
1003 ATH_MSG_DEBUG ( "End of testEachCondObject " );
1004 return StatusCode::SUCCESS;
1005}
1006
1007// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1008
1011{
1012
1014 typedef ChanSet::ConstChannelIt ConstChannelIt;
1015
1016 ATH_MSG_INFO ("in testChannelSet" );
1017
1018 ChanSet chanSet;
1019
1020 // corrections not always available:
1022 // add corrections to channel set
1023 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
1024 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
1026 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
1027 chanSet.insert(m_rampCorrections[i].m_channelID.get_identifier32().get_compact(), ramp);
1028 }
1029 // Now loop over corrections and check that they agree
1030 bool error = false;
1031 if (m_rampCorrections.size() != chanSet.size()) {
1032 ATH_MSG_ERROR ("Corrections not the same size as channel set: "
1033 << m_rampCorrections.size() << " " << chanSet.size() );
1034 return (StatusCode::FAILURE);
1035 }
1036 else {
1037 ATH_MSG_DEBUG ("Sizes OK: " << chanSet.size() );
1038 }
1039
1040 ConstChannelIt it = chanSet.begin();
1041 ConstChannelIt itEnd = chanSet.end();
1042
1043
1044 unsigned int i = 0;
1045 for (; it != itEnd; ++it, ++i) {
1046
1047 HWIdentifier id = m_rampCorrections[i].m_channelID;
1048 HWIdentifier id1((*it).first);
1049 LArRampComplete::LArCondObj rampP = (*it).second;
1050 if (id != id1 || rampP != m_rampCorrections[i]) {
1051 ATH_MSG_ERROR ("Correction retrieved with iterator does not match: "
1052 << " i = " << i );
1053 error = true;
1054 }
1055 ATH_MSG_DEBUG ("New : chan id, gain, ramps "
1056 << m_onlineID->show_to_string(id1) << " "
1057 << m_rampCorrections[i].m_gain << " "
1058 << rampP.m_vRamp[0] << " "
1059 << rampP.m_vRamp[1] << " "
1060 << rampP.m_vRamp[2] << " "
1061 );
1062 ATH_MSG_DEBUG ("Corrections: chan id, gain, ramps "
1063 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
1064 << m_rampCorrections[i].m_gain << " "
1065 << m_rampCorrections[i].m_vRamp[0] << " "
1066 << m_rampCorrections[i].m_vRamp[1] << " "
1067 << m_rampCorrections[i].m_vRamp[2] << " "
1068 << " Compare = " << (rampP == m_rampCorrections[i])
1069 );
1070 }
1071 if (!error) {
1072 ATH_MSG_DEBUG ("Iteration check OK " );
1073 }
1074
1075 i = 0;
1076 for (; i < m_rampCorrections.size(); ++i) {
1077
1078 unsigned int id = m_rampCorrections[i].m_channelID.get_identifier32().get_compact();
1079 it = chanSet.find(id);
1080 if (it == itEnd) {
1081 ATH_MSG_ERROR ("Could not find correction: "
1082 << " i = " << i );
1083 error = true;
1084 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
1085 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
1086 << m_rampCorrections[i].m_gain << " "
1087 << m_rampCorrections[i].m_vRamp[0] << " "
1088 << m_rampCorrections[i].m_vRamp[1] << " "
1089 << m_rampCorrections[i].m_vRamp[2] << " "
1090 );
1091 }
1092 }
1093 if (!error) {
1094 ATH_MSG_DEBUG ("Find check OK " );
1095 }
1096
1097 if (error) {
1098 ATH_MSG_ERROR ("Failing check of channel set - see above" );
1099 return (StatusCode::FAILURE);
1100 }
1101 }
1102
1103 return StatusCode::SUCCESS;
1104
1105}
1106
1107
1109{
1110
1111 typedef LArRampMC::CONTAINER CONTAINER;
1112 typedef CONTAINER::Subset Subset;
1113
1114 const LArRampMC* ramp = 0 ;
1115 ATH_CHECK( detStore()->retrieve(ramp, "LArRamp") );
1116
1117 ATH_MSG_DEBUG ( " Found LArRampMC, key LArRamp." );
1118
1119 // Print out channels
1120 ATH_MSG_DEBUG ( " Number of channels " << ramp->chan_size() );
1121
1122 // Print out first 10 elements of each gain for subset
1123 CONTAINER::chan_const_iterator chanIt = ramp->chan_begin();
1124 CONTAINER::chan_const_iterator endChan = ramp->chan_end ();
1125 for (unsigned int i = 0; chanIt != endChan; ++chanIt, ++i) {
1126 unsigned int coolChan = *chanIt;
1127 const Subset* subset = ramp->at(i);
1128
1129 ATH_MSG_DEBUG ( " Channel " << coolChan << " "
1130 << " Subset size " << subset->subsetSize()
1131 << " gain, channel, grouping type " << subset->gain() << " "
1132 << MSG::hex << subset->channel() << " " << MSG::dec
1133 << subset->groupingType() << " "
1134 );
1135
1136 Subset::ConstSubsetIt first = subset->subsetBegin();
1137 Subset::ConstSubsetIt last = subset->subsetEnd();
1138 //for (int i = 0; i < 10 && first != last; ++i, ++first) {
1139 for (; first != last; ++first) {
1140
1141 // select non-zero subsets
1142 if ((*first).second.size()) {
1143
1144 ATH_MSG_DEBUG ( " FEB id "
1145 << m_onlineID->show_to_string(HWIdentifier((*first).first)) << " "
1146 );
1147 for (unsigned int k = 0; k < 5; ++k) {
1148 msg() << MSG::DEBUG << " vramp " ;
1149// << m_onlineID->show_to_string((*first).second[k].m_channelID) << " "
1150// << (*first).second[k].m_gain << " ";
1151 for (unsigned int j = 0; j < (*first).second[k].m_vRamp.size(); ++j) {
1152 msg() << MSG::DEBUG << (*first).second[k].m_vRamp[j] << " ";
1153 }
1154 msg() << MSG::DEBUG << endmsg;
1155 }
1156
1157 }
1158
1159 }
1160 }
1161
1162
1163 /*
1164
1165 // Print out first 10 elements of each gain for corrections
1166 for (unsigned int gain = 0; gain < 3; ++gain) {
1167 log << MSG::DEBUG << " Gain, size "
1168 << gain << " "
1169 << ramp->correctionsSize(gain) << endmsg;
1170 CONTAINER::ConstCorrectionIt first = ramp->correctionsBegin(gain);
1171 CONTAINER::ConstCorrectionIt last = ramp->correctionsEnd(gain);
1172 for (int i = 0; i < 10 && first != last; ++i, ++first) {
1173 log << MSG::DEBUG << " id, vramp "
1174 << m_onlineID->show_to_string(HWIdentifier((*first).first)) << " ";
1175// << m_onlineID->show_to_string((*first).second.m_channelID) << " "
1176// << (*first).second.m_gain << " ";
1177 for (unsigned int j = 0; j < (*first).second.m_vRamp.size(); ++j) {
1178 log << MSG::DEBUG << (*first).second.m_vRamp[j] << " ";
1179 }
1180 log << MSG::DEBUG << endmsg;
1181 }
1182 }
1183
1184 */
1185
1186 return StatusCode::SUCCESS;
1187
1188}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
Helpers for checking error return status codes and reporting errors.
This file defines the template class used for I/O of conditions data.
bool operator==(const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
bool operator!=(const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
bool CorrectionCompare(const LArRampComplete::LArCondObj &r1, const LArRampPTmp &r2)
This file contains an algorithm for testing lar conditions data access.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const ServiceHandle< StoreGateSvc > & detStore() const
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
template class for use for I/O of conditions data correction sets
void setGroupingType(GroupingType type)
allow group type to be set externally - need to (re)initialize after setting grouping type
void removeConditions()
Remove conditions leaving the corrections - may be needed to only write out the corrections when both...
StatusCode insertCorrection(HWIdentifier id, const T &cond, unsigned int gain, bool corrChannel=true)
access to corrections -
bool correctionsApplied() const
Have corrections been applied?
void setPdata(const HWIdentifier id, const T &payload, unsigned int gain=0)
put payload in persistent data
unsigned int coolChannel(const HWIdentifier id, unsigned int gain=0) const
Return the COOL channel number for a given online id and gain.
iov_const_iterator iov_begin() const
Access to IOVs via iterators - from MultChanCollection.
unsigned int nGroups() const
Number of groups - minimum is 2 (1 correction group, 1 FEB ID group).
StatusCode applyCorrections()
apply correction set
StatusCode undoCorrections()
undo corrections that have been already applied
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators - from MultChanCollection.
iov_const_iterator iov_end() const
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
unsigned int conditionsPerGain(unsigned int gain) const
Statistics: number of conditions per gain.
unsigned int conditionsPerChannel(unsigned int coolChannel) const
Statistics: number of conditions per COOL channel.
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
chan_size_type chan_size() const
number of channels - from MultChanCollection
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
unsigned int conditionsPerGroup(unsigned int group) const
Statistics: number of conditions per group.
iov_size_type iov_size() const
number of IOVs - from MultChanCollection
unsigned int totalNumberOfCorrections() const
Statistics: total number of corrections.
unsigned int totalNumberOfConditions() const
Statistics: total number of conditions.
chan_const_iterator chan_end() const
unsigned int nGains() const
Number of gain values.
BooleanProperty m_testCondObjs
BooleanProperty m_writeCorrections
BooleanProperty m_readCondObjs
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
std::vector< LArRampPTmp > m_rampCorrections
virtual StatusCode initialize() override
std::vector< LArRampPTmp > m_rampCache
BooleanProperty m_writeCondObjs
LArConditionsTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
const LArOnlineID * m_onlineID
virtual StatusCode finalize() override
BooleanProperty m_applyCorrections
Implementation of the interface ILArRamp for MC Derives from LArRampComplete, and implements the phi-...
Definition LArRampMC.h:22
LArRampComplete::CONTAINER CONTAINER
Definition LArRampMC.h:26
virtual StatusCode initialize()
Initialization done after creation or read back - derived classes may augment the functionality.
Definition LArRampMC.cxx:10
std::vector< float > m_vRamp
Definition LArRampP1.h:30
bool isEmpty() const
Definition LArRampP1.h:29
Persistent data for LArRamp Copied from LAr.
Definition LArRampPTmp.h:24
std::vector< float > m_vRamp
Definition LArRampPTmp.h:32
::StatusCode StatusCode
StatusCode definition for legacy code.
MsgStream & msg
Definition testRead.cxx:32