CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalTriggerTools Class Reference

#include <HGCalTriggerTools.h>

Public Member Functions

void eventSetup (const edm::EventSetup &)
 
float getEta (const GlobalPoint &position, const float &vertex_z=0.) const
 
float getLayerZ (const unsigned &layerWithOffset) const
 
float getLayerZ (const int &subdet, const unsigned &layer) const
 
float getPhi (const GlobalPoint &position) const
 
float getPt (const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
 
float getTCEta (const DetId &id, const float &vertex_z=0.) const
 
float getTCPhi (const DetId &id) const
 
GlobalPoint getTCPosition (const DetId &id) const
 
float getTCPt (const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
 
const HGCalTriggerGeometryBasegetTriggerGeometry () const
 
 HGCalTriggerTools ()
 
unsigned lastLayerBH () const
 
unsigned lastLayerEE () const
 
unsigned lastLayerFH () const
 
unsigned layer (const DetId &) const
 
unsigned layers (ForwardSubdetector type) const
 
unsigned layerWithOffset (const DetId &) const
 
 ~HGCalTriggerTools ()
 

Private Attributes

unsigned bhLayers_
 
unsigned eeLayers_
 
unsigned fhLayers_
 
const HGCalTriggerGeometryBasegeom_
 
unsigned totalLayers_
 

Detailed Description

Tools for handling HGCal trigger det-ID: in the current version of trhe HGCAL simulation only HGCalDetId for the TriggerCells (TC) are used and not HcalDetId as in the offline! As a consequence the class assumes that only DetIds of the first kind are used in the getTC* methods NOTE: this uses the trigger geometry hence would give wrong results when used for offline reco!!!!

Author
G. Cerminara (CERN), heavily "inspired" by HGCalRechHitTools ;)

Definition at line 30 of file HGCalTriggerTools.h.

Constructor & Destructor Documentation

HGCalTriggerTools::HGCalTriggerTools ( )
inline

Definition at line 32 of file HGCalTriggerTools.h.

32  : geom_(nullptr),
33  eeLayers_(0), fhLayers_(0), bhLayers_(0), totalLayers_(0){}
const HGCalTriggerGeometryBase * geom_
HGCalTriggerTools::~HGCalTriggerTools ( )
inline

Definition at line 34 of file HGCalTriggerTools.h.

References LayerTriplets::layers().

34 {}

Member Function Documentation

void HGCalTriggerTools::eventSetup ( const edm::EventSetup es)

Definition at line 59 of file HGCalTriggerTools.cc.

References bhLayers_, HGCalTriggerGeometryBase::bhTopology(), HGCalTopology::dddConstants(), HcalTopology::dddConstants(), eeLayers_, HGCalTriggerGeometryBase::eeTopology(), fhLayers_, HGCalTriggerGeometryBase::fhTopology(), geom_, edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), HGCalDDDConstants::layers(), edm::ESHandle< T >::product(), and totalLayers_.

Referenced by HGCalMulticlusteringImpl::eventSetup(), HGCalShowerShape::eventSetup(), HGCalTriggerCellCalibration::eventSetup(), HGCalTowerMap2DImpl::eventSetup(), HGCalClusteringImpl::eventSetup(), HGCalTriggerNtupleHGCClusters::fill(), HGCalTriggerNtupleHGCTriggerCells::fill(), and HGCalTriggerNtupleHGCDigis::fill().

60 {
62  es.get<CaloGeometryRecord>().get(triggerGeometry_);
63  geom_ = triggerGeometry_.product();
64 
69 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
const HGCalTopology & eeTopology() const
const HGCalTriggerGeometryBase * geom_
unsigned int layers(bool reco) const
const HcalTopology & bhTopology() const
const HGCalDDDConstants & dddConstants() const
int getMaxDepth(const int &type) const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 136 of file HGCalTriggerTools.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 getPt(), and getTCEta().

136  {
137  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
138  return corrected_position.eta();
139 }
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 HGCalTriggerTools::getLayerZ ( const unsigned &  layerWithOffset) const

Definition at line 167 of file HGCalTriggerTools.cc.

References HcalEndcap, HGCEE, HGCHEF, lastLayerEE(), lastLayerFH(), and PFRecoTauDiscriminationByIsolation_cfi::offset.

167  {
168  int subdet = ForwardSubdetector::HGCEE;
169  unsigned offset = 0;
172  offset = lastLayerEE();
173  } else if(layerWithOffset > lastLayerFH()) {
175  offset = lastLayerFH();
176  }
177  return getLayerZ(subdet, layerWithOffset - offset);
178 }
unsigned lastLayerEE() const
float getLayerZ(const unsigned &layerWithOffset) const
unsigned layerWithOffset(const DetId &) const
unsigned lastLayerFH() const
float HGCalTriggerTools::getLayerZ ( const int &  subdet,
const unsigned &  layer 
) const

