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 (ForwardSubdetector type) 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
 
unsigned int lastLayerEE () const
 
unsigned int lastLayerFH () const
 
unsigned int maxNumberOfWafersPerLayer () const
 
 RecHitTools ()
 
int zside (const DetId &id) const
 
 ~RecHitTools ()
 

Private Attributes

unsigned int bhOffset_
 
unsigned int fhOffset_
 
const CaloGeometrygeom_
 
unsigned int maxNumberOfWafersPerLayer_
 

Detailed Description

Definition at line 18 of file RecHitTools.h.

Constructor & Destructor Documentation

hgcal::RecHitTools::RecHitTools ( )
inline

Definition at line 20 of file RecHitTools.h.

20 : geom_(nullptr), fhOffset_(0), bhOffset_(0) {}
unsigned int fhOffset_
Definition: RecHitTools.h:57
unsigned int bhOffset_
Definition: RecHitTools.h:57
const CaloGeometry * geom_
Definition: RecHitTools.h:56
hgcal::RecHitTools::~RecHitTools ( )
inline

Definition at line 21 of file RecHitTools.h.

References position, and ecaldqm::zside().

21 {}

Member Function Documentation

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

Definition at line 201 of file RecHitTools.cc.

References HGCalDetId::cell(), TauDecayModes::dec, DetId::Forward, and SiStripPI::max.

201  {
202  if( id.det() != DetId::Forward ) {
203  edm::LogError("getCell::InvalidSiliconDetid")
204  << "det id: " << std::hex << id.rawId() << std::dec << ":"
205  << id.det() << " is not HGCal silicon!";
207  }
208  const HGCalDetId hid(id);
209  unsigned int cell = hid.cell();
210  return cell;
211 }
float RecHitTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 225 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(), getPt(), and HGCalIsoCalculator::setRecHits().

225  {
226  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
227  return corrected_position.eta();
228 }
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 230 of file RecHitTools.cc.

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

230  {
232  float eta = getEta(position, vertex_z);
233  return eta;
234 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:225
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:77
static int position[264][3]
Definition: ReadPGInfo.cc:509
void RecHitTools::getEvent ( const edm::Event ev)

Definition at line 58 of file RecHitTools.cc.

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

58  {
59 }
void RecHitTools::getEventSetup ( const edm::EventSetup es)

Definition at line 61 of file RecHitTools.cc.

References bhOffset_, fhOffset_, DetId::Forward, relativeConstraints::geom, geom_, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), HGCEE, HGCHEF, LayerTriplets::layers(), SiStripPI::max, maxNumberOfWafersPerLayer_, and edm::ESHandle< T >::product().

Referenced by HGCalHitCalibration::analyze(), HGCalShowerSeparation::analyze(), HGCalEgammaIDHelper::eventInit(), hgcal::ClusterTools::getEventSetup(), HGCal3DClustering::getEventSetup(), HGCalImagingAlgo::getEventSetup(), PFHGCalRecHitCreator< DET, Layer, subdet >::importRecHits(), and RealisticSimClusterMapper::update().

61  {
62 
64  es.get<CaloGeometryRecord>().get(geom);
65 
66  geom_ = geom.product();
68  fhOffset_ = (geomEE->topology().dddConstants()).layers(true);
69  unsigned int wmaxEE = 1 + (geomEE->topology().dddConstants()).waferMax();
71  bhOffset_ = fhOffset_ + (geomFH->topology().dddConstants()).layers(true);
72  unsigned int wmaxFH = 1 + (geomFH->topology().dddConstants()).waferMax();
73  maxNumberOfWafersPerLayer_ = std::max(wmaxEE,wmaxFH);
74 
75 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
unsigned int fhOffset_
Definition: RecHitTools.h:57
unsigned int bhOffset_
Definition: RecHitTools.h:57
unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:57
const CaloGeometry * geom_
Definition: RecHitTools.h:56
const T & get() const
Definition: EventSetup.h:59
T const * product() const
Definition: ESHandle.h:86
const CaloGeometry* hgcal::RecHitTools::getGeometry ( ) const
inline

Definition at line 51 of file RecHitTools.h.

Referenced by HGCalImagingAlgo::computeThreshold().

51 {return geom_;};
const CaloGeometry * geom_
Definition: RecHitTools.h:56
unsigned int RecHitTools::getLayer ( ForwardSubdetector  type) const

Definition at line 134 of file RecHitTools.cc.

References DetId::Forward, ForwardEmpty, geom_, CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalEndcap, HGCEE, HGCHEB, HGCHEF, and LayerTriplets::layers().

Referenced by RealisticSimClusterMapper::buildClusters(), and getLayerWithOffset().

134  {
135 
136  int layer;
137  switch (type) {
140  layer = (geomEE->topology().dddConstants()).layers(true);
141  break;
142  }
145  layer = (geomFH->topology().dddConstants()).layers(true);
146  break;
147  }
150  layer = (geomBH->topology().dddConstants())->getMaxDepth(1);
151  break;
152  }
155  layer = (geomEE->topology().dddConstants()).layers(true);
157  layer += (geomFH->topology().dddConstants()).layers(true);
159  layer += (geomBH->topology().dddConstants())->getMaxDepth(1);
160  break;
161  }
162  default: layer = 0;
163  }
164  return (unsigned int)(layer);
165 }
type
Definition: HCALResponse.h:21
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const CaloGeometry * geom_
Definition: RecHitTools.h:56
unsigned int RecHitTools::getLayer ( const DetId id) const

