CMS 3D CMS Logo

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
typedef edmNew::DetSetVector< SiStripClusteroutput_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
 
void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, output_t::TSFastFiller &out) const override
 
void stripByStripAdd (State &state, uint16_t strip, uint8_t adc, std::vector< SiStripCluster > &out) const override
 
Det stripByStripBegin (uint32_t id) const override
 
void stripByStripEnd (State &state, output_t::TSFastFiller &out) const override
 
void stripByStripEnd (State &state, std::vector< SiStripCluster > &out) const override
 
- Public Member Functions inherited from StripClusterizerAlgorithm
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
 
std::vector< const FedChannelConnection * > const & currentConnection (const Det &det) const
 
virtual void initialize (const edm::EventSetup &)
 
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 digiDetSet >
void clusterizeDetUnit_ (const digiDetSet &digis, output_t::TSFastFiller &output) 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 (float, float, float, unsigned, unsigned, unsigned, std::string qualityLabel, 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

- Static Public Attributes inherited from StripClusterizerAlgorithm
static constexpr unsigned short invalidI = std::numeric_limits<unsigned short>::max()
 
- Protected Member Functions inherited from StripClusterizerAlgorithm
Det findDetId (const uint32_t) const
 
bool isModuleBad (const uint32_t &id) const
 
bool isModuleUsable (const uint32_t &id) const
 
 StripClusterizerAlgorithm ()
 
- Protected Attributes inherited from StripClusterizerAlgorithm
std::string qualityLabel
 

Detailed Description

Definition at line 6 of file ThreeThresholdAlgorithm.h.

Member Typedef Documentation

◆ Det

Definition at line 11 of file ThreeThresholdAlgorithm.h.

◆ State

Definition at line 10 of file ThreeThresholdAlgorithm.h.

Constructor & Destructor Documentation

◆ ThreeThresholdAlgorithm()

ThreeThresholdAlgorithm::ThreeThresholdAlgorithm ( float  chan,
float  seed,
float  cluster,
unsigned  holes,
unsigned  bad,
unsigned  adj,
std::string  qualityLabel,
bool  removeApvShots,
float  minGoodCharge 
)
private

Definition at line 10 of file ThreeThresholdAlgorithm.cc.

21  ClusterThresholdSquared(cluster * cluster),
22  MaxSequentialHoles(holes),
23  MaxSequentialBad(bad),
24  MaxAdjacentBad(adj),
25  RemoveApvShots(removeApvShots),
27  qualityLabel = (qL);
28 }

References StripClusterizerAlgorithm::qualityLabel.

Member Function Documentation

◆ addToCandidate() [1/2]

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

Definition at line 56 of file ThreeThresholdAlgorithm.h.

56 { addToCandidate(state, digi.strip(), digi.adc()); }

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

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

◆ addToCandidate() [2/2]

void ThreeThresholdAlgorithm::addToCandidate ( State state,
uint16_t  strip,
uint8_t  adc 
) const
inlineprivate

Definition at line 69 of file ThreeThresholdAlgorithm.cc.

69  {
70  float Noise = state.det().noise(strip);
71  if (adc < static_cast<uint8_t>(Noise * ChannelThreshold) || state.det().bad(strip))
72  return;
73 
74  if (state.candidateLacksSeed)
75  state.candidateLacksSeed = adc < static_cast<uint8_t>(Noise * SeedThreshold);
76  if (state.ADCs.empty())
77  state.lastStrip = strip - 1; // begin candidate
78  while (++state.lastStrip < strip)
79  state.ADCs.push_back(0); // pad holes
80 
81  state.ADCs.push_back(adc);
82  state.noiseSquared += Noise * Noise;
83 }

References ecalMGPA::adc(), StripClusterizerAlgorithm::State::ADCs, StripClusterizerAlgorithm::Det::bad(), StripClusterizerAlgorithm::State::candidateLacksSeed, ChannelThreshold, StripClusterizerAlgorithm::State::det(), StripClusterizerAlgorithm::State::lastStrip, StripClusterizerAlgorithm::Det::noise(), DigiDM_cff::Noise, StripClusterizerAlgorithm::State::noiseSquared, SeedThreshold, and digitizers_cfi::strip.

◆ appendBadNeighbors()

void ThreeThresholdAlgorithm::appendBadNeighbors ( State state) const
inlineprivate

Definition at line 115 of file ThreeThresholdAlgorithm.cc.

