CMS 3D CMS Logo

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

#include <SiStripSummary.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 (sistripsummary::TrackerRegion region, 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
 
void print ()
 
bool put (const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
 
bool put (sistripsummary::TrackerRegion region, 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)
 
 SiStripSummary (std::vector< std::string > &userDBContent)
 
 SiStripSummary (const SiStripSummary &input)
 
 SiStripSummary ()
 
 ~SiStripSummary ()
 

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 66 of file SiStripSummary.h.

Member Typedef Documentation

◆ ContainerIterator

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

Definition at line 82 of file SiStripSummary.h.

◆ InputVector

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

Definition at line 86 of file SiStripSummary.h.

◆ Range

Definition at line 83 of file SiStripSummary.h.

◆ Registry

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

Definition at line 84 of file SiStripSummary.h.

◆ RegistryIterator

typedef Registry::const_iterator SiStripSummary::RegistryIterator

Definition at line 85 of file SiStripSummary.h.

Constructor & Destructor Documentation

◆ SiStripSummary() [1/3]

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

Definition at line 6 of file SiStripSummary.cc.

References runNr_, timeValue_, and userDBContent_.

6  {
7  userDBContent_ = userDBContent;
8  runNr_ = 0;
9  timeValue_ = 0;
10 }
unsigned long long timeValue_
std::vector< std::string > userDBContent_

◆ SiStripSummary() [2/3]

SiStripSummary::SiStripSummary ( const SiStripSummary input)

Definition at line 12 of file SiStripSummary.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< DetRegistry > indexes_
static std::string const input
Definition: EdmProvDump.cc:50
std::vector< float > v_sum_
unsigned long long timeValue_
std::vector< std::string > userDBContent_

◆ SiStripSummary() [3/3]

SiStripSummary::SiStripSummary ( )
inline

Definition at line 90 of file SiStripSummary.h.

90 {};

◆ ~SiStripSummary()

SiStripSummary::~SiStripSummary ( )
inline

Definition at line 91 of file SiStripSummary.h.

91 {};

Member Function Documentation

◆ getDataVectorBegin()

ContainerIterator SiStripSummary::getDataVectorBegin ( ) const
inline

Definition at line 93 of file SiStripSummary.h.

References v_sum_.

93 { return v_sum_.begin(); }
std::vector< float > v_sum_

◆ getDataVectorEnd()

ContainerIterator SiStripSummary::getDataVectorEnd ( ) const
inline

Definition at line 94 of file SiStripSummary.h.

References v_sum_.

94 { return v_sum_.end(); }
std::vector< float > v_sum_

◆ getDetIds()

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

Definition at line 70 of file SiStripSummary.cc.

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

Referenced by getSummaryObj().

70  {
71  // returns vector of DetIds in map
72  std::vector<uint32_t> DetIds_;
75  for (SiStripSummary::RegistryIterator p = begin; p != end; ++p) {
76  DetIds_.push_back(p->detid);
77  }
78  return DetIds_;
79 }
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator

◆ getPosition()

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

Definition at line 81 of file SiStripSummary.cc.

References spr::find(), and userDBContent_.

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

81  {
82  // returns position of elementName in UserDBContent_
83 
84  std::vector<std::string>::const_iterator it = find(userDBContent_.begin(), userDBContent_.end(), elementName);
85  short pos = -1;
86  if (it != userDBContent_.end())
87  pos = it - userDBContent_.begin();
88  else
89  edm::LogError("SiStripSummary") << "attempting to retrieve non existing historic DB object : " << elementName
90  << std::endl;
91  return pos;
92 }
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_

◆ getRange()

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

Definition at line 61 of file SiStripSummary.cc.

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

Referenced by getSummaryObj(), and setObj().

61  {
63  if (p == indexes_.end() || p->detid != DetId) {
64  return SiStripSummary::Range(v_sum_.end(), v_sum_.end());
65  std::cout << "not in range " << std::endl;
66  } else
67  return SiStripSummary::Range(v_sum_.begin() + p->ibegin, v_sum_.begin() + p->ibegin + userDBContent_.size());
68 }
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > v_sum_
Definition: DetId.h:17
std::vector< std::string > userDBContent_

◆ getRegistryVectorBegin()

RegistryIterator SiStripSummary::getRegistryVectorBegin ( ) const
inline

Definition at line 95 of file SiStripSummary.h.

References indexes_.

95 { return indexes_.begin(); }
std::vector< DetRegistry > indexes_

◆ getRegistryVectorEnd()

RegistryIterator SiStripSummary::getRegistryVectorEnd ( ) const
inline

Definition at line 96 of file SiStripSummary.h.

References indexes_.

96 { return indexes_.end(); }
std::vector< DetRegistry > indexes_

◆ getRunNr()

int SiStripSummary::getRunNr ( ) const
inline

Definition at line 137 of file SiStripSummary.h.

References runNr_.

137 { return runNr_; }

◆ getSummaryObj() [1/5]

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

Definition at line 113 of file SiStripSummary.cc.

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

113  {
114  std::vector<float> SummaryObj;
115  const SiStripSummary::Range range = getRange(detID);
116  if (range.first != range.second) {
117  for (unsigned int i = 0; i < list.size(); i++) {
118  const short pos = getPosition(list.at(i));
119 
120  if (pos != -1)
121  SummaryObj.push_back(*((range.first) + pos));
122  else
123  SummaryObj.push_back(-999.);
124  }
125  } else
126  for (unsigned int i = 0; i < list.size(); i++)
127  SummaryObj.push_back(
128  -99.); // no summary obj has ever been inserted for this detid, most likely all related histos were not available in DQM
129 
130  return SummaryObj;
131 }
std::pair< ContainerIterator, ContainerIterator > Range
const short getPosition(std::string elementName) const
const Range getRange(const uint32_t &detID) const

◆ getSummaryObj() [2/5]

std::vector< float > SiStripSummary::getSummaryObj ( sistripsummary::TrackerRegion  region,
const std::vector< std::string > &  list 
) const

Definition at line 133 of file SiStripSummary.cc.

References getSummaryObj(), and nano_mu_digi_cff::region.

134  {
135  uint32_t fakeDet = region;
136  return getSummaryObj(fakeDet, list);
137 }
std::vector< float > getSummaryObj() const

◆ getSummaryObj() [3/5]

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

Definition at line 154 of file SiStripSummary.cc.

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

154  {
155  std::vector<float> vSumElement;
156  std::vector<uint32_t> DetIds_ = getDetIds();
157  const short pos = getPosition(elementName);
158 
159  if (pos != -1) {
160  for (unsigned int i = 0; i < DetIds_.size(); i++) {
161  const SiStripSummary::Range range = getRange(DetIds_.at(i));
162  if (range.first != range.second) {
163  vSumElement.push_back(*((range.first) + pos));
164  } else {
165  vSumElement.push_back(-99.);
166  }
167  }
168  }
169 
170  return vSumElement;
171 }
std::pair< ContainerIterator, ContainerIterator > Range
const short getPosition(std::string elementName) const
const Range getRange(const uint32_t &detID) const
std::vector< uint32_t > getDetIds() const

◆ getSummaryObj() [4/5]

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

Definition at line 139 of file SiStripSummary.cc.

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

139  {
140  std::vector<float> SummaryObj;
141  const SiStripSummary::Range range = getRange(detID);
142  if (range.first != range.second) {
143  for (unsigned int i = 0; i < userDBContent_.size(); i++)
144  SummaryObj.push_back(*((range.first) + i));
145  } else {
146  for (unsigned int i = 0; i < userDBContent_.size(); i++)
147  SummaryObj.push_back(-99.);
148  }
149  return SummaryObj;
150 }
std::pair< ContainerIterator, ContainerIterator > Range
const Range getRange(const uint32_t &detID) const
std::vector< std::string > userDBContent_

◆ getSummaryObj() [5/5]

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

Definition at line 152 of file SiStripSummary.cc.

References v_sum_.

Referenced by getSummaryObj().

152 { return v_sum_; }
std::vector< float > v_sum_

◆ getTimeValue()

unsigned long long SiStripSummary::getTimeValue ( ) const
inline

Definition at line 135 of file SiStripSummary.h.

References timeValue_.

135 { return timeValue_; }
unsigned long long timeValue_

◆ getUserDBContent()

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

Definition at line 136 of file SiStripSummary.h.

References userDBContent_.

136 { return userDBContent_; }
std::vector< std::string > userDBContent_

◆ print()

void SiStripSummary::print ( void  )

Definition at line 173 of file SiStripSummary.cc.

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

173  {
174  std::cout << "Nr. of detector elements in SiStripSummary object is " << indexes_.size() << " RunNr= " << runNr_
175  << " timeValue= " << timeValue_ << std::endl;
176 }
std::vector< DetRegistry > indexes_
unsigned long long timeValue_

◆ put() [1/2]

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

Definition at line 22 of file SiStripSummary.cc.

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

Referenced by put().

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

◆ put() [2/2]

bool SiStripSummary::put ( sistripsummary::TrackerRegion  region,
InputVector input,
std::vector< std::string > &  userContent 
)

Definition at line 54 of file SiStripSummary.cc.

References input, put(), and nano_mu_digi_cff::region.

56  {
57  uint32_t fakeDet = region;
58  return put(fakeDet, input, userContent);
59 }
static std::string const input
Definition: EdmProvDump.cc:50
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)

