#ifndef CP2Q_HH #define CP2Q_HH /******************************************************************* Description: CP2Q class header file CP2Q is a Streamable Object Author List: 10/14/2004 Else Lytken : created Revision History: *******************************************************************/ #include #include "Edm/StreamableObject.hh" #include "Rtypes.h" #include "EdmUtilities/BitMask.hh" class CP2Q; typedef unsigned short int uint2; class CP2Q : public StreamableObject { public: CP2Q(); CP2Q( const CP2Q& ); // Copy Constructor CP2Q( uint2 Chid, uint2 Energy); virtual ~CP2Q(){} void print(std::ostream& = std::cout ) const; uint2 chid() const; uint2 energy() const; int module() const; int padNo() const; int we() const; /*=========================================================================*\ * StreamableObject requirements // \*=========================================================================*/ void Streamer(TBuffer& iobuffer) ; virtual bool postread( EventRecord* p_record) ; virtual bool prewrite( EventRecord* p_record) ; //----------------------------------------------------------------------------- // Enumerated constants describing the start word/cluster width bitfields //----------------------------------------------------------------------------- // identical to CP2D_StorableBank enum { pad_nbits = 6, pad_mask = BitMask::nbits06, pad_shift = 0, pad_loval = 0, pad_hival = pad_mask }; enum { westeast_nbits = 1, westeast_mask = BitMask::nbits01, westeast_shift = 6, westeast_loval = 0, westeast_hival = westeast_mask }; enum { module_nbits = 5, module_mask = BitMask::nbits05, module_shift = 8, module_loval = 0, module_hival = module_mask }; private: uint2 _chid; uint2 _energy; }; inline uint2 CP2Q::chid() const{ return(_chid);} inline std::ostream& operator << (std::ostream& os, const CP2Q& inter) { inter.print(os); return os; } inline int CP2Q::module() const { return( (_chid >> module_shift) & module_mask ) ; } inline int CP2Q::padNo() const { return( (_chid >> pad_shift) & pad_mask ) ; } inline int CP2Q::we() const { return( (_chid >> westeast_shift) & westeast_mask ) ; } inline uint2 CP2Q::energy() const { return(_energy); } #endif