CMS 3D CMS Logo

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

CaloTowerDetId Class Reference

#include <CaloTowerDetId.h>

Inheritance diagram for CaloTowerDetId:
DetId HodoscopeDetId

List of all members.

Public Types

enum  {
  kMaxIEta = 41, kMaxIPhi = 72, kBarNPhi = kMaxIPhi, kEndNPhi = kMaxIPhi/2,
  kForNPhi = kMaxIPhi/4, kBarIEta = 20, kEndIEta = 39, kForIEta = kMaxIEta,
  kBarNEta = kBarIEta, kEndNEta = kEndIEta - kBarNEta, kForNEta = kForIEta - kEndIEta, kBarNTot = kBarNPhi*kBarNEta,
  kEndNTot = kEndNPhi*kEndNEta, kForNTot = kForNPhi*kForNEta, kAllNTot = kBarNTot + kEndNTot + kForNTot, kNIndex = 2*kAllNTot
}
enum  { kSizeForDenseIndexing = kNIndex }

Public Member Functions

 CaloTowerDetId ()
 CaloTowerDetId (uint32_t rawid)
 CaloTowerDetId (const DetId &id)
 CaloTowerDetId (int tower_ieta, int tower_iphi)
uint32_t denseIndex () const
int ieta () const
 get the tower ieta
int ietaAbs () const
 get the absolute value of the tower ieta
int iphi () const
 get the tower iphi
CaloTowerDetIdoperator= (const DetId &id)
int zside () const
 get the z-side of the tower (1/-1)

Static Public Member Functions

static CaloTowerDetId detIdFromDenseIndex (uint32_t din)
static bool validDenseIndex (uint32_t din)
static bool validDetId (int ie, int ip)

Static Public Attributes

static const int SubdetId = 1

Detailed Description

CaloTowerDetId uses DetId::Det of Calo and subdetId() of 1.

Date:
2008/06/25 22:14:35
Revision:
1.6
Author:
J. Mans - Minnesota

Definition at line 14 of file CaloTowerDetId.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kMaxIEta 
kMaxIPhi 
kBarNPhi 
kEndNPhi 
kForNPhi 
kBarIEta 
kEndIEta 
kForIEta 
kBarNEta 
kEndNEta 
kForNEta 
kBarNTot 
kEndNTot 
kForNTot 
kAllNTot 
kNIndex 

Definition at line 46 of file CaloTowerDetId.h.

anonymous enum
Enumerator:
kSizeForDenseIndexing 

Definition at line 63 of file CaloTowerDetId.h.


Constructor & Destructor Documentation

CaloTowerDetId::CaloTowerDetId ( )

Create a null cellid

Definition at line 5 of file CaloTowerDetId.cc.

Referenced by detIdFromDenseIndex().

                               : DetId() {
}
CaloTowerDetId::CaloTowerDetId ( uint32_t  rawid) [explicit]

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

Definition at line 8 of file CaloTowerDetId.cc.

                                             : DetId(rawid&0xFFF0FFFFu) {
  
}
CaloTowerDetId::CaloTowerDetId ( int  tower_ieta,
int  tower_iphi 
)

Constructor from signed tower ieta and iphi

Definition at line 12 of file CaloTowerDetId.cc.

References DetId::id_.

                                                 : DetId(Calo,SubdetId) {
  id_|= 
    ((ieta>0)?(0x2000|((ieta&0x3F)<<7)):(((-ieta)&0x3f)<<7)) |
    (iphi&0x7F);
}
CaloTowerDetId::CaloTowerDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 18 of file CaloTowerDetId.cc.

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

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

Member Function Documentation

uint32_t CaloTowerDetId::denseIndex ( ) const

Definition at line 57 of file CaloTowerDetId.cc.

References ietaAbs(), iphi(), kAllNTot, kBarIEta, kBarNPhi, kBarNTot, kEndIEta, kEndNPhi, kEndNTot, kForNPhi, and zside().

Referenced by EcalTBHodoscopeGeometry::newCell().

