CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
popcon::PopConBTransitionSourceHandler< T > Class Template Reference

#include <PopConBTransitionSourceHandler.h>

Inheritance diagram for popcon::PopConBTransitionSourceHandler< T >:
popcon::PopConSourceHandler< T >

Public Member Functions

bool checkBOn ()
 
void getNewObjects () final
 
virtual void getObjectsForBTransition (bool isBOn)
 
std::string id () const final
 
 PopConBTransitionSourceHandler (edm::ParameterSet const &pset)
 
 ~PopConBTransitionSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< T >
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

cond::persistency::ConnectionPool m_connection
 
edm::ParameterSet m_connectionPset
 
std::string m_connectionString
 
double m_currentThreshold
 
unsigned long long m_run
 
std::string m_tagForBOff
 
std::string m_tagForBOn
 
std::string m_tagForRunInfo
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< T >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair< T *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< Tself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef T value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< T >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< T >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

template<class T>
class popcon::PopConBTransitionSourceHandler< T >

Definition at line 14 of file PopConBTransitionSourceHandler.h.

Constructor & Destructor Documentation

◆ PopConBTransitionSourceHandler()

Definition at line 16 of file PopConBTransitionSourceHandler.h.

17  : m_run(pset.getParameter<edm::ParameterSet>("BTransition").getParameter<unsigned long long>("runNumber")),
18  m_currentThreshold(pset.getParameter<edm::ParameterSet>("BTransition")
19  .getUntrackedParameter<double>("currentThreshold", 18000.)),
21  pset.getParameter<edm::ParameterSet>("BTransition").getParameter<std::string>("tagForRunInfo")),
22  m_tagForBOff(pset.getParameter<edm::ParameterSet>("BTransition").getParameter<std::string>("tagForBOff")),
23  m_tagForBOn(pset.getParameter<edm::ParameterSet>("BTransition").getParameter<std::string>("tagForBOn")),
24  m_connectionString(pset.getParameter<edm::ParameterSet>("BTransition").getParameter<std::string>("connect")),
26  pset.getParameter<edm::ParameterSet>("BTransition").getParameter<edm::ParameterSet>("DBParameters")) {
27  edm::LogInfo("PopConBTransitionSourceHandler") << "["
28  << "PopConBTransitionSourceHandler:" << __func__ << "]: "
29  << "Initialising Connection Pool" << std::endl;
32  }

References cond::persistency::ConnectionPool::configure(), popcon::PopConBTransitionSourceHandler< T >::m_connection, popcon::PopConBTransitionSourceHandler< T >::m_connectionPset, and cond::persistency::ConnectionPool::setParameters().

◆ ~PopConBTransitionSourceHandler()

template<class T >
popcon::PopConBTransitionSourceHandler< T >::~PopConBTransitionSourceHandler ( )
inlineoverride

Definition at line 34 of file PopConBTransitionSourceHandler.h.

34 {}

Member Function Documentation

◆ checkBOn()

template<class T >
bool popcon::PopConBTransitionSourceHandler< T >::checkBOn ( )
inline

Definition at line 38 of file PopConBTransitionSourceHandler.h.

38  {
39  //the output boolean is set to true as default
40  bool isBOn = true;
42  //reading RunInfo from Conditions
44  edm::LogInfo("PopConBTransitionSourceHandler")
45  << "["
46  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
47  << "Loading tag for RunInfo " << m_tagForRunInfo << " and IOV valid for run number: " << m_run << std::endl;
49  cond::Iov_t currentIov = iov.getInterval(m_run);
50  LogDebug("PopConBTransitionSourceHandler")
51  << "Loaded IOV sequence from tag " << m_tagForRunInfo << " with size: " << iov.loadedSize()
52  << ", IOV valid for run number " << m_run << " starting from: " << currentIov.since
53  << ", with corresponding payload hash: " << currentIov.payloadId << std::endl;
54  //accessing the average magnet current for the run
55  double current_default = -1;
56  double avg_current = current_default;
57  avg_current = session.fetchPayload<RunInfo>(currentIov.payloadId)->m_avg_current;
58  LogDebug("PopConBTransitionSourceHandler")
59  << "Comparing value of magnet current: " << avg_current << " A for run: " << m_run
60  << " with the corresponding threshold: " << m_currentThreshold << " A." << std::endl;
61  //comparing the magnet current with the user defined threshold
62  if (avg_current != current_default && avg_current <= m_currentThreshold)
63  isBOn = false;
64  edm::LogInfo("PopConBTransitionSourceHandler")
65  << "["
66  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
67  << "The magnet was " << (isBOn ? "ON" : "OFF") << " during run " << m_run << std::endl;
68  trans.close();
69  return isBOn;
70  }

