00001 #include "SimCalorimetry/CaloSimAlgos/interface/CaloVNoiseSignalGenerator.h" 00002 #include "FWCore/Utilities/interface/Algorithms.h" 00003 00004 00005 CaloVNoiseSignalGenerator::CaloVNoiseSignalGenerator() 00006 : theNoiseSignals(), 00007 theDetIds() 00008 { 00009 } 00010 00011 00012 void CaloVNoiseSignalGenerator::fillEvent() 00013 { 00014 theDetIds.clear(); 00015 fillNoiseSignals(); 00016 fillDetIds(); 00017 } 00018 00019 void CaloVNoiseSignalGenerator::setNoiseSignals(const std::vector<CaloSamples> & noiseSignals) 00020 { 00021 theNoiseSignals = noiseSignals; 00022 } 00023 00024 00025 bool CaloVNoiseSignalGenerator::contains(const DetId & detId) const 00026 { 00027 return edm::binary_search_all(theDetIds, detId.rawId()); 00028 } 00029 00030 00031 void CaloVNoiseSignalGenerator::fillDetIds() 00032 { 00033 theDetIds.reserve(theNoiseSignals.size()); 00034 for(std::vector<CaloSamples>::const_iterator sampleItr = theNoiseSignals.begin(); 00035 sampleItr != theNoiseSignals.end(); ++sampleItr) 00036 { 00037 theDetIds.push_back(sampleItr->id().rawId()); 00038 } 00039 edm::sort_all(theDetIds); 00040 } 00041 00042 00043