ATLAS Offline Software
Loading...
Searching...
No Matches
MagField::AtlasFieldCacheCondAlg Class Reference

#include <AtlasFieldCacheCondAlg.h>

Inheritance diagram for MagField::AtlasFieldCacheCondAlg:
Collaboration diagram for MagField::AtlasFieldCacheCondAlg:

Classes

struct  Cache

Public Member Functions

 AtlasFieldCacheCondAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~AtlasFieldCacheCondAlg ()
StatusCode initialize () override final
StatusCode execute (const EventContext &ctx) const override final
virtual bool isReEntrant () const override
 Avoid scheduling algorithm multiple times.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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 updateCurrentFromConditions (const EventContext &ctx, Cache &cache) const
StatusCode updateCurrentFromParameters (const EventContext &ctx, Cache &cache) const
void scaleField (Cache &cache, const MagField::AtlasFieldMap *fieldMap) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< double > m_soleMinCurrent
Gaudi::Property< double > m_toroMinCurrent
Gaudi::Property< bool > m_useDCS
Gaudi::Property< bool > m_lockMapCurrents
SG::ReadCondHandleKey< CondAttrListCollectionm_currInputKey
SG::ReadCondHandleKey< AtlasFieldMapCondObjm_mapCondObjInputKey
SG::WriteCondHandleKey< AtlasFieldCacheCondObjm_condObjOutputKey
Gaudi::Property< double > m_useSoleCurrent
Gaudi::Property< double > m_useToroCurrent
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Definition at line 23 of file AtlasFieldCacheCondAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ AtlasFieldCacheCondAlg()

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

Definition at line 26 of file AtlasFieldCacheCondAlg.cxx.

29 : AthCondAlgorithm(name, pSvcLocator)
30{}

◆ ~AtlasFieldCacheCondAlg()

AtlasFieldCacheCondAlg::~AtlasFieldCacheCondAlg ( )
virtualdefault

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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 AtlasFieldCacheCondAlg::execute ( const EventContext & ctx) const
finaloverride

Definition at line 61 of file AtlasFieldCacheCondAlg.cxx.

62{
63
64 ATH_MSG_DEBUG("execute: entering");
65
66 // Check if output conditions object with field cache object is still valid,
67 // if not replace it with new current scale factors
68 SG::WriteCondHandle<AtlasFieldCacheCondObj> writeHandle{ m_condObjOutputKey,
69 ctx };
70 if (writeHandle.isValid()) {
71 ATH_MSG_DEBUG("execute: CondHandle "
72 << writeHandle.fullKey() << " is already valid. "
73 << " May happen if multiple concurrent events are being "
74 "processed out of order.");
75 return StatusCode::SUCCESS;
76 }
77
78 // This will need to be filled before we construct the condition object
79 Cache cache{};
80
81 if (m_useDCS) {
83 } else {
85 }
86
87 // Must read map cond object to get previously created map
88 SG::ReadCondHandle<AtlasFieldMapCondObj> mapReadHandle{ m_mapCondObjInputKey,
89 ctx };
90 const AtlasFieldMapCondObj* mapCondObj{ *mapReadHandle };
91 if (mapCondObj == nullptr) {
92 ATH_MSG_ERROR("execute: Could not access conditions map for key: "
93 << m_mapCondObjInputKey.fullKey());
94 return StatusCode::FAILURE;
95 }
96
97 // simple pointer to the map, to be give to the AtlasFieldCacheCondObj, used
98 // for the cache field map access
99 const MagField::AtlasFieldMap* fieldMap = mapCondObj->fieldMap();
100
101 // calculate the scale factors
102 if (!m_lockMapCurrents) {
103 scaleField(cache, fieldMap);
104 }
105
106 // save current scale factor in conditions object
107 auto fieldCondObj = std::make_unique<AtlasFieldCacheCondObj>();
108
109 // initialize cond obj with current scale factors and the field svc (needed to
110 // setup cache)
111 fieldCondObj->initialize(
112 cache.m_solScaleFactor, cache.m_torScaleFactor, fieldMap);
113
114 // Record in conditions store the conditions object with scale factors and map
115 // pointer for cache
116 if (writeHandle.record(cache.m_condObjOutputRange, std::move(fieldCondObj))
117 .isFailure()) {
119 "execute: Could not record AtlasFieldCacheCondObj object with "
120 << writeHandle.key() << " with EventRange " << cache.m_condObjOutputRange
121 << " into Conditions Store");
122 return StatusCode::FAILURE;
123 }
124
126 "execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor "
127 << cache.m_solScaleFactor << "/" << cache.m_torScaleFactor
128 << ", EventRange " << cache.m_condObjOutputRange);
129 if (fieldMap) {
130 ATH_MSG_INFO("execute: solenoid zone id " << fieldMap->solenoidZoneId());
131 } else {
132 ATH_MSG_INFO("execute: no map read (currents == 0");
133 }
134
135 return StatusCode::SUCCESS;
136}
#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)
const MagField::AtlasFieldMap * fieldMap() const
void scaleField(Cache &cache, const MagField::AtlasFieldMap *fieldMap) const
SG::WriteCondHandleKey< AtlasFieldCacheCondObj > m_condObjOutputKey
StatusCode updateCurrentFromConditions(const EventContext &ctx, Cache &cache) const
StatusCode updateCurrentFromParameters(const EventContext &ctx, Cache &cache) const
Gaudi::Property< bool > m_lockMapCurrents
SG::ReadCondHandleKey< AtlasFieldMapCondObj > m_mapCondObjInputKey
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode AtlasFieldCacheCondAlg::initialize ( )
finaloverride

