CMS 3D CMS Logo

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)
 
cond::persistency::SessiondbSession () const
 
- 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 19 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 22 of file SiStripPopConDbObjHandler.h.

22  :
23  m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopConDbObjHandler")),
24  m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
25  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 29 of file SiStripPopConDbObjHandler.h.

29 {};

Member Function Documentation

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

Definition at line 85 of file SiStripPopConDbObjHandler.h.

References dataset::name.

85 {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 33 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().

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

Definition at line 91 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().

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

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

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

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