CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

SiStripClusterInfo Class Reference

#include <SiStripClusterInfo.h>

List of all members.

Public Member Functions

float baryStrip () const
uint16_t charge () const
std::pair< uint16_t, uint16_t > chargeLR () const
const SiStripClustercluster () const
uint32_t detId () const
uint16_t firstStrip () const
bool IsAnythingBad () const
bool IsApvBad () const
bool IsFiberBad () const
bool IsModuleBad () const
bool IsModuleUsable () const
uint8_t maxCharge () const
uint16_t maxIndex () const
uint16_t maxStrip () const
float noise () const
float noiseRescaledByGain () const
std::vector< SiStripClusterreclusterize (const edm::ParameterSet &) const
float signalOverNoise () const
 SiStripClusterInfo (const SiStripCluster &cluster, const edm::EventSetup &es, const int detid, const std::string &qualityLabel="")
const std::vector< uint8_t > & stripCharges () const
std::vector< float > stripGains () const
std::vector< float > stripNoises () const
std::vector< float > stripNoisesRescaledByGain () const
std::vector< bool > stripQualitiesBad () const
float variance () const
uint16_t width () const

Private Member Functions

float calculate_noise (const std::vector< float > &) const

Private Attributes

const SiStripClustercluster_ptr
uint32_t detId_
const edm::EventSetupes
edm::ESHandle< SiStripGaingainHandle
edm::ESHandle< SiStripNoisesnoiseHandle
edm::ESHandle< SiStripQualityqualityHandle
std::string qualityLabel

Detailed Description

Definition at line 14 of file SiStripClusterInfo.h.


Constructor & Destructor Documentation

SiStripClusterInfo::SiStripClusterInfo ( const SiStripCluster cluster,
const edm::EventSetup es,
const int  detid,
const std::string &  qualityLabel = "" 
)

Member Function Documentation

float SiStripClusterInfo::baryStrip ( ) const [inline]
float SiStripClusterInfo::calculate_noise ( const std::vector< float > &  noise) const [private]

Definition at line 100 of file SiStripClusterInfo.cc.

References i, mathSSE::sqrt(), stripCharges(), and width().

Referenced by noise(), and noiseRescaledByGain().

                                                     {  
  float noiseSumInQuadrature = 0;
  int numberStripsOverThreshold = 0;
  for(int i=0;i<width();i++) {
    if(stripCharges().at(i)!=0) {
      noiseSumInQuadrature += noise.at(i) * noise.at(i);
      numberStripsOverThreshold++;
    }
  }
  return std::sqrt( noiseSumInQuadrature / numberStripsOverThreshold );
} 
uint16_t SiStripClusterInfo::charge ( void  ) const [inline]
std::pair< uint16_t, uint16_t > SiStripClusterInfo::chargeLR ( ) const

Definition at line 27 of file SiStripClusterInfo.cc.

References begin, end, max(), and stripCharges().

                 { 
  std::vector<uint8_t>::const_iterator 
    begin( stripCharges().begin() ),
    end( stripCharges().end() ), 
    max; max = max_element(begin,end);
  return std::make_pair( accumulate(begin, max, uint16_t(0) ),
                         accumulate(max+1, end, uint16_t(0) ) );
}
const SiStripCluster* SiStripClusterInfo::cluster ( ) const [inline]

Definition at line 23 of file SiStripClusterInfo.h.

References cluster_ptr.

Referenced by baryStrip(), firstStrip(), stripCharges(), and width().

{return cluster_ptr;}
uint32_t SiStripClusterInfo::detId ( ) const [inline]
uint16_t SiStripClusterInfo::firstStrip ( ) const [inline]
bool SiStripClusterInfo::IsAnythingBad ( ) const

Definition at line 114 of file SiStripClusterInfo.cc.

References IsApvBad(), IsFiberBad(), IsModuleBad(), and stripQualitiesBad().

Referenced by ShallowClustersProducer::produce().

                      {
  std::vector<bool> stripBad = stripQualitiesBad();
  return
    IsApvBad() ||
    IsFiberBad() ||
    IsModuleBad() ||
    accumulate(stripBad.begin(), stripBad.end(), 
               false,
               std::logical_or<bool>());
}
bool SiStripClusterInfo::IsApvBad ( ) const

Definition at line 126 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), qualityHandle, and width().

Referenced by IsAnythingBad().

                 {
  return 
    qualityHandle->IsApvBad( detId_, firstStrip()/128 ) ||
    qualityHandle->IsApvBad( detId_, (firstStrip()+width())/128 ) ;    
}
bool SiStripClusterInfo::IsFiberBad ( ) const

Definition at line 133 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), qualityHandle, and width().

Referenced by IsAnythingBad().

                   {
  return 
    qualityHandle->IsFiberBad( detId_, firstStrip()/256 ) ||
    qualityHandle->IsFiberBad( detId_, (firstStrip()+width())/256 ) ;
}
bool SiStripClusterInfo::IsModuleBad ( ) const

Definition at line 140 of file SiStripClusterInfo.cc.

References detId_, and qualityHandle.

Referenced by IsAnythingBad().

                    {
  return qualityHandle->IsModuleBad( detId_ );
}
bool SiStripClusterInfo::IsModuleUsable ( ) const

Definition at line 145 of file SiStripClusterInfo.cc.

