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 Member Functions | Private Attributes
popcon::SiStripPopConDbObjHandler< T, U > Class Template Reference

#include <SiStripPopConDbObjHandler.h>

Inheritance diagram for popcon::SiStripPopConDbObjHandler< T, U >:
popcon::PopConSourceHandler< T >

Public Member Functions

void getNewObjects ()
 
std::string id () const
 
 SiStripPopConDbObjHandler (const edm::ParameterSet &pset)
 
 ~SiStripPopConDbObjHandler ()
 
- 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 Member Functions

std::string getDataType ()
 
bool isTransferNeeded ()
 
void setForTransfer ()
 

Private Attributes

edm::Service< U > 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, typename U>
class popcon::SiStripPopConDbObjHandler< T, U >

Definition at line 21 of file SiStripPopConDbObjHandler.h.

Constructor & Destructor Documentation

template<typename T , typename U >
popcon::SiStripPopConDbObjHandler< T, U >::SiStripPopConDbObjHandler ( const edm::ParameterSet pset)
inline

Definition at line 24 of file SiStripPopConDbObjHandler.h.

24  :
25  m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopConDbObjHandler")),
26  m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
27  m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){};
T getUntrackedParameter(std::string const &, T const &) const
template<typename T , typename U >
popcon::SiStripPopConDbObjHandler< T, U >::~SiStripPopConDbObjHandler ( )
inline

Definition at line 31 of file SiStripPopConDbObjHandler.h.

31 {};

Member Function Documentation

template<typename T , typename U >
std::string popcon::SiStripPopConDbObjHandler< T, U >::getDataType ( )
inlineprivate

Definition at line 88 of file SiStripPopConDbObjHandler.h.

References mergeVDriftHistosByStation::name.

88 {return typeid(T).name();}
long double T
template<typename T , typename U >
void popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects ( )
inlinevirtual

Implements popcon::PopConSourceHandler< T >.

Definition at line 35 of file SiStripPopConDbObjHandler.h.

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

35  {
36  edm::LogInfo ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name;
37 
38  if (m_debugMode){
39  std::stringstream ss;
40  ss << "\n\n------- " << m_name
41  << " - > getNewObjects\n";
42  if (this->tagInfo().size){
43  //check whats already inside of database
44  ss << "\ngot offlineInfo"<< this->tagInfo().name
45  << "\n size " << this->tagInfo().size
46  << "\n" << this->tagInfo().token
47  << "\n last object valid since " << this->tagInfo().lastInterval.first
48  << "\n token " << this->tagInfo().lastPayloadToken
49  << "\n UserText " << this->userTextLog()
50  << "\n LogDBEntry \n"
51  << this->logDBEntry().logId<< "\n"
52  << this->logDBEntry().destinationDB<< "\n"
53  << this->logDBEntry().provenance<< "\n"
54  << this->logDBEntry().usertext<< "\n"
55  << this->logDBEntry().iovtag<< "\n"
56  << this->logDBEntry().iovtimetype<< "\n"
57  << this->logDBEntry().payloadIdx<< "\n"
58  << this->logDBEntry().payloadName<< "\n"
59  << this->logDBEntry().payloadToken<< "\n"
60  << this->logDBEntry().payloadContainer<< "\n"
61  << this->logDBEntry().exectime<< "\n"
62  << this->logDBEntry().execmessage<< "\n";
63  if(this->logDBEntry().usertext!="")
64  ss<< "\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
65 
66  } else {
67  ss << " First object for this tag ";
68  }
69  edm::LogInfo ("SiStripPopConDbObjHandler") << ss.str();
70  }
71 
72  condObjBuilder->initialize();
73 
74  if (isTransferNeeded())
76 
77  edm::LogInfo ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
78  }
std::string exectime
Definition: LogDBEntry.h:18
std::string usertext
Definition: LogDBEntry.h:10
std::string iovtimetype
Definition: LogDBEntry.h:12
std::string const & userTextLog() const
unsigned int payloadIdx
Definition: LogDBEntry.h:13
std::string payloadToken
Definition: LogDBEntry.h:16
unsigned long long logId
Definition: LogDBEntry.h:7
std::string payloadName
Definition: LogDBEntry.h:15
std::string destinationDB
Definition: LogDBEntry.h:8
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:19
size_t size
Definition: TagInfo.h:13
std::string payloadContainer
Definition: LogDBEntry.h:17
std::string token
Definition: TagInfo.h:10
std::string provenance
Definition: LogDBEntry.h:9
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
std::string iovtag
Definition: LogDBEntry.h:11
tuple size
Write out results.
template<typename T , typename U >
std::string popcon::SiStripPopConDbObjHandler< T, U >::id ( void  ) const
inlinevirtual
template<typename T , typename U >
bool popcon::SiStripPopConDbObjHandler< T, U >::isTransferNeeded ( )
inlineprivate