115  {
116  uint8_t max = MaxAdjacentBad;
117  while (0 < max--) {
118  if (state.det().bad(firstStrip(state) - 1)) {
119  state.ADCs.insert(state.ADCs.begin(), 0);
120  }
121  if (state.det().bad(state.lastStrip + 1)) {
122  state.ADCs.push_back(0);
123  state.lastStrip++;
124  }
125  }
126 }

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

Referenced by endCandidate().

◆ applyGains()

void ThreeThresholdAlgorithm::applyGains ( State state) const
inlineprivate

Definition at line 102 of file ThreeThresholdAlgorithm.cc.

102  {
103  uint16_t strip = firstStrip(state);
104  for (auto& adc : state.ADCs) {
105 #ifdef EDM_ML_DEBUG
106  // if(adc > 255) throw InvalidChargeException( SiStripDigi(strip,adc) );
107 #endif
108  // if(adc > 253) continue; //saturated, do not scale
109  auto charge = int(float(adc) / state.det().gain(strip++) + 0.5f); //adding 0.5 turns truncation into rounding
110  if (adc < 254)
111  adc = (charge > 1022 ? 255 : (charge > 253 ? 254 : charge));
112  }
113 }

References ecalMGPA::adc(), StripClusterizerAlgorithm::State::ADCs, ALCARECOTkAlJpsiMuMu_cff::charge, StripClusterizerAlgorithm::State::det(), firstStrip(), StripClusterizerAlgorithm::Det::gain(), createfilelist::int, and digitizers_cfi::strip.

Referenced by endCandidate().

◆ candidateAccepted()

bool ThreeThresholdAlgorithm::candidateAccepted ( State const &  state) const
inlineprivate

Definition at line 96 of file ThreeThresholdAlgorithm.cc.

96  {
97  return (!state.candidateLacksSeed &&
98  state.noiseSquared * ClusterThresholdSquared <=
99  std::pow(float(std::accumulate(state.ADCs.begin(), state.ADCs.end(), int(0))), 2.f));
100 }

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

Referenced by endCandidate().

◆ candidateEnded()

bool ThreeThresholdAlgorithm::candidateEnded ( State const &  state,
const uint16_t &  testStrip 
) const
inlineprivate

Definition at line 59 of file ThreeThresholdAlgorithm.cc.

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

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

Referenced by clusterizeDetUnit_(), and stripByStripAdd().

◆ clearCandidate()

void ThreeThresholdAlgorithm::clearCandidate ( State state) const
inlineprivate

Definition at line 51 of file ThreeThresholdAlgorithm.h.

51  {
52  state.candidateLacksSeed = true;
53  state.noiseSquared = 0;
54  state.ADCs.clear();
55  }

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

Referenced by endCandidate().

◆ clusterizeDetUnit() [1/2]

void ThreeThresholdAlgorithm::clusterizeDetUnit ( const edm::DetSet< SiStripDigi > &  digis,
output_t::TSFastFiller output 
) const
overridevirtual

Implements StripClusterizerAlgorithm.

Definition at line 128 of file ThreeThresholdAlgorithm.cc.

129  {
130  clusterizeDetUnit_(digis, output);
131 }

References clusterizeDetUnit_(), and convertSQLitetoXML_cfg::output.

◆ clusterizeDetUnit() [2/2]

void ThreeThresholdAlgorithm::clusterizeDetUnit ( const edmNew::DetSet< SiStripDigi > &  digis,
output_t::TSFastFiller output 
) const
overridevirtual

Implements StripClusterizerAlgorithm.

Definition at line 132 of file ThreeThresholdAlgorithm.cc.

133  {
134  clusterizeDetUnit_(digis, output);
135 }

References clusterizeDetUnit_(), and convertSQLitetoXML_cfg::output.

◆ clusterizeDetUnit_() [1/2]

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

Definition at line 31 of file ThreeThresholdAlgorithm.cc.

31  {
32  if (isModuleBad(digis.detId()))
33  return;
34 
35  auto const& det = findDetId(digis.detId());
36  if (!det.valid())
37  return;
38 
39 #ifdef EDM_ML_DEBUG
40  if (!isModuleUsable(digis.detId()))
41  edm::LogWarning("ThreeThresholdAlgorithm") << " id " << digis.detId() << " not usable???" << std::endl;
42 #endif
43 
44  typename digiDetSet::const_iterator scan(digis.begin()), end(digis.end());
45 
46  SiStripApvShotCleaner ApvCleaner;
47  if (RemoveApvShots) {
48  ApvCleaner.clean(digis, scan, end);
49  }
50 
51  State state(det);
52  while (scan != end) {
53  while (scan != end && !candidateEnded(state, scan->strip()))
54  addToCandidate(state, *scan++);
55  endCandidate(state, output);
56  }
57 }

