CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
GenSpecificAlgo Class Reference

#include <RecoMET/METAlgorithms/interface/GenSpecificAlgo.h>

Public Member Functions

reco::GenMET addInfo (edm::Handle< edm::View< reco::Candidate > > particles, CommonMETData *met, double globalThreshold=0, bool onlyFiducial=false, bool applyFiducialThresholdForFractions=false, bool usePt=false)
 

Private Types

typedef math::XYZTLorentzVector LorentzVector
 
typedef math::XYZPoint Point
 

Private Member Functions

void fillCommonMETData (CommonMETData *met, edm::Handle< edm::View< reco::Candidate > > &particles, double globalThreshold, bool onlyFiducial, bool usePt)
 
SpecificGenMETData mkSpecificGenMETData (edm::Handle< edm::View< reco::Candidate > > &particles, double globalThreshold, bool onlyFiducial, bool applyFiducialThresholdForFractions, bool usePt)
 

Detailed Description

Description: Adds generator level HEPMC specific information to MET

Implementation: [Notes on implementation]

Definition at line 29 of file GenSpecificAlgo.h.

Member Typedef Documentation

◆ LorentzVector

Definition at line 39 of file GenSpecificAlgo.h.

◆ Point

Definition at line 40 of file GenSpecificAlgo.h.

Member Function Documentation

◆ addInfo()

reco::GenMET GenSpecificAlgo::addInfo ( edm::Handle< edm::View< reco::Candidate > >  particles,
CommonMETData met,
double  globalThreshold = 0,
bool  onlyFiducial = false,
bool  applyFiducialThresholdForFractions = false,
bool  usePt = false 
)

◆ fillCommonMETData()

void GenSpecificAlgo::fillCommonMETData ( CommonMETData met,
edm::Handle< edm::View< reco::Candidate > > &  particles,
double  globalThreshold,
bool  onlyFiducial,
bool  usePt 
)
private

Definition at line 36 of file GenSpecificAlgo.cc.

40  {
41  double sum_et = 0.0;
42  double sum_ex = 0.0;
43  double sum_ey = 0.0;
44  double sum_ez = 0.0;
45 
46  for (edm::View<reco::Candidate>::const_iterator iParticle = (particles.product())->begin();
47  iParticle != (particles.product())->end();
48  ++iParticle) {
49  if ((onlyFiducial && TMath::Abs(iParticle->eta()) >= 5.0))
50  continue;
51 
52  if (iParticle->et() <= globalThreshold)
53  continue;
54 
55  if (usePt) {
56  double phi = iParticle->phi();
57  double et = iParticle->pt();
58  sum_ez += iParticle->pz();
59  sum_et += et;
60  sum_ex += et * cos(phi);
61  sum_ey += et * sin(phi);
62  } else {
63  double phi = iParticle->phi();
64  double theta = iParticle->theta();
65  double e = iParticle->energy();
66  double et = e * sin(theta);
67  sum_ez += e * cos(theta);
68  sum_et += et;
69  sum_ex += et * cos(phi);
70  sum_ey += et * sin(phi);
71  }
72  }
73 
74  met->mex = -sum_ex;
75  met->mey = -sum_ey;
76  met->mez = -sum_ez;
77  met->met = sqrt(sum_ex * sum_ex + sum_ey * sum_ey);
78  met->sumet = sum_et;
79 }

References Abs(), funct::cos(), MillePedeFileConverter_cfg::e, mps_fire::end, EgHLTOffHistBins_cfi::et, HLT_FULL_cff::globalThreshold, BTaggingMonitor_cfi::met, ecalTrigSettings_cff::particles, phi, funct::sin(), mathSSE::sqrt(), theta(), and HLT_FULL_cff::usePt.

Referenced by addInfo().

◆ mkSpecificGenMETData()

SpecificGenMETData GenSpecificAlgo::mkSpecificGenMETData ( edm::Handle< edm::View< reco::Candidate > > &  particles,
double  globalThreshold,
bool  onlyFiducial,
bool  applyFiducialThresholdForFractions,
bool  usePt 
)
private

Definition at line 82 of file GenSpecificAlgo.cc.

