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

Extend the definition of good cell for v17 version of HGCal Geometry #38217

Merged
merged 4 commits into from Jun 4, 2022
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
2 changes: 0 additions & 2 deletions Geometry/HGCalCommonData/interface/HGCalCellUV.h
Expand Up @@ -40,8 +40,6 @@ class HGCalCellUV {
static constexpr double sqrt3_ = 1.732050807568877; // std::sqrt(3.0) in double precision
static constexpr double sin60_ = 0.5 * sqrt3_;
static constexpr double cos60_ = 0.5;
static constexpr int edgeWaferLDTop = 7; // The edge of wafer defined by u=7
static constexpr int edgeWaferHDBottom = 10; // The edge of wafer defined by u=10

int32_t ncell_[2];
double cellX_[2], cellY_[2], cellXTotal_[2], cellYTotal_[2], waferSize;
Expand Down
14 changes: 14 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalTypes.h
Expand Up @@ -4,6 +4,7 @@
#include <cmath>
#include <cstdint>
#include <vector>
#include <array>

class HGCalTypes {
public:
Expand Down Expand Up @@ -85,6 +86,19 @@ class HGCalTypes {
static constexpr double c88 = 0.8875;
static constexpr double c10 = 1.0;

// Condition for cells in partial wafer: arr[0]*u + arr[1]*v <= arr[2]
static constexpr std::array<int, 3> edgeWaferLDTop = {{1, 0, 7}};
static constexpr std::array<int, 3> edgeWaferLDBottom = {{-1, 0, -8}};
static constexpr std::array<int, 3> edgeWaferLDLeft = {{-1, 2, 7}};
static constexpr std::array<int, 3> edgeWaferLDRight = {{1, -2, -7}};
static constexpr std::array<int, 3> edgeWaferLDFive = {{-1, 2, 15}};
static constexpr std::array<int, 3> edgeWaferLDThree = {{1, -2, -15}};
static constexpr std::array<int, 3> edgeWaferHDTop = {{1, 0, 9}};
static constexpr std::array<int, 3> edgeWaferHDBottom = {{-1, 0, -10}};
static constexpr std::array<int, 3> edgeWaferHDLeft = {{-1, 2, 4}};
static constexpr std::array<int, 3> edgeWaferHDRight = {{1, -2, -18}};
static constexpr std::array<int, 3> edgeWaferHDFive = {{-1, 2, 18}};

enum TileType { TileFine = 0, TileCoarseCast = 1, TileCoarseMould = 2 };

enum TileSiPMType { SiPMUnknown = 0, SiPMSmall = 2, SiPMLarge = 4 };
Expand Down
2 changes: 2 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalWaferMask.h
Expand Up @@ -21,6 +21,8 @@ class HGCalWaferMask {
static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners);
// Decides if the cell is present or not from # oc corners (for V15, V16)
static bool goodCell(int u, int v, int N, int type, int rotn);
// Decides if the cell is present or not (for v17)
static bool goodCell(int u, int v, int waferType);
// Converts rotation index (as otained from flat file) depending on
// zside and type (for V15, V16)
static int getRotation(int zside, int type, int rotn);
Expand Down
6 changes: 4 additions & 2 deletions Geometry/HGCalCommonData/src/HGCalCellUV.cc
@@ -1,6 +1,7 @@
#include "Geometry/HGCalCommonData/interface/HGCalCellUV.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/HGCalCommonData/interface/HGCalWaferMask.h"
#include <iostream>
#include <array>
#include <algorithm>
Expand Down Expand Up @@ -274,7 +275,7 @@ std::pair<int32_t, int32_t> HGCalCellUV::cellUVFromXY1(
int u = uv.first;
int v = uv.second;
if (partial == HGCalTypes::WaferLDTop) {
if (u > edgeWaferLDTop) {
if (u * HGCalTypes::edgeWaferLDTop[0] + v * HGCalTypes::edgeWaferLDTop[1] == HGCalTypes::edgeWaferLDTop[2] + 1) {
double xloc1 = (placement >= HGCalCell::cellPlacementExtra) ? xloc : -xloc;
int rot = placement % HGCalCell::cellPlacementExtra;
static constexpr std::array<double, 6> fcos = {{1.0, cos60_, -cos60_, -1.0, -cos60_, cos60_}};
Expand All @@ -291,7 +292,8 @@ std::pair<int32_t, int32_t> HGCalCellUV::cellUVFromXY1(
}
}
} else if (partial == HGCalTypes::WaferHDBottom) {
if (u < edgeWaferHDBottom) {
if (u * HGCalTypes::edgeWaferHDBottom[0] + v * HGCalTypes::edgeWaferHDBottom[1] ==
HGCalTypes::edgeWaferHDBottom[2] + 1) {
double xloc1 = (placement >= HGCalCell::cellPlacementExtra) ? xloc : -xloc;
int rot = placement % HGCalCell::cellPlacementExtra;
static constexpr std::array<double, 6> fcos = {{1.0, cos60_, -cos60_, -1.0, -cos60_, cos60_}};
Expand Down
70 changes: 69 additions & 1 deletion Geometry/HGCalCommonData/src/HGCalWaferMask.cc
Expand Up @@ -106,7 +106,7 @@ The argument 'corners' controls the types of wafers the user wants: for instance
}

bool HGCalWaferMask::goodCell(int u, int v, int n, int type, int rotn) {
// Needs extension for V17
// for V15 and V16
bool good(false);
int n2 = n / 2;
int n4 = n / 4;
Expand Down Expand Up @@ -395,6 +395,74 @@ bool HGCalWaferMask::goodCell(int u, int v, int n, int type, int rotn) {
return good;
}

bool HGCalWaferMask::goodCell(int u, int v, int waferType) {
// for V17
bool good(false);
switch (waferType) {
case (HGCalTypes::WaferFull): { //WaferFull
good = true;
break;
}
case (HGCalTypes::WaferLDTop): {
good = (u * HGCalTypes::edgeWaferLDTop[0] + v * HGCalTypes::edgeWaferLDTop[1] <= HGCalTypes::edgeWaferLDTop[2]);
break;
}
case (HGCalTypes::WaferLDBottom): {
good = (u * HGCalTypes::edgeWaferLDBottom[0] + v * HGCalTypes::edgeWaferLDBottom[1] <=
HGCalTypes::edgeWaferLDBottom[2]);
break;
}
case (HGCalTypes::WaferLDLeft): {
good =
(u * HGCalTypes::edgeWaferLDLeft[0] + v * HGCalTypes::edgeWaferLDLeft[1] <= HGCalTypes::edgeWaferLDLeft[2]);
break;
}
case (HGCalTypes::WaferLDRight): {
good = (u * HGCalTypes::edgeWaferLDRight[0] + v * HGCalTypes::edgeWaferLDRight[1] <=
HGCalTypes::edgeWaferLDRight[2]);
break;
}
case (HGCalTypes::WaferLDFive): {
good =
(u * HGCalTypes::edgeWaferLDFive[0] + v * HGCalTypes::edgeWaferLDFive[1] <= HGCalTypes::edgeWaferLDFive[2]);
break;
}
case (HGCalTypes::WaferLDThree): {
good = (u * HGCalTypes::edgeWaferLDThree[0] + v * HGCalTypes::edgeWaferLDThree[1] <=
HGCalTypes::edgeWaferLDThree[2]);
break;
}
case (HGCalTypes::WaferHDTop): {
good = (u * HGCalTypes::edgeWaferHDTop[0] + v * HGCalTypes::edgeWaferHDTop[1] <= HGCalTypes::edgeWaferHDTop[2]);
break;
}
case (HGCalTypes::WaferHDBottom): {
good = (u * HGCalTypes::edgeWaferHDBottom[0] + v * HGCalTypes::edgeWaferHDBottom[1] <=
HGCalTypes::edgeWaferHDBottom[2]);
break;
}
case (HGCalTypes::WaferHDLeft): {
good =
(u * HGCalTypes::edgeWaferHDLeft[0] + v * HGCalTypes::edgeWaferHDLeft[1] <= HGCalTypes::edgeWaferHDLeft[2]);
break;
}
case (HGCalTypes::WaferHDRight): {
good = (u * HGCalTypes::edgeWaferHDRight[0] + v * HGCalTypes::edgeWaferHDRight[1] <=
HGCalTypes::edgeWaferHDRight[2]);
break;
}
case (HGCalTypes::WaferHDFive): {
good =
(u * HGCalTypes::edgeWaferHDFive[0] + v * HGCalTypes::edgeWaferHDFive[1] <= HGCalTypes::edgeWaferHDFive[2]);
break;
}
}
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "u|v " << u << ":" << v << " WaferType " << waferType << " good " << good;
#endif
return good;
}

int HGCalWaferMask::getRotation(int zside, int type, int rotn) {
// Needs extension for V17
if (rotn >= HGCalTypes::WaferCornerMax)
Expand Down