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

HGcal Hexgonal Geometry #12862

Merged
merged 8 commits into from
Jan 8, 2016
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
74 changes: 74 additions & 0 deletions CondFormats/GeometryObjects/interface/PHGCalParameters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#ifndef CondFormats_GeometryObjects_PHGCalParameters_h
#define CondFormats_GeometryObjects_PHGCalParameters_h

#include "CondFormats/Serialization/interface/Serializable.h"
#include <string>
#include <vector>

class PHGCalParameters {

public:

PHGCalParameters( void ) {}
~PHGCalParameters( void ) {}

std::string name_;
std::vector<double> cellSize_;
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<double> moduleBlR_;
std::vector<double> moduleTlR_;
std::vector<double> moduleHR_;
std::vector<double> moduleDzR_;
std::vector<double> moduleAlphaR_;
std::vector<double> moduleCellR_;
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<double> zLayerHex_;
std::vector<double> rMinLayHex_;
std::vector<double> rMaxLayHex_;
std::vector<double> waferPosX_;
std::vector<double> waferPosY_;
std::vector<double> cellFineX_;
std::vector<double> cellFineY_;
std::vector<double> cellCoarseX_;
std::vector<double> cellCoarseY_;
std::vector<double> boundR_;
std::vector<int> moduleLayS_;
std::vector<int> moduleLayR_;
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<int> waferCopy_;
std::vector<int> waferTypeL_;
std::vector<int> waferTypeT_;
std::vector<int> layerGroupM_;
std::vector<int> layerGroupO_;
std::vector<uint32_t> trformIndex_;
double waferR_;
int nCells_;
int nSectors_;
int mode_;

COND_SERIALIZABLE;
};

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "CondFormats/GeometryObjects/interface/PHGCalParameters.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(PHGCalParameters);
1 change: 1 addition & 0 deletions CondFormats/GeometryObjects/src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#include "CondFormats/GeometryObjects/interface/CSCRecoDigiParameters.h"
#include "CondFormats/GeometryObjects/interface/PTrackerParameters.h"
#include "CondFormats/GeometryObjects/interface/HcalParameters.h"
#include "CondFormats/GeometryObjects/interface/PHGCalParameters.h"

57 changes: 57 additions & 0 deletions CondFormats/GeometryObjects/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,61 @@
</class>
<class name="HcalParameters::LayerItem"/>
<class name="std::vector<HcalParameters::LayerItem>"/>
<class name="PHGCalParameters" class_version="0">
<field name="name_" mapping="blob"/>
<field name="cellSize_" mapping="blob"/>
<field name="moduleBlS_" mapping="blob"/>
<field name="moduleTlS_" mapping="blob"/>
<field name="moduleHS_" mapping="blob"/>
<field name="moduleDzS_" mapping="blob"/>
<field name="moduleAlphaS_" mapping="blob"/>
<field name="moduleCellS_" mapping="blob"/>
<field name="moduleBlR_" mapping="blob"/>
<field name="moduleTlR_" mapping="blob"/>
<field name="moduleHR_" mapping="blob"/>
<field name="moduleDzR_" mapping="blob"/>
<field name="moduleAlphaR_" mapping="blob"/>
<field name="moduleCellR_" mapping="blob"/>
<field name="trformTranX_" mapping="blob"/>
<field name="trformTranY_" mapping="blob"/>
<field name="trformTranZ_" mapping="blob"/>
<field name="trformRotXX_" mapping="blob"/>
<field name="trformRotYX_" mapping="blob"/>
<field name="trformRotZX_" mapping="blob"/>
<field name="trformRotXY_" mapping="blob"/>
<field name="trformRotYY_" mapping="blob"/>
<field name="trformRotZY_" mapping="blob"/>
<field name="trformRotXZ_" mapping="blob"/>
<field name="trformRotYZ_" mapping="blob"/>
<field name="trformRotZZ_" mapping="blob"/>
<field name="zLayerHex_" mapping="blob"/>
<field name="rMinLayHex_" mapping="blob"/>
<field name="rMaxLayHex_" mapping="blob"/>
<field name="waferPosX_" mapping="blob"/>
<field name="waferPosY_" mapping="blob"/>
<field name="cellFineX_" mapping="blob"/>
<field name="cellFineY_" mapping="blob"/>
<field name="cellCoarseX_" mapping="blob"/>
<field name="cellCoarseY_" mapping="blob"/>
<field name="boundR_" mapping="blob"/>
<field name="moduleLayS_" mapping="blob"/>
<field name="moduleLayR_" mapping="blob"/>
<field name="layer_" mapping="blob"/>
<field name="layerIndex_" mapping="blob"/>
<field name="layerGroup_" mapping="blob"/>
<field name="cellFactor_" mapping="blob"/>
<field name="depth_" mapping="blob"/>
<field name="depthIndex_" mapping="blob"/>
<field name="depthLayerF_" mapping="blob"/>
<field name="waferCopy_" mapping="blob"/>
<field name="waferTypeL_" mapping="blob"/>
<field name="waferTypeT_" mapping="blob"/>
<field name="layerGroupM_" mapping="blob"/>
<field name="layerGroupO_" mapping="blob"/>
<field name="trformIndex_" mapping="blob"/>
<field name="waferR_" mapping="blob"/>
<field name="nCells_" mapping="blob"/>
<field name="nSectors_" mapping="blob"/>
<field name="mode_" mapping="blob"/>
</class>
</lcgdict>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int main()
testSerialization<PTrackerParameters>();
testSerialization<PTrackerParameters::Item>();
testSerialization<HcalParameters>();
testSerialization<PHGCalParameters>();

