ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::AlignmentErrorDbAlg Class Reference

#include <AlignmentErrorDbAlg.h>

Inheritance diagram for Muon::AlignmentErrorDbAlg:
Collaboration diagram for Muon::AlignmentErrorDbAlg:

Public Member Functions

 ~AlignmentErrorDbAlg () override=default
StatusCode initialize () override
StatusCode execute (const EventContext &ctx) const override
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

std::tuple< std::string, EventIDRange > getDbClobContent (const EventContext &ctx) const
std::tuple< std::string, EventIDRange > getFileClobContent () const
std::string hardwareName (MuonCalib::MuonFixedLongId calibId) const
std::string_view side (MuonCalib::MuonFixedLongId calibId) const
std::string sectorString (MuonCalib::MuonFixedLongId calibId) const
int sector (MuonCalib::MuonFixedLongId calibId) const
int hardwareEta (MuonCalib::MuonFixedLongId calibId) const
bool isSmallSector (MuonCalib::MuonFixedLongId calibId) const
void generateMap (const auto &helper_obj, const auto &idTool, MuonAlignmentErrorData::MuonAlignmentErrorRuleCache &adev_new, std::vector< MuonAlignmentErrorData::MuonAlignmentErrorRule > &devVec) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< CondAttrListCollectionm_readKey
SG::WriteCondHandleKey< MuonAlignmentErrorDatam_writeKey
Gaudi::Property< std::string > m_clobFileOverride
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ToolHandle< MuonCalib::IIdToFixedIdToolm_idTool {this, "idTool", "MuonCalib::IdToFixedIdTool"}
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 22 of file AlignmentErrorDbAlg.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

◆ ~AlignmentErrorDbAlg()

Muon::AlignmentErrorDbAlg::~AlignmentErrorDbAlg ( )
overridedefault

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 Muon::AlignmentErrorDbAlg::execute ( const EventContext & ctx) const
override

Definition at line 22 of file AlignmentErrorDbAlg.cxx.

