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 108 of file LArConditionsTestAlg.cxx.

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}
#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 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}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
BooleanProperty m_testCondObjs

◆ 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 98 of file LArConditionsTestAlg.cxx.

99{
101 return StatusCode::SUCCESS;
102}

◆ 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
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}
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 1016 of file LArConditionsTestAlg.cxx.

1017{
1018
1019 typedef LArConditionsChannelSet<LArRampComplete::LArCondObj> ChanSet;
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}
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 207 of file LArConditionsTestAlg.cxx.

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}
#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 1114 of file LArConditionsTestAlg.cxx.

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}
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ 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: