Skip to content

Commit

Permalink
Merge pull request #30184 from bsunanda/Phase2-hgx243
Browse files Browse the repository at this point in the history
Phase2-hgx243 Debug the partial wafer through masking
  • Loading branch information
cmsbuild committed Jun 16, 2020
2 parents 4239ba1 + 4539677 commit e67a62f
Show file tree
Hide file tree
Showing 19 changed files with 428 additions and 111 deletions.
31 changes: 16 additions & 15 deletions Geometry/CaloTopology/src/HGCalTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"
#include "Geometry/CaloTopology/interface/HGCalTopology.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"

Expand Down Expand Up @@ -57,14 +58,14 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
std::vector<DetId> ids;
HGCalTopology::DecodedDetId id = decode(idin);
if ((mode_ == HGCalGeometryMode::Hexagon8) || (mode_ == HGCalGeometryMode::Hexagon8Full)) {
HGCalDDDConstants::CellType celltype = hdcons_.cellType(id.iType, id.iCell1, id.iCell2);
HGCalTypes::CellType celltype = hdcons_.cellType(id.iType, id.iCell1, id.iCell2);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "Type:WaferU:WaferV " << id.iType << ":" << id.iCell1 << ":" << id.iCell2
<< " CellType "
<< static_cast<std::underlying_type<HGCalDDDConstants::CellType>::type>(celltype);
<< static_cast<std::underlying_type<HGCalTypes::CellType>::type>(celltype);
#endif
switch (celltype) {
case (HGCalDDDConstants::CellType::CentralType): {
case (HGCalTypes::CellType::CentralType): {
// cell within the wafer
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "Cell Type 0";
Expand All @@ -77,7 +78,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::BottomLeftEdge): {
case (HGCalTypes::CellType::BottomLeftEdge): {
// bottom left edge
int wu1(id.iSec1), wv1(id.iSec2 - 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -95,7 +96,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::LeftEdge): {
case (HGCalTypes::CellType::LeftEdge): {
// left edege
int wu1(id.iSec1 + 1), wv1(id.iSec2);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -113,7 +114,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::TopLeftEdge): {
case (HGCalTypes::CellType::TopLeftEdge): {
// top left edge
int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -131,7 +132,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::TopRightEdge): {
case (HGCalTypes::CellType::TopRightEdge): {
// top right edge
int wu1(id.iSec1), wv1(id.iSec2 + 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -149,7 +150,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, 0, v1 - N1 + 1);
break;
}
case (HGCalDDDConstants::CellType::RightEdge): {
case (HGCalTypes::CellType::RightEdge): {
// right edge
int wu1(id.iSec1 - 1), wv1(id.iSec2);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -167,7 +168,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, t1, id.iLay, wu1, wv1, u1 - N1 + 1, 0);
break;
}
case (HGCalDDDConstants::CellType::BottomRightEdge): {
case (HGCalTypes::CellType::BottomRightEdge): {
// bottom right edge
int wu1(id.iSec1 - 1), wv1(id.iSec2 - 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -185,7 +186,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::BottomCorner): {
case (HGCalTypes::CellType::BottomCorner): {
// bottom corner
int wu1(id.iSec1), wv1(id.iSec2 - 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -208,7 +209,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::BottomLeftCorner): {
case (HGCalTypes::CellType::BottomLeftCorner): {
// bottom left corner
int wu1(id.iSec1 + 1), wv1(id.iSec2);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -231,7 +232,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::TopLeftCorner): {
case (HGCalTypes::CellType::TopLeftCorner): {
// top left corner
int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -254,7 +255,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, id.iType, id.iLay, id.iSec1, id.iSec2, id.iCell1 + 1, id.iCell2 + 1);
break;
}
case (HGCalDDDConstants::CellType::TopCorner): {
case (HGCalTypes::CellType::TopCorner): {
// top corner
int wu1(id.iSec1 + 1), wv1(id.iSec2 + 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -277,7 +278,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, 0, v2 - N2 + 1);
break;
}
case (HGCalDDDConstants::CellType::TopRightCorner): {
case (HGCalTypes::CellType::TopRightCorner): {
// top right corner
int wu1(id.iSec1), wv1(id.iSec2 + 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand All @@ -300,7 +301,7 @@ std::vector<DetId> HGCalTopology::neighbors(const DetId& idin) const {
addHGCSiliconId(ids, id.det, id.zSide, t2, id.iLay, wu2, wv2, u2 - N2 + 1, 0);
break;
}
case (HGCalDDDConstants::CellType::BottomRightCorner): {
case (HGCalTypes::CellType::BottomRightCorner): {
// bottom right corner
int wu1(id.iSec1 - 1), wv1(id.iSec2 - 1);
int t1 = hdcons_.getTypeHex(id.iLay, wu1, wv1);
Expand Down
5 changes: 3 additions & 2 deletions Geometry/HGCalCommonData/data/hgcalCons/v12/hgcalCons.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../../../DetectorDescription/Schema/DDLSchema.xsd">
<DDDefinition xmlns="http://www.cern.ch/cms/DDL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cern.ch/cms/DDL ../../../../../DetectorDescription/Schema/DDLSchema.xsd">

<ConstantsSection label="hgcalCons.xml" eval="true">
<Constant name="MinimumTileSize" value="10.0*mm"/>
Expand Down Expand Up @@ -86,7 +86,7 @@
<Parameter name="FirstMixedLayer" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerOffset" value="28"/>
<Parameter name="DetectorType" value="2"/>
<Parameter name="WaferMaskMode" value="0"/>
<Parameter name="WaferMaskMode" value="1"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P0]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P1]"/>
<Parameter name="Radius100to200" value="[hgcal:rad100200P2]"/>
Expand Down Expand Up @@ -137,6 +137,7 @@
<Parameter name="FirstMixedLayer" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerOffset" value="28"/>
<Parameter name="DetectorType" value="3"/>
<Parameter name="WaferMaskMode" value="1"/>
<Parameter name="WaferThickness" value="[hgcal:ScintillatorThickness]"/>
<Parameter name="MinimumTileSize" value="[MinimumTileSize]"/>
<Parameter name="NPhiBinBH" value="360"/>
Expand Down
24 changes: 5 additions & 19 deletions Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "DataFormats/DetId/interface/DetId.h"
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
#include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"

#include <unordered_map>

Expand All @@ -24,23 +25,6 @@ class HGCalDDDConstants {
HGCalDDDConstants(const HGCalParameters* hp, const std::string& name);
~HGCalDDDConstants();

enum class CellType {
UndefinedType = -1,
CentralType = 0,
BottomLeftEdge = 1,
LeftEdge = 2,
TopLeftEdge = 3,
TopRightEdge = 4,
RightEdge = 5,
BottomRightEdge = 6,
BottomCorner = 11,
BottomLeftCorner = 12,
TopLeftCorner = 13,
TopCorner = 14,
TopRightCorner = 15,
BottomRightCorner = 16
};

std::pair<int, int> assignCell(float x, float y, int lay, int subSec, bool reco) const;
std::array<int, 5> assignCellHex(float x, float y, int lay, bool reco) const;
std::array<int, 3> assignCellTrap(float x, float y, float z, int lay, bool reco) const;
Expand All @@ -51,7 +35,7 @@ class HGCalDDDConstants {
return std::make_pair(hgpar_->radiusLayer_[type][irad - 1], hgpar_->radiusLayer_[type][irad]);
}
double cellThickness(int layer, int waferU, int waferV) const;
CellType cellType(int type, int waferU, int waferV) const;
HGCalTypes::CellType cellType(int type, int waferU, int waferV) const;
double distFromEdgeHex(double x, double y, double z) const;
double distFromEdgeTrap(double x, double y, double z) const;
void etaPhiFromPosition(const double x,
Expand Down Expand Up @@ -113,6 +97,7 @@ class HGCalDDDConstants {
int numberCellsHexagon(int wafer) const;
int numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const;
std::pair<double, double> rangeR(double z, bool reco) const;
std::pair<double, double> rangeRLayer(int lay, bool reco) const;
std::pair<double, double> rangeZ(bool reco) const;
std::pair<int, int> rowColumnWafer(const int wafer) const;
int sectors() const { return hgpar_->nSectors_; }
Expand All @@ -135,6 +120,7 @@ class HGCalDDDConstants {
int waferCount(const int type) const { return ((type == 0) ? waferMax_[2] : waferMax_[3]); }
int waferMax() const { return waferMax_[1]; }
int waferMin() const { return waferMax_[0]; }
std::pair<double, double> waferParameters(bool reco) const;
std::pair<double, double> waferPosition(int wafer, bool reco) const;
std::pair<double, double> waferPosition(int lay, int waferU, int waferV, bool reco, bool debug = false) const;
double waferSepar(bool reco) const {
Expand All @@ -159,7 +145,7 @@ class HGCalDDDConstants {
}
int waferType(DetId const& id) const;
int waferType(int layer, int waferU, int waferV) const;
std::pair<int, int> waferTypeRotation(int layer, int waferU, int waferV) const;
std::pair<int, int> waferTypeRotation(int layer, int waferU, int waferV, bool debug = false) const;
int waferUVMax() const { return hgpar_->waferUVMax_; }
bool waferVirtual(int layer, int waferU, int waferV) const;
double waferZ(int layer, bool reco) const;
Expand Down
1 change: 1 addition & 0 deletions Geometry/HGCalCommonData/interface/HGCalGeomParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class HGCalGeomParameters {
void rescale(std::vector<double>&, const double s);
void resetZero(std::vector<double>&);

constexpr static double tan30deg_ = 0.5773502693;
HGCalGeomTools geomTools_;
const double sqrt3_;
double waferSize_;
Expand Down
17 changes: 17 additions & 0 deletions Geometry/HGCalCommonData/interface/HGCalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ class HGCalTypes {
public:
HGCalTypes() {}

enum class CellType {
UndefinedType = -1,
CentralType = 0,
BottomLeftEdge = 1,
LeftEdge = 2,
TopLeftEdge = 3,
TopRightEdge = 4,
RightEdge = 5,
BottomRightEdge = 6,
BottomCorner = 11,
BottomLeftCorner = 12,
TopLeftCorner = 13,
TopCorner = 14,
TopRightCorner = 15,
BottomRightCorner = 16
};

enum WaferCorner {
WaferCorner0 = 0,
WaferCorner1 = 1,
Expand Down
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/interface/HGCalWaferMask.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class HGCalWaferMask {
const double& rin,
const double& rout,
const int& waferType,
const int& mode);
const int& mode,
bool deug = false);
static const int k_OffsetRotation = 10;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ HGCalNumberingInitialization::~HGCalNumberingInitialization() {}

// ------------ method called to produce the data ------------
HGCalNumberingInitialization::ReturnType HGCalNumberingInitialization::produce(const IdealGeometryRecord& iRecord) {
edm::LogVerbatim("HGCalGeom") << "in HGCalNumberingInitialization::produce";
edm::LogVerbatim("HGCalGeom") << "in HGCalNumberingInitialization::produce for " << name_;
const auto& pHGpar = iRecord.get(hgParToken_);
return std::make_unique<HGCalDDDConstants>(&pHGpar, name_);
}
Expand Down
Loading

0 comments on commit e67a62f

Please sign in to comment.