CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
hgcal::RecHitTools Class Reference

#include <RecHitTools.h>

Public Member Functions

unsigned int getCell (const DetId &) const
 
float getEta (const GlobalPoint &position, const float &vertex_z=0.) const
 
float getEta (const DetId &id, const float &vertex_z=0.) const
 
void getEvent (const edm::Event &)
 
void getEventSetup (const edm::EventSetup &)
 
unsigned int getLayer (const DetId &) const
 
unsigned int getLayerWithOffset (const DetId &) const
 
float getPhi (const GlobalPoint &position) const
 
float getPhi (const DetId &id) const
 
GlobalPoint getPosition (const DetId &id) const
 
float getPt (const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
 
float getPt (const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
 
std::float_t getRadiusToSide (const DetId &) const
 
std::float_t getSiThickness (const DetId &) const
 
unsigned int getWafer (const DetId &) const
 
bool isHalfCell (const DetId &) const
 
 RecHitTools ()
 
 ~RecHitTools ()
 

Private Attributes

const CaloGeometrygeom_
 

Detailed Description

Definition at line 17 of file RecHitTools.h.

Constructor & Destructor Documentation

hgcal::RecHitTools::RecHitTools ( )
inline

Definition at line 19 of file RecHitTools.h.

19 : geom_(nullptr) {}
const CaloGeometry * geom_
Definition: RecHitTools.h:48
hgcal::RecHitTools::~RecHitTools ( )
inline

Definition at line 20 of file RecHitTools.h.

References getEta(), and position.

20 {}

Member Function Documentation

unsigned int RecHitTools::getCell ( const DetId id) const

Definition at line 147 of file RecHitTools.cc.

References HGCalDetId::cell(), DetId::Forward, and hpstanc_transforms::max.

147  {
148  if( id.det() != DetId::Forward ) {
149  edm::LogError("getCell::InvalidSiliconDetid")
150  << "det id: " << id.rawId() << " is not HGCal silicon!";
152  }
153  const HGCalDetId hid(id);
154  unsigned int cell = hid.cell();
155  return cell;
156 }
float RecHitTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 170 of file RecHitTools.cc.

References PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getEta(), and getPt().

170  {
171  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
172  return corrected_position.eta();
173 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
T eta() const
Definition: PV3DBase.h:76
T x() const
Definition: PV3DBase.h:62
float RecHitTools::getEta ( const DetId id,
const float &  vertex_z = 0. 
) const

Definition at line 175 of file RecHitTools.cc.

References stringResolutionProvider_cfi::eta, getEta(), getPosition(), and position.

175  {
177  float eta = getEta(position, vertex_z);
178  return eta;
179 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:170
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:73
static int position[264][3]
Definition: ReadPGInfo.cc:509
void RecHitTools::getEvent ( const edm::Event ev)

Definition at line 63 of file RecHitTools.cc.

Referenced by hgcal::ClusterTools::getEvent().

63  {
64 }
void RecHitTools::getEventSetup ( const edm::EventSetup es)
unsigned int RecHitTools::getLayer ( const DetId id) const

Definition at line 114 of file RecHitTools.cc.

References HcalDetId::depth(), DetId::Forward, DetId::Hcal, HcalEndcap, HGCalDetId::layer(), and hpstanc_transforms::max.

Referenced by getLayerWithOffset().

114  {
115  unsigned int layer = std::numeric_limits<unsigned int>::max();
116  if( id.det() == DetId::Forward) {
117  const HGCalDetId hid(id);
118  layer = hid.layer();
119  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
120  const HcalDetId hcid(id);
121  layer = hcid.depth();
122  }
123  return layer;
124 }
unsigned int RecHitTools::getLayerWithOffset ( const DetId id) const

Definition at line 126 of file RecHitTools.cc.

References DetId::Forward, getLayer(), DetId::Hcal, HcalEndcap, and HGCHEF.

Referenced by HGCalHitCalibration::analyze(), and HGCalImagingAlgo::makeClusters().

126  {
127  unsigned int layer = getLayer(id);
128  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
129  layer += fhOffset;
130  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
131  layer += bhOffset;
132  }
133  return layer;
134 }
unsigned int getLayer(const DetId &) const
Definition: RecHitTools.cc:114
float RecHitTools::getPhi ( const GlobalPoint position) const

Definition at line 181 of file RecHitTools.cc.

References PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

181  {
182  float phi = atan2(position.y(),position.x());
183  return phi;
184 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float RecHitTools::getPhi ( const DetId id) const

Definition at line 186 of file RecHitTools.cc.

References getPosition(), position, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

186  {
188  float phi = atan2(position.y(),position.x());
189  return phi;
190 }
T y() const
Definition: PV3DBase.h:63
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:73
static int position[264][3]
Definition: ReadPGInfo.cc:509
T x() const
Definition: PV3DBase.h:62
GlobalPoint RecHitTools::getPosition ( const DetId id) const

Definition at line 73 of file RecHitTools.cc.

References relativeConstraints::geom, geom_, CaloSubdetectorGeometry::getGeometry(), HGCalGeometry::getPosition(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, and position.

Referenced by getEta(), getPhi(), getPt(), HGCalImagingAlgo::Hexel::Hexel(), and HGCalImagingAlgo::makeClusters().

73  {
74  auto geom = geom_->getSubdetectorGeometry(id);
75  check_geom(geom);
77  if( id.det() == DetId::Hcal ) {
78  position = geom->getGeometry(id)->getPosition();
79  } else {
80  const auto* hg = static_cast<const HGCalGeometry*>(geom);
81  position = hg->getPosition(id);
82  }
83  return position;
84 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const CaloGeometry * geom_
Definition: RecHitTools.h:48
static int position[264][3]
Definition: ReadPGInfo.cc:509
float RecHitTools::getPt ( const GlobalPoint position,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 192 of file RecHitTools.cc.

References stringResolutionProvider_cfi::eta, getEta(), and EnergyCorrector::pt.

192  {
193  float eta = getEta(position, vertex_z);
194  float pt = hitEnergy / cosh(eta);
195  return pt;
196 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:170
float RecHitTools::getPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 198 of file RecHitTools.cc.

References stringResolutionProvider_cfi::eta, getEta(), getPosition(), position, and EnergyCorrector::pt.

198  {
200  float eta = getEta(position, vertex_z);
201  float pt = hitEnergy / cosh(eta);
202  return pt;
203 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:170
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:73
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::float_t RecHitTools::getRadiusToSide ( const DetId id) const

Definition at line 100 of file RecHitTools.cc.

References HGCalDDDConstants::cellSizeHex(), DetId::Forward, geom_, CaloGeometry::getSubdetectorGeometry(), hpstanc_transforms::max, findQualityFiles::size, and HGCalDetId::waferType().

100  {
101  auto geom = geom_->getSubdetectorGeometry(id);
102  check_geom(geom);
103  if( id.det() != DetId::Forward ) {
104  edm::LogError("getRadiusToSide::InvalidSiliconDetid")
105  << "det id: " << id.rawId() << " is not HGCal silicon!";
107  }
108  const HGCalDetId hid(id);
109  auto ddd = get_ddd(geom,hid);
110  std::float_t size = ddd->cellSizeHex(hid.waferType());
111  return size;
112 }
size
Write out results.
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const CaloGeometry * geom_
Definition: RecHitTools.h:48
std::float_t RecHitTools::getSiThickness ( const DetId id) const

Definition at line 86 of file RecHitTools.cc.

References DetId::Forward, geom_, CaloGeometry::getSubdetectorGeometry(), HGCalDetId::wafer(), and HGCalDDDConstants::waferTypeL().

Referenced by HGCalHitCalibration::analyze().

86  {
87  auto geom = geom_->getSubdetectorGeometry(id);
88  check_geom(geom);
89  if( id.det() != DetId::Forward ) {
90  edm::LogError("getSiThickness::InvalidSiliconDetid")
91  << "det id: " << id.rawId() << " is not HGCal silicon!";
92  }
93  const HGCalDetId hid(id);
94  auto ddd = get_ddd(geom,hid);
95  unsigned int wafer = hid.wafer();
96  int tidx = ddd->waferTypeL(wafer);
97  return idx_to_thickness*tidx;
98 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const CaloGeometry * geom_
Definition: RecHitTools.h:48
unsigned int RecHitTools::getWafer ( const DetId id) const

Definition at line 136 of file RecHitTools.cc.

References DetId::Forward, hpstanc_transforms::max, and HGCalDetId::wafer().

136  {
137  if( id.det() != DetId::Forward ) {
138  edm::LogError("getWafer::InvalidSiliconDetid")
139  << "det id: " << id.rawId() << " is not HGCal silicon!";
141  }
142  const HGCalDetId hid(id);
143  unsigned int wafer = hid.wafer();
144  return wafer;
145 }
bool RecHitTools::isHalfCell ( const DetId id) const

Definition at line 158 of file RecHitTools.cc.

References HGCalDetId::cell(), DetId::Forward, geom_, CaloGeometry::getSubdetectorGeometry(), HGCalDDDConstants::isHalfCell(), HGCalDetId::waferType(), and HGCalDDDConstants::waferTypeT().

Referenced by HGCalImagingAlgo::makeClusters().

158  {
159  if( id.det() != DetId::Forward ) {
160  return false;
161  }
162  auto geom = geom_->getSubdetectorGeometry(id);
163  check_geom(geom);
164  const HGCalDetId hid(id);
165  auto ddd = get_ddd(geom,hid);
166  const int waferType = ddd->waferTypeT(hid.waferType());
167  return ddd->isHalfCell(waferType,hid.cell());
168 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const CaloGeometry * geom_
Definition: RecHitTools.h:48

Member Data Documentation

const CaloGeometry* hgcal::RecHitTools::geom_
private

Definition at line 48 of file RecHitTools.h.

Referenced by getEventSetup(), getPosition(), getRadiusToSide(), getSiThickness(), and isHalfCell().