Definition at line 167 of file RecHitTools.cc.

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

167  {
168  unsigned int layer = std::numeric_limits<unsigned int>::max();
169  if( id.det() == DetId::Forward) {
170  const HGCalDetId hid(id);
171  layer = hid.layer();
172  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
173  const HcalDetId hcid(id);
174  layer = hcid.depth();
175  }
176  return layer;
177 }
unsigned int RecHitTools::getLayerWithOffset ( const DetId id) const

Definition at line 179 of file RecHitTools.cc.

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

Referenced by HGCalHitCalibration::analyze(), HGCalShowerSeparation::analyze(), RealisticSimClusterMapper::buildClusters(), HGCalImagingAlgo::computeThreshold(), HGCalHitCalibration::fillWithRecHits(), hgcal::ClusterTools::getLayer(), HGCal3DClustering::organizeByLayer(), HGCalImagingAlgo::populate(), HGCalIsoCalculator::produceHGCalIso(), and hgcal::EGammaPCAHelper::storeRecHits().

179  {
180  unsigned int layer = getLayer(id);
181  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
182  layer += fhOffset_;
183  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
184  layer += bhOffset_;
185  }
186  return layer;
187 }
unsigned int fhOffset_
Definition: RecHitTools.h:57
unsigned int bhOffset_
Definition: RecHitTools.h:57
unsigned int getLayer(ForwardSubdetector type) const
Definition: RecHitTools.cc:134
float RecHitTools::getPhi ( const GlobalPoint position) const

Definition at line 236 of file RecHitTools.cc.

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

Referenced by HGCalIsoCalculator::setRecHits().

