CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
StripClusterizerAlgorithm Class Referenceabstract

#include <StripClusterizerAlgorithm.h>

Inheritance diagram for StripClusterizerAlgorithm:
ThreeThresholdAlgorithm

Classes

struct  Det
 
struct  Index
 
struct  InvalidChargeException
 
struct  State
 

Public Types

typedef edmNew::DetSetVector< SiStripClusteroutput_t
 

Public Member Functions

std::vector< uint32_t > const & allDetIds () const
 
SiStripDetCabling const * cabling () const
 
void clusterize (const edm::DetSetVector< SiStripDigi > &, output_t &) const
 
void clusterize (const edmNew::DetSetVector< SiStripDigi > &, output_t &) const
 
virtual void clusterizeDetUnit (const edm::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const =0
 
virtual void clusterizeDetUnit (const edmNew::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const =0
 
std::vector< const FedChannelConnection * > const & currentConnection (const Det &det) const
 
virtual void initialize (const edm::EventSetup &)
 
virtual void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, output_t::TSFastFiller &out) const
 
virtual void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, std::vector< SiStripCluster > &out) const
 
virtual Det stripByStripBegin (uint32_t id) const =0
 
virtual void stripByStripEnd (State &state, output_t::TSFastFiller &out) const
 
virtual void stripByStripEnd (State &state, std::vector< SiStripCluster > &out) const
 
virtual ~StripClusterizerAlgorithm ()
 

Static Public Attributes

static constexpr unsigned short invalidI = std::numeric_limits<unsigned short>::max()
 

Protected Member Functions

Det findDetId (const uint32_t) const
 
bool isModuleBad (const uint32_t &id) const
 
bool isModuleUsable (const uint32_t &id) const
 
 StripClusterizerAlgorithm ()
 

Protected Attributes

std::string qualityLabel
 

Private Member Functions

template<class T >
void clusterize_ (const T &input, output_t &output) const
 

Private Attributes

std::vector< std::vector< const FedChannelConnection * > > connections
 
std::vector< uint32_t > detIds
 
uint32_t gain_cache_id
 
edm::ESHandle< SiStripGaingainHandle
 
std::vector< Indexindices
 
uint32_t noise_cache_id
 
edm::ESHandle< SiStripNoisesnoiseHandle
 
uint32_t quality_cache_id
 
edm::ESHandle< SiStripQualityqualityHandle
 
SiStripDetCabling const * theCabling = nullptr
 

Detailed Description

Definition at line 20 of file StripClusterizerAlgorithm.h.

Member Typedef Documentation

◆ output_t

Definition at line 60 of file StripClusterizerAlgorithm.h.

Constructor & Destructor Documentation

◆ ~StripClusterizerAlgorithm()

virtual StripClusterizerAlgorithm::~StripClusterizerAlgorithm ( )
inlinevirtual

Definition at line 56 of file StripClusterizerAlgorithm.h.

56 {}

◆ StripClusterizerAlgorithm()

StripClusterizerAlgorithm::StripClusterizerAlgorithm ( )
inlineprotected

Definition at line 88 of file StripClusterizerAlgorithm.h.

Member Function Documentation

◆ allDetIds()

std::vector<uint32_t> const& StripClusterizerAlgorithm::allDetIds ( ) const
inline

Definition at line 81 of file StripClusterizerAlgorithm.h.

81 { return detIds; }

References detIds.

◆ cabling()

SiStripDetCabling const* StripClusterizerAlgorithm::cabling ( ) const
inline

Definition at line 80 of file StripClusterizerAlgorithm.h.

80 { return theCabling; }

References theCabling.

Referenced by initialize().

◆ clusterize() [1/2]

void StripClusterizerAlgorithm::clusterize ( const edm::DetSetVector< SiStripDigi > &  input,
output_t output 
) const

Definition at line 196 of file StripClusterizerAlgorithm.cc.

196  {
198 }

References clusterize_(), input, and convertSQLitetoXML_cfg::output.

◆ clusterize() [2/2]

void StripClusterizerAlgorithm::clusterize ( const edmNew::DetSetVector< SiStripDigi > &  input,
output_t output 
) const

Definition at line 199 of file StripClusterizerAlgorithm.cc.

199  {
201 }

References clusterize_(), input, and convertSQLitetoXML_cfg::output.

◆ clusterize_()

template<class T >
void StripClusterizerAlgorithm::clusterize_ ( const T input,
output_t output 
) const
inlineprivate

