Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

LHCbID Class Reference

#include <LHCbID.h>

List of all members.

Public Member Functions

 LHCbID (const VeloChannelID &chanID)
 Constructor from VeloChannelID.
 LHCbID (const ITChannelID &chanID)
 Constructor from ITChannelID.
 LHCbID (const OTChannelID &chanID)
 Constructor from OTChannelID.
 LHCbID (const RichSmartID &chanID)
 Constructor from RichSmartID.
 LHCbID (const CaloCellID &chanID)
 Constructor from CaloCellID.
 LHCbID ()
 Default Constructor.
virtual ~LHCbID ()
 Default Destructor.
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the ASCII output stream.
bool operator== (const LHCbID &chanID) const
 comparison equality
bool isVelo () const
 return true if this is a Velo identifier
VeloChannelID veloID () const
 return the VeloChannelID
bool isST () const
 return true if this is a Silicon Tracker identifier
ITChannelID stID () const
 return the ITChannelID
bool isOT () const
 return true if this is a Outer Tracker identifier
OTChannelID otID () const
 return the OTChannelID
bool isRich () const
 return true if this is a Rich identifier
RichSmartID richID () const
 return the richSmartID
bool isCalo () const
 return true if this is a Calo identifier
CaloCellID caloID () const
 return the CaloCellID
unsigned int channelID () const
 return the specific detector channelID (the key value)
void setSpareBits (unsigned int value)
 set the spare bits
unsigned int spareBits () const
 retrieve the spare bits
unsigned int lhcbID () const
 Retrieve const the internal representation.
void setID (unsigned int value)
 Update the ID bits (to recreate the channelID).
unsigned int detectorType () const
 Retrieve the LHCb detector type bits.
void setDetectorType (unsigned int value)
 Update the LHCb detector type bits.

Protected Types

enum  SpecificMask { veloMask = 0x1FFFFFL, stMask = 0x3FFFFFFL, otMask = 0x3FFFFFFL }
 enumeration of the specific mask More...
enum  SpecificBits { veloBits = 21, stBits = 26, otBits = 26 }
 enumeration of the specific bits More...

Private Types

enum  channelIDType {
  veloType = 1, stType, otType, richType,
  caloType, muonType
}
 types of sub-detector channel ID More...
enum  lhcbIDBits { IDBits = 0, detectorTypeBits = 28 }
 Offsets of bitfield lhcbID. More...
enum  lhcbIDMasks { IDMask = 0xFFFFFFFL, detectorTypeMask = 0xF0000000L }
 Bitmasks for bitfield lhcbID. More...

Private Attributes

unsigned int m_lhcbID
 the internal representation

Friends

std::ostream & operator<< (std::ostream &str, const LHCbID &obj)
 Operator overloading for stringoutput.


Detailed Description

LHCb wide channel identifier

Author:
Marco Cattaneo created Wed May 4 11:06:24 2005

Definition at line 40 of file LHCbID.h.


Member Enumeration Documentation

enum LHCbID::channelIDType [private]
 

types of sub-detector channel ID

Enumeration values:
veloType 
stType 
otType 
richType 
caloType 
muonType 

Definition at line 140 of file LHCbID.h.

00140                     { veloType=1,
00141                       stType,
00142                       otType,
00143                       richType,
00144                       caloType,
00145                       muonType };

enum LHCbID::lhcbIDBits [private]
 

Offsets of bitfield lhcbID.

Enumeration values:
IDBits 
detectorTypeBits 

Definition at line 148 of file LHCbID.h.

00148                  {IDBits           = 0,
00149                   detectorTypeBits = 28};

enum LHCbID::lhcbIDMasks [private]
 

Bitmasks for bitfield lhcbID.

Enumeration values:
IDMask 
detectorTypeMask 

Definition at line 152 of file LHCbID.h.

00152                   {IDMask           = 0xFFFFFFFL,
00153                    detectorTypeMask = 0xF0000000L};

