15#ifndef DETDESCR_ECALGEOMETRY_H_
16#define DETDESCR_ECALGEOMETRY_H_
27#include "Framework/Configure/Parameters.h"
28#include "Framework/Exception/Exception.h"
29#include "Framework/Logger.h"
32#include "TGeoPolygon.h"
38class EcalGeometryProvider;
110 static constexpr const char* CONDITIONS_OBJECT_NAME{
"EcalGeometry"};
136 EcalID getID(
double x,
double y,
double z,
bool fallible =
false)
const;
157 EcalID getID(
double x,
double y,
int layer_id,
bool fallible =
false)
const;
182 EcalID getID(
double x,
double y,
int layer_id,
int module_id,
183 bool fallible =
false)
const;
256 for (
auto& flat : list)
257 flat =
EcalID(
id.layer(), flat.module(), flat.cell());
269 for (
auto&
id :
getNN(centroid)) {
270 if (
id == probe)
return true;
283 for (
auto& flat : list)
284 flat =
EcalID(
id.layer(), flat.module(), flat.cell());
297 for (
auto&
id :
getNNN(centroid)) {
298 if (
id == probe)
return true;
490 bool isInside(
double normX,
double normY)
const;
621 std::map<EcalID, std::vector<EcalID>>
nn_map_;
640 enableLogging(
"EcalGeometry")
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 > > nnn_map_
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.
double getEcalFrontZ() const
Get the z-coordinate of the Ecal face.
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.
bool layer_shift_odd_
shift odd layers
int getNumModulesPerLayer() const
Get the number of modules in the Ecal flower.
double module_r_max_
Center-to-Corner Radius of module hexagon [mm].
double cell_r_min_
Center-to-Flat Radius of cell hexagon [mm].
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 n_cell_r_height_
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::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 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.
std::map< EcalID, std::vector< EcalID > > nn_map_
Map of cell ID to neighboring cells.
std::vector< double > layer_z_positions_
The layer Z postions are with respect to the front of the ECal [mm].
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.
double si_thickness_
Thickness of the Si sensitive layer [mm].
bool layer_shift_odd_bilayer_
shift odd bi layers
void buildLayerMap()
Constructs the positions of the layers in world coordinates.
EcalGeometry(const framework::config::Parameters &ps)
Class constructor, for use only by the provider.
double cell_r_max_
Center-to-Corner Radius of cell hexagon [mm].
double ecal_front_z_
Front of ECal relative to world geometry [mm].
double gap_
Gap between module flat sides [mm].
virtual ~EcalGeometry()=default
Class destructor.
double module_r_min_
Center-to-Flat Radius of module hexagon [mm].
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.
bool corners_side_up_
indicator of geometry orientation if true, flower shape's corners side (ie: side with two modules) is...
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.