CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripClusterInfo Class Reference

#include <SiStripClusterInfo.h>

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="")
 
auto stripCharges () const -> decltype(cluster() ->amplitudes())
 
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 15 of file SiStripClusterInfo.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file SiStripClusterInfo.cc.

References chargeLR(), es, gainHandle, edm::EventSetup::get(), noiseHandle, qualityHandle, and qualityLabel.

17  : cluster_ptr(&cluster),
18  es(setup),
20  detId_(detId) {
21  es.get<SiStripNoisesRcd>().get(noiseHandle);
22  es.get<SiStripGainRcd>().get(gainHandle);
24 }
edm::ESHandle< SiStripGain > gainHandle
edm::ESHandle< SiStripQuality > qualityHandle
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
const SiStripCluster * cluster_ptr
const T & get() const
Definition: EventSetup.h:55
const edm::EventSetup & es
uint32_t detId() const
edm::ESHandle< SiStripNoises > noiseHandle

Member Function Documentation

float SiStripClusterInfo::baryStrip ( ) const
inline

Definition at line 29 of file SiStripClusterInfo.h.

References SiStripCluster::barycenter(), and cluster().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), and ApeEstimator::fillHitVariables().

29 {return cluster()->barycenter();}
const SiStripCluster * cluster() const
float barycenter() const
float SiStripClusterInfo::calculate_noise ( const std::vector< float > &  noise) const
private

Definition at line 100 of file SiStripClusterInfo.cc.

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

Referenced by noise(), noiseRescaledByGain(), signalOverNoise(), and stripQualitiesBad().

100  {
101  float noiseSumInQuadrature = 0;
102  int numberStripsOverThreshold = 0;
103  for(int i=0;i<width();i++) {
104  if(stripCharges()[i]!=0) {
105  noiseSumInQuadrature += noise.at(i) * noise.at(i);
106  numberStripsOverThreshold++;
107  }
108  }
109  return std::sqrt( noiseSumInQuadrature / numberStripsOverThreshold );
110 }
float noise() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
T sqrt(T t)
Definition: SSEVec.h:18
uint16_t width() const
uint16_t SiStripClusterInfo::charge ( void  ) const
inline

Definition at line 39 of file SiStripClusterInfo.h.

References begin, end, and stripCharges().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), ApeEstimator::fillHitVariables(), StandaloneTrackMonitor::processClusters(), StandaloneTrackMonitor::processHit(), ShallowClustersProducer::produce(), and signalOverNoise().

39 {return std::accumulate( stripCharges().begin(), stripCharges().end(), uint16_t(0));}
auto stripCharges() const -> decltype(cluster() ->amplitudes())
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
std::pair< uint16_t, uint16_t > SiStripClusterInfo::chargeLR ( ) const

Definition at line 27 of file SiStripClusterInfo.cc.

References begin, end, SiStripPI::max, stripCharges(), and variance().

Referenced by ApeEstimator::fillHitVariables(), maxIndex(), and SiStripClusterInfo().

27  {
28  std::vector<uint8_t>::const_iterator
29  begin( stripCharges().begin() ),
30  end( stripCharges().end() ),
31  max; max = max_element(begin,end);
32  return std::make_pair( accumulate(begin, max, uint16_t(0) ),
33  accumulate(max+1, end, uint16_t(0) ) );
34 }
auto stripCharges() const -> decltype(cluster() ->amplitudes())
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
const SiStripCluster* SiStripClusterInfo::cluster ( ) const
inline

Definition at line 24 of file SiStripClusterInfo.h.

References cluster_ptr.

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

24 {return cluster_ptr;}
const SiStripCluster * 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 calculate_noise(), ShallowClustersProducer::produce(), and signalOverNoise().

114  {
115  std::vector<bool> stripBad = stripQualitiesBad();
116  return
117  IsApvBad() ||
118  IsFiberBad() ||
119  IsModuleBad() ||
120  accumulate(stripBad.begin(), stripBad.end(),
121  false,
122  std::logical_or<bool>());
123 }
std::vector< bool > stripQualitiesBad() const
bool SiStripClusterInfo::IsApvBad ( ) const

Definition at line 126 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripQuality::IsApvBad(), IsFiberBad(), qualityHandle, and width().

Referenced by IsAnythingBad(), and signalOverNoise().

126  {
127  return
129  qualityHandle->IsApvBad( detId_, (firstStrip()+width())/128 ) ;
130 }
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
uint16_t firstStrip() const
edm::ESHandle< SiStripQuality > qualityHandle
uint16_t width() const
bool SiStripClusterInfo::IsFiberBad ( ) const

Definition at line 133 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripQuality::IsFiberBad(), IsModuleBad(), qualityHandle, and width().

Referenced by IsAnythingBad(), IsApvBad(), and signalOverNoise().

