CMS 3D CMS Logo

LHCInfoPerLSPopConSourceHandler.h
Go to the documentation of this file.
1 #ifndef LHCInfoPerLSPopConSourceHandler_h
2 #define LHCInfoPerLSPopConSourceHandler_h
3 
8 #include <map>
9 #include <memory>
10 #include <string>
11 #include <utility>
12 #include <vector>
13 
15 public:
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);
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);
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;
45  // for reading from relational database source
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:
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;
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
void addDefaultPayload(cond::Time_t iov, unsigned short fill, const cond::OMSService &oms)
bool makeFillPayload(std::unique_ptr< LHCInfoPerLS > &targetPayload, const cond::OMSServiceResult &queryResult)
std::shared_ptr< LHCInfoPerLS > m_prevPayload
LHCInfoPerLSPopConSourceHandler(edm::ParameterSet const &pset)
std::vector< std::pair< cond::Time_t, std::shared_ptr< LHCInfoPerLS > > > m_tmpBuffer
bool isPayloadValid(const LHCInfoPerLS &payload) const
unsigned long long Time_t
Definition: Time.h:14
size_t bufferAllLS(const cond::OMSServiceResult &queryResult)
void addPayloadToBuffer(cond::OMSServiceResultRef &row)
std::map< std::pair< cond::Time_t, unsigned int >, std::pair< cond::Time_t, unsigned int > > m_lsIdMap
std::unique_ptr< LHCInfoPerLS > m_fillPayload
bool getCTPPSData(cond::persistency::Session &session, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)
size_t getLumiData(const cond::OMSService &oms, unsigned short fillId, const boost::posix_time::ptime &beginFillTime, const boost::posix_time::ptime &endFillTime)