Definition at line 98 of file StripClusterizerAlgorithm.h.

98  {
99  for (typename T::const_iterator it = input.begin(); it != input.end(); it++) {
100  output_t::TSFastFiller ff(output, it->detId());
101  clusterizeDetUnit(*it, ff);
102  if (ff.empty())
103  ff.abort();
104  }
105  }

References clusterizeDetUnit(), alignCSCRings::ff, input, and convertSQLitetoXML_cfg::output.

Referenced by clusterize().

◆ clusterizeDetUnit() [1/2]

virtual void StripClusterizerAlgorithm::clusterizeDetUnit ( const edm::DetSet< SiStripDigi > &  ,
output_t::TSFastFiller  
) const
pure virtual

Implemented in ThreeThresholdAlgorithm.

Referenced by clusterize_().

◆ clusterizeDetUnit() [2/2]

virtual void StripClusterizerAlgorithm::clusterizeDetUnit ( const edmNew::DetSet< SiStripDigi > &  ,
output_t::TSFastFiller  
) const
pure virtual

Implemented in ThreeThresholdAlgorithm.

◆ currentConnection()

std::vector<const FedChannelConnection*> const& StripClusterizerAlgorithm::currentConnection ( const Det det) const
inline

Definition at line 83 of file StripClusterizerAlgorithm.h.

83  {
84  return connections[det.ind];
85  }

References connections, and StripClusterizerAlgorithm::Det::ind.

◆ findDetId()

StripClusterizerAlgorithm::Det StripClusterizerAlgorithm::findDetId ( const uint32_t  id) const
protected

Definition at line 161 of file StripClusterizerAlgorithm.cc.

161  {
162  auto b = detIds.begin();
163  auto e = detIds.end();
164  auto p = std::lower_bound(b, e, id);
165  if (p == e || id != (*p)) {
166 #ifdef NOT_ON_MONTECARLO
167  edm::LogWarning("StripClusterizerAlgorithm") << "id " << id << " not connected. this is impossible on data "
168  << "old id " << detId << std::endl;
169 #endif
170  return Det();
171  }
172  Det det;
173  det.ind = p - detIds.begin();
174 
175  det.detId = id;
176  det.noiseRange = noiseHandle->getRangeByPos(indices[det.ind].ni);
177  det.gainRange = gainHandle->getRangeByPos(indices[det.ind].gi);
178  det.qualityRange = qualityHandle->getRangeByPos(indices[det.ind].qi);
179  det.quality = qualityHandle.product();
180 
181 #ifdef EDM_ML_DEBUG
182  assert(detIds[det.ind] == det.detId);
183  auto oldg = gainHandle->getRange(id);
184  assert(oldg == det.gainRange);
185  auto oldn = noiseHandle->getRange(id);
186  assert(oldn == det.noiseRange);
187  auto oldq = qualityHandle->getRange(id);
188  assert(oldq == det.qualityRange);
189 #endif
190 #ifdef EDM_ML_DEBUG
191  assert(isModuleUsable(id));
192 #endif
193  return det;
194 }

References cms::cuda::assert(), b, StripClusterizerAlgorithm::Det::detId, detIds, MillePedeFileConverter_cfg::e, gainHandle, StripClusterizerAlgorithm::Det::gainRange, SiStripNoises::getRange(), SiStripBadStrip::getRange(), SiStripGain::getRange(), SiStripNoises::getRangeByPos(), SiStripBadStrip::getRangeByPos(), SiStripGain::getRangeByPos(), triggerObjects_cff::id, StripClusterizerAlgorithm::Det::ind, indices, isModuleUsable(), cuda_std::lower_bound(), noiseHandle, StripClusterizerAlgorithm::Det::noiseRange, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), StripClusterizerAlgorithm::Det::quality, qualityHandle, and StripClusterizerAlgorithm::Det::qualityRange.

Referenced by ThreeThresholdAlgorithm::clusterizeDetUnit_(), and ThreeThresholdAlgorithm::stripByStripBegin().

◆ initialize()

void StripClusterizerAlgorithm::initialize ( const edm::EventSetup es)
virtual

Definition at line 24 of file StripClusterizerAlgorithm.cc.

