Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase2-hgx82 Add the required changes to utilize wafers defined as ExtrudedPolygon #18774

Merged
merged 5 commits into from
Jun 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Geometry/CaloTopology/interface/HGCalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class HGCalTopology : public CaloSubdetectorTopology {
}

///Geometry mode
HGCalGeometryMode geomMode() const {return mode_;}
HGCalGeometryMode::GeometryMode geomMode() const {return mode_;}

///Dense indexing
virtual uint32_t detId2denseId(const DetId& id) const;
Expand Down Expand Up @@ -130,14 +130,15 @@ class HGCalTopology : public CaloSubdetectorTopology {
/// move the nagivator along z
DetId changeZ(const DetId& id, int nrStepsZ) const ;

const HGCalDDDConstants& hdcons_;
HGCalGeometryMode mode_;
const HGCalDDDConstants& hdcons_;
HGCalGeometryMode::GeometryMode mode_;

ForwardSubdetector subdet_;
bool half_;
int sectors_, layers_, cells_, kHGhalf_, kHGeomHalf_;
std::vector<int> maxcells_;
unsigned int kSizeForDenseIndexing;
ForwardSubdetector subdet_;
bool half_;
int sectors_, layers_, cells_;
int kHGhalf_, kHGeomHalf_;
std::vector<int> maxcells_;
unsigned int kSizeForDenseIndexing;
};

