15#ifndef DETDESCR_ECALGEOMETRY_H_
16#define DETDESCR_ECALGEOMETRY_H_
21#include "Framework/Configure/Parameters.h"
22#include "Framework/Exception/Exception.h"
31class EcalGeometryProvider;
103 static constexpr const char* CONDITIONS_OBJECT_NAME{
"EcalGeometry"};
129 EcalID getID(
double x,
double y,
double z,
bool fallible =
false)
const;
150 EcalID getID(
double x,
double y,
int layer_id,
bool fallible =
false)
const;
175 EcalID getID(
double x,
double y,
int layer_id,
int module_id,
176 bool fallible =
false)
const;
242 auto list =
NNMap_.at(
EcalID(0,
id.module(),
id.cell()));
243 for (
auto& flat : list)
244 flat =
EcalID(
id.layer(), flat.module(), flat.cell());
256 for (
auto&
id :
getNN(centroid)) {
257 if (
id == probe)
return true;
270 for (
auto& flat : list)
271 flat =
EcalID(
id.layer(), flat.module(), flat.cell());
284 for (
auto&
id :
getNNN(centroid)) {
285 if (
id == probe)
return true;
477 bool isInside(
double normX,
double normY)
const;
603 std::map<EcalID, std::vector<EcalID>>
NNMap_;
610 std::map<EcalID, std::vector<EcalID>>
NNNMap_;
Base class for conditions information like pedestals, gains, electronics maps, etc.
Class that defines an ECal detector ID with a cell number.
Base class for all conditions objects, very simple.
Class encapsulating parameters for configuring a processor.
Translation between real-space positions and cell IDs within the ECal.
std::vector< EcalID > getNN(EcalID id) const
Get the Nearest Neighbors of the input ID.
std::map< EcalID, std::tuple< double, double, double > > cell_global_pos_
Position of cell centers relative to world geometry.
std::map< EcalID, std::vector< EcalID > > NNNMap_
Map of cell ID to neighbors of neighbor cells.
EcalID getID(double x, double y, double z, bool fallible=false) const
Get a cell's ID number from its position.
double getModuleMinR() const
Get the center-to-flat radius of the module hexagons.
std::tuple< double, double, double > getPosition(EcalID id) const
Get a cell's position from its ID number.
int getNumLayers() const
Get the number of layers in the Ecal Geometry.
double getZPosition(int layer) const
Get the z-coordinate given the layer id.
void buildCellModuleMap()
Constructs the positions of all the cells in a layer relative to the ecal center.
double layer_shift_y_
shift of layers in the y-direction [mm]
double distanceToEdge(EcalID id) const
Distance to module edge, and whether cell is on edge of module.
std::pair< double, double > getPositionInModule(int cell_id) const
Get a cell's position within a module.
std::map< int, std::pair< double, double > > module_pos_xy_
Postion of module centers relative to the center of the layer in world coordinates.
void buildCellMap()
Constructs the flat-bottomed hexagonal grid (cellID) of corner-down hexagonal cells.
double moduler_
Center-to-Flat Radius of module hexagon [mm].
double cellr_
Center-to-Flat Radius of cell hexagon [mm].
bool layer_shift_odd_
shift odd layers
int getNumModulesPerLayer() const
Get the number of modules in the Ecal flower.
std::vector< double > layerZPositions_
The layer Z postions are with respect to the front of the ECal [mm].
double nCellRHeight_
Number of cell center-to-corner radii (one side of the cell) from the bottom to the top of the module...
std::map< int, std::tuple< double, double, double > > layer_pos_xy_
Position of layer centers in world coordinates (uses layer ID as key)
int getNumCellsPerModule() const
Get the number of cells in each module of the Ecal Geometry.
double ecalFrontZ_
Front of ECal relative to world geometry [mm].
std::map< int, std::pair< double, double > > cell_pos_in_module_
Position of cell centers relative to center of module in p,q space.
double layer_shift_x_
shift of layers in the x-direction [mm]
std::vector< EcalID > getNNN(EcalID id) const
Get the Next-to-Nearest Neighbors of the input ID.
double cellR_
Center-to-Corner Radius of cell hexagon [mm].
double getModuleMaxR() const
Get the center-to-corner radius of the module hexagons.
void buildModuleMap()
Constructs the positions of the seven modules (moduleID) relative to the ecal center.
std::map< EcalID, std::pair< double, double > > cell_pos_in_layer_
Position of cell centers relative to center of layer in world coordinates.
bool isNNN(EcalID centroid, EcalID probe) const
Check if the probe id is one of the next-to-nearest neightbors of the centroid id.
double getCellMinR() const
Get the center-to-flat radius of the cell hexagons.
bool isInside(double normX, double normY) const
Determines if point (x,y), already normed to max hexagon radius, lies within a hexagon.
bool layer_shift_odd_bilayer_
shift odd bi layers
bool cornersSideUp_
indicator of geometry orientation if true, flower shape's corners side (ie: side with two modules) is...
void buildLayerMap()
Constructs the positions of the layers in world coordinates.
std::map< EcalID, std::vector< EcalID > > NNMap_
Map of cell ID to neighboring cells.
double moduleR_
Center-to-Corner Radius of module hexagon [mm].
double gap_
Gap between module flat sides [mm].
virtual ~EcalGeometry()=default
Class destructor.
TH2Poly cell_id_in_module_
Honeycomb Binning from ROOT.
bool isNN(EcalID centroid, EcalID probe) const
Check if the probe id is one of the nearest neightbors of the centroid id.
double getCellMaxR() const
Get the center-to-corner radius of the cell hexagons.
bool isEdgeCell(EcalID cellModuleID) const
Check if input cell is on the edge of a module.
void buildNeighborMaps()
Construts NNMap and NNNMap.
TH2Poly * getCellPolyMap() const
Get a reference to the TH2Poly used for Cell IDs.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.