Skip to content

Commit 59bdefa

Browse files
authored
Merge pull request #45366 from bsunanda/Phase2-hgc358C
Phase2-hgx358C Add a few new modes to enable cog computation for wafers as default for the future V19 version of HGCal
2 parents 7135505 + 0f76b00 commit 59bdefa

File tree

19 files changed

+103
-44
lines changed

19 files changed

+103
-44
lines changed

Geometry/HGCalCommonData/data/hgcalCons/v19/hgcalCons.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<SpecPar name="HGCalEELayer">
3939
<PartSelector path="//HGCalEELayer.*"/>
4040
<Parameter name="Volume" value="HGCalEELayer" eval="false"/>
41-
<Parameter name="GeometryMode" value="HGCalGeometryMode::Hexagon8CalibCell" eval="false"/>
41+
<Parameter name="GeometryMode" value="HGCalGeometryMode::Hexagon8FineCell" eval="false"/>
4242
<Parameter name="LevelZSide" value="3"/>
4343
<Parameter name="LevelTop" value="9"/>
4444
<Parameter name="LevelTop" value="12"/>
@@ -102,7 +102,7 @@
102102
<SpecPar name="HGCalHESiliconLayer">
103103
<PartSelector path="//HGCalHESiliconLayer.*"/>
104104
<Parameter name="Volume" value="HGCalHESiliconLayer" eval="false"/>
105-
<Parameter name="GeometryMode" value="HGCalGeometryMode::Hexagon8CalibCell" eval="false"/>
105+
<Parameter name="GeometryMode" value="HGCalGeometryMode::Hexagon8FineCell" eval="false"/>
106106
<Parameter name="LevelZSide" value="3"/>
107107
<Parameter name="LevelTop" value="9"/>
108108
<Parameter name="LevelTop" value="12"/>
@@ -166,7 +166,7 @@
166166
<SpecPar name="HGCalHEScintillatorSensitive">
167167
<PartSelector path="//HGCalHEScintillatorSensitive.*"/>
168168
<Parameter name="Volume" value="HGCalHEScintillatorSensitive" eval="false"/>
169-
<Parameter name="GeometryMode" value="HGCalGeometryMode::TrapezoidFineCassette" eval="false"/>
169+
<Parameter name="GeometryMode" value="HGCalGeometryMode::TrapezoidFinCell" eval="false"/>
170170
<Parameter name="LevelZSide" value="3"/>
171171
<Parameter name="LevelTop" value="9"/>
172172
<Parameter name="LevelTop" value="11"/>

