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

Phase2-hgx357 Give correct names of some of the variables and correct their implementation in the HGCal Geometry #45284

Merged
merged 2 commits into from
Jul 1, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions DataFormats/ForwardDetId/interface/HGCSiliconDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
[19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
[20:24] layer number
[25:25] z-side (0 for +z; 1 for -z)
[26:27] Type (0 fine divisions of wafer with 120 mum thick silicon
1 coarse divisions of wafer with 200 mum thick silicon
2 coarse divisions of wafer with 300 mum thick silicon
3 fine divisions of wafer with 200 mum thick silicon)
[26:27] Type (0 high density wafer with depltetion thickness of 120 mum
1 low density wafer with depletion thickness of 200 mum
2 low density wafer with depletion thickness of 300 mum
3 high density wafer with depletion thickness of 200 mum)
[28:31] Detector type (HGCalEE or HGCalHSi)
*/
class HGCSiliconDetId : public DetId {
public:
enum waferType { HGCalFine = 0, HGCalCoarseThin = 1, HGCalCoarseThick = 2, HGCalFineThick = 3 };
enum waferType { HGCalHD120 = 0, HGCalLD200 = 1, HGCalLD300 = 2, HGCalHD200 = 3 };
static constexpr int32_t HGCalHighDensityN = 12;
static constexpr int32_t HGCalLowDensityN = 8;
static constexpr int32_t HGCalFineTrigger = 3;
Expand Down Expand Up @@ -95,11 +95,10 @@ class HGCSiliconDetId : public DetId {

/// get the type
constexpr int32_t type() const { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
constexpr bool lowDensity() const { return ((type() == HGCalCoarseThin) || (type() == HGCalCoarseThick)); }
constexpr bool highDensity() const { return ((type() == HGCalFine) || (type() == HGCalFineThick)); }
constexpr bool lowDensity() const { return ((type() == HGCalLD200) || (type() == HGCalLD300)); }
constexpr bool highDensity() const { return ((type() == HGCalHD120) || (type() == HGCalHD200)); }
constexpr int32_t depletion() const {
return ((type() == HGCalFine) ? HGCal0Depletion
: ((type() == HGCalCoarseThick) ? HGCal2Depletion : HGCal1Depletion));
return ((type() == HGCalHD120) ? HGCal0Depletion : ((type() == HGCalLD300) ? HGCal2Depletion : HGCal1Depletion));
}

/// get the z-side of the cell (1/-1)
Expand All @@ -113,11 +112,11 @@ class HGCSiliconDetId : public DetId {
constexpr int32_t cellV() const { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
constexpr std::pair<int32_t, int32_t> cellUV() const { return std::pair<int32_t, int32_t>(cellU(), cellV()); }
constexpr int32_t cellX() const {
int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN;
return (3 * (cellV() - N) + 2);
}
constexpr int32_t cellY() const {
int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN;
return (2 * cellU() - (N + cellV()));
}
constexpr std::pair<int32_t, int32_t> cellXY() const { return std::pair<int32_t, int32_t>(cellX(), cellY()); }
Expand Down Expand Up @@ -148,15 +147,15 @@ class HGCSiliconDetId : public DetId {

// get trigger cell u,v
constexpr int32_t triggerCellU() const {
int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t NT = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalFineTrigger : HGCalCoarseTrigger;
int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t NT = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalFineTrigger : HGCalCoarseTrigger;
return (cellU() >= N && cellV() >= N)
? cellU() / NT
: ((cellU() < N && cellU() <= cellV()) ? cellU() / NT : (1 + (cellU() - (cellV() % NT + 1)) / NT));
}
constexpr int32_t triggerCellV() const {
int32_t N = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t NT = ((type() == HGCalFine) || (type() == HGCalFineThick)) ? HGCalFineTrigger : HGCalCoarseTrigger;
int32_t N = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalHighDensityN : HGCalLowDensityN;
int32_t NT = ((type() == HGCalHD120) || (type() == HGCalHD200)) ? HGCalFineTrigger : HGCalCoarseTrigger;
return (cellU() >= N && cellV() >= N)
? cellV() / NT
: ((cellU() < N && cellU() <= cellV()) ? ((cellV() - cellU()) / NT + cellU() / NT) : cellV() / NT);
Expand Down
7 changes: 4 additions & 3 deletions DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
[13:16] abs(v) of the wafer (v-axis points 60-degree wrt x-axis)
[17:17] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line)
[18:22] layer number
[23:24] Type (0 fine divisions of wafer with 120 mum thick silicon
1 coarse divisions of wafer with 200 mum thick silicon
2 coarse divisions of wafer with 300 mum thick silicon)
[23:24] Type (0 high density wafer with depltetion thickness of 120 mum
1 low density wafer with depletion thickness of 200 mum
2 low density wafer with depletion thickness of 300 mum
3 high density wafer with depletion thickness of 200 mum)
[25:26] Subdetector Type (HGCalEETrigger/HGCalHSiTrigger)
[27:27] z-side (0 for +z; 1 for -z)
[28:31] Detector type (HGCalTrigger)
Expand Down
20 changes: 12 additions & 8 deletions DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ HGCalTriggerDetId& HGCalTriggerDetId::operator=(const DetId& gen) {
}

int HGCalTriggerDetId::triggerCellX() const {
int nT =
(type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger;
int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200))
? HGCSiliconDetId::HGCalFineTrigger
: HGCSiliconDetId::HGCalCoarseTrigger;
int N = nT * HGCalTriggerCell;
std::vector<int> vc = cellV();
int x(0);
Expand All @@ -59,8 +60,9 @@ int HGCalTriggerDetId::triggerCellX() const {
}

int HGCalTriggerDetId::triggerCellY() const {
int nT =
(type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger;
int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200))
? HGCSiliconDetId::HGCalFineTrigger
: HGCSiliconDetId::HGCalCoarseTrigger;
int N = nT * HGCalTriggerCell;
std::vector<int> uc = cellU();
std::vector<int> vc = cellV();
Expand All @@ -73,8 +75,9 @@ int HGCalTriggerDetId::triggerCellY() const {

std::vector<int> HGCalTriggerDetId::cellU() const {
std::vector<int> uc;
int nT =
(type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger;
int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200))
? HGCSiliconDetId::HGCalFineTrigger
: HGCSiliconDetId::HGCalCoarseTrigger;
if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) {
int u0 = nT * triggerCellU();
for (int i = 0; i < nT; ++i) {
Expand Down Expand Up @@ -103,8 +106,9 @@ std::vector<int> HGCalTriggerDetId::cellU() const {

std::vector<int> HGCalTriggerDetId::cellV() const {
std::vector<int> vc;
int nT =
(type() == HGCSiliconDetId::HGCalFine) ? HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger;
int nT = ((type() == HGCSiliconDetId::HGCalHD120) || (type() == HGCSiliconDetId::HGCalHD200))
? HGCSiliconDetId::HGCalFineTrigger
: HGCSiliconDetId::HGCalCoarseTrigger;
if ((triggerCellU() >= HGCalTriggerCell) && (triggerCellV() >= HGCalTriggerCell)) {
int v0 = nT * triggerCellV();
for (int i = 0; i < nT; ++i) {
Expand Down
10 changes: 5 additions & 5 deletions Geometry/HGCalCommonData/interface/HGCalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class HGCalTypes {
static constexpr int32_t WaferCenterR = 6;

static constexpr int32_t WaferTypeUndefined = -1;
static constexpr int32_t WaferFineThin = 0;
static constexpr int32_t WaferCoarseThin = 1;
static constexpr int32_t WaferCoarseThick = 2;
static constexpr int32_t WaferFineThick = 3;
static constexpr int32_t WaferHD120 = 0;
static constexpr int32_t WaferLD200 = 1;
static constexpr int32_t WaferLD300 = 2;
static constexpr int32_t WaferHD200 = 3;

static constexpr int32_t WaferFull = 0;
static constexpr int32_t WaferFive = 1;
Expand Down Expand Up @@ -137,7 +137,7 @@ class HGCalTypes {
static constexpr int32_t layerFrontBack(int32_t layerOrient) { return ((layerOrient == WaferCenterB) ? 1 : -1); }
static constexpr int32_t waferFrontBack(int32_t index) { return ((index == 0) ? -1 : 1); }
// LD vs HD and Fullvs Partial wafer
static constexpr bool waferHD(int32_t type) { return ((type == WaferFineThin) || (type == WaferFineThick)); }
static constexpr bool waferHD(int32_t type) { return ((type == WaferHD120) || (type == WaferHD200)); }
static constexpr bool waferFull(int32_t type) { return (type == WaferFull); }

private:
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HGCalCommonData/src/HGCalCalibrationCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ HGCalCalibrationCell::HGCalCalibrationCell(const HGCalDDDConstants* cons) : cons
int HGCalCalibrationCell::findCell(
int zside, int layer, int waferU, int waferV, int cellUV, const std::pair<double, double>& xy) const {
const auto& info = cons_->waferInfo(layer, waferU, waferV);
int ld = (info.type == HGCalTypes::WaferFineThin) ? 1 : 0;
int ld = ((info.type == HGCalTypes::WaferHD120) || (info.type == HGCalTypes::WaferHD200)) ? 1 : 0;
int part = (info.part == HGCalTypes::WaferFull) ? 1 : 0;
int indx = 2 * ld + part;
#ifdef EDM_ML_DEBUG
Expand Down
Loading