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

MuonAlignmentErrorDbAlg reads raw condition data and writes derived condition data (MuonAlignmentErrorData) to the condition store. More...

#include <MuonAlignmentErrorDbAlg.h>

Inheritance diagram for MuonAlignmentErrorDbAlg:
Collaboration diagram for MuonAlignmentErrorDbAlg:

Public Member Functions

 MuonAlignmentErrorDbAlg (const std::string &name, ISvcLocator *pSvcLocator)
 ~MuonAlignmentErrorDbAlg () 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

MuonAlignmentErrorDbAlg reads raw condition data and writes derived condition data (MuonAlignmentErrorData) to the condition store.

Definition at line 23 of file MuonAlignmentErrorDbAlg.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

◆ MuonAlignmentErrorDbAlg()

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

Definition at line 12 of file MuonAlignmentErrorDbAlg.cxx.

12 :
13 AthCondAlgorithm(name, pSvcLocator) {}

◆ ~MuonAlignmentErrorDbAlg()

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

Definition at line 24 of file MuonAlignmentErrorDbAlg.cxx.

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

Definition at line 162 of file MuonAlignmentErrorDbAlg.cxx.

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

Definition at line 197 of file MuonAlignmentErrorDbAlg.cxx.

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

◆ getFileClobContent()

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

Definition at line 229 of file MuonAlignmentErrorDbAlg.cxx.

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

◆ hardwareEta()

int MuonAlignmentErrorDbAlg::hardwareEta ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 303 of file MuonAlignmentErrorDbAlg.cxx.

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

◆ hardwareName()

std::string MuonAlignmentErrorDbAlg::hardwareName ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 243 of file MuonAlignmentErrorDbAlg.cxx.

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

◆ initialize()

StatusCode MuonAlignmentErrorDbAlg::initialize ( )
override

Definition at line 15 of file MuonAlignmentErrorDbAlg.cxx.

15 {
16 ATH_MSG_DEBUG("initialize " << name());
17 ATH_CHECK(m_readKey.initialize());
18 ATH_CHECK(m_writeKey.initialize());
19 ATH_CHECK(m_idHelperSvc.retrieve());
20 ATH_CHECK(m_idTool.retrieve());
21 return StatusCode::SUCCESS;
22}
#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 MuonAlignmentErrorDbAlg::isSmallSector ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 279 of file MuonAlignmentErrorDbAlg.cxx.

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

◆ 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 MuonAlignmentErrorDbAlg::sector ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 270 of file MuonAlignmentErrorDbAlg.cxx.

270 {
271 if (calibId.is_tgc()) {
272 // TGC sector convention is special
273 return calibId.phi();
274 } else {
275 return isSmallSector(calibId) ? 2*calibId.phi() : 2*calibId.phi()-1;
276 }
277}
bool isSmallSector(MuonCalib::MuonFixedLongId calibId) const

◆ sectorString()

std::string MuonAlignmentErrorDbAlg::sectorString ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 262 of file MuonAlignmentErrorDbAlg.cxx.

262 {
263 int sec = sector(calibId);
264 if (sec<0 || sec > 99) {
265 throw std::runtime_error("Unhandled sector number");
266 }
267 return std::to_string(sec/10) + std::to_string(sec%10);
268}

◆ 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 MuonAlignmentErrorDbAlg::side ( MuonCalib::MuonFixedLongId calibId) const
inlineprivate

Definition at line 258 of file MuonAlignmentErrorDbAlg.cxx.

258 {
259 return calibId.eta()>0 ? "A" : calibId.eta()<0 ? "C" : "B";
260}

◆ 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> MuonAlignmentErrorDbAlg::m_clobFileOverride
private
Initial value:
{this, "clobFileOverride", "",
"Set this to the location of a CLOB file to override the DB setting"}

Definition at line 41 of file MuonAlignmentErrorDbAlg.h.

41 {this, "clobFileOverride", "",
42 "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> MuonAlignmentErrorDbAlg::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 43 of file MuonAlignmentErrorDbAlg.h.

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

◆ m_idTool

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

Definition at line 44 of file MuonAlignmentErrorDbAlg.h.

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

◆ m_readKey

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

Definition at line 37 of file MuonAlignmentErrorDbAlg.h.

37 {this, "ReadKey", "/MUONALIGN/ERRS",
38 "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> MuonAlignmentErrorDbAlg::m_writeKey
private
Initial value:
{this, "WriteKey", "MuonAlignmentErrorData",
"Key of output muon alignment error condition data"}

Definition at line 39 of file MuonAlignmentErrorDbAlg.h.

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

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