CMS 3D CMS Logo

Public Member Functions | Private Attributes

jptJetAnalysis::StripSignalOverNoiseCalculator Class Reference

List of all members.

Public Member Functions

double operator() (const SiStripCluster &cluster, const uint32_t &id) const
double signalOverNoise (const SiStripCluster &cluster, const uint32_t &id) const
 StripSignalOverNoiseCalculator (const std::string &theQualityLabel=std::string(""))
void update (const edm::EventSetup &eventSetup)

Private Attributes

const SiStripGaingain_
uint32_t gainCacheId_
const SiStripNoisesnoise_
uint32_t noiseCacheId_
const SiStripQualityquality_
uint32_t qualityCacheId_
const std::string qualityLabel_

Detailed Description

Definition at line 55 of file JPTJetAnalyzer.cc.


Constructor & Destructor Documentation

jptJetAnalysis::StripSignalOverNoiseCalculator::StripSignalOverNoiseCalculator ( const std::string &  theQualityLabel = std::string(""))

Definition at line 751 of file JPTJetAnalyzer.cc.


Member Function Documentation

double jptJetAnalysis::StripSignalOverNoiseCalculator::operator() ( const SiStripCluster cluster,
const uint32_t &  id 
) const [inline]

Definition at line 62 of file JPTJetAnalyzer.cc.

References signalOverNoise().

    { return signalOverNoise(cluster,id); }
double jptJetAnalysis::StripSignalOverNoiseCalculator::signalOverNoise ( const SiStripCluster cluster,
const uint32_t &  id 
) const

Definition at line 792 of file JPTJetAnalyzer.cc.

References ecalMGPA::adc(), SiStripCluster::amplitudes(), SiStripCluster::firstStrip(), gain_, SiStripNoises::getNoise(), SiStripBadStrip::getRange(), SiStripNoises::getRange(), SiStripGain::getRange(), SiStripGain::getStripGain(), SiStripQuality::IsStripBad(), noise_, quality_, mathSSE::sqrt(), and strip().

Referenced by operator()().

  {
    //const uint32_t detId = cluster.geographicalId();
    
    const uint16_t firstStrip = cluster.firstStrip();
    const SiStripQuality::Range& qualityRange = quality_->getRange(detId);
    const SiStripNoises::Range& noiseRange = noise_->getRange(detId);
    const SiStripApvGain::Range& gainRange = gain_->getRange(detId);
    double signal = 0;
    double noise2 = 0;
    unsigned int nNonZeroStrips = 0;
    const std::vector<uint8_t>& clusterAmplitudes = cluster.amplitudes();
    const std::vector<uint8_t>::const_iterator clusterAmplitudesEnd = clusterAmplitudes.end();
    const std::vector<uint8_t>::const_iterator clusterAmplitudesBegin = clusterAmplitudes.begin();
    for (std::vector<uint8_t>::const_iterator iAmp = clusterAmplitudesBegin; iAmp != clusterAmplitudesEnd; ++iAmp) {
      const uint8_t adc = *iAmp;
      const uint16_t strip = iAmp-clusterAmplitudesBegin+firstStrip;
      const bool stripBad = quality_->IsStripBad(qualityRange,strip);
      const double noise = noise_->getNoise(strip,noiseRange);
      const double gain = gain_->getStripGain(strip,gainRange);
      signal += adc;
      if (adc) ++nNonZeroStrips;
      const double noiseContrib = (stripBad ? 0 : noise/gain);
      noise2 += noiseContrib*noiseContrib;
    }
    const double noise = sqrt(noise2/nNonZeroStrips);
    if (noise) return signal/noise;
    else return 0;
  }
void jptJetAnalysis::StripSignalOverNoiseCalculator::update ( const edm::EventSetup eventSetup)

Definition at line 761 of file JPTJetAnalyzer.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), gain_, gainCacheId_, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), noise_, noiseCacheId_, edm::ESHandle< T >::product(), quality_, qualityCacheId_, and qualityLabel_.

  {
    //update the quality if necessary
    const SiStripQualityRcd& qualityRecord = eventSetup.get<SiStripQualityRcd>();
    const uint32_t newQualityCacheId = qualityRecord.cacheIdentifier();
    if ((newQualityCacheId != qualityCacheId_) || !quality_) {
      edm::ESHandle<SiStripQuality> qualityHandle;
      qualityRecord.get(qualityLabel_,qualityHandle);
      quality_ = qualityHandle.product();
      qualityCacheId_ = newQualityCacheId;
    }
    //update the noise if necessary
    const SiStripNoisesRcd& noiseRecord = eventSetup.get<SiStripNoisesRcd>();
    const uint32_t newNoiseCacheId = noiseRecord.cacheIdentifier();
    if ((newNoiseCacheId != noiseCacheId_) || !noise_) {
      edm::ESHandle<SiStripNoises> noiseHandle;
      noiseRecord.get(noiseHandle);
      noise_ = noiseHandle.product();
      noiseCacheId_ = newNoiseCacheId;
    }
    //update the gain if necessary
    const SiStripGainRcd& gainRecord = eventSetup.get<SiStripGainRcd>();
    const uint32_t newGainCacheId = gainRecord.cacheIdentifier();
    if ((newGainCacheId != gainCacheId_) || !gain_) {
      edm::ESHandle<SiStripGain> gainHandle;
      gainRecord.get(gainHandle);
      gain_ = gainHandle.product();
      gainCacheId_ = newGainCacheId;
    }
  }

Member Data Documentation

Definition at line 69 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

Definition at line 72 of file JPTJetAnalyzer.cc.

Referenced by update().

Definition at line 68 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

Definition at line 71 of file JPTJetAnalyzer.cc.

Referenced by update().

Definition at line 67 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

Definition at line 70 of file JPTJetAnalyzer.cc.

Referenced by update().

Definition at line 66 of file JPTJetAnalyzer.cc.

Referenced by update().