#endif
2 changes: 1 addition & 1 deletion Geometry/CaloTopology/src/HGCalTopology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HGCalTopology::HGCalTopology(const HGCalDDDConstants& hdcons,
sectors_ = hdcons_.sectors();
layers_ = hdcons_.layers(true);
cells_ = hdcons_.maxCells(true);
mode_ = HGCalGeometryMode( hdcons_.geomMode());
mode_ = hdcons_.geomMode();
if (mode_ == HGCalGeometryMode::Square) {
kHGhalf_ = sectors_*layers_*subSectors_*cells_ ;
kHGeomHalf_ = (half_ ? (sectors_*layers_*subSectors_) : (sectors_*layers_));
Expand Down
1 change: 1 addition & 0 deletions Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
<PartSelector path="//HGCalEECell.*"/>
<PartSelector path="//HGCalHECell.*"/>
<Parameter name="OnlyForHGCalNumbering" value="HGCal" eval="false"/>
<Parameter name="WaferMode" value="HGCalGeometryMode::Polyhedra" eval="false"/>
</SpecPar>
</SpecParSection>

Expand Down
1 change: 1 addition & 0 deletions Geometry/HGCalCommonData/data/hgcalwafer/v8/hgcalwafer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
<PartSelector path="//HGCalEECell.*"/>
<PartSelector path="//HGCalHECell.*"/>
<Parameter name="OnlyForHGCalNumbering" value="HGCal" eval="false"/>
<Parameter name="WaferMode" value="HGCalGeometryMode::ExtrudedPolygon" eval="false"/>
</SpecPar>
</SpecParSection>

Expand Down
16 changes: 8 additions & 8 deletions Geometry/HGCalCommonData/interface/HGCalDDDConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class HGCalDDDConstants {
std::pair<int,int> findCell(int cell, int lay, int subSec, bool reco) const;
std::pair<int,int> findCellSquare(int cell, float h, float bl, float tl,
float alpha, float cellSize) const;
HGCalGeometryMode geomMode() const {return mode_;}
HGCalGeometryMode::GeometryMode geomMode() const {return mode_;}
bool isValid(int lay, int mod, int cell, bool reco) const;
bool isValidCell(int layindex, int wafer, int cell) const;
unsigned int layers(bool reco) const;
Expand Down Expand Up @@ -102,13 +102,13 @@ class HGCalDDDConstants {
float& tl, float& alpha) const;
bool waferInLayer(int wafer, int lay) const;

const HGCalParameters* hgpar_;
constexpr static double tan30deg_ = 0.5773502693;
double rmax_, hexside_;
HGCalGeometryMode mode_;
int32_t tot_wafers_, modHalf_;
std::array<uint32_t,2> tot_layers_;
simrecovecs max_modules_layer_;
const HGCalParameters* hgpar_;
constexpr static double tan30deg_ = 0.5773502693;
double rmax_, hexside_;
HGCalGeometryMode::GeometryMode mode_;
int32_t tot_wafers_, modHalf_;
std::array<uint32_t,2> tot_layers_;
simrecovecs max_modules_layer_;
};

#endif
4 changes: 3 additions & 1 deletion Geometry/HGCalCommonData/interface/HGCalGeomParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "DetectorDescription/Core/interface/DDsvalues.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"

class DDCompactView;
class DDFilteredView;
Expand All @@ -33,7 +34,8 @@ class HGCalGeomParameters {
const std::string&);
void loadGeometryHexagon(const DDFilteredView&, HGCalParameters&,
const std::string&, const DDCompactView*,
const std::string&, const std::string&);
const std::string&, const std::string&,
HGCalGeometryMode::WaferMode);
void loadSpecParsSquare(const DDFilteredView&, HGCalParameters&);
void loadSpecParsHexagon(const DDFilteredView&, HGCalParameters&,
const DDCompactView*, const std::string&,
Expand Down
5 changes: 4 additions & 1 deletion Geometry/HGCalCommonData/interface/HGCalGeometryMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class HGCalStringToEnumParser {
}
};

enum class HGCalGeometryMode : int { Square=0, Hexagon=1, HexagonFull=2 };
namespace HGCalGeometryMode {
enum GeometryMode { Square=0, Hexagon=1, HexagonFull=2 };
enum WaferMode { Polyhedra=0, ExtrudedPolygon=1};
}

#endif
127 changes: 64 additions & 63 deletions Geometry/HGCalCommonData/interface/HGCalParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "CondFormats/Serialization/interface/Serializable.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
#include <CLHEP/Geometry/Transform3D.h>
#include <string>
#include <vector>
Expand Down Expand Up @@ -47,69 +48,69 @@ class HGCalParameters {
static const int kShiftSector = 1;
static const int kShiftSubSec = 0;

std::string name_;
int nCells_;
int nSectors_;
std::vector<double> cellSize_;
std::vector<int> moduleLayS_;
std::vector<double> moduleBlS_;
std::vector<double> moduleTlS_;
std::vector<double> moduleHS_;
std::vector<double> moduleDzS_;
std::vector<double> moduleAlphaS_;
std::vector<double> moduleCellS_;
std::vector<int> moduleLayR_;
std::vector<double> moduleBlR_;
std::vector<double> moduleTlR_;
std::vector<double> moduleHR_;
std::vector<double> moduleDzR_;
std::vector<double> moduleAlphaR_;
std::vector<double> moduleCellR_;
std::vector<uint32_t> trformIndex_;
std::vector<double> trformTranX_;
std::vector<double> trformTranY_;
std::vector<double> trformTranZ_;
std::vector<double> trformRotXX_;
std::vector<double> trformRotYX_;
std::vector<double> trformRotZX_;
std::vector<double> trformRotXY_;
std::vector<double> trformRotYY_;
std::vector<double> trformRotZY_;
std::vector<double> trformRotXZ_;
std::vector<double> trformRotYZ_;
std::vector<double> trformRotZZ_;
std::vector<int> layer_;
std::vector<int> layerIndex_;
std::vector<int> layerGroup_;
std::vector<int> cellFactor_;
std::vector<int> depth_;
std::vector<int> depthIndex_;
std::vector<int> depthLayerF_;
std::vector<double> zLayerHex_;
std::vector<double> rMinLayHex_;
std::vector<double> rMaxLayHex_;
std::vector<int> waferCopy_;
std::vector<int> waferTypeL_;
std::vector<int> waferTypeT_;
std::vector<double> waferPosX_;
std::vector<double> waferPosY_;
std::vector<double> cellFineX_;
std::vector<double> cellFineY_;
std::vector<bool> cellFineHalf_;
std::vector<double> cellCoarseX_;
std::vector<double> cellCoarseY_;
std::vector<bool> cellCoarseHalf_;
std::vector<int> layerGroupM_;
std::vector<int> layerGroupO_;
std::vector<double> boundR_;
std::vector<double> rLimit_;
std::vector<int> cellFine_;
std::vector<int> cellCoarse_;
double waferR_;
int levelT_;
int mode_;
double slopeMin_;
layer_map copiesInLayers_;
std::string name_;
int nCells_;
int nSectors_;
std::vector<double> cellSize_;
std::vector<int> moduleLayS_;
std::vector<double> moduleBlS_;
std::vector<double> moduleTlS_;
std::vector<double> moduleHS_;
std::vector<double> moduleDzS_;
std::vector<double> moduleAlphaS_;
std::vector<double> moduleCellS_;
std::vector<int> moduleLayR_;
std::vector<double> moduleBlR_;
std::vector<double> moduleTlR_;
std::vector<double> moduleHR_;
std::vector<double> moduleDzR_;
std::vector<double> moduleAlphaR_;
std::vector<double> moduleCellR_;
std::vector<uint32_t> trformIndex_;
std::vector<double> trformTranX_;
std::vector<double> trformTranY_;
std::vector<double> trformTranZ_;
std::vector<double> trformRotXX_;
std::vector<double> trformRotYX_;
std::vector<double> trformRotZX_;
std::vector<double> trformRotXY_;
std::vector<double> trformRotYY_;
std::vector<double> trformRotZY_;
std::vector<double> trformRotXZ_;
std::vector<double> trformRotYZ_;
std::vector<double> trformRotZZ_;
std::vector<int> layer_;
std::vector<int> layerIndex_;
std::vector<int> layerGroup_;
std::vector<int> cellFactor_;
std::vector<int> depth_;
std::vector<int> depthIndex_;
std::vector<int> depthLayerF_;
std::vector<double> zLayerHex_;
std::vector<double> rMinLayHex_;
std::vector<double> rMaxLayHex_;
std::vector<int> waferCopy_;
std::vector<int> waferTypeL_;
std::vector<int> waferTypeT_;
std::vector<double> waferPosX_;
std::vector<double> waferPosY_;
std::vector<double> cellFineX_;
std::vector<double> cellFineY_;
std::vector<bool> cellFineHalf_;
std::vector<double> cellCoarseX_;
std::vector<double> cellCoarseY_;
std::vector<bool> cellCoarseHalf_;
std::vector<int> layerGroupM_;
std::vector<int> layerGroupO_;
std::vector<double> boundR_;
std::vector<double> rLimit_;
std::vector<int> cellFine_;
std::vector<int> cellCoarse_;
double waferR_;
int levelT_;
HGCalGeometryMode::GeometryMode mode_;
double slopeMin_;
layer_map copiesInLayers_;

COND_SERIALIZABLE;
};
Expand Down
2 changes: 1 addition & 1 deletion Geometry/HGCalCommonData/python/testHGCV8XML_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
'Geometry/HGCalCommonData/data/hgcal/v8/hgcal.xml',
'Geometry/HGCalCommonData/data/hgcalEE/v8/hgcalEE.xml',
'Geometry/HGCalCommonData/data/hgcalHEsil/v8/hgcalHEsil.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v7/hgcalwafer.xml',
'Geometry/HGCalCommonData/data/hgcalwafer/v8/hgcalwafer.xml',
'Geometry/HGCalCommonData/data/hgcalCons/v8/hgcalCons.xml',
'Geometry/MuonCommonData/data/mbCommon/2017/v2/mbCommon.xml',
'Geometry/MuonCommonData/data/mb1/2015/v1/mb1.xml',
Expand Down
6 changes: 3 additions & 3 deletions Geometry/HGCalCommonData/src/HGCalDDDConstants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ constexpr double k_ScaleFromDDD = 0.1;

HGCalDDDConstants::HGCalDDDConstants(const HGCalParameters* hp,
const std::string name) : hgpar_(hp) {
mode_ = HGCalGeometryMode( hgpar_->mode_ );
mode_ = hgpar_->mode_;
if (mode_ == HGCalGeometryMode::Square) {
rmax_ = 0;
modHalf_ = sectors()*layers(true);
Expand Down Expand Up @@ -792,9 +792,9 @@ bool HGCalDDDConstants::waferInLayer(int wafer, int lay) const {
else cornerAll = false;
}
bool in(false);
if (hgpar_->mode_ == static_cast<int> (HGCalGeometryMode::Hexagon))
if (hgpar_->mode_ == HGCalGeometryMode::Hexagon)
in = cornerAll;
else if (hgpar_->mode_ == static_cast<int> (HGCalGeometryMode::HexagonFull))
else if (hgpar_->mode_ == HGCalGeometryMode::HexagonFull)
in = cornerOne;
return in;
}
Expand Down
20 changes: 16 additions & 4 deletions Geometry/HGCalCommonData/src/HGCalGeomParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ void HGCalGeomParameters::loadGeometryHexagon(const DDFilteredView& _fv,
const std::string & sdTag1,
const DDCompactView* cpv,
const std::string & sdTag2,
const std::string & sdTag3) {
const std::string & sdTag3,
HGCalGeometryMode::WaferMode mode) {

DDFilteredView fv = _fv;
bool dodet(true);
Expand Down Expand Up @@ -322,11 +323,22 @@ void HGCalGeomParameters::loadGeometryHexagon(const DDFilteredView& _fv,
HGCalGeomParameters::cellParameters cell(false,wafer,p);
wafers.emplace_back(cell);
if ( names.count(name) == 0 ) {
const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
std::vector<double> zv = polyhedra.zVec();
std::vector<double> rv = polyhedra.rMaxVec();
std::vector<double> zv, rv;
if (mode == HGCalGeometryMode::Polyhedra) {
const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
zv = polyhedra.zVec();
rv = polyhedra.rMaxVec();
} else {
const DDExtrudedPolygon & polygon = static_cast<DDExtrudedPolygon>(sol);
zv = polygon.zVec();
rv = polygon.xVec();
}
php.waferR_ = rv[0]/std::cos(30.0*CLHEP::deg);
double dz = 0.5*(zv[1]-zv[0]);
#ifdef EDM_ML_DEBUG
std::cout << "Mode " << mode << " R " << php.waferR_ << " z " << dz
<< std::endl;
#endif
HGCalParameters::hgtrap mytr;
mytr.lay = 1; mytr.bl = php.waferR_;
mytr.tl = php.waferR_; mytr.h = php.waferR_;
Expand Down
8 changes: 7 additions & 1 deletion Geometry/HGCalCommonData/src/HGCalGeometryMode.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"

template<>
HGCalStringToEnumParser<HGCalGeometryMode>::HGCalStringToEnumParser() {
HGCalStringToEnumParser<HGCalGeometryMode::GeometryMode>::HGCalStringToEnumParser() {
enumMap["HGCalGeometryMode::Square"] = HGCalGeometryMode::Square;
enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon;
enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull;
}

template<>
HGCalStringToEnumParser<HGCalGeometryMode::WaferMode>::HGCalStringToEnumParser() {
enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra;
enumMap["HGCalGeometryMode::ExtrudedPolygon"] = HGCalGeometryMode::ExtrudedPolygon;
}

Loading