#ifndef STNTUPLE_TStnSiDigiCode #define STNTUPLE_TStnSiDigiCode //----------------------------------------------------------------------------- // See SiliconGeometry/SiDigiCode.hh. // // This just gives a fairly compact unique number to every detector // element in the silicon system. // // Author: Aaron Dominguez (CDF/LBNL) // Date: May 4 2001 //----------------------------------------------------------------------------- #include "TObject.h" class TStnSiDigiCode: public TObject { public: //------------------------------------------------------------------------------ // data members //------------------------------------------------------------------------------ UShort_t fDigiCode; // Unique code for detector element //------------------------------------------------------------------------------ // functions //------------------------------------------------------------------------------ // ****** constructors and destructor TStnSiDigiCode(); TStnSiDigiCode(UShort_t code); TStnSiDigiCode(Int_t barrel, Int_t ladderSeg, Int_t phiWedge, Int_t layer, Int_t side); virtual ~TStnSiDigiCode(); // ****** accessors UInt_t Barrel () const { return (fDigiCode >> 6) & 0x03; } UInt_t LadderSeg() const { return (fDigiCode >> 4) & 0x03; } UInt_t PhiWedge () const { return (fDigiCode >> 8) & 0x3F; } UInt_t Layer () const { return (fDigiCode >> 1) & 0x07; } UInt_t Side () const { return (fDigiCode >> 0) & 0x01; } void Print(Option_t* option = "") const; // ****** modifiers void SetBarrel(UInt_t barrel) { fDigiCode = fDigiCode & 0xFFFFFF3F; fDigiCode |= (barrel & 0x00000003) << 6; } void SetLadderSeg(UInt_t ladderSeg) { fDigiCode = fDigiCode & 0xFFFFFFCF; fDigiCode |= (ladderSeg & 0x00000003) << 4; } void SetPhiWedge(UInt_t phiWedge) { fDigiCode = fDigiCode & 0xFFFFC0FF; fDigiCode |= (phiWedge & 0x0000003F) << 8; } void SetLayer(UInt_t layer) { fDigiCode = fDigiCode & 0xFFFFFFF1; fDigiCode |= (layer & 0x00000007) << 1; } void SetSide(UInt_t side) { fDigiCode = fDigiCode & 0xFFFFFFFE; fDigiCode |= (side & 0x00000001) << 0; } // Override the Hash(), IsEqual(), & Compare() to use as an index in containers virtual ULong_t Hash() const; virtual Bool_t IsEqual(const TObject *obj) const; virtual Int_t Compare(const TObject *obj) const; virtual Bool_t IsSortable() const { return kTRUE; } ClassDef(TStnSiDigiCode,3) }; #endif