Definition at line 94 of file SiStripPopConDbObjHandler.h.

References popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder, cond::LogDBEntry::destinationDB, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::SiStripPopConDbObjHandler< T, U >::m_since, popcon::PopConSourceHandler< T >::m_userTextLog, cond::LogDBEntry::payloadName, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.

Referenced by popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects().

94  {
95 
96  edm::LogInfo ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::isTransferNeeded] checking for transfer " << std::endl;
97 
98  if(m_since<=this->tagInfo().lastInterval.first){
99  edm::LogInfo ("SiStripPopConDbObjHandler")
100  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe current starting iov " << m_since
101  << "\nis not compatible with the last iov ("
102  << this->tagInfo().lastInterval.first << ") open for the object "
103  << this->logDBEntry().payloadName << " \nin the db "
104  << this->logDBEntry().destinationDB << " \n NO TRANSFER NEEDED";
105  return false;
106  }
107 
108  std::stringstream ss_logdb, ss;
109 
110  //get log information from previous upload
111  if (this->logDBEntry().usertext!="")
112  ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")+2);
113 
114 
115  condObjBuilder->getMetaDataString(ss);
116  if(condObjBuilder->checkForCompatibility(ss_logdb.str())){
117 
118  this->m_userTextLog = "@ " + ss.str();
119 
120  edm::LogInfo ("SiStripPopConDbObjHandler")
121  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe selected conditions will be uploaded: " << ss.str()
122  << "\n Current MetaData - "<< ss.str() << "\n Last Uploaded MetaData- " << ss_logdb.str() << "\n Fine";
123 
124  return true;
125  } else {
126  edm::LogInfo ("SiStripPopConDbObjHandler")
127  << "[SiStripPopConDbObjHandler::isTransferNeeded] \nthe current MetaData conditions " << ss.str()
128  << "\nare not compatible with the MetaData Conditions of the last iov ("
129  << this->tagInfo().lastInterval.first << ") open for the object "
130  << this->logDBEntry().payloadName << " \nin the db "
131  << this->logDBEntry().destinationDB << " \nConditions: " << ss_logdb.str() << "\n NO TRANSFER NEEDED";
132  return false;
133  }
134  }
std::string usertext
Definition: LogDBEntry.h:10
std::string payloadName
Definition: LogDBEntry.h:15
std::string destinationDB
Definition: LogDBEntry.h:8
cond::TagInfo const & tagInfo() const
cond::LogDBEntry const & logDBEntry() const
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
template<typename T , typename U >
void popcon::SiStripPopConDbObjHandler< T, U >::setForTransfer ( )
inlineprivate

Definition at line 139 of file SiStripPopConDbObjHandler.h.

References popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder, cond::TagInfo::lastInterval, popcon::SiStripPopConDbObjHandler< T, U >::m_debugMode, popcon::SiStripPopConDbObjHandler< T, U >::m_name, popcon::SiStripPopConDbObjHandler< T, U >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, VarParsing::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

Referenced by popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects().

139  {
140  edm::LogInfo ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::setForTransfer] " << m_name << " getting data to be transferred " << std::endl;
141 
142  T *obj=0;
143  condObjBuilder->getObj(obj);
144 
145  if(!this->tagInfo().size)
146  m_since=1;
147  else
148  if (m_debugMode)
149  m_since=this->tagInfo().lastInterval.first+1;
150 
151  if (obj!=0){
152 
153  edm::LogInfo ("SiStripPopConDbObjHandler") <<"setting since = "<< m_since <<std::endl;
154  this->m_to_transfer.push_back(std::make_pair(obj,m_since));
155  }else{
156  edm::LogError ("SiStripPopConDbObjHandler") <<"[SiStripPopConDbObjHandler::setForTransfer] " << m_name << " : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
157  }
158  }
cond::TagInfo const & tagInfo() const
tuple obj
Example code starts here #.
Definition: VarParsing.py:655
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
long double T
tuple size
Write out results.

Member Data Documentation

template<typename T , typename U >
edm::Service<U> popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder
private
template<typename T , typename U >
bool popcon::SiStripPopConDbObjHandler< T, U >::m_debugMode
private
template<typename T , typename U >
std::string popcon::SiStripPopConDbObjHandler< T, U >::m_name
private
template<typename T , typename U >
unsigned long long popcon::SiStripPopConDbObjHandler< T, U >::m_since
private