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 () const
 
std::vector< float > getSummaryObj (std::string elementName) const
 
std::vector< float > getSummaryObj (uint32_t &detID) const
 
std::vector< float > getSummaryObj (uint32_t &detID, const std::vector< std::string > &list) const
 
unsigned long long getTimeValue () const
 
std::vector< std::string > getUserDBContent () const
 
 HDQMSummary ()
 
 HDQMSummary (const HDQMSummary &input)
 
 HDQMSummary (std::vector< std::string > &userDBContent)
 
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.

6  {
7  userDBContent_ = userDBContent;
8  runNr_ = 0;
9  timeValue_ = 0;
10 }

References runNr_, timeValue_, and userDBContent_.

◆ HDQMSummary() [2/3]

HDQMSummary::HDQMSummary ( const HDQMSummary input)

Definition at line 12 of file HDQMSummary.cc.

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 }

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

◆ 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.

66 { return v_sum_.begin(); }

References v_sum_.

◆ getDataVectorEnd()

ContainerIterator HDQMSummary::getDataVectorEnd ( ) const
inline

Definition at line 67 of file HDQMSummary.h.

67 { return v_sum_.end(); }

References v_sum_.

◆ getDetIds()

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

Definition at line 62 of file HDQMSummary.cc.

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 }

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

Referenced by getSummaryObj().

◆ getPosition()

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

Definition at line 73 of file HDQMSummary.cc.

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 }

References spr::find(), and userDBContent_.

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

◆ getRange()

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

Definition at line 53 of file HDQMSummary.cc.

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 }

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

Referenced by getSummaryObj(), and setObj().

◆ getRegistryVectorBegin()

RegistryIterator HDQMSummary::getRegistryVectorBegin ( ) const
inline

Definition at line 68 of file HDQMSummary.h.

68 { return indexes_.begin(); }

References indexes_.

◆ getRegistryVectorEnd()

RegistryIterator HDQMSummary::getRegistryVectorEnd ( ) const
inline

Definition at line 69 of file HDQMSummary.h.

69 { return indexes_.end(); }

References indexes_.

◆ getRunNr()

int HDQMSummary::getRunNr ( ) const
inline

Definition at line 108 of file HDQMSummary.h.

108 { return runNr_; }

References runNr_.

◆ getSummaryObj() [1/4]

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

Definition at line 139 of file HDQMSummary.cc.

139 { return v_sum_; }

References v_sum_.

◆ getSummaryObj() [2/4]

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

Definition at line 141 of file HDQMSummary.cc.

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 }

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

◆ getSummaryObj() [3/4]

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

Definition at line 126 of file HDQMSummary.cc.

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 }

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

◆ getSummaryObj() [4/4]

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

Definition at line 105 of file HDQMSummary.cc.

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 }

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

◆ getTimeValue()

unsigned long long HDQMSummary::getTimeValue ( ) const
inline

Definition at line 106 of file HDQMSummary.h.

106 { return timeValue_; }

References timeValue_.

◆ getUserDBContent()

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

Definition at line 107 of file HDQMSummary.h.

107 { return userDBContent_; }

References userDBContent_.

◆ print()

void HDQMSummary::print ( void  )

Definition at line 160 of file HDQMSummary.cc.

160  {
161  std::cout << "Nr. of detector elements in HDQMSummary object is " << indexes_.size() << " RunNr= " << runNr_
162  << " timeValue= " << timeValue_ << std::endl;
163 }

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

◆ put()

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

Definition at line 22 of file HDQMSummary.cc.

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 }

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

◆ 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.

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 }

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

◆ setRunNr()

void HDQMSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 103 of file HDQMSummary.h.

103 { runNr_ = inputRunNr; }

References runNr_.

◆ setTimeValue()

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

Definition at line 104 of file HDQMSummary.h.

104 { timeValue_ = inputTimeValue; }

References timeValue_.

◆ setUserDBContent()

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

Definition at line 102 of file HDQMSummary.h.

102 { userDBContent_ = userDBContent; }

References userDBContent_.

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_
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
HDQMSummary::StrictWeakOrdering
Definition: HDQMSummary.h:48
HDQMSummary::getRange
const Range getRange(const uint32_t &detID) const
Definition: HDQMSummary.cc:53
HDQMSummary::getPosition
const short getPosition(std::string elementName) const
Definition: HDQMSummary.cc:73
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
HDQMSummary::runNr_
int runNr_
Definition: HDQMSummary.h:120
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
HDQMSummary::InputVector
std::vector< float > InputVector
Definition: HDQMSummary.h:59
DetId
Definition: DetId.h:17
HDQMSummary::v_sum_
std::vector< float > v_sum_
Definition: HDQMSummary.h:117
mps_fire.end
end
Definition: mps_fire.py:242
HDQMSummary::timeValue_
unsigned long long timeValue_
Definition: HDQMSummary.h:121
HDQMSummary::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: HDQMSummary.h:58
HDQMSummary::indexes_
std::vector< DetRegistry > indexes_
Definition: HDQMSummary.h:118
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HDQMSummary::userDBContent_
std::vector< std::string > userDBContent_
Definition: HDQMSummary.h:116
HDQMSummary::getDetIds
std::vector< uint32_t > getDetIds() const
Definition: HDQMSummary.cc:62
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
HDQMSummary::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: HDQMSummary.h:56