CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoLocalTracker/SiStripClusterizer/src/StripClusterizerAlgorithm.cc

Go to the documentation of this file.
00001 #include "RecoLocalTracker/SiStripClusterizer/interface/StripClusterizerAlgorithm.h"
00002 
00003 #include "FWCore/Framework/interface/EventSetup.h"
00004 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
00005 #include "CalibTracker/Records/interface/SiStripGainRcd.h"
00006 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
00007 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
00008 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00009 #include <string>
00010 
00011 void StripClusterizerAlgorithm::
00012 initialize(const edm::EventSetup& es) {
00013   uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier();
00014   uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
00015   uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier();
00016 
00017   if(n_cache_id != noise_cache_id) {
00018     es.get<SiStripNoisesRcd>().get( noiseHandle );
00019     noise_cache_id = n_cache_id;
00020   }
00021   if(g_cache_id != gain_cache_id) {
00022     es.get<SiStripGainRcd>().get( gainHandle );
00023     gain_cache_id = g_cache_id;
00024   }
00025   if(q_cache_id != quality_cache_id) {
00026     es.get<SiStripQualityRcd>().get( qualityLabel, qualityHandle );
00027     quality_cache_id = q_cache_id;
00028   }
00029 }
00030 
00031 inline 
00032 void StripClusterizerAlgorithm::
00033 setDetId(const uint32_t id) {
00034   gainRange =  gainHandle->getRange(id); 
00035   noiseRange = noiseHandle->getRange(id);
00036   qualityRange = qualityHandle->getRange(id);
00037   detId = id;
00038 }
00039 
00040 template<class T> 
00041 inline
00042 void StripClusterizerAlgorithm::
00043 clusterize_(const T& input, output_t& output) {
00044   for(typename T::const_iterator it = input.begin(); it!=input.end(); it++) {
00045     output_t::FastFiller ff(output, it->detId());
00046     clusterizeDetUnit(*it, ff);
00047     if(ff.empty()) ff.abort();
00048   }
00049 }
00050 
00051 void StripClusterizerAlgorithm::clusterize(const   edm::DetSetVector<SiStripDigi>& input,  output_t& output) {clusterize_(input, output);}
00052 void StripClusterizerAlgorithm::clusterize(const edmNew::DetSetVector<SiStripDigi>& input, output_t& output) {clusterize_(input, output);}
00053 
00054 StripClusterizerAlgorithm::
00055 InvalidChargeException::InvalidChargeException(const SiStripDigi& digi)
00056   : cms::Exception("Invalid Charge") {
00057   std::stringstream s;
00058   s << "Digi charge of " << digi.adc() << " ADC "
00059     << "is out of range on strip " << digi.strip() << ".  ";
00060   this->append(s.str());
00061 }