Newer
Older
TB_Chris / TbUT / src / .svn / text-base / TbUTPedestal.cpp.svn-base
@iaro iaro on 9 May 2016 960 bytes first attempt of automated anal
  1. /*
  2. * TbUTPedestal.cpp
  3. *
  4. * Created on: Dec 31, 2014
  5. * Author: ADendek
  6. */
  7.  
  8. #include "TbUTPedestal.h"
  9. #include <boost/assign/list_of.hpp>
  10. #include <boost/foreach.hpp>
  11.  
  12.  
  13. using namespace TbUT;
  14. using namespace std;
  15.  
  16. Pedestal::Pedestal():
  17. m_normalization(1024),
  18. m_isNormalized(false)
  19. {
  20. int l_initialValue=0*m_normalization;// temporary change. until initial value of the pedestal stabilize
  21. int l_sensorNumber=RawData<>::getnChannelNumber();
  22. m_pedestals=DataVector(l_sensorNumber,l_initialValue);
  23. }
  24.  
  25. int Pedestal::getPedestal(int p_channel)
  26. {
  27. //normalizePedestals();
  28. return m_pedestals[p_channel];
  29. }
  30.  
  31. void Pedestal::setPedestal(int p_channel, int p_value)
  32. {
  33. m_pedestals[p_channel]=p_value;
  34. }
  35.  
  36. void Pedestal::normalizePedestals()
  37. {
  38. if(!m_isNormalized){
  39. int i=0;
  40. BOOST_FOREACH(auto& l_pedestal, m_pedestals)
  41. {
  42. l_pedestal/=m_normalization;
  43. cout<<"channel: "<<i<<" pedestal: " <<l_pedestal<<endl;
  44. i++;
  45. m_isNormalized=true;
  46. }
  47. }
  48. }