Skip to content

Commit be1fc65

Browse files
JanChyczynskiperrotta
authored andcommitted
HLT-compatible LHCInfoPer* PopCon (duringFill mode)
adjust LHCInfoPer*PopConSourceHandler duringFill mode for HLT-compatibility fix LHCInfoPerLS PopCon duringFill startSampleTime error fix filtering in duringFill mode (prevPayload error) Remove adding empty payload to empty tag Extract SourceHandler from LHCInfoPer*PopConAnalyzer Make perLS and perFill duringFill use OnlinePopCon Attempt to configure OnlineDBOutputService in LHCInfoPer*PopConAnalyzer_cfg.py finish LHCInfoPer*PopConAnalyzer_cfg files for updated duringFill For perLS duringfill implement adding defaultPayload and skipping invalid payloads implement adding defaultPayload in duringFill mode duringFill perLS: skip upload if invalid values Adjust duringFill unit tests remove duplicated kLumisectionsQueryLimit fix unit tests, print logs of failed lhcInfoNewPopCon test add connection strings as cfg parameters, fix frontier key parameter for perFill
1 parent c8a3095 commit be1fc65

17 files changed

+1846
-1395
lines changed

CondTools/RunInfo/interface/LHCInfoHelper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ namespace cond {
1111
// Large number of LS for the OMS query, covering around 25 hours
1212
static constexpr unsigned int kLumisectionsQueryLimit = 4000;
1313

14+
// last Run number and LS number of the specified Fill
15+
std::pair<int, unsigned short> getFillLastRunAndLS(const cond::OMSService& oms, unsigned short fillId);
16+
1417
// Returns lumi-type IOV from last LS of last Run of the specified Fill
1518
cond::Time_t getFillLastLumiIOV(const cond::OMSService& oms, unsigned short fillId);
1619

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include "CondCore/PopCon/interface/PopConSourceHandler.h"
2+
#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h"
3+
#include "CondTools/RunInfo/interface/OMSAccess.h"
4+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
5+
6+
class LHCInfoPerFillPopConSourceHandler : public popcon::PopConSourceHandler<LHCInfoPerFill> {
7+
public:
8+
LHCInfoPerFillPopConSourceHandler(edm::ParameterSet const& pset);
9+
~LHCInfoPerFillPopConSourceHandler() override = default;
10+
11+
void getNewObjects() override;
12+
std::string id() const override;
13+
14+
private:
15+
void addEmptyPayload(cond::Time_t iov);
16+
17+
// Add payload to buffer and store corresponding lumiid IOV in m_timestampToLumiid map
18+
void addPayloadToBuffer(cond::OMSServiceResultRef& row);
19+
void convertBufferedIovsToLumiid(std::map<cond::Time_t, cond::Time_t> timestampToLumiid);
20+
21+
size_t getLumiData(const cond::OMSService& oms,
22+
unsigned short fillId,
23+
const boost::posix_time::ptime& beginFillTime,
24+
const boost::posix_time::ptime& endFillTime);
25+
26+
void getDipData(const cond::OMSService& oms,
27+
const boost::posix_time::ptime& beginFillTime,
28+
const boost::posix_time::ptime& endFillTime);
29+
30+
bool getCTPPSData(cond::persistency::Session& session,
31+
const boost::posix_time::ptime& beginFillTime,
32+
const boost::posix_time::ptime& endFillTime);
33+
34+
bool getEcalData(cond::persistency::Session& session,
35+
const boost::posix_time::ptime& lowerTime,
36+
const boost::posix_time::ptime& upperTime);
37+
38+
private:
39+
bool m_debug;
40+
// starting date for sampling
41+
boost::posix_time::ptime m_startTime;
42+
boost::posix_time::ptime m_endTime;
43+
bool m_endFillMode = true;
44+
std::string m_name;
45+
//for reading from relational database source
46+
std::string m_connectionString, m_ecalConnectionString;
47+
std::string m_authpath;
48+
std::string m_omsBaseUrl;
49+
std::unique_ptr<LHCInfoPerFill> m_fillPayload;
50+
std::shared_ptr<LHCInfoPerFill> m_prevPayload;
51+
std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerFill>>> m_tmpBuffer;
52+
bool m_lastPayloadEmpty = false;
53+
// to hold correspondance between timestamp-type IOVs and lumiid-type IOVs
54+
std::map<cond::Time_t, cond::Time_t> m_timestampToLumiid;
55+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#ifndef LHCInfoPerLSPopConSourceHandler_h
2+
#define LHCInfoPerLSPopConSourceHandler_h
3+
4+
#include "CondCore/PopCon/interface/PopConSourceHandler.h"
5+
#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h"
6+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
7+
#include "CondTools/RunInfo/interface/OMSAccess.h"
8+
#include <map>
9+
#include <memory>
10+
#include <string>
11+
#include <utility>
12+
#include <vector>
13+
14+
class LHCInfoPerLSPopConSourceHandler : public popcon::PopConSourceHandler<LHCInfoPerLS> {
15+
public:
16+
LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const& pset);
17+
~LHCInfoPerLSPopConSourceHandler() override;
18+
void getNewObjects() override;
19+
std::string id() const override;
20+
21+
private:
22+
void populateIovs();
23+
void filterInvalidPayloads();
24+
bool isPayloadValid(const LHCInfoPerLS& payload) const;
25+
void addEmptyPayload(cond::Time_t iov);
26+
void addDefaultPayload(cond::Time_t iov, unsigned short fill, const cond::OMSService& oms);
27+
void addDefaultPayload(cond::Time_t iov, unsigned short fill, int run, unsigned short lumi);
28+
bool makeFillPayload(std::unique_ptr<LHCInfoPerLS>& targetPayload, const cond::OMSServiceResult& queryResult);
29+
void addPayloadToBuffer(cond::OMSServiceResultRef& row);
30+
size_t bufferAllLS(const cond::OMSServiceResult& queryResult);
31+
size_t getLumiData(const cond::OMSService& oms,
32+
unsigned short fillId,
33+
const boost::posix_time::ptime& beginFillTime,
34+
const boost::posix_time::ptime& endFillTime);
35+
bool getCTPPSData(cond::persistency::Session& session,
36+
const boost::posix_time::ptime& beginFillTime,
37+
const boost::posix_time::ptime& endFillTime);
38+
39+
bool m_debug;
40+
// starting date for sampling
41+
boost::posix_time::ptime m_startTime;
42+
boost::posix_time::ptime m_endTime;
43+
bool m_endFillMode = true;
44+
std::string m_name;
45+
// for reading from relational database source
46+
std::string m_connectionString;
47+
std::string m_authpath;
48+
std::string m_omsBaseUrl;
49+
// Allows for basic test of durigFill mode when there is no Stable Beams in LHC
50+
// makes duringFill interpret fills as ongoing fill and writing their last LS
51+
// (disabling the check if the last LS is in stable beams,
52+
// although still only fills with stable beams are being processed
53+
// also, still only up to one payload will be written)
54+
const bool m_debugLogic;
55+
// values for the default payload which is inserted after the last processed fill
56+
// has ended and there's no ongoing stable beam yet:
57+
float m_defaultCrossingAngleX;
58+
float m_defaultCrossingAngleY;
59+
float m_defaultBetaStarX;
60+
float m_defaultBetaStarY;
61+
float m_minBetaStar; // meters
62+
float m_maxBetaStar; // meters
63+
float m_minCrossingAngle; // urad
64+
float m_maxCrossingAngle; // urad
65+
66+
std::unique_ptr<LHCInfoPerLS> m_fillPayload;
67+
std::shared_ptr<LHCInfoPerLS> m_prevPayload;
68+
cond::Time_t m_startFillTime;
69+
cond::Time_t m_endFillTime;
70+
cond::Time_t m_prevEndFillTime = 0;
71+
cond::Time_t m_prevStartFillTime;
72+
cond::Time_t m_startStableBeamTime;
73+
cond::Time_t m_endStableBeamTime;
74+
std::vector<std::pair<cond::Time_t, std::shared_ptr<LHCInfoPerLS>>> m_tmpBuffer;
75+
bool m_lastPayloadEmpty = false;
76+
// mapping of lumisections IDs (pairs of runnumber an LS number) found in OMS to
77+
// the IDs they've been assignd from PPS DB value pair(-1, -1) means lumisection
78+
// corresponding to the key exists in OMS but no lumisection was matched from PPS
79+
std::map<std::pair<cond::Time_t, unsigned int>, std::pair<cond::Time_t, unsigned int>> m_lsIdMap;
80+
};
81+
82+
#endif

CondTools/RunInfo/interface/LHCInfoPopConSourceHandler.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ class LHCInfoPopConSourceHandler : public popcon::PopConSourceHandler<LHCInfo> {
1818
void getNewObjects() override;
1919
std::string id() const override;
2020

21-
static constexpr unsigned int kLumisectionsQueryLimit = 4000; // enough for fills not exceeding 25h
22-
2321
private:
2422
void addEmptyPayload(cond::Time_t iov);
2523

CondTools/RunInfo/plugins/BuildFile.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
<flags EDM_PLUGIN="1"/>
6060
</library>
6161

62+
<library file="LHCInfoPerLSWriter.cc" name="LHCInfoPerLSWriter">
63+
<flags EDM_PLUGIN="1"/>
64+
</library>
65+
6266
<library file="LHCInfoPerFillAnalyzer.cc" name="LHCInfoPerFillAnalyzer">
6367
<flags EDM_PLUGIN="1"/>
6468
</library>
@@ -67,10 +71,14 @@
6771
<flags EDM_PLUGIN="1"/>
6872
</library>
6973

74+
<library file="LHCInfoPerLSOnlinePopConAnalyzer.cc" name="CondToolsLHCInfoPerLSOnlinePopConAnalyzer">
75+
<flags EDM_PLUGIN="1"/>
76+
</library>
77+
7078
<library file="LHCInfoPerFillPopConAnalyzer.cc" name="CondToolsLHCInfoPerFillPopConAnalyzer">
7179
<flags EDM_PLUGIN="1"/>
7280
</library>
7381

74-
<library file="LHCInfoPerLSWriter.cc" name="LHCInfoPerLSWriter">
82+
<library file="LHCInfoPerFillOnlinePopConAnalyzer.cc" name="CondToolsLHCInfoPerFillOnlinePopConAnalyzer">
7583
<flags EDM_PLUGIN="1"/>
7684
</library>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "CondCore/PopCon/interface/OnlinePopConAnalyzer.h"
2+
#include "CondTools/RunInfo/interface/LHCInfoPerFillPopConSourceHandler.h"
3+
#include "FWCore/Framework/interface/MakerMacros.h"
4+
5+
typedef popcon::OnlinePopConAnalyzer<LHCInfoPerFillPopConSourceHandler> LHCInfoPerFillOnlinePopConAnalyzer;
6+
7+
DEFINE_FWK_MODULE(LHCInfoPerFillOnlinePopConAnalyzer);

0 commit comments

Comments
 (0)