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
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
206StatusCode
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 const ILArRamp* iramps = 0;
253 ATH_CHECK( detStore()->symLink(ramps, iramps) );
254
256 if (ramps) {
257 ATH_MSG_DEBUG ( "Total number of conditions objects"
258 << ramps->totalNumberOfConditions() );
259 }
260 if (!m_writeCondObjs) {
261 // Remove conditions objects if not writing out
262 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
263 if (!ramps_rw) {
264 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
265 return StatusCode::FAILURE;
266 }
267 ramps_rw->removeConditions();
268 ATH_MSG_DEBUG ( "Removed conditions objects" );
269 }
270 ATH_MSG_DEBUG ( "Total number of conditions objects "
271 << ramps->totalNumberOfConditions() );
272 ATH_MSG_DEBUG ( "Total number of correction objects"
273 << ramps->totalNumberOfCorrections() );
274 }
275
276 // Create SubDetectorGrouping
277 if (m_readCondObjs) {
278 const ILArRamp* iramps = 0;
279 ATH_CHECK( detStore()->retrieve(iramps, "/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping") );
280 ATH_MSG_INFO ( "Retrieved ramps for LArRampsSubDetectorGrouping " );
281 ramps = dynamic_cast<const LArRampMC*>(iramps);
282 if (!ramps) {
283 ATH_MSG_ERROR ("Could not dynamic cast ILArRamp to LArRampMC" );
284 return( StatusCode::FAILURE);
285 }
286 }
287 else {
288 LArRampMC* ramps_rw = new LArRampMC;
289 ramps = ramps_rw;
290 //ramps_rw->setGroupingType(LArConditionsContainerBase::SubDetectorGrouping);
291 ATH_CHECK( ramps_rw->initialize() );
292 }
293
294 ATH_CHECK( testEachCondObject(ramps) );
295 ATH_MSG_INFO ( "Succeeded SubDetectorGrouping test " );
296
297 if (!m_readCondObjs) {
298 // Save in DetectorStore
299 ATH_CHECK( detStore()->record(ramps, "/LArCalorimeter/LArTests/LArRampsSubDetectorGrouping") );
300 const ILArRamp* iramps = 0;
301 ATH_CHECK( detStore()->symLink(ramps, iramps) );
303 if (ramps) {
304 ATH_MSG_DEBUG ( "Total number of conditions objects"
305 << ramps->totalNumberOfConditions() );
306 }
307 if (!m_writeCondObjs) {
308 // Remove conditions objects if not writing out
309 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
310 if (!ramps_rw) {
311 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
312 return StatusCode::FAILURE;
313 }
314 ramps_rw->removeConditions();
315 ATH_MSG_DEBUG ( "Removed conditions objects" );
316 }
317 ATH_MSG_DEBUG ( "Total number of conditions objects "
318 << ramps->totalNumberOfConditions() );
319 ATH_MSG_DEBUG ( "Total number of correction objects"
320 << ramps->totalNumberOfConditions() );
321 }
322
323 // Create FeedThroughGrouping
324 if (m_readCondObjs) {
325 const ILArRamp* iramps = 0;
326 ATH_CHECK( detStore()->retrieve(iramps, "/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping") );
327 ATH_MSG_INFO ( "Retrieved ramps for LArRampsFeedThroughGrouping " );
328 ramps = dynamic_cast<const LArRampMC*>(iramps);
329 if (!ramps) {
330 ATH_MSG_ERROR ("Could not dynamic cast ILArRamp to LArRampMC" );
331 return( StatusCode::FAILURE);
332 }
333 }
334 else {
335 LArRampMC* ramps_rw = new LArRampMC;
336 ramps = ramps_rw;
338 ATH_CHECK( ramps_rw->initialize() );
339 }
340
341 ATH_CHECK( testEachCondObject(ramps) );
342 ATH_MSG_INFO ( "Succeeded FeedThroughGrouping test " );
343
344 if (!m_readCondObjs) {
345 // Save in DetectorStore
346 ATH_CHECK( detStore()->record(ramps, "/LArCalorimeter/LArTests/LArRampsFeedThroughGrouping") );
347 const ILArRamp* iramps = 0;
348 ATH_CHECK( detStore()->symLink(ramps, iramps) );
350 if (ramps) {
351 ATH_MSG_DEBUG ( "Total number of conditions objects"
352 << ramps->totalNumberOfConditions() );
353 }
354 if (!m_writeCondObjs) {
355 // Remove conditions objects if not writing out
356 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
357 if (!ramps_rw) {
358 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
359 return StatusCode::FAILURE;
360 }
361 ramps_rw->removeConditions();
362 ATH_MSG_DEBUG ( "Removed conditions objects" );
363 }
364 ATH_MSG_DEBUG ( "Total number of conditions objects "
365 << ramps->totalNumberOfConditions() );
366 ATH_MSG_DEBUG ( "Total number of correction objects"
367 << ramps->totalNumberOfCorrections() );
368 }
369
370 ATH_MSG_DEBUG ( "Statistics for LArRampsFeedThroughGrouping " );
371 ATH_MSG_DEBUG ( "Number of channels, iovs "
372 << ramps->chan_size() << " " << ramps->iov_size() );
373
374 iov_const_iterator iovIt = ramps->iov_begin();
375 iov_const_iterator iovEnd = ramps->iov_end ();
376 msg() << MSG::DEBUG << "IOVs found: ";
377 for (; iovIt != iovEnd; ++iovIt) {
378 msg() << MSG::DEBUG << (*iovIt) << ", ";
379 }
380 msg() << MSG::DEBUG << endmsg;
381
382 chan_const_iterator chIt = ramps->chan_begin();
383 chan_const_iterator chEnd = ramps->chan_end ();
384 for (; chIt != chEnd; ++chIt) {
385 ATH_MSG_DEBUG ( "Channel: " << (*chIt)
386 << " number of conditions: " << ramps->conditionsPerChannel((*chIt)) );
387 }
388
389 for (unsigned int i = 0; i < ramps->nGroups(); ++i) {
390 ATH_MSG_DEBUG ( "Group: " << i
391 << " number of conditions: " << ramps->conditionsPerGroup(i) );
392 }
393 ATH_MSG_DEBUG ("");
394
395 for (unsigned int i = 0; i < ramps->nGains(); ++i) {
396 ATH_MSG_DEBUG ( "Gain: " << i
397 << " number of conditions: " << ramps->conditionsPerGain(i) );
398 }
399 ATH_MSG_DEBUG ( "Total number of conditions objects "
400 << ramps->totalNumberOfConditions() );
401 ATH_MSG_DEBUG ( "Total number of correction objects "
402 << ramps->totalNumberOfCorrections() );
403
404
405 ATH_MSG_DEBUG ( "End of testCondObjects " );
406
407 return StatusCode::SUCCESS;
408}
409
410// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
411
412StatusCode
413LArConditionsTestAlg::testEachCondObject ATLAS_NOT_THREAD_SAFE (const LArRampMC* ramps)
414{
415 ATH_MSG_INFO ("in testEachCondObject()" );
416 bool error = false;
417
418 typedef LArRampMC::CONTAINER CONTAINER;
419 //typedef CONTAINER::ConstCorrectionIt ConstCorrectionIt;
420
421 // Cast into r/w for tests
422 LArRampMC* ramps_rw = const_cast<LArRampMC*>(ramps);
423 if (!ramps_rw) {
424 ATH_MSG_ERROR ( "Could not const cast to LArRampMC " );
425 return StatusCode::FAILURE;
426 }
427
428 if (ramps_rw->correctionsApplied())
429 ATH_CHECK(ramps_rw->undoCorrections());
430
431 if (!m_readCondObjs) {
432 if (m_writeCondObjs) {
433
434 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
435 ATH_MSG_DEBUG ("setPdata for chan, chan id, gain " << i << " "
436 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
437 << m_rampCache[i].m_gain << " " );
438
439 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
441 ramp.m_vRamp = m_rampCache[i].m_vRamp;
442
443 ramps_rw->setPdata(m_rampCache[i].m_channelID,
444 ramp,
445 m_rampCache[i].m_gain);
446 }
447 }
448
449 ATH_MSG_DEBUG ( "Finished conditions, now write corrections " );
450
451 if (m_writeCorrections) {
452 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
453
454 ATH_MSG_DEBUG ("insert corr for chan, chan id, gain " << i << " "
455 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
456 << m_rampCorrections[i].m_gain << " " );
457
458 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
460 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
461
462 ATH_CHECK( ramps_rw->insertCorrection(m_rampCorrections[i].m_channelID,
463 ramp,
464 m_rampCorrections[i].m_gain) );
465 }
466 }
467 }
468
469 ATH_MSG_DEBUG ("Number of channels, iovs "
470 << ramps->chan_size() << " " << ramps->iov_size() );
471
472 CONTAINER::chan_const_iterator chanIt1 = ramps->chan_begin();
473 CONTAINER::chan_const_iterator endChan1 = ramps->chan_end ();
474 for (unsigned int i = 0; chanIt1 != endChan1; ++chanIt1, ++i) {
475 const CONTAINER::Subset* subset = ramps->at(i);
476 ATH_MSG_DEBUG ( "Index " << i
477 << " channel " << subset->channel()
478 << " gain " << subset->gain()
479 << " groupingType " << subset->groupingType()
480 << " subsetSize " << subset->subsetSize()
481 << " correctionVecSize " << subset->correctionVecSize() );
482 if ((*chanIt1) != subset->channel()) {
483 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
484 << i
485 << " multchan " << (*chanIt1)
486 << " subset " << subset->channel() );
487 error = true;
488 }
489 }
490
491 ATH_MSG_DEBUG ("Number of channels, iovs, subsets "
492 << ramps->chan_size() << " "
493 << ramps->iov_size() << " "
494 << ramps->size() << " " );
495
496 ATH_MSG_DEBUG ("Compare LArRampMC with cache " );
497 // Now loop over ramps and compare with cache
498 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
499
500 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCache[i].m_channelID,
501 m_rampCache[i].m_gain);
502 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
503 m_rampCache[i].m_gain);
504
505 if (!rampP.isEmpty()) {
506 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
507 << coolChannel << " "
508 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
509 << m_rampCache[i].m_gain << " "
510 << rampP.m_vRamp[0] << " "
511 << rampP.m_vRamp[1] << " "
512 << rampP.m_vRamp[2] << " " );
513 }
514 else {
515 ATH_MSG_DEBUG ("New : isEmpty " );
516 }
517 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
518 << coolChannel << " "
519 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
520 << m_rampCache[i].m_gain << " "
521 << m_rampCache[i].m_vRamp[0] << " "
522 << m_rampCache[i].m_vRamp[1] << " "
523 << m_rampCache[i].m_vRamp[2] << " "
524 << " Compare = " << (rampP == m_rampCache[i]) );
525 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
526 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
527 error = true;
528 }
529 }
530
531
532 // Now loop over ramps using generic iterator and compare with cache
533 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator " );
534 CONTAINER::ConstConditionsMapIterator rampIt;
535 CONTAINER::ConstConditionsMapIterator rampEnd;
536 for (unsigned int gain = 0; gain < 3; ++gain) {
537 rampIt = ramps->begin(gain);
538 rampEnd = ramps->end (gain);
539 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
540 // cache is not in order for gains, select the current gain
541 if (gain != m_rampCache[i].m_gain) continue;
543 HWIdentifier rampId;
544 while(rampIt != rampEnd) {
545 rampP = *rampIt;
546 rampId = rampIt.channelId();
547 ++rampIt;
548 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
549 }
550 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
551 m_rampCache[i].m_gain);
552 if (!rampP.isEmpty()) {
553 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
554 << coolChannel << " "
555 << m_onlineID->show_to_string(rampId) << " "
556 << m_rampCache[i].m_gain << " "
557 << rampP.m_vRamp[0] << " "
558 << rampP.m_vRamp[1] << " "
559 << rampP.m_vRamp[2] << " " );
560 }
561 else {
562 ATH_MSG_DEBUG ("New : isEmpty " );
563 }
564 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
565 << coolChannel << " "
566 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
567 << m_rampCache[i].m_gain << " "
568 << m_rampCache[i].m_vRamp[0] << " "
569 << m_rampCache[i].m_vRamp[1] << " "
570 << m_rampCache[i].m_vRamp[2] << " "
571 << " Compare = " << (rampP == m_rampCache[i]) );
572 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
573 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
574 error = true;
575 }
576 }
577 }
578
579
580
581 // Now loop over ramps in pieces using the selector on febids to
582 // iterate and compare with cache
583 ATH_MSG_DEBUG ("Compare LArRampMC with cache using iterator and febid selection " );
584 // Loop over cache and divide the febids into three sets, where
585 // each set is an array of size 3 for the separate gains
586 std::vector<unsigned int> ids1[3];
587 std::vector<unsigned int> ids2[3];
588 std::vector<unsigned int> ids3[3];
589 for (unsigned int i = 0; i < m_rampCache.size(); ++i) {
590 if (i < m_rampCache.size()/3) {
591 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
592 ids1[m_rampCache[i].m_gain].push_back(id);
593 }
594 else if (i < 2*m_rampCache.size()/3) {
595 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
596 ids2[m_rampCache[i].m_gain].push_back(id);
597 }
598 else {
599 unsigned int id = m_onlineID->feb_Id(m_rampCache[i].m_channelID).get_identifier32().get_compact();
600 ids3[m_rampCache[i].m_gain].push_back(id);
601 }
602 }
603
604 for (unsigned int gain = 0; gain < 3; ++gain) {
605 for (unsigned int febSet = 0; febSet < 3; ++febSet) {
606 unsigned int i0 = 0;
607 unsigned int iend = m_rampCache.size()/3;
608 if (febSet < m_rampCache.size()/3) {
609 rampIt = ramps->begin(gain, ids1[gain]);
610 msg() << MSG::DEBUG <<"FebID vec 1 : ";
611 for (unsigned int i = 0; i < ids1[gain].size(); ++i) {
612 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids1[gain][i]))
613 << " ";
614 }
615 msg() << MSG::DEBUG << endmsg;
616 }
617 else if (febSet < 2*m_rampCache.size()/3) {
618 rampIt = ramps->begin(gain, ids2[gain]);
619 i0 = m_rampCache.size()/3 + 1;
620 iend = 2*m_rampCache.size()/3;
621 msg() << MSG::DEBUG <<"FebID vec 2 : ";
622 for (unsigned int i = 0; i < ids2[gain].size(); ++i) {
623 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids2[gain][i]))
624 << " ";
625 }
626 msg() << MSG::DEBUG << endmsg;
627 }
628 else {
629 rampIt = ramps->begin(gain, ids3[gain]);
630 i0 = 2*m_rampCache.size()/3 + 1;
631 iend = m_rampCache.size();
632 msg() << MSG::DEBUG <<"FebID vec 3 : ";
633 for (unsigned int i = 0; i < ids3[gain].size(); ++i) {
634 msg() << MSG::DEBUG << m_onlineID->show_to_string(HWIdentifier(ids3[gain][i]))
635 << " ";
636 }
637 msg() << MSG::DEBUG << endmsg;
638 }
639
640 rampEnd = ramps->end (gain);
641 ATH_MSG_DEBUG ("After ramps->end " );
642 for (unsigned int i = i0; i < iend; ++i) {
643 // cache is not in order for gains, select the current gain
644 if (gain != m_rampCache[i].m_gain) continue;
646 HWIdentifier rampId;
647
648 ATH_MSG_DEBUG ("Looking for "
649 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) );
650
651 // Skip the empty channels
652 while(rampIt != rampEnd) {
653 rampP = *rampIt;
654 rampId = rampIt.channelId();
655 ++rampIt;
656 if (!rampP.isEmpty()) break; // break out for first non-empty ramp
657 }
658 unsigned int coolChannel = ramps->coolChannel(m_rampCache[i].m_channelID,
659 m_rampCache[i].m_gain);
660 if (!rampP.isEmpty()) {
661 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
662 << coolChannel << " "
663 << m_onlineID->show_to_string(rampId) << " "
664 << m_rampCache[i].m_gain << " "
665 << rampP.m_vRamp[0] << " "
666 << rampP.m_vRamp[1] << " "
667 << rampP.m_vRamp[2] << " " );
668 }
669 else {
670 ATH_MSG_DEBUG ("New : isEmpty " );
671 }
672 ATH_MSG_DEBUG ("Cache: cool chan, chan id, gain, ramps "
673 << coolChannel << " "
674 << m_onlineID->show_to_string(m_rampCache[i].m_channelID) << " "
675 << m_rampCache[i].m_gain << " "
676 << m_rampCache[i].m_vRamp[0] << " "
677 << m_rampCache[i].m_vRamp[1] << " "
678 << m_rampCache[i].m_vRamp[2] << " "
679 << " Compare = " << (rampP == m_rampCache[i]) );
680 if (rampP != m_rampCache[i] && !rampP.isEmpty()) {
681 ATH_MSG_ERROR ("LArRampMC and cache NOT equal" );
682 error = true;
683 }
684 }
685 }
686 }
687
688 ATH_MSG_DEBUG ("Compare LArRampMC with corrections " );
689
690 if (m_applyCorrections) {
691 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
692 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
693 m_rampCorrections[i].m_gain);
694 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
695 m_rampCorrections[i].m_gain);
696 if (!rampP.isEmpty()) {
697 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
698 << coolChannel << " "
699 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
700 << m_rampCorrections[i].m_gain << " "
701 << rampP.m_vRamp[0] << " "
702 << rampP.m_vRamp[1] << " "
703 << rampP.m_vRamp[2] << " " );
704 }
705 else {
706 ATH_MSG_DEBUG ("New : isEmpty " );
707 }
708
709 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
710 << coolChannel << " "
711 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
712 << m_rampCorrections[i].m_gain << " "
713 << m_rampCorrections[i].m_vRamp[0] << " "
714 << m_rampCorrections[i].m_vRamp[1] << " "
715 << m_rampCorrections[i].m_vRamp[2] << " "
716 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
717 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
718
719 ATH_MSG_ERROR ("Before correction: LArRampMC and correction DO NOT compare - should have opposite signs for rampes" );
720 error = true;
721 }
722 }
723
724
725 ATH_MSG_DEBUG ("Apply corrections and compare LArRampMC with corrections " );
726 ATH_CHECK( ramps_rw->applyCorrections() );
727 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
728
729 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
730 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
731 m_rampCorrections[i].m_gain);
732 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
733 m_rampCorrections[i].m_gain);
734 if (!rampP.isEmpty()) {
735 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
736 << coolChannel << " "
737 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
738 << m_rampCorrections[i].m_gain << " "
739 << rampP.m_vRamp[0] << " "
740 << rampP.m_vRamp[1] << " "
741 << rampP.m_vRamp[2] << " " );
742 }
743 else {
744 ATH_MSG_DEBUG ("New : isEmpty " );
745 }
746 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
747 << coolChannel << " "
748 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
749 << m_rampCorrections[i].m_gain << " "
750 << m_rampCorrections[i].m_vRamp[0] << " "
751 << m_rampCorrections[i].m_vRamp[1] << " "
752 << m_rampCorrections[i].m_vRamp[2] << " "
753 << " Compare = " << (rampP == m_rampCorrections[i]) );
754 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
755 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
756 error = true;
757 }
758 }
759
760 ATH_MSG_DEBUG ("Undo corrections and compare LArRampMC with corrections " );
761 ATH_CHECK( ramps_rw->undoCorrections() );
762 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
763
764 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
765 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
766 m_rampCorrections[i].m_gain);
767 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
768 m_rampCorrections[i].m_gain);
769 if (!rampP.isEmpty()) {
770 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
771 << coolChannel << " "
772 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
773 << m_rampCorrections[i].m_gain << " "
774 << rampP.m_vRamp[0] << " "
775 << rampP.m_vRamp[1] << " "
776 << rampP.m_vRamp[2] << " " );
777 }
778 else {
779 ATH_MSG_DEBUG ("New : isEmpty " );
780 }
781 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
782 << coolChannel << " "
783 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
784 << m_rampCorrections[i].m_gain << " "
785 << m_rampCorrections[i].m_vRamp[0] << " "
786 << m_rampCorrections[i].m_vRamp[1] << " "
787 << m_rampCorrections[i].m_vRamp[2] << " "
788 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
789 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
790
791 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
792 error = true;
793 }
794 }
795
796 ATH_MSG_DEBUG ("2nd Apply corrections and compare LArRampMC with corrections " );
797 ATH_CHECK( ramps_rw->applyCorrections() );
798 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
799
800 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
801 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
802 m_rampCorrections[i].m_gain);
803 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
804 m_rampCorrections[i].m_gain);
805 if (!rampP.isEmpty()) {
806 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
807 << coolChannel << " "
808 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
809 << m_rampCorrections[i].m_gain << " "
810 << rampP.m_vRamp[0] << " "
811 << rampP.m_vRamp[1] << " "
812 << rampP.m_vRamp[2] << " " );
813 }
814 else {
815 ATH_MSG_DEBUG ("New : isEmpty " );
816 }
817 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
818 << coolChannel << " "
819 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
820 << m_rampCorrections[i].m_gain << " "
821 << m_rampCorrections[i].m_vRamp[0] << " "
822 << m_rampCorrections[i].m_vRamp[1] << " "
823 << m_rampCorrections[i].m_vRamp[2] << " "
824 << " Compare = " << (rampP == m_rampCorrections[i]) );
825 if (rampP != m_rampCorrections[i] && !rampP.isEmpty()) {
826 ATH_MSG_ERROR ("After correction: LArRampMC and correction NOT equal" );
827 error = true;
828 }
829 }
830
831 ATH_MSG_DEBUG ("2nd Undo corrections and compare LArRampMC with corrections " );
832 ATH_CHECK( ramps_rw->undoCorrections() );
833 ATH_MSG_DEBUG ("Corrections applied: " << ramps->correctionsApplied() );
834
835 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
836 LArRampComplete::LArCondObj rampP = ramps->get(m_rampCorrections[i].m_channelID,
837 m_rampCorrections[i].m_gain);
838 unsigned int coolChannel = ramps->coolChannel(m_rampCorrections[i].m_channelID,
839 m_rampCorrections[i].m_gain);
840 if (!rampP.isEmpty()) {
841 ATH_MSG_DEBUG ("New : cool chan, chan id, gain, ramps "
842 << coolChannel << " "
843 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
844 << m_rampCorrections[i].m_gain << " "
845 << rampP.m_vRamp[0] << " "
846 << rampP.m_vRamp[1] << " "
847 << rampP.m_vRamp[2] << " " );
848 }
849 else {
850 ATH_MSG_DEBUG ("New : isEmpty " );
851 }
852 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
853 << coolChannel << " "
854 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
855 << m_rampCorrections[i].m_gain << " "
856 << m_rampCorrections[i].m_vRamp[0] << " "
857 << m_rampCorrections[i].m_vRamp[1] << " "
858 << m_rampCorrections[i].m_vRamp[2] << " "
859 << " Compare = " << (CorrectionCompare(rampP, m_rampCorrections[i])) );
860 if (!CorrectionCompare(rampP, m_rampCorrections[i]) && !rampP.isEmpty()) {
861
862 ATH_MSG_ERROR ("After undo: LArRampMC and correction DO NOT compare - should have opposite signs for ramps" );
863 error = true;
864 }
865 }
866 }
867
868
869 /*
870 log << MSG::DEBUG <<"Find each correction "
871 << endmsg;
872
873 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
874 HWIdentifier id = m_rampCorrections[i].m_channelID;
875 unsigned int gain = m_rampCorrections[i].m_gain;
876
877 ConstCorrectionIt it = ramps->findCorrection(id, gain);
878 // May not have any corrections
879 if (it != ramps->correctionsEnd(gain)) {
880
881 unsigned int coolChannel = ramps->coolChannel(id, gain);
882 HWIdentifier id1((*it).first);
883 LArRampComplete::LArCondObj rampP = (*it).second;
884 if (id != id1 || rampP != m_rampCorrections[i]) {
885 log << MSG::ERROR <<"Correction retrieved with findCorrection does not match: "
886 << " i = " << i << endmsg;
887 error = true;
888 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
889 << coolChannel << " "
890 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
891 << m_rampCorrections[i].m_gain << " "
892 << rampP.m_vRamp[0] << " "
893 << rampP.m_vRamp[1] << " "
894 << rampP.m_vRamp[2] << " "
895 << endmsg;
896 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
897 << coolChannel << " "
898 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
899 << m_rampCorrections[i].m_gain << " "
900 << m_rampCorrections[i].m_vRamp[0] << " "
901 << m_rampCorrections[i].m_vRamp[1] << " "
902 << m_rampCorrections[i].m_vRamp[2] << " "
903 << " Compare = " << (rampP == m_rampCorrections[i])
904 << endmsg;
905 }
906 }
907 else {
908 log << MSG::DEBUG <<"No corrections found "
909 << endmsg;
910 }
911 }
912 log << MSG::DEBUG <<"End - Find each correction "
913 << endmsg;
914
915
916 // Count the number of corrections per gain
917 unsigned int gains[3] = {0,0,0};
918 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
919 unsigned int gain = m_rampCorrections[i].m_gain;
920 gains[gain]++;
921 }
922 for (unsigned int i = 0; i < 3; ++i) {
923 if (gains[i] != ramps->correctionsSize(i)) {
924 log << MSG::ERROR <<"Number of corrections not same as number inserted: "
925 << gains[i] << " "
926 << ramps->correctionsSize(i) << " gain " << i
927 << endmsg;
928 error = true;
929 }
930
931 // Check that each correction is the same using container iterator
932 unsigned int nit = 0;
933 ConstCorrectionIt it = ramps->correctionsBegin(i);
934 ConstCorrectionIt end = ramps->correctionsEnd(i);
935 unsigned int icorr = 0;
936 for (; it != end && icorr < m_rampCorrections.size(); ++it, ++nit, ++icorr) {
937 while (m_rampCorrections[icorr].m_gain != i) ++icorr;
938 HWIdentifier id = m_rampCorrections[icorr].m_channelID;
939 unsigned int gain = m_rampCorrections[icorr].m_gain;
940 unsigned int coolChannel = ramps->coolChannel(id, gain);
941 HWIdentifier id1((*it).first);
942 LArRampComplete::LArCondObj rampP = (*it).second;
943 if (id != id1 || rampP != m_rampCorrections[icorr]) {
944 log << MSG::ERROR <<"Correction retrieved with iterator does not match: "
945 << " gain = " << i
946 << " icorr = " << icorr
947 << " nit = " << nit
948 << endmsg;
949 error = true;
950 log << MSG::DEBUG <<"New : cool chan, chan id, gain, ramps "
951 << coolChannel << " "
952 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
953 << m_rampCorrections[icorr].m_gain << " "
954 << rampP.m_vRamp[0] << " "
955 << rampP.m_vRamp[1] << " "
956 << rampP.m_vRamp[2] << " "
957 << endmsg;
958 log << MSG::DEBUG <<"Corrections: cool chan, chan id, gain, ramps "
959 << coolChannel << " "
960 << m_onlineID->show_to_string(m_rampCorrections[icorr].m_channelID) << " "
961 << m_rampCorrections[icorr].m_gain << " "
962 << m_rampCorrections[icorr].m_vRamp[0] << " "
963 << m_rampCorrections[icorr].m_vRamp[1] << " "
964 << m_rampCorrections[icorr].m_vRamp[2] << " "
965 << " Compare = " << (rampP == m_rampCorrections[icorr])
966 << endmsg;
967 }
968 }
969 }
970
971 removed.
972 */
973
974 ATH_MSG_DEBUG ("Number of channels, iovs "
975 << ramps->chan_size() << " " << ramps->iov_size() );
976
977 std::set<unsigned int> channelNumbers;
978 CONTAINER::chan_const_iterator chanIt = ramps->chan_begin();
979 CONTAINER::chan_const_iterator endChan = ramps->chan_end ();
980 for (unsigned int i = 0; chanIt != endChan; ++chanIt, ++i) {
981 const CONTAINER::Subset* subset = ramps->at(i);
982 ATH_MSG_DEBUG ( "Index " << i
983 << " channel " << subset->channel()
984 << " gain " << subset->gain()
985 << " groupingType " << subset->groupingType()
986 << " subsetSize " << subset->subsetSize()
987 << " correctionVecSize " << subset->correctionVecSize() );
988 if ((*chanIt) != subset->channel()) {
989 ATH_MSG_ERROR ( "Channel numbers not the same for MultChanColl and subset: "
990 << i
991 << " multchan " << (*chanIt)
992 << " subset " << subset->channel() );
993 error = true;
994 }
995 if (!(channelNumbers.insert(subset->channel()).second)) {
996 ATH_MSG_ERROR ( "Duplicate channel number - Index " << i
997 << " channel " << subset->channel() );
998 error = true;
999 }
1000 }
1001 ATH_MSG_DEBUG ( "Channel numbers size " << channelNumbers.size()
1002 << " ramps size " << ramps->chan_size() );
1003
1004 if (error) {
1005 ATH_MSG_ERROR ("Failing check of LArRamp - see above" );
1006 return (StatusCode::FAILURE);
1007 }
1008
1009 ATH_MSG_DEBUG ( "End of testEachCondObject " );
1010 return StatusCode::SUCCESS;
1011}
1012
1013// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1014
1015StatusCode
1017{
1018
1020 typedef ChanSet::ConstChannelIt ConstChannelIt;
1021
1022 ATH_MSG_INFO ("in testChannelSet" );
1023
1024 ChanSet chanSet;
1025
1026 // corrections not always available:
1028 // add corrections to channel set
1029 for (unsigned int i = 0; i < m_rampCorrections.size(); ++i) {
1030 // Must copy LArRampPTmp into a LArRampComplete::LArCondObj
1032 ramp.m_vRamp = m_rampCorrections[i].m_vRamp;
1033 chanSet.insert(m_rampCorrections[i].m_channelID.get_identifier32().get_compact(), ramp);
1034 }
1035 // Now loop over corrections and check that they agree
1036 bool error = false;
1037 if (m_rampCorrections.size() != chanSet.size()) {
1038 ATH_MSG_ERROR ("Corrections not the same size as channel set: "
1039 << m_rampCorrections.size() << " " << chanSet.size() );
1040 return (StatusCode::FAILURE);
1041 }
1042 else {
1043 ATH_MSG_DEBUG ("Sizes OK: " << chanSet.size() );
1044 }
1045
1046 ConstChannelIt it = chanSet.begin();
1047 ConstChannelIt itEnd = chanSet.end();
1048
1049
1050 unsigned int i = 0;
1051 for (; it != itEnd; ++it, ++i) {
1052
1053 HWIdentifier id = m_rampCorrections[i].m_channelID;
1054 HWIdentifier id1((*it).first);
1055 LArRampComplete::LArCondObj rampP = (*it).second;
1056 if (id != id1 || rampP != m_rampCorrections[i]) {
1057 ATH_MSG_ERROR ("Correction retrieved with iterator does not match: "
1058 << " i = " << i );
1059 error = true;
1060 }
1061 ATH_MSG_DEBUG ("New : chan id, gain, ramps "
1062 << m_onlineID->show_to_string(id1) << " "
1063 << m_rampCorrections[i].m_gain << " "
1064 << rampP.m_vRamp[0] << " "
1065 << rampP.m_vRamp[1] << " "
1066 << rampP.m_vRamp[2] << " "
1067 );
1068 ATH_MSG_DEBUG ("Corrections: chan id, gain, ramps "
1069 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
1070 << m_rampCorrections[i].m_gain << " "
1071 << m_rampCorrections[i].m_vRamp[0] << " "
1072 << m_rampCorrections[i].m_vRamp[1] << " "
1073 << m_rampCorrections[i].m_vRamp[2] << " "
1074 << " Compare = " << (rampP == m_rampCorrections[i])
1075 );
1076 }
1077 if (!error) {
1078 ATH_MSG_DEBUG ("Iteration check OK " );
1079 }
1080
1081 i = 0;
1082 for (; i < m_rampCorrections.size(); ++i) {
1083
1084 unsigned int id = m_rampCorrections[i].m_channelID.get_identifier32().get_compact();
1085 it = chanSet.find(id);
1086 if (it == itEnd) {
1087 ATH_MSG_ERROR ("Could not find correction: "
1088 << " i = " << i );
1089 error = true;
1090 ATH_MSG_DEBUG ("Corrections: cool chan, chan id, gain, ramps "
1091 << m_onlineID->show_to_string(m_rampCorrections[i].m_channelID) << " "
1092 << m_rampCorrections[i].m_gain << " "
1093 << m_rampCorrections[i].m_vRamp[0] << " "
1094 << m_rampCorrections[i].m_vRamp[1] << " "
1095 << m_rampCorrections[i].m_vRamp[2] << " "
1096 );
1097 }
1098 }
1099 if (!error) {
1100 ATH_MSG_DEBUG ("Find check OK " );
1101 }
1102
1103 if (error) {
1104 ATH_MSG_ERROR ("Failing check of channel set - see above" );
1105 return (StatusCode::FAILURE);
1106 }
1107 }
1108
1109 return StatusCode::SUCCESS;
1110
1111}
1112
1113
1115{
1116
1117 typedef LArRampMC::CONTAINER CONTAINER;
1118 typedef CONTAINER::Subset Subset;
1119
1120 const LArRampMC* ramp = 0 ;
1121 ATH_CHECK( detStore()->retrieve(ramp, "LArRamp") );
1122
1123 ATH_MSG_DEBUG ( " Found LArRampMC, key LArRamp." );
1124
1125 // Print out channels
1126 ATH_MSG_DEBUG ( " Number of channels " << ramp->chan_size() );
1127
1128 // Print out first 10 elements of each gain for subset
1129 CONTAINER::chan_const_iterator chanIt = ramp->chan_begin();
1130 CONTAINER::chan_const_iterator endChan = ramp->chan_end ();
1131 for (unsigned int i = 0; chanIt != endChan; ++chanIt, ++i) {
1132 unsigned int coolChan = *chanIt;
1133 const Subset* subset = ramp->at(i);
1134
1135 ATH_MSG_DEBUG ( " Channel " << coolChan << " "
1136 << " Subset size " << subset->subsetSize()
1137 << " gain, channel, grouping type " << subset->gain() << " "
1138 << MSG::hex << subset->channel() << " " << MSG::dec
1139 << subset->groupingType() << " "
1140 );
1141
1142 Subset::ConstSubsetIt first = subset->subsetBegin();
1143 Subset::ConstSubsetIt last = subset->subsetEnd();
1144 //for (int i = 0; i < 10 && first != last; ++i, ++first) {
1145 for (; first != last; ++first) {
1146
1147 // select non-zero subsets
1148 if ((*first).second.size()) {
1149
1150 ATH_MSG_DEBUG ( " FEB id "
1151 << m_onlineID->show_to_string(HWIdentifier((*first).first)) << " "
1152 );
1153 for (unsigned int k = 0; k < 5; ++k) {
1154 msg() << MSG::DEBUG << " vramp " ;
1155// << m_onlineID->show_to_string((*first).second[k].m_channelID) << " "
1156// << (*first).second[k].m_gain << " ";
1157 for (unsigned int j = 0; j < (*first).second[k].m_vRamp.size(); ++j) {
1158 msg() << MSG::DEBUG << (*first).second[k].m_vRamp[j] << " ";
1159 }
1160 msg() << MSG::DEBUG << endmsg;
1161 }
1162
1163 }
1164
1165 }
1166 }
1167
1168
1169 /*
1170
1171 // Print out first 10 elements of each gain for corrections
1172 for (unsigned int gain = 0; gain < 3; ++gain) {
1173 log << MSG::DEBUG << " Gain, size "
1174 << gain << " "
1175 << ramp->correctionsSize(gain) << endmsg;
1176 CONTAINER::ConstCorrectionIt first = ramp->correctionsBegin(gain);
1177 CONTAINER::ConstCorrectionIt last = ramp->correctionsEnd(gain);
1178 for (int i = 0; i < 10 && first != last; ++i, ++first) {
1179 log << MSG::DEBUG << " id, vramp "
1180 << m_onlineID->show_to_string(HWIdentifier((*first).first)) << " ";
1181// << m_onlineID->show_to_string((*first).second.m_channelID) << " "
1182// << (*first).second.m_gain << " ";
1183 for (unsigned int j = 0; j < (*first).second.m_vRamp.size(); ++j) {
1184 log << MSG::DEBUG << (*first).second.m_vRamp[j] << " ";
1185 }
1186 log << MSG::DEBUG << endmsg;
1187 }
1188 }
1189
1190 */
1191
1192 return StatusCode::SUCCESS;
1193
1194}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(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 with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() 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
std::vector< LArRampPTmp > m_rampCorrections
virtual StatusCode execute() override
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
MsgStream & msg
Definition testRead.cxx:32