CMS 3D CMS Logo

SiStripSummary.cc
Go to the documentation of this file.
3 
4 #include <algorithm>
5 
6 SiStripSummary::SiStripSummary(std::vector<std::string>& userDBContent) {
7  userDBContent_ = userDBContent;
8  runNr_ = 0;
9  timeValue_ = 0;
10 }
11 
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 }
21 
22 bool SiStripSummary::put(const uint32_t& DetId, InputVector& input, std::vector<std::string>& userContent) {
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 }
53 
56  std::vector<std::string>& userContent) {
57  uint32_t fakeDet = region;
58  return put(fakeDet, input, userContent);
59 }
60 
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 }
69 
70 std::vector<uint32_t> SiStripSummary::getDetIds() const {
71  // returns vector of DetIds in map
72  std::vector<uint32_t> DetIds_;
76  DetIds_.push_back(p->detid);
77  }
78  return DetIds_;
79 }
80 
81 const short SiStripSummary::getPosition(std::string elementName) const {
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 }
93 
94 void SiStripSummary::setObj(const uint32_t& detID, std::string elementName, float value) {
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 }
112 
113 std::vector<float> SiStripSummary::getSummaryObj(uint32_t& detID, const std::vector<std::string>& list) const {
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 }
132 
134  const std::vector<std::string>& list) const {
135  uint32_t fakeDet = region;
136  return getSummaryObj(fakeDet, list);
137 }
138 
139 std::vector<float> SiStripSummary::getSummaryObj(uint32_t& detID) const {
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 }
151 
152 std::vector<float> SiStripSummary::getSummaryObj() const { return v_sum_; }
153 
154 std::vector<float> SiStripSummary::getSummaryObj(std::string elementName) const {
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 }
172 
174  std::cout << "Nr. of detector elements in SiStripSummary object is " << indexes_.size() << " RunNr= " << runNr_
175  << " timeValue= " << timeValue_ << std::endl;
176 }
SiStripSummary::DetRegistry
Definition: SiStripSummary.h:68
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
SiStripSummary::StrictWeakOrdering
Definition: SiStripSummary.h:75
SiStripSummary::getPosition
const short getPosition(std::string elementName) const
Definition: SiStripSummary.cc:81
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
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
end
#define end
Definition: vmac.h:39
DetId
Definition: DetId.h:17
SiStripSummary::getDetIds
std::vector< uint32_t > getDetIds() const
Definition: SiStripSummary.cc:70
SiStripSummary::SiStripSummary
SiStripSummary()
Definition: SiStripSummary.h:90
sistripsummary::TrackerRegion
TrackerRegion
Definition: SiStripSummary.h:19
SiStripSummary::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripSummary.h:83
SiStripSummary
Definition: SiStripSummary.h:66
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
SiStripSummary::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiStripSummary.h:85
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogError
Definition: MessageLogger.h:183
SiStripSummary::InputVector
std::vector< float > InputVector
Definition: SiStripSummary.h:86
SiStripSummary.h
SiStripSummary::DetRegistry::ibegin
uint32_t ibegin
Definition: SiStripSummary.h:70
value
Definition: value.py:1
SiStripSummary::userDBContent_
std::vector< std::string > userDBContent_
Definition: SiStripSummary.h:145
SiStripSummary::getSummaryObj
std::vector< float > getSummaryObj() const
Definition: SiStripSummary.cc:152
SiStripSummary::print
void print()
Definition: SiStripSummary.cc:173
SiStripSummary::setObj
void setObj(const uint32_t &detID, std::string elementName, float value)
Definition: SiStripSummary.cc:94
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
SiStripSummary::put
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
Definition: SiStripSummary.cc:22
list
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*", "!HLTx*" if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL. It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of "!*" before the partial wildcard feature was incorporated). Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
SiStripSummary::indexes_
std::vector< DetRegistry > indexes_
Definition: SiStripSummary.h:147
SiStripSummary::DetRegistry::detid
uint32_t detid
Definition: SiStripSummary.h:69
begin
#define begin
Definition: vmac.h:32
SiStripSummary::timeValue_
unsigned long long timeValue_
Definition: SiStripSummary.h:150