CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
CaloTowerDetId Class Reference

#include <CaloTowerDetId.h>

Inheritance diagram for CaloTowerDetId:
DetId HodoscopeDetId

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 Types inherited from DetId
enum  Detector {
  Tracker =1, Muon =2, Ecal =3, Hcal =4,
  Calo =5
}
 

Public Member Functions

 CaloTowerDetId ()
 
 CaloTowerDetId (uint32_t rawid)
 
 CaloTowerDetId (int tower_ieta, int tower_iphi)
 
 CaloTowerDetId (const DetId &id)
 
uint32_t denseIndex () const
 
int ieta () const
 get the tower ieta More...
 
int ietaAbs () const
 get the absolute value of the tower ieta More...
 
int iphi () const
 get the tower iphi More...
 
CaloTowerDetIdoperator= (const DetId &id)
 
int zside () const
 get the z-side of the tower (1/-1) More...
 
- Public Member Functions inherited from DetId
Detector det () const
 get the detector field from this detid More...
 
 DetId ()
 Create an empty or null id (also for persistence) More...
 
 DetId (uint32_t id)
 Create an id from a raw number. More...
 
 DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
bool null () const
 is this a null id ? More...
 
 operator uint32_t () const
 
bool operator!= (DetId id) const
 inequality More...
 
uint32_t operator() () const
 
bool operator< (DetId id) const
 comparison More...
 
bool operator== (DetId id) const
 equality More...
 
uint32_t rawId () const
 get the raw id More...
 
int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

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
 
- Static Public Attributes inherited from DetId
static const int kDetOffset = 28
 
static const int kSubdetOffset = 25
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

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().

5  : DetId() {
6 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
CaloTowerDetId::CaloTowerDetId ( uint32_t  rawid)
explicit

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

Definition at line 8 of file CaloTowerDetId.cc.

8  : DetId(rawid&0xFFF0FFFFu) {
9 
10 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
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_.

12  : DetId(Calo,SubdetId) {
13  id_|=
14  ((ieta>0)?(0x2000|((ieta&0x3F)<<7)):(((-ieta)&0x3f)<<7)) |
15  (iphi&0x7F);
16 }
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:28
static const int SubdetId
int iphi() const
get the tower iphi
uint32_t id_
Definition: DetId.h:57
int ieta() const
get the tower ieta
CaloTowerDetId::CaloTowerDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 18 of file CaloTowerDetId.cc.

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

18  {
19  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetId)) {
20  throw cms::Exception("Invalid DetId") << "Cannot initialize CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
21  }
22  id_=gen.rawId();
23 }
static const int SubdetId
uint32_t id_
Definition: DetId.h:57

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().

58 {
59  const uint32_t ie ( ietaAbs() ) ;
60  const uint32_t ip ( iphi() - 1 ) ;
61 
62  return ( ( 0 > zside() ? 0 : kAllNTot ) +
63  ( ( kBarIEta >= ie ? ( ie - 1 )*kBarNPhi + ip :
64  ( kEndIEta >= ie ? kBarNTot + ( ie - 1 - kBarIEta )*kEndNPhi + ip/2 :
65  kBarNTot + kEndNTot + ( ie - 1 - kEndIEta )*kForNPhi + ip/4 ) ) ) ) ;
66 }
int ietaAbs() const
get the absolute value of the tower ieta
int iphi() const
get the tower iphi
int zside() const
get the z-side of the tower (1/-1)
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().

70 {
71  const int iz ( din < kAllNTot ? -1 : 1 ) ;
72  din %= kAllNTot ;
73  const uint32_t ie ( ( kBarNTot + kEndNTot ) - 1 < din ?
74  kEndIEta + ( din - kBarNTot - kEndNTot )/kForNPhi + 1 :
75  ( kBarNTot - 1 < din ?
76  kBarIEta + ( din - kBarNTot )/kEndNPhi + 1 :
77  din/kBarNPhi + 1 ) ) ;
78 
79  const uint32_t ip ( ( kBarNTot + kEndNTot ) - 1 < din ?
80  ( ( din - kBarNTot - kEndNTot )%kForNPhi )*4 + 3 :
81  ( kBarNTot - 1 < din ?
82  ( ( din - kBarNTot )%kEndNPhi )*2 + 1 :
83  din%kBarNPhi + 1 ) ) ;
84 
85  return ( validDenseIndex( din ) ? CaloTowerDetId( iz*ie, ip ) : CaloTowerDetId() ) ;
86 }
static bool validDenseIndex(uint32_t din)
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(), edm::hlt::Exception, DetId::id_, DetId::null(), DetId::rawId(), SubdetId, and DetId::subdetId().

25  {
26  if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetId)) {
27  throw cms::Exception("Invalid DetId") << "Cannot assign CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
28  }
29  id_=gen.rawId();
30  return *this;
31 }
static const int SubdetId
uint32_t id_
Definition: DetId.h:57
static bool CaloTowerDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 44 of file CaloTowerDetId.h.

References kSizeForDenseIndexing.

Referenced by detIdFromDenseIndex().

bool CaloTowerDetId::validDetId ( int  ie,
int  ip 
)
static

Definition at line 39 of file CaloTowerDetId.cc.

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

Referenced by CaloGenericDetId::validDetId().

40 {
41  const int ia ( abs( ie ) ) ;
42  return ( ( ia >= 1 ) &&
43  ( ip >= 1 ) &&
44  ( ia <= kMaxIEta ) &&
45  ( ip <= kMaxIPhi ) &&
46  ( ( ( ia <= kBarIEta ) &&
47  ( ip <= kBarNPhi ) ) ||
48  ( ( ia > kBarIEta ) &&
49  ( ia <= kEndIEta ) &&
50  ( (ip-1)%2 == 0 ) ) ||
51  ( ( ia > kEndIEta ) &&
52  ( ia <= kForIEta ) &&
53  ( (ip-3)%4 == 0 ) ) ) ) ;
54 }
#define abs(x)
Definition: mlp_lapack.h:159
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().

28 { return (id_&0x2000)?(1):(-1); }
uint32_t id_
Definition: DetId.h:57

Member Data Documentation

const int CaloTowerDetId::SubdetId = 1
static