CMS 3D CMS Logo

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

#include <SiStripPopConConfigDbObjHandler.h>

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

Public Member Functions

void getNewObjects () override
 
std::string id () const override
 
bool isTransferNeeded ()
 
void setForTransfer ()
 
 SiStripPopConConfigDbObjHandler (const edm::ParameterSet &pset)
 
 ~SiStripPopConConfigDbObjHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< T >
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

edm::Service< SiStripCondObjBuilderFromDbcondObjBuilder
 
bool m_debugMode
 
std::string m_name
 
unsigned long long m_since
 

Additional Inherited Members

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

Detailed Description

template<typename T>
class popcon::SiStripPopConConfigDbObjHandler< T >

Definition at line 26 of file SiStripPopConConfigDbObjHandler.h.

Constructor & Destructor Documentation

◆ SiStripPopConConfigDbObjHandler()

Definition at line 30 of file SiStripPopConConfigDbObjHandler.h.

31  : m_name(pset.getUntrackedParameter<std::string>("name", "SiStripPopPopConConfigDbObjHandler")),
32  m_since(pset.getUntrackedParameter<uint32_t>("since", 5)),
33  m_debugMode(pset.getUntrackedParameter<bool>("debug", false)){};

◆ ~SiStripPopConConfigDbObjHandler()

template<typename T >
popcon::SiStripPopConConfigDbObjHandler< T >::~SiStripPopConConfigDbObjHandler ( )
inlineoverride

Definition at line 37 of file SiStripPopConConfigDbObjHandler.h.

37 {};

Member Function Documentation

◆ getNewObjects()

template<typename T >
void popcon::SiStripPopConConfigDbObjHandler< T >::getNewObjects ( )
inlineoverridevirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 41 of file SiStripPopConConfigDbObjHandler.h.

References cond::LogDBEntry_t::destinationDB, cond::LogDBEntry_t::execmessage, cond::LogDBEntry_t::exectime, cond::LogDBEntry_t::iovtag, cond::LogDBEntry_t::iovtimetype, popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded(), cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry_t::logId, popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode, popcon::SiStripPopConConfigDbObjHandler< T >::m_name, cond::TagInfo_t::name, cond::LogDBEntry_t::payloadClass, cond::Iov_t::payloadId, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConConfigDbObjHandler< T >::setForTransfer(), cond::Iov_t::since, cond::TagInfo_t::size, contentValuesCheck::ss, popcon::PopConSourceHandler< T >::tagInfo(), cond::LogDBEntry_t::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

41  {
42  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name;
43 
44  if (m_debugMode) {
45  std::stringstream ss;
46  ss << "\n\n------- " << m_name << " - > getNewObjects\n";
47  if (this->tagInfo().size) {
48  //check whats already inside of database
49  ss << "got offlineInfo" << this->tagInfo().name << ", size " << this->tagInfo().size
50  << " , last object valid since " << this->tagInfo().lastInterval.since << " token "
51  << this->tagInfo().lastInterval.payloadId << "\n\n UserText " << this->userTextLog() << "\n LogDBEntry \n"
52  << this->logDBEntry().logId << "\n"
53  << this->logDBEntry().destinationDB << "\n"
54  << this->logDBEntry().provenance << "\n"
55  << this->logDBEntry().usertext << "\n"
56  << this->logDBEntry().iovtag << "\n"
57  << this->logDBEntry().iovtimetype << "\n"
58  << this->logDBEntry().payloadIdx << "\n"
59  << this->logDBEntry().payloadClass << "\n"
60  << this->logDBEntry().payloadToken << "\n"
61  << this->logDBEntry().exectime << "\n"
62  << this->logDBEntry().execmessage << "\n"
63  << "\n\n-- user text "
64  << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of('@'));
65  } else {
66  ss << " First object for this tag ";
67  }
68  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << ss.str();
69  }
70  if (isTransferNeeded())
72 
73  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
74  << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
75  }
Iov_t lastInterval
Definition: Types.h:73
unsigned long long logId
Definition: Types.h:87
std::string provenance
Definition: Types.h:89
std::string payloadToken
Definition: Types.h:96
Time_t since
Definition: Types.h:53
size_t size
Definition: Types.h:74
std::string execmessage
Definition: Types.h:98
std::string name
Definition: Types.h:72
cond::TagInfo_t const & tagInfo() const
std::string payloadClass
Definition: Types.h:95
Hash payloadId
Definition: Types.h:55
std::string destinationDB
Definition: Types.h:88
Log< level::Info, false > LogInfo
std::string exectime
Definition: Types.h:97
cond::LogDBEntry_t const & logDBEntry() const
std::string const & userTextLog() const
unsigned int payloadIdx
Definition: Types.h:93
std::string usertext
Definition: Types.h:90
std::string iovtimetype
Definition: Types.h:92
std::string iovtag
Definition: Types.h:91

◆ id()

