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-hgx310C Add in line documentation to some service methods in Geometry/HGCalCommonData #37759

Merged
merged 2 commits into from
May 2, 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
4 changes: 4 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ class HGCalCell {

std::pair<double, double> cellUV2XY1(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
std::pair<double, double> cellUV2XY2(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
// Get cell type and orientation index
std::pair<int32_t, int32_t> cellUV2Cell(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
// Get the placement index from zside, forward-backward tag, orientation flag
static int32_t cellPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient);
// Get the orientation flag and forward-backward tag from placement index
static std::pair<int32_t, int32_t> cellOrient(int32_t placementIndex);
// Get cell type and position in the list
static std::pair<int32_t, int32_t> cellType(int32_t u, int32_t v, int32_t ncell, int32_t placementIndex);

private:
Expand Down
10 changes: 10 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalTileIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@
#include <tuple>

namespace HGCalTileIndex {
// Packs layer, ring, phi indices into a single word (useful for XML files)
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi);
// Unpacks Layer number from the packed index
int32_t tileLayer(int32_t index);
// Unpacks Ring number from the packed index
int32_t tileRing(int32_t index);
// Unpacks Phi number from the packed index
int32_t tilePhi(int32_t index);
// Packs tile type and SiPM size into a single word (useful for XML files)
int32_t tileProperty(int32_t, int32_t);
// Unpacks tile type from the packed word
int32_t tileType(int32_t);
// Unpacks SiPM size from the packed word
int32_t tileSiPM(int32_t);
// Packs 3 information for usage in xml file
int32_t tilePack(int32_t ly, int32_t k1, int32_t k2);
// Unpacks thos three information from the packed word
std::tuple<int32_t, int32_t, int32_t> tileUnpack(int32_t index);
// Sees if the tile exists or not depending the HEX information in flat file
bool tileExist(const int32_t* hex, int32_t zside, int32_t phi);
}; // namespace HGCalTileIndex

Expand Down
6 changes: 6 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalWaferIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
#include <cstdint>

namespace HGCalWaferIndex {
// Packs layer, u, v indices into a single word (useful for xml definition)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old = false);
// Unpacks the layer number from the packed index
int32_t waferLayer(const int32_t index);
// Unpacks wafer U from the packed index
int32_t waferU(const int32_t index);
// Unpacks wafer V from the packed index
int32_t waferV(const int32_t index);
// Gets the used part of the index (Layer:u:v)
int32_t waferCopy(const int32_t index);
// Finds the index format (old:false or new:true)
bool waferFormat(const int32_t index);
}; // namespace HGCalWaferIndex

Expand Down
23 changes: 20 additions & 3 deletions Geometry/HGCalCommonData/interface/HGCalWaferMask.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ class HGCalWaferMask {
public:
HGCalWaferMask() = default;

// Decides if the cell is present or not from # oc corners (for V14)
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);
// 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);
// Get partial wafer type and orientation (for V15, V16)
static std::pair<int, int> getTypeMode(const double& xpos,
const double& ypos,
const double& delX,
Expand All @@ -28,11 +33,23 @@ class HGCalWaferMask {
const double& rout,
const int& waferType,
const int& mode,
bool deug = false);
static bool goodTypeMode(
double xpos, double ypos, double delX, double delY, double rin, double rout, int part, int rotn, bool debug);
bool debug = false);
// Checks partial wafer type and orientation (for V15, V16)
static bool goodTypeMode(double xpos,
double ypos,
double delX,
double delY,
double rin,
double rout,
int part,
int rotn,
bool debug = false);
// Gets the corners of the partial wafers from its type, orientation, zside
// (Good for V15, V16 geometries)
static std::vector<std::pair<double, double> > waferXY(
int part, int orient, int zside, double delX, double delY, double xpos, double ypos);
// Gets the corners of the partial wafers from its type, placement index
// (Good for V17 geometry)
static std::vector<std::pair<double, double> > waferXY(
int part, int placement, double delX, double delY, double xpos, double ypos);

Expand Down
52 changes: 52 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalWaferMask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +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
bool good(false);
int n2 = n / 2;
int n4 = n / 4;
Expand Down Expand Up @@ -395,6 +396,7 @@ bool HGCalWaferMask::goodCell(int u, int v, int n, int type, int rotn) {
}

int HGCalWaferMask::getRotation(int zside, int type, int rotn) {
// Needs extension for V17
if (rotn >= HGCalTypes::WaferCornerMax)
rotn = HGCalTypes::WaferCorner0;
int newrotn(rotn);
Expand Down Expand Up @@ -441,6 +443,7 @@ std::pair<int, int> HGCalWaferMask::getTypeMode(const double& xpos,
const int& wType,
const int& mode,
bool debug) {
// No need to extend this for V17 -- use flat file information only
int ncor(0), iok(0);
int type(HGCalTypes::WaferFull), rotn(HGCalTypes::WaferCorner0);

Expand Down Expand Up @@ -680,6 +683,7 @@ std::pair<int, int> HGCalWaferMask::getTypeMode(const double& xpos,

bool HGCalWaferMask::goodTypeMode(
double xpos, double ypos, double delX, double delY, double rin, double rout, int part, int rotn, bool debug) {
// Needs extension for V17
if (part < 0 || part > HGCalTypes::WaferSizeMax)
return false;
if (rotn < 0 || rotn > HGCalTypes::WaferCornerMax)
Expand Down Expand Up @@ -1002,11 +1006,35 @@ bool HGCalWaferMask::goodTypeMode(

std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
int part, int ori, int zside, double delX, double delY, double xpos, double ypos) {
// Good for V15 and V16 versions
std::vector<std::pair<double, double> > xy;
int orient = getRotation(-zside, part, ori);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "Part " << part << " zSide " << zside << " Orient " << ori << ":" << orient;
#endif
/*
The exact contour of partial wafers are obtained by joining points on
the circumference of a full wafer.
Numbering the points along the edges of a hexagonal wafer, starting from
the bottom corner:

3
15 18
9 8
19 14
4 2
16 23
10 7
20 13
5 1
17 22
11 6
21 12
0

Depending on the wafer type and orientation index, the corners
are chosen in the variable *np*
*/
double dx[24] = {HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
Expand Down Expand Up @@ -1155,9 +1183,33 @@ std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
std::vector<std::pair<double, double> > HGCalWaferMask::waferXY(
int part, int place, double delX, double delY, double xpos, double ypos) {
std::vector<std::pair<double, double> > xy;
// Good for V17 version and uses partial wafer type & placement index
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "Part " << part << " Placement Index " << place;
#endif
/*
The exact contour of partial wafers are obtained by joining points on
the circumference of a full wafer.
Numbering the points along the edges of a hexagonal wafer, starting from
the bottom corner:

3
15 18
9 8
19 14
4 2
16 23
10 7
20 13
5 1
17 22
11 6
21 12
0

Depending on the wafer type and placement index, the corners
are chosen in the variable *np*
*/
double dx[24] = {HGCalTypes::c00 * delX, HGCalTypes::c10 * delX, HGCalTypes::c10 * delX, HGCalTypes::c00 * delX,
-HGCalTypes::c10 * delX, -HGCalTypes::c10 * delX, HGCalTypes::c50 * delX, HGCalTypes::c10 * delX,
HGCalTypes::c50 * delX, -HGCalTypes::c50 * delX, -HGCalTypes::c10 * delX, -HGCalTypes::c50 * delX,
Expand Down