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().payloadName << "\n"
41  << logDBEntry().payloadToken << "\n"
42  << logDBEntry().payloadContainer << "\n"
43  << logDBEntry().exectime << "\n"
44  << logDBEntry().execmessage << "\n"
45  << "\n\n-- user text " << userText;
46  } else {
47  dbstr << " First object for this tag ";
48  }
49  dbstr << "\n-------------------------\n";
50  edm::LogInfo ("SiStripDetVOffHandler") << dbstr.str();
51 
52  // Do the transfer!
53  std::cout << "getNewObjects setForTransfer" << std::endl;
55  std::cout << "getNewObjects setForTransfer end" << std::endl;
56 }
std::string exectime
Definition: LogDBEntry.h:18
std::string usertext
Definition: LogDBEntry.h:10
std::string iovtimetype
Definition: LogDBEntry.h:12
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
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
tuple cout
Definition: gather_cfg.py:41
std::string iovtag
Definition: LogDBEntry.h:11
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 58 of file SiStripDetVOffHandler.cc.

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

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

Definition at line 109 of file SiStripDetVOffHandler.cc.

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

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

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

Definition at line 30 of file SiStripDetVOffHandler.h.