CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Attributes
FixedGridEnergyDensity Class Reference

#include <FixedGridEnergyDensity.h>

Public Types

enum  EtaRegion { Central, Forward, All }
 

Public Member Functions

 FixedGridEnergyDensity (const reco::PFCandidateCollection *input)
 
float fixedGridRho (EtaRegion etaRegion=Central)
 
float fixedGridRho (std::vector< float > &etabins, std::vector< float > &phibins)
 
 ~FixedGridEnergyDensity ()
 

Private Attributes

const reco::PFCandidateCollectionpfCandidates
 

Detailed Description

Definition at line 6 of file FixedGridEnergyDensity.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

FixedGridEnergyDensity::FixedGridEnergyDensity ( const reco::PFCandidateCollection input)
inline

Definition at line 8 of file FixedGridEnergyDensity.h.

References input, and pfCandidates.

8 { pfCandidates = input; }
const reco::PFCandidateCollection * pfCandidates
static std::string const input
Definition: EdmProvDump.cc:47
FixedGridEnergyDensity::~FixedGridEnergyDensity ( )
inline

Definition at line 9 of file FixedGridEnergyDensity.h.

9 {};

Member Function Documentation

float FixedGridEnergyDensity::fixedGridRho ( EtaRegion  etaRegion = Central)

Definition at line 11 of file FixedGridEnergyDensity.cc.

References muon::All, defaults_cfi::etabins, mps_fire::i, Pi, and TwoPi.

11  {
12  //define the phi bins
13  vector<float> phibins;
14  phibins.reserve(10);
15  for (int i = 0; i < 10; i++)
16  phibins.push_back(-TMath::Pi() + (2 * i + 1) * TMath::TwoPi() / 20.);
17  //define the eta bins
18  vector<float> etabins;
19  if (etaRegion == Central) {
20  for (int i = 0; i < 8; ++i)
21  etabins.push_back(-2.1 + 0.6 * i);
22  } else if (etaRegion == Forward) {
23  for (int i = 0; i < 10; ++i) {
24  if (i < 5)
25  etabins.push_back(-5.1 + 0.6 * i);
26  else
27  etabins.push_back(2.7 + 0.6 * (i - 5));
28  }
29  } else if (etaRegion == All) {
30  for (int i = 0; i < 18; ++i)
31  etabins.push_back(-5.1 + 0.6 * i);
32  }
33  return fixedGridRho(etabins, phibins);
34 }
const double TwoPi
const double Pi
float fixedGridRho(EtaRegion etaRegion=Central)
float FixedGridEnergyDensity::fixedGridRho ( std::vector< float > &  etabins,
std::vector< float > &  phibins 
)

Definition at line 36 of file FixedGridEnergyDensity.cc.

References reco::deltaPhi(), and slimmedMuons_cfi::pfCandidates.

36  {
37  float etadist = etabins[1] - etabins[0];
38  float phidist = phibins[1] - phibins[0];
39  float etahalfdist = (etabins[1] - etabins[0]) / 2.;
40  float phihalfdist = (phibins[1] - phibins[0]) / 2.;
41  vector<float> sumPFNallSMDQ;
42  sumPFNallSMDQ.reserve(etabins.size() * phibins.size());
43  for (unsigned int ieta = 0; ieta < etabins.size(); ++ieta) {
44  for (unsigned int iphi = 0; iphi < phibins.size(); ++iphi) {
45  float pfniso_ieta_iphi = 0;
46  for (PFCandidateCollection::const_iterator pf_it = pfCandidates->begin(); pf_it != pfCandidates->end(); pf_it++) {
47  if (fabs(etabins[ieta] - pf_it->eta()) > etahalfdist)
48  continue;
49  if (fabs(reco::deltaPhi(phibins[iphi], pf_it->phi())) > phihalfdist)
50  continue;
51  pfniso_ieta_iphi += pf_it->pt();
52  }
53  sumPFNallSMDQ.push_back(pfniso_ieta_iphi);
54  }
55  }
56  float evt_smdq = 0;
57  sort(sumPFNallSMDQ.begin(), sumPFNallSMDQ.end());
58  if (sumPFNallSMDQ.size() % 2)
59  evt_smdq = sumPFNallSMDQ[(sumPFNallSMDQ.size() - 1) / 2];
60  else
61  evt_smdq = (sumPFNallSMDQ[sumPFNallSMDQ.size() / 2] + sumPFNallSMDQ[(sumPFNallSMDQ.size() - 2) / 2]) / 2.;
62  return evt_smdq / (etadist * phidist);
63 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
const reco::PFCandidateCollection * pfCandidates

Member Data Documentation

const reco::PFCandidateCollection* FixedGridEnergyDensity::pfCandidates
private

Definition at line 15 of file FixedGridEnergyDensity.h.

Referenced by FixedGridEnergyDensity().