CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BeamSpotOnlinePopConSourceHandler Class Reference

#include <BeamSpotOnlinePopConSourceHandler.h>

Inheritance diagram for BeamSpotOnlinePopConSourceHandler:
popcon::PopConSourceHandler< BeamSpotOnlineObjects >

Public Member Functions

 BeamSpotOnlinePopConSourceHandler (const edm::ParameterSet &pset)
 
void getNewObjects () override
 
std::string id () const override
 
 ~BeamSpotOnlinePopConSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Attributes

bool m_debug
 
unsigned int m_maxAge
 
std::string m_name
 
std::unique_ptr< BeamSpotOnlineObjectsm_payload
 
unsigned int m_runNumber
 
std::string m_sourcePayloadTag
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
typedef std::map< Time_t, std::shared_ptr< BeamSpotOnlineObjects > > Container
 
typedef std::unique_ptr< BeamSpotOnlineObjectsRef
 
typedef PopConSourceHandler< BeamSpotOnlineObjectsself
 
typedef cond::Time_t Time_t
 
typedef BeamSpotOnlineObjects value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
Container m_iovs
 
std::vector< std::pair< BeamSpotOnlineObjects *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 10 of file BeamSpotOnlinePopConSourceHandler.h.

Constructor & Destructor Documentation

◆ BeamSpotOnlinePopConSourceHandler()

BeamSpotOnlinePopConSourceHandler::BeamSpotOnlinePopConSourceHandler ( const edm::ParameterSet pset)

Definition at line 9 of file BeamSpotOnlinePopConSourceHandler.cc.

10  : m_debug(pset.getUntrackedParameter<bool>("debug", false)),
11  m_name(pset.getUntrackedParameter<std::string>("name", "BeamSpotOnlineSourceHandler")),
12  m_maxAge(pset.getUntrackedParameter<unsigned int>("maxAge", 86400)),
13  m_runNumber(pset.getUntrackedParameter<unsigned int>("runNumber", 1)),
14  m_sourcePayloadTag(pset.getUntrackedParameter<std::string>("sourcePayloadTag", "")) {}

◆ ~BeamSpotOnlinePopConSourceHandler()

BeamSpotOnlinePopConSourceHandler::~BeamSpotOnlinePopConSourceHandler ( )
override

Definition at line 16 of file BeamSpotOnlinePopConSourceHandler.cc.

16 {}

Member Function Documentation

◆ getNewObjects()

void BeamSpotOnlinePopConSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< BeamSpotOnlineObjects >.

Definition at line 36 of file BeamSpotOnlinePopConSourceHandler.cc.

References checkPayloadAge(), popcon::PopConSourceHandler< BeamSpotOnlineObjects >::dbSession(), cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< BeamSpotOnlineObjects >::lastPayload(), cond::time::lumiTime(), m_maxAge, m_name, m_payload, m_runNumber, m_sourcePayloadTag, popcon::PopConSourceHandler< BeamSpotOnlineObjects >::m_to_transfer, makeDummyPayload(), cond::TagInfo_t::name, cond::Iov_t::since, findQualityFiles::size, and popcon::PopConSourceHandler< BeamSpotOnlineObjects >::tagInfo().

36  {
37  bool addNewPayload = false;
38  if (!tagInfo().size) {
39  edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects";
40  addNewPayload = true;
41  } else {
42  edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ", last object valid since "
43  << tagInfo().lastInterval.since << "; from " << m_name << "::getNewObjects";
45  addNewPayload = true;
46  }
47  }
48 
49  if (addNewPayload) {
50  if (!m_sourcePayloadTag.empty()) {
51  edm::LogInfo(m_name) << "Reading target payload from tag " << m_sourcePayloadTag;
52  auto session = dbSession();
53  session.transaction().start(true);
54  auto lastIov = session.readIov(m_sourcePayloadTag).getLast();
55  m_payload = session.fetchPayload<BeamSpotOnlineObjects>(lastIov.payloadId);
56  session.transaction().commit();
57  } else {
59  }
60 
62  m_to_transfer.push_back(std::make_pair(m_payload.get(), targetTime));
63 
64  edm::LogInfo(m_name) << "Payload added with IOV since " << targetTime;
65  } else {
66  edm::LogInfo(m_name) << "Nothing to do, last payload satisfies maximum age requirement.";
67  }
68 }
size
Write out results.
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
bool checkPayloadAge(const BeamSpotOnlineObjects &payload, unsigned int maxAge)
std::string name
Definition: Types.h:72
unsigned long long Time_t
Definition: Time.h:14
Time_t lumiTime(unsigned int run, unsigned int lumiId)
Definition: Time.cc:66
std::vector< std::pair< BeamSpotOnlineObjects *, Time_t > > m_to_transfer
std::unique_ptr< BeamSpotOnlineObjects > m_payload
Log< level::Info, false > LogInfo
std::unique_ptr< BeamSpotOnlineObjects > makeDummyPayload()
cond::persistency::Session & dbSession() const

◆ id()

std::string BeamSpotOnlinePopConSourceHandler::id ( ) const
overridevirtual

Member Data Documentation

◆ m_debug

bool BeamSpotOnlinePopConSourceHandler::m_debug
private

Definition at line 18 of file BeamSpotOnlinePopConSourceHandler.h.

◆ m_maxAge

unsigned int BeamSpotOnlinePopConSourceHandler::m_maxAge
private

Definition at line 20 of file BeamSpotOnlinePopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_name

std::string BeamSpotOnlinePopConSourceHandler::m_name
private

Definition at line 19 of file BeamSpotOnlinePopConSourceHandler.h.

Referenced by getNewObjects(), and id().

◆ m_payload

std::unique_ptr<BeamSpotOnlineObjects> BeamSpotOnlinePopConSourceHandler::m_payload
private

Definition at line 23 of file BeamSpotOnlinePopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_runNumber

unsigned int BeamSpotOnlinePopConSourceHandler::m_runNumber
private

Definition at line 21 of file BeamSpotOnlinePopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_sourcePayloadTag

std::string BeamSpotOnlinePopConSourceHandler::m_sourcePayloadTag
private

Definition at line 22 of file BeamSpotOnlinePopConSourceHandler.h.

Referenced by getNewObjects().