CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
ThreeThresholdAlgorithm Class Referencefinal

#include <ThreeThresholdAlgorithm.h>

Inheritance diagram for ThreeThresholdAlgorithm:
StripClusterizerAlgorithm

Public Types

using Det = StripClusterizerAlgorithm::Det
 
using State = StripClusterizerAlgorithm::State
 
- Public Types inherited from StripClusterizerAlgorithm
using Det = SiStripClusterizerConditions::Det
 
typedef edmNew::DetSetVector
< SiStripCluster
output_t
 

Public Member Functions

void clusterizeDetUnit (const edm::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const override
 
void clusterizeDetUnit (const edmNew::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const override
 
template<class digiDetSet >
void clusterizeDetUnit_ (const digiDetSet &digis, output_t::TSFastFiller &output) const
 
void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, std::vector< SiStripCluster > &out) const override
 
void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, output_t::TSFastFiller &out) const override
 
void stripByStripEnd (State &state, std::vector< SiStripCluster > &out) const override
 
void stripByStripEnd (State &state, output_t::TSFastFiller &out) const override
 
- Public Member Functions inherited from StripClusterizerAlgorithm
void clusterize (const edm::DetSetVector< SiStripDigi > &, output_t &) const
 
void clusterize (const edmNew::DetSetVector< SiStripDigi > &, output_t &) const
 
const
SiStripClusterizerConditions
conditions () const
 
void initialize (const edm::EventSetup &es)
 
Det const & stripByStripBegin (uint32_t id) const
 
virtual ~StripClusterizerAlgorithm ()
 

Private Member Functions

void addToCandidate (State &state, const SiStripDigi &digi) const
 
void addToCandidate (State &state, uint16_t strip, uint8_t adc) const
 
void appendBadNeighbors (State &state) const
 
void applyGains (State &state) const
 
bool candidateAccepted (State const &state) const
 
bool candidateEnded (State const &state, const uint16_t &) const
 
void clearCandidate (State &state) const
 
template<class T >
void clusterizeDetUnit_ (const T &, output_t::TSFastFiller &) const
 
template<class T >
void endCandidate (State &state, T &) const
 
uint16_t firstStrip (State const &state) const
 
 ThreeThresholdAlgorithm (const edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > &, float, float, float, unsigned, unsigned, unsigned, bool removeApvShots, float minGoodCharge)
 

Private Attributes

float ChannelThreshold
 
float ClusterThresholdSquared
 
uint8_t MaxAdjacentBad
 
uint8_t MaxSequentialBad
 
uint8_t MaxSequentialHoles
 
float minGoodCharge
 
bool RemoveApvShots
 
float SeedThreshold
 

Friends

class StripClusterizerAlgorithmFactory
 

Additional Inherited Members

- Protected Member Functions inherited from StripClusterizerAlgorithm
 StripClusterizerAlgorithm (const edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > &conditionsToken)
 

Detailed Description

Definition at line 6 of file ThreeThresholdAlgorithm.h.

Member Typedef Documentation

Definition at line 11 of file ThreeThresholdAlgorithm.h.

Definition at line 10 of file ThreeThresholdAlgorithm.h.

Constructor & Destructor Documentation

ThreeThresholdAlgorithm::ThreeThresholdAlgorithm ( const edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > &  conditionsToken,
float  chan,
float  seed,
float  cluster,
unsigned  holes,
unsigned  bad,
unsigned  adj,
bool  removeApvShots,
float  minGoodCharge 
)
private

Definition at line 10 of file ThreeThresholdAlgorithm.cc.

20  : StripClusterizerAlgorithm(conditionsToken),
23  ClusterThresholdSquared(cluster * cluster),
24  MaxSequentialHoles(holes),
25  MaxSequentialBad(bad),
26  MaxAdjacentBad(adj),
27  RemoveApvShots(removeApvShots),
tuple chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, &quot;NDC&quot;) lumi.SetBorderSize( 0 ) lumi...
StripClusterizerAlgorithm(const edm::ESGetToken< SiStripClusterizerConditions, SiStripClusterizerConditionsRcd > &conditionsToken)

Member Function Documentation

void ThreeThresholdAlgorithm::addToCandidate ( State state,
const SiStripDigi digi 
) const
inlineprivate

Definition at line 54 of file ThreeThresholdAlgorithm.h.

References SiStripDigi::adc(), addToCandidate(), and SiStripDigi::strip().

Referenced by addToCandidate(), clusterizeDetUnit_(), and stripByStripAdd().

