CMS 3D CMS Logo

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

#include <EcalTrigTowerDetId.h>

Inheritance diagram for EcalTrigTowerDetId:
DetId

Public Types

enum  {
  kEETowersInPhiPerEndcap = 4 * kEETowersInPhiPerQuadrant, kEEOuterEta = 18, kEEInnerEta = 28, kEETowersInEta = (kEEInnerEta - kEEOuterEta + 1),
  kEBHalfTowers = kEBTowersPerSM * 18, kEBTotalTowers = kEBHalfTowers * 2, kEETowersPerEndcap = kEETowersInEta * kEETowersInPhiPerEndcap - 72, kEETotalTowers = kEETowersPerEndcap * 2,
  kSizeForDenseIndexing = kEBTotalTowers + kEETotalTowers
}
 
- 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
 
 EcalTrigTowerDetId ()
 
 EcalTrigTowerDetId (uint32_t rawid)
 
 EcalTrigTowerDetId (int zside, EcalSubdetector subdet, int i, int j, int mode=SUBDETIJMODE)
 Constructor from signed ieta, iphi. More...
 
 EcalTrigTowerDetId (const DetId &id)
 
int hashedIndex () const
 get a compact index for arrays [TODO: NEEDS WORK] More...
 
int iDCC () const
 get the ECAL DCC id - in the barrrel ism == iDCC More...
 
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...
 
int iquadrant () const
 
int iTT () const
 sequential index within one DCC More...
 
int ix () const
 get the tower ix (Endcap case) */ More...
 
int iy () const
 get the tower iy (Endcap case) */ More...
 
EcalTrigTowerDetIdoperator= (const DetId &id)
 
EcalSubdetector subDet () const
 get the subDetector associated to the Trigger Tower More...
 
int zside () const
 get the z-side of the tower (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 (uint32_t id)
 Create an id from a raw number. More...
 
constexpr DetId (Detector det, int subdet)
 Create an id, filling the detector and subdetector fields as specified. 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 EcalTrigTowerDetId detIdFromDenseIndex (uint32_t di)
 
static bool validDenseIndex (uint32_t din)
 
static bool validDetId (int iz, EcalSubdetector sd, int i, int j)
 check if a valid index combination More...
 

Static Public Attributes

static const int kEBTowersInEta = 17
 
static const int kEBTowersInPhi = 4
 
static const int kEBTowersPerSM = 68
 
static const int kEETowersInPhiPerQuadrant = 18
 
static const int MAX_I = 127
 
static const int MAX_J = 127
 
static const int MIN_I = 1
 
static const int MIN_J = 1
 
static const int SUBDETDCCTTMODE = 1
 
static const int SUBDETIJMODE = 0
 
- 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
 

Additional Inherited Members

- Protected Attributes inherited from DetId
uint32_t id_
 

Detailed Description

DetId for an Ecal Trigger tower

Definition at line 14 of file EcalTrigTowerDetId.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kEETowersInPhiPerEndcap 
kEEOuterEta 
kEEInnerEta 
kEETowersInEta 
kEBHalfTowers 
kEBTotalTowers 
kEETowersPerEndcap 
kEETotalTowers 
kSizeForDenseIndexing 

Definition at line 110 of file EcalTrigTowerDetId.h.

Constructor & Destructor Documentation

◆ EcalTrigTowerDetId() [1/4]

EcalTrigTowerDetId::EcalTrigTowerDetId ( )

Constructor of a null id

Definition at line 5 of file EcalTrigTowerDetId.cc.

Referenced by detIdFromDenseIndex().

5 {}

◆ EcalTrigTowerDetId() [2/4]

EcalTrigTowerDetId::EcalTrigTowerDetId ( uint32_t  rawid)

Constructor from a raw value

Definition at line 7 of file EcalTrigTowerDetId.cc.

7 : DetId(rawid) {}
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ EcalTrigTowerDetId() [3/4]

EcalTrigTowerDetId::EcalTrigTowerDetId ( int  zside,
EcalSubdetector  subdet,
int  i,
int  j,
int  mode = SUBDETIJMODE 
)

Constructor from signed ieta, iphi.

Definition at line 9 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, mps_fire::i, DetId::id_, dqmiolumiharvest::j, MAX_I, MAX_J, MIN_J, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, subDet(), SUBDETDCCTTMODE, SUBDETIJMODE, and zside().

11  int tower_i = 0;
12  int tower_j = 0;
13 
14  if (mode == SUBDETIJMODE) {
15  tower_i = i;
16  tower_j = j;
17  } else if (mode == SUBDETDCCTTMODE) {
18  throw cms::Exception("InvalidDetId")
19  << "EcalTriggerTowerDetId: Cannot create object. SUBDETDCCTTMODE not yet implemented.";
20  } else
21  throw cms::Exception("InvalidDetId") << "EcalTriggerTowerDetId: Cannot create object. Unknown mode for (int, "
22  "EcalSubdetector, int, int) constructor.";
23 
24  if (tower_i > MAX_I || tower_i < MIN_I || tower_j > MAX_J || tower_j < MIN_J)
25  throw cms::Exception("InvalidDetId") << "EcalTriggerTowerDetId: Cannot create object. Indexes out of bounds.";
26 
27  id_ |= ((zside > 0) ? (0x8000) : (0x0)) | ((subDet == EcalBarrel) ? (0x4000) : (0x0)) | (tower_i << 7) |
28  (tower_j & 0x7F);
29 }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static const int SUBDETIJMODE
static const int MIN_J
static const int MAX_J
int zside() const
get the z-side of the tower (1/-1)
static const int MAX_I
static const int SUBDETDCCTTMODE
uint32_t id_
Definition: DetId.h:69
constexpr DetId()
Create an empty or null id (also for persistence)
Definition: DetId.h:38

