|
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "CoralBase/Attribute.h"
14 #include "CoralBase/AttributeListSpecification.h"
15 #include "GaudiKernel/ConcurrencyFlags.h"
29 ATH_MSG_ERROR(
"There's no point in setting up this algorithm if neither A or B Lines shall be processed");
30 return StatusCode::FAILURE;
39 return StatusCode::SUCCESS;
47 if (writeALineHandle.isValid()) {
48 ATH_MSG_DEBUG(
"CondHandle " << writeALineHandle.fullKey() <<
" is already valid."
49 <<
". In theory this should not be called, but may happen"
50 <<
" if multiple concurrent events are being processed out of order.");
51 return StatusCode::SUCCESS;
60 if (writeBLineHandle.isValid()) {
61 ATH_MSG_DEBUG(
"CondHandle " << writeBLineHandle.fullKey() <<
" is already valid."
62 <<
". In theory this should not be called, but may happen"
63 <<
" if multiple concurrent events are being processed out of order.");
64 return StatusCode::SUCCESS;
68 std::unique_ptr<ALineContainer> writeALineCdo{std::make_unique<ALineContainer>()};
69 std::unique_ptr<BLineContainer> writeBLineCdo{std::make_unique<BLineContainer>()};
76 if (!inStream.good()) {
78 return StatusCode::FAILURE;
87 return StatusCode::SUCCESS;
89 template <
class ContType>
92 std::unique_ptr<ContType>&& container)
const {
93 if (writeKey.
empty()) {
94 ATH_MSG_DEBUG(
"The key of type "<<
typeid(ContType).
name()<<
" is not set. Assume that nothing shall be written.");
95 return StatusCode::SUCCESS;
102 if (!readHandle.isValid()){
104 return StatusCode::FAILURE;
106 ATH_MSG_INFO(
"Attach new dependency from <"<<readHandle.key()<<
"> to the "<<
typeid(ContType).name()<<
". IOV: "<<readHandle.getRange());
107 writeHandle.addDependency(readHandle);
109 ATH_CHECK(writeHandle.record(std::move(container)));
110 return StatusCode::SUCCESS;
118 if (!readHandle.isValid()){
120 return StatusCode::FAILURE;
132 return StatusCode::FAILURE;
135 data = *(
static_cast<const std::string*
>((atr[
"data"]).addressOfData()));
142 lines = j[
"corrections"];
150 return StatusCode::SUCCESS;
157 for (
auto& corr :
lines.items()) {
161 const std::string stationType =
line[
"typ"];
167 if (stationType[0] ==
'M') {
173 }
else if (stationType[0] ==
'S') {
180 }
else if (stationType[0] ==
'T') {
192 id =
m_idHelperSvc->tgcIdHelper().elementID(stationType, stEta, stPhi);
193 }
else if (stationType[0] ==
'C') {
199 }
else if (stationType.substr(0, 3) ==
"BML" && std::abs(
stationEta) == 7) {
214 newALine.setParameters(
line[
"svalue"],
line[
"zvalue"],
line[
"tvalue"],
216 auto aLineInsert = writeALineCdo.insert(newALine);
217 if (newALine && !aLineInsert.second) {
219 <<
" because "<<(*aLineInsert.first)<<
" has been added before");
223 if (
line.find(
"bz") ==
line.end()) {
231 newBLine.setIdentifier(
id);
234 auto bLineInsert = writeBLineCdo.insert(newBLine);
235 if (newBLine && !bLineInsert.second){
237 <<
" because "<<(*bLineInsert.first)<<
" has been added before.");
240 return StatusCode::SUCCESS;
244 bool loadBLines)
const {
247 constexpr std::string_view
delimiter{
"\n"};
251 for (
const std::string& blobline :
lines) {
253 constexpr std::string_view
delimiter{
":"};
259 return StatusCode::FAILURE;
263 if (
type[0] ==
'#') {
274 if (
type.compare(0, 4,
"Corr") == 0) {
275 constexpr std::string_view
delimiter{
" "};
277 if (
tokens.size() != 25) {
279 return StatusCode::FAILURE;
321 return StatusCode::SUCCESS;
char data[hepevt_bytes_allocation_ATLAS]
constexpr uint8_t stationPhi
station Phi 1 to 8
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
void setIdentifier(const Identifier &id)
Setters and getters for the Athena Identifier.
MuonAlignmentCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
#define ATH_MSG_VERBOSE(x)
bool empty() const
Test if the key is blank.
An algorithm that can be simultaneously executed in multiple threads.
void setParameters(float bz, float bp, float bn, float sp, float sn, float tw, float pg, float tr, float eg, float ep, float en)
Cast the parameter to an unsigned int
bool readBlobAsString(const coral::Blob &, std::string &)
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< bool > m_newFormat2020
std::set< ALinePar, std::less<> > ALineContainer
SG::WriteCondHandleKey< ALineContainer > m_writeALineKey
SG::WriteCondHandleKey< BLineContainer > m_writeBLineKey
double atof(std::string_view str)
Converts a string into a double / float.
Gaudi::Property< bool > m_loadBLines
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode writeContainer(const EventContext &ctx, const SG::WriteCondHandleKey< ContType > &writeKey, std::unique_ptr< ContType > &&container) const
Attaches the dependencies of the Alignment keys onto the A & Bline container.
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_alignKeys
StatusCode loadDataFromLegacy(const std::string &data, nlohmann::json &json, bool loadBLines) const
Load the Alignment data from the legacy format where the channels are parsed line wise The data is th...
StatusCode initialize(bool used=true)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< std::string > m_readFromJSON
Load the alignment parameters from a JSON file.
StatusCode parseDataFromJSON(const nlohmann::json &lines, ALineContainer &writeALineCdo, BLineContainer &writeBLineCdo) const
Parse the JSON blob to fill the A & B Line containers.
#define ATH_MSG_WARNING(x)
ChanAttrListMap::const_iterator const_iterator
Gaudi::Property< bool > m_loadALines
int stationPhiTGC(std::string_view stName, int fi, int zi_input)
Converts the AMDB phi index to the Identifier phi Index.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
std::set< BLinePar, std::less<> > BLineContainer
constexpr uint8_t stationEta
1 to 3
StatusCode loadCoolFolder(const EventContext &ctx, const SG::ReadCondHandleKey< CondAttrListCollection > &key, ALineContainer &writeALineCdo, BLineContainer &writeBLineCdo) const
Retrieves the alignment parameters from a COOL folder.