133  {
134  return
137 }
bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const
uint16_t firstStrip() const
edm::ESHandle< SiStripQuality > qualityHandle
uint16_t width() const
bool SiStripClusterInfo::IsModuleBad ( ) const

Definition at line 140 of file SiStripClusterInfo.cc.

References detId_, SiStripQuality::IsModuleBad(), IsModuleUsable(), and qualityHandle.

Referenced by IsAnythingBad(), IsFiberBad(), and signalOverNoise().

140  {
141  return qualityHandle->IsModuleBad( detId_ );
142 }
edm::ESHandle< SiStripQuality > qualityHandle
bool IsModuleBad(const uint32_t &detid) const
bool SiStripClusterInfo::IsModuleUsable ( ) const

Definition at line 145 of file SiStripClusterInfo.cc.

References detId_, SiStripQuality::IsModuleUsable(), qualityHandle, and reclusterize().

Referenced by ApeEstimator::fillHitVariables(), IsModuleBad(), and signalOverNoise().

145  {
147 }
edm::ESHandle< SiStripQuality > qualityHandle
bool IsModuleUsable(const uint32_t &detid) const
uint8_t SiStripClusterInfo::maxCharge ( ) const
inline

Definition at line 40 of file SiStripClusterInfo.h.

References begin, end, and stripCharges().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), ApeEstimator::fillHitVariables(), ShallowClustersProducer::NearDigis::NearDigis(), and ShallowClustersProducer::produce().

40 {return * std::max_element(stripCharges().begin(), stripCharges().end());}
auto stripCharges() const -> decltype(cluster() ->amplitudes())
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
uint16_t SiStripClusterInfo::maxIndex ( ) const
inline

Definition at line 41 of file SiStripClusterInfo.h.

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

Referenced by SiStripMonitorTrack::clusterInfos(), ApeEstimator::fillHitVariables(), maxStrip(), ShallowClustersProducer::NearDigis::NearDigis(), and ShallowClustersProducer::produce().

41 {return std::max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();}
auto stripCharges() const -> decltype(cluster() ->amplitudes())
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
uint16_t SiStripClusterInfo::maxStrip ( ) const
inline
float SiStripClusterInfo::noise ( ) const
inline

Definition at line 44 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoises().

Referenced by TrackerDpgAnalysis::analyze().

44 { return calculate_noise(stripNoises());}
float calculate_noise(const std::vector< float > &) const
std::vector< float > stripNoises() const
float SiStripClusterInfo::noiseRescaledByGain ( ) const
inline

Definition at line 45 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoisesRescaledByGain().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), ShallowClustersProducer::produce(), and signalOverNoise().

float calculate_noise(const std::vector< float > &) const
std::vector< float > stripNoisesRescaledByGain() const
std::vector< SiStripCluster > SiStripClusterInfo::reclusterize ( const edm::ParameterSet conf) const

Definition at line 150 of file SiStripClusterInfo.cc.

References electronCleaner_cfi::algorithm, begin, fastPrimaryVertexProducer_cfi::clusters, StripClusterizerAlgorithmFactory::create(), detId_, end, es, firstStrip(), mps_fire::i, stripCharges(), stripGains(), and width().

Referenced by IsModuleUsable(), and signalOverNoise().

150  {
151 
152  std::vector<SiStripCluster> clusters;
153 
154  std::vector<uint8_t> charges(stripCharges().begin(),stripCharges().end());
155  std::vector<float> gains = stripGains();
156  for(unsigned i=0; i < charges.size(); i++)
157  charges[i] = (charges[i] < 254)
158  ? static_cast<uint8_t>(charges[i] * gains[i])
159  : charges[i];
160 
161  std::auto_ptr<StripClusterizerAlgorithm>
163  algorithm->initialize(es);
164  auto const & det = algorithm->stripByStripBegin( detId_ );
165  if(det.valid()) {
167  for(unsigned i = 0; i<width(); i++)
168  algorithm->stripByStripAdd(state, firstStrip()+i, charges[i], clusters );
169  algorithm->stripByStripEnd(state, clusters );
170  }
171 
172  return clusters;
173 }
uint16_t firstStrip() const
std::vector< float > stripGains() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
static std::auto_ptr< StripClusterizerAlgorithm > create(const edm::ParameterSet &)
uint16_t width() const
#define end
Definition: vmac.h:37
const edm::EventSetup & es
#define begin
Definition: vmac.h:30
float SiStripClusterInfo::signalOverNoise ( ) const
inline
auto SiStripClusterInfo::stripCharges ( ) const -> decltype(cluster()->amplitudes())
inline
std::vector< float > SiStripClusterInfo::stripGains ( ) const

Definition at line 77 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), gainHandle, SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, stripQualitiesBad(), and width().

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