54 { addToCandidate(state, digi.strip(), digi.adc()); }
const uint16_t & strip() const
Definition: SiStripDigi.h:33
void addToCandidate(State &state, const SiStripDigi &digi) const
const uint16_t & adc() const
Definition: SiStripDigi.h:34
void ThreeThresholdAlgorithm::addToCandidate ( State state,
uint16_t  strip,
uint8_t  adc 
) const
inlineprivate

Definition at line 71 of file ThreeThresholdAlgorithm.cc.

References StripClusterizerAlgorithm::State::ADCs, SiStripClusterizerConditions::Det::bad(), StripClusterizerAlgorithm::State::candidateLacksSeed, ChannelThreshold, StripClusterizerAlgorithm::State::det(), StripClusterizerAlgorithm::State::lastStrip, SiStripClusterizerConditions::Det::noise(), SiStripSimParameters_cfi::Noise, StripClusterizerAlgorithm::State::noiseSquared, SeedThreshold, and gpuVertexFinder::while().

71  {
72  float Noise = state.det().noise(strip);
73  if (adc < static_cast<uint8_t>(Noise * ChannelThreshold) || state.det().bad(strip))
74  return;
75 
76  if (state.candidateLacksSeed)
77  state.candidateLacksSeed = adc < static_cast<uint8_t>(Noise * SeedThreshold);
78  if (state.ADCs.empty())
79  state.lastStrip = strip - 1; // begin candidate
80  while (++state.lastStrip < strip)
81  state.ADCs.push_back(0); // pad holes
82 
83  state.ADCs.push_back(adc);
84  state.noiseSquared += Noise * Noise;
85 }
while(__syncthreads_or(more))
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void ThreeThresholdAlgorithm::appendBadNeighbors ( State state) const
inlineprivate

Definition at line 119 of file ThreeThresholdAlgorithm.cc.

References StripClusterizerAlgorithm::State::ADCs, SiStripClusterizerConditions::Det::bad(), StripClusterizerAlgorithm::State::det(), firstStrip(), StripClusterizerAlgorithm::State::lastStrip, SiStripPI::max, and MaxAdjacentBad.

Referenced by endCandidate().

119  {
120  uint8_t max = MaxAdjacentBad;
121  while (0 < max--) {
122  if (state.det().bad(firstStrip(state) - 1)) {
123  state.ADCs.insert(state.ADCs.begin(), 0);
124  }
125  if (state.det().bad(state.lastStrip + 1)) {
126  state.ADCs.push_back(0);
127  state.lastStrip++;
128  }
129  }
130 }
uint16_t firstStrip(State const &state) const
void ThreeThresholdAlgorithm::applyGains ( State state) const
inlineprivate

Definition at line 106 of file ThreeThresholdAlgorithm.cc.

References gpuClustering::adc, StripClusterizerAlgorithm::State::ADCs, RecoTauCleanerPlugins::charge, StripClusterizerAlgorithm::State::det(), firstStrip(), digitizers_cfi::strip, and SiStripClusterizerConditions::Det::weight().

Referenced by endCandidate().

106  {
107  uint16_t strip = firstStrip(state);
108  for (auto& adc : state.ADCs) {
109 #ifdef EDM_ML_DEBUG
110  // if(adc > 255) throw InvalidChargeException( SiStripDigi(strip,adc) );
111 #endif
112  // if(adc > 253) continue; //saturated, do not scale
113  auto charge = int(float(adc) * state.det().weight(strip++) + 0.5f); //adding 0.5 turns truncation into rounding
114  if (adc < 254)
115  adc = (charge > 1022 ? 255 : (charge > 253 ? 254 : charge));
116  }
117 }
uint16_t firstStrip(State const &state) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
bool ThreeThresholdAlgorithm::candidateAccepted ( State const &  state) const
inlineprivate

Definition at line 100 of file ThreeThresholdAlgorithm.cc.

References StripClusterizerAlgorithm::State::ADCs, StripClusterizerAlgorithm::State::candidateLacksSeed, ClusterThresholdSquared, StripClusterizerAlgorithm::State::noiseSquared, and funct::pow().

Referenced by endCandidate().

