CMS 3D CMS Logo

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

◆ EtaRegion

Enumerator
Central 
Forward 
All 

Definition at line 10 of file FixedGridEnergyDensity.h.

10 { Central, Forward, All };

Constructor & Destructor Documentation

◆ FixedGridEnergyDensity()

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

Definition at line 8 of file FixedGridEnergyDensity.h.

8 { pfCandidates = input; }

References input, and pfCandidates.

◆ ~FixedGridEnergyDensity()

FixedGridEnergyDensity::~FixedGridEnergyDensity ( )
inline

Definition at line 9 of file FixedGridEnergyDensity.h.

9 {};

Member Function Documentation

◆ fixedGridRho() [1/2]

float FixedGridEnergyDensity::fixedGridRho ( EtaRegion  etaRegion = Central)

Definition at line 11 of file FixedGridEnergyDensity.cc.

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

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

◆ fixedGridRho() [2/2]

float FixedGridEnergyDensity::fixedGridRho ( std::vector< float > &  etabins,
std::vector< float > &  phibins 
)

Definition at line 35 of file FixedGridEnergyDensity.cc.

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

References reco::deltaPhi(), defaults_cfi::etabins, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, and zmumugammaAnalyzer_cfi::pfCandidates.

Member Data Documentation

◆ pfCandidates

const reco::PFCandidateCollection* FixedGridEnergyDensity::pfCandidates
private

Definition at line 15 of file FixedGridEnergyDensity.h.

Referenced by FixedGridEnergyDensity().

mps_fire.i
i
Definition: mps_fire.py:355
input
static const std::string input
Definition: EdmProvDump.cc:48
TwoPi
const double TwoPi
Definition: CosmicMuonParameters.h:19
FixedGridEnergyDensity::All
Definition: FixedGridEnergyDensity.h:10
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
FixedGridEnergyDensity::Forward
Definition: FixedGridEnergyDensity.h:10
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
FixedGridEnergyDensity::pfCandidates
const reco::PFCandidateCollection * pfCandidates
Definition: FixedGridEnergyDensity.h:15
dyt_utils::etaRegion
etaRegion
Definition: DynamicTruncation.h:44
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
FixedGridEnergyDensity::Central
Definition: FixedGridEnergyDensity.h:10
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
FixedGridEnergyDensity::fixedGridRho
float fixedGridRho(EtaRegion etaRegion=Central)
Definition: FixedGridEnergyDensity.cc:11
defaults_cfi.etabins
etabins
Definition: defaults_cfi.py:7