77  {
79 
80  std::vector<float> gains;
81  gains.reserve(width());
82  for(size_t i=0; i< width(); i++){
83  gains.push_back( gainHandle->getStripGain( firstStrip()+i, detGainRange) );
84  }
85  return gains;
86 }
edm::ESHandle< SiStripGain > gainHandle
uint16_t firstStrip() const
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
uint16_t width() const
std::pair< ContainerIterator, ContainerIterator > Range
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70
std::vector< float > SiStripClusterInfo::stripNoises ( ) const

Definition at line 65 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripNoises::getNoise(), SiStripNoises::getRange(), mps_fire::i, noiseHandle, stripGains(), and width().

Referenced by noise(), stripCharges(), and stripNoisesRescaledByGain().

65  {
67 
68  std::vector<float> noises;
69  noises.reserve(width());
70  for(size_t i=0; i < width(); i++){
71  noises.push_back( noiseHandle->getNoise( firstStrip()+i, detNoiseRange) );
72  }
73  return noises;
74 }
uint16_t firstStrip() const
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:74
uint16_t width() const
edm::ESHandle< SiStripNoises > noiseHandle
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:50
std::vector< float > SiStripClusterInfo::stripNoisesRescaledByGain ( ) const

Definition at line 52 of file SiStripClusterInfo.cc.

References detId_, MillePedeFileConverter_cfg::e, firstStrip(), gainHandle, SiStripNoises::getNoise(), SiStripNoises::getRange(), SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, noiseHandle, mps_update::results, stripNoises(), and width().

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

52  {
55 
56  std::vector<float> results;
57  results.reserve(width());
58  for(size_t i = 0, e = width(); i < e; i++){
59  results.push_back(noiseHandle->getNoise(firstStrip()+i, detNoiseRange) / gainHandle->getStripGain( firstStrip()+i, detGainRange));
60  }
61  return results;
62 }
edm::ESHandle< SiStripGain > gainHandle
uint16_t firstStrip() const
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:74
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
uint16_t width() const
std::pair< ContainerIterator, ContainerIterator > Range
edm::ESHandle< SiStripNoises > noiseHandle
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:50
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70
std::vector< bool > SiStripClusterInfo::stripQualitiesBad ( ) const

Definition at line 89 of file SiStripClusterInfo.cc.

References calculate_noise(), detId_, firstStrip(), mps_fire::i, SiStripQuality::IsStripBad(), qualityHandle, and width().

Referenced by IsAnythingBad(), stripCharges(), and stripGains().

89  {
90  std::vector<bool> isBad;
91  isBad.reserve(width());
92  for(int i=0; i< width(); i++) {
93  isBad.push_back( qualityHandle->IsStripBad( detId_,
94  firstStrip()+i) );
95  }
96  return isBad;
97 }
uint16_t firstStrip() const
edm::ESHandle< SiStripQuality > qualityHandle
bool IsStripBad(const uint32_t &detid, const short &strip) const
uint16_t width() const
float SiStripClusterInfo::variance ( ) const

Definition at line 38 of file SiStripClusterInfo.cc.

References begin, end, mps_fire::i, lumiQueryAPI::q, stripCharges(), stripNoisesRescaledByGain(), globals_cff::x1, and globals_cff::x2.

Referenced by chargeLR(), maxStrip(), and ShallowClustersProducer::produce().

38  {
39  float q(0), x1(0), x2(0);
40  for(auto
41  begin(stripCharges().begin()), end(stripCharges().end()), it(begin);
42  it!=end; ++it) {
43  unsigned i = it-begin;
44  q += (*it);
45  x1 += (*it) * (i+0.5);
46  x2 += (*it) * (i*i+i+1./3);
47  }
48  return (x2 - x1*x1/q ) / q;
49 }
auto stripCharges() const -> decltype(cluster() ->amplitudes())
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
uint16_t SiStripClusterInfo::width ( ) const
inline

Member Data Documentation

const SiStripCluster* SiStripClusterInfo::cluster_ptr
private

Definition at line 61 of file SiStripClusterInfo.h.

Referenced by cluster().

uint32_t SiStripClusterInfo::detId_
private
const edm::EventSetup& SiStripClusterInfo::es
private

Definition at line 62 of file SiStripClusterInfo.h.

Referenced by reclusterize(), and SiStripClusterInfo().

edm::ESHandle<SiStripGain> SiStripClusterInfo::gainHandle
private

Definition at line 64 of file SiStripClusterInfo.h.

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

edm::ESHandle<SiStripNoises> SiStripClusterInfo::noiseHandle
private

Definition at line 63 of file SiStripClusterInfo.h.

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

edm::ESHandle<SiStripQuality> SiStripClusterInfo::qualityHandle
private
std::string SiStripClusterInfo::qualityLabel
private

Definition at line 66 of file SiStripClusterInfo.h.

Referenced by SiStripClusterInfo().