100  {
101  return (!state.candidateLacksSeed &&
102  state.noiseSquared * ClusterThresholdSquared <=
103  std::pow(float(std::accumulate(state.ADCs.begin(), state.ADCs.end(), int(0))), 2.f));
104 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
bool ThreeThresholdAlgorithm::candidateEnded ( State const &  state,
const uint16_t &  testStrip 
) const
inlineprivate

Definition at line 61 of file ThreeThresholdAlgorithm.cc.

References StripClusterizerAlgorithm::State::ADCs, SiStripClusterizerConditions::Det::allBadBetween(), StripClusterizerAlgorithm::State::det(), StripClusterizerAlgorithm::State::lastStrip, MaxSequentialBad, and MaxSequentialHoles.

Referenced by clusterizeDetUnit_(), and stripByStripAdd().

61  {
62  uint16_t holes = testStrip - state.lastStrip - 1;
63  return (((!state.ADCs.empty()) & // a candidate exists, and
64  (holes > MaxSequentialHoles) // too many holes if not all are bad strips, and
65  ) &&
66  (holes > MaxSequentialBad || // (too many bad strips anyway, or
67  !state.det().allBadBetween(state.lastStrip, testStrip) // not all holes are bad strips)
68  ));
69 }
void ThreeThresholdAlgorithm::clearCandidate ( State state) const
inlineprivate

Definition at line 49 of file ThreeThresholdAlgorithm.h.

References StripClusterizerAlgorithm::State::ADCs, StripClusterizerAlgorithm::State::candidateLacksSeed, and StripClusterizerAlgorithm::State::noiseSquared.

Referenced by endCandidate().

49  {
50  state.candidateLacksSeed = true;
51  state.noiseSquared = 0;
52  state.ADCs.clear();
53  }
void ThreeThresholdAlgorithm::clusterizeDetUnit ( const edm::DetSet< SiStripDigi > &  digis,
output_t::TSFastFiller output 
) const
overridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 132 of file ThreeThresholdAlgorithm.cc.

References clusterizeDetUnit_().

133  {
134  clusterizeDetUnit_(digis, output);
135 }
void clusterizeDetUnit_(const T &, output_t::TSFastFiller &) const
void ThreeThresholdAlgorithm::clusterizeDetUnit ( const edmNew::DetSet< SiStripDigi > &  digis,
output_t::TSFastFiller output 
) const
overridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 136 of file ThreeThresholdAlgorithm.cc.

References clusterizeDetUnit_().

137  {
138  clusterizeDetUnit_(digis, output);
139 }
void clusterizeDetUnit_(const T &, output_t::TSFastFiller &) const
template<class T >
void ThreeThresholdAlgorithm::clusterizeDetUnit_ ( const T ,
output_t::TSFastFiller  
) const
private

Referenced by clusterizeDetUnit().

template<class digiDetSet >
void ThreeThresholdAlgorithm::clusterizeDetUnit_ ( const digiDetSet &  digis,
output_t::TSFastFiller output 
) const
inline

Definition at line 31 of file ThreeThresholdAlgorithm.cc.

References addToCandidate(), candidateEnded(), SiStripApvShotCleaner::clean(), StripClusterizerAlgorithm::conditions(), dataset::end, endCandidate(), RemoveApvShots, and edmNew::DetSetVector< T >::TSFastFiller::reserve().

31  {
32  const auto& cond = conditions();
33  if (cond.isModuleBad(digis.detId()))
34  return;
35 
36  auto const& det = cond.findDetId(digis.detId());
37  if (!det.valid())
38  return;
39 
40 #ifdef EDM_ML_DEBUG
41  if (!cond.isModuleUsable(digis.detId()))
42  edm::LogWarning("ThreeThresholdAlgorithm") << " id " << digis.detId() << " not usable???" << std::endl;
43 #endif
44 
45  typename digiDetSet::const_iterator scan(digis.begin()), end(digis.end());
46 
47  SiStripApvShotCleaner ApvCleaner;
48  if (RemoveApvShots) {
49  ApvCleaner.clean(digis, scan, end);
50  }
51 
52  output.reserve(16);
53  State state(det);
54  while (scan != end) {
55  while (scan != end && !candidateEnded(state, scan->strip()))
56  addToCandidate(state, *scan++);
58  }
59 }
void endCandidate(State &state, T &) const
bool candidateEnded(State const &state, const uint16_t &) const
const SiStripClusterizerConditions & conditions() const
void addToCandidate(State &state, const SiStripDigi &digi) const
string end
Definition: dataset.py:937
bool clean(const edmNew::DetSet< SiStripDigi > &in, edmNew::DetSet< SiStripDigi >::const_iterator &scan, edmNew::DetSet< SiStripDigi >::const_iterator &end)
Log< level::Warning, false > LogWarning
template<class T >
void ThreeThresholdAlgorithm::endCandidate ( State state,
T out 
) const
inlineprivate

Definition at line 88 of file ThreeThresholdAlgorithm.cc.

References StripClusterizerAlgorithm::State::ADCs, appendBadNeighbors(), applyGains(), candidateAccepted(), siStripClusterTools::chargePerCM(), clearCandidate(), StripClusterizerAlgorithm::State::det(), SiStripClusterizerConditions::Det::detId, firstStrip(), MaxAdjacentBad, minGoodCharge, and eostools::move().

Referenced by clusterizeDetUnit_(), stripByStripAdd(), and stripByStripEnd().

88  {
89  if (candidateAccepted(state)) {
91  if (MaxAdjacentBad > 0)
93  if (minGoodCharge <= 0 ||
94  siStripClusterTools::chargePerCM(state.det().detId, state.ADCs.begin(), state.ADCs.end()) > minGoodCharge)
95  out.push_back(std::move(SiStripCluster(firstStrip(state), state.ADCs.begin(), state.ADCs.end())));
96  }
98 }
float chargePerCM(DetId detid, Iter a, Iter b)
bool candidateAccepted(State const &state) const
void clearCandidate(State &state) const
void appendBadNeighbors(State &state) const
def move
Definition: eostools.py:511
void applyGains(State &state) const
uint16_t firstStrip(State const &state) const
uint16_t ThreeThresholdAlgorithm::firstStrip ( State const &  state) const
inlineprivate
void ThreeThresholdAlgorithm::stripByStripAdd ( State state,
uint16_t  strip,
uint8_t  adc,
std::vector< SiStripCluster > &  out 
) const
overridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 141 of file ThreeThresholdAlgorithm.cc.

References addToCandidate(), candidateEnded(), and endCandidate().

144  {
145  if (candidateEnded(state, strip))
148 }
void endCandidate(State &state, T &) const
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
bool candidateEnded(State const &state, const uint16_t &) const
void addToCandidate(State &state, const SiStripDigi &digi) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void ThreeThresholdAlgorithm::stripByStripAdd ( State state,
uint16_t  strip,
uint8_t  adc,
output_t::TSFastFiller out 
) const
inlineoverridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 19 of file ThreeThresholdAlgorithm.h.

References addToCandidate(), candidateEnded(), and endCandidate().

19  {
23  }
void endCandidate(State &state, T &) const
bool candidateEnded(State const &state, const uint16_t &) const
void addToCandidate(State &state, const SiStripDigi &digi) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc
void ThreeThresholdAlgorithm::stripByStripEnd ( State state,
std::vector< SiStripCluster > &  out 
) const
overridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 150 of file ThreeThresholdAlgorithm.cc.

References endCandidate().

void ThreeThresholdAlgorithm::stripByStripEnd ( State state,
output_t::TSFastFiller out 
) const
inlineoverridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 25 of file ThreeThresholdAlgorithm.h.

References endCandidate().

Friends And Related Function Documentation

friend class StripClusterizerAlgorithmFactory
friend

Definition at line 7 of file ThreeThresholdAlgorithm.h.

Member Data Documentation

float ThreeThresholdAlgorithm::ChannelThreshold
private

Definition at line 59 of file ThreeThresholdAlgorithm.h.

Referenced by addToCandidate().

float ThreeThresholdAlgorithm::ClusterThresholdSquared
private

Definition at line 59 of file ThreeThresholdAlgorithm.h.

Referenced by candidateAccepted().

uint8_t ThreeThresholdAlgorithm::MaxAdjacentBad
private

Definition at line 60 of file ThreeThresholdAlgorithm.h.

Referenced by appendBadNeighbors(), and endCandidate().

uint8_t ThreeThresholdAlgorithm::MaxSequentialBad
private

Definition at line 60 of file ThreeThresholdAlgorithm.h.

Referenced by candidateEnded().

uint8_t ThreeThresholdAlgorithm::MaxSequentialHoles
private

Definition at line 60 of file ThreeThresholdAlgorithm.h.

Referenced by candidateEnded().

float ThreeThresholdAlgorithm::minGoodCharge
private

Definition at line 62 of file ThreeThresholdAlgorithm.h.

Referenced by endCandidate().

bool ThreeThresholdAlgorithm::RemoveApvShots
private

Definition at line 61 of file ThreeThresholdAlgorithm.h.

Referenced by clusterizeDetUnit_().

float ThreeThresholdAlgorithm::SeedThreshold
private

Definition at line 59 of file ThreeThresholdAlgorithm.h.

Referenced by addToCandidate().