Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

StripId.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // The StripId class contains strip identification information.  This
00004 // includes the strip number within the layer, the tower (always 0 for
00005 // the '99/2000 beamtest, and the controller the strip was read out on.
00006 //
00008 
00009 #include "digiRootData/StripId.h"
00010 
00011 ClassImp(StripId)
00012 
00014 // Construction/Destruction
00016 
00018 StripId::StripId() : m_tag(0), m_cable(0)
00019 {
00020 
00021 }
00022 
00024 
00026 // Member functions
00028 
00030 Int_t StripId::Compare(TObject *obj) {
00031   StripId *strip;
00032   if (strip = dynamic_cast<StripId*>(obj)) {
00033     if (strip == this)
00034       return 0;
00035     else {
00036       UInt_t id_this = getId();
00037       UInt_t id_strip = strip->getId();
00038       if (id_this == id_strip)
00039         return 0;
00040       else
00041         return (id_this > id_strip) ? 1 : -1;
00042     }
00043   }
00044   else {
00045     return 0;
00046   }
00047 }
00049 Bool_t StripId::IsSortable() const {
00050   return kTRUE;
00051 }
00053 Bool_t StripId::setStrip(UShort_t stripVal) {
00054     if (!(stripVal & ~TKR_M_STRIP)) {
00055         m_tag &= ~(TKR_M_STRIP << TKR_V_STRIP);
00056         m_tag |= (stripVal << TKR_V_STRIP);
00057         return kTRUE;
00058     }
00059     else
00060         return kFALSE;
00061 }
00062 
00064 Bool_t StripId::setController(UShort_t ctrlVal) {
00065     if (!(ctrlVal & ~TKR_M_CTRL)) {
00066         m_tag &= ~(TKR_M_CTRL << TKR_V_CTRL);
00067         m_tag |= (ctrlVal << TKR_V_CTRL);
00068         return kTRUE;
00069     }
00070     else
00071         return kFALSE;
00072 }
00073 
00075 Bool_t StripId::setTower(UShort_t towerVal) {
00076     if (!(towerVal & ~TKR_M_TOWER)) {
00077         m_tag &= ~(TKR_M_TOWER << TKR_V_TOWER);
00078         m_tag |= (towerVal << TKR_V_TOWER);
00079         return kTRUE;
00080     }
00081     else
00082         return kFALSE;
00083 }
00084 
00085 
00086 Bool_t StripId::setCable(UChar_t cableVal, UChar_t cntrl) {
00087     m_cable = cableVal;
00088     return (setController(cntrl));
00089 }

Generated at Wed Nov 21 12:22:45 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000