CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types

HcalZDCDetId Class Reference

#include <HcalZDCDetId.h>

Inheritance diagram for HcalZDCDetId:
DetId

List of all members.

Public Types

enum  { kSizeForDenseIndexing = 2*kDepTot }
enum  Section { Unknown = 0, EM = 1, HAD = 2, LUM = 3 }

Public Member Functions

int channel () const
 get the channel
uint32_t denseIndex () const
int depth () const
 get the depth (1 for EM, channel + 1 for HAD, not sure yet for LUM, leave as default)
 HcalZDCDetId (const DetId &id)
 HcalZDCDetId (uint32_t rawid)
 HcalZDCDetId ()
 HcalZDCDetId (Section section, bool true_for_positive_eta, int channel)
HcalZDCDetIdoperator= (const DetId &id)
Section section () const
 get the section
int zside () const
 get the z-side of the cell (1/-1)

Static Public Member Functions

static HcalZDCDetId detIdFromDenseIndex (uint32_t di)
static bool validDenseIndex (uint32_t di)
static bool validDetId (Section se, int dp)

Static Public Attributes

static const int SubdetectorId = 2

Private Types

enum  { kDepEM = 5, kDepHAD = 4, kDepLUM = 2, kDepTot = kDepEM + kDepHAD + kDepLUM }

Detailed Description

Contents of the HcalZDCDetId : [6] Z position (true for positive) [5:4] Section (EM/HAD/Lumi) [3:0] Channel

Date:
2009/02/09 16:48:01
Revision:
1.5
Author:
J. Mans - Minnesota

Definition at line 18 of file HcalZDCDetId.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kDepEM 
kDepHAD 
kDepLUM 
kDepTot 

Definition at line 54 of file HcalZDCDetId.h.

           { kDepEM  = 5,
             kDepHAD = 4,
             kDepLUM = 2,
             kDepTot = kDepEM + kDepHAD + kDepLUM };
anonymous enum
Enumerator:
kSizeForDenseIndexing 

Definition at line 61 of file HcalZDCDetId.h.

Enumerator:
Unknown 
EM 
HAD 
LUM 

Definition at line 20 of file HcalZDCDetId.h.

{ Unknown=0, EM=1, HAD=2, LUM=3 };

Constructor & Destructor Documentation

HcalZDCDetId::HcalZDCDetId ( )

Create a null cellid

Definition at line 4 of file HcalZDCDetId.cc.

Referenced by detIdFromDenseIndex().

                           : DetId() {
}
HcalZDCDetId::HcalZDCDetId ( uint32_t  rawid)

Create cellid from raw id (0=invalid tower id)

Definition at line 8 of file HcalZDCDetId.cc.

                                         : DetId(rawid) {
}
HcalZDCDetId::HcalZDCDetId ( Section  section,
bool  true_for_positive_eta,
int  channel 
)

Constructor from section, eta sign, and channel

Definition at line 11 of file HcalZDCDetId.cc.

References DetId::id_.

                                                                                   : DetId(DetId::Calo,SubdetectorId) {
  id_|=(section&0x3)<<4;
  if (true_for_positive_eta) id_|=0x40;
  id_|=channel&0xF;
}
HcalZDCDetId::HcalZDCDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 17 of file HcalZDCDetId.cc.

References DetId::Calo, DetId::det(), Exception, DetId::id_, DetId::null(), DetId::rawId(), SubdetectorId, and DetId::subdetId().

                                           {
  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetectorId)) {
    throw cms::Exception("Invalid DetId") << "Cannot initialize ZDCDetId from " << std::hex << gen.rawId() << std::dec; 
  }
  id_=gen.rawId();
}

Member Function Documentation

int HcalZDCDetId::channel ( ) const [inline]
uint32_t HcalZDCDetId::denseIndex ( ) const

Definition at line 33 of file HcalZDCDetId.cc.

References channel(), HAD, kDepEM, kDepHAD, kDepTot, LUM, section(), and zside().

{
   const int se ( section() ) ;
   return ( ( zside()<0 ? 0 : kDepTot ) + channel() - 1 +
            ( se == HAD  ? kDepEM :
              ( se == LUM ? kDepEM + kDepHAD : 0 ) ) ) ;
}
int HcalZDCDetId::depth ( ) const [inline]

get the depth (1 for EM, channel + 1 for HAD, not sure yet for LUM, leave as default)

Definition at line 40 of file HcalZDCDetId.h.

References DetId::id_.

Referenced by ZdcTBAnalysis::analyze(), and ZDCLogicalMapEntry::printLMapLine().

{ return (((id_>>4)&0x3)==1)?(1):((((id_>>4)&0x3)==2)?((id_&0xF)+1):(id_&0xF)); }
HcalZDCDetId HcalZDCDetId::detIdFromDenseIndex ( uint32_t  di) [static]

Definition at line 42 of file HcalZDCDetId.cc.

References EM, HAD, HcalZDCDetId(), recoMuon::in, kDepEM, kDepHAD, kDepTot, LUM, and validDenseIndex().

Referenced by CaloGenericDetId::CaloGenericDetId().

{
   if( validDenseIndex( di ) )
   {
      const bool lz ( di >= kDepTot ) ;
      const uint32_t in ( di%kDepTot ) ;
      const Section se ( in<kDepEM ? EM :
                         ( in<kDepEM+kDepHAD ? HAD : LUM ) ) ;
      const uint32_t dp ( EM == se ? in+1 :
                          ( HAD == se ? in - kDepEM + 1 : in - kDepEM - kDepHAD + 1 ) ) ;
      return HcalZDCDetId( se, lz, dp ) ;
   }
   else
   {
      return HcalZDCDetId() ;
   }
}
HcalZDCDetId & HcalZDCDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 24 of file HcalZDCDetId.cc.

References DetId::Calo, DetId::det(), Exception, DetId::id_, DetId::null(), DetId::rawId(), SubdetectorId, and DetId::subdetId().

                                                      {
  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetectorId)) {
    throw cms::Exception("Invalid DetId") << "Cannot assign ZDCDetId from " << std::hex << gen.rawId() << std::dec; 
  }
  id_=gen.rawId();
  return *this;
}
Section HcalZDCDetId::section ( ) const [inline]
static bool HcalZDCDetId::validDenseIndex ( uint32_t  di) [inline, static]

Definition at line 46 of file HcalZDCDetId.h.

References kSizeForDenseIndexing.

Referenced by detIdFromDenseIndex().

{ return ( di < kSizeForDenseIndexing ) ; }
bool HcalZDCDetId::validDetId ( Section  se,
int  dp 
) [static]

Definition at line 61 of file HcalZDCDetId.cc.

References EM, HAD, kDepEM, kDepHAD, kDepLUM, and LUM.

{
  return ( dp >= 1 && (
                       ( ( se == EM      ) &&
                         ( dp <= kDepEM  )    ) ||
                       ( ( se == HAD     ) &&
                         ( dp <= kDepHAD )    ) ||
                       ( ( se == LUM     ) &&
                         ( dp <= kDepLUM )    )   
                       )
           ) ;
}
int HcalZDCDetId::zside ( ) const [inline]

Member Data Documentation

const int HcalZDCDetId::SubdetectorId = 2 [static]