CMS 3D CMS Logo

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

#include <PopConESTransitionSourceHandler.h>

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

Public Member Functions

bool checkLowGain ()
 
void getNewObjects () final
 
virtual void getObjectsForESTransition (bool isLowGain)
 
std::string id () const final
 
 PopConESTransitionSourceHandler (edm::ParameterSet const &pset)
 
 ~PopConESTransitionSourceHandler () 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
 
std::string m_ESGain
 
unsigned long long m_run
 
std::string m_tagForHighGain
 
std::string m_tagForLowGain
 
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::PopConESTransitionSourceHandler< T >

Definition at line 14 of file PopConESTransitionSourceHandler.h.

Constructor & Destructor Documentation

◆ PopConESTransitionSourceHandler()

Definition at line 16 of file PopConESTransitionSourceHandler.h.

17  : m_run(pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<unsigned long long>("runNumber")),
18  // m_currentThreshold( pset.getParameter<edm::ParameterSet>( "ESTransition" ).getUntrackedParameter<double>( "currentThreshold", 18000. ) ),
20  pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<std::string>("tagForRunInfo")),
21  m_ESGain(pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<std::string>("ESGain")),
23  pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<std::string>("ESLowGainTag")),
25  pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<std::string>("ESHighGainTag")),
26  m_connectionString(pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<std::string>("connect")),
28  pset.getParameter<edm::ParameterSet>("ESTransition").getParameter<edm::ParameterSet>("DBParameters")) {
29  edm::LogInfo("PopConESTransitionSourceHandler") << "["
30  << "PopConESTransitionSourceHandler:" << __func__ << "]: "
31  << "Initialising Connection Pool" << std::endl;
34  }

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

◆ ~PopConESTransitionSourceHandler()

Definition at line 36 of file PopConESTransitionSourceHandler.h.

36 {}

Member Function Documentation

◆ checkLowGain()

template<class T >
bool popcon::PopConESTransitionSourceHandler< T >::checkLowGain ( )
inline

Definition at line 40 of file PopConESTransitionSourceHandler.h.

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

References popcon::PopConSourceHandler< T >::dbSession(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVProxy::loadedSize(), LogDebug, popcon::PopConESTransitionSourceHandler< T >::m_ESGain, popcon::PopConESTransitionSourceHandler< T >::m_run, popcon::PopConESTransitionSourceHandler< T >::m_tagForRunInfo, cond::Iov_t::payloadId, cond::persistency::Session::readIov(), cond::Iov_t::since, and cond::persistency::Session::transaction().

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

◆ getNewObjects()

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

Implements popcon::PopConSourceHandler< T >.

Definition at line 121 of file PopConESTransitionSourceHandler.h.

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

References popcon::PopConESTransitionSourceHandler< T >::checkLowGain(), popcon::PopConESTransitionSourceHandler< T >::getObjectsForESTransition(), cond::TagInfo_t::lastInterval, popcon::PopConESTransitionSourceHandler< 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().

◆ getObjectsForESTransition()

template<class T >
virtual void popcon::PopConESTransitionSourceHandler< T >::getObjectsForESTransition ( bool  isLowGain)
inlinevirtual

Definition at line 76 of file PopConESTransitionSourceHandler.h.

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

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::PopConESTransitionSourceHandler< T >::m_run, popcon::PopConESTransitionSourceHandler< T >::m_tagForHighGain, popcon::PopConESTransitionSourceHandler< T >::m_tagForLowGain, 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::PopConESTransitionSourceHandler< T >::getNewObjects().

◆ id()

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

Implements popcon::PopConSourceHandler< T >.

Definition at line 38 of file PopConESTransitionSourceHandler.h.

38 { return std::string("PopConESTransitionSourceHandler"); }

References AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_connection

◆ m_connectionPset

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

◆ m_connectionString

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

Definition at line 158 of file PopConESTransitionSourceHandler.h.

◆ m_currentThreshold

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

Definition at line 151 of file PopConESTransitionSourceHandler.h.

◆ m_ESGain

template<class T >
std::string popcon::PopConESTransitionSourceHandler< T >::m_ESGain
private

◆ m_run

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

◆ m_tagForHighGain

template<class T >
std::string popcon::PopConESTransitionSourceHandler< T >::m_tagForHighGain
private

◆ m_tagForLowGain

template<class T >
std::string popcon::PopConESTransitionSourceHandler< T >::m_tagForLowGain
private

◆ m_tagForRunInfo

template<class T >
std::string popcon::PopConESTransitionSourceHandler< 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
popcon::PopConESTransitionSourceHandler::m_tagForHighGain
std::string m_tagForHighGain
Definition: PopConESTransitionSourceHandler.h:157
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::PopConESTransitionSourceHandler::m_connection
cond::persistency::ConnectionPool m_connection
Definition: PopConESTransitionSourceHandler.h:160
popcon::PopConESTransitionSourceHandler::m_ESGain
std::string m_ESGain
Definition: PopConESTransitionSourceHandler.h:155
popcon::PopConESTransitionSourceHandler::checkLowGain
bool checkLowGain()
Definition: PopConESTransitionSourceHandler.h:40
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
popcon::PopConESTransitionSourceHandler::m_connectionString
std::string m_connectionString
Definition: PopConESTransitionSourceHandler.h:158
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
popcon::PopConESTransitionSourceHandler::m_tagForLowGain
std::string m_tagForLowGain
Definition: PopConESTransitionSourceHandler.h:156
popcon::PopConESTransitionSourceHandler::m_tagForRunInfo
std::string m_tagForRunInfo
Definition: PopConESTransitionSourceHandler.h:153
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
popcon::PopConESTransitionSourceHandler::m_run
unsigned long long m_run
Definition: PopConESTransitionSourceHandler.h:150
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
cond::persistency::Session::editIov
IOVEditor editIov(const std::string &tag)
Definition: Session.cc:130
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
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
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
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
cond::Iov_t
Definition: Types.h:47
popcon::PopConESTransitionSourceHandler::getObjectsForESTransition
virtual void getObjectsForESTransition(bool isLowGain)
Definition: PopConESTransitionSourceHandler.h:76
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
popcon::PopConESTransitionSourceHandler::m_connectionPset
edm::ParameterSet m_connectionPset
Definition: PopConESTransitionSourceHandler.h:159