◆ EcalTrigTowerDetId() [4/4]

EcalTrigTowerDetId::EcalTrigTowerDetId ( const DetId id)

Constructor from a generic cell id

Definition at line 31 of file EcalTrigTowerDetId.cc.

References DetId::Ecal, EcalTriggerTower, Exception, and DetId::id_.

31  {
32  if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalTriggerTower)) {
33  throw cms::Exception("InvalidDetId");
34  }
35  id_ = gen.rawId();
36 }
uint32_t id_
Definition: DetId.h:69

Member Function Documentation

◆ denseIndex()

uint32_t EcalTrigTowerDetId::denseIndex ( ) const
inline

Definition at line 80 of file EcalTrigTowerDetId.h.

References hashedIndex().

80 { return hashedIndex(); }
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]

◆ detIdFromDenseIndex()

EcalTrigTowerDetId EcalTrigTowerDetId::detIdFromDenseIndex ( uint32_t  di)
static

Definition at line 104 of file EcalTrigTowerDetId.cc.

References cms::cuda::assert(), EcalBarrel, EcalEndcap, EcalTrigTowerDetId(), mps_fire::i, dqmiolumiharvest::j, kEBHalfTowers, kEBTotalTowers, kEBTowersInPhi, kEBTowersPerSM, kEEOuterEta, kEETowersInPhiPerEndcap, kEETowersPerEndcap, and validDetId().

Referenced by EcalDAQTowerStatusXMLTranslator::dumpXML(), EcalDCSTowerStatusXMLTranslator::dumpXML(), ecaldqm::TowerStatusTask::endLuminosityBlock(), EcalDAQTowerStatusXMLTranslator::plot(), EcalDCSTowerStatusXMLTranslator::plot(), ecaldqm::TrigPrimClient::producePlots(), ecaldqm::SelectiveReadoutClient::producePlots(), ecaldqm::OccupancyClient::producePlots(), ecaldqm::StatusManager::readFromObj(), ecaldqm::SelectiveReadoutTask::runOnDigis(), and ecaldqm::StatusManager::writeToObj().

104  {
106  const int iz(di < kEBTotalTowers ? (di < kEBHalfTowers ? 1 : -1)
107  : (di - kEBTotalTowers < kEETowersPerEndcap ? -1 : 1));
108  int i;
109  int j;
110  if (di < kEBTotalTowers) // barrel
111  {
112  const unsigned int itt(di % kEBTowersPerSM);
113  const unsigned int idc(di / kEBTowersPerSM);
114  j = (idc % 18) * kEBTowersInPhi + ((1 + iz) / 2) * kEBTowersInPhi - iz * (itt % kEBTowersInPhi) + 1 - (1 + iz) / 2 -
115  2;
116  if (j < 1)
117  j += 72;
118  i = 1 + itt / kEBTowersInPhi;
119  } else {
120  const int eonly((di - kEBTotalTowers) % kEETowersPerEndcap);
122  j = 1 + eonly % kEETowersInPhiPerEndcap;
123  if (27 == i) // last two rings have half of normal phi elementes
124  {
125  if (j > kEETowersInPhiPerEndcap / 2) {
126  ++i;
127  j -= kEETowersInPhiPerEndcap / 2;
128  }
129  j = 2 * j;
130  if (0 < iz)
131  --j;
132  }
133  }
134  assert(validDetId(iz, sd, i, j));
135  return EcalTrigTowerDetId(iz, sd, i, j);
136 }
static const int kEBTowersInPhi
assert(be >=bs)
static bool validDetId(int iz, EcalSubdetector sd, int i, int j)
check if a valid index combination
static const int kEBTowersPerSM
EcalSubdetector

