Skip to content

Commit

Permalink
Merge pull request #37547 from bsunanda/Phase2-hgx308
Browse files Browse the repository at this point in the history
Phase2-hgx308 Add the new conversion code of Flat file to XML
  • Loading branch information
cmsbuild authored Apr 19, 2022
2 parents 8ae9891 + c571482 commit 2e395dc
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 114 deletions.
7 changes: 0 additions & 7 deletions Geometry/HGCalCommonData/interface/HGCalCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ class HGCalCell {
public:
HGCalCell(double waferSize, int32_t nFine, int32_t nCoarse);

static constexpr int32_t waferOrient0 = 0;
static constexpr int32_t waferOrient1 = 1;
static constexpr int32_t waferOrient2 = 2;
static constexpr int32_t waferOrient3 = 3;
static constexpr int32_t waferOrient4 = 4;
static constexpr int32_t waferOrient5 = 5;

static constexpr int32_t cellPlacementIndex0 = 0;
static constexpr int32_t cellPlacementIndex1 = 1;
static constexpr int32_t cellPlacementIndex2 = 2;
Expand Down
5 changes: 4 additions & 1 deletion Geometry/HGCalCommonData/interface/HGCalProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#include <cstdint>

namespace HGCalProperty {
int32_t waferProperty(const int32_t thick, const int32_t partial, const int32_t orient);
int32_t waferProperty(const int32_t thick, const int32_t partial, const int32_t orient, const int32_t cassette = 0);
int32_t waferThick(const int32_t property);
int32_t waferPartial(const int32_t property);
int32_t waferOrient(const int32_t property);
int32_t waferCassette(const int32_t property);
int32_t tileProperty(const int32_t type, const int32_t sipm);
int32_t tileType(const int32_t property);
int32_t tileSiPM(const int32_t property);
Expand All @@ -35,9 +36,11 @@ namespace HGCalProperty {

constexpr int32_t kHGCalFactor = 10;
constexpr int32_t kHGCalFactorPartial = 100;
constexpr int32_t kHGCalFactorCassette = 100;
constexpr int32_t kHGCalOffsetThick = 1;
constexpr int32_t kHGCalOffsetPartial = 10;
constexpr int32_t kHGCalOffsetOrient = 1000;
constexpr int32_t kHGCalOffsetCassette = 10000;
constexpr int32_t kHGCalOffsetType = 1;
constexpr int32_t kHGCalOffsetSiPM = 10;
constexpr int32_t kHGCalTilePack = 1000;
Expand Down
109 changes: 53 additions & 56 deletions Geometry/HGCalCommonData/interface/HGCalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,63 @@ class HGCalTypes {
public:
HGCalTypes() {}

enum WaferCorner {
WaferCorner0 = 0,
WaferCorner1 = 1,
WaferCorner2 = 2,
WaferCorner3 = 3,
WaferCorner4 = 4,
WaferCorner5 = 5
};
static constexpr int32_t WaferCorner0 = 0;
static constexpr int32_t WaferCorner1 = 1;
static constexpr int32_t WaferCorner2 = 2;
static constexpr int32_t WaferCorner3 = 3;
static constexpr int32_t WaferCorner4 = 4;
static constexpr int32_t WaferCorner5 = 5;

enum WaferPosition {
UnknownPosition = -1,
WaferCenter = 0,
CornerCenterYp = 1,
CornerCenterYm = 2,
CornerCenterXp = 3,
CornerCenterXm = 4,
WaferCenterB = 5,
WaferCenterR = 6
};
static constexpr int32_t UnknownPosition = -1;
static constexpr int32_t WaferCenter = 0;
static constexpr int32_t CornerCenterYp = 1;
static constexpr int32_t CornerCenterYm = 2;
static constexpr int32_t CornerCenterXp = 3;
static constexpr int32_t CornerCenterXm = 4;
static constexpr int32_t WaferCenterB = 5;
static constexpr int32_t WaferCenterR = 6;

enum WaferType {
WaferTypeUndefined = -1,
WaferFineThin = 0,
WaferCoarseThin = 1,
WaferCoarseThick = 2,
WaferFineThick = 3
};
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;

enum WaferPartialType {
WaferFull = 0,
WaferFive = 1,
WaferChopTwo = 2,
WaferChopTwoM = 3,
WaferHalf = 4,
WaferSemi = 5,
WaferSemi2 = 6,
WaferThree = 7,
WaferHalf2 = 8,
WaferFive2 = 9,
WaferLDTop = 11,
WaferLDBottom = 12,
WaferLDLeft = 13,
WaferLDRight = 14,
WaferLDFive = 15,
WaferLDTree = 16,
WaferHDTop = 21,
WaferHDBottom = 22,
WaferHDLeft = 23,
WaferHDRight = 24,
WaferHDFive = 25,
WaferOut = 99
};
static constexpr int32_t WaferFull = 0;
static constexpr int32_t WaferFive = 1;
static constexpr int32_t WaferChopTwo = 2;
static constexpr int32_t WaferChopTwoM = 3;
static constexpr int32_t WaferHalf = 4;
static constexpr int32_t WaferSemi = 5;
static constexpr int32_t WaferSemi2 = 6;
static constexpr int32_t WaferThree = 7;
static constexpr int32_t WaferHalf2 = 8;
static constexpr int32_t WaferFive2 = 9;
static constexpr int32_t WaferLDTop = 11;
static constexpr int32_t WaferLDBottom = 12;
static constexpr int32_t WaferLDLeft = 13;
static constexpr int32_t WaferLDRight = 14;
static constexpr int32_t WaferLDFive = 15;
static constexpr int32_t WaferLDThree = 16;
static constexpr int32_t WaferHDTop = 21;
static constexpr int32_t WaferHDBottom = 22;
static constexpr int32_t WaferHDLeft = 23;
static constexpr int32_t WaferHDRight = 24;
static constexpr int32_t WaferHDFive = 25;
static constexpr int32_t WaferOut = 99;

enum LayerType {
WaferCenteredFront = 0,
WaferCenteredBack = 1,
CornerCenteredY = 2,
CornerCenteredLambda = 3,
WaferCenteredRotated = 4
};
static constexpr int32_t WaferOrient0 = 0;
static constexpr int32_t WaferOrient1 = 1;
static constexpr int32_t WaferOrient2 = 2;
static constexpr int32_t WaferOrient3 = 3;
static constexpr int32_t WaferOrient4 = 4;
static constexpr int32_t WaferOrient5 = 5;

static constexpr int32_t WaferCenteredFront = 0;
static constexpr int32_t WaferCenteredBack = 1;
static constexpr int32_t CornerCenteredY = 2;
static constexpr int32_t CornerCenteredLambda = 3;
static constexpr int32_t WaferCenteredRotated = 4;

static constexpr int32_t WaferCornerMin = 3;
static constexpr int32_t WaferCornerMax = 6;
Expand Down
12 changes: 10 additions & 2 deletions Geometry/HGCalCommonData/src/HGCalProperty.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#include "Geometry/HGCalCommonData/interface/HGCalProperty.h"

int32_t HGCalProperty::waferProperty(const int32_t thick, const int32_t part, const int32_t orient) {
int32_t HGCalProperty::waferProperty(const int32_t thick,
const int32_t part,
const int32_t orient,
const int32_t cassette) {
return (((thick % HGCalProperty::kHGCalFactor) * HGCalProperty::kHGCalOffsetThick) +
((part % HGCalProperty::kHGCalFactorPartial) * HGCalProperty::kHGCalOffsetPartial) +
((orient % HGCalProperty::kHGCalFactor) * HGCalProperty::kHGCalOffsetOrient));
((orient % HGCalProperty::kHGCalFactor) * HGCalProperty::kHGCalOffsetOrient) +
((cassette % HGCalProperty::kHGCalFactorCassette) * HGCalProperty::kHGCalOffsetCassette));
}

int32_t HGCalProperty::waferThick(const int32_t property) {
Expand All @@ -18,6 +22,10 @@ int32_t HGCalProperty::waferOrient(const int32_t property) {
return ((property / HGCalProperty::kHGCalOffsetOrient) % HGCalProperty::kHGCalFactor);
}

int32_t HGCalProperty::waferCassette(const int32_t property) {
return ((property / HGCalProperty::kHGCalOffsetCassette) % HGCalProperty::kHGCalFactorCassette);
}

int32_t HGCalProperty::tileProperty(const int32_t type, const int32_t sipm) {
return (((type % HGCalProperty::kHGCalFactor) * HGCalProperty::kHGCalOffsetType) +
((sipm % HGCalProperty::kHGCalFactor) * HGCalProperty::kHGCalOffsetSiPM));
Expand Down
Loading

0 comments on commit 2e395dc

Please sign in to comment.