ATLAS Offline Software
Loading...
Searching...
No Matches
LArConditionsTestAlg Class Reference

Athena algorithm used for testing LAr conditions data access. More...

#include <LArConditionsTestAlg.h>

Inheritance diagram for LArConditionsTestAlg:
Collaboration diagram for LArConditionsTestAlg:

Public Member Functions

 LArConditionsTestAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~LArConditionsTestAlg ()
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode createCompareObjects ()
StatusCode testCondObjects ()
StatusCode testEachCondObject ATLAS_NOT_THREAD_SAFE (const LArRampMC *ramps)
StatusCode testChannelSet ()
StatusCode testDbObjectRead ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::vector< LArRampPTmpm_rampCache
std::vector< LArRampPTmpm_rampCorrections
const LArOnlineIDm_onlineID {}
BooleanProperty m_testCondObjs {this, "TestCondObjs", false}
BooleanProperty m_readCondObjs {this, "ReadCondObjs", false}
BooleanProperty m_writeCondObjs {this, "WriteCondObjs", false}
BooleanProperty m_writeCorrections {this, "WriteCorrections", false}
BooleanProperty m_applyCorrections {this, "ApplyCorrections", false}
BooleanProperty m_testReadDB {this, "TestReadDBDirect", false}
BooleanProperty m_TB {this, "Testbeam", false}
IntegerProperty m_tbin {this, "Tbin", 0}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Athena algorithm used for testing LAr conditions data access.

Definition at line 39 of file LArConditionsTestAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ LArConditionsTestAlg()

LArConditionsTestAlg::LArConditionsTestAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 32 of file LArConditionsTestAlg.cxx.

32 :
33 AthAlgorithm(name,pSvcLocator)
34{
35}
AthAlgorithm()
Default constructor:

◆ ~LArConditionsTestAlg()

LArConditionsTestAlg::~LArConditionsTestAlg ( )
virtual

Definition at line 41 of file LArConditionsTestAlg.cxx.

42{ }

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode testEachCondObject LArConditionsTestAlg::ATLAS_NOT_THREAD_SAFE ( const LArRampMC * ramps)
private

◆ createCompareObjects()

StatusCode LArConditionsTestAlg::createCompareObjects ( )
private

Definition at line 126 of file LArConditionsTestAlg.cxx.

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}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
BooleanProperty m_writeCorrections
std::vector< LArRampPTmp > m_rampCorrections
std::vector< LArRampPTmp > m_rampCache
const LArOnlineID * m_onlineID
BooleanProperty m_applyCorrections

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode LArConditionsTestAlg::execute ( )
overridevirtual

Definition at line 71 of file LArConditionsTestAlg.cxx.

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}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
BooleanProperty m_testCondObjs
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode LArConditionsTestAlg::finalize ( )
overridevirtual

Definition at line 116 of file LArConditionsTestAlg.cxx.

117{
119 return StatusCode::SUCCESS;
120}

◆ initialize()

StatusCode LArConditionsTestAlg::initialize ( )
overridevirtual

Definition at line 48 of file LArConditionsTestAlg.cxx.

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
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}
BooleanProperty m_readCondObjs
BooleanProperty m_writeCondObjs

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ testChannelSet()

StatusCode LArConditionsTestAlg::testChannelSet ( )
private

Definition at line 1034 of file LArConditionsTestAlg.cxx.

1035{
1036
1037 typedef LArConditionsChannelSet<LArRampComplete::LArCondObj> ChanSet;
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}
std::vector< float > m_vRamp
Definition LArRampP1.h:30

◆ testCondObjects()

StatusCode LArConditionsTestAlg::testCondObjects ( )
private

Statistics: total number of conditions

Statistics: total number of conditions

Statistics: total number of conditions

Definition at line 225 of file LArConditionsTestAlg.cxx.

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}
#define endmsg
MsgStream & msg() const
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...
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)
chan_const_iterator chan_begin() const
Access to Channel numbers via iterators - from MultChanCollection.
iov_const_iterator iov_end() const
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.
chan_size_type chan_size() const
number of channels - from MultChanCollection
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.
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
bool first
Definition DeMoScan.py:534

◆ testDbObjectRead()

StatusCode LArConditionsTestAlg::testDbObjectRead ( )
private

Definition at line 1132 of file LArConditionsTestAlg.cxx.

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}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_applyCorrections

BooleanProperty LArConditionsTestAlg::m_applyCorrections {this, "ApplyCorrections", false}
private

Definition at line 68 of file LArConditionsTestAlg.h.

68{this, "ApplyCorrections", false};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_onlineID

const LArOnlineID* LArConditionsTestAlg::m_onlineID {}
private

Definition at line 63 of file LArConditionsTestAlg.h.

63{};

◆ m_rampCache

std::vector<LArRampPTmp> LArConditionsTestAlg::m_rampCache
private

Definition at line 60 of file LArConditionsTestAlg.h.

◆ m_rampCorrections

std::vector<LArRampPTmp> LArConditionsTestAlg::m_rampCorrections
private

Definition at line 61 of file LArConditionsTestAlg.h.

◆ m_readCondObjs

BooleanProperty LArConditionsTestAlg::m_readCondObjs {this, "ReadCondObjs", false}
private

Definition at line 65 of file LArConditionsTestAlg.h.

65{this, "ReadCondObjs", false};

◆ m_TB

BooleanProperty LArConditionsTestAlg::m_TB {this, "Testbeam", false}
private

Definition at line 70 of file LArConditionsTestAlg.h.

70{this, "Testbeam", false};

◆ m_tbin

IntegerProperty LArConditionsTestAlg::m_tbin {this, "Tbin", 0}
private

Definition at line 71 of file LArConditionsTestAlg.h.

71{this, "Tbin", 0};

◆ m_testCondObjs

BooleanProperty LArConditionsTestAlg::m_testCondObjs {this, "TestCondObjs", false}
private

Definition at line 64 of file LArConditionsTestAlg.h.

64{this, "TestCondObjs", false};

◆ m_testReadDB

BooleanProperty LArConditionsTestAlg::m_testReadDB {this, "TestReadDBDirect", false}
private

Definition at line 69 of file LArConditionsTestAlg.h.

69{this, "TestReadDBDirect", false};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_writeCondObjs

BooleanProperty LArConditionsTestAlg::m_writeCondObjs {this, "WriteCondObjs", false}
private

Definition at line 66 of file LArConditionsTestAlg.h.

66{this, "WriteCondObjs", false};

◆ m_writeCorrections

BooleanProperty LArConditionsTestAlg::m_writeCorrections {this, "WriteCorrections", false}
private

Definition at line 67 of file LArConditionsTestAlg.h.

67{this, "WriteCorrections", false};

The documentation for this class was generated from the following files: