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 () 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 (uint32_t &detID, const std::vector< std::string > &list) 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 ()
 
 SiStripSummary (const SiStripSummary &input)
 
 SiStripSummary (std::vector< std::string > &userDBContent)
 
 ~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.

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

References runNr_, timeValue_, and userDBContent_.

◆ SiStripSummary() [2/3]

SiStripSummary::SiStripSummary ( const SiStripSummary input)

Definition at line 12 of file SiStripSummary.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_.

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

93 { return v_sum_.begin(); }

References v_sum_.

◆ getDataVectorEnd()

ContainerIterator SiStripSummary::getDataVectorEnd ( ) const
inline

Definition at line 94 of file SiStripSummary.h.

94 { return v_sum_.end(); }

References v_sum_.

◆ getDetIds()

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

Definition at line 70 of file SiStripSummary.cc.

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 }

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

Referenced by getSummaryObj().

◆ getPosition()

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

Definition at line 81 of file SiStripSummary.cc.

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 }

References spr::find(), and userDBContent_.

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

◆ getRange()

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

Definition at line 61 of file SiStripSummary.cc.

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 }

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

Referenced by getSummaryObj(), and setObj().

◆ getRegistryVectorBegin()

RegistryIterator SiStripSummary::getRegistryVectorBegin ( ) const
inline

Definition at line 95 of file SiStripSummary.h.

95 { return indexes_.begin(); }

References indexes_.

◆ getRegistryVectorEnd()

RegistryIterator SiStripSummary::getRegistryVectorEnd ( ) const
inline

Definition at line 96 of file SiStripSummary.h.

96 { return indexes_.end(); }

References indexes_.

◆ getRunNr()

int SiStripSummary::getRunNr ( ) const
inline

Definition at line 137 of file SiStripSummary.h.

137 { return runNr_; }

References runNr_.

◆ getSummaryObj() [1/5]

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

Definition at line 152 of file SiStripSummary.cc.

152 { return v_sum_; }

References v_sum_.

Referenced by getSummaryObj().

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

134  {
135  uint32_t fakeDet = region;
136  return getSummaryObj(fakeDet, list);
137 }

References getSummaryObj(), and HLT_FULL_cff::region.

◆ getSummaryObj() [3/5]

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

Definition at line 154 of file SiStripSummary.cc.

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 }

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

◆ getSummaryObj() [4/5]

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

Definition at line 139 of file SiStripSummary.cc.

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 }

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

◆ getSummaryObj() [5/5]

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

Definition at line 113 of file SiStripSummary.cc.

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 }

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

◆ getTimeValue()

unsigned long long SiStripSummary::getTimeValue ( ) const
inline

Definition at line 135 of file SiStripSummary.h.

135 { return timeValue_; }

References timeValue_.

◆ getUserDBContent()

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

Definition at line 136 of file SiStripSummary.h.

136 { return userDBContent_; }

References userDBContent_.

◆ print()

void SiStripSummary::print ( void  )

Definition at line 173 of file SiStripSummary.cc.

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

References gather_cfg::cout, indexes_, runNr_, and 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.

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 }

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().

◆ put() [2/2]

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

Definition at line 54 of file SiStripSummary.cc.

56  {
57  uint32_t fakeDet = region;
58  return put(fakeDet, input, userContent);
59 }

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

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

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 }

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

◆ setRunNr()

void SiStripSummary::setRunNr ( int  inputRunNr)
inline

Definition at line 132 of file SiStripSummary.h.

132 { runNr_ = inputRunNr; }

References runNr_.

◆ setTimeValue()

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

Definition at line 133 of file SiStripSummary.h.

133 { timeValue_ = inputTimeValue; }

References timeValue_.

◆ setUserDBContent()

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

Definition at line 131 of file SiStripSummary.h.

131 { userDBContent_ = userDBContent; }

References 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_
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
SiStripSummary::StrictWeakOrdering
Definition: SiStripSummary.h:75
SiStripSummary::getPosition
const short getPosition(std::string elementName) const
Definition: SiStripSummary.cc:81
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
SiStripSummary::v_sum_
std::vector< float > v_sum_
Definition: SiStripSummary.h:146
SiStripSummary::runNr_
int runNr_
Definition: SiStripSummary.h:149
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
SiStripSummary::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiStripSummary.cc:61
DetId
Definition: DetId.h:17
SiStripSummary::getDetIds
std::vector< uint32_t > getDetIds() const
Definition: SiStripSummary.cc:70
mps_fire.end
end
Definition: mps_fire.py:242
SiStripSummary::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripSummary.h:83
SiStripSummary::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiStripSummary.h:85
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripSummary::InputVector
std::vector< float > InputVector
Definition: SiStripSummary.h:86
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
SiStripSummary::userDBContent_
std::vector< std::string > userDBContent_
Definition: SiStripSummary.h:145
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
SiStripSummary::getSummaryObj
std::vector< float > getSummaryObj() const
Definition: SiStripSummary.cc:152
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
SiStripSummary::put
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
Definition: SiStripSummary.cc:22
SiStripSummary::indexes_
std::vector< DetRegistry > indexes_
Definition: SiStripSummary.h:147
SiStripSummary::timeValue_
unsigned long long timeValue_
Definition: SiStripSummary.h:150