CMS 3D CMS Logo

CaloTowerDetId Class Reference

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

#include <DataFormats/CaloTowers/interface/CaloTowerDetId.h>

Inheritance diagram for CaloTowerDetId:

DetId

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 (const DetId &id)
 Constructor from a generic cell id.
 CaloTowerDetId (int tower_ieta, int tower_iphi)
 Constructor from signed tower ieta and iphi.
 CaloTowerDetId (uint32_t rawid)
 Create cellid from raw id (0=invalid tower id).
 CaloTowerDetId ()
 Create a null cellid.
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)
 Assignment from a generic cell 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.

00046            { kMaxIEta = 41 ,
00047              kMaxIPhi = 72 ,
00048              kBarNPhi = kMaxIPhi ,
00049              kEndNPhi = kMaxIPhi/2 ,
00050              kForNPhi = kMaxIPhi/4 ,
00051              kBarIEta = 20 ,
00052              kEndIEta = 39 ,
00053              kForIEta = kMaxIEta ,
00054              kBarNEta = kBarIEta ,
00055              kEndNEta = kEndIEta - kBarNEta ,
00056              kForNEta = kForIEta - kEndIEta ,
00057              kBarNTot = kBarNPhi*kBarNEta   ,
00058              kEndNTot = kEndNPhi*kEndNEta   ,
00059              kForNTot = kForNPhi*kForNEta   ,
00060              kAllNTot = kBarNTot + kEndNTot + kForNTot ,
00061              kNIndex  = 2*kAllNTot } ;

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

00005                                : DetId() {
00006 }

CaloTowerDetId::CaloTowerDetId ( uint32_t  rawid  )  [explicit]

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

Definition at line 8 of file CaloTowerDetId.cc.

00008                                              : DetId(rawid&0xFFF0FFFFu) {
00009   
00010 }

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_.

00012                                                  : DetId(Calo,SubdetId) {
00013   id_|= 
00014     ((ieta>0)?(0x2000|((ieta&0x3F)<<7)):(((-ieta)&0x3f)<<7)) |
00015     (iphi&0x7F);
00016 }

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

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


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

00058 {
00059    const uint32_t ie ( ietaAbs()     ) ;
00060    const uint32_t ip ( iphi()    - 1 ) ;
00061    
00062    return ( ( 0 > zside() ? 0 : kAllNTot ) +
00063             ( ( kBarIEta >= ie ? ( ie - 1 )*kBarNPhi + ip :
00064                 ( kEndIEta >= ie ?  kBarNTot + ( ie - 1 - kBarIEta )*kEndNPhi + ip/2 :
00065                   kBarNTot + kEndNTot + ( ie - 1 - kEndIEta )*kForNPhi + ip/4 ) ) ) ) ;
00066 }

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

00070 {
00071    const int iz ( din < kAllNTot ? -1 : 1 ) ;
00072    din %= kAllNTot ;
00073    const uint32_t ie ( ( kBarNTot + kEndNTot ) - 1 < din ?
00074                        kEndIEta + ( din - kBarNTot - kEndNTot )/kForNPhi + 1 :
00075                        ( kBarNTot - 1 < din ?
00076                          kBarIEta + ( din - kBarNTot )/kEndNPhi + 1 :
00077                          din/kBarNPhi + 1 ) ) ;
00078 
00079    const uint32_t ip ( ( kBarNTot + kEndNTot ) - 1 < din ?
00080                        ( ( din - kBarNTot - kEndNTot )%kForNPhi )*4 + 3 :
00081                        ( kBarNTot - 1 < din ?
00082                          ( ( din - kBarNTot )%kEndNPhi )*2 + 1 :
00083                          din%kBarNPhi + 1 ) ) ;
00084 
00085    return ( validDenseIndex( din ) ? CaloTowerDetId( iz*ie, ip ) : CaloTowerDetId() ) ;
00086 }

int CaloTowerDetId::ieta (  )  const [inline]

get the tower ieta

Definition at line 32 of file CaloTowerDetId.h.

References ietaAbs(), and zside().