24  {
25  uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier();
26  uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier();
27  uint32_t q_cache_id = es.get<SiStripQualityRcd>().cacheIdentifier();
28 
29  bool mod = false;
30  if (g_cache_id != gain_cache_id) {
32  gain_cache_id = g_cache_id;
33  mod = true;
34  }
35  if (n_cache_id != noise_cache_id) {
37  noise_cache_id = n_cache_id;
38  mod = true;
39  }
40  if (q_cache_id != quality_cache_id) {
42  quality_cache_id = q_cache_id;
43  mod = true;
44  }
45 
46  if (mod) {
47  // redo indexing!
50  auto const& conn = cabling()->connected();
51  COUT << "cabling " << conn.size() << std::endl;
52  detIds.clear();
53  detIds.reserve(conn.size());
54  for (auto const& c : conn) {
55  if (!isModuleBad(c.first))
56  detIds.push_back(c.first);
57  }
58  indices.clear();
59  indices.resize(detIds.size());
60  COUT << "good detIds " << detIds.size() << std::endl;
61 
62  if (detIds.empty())
63  return;
64 
65  {
66  connections.clear();
67  connections.resize(detIds.size());
68  //connections (slow, not a big deal)
69  auto const& conns = cabling()->getDetCabling();
70  for (auto i = 0U; i < detIds.size(); ++i) {
71  auto c = conns.find(detIds[i]);
72  if (c != conns.end())
73  connections[i] = (*c).second;
74  }
75  }
76 
77  { // quality
78  std::vector<uint32_t> dum;
80  assert(dum.size() < invalidI);
81  unsigned short j = 0, i = 0;
82  while (i < dum.size() && j < detIds.size()) {
83  if (dum[i] < detIds[j])
84  ++i;
85  else if (detIds[j] < dum[i]) {
86  indices[j].qi = invalidI;
87  ++j;
88  } else {
89  indices[j].qi = i;
90  ++i;
91  ++j;
92  }
93  }
94  unsigned int nn = 0;
95  for (auto k = 0U; k < detIds.size(); ++k) {
96  if (indices[k].qi < invalidI) {
97  ++nn;
98  assert(dum[indices[k].qi] == detIds[k]);
99  }
100  }
101  assert(nn <= dum.size());
102  COUT << "quality " << dum.size() << " " << nn << std::endl;
103  }
104  { //noise
105  std::vector<uint32_t> dum;
106  noiseHandle->getDetIds(dum);
107  assert(dum.size() < invalidI);
108  unsigned short j = 0, i = 0;
109  while (i < dum.size() && j < detIds.size()) {
110  if (dum[i] < detIds[j])
111  ++i;
112  else if (detIds[j] < dum[i]) {
113  indices[j].ni = invalidI;
114  ++j;
115  } else {
116  indices[j].ni = i;
117  ++i;
118  ++j;
119  }
120  }
121  unsigned int nn = 0;
122  for (auto k = 0U; k < detIds.size(); ++k) {
123  if (indices[k].ni < invalidI) {
124  ++nn;
125  assert(dum[indices[k].ni] == detIds[k]);
126  }
127  }
128  assert(nn <= dum.size());
129  COUT << "noise " << dum.size() << " " << nn << std::endl;
130  }
131  { //gain
132  std::vector<uint32_t> dum;
133  gainHandle->getDetIds(dum);
134  assert(dum.size() < invalidI);
135  unsigned short j = 0, i = 0;
136  while (i < dum.size() && j < detIds.size()) {
137  if (dum[i] < detIds[j])
138  ++i;
139  else if (detIds[j] < dum[i]) {
140  indices[j].gi = invalidI;
141  ++j;
142  } else {
143  indices[j].gi = i;
144  ++i;
145  ++j;
146  }
147  }
148  unsigned int nn = 0;
149  for (auto k = 0U; k < detIds.size(); ++k) {
150  if (indices[k].gi < invalidI) {
151  ++nn;
152  assert(dum[indices[k].gi] == detIds[k]);
153  }
154  }
155  assert(nn <= dum.size());
156  COUT << "gain " << dum.size() << " " << nn << std::endl;
157  }
158  }
159 }

References cms::cuda::assert(), HltBtagPostValidation_cff::c, cabling(), SiStripQuality::cabling(), SiStripCommissioningClient_cfg::conn, SiStripDetCabling::connected(), connections, COUT, detIds, gain_cache_id, gainHandle, edm::EventSetup::get(), get, SiStripDetCabling::getDetCabling(), SiStripNoises::getDetIds(), SiStripBadStrip::getDetIds(), SiStripGain::getDetIds(), mps_fire::i, indices, invalidI, isModuleBad(), dqmiolumiharvest::j, dqmdumpme::k, mod(), groupFilesInBlocks::nn, noise_cache_id, noiseHandle, quality_cache_id, qualityHandle, qualityLabel, theCabling, and mitigatedMETSequence_cff::U.