Definition at line 35 of file AtlasFieldCacheCondAlg.cxx.

36{
37 // Read Handle for the current
39
40 // Read handle for the field map cond object
41 ATH_CHECK(m_mapCondObjInputKey.initialize());
42
43 // Output handle for scale factors/cache
44 ATH_CHECK(m_condObjOutputKey.initialize());
45
46 ATH_MSG_DEBUG("Initialize: Key " << m_condObjOutputKey.fullKey()
47 << " has been succesfully registered ");
48
49 ATH_MSG_INFO("Initialize: Will update current from " <<
50 (m_useDCS ? "conditions" : "parameters"));
51
52 ATH_MSG_INFO("Initialize: useDCS, useSoleCurrent, useToroCurrent. "
53 << (int)m_useDCS << ", " << m_useSoleCurrent << ", "
54 << m_useToroCurrent << " LockMapCurrents "
55 << (int)m_lockMapCurrents);
56
57 return StatusCode::SUCCESS;
58}
Gaudi::Property< double > m_useSoleCurrent
Gaudi::Property< double > m_useToroCurrent
SG::ReadCondHandleKey< CondAttrListCollection > m_currInputKey

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ isClonable()

◆ isReEntrant()

virtual bool AthCondAlgorithm::isReEntrant ( ) const
inlineoverridevirtualinherited

Avoid scheduling algorithm multiple times.

With multiple concurrent events, conditions objects often expire simultaneously for all slots. To avoid that the scheduler runs the CondAlg in each slot, we declare it as "non-reentrant". This ensures that the conditions objects are only created once.

In case a particular CondAlg should behave differently, it can override this method again and return true.

See also
ATEAM-836

Definition at line 39 of file AthCondAlgorithm.h.

39{ return false; }

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ scaleField()

void AtlasFieldCacheCondAlg::scaleField ( Cache & cache,
const MagField::AtlasFieldMap * fieldMap ) const
private

Definition at line 286 of file AtlasFieldCacheCondAlg.cxx.

