CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Friends
HDQMSummary Class Reference

#include <HDQMSummary.h>

Classes

struct  DetRegistry
 
class  StrictWeakOrdering
 

Public Types

typedef std::vector< float >::const_iterator ContainerIterator
 
typedef std::vector< float > InputVector
 
typedef std::pair< ContainerIterator, ContainerIteratorRange
 
typedef std::vector< DetRegistryRegistry
 
typedef Registry::const_iterator RegistryIterator
 

Public Member Functions

ContainerIterator getDataVectorBegin () const
 
ContainerIterator getDataVectorEnd () const
 
std::vector< uint32_t > getDetIds () const
 
const Range getRange (const uint32_t &detID) const
 
RegistryIterator getRegistryVectorBegin () const
 
RegistryIterator getRegistryVectorEnd () const
 
int getRunNr () const
 
std::vector< float > getSummaryObj (uint32_t &detID, const std::vector< std::string > &list) const
 
std::vector< float > getSummaryObj (std::string elementName) const
 
std::vector< float > getSummaryObj (uint32_t &detID) const
 
std::vector< float > getSummaryObj () const
 
unsigned long long getTimeValue () const
 
std::vector< std::string > getUserDBContent () const
 
 HDQMSummary (std::vector< std::string > &userDBContent)
 
 HDQMSummary (const HDQMSummary &input)
 
 HDQMSummary ()
 
void print ()
 