enum LHCbID::SpecificBits [protected]
 

enumeration of the specific bits

Enumeration values:
veloBits 
stBits 
otBits 

Definition at line 133 of file LHCbID.h.

00133                    { veloBits=21,
00134                      stBits=26,
00135                      otBits=26 };

enum LHCbID::SpecificMask [protected]
 

enumeration of the specific mask

Enumeration values:
veloMask 
stMask 
otMask 

Definition at line 129 of file LHCbID.h.

00129                    { veloMask= 0x1FFFFFL,
00130                      stMask=0x3FFFFFFL,
00131                      otMask=0x3FFFFFFL };


Constructor & Destructor Documentation

LHCbID::LHCbID const VeloChannelID &  chanID  )  [inline]
 

Constructor from VeloChannelID.

Definition at line 166 of file LHCbID.h.

References setDetectorType(), setID(), and veloType.

00166                                                  : m_lhcbID(0) 
00167 {
00168 
00169   setDetectorType( veloType );
00170   setID( chanID );
00171           
00172 }

LHCbID::LHCbID const ITChannelID &  chanID  )  [inline]
 

Constructor from ITChannelID.

Definition at line 174 of file LHCbID.h.

References setDetectorType(), setID(), and stType.

00174                                                : m_lhcbID(0) 
00175 {
00176 
00177   setDetectorType( stType );
00178   setID( ((chanID.uniqueWafer()-1)>>4) + (chanID.strip()-1) );
00179           
00180 }

LHCbID::LHCbID const OTChannelID &  chanID  )  [inline]
 

Constructor from OTChannelID.

Definition at line 182 of file LHCbID.h.

References otType, setDetectorType(), and setID().

00182                                                : m_lhcbID(0) 
00183 {
00184 
00185   setDetectorType( otType );
00186   setID( chanID );
00187         
00188 }

LHCbID::LHCbID const RichSmartID &  chanID  )  [inline]
 

Constructor from RichSmartID.

Definition at line 190 of file LHCbID.h.

References richType, setDetectorType(), and setID().

00190                                                : m_lhcbID(0) 
00191 {
00192 
00193   unsigned int richData = chanID.dataBitsOnly();
00194   if( chanID.pixelDataAreValid() ) richData += 0x8000000;
00195   setDetectorType( richType );
00196   setID( richData );
00197          
00198 }

LHCbID::LHCbID const CaloCellID &  chanID  )  [inline]
 

Constructor from CaloCellID.

Definition at line 200 of file LHCbID.h.

References caloType, setDetectorType(), and setID().

00200                                               : m_lhcbID(0) 
00201 {
00202 
00203   setDetectorType( caloType );
00204   setID( chanID.ccid() );
00205          
00206 }

LHCbID::LHCbID  )  [inline]
 

Default Constructor.

Definition at line 60 of file LHCbID.h.

References m_lhcbID.

00060 : m_lhcbID(0) {}

virtual LHCbID::~LHCbID  )  [inline, virtual]
 

Default Destructor.

Definition at line 63 of file LHCbID.h.

00063 {}


Member Function Documentation

CaloCellID LHCbID::caloID  )  const [inline]
 

return the CaloCellID

Definition at line 315 of file LHCbID.h.

References channelID(), and isCalo().

00316 {
00317 
00318   return isCalo() ? channelID() : 0xF0000000;
00319          
00320 }

unsigned int LHCbID::channelID  )  const [inline]
 

return the specific detector channelID (the key value)

Definition at line 322 of file LHCbID.h.

References IDBits, IDMask, isOT(), isRich(), isST(), isVelo(), m_lhcbID, otMask, stMask, and veloMask.

Referenced by caloID(), otID(), richID(), stID(), and veloID().

