CMS 3D CMS Logo

AHCalDetId.cc
Go to the documentation of this file.
2 #include <ostream>
4 
5 const AHCalDetId AHCalDetId::Undefined(0, 0, 0);
6 
8 
9 AHCalDetId::AHCalDetId(uint32_t rawid) : DetId(rawid) {}
10 
12  int icol = (col > 0) ? col : 10 - col;
13  int irow = (row > 0) ? row : 10 - row;
14  id_ |=
19  (icol & HcalDetId::kHcalPhiMask2);
20 }
21 
23  if (!gen.null()) {
25  if (gen.det() != Hcal || subdet != HcalOther) {
26  throw cms::Exception("Invalid DetId")
27  << "Cannot initialize AHCalDetId from " << std::hex << gen.rawId()
28  << std::dec;
29  }
30  }
31  id_ = gen.rawId();
32 }
33 
34 int AHCalDetId::irow() const {
36  if (value >= 10) value = -(value % 10);
37  return value;
38 }
39 
40 int AHCalDetId::icol() const {
42  if (value >= 10) value = -(value % 10);
43  return value;
44 }
45 
46 int AHCalDetId::depth() const {
48 }
49 
50 std::pair<double, double> AHCalDetId::getXY() const {
51  int row = irow();
52  int col = icol();
53  double shiftx = (col > 0) ? -0.5 * deltaX_ : 0.5 * deltaX_;
54  double shifty = (row > 0) ? -0.5 * deltaY_ : 0.5 * deltaY_;
55  return std::pair<double, double>(col * deltaX_ + shiftx,
56  row * deltaY_ + shifty);
57 }
58 
59 double AHCalDetId::getZ() const {
60  int lay = depth();
61  return (zFirst_ + (lay - 1) * deltaZ_);
62 }
63 
64 std::ostream& operator<<(std::ostream& s, const AHCalDetId& id) {
65  return s << "(AHCal " << id.irow() << ',' << id.icol() << ',' << id.depth()
66  << ')';
67 }
static uint32_t kHcalEtaMask2
Definition: HcalDetId.h:21
constexpr bool null() const
is this a null id ?
Definition: DetId.h:52
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
double getZ() const
Definition: AHCalDetId.cc:59
int irow() const
get the row number
Definition: AHCalDetId.cc:34
const double zFirst_
Definition: AHCalDetId.h:52
HcalSubdetector subdet() const
get the subdetector
Definition: AHCalDetId.h:30
int depth() const
Definition: AHCalDetId.cc:46
int icol() const
get the column number
Definition: AHCalDetId.cc:40
std::pair< double, double > getXY() const
get the local coordinate in the plane and along depth
Definition: AHCalDetId.cc:50
static uint32_t kHcalDepthMask2
Definition: HcalDetId.h:27
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: value.py:1
const double deltaZ_
Definition: AHCalDetId.h:51
std::ostream & operator<<(std::ostream &s, const AHCalDetId &id)
Definition: AHCalDetId.cc:64
Definition: DetId.h:18
static const AHCalDetId Undefined
Definition: AHCalDetId.h:48
static uint32_t kHcalPhiMask2
Definition: HcalDetId.h:17
uint32_t id_
Definition: DetId.h:62
static uint32_t kHcalEtaOffset2
Definition: HcalDetId.h:19
static uint32_t kHcalIdFormat2
Definition: HcalDetId.h:30
static uint32_t kHcalZsideMask2
Definition: HcalDetId.h:23
col
Definition: cuy.py:1010
const double deltaX_
Definition: AHCalDetId.h:49
static uint32_t kHcalDepthOffset2
Definition: HcalDetId.h:25
const double deltaY_
Definition: AHCalDetId.h:50
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39