CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoRomanPot/RecoFP420/interface/ClusterNoiseFP420.h

Go to the documentation of this file.
00001 #ifndef ClusterNoiseFP420_h
00002 #define ClusterNoiseFP420_h
00003 
00004 #include<vector>
00005 #include<map>
00006 #include<iostream>
00007 #include<boost/cstdint.hpp>
00008 //#define mynsdebug0
00009 
00010 
00011 typedef float ElectrodNoise;
00012 typedef bool  ElectrodDisable;
00013 
00014 class ClusterNoiseFP420 {
00015 
00016  public:
00017   ClusterNoiseFP420();
00018   ~ClusterNoiseFP420();
00019   
00020   
00021   class ElectrodData {
00022   public:
00023 
00024     ElectrodNoise   getNoise()   const {return static_cast<ElectrodNoise> (std::abs(Data)/10.0);}
00025     ElectrodDisable getDisable() const {return ( (Data>0) ? false : true );}// if Data <=0 then electrode is disable
00026     void setData(short data){Data=data;}
00027     void setData(float noise_,bool disable_){
00028       short noise =  static_cast<short>  (noise_*10.0 + 0.5) & 0x01FF;
00029       Data = ( disable_ ? -1 : 1 ) * noise; // Data = sign(+/-1) * Noise(Adc count). if Data <=0 then electrode is disable
00030  
00031 #ifdef mynsdebug0
00032          std::cout  
00033         << std::fixed <<"ClusterNoiseFP420.h:: ElectrodData: noise= " << noise_ << " \t"  
00034         <<": disable= " << disable_  << " \t"  
00035         <<"sign Data(=noise*10.0 + 0.5)= " << Data << " \t"  
00036         <<"in getNoise we do: abs(Data)/10.0, so it is OK"  << " \t"  
00037         << std::endl; 
00038 #endif
00039     };
00040     
00041 
00042   private:
00043     //the short type is assured to be 16 bit in CMSSW???
00044     short Data; // Data = sign(+/-1) * Noise(Adc count). if Data <=0 then electrode is disable
00045   };
00046     
00047 
00048   std::map<uint32_t, std::vector<ElectrodData> > m_noises;
00049 };
00050 
00051 typedef std::vector<ClusterNoiseFP420::ElectrodData>                 ElectrodNoiseVector;
00052 typedef std::vector<ClusterNoiseFP420::ElectrodData>::const_iterator ElectrodNoiseVectorIterator;
00053 typedef std::map<uint32_t, ElectrodNoiseVector>                 ElectrodNoiseMap;
00054 typedef std::map<uint32_t, ElectrodNoiseVector>::const_iterator ElectrodNoiseMapIterator;
00055 
00056 #endif