7 #include <GaudiKernel/EventIDRange.h>
19 return StatusCode::SUCCESS;
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;
34 std::unique_ptr<MuonAlignmentErrorData> writeCdo{std::make_unique<MuonAlignmentErrorData>()};
36 std::string clobContent;
40 if (clobContent.empty()) {
42 return StatusCode::FAILURE;
45 std::istringstream indata(clobContent);
48 return StatusCode::FAILURE;
55 std::vector<MuonAlignmentErrorData::Deviation> deviationVec;
57 while (getline(indata,
line)) {
59 if (
line.compare(0, 1,
"#") == 0) {
66 std::string name_sstring(
"");
67 std::string multilayer_sstring(
"");
68 double translation(0.);
72 if (
line.compare(0, 7,
"version") == 0) {
73 std::string clobVersion;
74 std::istringstream(
line) >>
flag >> clobVersion;
75 ATH_MSG_INFO(
"*****************************************");
77 ATH_MSG_INFO(
"*****************************************");
78 writeCdo->setClobVersion(std::move(clobVersion));
83 if (
line.compare(0, 12,
"has_nsw_hits") == 0) {
84 bool hasNswHits{
false};
85 std::istringstream(
line) >>
flag >> hasNswHits;
86 writeCdo->setHasNswHits(hasNswHits);
93 if (std::istringstream(
line) >>
flag >> name_sstring >> multilayer_sstring >> translation >>
rotation) {
103 deviationVec.emplace_back(std::move(aDev));
109 if (deviationVec.empty()) {
111 return StatusCode::FAILURE;
113 writeCdo->setDeviations(std::move(deviationVec));
115 if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
116 ATH_MSG_FATAL(
"Could not record MuonAlignmentErrorData " << writeHandle.key() <<
" with EventRange " << rangeW
117 <<
" into Conditions Store");
118 return StatusCode::FAILURE;
120 ATH_MSG_INFO(
"recorded new " << writeHandle.key() <<
" with range " << rangeW <<
" into Conditions Store");
122 return StatusCode::SUCCESS;
131 if (readCdo ==
nullptr) {
133 return std::make_tuple(std::string(), EventIDRange());
137 if (!readHandle.range(rangeW)) {
138 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << readHandle.key());
139 return std::make_tuple(std::string(), EventIDRange());
142 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
147 std::string clobContent, dbClobVersion;
149 for (itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
151 clobContent = *(
static_cast<const std::string*
>((atr[
"syserrors"]).addressOfData()));
152 dbClobVersion = *(
static_cast<const std::string*
>((atr[
"version"]).addressOfData()));
154 return std::make_tuple(std::move(clobContent), rangeW);
163 return std::make_tuple(std::string(), EventIDRange());