template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::id ( void  ) const
inlineoverridevirtual

◆ isTransferNeeded()

template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded ( )
inline

Definition at line 83 of file SiStripPopConConfigDbObjHandler.h.

References SiStripCondObjBuilderFromDb::checkForCompatibility(), popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder, cond::LogDBEntry_t::destinationDB, label, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, Skims_PA_cff::name, cond::LogDBEntry_t::payloadClass, cond::Iov_t::since, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry_t::usertext.

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

83  {
84  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
85  << "[isTransferNeeded] checking for transfer: " << typeid(T).name() << std::endl;
86  std::stringstream ss_logdb, ss;
87 
88  //get log information from previous upload
89  if (!this->logDBEntry().usertext.empty())
90  ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_first_of('@'));
91  else
92  ss_logdb << "";
93 
94  std::string label = "";
95  if (typeid(T) == typeid(SiStripFedCabling))
96  label = "Cabling";
97 
98  if (typeid(T) == typeid(SiStripApvGain))
99  label = "ApvTiming";
100 
101  if (typeid(T) == typeid(SiStripLatency))
102  label = "ApvLatency";
103 
104  if (!condObjBuilder->checkForCompatibility(ss_logdb, ss, label)) {
105  //string are equal, no need to do transfer
106  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
107  << "[isTransferNeeded] the selected conditions are already uploaded in the last iov ("
108  << this->tagInfo().lastInterval.since << ") open for the object " << this->logDBEntry().payloadClass
109  << " in the db " << this->logDBEntry().destinationDB << " parameters: " << ss_logdb.str()
110  << "\n NO TRANSFER NEEDED";
111  return false;
112  }
113 
114  this->m_userTextLog = ss.str();
115  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
116  << "[isTransferNeeded] the selected conditions will be uploaded: " << ss.str()
117  << "\n Going to Upload: " << ss.str() << "\n Last Upload: " << ss_logdb.str() << "\n Fine";
118 
119  return true;
120  }
Iov_t lastInterval
Definition: Types.h:73
edm::Service< SiStripCondObjBuilderFromDb > condObjBuilder
Time_t since
Definition: Types.h:53
cond::TagInfo_t const & tagInfo() const
char const * label
bool checkForCompatibility(std::stringstream &input, std::stringstream &output, std::string &label)
std::string payloadClass
Definition: Types.h:95
std::string destinationDB
Definition: Types.h:88
Log< level::Info, false > LogInfo
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
cond::LogDBEntry_t const & logDBEntry() const
std::string usertext
Definition: Types.h:90
long double T

◆ setForTransfer()

template<typename T >
void popcon::SiStripPopConConfigDbObjHandler< T >::setForTransfer ( )
inline

Definition at line 124 of file SiStripPopConConfigDbObjHandler.h.

References popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder, SiStripCondObjBuilderFromDb::getValue(), cond::TagInfo_t::lastInterval, popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode, popcon::SiStripPopConConfigDbObjHandler< T >::m_name, popcon::SiStripPopConConfigDbObjHandler< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, Skims_PA_cff::name, getGTfromDQMFile::obj, cond::Iov_t::since, and popcon::PopConSourceHandler< T >::tagInfo().

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

124  {
125  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
126  << "[setForTransfer] " << m_name << " getting data to be transferred " << std::endl;
127 
128  T* obj = nullptr;
130 
131  edm::LogInfo("SiStripPopPopConConfigDbObjHandler")
132  << "[setForTransfer] " << m_name << " got data to be transferred from condObjBuilder " << std::endl;
133 
134  if (!this->tagInfo().size)
135  m_since = 1;
136  else if (m_debugMode)
137  m_since = this->tagInfo().lastInterval.since + 1;
138  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] setting since = " << m_since << std::endl;
139 
140  if (obj != nullptr) {
141  edm::LogInfo("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] filling map m_to_transfer" << std::endl;
142  this->m_to_transfer.push_back(std::make_pair(obj, m_since));
143  } else {
144  edm::LogError("SiStripPopPopConConfigDbObjHandler")
145  << "[setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name()
146  << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted" << std::endl;
147  }
148  }
Iov_t lastInterval
Definition: Types.h:73
edm::Service< SiStripCondObjBuilderFromDb > condObjBuilder
Time_t since
Definition: Types.h:53
Log< level::Error, false > LogError
cond::TagInfo_t const & tagInfo() const
std::vector< std::pair< T *, Time_t > > m_to_transfer
void getValue(SiStripFedCabling *&val)
Log< level::Info, false > LogInfo
long double T

Member Data Documentation

◆ condObjBuilder

template<typename T >
edm::Service<SiStripCondObjBuilderFromDb> popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder
private

◆ m_debugMode

template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode
private

◆ m_name

template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::m_name
private

◆ m_since

template<typename T >
unsigned long long popcon::SiStripPopConConfigDbObjHandler< T >::m_since
private