CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions
HcalCastorDetId Class Reference

#include <HcalCastorDetId.h>

Inheritance diagram for HcalCastorDetId:
DetId

Public Types

enum  { kNumberModulesPerEnd = 14, kNumberSectorsPerEnd = 16, kNumberCellsPerEnd = kNumberModulesPerEnd * kNumberSectorsPerEnd, kSizeForDenseIndexing = kNumberCellsPerEnd }
 
enum  Section { Unknown = 0, EM = 1, HAD = 2 }
 
- Public Types inherited from DetId
enum  Detector {
  Tracker = 1, Muon = 2, Ecal = 3, Hcal = 4,
  Calo = 5, Forward = 6, VeryForward = 7, HGCalEE = 8,
  HGCalHSi = 9, HGCalHSc = 10, HGCalTrigger = 11
}
 

Public Member Functions

uint32_t denseIndex () const
 
 HcalCastorDetId ()
 
 HcalCastorDetId (bool true_for_positive_eta, int sector, int module)
 
 HcalCastorDetId (const DetId &id)
 
 HcalCastorDetId (Section section, bool true_for_positive_eta, int sector, int module)
 
 HcalCastorDetId (uint32_t rawid)
 
int module () const
 get the module (1-2 for EM, 1-12 for HAD) More...
 
HcalCastorDetIdoperator= (const DetId &id)
 
Section section () const
 get the section More...
 
int sector () const
 get the sector (1-16) More...
 
int zside () const
 get the z-side of the cell (1/-1) More...
 
- Public Member Functions inherited from DetId
constexpr Detector det () const
 get the detector field from this detid More...
 
constexpr DetId ()
 Create an empty or null id (also for persistence) More...
 
constexpr DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. More...
 
constexpr DetId (uint32_t id)
 Create an id from a raw number. More...
 
constexpr bool null () const
 is this a null id ? More...
 
constexpr operator uint32_t () const
 
constexpr bool operator!= (DetId id) const
 inequality More...
 
constexpr uint32_t operator() () const
 
constexpr bool operator< (DetId id) const
 comparison More...
 
constexpr bool operator== (DetId id) const
 equality More...
 
constexpr uint32_t rawId () const
 get the raw id More...
 
constexpr int subdetId () const
 get the contents of the subdetector field (not cast into any detector's numbering enum) More...
 

Static Public Member Functions

static HcalCastorDetId detIdFromDenseIndex (uint32_t di)
 
static bool validDenseIndex (uint32_t din)
 
static bool validDetId (Section iSection, bool posEta, int iSector, int iMod)
 

Static Public Attributes

static const int SubdetectorId = 3
 
- Static Public Attributes inherited from DetId
static const int kDetMask = 0xF
 
static const int kDetOffset = 28
 
static const int kSubdetMask = 0x7
 
static const int kSubdetOffset = 25
 

Private Member Functions

void buildMe (Section section, bool true_for_positive_eta, int sector, int module)
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

Contents of the HcalCastorDetId : [9] Z position (true for positive) [8:7] Section (EM/HAD) [6:4] sector (depth) [3:0] module

NEW: [8] z position [7:4] sector [3:0] module

Author
P. Katsas, T. McCauley

Definition at line 23 of file HcalCastorDetId.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kNumberModulesPerEnd 
kNumberSectorsPerEnd 
kNumberCellsPerEnd 
kSizeForDenseIndexing 

Definition at line 67 of file HcalCastorDetId.h.

◆ Section

Enumerator
Unknown 
EM 
HAD 

Definition at line 25 of file HcalCastorDetId.h.

25 { Unknown = 0, EM = 1, HAD = 2 };

Constructor & Destructor Documentation

◆ HcalCastorDetId() [1/5]

HcalCastorDetId::HcalCastorDetId ( )

Create a null cellid

Definition at line 5 of file HcalCastorDetId.cc.

5 : DetId() {}

Referenced by detIdFromDenseIndex().

◆ HcalCastorDetId() [2/5]

HcalCastorDetId::HcalCastorDetId ( uint32_t  rawid)

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

Definition at line 7 of file HcalCastorDetId.cc.

7 : DetId(rawid) {}

◆ HcalCastorDetId() [3/5]

HcalCastorDetId::HcalCastorDetId ( Section  section,
bool  true_for_positive_eta,
int  sector,
int  module 
)

Constructor from section, z-side, sector and module

Definition at line 14 of file HcalCastorDetId.cc.

16  buildMe(section, true_for_positive_eta, sector, module);
17 }

References buildMe(), module(), section(), and sector().

◆ HcalCastorDetId() [4/5]

HcalCastorDetId::HcalCastorDetId ( bool  true_for_positive_eta,
int  sector,
int  module 
)

Definition at line 19 of file HcalCastorDetId.cc.

21  buildMe(Section(Unknown), true_for_positive_eta, sector, module);
22 }

References buildMe(), module(), sector(), and Unknown.

◆ HcalCastorDetId() [5/5]

HcalCastorDetId::HcalCastorDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 24 of file HcalCastorDetId.cc.

24  {
25  if (!gen.null() && (gen.det() != DetId::Calo || gen.subdetId() != SubdetectorId)) {
26  throw cms::Exception("Invalid DetId")
27  << "Cannot initialize CASTORDetId from " << std::hex << gen.rawId() << std::dec;
28  }
29  id_ = gen.rawId();
30 }

References DetId::Calo, TauDecayModes::dec, Exception, DetId::id_, and SubdetectorId.

Member Function Documentation

◆ buildMe()

