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::SiStripDetVOffHandler Class Reference

#include <SiStripDetVOffHandler.h>

Inheritance diagram for popcon::SiStripDetVOffHandler:
popcon::PopConSourceHandler< SiStripDetVOff >

Public Member Functions

void getNewObjects ()
 
std::string id () const
 
 SiStripDetVOffHandler (const edm::ParameterSet &pset)
 
 ~SiStripDetVOffHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< SiStripDetVOff >
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

void setForTransfer ()
 
void setUserTextLog ()
 

Private Attributes

bool debug_
 
uint32_t deltaTmin_
 
uint32_t maxIOVlength_
 
edm::Service
< SiStripDetVOffBuilder
modHVBuilder
 
std::string name_
 
std::vector< std::pair
< SiStripDetVOff
*, cond::Time_t > > 
resultVec
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< SiStripDetVOff >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< SiStripDetVOff
*, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< SiStripDetVOff
self
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef SiStripDetVOff value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< SiStripDetVOff >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< SiStripDetVOff >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 18 of file SiStripDetVOffHandler.h.

Constructor & Destructor Documentation

popcon::SiStripDetVOffHandler::~SiStripDetVOffHandler ( )

Definition at line 10 of file SiStripDetVOffHandler.cc.

References LogTrace.

10  {
11  LogTrace("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::" << __func__ << "] Destructing ...";
12 }
#define LogTrace(id)
popcon::SiStripDetVOffHandler::SiStripDetVOffHandler ( const edm::ParameterSet pset)

Definition at line 3 of file SiStripDetVOffHandler.cc.

3  :
4  name_(pset.getUntrackedParameter<std::string>("name","SiStripDetVOffHandler")),
5  deltaTmin_(pset.getParameter<uint32_t>("DeltaTmin")),
6  maxIOVlength_(pset.getParameter<uint32_t>("MaxIOVlength")),
7  debug_(pset.getUntrackedParameter<bool>("Debug", false))
8 { }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const

Member Function Documentation

void popcon::SiStripDetVOffHandler::getNewObjects ( )
virtual

Implements popcon::PopConSourceHandler< SiStripDetVOff >.

Definition at line 14 of file SiStripDetVOffHandler.cc.

References gather_cfg::cout, and findQualityFiles::size.

15 {
16  std::cout << "[SiStripDetVOffHandler::getNewObjects]" << std::endl;
17 
18  std::stringstream dbstr;
19  dbstr << "\n\n---------------------\n " << name_
20  << " - > getNewObjects\n";
21  if (tagInfo().size){
22  //check whats already inside of database
23  std::string userText("No data");
24  size_t splitPoint = logDBEntry().usertext.find_last_of("@");
25  if( splitPoint != std::string::npos ) {
26  userText = logDBEntry().usertext.substr(splitPoint);
27  }
28  dbstr << "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << " " << tagInfo().token
29  << " , last object valid since "
30  << tagInfo().lastInterval.first << " token "
31  << tagInfo().lastPayloadToken << "\n\n UserText " << userTextLog()
32  << "\n LogDBEntry \n"
33  << logDBEntry().logId << "\n"
34  << logDBEntry().destinationDB << "\n"
35  << logDBEntry().provenance << "\n"
36  << logDBEntry().usertext << "\n"
37  << logDBEntry().iovtag << "\n"
38  << logDBEntry().iovtimetype << "\n"
39  << logDBEntry().payloadIdx << "\n"
40  << logDBEntry().payloadClass << "\n"
41  << logDBEntry().payloadToken << "\n"
42  << logDBEntry().exectime << "\n"
43  << logDBEntry().execmessage << "\n"
44  << "\n\n-- user text " << userText;
45  } else {
46  dbstr << " First object for this tag ";
47  }
48  dbstr << "\n-------------------------\n";
49  edm::LogInfo ("SiStripDetVOffHandler") << dbstr.str();
50 
51  // Do the transfer!
52  std::cout << "getNewObjects setForTransfer" << std::endl;
54  std::cout << "getNewObjects setForTransfer end" << std::endl;
55 }
std::string exectime
Definition: LogDBEntry.h:27
std::string usertext
Definition: LogDBEntry.h:20
std::string iovtimetype
Definition: LogDBEntry.h:22
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
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
tuple cout
Definition: gather_cfg.py:121
std::string iovtag
Definition: LogDBEntry.h:21
tuple size
Write out results.
std::string popcon::SiStripDetVOffHandler::id ( void  ) const
inlinevirtual

Implements popcon::PopConSourceHandler< SiStripDetVOff >.

Definition at line 24 of file SiStripDetVOffHandler.h.

References name_.

24 { return name_;}
void popcon::SiStripDetVOffHandler::setForTransfer ( )
private

Definition at line 57 of file SiStripDetVOffHandler.cc.

References gather_cfg::cout, i, and findQualityFiles::size.

57  {
58  edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer]" << std::endl;
59 
60  // retrieve the last object transferred
61  if (tagInfo().size ) {
62  Ref payload = lastPayload();
63  SiStripDetVOff * lastV = new SiStripDetVOff( *payload );
64  modHVBuilder->setLastSiStripDetVOff( lastV, tagInfo().lastInterval.first );
65  }
66 
67  // build the object!
68  resultVec.clear();
71 
72  if (!resultVec.empty()){
73  // assume by default that transfer is needed
74  unsigned int firstPayload = 0;
75 
76  // check if there is an existing payload and retrieve if there is
77  if (tagInfo().size > 0) {
78  Ref payload = lastPayload();
79  // resultVec does not contain duplicates, so only need to compare payload with resultVec[0]
80  SiStripDetVOff * modV = resultVec[0].first;
81  if (*modV == *payload) {
82  edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element not required!";
83  cout << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element not required!" << endl;
84  firstPayload = 1;
85  }
86  else {
87  cout << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element required" << endl;
88  }
89  } else {
90  edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer] No previous payload";
91  cout << "[SiStripDetVOffHandler::setForTransfer] No previous payload" << endl;
92  }
93 
95 
96  for (unsigned int i = firstPayload; i < resultVec.size(); i++) {
97  this->m_to_transfer.push_back(resultVec[i]);
98  }
99 
100  } else {
101  edm::LogError("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::" << __func__ << "] "
102  << name_ << " : NULL pointer reported by SiStripDetVOffBuilder"
103  << "\n Transfer aborted"<< std::endl;
104  }
105 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::pair< SiStripDetVOff *, cond::Time_t > > getModulesVOff(const int deltaTmin=1, const int maxIOVlength=120)
edm::Service< SiStripDetVOffBuilder > modHVBuilder
size_t size
Definition: TagInfo.h:13
std::vector< std::pair< SiStripDetVOff *, cond::Time_t > > resultVec
void setLastSiStripDetVOff(SiStripDetVOff *lastPayload, cond::Time_t lastTimeStamp)
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
void popcon::SiStripDetVOffHandler::setUserTextLog ( )
private

Definition at line 108 of file SiStripDetVOffHandler.cc.

References j, LogTrace, and cond::time::to_boost().

109 {
110  std::stringstream ss;
111  ss << "@@@ Number of payloads transferred " << resultVec.size() << "." << std::endl;
112  std::vector< std::pair<SiStripDetVOff*,cond::Time_t> >::const_iterator it = resultVec.begin();
113  ss << "time \t #LV off \t #HV off" << std::endl;
114  for( ; it != resultVec.end(); ++it ) {
115  ss << boost::posix_time::to_iso_extended_string( cond::time::to_boost(it->second) );
116  ss << "\t\t " << it->first->getLVoffCounts() << "\t\t " << it->first->getHVoffCounts() << std::endl;
117  }
118 
119  if( debug_ ) {
120  ss << "PayloadNo/Badmodules/NoAdded/NoRemoved: ";
121  std::vector< std::vector<uint32_t> > payloadStats = modHVBuilder->getPayloadStats();
122  for (unsigned int j = 0; j < payloadStats.size(); j++) {
123  ss << j << "/" << payloadStats[j][0] << "/" << payloadStats[j][1] << "/" << payloadStats[j][2] << "\t ";
124  }
125  }
126 
127  this->m_userTextLog = ss.str();
128 
129  LogTrace("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setUserTextLog] " << ss.str();
130 
131 
132 }
int j
Definition: DBlmapReader.cc:9
edm::Service< SiStripDetVOffBuilder > modHVBuilder
#define LogTrace(id)
std::vector< std::pair< SiStripDetVOff *, cond::Time_t > > resultVec
std::vector< std::vector< uint32_t > > getPayloadStats()
boost::posix_time::ptime to_boost(Time_t iValue)

Member Data Documentation

bool popcon::SiStripDetVOffHandler::debug_
private

Definition at line 34 of file SiStripDetVOffHandler.h.

uint32_t popcon::SiStripDetVOffHandler::deltaTmin_
private

Definition at line 32 of file SiStripDetVOffHandler.h.

uint32_t popcon::SiStripDetVOffHandler::maxIOVlength_
private

Definition at line 33 of file SiStripDetVOffHandler.h.

edm::Service<SiStripDetVOffBuilder> popcon::SiStripDetVOffHandler::modHVBuilder
private

Definition at line 31 of file SiStripDetVOffHandler.h.

std::string popcon::SiStripDetVOffHandler::name_
private

Definition at line 29 of file SiStripDetVOffHandler.h.

Referenced by id().

std::vector< std::pair<SiStripDetVOff*,cond::Time_t> > popcon::SiStripDetVOffHandler::resultVec
private

Definition at line 30 of file SiStripDetVOffHandler.h.