References addToCandidate(), candidateEnded(), SiStripApvShotCleaner::clean(), end, endCandidate(), StripClusterizerAlgorithm::findDetId(), StripClusterizerAlgorithm::isModuleBad(), StripClusterizerAlgorithm::isModuleUsable(), convertSQLitetoXML_cfg::output, and RemoveApvShots.

◆ clusterizeDetUnit_() [2/2]

template<class T >
void ThreeThresholdAlgorithm::clusterizeDetUnit_ ( const T ,
output_t::TSFastFiller  
) const
private

Referenced by clusterizeDetUnit().

◆ endCandidate()

template<class T >
void ThreeThresholdAlgorithm::endCandidate ( State state,
T out 
) const
inlineprivate

◆ firstStrip()

uint16_t ThreeThresholdAlgorithm::firstStrip ( State const &  state) const
inlineprivate

Definition at line 44 of file ThreeThresholdAlgorithm.h.

44 { return state.lastStrip - state.ADCs.size() + 1; }

References StripClusterizerAlgorithm::State::ADCs, and StripClusterizerAlgorithm::State::lastStrip.

Referenced by appendBadNeighbors(), applyGains(), and endCandidate().

◆ stripByStripAdd() [1/2]

void ThreeThresholdAlgorithm::stripByStripAdd ( State state,
uint16_t  strip,
uint8_t  adc,
output_t::TSFastFiller out 
) const
inlineoverridevirtual

◆ stripByStripAdd() [2/2]

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

◆ stripByStripBegin()

StripClusterizerAlgorithm::Det ThreeThresholdAlgorithm::stripByStripBegin ( uint32_t  id) const
overridevirtual

Implements StripClusterizerAlgorithm.

Definition at line 137 of file ThreeThresholdAlgorithm.cc.

137 { return findDetId(id); }

References StripClusterizerAlgorithm::findDetId().

◆ stripByStripEnd() [1/2]

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

Reimplemented from StripClusterizerAlgorithm.

Definition at line 27 of file ThreeThresholdAlgorithm.h.

27 { endCandidate(state, out); }

References endCandidate(), and MillePedeFileConverter_cfg::out.

◆ stripByStripEnd() [2/2]

void ThreeThresholdAlgorithm::stripByStripEnd ( State state,
std::vector< SiStripCluster > &  out 
) const
overridevirtual

Reimplemented from StripClusterizerAlgorithm.

Definition at line 148 of file ThreeThresholdAlgorithm.cc.

148  {
149  endCandidate(state, out);
150 }

References endCandidate(), and MillePedeFileConverter_cfg::out.

Friends And Related Function Documentation

◆ StripClusterizerAlgorithmFactory

friend class StripClusterizerAlgorithmFactory
friend

Definition at line 7 of file ThreeThresholdAlgorithm.h.

Member Data Documentation

◆ ChannelThreshold

float ThreeThresholdAlgorithm::ChannelThreshold
private

Definition at line 61 of file ThreeThresholdAlgorithm.h.

Referenced by addToCandidate().

◆ ClusterThresholdSquared

float ThreeThresholdAlgorithm::ClusterThresholdSquared
private

Definition at line 61 of file ThreeThresholdAlgorithm.h.

Referenced by candidateAccepted().

◆ MaxAdjacentBad

uint8_t ThreeThresholdAlgorithm::MaxAdjacentBad
private

Definition at line 62 of file ThreeThresholdAlgorithm.h.

Referenced by appendBadNeighbors().

◆ MaxSequentialBad

uint8_t ThreeThresholdAlgorithm::MaxSequentialBad
private

Definition at line 62 of file ThreeThresholdAlgorithm.h.

Referenced by candidateEnded().

◆ MaxSequentialHoles

uint8_t ThreeThresholdAlgorithm::MaxSequentialHoles
private

Definition at line 62 of file ThreeThresholdAlgorithm.h.

Referenced by candidateEnded().

◆ minGoodCharge

float ThreeThresholdAlgorithm::minGoodCharge
private

Definition at line 64 of file ThreeThresholdAlgorithm.h.

Referenced by endCandidate().

◆ RemoveApvShots

bool ThreeThresholdAlgorithm::RemoveApvShots
private

Definition at line 63 of file ThreeThresholdAlgorithm.h.

Referenced by clusterizeDetUnit_().