289{
290 // Calculate the scale factor for solenoid and toroid.
291
292 // We have one piece of information coming from the map.
293 // Do we have a map including both Toroid/Solenoid or only one.
294 // The values are typically the nominal value for the map
295 // or 0.
296 bool mapHasToroid = fieldMap && (fieldMap->toroidCurrent()>0);
297 bool mapHasSolenoid = fieldMap && (fieldMap->solenoidCurrent()>0);
298
299 // Then we have the info we get on the actual current we have
300 // So we might need to scale the map with it.
301 // Set the SF for the solenoid
302 if (cache.m_solenoidCurrent > 0.0) {
303 if (mapHasSolenoid &&
304 std::abs(cache.m_solenoidCurrent / fieldMap->solenoidCurrent() - 1.0) >
305 0.001) {
306 cache.m_solScaleFactor =
307 cache.m_solenoidCurrent / fieldMap->solenoidCurrent();
308 }
309 ATH_MSG_INFO("scaleField: Solenoid field scale factor "
310 << cache.m_solScaleFactor
311 << ". Desired current and map current: "
312 << cache.m_solenoidCurrent << ","
313 << (fieldMap ? fieldMap->solenoidCurrent() : 0));
314 } else {
315 // No SF set, set it to 0 - current was set to zero either here or for the
316 // map, or the map was not read in
317 cache.m_solScaleFactor = 0;
318 ATH_MSG_INFO("scaleField: Solenoid field scale factor "
319 << cache.m_solScaleFactor
320 << ". Desired current and map current: "
321 << cache.m_solenoidCurrent << ","
322 << ((fieldMap) ? fieldMap->solenoidCurrent() : 0));
323 }
324
325
326 // Set the SF for the toroid
327 if (cache.m_toroidCurrent > 0.0) {
328 if (mapHasToroid &&
329 std::abs(cache.m_toroidCurrent / fieldMap->toroidCurrent() - 1.0) >
330 0.001) {
331 // scale the field in all zones except for the solenoid zone
332 cache.m_torScaleFactor =
333 cache.m_toroidCurrent / fieldMap->toroidCurrent();
334 }
335 ATH_MSG_INFO("scaleField: Toroid field scale factor "
336 << cache.m_torScaleFactor
337 << ". Desired current and map current: "
338 << cache.m_toroidCurrent << ","
339 << (fieldMap ? fieldMap->toroidCurrent() : 0));
340 } else {
341 cache.m_torScaleFactor = 0;
342 ATH_MSG_INFO("scaleField: Toroid field scale factor "
343 << cache.m_torScaleFactor
344 << ". Desired current and map current: "
345 << cache.m_toroidCurrent << ","
346 << ((fieldMap) ? fieldMap->toroidCurrent() : 0));
347 }
348 // If the map was toroid only set both to the toroid
349 // the 0s in the solenoid should be covered by the map
350 if (mapHasToroid && !mapHasSolenoid) {
351 cache.m_solScaleFactor = cache.m_torScaleFactor;
352 }
353 // if the map is solenoid only set both to the solenoid
354 // the 0s in the toroid should be covered by the map
355 if (!mapHasToroid && mapHasSolenoid) {
356 cache.m_torScaleFactor = cache.m_solScaleFactor;
357 }
358}
float toroidCurrent() const
float solenoidCurrent() const

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::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< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ updateCurrentFromConditions()

StatusCode AtlasFieldCacheCondAlg::updateCurrentFromConditions ( const EventContext & ctx,
Cache & cache ) const
private

Definition at line 139 of file AtlasFieldCacheCondAlg.cxx.

