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 | 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
}
 

Public Member Functions

uint32_t denseIndex () const
 
 HcalCastorDetId ()
 
 HcalCastorDetId (uint32_t rawid)
 
 HcalCastorDetId (Section section, bool true_for_positive_eta, int sector, int module)
 
 HcalCastorDetId (bool true_for_positive_eta, int sector, int module)
 
 HcalCastorDetId (const DetId &id)
 
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
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 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 kDetOffset = 28
 
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
Enumerator
Unknown 
EM 
HAD 

Definition at line 27 of file HcalCastorDetId.h.

Constructor & Destructor Documentation

HcalCastorDetId::HcalCastorDetId ( )

Create a null cellid

Definition at line 5 of file HcalCastorDetId.cc.

Referenced by detIdFromDenseIndex().

5 : DetId() {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
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) {}
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
HcalCastorDetId::HcalCastorDetId ( Section  section,
bool  true_for_positive_eta,
int  sector,
int  module 
)

Constructor from section, z-side, sector and module

Definition at line 19 of file HcalCastorDetId.cc.

References buildMe().

24 {
25  buildMe( section, true_for_positive_eta, sector, module ) ;
26 }
int sector() const
get the sector (1-16)
void buildMe(Section section, bool true_for_positive_eta, int sector, int module)
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
Section section() const
get the section
static const int SubdetectorId
Definition: vlib.h:208
HcalCastorDetId::HcalCastorDetId ( bool  true_for_positive_eta,
int  sector,
int  module 
)

Definition at line 29 of file HcalCastorDetId.cc.

References buildMe(), and Unknown.

33 {
34  buildMe( Section(Unknown), true_for_positive_eta, sector, module ) ;
35 }
int sector() const
get the sector (1-16)
void buildMe(Section section, bool true_for_positive_eta, int sector, int module)
DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:26
static const int SubdetectorId
Definition: vlib.h:208
HcalCastorDetId::HcalCastorDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 37 of file HcalCastorDetId.cc.

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

38 {
39  if( !gen.null() &&
40  ( gen.det() != DetId::Calo ||
41  gen.subdetId() != SubdetectorId ) )
42  {
43  throw cms::Exception("Invalid DetId") << "Cannot initialize CASTORDetId from " << std::hex << gen.rawId() << std::dec;
44  }
45  id_= gen.rawId();
46 }
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
static const int SubdetectorId
uint32_t id_
Definition: DetId.h:55

Member Function Documentation

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

Definition at line 10 of file HcalCastorDetId.cc.

References DetId::id_, and module().

Referenced by HcalCastorDetId().

14 {
15  sector -= 1; // we count sector from 1-16 instead of 0-15
16  id_ |= ( true_for_positive_eta << 8 ) | ( sector << 4 ) | module;
17 }
int sector() const
get the sector (1-16)
int module() const
get the module (1-2 for EM, 1-12 for HAD)
uint32_t id_
Definition: DetId.h:55
uint32_t HcalCastorDetId::denseIndex ( ) const

Definition at line 95 of file HcalCastorDetId.cc.

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

96 {
97  return ( kNumberCellsPerEnd*( zside() + 1 )/2 +
98  kNumberSectorsPerEnd*( module() - 1 ) + sector() - 1 ) ;
99 }
int sector() const
get the sector (1-16)
int module() const
get the module (1-2 for EM, 1-12 for HAD)
int zside() const
get the z-side of the cell (1/-1)
HcalCastorDetId HcalCastorDetId::detIdFromDenseIndex ( uint32_t  di)
static
int HcalCastorDetId::module ( ) const
inline
HcalCastorDetId & HcalCastorDetId::operator= ( const DetId id)

Assignment from a generic cell id

Definition at line 49 of file HcalCastorDetId.cc.

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

50 {
51  if( !gen.null() &&
52  ( gen.det() != DetId::Calo ||
53  gen.subdetId() != SubdetectorId ) )
54  {
55  throw cms::Exception("Invalid DetId") << "Cannot assign Castor DetId from " << std::hex << gen.rawId() << std::dec;
56  }
57 
58  id_ = gen.rawId();
59 
60  return *this;
61 }
def gen
run2 Cosmic #### Run 256259 @ 0T 2015C### Run 272133 @ 3.8T 2016B###
static const int SubdetectorId
uint32_t id_
Definition: DetId.h:55
HcalCastorDetId::Section HcalCastorDetId::section ( ) const

get the section

Definition at line 71 of file HcalCastorDetId.cc.

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

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

72 {
73  const int mod = module();
74 
75  Section sect ;
76  if ( mod <= 2 )
77  {
78  sect = HcalCastorDetId::EM ;
79  }
80  else
81  {
82  if( mod > 2 && mod <= 14 )
83  {
84  sect = HcalCastorDetId::HAD ;
85  }
86  else
87  {
89  }
90  }
91  return sect ;
92 }
int module() const
get the module (1-2 for EM, 1-12 for HAD)
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
int HcalCastorDetId::sector ( ) const
inline
static bool HcalCastorDetId::validDenseIndex ( uint32_t  din)
inlinestatic

Definition at line 86 of file HcalCastorDetId.h.

References kSizeForDenseIndexing.

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

Definition at line 102 of file HcalCastorDetId.cc.

References kNumberModulesPerEnd, and kNumberSectorsPerEnd.

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

106 {
107  return ( 0 < iSector &&
108  kNumberSectorsPerEnd >= iSector &&
109  0 < iModule &&
110  kNumberModulesPerEnd >= iModule ) ;
111 }
int HcalCastorDetId::zside ( ) const
inline

Member Data Documentation

const int HcalCastorDetId::SubdetectorId = 3
static