Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-TB40 Correct AHCal DetId for # of row/column and apply smearing for position/time #27697

Merged
merged 5 commits into from Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 11 additions & 12 deletions SimG4CMS/HGCalTestBeam/plugins/AHCalDetId.cc
Expand Up @@ -9,11 +9,10 @@ AHCalDetId::AHCalDetId() : DetId() {}
AHCalDetId::AHCalDetId(uint32_t rawid) : DetId(rawid) {}

AHCalDetId::AHCalDetId(int row, int col, int depth) : DetId(Hcal, HcalOther) {
int icol = (col > 0) ? col : 10 - col;
int irow = (row > 0) ? row : 10 - row;
id_ |= (HcalDetId::kHcalIdFormat2) | ((depth & HcalDetId::kHcalDepthMask2) << HcalDetId::kHcalDepthOffset2) |
(HcalDetId::kHcalZsideMask2) | ((irow & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2) |
(icol & HcalDetId::kHcalPhiMask2);
int icol = (col > 0) ? col : kMaxRowCol - col;
int irow = (row > 0) ? row : kMaxRowCol - row;
id_ |= ((depth & kHcalDepthMask) << HcalDetId::kHcalDepthOffset1) | (HcalDetId::kHcalZsideMask1) |
((irow & HcalDetId::kHcalEtaMask1) << HcalDetId::kHcalEtaOffset1) | (icol & HcalDetId::kHcalPhiMask1);
}

AHCalDetId::AHCalDetId(const DetId& gen) {
Expand All @@ -28,20 +27,20 @@ AHCalDetId::AHCalDetId(const DetId& gen) {
}

int AHCalDetId::irow() const {
int value = ((id_ >> HcalDetId::kHcalEtaOffset2) & HcalDetId::kHcalEtaMask2);
if (value >= 10)
value = -(value % 10);
int value = ((id_ >> HcalDetId::kHcalEtaOffset1) & HcalDetId::kHcalEtaMask1);
if (value >= kMaxRowCol)
value = (kMaxRowCol - value);
return value;
}

int AHCalDetId::icol() const {
int value = (id_ & HcalDetId::kHcalPhiMask2);
if (value >= 10)
value = -(value % 10);
int value = (id_ & HcalDetId::kHcalPhiMask1);
if (value >= kMaxRowCol)
value = (kMaxRowCol - value);
return value;
}

int AHCalDetId::depth() const { return ((id_ >> HcalDetId::kHcalDepthOffset2) & HcalDetId::kHcalDepthMask2); }
int AHCalDetId::depth() const { return ((id_ >> HcalDetId::kHcalDepthOffset1) & kHcalDepthMask); }

std::ostream& operator<<(std::ostream& s, const AHCalDetId& id) {
return s << "(AHCal " << id.irow() << ',' << id.icol() << ',' << id.depth() << ')';
Expand Down
8 changes: 6 additions & 2 deletions SimG4CMS/HGCalTestBeam/plugins/AHCalDetId.h
Expand Up @@ -32,14 +32,18 @@ class AHCalDetId : public DetId {
int zside() const { return 1; }
/// get the row number
int irow() const;
int irowAbs() const { return ((id_ >> HcalDetId::kHcalEtaOffset2) & HcalDetId::kHcalEtaMask2); }
int irowAbs() const { return ((id_ >> HcalDetId::kHcalEtaOffset1) & HcalDetId::kHcalEtaMask1); }
/// get the column number
int icol() const;
int icolAbs() const { return (id_ & HcalDetId::kHcalPhiMask2); }
int icolAbs() const { return (id_ & HcalDetId::kHcalPhiMask1); }
/// get the layer number
int depth() const;

static const AHCalDetId Undefined;

private:
static constexpr int kMaxRowCol = 16;
static constexpr uint32_t kHcalDepthMask = 0x3F;
};

std::ostream& operator<<(std::ostream&, const AHCalDetId& id);
Expand Down