Definition at line 180 of file HGCalTriggerTools.cc.

References HGCalTriggerGeometryBase::bhTopology(), HGCalTopology::dddConstants(), HcalTopology::dddConstants(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), geom_, HcalDDDRecConstants::getEtaRange(), HcalDDDRecConstants::getRZ(), HcalEndcap, HGCEE, HGCHEB, HGCHEF, and HGCalDDDConstants::waferZ().

180  {
181  float layerGlobalZ = 0.;
182  if(subdet == ForwardSubdetector::HGCEE) {
183  layerGlobalZ = geom_->eeTopology().dddConstants().waferZ(layer, true);
184  } else if(subdet == ForwardSubdetector::HGCHEF) {
185  layerGlobalZ = geom_->fhTopology().dddConstants().waferZ(layer, true);
186  } else if(subdet == HcalSubdetector::HcalEndcap || subdet == ForwardSubdetector::HGCHEB) {
187  std::pair<int,int> eta_range = geom_->bhTopology().dddConstants()->getEtaRange(1);
188  layerGlobalZ = geom_->bhTopology().dddConstants()->getRZ(HcalSubdetector::HcalEndcap,eta_range.second,layer);
189  }
190  return layerGlobalZ;
191 }
unsigned layer(const DetId &) const
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:161
const HGCalTopology & eeTopology() const
const HGCalTriggerGeometryBase * geom_
std::pair< int, int > getEtaRange(const int &i) const
const HcalTopology & bhTopology() const
double getRZ(const int &subdet, const int &ieta, const int &depth) const
double waferZ(int layer, bool reco) const
const HGCalDDDConstants & dddConstants() const
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getPhi ( const GlobalPoint position) const

Definition at line 146 of file HGCalTriggerTools.cc.

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

Referenced by getTCPhi().

