#ifndef TDCKEY_HH #define TDCKEY_HH //*********************************************************************** // File: TdcKey.hh // ---------------------------------------------------------------------- // Simple class to map raw had Tdc channels to Software indexes. // See elsewhere a description (E. James) of a HATD bank... // Use class accessors to get the software (eta, phi) indexes // and the tag (of type Detector) of a calorimeter subdetector. // // Author List: // Igor Gorelov // University of New Mexico // May 25, 01 // Revisions: // // added additional methods to unfold software indexes // back to hardware ones. (Igor Gorelov, 9-Jul-01) //======================================================================== // //************************************************************************ // STL headers #include #include //ROOT headers #ifndef ROOT_Rtypes #include "Rtypes.h" #endif //--------------- // C++ Headers -- //--------------- #include "CalorGeometry/CalConstants.hh" //================= // Class definition //================= class TdcKey { public: TdcKey (); TdcKey ( int eta, int phi, Detector subdet ); TdcKey ( int side, int wedge, int rapidity, int depth_or_tile); TdcKey ( const TdcKey& tkey); TdcKey ( const TdcKey* tkey); ~TdcKey (); // // Manipulation and access // TdcKey& operator=(const TdcKey &rhs); bool operator < (const TdcKey &rhs) const; bool operator > (const TdcKey &rhs) const; bool operator==(const TdcKey &rhs) const; bool operator!=(const TdcKey &rhs) const; int ixEta() const; int ixPhi() const; Detector detector() const; bool isValid() const; std::string calodetName(void) const; int iside() const; int iwedge() const; int irap() const; int idepth() const; void print(void) const; private: // software indexes ... int _ixEta; // eta software index int _ixPhi; // phi software index Detector _calodet; // software calo subdetector tag bool _validFlag; int setTdcIdx( int side, int wedge, int rapidity, int depth_or_tile); }; inline int TdcKey::ixEta() const {return _ixEta;} inline int TdcKey::ixPhi() const {return _ixPhi;} inline Detector TdcKey::detector() const {return _calodet;} inline bool TdcKey::isValid() const {return _validFlag;} inline TdcKey& TdcKey::operator=( const TdcKey &rhs ) { _ixEta = rhs._ixEta; _ixPhi = rhs._ixPhi; _calodet = rhs._calodet; _validFlag = rhs._validFlag; return *this; } inline bool TdcKey::operator==(const TdcKey &rhs) const { return ( ( _ixEta == rhs._ixEta ) && ( _ixPhi == rhs._ixPhi ) && ( _calodet == rhs._calodet ) ); } inline bool TdcKey::operator!=(const TdcKey &rhs) const { return ( ( _ixEta != rhs._ixEta ) || ( _ixPhi != rhs._ixPhi ) || ( _calodet != rhs._calodet ) ); } inline bool TdcKey::operator<(const TdcKey &rhs) const { return ( ( _ixEta < rhs._ixEta ) || ( _ixEta == rhs._ixEta && _ixPhi < rhs._ixPhi ) || ( _ixEta == rhs._ixEta && _ixPhi == rhs._ixPhi && _calodet < rhs._calodet ) ); } inline bool TdcKey::operator>(const TdcKey &rhs) const { return ( ( _ixEta > rhs._ixEta ) || ( _ixEta == rhs._ixEta && _ixPhi > rhs._ixPhi ) || ( _ixEta == rhs._ixEta && _ixPhi == rhs._ixPhi && _calodet > rhs._calodet ) ); } #endif // TDCKEY_HH