22 {
23 ATH_MSG_DEBUG("execute " << name());
24
25 // Write Cond Handle
26
27 SG::WriteCondHandle writeHandle{m_writeKey, ctx};
28 if (writeHandle.isValid()) {
29 ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
30 << ". In theory this should not be called, but may happen"
31 << " if multiple concurrent events are being processed out of order.");
32 return StatusCode::SUCCESS;
33 }
34 auto writeCdo{std::make_unique<MuonAlignmentErrorData>()};
35
36 std::string clobContent;
37 EventIDRange rangeW;
38 std::tie(clobContent, rangeW) = m_clobFileOverride.value().empty() ? getDbClobContent(ctx) : getFileClobContent();
39
40 if (clobContent.empty()) {
41 ATH_MSG_ERROR("Cannot retrieve alignment error CLOB");
42 return StatusCode::FAILURE;
43 }
44
45 std::istringstream indata(clobContent);
46 if (!indata) {
47 ATH_MSG_ERROR("Alignment error configuration invalid");
48 return StatusCode::FAILURE;
49 }
50
51 ATH_MSG_DEBUG("***********************************");
52 ATH_MSG_DEBUG("PARSING LIST OF DEVIATIONS...");
53
54 std::string line;
55 std::vector<MuonAlignmentErrorData::MuonAlignmentErrorRule> MuonAlignmentErrorRuleVec;
56 MuonAlignmentErrorData::MuonAlignmentErrorRule aDev;
57 while (getline(indata, line)) {
58 // READING COMMENTS
59 if (line.compare(0, 1,"#") == 0) {
60 // ATH_MSG_DEBUG("Reading a commented line saying " << line);
61 continue;
62 }
63
64 // READING FROM INPUT FILE: //
65 std::string flag("");
66 std::string name_sstring("");
67 std::string multilayer_sstring("");
68 double translation(0.);
69 double rotation(0.);
70
71 // GET INPUT FILE VERSION
72 if (line.compare(0, 7, "version") == 0) {
73 std::string clobVersion;
74 std::istringstream(line) >> flag >> clobVersion;
75 ATH_MSG_INFO("*****************************************");
76 ATH_MSG_INFO("Input file version " << clobVersion);
77 ATH_MSG_INFO("*****************************************");
78 writeCdo->setClobVersion(std::move(clobVersion));
79 continue;
80 }
81
82 // get the flag has_nsw_hits
83 if (line.compare(0, 12, "has_nsw_hits") == 0) {
84 bool hasNswHits{false};
85 std::istringstream(line) >> flag >> hasNswHits;
86 writeCdo->setHasNswHits(hasNswHits);
87 continue;
88 }
89
90 // A FLAG CHARACTERIZING THE TYPE OF ERROR
91 // A REGULAR EXPRESSION FOR THE STATION NAME (EX: BIL.*) //
92 // TWO DOUBLES FOR THE TRANSLATION AND ROTATION DEVIATIONS //
93 if (std::istringstream(line) >> flag >> name_sstring >> multilayer_sstring >> translation >> rotation) {
94 ATH_MSG_DEBUG(flag << " " << name_sstring << " " << multilayer_sstring << " " << translation << " " << rotation);
95
96 // SAVING THE STATION DEVIATIONS IN THE STRUCT //
97 aDev.stationName = name_sstring;
98 aDev.multilayer = multilayer_sstring;
99 aDev.translation = translation;
100 aDev.rotation = rotation;
101
102 // FILLING THE VECTOR OF STRUCT CONTAINING THE STATION DEVIATIONS //
103 MuonAlignmentErrorRuleVec.emplace_back(std::move(aDev));
104
105 } // check stream is not at the end
106
107 } // end of loop on input file lines
108
109 std::vector<MuonAlignmentErrorData::MuonAlignmentErrorRuleCache> MuonAlignmentErrorRuleCacheVec;
110 MuonAlignmentErrorData::MuonAlignmentErrorRuleCache aDev_cache;
111
112 // Check the presence of detector elements in current reco and generate multimap to deviationVec
113 if (writeCdo->hasNswHits() == 1){
114 ATH_MSG_DEBUG("CLOB HAS NSW errors");
115 if(m_idHelperSvc->hasSTGC()){
116 ATH_MSG_DEBUG("HAS STGC");
117 generateMap(m_idHelperSvc->stgcIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
118 }
119 if(m_idHelperSvc->hasMM()){
120 ATH_MSG_DEBUG("HAS MM");
121 generateMap(m_idHelperSvc->mmIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
122 }
123 }
124 if (m_idHelperSvc->hasMDT()){
125 ATH_MSG_DEBUG("HAS MDT");
126 generateMap(m_idHelperSvc->mdtIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
127 }
128 if (m_idHelperSvc->hasRPC()){
129 ATH_MSG_DEBUG("HAS RPC");
130 generateMap(m_idHelperSvc->rpcIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
131 }
132 if (m_idHelperSvc->hasTGC()){
133 ATH_MSG_DEBUG("HAS TGC");
134 generateMap(m_idHelperSvc->tgcIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
135 }
136 if (m_idHelperSvc->hasCSC()){
137 ATH_MSG_DEBUG("HAS CSC");
138 generateMap(m_idHelperSvc->cscIdHelper(), m_idTool, aDev_cache, MuonAlignmentErrorRuleVec);
139 }
140
141 MuonAlignmentErrorRuleCacheVec.emplace_back(std::move(aDev_cache));
142 if (MuonAlignmentErrorRuleVec.empty()) {
143 ATH_MSG_WARNING("Could not read any alignment error configuration");
144 return StatusCode::FAILURE;
145 }
146
147 writeCdo->setAlignmentErrorRules(std::move(MuonAlignmentErrorRuleVec));
148 writeCdo->setMuonAlignmentErrorRuleCache(std::move(MuonAlignmentErrorRuleCacheVec));
149
150 if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
151 ATH_MSG_FATAL("Could not record MuonAlignmentErrorData " << writeHandle.key() << " with EventRange " << rangeW
152 << " into Conditions Store");
153 return StatusCode::FAILURE;
154 }
155 ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
156
157 return StatusCode::SUCCESS;
158}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
ToolHandle< MuonCalib::IIdToFixedIdTool > m_idTool
SG::WriteCondHandleKey< MuonAlignmentErrorData > m_writeKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::tuple< std::string, EventIDRange > getDbClobContent(const EventContext &ctx) const
std::tuple< std::string, EventIDRange > getFileClobContent() const
void generateMap(const auto &helper_obj, const auto &idTool, MuonAlignmentErrorData::MuonAlignmentErrorRuleCache &adev_new, std::vector< MuonAlignmentErrorData::MuonAlignmentErrorRule > &devVec) const
Gaudi::Property< std::string > m_clobFileOverride
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
bool flag
Definition master.py:29

◆ 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

◆ generateMap()

void Muon::AlignmentErrorDbAlg::generateMap ( const auto & helper_obj,
const auto & idTool,
MuonAlignmentErrorData::MuonAlignmentErrorRuleCache & adev_new,
std::vector< MuonAlignmentErrorData::MuonAlignmentErrorRule > & devVec ) const
inlineprivate

Definition at line 160 of file AlignmentErrorDbAlg.cxx.

162 {
163
164 for(auto itr = helper_obj.detectorElement_begin(); itr!= helper_obj.detectorElement_end(); ++itr){
165 // GATHERING INFORMATION TO PUT TOGETHER THE STATION NAME //
166 MuonCalib::MuonFixedLongId calibId = idTool->idToFixedLongId(*itr);
167 if (!calibId.isValid()) continue;
168 int multilayer = 1;
169 if (calibId.is_mdt()) {
170 multilayer = calibId.mdtMultilayer();
171 } else if (calibId.is_mmg()) {
172 multilayer = calibId.mmgMultilayer();
173 } else if (calibId.is_stg()) {
174 multilayer = calibId.stgMultilayer();
175 }
176 std::string multilayerName = std::to_string(multilayer);
177 std::string alignStationName = hardwareName(calibId);
179 // try to regexp-match the station name and the multilayer name then fill multimap
180 for (auto& iDev : devVec){
181 if (!boost::regex_match(alignStationName, iDev.stationName)) {
182 ++i;
183 continue;
184 }
185 if (!boost::regex_match(multilayerName, iDev.multilayer)) {
186 ++i;
187 continue;
188 }
189 adev_new.id_rule_map.insert({*itr, i});
190 ++i;
191 }
192 }
193}
int stgMultilayer() const
Stg specific:
int mdtMultilayer() const
Mdt specific:
int mmgMultilayer() const
Mmg specific:
bool isValid() const
check validity of the identifier.
std::string hardwareName(MuonCalib::MuonFixedLongId calibId) const
std::unordered_multimap< Identifier, MuonAlignmentErrorRuleIndex > id_rule_map
For each multilayer identifier, cache the indices of the affecting rules.

◆ getDbClobContent()

std::tuple< std::string, EventIDRange > Muon::AlignmentErrorDbAlg::getDbClobContent ( const EventContext & ctx) const
private

Definition at line 195 of file AlignmentErrorDbAlg.cxx.

195 {
196 // Read Cond Handle
197 SG::ReadCondHandle readCdo{m_readKey, ctx};
198 if (!readCdo.isValid()) {
199 ATH_MSG_ERROR("Null pointer to the read conditions object");
200 return {};
201 }
202
203 EventIDRange rangeW;
204 if (!readCdo.range(rangeW)) {
205 ATH_MSG_ERROR("Failed to retrieve validity range for " << m_readKey.key());
206 return {};
207 }
208
209 ATH_MSG_INFO("Size of CondAttrListCollection " << m_readKey.fullKey() << " readCdo->size()= " << readCdo->size());
210 ATH_MSG_INFO("Range of input is " << rangeW);
211
212 // like MuonAlignmentErrorDbTool::loadAlignmentError() after retrieving atrc (readCdo)
213
214 std::string clobContent, dbClobVersion;
216 for (itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
217 const coral::AttributeList& atr = itr->second;
218 clobContent = *(static_cast<const std::string*>((atr["syserrors"]).addressOfData()));
219 dbClobVersion = *(static_cast<const std::string*>((atr["version"]).addressOfData()));
220 }
221 return std::make_tuple(std::move(clobContent), rangeW);
222}
ChanAttrListMap::const_iterator const_iterator
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
bool range(EventIDRange &r)

◆ getFileClobContent()

std::tuple< std::string, EventIDRange > Muon::AlignmentErrorDbAlg::getFileClobContent ( ) const
private

Definition at line 224 of file AlignmentErrorDbAlg.cxx.

224 {
225 ATH_MSG_INFO("Retrieving alignment error CLOB from file override " << m_clobFileOverride.value());
226
227 std::ifstream in(m_clobFileOverride.value());
228 if (!in) {
229 ATH_MSG_ERROR("Failed to read CLOB file " << m_clobFileOverride.value());
230 return std::make_tuple(std::string(), EventIDRange());
231 }
232 return std::make_tuple(std::string(std::istreambuf_iterator<char>(in), {}), IOVInfiniteRange::infiniteTime());
233}
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.

◆ hardwareEta()

int Muon::AlignmentErrorDbAlg::hardwareEta ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 298 of file AlignmentErrorDbAlg.cxx.

298 {
299 using StationName = MuonCalib::MuonFixedLongId::StationName;
300 switch (calibId.stationName()) {
301 case StationName::BML:
302 {
303 if (sector(calibId)==13) {
304 switch (calibId.eta()) {
305 case 4: return 5;
306 case 5: return 6;
307 case 6: return 7;
308 case -4: return -5;
309 case -5: return -6;
310 case -6: return -7;
311 }
312 }
313 return calibId.eta();
314 }
315 case StationName::BOL:
316 {
317 // In sector 13, the BOE chambers are coded as BOL, with eta=7
318 if (sector(calibId)==13) {
319 if (calibId.eta()== 7) return 1; // BOE1A13 not BOL7A13
320 if (calibId.eta()==-7) return -1; // BOE1C13 not BOL7C13
321 }
322 return calibId.eta();
323 }
324 case StationName::BOF:
325 // In sectors 12 and 14 BOF1, BOF3, BOF5 are coded with eta=1,2,3
326 return calibId.eta()>0 ? calibId.eta()*2-1 : calibId.eta()*2+1;
327 case StationName::BOG:
328 // In sectors 12 and 14, BOG2, BOG4, BOG6 are coded with eta=1,2,3
329 return calibId.eta()*2;
330 case StationName::EIL:
331 {
332 if ((sector(calibId) == 1) || (sector(calibId) == 9)) {
333 switch (calibId.eta()) {
334 // In sectors 1 and 9 the small chamber is called EIL5, although it comes inward wrt EIL4, so athena indices need to be swapped
335 case 4: return 5;
336 case 5: return 4;
337 case -4: return -5;
338 case -5: return -4;
339 }
340 }
341 return calibId.eta();
342 }
343 case StationName::EEL:
344 {
345 // In sector 5, special EEL chamber called EEL2X05, while athena eta = 1
346 if ((sector(calibId) == 5) && (calibId.eta() == 1)) return 2;
347 if ((sector(calibId) == 5) && (calibId.eta() == -1)) return -2;
348 return calibId.eta();
349 }
350 default: return calibId.eta();
351 }
352}
StationName
an enum with the station names
StationName stationName() const
int sector(MuonCalib::MuonFixedLongId calibId) const

◆ hardwareName()

std::string Muon::AlignmentErrorDbAlg::hardwareName ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 238 of file AlignmentErrorDbAlg.cxx.

238 {
239 using StationName = MuonCalib::MuonFixedLongId::StationName;
240
241 // The only exception that cannot be caught by hardwareEta() above
242 if (sector(calibId)==13) {
243 if (calibId.eta()== 7 && calibId.stationName()==StationName::BOL) return "BOE1A13"; // BOE1A13 not BOL7A13
244 if (calibId.eta()==-7 && calibId.stationName()==StationName::BOL) return "BOE1C13"; // BOE1C13 not BOL7C13
245 if (calibId.eta()== 8 && calibId.stationName()==StationName::BOL) return "BOE2A13"; // BOE2A13 not BOL8A13
246 if (calibId.eta()==-8 && calibId.stationName()==StationName::BOL) return "BOE2C13"; // BOE2C13 not BOL8C13
247 }
248
249 std::string ret = std::format("{}{}{}{}", calibId.stationNameString(), std::abs(hardwareEta(calibId)), side(calibId), sectorString(calibId) );
250 return ret;
251}
std::string_view stationNameString() const
std::string sectorString(MuonCalib::MuonFixedLongId calibId) const
int hardwareEta(MuonCalib::MuonFixedLongId calibId) const
std::string_view side(MuonCalib::MuonFixedLongId calibId) const

◆ initialize()

StatusCode Muon::AlignmentErrorDbAlg::initialize ( )
override

Definition at line 13 of file AlignmentErrorDbAlg.cxx.

13 {
14 ATH_MSG_DEBUG("initialize " << name());
15 ATH_CHECK(m_readKey.initialize());
16 ATH_CHECK(m_writeKey.initialize());
17 ATH_CHECK(m_idHelperSvc.retrieve());
18 ATH_CHECK(m_idTool.retrieve());
19 return StatusCode::SUCCESS;
20}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ 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; }

◆ isSmallSector()

bool Muon::AlignmentErrorDbAlg::isSmallSector ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 274 of file AlignmentErrorDbAlg.cxx.

274 {
275 using StationName = MuonCalib::MuonFixedLongId::StationName;
276 switch (calibId.stationName()) {
277 case StationName::BIS:
278 case StationName::BMS:
279 case StationName::BOS:
280 case StationName::BEE:
281 case StationName::BMF:
282 case StationName::BOF:
283 case StationName::BOG:
284 case StationName::EES:
285 case StationName::EMS:
286 case StationName::EOS:
287 case StationName::EIS:
288 case StationName::CSS:
289 case StationName::BMG:
290 case StationName::MMS:
291 case StationName::STS:
292 return true;
293 default:
294 return false;
295 }
296}

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

◆ sector()

int Muon::AlignmentErrorDbAlg::sector ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 265 of file AlignmentErrorDbAlg.cxx.

265 {
266 if (calibId.is_tgc()) {
267 // TGC sector convention is special
268 return calibId.phi();
269 } else {
270 return isSmallSector(calibId) ? 2*calibId.phi() : 2*calibId.phi()-1;
271 }
272}
bool isSmallSector(MuonCalib::MuonFixedLongId calibId) const

◆ sectorString()

std::string Muon::AlignmentErrorDbAlg::sectorString ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 257 of file AlignmentErrorDbAlg.cxx.

257 {
258 int sec = sector(calibId);
259 if (sec<0 || sec > 99) {
260 throw std::runtime_error("Unhandled sector number");
261 }
262 return std::to_string(sec/10) + std::to_string(sec%10);
263}

◆ 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

◆ side()

std::string_view Muon::AlignmentErrorDbAlg::side ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 253 of file AlignmentErrorDbAlg.cxx.

253 {
254 return calibId.eta()>0 ? "A" : calibId.eta()<0 ? "C" : "B";
255}

◆ 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}
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.

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

Gaudi::Property<std::string> Muon::AlignmentErrorDbAlg::m_clobFileOverride
private
Initial value:
{this, "clobFileOverride", "",
"Set this to the location of a CLOB file to override the DB setting"}

Definition at line 39 of file AlignmentErrorDbAlg.h.

39 {this, "clobFileOverride", "",
40 "Set this to the location of a CLOB file to override the DB setting"};

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

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::AlignmentErrorDbAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 41 of file AlignmentErrorDbAlg.h.

41{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_idTool

ToolHandle<MuonCalib::IIdToFixedIdTool> Muon::AlignmentErrorDbAlg::m_idTool {this, "idTool", "MuonCalib::IdToFixedIdTool"}
private

Definition at line 42 of file AlignmentErrorDbAlg.h.

42{this, "idTool", "MuonCalib::IdToFixedIdTool"};

◆ m_readKey

SG::ReadCondHandleKey<CondAttrListCollection> Muon::AlignmentErrorDbAlg::m_readKey
private
Initial value:
{this, "ReadKey", "/MUONALIGN/ERRS",
"Key of input muon alignment error condition data"}

Definition at line 35 of file AlignmentErrorDbAlg.h.

35 {this, "ReadKey", "/MUONALIGN/ERRS",
36 "Key of input muon alignment error condition data"};

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

◆ m_writeKey

SG::WriteCondHandleKey<MuonAlignmentErrorData> Muon::AlignmentErrorDbAlg::m_writeKey
private
Initial value:
{this, "WriteKey", "MuonAlignmentErrorData",
"Key of output muon alignment error condition data"}

Definition at line 37 of file AlignmentErrorDbAlg.h.

37 {this, "WriteKey", "MuonAlignmentErrorData",
38 "Key of output muon alignment error condition data"};

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