void HcalCastorDetId::buildMe ( Section  section,
bool  true_for_positive_eta,
int  sector,
int  module 
)
private

Definition at line 9 of file HcalCastorDetId.cc.

9  {
10  sector -= 1; // we count sector from 1-16 instead of 0-15
11  id_ |= (true_for_positive_eta << 8) | (sector << 4) | module;
12 }

References DetId::id_, module(), and sector().

Referenced by HcalCastorDetId().

◆ denseIndex()

uint32_t HcalCastorDetId::denseIndex ( ) const

Definition at line 65 of file HcalCastorDetId.cc.

65  {
66  return (kNumberCellsPerEnd * (zside() + 1) / 2 + kNumberSectorsPerEnd * (module() - 1) + sector() - 1);
67 }

References kNumberCellsPerEnd, kNumberSectorsPerEnd, module(), sector(), and zside().

◆ detIdFromDenseIndex()

HcalCastorDetId HcalCastorDetId::detIdFromDenseIndex ( uint32_t  di)
static

Definition at line 73 of file HcalCastorDetId.cc.

73  {
74  return HcalCastorDetId(
76 }

References HcalCastorDetId(), kNumberCellsPerEnd, and kNumberSectorsPerEnd.

Referenced by CaloGenericDetId::CaloGenericDetId().

◆ module()

int HcalCastorDetId::module ( ) const
inline

◆ operator=()

HcalCastorDetId & HcalCastorDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 32 of file HcalCastorDetId.cc.

32  {
33  if (!gen.null() && (gen.det() != DetId::Calo || gen.subdetId() != SubdetectorId)) {
34  throw cms::Exception("Invalid DetId") << "Cannot assign Castor DetId from " << std::hex << gen.rawId() << std::dec;
35  }
36 
37  id_ = gen.rawId();
38 
39  return *this;
40 }

References DetId::Calo, TauDecayModes::dec, Exception, DetId::id_, and SubdetectorId.

◆ section()

HcalCastorDetId::Section HcalCastorDetId::section ( ) const

get the section

Definition at line 49 of file HcalCastorDetId.cc.

49  {
50  const int mod = module();
51 
52  Section sect;
53  if (mod <= 2) {
54  sect = HcalCastorDetId::EM;
55  } else {
56  if (mod > 2 && mod <= 14) {
57  sect = HcalCastorDetId::HAD;
58  } else {
60  }
61  }
62  return sect;
63 }

References EM, HAD, mod(), module(), and Unknown.

Referenced by HcalCastorDetId(), CastorTopology::incModule(), CastorTopology::incSector(), CastorText2DetIdConverter::init(), CastorHardcodeGeometryLoader::makeCell(), VarParsing.VarParsing::parseArguments(), and CaloGenericDetId::validDetId().

◆ sector()

int HcalCastorDetId::sector ( ) const
inline

◆ validDenseIndex()

static bool HcalCastorDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 78 of file HcalCastorDetId.h.

78 { return (din < kSizeForDenseIndexing); }

References cropTnPTrees::din, and kSizeForDenseIndexing.

◆ validDetId()

bool HcalCastorDetId::validDetId ( Section  iSection,
bool  posEta,
int  iSector,
int  iMod 
)
static

Definition at line 69 of file HcalCastorDetId.cc.

69  {
70  return (0 < iSector && kNumberSectorsPerEnd >= iSector && 0 < iModule && kNumberModulesPerEnd >= iModule);
71 }

References kNumberModulesPerEnd, and kNumberSectorsPerEnd.

Referenced by CaloGenericDetId::validDetId(), and CastorTopology::validRaw().

◆ zside()

int HcalCastorDetId::zside ( ) const
inline

Member Data Documentation

◆ SubdetectorId

const int HcalCastorDetId::SubdetectorId = 3
static
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
HcalCastorDetId::kNumberSectorsPerEnd
Definition: HcalCastorDetId.h:69
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
HcalCastorDetId::Section
Section
Definition: HcalCastorDetId.h:25
DetId::Calo
Definition: DetId.h:29
HcalCastorDetId::Unknown
Definition: HcalCastorDetId.h:25
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HcalCastorDetId::section
Section section() const
get the section
Definition: HcalCastorDetId.cc:49
gen
Definition: PythiaDecays.h:13
HcalCastorDetId::kNumberModulesPerEnd
Definition: HcalCastorDetId.h:68
HcalCastorDetId::module
int module() const
get the module (1-2 for EM, 1-12 for HAD)
Definition: HcalCastorDetId.h:58
cropTnPTrees.din
din
Definition: cropTnPTrees.py:30
DetId::id_
uint32_t id_
Definition: DetId.h:69
HcalCastorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalCastorDetId.h:50
HcalCastorDetId::sector
int sector() const
get the sector (1-16)
Definition: HcalCastorDetId.h:62
HcalCastorDetId::buildMe
void buildMe(Section section, bool true_for_positive_eta, int sector, int module)
Definition: HcalCastorDetId.cc:9
Exception
Definition: hltDiff.cc:245
HcalCastorDetId::kSizeForDenseIndexing
Definition: HcalCastorDetId.h:71
HcalCastorDetId::HAD
Definition: HcalCastorDetId.h:25
DetId::DetId
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
HcalCastorDetId::kNumberCellsPerEnd
Definition: HcalCastorDetId.h:70
HcalCastorDetId::EM
Definition: HcalCastorDetId.h:25
HcalCastorDetId::HcalCastorDetId
HcalCastorDetId()
Definition: HcalCastorDetId.cc:5