test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StripClusterizerAlgorithm.h
Go to the documentation of this file.
1 #ifndef RecoLocalTracker_StripClusterizerAlgorithm_h
2 #define RecoLocalTracker_StripClusterizerAlgorithm_h
3 
4 namespace edm{class EventSetup;}
5 class SiStripDigi;
14 #include <limits>
15 
16 
18 
20 
21  public:
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 { while( ++L < R && bad(L) ); return L == R; }
35  uint32_t detId=0;
36  unsigned short ind=invalidI;
37  };
38 
39  //state of the candidate cluster
40  struct State {
41  State(Det const & idet) : m_det(idet) { ADCs.reserve(128);}
42  Det const & det() const { return m_det;}
43  std::vector<uint8_t> ADCs;
44  uint16_t lastStrip=0;
45  float noiseSquared=0;
46  bool candidateLacksSeed=true;
47  private:
48  Det const & m_det;
49  };
50 
51 
53  virtual void initialize(const edm::EventSetup&);
54 
55 
56  //Offline DetSet interface
58  void clusterize(const edm::DetSetVector<SiStripDigi> &, output_t &) const;
60  virtual void clusterizeDetUnit(const edm::DetSet<SiStripDigi> &, output_t::TSFastFiller &) const = 0;
61  virtual void clusterizeDetUnit(const edmNew::DetSet<SiStripDigi> &, output_t::TSFastFiller &) const = 0;
62 
63  //HLT stripByStrip interface
64  virtual Det stripByStripBegin(uint32_t id)const = 0;
65 
66  virtual void addFed(Det const & det, sistrip::FEDZSChannelUnpacker & unpacker, uint16_t ipair, std::vector<SiStripCluster>& out) const {}
67  virtual void stripByStripAdd(State & state, uint16_t strip, uint8_t adc, std::vector<SiStripCluster>& out) const{}
68  virtual void stripByStripEnd(State & state, std::vector<SiStripCluster>& out) const {}
69 
70  virtual void addFed(State & state, sistrip::FEDZSChannelUnpacker & unpacker, uint16_t ipair, output_t::TSFastFiller & out) const {}
71  virtual void stripByStripAdd(State & state, uint16_t strip, uint8_t adc, output_t::TSFastFiller & out) const {}
72  virtual void stripByStripEnd(State & state, output_t::TSFastFiller & out) const {}
73 
74 
76 
77 
78  SiStripDetCabling const * cabling() const { return theCabling;}
79  std::vector<uint32_t> const & allDetIds() const { return detIds;}
80 
81  std::vector<const FedChannelConnection *> const & currentConnection(const Det& det) const { return connections[det.ind]; }
82 
83  protected:
84 
86 
87  Det findDetId(const uint32_t) const;
88  bool isModuleBad(const uint32_t& id) const { return qualityHandle->IsModuleBad( id ); }
89  bool isModuleUsable(const uint32_t& id) const { return qualityHandle->IsModuleUsable( id ); }
90 
92 
93  private:
94 
95  template<class T> void clusterize_(const T& input, output_t& output) const {
96  for(typename T::const_iterator it = input.begin(); it!=input.end(); it++) {
97  output_t::TSFastFiller ff(output, it->detId());
98  clusterizeDetUnit(*it, ff);
99  if(ff.empty()) ff.abort();
100  }
101  }
102 
103  struct Index {
104  unsigned short
108  };
109  std::vector<uint32_t> detIds; // from cabling (connected and not bad)
110  std::vector<std::vector<const FedChannelConnection *> > connections;
111  std::vector<Index> indices;
115  SiStripDetCabling const * theCabling = nullptr;
117 
118 
119 };
120 #endif
int adc(sample_type sample)
get the ADC sample (12 bits)
edm::ESHandle< SiStripQuality > qualityHandle
void clusterize(const edm::DetSetVector< SiStripDigi > &, output_t &) const
std::vector< uint32_t > const & allDetIds() const
edm::ESHandle< SiStripGain > gainHandle
bool IsStripBad(const uint32_t &detid, const short &strip) const
bool isModuleBad(const uint32_t &id) const
#define constexpr
edm::ESHandle< SiStripNoises > noiseHandle
static std::string const input
Definition: EdmProvDump.cc:44
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:74
virtual void addFed(Det const &det, sistrip::FEDZSChannelUnpacker &unpacker, uint16_t ipair, std::vector< SiStripCluster > &out) const
virtual void stripByStripAdd(State &state, uint16_t strip, uint8_t adc, output_t::TSFastFiller &out) const
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:68
Class containning control, module, detector and connection information, at the level of a FED channel...
virtual Det stripByStripBegin(uint32_t id) const =0
std::vector< std::vector< const FedChannelConnection * > > connections
bool bad(const uint16_t &strip) const
std::pair< ContainerIterator, ContainerIterator > Range
void clusterize_(const T &input, output_t &output) const
edmNew::DetSetVector< SiStripCluster > output_t
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
SiStripDetCabling const * theCabling
bool allBadBetween(uint16_t L, const uint16_t &R) const
float gain(const uint16_t &strip) const
bool isModuleUsable(const uint32_t &id) const
virtual void initialize(const edm::EventSetup &)
SiStripDetCabling const * cabling() const
virtual void stripByStripEnd(State &state, output_t::TSFastFiller &out) const
Det findDetId(const uint32_t) const
std::pair< ContainerIterator, ContainerIterator > Range
virtual void stripByStripEnd(State &state, std::vector< SiStripCluster > &out) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:48
std::vector< const FedChannelConnection * > const & currentConnection(const Det &det) const
long double T
virtual void clusterizeDetUnit(const edm::DetSet< SiStripDigi > &, output_t::TSFastFiller &) const =0
virtual void addFed(State &state, sistrip::FEDZSChannelUnpacker &unpacker, uint16_t ipair, output_t::TSFastFiller &out) const
float noise(const uint16_t &strip) const
virtual void stripByStripAdd(State &state, uint16_t strip, uint8_t adc, std::vector< SiStripCluster > &out) const