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

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),
19  qualityLabel(quality),
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:55
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 28 of file SiStripClusterInfo.h.

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

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::fillMEs(), and SiStripMonitorTrack::fillModMEs().

28 {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().at(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
T sqrt(T t)
Definition: SSEVec.h:48
uint16_t width() const
const std::vector< uint8_t > & stripCharges() const
uint16_t SiStripClusterInfo::charge ( void  ) const
inline

Definition at line 38 of file SiStripClusterInfo.h.

References begin, end, and stripCharges().

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

38 {return accumulate( stripCharges().begin(), stripCharges().end(), uint16_t(0));}
#define end
Definition: vmac.h:38
const std::vector< uint8_t > & stripCharges() const
#define begin
Definition: vmac.h:31
std::pair< uint16_t, uint16_t > SiStripClusterInfo::chargeLR ( ) const

Definition at line 27 of file SiStripClusterInfo.cc.

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

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 }
const T & max(const T &a, const T &b)
#define end
Definition: vmac.h:38
const std::vector< uint8_t > & stripCharges() const
#define begin
Definition: vmac.h:31
const SiStripCluster* SiStripClusterInfo::cluster ( ) const
inline

Definition at line 23 of file SiStripClusterInfo.h.

References cluster_ptr.

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

23 {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.

145  {
146  return qualityHandle->IsModuleUsable( detId_ );
147 }
edm::ESHandle< SiStripQuality > qualityHandle
uint8_t SiStripClusterInfo::maxCharge ( ) const
inline

Definition at line 39 of file SiStripClusterInfo.h.

References begin, end, and stripCharges().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::fillModMEs(), ShallowClustersProducer::NearDigis::NearDigis(), and ShallowClustersProducer::produce().

39 {return * max_element(stripCharges().begin(), stripCharges().end());}
#define end
Definition: vmac.h:38
const std::vector< uint8_t > & stripCharges() const
#define begin
Definition: vmac.h:31
uint16_t SiStripClusterInfo::maxIndex ( ) const
inline

Definition at line 40 of file SiStripClusterInfo.h.

References begin, end, and stripCharges().

Referenced by SiStripMonitorTrack::fillModMEs(), maxStrip(), ShallowClustersProducer::NearDigis::NearDigis(), and ShallowClustersProducer::produce().

40 {return max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();}
#define end
Definition: vmac.h:38
const std::vector< uint8_t > & stripCharges() const
#define begin
Definition: vmac.h:31
uint16_t SiStripClusterInfo::maxStrip ( ) const
inline

Definition at line 29 of file SiStripClusterInfo.h.

References firstStrip(), and maxIndex().

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

29 {return firstStrip() + maxIndex();}
uint16_t firstStrip() const
uint16_t maxIndex() const
float SiStripClusterInfo::noise ( ) const
inline

Definition at line 43 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoises().

Referenced by TrackerDpgAnalysis::analyze().

43 { return calculate_noise(stripNoises());}
float calculate_noise(const std::vector< float > &) const
std::vector< float > stripNoises() const
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(), StripClusterizerAlgorithmFactory::create(), detId_, es, firstStrip(), i, stripCharges(), stripGains(), and width().

150  {
151 
152  std::vector<SiStripCluster> clusters;
153 
154  std::vector<uint8_t> charges = stripCharges();
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 
165  if( algorithm->stripByStripBegin( detId_ )) {
166  for(unsigned i = 0; i<width(); i++)
167  algorithm->stripByStripAdd( firstStrip()+i, charges[i], clusters );
168  algorithm->stripByStripEnd( clusters );
169  }
170 
171  return clusters;
172 }
int i
Definition: DBlmapReader.cc:9
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Ecal cluster collections</td ></tr >< tr >< td >< ahref="classreco_1_1BasicCluster.html"> reco::BasicCluster</a ></td >< td >< ahref="DataFormats_EgammaReco.html"> reco::BasicClusterCollection</a ></td >< td >< ahref="#"> hybridSuperClusters</a ></td >< tdclass="description"> Basic clusters reconstructed with hybrid algorithm(barrel only)</td >< td >S.Rahatlou</td ></tr >< tr >< td >< a href
uint16_t firstStrip() const
std::vector< float > stripGains() const
static std::auto_ptr< StripClusterizerAlgorithm > create(const edm::ParameterSet &)
uint16_t width() const
const edm::EventSetup & es
const std::vector< uint8_t > & stripCharges() const
float SiStripClusterInfo::signalOverNoise ( ) const
inline
const std::vector<uint8_t>& SiStripClusterInfo::stripCharges ( ) const
inline

Definition at line 32 of file SiStripClusterInfo.h.

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

Referenced by calculate_noise(), charge(), chargeLR(), SiStripMonitorTrack::fillModMEs(), maxCharge(), maxIndex(), ShallowClustersProducer::NearDigis::NearDigis(), reclusterize(), and variance().

32 {return cluster()->amplitudes();}
const SiStripCluster * cluster() const
const std::vector< uint8_t > & amplitudes() const
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:41
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().

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
uint16_t width() const
std::pair< ContainerIterator, ContainerIterator > Range
edm::ESHandle< SiStripNoises > noiseHandle
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:41
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(std::vector<uint8_t>::const_iterator
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
#define end
Definition: vmac.h:38
const std::vector< uint8_t > & stripCharges() const
#define begin
Definition: vmac.h:31
uint16_t SiStripClusterInfo::width ( ) const
inline

Member Data Documentation

const SiStripCluster* SiStripClusterInfo::cluster_ptr
private

Definition at line 60 of file SiStripClusterInfo.h.

Referenced by cluster().

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

Definition at line 61 of file SiStripClusterInfo.h.

Referenced by reclusterize(), and SiStripClusterInfo().

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

Definition at line 63 of file SiStripClusterInfo.h.

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

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

Definition at line 62 of file SiStripClusterInfo.h.

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

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

Definition at line 65 of file SiStripClusterInfo.h.

Referenced by SiStripClusterInfo().