return 0;
}
2 changes: 2 additions & 0 deletions Configuration/Geometry/python/GeometryExtended2023Dev_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *
from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import *
from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *
25 changes: 22 additions & 3 deletions Configuration/Geometry/python/GeometryExtended2023Reco_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from Geometry.MuonNumbering.muonNumberingInitialization_cfi import *
from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import *
from Geometry.GEMGeometryBuilder.gemGeometry_cfi import *
from Geometry.GEMGeometryBuilder.me0Geometry_cfi import *

# Alignment
from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *
Expand All @@ -25,10 +26,28 @@
trackerGeometry.applyAlignment = cms.bool(False)

# Calorimeters
from Geometry.CaloEventSetup.HGCalTopology_cfi import *
from Geometry.HGCalGeometry.HGCalGeometryESProducer_cfi import *
from Geometry.CaloEventSetup.CaloTopology_cfi import *
from Geometry.CaloEventSetup.CaloGeometry_cff import *
from Geometry.CaloEventSetup.CaloGeometryBuilder_cfi import *

CaloGeometryBuilder = cms.ESProducer("CaloGeometryBuilder",
SelectedCalos = cms.vstring('HCAL' ,
'ZDC' ,
'CASTOR' ,
'EcalBarrel' ,
'TOWER' )
)

from Geometry.EcalAlgo.EcalBarrelGeometry_cfi import *
from Geometry.HcalEventSetup.HcalGeometry_cfi import *
from Geometry.HcalEventSetup.CaloTowerGeometry_cfi import *
from Geometry.HcalEventSetup.CaloTowerTopology_cfi import *
from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import *
from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import *
from Geometry.ForwardGeometry.ForwardGeometry_cfi import *

from Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi import *
from Geometry.EcalMapping.EcalMapping_cfi import *
from Geometry.EcalMapping.EcalMappingRecord_cfi import *
from Geometry.HcalCommonData.hcalDDDRecConstants_cfi import *
from Geometry.HcalEventSetup.hcalTopologyIdeal_cfi import *