Geometry/HGCalCommonData/interface/HGCalDDDConstants.h

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class HGCalDDDConstants {
5151
double calibCellRad(bool hd) const { return (hd ? hgpar_->calibCellRHD_ : hgpar_->calibCellRLD_); }
5252
bool cassetteMode() const {
5353
return ((mode_ == HGCalGeometryMode::Hexagon8Cassette) || (mode_ == HGCalGeometryMode::TrapezoidCassette) ||
54-
(mode_ == HGCalGeometryMode::Hexagon8CalibCell));
54+
(mode_ == HGCalGeometryMode::Hexagon8CalibCell) || (mode_ == HGCalGeometryMode::Hexagon8FineCell) ||
55+
(mode_ == HGCalGeometryMode::TrapezoidFineCell));
5556
}
5657
bool cassetteShiftScintillator(int zside, int layer, int iphi) const;
5758
bool cassetteShiftSilicon(int zside, int layer, int waferU, int waferV) const;
@@ -113,10 +114,18 @@ class HGCalDDDConstants {
113114
std::pair<float, float> localToGlobal8(
114115
int zside, int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) const;
115116
std::pair<float, float> locateCell(int cell, int lay, int type, bool reco) const;
116-
std::pair<float, float> locateCell(
117-
int zside, int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool norot, bool debug)
118-
const;
119-
std::pair<float, float> locateCell(const HGCSiliconDetId&, bool debug) const;
117+
std::pair<float, float> locateCell(int zside,
118+
int lay,
119+
int waferU,
120+
int waferV,
121+
int cellU,
122+
int cellV,
123+
bool reco,
124+
bool all,
125+
bool norot,
126+
bool cog,
127+
bool debug) const;
128+
std::pair<float, float> locateCell(const HGCSiliconDetId&, bool cog, bool debug) const;
120129
std::pair<float, float> locateCell(const HGCScintillatorDetId&, bool debug) const;
121130
std::pair<float, float> locateCellHex(int cell, int wafer, bool reco) const;
122131
std::pair<float, float> locateCellTrap(int zside, int lay, int ieta, int iphi, bool reco, bool debug) const;
@@ -137,6 +146,12 @@ class HGCalDDDConstants {
137146
std::vector<int> numberCells(int lay, bool reco) const;
138147
int numberCellsHexagon(int wafer) const;
139148
int numberCellsHexagon(int lay, int waferU, int waferV, bool flag) const;
149+
inline int partialWaferType(int lay, int waferU, int waferV) const {
150+
int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
151+
auto ktr = hgpar_->waferInfoMap_.find(indx);
152+
int part = (ktr != hgpar_->waferInfoMap_.end()) ? (ktr->second).part : HGCalTypes::WaferFull;
153+
return part;
154+
}
140155
std::pair<double, double> rangeR(double z, bool reco) const;
141156
std::pair<double, double> rangeRLayer(int lay, bool reco) const;
142157
std::pair<double, double> rangeZ(bool reco) const;
@@ -153,12 +168,13 @@ class HGCalDDDConstants {
153168
inline int tileSiPM(int sipm) const { return ((sipm > 0) ? HGCalTypes::SiPMSmall : HGCalTypes::SiPMLarge); }
154169
bool tileTrapezoid() const {
155170
return ((mode_ == HGCalGeometryMode::Trapezoid) || (mode_ == HGCalGeometryMode::TrapezoidFile) ||
156-
(mode_ == HGCalGeometryMode::TrapezoidModule) || (mode_ == HGCalGeometryMode::TrapezoidCassette));
171+
(mode_ == HGCalGeometryMode::TrapezoidModule) || (mode_ == HGCalGeometryMode::TrapezoidCassette) ||
172+
(mode_ == HGCalGeometryMode::TrapezoidFineCell));
157173
}
158174
std::pair<int, int> tileType(int layer, int ring, int phi) const;
159175
inline bool trapezoidFile() const {
160176
return ((mode_ == HGCalGeometryMode::TrapezoidFile) || (mode_ == HGCalGeometryMode::TrapezoidModule) ||
161-
(mode_ == HGCalGeometryMode::TrapezoidCassette));
177+
(mode_ == HGCalGeometryMode::TrapezoidCassette) || (mode_ == HGCalGeometryMode::TrapezoidFineCell));
162178
}
163179
inline bool v17OrLess() const { return (mode_ < HGCalGeometryMode::Hexagon8CalibCell); }
164180
inline unsigned int volumes() const { return hgpar_->moduleLayR_.size(); }
@@ -182,15 +198,18 @@ class HGCalDDDConstants {
182198
inline bool waferHexagon8() const {
183199
return ((mode_ == HGCalGeometryMode::Hexagon8) || (mode_ == HGCalGeometryMode::Hexagon8Full) ||
184200
(mode_ == HGCalGeometryMode::Hexagon8File) || (mode_ == HGCalGeometryMode::Hexagon8Module) ||
185-
(mode_ == HGCalGeometryMode::Hexagon8Cassette) || (mode_ == HGCalGeometryMode::Hexagon8CalibCell));
201+
(mode_ == HGCalGeometryMode::Hexagon8Cassette) || (mode_ == HGCalGeometryMode::Hexagon8CalibCell) ||
202+
(mode_ == HGCalGeometryMode::Hexagon8FineCell));
186203
}
187204
inline bool waferHexagon8File() const {
188205
return ((mode_ == HGCalGeometryMode::Hexagon8File) || (mode_ == HGCalGeometryMode::Hexagon8Module) ||
189-
(mode_ == HGCalGeometryMode::Hexagon8Cassette) || (mode_ == HGCalGeometryMode::Hexagon8CalibCell));
206+
(mode_ == HGCalGeometryMode::Hexagon8Cassette) || (mode_ == HGCalGeometryMode::Hexagon8CalibCell) ||
207+
(mode_ == HGCalGeometryMode::Hexagon8FineCell));
190208
}
209+
inline bool waferHexagon8Fine() const { return ((mode_ == HGCalGeometryMode::Hexagon8FineCell)); }
191210
inline bool waferHexagon8Module() const {
192211
return ((mode_ == HGCalGeometryMode::Hexagon8Module) || (mode_ == HGCalGeometryMode::Hexagon8Cassette) ||
193-
(mode_ == HGCalGeometryMode::Hexagon8CalibCell));
212+
(mode_ == HGCalGeometryMode::Hexagon8CalibCell) || (mode_ == HGCalGeometryMode::Hexagon8FineCell));
194213
}
195214
bool waferInLayer(int wafer, int lay, bool reco) const;
196215
bool waferFullInLayer(int wafer, int lay, bool reco) const;

