Newer
Older
TB_Chris / TbUT / src / alibava / .svn / text-base / ChanList.h.svn-base
  1. /* -*- mode: c++ -*- */
  2. #ifndef __ChanList_h__
  3. #define __ChanList_h__
  4.  
  5. #include <iostream>
  6. #include <vector>
  7. #include "TbAlibavaHit.h"
  8. //////////////////////////////////////////////////////////////////////////
  9. // ChanList
  10. //
  11. // Created: Mon Sep 7 18:46:56 1998 Author: Carlos Lacasta
  12. // Purpose: Class to handle channel lists
  13. //
  14. //////////////////////////////////////////////////////////////////////////
  15.  
  16. class ChanList
  17. {
  18. protected:
  19. int nch; // number of channels in the list
  20. std::vector<int> ch; // list of channels
  21. TbAlibavaHitList hits;
  22. double cm; // Common mode
  23. double noise; // noise
  24. void copy(const ChanList &);
  25. public:
  26. ChanList(const char *ch = 0);
  27. ChanList(int, int);
  28. ChanList(const ChanList &);
  29. ChanList &operator=(const ChanList &);
  30. virtual ~ChanList()
  31. {
  32. hits.clear();
  33. ch.clear();
  34. }
  35. int Set(const char *);
  36. int Nch() const
  37. {
  38. return nch;
  39. }
  40. int Chan(int x) const
  41. {
  42. return ch[x];
  43. }
  44.  
  45. int operator[](int x) const { return ch[x]; }
  46. void add_hit(const TbAlibavaHit &h) { hits.push_back(h); }
  47. bool empty() const { return hits.empty(); }
  48. int nhits() const { return hits.size(); }
  49. void clear_hits() { hits.clear(); }
  50. const TbAlibavaHit &get_hit(int i) const { return hits[i]; }
  51. const TbAlibavaHitList hit_list() const { return hits; }
  52.  
  53. double CommonMode() const
  54. {
  55. return cm;
  56. }
  57. double Noise() const
  58. {
  59. return noise;
  60. }
  61. ChanList *CommonMode(double x)
  62. {
  63. cm = x;
  64. return this;
  65. }
  66. ChanList *Noise(double x)
  67. {
  68. noise = x;
  69. return this;
  70. }
  71. static int ParseChanList(const char *, ChanList **);
  72. };
  73. std::ostream &operator<<(std::ostream &, ChanList&);
  74. #endif
  75.