◆ SeedThreshold

float ThreeThresholdAlgorithm::SeedThreshold
private

Definition at line 61 of file ThreeThresholdAlgorithm.h.

Referenced by addToCandidate().

ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
ThreeThresholdAlgorithm::MaxAdjacentBad
uint8_t MaxAdjacentBad
Definition: ThreeThresholdAlgorithm.h:62
StripClusterizerAlgorithm::qualityLabel
std::string qualityLabel
Definition: StripClusterizerAlgorithm.h:94
ThreeThresholdAlgorithm::addToCandidate
void addToCandidate(State &state, const SiStripDigi &digi) const
Definition: ThreeThresholdAlgorithm.h:56
ThreeThresholdAlgorithm::candidateAccepted
bool candidateAccepted(State const &state) const
Definition: ThreeThresholdAlgorithm.cc:96
ThreeThresholdAlgorithm::endCandidate
void endCandidate(State &state, T &) const
Definition: ThreeThresholdAlgorithm.cc:86
ThreeThresholdAlgorithm::candidateEnded
bool candidateEnded(State const &state, const uint16_t &) const
Definition: ThreeThresholdAlgorithm.cc:59
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
siStripClusterTools::chargePerCM
float chargePerCM(DetId detid, Iter a, Iter b)
Definition: SiStripClusterTools.h:29
ThreeThresholdAlgorithm::minGoodCharge
float minGoodCharge
Definition: ThreeThresholdAlgorithm.h:64
ThreeThresholdAlgorithm::appendBadNeighbors
void appendBadNeighbors(State &state) const
Definition: ThreeThresholdAlgorithm.cc:115
end
#define end
Definition: vmac.h:39
ThreeThresholdAlgorithm::ClusterThresholdSquared
float ClusterThresholdSquared
Definition: ThreeThresholdAlgorithm.h:61
ThreeThresholdAlgorithm::firstStrip
uint16_t firstStrip(State const &state) const
Definition: ThreeThresholdAlgorithm.h:44
ThreeThresholdAlgorithm::SeedThreshold
float SeedThreshold
Definition: ThreeThresholdAlgorithm.h:61
SiStripDigi::adc
const uint16_t & adc() const
Definition: SiStripDigi.h:34
ThreeThresholdAlgorithm::applyGains
void applyGains(State &state) const
Definition: ThreeThresholdAlgorithm.cc:102
ThreeThresholdAlgorithm::RemoveApvShots
bool RemoveApvShots
Definition: ThreeThresholdAlgorithm.h:63
ThreeThresholdAlgorithm::MaxSequentialBad
uint8_t MaxSequentialBad
Definition: ThreeThresholdAlgorithm.h:62
ThreeThresholdAlgorithm::clusterizeDetUnit_
void clusterizeDetUnit_(const T &, output_t::TSFastFiller &) const
edm::LogWarning
Definition: MessageLogger.h:141
SiStripApvShotCleaner
Definition: SiStripApvShotCleaner.h:11
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
StripClusterizerAlgorithm::findDetId
Det findDetId(const uint32_t) const
Definition: StripClusterizerAlgorithm.cc:161
ThreeThresholdAlgorithm::clearCandidate
void clearCandidate(State &state) const
Definition: ThreeThresholdAlgorithm.h:51
SiStripDigi::strip
const uint16_t & strip() const
Definition: SiStripDigi.h:33
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
State
State
Definition: RPixErrorChecker.h:15
createfilelist.int
int
Definition: createfilelist.py:10
ThreeThresholdAlgorithm::ChannelThreshold
float ChannelThreshold
Definition: ThreeThresholdAlgorithm.h:61
SiStripApvShotCleaner::clean
bool clean(const edmNew::DetSet< SiStripDigi > &in, edmNew::DetSet< SiStripDigi >::const_iterator &scan, edmNew::DetSet< SiStripDigi >::const_iterator &end)
Definition: SiStripApvShotCleaner.h:19
StripClusterizerAlgorithm::isModuleBad
bool isModuleBad(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:91
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
StripClusterizerAlgorithm::isModuleUsable
bool isModuleUsable(const uint32_t &id) const
Definition: StripClusterizerAlgorithm.h:92
ThreeThresholdAlgorithm::MaxSequentialHoles
uint8_t MaxSequentialHoles
Definition: ThreeThresholdAlgorithm.h:62
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
DigiDM_cff.Noise
Noise
Definition: DigiDM_cff.py:38
SiStripCluster
Definition: SiStripCluster.h:9
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295