13const std::string
r_t(
"\\[([0-9]+),([0-9]+)\\]");
14const std::string
r_r =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}\\s*";
15const std::string
r_e =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}=([0-9]+)\\s*";
16const std::string
r_ef =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}=(-*[0-9]*\\.*[0-9]*)\\s*";
25 base_class(name,svcLoc)
34 StatusCode
sc(AthService::initialize());
35 msg().setLevel( m_outputLevel.value() );
37 if (!
sc.isSuccess()) {
38 warning () <<
"Base class could not be initialized" <<
endmsg;
39 return StatusCode::FAILURE;
44 return StatusCode::SUCCESS;
48 return StatusCode::FAILURE;
51 std::ostringstream ost;
52 ost <<
" Printing CondDB registry";
54 ost << std::endl <<
" - id: " << e.first <<
" r:";
56 ost <<
" " <<
r.range() <<
" :: " << *
r.objPtr();
62 return StatusCode::SUCCESS;
70 StatusCode
sc(StatusCode::SUCCESS);
74 std::ifstream ifs (fname);
80 while( getline (ifs, line) ) {
83 size_t fh = line.find(
"#");
84 if(fh != std::string::npos)
85 line.erase(fh,line.length()-fh);
86 if (line.length() == 0)
continue;
88 std::vector<std::string> tokens;
89 for (
auto&& token : line | std::views::split(
' '))
if (!token.empty()) tokens.emplace_back(token.begin(), token.end());
90 auto it = tokens.begin();
92 std::string dbKey = *it;
96 while (it != tokens.end()) {
100 error() <<
"while reading " << fname <<
" problem parsing " << *it
101 <<
" in line\n" << line <<
endmsg;
102 sc = StatusCode::FAILURE;
110 sc = StatusCode::FAILURE;
121 std::ostringstream ost;
124 info() << ost.str() <<
endmsg;
136 ost <<
"ASCIICondDbSvc::dump()";
149 if (msgLvl(MSG::DEBUG)) {
150 std::ostringstream ost;
157 for (
auto ie : e.second ) {
164 return StatusCode::SUCCESS;
174 std::regex_match(s,m,
rr);
180 if (m.size() != 5) {
return false; }
183 EventIDBase start(std::stoi(m[1]), EventIDBase::UNDEFEVT, std::stoi(m[2]));
184 EventIDBase end(std::stoi(m[3]), EventIDBase::UNDEFEVT, std::stoi(m[4]));
186 start.set_lumi_block(
m_lbn);
187 end.set_lumi_block(
m_lbn);
189 t = EventIDRange(start, end);
201 std::regex_match(s,m,
ref);
203 if (m.size() != 6) {
return false; }
212 EventIDBase start(0, EventIDBase::UNDEFEVT,
214 EventIDBase end(EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT,
216 start.set_lumi_block(std::stoi(m[1]));
217 end.set_lumi_block(std::stoi(m[3]));
225 ie.setRange(EventIDRange(start,end));
242 registry_t::const_iterator itr =
m_registry.find(dbKey);
245 error() <<
"getRange: no dbKey " << dbKey <<
" found in registry"
247 return StatusCode::FAILURE;
251 debug() <<
"compare " << e.range() <<
" with " << ctx.eventID()
253 if (e.range().isInRange(EventIDBase(ctx.eventID()))) {
256 return StatusCode::SUCCESS;
260 error() <<
"getRange: no range for Time " << ctx.eventID()
261 <<
" found for dbKey " << dbKey <<
endmsg;
263 return StatusCode::FAILURE;
const std::regex ref(r_ef)
const std::string r_t("\\[([0-9]+),([0-9]+)\\]")
Hold mappings of ranges to condition objects.
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
virtual StatusCode getRange(const std::string &, const EventContext &, EventIDRange &, IASCIICondDbSvc::dbData_t &) const override
Gaudi::Property< unsigned int > m_lbn
virtual StatusCode finalize() override
Gaudi::Property< std::string > m_file
virtual StatusCode initialize() override
ASCIICondDbSvc(const std::string &name, ISvcLocator *svc)
bool parse(EventIDRange &t, const std::string &s)
StatusCode readDbFile(const std::string &)
virtual void dump() const override