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

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::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<typename T>
class popcon::SiStripPopConConfigDbObjHandler< T >

Definition at line 26 of file SiStripPopConConfigDbObjHandler.h.

Constructor & Destructor Documentation

Definition at line 31 of file SiStripPopConConfigDbObjHandler.h.

31  :
32  m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopPopConConfigDbObjHandler")),
33  m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
34  m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){};
T getUntrackedParameter(std::string const &, T const &) const
template<typename T >
popcon::SiStripPopConConfigDbObjHandler< T >::~SiStripPopConConfigDbObjHandler ( )
inlineoverride

Definition at line 38 of file SiStripPopConConfigDbObjHandler.h.

38 {};

Member Function Documentation

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

Implements popcon::PopConSourceHandler< T >.

Definition at line 42 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, cond::TagInfo_t::lastPayloadToken, 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::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConConfigDbObjHandler< T >::setForTransfer(), cond::TagInfo_t::size, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo_t::token, cond::LogDBEntry_t::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

42  {
43  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name;
44 
45  if (m_debugMode){
46  std::stringstream ss;
47  ss << "\n\n------- " << m_name
48  << " - > getNewObjects\n";
49  if (this->tagInfo().size){
50  //check whats already inside of database
51  ss << "got offlineInfo"<<
52  this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token
53  << " , last object valid since "
54  << this->tagInfo().lastInterval.first << " token "
55  << this->tagInfo().lastPayloadToken << "\n\n UserText " << this->userTextLog()
56  << "\n LogDBEntry \n"
57  << this->logDBEntry().logId<< "\n"
58  << this->logDBEntry().destinationDB<< "\n"
59  << this->logDBEntry().provenance<< "\n"
60  << this->logDBEntry().usertext<< "\n"
61  << this->logDBEntry().iovtag<< "\n"
62  << this->logDBEntry().iovtimetype<< "\n"
63  << this->logDBEntry().payloadIdx<< "\n"
64  << this->logDBEntry().payloadClass<< "\n"
65  << this->logDBEntry().payloadToken<< "\n"
66  << this->logDBEntry().exectime<< "\n"
67  << this->logDBEntry().execmessage<< "\n"
68  << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
69  } else {
70  ss << " First object for this tag ";
71  }
72  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << ss.str();
73  }
74  if (isTransferNeeded())
76 
77  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
78  }
size
Write out results.
std::string const & userTextLog() const
unsigned long long logId
Definition: Types.h:92
std::string provenance
Definition: Types.h:94
std::string payloadToken
Definition: Types.h:101
size_t size
Definition: Types.h:77
std::string execmessage
Definition: Types.h:103
std::string name
Definition: Types.h:73
cond::ValidityInterval lastInterval
Definition: Types.h:75
std::string payloadClass
Definition: Types.h:100
cond::LogDBEntry_t const & logDBEntry() const
std::string destinationDB
Definition: Types.h:93
std::string exectime
Definition: Types.h:102
std::string lastPayloadToken
Definition: Types.h:76
unsigned int payloadIdx
Definition: Types.h:98
std::string usertext
Definition: Types.h:95
std::string token
Definition: Types.h:74
cond::TagInfo_t const & tagInfo() const
std::string iovtimetype
Definition: Types.h:97
std::string iovtag
Definition: Types.h:96
template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::id ( void  ) const
inlineoverridevirtual
template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded ( )
inline

Definition at line 87 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, dataset::name, cond::LogDBEntry_t::payloadClass, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry_t::usertext.

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

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

Definition at line 130 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, dataset::name, GetRecoTauVFromDQM_MC_cff::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

130  {
131  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " getting data to be transferred " << std::endl;
132 
133  T *obj=nullptr;
134  condObjBuilder->getValue(obj);
135 
136  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " got data to be transferred from condObjBuilder " << std::endl;
137 
138  if(!this->tagInfo().size)
139  m_since=1;
140  else
141  if (m_debugMode)
142  m_since=this->tagInfo().lastInterval.first+1;
143  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] setting since = "<< m_since <<std::endl;
144 
145  if (obj!=nullptr){
146 
147  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] filling map m_to_transfer" <<std::endl;
148  this->m_to_transfer.push_back(std::make_pair(obj,m_since));
149  }else{
150  edm::LogError ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
151  }
152  }
size
Write out results.
edm::Service< SiStripCondObjBuilderFromDb > condObjBuilder
cond::ValidityInterval lastInterval
Definition: Types.h:75
void getValue(SiStripFedCabling *&val)
long double T
cond::TagInfo_t const & tagInfo() const

Member Data Documentation

template<typename T >
edm::Service<SiStripCondObjBuilderFromDb> popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder
private
template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode
private
template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::m_name
private
template<typename T >
unsigned long long popcon::SiStripPopConConfigDbObjHandler< T >::m_since
private