CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
ContainerIterator
Range
 
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

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

Definition at line 55 of file HDQMSummary.h.

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

Definition at line 59 of file HDQMSummary.h.

Definition at line 56 of file HDQMSummary.h.

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

Definition at line 57 of file HDQMSummary.h.

typedef Registry::const_iterator HDQMSummary::RegistryIterator

Definition at line 58 of file HDQMSummary.h.

Constructor & Destructor Documentation

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::HDQMSummary ( const HDQMSummary input)

Definition at line 12 of file HDQMSummary.cc.

References getRunNr(), getTimeValue(), getUserDBContent(), indexes_, runNr_, timeValue_, userDBContent_, and v_sum_.

12  {
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 }
unsigned long long getTimeValue() const
Definition: HDQMSummary.h:106
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
unsigned long long timeValue_
Definition: HDQMSummary.h:121
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
int getRunNr() const
Definition: HDQMSummary.h:108
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
std::vector< std::string > getUserDBContent() const
Definition: HDQMSummary.h:107
HDQMSummary::HDQMSummary ( )
inline

Definition at line 63 of file HDQMSummary.h.

63 {};
HDQMSummary::~HDQMSummary ( )
inline

Definition at line 64 of file HDQMSummary.h.

64 {};

Member Function Documentation

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
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
std::vector< uint32_t > HDQMSummary::getDetIds ( ) const

Definition at line 62 of file HDQMSummary.cc.

References SplitLinear::begin, dataset::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
string end
Definition: dataset.py:937
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
const HDQMSummary::Range HDQMSummary::getRange ( const uint32_t &  detID) const

Definition at line 53 of file HDQMSummary.cc.

References gather_cfg::cout, indexes_, cuda_std::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
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
tuple cout
Definition: gather_cfg.py:144
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
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
int HDQMSummary::getRunNr ( ) const
inline

Definition at line 108 of file HDQMSummary.h.

References runNr_.

Referenced by HDQMSummary().

108 { return runNr_; }
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 sistrip::SpyUtilities::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 uint16_t range(const Frame &aFrame)
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
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 sistrip::SpyUtilities::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 uint16_t range(const Frame &aFrame)
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
std::vector< uint32_t > getDetIds() const
Definition: HDQMSummary.cc:62
std::vector< float > HDQMSummary::getSummaryObj ( uint32_t &  detID) const

Definition at line 126 of file HDQMSummary.cc.

References getRange(), mps_fire::i, sistrip::SpyUtilities::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 uint16_t range(const Frame &aFrame)
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
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
unsigned long long HDQMSummary::getTimeValue ( ) const
inline

Definition at line 106 of file HDQMSummary.h.

References timeValue_.

Referenced by HDQMSummary().

106 { return timeValue_; }
unsigned long long timeValue_
Definition: HDQMSummary.h:121
std::vector<std::string> HDQMSummary::getUserDBContent ( ) const
inline

Definition at line 107 of file HDQMSummary.h.

References userDBContent_.

Referenced by HDQMSummary().

107 { return userDBContent_; }
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
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
tuple cout
Definition: gather_cfg.py:144
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_, cuda_std::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
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
tmp
align.sh
Definition: createJobs.py:716
template<class Archive >
void HDQMSummary::serialize ( Archive &  ar,
const unsigned int  version 
)
private
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_, cuda_std::lower_bound(), AlCaHLTBitMon_ParallelJobs::p, sistrip::SpyUtilities::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
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
const uint16_t range(const Frame &aFrame)
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
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
void HDQMSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 103 of file HDQMSummary.h.

References runNr_.

103 { runNr_ = inputRunNr; }
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
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

friend class boost::serialization::access
friend

Definition at line 127 of file HDQMSummary.h.

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

Definition at line 127 of file HDQMSummary.h.

Member Data Documentation

std::vector<DetRegistry> HDQMSummary::indexes_
int HDQMSummary::runNr_

Definition at line 120 of file HDQMSummary.h.

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

unsigned long long HDQMSummary::timeValue_

Definition at line 121 of file HDQMSummary.h.

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

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