#include <ThreeThresholdAlgorithm.h>
Public Member Functions | |
void | clusterizeDetUnit (const edm::DetSet< SiStripDigi > &, output_t::FastFiller &) |
void | clusterizeDetUnit (const edmNew::DetSet< SiStripDigi > &, output_t::FastFiller &) |
template<class digiDetSet > | |
void | clusterizeDetUnit_ (const digiDetSet &digis, output_t::FastFiller &output) |
void | stripByStripAdd (uint16_t strip, uint16_t adc, std::vector< SiStripCluster > &out) |
bool | stripByStripBegin (uint32_t id) |
void | stripByStripEnd (std::vector< SiStripCluster > &out) |
Private Member Functions | |
void | addToCandidate (const SiStripDigi &) |
void | appendBadNeighbors () |
void | applyGains () |
bool | candidateAccepted () const |
bool | candidateEnded (const uint16_t &) const |
void | clearCandidate () |
template<class T > | |
void | clusterizeDetUnit_ (const T &, output_t::FastFiller &) |
template<class T > | |
void | endCandidate (T &) |
uint16_t | firstStrip () const |
ThreeThresholdAlgorithm (float, float, float, unsigned, unsigned, unsigned, std::string qualityLabel, bool setDetId, bool removeApvShots=false) | |
Private Attributes | |
std::vector< uint16_t > | ADCs |
SiStripApvShotCleaner | ApvCleaner |
bool | candidateLacksSeed |
float | ChannelThreshold |
float | ClusterThresholdSquared |
uint16_t | lastStrip |
uint8_t | MaxAdjacentBad |
uint8_t | MaxSequentialBad |
uint8_t | MaxSequentialHoles |
float | noiseSquared |
bool | RemoveApvShots |
float | SeedThreshold |
Friends | |
class | StripClusterizerAlgorithmFactory |
Definition at line 6 of file ThreeThresholdAlgorithm.h.
ThreeThresholdAlgorithm::ThreeThresholdAlgorithm | ( | float | chan, |
float | seed, | ||
float | cluster, | ||
unsigned | holes, | ||
unsigned | bad, | ||
unsigned | adj, | ||
std::string | qualityLabel, | ||
bool | setDetId, | ||
bool | removeApvShots = false |
||
) | [private] |
Definition at line 8 of file ThreeThresholdAlgorithm.cc.
References StripClusterizerAlgorithm::_setDetId, ADCs, StripClusterizerAlgorithm::qualityLabel, and StripClusterizerAlgorithm::setDetId().
: ChannelThreshold( chan ), SeedThreshold( seed ), ClusterThresholdSquared( cluster*cluster ), MaxSequentialHoles( holes ), MaxSequentialBad( bad ), MaxAdjacentBad( adj ), RemoveApvShots(removeApvShots) { _setDetId=setDetId; qualityLabel = (qL); ADCs.reserve(128); }
void ThreeThresholdAlgorithm::addToCandidate | ( | const SiStripDigi & | digi | ) | [inline, private] |
Definition at line 52 of file ThreeThresholdAlgorithm.cc.
References SiStripDigi::adc(), ADCs, StripClusterizerAlgorithm::bad(), candidateLacksSeed, ChannelThreshold, lastStrip, StripClusterizerAlgorithm::noise(), noiseSquared, SeedThreshold, and SiStripDigi::strip().
Referenced by clusterizeDetUnit_(), and stripByStripAdd().
{ float Noise = noise( digi.strip() ); if( bad(digi.strip()) || digi.adc() < static_cast<uint16_t>( Noise * ChannelThreshold)) return; if(candidateLacksSeed) candidateLacksSeed = digi.adc() < static_cast<uint16_t>( Noise * SeedThreshold); if(ADCs.empty()) lastStrip = digi.strip() - 1; // begin candidate while( ++lastStrip < digi.strip() ) ADCs.push_back(0); // pad holes ADCs.push_back( digi.adc() ); noiseSquared += Noise*Noise; }
void ThreeThresholdAlgorithm::appendBadNeighbors | ( | ) | [inline, private] |
Definition at line 101 of file ThreeThresholdAlgorithm.cc.
References ADCs, StripClusterizerAlgorithm::bad(), firstStrip(), lastStrip, max(), and MaxAdjacentBad.
Referenced by endCandidate().
{ uint8_t max = MaxAdjacentBad; while(0 < max--) { if( bad( firstStrip()-1) ) { ADCs.insert( ADCs.begin(), 0); } if( bad( lastStrip + 1) ) { ADCs.push_back(0); lastStrip++; } } }
void ThreeThresholdAlgorithm::applyGains | ( | ) | [inline, private] |
Definition at line 88 of file ThreeThresholdAlgorithm.cc.
References ecalMGPA::adc(), ADCs, DeDxDiscriminatorTools::charge(), firstStrip(), StripClusterizerAlgorithm::gain(), and strip().
Referenced by endCandidate().
{ uint16_t strip = firstStrip(); for( std::vector<uint16_t>::iterator adc = ADCs.begin(); adc != ADCs.end(); adc++) { if(*adc > 255) throw InvalidChargeException( SiStripDigi(strip,*adc) ); if(*adc > 253) continue; //saturated, do not scale uint16_t charge = static_cast<uint16_t>( *adc/gain(strip++) + 0.5 ); //adding 0.5 turns truncation into rounding *adc = ( charge > 1022 ? 255 : ( charge > 253 ? 254 : charge )); } }
bool ThreeThresholdAlgorithm::candidateAccepted | ( | ) | const [inline, private] |
Definition at line 80 of file ThreeThresholdAlgorithm.cc.
References ADCs, candidateLacksSeed, ClusterThresholdSquared, noiseSquared, and funct::pow().
Referenced by endCandidate().
{ return ( !candidateLacksSeed && noiseSquared * ClusterThresholdSquared <= std::pow( std::accumulate(ADCs.begin(),ADCs.end(),float(0)), 2)); }
bool ThreeThresholdAlgorithm::candidateEnded | ( | const uint16_t & | testStrip | ) | const [inline, private] |
Definition at line 42 of file ThreeThresholdAlgorithm.cc.
References ADCs, StripClusterizerAlgorithm::allBadBetween(), lastStrip, MaxSequentialBad, and MaxSequentialHoles.
Referenced by clusterizeDetUnit_(), and stripByStripAdd().
{ uint16_t holes = testStrip - lastStrip - 1; return ( !ADCs.empty() && // a candidate exists, and holes > MaxSequentialHoles && // too many holes if not all are bad strips, and ( holes > MaxSequentialBad || // (too many bad strips anyway, or !allBadBetween( lastStrip, testStrip ))); // not all holes are bad strips) }
void ThreeThresholdAlgorithm::clearCandidate | ( | ) | [inline, private] |
Definition at line 38 of file ThreeThresholdAlgorithm.h.
References ADCs, candidateLacksSeed, and noiseSquared.
Referenced by clusterizeDetUnit_(), endCandidate(), and stripByStripBegin().
{ candidateLacksSeed = true; noiseSquared = 0; ADCs.clear();}
void ThreeThresholdAlgorithm::clusterizeDetUnit | ( | const edm::DetSet< SiStripDigi > & | digis, |
output_t::FastFiller & | output | ||
) | [virtual] |
Implements StripClusterizerAlgorithm.
Definition at line 110 of file ThreeThresholdAlgorithm.cc.
References clusterizeDetUnit_().
{clusterizeDetUnit_(digis,output);}
void ThreeThresholdAlgorithm::clusterizeDetUnit | ( | const edmNew::DetSet< SiStripDigi > & | digis, |
output_t::FastFiller & | output | ||
) | [virtual] |
Implements StripClusterizerAlgorithm.
Definition at line 111 of file ThreeThresholdAlgorithm.cc.
References clusterizeDetUnit_().
{clusterizeDetUnit_(digis,output);}
void ThreeThresholdAlgorithm::clusterizeDetUnit_ | ( | const T & | , |
output_t::FastFiller & | |||
) | [private] |
Referenced by clusterizeDetUnit().
void ThreeThresholdAlgorithm::clusterizeDetUnit_ | ( | const digiDetSet & | digis, |
output_t::FastFiller & | output | ||
) | [inline] |
Definition at line 20 of file ThreeThresholdAlgorithm.cc.
References addToCandidate(), ApvCleaner, candidateEnded(), SiStripApvShotCleaner::clean(), clearCandidate(), end, endCandidate(), StripClusterizerAlgorithm::isModuleUsable(), RemoveApvShots, and StripClusterizerAlgorithm::setDetId().
{ if( !isModuleUsable( digis.detId() )) return; setDetId( digis.detId() ); typename digiDetSet::const_iterator scan( digis.begin() ), end( digis.end() ); if(RemoveApvShots){ ApvCleaner.clean(digis,scan,end); } clearCandidate(); while( scan != end ) { while( scan != end && !candidateEnded( scan->strip() ) ) addToCandidate(*scan++); endCandidate(output); } }
void ThreeThresholdAlgorithm::endCandidate | ( | T & | out | ) | [inline, private] |
Definition at line 68 of file ThreeThresholdAlgorithm.cc.
References StripClusterizerAlgorithm::_setDetId, ADCs, appendBadNeighbors(), applyGains(), candidateAccepted(), clearCandidate(), StripClusterizerAlgorithm::currentId(), and firstStrip().
Referenced by clusterizeDetUnit_(), stripByStripAdd(), and stripByStripEnd().
{ if(candidateAccepted()) { applyGains(); appendBadNeighbors(); out.push_back(SiStripCluster(currentId(), firstStrip(), ADCs.begin(), ADCs.end())); if (_setDetId) out.back().setId(currentId()); } clearCandidate(); }
uint16_t ThreeThresholdAlgorithm::firstStrip | ( | ) | const [inline, private] |
Definition at line 32 of file ThreeThresholdAlgorithm.h.
References ADCs, and lastStrip.
Referenced by appendBadNeighbors(), applyGains(), and endCandidate().
void ThreeThresholdAlgorithm::stripByStripAdd | ( | uint16_t | strip, |
uint16_t | adc, | ||
std::vector< SiStripCluster > & | out | ||
) | [inline, virtual] |
Implements StripClusterizerAlgorithm.
Definition at line 124 of file ThreeThresholdAlgorithm.cc.
References addToCandidate(), candidateEnded(), and endCandidate().
{ if(candidateEnded(strip)) endCandidate(out); addToCandidate(SiStripDigi(strip,adc)); }
bool ThreeThresholdAlgorithm::stripByStripBegin | ( | uint32_t | id | ) | [inline, virtual] |
Implements StripClusterizerAlgorithm.
Definition at line 115 of file ThreeThresholdAlgorithm.cc.
References clearCandidate(), StripClusterizerAlgorithm::isModuleUsable(), and StripClusterizerAlgorithm::setDetId().
{ if( !isModuleUsable( id )) return false; setDetId( id ); clearCandidate(); return true; }
void ThreeThresholdAlgorithm::stripByStripEnd | ( | std::vector< SiStripCluster > & | out | ) | [inline, virtual] |
Implements StripClusterizerAlgorithm.
Definition at line 132 of file ThreeThresholdAlgorithm.cc.
References endCandidate().
{ endCandidate(out); }
friend class StripClusterizerAlgorithmFactory [friend] |
Definition at line 8 of file ThreeThresholdAlgorithm.h.
std::vector<uint16_t> ThreeThresholdAlgorithm::ADCs [private] |
Definition at line 26 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate(), appendBadNeighbors(), applyGains(), candidateAccepted(), candidateEnded(), clearCandidate(), endCandidate(), firstStrip(), and ThreeThresholdAlgorithm().
Definition at line 47 of file ThreeThresholdAlgorithm.h.
Referenced by clusterizeDetUnit_().
bool ThreeThresholdAlgorithm::candidateLacksSeed [private] |
Definition at line 29 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate(), candidateAccepted(), and clearCandidate().
float ThreeThresholdAlgorithm::ChannelThreshold [private] |
Definition at line 43 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate().
float ThreeThresholdAlgorithm::ClusterThresholdSquared [private] |
Definition at line 43 of file ThreeThresholdAlgorithm.h.
Referenced by candidateAccepted().
uint16_t ThreeThresholdAlgorithm::lastStrip [private] |
Definition at line 27 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate(), appendBadNeighbors(), candidateEnded(), and firstStrip().
uint8_t ThreeThresholdAlgorithm::MaxAdjacentBad [private] |
Definition at line 44 of file ThreeThresholdAlgorithm.h.
Referenced by appendBadNeighbors().
uint8_t ThreeThresholdAlgorithm::MaxSequentialBad [private] |
Definition at line 44 of file ThreeThresholdAlgorithm.h.
Referenced by candidateEnded().
uint8_t ThreeThresholdAlgorithm::MaxSequentialHoles [private] |
Definition at line 44 of file ThreeThresholdAlgorithm.h.
Referenced by candidateEnded().
float ThreeThresholdAlgorithm::noiseSquared [private] |
Definition at line 28 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate(), candidateAccepted(), and clearCandidate().
bool ThreeThresholdAlgorithm::RemoveApvShots [private] |
Definition at line 45 of file ThreeThresholdAlgorithm.h.
Referenced by clusterizeDetUnit_().
float ThreeThresholdAlgorithm::SeedThreshold [private] |
Definition at line 43 of file ThreeThresholdAlgorithm.h.
Referenced by addToCandidate().