bool put (const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
 
void setObj (const uint32_t &detID, std::string elementName, float value)
 
void setRunNr (int inputRunNr)
 
void setTimeValue (unsigned long long inputTimeValue)
 
void setUserDBContent (const std::vector< std::string > &userDBContent)
 
 ~HDQMSummary ()
 

Public Attributes

std::vector< DetRegistryindexes_
 
int runNr_
 
unsigned long long timeValue_
 
std::vector< std::string > userDBContent_
 
std::vector< float > v_sum_
 

Protected Member Functions

const short getPosition (std::string elementName) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Author
D. Giordano, A.-C. Le Bihan

Definition at line 39 of file HDQMSummary.h.

Member Typedef Documentation

◆ ContainerIterator

typedef std::vector<float>::const_iterator HDQMSummary::ContainerIterator

Definition at line 55 of file HDQMSummary.h.

◆ InputVector

typedef std::vector<float> HDQMSummary::InputVector

Definition at line 59 of file HDQMSummary.h.

◆ Range

Definition at line 56 of file HDQMSummary.h.

◆ Registry

typedef std::vector<DetRegistry> HDQMSummary::Registry

Definition at line 57 of file HDQMSummary.h.

◆ RegistryIterator

typedef Registry::const_iterator HDQMSummary::RegistryIterator

Definition at line 58 of file HDQMSummary.h.

Constructor & Destructor Documentation

◆ HDQMSummary() [1/3]

HDQMSummary::HDQMSummary ( std::vector< std::string > &  userDBContent)

Definition at line 6 of file HDQMSummary.cc.

References runNr_, timeValue_, and userDBContent_.

6  {
7  userDBContent_ = userDBContent;
8  runNr_ = 0;
9  timeValue_ = 0;
10 }
unsigned long long timeValue_
Definition: HDQMSummary.h:121
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

◆ HDQMSummary() [2/3]

HDQMSummary::HDQMSummary ( const HDQMSummary input)

Definition at line 12 of file HDQMSummary.cc.

References indexes_, input, runNr_, timeValue_, userDBContent_, and v_sum_.

12  {
13  userDBContent_ = input.getUserDBContent();
14  runNr_ = input.getTimeValue();
15  timeValue_ = input.getRunNr();
16  v_sum_.clear();
17  indexes_.clear();
18  v_sum_.insert(v_sum_.end(), input.v_sum_.begin(), input.v_sum_.end());
19  indexes_.insert(indexes_.end(), input.indexes_.begin(), input.indexes_.end());
20 }
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
static std::string const input
Definition: EdmProvDump.cc:47
unsigned long long timeValue_
Definition: HDQMSummary.h:121
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

◆ HDQMSummary() [3/3]

HDQMSummary::HDQMSummary ( )
inline

Definition at line 63 of file HDQMSummary.h.

63 {};

◆ ~HDQMSummary()

HDQMSummary::~HDQMSummary ( )
inline

Definition at line 64 of file HDQMSummary.h.

64 {};

Member Function Documentation

◆ getDataVectorBegin()

ContainerIterator HDQMSummary::getDataVectorBegin ( ) const
inline

Definition at line 66 of file HDQMSummary.h.

References v_sum_.

66 { return v_sum_.begin(); }
std::vector< float > v_sum_
Definition: HDQMSummary.h:117

◆ getDataVectorEnd()

ContainerIterator HDQMSummary::getDataVectorEnd ( ) const
inline

Definition at line 67 of file HDQMSummary.h.

References v_sum_.

67 { return v_sum_.end(); }
std::vector< float > v_sum_
Definition: HDQMSummary.h:117

◆ getDetIds()

std::vector< uint32_t > HDQMSummary::getDetIds ( ) const

Definition at line 62 of file HDQMSummary.cc.

References mps_fire::end, indexes_, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by getSummaryObj().

62  {
63  // returns vector of DetIds in map
64  std::vector<uint32_t> DetIds_;
67  for (HDQMSummary::RegistryIterator p = begin; p != end; ++p) {
68  DetIds_.push_back(p->detid);
69  }
70  return DetIds_;
71 }
Registry::const_iterator RegistryIterator
Definition: HDQMSummary.h:58
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118

◆ getPosition()

const short HDQMSummary::getPosition ( std::string  elementName) const
protected

Definition at line 73 of file HDQMSummary.cc.

References spr::find(), and userDBContent_.

Referenced by getSummaryObj(), put(), and setObj().

73  {
74  // returns position of elementName in UserDBContent_
75 
76  std::vector<std::string>::const_iterator it = find(userDBContent_.begin(), userDBContent_.end(), elementName);
77  short pos = -1;
78  if (it != userDBContent_.end())
79  pos = it - userDBContent_.begin();
80  else
81  edm::LogError("HDQMSummary") << "attempting to retrieve non existing historic DB object : " << elementName
82  << std::endl;
83  return pos;
84 }
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

◆ getRange()

const HDQMSummary::Range HDQMSummary::getRange ( const uint32_t &  detID) const

Definition at line 53 of file HDQMSummary.cc.

References gather_cfg::cout, indexes_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, userDBContent_, and v_sum_.

Referenced by getSummaryObj(), and setObj().

53  {
55  if (p == indexes_.end() || p->detid != DetId) {
56  return HDQMSummary::Range(v_sum_.end(), v_sum_.end());
57  std::cout << "not in range " << std::endl;
58  } else
59  return HDQMSummary::Range(v_sum_.begin() + p->ibegin, v_sum_.begin() + p->ibegin + userDBContent_.size());
60 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
Registry::const_iterator RegistryIterator
Definition: HDQMSummary.h:58
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
Definition: DetId.h:17

◆ getRegistryVectorBegin()

RegistryIterator HDQMSummary::getRegistryVectorBegin ( ) const
inline

Definition at line 68 of file HDQMSummary.h.

References indexes_.

68 { return indexes_.begin(); }
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118

◆ getRegistryVectorEnd()

RegistryIterator HDQMSummary::getRegistryVectorEnd ( ) const
inline

Definition at line 69 of file HDQMSummary.h.

References indexes_.

69 { return indexes_.end(); }
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118

◆ getRunNr()

int HDQMSummary::getRunNr ( ) const
inline

Definition at line 108 of file HDQMSummary.h.

References runNr_.

108 { return runNr_; }

◆ getSummaryObj() [1/4]

std::vector< float > HDQMSummary::getSummaryObj ( uint32_t &  detID,
const std::vector< std::string > &  list 
) const

Definition at line 105 of file HDQMSummary.cc.

References getPosition(), getRange(), mps_fire::i, and FastTimerService_cff::range.

105  {
106  std::vector<std::string> list = _list;
107  std::vector<float> SummaryObj;
108  const HDQMSummary::Range range = getRange(detID);
109  if (range.first != range.second) {
110  for (unsigned int i = 0; i < list.size(); i++) {
111  const short pos = getPosition(list.at(i));
112 
113  if (pos != -1)
114  SummaryObj.push_back(*((range.first) + pos));
115  else
116  SummaryObj.push_back(-999.);
117  }
118  } else
119  for (unsigned int i = 0; i < list.size(); i++)
120  SummaryObj.push_back(
121  -99.); // no summary obj has ever been inserted for this detid, most likely all related histos were not available in DQM
122 
123  return SummaryObj;
124 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73

◆ getSummaryObj() [2/4]

std::vector< float > HDQMSummary::getSummaryObj ( std::string  elementName) const

Definition at line 141 of file HDQMSummary.cc.

References getDetIds(), getPosition(), getRange(), mps_fire::i, and FastTimerService_cff::range.

141  {
142  std::vector<float> vSumElement;
143  std::vector<uint32_t> DetIds_ = getDetIds();
144  const short pos = getPosition(elementName);
145 
146  if (pos != -1) {
147  for (unsigned int i = 0; i < DetIds_.size(); i++) {
148  const HDQMSummary::Range range = getRange(DetIds_.at(i));
149  if (range.first != range.second) {
150  vSumElement.push_back(*((range.first) + pos));
151  } else {
152  vSumElement.push_back(-99.);
153  }
154  }
155  }
156 
157  return vSumElement;
158 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
std::vector< uint32_t > getDetIds() const
Definition: HDQMSummary.cc:62
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73

◆ getSummaryObj() [3/4]

std::vector< float > HDQMSummary::getSummaryObj ( uint32_t &  detID) const

Definition at line 126 of file HDQMSummary.cc.

References getRange(), mps_fire::i, FastTimerService_cff::range, and userDBContent_.

126  {
127  std::vector<float> SummaryObj;
128  const HDQMSummary::Range range = getRange(detID);
129  if (range.first != range.second) {
130  for (unsigned int i = 0; i < userDBContent_.size(); i++)
131  SummaryObj.push_back(*((range.first) + i));
132  } else {
133  for (unsigned int i = 0; i < userDBContent_.size(); i++)
134  SummaryObj.push_back(-99.);
135  }
136  return SummaryObj;
137 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

◆ getSummaryObj() [4/4]

std::vector< float > HDQMSummary::getSummaryObj ( ) const

Definition at line 139 of file HDQMSummary.cc.

References v_sum_.

139 { return v_sum_; }
std::vector< float > v_sum_
Definition: HDQMSummary.h:117

◆ getTimeValue()

unsigned long long HDQMSummary::getTimeValue ( ) const
inline

Definition at line 106 of file HDQMSummary.h.

References timeValue_.

106 { return timeValue_; }
unsigned long long timeValue_
Definition: HDQMSummary.h:121

◆ getUserDBContent()

std::vector<std::string> HDQMSummary::getUserDBContent ( ) const
inline

Definition at line 107 of file HDQMSummary.h.

References userDBContent_.

107 { return userDBContent_; }
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

◆ print()

void HDQMSummary::print ( void  )

Definition at line 160 of file HDQMSummary.cc.

References gather_cfg::cout, indexes_, runNr_, and timeValue_.

160  {
161  std::cout << "Nr. of detector elements in HDQMSummary object is " << indexes_.size() << " RunNr= " << runNr_
162  << " timeValue= " << timeValue_ << std::endl;
163 }
unsigned long long timeValue_
Definition: HDQMSummary.h:121
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118

◆ put()

bool HDQMSummary::put ( const uint32_t &  detID,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 22 of file HDQMSummary.cc.

References HDQMSummary::DetRegistry::detid, getPosition(), mps_fire::i, HDQMSummary::DetRegistry::ibegin, indexes_, input, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, createJobs::tmp, userDBContent_, and v_sum_.

22  {
23  Registry::iterator p = std::lower_bound(indexes_.begin(), indexes_.end(), DetId, HDQMSummary::StrictWeakOrdering());
24 
25  if (p == indexes_.end() || p->detid != DetId) {
26  //First request for the given DetID
27  //Create entries for all the declared userDBContent
28  //and fill for the provided userContent
29 
30  DetRegistry detregistry;
31  detregistry.detid = DetId;
32  detregistry.ibegin = v_sum_.size();
33  indexes_.insert(p, detregistry);
34  InputVector tmp(userDBContent_.size(), -9999);
35 
36  for (size_t i = 0; i < userContent.size(); ++i)
37  tmp[getPosition(userContent[i])] = input[i];
38 
39  v_sum_.insert(v_sum_.end(), tmp.begin(), tmp.end());
40  } else {
41  if (p->detid == DetId) {
42  //I should already find the entries
43  //fill for the provided userContent
44 
45  for (size_t i = 0; i < userContent.size(); ++i)
46  v_sum_[p->ibegin + getPosition(userContent[i])] = input[i];
47  }
48  }
49 
50  return true;
51 }
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
static std::string const input
Definition: EdmProvDump.cc:47
std::vector< float > InputVector
Definition: HDQMSummary.h:59
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
Definition: DetId.h:17
tmp
align.sh
Definition: createJobs.py:716
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73

◆ serialize()

template<class Archive >
void HDQMSummary::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setObj()

void HDQMSummary::setObj ( const uint32_t &  detID,
std::string  elementName,
float  value 
)

Definition at line 86 of file HDQMSummary.cc.

References Exception, getPosition(), getRange(), indexes_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, FastTimerService_cff::range, v_sum_, and relativeConstraints::value.

86  {
87  // modifies value of info "elementName" for the given detID
88  // requires that an entry has be defined beforehand for detId in DB
90  if (p == indexes_.end() || p->detid != detID) {
91  throw cms::Exception("") << "not allowed to modify " << elementName
92  << " in historic DB - SummaryObj needs to be available first !";
93  }
94 
95  const HDQMSummary::Range range = getRange(detID);
96 
97  std::vector<float>::const_iterator it = range.first + getPosition(elementName);
98  std::vector<float>::difference_type pos = -1;
99  if (it != v_sum_.end()) {
100  pos = it - v_sum_.begin();
101  v_sum_.at(pos) = value;
102  }
103 }
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
Registry::const_iterator RegistryIterator
Definition: HDQMSummary.h:58
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73

◆ setRunNr()

void HDQMSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 103 of file HDQMSummary.h.

References runNr_.

103 { runNr_ = inputRunNr; }

◆ setTimeValue()

void HDQMSummary::setTimeValue ( unsigned long long  inputTimeValue)
inline

Definition at line 104 of file HDQMSummary.h.

References timeValue_.

104 { timeValue_ = inputTimeValue; }
unsigned long long timeValue_
Definition: HDQMSummary.h:121

◆ setUserDBContent()

void HDQMSummary::setUserDBContent ( const std::vector< std::string > &  userDBContent)
inline

Definition at line 102 of file HDQMSummary.h.

References userDBContent_.

102 { userDBContent_ = userDBContent; }
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 127 of file HDQMSummary.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 127 of file HDQMSummary.h.

Member Data Documentation

◆ indexes_

std::vector<DetRegistry> HDQMSummary::indexes_

◆ runNr_

int HDQMSummary::runNr_

Definition at line 120 of file HDQMSummary.h.

Referenced by getRunNr(), HDQMSummary(), print(), and setRunNr().

◆ timeValue_

unsigned long long HDQMSummary::timeValue_

Definition at line 121 of file HDQMSummary.h.

Referenced by getTimeValue(), HDQMSummary(), print(), and setTimeValue().

◆ userDBContent_

std::vector<std::string> HDQMSummary::userDBContent_

◆ v_sum_

std::vector<float> HDQMSummary::v_sum_