146  {
147  float phi = atan2(position.y(),position.x());
148  return phi;
149 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float HGCalTriggerTools::getPt ( const GlobalPoint position,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 156 of file HGCalTriggerTools.cc.

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

Referenced by getTCPt().

156  {
157  float eta = getEta(position, vertex_z);
158  float pt = hitEnergy / cosh(eta);
159  return pt;
160 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
float HGCalTriggerTools::getTCEta ( const DetId id,
const float &  vertex_z = 0. 
) const

Definition at line 141 of file HGCalTriggerTools.cc.

References getEta(), getTCPosition(), and position.

141  {
143  return getEta(position, vertex_z);
144 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
float HGCalTriggerTools::getTCPhi ( const DetId id) const

Definition at line 151 of file HGCalTriggerTools.cc.

References getPhi(), getTCPosition(), and position.

151  {
153  return getPhi(position);
154 }
float getPhi(const GlobalPoint &position) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
GlobalPoint HGCalTriggerTools::getTCPosition ( const DetId id) const

Definition at line 71 of file HGCalTriggerTools.cc.

References Exception, geom_, HGCalTriggerGeometryBase::getTriggerCellPosition(), DetId::Hcal, layers(), and position.

Referenced by getTCEta(), getTCPhi(), and getTCPt().

71  {
72  if(id.det() == DetId::Hcal) {
73  throw cms::Exception("hgcal::HGCalTriggerTools")
74  << "method getTCPosition called for DetId not belonging to a TC";
75  // FIXME: this would actually need a better test...but at the moment I can not think to anything better
76  // to distinguish a TC detId
77  }
78 
80  return position;
81 }
const HGCalTriggerGeometryBase * geom_
static int position[264][3]
Definition: ReadPGInfo.cc:509
virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const =0
float HGCalTriggerTools::getTCPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 162 of file HGCalTriggerTools.cc.

References getPt(), getTCPosition(), and position.

162  {
164  return getPt(position, hitEnergy, vertex_z);
165 }
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
const HGCalTriggerGeometryBase* HGCalTriggerTools::getTriggerGeometry ( ) const
inline

Definition at line 56 of file HGCalTriggerTools.h.

56 {return geom_;};
const HGCalTriggerGeometryBase * geom_
unsigned HGCalTriggerTools::lastLayerBH ( ) const
inline

Definition at line 44 of file HGCalTriggerTools.h.

References getEta(), and position.

Referenced by HGCalTowerMap2DImpl::buildTowerMap2D(), and HGCalTowerMap2DImpl::newTowerMaps().

44 {return totalLayers_;}
unsigned HGCalTriggerTools::lastLayerEE ( ) const
inline

Definition at line 42 of file HGCalTriggerTools.h.

Referenced by HGCalTowerMap2DImpl::buildTowerMap2D(), and getLayerZ().

42 {return eeLayers_;}
unsigned HGCalTriggerTools::lastLayerFH ( ) const
inline

Definition at line 43 of file HGCalTriggerTools.h.

Referenced by getLayerZ().

unsigned HGCalTriggerTools::layer ( const DetId id) const

Definition at line 111 of file HGCalTriggerTools.cc.

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

Referenced by geometryXMLparser.DTAlignable::index(), geometryXMLparser.CSCAlignable::index(), layers(), and layerWithOffset().

111  {
113  if( id.det() == DetId::Forward) {
114  const HGCalDetId hid(id);
115  layer = hid.layer();
116  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
117  const HcalDetId hcid(id);
118  layer = hcid.depth();
119  }
120  return layer;
121 }
unsigned layer(const DetId &) const
unsigned HGCalTriggerTools::layers ( ForwardSubdetector  type) const

Definition at line 86 of file HGCalTriggerTools.cc.

References bhLayers_, eeLayers_, fhLayers_, ForwardEmpty, HGCEE, HGCHEB, HGCHEF, layer(), and totalLayers_.

Referenced by HGCalClusteringImpl::clusterizeNN(), HGCalShowerShape::coreShowerLength(), and getTCPosition().

87 {
88  unsigned layers = 0;
89  switch(type)
90  {
92  layers = eeLayers_;
93  break;
95  layers = fhLayers_;
96  break;
98  layers = bhLayers_;
99  break;
101  layers = totalLayers_;
102  break;
103  default:
104  break;
105  };
106  return layers;
107 }
type
Definition: HCALResponse.h:21
unsigned layers(ForwardSubdetector type) const
unsigned HGCalTriggerTools::layerWithOffset ( const DetId id) const

Definition at line 125 of file HGCalTriggerTools.cc.

References eeLayers_, fhLayers_, DetId::Forward, DetId::Hcal, HcalEndcap, HGCHEB, HGCHEF, checklumidiff::l, and layer().

Referenced by HGCalTowerMap2DImpl::buildTowerMap2D(), HGCalTriggerCellCalibration::calibrateMipTinGeV(), HGCalClusteringImpl::calibratePt(), HGCalShowerShape::eMax(), HGCalTriggerNtupleHGCClusters::fill(), HGCalTriggerNtupleHGCTriggerCells::fill(), HGCalTriggerNtupleHGCDigis::fill(), HGCalShowerShape::firstLayer(), HGCalShowerShape::lastLayer(), layer(), HGCalShowerShape::maxLayer(), HGCalShowerShape::sigmaEtaEtaMax(), HGCalShowerShape::sigmaPhiPhiMax(), HGCalShowerShape::sigmaRRMax(), HGCalShowerShape::sigmaRRMean(), and HGCalClusteringImpl::triggerCellReshuffling().

125  {
126  unsigned int l = layer(id);
127  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
128  l += eeLayers_;
129  } else if( (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) ||
130  (id.det() == DetId::Forward && id.subdetId() == HGCHEB) ) {
131  l += eeLayers_ + fhLayers_;
132  }
133  return l;
134 }
unsigned layer(const DetId &) const

Member Data Documentation

unsigned HGCalTriggerTools::bhLayers_
private

Definition at line 67 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().

unsigned HGCalTriggerTools::eeLayers_
private

Definition at line 65 of file HGCalTriggerTools.h.

Referenced by eventSetup(), layers(), and layerWithOffset().

unsigned HGCalTriggerTools::fhLayers_
private

Definition at line 66 of file HGCalTriggerTools.h.

Referenced by eventSetup(), layers(), and layerWithOffset().

const HGCalTriggerGeometryBase* HGCalTriggerTools::geom_
private

Definition at line 64 of file HGCalTriggerTools.h.

Referenced by eventSetup(), getLayerZ(), and getTCPosition().

unsigned HGCalTriggerTools::totalLayers_
private

Definition at line 68 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().