Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed LHCInfoPer* PopCons not recoginizing ongoing fills in duringFill mode #42837

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CondTools/RunInfo/plugins/LHCInfoPerFillPopConAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ namespace theLHCInfoPerFillImpl {
auto energy = row.get<float>("energy");
auto creationTime = row.get<boost::posix_time::ptime>("start_time");
auto stableBeamStartTime = row.get<boost::posix_time::ptime>("start_stable_beam");
auto beamDumpTime = row.get<boost::posix_time::ptime>("end_time");
std::string endTimeStr = row.get<std::string>("end_time");
auto beamDumpTime =
(endTimeStr == "null") ? 0 : cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
auto injectionScheme = row.get<std::string>("injection_scheme");
targetPayload = std::make_unique<LHCInfoPerFill>();
targetPayload->setFillNumber(currentFill);
Expand All @@ -114,7 +116,7 @@ namespace theLHCInfoPerFillImpl {
targetPayload->setEnergy(energy);
targetPayload->setCreationTime(cond::time::from_boost(creationTime));
targetPayload->setBeginTime(cond::time::from_boost(stableBeamStartTime));
targetPayload->setEndTime(cond::time::from_boost(beamDumpTime));
targetPayload->setEndTime(beamDumpTime);
targetPayload->setInjectionScheme(injectionScheme);
ret = true;
}
Expand Down
13 changes: 10 additions & 3 deletions CondTools/RunInfo/plugins/LHCInfoPerLSPopConAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,18 @@ class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler<LHCIn
oms.connect(m_omsBaseUrl);
auto query = oms.query("fills");
query->addOutputVar("end_time");
query->addOutputVar("start_time");
query->filterEQ("fill_number", m_prevPayload->fillNumber());
bool foundFill = query->execute();
if (foundFill) {
auto result = query->result();

if (!result.empty()) {
auto endFillTime = (*result.begin()).get<boost::posix_time::ptime>("end_time");
m_prevEndFillTime = cond::time::from_boost(endFillTime);
std::string endTimeStr = (*result.begin()).get<std::string>("end_time");
m_prevEndFillTime =
(endTimeStr == "null")
? 0
: cond::time::from_boost((*result.begin()).get<boost::posix_time::ptime>("end_time"));
auto startFillTime = (*result.begin()).get<boost::posix_time::ptime>("start_time");
m_prevStartFillTime = cond::time::from_boost(startFillTime);
} else {
Expand Down Expand Up @@ -362,7 +366,9 @@ class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler<LHCIn
auto row = *queryResult.begin();
auto currentFill = row.get<unsigned short>("fill_number");
m_startFillTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("start_time"));
m_endFillTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
std::string endTimeStr = row.get<std::string>("end_time");
m_endFillTime =
(endTimeStr == "null") ? 0 : cond::time::from_boost(row.get<boost::posix_time::ptime>("end_time"));
m_startStableBeamTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("start_stable_beam"));
m_endStableBeamTime = cond::time::from_boost(row.get<boost::posix_time::ptime>("end_stable_beam"));
targetPayload = std::make_unique<LHCInfoPerLS>();
Expand Down Expand Up @@ -431,6 +437,7 @@ class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler<LHCIn
}
return nlumi;
}

bool getCTPPSData(cond::persistency::Session& session,
const boost::posix_time::ptime& beginFillTime,
const boost::posix_time::ptime& endFillTime) {
Expand Down
6 changes: 3 additions & 3 deletions CondTools/RunInfo/test/test_lhcInfoNewPopCon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function assert_found_fills {

rm -f lhcinfo_pop_unit_test.db

echo "testing LHCInfoPerFillPopConAnalyzer in EndFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
echo "testing LHCInfoPerFillPopConAnalyzer in endFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer.py mode=endFill \
destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
Expand All @@ -50,11 +50,11 @@ cmsRun ${SCRIPTS_DIR}/LHCInfoPerLSPopConAnalyzer.py mode=endFill \
destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
startTime="2022-07-11 22:00:00.000" endTime="2022-07-12 18:10:10.000" \
tag=ls_end_test2 > ls_end_test2.log || die "cmsRun LHCInfoPerLSPopConAnalyzer.py mode=endFill" $?
assert_equal 69 `cat ls_end_test2.log | grep -E '^Since ' | \
assert_equal 70 `cat ls_end_test2.log | grep -E '^Since ' | \
rappoccio marked this conversation as resolved.
Show resolved Hide resolved
wc -l` "LHCInfoPerLSPopConAnalyzer in endFill mode written wrong number of payloads"
assert_found_fills ls_end_test2.log "LHCInfoPerLSPopConAnalyzer in endFill mode" 7967

echo "testing LHCInfoPerFillPopConAnalyzer in DuringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
echo "testing LHCInfoPerFillPopConAnalyzer in duringFill mode for startTime=\"2022-10-24 01:00:00.000\" endTime=\"2022-10-24 20:00:00.000\""
cmsRun ${SCRIPTS_DIR}/LHCInfoPerFillPopConAnalyzer.py mode=duringFill \
destinationConnection="sqlite_file:lhcinfo_pop_unit_test.db" \
startTime="2022-10-24 01:00:00.000" endTime="2022-10-24 20:00:00.000" \
Expand Down