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 HcalDigiParam_cfi::zside.

21 {}

Member Function Documentation

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

Definition at line 197 of file RecHitTools.cc.

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

197  {
198  if( id.det() != DetId::Forward ) {
199  edm::LogError("getCell::InvalidSiliconDetid")
200  << "det id: " << id.rawId() << " is not HGCal silicon!";
202  }
203  const HGCalDetId hid(id);
204  unsigned int cell = hid.cell();
205  return cell;
206 }
float RecHitTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

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

220  {
221  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
222  return corrected_position.eta();
223 }
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 225 of file RecHitTools.cc.

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

225  {
227  float eta = getEta(position, vertex_z);
228  return eta;
229 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:220
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(), 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:45
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:55
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 131 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().

131  {
132 
133  int layer;
134  switch (type) {
137  layer = (geomEE->topology().dddConstants()).layers(true);
138  break;
139  }
142  layer = (geomFH->topology().dddConstants()).layers(true);
143  break;
144  }
147  layer = (geomBH->topology().dddConstants())->getMaxDepth(1);
148  break;
149  }
152  layer = (geomEE->topology().dddConstants()).layers(true);
154  layer += (geomFH->topology().dddConstants()).layers(true);
156  layer += (geomBH->topology().dddConstants())->getMaxDepth(1);
157  break;
158  }
159  default: layer = 0;
160  }
161  return (unsigned int)(layer);
162 }
type
Definition: HCALResponse.h:21
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
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 164 of file RecHitTools.cc.

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

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

Definition at line 176 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(), and HGCalImagingAlgo::populate().

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

Definition at line 231 of file RecHitTools.cc.

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

231  {
232  float phi = atan2(position.y(),position.x());
233  return phi;
234 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float RecHitTools::getPhi ( const DetId id) const

Definition at line 236 of file RecHitTools.cc.

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

236  {
238  float phi = atan2(position.y(),position.x());
239  return phi;
240 }
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(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, and position.

Referenced by HGCalShowerSeparation::analyze(), RealisticSimClusterMapper::buildClusters(), getEta(), getPhi(), getPt(), hgcal::ClusterTools::getWidths(), HGCalImagingAlgo::Hexel::Hexel(), PFHGCalRecHitCreator< DET, Layer, subdet >::importRecHits(), and HGCalImagingAlgo::populate().

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  const auto* hg = static_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:45
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 242 of file RecHitTools.cc.

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

242  {
243  float eta = getEta(position, vertex_z);
244  float pt = hitEnergy / cosh(eta);
245  return pt;
246 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:220
float RecHitTools::getPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 248 of file RecHitTools.cc.

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

248  {
250  float eta = getEta(position, vertex_z);
251  float pt = hitEnergy / cosh(eta);
252  return pt;
253 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:220
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 117 of file RecHitTools.cc.

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

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

Definition at line 103 of file RecHitTools.cc.

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

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

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

Definition at line 186 of file RecHitTools.cc.

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

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

186  {
187  if( id.det() != DetId::Forward ) {
188  edm::LogError("getWafer::InvalidSiliconDetid")
189  << "det id: " << id.rawId() << " is not HGCal silicon!";
191  }
192  const HGCalDetId hid(id);
193  unsigned int wafer = hid.wafer();
194  return wafer;
195 }
bool RecHitTools::isHalfCell ( const DetId id) const

Definition at line 208 of file RecHitTools.cc.

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

Referenced by HGCalImagingAlgo::populate().

208  {
209  if( id.det() != DetId::Forward ) {
210  return false;
211  }
212  auto geom = geom_->getSubdetectorGeometry(id);
213  check_geom(geom);
214  const HGCalDetId hid(id);
215  auto ddd = get_ddd(geom,hid);
216  const int waferType = ddd->waferTypeT(hid.waferType());
217  return ddd->isHalfCell(waferType,hid.cell());
218 }
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:56
unsigned int hgcal::RecHitTools::lastLayerEE ( ) const
inline

Definition at line 52 of file RecHitTools.h.

Referenced by RealisticSimClusterMapper::buildClusters().

52 {return fhOffset_;}
unsigned int fhOffset_
Definition: RecHitTools.h:57
unsigned int hgcal::RecHitTools::lastLayerFH ( ) const
inline

Definition at line 53 of file RecHitTools.h.

Referenced by RealisticSimClusterMapper::buildClusters().

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().