Skip to content

Commit

Permalink
Merge pull request #37956 from bsunanda/Phase2-hgx312E
Browse files Browse the repository at this point in the history
Phase2-hgx312E Change names of variabes to enable easy reading of the code for creation of HGCal geometry
  • Loading branch information
cmsbuild authored May 17, 2022
2 parents 6bd45e5 + 0f61527 commit 5bc18d0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
28 changes: 14 additions & 14 deletions Geometry/HGCalCommonData/plugins/DDHGCalMixRotatedLayer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DDHGCalMixRotatedLayer : public DDAlgorithm {
std::vector<double> layerThickTop_; // Thickness of the top sections
std::vector<int> layerTypeTop_; // Type of the Top layer
std::vector<int> copyNumberTop_; // Initial copy numbers (top section)
std::vector<int> layerTypes_; // Layer type of silicon layers
std::vector<int> layerOrient_; // Layer orientation for the silicon component
std::vector<int> waferIndex_; // Wafer index for the types
std::vector<int> waferProperty_; // Wafer property
std::vector<int> waferLayerStart_; // Start index of wafers in each layer
Expand Down Expand Up @@ -208,10 +208,10 @@ void DDHGCalMixRotatedLayer::initialize(const DDNumericArguments& nArgs,
#endif
layerType_ = dbl_to_int(vArgs["LayerType"]);
layerSense_ = dbl_to_int(vArgs["LayerSense"]);
layerTypes_ = dbl_to_int(vArgs["LayerTypes"]);
layerOrient_ = dbl_to_int(vArgs["LayerTypes"]);
#ifdef EDM_ML_DEBUG
for (unsigned int i = 0; i < layerTypes_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerTypes_[i];
for (unsigned int i = 0; i < layerOrient_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerOrient_[i];
#endif
if (firstLayer_ > 0) {
for (unsigned int i = 0; i < layerType_.size(); ++i) {
Expand Down Expand Up @@ -506,23 +506,23 @@ void DDHGCalMixRotatedLayer::positionMix(const DDLogicalPart& glog,
// Make the bottom part next
int layer = (copyM - firstLayer_);
static const double sqrt3 = std::sqrt(3.0);
int layercenter = (layerTypes_[layer] == HGCalTypes::CornerCenteredLambda)
int layercenter = (layerOrient_[layer] == HGCalTypes::CornerCenteredLambda)
? HGCalTypes::CornerCenterYp
: ((layerTypes_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerTypes_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
: ((layerOrient_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
int firstWafer = waferLayerStart_[layer];
int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
: static_cast<int>(waferIndex_.size()));
double r = 0.5 * (waferSize_ + waferSepar_);
double R = 2.0 * r / sqrt3;
double dy = 0.75 * R;
double delx = 0.5 * (waferSize_ + waferSepar_);
double dely = 2.0 * delx / sqrt3;
double dy = 0.75 * dely;
const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
#ifdef EDM_ML_DEBUG
int ium(0), ivm(0), kount(0);
std::vector<int> ntype(3, 0);
edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedLayer: " << glog.ddname() << " r " << r << " R " << R << " dy "
<< dy << " Shift " << xyoff.first << ":" << xyoff.second << " WaferSize "
edm::LogVerbatim("HGCalGeom") << "DDHGCalMixRotatedLayer: " << glog.ddname() << " r " << delx << " R " << dely
<< " dy " << dy << " Shift " << xyoff.first << ":" << xyoff.second << " WaferSize "
<< (waferSize_ + waferSepar_) << " index " << firstWafer << ":" << (lastWafer - 1);
#endif
for (int k = firstWafer; k < lastWafer; ++k) {
Expand All @@ -545,7 +545,7 @@ void DDHGCalMixRotatedLayer::positionMix(const DDLogicalPart& glog,
<< ":" << cassette << ":" << place;
#endif
auto cshift = cassette_.getShift(layer + 1, 1, cassette);
double xpos = xyoff.first + cshift.first + nc * r;
double xpos = xyoff.first + cshift.first + nc * delx;
double ypos = xyoff.second + cshift.second + nr * dy;
std::string wafer;
int i(999);
Expand Down
30 changes: 15 additions & 15 deletions Geometry/HGCalCommonData/plugins/DDHGCalSiliconRotatedModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class DDHGCalSiliconRotatedModule : public DDAlgorithm {
std::vector<double> slopeT_; // Slopes at the larger R
std::vector<double> zFrontT_; // Starting Z values for the slopes
std::vector<double> rMaxFront_; // Corresponding rMax's
std::vector<int> layerTypes_; // Layer type (Centering, rotations..)
std::vector<int> layerOrient_; // Layer orientation (Centering, rotations..)
std::vector<int> waferIndex_; // Wafer index for the types
std::vector<int> waferProperty_; // Wafer property
std::vector<int> waferLayerStart_; // Index of wafers in each layer
Expand Down Expand Up @@ -179,10 +179,10 @@ void DDHGCalSiliconRotatedModule::initialize(const DDNumericArguments& nArgs,
#endif
layerType_ = dbl_to_int(vArgs["LayerType"]);
layerSense_ = dbl_to_int(vArgs["LayerSense"]);
layerTypes_ = dbl_to_int(vArgs["LayerTypes"]);
layerOrient_ = dbl_to_int(vArgs["LayerTypes"]);
#ifdef EDM_ML_DEBUG
for (unsigned int i = 0; i < layerTypes_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerTypes_[i];
for (unsigned int i = 0; i < layerOrient_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerOrient_[i];
#endif
if (firstLayer_ > 0) {
for (unsigned int i = 0; i < layerType_.size(); ++i) {
Expand Down Expand Up @@ -347,7 +347,7 @@ void DDHGCalSiliconRotatedModule::constructLayers(const DDLogicalPart& module, D
edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << solid.name() << " Tubs made of " << matName
<< " of dimensions " << rinB << ":" << rins << ", " << routF << ":" << routs
<< ", " << hthick << ", 0.0, 360.0 and position " << glog.name() << " number "
<< copy << ":" << layerTypes_[copy - firstLayer_];
<< copy << ":" << layerOrient_[copy - firstLayer_];
#endif
positionSensitive(glog, (copy - firstLayer_), cpv);
}
Expand All @@ -356,7 +356,7 @@ void DDHGCalSiliconRotatedModule::constructLayers(const DDLogicalPart& module, D
#ifdef EDM_ML_DEBUG
std::string rotName("Null");
#endif
if ((layerSense_[ly] > 0) && (layerTypes_[copy - firstLayer_] == HGCalTypes::WaferCenteredRotated)) {
if ((layerSense_[ly] > 0) && (layerOrient_[copy - firstLayer_] == HGCalTypes::WaferCenteredRotated)) {
rot = DDRotation(DDName(DDSplit(rotstr_).first, DDSplit(rotstr_).second));
#ifdef EDM_ML_DEBUG
rotName = rotstr_;
Expand Down Expand Up @@ -389,22 +389,22 @@ void DDHGCalSiliconRotatedModule::constructLayers(const DDLogicalPart& module, D

void DDHGCalSiliconRotatedModule::positionSensitive(const DDLogicalPart& glog, int layer, DDCompactView& cpv) {
static const double sqrt3 = std::sqrt(3.0);
int layercenter = (layerTypes_[layer] == HGCalTypes::CornerCenteredLambda)
int layercenter = (layerOrient_[layer] == HGCalTypes::CornerCenteredLambda)
? HGCalTypes::CornerCenterYp
: ((layerTypes_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerTypes_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
: ((layerOrient_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
int firstWafer = waferLayerStart_[layer];
int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
: static_cast<int>(waferIndex_.size()));
double r = 0.5 * (waferSize_ + waferSepar_);
double R = 2.0 * r / sqrt3;
double dy = 0.75 * R;
double delx = 0.5 * (waferSize_ + waferSepar_);
double dely = 2.0 * delx / sqrt3;
double dy = 0.75 * dely;
const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
#ifdef EDM_ML_DEBUG
int ium(0), ivm(0), kount(0);
std::vector<int> ntype(3, 0);
edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.ddname() << " r " << r << " R " << R
edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.ddname() << " r " << delx << " R " << dely
<< " dy " << dy << " Shift " << xyoff.first << ":" << xyoff.second << " WaferSize "
<< (waferSize_ + waferSepar_) << " index " << firstWafer << ":" << (lastWafer - 1);
#endif
Expand All @@ -423,7 +423,7 @@ void DDHGCalSiliconRotatedModule::positionSensitive(const DDLogicalPart& glog, i
int cassette = HGCalProperty::waferCassette(waferProperty_[k]);
int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
auto cshift = cassette_.getShift(layer, 1, cassette);
double xpos = xyoff.first + cshift.first + nc * r;
double xpos = xyoff.first + cshift.first + nc * delx;
double ypos = xyoff.second + cshift.second + nr * dy;
std::string wafer;
int i(999);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ struct HGCalSiliconRotatedModule {
#endif
layerType_ = args.value<std::vector<int>>("LayerType");
layerSense_ = args.value<std::vector<int>>("LayerSense");
layerTypes_ = args.value<std::vector<int>>("LayerTypes");
layerOrient_ = args.value<std::vector<int>>("LayerTypes");
#ifdef EDM_ML_DEBUG
for (unsigned int i = 0; i < layerTypes_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerTypes_[i];
for (unsigned int i = 0; i < layerOrient_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "LayerTypes [" << i << "] " << layerOrient_[i];
#endif
if (firstLayer_ > 0) {
for (unsigned int i = 0; i < layerType_.size(); ++i) {
Expand Down Expand Up @@ -269,7 +269,7 @@ struct HGCalSiliconRotatedModule {
<< cms::convert2mm(rins) << ", " << cms::convert2mm(routF) << ":"
<< cms::convert2mm(routs) << ", " << cms::convert2mm(hthick)
<< ", 0.0, 360.0 and position " << glog.name() << " number " << copy << ":"
<< layerTypes_[copy - firstLayer_];
<< layerOrient_[copy - firstLayer_];
#endif
positionSensitive(ctxt, e, glog, (copy - firstLayer_));
}
Expand All @@ -279,7 +279,7 @@ struct HGCalSiliconRotatedModule {
#ifdef EDM_ML_DEBUG
std::string rotName("Null");
#endif
if ((layerSense_[ly] > 0) && (layerTypes_[copy - firstLayer_] == HGCalTypes::WaferCenteredRotated)) {
if ((layerSense_[ly] > 0) && (layerOrient_[copy - firstLayer_] == HGCalTypes::WaferCenteredRotated)) {
rot = ns.rotation(rotstr_);
#ifdef EDM_ML_DEBUG
rotName = rotstr_;
Expand Down Expand Up @@ -325,23 +325,23 @@ struct HGCalSiliconRotatedModule {
void positionSensitive(cms::DDParsingContext& ctxt, xml_h e, const dd4hep::Volume& glog, int layer) {
cms::DDNamespace ns(ctxt, e, true);
static const double sqrt3 = std::sqrt(3.0);
int layercenter = (layerTypes_[layer] == HGCalTypes::CornerCenteredLambda)
int layercenter = (layerOrient_[layer] == HGCalTypes::CornerCenteredLambda)
? HGCalTypes::CornerCenterYp
: ((layerTypes_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerTypes_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
: ((layerOrient_[layer] == HGCalTypes::CornerCenteredY) ? HGCalTypes::CornerCenterYm
: HGCalTypes::WaferCenter);
int layertype = (layerOrient_[layer] == HGCalTypes::WaferCenteredBack) ? 1 : 0;
int firstWafer = waferLayerStart_[layer];
int lastWafer = ((layer + 1 < static_cast<int>(waferLayerStart_.size())) ? waferLayerStart_[layer + 1]
: static_cast<int>(waferIndex_.size()));
double r = 0.5 * (waferSize_ + waferSepar_);
double R = 2.0 * r / sqrt3;
double dy = 0.75 * R;
double delx = 0.5 * (waferSize_ + waferSepar_);
double dely = 2.0 * delx / sqrt3;
double dy = 0.75 * dely;
const auto& xyoff = geomTools_.shiftXY(layercenter, (waferSize_ + waferSepar_));
#ifdef EDM_ML_DEBUG
int ium(0), ivm(0), kount(0);
std::vector<int> ntype(3, 0);
edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.name() << " r " << cms::convert2mm(r)
<< " R " << cms::convert2mm(R) << " dy " << cms::convert2mm(dy) << " Shift "
edm::LogVerbatim("HGCalGeom") << "DDHGCalSiliconRotatedModule: " << glog.name() << " r " << cms::convert2mm(delx)
<< " R " << cms::convert2mm(dely) << " dy " << cms::convert2mm(dy) << " Shift "
<< cms::convert2mm(xyoff.first) << ":" << cms::convert2mm(xyoff.second)
<< " WaferSize " << cms::convert2mm((waferSize_ + waferSepar_)) << " index "
<< firstWafer << ":" << (lastWafer - 1);
Expand All @@ -361,7 +361,7 @@ struct HGCalSiliconRotatedModule {
int cassette = HGCalProperty::waferCassette(waferProperty_[k]);
int place = HGCalCell::cellPlacementIndex(1, layertype, orien);
auto cshift = cassette_.getShift(layer, 1, cassette);
double xpos = xyoff.first + cshift.first + nc * r;
double xpos = xyoff.first + cshift.first + nc * delx;
double ypos = xyoff.second + cshift.second + nr * dy;
std::string wafer;
int i(999);
Expand Down Expand Up @@ -445,7 +445,7 @@ struct HGCalSiliconRotatedModule {
std::vector<double> slopeT_; // Slopes at the larger R
std::vector<double> zFrontT_; // Starting Z values for the slopes
std::vector<double> rMaxFront_; // Corresponding rMax's
std::vector<int> layerTypes_; // Layer type (Centering, rotations..)
std::vector<int> layerOrient_; // Layer orientation (Centering, rotations..)
std::vector<int> waferIndex_; // Wafer index for the types
std::vector<int> waferProperty_; // Wafer property
std::vector<int> waferLayerStart_; // Index of wafers in each layer
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
#include "Geometry/HGCalCommonData/interface/HGCalParameters.h"

#define EDM_ML_DEBUG
//#define EDM_ML_DEBUG
using namespace geant_units::operators;

namespace {
Expand Down

0 comments on commit 5bc18d0

Please sign in to comment.