CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
SiStripDQMPopConSourceHandler< T > Class Template Referenceabstract

#include <SiStripDQMPopConSourceHandler.h>

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

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
- 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
 

Public Member Functions

virtual bool checkForCompatibility (const std::string &otherMetaData) const
 
virtual void dqmEndJob (DQMStore::IBooker &booker, DQMStore::IGetter &getter)
 
virtual std::string getMetaDataString () const
 
void getNewObjects () override
 
virtual TgetObj () const =0
 
std::string id () const override
 
virtual void initES (const edm::EventSetup &)
 
 SiStripDQMPopConSourceHandler (const edm::ParameterSet &pset)
 
 ~SiStripDQMPopConSourceHandler () 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 ()
 

Protected Member Functions

uint32_t getRunNumber () const
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< T >
cond::persistency::SessiondbSession () const
 

Private Member Functions

bool isTransferNeeded ()
 
void setForTransfer ()
 

Private Attributes

bool m_debugMode
 
bool m_iovSequence
 
std::string m_name
 
uint32_t m_runNumber
 
unsigned long long m_since
 

Additional Inherited Members

- 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 SiStripDQMPopConSourceHandler< T >

Author
M. De Mattia
P. David (merge service functionality into base class)

Base class for SiStrip popcon::PopConSourceHandler (reading from DQM) and writing in the Database.

Definition at line 19 of file SiStripDQMPopConSourceHandler.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 21 of file SiStripDQMPopConSourceHandler.h.

Constructor & Destructor Documentation

◆ SiStripDQMPopConSourceHandler()

template<typename T>
SiStripDQMPopConSourceHandler< T >::SiStripDQMPopConSourceHandler ( const edm::ParameterSet pset)
inlineexplicit

Definition at line 23 of file SiStripDQMPopConSourceHandler.h.

24  : m_name{pset.getUntrackedParameter<std::string>("name", "SiStripPopConDbObjHandler")},
25  m_since{pset.getUntrackedParameter<uint32_t>("since", 5)},
26  m_runNumber{pset.getParameter<uint32_t>("RunNb")},
27  m_iovSequence{pset.getUntrackedParameter<bool>("iovSequence", true)} // flag: check compatibility
28  ,
29  m_debugMode{pset.getUntrackedParameter<bool>("debug", false)} {}

◆ ~SiStripDQMPopConSourceHandler()

template<typename T>
SiStripDQMPopConSourceHandler< T >::~SiStripDQMPopConSourceHandler ( )
inlineoverride

Definition at line 31 of file SiStripDQMPopConSourceHandler.h.

31 {}

Member Function Documentation

◆ checkForCompatibility()

template<typename T>
virtual bool SiStripDQMPopConSourceHandler< T >::checkForCompatibility ( const std::string &  otherMetaData) const
inlinevirtual

Definition at line 40 of file SiStripDQMPopConSourceHandler.h.

40  {
41  return otherMetaData != getMetaDataString();
42  }
virtual std::string getMetaDataString() const

◆ dqmEndJob()

template<typename T>
virtual void SiStripDQMPopConSourceHandler< T >::dqmEndJob ( DQMStore::IBooker booker,
DQMStore::IGetter getter 
)
inlinevirtual

◆ getMetaDataString()

template<class T >
std::string SiStripDQMPopConSourceHandler< T >::getMetaDataString ( ) const
virtual

Reimplemented in SiStripPopConBadComponentsHandlerFromDQM.

Definition at line 168 of file SiStripDQMPopConSourceHandler.h.

Referenced by SiStripDQMPopConSourceHandler< SiStripBadStrip >::checkForCompatibility().

168  {
169  std::cout << "SiStripPedestalsDQMService::getMetaDataString" << std::endl;
170  std::stringstream ss;
171  ss << "Run " << m_runNumber << std::endl;
172  return ss.str();
173 }

◆ getNewObjects()

template<typename T >
void SiStripDQMPopConSourceHandler< T >::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 68 of file SiStripDQMPopConSourceHandler.h.

68  {
69  edm::LogInfo("SiStripPopConDbObjHandler")
70  << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name;
71 
72  if (m_debugMode) {
73  std::stringstream ss;
74  ss << "\n\n------- " << m_name << " - > getNewObjects\n";
75  if (this->tagInfo().size) {
76  //check whats already inside of database
77  ss << "\ngot offlineInfo" << this->tagInfo().name << "\n size " << this->tagInfo().size
78  << "\n last object valid since " << this->tagInfo().lastInterval.since << "\n token "
79  << this->tagInfo().lastInterval.payloadId << "\n UserText " << this->userTextLog() << "\n LogDBEntry \n"
80  << this->logDBEntry().logId << "\n"
81  << this->logDBEntry().destinationDB << "\n"
82  << this->logDBEntry().provenance << "\n"
83  << this->logDBEntry().usertext << "\n"
84  << this->logDBEntry().iovtag << "\n"
85  << this->logDBEntry().iovtimetype << "\n"
86  << this->logDBEntry().payloadIdx << "\n"
87  << this->logDBEntry().payloadClass << "\n"
88  << this->logDBEntry().payloadToken << "\n"
89  << this->logDBEntry().exectime << "\n"
90  << this->logDBEntry().execmessage << "\n";
91  if (!this->logDBEntry().usertext.empty())
92  ss << "\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of('@'));
93  } else {
94  ss << " First object for this tag ";
95  }
96  edm::LogInfo("SiStripPopConDbObjHandler") << ss.str();
97  }
98 
99  if (isTransferNeeded())
100  setForTransfer();
101 
102  edm::LogInfo("SiStripPopConDbObjHandler")
103  << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
104 }
size
Write out results.
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

