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 &)
 
const CaloGeometrygetGeometry () const
 
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 ()
 
int zside (const DetId &id) const
 
 ~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:49
hgcal::RecHitTools::~RecHitTools ( )
inline

Definition at line 20 of file RecHitTools.h.

References getEta(), position, and HcalDigiParam_cfi::zside.

20 {}

Member Function Documentation

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

Definition at line 160 of file RecHitTools.cc.

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

160  {
161  if( id.det() != DetId::Forward ) {
162  edm::LogError("getCell::InvalidSiliconDetid")
163  << "det id: " << id.rawId() << " is not HGCal silicon!";
165  }
166  const HGCalDetId hid(id);
167  unsigned int cell = hid.cell();
168  return cell;
169 }
float RecHitTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 183 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().

183  {
184  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
185  return corrected_position.eta();
186 }
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 188 of file RecHitTools.cc.

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

188  {
190  float eta = getEta(position, vertex_z);
191  return eta;
192 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:183
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)
const CaloGeometry* hgcal::RecHitTools::getGeometry ( ) const
inline

Definition at line 49 of file RecHitTools.h.

Referenced by HGCalImagingAlgo::computeThreshold().

49 {return geom_;};
const CaloGeometry * geom_
Definition: RecHitTools.h:49
unsigned int RecHitTools::getLayer ( const DetId id) const

Definition at line 127 of file RecHitTools.cc.

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

Referenced by getLayerWithOffset().

127  {
128  unsigned int layer = std::numeric_limits<unsigned int>::max();
129  if( id.det() == DetId::Forward) {
130  const HGCalDetId hid(id);
131  layer = hid.layer();
132  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
133  const HcalDetId hcid(id);
134  layer = hcid.depth();
135  }
136  return layer;
137 }
unsigned int RecHitTools::getLayerWithOffset ( const DetId id) const

Definition at line 139 of file RecHitTools.cc.

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

Referenced by HGCalHitCalibration::analyze(), HGCalImagingAlgo::computeThreshold(), hgcal::ClusterTools::getLayer(), HGCal3DClustering::organizeByLayer(), and HGCalImagingAlgo::populate().

139  {
140  unsigned int layer = getLayer(id);
141  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
142  layer += fhOffset;
143  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
144  layer += bhOffset;
145  }
146  return layer;
147 }
unsigned int getLayer(const DetId &) const
Definition: RecHitTools.cc:127
float RecHitTools::getPhi ( const GlobalPoint position) const

Definition at line 194 of file RecHitTools.cc.

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

194  {
195  float phi = atan2(position.y(),position.x());
196  return phi;
197 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float RecHitTools::getPhi ( const DetId id) const

Definition at line 199 of file RecHitTools.cc.

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

199  {
201  float phi = atan2(position.y(),position.x());
202  return phi;
203 }
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(), hgcal::ClusterTools::getWidths(), HGCalImagingAlgo::Hexel::Hexel(), and HGCalImagingAlgo::populate().

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:49
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 205 of file RecHitTools.cc.

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

205  {
206  float eta = getEta(position, vertex_z);
207  float pt = hitEnergy / cosh(eta);
208  return pt;
209 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:183
float RecHitTools::getPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 211 of file RecHitTools.cc.

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

211  {
213  float eta = getEta(position, vertex_z);
214  float pt = hitEnergy / cosh(eta);
215  return pt;
216 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:183
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 113 of file RecHitTools.cc.

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

113  {
114  auto geom = geom_->getSubdetectorGeometry(id);
115  check_geom(geom);
116  if( id.det() != DetId::Forward ) {
117  edm::LogError("getRadiusToSide::InvalidSiliconDetid")
118  << "det id: " << id.rawId() << " is not HGCal silicon!";
120  }
121  const HGCalDetId hid(id);
122  auto ddd = get_ddd(geom,hid);
123  std::float_t size = ddd->cellSizeHex(hid.waferType());
124  return size;
125 }
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:49
std::float_t RecHitTools::getSiThickness ( const DetId id) const

Definition at line 99 of file RecHitTools.cc.

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

Referenced by HGCalHitCalibration::analyze(), HGCalImagingAlgo::computeThreshold(), and HGCalImagingAlgo::populate().

99  {
100  auto geom = geom_->getSubdetectorGeometry(id);
101  check_geom(geom);
102  if( id.det() != DetId::Forward ) {
103  edm::LogError("getSiThickness::InvalidSiliconDetid")
104  << "det id: " << id.rawId() << " is not HGCal silicon!";
105  }
106  const HGCalDetId hid(id);
107  auto ddd = get_ddd(geom,hid);
108  unsigned int wafer = hid.wafer();
109  int tidx = ddd->waferTypeL(wafer);
110  return idx_to_thickness*tidx;
111 }
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:49
unsigned int RecHitTools::getWafer ( const DetId id) const

Definition at line 149 of file RecHitTools.cc.

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

Referenced by HGCalImagingAlgo::computeThreshold(), and HGCalImagingAlgo::populate().

149  {
150  if( id.det() != DetId::Forward ) {
151  edm::LogError("getWafer::InvalidSiliconDetid")
152  << "det id: " << id.rawId() << " is not HGCal silicon!";
154  }
155  const HGCalDetId hid(id);
156  unsigned int wafer = hid.wafer();
157  return wafer;
158 }
bool RecHitTools::isHalfCell ( const DetId id) const

Definition at line 171 of file RecHitTools.cc.

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

Referenced by HGCalImagingAlgo::populate().

171  {
172  if( id.det() != DetId::Forward ) {
173  return false;
174  }
175  auto geom = geom_->getSubdetectorGeometry(id);
176  check_geom(geom);
177  const HGCalDetId hid(id);
178  auto ddd = get_ddd(geom,hid);
179  const int waferType = ddd->waferTypeT(hid.waferType());
180  return ddd->isHalfCell(waferType,hid.cell());
181 }
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:49
int RecHitTools::zside ( const DetId id) const

Definition at line 87 of file RecHitTools.cc.

References DetId::Forward, DetId::Hcal, HcalEndcap, HGCalDetId::zside(), and HcalDetId::zside().

Referenced by HGCalImagingAlgo::computeThreshold(), and HGCalImagingAlgo::populate().

87  {
88  int zside = 0;
89  if( id.det() == DetId::Forward) {
90  const HGCalDetId hid(id);
91  zside = hid.zside();
92  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
93  const HcalDetId hcid(id);
94  zside = hcid.zside();
95  }
96  return zside;
97 }
int zside(const DetId &id) const
Definition: RecHitTools.cc:87

Member Data Documentation

const CaloGeometry* hgcal::RecHitTools::geom_
private

Definition at line 49 of file RecHitTools.h.

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