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, const unsigned int size=0)
 Constructor from VeloChannelID and optional size.
 LHCbID (const ITChannelID &chanID, const unsigned int size=0)
 Constructor from ITChannelID and optional size.
 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
 Returns the ChannelID part, for printing...
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 Tue Jun 28 16:58:05 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 142 of file LHCbID.h.

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

enum LHCbID::lhcbIDBits [private]
 

Offsets of bitfield lhcbID.

Enumeration values:
IDBits 
detectorTypeBits 

Definition at line 150 of file LHCbID.h.

00150                  {IDBits           = 0,
00151                   detectorTypeBits = 28};

enum LHCbID::lhcbIDMasks [private]
 

Bitmasks for bitfield lhcbID.

Enumeration values:
IDMask 
detectorTypeMask 

Definition at line 154 of file LHCbID.h.

00154                   {IDMask           = 0xFFFFFFFL,
00155                    detectorTypeMask = 0xF0000000L};

enum LHCbID::SpecificBits [protected]
 

enumeration of the specific bits

Enumeration values:
veloBits 
stBits 
otBits 

Definition at line 135 of file LHCbID.h.

00135                    { veloBits=21,
00136                      stBits=26,
00137                      otBits=26 };

enum LHCbID::SpecificMask [protected]
 

enumeration of the specific mask

Enumeration values:
veloMask 
stMask 
otMask 

Definition at line 131 of file LHCbID.h.

00131                    { veloMask= 0x1FFFFFL,
00132                      stMask=0x3FFFFFFL,
00133                      otMask=0x3FFFFFFL };


Constructor & Destructor Documentation

LHCbID::LHCbID const VeloChannelID &  chanID,
const unsigned int  size = 0
[inline]
 

Constructor from VeloChannelID and optional size.

Definition at line 168 of file LHCbID.h.

References detectorTypeBits, m_lhcbID, veloBits, and veloType.

00170 {
00171 
00172 m_lhcbID = (veloType << detectorTypeBits) +
00173            (size     << veloBits ) +
00174            chanID;
00175           
00176 }

LHCbID::LHCbID const ITChannelID &  chanID,
const unsigned int  size = 0
[inline]
 

Constructor from ITChannelID and optional size.

Definition at line 178 of file LHCbID.h.

References detectorTypeBits, m_lhcbID, stBits, and stType.

00180 {
00181 
00182 m_lhcbID = (stType << detectorTypeBits) +
00183           (size   << stBits ) +
00184           ((chanID.uniqueWafer()-1) >>6) +
00185           (chanID.strip()-1) ;
00186         
00187 }

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

Constructor from OTChannelID.

Definition at line 189 of file LHCbID.h.

References detectorTypeBits, m_lhcbID, and otType.

00190 {
00191 
00192 m_lhcbID = (otType << detectorTypeBits) + chanID;
00193         
00194 }

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

Constructor from RichSmartID.

Definition at line 196 of file LHCbID.h.

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

00196                                                : m_lhcbID(0) 
00197 {
00198 
00199   unsigned int richData = chanID.dataBitsOnly();
00200   if( chanID.pixelDataAreValid() ) richData += 0x8000000;
00201   setDetectorType( richType );
00202   setID( richData );
00203          
00204 }

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

Constructor from CaloCellID.

Definition at line 206 of file LHCbID.h.

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

00206                                               : m_lhcbID(0) 
00207 {
00208 
00209   setDetectorType( caloType );
00210   setID( chanID.ccid() );
00211          
00212 }

LHCbID::LHCbID  )  [inline]
 

Default Constructor.

Definition at line 62 of file LHCbID.h.

References m_lhcbID.

00062 : m_lhcbID(0) {}

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

Default Destructor.

Definition at line 65 of file LHCbID.h.

00065 {}


Member Function Documentation

CaloCellID LHCbID::caloID  )  const [inline]
 

return the CaloCellID

Definition at line 327 of file LHCbID.h.

References IDMask, isCalo(), and m_lhcbID.

00328 {
00329 
00330   return isCalo() ? (m_lhcbID & IDMask) : 0xF0000000;
00331          
00332 }

unsigned int LHCbID::channelID  )  const [inline]
 

Returns the ChannelID part, for printing...

Definition at line 334 of file LHCbID.h.

References IDMask, and m_lhcbID.

Referenced by TrFitTrack2TrackCnv::execute().

00335 {
00336 
00337 return m_lhcbID & IDMask;
00338         
00339 }

unsigned int LHCbID::detectorType  )  const [inline]
 

Retrieve the LHCb detector type bits.

Definition at line 239 of file LHCbID.h.

References detectorTypeBits, detectorTypeMask, and m_lhcbID.

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

00240 {
00241   return (unsigned int)((m_lhcbID & detectorTypeMask) >> detectorTypeBits);
00242 }

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

Fill the ASCII output stream.

Definition at line 220 of file LHCbID.h.

References m_lhcbID.

00221 {
00222   s << "{ " << "lhcbID :        " << m_lhcbID << std::endl << " }";
00223   return s;
00224 }

bool LHCbID::isCalo  )  const [inline]
 

return true if this is a Calo identifier