◆ getObj()

template<typename T>
virtual T* SiStripDQMPopConSourceHandler< T >::getObj ( ) const
pure virtual

◆ getRunNumber()

template<typename T>
uint32_t SiStripDQMPopConSourceHandler< T >::getRunNumber ( ) const
inlineprotected

Definition at line 49 of file SiStripDQMPopConSourceHandler.h.

◆ id()

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

◆ initES()

template<typename T>
virtual void SiStripDQMPopConSourceHandler< T >::initES ( const edm::EventSetup )
inlinevirtual

◆ isTransferNeeded()

template<typename T >
bool SiStripDQMPopConSourceHandler< T >::isTransferNeeded ( )
private

Definition at line 107 of file SiStripDQMPopConSourceHandler.h.

107  {
108  edm::LogInfo("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::isTransferNeeded] checking for transfer ";
109 
110  if (m_iovSequence && (m_since <= this->tagInfo().lastInterval.since)) {
111  edm::LogInfo("SiStripPopConDbObjHandler")
112  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe current starting iov " << m_since
113  << "\nis not compatible with the last iov (" << this->tagInfo().lastInterval.since << ") open for the object "
114  << this->logDBEntry().payloadClass << " \nin the db " << this->logDBEntry().destinationDB
115  << " \n NO TRANSFER NEEDED";
116  return false;
117  }
118 
119  std::string ss_logdb{};
120 
121  //get log information from previous upload
122  if (!this->logDBEntry().usertext.empty())
123  ss_logdb = this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of('@') + 2);
124 
126  if ((!m_iovSequence) || checkForCompatibility(ss_logdb)) {
127  this->m_userTextLog = "@ " + ss;
128 
129  edm::LogInfo("SiStripPopConDbObjHandler")
130  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe selected conditions will be uploaded: " << ss
131  << "\n Current MetaData - " << ss << "\n Last Uploaded MetaData- " << ss_logdb << "\n Fine";
132 
133  return true;
134  } else if (m_iovSequence) {
135  edm::LogInfo("SiStripPopConDbObjHandler")
136  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe current MetaData conditions " << ss
137  << "\nare not compatible with the MetaData Conditions of the last iov (" << this->tagInfo().lastInterval.since
138  << ") open for the object " << this->logDBEntry().payloadClass << " \nin the db "
139  << this->logDBEntry().destinationDB << " \nConditions: " << ss_logdb << "\n NO TRANSFER NEEDED";
140  return false;
141  } else {
142  return true;
143  }
144 }
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
cond::TagInfo_t const & tagInfo() const
std::string payloadClass
Definition: Types.h:95
std::string destinationDB
Definition: Types.h:88
Log< level::Info, false > LogInfo
cond::LogDBEntry_t const & logDBEntry() const
virtual bool checkForCompatibility(const std::string &otherMetaData) const
std::string usertext
Definition: Types.h:90
virtual std::string getMetaDataString() const

◆ setForTransfer()

template<typename T >
void SiStripDQMPopConSourceHandler< T >::setForTransfer ( )
private

Definition at line 147 of file SiStripDQMPopConSourceHandler.h.

147  {
148  edm::LogInfo("SiStripPopConDbObjHandler")
149  << "[SiStripPopConDbObjHandler::setForTransfer] " << m_name << " getting data to be transferred ";
150 
151  if (!this->tagInfo().size)
152  m_since = 1;
153  else if (m_debugMode)
154  m_since = this->tagInfo().lastInterval.since + 1;
155 
156  T* obj = this->getObj();
157  if (obj) {
158  edm::LogInfo("SiStripPopConDbObjHandler") << "setting since = " << m_since;
159  this->m_to_transfer.push_back(std::make_pair(obj, m_since));
160  } else {
161  edm::LogError("SiStripPopConDbObjHandler")
162  << "[SiStripPopConDbObjHandler::setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name()
163  << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted";
164  }
165 }
size
Write out results.
Iov_t lastInterval
Definition: Types.h:73
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
Log< level::Info, false > LogInfo
virtual T * getObj() const =0
long double T

Member Data Documentation

◆ m_debugMode

template<typename T>
bool SiStripDQMPopConSourceHandler< T >::m_debugMode
private

Definition at line 56 of file SiStripDQMPopConSourceHandler.h.

◆ m_iovSequence

template<typename T>
bool SiStripDQMPopConSourceHandler< T >::m_iovSequence
private

Definition at line 55 of file SiStripDQMPopConSourceHandler.h.

◆ m_name

template<typename T>
std::string SiStripDQMPopConSourceHandler< T >::m_name
private

◆ m_runNumber

template<typename T>
uint32_t SiStripDQMPopConSourceHandler< T >::m_runNumber
private

◆ m_since

template<typename T>
unsigned long long SiStripDQMPopConSourceHandler< T >::m_since
private

Definition at line 53 of file SiStripDQMPopConSourceHandler.h.