// ----------------------------------------------------------------------------
// $Id: LCDstripID.cxx,v 1.1 2001/05/10 17:25:14 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDstripID.cxx,v $
// Revision 1.1  2001/05/10 17:25:14  toshi
// Rename *.C to *.cxx.
//
// Revision 1.2  2001/04/28 23:49:16  toshi
// Start to use CVS.
//
//
// access and set functions for binary muon strip tags
// Version 1.0 21 Oct 1998 Richard creation
///////////////////////////////////////////////////////////////////////////
//                                                                        
// LCDstripID                                                                
//                                                                        
// The stripID class contains a strip ID number and functions to
// obtain the location of the strip in question. StripID is used in the   
// class StripHit
//                                                                        
///////////////////////////////////////////////////////////////////////////

#include "LCDstripID.h"

ClassImp(LCDstripID)

///________________________________________________________________________
 LCDstripID::LCDstripID() {
    // Default constructor
  m_tag = 0;
}
///________________________________________________________________________
 LCDstripID::LCDstripID(UInt_t tag=0) : m_tag(tag) {
  // Create a stripID object with number tag
}
///________________________________________________________________________
 UInt_t LCDstripID::tag() const {
  // Returns the tower number
  return m_tag;
}
///________________________________________________________________________
 void LCDstripID::SetTag(UInt_t tagVal) { 
  // Sets the m_tag to tagVal
  m_tag = tagVal;
}
///________________________________________________________________________
 Int_t LCDstripID::c1() const {
// theta bin in bits 0-11. c1 extracts those bits.
  Int_t  theta = (LCDstripID::c1On & m_tag);
  
  return theta;
}
///________________________________________________________________________
 void LCDstripID::SetC1(Int_t tag) {
  // SetC1 sets tag theta bits in appropriate place (bits 0-11)
  Int_t c1Shift = tag & LCDstripID::c1On;
  Int_t  theta = (LCDstripID::c1Off & m_tag) | c1Shift;
  m_tag = theta;
}
///________________________________________________________________________
 Int_t LCDstripID::c2() const {
  // phi bin in bits 12-23. c2 extracts those bits, shifts to "bottom"
  // and returns them.
  Int_t  phi = (LCDstripID::c2On & m_tag) >> 12;
  return phi;
}
///________________________________________________________________________
 void LCDstripID::SetC2(Int_t tag) {
  // SetC2 sets tag phi bits in appropriate place (bits 12-23)
  Int_t c2Shift = (tag << 12) & LCDstripID::c2On;
  Int_t  phi = (LCDstripID::c2Off & m_tag) | c2Shift;
  m_tag = phi;
}
///________________________________________________________________________
 Int_t LCDstripID::layer() const {
  // layer bin in bits 24-28. Extracts those bits, shift down to lsb, return.
  Int_t  layer = (LCDstripID::layerOn & m_tag) >> 24;
  return layer;
}
///________________________________________________________________________
 void LCDstripID::SetLayer(Int_t tag) {
  // SetLayer sets tag layer into appropriate bits (24-28)
  Int_t layerShift = (tag << 24) & LCDstripID::layerOn;
  Int_t  layer = (LCDstripID::layerOff & m_tag) | layerShift;
  m_tag = layer;
}
///________________________________________________________________________
 Int_t LCDstripID::barrelEndcap() const {
  // barrelEndcap in bit 31. Extract, shift down to lsb, and return it.
  Int_t  barrelEndcap = (LCDstripID::barrelEndcapOn & m_tag) >> 31;
  return barrelEndcap;
}
///________________________________________________________________________
 void LCDstripID::SetBarrelEndcap(Int_t tag) {
  // Sets tag barrelEndcap bit in proper place (bit 31)
  Int_t barrelEndcapShift = (tag << 31) & LCDstripID::barrelEndcapOn;
  Int_t  barrelEndcap = (LCDstripID::barrelEndcapOff & m_tag) 
    | barrelEndcapShift;
  m_tag = barrelEndcap;
}
///________________________________________________________________________
 Int_t LCDstripID::northSouth() const {
  // north/south in bit 30. Extract it and return (shifted down to lsb)
  Int_t  northSouth = (LCDstripID::northSouthOn & m_tag) >> 30;
  return northSouth;
}
///________________________________________________________________________
 void LCDstripID::SetNorthSouth(Int_t tag) {
  // SetNorthSouth sets tag N/S bit in proper place (bit 30)
  Int_t northSouthShift = (tag << 30) & LCDstripID::northSouthOn;
  Int_t  northSouth = (LCDstripID::northSouthOff & m_tag) | northSouthShift;
  m_tag = northSouth;
}
///________________________________________________________________________


const Int_t  LCDstripID::c1On =	        0x00000FFF;
const Int_t  LCDstripID::c1Off =	~LCDstripID::c1On;

const Int_t  LCDstripID::c2On =	        0x00FFF000;
const Int_t  LCDstripID::c2Off =	~LCDstripID::c2On;

const Int_t  LCDstripID::layerOn =	  0x1F000000;
const Int_t  LCDstripID::layerOff =        ~LCDstripID::layerOn;

const Int_t  LCDstripID::northSouthOn =    0x40000000;
const Int_t  LCDstripID::northSouthOff =   ~LCDstripID::northSouthOn;

const Int_t  LCDstripID::barrelEndcapOn =  0x80000000;
const Int_t  LCDstripID::barrelEndcapOff = ~LCDstripID::barrelEndcapOn;


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.