Skip to content

Commit

Permalink
Merge pull request #33379 from bsunanda/Phase2-hgx281
Browse files Browse the repository at this point in the history
Phase2-hgx281 Compare DDD against DD4Hep scenario for 2026D76 scenario
  • Loading branch information
cmsbuild authored Apr 11, 2021
2 parents cd2c682 + 36c916f commit 887ebbf
Show file tree
Hide file tree
Showing 13 changed files with 633 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<DDDefinition>
<debug>
<!--
<debug_shapes/>
<debug_includes/>
<debug_rotations/>
<debug_includes/>
<debug_volumes/>
<debug_constants/>
<debug_namespaces/>
<debug_placements/>
<debug_algorithms/>
<debug_materials/>
<debug_visattr/>
-->
</debug>

<open_geometry/>
<close_geometry/>

<IncludeSection>
<Include ref="Geometry/CMSCommonData/data/materials/2021/v1/materials.xml"/>
<Include ref="Geometry/CMSCommonData/data/rotations.xml"/>
<Include ref="Geometry/HGCalCommonData/test/cms.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcal.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml"/>
<Include ref="Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalpos.xml"/>
</IncludeSection>

</DDDefinition>

25 changes: 6 additions & 19 deletions Geometry/HGCalCommonData/plugins/DDHGCalCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
class DDHGCalCell : public DDAlgorithm {
public:
// Constructor and Destructor
DDHGCalCell();
~DDHGCalCell() override;
DDHGCalCell() {}

void initialize(const DDNumericArguments& nArgs,
const DDVectorArguments& vArgs,
Expand All @@ -42,14 +41,6 @@ class DDHGCalCell : public DDAlgorithm {
std::string nameSpace_; // Namespace to be used
};

DDHGCalCell::DDHGCalCell() {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Creating an instance";
#endif
}

DDHGCalCell::~DDHGCalCell() {}

void DDHGCalCell::initialize(const DDNumericArguments& nArgs,
const DDVectorArguments&,
const DDMapArguments&,
Expand Down Expand Up @@ -84,7 +75,7 @@ void DDHGCalCell::initialize(const DDNumericArguments& nArgs,
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << waferSize_ << " T " << waferT_ << " Cell T " << cellT_
<< " Cells/Wafer " << nCells_ << " Material " << material_ << "Sensitive Position "
<< posSens_ << " NameSpace " << nameSpace_ << " Full Cell: " << fullCN_ << ":"
<< posSens_ << " NameSpace " << nameSpace_ << ": Full Cell: " << fullCN_ << ":"
<< fullSensN_;
for (unsigned int k = 0; k < truncCN_.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN_[k] << ":"
Expand All @@ -97,14 +88,10 @@ void DDHGCalCell::initialize(const DDNumericArguments& nArgs,
}

void DDHGCalCell::execute(DDCompactView& cpv) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalCell...";
#endif

DDName matName(DDSplit(material_).first, DDSplit(material_).second);
DDMaterial matter(matName);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized at " << &matter;
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << matName << " initialized";
#endif
DDLogicalPart glog1, glog2;

Expand Down Expand Up @@ -187,7 +174,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) {
cpv.position(glog2, glog1, 1, tran, rot);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at " << tran << " with " << rot;
<< " at " << tran << " with no rotation";
#endif
}

Expand Down Expand Up @@ -222,7 +209,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) {
cpv.position(glog2, glog1, 1, tran, rot);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at " << tran << " with " << rot;
<< " at " << tran << " with no rotation";
#endif
}

Expand Down Expand Up @@ -257,7 +244,7 @@ void DDHGCalCell::execute(DDCompactView& cpv) {
cpv.position(glog2, glog1, 1, tran, rot);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at " << tran << " with " << rot;
<< " at " << tran << " with no rotation";
#endif
}
}
Expand Down
13 changes: 5 additions & 8 deletions Geometry/HGCalCommonData/plugins/DDHGCalEEFileAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void DDHGCalEEFileAlgo::initialize(const DDNumericArguments& nArgs,
#endif
nameSpace_ = DDCurrentNamespace::ns();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: NameSpace " << nameSpace_;
edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: NameSpace " << nameSpace_ << ":";
#endif
}

Expand All @@ -220,9 +220,6 @@ void DDHGCalEEFileAlgo::execute(DDCompactView& cpv) {
}

void DDHGCalEEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactView& cpv) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: \t\tInside Layers";
#endif
double zi(zMinBlock_);
int laymin(0);
for (unsigned int i = 0; i < layers_.size(); i++) {
Expand Down Expand Up @@ -289,10 +286,10 @@ void DDHGCalEEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactVi
DDSolid solid = DDSolidFactory::tubs(DDName(name, nameSpace_), hthick, rins, routs, 0.0, 2._pi);
glog = DDLogicalPart(solid.ddname(), matter, solid);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: " << solid.name() << " Tubs made of " << matName << ":"
<< &matter << " of dimensions " << rinB << ":" << rins << ", " << routF << ":"
<< routs << ", " << hthick << ", 0.0, 360.0 and position " << glog.name()
<< " number " << copy << ":" << layerCenter_[copy - firstLayer_];
edm::LogVerbatim("HGCalGeom") << "DDHGCalEEFileAlgo: " << solid.name() << " Tubs made of " << matName
<< " of dimensions " << rinB << ":" << rins << ", " << routF << ":" << routs
<< ", " << hthick << ", 0.0, 360.0 and position " << glog.name() << " number "
<< copy << ":" << layerCenter_[copy - firstLayer_];
#endif
positionSensitive(glog, rins, routs, zz, layerSense_[ly], (copy - firstLayer_), cpv);
}
Expand Down
5 changes: 1 addition & 4 deletions Geometry/HGCalCommonData/plugins/DDHGCalHEFileAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void DDHGCalHEFileAlgo::initialize(const DDNumericArguments& nArgs,
#endif
nameSpace_ = DDCurrentNamespace::ns();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << nameSpace_;
edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: NameSpace " << nameSpace_ << ":";
#endif
}

Expand All @@ -274,9 +274,6 @@ void DDHGCalHEFileAlgo::execute(DDCompactView& cpv) {
}

void DDHGCalHEFileAlgo::constructLayers(const DDLogicalPart& module, DDCompactView& cpv) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: \t\tInside Layers";
#endif
double zi(zMinBlock_);
int laymin(0);
for (unsigned int i = 0; i < layers_.size(); i++) {
Expand Down
31 changes: 11 additions & 20 deletions Geometry/HGCalCommonData/plugins/DDHGCalWafer8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
class DDHGCalWafer8 : public DDAlgorithm {
public:
// Constructor and Destructor
DDHGCalWafer8();
~DDHGCalWafer8() override;
DDHGCalWafer8() {}

void initialize(const DDNumericArguments& nArgs,
const DDVectorArguments& vArgs,
Expand All @@ -33,22 +32,13 @@ class DDHGCalWafer8 : public DDAlgorithm {
double waferSize_; // Wafer size
double waferT_; // Wafer thickness
double waferSepar_; // Sensor separation
double mouseBite_; // MouseBite radius
int nCells_; // Half number of cells along u-v axis
int cellType_; // Cell Type (0,1,2: Fine, Course 2/3)
std::string material_; // Material name for module with gap
std::vector<std::string> cellNames_; // Name of the cells
std::string nameSpace_; // Namespace to be used
};

DDHGCalWafer8::DDHGCalWafer8() {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Creating an instance";
#endif
}

DDHGCalWafer8::~DDHGCalWafer8() {}

void DDHGCalWafer8::initialize(const DDNumericArguments& nArgs,
const DDVectorArguments&,
const DDMapArguments&,
Expand All @@ -57,28 +47,22 @@ void DDHGCalWafer8::initialize(const DDNumericArguments& nArgs,
waferSize_ = nArgs["WaferSize"];
waferT_ = nArgs["WaferThick"];
waferSepar_ = nArgs["SensorSeparation"];
mouseBite_ = nArgs["MouseBite"];
nCells_ = (int)(nArgs["NCells"]);
cellType_ = (int)(nArgs["CellType"]);
material_ = sArgs["Material"];
cellNames_ = vsArgs["CellNames"];
nameSpace_ = DDCurrentNamespace::ns();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Wafer 2r " << waferSize_ << " T " << waferT_ << " Half Separation "
<< waferSepar_ << " Mouse bite radius " << mouseBite_ << " Cells/Wafer " << nCells_
<< " Cell Type " << cellType_ << " Material " << material_ << " Names "
<< parent().name() << " NameSpace " << nameSpace_ << " # of cells "
<< cellNames_.size();
<< waferSepar_ << " Cells/Wafer " << nCells_ << " Cell Type " << cellType_
<< " Material " << material_ << " Names " << parent().name() << " NameSpace "
<< nameSpace_ << ": # of cells " << cellNames_.size();
for (unsigned int k = 0; k < cellNames_.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalWafer8: Cell[" << k << "] " << cellNames_[k];
#endif
}

void DDHGCalWafer8::execute(DDCompactView& cpv) {
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "==>> Executing DDHGCalWafer8...";
#endif

static const double sqrt3 = std::sqrt(3.0);
double rM = 0.5 * (waferSize_ + waferSepar_);
double RM2 = rM / sqrt3;
Expand All @@ -102,12 +86,16 @@ void DDHGCalWafer8::execute(DDCompactView& cpv) {
<< " and " << xM.size() << " edges";
for (unsigned int k = 0; k < xM.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
int counter(0);
#endif

DDRotation rot;
for (int u = 0; u < 2 * nCells_; ++u) {
for (int v = 0; v < 2 * nCells_; ++v) {
if (((v - u) < nCells_) && (u - v) <= nCells_) {
#ifdef EDM_ML_DEBUG
counter++;
#endif
int n2 = nCells_ / 2;
double yp = (u - 0.5 * v - n2) * 2 * r;
double xp = (1.5 * (v - nCells_) + 1.0) * R;
Expand Down Expand Up @@ -146,6 +134,9 @@ void DDHGCalWafer8::execute(DDCompactView& cpv) {
}
}
}
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "\nDDHGCalWafer8::Counter : " << counter << "\n===============================\n";
#endif
}

DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDHGCalWafer8, "hgcal:DDHGCalWafer8");
18 changes: 8 additions & 10 deletions Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,18 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Wafer r " << cms::convert2mm(waferSize) << " T "
<< cms::convert2mm(waferT) << " Cell T " << cms::convert2mm(cellT) << " Cells/Wafer "
<< nCells << " Material " << material << "Sensitive Position " << posSens
<< " Full Cell: " << fullCN << ":" << fullSensN;
<< " NameSpace " << ns.name() << " Full Cell: " << fullCN << ":" << fullSensN;
for (int k = 0; k < 3; ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Truncated Cell[" << k << "] " << truncCN[k] << ":" << truncSensN[k];
for (int k = 0; k < 3; ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Extended Cell[" << k << "] " << extenCN[k] << ":" << extenSensN[k];
for (int k = 0; k < 6; ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: Corner Cell[" << k << "] " << cornrCN[k] << ":" << cornrSensN[k];
edm::LogVerbatim("HGCalGeom") << "Name space " << ns.name();
#endif

dd4hep::Material matter = ns.material(material);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << material << " initialized at " << &matter;
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << material << " initialized";
#endif
dd4hep::Volume glog1, glog2;

Expand Down Expand Up @@ -119,8 +118,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]);
#endif

dd4hep::Rotation3D rotation;
glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
glog1.placeVolume(glog2, 1, tran);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
Expand Down Expand Up @@ -162,7 +160,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
for (unsigned int k = 0; k < xw.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]);
#endif
glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
glog1.placeVolume(glog2, 1, tran);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
Expand Down Expand Up @@ -203,10 +201,10 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
for (unsigned int k = 0; k < xw.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]);
#endif
glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
glog1.placeVolume(glog2, 1, tran);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at (0,0," << cms::convert2mm(zpos) << " with no rotation";
<< " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
#endif
}

Expand Down Expand Up @@ -244,10 +242,10 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext
for (unsigned int k = 0; k < xw.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << cms::convert2mm(xw[k]) << ":" << cms::convert2mm(yw[k]);
#endif
glog1.placeVolume(glog2, 1, dd4hep::Transform3D(rotation, tran));
glog1.placeVolume(glog2, 1, tran);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalCell: " << glog2.name() << " number 1 position in " << glog1.name()
<< " at (0,0," << cms::convert2mm(zpos) << " with no rotation";
<< " at (0,0," << cms::convert2mm(zpos) << ") with no rotation";
#endif
}
return cms::s_executed;
Expand Down
16 changes: 8 additions & 8 deletions Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalHEFileAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,9 @@ struct HGCalHEFileAlgo {
#ifdef EDM_ML_DEBUG
int ium(0), ivm(0), iumAll(0), ivmAll(0), kount(0), ntot(0), nin(0);
std::vector<int> ntype(6, 0);
edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " rout " << cms::convert2mm(rout) << " N "
<< N << " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":"
edm::LogVerbatim("HGCalGeom") << "DDHGCalHEFileAlgo: " << glog.name() << " rin:rout " << cms::convert2mm(rin) << ":"
<< cms::convert2mm(rout) << " zpos " << cms::convert2mm(zpos) << " N " << N
<< " for maximum u, v Offset; Shift " << cms::convert2mm(xyoff.first) << ":"
<< cms::convert2mm(xyoff.second) << " WaferSize "
<< cms::convert2mm((waferSize_ + waferSepar_));
#endif
Expand All @@ -506,6 +507,8 @@ struct HGCalHEFileAlgo {
int type = HGCalWaferType::getType(indx, waferIndex_, waferProperty_);
if (corner.first > 0 && type >= 0) {
int copy = HGCalTypes::packTypeUV(type, u, v);
if (layertype > 1)
type += 3;
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << " DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type "
<< type << " layer:u:v:indx " << (layer + firstLayer_) << ":" << u << ":" << v
Expand All @@ -526,17 +529,14 @@ struct HGCalHEFileAlgo {
ivmAll = iv;
++nin;
#endif

dd4hep::Position tran(xpos, ypos, 0.0);
if (layertype > 1)
type += 3;
glog.placeVolume(ns.volume(waferNames_[type]), copy, tran);

#ifdef EDM_ML_DEBUG
++ntype[type];
edm::LogVerbatim("HGCalGeom")
<< "DDHGCalHEFileAlgo: " << glog.name() << " number " << copy << " positioned in " << glog.name()
<< " at (" << cms::convert2mm(xpos) << ", " << cms::convert2mm(ypos) << ", 0) with no rotation";
<< "DDHGCalHEFileAlgo: " << waferNames_[type] << " number " << copy << " type " << layertype << ":"
<< type << " positioned in " << glog.name() << " at (" << cms::convert2mm(xpos) << ", "
<< cms::convert2mm(ypos) << ", 0) with no rotation";
#endif
}
}
Expand Down
9 changes: 5 additions & 4 deletions Geometry/HGCalCommonData/python/testHGCalWafer8XML_cfi.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import FWCore.ParameterSet.Config as cms

XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
geomXMLFiles = cms.vstring(
'Geometry/CMSCommonData/data/materials/2021/v1/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/HGCalCommonData/test/cms.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcal.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalpos.xml',
'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml',
'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml'),
rootNodeName = cms.string('cms:OCMS')
'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalpos.xml'),
rootNodeName = cms.string('cms:OCMS')
)


4 changes: 4 additions & 0 deletions Geometry/HGCalCommonData/test/cms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<rSolid name="OCMS"/>
<rMaterial name="materials:Air"/>
</LogicalPart>
<LogicalPart name="MCMS" category="unspecified">
<rSolid name="OCMS"/>
<rMaterial name="materials:Air"/>
</LogicalPart>
<LogicalPart name="CMSE" category="unspecified">
<rSolid name="CMSE"/>
<rMaterial name="materials:Air"/>
Expand Down
Loading

0 comments on commit 887ebbf

Please sign in to comment.