Referenced by JetToDigiDump::analyze(), CaloTowerAnalyzer::analyze(), CaloTowersCreationAlgo::assignHit(), CaloTowerTopology::east(), FastL1Region::FillEMCrystals(), FastL1RegionMap::getRegionEtaPhiIndex(), FastL1RegionMap::getRegionIndex(), FastL1RegionMap::getRegionTowerIndex(), cms::BasePilupSubtractionJetProducer::ieta(), CaloTower::ieta(), DetIdInfo::info(), FastL1GlobalAlgo::isEMCand(), JetMaker::makeSpecific(), CaloTowerTopology::north(), TrackDetMatchInfo::nXnEnergy(), CaloTowerTopology::south(), CaloTowerTopology::valid(), CaloTowerTopology::west(), and DumpEvent::WriteJets().

00032 { return zside()*ietaAbs(); }

int CaloTowerDetId::ietaAbs (  )  const [inline]

get the absolute value of the tower ieta

Definition at line 30 of file CaloTowerDetId.h.

References DetId::id_.

Referenced by denseIndex(), CaloTower::hadEnergyHeInnerLayer(), CaloTower::hadEnergyHeOuterLayer(), ieta(), CaloTower::ietaAbs(), CaloTowerTopology::north(), CaloTower::numCrystals(), CaloTower::outerEnergy(), CaloTower::outerEt(), and CaloTowerTopology::south().

00030 { return (id_>>7)&0x3f; }

int CaloTowerDetId::iphi (  )  const

get the tower iphi

Definition at line 33 of file CaloTowerDetId.cc.

References DetId::id_.

Referenced by JetToDigiDump::analyze(), CaloTowerAnalyzer::analyze(), CaloTowersCreationAlgo::assignHit(), denseIndex(), CaloTowerTopology::east(), FastL1Region::FillEMCrystals(), FastL1RegionMap::getRegionEtaPhiIndex(), FastL1RegionMap::getRegionIndex(), FastL1RegionMap::getRegionTowerIndex(), DetIdInfo::info(), cms::BasePilupSubtractionJetProducer::iphi(), CaloTower::iphi(), FastL1GlobalAlgo::isEMCand(), CaloTowerTopology::north(), TrackDetMatchInfo::nXnEnergy(), CaloTowerTopology::south(), CaloTowerTopology::valid(), CaloTowerTopology::west(), and DumpEvent::WriteJets().

00033                                {
00034   int retval=id_&0x7F;
00035   return retval;
00036 }  

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

00025                                                           {
00026   if (!gen.null() && (gen.det()!=Calo || gen.subdetId()!=SubdetId)) {
00027     throw cms::Exception("Invalid DetId") << "Cannot assign CaloTowerDetId from " << std::hex << gen.rawId() << std::dec;
00028   }
00029   id_=gen.rawId();
00030   return *this;
00031 }

static bool CaloTowerDetId::validDenseIndex ( uint32_t  din  )  [inline, static]

Definition at line 44 of file CaloTowerDetId.h.

References kSizeForDenseIndexing.

Referenced by detIdFromDenseIndex().

00044 { return ( din < kSizeForDenseIndexing ) ; }

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

Definition at line 39 of file CaloTowerDetId.cc.

References funct::abs(), kBarIEta, kBarNPhi, kEndIEta, kForIEta, kMaxIEta, and kMaxIPhi.

00040 {
00041    const int ia ( abs( ie ) ) ;
00042    return ( ( ia >= 1 )        &&
00043             ( ip >= 1 )        &&
00044             ( ia <= kMaxIEta ) &&
00045             ( ip <= kMaxIPhi ) &&
00046             ( ( ( ia <= kBarIEta ) &&
00047                 ( ip <= kBarNPhi )    ) ||
00048              ( ( ia >  kBarIEta ) &&
00049                 ( ia <= kEndIEta ) &&
00050                 ( (ip-1)%2 == 0  )    ) ||
00051               ( ( ia >  kEndIEta ) &&
00052                 ( ia <= kForIEta ) &&
00053                 ( (ip-3)%4 == 0 )    )    )  ) ;
00054 }

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(), ieta(), and CaloTower::zside().

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


Member Data Documentation

const int CaloTowerDetId::SubdetId = 1 [static]

Definition at line 36 of file CaloTowerDetId.h.

Referenced by CaloRecoTauAlgorithm::buildCaloTau(), CaloTowerDetId(), operator=(), cms::BasePilupSubtractionJetProducer::produce(), cms::BaseJetProducer::produce(), and CaloTowersCreationAlgo::setGeometry().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:15:59 2009 for CMSSW by  doxygen 1.5.4