#ifndef _TDCTOWER_HH_ #define _TDCTOWER_HH_ ///////////////////////////////////////////////////////////////////////////// // // Component: TdcTower.hh // Purpose: This is the base class for the TDC towers. It is an // abstract base class. Subclasses of TdcTower represent specific // types, as defined by the CDF calorimeter hardware. // // Created: 01/22/2003 Max Goncharov // ///////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include "EdmUtilities/FixedSizeTypes.hh" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/CalParameters.hh" #include "CalorGeometry/CalorKey.hh" //ROOT headers #include "TBuffer.h" class TdcHit{ public: typedef UChar_t valcode_t; TdcHit(int hit = 0, int width = 0); virtual ~TdcHit(); bool operator==(const TdcHit& rhs) const; bool operator<(const TdcHit& rhs) const; bool operator>(const TdcHit& rhs) const; friend std::ostream& operator<<(std::ostream& os, const TdcHit& t); void set_geometry(int,int,int,Detector); void set_hit(float,float); void reset(); valcode_t validCode() const; int PrintValidCode() const; bool isCorrected() const; void setCorrected(bool i = true); void get_geometry(int&,int&,int&,Detector&) const; void get_hit(float&,float&) const; void print(std::ostream& os = std::cout) const; protected: void checkT0(); void checkWidth(); int _wedge, _tower, _ewe; float _t0, _wt0; valcode_t _valid; bool _corrected; Detector _calor; enum{_tMin=-2000,_tMax=2000,_wMin=0,_wMax=2000}; }; inline TdcHit::valcode_t TdcHit::validCode() const{return _valid;} inline bool TdcHit::isCorrected() const{return _corrected;} inline void TdcHit::setCorrected(bool i) {_corrected = i;} class TdcTower { public: typedef std::map CalorKeyMap; typedef UChar_t valcode_t; TdcTower(); virtual ~TdcTower(); bool operator==(const TdcTower& rhs) const; bool operator<(const TdcTower& rhs) const; bool operator>(const TdcTower& rhs) const; friend std::ostream& operator<<(std::ostream& os, const TdcTower& t); int PrintValidCode() const; TdcHit accessHit(int ihit = 0) const; int howManyHits() const; int howManyKeys() const; bool hasCalorKey(const CalorKey& ) const; float getPmtEnergy(int) const; float getPmtEnergy(const CalorKey& ) const; CalorKeyMap getCalorKeys() const; valcode_t validCode() const; virtual int maxCalorKeys() const = 0; bool addTdcHit(int,int); bool addTdcHit(const TdcHit&); virtual bool addEnergy(const CalorKey&, float); bool setEnergy(const CalorKey&, float); virtual bool setCalorKeys(const CalorKeyMap&); virtual bool isFullyBuild() const = 0; virtual float energy() const = 0; virtual TdcTower* clone() const = 0; virtual std::ostream& print(std::ostream& os = std::cout) const; void reset(); protected: int _nTdcHits, _nCalorKeys; valcode_t _valid; TdcHit _tdc_hits[CAL_TDC_NHITS]; CalorKeyMap _calor_keys; }; inline int TdcTower::howManyHits() const{return _nTdcHits;} inline int TdcTower::howManyKeys() const{return _nCalorKeys;} inline TdcTower::valcode_t TdcTower::validCode() const{return _valid;} inline TdcTower::CalorKeyMap TdcTower::getCalorKeys() const{ return _calor_keys; } #endif // _TDCTOWER_HH_