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 (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 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 87 of file SiStripPopConDbObjHandler.h.

References mergeVDriftHistosByStation::name.

87 {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_t::destinationDB, cond::LogDBEntry_t::execmessage, cond::LogDBEntry_t::exectime, cond::LogDBEntry_t::iovtag, cond::LogDBEntry_t::iovtimetype, popcon::SiStripPopConDbObjHandler< T, U >::isTransferNeeded(), cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, popcon::PopConSourceHandler< T >::logDBEntry(), cond::LogDBEntry_t::logId, popcon::SiStripPopConDbObjHandler< T, U >::m_debugMode, popcon::SiStripPopConDbObjHandler< T, U >::m_name, cond::TagInfo_t::name, cond::LogDBEntry_t::payloadClass, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::payloadToken, cond::LogDBEntry_t::provenance, popcon::SiStripPopConDbObjHandler< T, U >::setForTransfer(), cond::TagInfo_t::size, findQualityFiles::size, popcon::PopConSourceHandler< T >::tagInfo(), cond::TagInfo_t::token, cond::LogDBEntry_t::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().payloadClass<< "\n"
59  << this->logDBEntry().payloadToken<< "\n"
60  << this->logDBEntry().exectime<< "\n"
61  << this->logDBEntry().execmessage<< "\n";
62  if(this->logDBEntry().usertext!="")
63  ss<< "\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
64 
65  } else {
66  ss << " First object for this tag ";
67  }
68  edm::LogInfo ("SiStripPopConDbObjHandler") << ss.str();
69  }
70 
71  condObjBuilder->initialize();
72 
73  if (isTransferNeeded())
75 
76  edm::LogInfo ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
77  }
std::string const & userTextLog() const
unsigned long long logId
Definition: Types.h:78
std::string provenance
Definition: Types.h:80
std::string payloadToken
Definition: Types.h:87
size_t size
Definition: Types.h:63
std::string execmessage
Definition: Types.h:89
std::string name
Definition: Types.h:59
cond::ValidityInterval lastInterval
Definition: Types.h:61
std::string payloadClass
Definition: Types.h:86
cond::LogDBEntry_t const & logDBEntry() const
std::string destinationDB
Definition: Types.h:79
std::string exectime
Definition: Types.h:88
std::string lastPayloadToken
Definition: Types.h:62
unsigned int payloadIdx
Definition: Types.h:84
std::string usertext
Definition: Types.h:81
tuple size
Write out results.
std::string token
Definition: Types.h:60
cond::TagInfo_t const & tagInfo() const
std::string iovtimetype
Definition: Types.h:83
std::string iovtag
Definition: Types.h:82
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 93 of file SiStripPopConDbObjHandler.h.

References popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder, cond::LogDBEntry_t::destinationDB, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::SiStripPopConDbObjHandler< T, U >::m_since, popcon::PopConSourceHandler< T >::m_userTextLog, cond::LogDBEntry_t::payloadClass, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry_t::usertext.

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

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

Definition at line 138 of file SiStripPopConDbObjHandler.h.

References popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder, cond::TagInfo_t::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, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

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

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

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