25 return StatusCode::SUCCESS;
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;
37 auto writeCdo{std::make_unique<ALineContainer>()};
42 return StatusCode::FAILURE;
51 itr != readHandle->end(); ++itr) {
53 const coral::AttributeList& atr = itr->second;
55 if (atr[
"data"].specification().
type() ==
typeid(coral::Blob)) {
59 return StatusCode::FAILURE;
62 data = *(
static_cast<const std::string*
>((atr[
"data"]).addressOfData()));
65 nlohmann::json lines = nlohmann::json::array();
69 nlohmann::json j = nlohmann::json::parse(
data);
70 lines = j[
"corrections"];
79 if (!inStream.good()) {
81 return StatusCode::FAILURE;
92 return StatusCode::SUCCESS;
98 constexpr std::string_view delimiter{
"\n"};
99 json = nlohmann::json::array();
101 for (
const std::string& blobline : lines) {
103 constexpr std::string_view delimiter {
":"};
106 if (tokens.empty()) {
108 return StatusCode::FAILURE;
110 const std::string_view
type = tokens[0];
112 if (
'#' ==
type[0]) {
116 if (
type.compare(0, 4,
"Corr") == 0) {
123 constexpr std::string_view delimiter{
" "};
125 if (tokens.size() != 12) {
126 ATH_MSG_FATAL(
"Invalid length in string retrieved from DB in folder. String length is "
128 return StatusCode::FAILURE;
138 line[
"typ"] = std::string(tokens[ival++]);
152 if (line.empty())
continue;
153 json.push_back(std::move(line));
155 return StatusCode::SUCCESS;
160 for (
auto& corr : lines.items()) {
161 nlohmann::json line = corr.value();
165 const int jff = line[
"jff"];
166 const int jzz = line[
"jzz"];
167 const int job = line[
"job"];
168 const int jlay = line[
"jlay"];
169 const std::string stationType = line[
"typ"];
170 newILine.
setAmdbId(stationType, jzz, jff, job);
173 bool is_valid{
false};
174 if (stationType[0] ==
'C') {
176 constexpr int chamberLayer = 2;
177 if (job != 3)
ATH_MSG_WARNING(
"job = " << job <<
" is not 3 => chamberLayer should be 1 - not existing ! setting 2");
178 id =
m_idHelperSvc->cscIdHelper().channelID(stationType, jzz, jff, chamberLayer, jlay, 0, 1, is_valid);
182 ATH_MSG_ERROR(
"There is a non CSC chamber in the list of CSC internal alignment parameters.");
183 return StatusCode::FAILURE;
187 newILine.
setParameters(line[
"tras"], line[
"traz"], line[
"trat"],
188 line[
"rots"], line[
"rotz"], line[
"rott"]);
190 const auto insertItr = writeCdo.insert(newILine);
191 if (!insertItr.second) {
192 ATH_MSG_FATAL(
"Could not insert "<<newILine<<
" as "<<(*insertItr.first)<<
" has already been safed before" );
193 return StatusCode::FAILURE;
197 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::set< ALinePar, std::less<> > ALineContainer
char data[hepevt_bytes_allocation_ATLAS]
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
void setParameters(float s, float z, float t, float rotS, float rotZ, float rotT)
ChanAttrListMap::const_iterator const_iterator
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
void setIdentifier(const Identifier &id)
Setters and getters for the Athena Identifier.
void setAmdbId(const std::string &stName, int stEta, int stPhi, int stJob)
AMDB identifiers. They're often not the same as the ATLAS ones (TGCs)
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
SG::WriteCondHandleKey< ALineContainer > m_writeKey
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< std::string > m_readFromJSON
Load the alignment parameters from a JSON file.
Gaudi::Property< bool > m_newFormat2020
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode loadDataFromLegacy(const std::string &data, nlohmann::json &json) const
Load the Alignment data from the legacy format where the channels are parsed line wise The data is th...
StatusCode parseDataFromJSON(const nlohmann::json &lines, ALineContainer &writeCdo) const
Parse the JSON blob to fill the I Line container.
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
bool readBlobAsString(const coral::Blob &, std::string &)
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
double atof(std::string_view str)
Converts a string into a double / float.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.