CMS 3D CMS Logo

CaloVNoiseSignalGenerator.cc
Go to the documentation of this file.
3 #include <iostream>
4 
6 : theNoiseSignals(),
7  theDetIds()
8 {
9 }
10 
11 
12 void CaloVNoiseSignalGenerator::fillEvent(CLHEP::HepRandomEngine* engine)
13 {
14  theDetIds.clear();
15  fillNoiseSignals(engine);
16  fillDetIds();
17 }
18 
19 
21 {
22  theDetIds.clear();
24  fillDetIds();
25 }
26 
27 
28 void CaloVNoiseSignalGenerator::setNoiseSignals(const std::vector<CaloSamples> & noiseSignals)
29 {
30  theNoiseSignals = noiseSignals;
31 }
32 
33 
34 bool CaloVNoiseSignalGenerator::contains(const DetId & detId) const
35 {
36  return edm::binary_search_all(theDetIds, detId.rawId());
37 }
38 
39 
41 {
42  theDetIds.reserve(theNoiseSignals.size());
43  for(std::vector<CaloSamples>::const_iterator sampleItr = theNoiseSignals.begin();
44  sampleItr != theNoiseSignals.end(); ++sampleItr)
45  {
46 
47  theDetIds.push_back(sampleItr->id().rawId());
48 
49  }
51 }
52 
53 
54 
virtual void fillNoiseSignals()=0
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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:120
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
Definition: Algorithms.h:76