◆ hashedIndex()

int EcalTrigTowerDetId::hashedIndex ( ) const

get a compact index for arrays [TODO: NEEDS WORK]

Definition at line 93 of file EcalTrigTowerDetId.cc.

References EcalBarrel, iDCC(), ietaAbs(), iphi(), iTT(), kEBTotalTowers, kEBTowersPerSM, kEEOuterEta, kEETowersInPhiPerEndcap, kEETowersPerEndcap, subDet(), and zside().

Referenced by denseIndex(), popcon::EcalDAQHandler::getNewObjects(), popcon::EcalDCSHandler::getNewObjects(), ecaldqm::SelectiveReadoutTask::runOnDigis(), and ecaldqm::SelectiveReadoutTask::runOnSrFlags().

93  {
94  const unsigned int iea(ietaAbs());
95  const unsigned int iph(iphi());
96  return (subDet() == EcalBarrel ? (iDCC() - 1) * kEBTowersPerSM + iTT() - 1
97  : kEBTotalTowers + ((zside() + 1) / 2) * kEETowersPerEndcap +
98  ((iea < 27 ? iea : 27) - kEEOuterEta) * kEETowersInPhiPerEndcap +
99  (iea < 27 ? iph : // for iphi=27,28 only half TT present, odd for EE-, even EE+
100  (iea - 27) * kEETowersInPhiPerEndcap / 2 + (iph + 1) / 2) -
101  1);
102 }
int iTT() const
sequential index within one DCC
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
int zside() const
get the z-side of the tower (1/-1)
int ietaAbs() const
get the absolute value of the tower ieta
int iDCC() const
get the ECAL DCC id - in the barrrel ism == iDCC
int iphi() const
get the tower iphi
static const int kEBTowersPerSM

◆ iDCC()

int EcalTrigTowerDetId::iDCC ( ) const

get the ECAL DCC id - in the barrrel ism == iDCC

Definition at line 47 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, l1ctLayer2EG_cff::id, iphi(), kEBTowersInPhi, subDet(), and zside().

Referenced by hashedIndex().

47  {
48  if (subDet() == EcalBarrel) {
49  //Correction since iphi is uniformized with HB convention
50  int iphi_simple = iphi() + 2;
51  if (iphi_simple > 72)
52  iphi_simple = iphi_simple % 72;
53  int id = (iphi_simple - 1) / kEBTowersInPhi + 1;
54  if (zside() < 0)
55  id += 18;
56  return id;
57  } else
58  throw cms::Exception("MethodNotImplemented") << "EcalTriggerTowerDetId: iDCC not yet implemented";
59 }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static const int kEBTowersInPhi
int zside() const
get the z-side of the tower (1/-1)
int iphi() const
get the tower iphi

◆ ieta()

int EcalTrigTowerDetId::ieta ( ) const
inline

◆ ietaAbs()

int EcalTrigTowerDetId::ietaAbs ( ) const
inline

get the absolute value of the tower ieta

Definition at line 36 of file EcalTrigTowerDetId.h.

References DetId::id_.

Referenced by EcalTPGParamBuilder::analyze(), EcalSelectiveReadoutValidation::analyzeEB(), TCCBlockFormatter::DigiToRaw(), hashedIndex(), ieta(), iTT(), EcalTrigPrimFunctionalAlgo::run_part2(), and EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId().

36  {
37  /* if ( subDet() == EcalBarrel) */
38  return (id_ >> 7) & 0x7f;
39  /* else */
40  /* throw(std::runtime_error("EcalTrigTowerDetId: ietaAbs not applicable for this subDetector.")); */
41  }
uint32_t id_
Definition: DetId.h:69

◆ iphi()

int EcalTrigTowerDetId::iphi ( ) const
inline

◆ iquadrant()

int EcalTrigTowerDetId::iquadrant ( ) const

Definition at line 79 of file EcalTrigTowerDetId.cc.

References EcalEndcap, Exception, createfilelist::int, iphi(), kEETowersInPhiPerQuadrant, and subDet().

Referenced by EcalTrigTowerConstituentsMap::wrapEcalTrigTowerDetId().

79  {
80  if (subDet() == EcalEndcap)
81  return int((iphi() - 1) / kEETowersInPhiPerQuadrant) + 1;
82  else
83  throw cms::Exception("MethodNotApplicable") << "EcalTriggerTowerDetId: iquadrant not applicable";
84 }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static const int kEETowersInPhiPerQuadrant
int iphi() const
get the tower iphi

◆ iTT()

