1 #ifndef PopConBTransitionSourceHandler_H 2 #define PopConBTransitionSourceHandler_H 17 m_run( pset.getParameter<
edm::
ParameterSet>(
"BTransition" ).getParameter<unsigned long long>(
"runNumber" ) ),
24 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler:" << __func__ <<
"]: " 25 <<
"Initialising Connection Pool" << std::endl;
40 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 42 <<
" and IOV valid for run number: " <<
m_run << std::endl;
47 <<
", IOV valid for run number " <<
m_run <<
" starting from: " << currentIov.
since 48 <<
", with corresponding payload hash: " << currentIov.
payloadId 51 double current_default = -1;
52 double avg_current = current_default;
54 LogDebug(
"PopConBTransitionSourceHandler" ) <<
"Comparing value of magnet current: " << avg_current <<
" A for run: " <<
m_run 57 if( avg_current != current_default && avg_current <=
m_currentThreshold ) isBOn =
false;
58 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 59 <<
"The magnet was " << ( isBOn ?
"ON" :
"OFF" )
60 <<
" during run " <<
m_run << std::endl;
69 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 70 <<
"Loading tag for B " << ( isBOn ?
"ON" :
"OFF" ) <<
": " 72 <<
" and IOV valid for run number: " <<
m_run << std::endl;
77 <<
", IOV valid for run number " <<
m_run <<
" starting from: " << currentIov.
since 78 <<
", with corresponding payload hash: " << currentIov.
payloadId 81 if( currentIov.
payloadId != this->tagInfo().lastPayloadToken ) {
82 std::ostringstream ss;
83 ss <<
"Adding iov with since "<<
m_run<<
" pointing to hash " << currentIov.
payloadId 84 <<
" corresponding to the calibrations for magnetic field " 85 << ( isBOn ?
"ON" :
"OFF" );
86 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 87 << ss.str() << std::endl;
90 editor = session.
editIov( destTag );
93 editor.
setDescription(
"Tag created by PopConBTransitionSourceHandler" );
99 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 100 <<
"The payload with hash " << currentIov.
payloadId 101 <<
" corresponding to the calibrations for magnetic field " 102 << ( isBOn ?
"ON" :
"OFF" )
103 <<
" is still valid for run " <<
m_run 104 <<
" in the destination tag " << destTag
105 <<
".\nNo transfer needed." <<std::endl;
112 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 113 <<
"Destination Tag Info: name " << this->
tagInfo().
name 122 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 125 <<
" the run proposed for insertion " <<
m_run 126 <<
". No transfer needed." << std::endl;
131 edm::LogInfo(
"PopConBTransitionSourceHandler" ) <<
"[" <<
"PopConBTransitionSourceHandler::" << __func__ <<
"]: " 132 <<
"END." << std::endl;
149 #endif //PopConBTransitionSourceHandler_H
std::string id() const final
cond::persistency::Session & dbSession() const
std::string m_userTextLog
double m_currentThreshold
std::string m_tagForRunInfo
IOVEditor createIov(const std::string &tag, cond::TimeType timeType, cond::SynchronizationType synchronizationType=cond::SYNCH_ANY)
void setDescription(const std::string &description)
Transaction & transaction()
void setParameters(const edm::ParameterSet &connectionPset)
cond::ValidityInterval lastInterval
IOVProxy readIov(const std::string &tag, bool full=false)
cond::TimeType timeType() const
Iterator find(cond::Time_t time)
virtual void getObjectsForBTransition(bool isBOn)
cond::persistency::ConnectionPool m_connection
PopConBTransitionSourceHandler(edm::ParameterSet const &pset)
IOVEditor editIov(const std::string &tag)
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
~PopConBTransitionSourceHandler() override
std::string lastPayloadToken
bool existsIov(const std::string &tag)
void getNewObjects() final
std::string m_connectionString
edm::ParameterSet m_connectionPset
cond::TagInfo_t const & tagInfo() const
std::shared_ptr< T > fetchPayload(const cond::Hash &payloadHash)