{
   const uint32_t ie ( ietaAbs()     ) ;
   const uint32_t ip ( iphi()    - 1 ) ;
   
   return ( ( 0 > zside() ? 0 : kAllNTot ) +
            ( ( kBarIEta >= ie ? ( ie - 1 )*kBarNPhi + ip :
                ( kEndIEta >= ie ?  kBarNTot + ( ie - 1 - kBarIEta )*kEndNPhi + ip/2 :
                  kBarNTot + kEndNTot + ( ie - 1 - kEndIEta )*kForNPhi + ip/4 ) ) ) ) ;
}
CaloTowerDetId CaloTowerDetId::detIdFromDenseIndex ( uint32_t  din) [static]

Definition at line 69 of file CaloTowerDetId.cc.

References CaloTowerDetId(), kAllNTot, kBarIEta, kBarNPhi, kBarNTot, kEndIEta, kEndNPhi, kEndNTot, kForNPhi, and validDenseIndex().

Referenced by CaloGenericDetId::CaloGenericDetId().

{
   const int iz ( din < kAllNTot ? -1 : 1 ) ;
   din %= kAllNTot ;
   const uint32_t ie ( ( kBarNTot + kEndNTot ) - 1 < din ?
                       kEndIEta + ( din - kBarNTot - kEndNTot )/kForNPhi + 1 :
                       ( kBarNTot - 1 < din ?
                         kBarIEta + ( din - kBarNTot )/kEndNPhi + 1 :
                         din/kBarNPhi + 1 ) ) ;

   const uint32_t ip ( ( kBarNTot + kEndNTot ) - 1 < din ?
                       ( ( din - kBarNTot - kEndNTot )%kForNPhi )*4 + 3 :
                       ( kBarNTot - 1 < din ?
                         ( ( din - kBarNTot )%kEndNPhi )*2 + 1 :
                         din%kBarNPhi + 1 ) ) ;

   return ( validDenseIndex( din ) ? CaloTowerDetId( iz*ie, ip ) : CaloTowerDetId() ) ;
}
int CaloTowerDetId::ieta ( ) const [inline]
int CaloTowerDetId::ietaAbs ( ) const [inline]
int CaloTowerDetId::iphi ( ) const
CaloTowerDetId & CaloTowerDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 25 of file CaloTowerDetId.cc.

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

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

Definition at line 44 of file CaloTowerDetId.h.

References kSizeForDenseIndexing.

Referenced by detIdFromDenseIndex().

{ return ( din < kSizeForDenseIndexing ) ; }
bool CaloTowerDetId::validDetId ( int  ie,
int  ip 
) [static]

Reimplemented in HodoscopeDetId.

Definition at line 39 of file CaloTowerDetId.cc.

References abs, kBarIEta, kBarNPhi, kEndIEta, kForIEta, kMaxIEta, and kMaxIPhi.

{
   const int ia ( abs( ie ) ) ;
   return ( ( ia >= 1 )        &&
            ( ip >= 1 )        &&
            ( ia <= kMaxIEta ) &&
            ( ip <= kMaxIPhi ) &&
            ( ( ( ia <= kBarIEta ) &&
                ( ip <= kBarNPhi )    ) ||
             ( ( ia >  kBarIEta ) &&
                ( ia <= kEndIEta ) &&
                ( (ip-1)%2 == 0  )    ) ||
              ( ( ia >  kEndIEta ) &&
                ( ia <= kForIEta ) &&
                ( (ip-3)%4 == 0 )    )    )  ) ;
}
int CaloTowerDetId::zside ( ) const [inline]

get the z-side of the tower (1/-1)

Definition at line 28 of file CaloTowerDetId.h.

References DetId::id_.

Referenced by CaloTowersCreationAlgo::assignHit(), denseIndex(), PhysicsTowerOrganizer::findNeighbors(), ieta(), CaloTowersCreationAlgo::makeHcalDropChMap(), and CaloTower::zside().

{ return (id_&0x2000)?(1):(-1); }

Member Data Documentation

const int CaloTowerDetId::SubdetId = 1 [static]