int EcalTrigTowerDetId::iTT ( ) const

sequential index within one DCC

Definition at line 61 of file EcalTrigTowerDetId.cc.

References EcalBarrel, Exception, ietaAbs(), iphi(), kEBTowersInPhi, subDet(), and zside().

Referenced by hashedIndex(), ecaldqm::towerId(), and ecaldqm::ttId().

61  {
62  if (subDet() == EcalBarrel) {
63  int ie = ietaAbs() - 1;
64  int ip;
65  int iphi_simple = iphi() + 2;
66  if (iphi_simple > 72)
67  iphi_simple = iphi_simple % 72;
68  if (zside() < 0) {
69  ip = ((iphi_simple - 1) % kEBTowersInPhi) + 1;
70  } else {
71  ip = kEBTowersInPhi - ((iphi_simple - 1) % kEBTowersInPhi);
72  }
73 
74  return (ie * kEBTowersInPhi) + ip;
75  } else
76  throw cms::Exception("MethodNotImplemented") << "EcalTriggerTowerDetId: iTT not yet implemented";
77 }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static const int kEBTowersInPhi
int zside() const
get the z-side of the tower (1/-1)
int ietaAbs() const
get the absolute value of the tower ieta
int iphi() const
get the tower iphi

◆ ix()

int EcalTrigTowerDetId::ix ( ) const
inline

get the tower ix (Endcap case) */

Definition at line 62 of file EcalTrigTowerDetId.h.

References EcalEndcap, DetId::id_, and subDet().

62  {
63  if (subDet() == EcalEndcap)
64  return (id_ >> 7) & 0x7f;
65  else
66  throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector."));
67  }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
uint32_t id_
Definition: DetId.h:69

◆ iy()

int EcalTrigTowerDetId::iy ( ) const
inline

get the tower iy (Endcap case) */

Definition at line 70 of file EcalTrigTowerDetId.h.

References EcalEndcap, DetId::id_, and subDet().

70  {
71  if (subDet() == EcalEndcap)
72  return id_ & 0x7F;
73  else
74  throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector."));
75  }
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
uint32_t id_
Definition: DetId.h:69

◆ operator=()

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

Assignment from a generic cell id

Definition at line 38 of file EcalTrigTowerDetId.cc.

References DetId::Ecal, EcalTriggerTower, Exception, and DetId::id_.

38  {
39  if (!gen.null() && (gen.det() != Ecal || gen.subdetId() != EcalTriggerTower)) {
40  throw cms::Exception("InvalidDetId");
41  }
42  id_ = gen.rawId();
43  return *this;
44 }
uint32_t id_
Definition: DetId.h:69

◆ subDet()

EcalSubdetector EcalTrigTowerDetId::subDet ( ) const
inline

◆ validDenseIndex()

static bool EcalTrigTowerDetId::validDenseIndex ( uint32_t  din)
inlinestatic

◆ validDetId()

bool EcalTrigTowerDetId::validDetId ( int  iz,
EcalSubdetector  sd,
int  i,
int  j 
)
static

◆ zside()

int EcalTrigTowerDetId::zside ( ) const
inline

Member Data Documentation

◆ kEBTowersInEta

const int EcalTrigTowerDetId::kEBTowersInEta = 17
static

Definition at line 102 of file EcalTrigTowerDetId.h.

Referenced by validDetId().

◆ kEBTowersInPhi

const int EcalTrigTowerDetId::kEBTowersInPhi = 4
static

Definition at line 100 of file EcalTrigTowerDetId.h.

Referenced by detIdFromDenseIndex(), iDCC(), and iTT().

◆ kEBTowersPerSM

const int EcalTrigTowerDetId::kEBTowersPerSM = 68
static

◆ kEETowersInPhiPerQuadrant

const int EcalTrigTowerDetId::kEETowersInPhiPerQuadrant = 18
static

◆ MAX_I

const int EcalTrigTowerDetId::MAX_I = 127
static

Definition at line 97 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

◆ MAX_J

const int EcalTrigTowerDetId::MAX_J = 127
static

Definition at line 98 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

◆ MIN_I

const int EcalTrigTowerDetId::MIN_I = 1
static

Definition at line 95 of file EcalTrigTowerDetId.h.

◆ MIN_J

const int EcalTrigTowerDetId::MIN_J = 1
static

Definition at line 96 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

◆ SUBDETDCCTTMODE

const int EcalTrigTowerDetId::SUBDETDCCTTMODE = 1
static

Definition at line 108 of file EcalTrigTowerDetId.h.

Referenced by EcalTrigTowerDetId().

◆ SUBDETIJMODE

const int EcalTrigTowerDetId::SUBDETIJMODE = 0
static