CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
std::string id () const
 
bool isTransferNeeded ()
 
void setForTransfer ()
 
 SiStripPopConConfigDbObjHandler (const edm::ParameterSet &pset)
 
 ~SiStripPopConConfigDbObjHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< T >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (cond::DbSession dbSession, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (cond::DbSession session, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Attributes

edm::Service
< SiStripCondObjBuilderFromDb
condObjBuilder
 
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)
 
- 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 27 of file SiStripPopConConfigDbObjHandler.h.

Constructor & Destructor Documentation

Definition at line 32 of file SiStripPopConConfigDbObjHandler.h.

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

Definition at line 39 of file SiStripPopConConfigDbObjHandler.h.

39 {};

Member Function Documentation

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

Implements popcon::PopConSourceHandler< T >.

Definition at line 43 of file SiStripPopConConfigDbObjHandler.h.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry::logId, popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode, popcon::SiStripPopConConfigDbObjHandler< T >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadClass, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::SiStripPopConConfigDbObjHandler< T >::setForTransfer(), cond::TagInfo::size, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< T >::userTextLog().

43  {
44  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name;
45 
46  if (m_debugMode){
47  std::stringstream ss;
48  ss << "\n\n------- " << m_name
49  << " - > getNewObjects\n";
50  if (this->tagInfo().size){
51  //check whats already inside of database
52  ss << "got offlineInfo"<<
53  this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token
54  << " , last object valid since "
55  << this->tagInfo().lastInterval.first << " token "
56  << this->tagInfo().lastPayloadToken << "\n\n UserText " << this->userTextLog()
57  << "\n LogDBEntry \n"
58  << this->logDBEntry().logId<< "\n"
59  << this->logDBEntry().destinationDB<< "\n"
60  << this->logDBEntry().provenance<< "\n"
61  << this->logDBEntry().usertext<< "\n"
62  << this->logDBEntry().iovtag<< "\n"
63  << this->logDBEntry().iovtimetype<< "\n"
64  << this->logDBEntry().payloadIdx<< "\n"
65  << this->logDBEntry().payloadClass<< "\n"
66  << this->logDBEntry().payloadToken<< "\n"
67  << this->logDBEntry().exectime<< "\n"
68  << this->logDBEntry().execmessage<< "\n"
69  << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
70  } else {
71  ss << " First object for this tag ";
72  }
73  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << ss.str();
74  }
75  if (isTransferNeeded())
77 
78  edm::LogInfo ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
79  }
std::string exectime
Definition: LogDBEntry.h:27
std::string usertext
Definition: LogDBEntry.h:20
std::string iovtimetype
Definition: LogDBEntry.h:22
std::string const & userTextLog() const
unsigned int payloadIdx
Definition: LogDBEntry.h:23
std::string payloadToken
Definition: LogDBEntry.h:26
unsigned long long logId
Definition: LogDBEntry.h:17
std::string payloadClass
Definition: LogDBEntry.h:25
std::string destinationDB
Definition: LogDBEntry.h:18
std::string lastPayloadToken
Definition: TagInfo.h:12
cond::TagInfo const & tagInfo() const
std::string name
Definition: TagInfo.h:9
cond::LogDBEntry const & logDBEntry() const
std::string execmessage
Definition: LogDBEntry.h:28
size_t size
Definition: TagInfo.h:13
std::string token
Definition: TagInfo.h:10
std::string provenance
Definition: LogDBEntry.h:19
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
std::string iovtag
Definition: LogDBEntry.h:21
tuple size
Write out results.
template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::id ( void  ) const
inlinevirtual
template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded ( )
inline

Definition at line 88 of file SiStripPopConConfigDbObjHandler.h.

References SiStripCondObjBuilderFromDb::checkForCompatibility(), popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder, cond::LogDBEntry::destinationDB, diffTwoXMLs::label, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, mergeVDriftHistosByStation::name, cond::LogDBEntry::payloadClass, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.

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

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

Definition at line 131 of file SiStripPopConConfigDbObjHandler.h.

References popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder, SiStripCondObjBuilderFromDb::getValue(), cond::TagInfo::lastInterval, popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode, popcon::SiStripPopConConfigDbObjHandler< T >::m_name, popcon::SiStripPopConConfigDbObjHandler< T >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

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

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