1 change: 1 addition & 0 deletions Configuration/Geometry/python/GeometryExtended2023_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import *
from Geometry.HcalCommonData.hcalParameters_cfi import *
from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import *
from Geometry.HGCalCommonData.hgcalParametersInitialization_cfi import *
from Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi import *
from Geometry.CaloEventSetup.HGCalTopology_cfi import *
6 changes: 5 additions & 1 deletion DataFormats/ForwardDetId/interface/HGCalDetId.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class HGCalDetId : public DetId {
static const int kHGCalLayerMask = 0x1F;
static const int kHGCalZsideOffset = 24;
static const int kHGCalZsideMask = 0x1;
static const int kHGCalMaskCell = 0xFFFFFF00;

/** Create a null cellid*/
HGCalDetId();
Expand All @@ -30,6 +31,9 @@ class HGCalDetId : public DetId {
HGCalDetId(const DetId& id);
/** Assignment from a generic cell id */
HGCalDetId& operator=(const DetId& id);

/** Converter for a geometry cell id */
HGCalDetId geometryCell () const {return id_&kHGCalMaskCell;}

/// get the absolute value of the cell #'s in x and y
int cell() const { return id_&kHGCalCellMask; }
Expand All @@ -38,7 +42,7 @@ class HGCalDetId : public DetId {
int wafer() const { return (id_>>kHGCalWaferOffset)&kHGCalWaferMask; }

/// get the wafer type
int waferType() const { return (id_>>kHGCalWaferTypeOffset)&kHGCalWaferTypeMask; }
int waferType() const { return ((id_>>kHGCalWaferTypeOffset)&kHGCalWaferTypeMask ? 1 : -1); }

/// get the layer #
int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; }
Expand Down
20 changes: 11 additions & 9 deletions DataFormats/ForwardDetId/src/HGCalDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ HGCalDetId::HGCalDetId(uint32_t rawid) : DetId(rawid) {
}

HGCalDetId::HGCalDetId(ForwardSubdetector subdet, int zp, int lay, int wafertype, int wafer, int cell) : DetId(Forward,subdet) {

if (cell>kHGCalCellMask || cell<0 || wafer>kHGCalWaferMask || wafer<0 || wafertype>kHGCalWaferTypeMask || wafertype<0 || lay>kHGCalLayerMask || lay<0) {

if (wafertype < 0) wafertype = 0;
if (cell>kHGCalCellMask || cell<0 || wafer>kHGCalWaferMask || wafer<0 || wafertype>kHGCalWaferTypeMask || lay>kHGCalLayerMask || lay<0) {
#ifdef DebugLog
std::cout << "[HGCalDetId] request for new id for layer=" << lay
std::cout << "[HGCalDetId] request for new id for"
<< " layer=" << lay << ":" << kHGCalLayerMask
<< " @ zp=" << zp
<< " wafer=" << wafer
<< " waferType=" << wafertype
<< " cell=" << cell
<< " wafer=" << wafer << ":" << kHGCalWaferMask
<< " waferType=" << wafertype << ":" << kHGCalWaferTypeMask
<< " cell=" << cell << ":" << kHGCalCellMask
<< " for subdet=" << subdet
<< " has one or more fields out of bounds and will be reset"
<< std::endl;
#endif
zp = lay = wafertype = wafer = cell=0;
zp = lay = wafertype = wafer = cell = 0;
}
id_ |= ((cell & kHGCalCellMask) << kHGCalCellOffset);
id_ |= ((wafer & kHGCalWaferMask) << kHGCalWaferOffset);
Expand All @@ -45,7 +47,7 @@ bool HGCalDetId::isValid(ForwardSubdetector subdet, int zp, int lay, int waferty
bool ok = ((subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB) &&
(cell >= 0 && cell <= kHGCalCellMask) &&
(wafer >= 0 && wafer <= kHGCalWaferMask) &&
(wafertype >= 0 || wafertype <= kHGCalWaferTypeMask) &&
(wafertype <= kHGCalWaferTypeMask) &&
(lay >= 0 && lay <= kHGCalLayerMask) &&
(zp == -1 || zp == 1));
#ifdef DebugLog
Expand All @@ -54,7 +56,7 @@ bool HGCalDetId::isValid(ForwardSubdetector subdet, int zp, int lay, int waferty
<< (subdet == HGCEE || subdet == HGCHEF || subdet == HGCHEB)
<< " Cell " << cell << ":" << (cell >= 0 && cell <= kHGCalCellMask)
<< " Wafer " << wafer << ":" << (wafer >= 0 && wafer <= kHGCalWaferMask)
<< " WaferType " << wafertype << ":" << (wafertype >= 0 || wafertype <= kHGCalWaferTypeMask)
<< " WaferType " << wafertype << ":" << (wafertype <= kHGCalWaferTypeMask)
<< " Layer " << lay << ":" << (lay >= 0 && lay <= kHGCalLayerMask)
<< " zp " << zp << ":" << (zp == -1 || zp == 1) << std::endl;
#endif
Expand Down
10 changes: 10 additions & 0 deletions Geometry/CaloGeometry/src/FlatTrd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,21 @@ FlatTrd::~FlatTrd() {}

GlobalPoint FlatTrd::getPosition(const Pt3D& local ) const {
Pt3D glb = m_tr*local;
#ifdef DebugLog
std::cout << "FlatTrd::Local " << local.x() << ":" << local.y() << ":"
<< local.z() << " Global " << glb.x() << ":" << glb.y() << ":"
<< glb.z() << std::endl;
#endif
return GlobalPoint(glb.x(),glb.y(),glb.z());
}

Pt3D FlatTrd::getLocal(const GlobalPoint& global) const {
Pt3D local = m_tr.inverse()*Pt3D(global.x(),global.y(),global.z());
#ifdef DebugLog
std::cout << "FlatTrd::Global " << global.x() << ":" << global.y() << ":"
<< global.z() << " Local " << local.x() << ":" << local.y() << ":"
<< local.z() << std::endl;
#endif
return local;
}

Expand Down
7 changes: 7 additions & 0 deletions Geometry/CaloTopology/interface/HGCalTopology.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
#include "DataFormats/ForwardDetId/interface/HGCEEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCHEDetId.h"
#include "DataFormats/ForwardDetId/interface/HGCalDetId.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h"
#include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
#include <vector>
#include <iostream>

Expand Down Expand Up @@ -82,6 +84,9 @@ class HGCalTopology : public CaloSubdetectorTopology {
return vNeighborsDetId;
}

///Geometry mode
int geomMode() const {return hdcons_.geomMode();}

///Dense indexing
virtual uint32_t detId2denseId(const DetId& id) const;
virtual DetId denseId2detId(uint32_t denseId) const;
Expand All @@ -93,6 +98,7 @@ class HGCalTopology : public CaloSubdetectorTopology {

unsigned int totalModules() const {return kSizeForDenseIndexing;}
unsigned int totalGeomModules() const {return (unsigned int)(2*kHGeomHalf_);}
unsigned int allGeomModules() const;

const HGCalDDDConstants& dddConstants () const {return hdcons_;}

Expand All @@ -101,6 +107,7 @@ class HGCalTopology : public CaloSubdetectorTopology {
DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY) const;
DetId switchZSide(const DetId startId) const;

/// Use subSector in square mode as wafer type in hexagon mode
static const int subSectors_ = 2;

struct DecodedDetId {
Expand Down
Loading