CMS 3D CMS Logo

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

#include <HGCalTriggerTools.h>

Public Member Functions

template<typename T >
std::vector< TbxVectorToVector (const BXVector< T > &inputBXVector)
 
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 33 of file HGCalTriggerTools.h.

Constructor & Destructor Documentation

HGCalTriggerTools::HGCalTriggerTools ( )
inline

Definition at line 35 of file HGCalTriggerTools.h.

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

Definition at line 37 of file HGCalTriggerTools.h.

References LayerTriplets::layers().

37 {}

Member Function Documentation

template<typename T >
std::vector<T> HGCalTriggerTools::bxVectorToVector ( const BXVector< T > &  inputBXVector)
inline

Definition at line 65 of file HGCalTriggerTools.h.

References BXVector< T >::begin(), and BXVector< T >::end().

65  {
66  std::vector<T> outputVector;
67  //loop over collection for a given bx and put the objects into a std::vector
68  outputVector.insert(outputVector.end(), inputBXVector.begin(0), inputBXVector.end(0));
69  return outputVector;
70  }
const_iterator end(int bx) const
const_iterator begin(int bx) const
void HGCalTriggerTools::eventSetup ( const edm::EventSetup es)

Definition at line 38 of file HGCalTriggerTools.cc.

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

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

39 {
41  es.get<CaloGeometryRecord>().get(triggerGeometry_);
42  geom_ = triggerGeometry_.product();
43 
46  if(geom_->isV9Geometry())
47  {
50  }
51  else
52  {
55  }
56 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
const HGCalTopology & eeTopology() const
const HGCalTriggerGeometryBase * geom_
unsigned int layers(bool reco) const
const HcalTopology & bhTopology() const
const HGCalDDDConstants & dddConstants() const
const HGCalTopology & hscTopology() const
int getMaxDepth(const int &type) const
T get() const
Definition: EventSetup.h:68
T const * product() const
Definition: ESHandle.h:84
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

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

124  {
125  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
126  return corrected_position.eta();
127 }
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 155 of file HGCalTriggerTools.cc.

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

155  {
156  int subdet = ForwardSubdetector::HGCEE;
157  unsigned offset = 0;
160  offset = lastLayerEE();
161  } else if(layerWithOffset > lastLayerFH()) {
163  offset = lastLayerFH();
164  }
165  return getLayerZ(subdet, layerWithOffset - offset);
166 }
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 168 of file HGCalTriggerTools.cc.

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

168  {
169  float layerGlobalZ = 0.;
170  if(subdet == ForwardSubdetector::HGCEE) {
171  layerGlobalZ = geom_->eeTopology().dddConstants().waferZ(layer, true);
172  } else if(subdet == ForwardSubdetector::HGCHEF) {
173  layerGlobalZ = geom_->fhTopology().dddConstants().waferZ(layer, true);
174  } else if(subdet == HcalSubdetector::HcalEndcap || subdet == ForwardSubdetector::HGCHEB) {
175  if(geom_->isV9Geometry())
176  {
177  layerGlobalZ = geom_->hscTopology().dddConstants().waferZ(layer, true);
178  }
179  else
180  {
181  layerGlobalZ = geom_->bhTopology().dddConstants()->getRZ(
183  geom_->bhTopology().dddConstants()->getEtaRange(1).second,
184  layer);
185  }
186  }
187  return layerGlobalZ;
188 }
unsigned layer(const DetId &) const
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
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 & hscTopology() const
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getPhi ( const GlobalPoint position) const

Definition at line 134 of file HGCalTriggerTools.cc.

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

Referenced by getTCPhi().

134  {
135  float phi = atan2(position.y(),position.x());
136  return phi;
137 }
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 144 of file HGCalTriggerTools.cc.

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

Referenced by getTCPt().

144  {
145  float eta = getEta(position, vertex_z);
146  float pt = hitEnergy / cosh(eta);
147  return pt;
148 }
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 129 of file HGCalTriggerTools.cc.

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

129  {
131  return getEta(position, vertex_z);
132 }
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 139 of file HGCalTriggerTools.cc.

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

139  {
141  return getPhi(position);
142 }
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 58 of file HGCalTriggerTools.cc.

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

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

58  {
59  if(id.det() == DetId::Hcal) {
60  throw cms::Exception("hgcal::HGCalTriggerTools")
61  << "method getTCPosition called for DetId not belonging to a TC";
62  // FIXME: this would actually need a better test...but at the moment I can not think to anything better
63  // to distinguish a TC detId
64  }
65 
67  return position;
68 }
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 150 of file HGCalTriggerTools.cc.

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

150  {
152  return getPt(position, hitEnergy, vertex_z);
153 }
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 59 of file HGCalTriggerTools.h.

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

Definition at line 47 of file HGCalTriggerTools.h.

References position.

Referenced by HGCalTowerMap2DImpl::newTowerMaps().

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

Definition at line 46 of file HGCalTriggerTools.h.

Referenced by getLayerZ().

unsigned HGCalTriggerTools::layer ( const DetId id) const

Definition at line 98 of file HGCalTriggerTools.cc.

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

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

98  {
100  if( id.det() == DetId::Forward) {
101  const HGCalDetId hid(id);
102  layer = hid.layer();
103  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
104  const HcalDetId hcid(id);
105  layer = hcid.depth();
106  }
107  return layer;
108 }
unsigned layer(const DetId &) const
unsigned HGCalTriggerTools::layers ( ForwardSubdetector  type) const

Definition at line 73 of file HGCalTriggerTools.cc.

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

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

74 {
75  unsigned layers = 0;
76  switch(type)
77  {
79  layers = eeLayers_;
80  break;
82  layers = fhLayers_;
83  break;
85  layers = bhLayers_;
86  break;
88  layers = totalLayers_;
89  break;
90  default:
91  break;
92  };
93  return layers;
94 }
type
Definition: HCALResponse.h:21
unsigned layers(ForwardSubdetector type) const
unsigned HGCalTriggerTools::layerWithOffset ( const DetId id) const

Definition at line 112 of file HGCalTriggerTools.cc.

References eeLayers_, fhLayers_, DetId::Forward, geom_, DetId::Hcal, HcalEndcap, HGCHEB, HGCHEF, HGCalTriggerGeometryBase::isV9Geometry(), 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().

112  {
113  unsigned int l = layer(id);
114  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
115  l += eeLayers_;
116  } else if( (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) ||
117  (id.det() == DetId::Forward && id.subdetId() == HGCHEB) ) {
118  if(geom_->isV9Geometry()) l += eeLayers_;
119  else l += eeLayers_ + fhLayers_;
120  }
121  return l;
122 }
unsigned layer(const DetId &) const
const HGCalTriggerGeometryBase * geom_

Member Data Documentation

unsigned HGCalTriggerTools::bhLayers_
private

Definition at line 76 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().

unsigned HGCalTriggerTools::eeLayers_
private

Definition at line 74 of file HGCalTriggerTools.h.

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

unsigned HGCalTriggerTools::fhLayers_
private

Definition at line 75 of file HGCalTriggerTools.h.

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

const HGCalTriggerGeometryBase* HGCalTriggerTools::geom_
private

Definition at line 73 of file HGCalTriggerTools.h.

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

unsigned HGCalTriggerTools::totalLayers_
private

Definition at line 77 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().