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
 
double signalOverNoise (const SiStripCluster &cluster) 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
inline

Definition at line 61 of file JPTJetAnalyzer.cc.

References signalOverNoise().

62  { return signalOverNoise(cluster); }
double signalOverNoise(const SiStripCluster &cluster) const
double jptJetAnalysis::StripSignalOverNoiseCalculator::signalOverNoise ( const SiStripCluster cluster) const

Definition at line 778 of file JPTJetAnalyzer.cc.

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

Referenced by operator()().

779  {
780  const uint32_t detId = cluster.geographicalId();
781  const uint16_t firstStrip = cluster.firstStrip();
782  const SiStripQuality::Range& qualityRange = quality_->getRange(detId);
783  const SiStripNoises::Range& noiseRange = noise_->getRange(detId);
784  const SiStripApvGain::Range& gainRange = gain_->getRange(detId);
785  double signal = 0;
786  double noise2 = 0;
787  unsigned int nNonZeroStrips = 0;
788  const std::vector<uint8_t>& clusterAmplitudes = cluster.amplitudes();
789  const std::vector<uint8_t>::const_iterator clusterAmplitudesEnd = clusterAmplitudes.end();
790  const std::vector<uint8_t>::const_iterator clusterAmplitudesBegin = clusterAmplitudes.begin();
791  for (std::vector<uint8_t>::const_iterator iAmp = clusterAmplitudesBegin; iAmp != clusterAmplitudesEnd; ++iAmp) {
792  const uint8_t adc = *iAmp;
793  const uint16_t strip = iAmp-clusterAmplitudesBegin+firstStrip;
794  const bool stripBad = quality_->IsStripBad(qualityRange,strip);
795  const double noise = noise_->getNoise(strip,noiseRange);
796  const double gain = gain_->getStripGain(strip,gainRange);
797  signal += adc;
798  if (adc) ++nNonZeroStrips;
799  const double noiseContrib = (stripBad ? 0 : noise/gain);
800  noise2 += noiseContrib*noiseContrib;
801  }
802  const double noise = sqrt(noise2/nNonZeroStrips);
803  if (noise) return signal/noise;
804  else return 0;
805  }
int adc(sample_type sample)
get the ADC sample (12 bits)
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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:87
uint32_t geographicalId() const
T sqrt(T t)
Definition: SSEVec.h:28
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:129
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 747 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 python.Vispa.Gui.VispaWidget.VispaWidget::autosize(), python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), python.Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), python.Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), python.Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), python.Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), python.Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), python.Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), python.Vispa.Gui.FindDialog.FindDialog::reset(), python.Vispa.Gui.PortConnection.PointToPointConnection::select(), python.Vispa.Gui.VispaWidget.VispaWidget::select(), python.Vispa.Views.LineDecayView.LineDecayContainer::select(), python.Vispa.Gui.VispaWidget.VispaWidget::setText(), python.Vispa.Gui.VispaWidget.VispaWidget::setTitle(), python.Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), python.Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and python.Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

748  {
749  //update the quality if necessary
750  const SiStripQualityRcd& qualityRecord = eventSetup.get<SiStripQualityRcd>();
751  const uint32_t newQualityCacheId = qualityRecord.cacheIdentifier();
752  if ((newQualityCacheId != qualityCacheId_) || !quality_) {
753  edm::ESHandle<SiStripQuality> qualityHandle;
754  qualityRecord.get(qualityLabel_,qualityHandle);
755  quality_ = qualityHandle.product();
756  qualityCacheId_ = newQualityCacheId;
757  }
758  //update the noise if necessary
759  const SiStripNoisesRcd& noiseRecord = eventSetup.get<SiStripNoisesRcd>();
760  const uint32_t newNoiseCacheId = noiseRecord.cacheIdentifier();
761  if ((newNoiseCacheId != noiseCacheId_) || !noise_) {
762  edm::ESHandle<SiStripNoises> noiseHandle;
763  noiseRecord.get(noiseHandle);
764  noise_ = noiseHandle.product();
765  noiseCacheId_ = newNoiseCacheId;
766  }
767  //update the gain if necessary
768  const SiStripGainRcd& gainRecord = eventSetup.get<SiStripGainRcd>();
769  const uint32_t newGainCacheId = gainRecord.cacheIdentifier();
770  if ((newGainCacheId != gainCacheId_) || !gain_) {
771  edm::ESHandle<SiStripGain> gainHandle;
772  gainRecord.get(gainHandle);
773  gain_ = gainHandle.product();
774  gainCacheId_ = newGainCacheId;
775  }
776  }
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 67 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::gainCacheId_
private

Definition at line 70 of file JPTJetAnalyzer.cc.

Referenced by update().

const SiStripNoises* jptJetAnalysis::StripSignalOverNoiseCalculator::noise_
private

Definition at line 66 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::noiseCacheId_
private

Definition at line 69 of file JPTJetAnalyzer.cc.

Referenced by update().

const SiStripQuality* jptJetAnalysis::StripSignalOverNoiseCalculator::quality_
private

Definition at line 65 of file JPTJetAnalyzer.cc.

Referenced by signalOverNoise(), and update().

uint32_t jptJetAnalysis::StripSignalOverNoiseCalculator::qualityCacheId_
private

Definition at line 68 of file JPTJetAnalyzer.cc.

Referenced by update().

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

Definition at line 64 of file JPTJetAnalyzer.cc.

Referenced by update().