142{
143
144 // readin current value
145 SG::ReadCondHandle<CondAttrListCollection> readHandle{ m_currInputKey, ctx };
146 const CondAttrListCollection* attrListColl{ *readHandle };
147 if (attrListColl == nullptr) {
148 ATH_MSG_ERROR("updateCurrentFromConditions: Failed to retrieve "
149 "CondAttributeListCollection with key "
150 << m_currInputKey.key());
151 return StatusCode::FAILURE;
152 }
153
154 // Get the validitiy range
155 EventIDRange rangeW;
156 if (!readHandle.range(rangeW)) {
158 "updateCurrentFromConditions: Failed to retrieve validity range for "
159 << readHandle.key());
160 return StatusCode::FAILURE;
161 }
162 cache.m_condObjOutputRange = rangeW;
163 ATH_MSG_INFO("UpdateCurrentFromConditions: Range of input/output is "
164 << cache.m_condObjOutputRange);
165
166 // get magnet currents from DCS
167 double solcur{ 0. };
168 double torcur{ 0. };
169 bool gotsol{ false };
170 bool gottor{ false };
171
172 /*
173 * due to inconsistencies between CONDBR2 and OFLP200/COMP200 (the former
174 * includes channel names in the /EXT/DCS/MAGNETS/SENSORDATA folder, the
175 * latter don't), we try to read currents in both ways
176 */
177 bool hasChanNames{ false };
178 ATH_MSG_INFO("UpdateCurrentFromConditions: Attempt 1 at reading currents "
179 "from DCS (using channel name)");
180 for (CondAttrListCollection::const_iterator itr = attrListColl->begin();
181 itr != attrListColl->end();
182 ++itr) {
183 const std::string& name = attrListColl->chanName(itr->first);
184 ATH_MSG_INFO("UpdateCurrentFromConditions: Trying to read from DCS: "
185 "[channel name, index, value] "
186 << name << " , " << itr->first << " , "
187 << itr->second["value"].data<float>());
188 if (name.compare("") != 0) {
189 hasChanNames = true;
190 }
191 if (name.compare("CentralSol_Current") == 0) {
192 // channel 1 is solenoid current
193 solcur = itr->second["value"].data<float>();
194 gotsol = true;
195 } else if (name.compare("Toroids_Current") == 0) {
196 // channel 3 is toroid current
197 torcur = itr->second["value"].data<float>();
198 gottor = true;
199 }
200 }
201 if (!hasChanNames) {
202 ATH_MSG_INFO("UpdateCurrentFromConditions: Attempt 2 at reading currents "
203 "from DCS (using channel index)");
204 // in no channel is named, try again using channel index instead
205 for (CondAttrListCollection::const_iterator itr = attrListColl->begin();
206 itr != attrListColl->end();
207 ++itr) {
208
209 if (itr->first == 1) {
210 // channel 1 is solenoid current
211 solcur = itr->second["value"].data<float>();
212 gotsol = true;
213 } else if (itr->first == 3) {
214 // channel 3 is toroid current
215 torcur = itr->second["value"].data<float>();
216 gottor = true;
217 }
218 }
219 }
220 if (!gotsol || !gottor) {
221 if (!gotsol)
222 ATH_MSG_ERROR("UpdateCurrentFromConditions: Missing solenoid current in "
223 "DCS information");
224 if (!gottor)
225 ATH_MSG_ERROR("UpdateCurrentFromConditions: Missing toroid current in "
226 "DCS information");
227 return StatusCode::FAILURE;
228 }
229
230 ATH_MSG_INFO("UpdateCurrentFromConditions: Currents read from DCS - solenoid "
231 << solcur << " toroid " << torcur);
232
233 // round to zero if close to zero
234 if (solcur < m_soleMinCurrent) {
235 solcur = 0.0;
236 ATH_MSG_INFO("UpdateCurrentFromConditions: Solenoid is off");
237 }
238 if (torcur < m_toroMinCurrent) {
239 torcur = 0.0;
240 ATH_MSG_INFO("UpdateCurrentFromConditions: Toroids are off");
241 }
242
243 cache.m_solenoidCurrent = solcur;
244 cache.m_toroidCurrent = torcur;
245
246 return StatusCode::SUCCESS;
247}
#define ATH_MSG_FATAL(x)
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
ChanAttrListMap::const_iterator const_iterator
Gaudi::Property< double > m_soleMinCurrent
Gaudi::Property< double > m_toroMinCurrent
bool range(EventIDRange &r)
const std::string & key() const

◆ updateCurrentFromParameters()

StatusCode AtlasFieldCacheCondAlg::updateCurrentFromParameters ( const EventContext & ctx,
Cache & cache ) const
private

Definition at line 250 of file AtlasFieldCacheCondAlg.cxx.

253{
254
255 // take the current values from JobOptions
256 double solcur{ m_useSoleCurrent };
257 double torcur{ m_useToroCurrent };
258 if (solcur < m_soleMinCurrent) {
259 solcur = 0.0;
260 ATH_MSG_INFO("updateCurrentFromParameters: Solenoid is off");
261 }
262 if (torcur < m_toroMinCurrent) {
263 torcur = 0.0;
264 ATH_MSG_INFO("updateCurrentFromParameters: Toroids are off");
265 }
266 cache.m_solenoidCurrent = solcur;
267 cache.m_toroidCurrent = torcur;
268
269 // in case of reading from DB or from FILE, the EventID range is always the
270 // current run
271 EventIDBase start, stop;
272 start.set_run_number(ctx.eventID().run_number());
273 start.set_lumi_block(0);
274 stop.set_run_number(ctx.eventID().run_number() + 1);
275 stop.set_lumi_block(0);
276 cache.m_condObjOutputRange = EventIDRange(start, stop);
277
278 ATH_MSG_INFO("updateCurrentFromParameters: Update from job options: Range of "
279 "input/output is "
280 << cache.m_condObjOutputRange);
281
282 return StatusCode::SUCCESS;
283}

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 }

Member Data Documentation

