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 convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
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 ()
 
void sort ()
 
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::vector< Triplet > Container
 
typedef std::vector< std::pair< BeamSpotOnlineObjects *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< BeamSpotOnlineObjectsself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef BeamSpotOnlineObjects value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< BeamSpotOnlineObjects >
OldContainer 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.

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 }

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().

◆ id()

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

Implements popcon::PopConSourceHandler< BeamSpotOnlineObjects >.

Definition at line 70 of file BeamSpotOnlinePopConSourceHandler.cc.

70 { return m_name; }

References m_name.

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().

makeDummyPayload
std::unique_ptr< BeamSpotOnlineObjects > makeDummyPayload()
Definition: BeamSpotOnlinePopConSourceHandler.cc:26
BeamSpotOnlinePopConSourceHandler::m_runNumber
unsigned int m_runNumber
Definition: BeamSpotOnlinePopConSourceHandler.h:21
popcon::PopConSourceHandler< BeamSpotOnlineObjects >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
popcon::PopConSourceHandler< BeamSpotOnlineObjects >::dbSession
cond::persistency::Session & dbSession() const
Definition: PopConSourceHandler.h:144
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
BeamSpotOnlinePopConSourceHandler::m_sourcePayloadTag
std::string m_sourcePayloadTag
Definition: BeamSpotOnlinePopConSourceHandler.h:22
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
BeamSpotOnlinePopConSourceHandler::m_payload
std::unique_ptr< BeamSpotOnlineObjects > m_payload
Definition: BeamSpotOnlinePopConSourceHandler.h:23
checkPayloadAge
bool checkPayloadAge(const BeamSpotOnlineObjects &payload, unsigned int maxAge)
Definition: BeamSpotOnlinePopConSourceHandler.cc:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
popcon::PopConSourceHandler< BeamSpotOnlineObjects >::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
cond::Iov_t::since
Time_t since
Definition: Types.h:53
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
cond::time::lumiTime
Time_t lumiTime(unsigned int run, unsigned int lumiId)
Definition: Time.cc:54
BeamSpotOnlinePopConSourceHandler::m_maxAge
unsigned int m_maxAge
Definition: BeamSpotOnlinePopConSourceHandler.h:20
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
BeamSpotOnlineObjects
Definition: BeamSpotOnlineObjects.h:25
popcon::PopConSourceHandler< BeamSpotOnlineObjects >::lastPayload
Ref lastPayload() const
Definition: PopConSourceHandler.h:81
BeamSpotOnlinePopConSourceHandler::m_name
std::string m_name
Definition: BeamSpotOnlinePopConSourceHandler.h:19
BeamSpotOnlinePopConSourceHandler::m_debug
bool m_debug
Definition: BeamSpotOnlinePopConSourceHandler.h:18
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443