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 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 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
const SiStripCluster * cluster_ptr
const T & get() const
Definition: EventSetup.h:56
const edm::EventSetup & es
uint32_t detId() const
edm::ESHandle< SiStripNoises > noiseHandle
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")

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 i, mathSSE::sqrt(), stripCharges(), and width().

Referenced by noise(), and noiseRescaledByGain().

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 }
int i
Definition: DBlmapReader.cc:9
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, bookConverter::max, and stripCharges().

Referenced by ApeEstimator::fillHitVariables().

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 ShallowClustersProducer::produce().

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(), qualityHandle, and width().

Referenced by IsAnythingBad().

126  {
127  return
128  qualityHandle->IsApvBad( detId_, firstStrip()/128 ) ||
129  qualityHandle->IsApvBad( detId_, (firstStrip()+width())/128 ) ;
130 }
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(), qualityHandle, and width().

Referenced by IsAnythingBad().

133  {
134  return
135  qualityHandle->IsFiberBad( detId_, firstStrip()/256 ) ||
136  qualityHandle->IsFiberBad( detId_, (firstStrip()+width())/256 ) ;
137 }
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_, and qualityHandle.

Referenced by IsAnythingBad().

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

Definition at line 145 of file SiStripClusterInfo.cc.

References detId_, and qualityHandle.

Referenced by ApeEstimator::fillHitVariables().

145  {
146  return qualityHandle->IsModuleUsable( detId_ );
147 }
edm::ESHandle< SiStripQuality > qualityHandle
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, 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 HLT_FULL_cff::algorithm, begin, HLT_FULL_cff::clusters, StripClusterizerAlgorithmFactory::create(), detId_, end, es, firstStrip(), i, stripCharges(), stripGains(), and width().

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 }
int i
Definition: DBlmapReader.cc:9
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, i, and width().

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

77  {
78  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId_);
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 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiStripGain > gainHandle
uint16_t firstStrip() const
uint16_t width() const
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< float > SiStripClusterInfo::stripNoises ( ) const

Definition at line 65 of file SiStripClusterInfo.cc.

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

Referenced by noise().

65  {
66  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_);
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 }
int i
Definition: DBlmapReader.cc:9
uint16_t firstStrip() const
uint16_t width() const
edm::ESHandle< SiStripNoises > noiseHandle
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:48
std::vector< float > SiStripClusterInfo::stripNoisesRescaledByGain ( ) const

Definition at line 52 of file SiStripClusterInfo.cc.

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

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

52  {
53  SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detId_);
54  SiStripApvGain::Range detGainRange = gainHandle->getRange(detId_);
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 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< SiStripGain > gainHandle
uint16_t firstStrip() const
dictionary results
uint16_t width() const
std::pair< ContainerIterator, ContainerIterator > Range
edm::ESHandle< SiStripNoises > noiseHandle
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:48
std::vector< bool > SiStripClusterInfo::stripQualitiesBad ( ) const

Definition at line 89 of file SiStripClusterInfo.cc.

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

Referenced by IsAnythingBad().

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 }
int i
Definition: DBlmapReader.cc:9
uint16_t firstStrip() const
edm::ESHandle< SiStripQuality > qualityHandle
uint16_t width() const
float SiStripClusterInfo::variance ( ) const

Definition at line 38 of file SiStripClusterInfo.cc.

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

Referenced by 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 }
int i
Definition: DBlmapReader.cc:9
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().