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

[CPP20][GEOMETRY] Replace some enums with constexpr ints #44514

Merged
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
2 changes: 1 addition & 1 deletion DataFormats/EcalDetId/interface/EBDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class EBDetId : public DetId {
// eta coverage of one crystal (approximate)
static const float crystalUnitToEta;

enum { kSizeForDenseIndexing = MAX_HASH + 1 };
static constexpr int kSizeForDenseIndexing = MAX_HASH + 1;

// function modes for (int, int) constructor
static const int ETAPHIMODE = 0;
Expand Down
12 changes: 5 additions & 7 deletions DataFormats/EcalDetId/interface/EEDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,13 @@ class EEDetId : public DetId {
*/
static const int ICR_MAX = 25;

enum {
/** Number of crystals per Dee
*/
kEEhalf = 7324,
/** Number of dense crystal indices, that is number of
/** Number of crystals per Dee
*/
static constexpr int kEEhalf = 7324;
/** Number of dense crystal indices, that is number of
* crystals per endcap.
*/
kSizeForDenseIndexing = 2 * kEEhalf
};
static constexpr int kSizeForDenseIndexing = 2 * kEEhalf;

/*@{*/
/** function modes for EEDetId(int, int, int, int) constructor
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/EcalDetId/interface/ESDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class ESDetId : public DetId {
static const unsigned short hy2[kXYMAX];

public:
enum { kSizeForDenseIndexing = kLa };
static constexpr int kSizeForDenseIndexing = kLa;
};

std::ostream& operator<<(std::ostream&, const ESDetId& id);
Expand Down
9 changes: 3 additions & 6 deletions DataFormats/HcalDetId/interface/HcalCastorDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ class HcalCastorDetId : public DetId {
// get the individual cell id
// int channel() const;

enum {
kNumberModulesPerEnd = 14,
kNumberSectorsPerEnd = 16,
kNumberCellsPerEnd = kNumberModulesPerEnd * kNumberSectorsPerEnd,
kSizeForDenseIndexing = kNumberCellsPerEnd
};
static constexpr int kNumberModulesPerEnd = 14, kNumberSectorsPerEnd = 16,
kNumberCellsPerEnd = kNumberModulesPerEnd * kNumberSectorsPerEnd,
kSizeForDenseIndexing = kNumberCellsPerEnd;

uint32_t denseIndex() const;

Expand Down
2 changes: 1 addition & 1 deletion DataFormats/HcalDetId/interface/HcalZDCDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class HcalZDCDetId : public DetId {
public:
constexpr static int32_t kSizeForDenseIndexingRun1 = 2 * kDepRun1;
constexpr static int32_t kSizeForDenseIndexingRun3 = 2 * kDepRun3;
enum { kSizeForDenseIndexing = kSizeForDenseIndexingRun1 };
constexpr static int32_t kSizeForDenseIndexing = kSizeForDenseIndexingRun1;
};

std::ostream& operator<<(std::ostream&, const HcalZDCDetId& id);
Expand Down
31 changes: 11 additions & 20 deletions Geometry/CaloTopology/interface/HcalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,26 +224,17 @@ class HcalTopology : public CaloSubdetectorTopology {
SegmentationMap depthSegmentation_;
SegmentationMap depthSegmentationOne_;

enum {
kHBhalf = 1296,
kHEhalf = 1296,
kHOhalf = 1080,
kHFhalf = 864,
kHThalf = 2088,
kZDChalf = 11,
kCASTORhalf = 224,
kCALIBhalf = 693,
kHThalfPhase1 = 2520,
kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf
};
enum { kSizeForDenseIndexingPreLS1 = 2 * kHcalhalf };
enum { kHBSizePreLS1 = 2 * kHBhalf };
enum { kHESizePreLS1 = 2 * kHEhalf };
enum { kHOSizePreLS1 = 2 * kHOhalf };
enum { kHFSizePreLS1 = 2 * kHFhalf };
enum { kHTSizePreLS1 = 2 * kHThalf };
enum { kHTSizePhase1 = 2 * kHThalfPhase1 };
enum { kCALIBSizePreLS1 = 2 * kCALIBhalf };
static constexpr int kHBhalf = 1296, kHEhalf = 1296, kHOhalf = 1080, kHFhalf = 864, kHThalf = 2088, kZDChalf = 11,
kCASTORhalf = 224, kCALIBhalf = 693, kHThalfPhase1 = 2520,
kHcalhalf = kHBhalf + kHEhalf + kHOhalf + kHFhalf;
static constexpr int kSizeForDenseIndexingPreLS1 = 2 * kHcalhalf;
static constexpr int kHBSizePreLS1 = 2 * kHBhalf;
static constexpr int kHESizePreLS1 = 2 * kHEhalf;
static constexpr int kHOSizePreLS1 = 2 * kHOhalf;
static constexpr int kHFSizePreLS1 = 2 * kHFhalf;
static constexpr int kHTSizePreLS1 = 2 * kHThalf;
static constexpr int kHTSizePhase1 = 2 * kHThalfPhase1;
static constexpr int kCALIBSizePreLS1 = 2 * kCALIBhalf;
static constexpr int minMaxDepth_ = 4;
static constexpr unsigned int minPhi_ = 1, maxPhi_ = 72;
static constexpr unsigned int kOffCalibHB_ = 0;
Expand Down
6 changes: 3 additions & 3 deletions Geometry/EcalAlgo/interface/EcalBarrelGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class EcalBarrelGeometry final : public CaloSubdetectorGeometry {

typedef EBDetId DetIdType;

enum { k_NumberOfCellsForCorners = EBDetId::kSizeForDenseIndexing };
static constexpr int k_NumberOfCellsForCorners = EBDetId::kSizeForDenseIndexing;

enum { k_NumberOfShapes = 17 };
static constexpr int k_NumberOfShapes = 17;

enum { k_NumberOfParametersPerShape = 11 };
static constexpr int k_NumberOfParametersPerShape = 11;

static std::string dbString() { return "PEcalBarrelRcd"; }

Expand Down
6 changes: 3 additions & 3 deletions Geometry/EcalAlgo/interface/EcalEndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class EcalEndcapGeometry final : public CaloSubdetectorGeometry {

typedef EEDetId DetIdType;

enum { k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing };
static constexpr int k_NumberOfCellsForCorners = EEDetId::kSizeForDenseIndexing;

enum { k_NumberOfShapes = 1 };
static constexpr int k_NumberOfShapes = 1;

enum { k_NumberOfParametersPerShape = 11 };
static constexpr int k_NumberOfParametersPerShape = 11;

static std::string dbString() { return "PEcalEndcapRcd"; }

Expand Down
6 changes: 3 additions & 3 deletions Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class EcalPreshowerGeometry final : public CaloSubdetectorGeometry {
typedef CaloSubdetectorGeometry::ParVecVec ParVecVec;
typedef ESDetId DetIdType;

enum { k_NumberOfCellsForCorners = ESDetId::kSizeForDenseIndexing };
static constexpr int k_NumberOfCellsForCorners = ESDetId::kSizeForDenseIndexing;

enum { k_NumberOfShapes = 4 };
static constexpr int k_NumberOfShapes = 4;

enum { k_NumberOfParametersPerShape = 4 };
static constexpr int k_NumberOfParametersPerShape = 4;

static std::string dbString() { return "PEcalPreshowerRcd"; }

Expand Down
6 changes: 3 additions & 3 deletions Geometry/ForwardGeometry/interface/CastorGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class CastorGeometry : public CaloSubdetectorGeometry {
typedef PCastorRcd PGeometryRecord;
typedef HcalCastorDetId DetIdType;

enum { k_NumberOfCellsForCorners = HcalCastorDetId::kSizeForDenseIndexing };
static constexpr int k_NumberOfCellsForCorners = HcalCastorDetId::kSizeForDenseIndexing;

enum { k_NumberOfShapes = 4 };
static constexpr int k_NumberOfShapes = 4;

enum { k_NumberOfParametersPerShape = 6 };
static constexpr int k_NumberOfParametersPerShape = 6;

static std::string dbString() { return "PCastorRcd"; }

Expand Down
6 changes: 3 additions & 3 deletions Geometry/ForwardGeometry/interface/ZdcGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class ZdcGeometry : public CaloSubdetectorGeometry {
typedef PZdcRcd PGeometryRecord;
typedef HcalZDCDetId DetIdType;

enum { k_NumberOfCellsForCorners = HcalZDCDetId::kSizeForDenseIndexing };
static constexpr int k_NumberOfCellsForCorners = HcalZDCDetId::kSizeForDenseIndexing;

enum { k_NumberOfShapes = 3 };
static constexpr int k_NumberOfShapes = 3;

enum { k_NumberOfParametersPerShape = 4 };
static constexpr int k_NumberOfParametersPerShape = 4;

static std::string dbString() { return "PZdcRcd"; }

Expand Down