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