Definition at line 320 of file LHCbID.h.

References caloType, and detectorType().

Referenced by caloID().

00321 {
00322 
00323   return (caloType == detectorType());
00324          
00325 }

bool LHCbID::isOT  )  const [inline]
 

return true if this is a Outer Tracker identifier

Definition at line 288 of file LHCbID.h.

References detectorType(), and otType.

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

00289 {
00290 
00291 return (otType == detectorType());
00292          
00293 }

bool LHCbID::isRich  )  const [inline]
 

return true if this is a Rich identifier

Definition at line 303 of file LHCbID.h.

References detectorType(), and richType.

Referenced by richID().

00304 {
00305 
00306   return (richType == detectorType());
00307          
00308 }

bool LHCbID::isST  )  const [inline]
 

return true if this is a Silicon Tracker identifier

Definition at line 273 of file LHCbID.h.

References detectorType(), and stType.

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

00274 {
00275 
00276   return (stType == detectorType());
00277          
00278 }

bool LHCbID::isVelo  )  const [inline]
 

return true if this is a Velo identifier

Definition at line 258 of file LHCbID.h.

References detectorType(), and veloType.

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

00259 {
00260 
00261   return (veloType == detectorType());
00262          
00263 }

unsigned int LHCbID::lhcbID  )  const [inline]
 

Retrieve const the internal representation.

Definition at line 227 of file LHCbID.h.

References m_lhcbID.

Referenced by TrFitTrack2TrackCnv::execute().

00228 {
00229   return m_lhcbID;
00230 }

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

comparison equality

Definition at line 251 of file LHCbID.h.

00252 {
00253 
00254   return (this->lhcbID() == chanID.lhcbID());
00255          
00256 }

OTChannelID LHCbID::otID  )  const [inline]
 

return the OTChannelID

Definition at line 295 of file LHCbID.h.

References isOT(), m_lhcbID, and otMask.

00296 {
00297 
00298 if ( !isOT() ) return  0xF0000000;
00299 return m_lhcbID & otMask;
00300          
00301 }

RichSmartID LHCbID::richID  )  const [inline]
 

return the richSmartID

Definition at line 310 of file LHCbID.h.

References IDMask, isRich(), and m_lhcbID.

00311 {
00312 
00313 if ( !isRich() ) return 0x0;
00314 int id = m_lhcbID & IDMask;
00315 if( id && 0x8000000 ) id = id | 0x7E000000;
00316 return id;
00317          
00318 }

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

Update the LHCb detector type bits.

Definition at line 244 of file LHCbID.h.

References detectorTypeBits, detectorTypeMask, and m_lhcbID.

Referenced by LHCbID().

00245 {
00246   unsigned int val = (unsigned int)value;
00247   m_lhcbID &= ~detectorTypeMask;
00248   m_lhcbID |= ((((unsigned int)val) << detectorTypeBits) & detectorTypeMask);
00249 }

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

Update the ID bits (to recreate the channelID).

Definition at line 232 of file LHCbID.h.

References IDBits, IDMask, and m_lhcbID.

Referenced by LHCbID().

00233 {
00234   unsigned int val = (unsigned int)value;
00235   m_lhcbID &= ~IDMask;
00236   m_lhcbID |= ((((unsigned int)val) << IDBits) & IDMask);
00237 }

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

set the spare bits

Definition at line 341 of file LHCbID.h.

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

Referenced by TrFitTrack2TrackCnv::execute(), and OTMeasurement::OTMeasurement().

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

unsigned int LHCbID::spareBits  )  const [inline]
 

retrieve the spare bits

Definition at line 362 of file LHCbID.h.

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

Referenced by TrFitTrack2TrackCnv::execute().

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

ITChannelID LHCbID::stID  )  const [inline]
 

return the ITChannelID

Definition at line 280 of file LHCbID.h.

References isST(), and m_lhcbID.

00281 {
00282 
00283 if ( !isST() ) return 0xF0000000;
00284 return ( ( (m_lhcbID & 0x3FFFC00 ) << 6) + ( m_lhcbID & 0x3FF));
00285          
00286 }

VeloChannelID LHCbID::veloID  )  const [inline]
 

return the VeloChannelID

Definition at line 265 of file LHCbID.h.

References isVelo(), m_lhcbID, and veloMask.

00266 {
00267 
00268 if ( !isVelo() ) return 0xF0000000;
00269 return ( m_lhcbID & veloMask );
00270          
00271 }


Friends And Related Function Documentation

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

Operator overloading for stringoutput.

Definition at line 214 of file LHCbID.h.

00216 {
00217   return obj.fillStream(str);
00218 }


Member Data Documentation

unsigned int LHCbID::m_lhcbID [private]
 

the internal representation

Definition at line 158 of file LHCbID.h.

Referenced by caloID(), channelID(), detectorType(), fillStream(), lhcbID(), LHCbID(), otID(), richID(), setDetectorType(), setID(), setSpareBits(), spareBits(), stID(), and veloID().


The documentation for this class was generated from the following file:
Generated on Mon Jul 4 13:54:44 2005 for New Track Event Model by doxygen 1.4.1