◆ m_condObjOutputKey

SG::WriteCondHandleKey<AtlasFieldCacheCondObj> MagField::AtlasFieldCacheCondAlg::m_condObjOutputKey
private
Initial value:
{
this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
"Name of the key for the Magnetic Field conditions object with currents "
"for scaling"
}

Definition at line 105 of file AtlasFieldCacheCondAlg.h.

105 {
106 this,
107 "AtlasFieldCacheCondObj",
108 "fieldCondObj",
109 "Name of the key for the Magnetic Field conditions object with currents "
110 "for scaling"
111 };

◆ m_currInputKey

SG::ReadCondHandleKey<CondAttrListCollection> MagField::AtlasFieldCacheCondAlg::m_currInputKey
private
Initial value:
{
this,
"COOLCurrentsFolderName",
"/EXT/DCS/MAGNETS/SENSORDATA",
"Name of the COOL folder containing magnet currents"
}

Definition at line 86 of file AtlasFieldCacheCondAlg.h.

86 {
87 this,
88 "COOLCurrentsFolderName",
89 "/EXT/DCS/MAGNETS/SENSORDATA",
90 "Name of the COOL folder containing magnet currents"
91 };

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_lockMapCurrents

Gaudi::Property<bool> MagField::AtlasFieldCacheCondAlg::m_lockMapCurrents
private
Initial value:
{
this,
"LockMapCurrents",
false,
"Skip current rescale and use map currents as they are"
}

Definition at line 77 of file AtlasFieldCacheCondAlg.h.

77 {
78 this,
79 "LockMapCurrents",
80 false,
81 "Skip current rescale and use map currents as they are"
82 };

◆ m_mapCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldMapCondObj> MagField::AtlasFieldCacheCondAlg::m_mapCondObjInputKey
private
Initial value:
{
this,
"AtlasFieldMapCondObj",
"fieldMapCondObj",
"Name of key for the Magnetic Field conditions object with the map file "
"names"
}

Definition at line 95 of file AtlasFieldCacheCondAlg.h.

95 {
96 this,
97 "AtlasFieldMapCondObj",
98 "fieldMapCondObj",
99 "Name of key for the Magnetic Field conditions object with the map file "
100 "names"
101 };

◆ m_soleMinCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_soleMinCurrent
private
Initial value:
{
this,
"SoleMinCurrent",
1.0,
"Minimum solenoid current (A) for which solenoid is considered ON"
}

Definition at line 55 of file AtlasFieldCacheCondAlg.h.

55 {
56 this,
57 "SoleMinCurrent",
58 1.0,
59 "Minimum solenoid current (A) for which solenoid is considered ON"
60 };

◆ m_toroMinCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_toroMinCurrent
private
Initial value:
{
this,
"ToroMinCurrent",
1.0,
"Minimum toroid current (A) for which toroid is considered ON"
}

Definition at line 61 of file AtlasFieldCacheCondAlg.h.

61 {
62 this,
63 "ToroMinCurrent",
64 1.0,
65 "Minimum toroid current (A) for which toroid is considered ON"
66 };

◆ m_useDCS

Gaudi::Property<bool> MagField::AtlasFieldCacheCondAlg::m_useDCS
private
Initial value:
{
this,
"UseDCS",
false,
"Get magnet currents from DCS through ConditionsSvc"
}

Definition at line 69 of file AtlasFieldCacheCondAlg.h.

69 {
70 this,
71 "UseDCS",
72 false,
73 "Get magnet currents from DCS through ConditionsSvc"
74 };

◆ m_useSoleCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_useSoleCurrent
private
Initial value:
{ this,
"UseSoleCurrent",
7730.,
"Set actual solenoid current (A)" }

Definition at line 114 of file AtlasFieldCacheCondAlg.h.

114 { this,
115 "UseSoleCurrent",
116 7730.,
117 "Set actual solenoid current (A)" };

◆ m_useToroCurrent

Gaudi::Property<double> MagField::AtlasFieldCacheCondAlg::m_useToroCurrent
private
Initial value:
{ this,
"UseToroCurrent",
20400.,
"Set actual toroid current (A)" }

Definition at line 118 of file AtlasFieldCacheCondAlg.h.

118 { this,
119 "UseToroCurrent",
120 20400.,
121 "Set actual toroid current (A)" };

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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