CMS 3D CMS Logo

StripClusterizerAlgorithm.h
Go to the documentation of this file.
1 #ifndef RecoLocalTracker_StripClusterizerAlgorithm_h
2 #define RecoLocalTracker_StripClusterizerAlgorithm_h
3 
4 namespace edm {
5  class EventSetup;
6 }
7 class SiStripDigi;
16 #include <limits>
17 
19 
21 public:
22  static constexpr unsigned short invalidI = std::numeric_limits<unsigned short>::max();
23 
24  // state of detID
25  struct Det {
26  bool valid() const { return ind != invalidI; }
27  float noise(const uint16_t& strip) const { return SiStripNoises::getNoise(strip, noiseRange); }
28  float gain(const uint16_t& strip) const { return SiStripGain::getStripGain(strip, gainRange); }
29  bool bad(const uint16_t& strip) const { return quality->IsStripBad(qualityRange, strip); }
30  bool allBadBetween(uint16_t L, const uint16_t& R) const {
31  while (++L < R && bad(L)) {
32  };
33  return L == R;
34  }
39  uint32_t detId = 0;
40  unsigned short ind = invalidI;
41  };
42 
43  //state of the candidate cluster
44  struct State {
45  State(Det const& idet) : m_det(idet) { ADCs.reserve(128); }
46  Det const& det() const { return m_det; }
47  std::vector<uint8_t> ADCs;
48  uint16_t lastStrip = 0;
49  float noiseSquared = 0;
50  bool candidateLacksSeed = true;
51 
52  private:
53  Det const& m_det;
54  };
55 
57  virtual void initialize(const edm::EventSetup&);
58 
59  //Offline DetSet interface
63  virtual void clusterizeDetUnit(const edm::DetSet<SiStripDigi>&, output_t::TSFastFiller&) const = 0;
65 
66  //HLT stripByStrip interface
67  virtual Det stripByStripBegin(uint32_t id) const = 0;
68 
69  virtual void stripByStripAdd(State& state, uint16_t strip, uint8_t adc, std::vector<SiStripCluster>& out) const {}
70  virtual void stripByStripEnd(State& state, std::vector<SiStripCluster>& out) const {}
71 
72  virtual void stripByStripAdd(State& state, uint16_t strip, uint8_t adc, output_t::TSFastFiller& out) const {}
73  virtual void stripByStripEnd(State& state, output_t::TSFastFiller& out) const {}
74 
76  public:
78  };
79 
80  SiStripDetCabling const* cabling() const { return theCabling; }
81  std::vector<uint32_t> const& allDetIds() const { return detIds; }
82 
83  std::vector<const FedChannelConnection*> const& currentConnection(const Det& det) const {
84  return connections[det.ind];
85  }
86 
87 protected:
89 
90  Det findDetId(const uint32_t) const;
91  bool isModuleBad(const uint32_t& id) const { return qualityHandle->IsModuleBad(id); }
92  bool isModuleUsable(const uint32_t& id) const { return qualityHandle->IsModuleUsable(id); }
93 
95 
96 private:
97  template <class T>
98  void clusterize_(const T& input, output_t& output) const {
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  }
106 
107  struct Index {
108  unsigned short gi = invalidI, ni = invalidI, qi = invalidI;
109  };
110  std::vector<uint32_t> detIds; // from cabling (connected and not bad)
111  std::vector<std::vector<const FedChannelConnection*> > connections;
112  std::vector<Index> indices;
116  SiStripDetCabling const* theCabling = nullptr;
118 };
119 #endif
edm::DetSetVector< SiStripDigi >
StripClusterizerAlgorithm
Definition: StripClusterizerAlgorithm.h:20
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
dttmaxenums::L
Definition: DTTMax.h:29
input
static const std::string input
Definition: EdmProvDump.cc:48
StripClusterizerAlgorithm::State::candidateLacksSeed
bool candidateLacksSeed
Definition: StripClusterizerAlgorithm.h:50
StripClusterizerAlgorithm::cabling
SiStripDetCabling const * cabling() const
Definition: StripClusterizerAlgorithm.h:80
StripClusterizerAlgorithm::qualityLabel
std::string qualityLabel
Definition: StripClusterizerAlgorithm.h:94
ESHandle.h
StripClusterizerAlgorithm::clusterize_
void clusterize_(const T &input, output_t &output) const
Definition: StripClusterizerAlgorithm.h:98
StripClusterizerAlgorithm::State::det
Det const & det() const
Definition: StripClusterizerAlgorithm.h:46
SiStripGain.h
edm::DetSet< SiStripDigi >
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
StripClusterizerAlgorithm::Index::gi
unsigned short gi
Definition: StripClusterizerAlgorithm.h:108
StripClusterizerAlgorithm::connections
std::vector< std::vector< const FedChannelConnection * > > connections
Definition: StripClusterizerAlgorithm.h:111
edm
HLT enums.
Definition: AlignableModifier.h:19
StripClusterizerAlgorithm::StripClusterizerAlgorithm
StripClusterizerAlgorithm()
Definition: StripClusterizerAlgorithm.h:88
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
SiStripQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiStripQuality.cc:604
StripClusterizerAlgorithm::State::State
State(Det const &idet)
Definition: StripClusterizerAlgorithm.h:45
edmNew::DetSetVector::TSFastFiller
Definition: DetSetVectorNew.h:334
StripClusterizerAlgorithm::Det::allBadBetween
bool allBadBetween(uint16_t L, const uint16_t &R) const
Definition: StripClusterizerAlgorithm.h:30
StripClusterizerAlgorithm::stripByStripBegin
virtual Det stripByStripBegin(uint32_t id) const =0
StripClusterizerAlgorithm::stripByStripEnd
virtual void stripByStripEnd(State &state, output_t::TSFastFiller &out) const
Definition: StripClusterizerAlgorithm.h:73
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
SiStripNoises.h
StripClusterizerAlgorithm::noise_cache_id
uint32_t noise_cache_id
Definition: StripClusterizerAlgorithm.h:117
StripClusterizerAlgorithm::State::m_det
Det const & m_det
Definition: StripClusterizerAlgorithm.h:53
StripClusterizerAlgorithm::State::lastStrip
uint16_t lastStrip
Definition: StripClusterizerAlgorithm.h:48
StripClusterizerAlgorithm::Det::noiseRange
SiStripNoises::Range noiseRange
Definition: StripClusterizerAlgorithm.h:37
SiStripGain::getStripGain
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
StripClusterizerAlgorithm::Det::quality
SiStripQuality const * quality
Definition: StripClusterizerAlgorithm.h:35
StripClusterizerAlgorithm::State
Definition: StripClusterizerAlgorithm.h:44
StripClusterizerAlgorithm::output_t
edmNew::DetSetVector< SiStripCluster > output_t
Definition: StripClusterizerAlgorithm.h:60
StripClusterizerAlgorithm::qualityHandle
edm::ESHandle< SiStripQuality > qualityHandle
Definition: StripClusterizerAlgorithm.h:115
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
StripClusterizerAlgorithm::State::ADCs
std::vector< uint8_t > ADCs
Definition: StripClusterizerAlgorithm.h:47
SiStripFEDBuffer.h
StripClusterizerAlgorithm::State::noiseSquared
float noiseSquared
Definition: StripClusterizerAlgorithm.h:49
alignCSCRings.ff
ff
Definition: alignCSCRings.py:148
SiStripNoises::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
StripClusterizerAlgorithm::Det
Definition: StripClusterizerAlgorithm.h:25
SiStripDetCabling
Definition: SiStripDetCabling.h:21
edm::ESHandle< SiStripGain >
edmNew::DetSet
Definition: DetSetNew.h:22
StripClusterizerAlgorithm::Det::gainRange
SiStripApvGain::Range gainRange
Definition: StripClusterizerAlgorithm.h:36
StripClusterizerAlgorithm::Det::ind
unsigned short ind
Definition: StripClusterizerAlgorithm.h:40
StripClusterizerAlgorithm::indices
std::vector< Index > indices
Definition: StripClusterizerAlgorithm.h:112
SiStripQuality::IsStripBad
bool IsStripBad(const uint32_t &detid, const short &strip) const
Definition: SiStripQuality.cc:628
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
StripClusterizerAlgorithm::Index::qi
unsigned short qi
Definition: StripClusterizerAlgorithm.h:108
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
StripClusterizerAlgorithm::findDetId
Det findDetId(const uint32_t) const
Definition: StripClusterizerAlgorithm.cc:161
SiStripCluster.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
StripClusterizerAlgorithm::clusterize
void clusterize(const edm::DetSetVector< SiStripDigi > &, output_t &) const
Definition: StripClusterizerAlgorithm.cc:196
StripClusterizerAlgorithm::Det::gain
float gain(const uint16_t &strip) const
Definition: StripClusterizerAlgorithm.h:28
StripClusterizerAlgorithm::Det::detId
uint32_t detId
Definition: StripClusterizerAlgorithm.h:39
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::currentConnection
std::vector< const FedChannelConnection * > const & currentConnection(const Det &det) const
Definition: StripClusterizerAlgorithm.h:83
StripClusterizerAlgorithm::InvalidChargeException
Definition: StripClusterizerAlgorithm.h:75
StripClusterizerAlgorithm::invalidI
static constexpr unsigned short invalidI
Definition: StripClusterizerAlgorithm.h:22
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
StripClusterizerAlgorithm::allDetIds
std::vector< uint32_t > const & allDetIds() const
Definition: StripClusterizerAlgorithm.h:81
StripClusterizerAlgorithm::detIds
std::vector< uint32_t > detIds
Definition: StripClusterizerAlgorithm.h:110
StripClusterizerAlgorithm::Index
Definition: StripClusterizerAlgorithm.h:107
StripClusterizerAlgorithm::initialize
virtual void initialize(const edm::EventSetup &)
Definition: StripClusterizerAlgorithm.cc:24
edmNew::DetSetVector
Definition: DetSetNew.h:13
StripClusterizerAlgorithm::stripByStripAdd
virtual void stripByStripAdd(State &state, uint16_t strip, uint8_t adc, std::vector< SiStripCluster > &out) const
Definition: StripClusterizerAlgorithm.h:69
StripClusterizerAlgorithm::Det::bad
bool bad(const uint16_t &strip) const
Definition: StripClusterizerAlgorithm.h:29
StripClusterizerAlgorithm::isModuleBad
bool isModuleBad(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:91
StripClusterizerAlgorithm::Det::noise
float noise(const uint16_t &strip) const
Definition: StripClusterizerAlgorithm.h:27
T
long double T
Definition: Basic3DVectorLD.h:48
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripQuality.h
StripClusterizerAlgorithm::isModuleUsable
bool isModuleUsable(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:92
StripClusterizerAlgorithm::~StripClusterizerAlgorithm
virtual ~StripClusterizerAlgorithm()
Definition: StripClusterizerAlgorithm.h:56
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
cms::Exception
Definition: Exception.h:70
EventSetup
GeometricSearchDet
Definition: GeometricSearchDet.h:17
StripClusterizerAlgorithm::stripByStripEnd
virtual void stripByStripEnd(State &state, std::vector< SiStripCluster > &out) const
Definition: StripClusterizerAlgorithm.h:70
StripClusterizerAlgorithm::stripByStripAdd
virtual void stripByStripAdd(State &state, uint16_t strip, uint8_t adc, output_t::TSFastFiller &out) const
Definition: StripClusterizerAlgorithm.h:72
SiStripNoises::getNoise
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
dttmaxenums::R
Definition: DTTMax.h:29
StripClusterizerAlgorithm::Index::ni
unsigned short ni
Definition: StripClusterizerAlgorithm.h:108
StripClusterizerAlgorithm::gainHandle
edm::ESHandle< SiStripGain > gainHandle
Definition: StripClusterizerAlgorithm.h:113
DetSetVectorNew.h
StripClusterizerAlgorithm::Det::valid
bool valid() const
Definition: StripClusterizerAlgorithm.h:26
StripClusterizerAlgorithm::Det::qualityRange
SiStripQuality::Range qualityRange
Definition: StripClusterizerAlgorithm.h:38
StripClusterizerAlgorithm::InvalidChargeException::InvalidChargeException
InvalidChargeException(const SiStripDigi &)
Definition: StripClusterizerAlgorithm.cc:203
SiStripQuality
Definition: SiStripQuality.h:32