CMS 3D CMS Logo

CaloVNoiseSignalGenerator.cc
Go to the documentation of this file.
3 #include <iostream>
4 
5 CaloVNoiseSignalGenerator::CaloVNoiseSignalGenerator() : theNoiseSignals(), theDetIds() {}
6 
7 void CaloVNoiseSignalGenerator::fillEvent(CLHEP::HepRandomEngine *engine) {
8  theDetIds.clear();
9  fillNoiseSignals(engine);
10  fillDetIds();
11 }
12 
14  theDetIds.clear();
16  fillDetIds();
17 }
18 
19 void CaloVNoiseSignalGenerator::setNoiseSignals(const std::vector<CaloSamples> &noiseSignals) {
20  theNoiseSignals = noiseSignals;
21 }
22 
23 bool CaloVNoiseSignalGenerator::contains(const DetId &detId) const {
24  return edm::binary_search_all(theDetIds, detId.rawId());
25 }
26 
28  theDetIds.reserve(theNoiseSignals.size());
29  for (std::vector<CaloSamples>::const_iterator sampleItr = theNoiseSignals.begin(); sampleItr != theNoiseSignals.end();
30  ++sampleItr) {
31  theDetIds.push_back(sampleItr->id().rawId());
32  }
34 }
virtual void fillNoiseSignals()=0
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::vector< CaloSamples > theNoiseSignals
void setNoiseSignals(const std::vector< CaloSamples > &noiseSignals)
bool contains(const DetId &detId) const
Definition: DetId.h:18
std::vector< unsigned int > theDetIds
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:58