References popcon::PopConSourceHandler< T >::dbSession(), cond::persistency::Session::fetchPayload(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVProxy::loadedSize(), LogDebug, RunInfoPI::m_avg_current, popcon::PopConBTransitionSourceHandler< T >::m_currentThreshold, popcon::PopConBTransitionSourceHandler< T >::m_run, popcon::PopConBTransitionSourceHandler< T >::m_tagForRunInfo, cond::Iov_t::payloadId, cond::persistency::Session::readIov(), cond::Iov_t::since, and cond::persistency::Session::transaction().

Referenced by popcon::PopConBTransitionSourceHandler< T >::getNewObjects().

◆ getNewObjects()

template<class T >
void popcon::PopConBTransitionSourceHandler< T >::getNewObjects ( )
inlinefinalvirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 118 of file PopConBTransitionSourceHandler.h.

118  {
119  //check whats already inside of database
120  edm::LogInfo("PopConBTransitionSourceHandler")
121  << "["
122  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
123  << "Destination Tag Info: name " << this->tagInfo().name << ", size " << this->tagInfo().size
124  << ", last object valid since " << this->tagInfo().lastInterval.since << ", hash "
125  << this->tagInfo().lastInterval.payloadId << std::endl;
126  //check if a transfer is needed:
127  //if the new run number is smaller than or equal to the latest IOV, exit.
128  //This is needed as now the IOV Editor does not always protect for insertions:
129  //ANY and VALIDATION sychronizations are allowed to write in the past.
130  if (this->tagInfo().size > 0 && this->tagInfo().lastInterval.since >= m_run) {
131  edm::LogInfo("PopConBTransitionSourceHandler")
132  << "["
133  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
134  << "last IOV " << this->tagInfo().lastInterval.since
135  << (this->tagInfo().lastInterval.since == m_run ? " is equal to" : " is larger than")
136  << " the run proposed for insertion " << m_run << ". No transfer needed." << std::endl;
137  return;
138  }
139  bool isBOn = checkBOn();
141  edm::LogInfo("PopConBTransitionSourceHandler") << "["
142  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
143  << "END." << std::endl;
144  }

References popcon::PopConBTransitionSourceHandler< T >::checkBOn(), popcon::PopConBTransitionSourceHandler< T >::getObjectsForBTransition(), cond::TagInfo_t::lastInterval, popcon::PopConBTransitionSourceHandler< T >::m_run, cond::TagInfo_t::name, cond::Iov_t::payloadId, cond::Iov_t::since, cond::TagInfo_t::size, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

◆ getObjectsForBTransition()

template<class T >
virtual void popcon::PopConBTransitionSourceHandler< T >::getObjectsForBTransition ( bool  isBOn)
inlinevirtual

Definition at line 72 of file PopConBTransitionSourceHandler.h.

72  {
73  //reading payloads for 0T and 3.8T from Conditions
76  edm::LogInfo("PopConBTransitionSourceHandler")
77  << "["
78  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
79  << "Loading tag for B " << (isBOn ? "ON" : "OFF") << ": " << (isBOn ? m_tagForBOn : m_tagForBOff)
80  << " and IOV valid for run number: " << m_run << std::endl;
82  cond::Iov_t currentIov = iov.getInterval(m_run);
83  LogDebug("PopConBTransitionSourceHandler")
84  << "Loaded IOV sequence from tag " << (isBOn ? m_tagForBOn : m_tagForBOff)
85  << " with size: " << iov.loadedSize() << ", IOV valid for run number " << m_run
86  << " starting from: " << currentIov.since << ", with corresponding payload hash: " << currentIov.payloadId
87  << std::endl;
88  std::string destTag = this->tagInfo().name;
89  if (currentIov.payloadId != this->tagInfo().lastInterval.payloadId) {
90  std::ostringstream ss;
91  ss << "Adding iov with since " << m_run << " pointing to hash " << currentIov.payloadId
92  << " corresponding to the calibrations for magnetic field " << (isBOn ? "ON" : "OFF");
93  edm::LogInfo("PopConBTransitionSourceHandler")
94  << "["
95  << "PopConBTransitionSourceHandler::" << __func__ << "]: " << ss.str() << std::endl;
97  if (session.existsIov(destTag)) {
98  editor = session.editIov(destTag);
99  } else {
100  editor = session.createIov<T>(destTag, iov.tagInfo().timeType);
101  editor.setDescription("Tag created by PopConBTransitionSourceHandler");
102  }
103  editor.insert(m_run, currentIov.payloadId);
104  editor.flush();
105  this->m_userTextLog = ss.str();
106  } else {
107  edm::LogInfo("PopConBTransitionSourceHandler")
108  << "["
109  << "PopConBTransitionSourceHandler::" << __func__ << "]: "
110  << "The payload with hash " << currentIov.payloadId
111  << " corresponding to the calibrations for magnetic field " << (isBOn ? "ON" : "OFF")
112  << " is still valid for run " << m_run << " in the destination tag " << destTag << ".\nNo transfer needed."
113  << std::endl;
114  }
115  trans.close();
116  }

References cond::persistency::Session::createIov(), popcon::PopConSourceHandler< T >::dbSession(), cond::persistency::Session::editIov(), cond::persistency::Session::existsIov(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVEditor::insert(), cond::persistency::IOVProxy::loadedSize(), LogDebug, popcon::PopConBTransitionSourceHandler< T >::m_run, popcon::PopConBTransitionSourceHandler< T >::m_tagForBOff, popcon::PopConBTransitionSourceHandler< T >::m_tagForBOn, popcon::PopConSourceHandler< T >::m_userTextLog, cond::TagInfo_t::name, cond::Iov_t::payloadId, cond::persistency::Session::readIov(), cond::persistency::IOVEditor::setDescription(), cond::Iov_t::since, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< T >::tagInfo(), cond::persistency::IOVProxy::tagInfo(), cond::Tag_t::timeType, and cond::persistency::Session::transaction().

Referenced by popcon::PopConBTransitionSourceHandler< T >::getNewObjects().

◆ id()

template<class T >
std::string popcon::PopConBTransitionSourceHandler< T >::id ( ) const
inlinefinalvirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 36 of file PopConBTransitionSourceHandler.h.

36 { return std::string("PopConBTransitionSourceHandler"); }

References AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_connection

template<class T >
cond::persistency::ConnectionPool popcon::PopConBTransitionSourceHandler< T >::m_connection
private

◆ m_connectionPset

template<class T >
edm::ParameterSet popcon::PopConBTransitionSourceHandler< T >::m_connectionPset
private

◆ m_connectionString

template<class T >
std::string popcon::PopConBTransitionSourceHandler< T >::m_connectionString
private

Definition at line 154 of file PopConBTransitionSourceHandler.h.

◆ m_currentThreshold

template<class T >
double popcon::PopConBTransitionSourceHandler< T >::m_currentThreshold
private

◆ m_run

template<class T >
unsigned long long popcon::PopConBTransitionSourceHandler< T >::m_run
private

◆ m_tagForBOff

template<class T >
std::string popcon::PopConBTransitionSourceHandler< T >::m_tagForBOff
private

◆ m_tagForBOn

template<class T >
std::string popcon::PopConBTransitionSourceHandler< T >::m_tagForBOn
private

◆ m_tagForRunInfo

template<class T >
std::string popcon::PopConBTransitionSourceHandler< T >::m_tagForRunInfo
private
cond::persistency::TransactionScope
Definition: Session.h:231
cond::persistency::IOVEditor::insert
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:160
cond::persistency::Session::existsIov
bool existsIov(const std::string &tag)
Definition: Session.cc:77
popcon::PopConSourceHandler::dbSession
cond::persistency::Session & dbSession() const
Definition: PopConSourceHandler.h:144
cond::persistency::IOVProxy::getInterval
cond::Iov_t getInterval(cond::Time_t time)
Definition: IOVProxy.cc:321
cond::persistency::IOVProxy::loadedSize
int loadedSize() const
Definition: IOVProxy.cc:401
cond::persistency::IOVEditor
Definition: IOVEditor.h:28
popcon::PopConBTransitionSourceHandler::getObjectsForBTransition
virtual void getObjectsForBTransition(bool isBOn)
Definition: PopConBTransitionSourceHandler.h:72
popcon::PopConBTransitionSourceHandler::checkBOn
bool checkBOn()
Definition: PopConBTransitionSourceHandler.h:38
popcon::PopConBTransitionSourceHandler::m_connectionString
std::string m_connectionString
Definition: PopConBTransitionSourceHandler.h:154
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
cond::persistency::Session::fetchPayload
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
RunInfo
Definition: RunInfo.h:18
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
cond::persistency::IOVEditor::setDescription
void setDescription(const std::string &description)
Definition: IOVEditor.cc:140
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
popcon::PopConBTransitionSourceHandler::m_connectionPset
edm::ParameterSet m_connectionPset
Definition: PopConBTransitionSourceHandler.h:155
cond::persistency::Session::editIov
IOVEditor editIov(const std::string &tag)
Definition: Session.cc:130
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
popcon::PopConSourceHandler::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
cond::Iov_t::payloadId
Hash payloadId
Definition: Types.h:55
cond::persistency::Session
Definition: Session.h:63
cond::Iov_t::since
Time_t since
Definition: Types.h:53
popcon::PopConBTransitionSourceHandler::m_tagForBOff
std::string m_tagForBOff
Definition: PopConBTransitionSourceHandler.h:152
cond::persistency::ConnectionPool::setParameters
void setParameters(const edm::ParameterSet &connectionPset)
Definition: ConnectionPool.cc:43
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:127
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
popcon::PopConBTransitionSourceHandler::m_tagForRunInfo
std::string m_tagForRunInfo
Definition: PopConBTransitionSourceHandler.h:150
RunInfoPI::m_avg_current
Definition: RunInfoPayloadInspectoHelper.h:29
popcon::PopConBTransitionSourceHandler::m_connection
cond::persistency::ConnectionPool m_connection
Definition: PopConBTransitionSourceHandler.h:156
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cond::persistency::Session::createIov
IOVEditor createIov(const std::string &tag, cond::TimeType timeType, cond::SynchronizationType synchronizationType=cond::SYNCH_ANY)
Definition: Session.h:179
popcon::PopConBTransitionSourceHandler::m_currentThreshold
double m_currentThreshold
Definition: PopConBTransitionSourceHandler.h:148
popcon::PopConBTransitionSourceHandler::m_run
unsigned long long m_run
Definition: PopConBTransitionSourceHandler.h:147
cond::Iov_t
Definition: Types.h:47
popcon::PopConBTransitionSourceHandler::m_tagForBOn
std::string m_tagForBOn
Definition: PopConBTransitionSourceHandler.h:153
cond::persistency::IOVEditor::flush
bool flush()
Definition: IOVEditor.cc:316
cond::persistency::IOVProxy::tagInfo
cond::Tag_t tagInfo() const
Definition: IOVProxy.cc:247
popcon::PopConSourceHandler::m_userTextLog
std::string m_userTextLog
Definition: PopConSourceHandler.h:168
cond::Tag_t::timeType
TimeType timeType
Definition: Types.h:63
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cond::TagInfo_t::size
size_t size
Definition: Types.h:74
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443