// access and set functions for binary muon strip tags
// Version 1.0 21 Oct 1998 Richard creation

#include "stripID.h"

ClassImp(stripID)

///////////////////////////////////////////////////////////////////////////
//                                                                        
// stripID                                                                
//                                                                        
// 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
//                                                                        
///////////////////////////////////////////////////////////////////////////
///________________________________________________________________________
 stripID::stripID() {
    // Default constructor
m_tag = 0;
}
///________________________________________________________________________
 stripID::stripID(UInt_t tag=0) : m_tag(tag) {
  // Create a stripID object with number tag
}
///________________________________________________________________________
 UInt_t stripID::tag() const {
  // Returns the tower number
 return m_tag;
}
///________________________________________________________________________
 void stripID::setTag(UInt_t tagVal) { 
  // Sets the m_tag to tagVal
   m_tag = tagVal;
}
///________________________________________________________________________
 Int_t stripID::c1() const {
// theta bin in bits 0-11. c1 extracts those bits.
    Int_t  theta = (stripID::c1On & m_tag);

    return theta;
}
///________________________________________________________________________
 void stripID::setC1(Int_t tag) {
// setC1 sets tag theta bits in appropriate place (bits 0-11)
    Int_t c1Shift = tag & stripID::c1On;
    Int_t  theta = (stripID::c1Off & m_tag) | c1Shift;
    m_tag = theta;
}
///________________________________________________________________________
 Int_t stripID::c2() const {
  // phi bin in bits 12-23. c2 extracts those bits, shifts to "bottom"
  // and returns them.
    Int_t  phi = (stripID::c2On & m_tag) >> 12;
    return phi;
}
///________________________________________________________________________
 void stripID::setC2(Int_t tag) {
// setC2 sets tag phi bits in appropriate place (bits 12-23)
    Int_t c2Shift = (tag << 12) & stripID::c2On;
    Int_t  phi = (stripID::c2Off & m_tag) | c2Shift;
    m_tag = phi;
}
///________________________________________________________________________
 Int_t stripID::layer() const {
// layer bin in bits 24-28. Extracts those bits, shift down to lsb, return.
    Int_t  layer = (stripID::layerOn & m_tag) >> 24;
    return layer;
}
///________________________________________________________________________
 void stripID::setLayer(Int_t tag) {
// setLayer sets tag layer into appropriate bits (24-28)
    Int_t layerShift = (tag << 24) & stripID::layerOn;
    Int_t  layer = (stripID::layerOff & m_tag) | layerShift;
    m_tag = layer;
}
///________________________________________________________________________
 Int_t stripID::barrelEndcap() const {
// barrelEndcap in bit 31. Extract, shift down to lsb, and return it.
    Int_t  barrelEndcap = (stripID::barrelEndcapOn & m_tag) >> 31;
    return barrelEndcap;
}
///________________________________________________________________________
 void stripID::setBarrelEndcap(Int_t tag) {
// Sets tag barrelEndcap bit in proper place (bit 31)
    Int_t barrelEndcapShift = (tag << 31) & stripID::barrelEndcapOn;
    Int_t  barrelEndcap = (stripID::barrelEndcapOff & m_tag) 
      | barrelEndcapShift;
    m_tag = barrelEndcap;
}
///________________________________________________________________________
 Int_t stripID::northSouth() const {
// north/south in bit 30. Extract it and return (shifted down to lsb)
    Int_t  northSouth = (stripID::northSouthOn & m_tag) >> 30;
    return northSouth;
}
///________________________________________________________________________
 void stripID::setNorthSouth(Int_t tag) {
// setNorthSouth sets tag N/S bit in proper place (bit 30)
    Int_t northSouthShift = (tag << 30) & stripID::northSouthOn;
    Int_t  northSouth = (stripID::northSouthOff & m_tag) | northSouthShift;
    m_tag = northSouth;
}
///________________________________________________________________________


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

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

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

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

const Int_t  stripID::barrelEndcapOn =  0x80000000;
const Int_t  stripID::barrelEndcapOff = ~stripID::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.