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