◆ serialize()

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

◆ setObj()

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

Definition at line 94 of file SiStripSummary.cc.

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

94  {
95  // modifies value of info "elementName" for the given detID
96  // requires that an entry has be defined beforehand for detId in DB
98  if (p == indexes_.end() || p->detid != detID) {
99  throw cms::Exception("") << "not allowed to modify " << elementName
100  << " in historic DB - SummaryObj needs to be available first !";
101  }
102 
103  const SiStripSummary::Range range = getRange(detID);
104 
105  std::vector<float>::const_iterator it = range.first + getPosition(elementName);
106  std::vector<float>::difference_type pos = -1;
107  if (it != v_sum_.end()) {
108  pos = it - v_sum_.begin();
109  v_sum_.at(pos) = value;
110  }
111 }
std::vector< DetRegistry > indexes_
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > v_sum_
const short getPosition(std::string elementName) const
const Range getRange(const uint32_t &detID) const

◆ setRunNr()

void SiStripSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 132 of file SiStripSummary.h.

References runNr_.

132 { runNr_ = inputRunNr; }

◆ setTimeValue()

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

Definition at line 133 of file SiStripSummary.h.

References timeValue_.

133 { timeValue_ = inputTimeValue; }
unsigned long long timeValue_

◆ setUserDBContent()

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

Definition at line 131 of file SiStripSummary.h.

References userDBContent_.

131 { userDBContent_ = userDBContent; }
std::vector< std::string > userDBContent_

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 156 of file SiStripSummary.h.

◆ cond::serialization::access

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

Definition at line 156 of file SiStripSummary.h.

Member Data Documentation

◆ indexes_

std::vector<DetRegistry> SiStripSummary::indexes_

◆ runNr_

int SiStripSummary::runNr_

Definition at line 149 of file SiStripSummary.h.

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

◆ timeValue_

unsigned long long SiStripSummary::timeValue_

Definition at line 150 of file SiStripSummary.h.

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

◆ userDBContent_

std::vector<std::string> SiStripSummary::userDBContent_

◆ v_sum_

std::vector<float> SiStripSummary::v_sum_