CMS 3D CMS Logo

ClusterNoiseFP420.h
Go to the documentation of this file.
1 #ifndef ClusterNoiseFP420_h
2 #define ClusterNoiseFP420_h
3 
4 #include <vector>
5 #include <map>
6 #include <iostream>
7 #include <cstdint>
8 //#define mynsdebug0
9 
10 typedef float ElectrodNoise;
11 typedef bool ElectrodDisable;
12 
14 public:
17 
18  class ElectrodData {
19  public:
20  ElectrodNoise getNoise() const { return static_cast<ElectrodNoise>(std::abs(Data) / 10.0); }
21  ElectrodDisable getDisable() const { return ((Data > 0) ? false : true); } // if Data <=0 then electrode is disable
22  void setData(short data) { Data = data; }
23  void setData(float noise_, bool disable_) {
24  short noise = static_cast<short>(noise_ * 10.0 + 0.5) & 0x01FF;
25  Data =
26  (disable_ ? -1 : 1) * noise; // Data = sign(+/-1) * Noise(Adc count). if Data <=0 then electrode is disable
27 
28 #ifdef mynsdebug0
29  std::cout << std::fixed << "ClusterNoiseFP420.h:: ElectrodData: noise= " << noise_ << " \t"
30  << ": disable= " << disable_ << " \t"
31  << "sign Data(=noise*10.0 + 0.5)= " << Data << " \t"
32  << "in getNoise we do: abs(Data)/10.0, so it is OK"
33  << " \t" << std::endl;
34 #endif
35  };
36 
37  private:
38  //the short type is assured to be 16 bit in CMSSW???
39  short Data; // Data = sign(+/-1) * Noise(Adc count). if Data <=0 then electrode is disable
40  };
41 
42  std::map<uint32_t, std::vector<ElectrodData> > m_noises;
43 };
44 
45 typedef std::vector<ClusterNoiseFP420::ElectrodData> ElectrodNoiseVector;
46 typedef std::vector<ClusterNoiseFP420::ElectrodData>::const_iterator ElectrodNoiseVectorIterator;
47 typedef std::map<uint32_t, ElectrodNoiseVector> ElectrodNoiseMap;
48 typedef std::map<uint32_t, ElectrodNoiseVector>::const_iterator ElectrodNoiseMapIterator;
49 
50 #endif
static const char noise_[]
void setData(float noise_, bool disable_)
std::vector< ClusterNoiseFP420::ElectrodData > ElectrodNoiseVector
std::map< uint32_t, ElectrodNoiseVector >::const_iterator ElectrodNoiseMapIterator
std::map< uint32_t, ElectrodNoiseVector > ElectrodNoiseMap
std::vector< ClusterNoiseFP420::ElectrodData >::const_iterator ElectrodNoiseVectorIterator
ElectrodNoise getNoise() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< uint32_t, std::vector< ElectrodData > > m_noises
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ElectrodDisable getDisable() const
float ElectrodNoise
bool ElectrodDisable