00323 {
00324 
00325   unsigned mask = IDMask;
00326   unsigned bits  = IDBits;
00327   if (isVelo()) mask = veloMask;
00328   if (isOT()) mask = otMask;
00329   if (isST()) mask = stMask;
00330   unsigned int id = (m_lhcbID & mask) >> bits;
00331   if (isST()) id = (((id & 0xFFFF000) << 4)+(id & 0xFFF));
00332   if (isRich())  {  
00333     id = id & 0x7000000;
00334     if( id && 0x8000000 ) id = id + 0x7E000000;
00335   }
00336   return id;
00337         
00338 }

unsigned int LHCbID::detectorType  )  const [inline]
 

Retrieve the LHCb detector type bits.

Definition at line 233 of file LHCbID.h.

References detectorTypeBits, detectorTypeMask, and m_lhcbID.

Referenced by isCalo(), isOT(), isRich(), isST(), and isVelo().

00234 {
00235   return (unsigned int)((m_lhcbID & detectorTypeMask) >> detectorTypeBits);
00236 }

std::ostream & LHCbID::fillStream std::ostream &  s  )  const [inline, virtual]
 

Fill the ASCII output stream.

Definition at line 214 of file LHCbID.h.

References m_lhcbID.

00215 {
00216   s << "{ " << "lhcbID :        " << m_lhcbID << std::endl << " }";
00217   return s;
00218 }

bool LHCbID::isCalo  )  const [inline]
 

return true if this is a Calo identifier

Definition at line 308 of file LHCbID.h.

References caloType, and detectorType().

Referenced by caloID().

00309 {
00310 
00311   return (caloType == detectorType()) ? true : false;
00312          
00313 }

bool LHCbID::isOT  )  const [inline]
 

return true if this is a Outer Tracker identifier

Definition at line 280 of file LHCbID.h.

References detectorType(), and otType.

Referenced by channelID(), otID(), setSpareBits(), and spareBits().

00281 {
00282 
00283   return (otType == detectorType()) ? true : false;
00284          
00285 }

bool LHCbID::isRich  )  const [inline]
 

return true if this is a Rich identifier

Definition at line 294 of file LHCbID.h.

References detectorType(), and richType.

Referenced by channelID(), and richID().

00295 {
00296 
00297   return (richType == detectorType()) ? true : false;
00298          
00299 }

bool LHCbID::isST  )  const [inline]
 

return true if this is a Silicon Tracker identifier

Definition at line 266 of file LHCbID.h.

References detectorType(), and stType.

Referenced by channelID(), setSpareBits(), spareBits(), and stID().

00267 {
00268 
00269   return (stType == detectorType()) ? true : false;
00270          
00271 }

bool LHCbID::isVelo  )  const [inline]
 

return true if this is a Velo identifier

Definition at line 252 of file LHCbID.h.

References detectorType(), and veloType.

Referenced by channelID(), setSpareBits(), spareBits(), and veloID().

00253 {
00254 
00255   return (veloType == detectorType()) ? true : false;
00256          
00257 }

unsigned int LHCbID::lhcbID  )  const [inline]
 

Retrieve const the internal representation.

Definition at line 221 of file LHCbID.h.

References m_lhcbID.

00222 {
00223   return m_lhcbID;
00224 }

bool LHCbID::operator== const LHCbID chanID  )  const [inline]
 

comparison equality

Definition at line 245 of file LHCbID.h.

00246 {
00247 
00248   return (this->lhcbID() == chanID.lhcbID());
00249          
00250 }

OTChannelID LHCbID::otID  )  const [inline]
 

return the OTChannelID

Definition at line 287 of file LHCbID.h.

References channelID(), and isOT().

00288 {
00289 
00290   return isOT() ? channelID() : 0xF0000000;
00291          
00292 }

RichSmartID LHCbID::richID  )  const [inline]
 

return the richSmartID

Definition at line 301 of file LHCbID.h.

References channelID(), and isRich().

00302 {
00303 
00304  return isRich()? channelID():0x0;
00305          
00306 }

void LHCbID::setDetectorType unsigned int  value  )  [inline]
 