References detId_, and qualityHandle.

                       {
  return qualityHandle->IsModuleUsable( detId_ );
}
uint8_t SiStripClusterInfo::maxCharge ( ) const [inline]
uint16_t SiStripClusterInfo::maxIndex ( ) const [inline]
uint16_t SiStripClusterInfo::maxStrip ( ) const [inline]
float SiStripClusterInfo::noise ( ) const [inline]

Definition at line 43 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoises().

Referenced by TrackerDpgAnalysis::analyze().

float SiStripClusterInfo::noiseRescaledByGain ( ) const [inline]
std::vector< SiStripCluster > SiStripClusterInfo::reclusterize ( const edm::ParameterSet conf) const

Definition at line 150 of file SiStripClusterInfo.cc.

References algorithm(), SurfaceDeformationFactory::create(), detId_, es, firstStrip(), i, stripCharges(), stripGains(), and width().

                                                {
  
  std::vector<SiStripCluster> clusters;

  std::vector<uint8_t> charges = stripCharges();
  std::vector<float> gains = stripGains();
  for(unsigned i=0; i < charges.size(); i++)
    charges[i] = (charges[i] < 254) 
      ? static_cast<uint8_t>(charges[i] * gains[i])
      : charges[i];

  std::auto_ptr<StripClusterizerAlgorithm> 
    algorithm = StripClusterizerAlgorithmFactory::create(conf);
  algorithm->initialize(es);

  if( algorithm->stripByStripBegin( detId_ )) {
    for(unsigned i = 0; i<width(); i++)
      algorithm->stripByStripAdd( firstStrip()+i, charges[i], clusters );
    algorithm->stripByStripEnd( clusters );
  }

  return clusters;
}
float SiStripClusterInfo::signalOverNoise ( ) const [inline]
const std::vector<uint8_t>& SiStripClusterInfo::stripCharges ( ) const [inline]
std::vector< float > SiStripClusterInfo::stripGains ( ) const

Definition at line 77 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), gainHandle, i, and width().

Referenced by ShallowClustersProducer::produce(), and reclusterize().

                   {  
  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId_);    

  std::vector<float> gains;
  gains.reserve(width());
  for(size_t i=0; i< width(); i++){     
    gains.push_back( gainHandle->getStripGain( firstStrip()+i, detGainRange) );
  } 
  return gains;
}
std::vector< float > SiStripClusterInfo::stripNoises ( ) const

Definition at line 65 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), i, noiseHandle, and width().

Referenced by noise().

                    {  
  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_);  
  
  std::vector<float> noises;
  noises.reserve(width());
  for(size_t i=0; i < width(); i++){
    noises.push_back( noiseHandle->getNoise( firstStrip()+i, detNoiseRange) );
  }
  return noises;
}
std::vector< float > SiStripClusterInfo::stripNoisesRescaledByGain ( ) const

Definition at line 52 of file SiStripClusterInfo.cc.

References detId_, alignCSCRings::e, firstStrip(), gainHandle, i, noiseHandle, python::entryComment::results, and width().

Referenced by noiseRescaledByGain(), and ShallowClustersProducer::produce().

                                  { 
  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_);
  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId_);

  std::vector<float> results;
  results.reserve(width());
  for(size_t i = 0, e = width(); i < e; i++){
    results.push_back(noiseHandle->getNoise(firstStrip()+i, detNoiseRange) / gainHandle->getStripGain( firstStrip()+i, detGainRange));
  }
  return results;
}
std::vector< bool > SiStripClusterInfo::stripQualitiesBad ( ) const

Definition at line 89 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), i, qualityHandle, and width().

Referenced by IsAnythingBad().

                          {
  std::vector<bool> isBad;
  isBad.reserve(width());
  for(int i=0; i< width(); i++) {
    isBad.push_back( qualityHandle->IsStripBad( detId_, 
                                                 firstStrip()+i) );
  }
  return isBad;
}
float SiStripClusterInfo::variance ( ) const

Definition at line 38 of file SiStripClusterInfo.cc.

References begin, end, i, lumiQueryAPI::q, and stripCharges().

Referenced by ShallowClustersProducer::produce().

                 {
  float q(0), x1(0), x2(0);
  for(std::vector<uint8_t>::const_iterator 
        begin(stripCharges().begin()), end(stripCharges().end()), it(begin); 
      it!=end; ++it) {
    unsigned i = it-begin;
    q  += (*it);
    x1 += (*it) * (i+0.5);
    x2 += (*it) * (i*i+i+1./3);
  }
  return (x2 - x1*x1/q ) / q;
}
uint16_t SiStripClusterInfo::width ( ) const [inline]

Member Data Documentation

Definition at line 60 of file SiStripClusterInfo.h.

Referenced by cluster().

uint32_t SiStripClusterInfo::detId_ [private]

Definition at line 61 of file SiStripClusterInfo.h.

Referenced by reclusterize(), and SiStripClusterInfo().

Definition at line 63 of file SiStripClusterInfo.h.

Referenced by SiStripClusterInfo(), stripGains(), and stripNoisesRescaledByGain().

Definition at line 62 of file SiStripClusterInfo.h.

Referenced by SiStripClusterInfo(), stripNoises(), and stripNoisesRescaledByGain().

std::string SiStripClusterInfo::qualityLabel [private]

Definition at line 65 of file SiStripClusterInfo.h.

Referenced by SiStripClusterInfo().