emcRejectList.h

Go to the documentation of this file.
00001 #ifndef __EMCREJECTLIST_H__
00002 #define __EMCREJECTLIST_H__
00003 
00004 #include <vector>
00005 #include <map>
00006 #include <iostream>
00007 
00008 #ifndef __EMCMANAGEABLE_H__
00009 #include "emcManageable.h"
00010 #endif
00011 #ifndef __PHTIMESTAMP_H__
00012 #include "PHTimeStamp.h"
00013 #endif
00014 
00020 class emcRejectList : public emcManageable
00021 {
00022 public:
00023 
00025   emcRejectList();
00026   emcRejectList(const emcRejectList&);
00027   emcRejectList& operator=(const emcRejectList&);
00028 
00029   emcRejectList& operator+=(const emcRejectList&);
00030   emcRejectList& operator-=(const emcRejectList&);
00031 
00032   virtual ~emcRejectList();
00033 
00035 
00036   unsigned int AmplitudeError(int towerid) const;
00037   unsigned int AmplitudeWarning(int towerid) const;
00038 
00039   unsigned int Error(int towerid) const;
00040 
00041   const char* GetCategory(void) const { return "RejectList"; }
00042 
00044   const PHTimeStamp& GetEndValTime(void) const { return fEnd; }
00045 
00047   const PHTimeStamp& GetStartValTime(void) const { return fStart; }
00048 
00049   bool nonZero(int towerid) const;
00050 
00051   void print(std::ostream& out=std::cout) const;
00052 
00053   size_t size() const { return fTowers.size(); }
00054   
00055   size_t maxsize() const { return 144*172; }
00056 
00057   unsigned int TimingError(int towerid) const;
00058   unsigned int TimingWarning(int towerid) const;
00059 
00060   unsigned int Warning(int towerid) const;
00061 
00063 
00064   void Reset(void);
00065  
00069   void set(int towerid, unsigned int amp_error, unsigned int amp_warning, 
00070            unsigned int timing_error, unsigned int timing_warning);
00071  
00074   void set_or(int towerid, unsigned int amp_error, unsigned int amp_warning, 
00075               unsigned int timing_error, unsigned int timing_warning);
00076 
00077   void SetValidityPeriod(const PHTimeStamp& t1, const PHTimeStamp& t2) 
00078   {
00079     fStart = t1; fEnd = t2;
00080   }
00081 
00082 private:
00083 
00084   void Copy(emcRejectList&) const;
00085 
00086   class SixInts 
00087   { 
00088   public:
00089     
00090     SixInts(unsigned int amperror=0, unsigned int ampwarning=0,
00091             unsigned int toferror=0, unsigned int tofwarning=0);
00092 
00093     bool nonZero() const;
00094     
00095     void zero();
00096 
00097     void set(unsigned int amperror, unsigned int ampwarning,
00098              unsigned int toferror, unsigned int tofwarning);
00099  
00100     void set_or(unsigned int amperror, unsigned int ampwarning,
00101                 unsigned int toferror, unsigned int tofwarning);
00102 
00103     unsigned int ampError() const { return ampError_; }
00104     unsigned int ampWarning() const { return ampWarning_; }
00105     unsigned int tofError() const { return tofError_; }
00106     unsigned int tofWarning() const { return tofWarning_; }
00107 
00108     unsigned int error() const { return error_; }
00109     unsigned int warning() const { return warning_; }
00110 
00111   private:
00112     unsigned int ampError_;
00113     unsigned int ampWarning_;
00114     unsigned int tofError_;
00115     unsigned int tofWarning_;
00116     unsigned int error_;
00117     unsigned int warning_;
00118   };
00119   typedef std::map<int,SixInts> TMAP;
00120   TMAP fTowers;
00121 
00122   SixInts getTower(int towerid) const;
00123 
00124   PHTimeStamp fStart;
00125   PHTimeStamp fEnd;
00126 };
00127 
00128 inline
00129 std::ostream& operator<<(std::ostream& out, const emcRejectList& rl)
00130 {
00131   rl.print(out);
00132   return out;
00133 }
00134 
00135 #endif