Update the LHCb detector type bits.

Definition at line 238 of file LHCbID.h.

References detectorTypeBits, detectorTypeMask, and m_lhcbID.

Referenced by LHCbID().

00239 {
00240   unsigned int val = (unsigned int)value;
00241   m_lhcbID &= ~detectorTypeMask;
00242   m_lhcbID |= ((((unsigned int)val) << detectorTypeBits) & detectorTypeMask);
00243 }

void LHCbID::setID unsigned int  value  )  [inline]
 

Update the ID bits (to recreate the channelID).

Definition at line 226 of file LHCbID.h.

References IDBits, IDMask, and m_lhcbID.

Referenced by LHCbID().

00227 {
00228   unsigned int val = (unsigned int)value;
00229   m_lhcbID &= ~IDMask;
00230   m_lhcbID |= ((((unsigned int)val) << IDBits) & IDMask);
00231 }

void LHCbID::setSpareBits unsigned int  value  )  [inline]
 

set the spare bits

Definition at line 340 of file LHCbID.h.

References IDBits, IDMask, isOT(), isST(), isVelo(), m_lhcbID, otBits, otMask, stBits, stMask, veloBits, and veloMask.

00341 {
00342 
00343   if ( !( isVelo() || isOT() || isST() ) ) return;
00344   unsigned int mask = IDMask;
00345   unsigned int bits = IDBits;
00346   if (isVelo()) {
00347     mask &= (~veloMask);
00348     bits = veloBits;
00349   } else if (isST()) {
00350     mask &= (~stMask);
00351     bits = stBits;
00352   } else if (isOT()) {
00353     mask &= (~otMask);
00354     bits = otBits;
00355   }
00356   m_lhcbID &= ~mask;
00357   m_lhcbID |= ((((unsigned int)value) << bits) & mask);
00358         
00359 }

unsigned int LHCbID::spareBits  )  const [inline]
 

retrieve the spare bits

Definition at line 361 of file LHCbID.h.

References IDBits, IDMask, isOT(), isST(), isVelo(), m_lhcbID, otBits, otMask, stBits, stMask, veloBits, and veloMask.

00362 {
00363 
00364   if ( !( isVelo() || isOT() || isST()) ) return 0;
00365   unsigned int mask = IDMask;
00366   unsigned int bits = IDBits;
00367   if (isVelo()) {
00368      mask &= (~veloMask);         
00369      bits = veloBits;
00370   } else if (isST()) {
00371     mask &= (~stMask);
00372     bits = stBits;
00373   } else if (isOT()) {
00374      mask &= (~otMask);   
00375      bits = otBits;
00376   }
00377   unsigned int val = ((m_lhcbID & mask) >> bits);
00378   return val;
00379          
00380 }

ITChannelID LHCbID::stID  )  const [inline]
 

return the ITChannelID

Definition at line 273 of file LHCbID.h.

References channelID(), and isST().

00274 {
00275 
00276   return isST() ? channelID(): 0xF0000000;
00277          
00278 }

VeloChannelID LHCbID::veloID  )  const [inline]
 

return the VeloChannelID

Definition at line 259 of file LHCbID.h.

References channelID(), and isVelo().

00260 {
00261 
00262   return isVelo() ? channelID() : 0x0;
00263          
00264 }


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  str,
const LHCbID obj
[friend]
 

Operator overloading for stringoutput.

Definition at line 208 of file LHCbID.h.

00210 {
00211   return obj.fillStream(str);
00212 }


Member Data Documentation

unsigned int LHCbID::m_lhcbID [private]
 

the internal representation

Definition at line 156 of file LHCbID.h.

Referenced by channelID(), detectorType(), fillStream(), lhcbID(), LHCbID(), setDetectorType(), setID(), setSpareBits(), and spareBits().


The documentation for this class was generated from the following file:
Generated on Wed May 4 11:52:38 2005 for New Track Event Model by doxygen 1.4.1