CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
jptJetAnalysis::StripSignalOverNoiseCalculator Class Reference

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(""))

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().

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

Definition at line 802 of file JPTJetAnalyzer.cc.

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

Referenced by operator()().

804  {
805  //const uint32_t detId = cluster.geographicalId();
806 
807  const uint16_t firstStrip = cluster.firstStrip();
808  const SiStripQuality::Range& qualityRange = quality_->getRange(detId);
809  const SiStripNoises::Range& noiseRange = noise_->getRange(detId);
810  const SiStripApvGain::Range& gainRange = gain_->getRange(detId);
811  double signal = 0;
812  double noise2 = 0;
813  unsigned int nNonZeroStrips = 0;
814  const std::vector<uint8_t>& clusterAmplitudes = cluster.amplitudes();
815  const std::vector<uint8_t>::const_iterator clusterAmplitudesEnd = clusterAmplitudes.end();
816  const std::vector<uint8_t>::const_iterator clusterAmplitudesBegin = clusterAmplitudes.begin();
817  for (std::vector<uint8_t>::const_iterator iAmp = clusterAmplitudesBegin; iAmp != clusterAmplitudesEnd; ++iAmp) {
818  const uint8_t adc = *iAmp;
819  const uint16_t strip = iAmp-clusterAmplitudesBegin+firstStrip;
820  const bool stripBad = quality_->IsStripBad(qualityRange,strip);
821  const double noise = noise_->getNoise(strip,noiseRange);
822  const double gain = gain_->getStripGain(strip,gainRange);
823  signal += adc;
824  if (adc) ++nNonZeroStrips;
825  const double noiseContrib = (stripBad ? 0 : noise/gain);
826  noise2 += noiseContrib*noiseContrib;
827  }
828  const double noise = sqrt(noise2/nNonZeroStrips);
829  if (noise) return signal/noise;
830  else return 0;
831  }
int adc(sample_type sample)
get the ADC sample (12 bits)
bool IsStripBad(const uint32_t &detid, const short &strip) const
uint16_t firstStrip() const
float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range) const
Definition: SiStripGain.cc:86
T sqrt(T t)
Definition: SSEVec.h:48
std::pair< ContainerIterator, ContainerIterator > Range
static float getNoise(uint16_t strip, const Range &range)
const Range getRange(const uint32_t &detID) const
std::pair< ContainerIterator, ContainerIterator > Range
const SiStripApvGain::Range getRange(const uint32_t &detID) const
Definition: SiStripGain.cc:128
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
const Range getRange(const uint32_t &detID) const
const std::vector< uint8_t > & amplitudes() const
void jptJetAnalysis::StripSignalOverNoiseCalculator::update ( const edm::EventSetup eventSetup)

Definition at line 771 of file JPTJetAnalyzer.cc.

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

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

772  {
773  //update the quality if necessary
774  const SiStripQualityRcd& qualityRecord = eventSetup.get<SiStripQualityRcd>();
775  const uint32_t newQualityCacheId = qualityRecord.cacheIdentifier();
776  if ((newQualityCacheId != qualityCacheId_) || !quality_) {
777  edm::ESHandle<SiStripQuality> qualityHandle;
778  qualityRecord.get(qualityLabel_,qualityHandle);
779  quality_ = qualityHandle.product();
780  qualityCacheId_ = newQualityCacheId;
781  }
782  //update the noise if necessary
783  const SiStripNoisesRcd& noiseRecord = eventSetup.get<SiStripNoisesRcd>();
784  const uint32_t newNoiseCacheId = noiseRecord.cacheIdentifier();
785  if ((newNoiseCacheId != noiseCacheId_) || !noise_) {
786  edm::ESHandle<SiStripNoises> noiseHandle;
787  noiseRecord.get(noiseHandle);
788  noise_ = noiseHandle.product();
789  noiseCacheId_ = newNoiseCacheId;
790  }
791  //update the gain if necessary
792  const SiStripGainRcd& gainRecord = eventSetup.get<SiStripGainRcd>();
793  const uint32_t newGainCacheId = gainRecord.cacheIdentifier();
794  if ((newGainCacheId != gainCacheId_) || !gain_) {
795  edm::ESHandle<SiStripGain> gainHandle;
796  gainRecord.get(gainHandle);
797  gain_ = gainHandle.product();
798  gainCacheId_ = newGainCacheId;
799  }
800  }
unsigned long long cacheIdentifier() const
void get(HolderT &iHolder) const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62

Member Data Documentation

const SiStripGain* jptJetAnalysis::StripSignalOverNoiseCalculator::gain_
private

Definition at line 69 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::gainCacheId_
private

Definition at line 72 of file JPTJetAnalyzer.cc.

Referenced by update().

const SiStripNoises* jptJetAnalysis::StripSignalOverNoiseCalculator::noise_
private

Definition at line 68 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::noiseCacheId_
private

Definition at line 71 of file JPTJetAnalyzer.cc.

Referenced by update().

const SiStripQuality* jptJetAnalysis::StripSignalOverNoiseCalculator::quality_
private

Definition at line 67 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::qualityCacheId_
private

Definition at line 70 of file JPTJetAnalyzer.cc.

Referenced by update().

const std::string jptJetAnalysis::StripSignalOverNoiseCalculator::qualityLabel_
private

Definition at line 66 of file JPTJetAnalyzer.cc.

Referenced by update().