◆ isModuleBad()

bool StripClusterizerAlgorithm::isModuleBad ( const uint32_t &  id) const
inlineprotected

◆ isModuleUsable()

bool StripClusterizerAlgorithm::isModuleUsable ( const uint32_t &  id) const
inlineprotected

◆ stripByStripAdd() [1/2]

virtual void StripClusterizerAlgorithm::stripByStripAdd ( State state,
uint16_t  strip,
uint8_t  adc,
output_t::TSFastFiller out 
) const
inlinevirtual

Reimplemented in ThreeThresholdAlgorithm.

Definition at line 72 of file StripClusterizerAlgorithm.h.

72 {}

◆ stripByStripAdd() [2/2]

virtual void StripClusterizerAlgorithm::stripByStripAdd ( State state,
uint16_t  strip,
uint8_t  adc,
std::vector< SiStripCluster > &  out 
) const
inlinevirtual

Reimplemented in ThreeThresholdAlgorithm.

Definition at line 69 of file StripClusterizerAlgorithm.h.

69 {}

◆ stripByStripBegin()

virtual Det StripClusterizerAlgorithm::stripByStripBegin ( uint32_t  id) const
pure virtual

Implemented in ThreeThresholdAlgorithm.

◆ stripByStripEnd() [1/2]

virtual void StripClusterizerAlgorithm::stripByStripEnd ( State state,
output_t::TSFastFiller out 
) const
inlinevirtual

Reimplemented in ThreeThresholdAlgorithm.

Definition at line 73 of file StripClusterizerAlgorithm.h.

73 {}

◆ stripByStripEnd() [2/2]

virtual void StripClusterizerAlgorithm::stripByStripEnd ( State state,
std::vector< SiStripCluster > &  out 
) const
inlinevirtual

Reimplemented in ThreeThresholdAlgorithm.

Definition at line 70 of file StripClusterizerAlgorithm.h.

70 {}

Member Data Documentation

◆ connections

std::vector<std::vector<const FedChannelConnection*> > StripClusterizerAlgorithm::connections
private

Definition at line 111 of file StripClusterizerAlgorithm.h.

Referenced by currentConnection(), and initialize().

◆ detIds

std::vector<uint32_t> StripClusterizerAlgorithm::detIds
private

Definition at line 110 of file StripClusterizerAlgorithm.h.

Referenced by allDetIds(), findDetId(), and initialize().

◆ gain_cache_id

uint32_t StripClusterizerAlgorithm::gain_cache_id
private

Definition at line 117 of file StripClusterizerAlgorithm.h.

Referenced by initialize().

◆ gainHandle

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

Definition at line 113 of file StripClusterizerAlgorithm.h.

Referenced by findDetId(), and initialize().

◆ indices

std::vector<Index> StripClusterizerAlgorithm::indices
private

Definition at line 112 of file StripClusterizerAlgorithm.h.

Referenced by findDetId(), and initialize().

◆ invalidI

constexpr unsigned short StripClusterizerAlgorithm::invalidI = std::numeric_limits<unsigned short>::max()
staticconstexpr

◆ noise_cache_id

uint32_t StripClusterizerAlgorithm::noise_cache_id
private

Definition at line 117 of file StripClusterizerAlgorithm.h.

Referenced by initialize().

◆ noiseHandle

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

Definition at line 114 of file StripClusterizerAlgorithm.h.

Referenced by findDetId(), and initialize().

◆ quality_cache_id

uint32_t StripClusterizerAlgorithm::quality_cache_id
private

Definition at line 117 of file StripClusterizerAlgorithm.h.

Referenced by initialize().

◆ qualityHandle

edm::ESHandle<SiStripQuality> StripClusterizerAlgorithm::qualityHandle
private

Definition at line 115 of file StripClusterizerAlgorithm.h.

Referenced by findDetId(), initialize(), isModuleBad(), and isModuleUsable().

◆ qualityLabel

std::string StripClusterizerAlgorithm::qualityLabel
protected

◆ theCabling

SiStripDetCabling const* StripClusterizerAlgorithm::theCabling = nullptr
private

Definition at line 116 of file StripClusterizerAlgorithm.h.

