CMS 3D CMS Logo

HGCalClusterTools.cc
Go to the documentation of this file.
2 
6 
8  const float phi,
9  const std::vector<reco::CaloCluster>& layerClusters,
10  const float minDR,
11  const float maxDR,
12  const float minEt,
13  const float minEnergy,
14  const std::vector<DetId::Detector>& subDets,
15  const HGCalClusterTools::EType& eType) {
16  float hadValue = 0.;
17 
18  const float minDR2 = minDR * minDR;
19  const float maxDR2 = maxDR * maxDR;
20 
21  for (auto& clus : layerClusters) {
22  if (clus.energy() < minEnergy) {
23  continue;
24  }
25 
26  if (std::find(subDets.begin(), subDets.end(), clus.seed().det()) == subDets.end()) {
27  continue;
28  }
29 
30  float clusEt = clus.energy() * std::sin(clus.position().theta());
31  if (clusEt < minEt) {
32  continue;
33  }
34 
35  //this is a prefilter on the clusters before we calculuate
36  //the expensive eta() of the cluster
37  float dPhi = reco::deltaPhi(phi, clus.phi());
38  if (dPhi > maxDR) {
39  continue;
40  }
41 
42  float dR2 = reco::deltaR2(eta, phi, clus.eta(), clus.phi());
43  if (dR2 < minDR2 || dR2 > maxDR2) {
44  continue;
45  }
46  switch (eType) {
47  case EType::ET:
48  hadValue += clusEt;
49  break;
50  case EType::ENERGY:
51  hadValue += clus.energy();
52  break;
53  }
54  }
55  return hadValue;
56 }
particleFlowClusterECALTimeSelected_cfi.minEnergy
minEnergy
Definition: particleFlowClusterECALTimeSelected_cfi.py:9
HLT_FULL_cff.minDR
minDR
Definition: HLT_FULL_cff.py:20394
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
deltaPhi.h
HGCalClusterTools::EType::ET
HGCalClusterTools.h
HLT_FULL_cff.dPhi
dPhi
Definition: HLT_FULL_cff.py:13695
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HGCalClusterTools::EType
EType
Definition: HGCalClusterTools.h:9
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PVValHelper::eta
Definition: PVValidationHelpers.h:70
EgHLTOffEleSelection_cfi.minEt
minEt
Definition: EgHLTOffEleSelection_cfi.py:10
HLTEgPhaseIITestSequence_cff.layerClusters
layerClusters
Definition: HLTEgPhaseIITestSequence_cff.py:2506
HGCalClusterTools::energyInCone
static float energyInCone(const float eta, const float phi, const std::vector< reco::CaloCluster > &layerClusters, const float minDR, const float maxDR, const float minEt, const float minEnergy, const std::vector< DetId::Detector > &subDets, const HGCalClusterTools::EType &eType=EType::ENERGY)
Definition: HGCalClusterTools.cc:7
PVValHelper::phi
Definition: PVValidationHelpers.h:69
deltaR.h
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
HGCalClusterTools::EType::ENERGY
DDAxes::phi
jets_cff.maxDR
maxDR
Definition: jets_cff.py:130
CaloCluster.h