236  {
237  float phi = atan2(position.y(),position.x());
238  return phi;
239 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float RecHitTools::getPhi ( const DetId id) const

Definition at line 241 of file RecHitTools.cc.

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

241  {
243  float phi = atan2(position.y(),position.x());
244  return phi;
245 }
T y() const
Definition: PV3DBase.h:63
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:77
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 77 of file RecHitTools.cc.

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

Referenced by HGCalShowerSeparation::analyze(), RealisticSimClusterMapper::buildClusters(), hgcal::EGammaPCAHelper::findZFirstLayer(), getEta(), getPhi(), getPt(), hgcal::ClusterTools::getWidths(), HGCalImagingAlgo::Hexel::Hexel(), HGCalImagingAlgo::populate(), HGCalIsoCalculator::setRecHits(), and hgcal::EGammaPCAHelper::storeRecHits().

77  {
78  auto geom = geom_->getSubdetectorGeometry(id);
79  check_geom(geom);
81  if( id.det() == DetId::Hcal ) {
82  position = geom->getGeometry(id)->getPosition();
83  } else {
84  auto hg = dynamic_cast<const HGCalGeometry*>(geom);
85  position = hg->getPosition(id);
86  }
87  return position;
88 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
const CaloGeometry * geom_
Definition: RecHitTools.h:56
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 247 of file RecHitTools.cc.

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

247  {
248  float eta = getEta(position, vertex_z);
249  float pt = hitEnergy / cosh(eta);
250  return pt;
251 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:225
float RecHitTools::getPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 253 of file RecHitTools.cc.

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

253  {
255  float eta = getEta(position, vertex_z);
256  float pt = hitEnergy / cosh(eta);
257  return pt;
258 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:225
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:77
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::float_t RecHitTools::getRadiusToSide ( const DetId id) const

Definition at line 119 of file RecHitTools.cc.

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

119  {
120  auto geom = geom_->getSubdetectorGeometry(id);
121  check_geom(geom);
122  if( id.det() != DetId::Forward ) {
123  edm::LogError("getRadiusToSide::InvalidSiliconDetid")
124  << "det id: " << std::hex << id.rawId() << std::dec << ":"
125  << id.det() << " is not HGCal silicon!";
127  }
128  const HGCalDetId hid(id);
129  auto ddd = get_ddd(geom,hid);
130  std::float_t size = ddd->cellSizeHex(hid.waferType());
131  return size;
132 }
size
Write out results.
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
const CaloGeometry * geom_
Definition: RecHitTools.h:56
std::float_t RecHitTools::getSiThickness ( const DetId id) const

Definition at line 103 of file RecHitTools.cc.

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

Referenced by HGCalHitCalibration::analyze(), HGCalImagingAlgo::computeThreshold(), HGCalHitCalibration::fillWithRecHits(), HGCalImagingAlgo::populate(), and hgcal::EGammaPCAHelper::storeRecHits().

103  {
104  auto geom = geom_->getSubdetectorGeometry(id);
105  check_geom(geom);
106  if( id.det() != DetId::Forward ) {
107  LogDebug("getSiThickness::InvalidSiliconDetid")
108  << "det id: " << std::hex << id.rawId() << std::dec << ":"
109  << id.det() << " is not HGCal silicon!";
110  return 0.37;
111  }
112  const HGCalDetId hid(id);
113  auto ddd = get_ddd(geom,hid);
114  unsigned int wafer = hid.wafer();
115  int tidx = ddd->waferTypeL(wafer);
116  return idx_to_thickness*tidx;
117 }
#define LogDebug(id)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
const CaloGeometry * geom_
Definition: RecHitTools.h:56
unsigned int RecHitTools::getWafer ( const DetId id) const

Definition at line 189 of file RecHitTools.cc.

References TauDecayModes::dec, DetId::Forward, SiStripPI::max, and HGCalDetId::wafer().

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

189  {
190  if( id.det() != DetId::Forward ) {
191  edm::LogError("getWafer::InvalidSiliconDetid")
192  << "det id: " << std::hex << id.rawId() << std::dec << ":"
193  << id.det() << " is not HGCal silicon!";
195  }
196  const HGCalDetId hid(id);
197  unsigned int wafer = hid.wafer();
198  return wafer;
199 }
bool RecHitTools::isHalfCell ( const DetId id) const

Definition at line 213 of file RecHitTools.cc.

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

Referenced by HGCalImagingAlgo::populate().

213  {
214  if( id.det() != DetId::Forward ) {
215  return false;
216  }
217  auto geom = geom_->getSubdetectorGeometry(id);
218  check_geom(geom);
219  const HGCalDetId hid(id);
220  auto ddd = get_ddd(geom,hid);
221  const int waferType = ddd->waferTypeT(hid.waferType());
222  return ddd->isHalfCell(waferType,hid.cell());
223 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
const CaloGeometry * geom_
Definition: RecHitTools.h:56
unsigned int hgcal::RecHitTools::lastLayerEE ( ) const
inline
unsigned int hgcal::RecHitTools::lastLayerFH ( ) const
inline

Definition at line 53 of file RecHitTools.h.

Referenced by RealisticSimClusterMapper::buildClusters(), and hgcal::EGammaPCAHelper::findZFirstLayer().

53 {return bhOffset_;}
unsigned int bhOffset_
Definition: RecHitTools.h:57
unsigned int hgcal::RecHitTools::maxNumberOfWafersPerLayer ( ) const
inline

Definition at line 54 of file RecHitTools.h.

unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:57
int RecHitTools::zside ( const DetId id) const

Definition at line 91 of file RecHitTools.cc.

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

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

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

Member Data Documentation

unsigned int hgcal::RecHitTools::bhOffset_
private

Definition at line 57 of file RecHitTools.h.

Referenced by getEventSetup(), and getLayerWithOffset().

unsigned int hgcal::RecHitTools::fhOffset_
private

Definition at line 57 of file RecHitTools.h.

Referenced by getEventSetup(), and getLayerWithOffset().

const CaloGeometry* hgcal::RecHitTools::geom_
private
unsigned int hgcal::RecHitTools::maxNumberOfWafersPerLayer_
private

Definition at line 57 of file RecHitTools.h.

Referenced by getEventSetup().