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

Avoid uninitialized data in DD4Hep HGCal geometry parameters #45442

Merged
merged 2 commits into from
Jul 15, 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
68 changes: 34 additions & 34 deletions Geometry/HGCalCommonData/interface/HGCalParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ class HGCalParameters {
std::array<int, 4> getID(unsigned int k) const;

std::string name_;
int detectorType_;
int useSimWt_;
int nCells_;
int nSectors_;
int firstLayer_;
int firstMixedLayer_;
HGCalGeometryMode::GeometryMode mode_;
int detectorType_ = 0;
int useSimWt_ = 0;
int nCells_ = 0;
int nSectors_ = 0;
int firstLayer_ = 0;
int firstMixedLayer_ = 0;
HGCalGeometryMode::GeometryMode mode_ = HGCalGeometryMode::Square;

std::vector<double> cellSize_;
std::vector<double> slopeMin_;
Expand Down Expand Up @@ -146,62 +146,62 @@ class HGCalParameters {
std::vector<double> rLimit_;
std::vector<int> cellFine_;
std::vector<int> cellCoarse_;
double waferR_;
double waferR_ = 0.;
std::vector<int> levelT_;
int levelZSide_;
int levelZSide_ = 0;
layer_map copiesInLayers_;
int nCellsFine_;
int nCellsCoarse_;
double waferSize_;
double waferThick_;
double sensorSeparation_;
double sensorSizeOffset_;
double guardRingOffset_;
double mouseBite_;
int useOffset_;
int waferUVMax_;
int nCellsFine_ = 0;
int nCellsCoarse_ = 0;
double waferSize_ = 0.;
double waferThick_ = 0.;
double sensorSeparation_ = 0.;
double sensorSizeOffset_ = 0.;
double guardRingOffset_ = 0.;
double mouseBite_ = 0.;
int useOffset_ = 0;
int waferUVMax_ = 0;
std::vector<int> waferUVMaxLayer_;
bool defineFull_;
bool defineFull_ = false;
std::vector<double> waferThickness_;
std::vector<double> cellThickness_;
std::vector<double> radius100to200_;
std::vector<double> radius200to300_;
int choiceType_;
int nCornerCut_;
double fracAreaMin_;
double zMinForRad_;
int choiceType_ = 0;
int nCornerCut_ = 0;
double fracAreaMin_ = 0.;
double zMinForRad_ = 0.;
std::vector<double> radiusMixBoundary_;
std::vector<int> nPhiBinBH_;
std::vector<int> layerFrontBH_;
std::vector<double> rMinLayerBH_;
std::vector<double> radiusLayer_[2];
std::vector<int> iradMinBH_;
std::vector<int> iradMaxBH_;
double minTileSize_;
double minTileSize_ = 0.;
std::vector<int> firstModule_;
std::vector<int> lastModule_;
int layerOffset_;
double layerRotation_;
int layerOffset_ = 0;
double layerRotation_ = 0.;
std::vector<int> layerType_;
std::vector<int> layerCenter_;
wafer_map wafersInLayers_;
wafer_map typesInLayers_;
waferT_map waferTypes_;
int waferMaskMode_;
int waferZSide_;
int waferMaskMode_ = 0;
int waferZSide_ = 0;
waferInfo_map waferInfoMap_;
std::vector<std::pair<double, double> > layerRotV_;
tileInfo_map tileInfoMap_;
std::vector<std::pair<double, double> > tileRingR_;
std::vector<std::pair<int, int> > tileRingRange_;
int cassettes_;
int nphiCassette_;
int phiOffset_;
int cassettes_ = 0;
int nphiCassette_ = 0;
int phiOffset_ = 0;
std::vector<double> cassetteShift_;
double calibCellRHD_;
double calibCellRHD_ = 0.;
std::vector<int> calibCellFullHD_;
std::vector<int> calibCellPartHD_;
double calibCellRLD_;
double calibCellRLD_ = 0.;
std::vector<int> calibCellFullLD_;
std::vector<int> calibCellPartLD_;

Expand Down
6 changes: 6 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalGeomParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1618,8 +1618,11 @@ void HGCalGeomParameters::loadSpecParsTrapezoid(const DDFilteredView& fv, HGCalP
php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
rescale(php.rMinLayerBH_, HGCalParameters::k_ScaleFromDDD);
assert(php.nPhiBinBH_.size() > 1);
php.nCellsFine_ = php.nPhiBinBH_[0];
php.nCellsCoarse_ = php.nPhiBinBH_[1];
assert(0 != php.nCellsFine_);
assert(0 != php.nCellsCoarse_);
php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);

Expand Down Expand Up @@ -1707,8 +1710,11 @@ void HGCalGeomParameters::loadSpecParsTrapezoid(const cms::DDFilteredView& fv,
php.layerFrontBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "LayerFrontBH"));
php.rMinLayerBH_ = fv.get<std::vector<double> >(sdTag1, "RMinLayerBH");
rescale(php.rMinLayerBH_, HGCalParameters::k_ScaleFromDD4hep);
assert(php.nPhiBinBH_.size() > 1);
php.nCellsFine_ = php.nPhiBinBH_[0];
php.nCellsCoarse_ = php.nPhiBinBH_[1];
assert(0 != php.nCellsFine_);
assert(0 != php.nCellsCoarse_);
php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);

Expand Down
5 changes: 5 additions & 0 deletions Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv,
php.mouseBite_ = HGCalParameters::k_ScaleFromDDD * getDDDValue("MouseBite", sv2);
php.useOffset_ = static_cast<int>(getDDDValue("UseOffset", sv2));
php.waferR_ = HGCalParameters::k_ScaleToDDD * php.waferSize_ * tan30deg_;
assert(php.nCellsFine_ != 0);
assert(php.nCellsCoarse_ != 0);
php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
#ifdef EDM_ML_DEBUG
Expand Down Expand Up @@ -355,6 +357,8 @@ bool HGCalParametersFromDD::build(const cms::DDCompactView* cpv,
tempD = fv.get<std::vector<double> >(namet, "UseOffset");
php.useOffset_ = static_cast<int>(tempD[0]);
php.waferR_ = HGCalParameters::k_ScaleToDDD * php.waferSize_ * tan30deg_;
assert(php.nCellsFine_ != 0);
assert(php.nCellsCoarse_ != 0);
php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsFine_);
php.cellSize_.emplace_back(HGCalParameters::k_ScaleToDDD * php.waferSize_ / php.nCellsCoarse_);
#ifdef EDM_ML_DEBUG
Expand Down Expand Up @@ -496,6 +500,7 @@ void HGCalParametersFromDD::getCellPosition(HGCalParameters& php, int type) {
std::vector<int> indtypes;
#endif
int N = (type == 1) ? php.nCellsCoarse_ : php.nCellsFine_;
assert(N != 0);
double R = php.waferSize_ / (3 * N);
double r = 0.5 * R * sqrt(3.0);
int n2 = N / 2;
Expand Down