86  {
87  const static int neutralEMpdgId[] = {22 /* photon */};
88  const static std::set<int> neutralEMpdgIdSet(neutralEMpdgId, neutralEMpdgId + sizeof(neutralEMpdgId) / sizeof(int));
89 
90  const static int chargedEMpdgId[] = {11 /* e */};
91  const static std::set<int> chargedEMpdgIdSet(chargedEMpdgId, chargedEMpdgId + sizeof(chargedEMpdgId) / sizeof(int));
92 
93  const static int muonpdgId[] = {13 /* muon */};
94  const static std::set<int> muonpdgIdSet(muonpdgId, muonpdgId + sizeof(muonpdgId) / sizeof(int));
95 
96  const static int neutralHADpdgId[] = {
97  130 /* K_long */,
98  310 /* K_short */,
99  3122 /* Lambda */,
100  2112 /* n */,
101  3222 /* Neutral Cascade */
102  };
103  const static std::set<int> neutralHADpdgIdSet(neutralHADpdgId,
104  neutralHADpdgId + sizeof(neutralHADpdgId) / sizeof(int));
105 
106  const static int chargedHADpdgId[] = {
107  211 /* pi */,
108  321 /* K+/K- */,
109  2212 /* p */,
110  3312 /* Cascade - */,
111  3112 /* Sigma - */,
112  3322 /* Sigma + */,
113  3334 /* Omega - */
114  };
115  const static std::set<int> chargedHADpdgIdSet(chargedHADpdgId,
116  chargedHADpdgId + sizeof(chargedHADpdgId) / sizeof(int));
117 
118  const static int invisiblepdgId[] = {
119  12 /* e_nu */, 14 /* mu_nu */, 16 /* tau_nu */,
120  1000022 /* Neutral ~Chi_0 */, 1000012 /* LH ~e_nu */, 1000014 /* LH ~mu_nu */,
121  1000016 /* LH ~tau_nu */, 2000012 /* RH ~e_nu */, 2000014 /* RH ~mu_nu */,
122  2000016 /* RH ~tau_nu */, 39 /* G */, 1000039 /* ~G */,
123  5100039 /* KK G */, 4000012 /* excited e_nu */, 4000014 /* excited mu_nu */,
124  4000016 /* excited tau_nu */, 9900012 /* Maj e_nu */, 9900014 /* Maj mu_nu */,
125  9900016 /* Maj tau_nu */,
126  };
127  const static std::set<int> invisiblepdgIdSet(invisiblepdgId, invisiblepdgId + sizeof(invisiblepdgId) / sizeof(int));
128 
130  double Et_unclassified = 0.0;
131 
132  for (edm::View<reco::Candidate>::const_iterator iParticle = (particles.product())->begin();
133  iParticle != (particles.product())->end();
134  ++iParticle) {
136  if (onlyFiducial && (TMath::Abs(iParticle->eta()) >= 5.0))
137  continue;
139  if (iParticle->et() <= globalThreshold)
140  continue;
141 
142  int pdgId = TMath::Abs(iParticle->pdgId());
143  double pt = (usePt) ? iParticle->pt() : iParticle->et();
144  if (neutralEMpdgIdSet.count(pdgId))
145  specific.NeutralEMEtFraction += pt;
146  else if (chargedEMpdgIdSet.count(pdgId))
147  specific.ChargedEMEtFraction += pt;
148  else if (muonpdgIdSet.count(pdgId))
149  specific.MuonEtFraction += pt;
150  else if (neutralHADpdgIdSet.count(pdgId))
151  specific.NeutralHadEtFraction += pt;
152  else if (chargedHADpdgIdSet.count(pdgId))
153  specific.ChargedHadEtFraction += pt;
154  else if (invisiblepdgIdSet.count(pdgId))
155  specific.InvisibleEtFraction += pt;
156  else
157  Et_unclassified += pt;
158  }
159 
160  double Et_Total = specific.NeutralEMEtFraction + specific.NeutralHadEtFraction + specific.ChargedEMEtFraction +
161  specific.ChargedHadEtFraction + specific.MuonEtFraction + specific.InvisibleEtFraction +
162  Et_unclassified;
163 
164  if (Et_Total) {
165  specific.NeutralEMEtFraction /= Et_Total;
166  specific.NeutralHadEtFraction /= Et_Total;
167  specific.ChargedEMEtFraction /= Et_Total;
168  specific.ChargedHadEtFraction /= Et_Total;
169  specific.MuonEtFraction /= Et_Total;
170  specific.InvisibleEtFraction /= Et_Total;
171  }
172 
173  return specific;
174 }

References Abs(), genMetCalo_cfi::applyFiducialThresholdForFractions, mps_fire::end, HLT_FULL_cff::globalThreshold, if(), ecalTrigSettings_cff::particles, EgammaValidation_cff::pdgId, DiDispStaMuonMonitor_cfi::pt, timingPdfMaker::specific, and HLT_FULL_cff::usePt.

Referenced by addInfo().

HLT_FULL_cff.globalThreshold
globalThreshold
Definition: HLT_FULL_cff.py:50221
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:48
ecalTrigSettings_cff.particles
particles
Definition: ecalTrigSettings_cff.py:11
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::GenMET
Definition: GenMET.h:20
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs
T Abs(T a)
Definition: MathUtil.h:49
timingPdfMaker.specific
specific
Definition: timingPdfMaker.py:78
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
mps_fire.end
end
Definition: mps_fire.py:242
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
GenSpecificAlgo::mkSpecificGenMETData
SpecificGenMETData mkSpecificGenMETData(edm::Handle< edm::View< reco::Candidate > > &particles, double globalThreshold, bool onlyFiducial, bool applyFiducialThresholdForFractions, bool usePt)
Definition: GenSpecificAlgo.cc:82
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
genMetCalo_cfi.applyFiducialThresholdForFractions
applyFiducialThresholdForFractions
using Pt instead Et
Definition: genMetCalo_cfi.py:11
p4
double p4[4]
Definition: TauolaWrapper.h:92
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
HepMCValidationHelper::genMet
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
Definition: HepMCValidationHelper.cc:278
DDAxes::phi
SpecificGenMETData
Definition: SpecificGenMETData.h:21
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
HLT_FULL_cff.usePt
usePt
Definition: HLT_FULL_cff.py:14128
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HLTMuonMatchAndPlot.h:49
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
GenSpecificAlgo::fillCommonMETData
void fillCommonMETData(CommonMETData *met, edm::Handle< edm::View< reco::Candidate > > &particles, double globalThreshold, bool onlyFiducial, bool usePt)
Definition: GenSpecificAlgo.cc:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37