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 (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
< 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_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().

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 const & userTextLog() const
unsigned long long logId
Definition: Types.h:82
std::string provenance
Definition: Types.h:84
std::string payloadToken
Definition: Types.h:91
size_t size
Definition: Types.h:67
std::string execmessage
Definition: Types.h:93
std::string name
Definition: Types.h:63
cond::ValidityInterval lastInterval
Definition: Types.h:65
std::string payloadClass
Definition: Types.h:90
cond::LogDBEntry_t const & logDBEntry() const
std::string destinationDB
Definition: Types.h:83
std::string exectime
Definition: Types.h:92
std::string lastPayloadToken
Definition: Types.h:66
unsigned int payloadIdx
Definition: Types.h:88
std::string usertext
Definition: Types.h:85
tuple size
Write out results.
std::string token
Definition: Types.h:64
cond::TagInfo_t const & tagInfo() const
std::string iovtimetype
Definition: Types.h:87
std::string iovtag
Definition: Types.h:86
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_t::destinationDB, diffTwoXMLs::label, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, mergeVDriftHistosByStation::name, cond::LogDBEntry_t::payloadClass, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry_t::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  }
edm::Service< SiStripCondObjBuilderFromDb > condObjBuilder
cond::ValidityInterval lastInterval
Definition: Types.h:65
bool checkForCompatibility(std::stringstream &input, std::stringstream &output, std::string &label)
std::string payloadClass
Definition: Types.h:90
cond::LogDBEntry_t const & logDBEntry() const
std::string destinationDB
Definition: Types.h:83
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::string usertext
Definition: Types.h:85
long double T
cond::TagInfo_t const & tagInfo() const
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_t::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::ValidityInterval lastInterval
Definition: Types.h:65
void getValue(SiStripFedCabling *&val)
long double T
tuple size
Write out results.
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