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 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16