Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunanda committed Jul 2, 2020
1 parent 919249a commit 6f7800d
Show file tree
Hide file tree
Showing 30 changed files with 925 additions and 324 deletions.
2 changes: 2 additions & 0 deletions Geometry/CaloTopology/interface/HGCalTopology.h
Expand Up @@ -85,7 +85,9 @@ class HGCalTopology : public CaloSubdetectorTopology {

///Is this a valid cell id
bool valid(const DetId& id) const override;
bool valid(const DetId& id, int cornerMin) const;
bool validHashIndex(uint32_t ix) const { return (ix < kSizeForDenseIndexing); }
bool validModule(const DetId& id, int cornerMin) const;

unsigned int totalModules() const { return kSizeForDenseIndexing; }
unsigned int totalGeomModules() const { return (unsigned int)(2 * kHGeomHalf_); }
Expand Down
55 changes: 40 additions & 15 deletions Geometry/CaloTopology/src/HGCalTopology.cc
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 Expand Up @@ -476,6 +477,30 @@ bool HGCalTopology::valid(const DetId& idin) const {
return flag;
}

bool HGCalTopology::valid(const DetId& idin, int cornerMin) const {
if ((mode_ == HGCalGeometryMode::Hexagon8) || (mode_ == HGCalGeometryMode::Hexagon8Full)) {
HGCalTopology::DecodedDetId id = decode(idin);
bool mask = (cornerMin < HGCalTypes::WaferCornerMin) ? false : hdcons_.maskCell(idin, cornerMin);
bool flag = ((idin.det() == det_) &&
hdcons_.isValidHex8(
id.iLay, id.iSec1, id.iSec2, id.iCell1, id.iCell2, (cornerMin >= HGCalTypes::WaferCornerMin)));
return (flag && (!mask));
} else {
return valid(idin);
}
}

bool HGCalTopology::validModule(const DetId& idin, int cornerMin) const {
if (idin.det() != det_) {
return false;
} else if ((idin.det() == DetId::HGCalEE) || (idin.det() == DetId::HGCalHSi)) {
HGCalTopology::DecodedDetId id = decode(idin);
return hdcons_.isValidHex8(id.iLay, id.iSec1, id.iSec2, (cornerMin >= HGCalTypes::WaferCornerMin));
} else {
return valid(idin);
}
}

DetId HGCalTopology::offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const {
if (startId.det() == DetId::Forward && startId.subdetId() == (int)(subdet_)) {
DetId id = changeXY(startId, nrStepsX, nrStepsY);
Expand Down
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/data/hgcalCons/v10/hgcalCons.xml
@@ -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 @@ -137,6 +137,7 @@
<Parameter name="FirstMixedLayer" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerOffset" value="28"/>
<Parameter name="DetectorType" value="3"/>
<Parameter name="WaferMaskMode" value="0"/>
<Parameter name="WaferThickness" value="[hgcal:ScintillatorThickness]"/>
<Parameter name="MinimumTileSize" value="[MinimumTileSize]"/>
<Parameter name="NPhiBinBH" value="360"/>
Expand Down
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/data/hgcalCons/v11/hgcalCons.xml
@@ -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 @@ -137,6 +137,7 @@
<Parameter name="FirstMixedLayer" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerOffset" value="28"/>
<Parameter name="DetectorType" value="3"/>
<Parameter name="WaferMaskMode" value="0"/>
<Parameter name="WaferThickness" value="[hgcal:ScintillatorThickness]"/>
<Parameter name="MinimumTileSize" value="[MinimumTileSize]"/>
<Parameter name="NPhiBinBH" value="360"/>
Expand Down
5 changes: 3 additions & 2 deletions Geometry/HGCalCommonData/data/hgcalCons/v11m/hgcalCons.xml
@@ -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
5 changes: 3 additions & 2 deletions Geometry/HGCalCommonData/data/hgcalCons/v12/hgcalCons.xml
@@ -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
3 changes: 2 additions & 1 deletion Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml
@@ -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 @@ -125,6 +125,7 @@
<Parameter name="FirstMixedLayer" value="[hgcal:FirstMixedLayer]"/>
<Parameter name="LayerOffset" value="28"/>
<Parameter name="DetectorType" value="3"/>
<Parameter name="WaferMaskMode" value="0"/>
<Parameter name="WaferThickness" value="[hgcal:ScintillatorThickness]"/>
<Parameter name="MinimumTileSize" value="[MinimumTileSize]"/>
<Parameter name="NPhiBinBH" value="360"/>
Expand Down

0 comments on commit 6f7800d

Please sign in to comment.