Referenced by cabling(), and initialize().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
StripClusterizerAlgorithm::cabling
SiStripDetCabling const * cabling() const
Definition: StripClusterizerAlgorithm.h:80
SiStripBadStrip::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripBadStrip.cc:27
StripClusterizerAlgorithm::qualityLabel
std::string qualityLabel
Definition: StripClusterizerAlgorithm.h:94
SiStripDetCabling::getDetCabling
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
Definition: SiStripDetCabling.h:33
StripClusterizerAlgorithm::clusterize_
void clusterize_(const T &input, output_t &output) const
Definition: StripClusterizerAlgorithm.h:98
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
StripClusterizerAlgorithm::connections
std::vector< std::vector< const FedChannelConnection * > > connections
Definition: StripClusterizerAlgorithm.h:111
SiStripQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiStripQuality.cc:604
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
cms::cuda::assert
assert(be >=bs)
StripClusterizerAlgorithm::gain_cache_id
uint32_t gain_cache_id
Definition: StripClusterizerAlgorithm.h:117
StripClusterizerAlgorithm::quality_cache_id
uint32_t quality_cache_id
Definition: StripClusterizerAlgorithm.h:117
SiStripQuality::IsModuleUsable
bool IsModuleUsable(const uint32_t &detid) const
Definition: SiStripQuality.cc:590
StripClusterizerAlgorithm::noise_cache_id
uint32_t noise_cache_id
Definition: StripClusterizerAlgorithm.h:117
SiStripNoises::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripNoises.cc:34
SiStripNoises::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripNoises.cc:58
SiStripNoisesRcd
Definition: SiStripCondDataRecords.h:40
StripClusterizerAlgorithm::qualityHandle
edm::ESHandle< SiStripQuality > qualityHandle
Definition: StripClusterizerAlgorithm.h:115
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
SiStripDetCabling::connected
const std::map< uint32_t, std::vector< int > > & connected() const
Definition: SiStripDetCabling.h:89
SiStripGain::getRangeByPos
SiStripApvGain::Range getRangeByPos(unsigned short pos) const
Definition: SiStripGain.h:72
alignCSCRings.ff
ff
Definition: alignCSCRings.py:148
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
SiStripQualityRcd
Definition: SiStripDependentRecords.h:56
SiStripGain::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
ATTENTION: we assume the detIds are the same as those from the first gain.
Definition: SiStripGain.cc:102
dqmdumpme.k
k
Definition: dqmdumpme.py:60
b
double b
Definition: hdecay.h:118
StripClusterizerAlgorithm::indices
std::vector< Index > indices
Definition: StripClusterizerAlgorithm.h:112
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::LogWarning
Definition: MessageLogger.h:141
SiStripNoises::getRangeByPos
Range getRangeByPos(unsigned short pos) const
Definition: SiStripNoises.cc:48
StripClusterizerAlgorithm::noiseHandle
edm::ESHandle< SiStripNoises > noiseHandle
Definition: StripClusterizerAlgorithm.h:114
StripClusterizerAlgorithm::clusterizeDetUnit
virtual void clusterizeDetUnit(const edm::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const =0
StripClusterizerAlgorithm::theCabling
SiStripDetCabling const * theCabling
Definition: StripClusterizerAlgorithm.h:116
StripClusterizerAlgorithm::invalidI
static constexpr unsigned short invalidI
Definition: StripClusterizerAlgorithm.h:22
SiStripBadStrip::getRangeByPos
Range getRangeByPos(unsigned short pos) const
Definition: SiStripBadStrip.cc:41
SiStripBadStrip::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripBadStrip.cc:51
StripClusterizerAlgorithm::detIds
std::vector< uint32_t > detIds
Definition: StripClusterizerAlgorithm.h:110
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
Det
GeometricSearchDet Det
Definition: DetBelowR.h:8
groupFilesInBlocks.nn
nn
Definition: groupFilesInBlocks.py:150
edmNew::DetSetVector::TSFastFiller
friend class TSFastFiller
Definition: DetSetVectorNew.h:411
StripClusterizerAlgorithm::isModuleBad
bool isModuleBad(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:91
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
StripClusterizerAlgorithm::isModuleUsable
bool isModuleUsable(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:92
GeometricSearchDet
Definition: GeometricSearchDet.h:17
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
StripClusterizerAlgorithm::gainHandle
edm::ESHandle< SiStripGain > gainHandle
Definition: StripClusterizerAlgorithm.h:113
SiStripQuality::cabling
const SiStripDetCabling * cabling() const
Definition: SiStripQuality.h:126
COUT
#define COUT
Definition: StripClusterizerAlgorithm.cc:17
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37