Geometry/HGCalCommonData/interface/HGCalGeometryMode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ namespace HGCalGeometryMode {
3737
Hexagon8Cassette = 10,
3838
TrapezoidCassette = 11,
3939
Hexagon8CalibCell = 12,
40+
TrapezoidFineCell = 13,
41+
Hexagon8FineCell = 14,
4042
};
4143

4244
enum WaferMode { Polyhedra = 0, ExtrudedPolygon = 1 };

Geometry/HGCalCommonData/src/HGCalDDDConstants.cc

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ bool HGCalDDDConstants::cellInLayer(int waferU, int waferV, int cellU, int cellV
325325
return HGCalWaferMask::goodCell(cellU, cellV, ncell, part, rotn);
326326
} else if (waferHexagon8() || waferHexagon6()) {
327327
const auto& xy =
328-
((waferHexagon8()) ? locateCell(zside, lay, waferU, waferV, cellU, cellV, reco, true, false, false)
328+
((waferHexagon8()) ? locateCell(zside, lay, waferU, waferV, cellU, cellV, reco, true, false, false, false)
329329
: locateCell(cellU, lay, waferU, reco));
330330
double rpos = sqrt(xy.first * xy.first + xy.second * xy.second);
331331
return ((rpos >= hgpar_->rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
@@ -836,9 +836,17 @@ std::pair<float, float> HGCalDDDConstants::locateCell(int cell, int lay, int typ
836836
return std::make_pair(x, y);
837837
}
838838

839-
std::pair<float, float> HGCalDDDConstants::locateCell(
840-
int zside, int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool norot, bool debug)
841-
const {
839+
std::pair<float, float> HGCalDDDConstants::locateCell(int zside,
840+
int lay,
841+
int waferU,
842+
int waferV,
843+
int cellU,
844+
int cellV,
845+
bool reco,
846+
bool all,
847+
bool norot,
848+
bool cog,
849+
bool debug) const {
842850
double x(0), y(0);
843851
int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
844852
auto itr = hgpar_->typesInLayers_.find(indx);
@@ -859,7 +867,9 @@ std::pair<float, float> HGCalDDDConstants::locateCell(
859867
if (ktr != hgpar_->waferInfoMap_.end())
860868
place = HGCalCell::cellPlacementIndex(1, HGCalTypes::layerFrontBack(layertype), (ktr->second).orient);
861869
}
862-
auto xy = hgcell_->cellUV2XY2(cellU, cellV, place, type);
870+
int part = partialWaferType(lay, waferU, waferV);
871+
auto xy = (waferHexagon8Fine() || cog) ? cellOffset_->cellOffsetUV2XY1(cellU, cellV, place, type, part)
872+
: hgcell_->cellUV2XY2(cellU, cellV, place, type);
863873
x = xy.first;
864874
y = xy.second;
865875
if (debug)
@@ -919,8 +929,9 @@ std::pair<float, float> HGCalDDDConstants::locateCell(
919929
return (rotx ? getXY(lay, x, y, false) : std::make_pair(x, y));
920930
}
921931

922-
std::pair<float, float> HGCalDDDConstants::locateCell(const HGCSiliconDetId& id, bool debug) const {
923-
return locateCell(id.zside(), id.layer(), id.waferU(), id.waferV(), id.cellU(), id.cellV(), true, true, false, debug);
932+
std::pair<float, float> HGCalDDDConstants::locateCell(const HGCSiliconDetId& id, bool cog, bool debug) const {
933+
return locateCell(
934+
id.zside(), id.layer(), id.waferU(), id.waferV(), id.cellU(), id.cellV(), true, true, false, cog, debug);
924935
}
925936

926937
std::pair<float, float> HGCalDDDConstants::locateCell(const HGCScintillatorDetId& id, bool debug) const {

Geometry/HGCalCommonData/src/HGCalGeometryMode.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ HGCalStringToEnumParser<HGCalGeometryMode::GeometryMode>::HGCalStringToEnumParse
1616
enumMap["HGCalGeometryMode::Hexagon8Cassette"] = HGCalGeometryMode::Hexagon8Cassette;
1717
enumMap["HGCalGeometryMode::TrapezoidCassette"] = HGCalGeometryMode::TrapezoidCassette;
1818
enumMap["HGCalGeometryMode::Hexagon8CalibCell"] = HGCalGeometryMode::Hexagon8CalibCell;
19+
enumMap["HGCalGeometryMode::TrapezoidFineCell"] = HGCalGeometryMode::TrapezoidFineCell;
20+
enumMap["HGCalGeometryMode::Hexagon8FineCell"] = HGCalGeometryMode::Hexagon8FineCell;
1921
}
2022

2123
template <>

Geometry/HGCalCommonData/test/HGCalNumberingTester.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet
172172
} else {
173173
std::array<int, 5> kxy, lxy;
174174
kxy = hgdc.assignCellHex(localx, localy, zside, i + loff, reco_, false, false);
175-
xy = hgdc.locateCell(zside, i + loff, kxy[0], kxy[1], kxy[3], kxy[4], reco_, true, false, false);
175+
xy = hgdc.locateCell(zside, i + loff, kxy[0], kxy[1], kxy[3], kxy[4], reco_, true, false, false, false);
176176
lxy = hgdc.assignCellHex(xy.first, xy.second, zside, i + loff, reco_, false, false);
177177
flg = (kxy == lxy) ? " " : " ***** Error *****";
178178
edm::LogVerbatim("HGCalGeom") << "Input: (" << localx << "," << localy << ", " << i + loff
@@ -182,7 +182,7 @@ void HGCalNumberingTester::analyze(const edm::Event& iEvent, const edm::EventSet
182182
<< lxy[3] << ":" << lxy[4] << ") Dist "
183183
<< hgdc.distFromEdgeHex(scl * localx, scl * localy, scl * zpos) << " " << flg;
184184
kxy = hgdc.assignCellHex(-localx, -localy, zside, i + loff, reco_, false, false);
185-
xy = hgdc.locateCell(zside, i + loff, kxy[0], kxy[1], kxy[3], kxy[4], reco_, true, false, false);
185+
xy = hgdc.locateCell(zside, i + loff, kxy[0], kxy[1], kxy[3], kxy[4], reco_, true, false, false, false);
186186
lxy = hgdc.assignCellHex(xy.first, xy.second, zside, i + loff, reco_, false, false);
187187
flg = (kxy == lxy) ? " " : " ***** Error *****";
188188
edm::LogVerbatim("HGCalGeom") << "Input: (" << -localx << "," << -localy << ", " << i + loff

Geometry/HGCalCommonData/test/HGCalPartialIDTester.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void HGCalPartialIDTester::beginRun(edm::Run const &iRun, edm::EventSetup const
154154
double dR(0);
155155
if ((waferU_[i] != 0) || (waferV_[i] != 0)) {
156156
std::pair<float, float> xy =
157-
hgcCons_->locateCell(zside_[i], layer_[i], waferU, waferV, cellU, cellV, false, true, false, false);
157+
hgcCons_->locateCell(zside_[i], layer_[i], waferU, waferV, cellU, cellV, false, true, false, false, false);
158158
double dx = (xpos_[i] - xy.first);
159159
double dy = (ypos_[i] - xy.second);
160160
dR = std::sqrt(dx * dx + dy * dy);
@@ -173,8 +173,8 @@ void HGCalPartialIDTester::beginRun(edm::Run const &iRun, edm::EventSetup const
173173
xx, ypos_[i], zside_[i], layer_[i], waferU, waferV, cellU, cellV, waferType, wt, false, debug_);
174174
info = hgcCons_->waferInfo(layer_[i], waferU, waferV);
175175
if ((waferU_[i] != 0) || (waferV_[i] != 0)) {
176-
std::pair<float, float> xy =
177-
hgcCons_->locateCell(zside_[i], layer_[i], waferU, waferV, cellU, cellV, false, true, false, false);
176+
std::pair<float, float> xy = hgcCons_->locateCell(
177+
zside_[i], layer_[i], waferU, waferV, cellU, cellV, false, true, false, false, false);
178178
double dx = (xpos_[i] - xy.first);
179179
double dy = (ypos_[i] - xy.second);
180180
dR = std::sqrt(dx * dx + dy * dy);

Geometry/HGCalCommonData/test/HGCalPartialWaferTester.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void HGCalPartialWaferTester::analyze(const edm::Event&, const edm::EventSetup&
107107
++alltry;
108108
double zpos = hgdc.waferZ(layer, reco);
109109
int zside = (zpos > 0) ? 1 : -1;
110-
auto xy = hgdc.locateCell(zside, layer, waferU, waferV, ui, vi, reco, all, norot, debug1);
110+
auto xy = hgdc.locateCell(zside, layer, waferU, waferV, ui, vi, reco, all, norot, false, debug1);
111111
int lay(layer), cU(0), cV(0), wType(-1), wU(0), wV(0);
112112
double wt(0);
113113
hgdc.waferFromPosition(HGCalParameters::k_ScaleToDDD * xy.first,

Geometry/HGCalCommonData/test/HGCalValidityTester.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ void HGCalValidityTester::beginRun(edm::Run const &iRun, edm::EventSetup const &
184184
HGCSiliconDetId id(detIds_[k].first);
185185
layer = id.layer();
186186
zside = id.zside();
187-
xy = cons->locateCell(zside, layer, id.waferU(), id.waferV(), id.cellU(), id.cellV(), true, true, false, false);
187+
xy = cons->locateCell(
188+
zside, layer, id.waferU(), id.waferV(), id.cellU(), id.cellV(), true, true, false, false, false);
188189
valid = cons->isValidHex8(layer, id.waferU(), id.waferV(), id.cellU(), id.cellV(), false);
189190
auto cell = cons->assignCellHex(zside * xy.first, xy.second, zside, layer, true, false, false);
190191
HGCSiliconDetId newId(id.det(), id.zside(), cell[2], id.layer(), cell[0], cell[1], cell[3], cell[4]);

Geometry/HGCalGeometry/interface/HGCalGeometry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class HGCalGeometry final : public CaloSubdetectorGeometry {
7070
CaloSubdetectorGeometry::DimVec& dimVector,
7171
CaloSubdetectorGeometry::IVec& dinsVector) const override;
7272

73+
GlobalPoint getPosition(const DetId& id, bool cog, bool debug) const;
7374
GlobalPoint getPosition(const DetId& id, bool debug = false) const;
7475
GlobalPoint getWaferPosition(const DetId& id) const;
7576

0 commit comments

Comments
 (0)