CMS 3D CMS Logo

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

#include <NoPileUpMEtUtilities.h>

Public Types

enum  { kOutsideJet = 0, kWithin, kAll }
 
enum  {
  kChHSMET = 0, kChPUMET, kNeutralUncMET, kHadronicHSMET,
  kHadronicPUMET
}
 

Public Member Functions

reco::PUSubMETCandInfoCollection cleanJets (const reco::PUSubMETCandInfoCollection &, const std::vector< reco::Candidate::LorentzVector > &, double, bool)
 
reco::PUSubMETCandInfoCollection cleanPFCandidates (const reco::PUSubMETCandInfoCollection &, const std::vector< reco::Candidate::LorentzVector > &, double, bool)
 
void computeAllSums (const reco::PUSubMETCandInfoCollection &jets, const reco::PUSubMETCandInfoCollection &pfCandidates)
 
CommonMETData computeRecoil (int metType, double &sumAbsPx, double &sumAbsPy)
 
void finalizeMEtData (CommonMETData &)
 
 NoPileUpMEtUtilities ()
 
 ~NoPileUpMEtUtilities ()
 

Private Member Functions

CommonMETData computeCandidateSum (const reco::PUSubMETCandInfoCollection &cands, bool neutralFracOnly, double &sumAbsPx, double &sumAbsPy)
 
reco::PUSubMETCandInfoCollection selectCandidates (const reco::PUSubMETCandInfoCollection &cands, double minPt, double maxPt, int type, bool isCharged, int isWithinJet)
 

Private Attributes

CommonMETData chHSPfcSum_
 
double chHSPfcSumAbsPx_
 
double chHSPfcSumAbsPy_
 
CommonMETData chPUPfcSum_
 
double chPUPfcSumAbsPx_
 
double chPUPfcSumAbsPy_
 
double maxPtDef_
 
double minPtDef_
 
CommonMETData nHSJetSum_
 
double nHSJetSumAbsPx_
 
double nHSJetSumAbsPy_
 
CommonMETData nPUJetSum_
 
double nPUJetSumAbsPx_
 
double nPUJetSumAbsPy_
 
CommonMETData nUncPfcSum_
 
double nUncPfcSumAbsPx_
 
double nUncPfcSumAbsPy_
 

Detailed Description

Definition at line 13 of file NoPileUpMEtUtilities.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

◆ anonymous enum

anonymous enum

Constructor & Destructor Documentation

◆ NoPileUpMEtUtilities()

NoPileUpMEtUtilities::NoPileUpMEtUtilities ( )

Definition at line 8 of file NoPileUpMEtUtilities.cc.

References maxPtDef_, and minPtDef_.

8  {
9  minPtDef_ = -1;
10  maxPtDef_ = 1000000;
11 }

◆ ~NoPileUpMEtUtilities()

NoPileUpMEtUtilities::~NoPileUpMEtUtilities ( )

Definition at line 13 of file NoPileUpMEtUtilities.cc.

13 {}

Member Function Documentation

◆ cleanJets()

reco::PUSubMETCandInfoCollection NoPileUpMEtUtilities::cleanJets ( const reco::PUSubMETCandInfoCollection jets,
const std::vector< reco::Candidate::LorentzVector > &  leptons,
double  dRoverlap,
bool  invert 
)

Definition at line 28 of file NoPileUpMEtUtilities.cc.

References HLTMuonOfflineAnalyzer_cfi::deltaR2, l1tstage2_dqm_sourceclient-live_cfg::invert, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, and HLT_2024v12_cff::leptons.

Referenced by NoPileUpPFMEtProducer::produce().

32  {
34  for (reco::PUSubMETCandInfoCollection::const_iterator jet = jets.begin(); jet != jets.end(); ++jet) {
35  bool isOverlap = false;
36  for (std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin(); lepton != leptons.end();
37  ++lepton) {
38  if (deltaR2(jet->p4(), *lepton) < dRoverlap * dRoverlap) {
39  isOverlap = true;
40  break;
41  }
42  }
43  if ((!isOverlap && !invert) || (isOverlap && invert))
44  retVal.push_back(*jet);
45  }
46  return retVal;
47 }
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection

◆ cleanPFCandidates()

reco::PUSubMETCandInfoCollection NoPileUpMEtUtilities::cleanPFCandidates ( const reco::PUSubMETCandInfoCollection pfCandidates,
const std::vector< reco::Candidate::LorentzVector > &  leptons,
double  dRoverlap,
bool  invert 
)

Definition at line 81 of file NoPileUpMEtUtilities.cc.

References HLTMuonOfflineAnalyzer_cfi::deltaR2, l1tstage2_dqm_sourceclient-live_cfg::invert, HLT_2024v12_cff::leptons, and zmumugammaAnalyzer_cfi::pfCandidates.

Referenced by NoPileUpPFMEtProducer::produce().

85  {
86  // invert: false = PFCandidates are required not to overlap with leptons
87  // true = PFCandidates are required to overlap with leptons
88 
90  for (reco::PUSubMETCandInfoCollection::const_iterator pfCandidate = pfCandidates.begin();
91  pfCandidate != pfCandidates.end();
92  ++pfCandidate) {
93  bool isOverlap = false;
94  for (std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin(); lepton != leptons.end();
95  ++lepton) {
96  if (deltaR2(pfCandidate->p4(), *lepton) < dRoverlap * dRoverlap) {
97  isOverlap = true;
98  break;
99  }
100  }
101  if ((!isOverlap && !invert) || (isOverlap && invert))
102  retVal.push_back(*pfCandidate);
103  }
104  return retVal;
105 }
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection

◆ computeAllSums()

void NoPileUpMEtUtilities::computeAllSums ( const reco::PUSubMETCandInfoCollection jets,
const reco::PUSubMETCandInfoCollection pfCandidates 
)

Definition at line 140 of file NoPileUpMEtUtilities.cc.

References chHSPfcSum_, chHSPfcSumAbsPx_, chHSPfcSumAbsPy_, chPUPfcSum_, chPUPfcSumAbsPx_, chPUPfcSumAbsPy_, computeCandidateSum(), PDWG_EXODelayedJetMET_cff::jets, kAll, reco::PUSubMETCandInfo::kChHS, reco::PUSubMETCandInfo::kChPU, reco::PUSubMETCandInfo::kHS, reco::PUSubMETCandInfo::kNeutral, kOutsideJet, reco::PUSubMETCandInfo::kPU, reco::PUSubMETCandInfo::kUndefined, maxPtDef_, minPtDef_, nHSJetSum_, nHSJetSumAbsPx_, nHSJetSumAbsPy_, nPUJetSum_, nPUJetSumAbsPx_, nPUJetSumAbsPy_, nUncPfcSum_, nUncPfcSumAbsPx_, nUncPfcSumAbsPy_, zmumugammaAnalyzer_cfi::pfCandidates, and selectCandidates().

141  {
144 
147 
150 
153 
158 
159  //not used so far
160  //_chPfcSum = computeCandidateSum(pfcsCh, false, &_chPfcSumAbsPx, &_chPfcSumAbsPy);
164 
167 }
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection
CommonMETData computeCandidateSum(const reco::PUSubMETCandInfoCollection &cands, bool neutralFracOnly, double &sumAbsPx, double &sumAbsPy)
reco::PUSubMETCandInfoCollection selectCandidates(const reco::PUSubMETCandInfoCollection &cands, double minPt, double maxPt, int type, bool isCharged, int isWithinJet)

◆ computeCandidateSum()

CommonMETData NoPileUpMEtUtilities::computeCandidateSum ( const reco::PUSubMETCandInfoCollection cands,
bool  neutralFracOnly,
double &  sumAbsPx,
double &  sumAbsPy 
)
private

Definition at line 49 of file NoPileUpMEtUtilities.cc.

References funct::abs(), HLT_2024v12_cff::cands, finalizeMEtData(), CommonMETData::mex, CommonMETData::mey, and CommonMETData::sumet.

Referenced by computeAllSums().

52  {
53  CommonMETData retVal;
54  retVal.mex = 0.;
55  retVal.mey = 0.;
56  retVal.sumet = 0.;
57  double retVal_sumAbsPx = 0.;
58  double retVal_sumAbsPy = 0.;
59  double pFrac = 1;
60  for (reco::PUSubMETCandInfoCollection::const_iterator cand = cands.begin(); cand != cands.end(); ++cand) {
61  pFrac = 1;
62  if (neutralFracOnly)
63  pFrac = (1 - cand->chargedEnFrac());
64 
65  retVal.mex += cand->p4().px() * pFrac;
66  retVal.mey += cand->p4().py() * pFrac;
67  retVal.sumet += cand->p4().pt() * pFrac;
68  retVal_sumAbsPx += std::abs(cand->p4().px());
69  retVal_sumAbsPy += std::abs(cand->p4().py());
70  }
71  finalizeMEtData(retVal);
72  sumAbsPx = retVal_sumAbsPx;
73  sumAbsPy = retVal_sumAbsPy;
74  return retVal;
75 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
void finalizeMEtData(CommonMETData &)

◆ computeRecoil()

CommonMETData NoPileUpMEtUtilities::computeRecoil ( int  metType,
double &  sumAbsPx,
double &  sumAbsPy 
)

Definition at line 169 of file NoPileUpMEtUtilities.cc.

References chHSPfcSum_, chHSPfcSumAbsPx_, chHSPfcSumAbsPy_, chPUPfcSum_, chPUPfcSumAbsPx_, chPUPfcSumAbsPy_, kChHSMET, kChPUMET, kHadronicHSMET, kHadronicPUMET, kNeutralUncMET, objects.autophobj::metType, CommonMETData::mex, CommonMETData::mey, nHSJetSum_, nHSJetSumAbsPx_, nHSJetSumAbsPy_, nUncPfcSum_, nUncPfcSumAbsPx_, nUncPfcSumAbsPy_, and CommonMETData::sumet.

169  {
170  CommonMETData retVal;
171  double retSumAbsPx = 0.;
172  double retSumAbsPy = 0.;
173 
174  //never used....
175  // if(metType==NoPileUpMEtUtilities::kChMET) {
176  // CommonMETData chPfcSum = computeCandidateSum(_pfcsCh, false, &trackSumAbsPx, &trackSumAbsPy);
177  // retVal.mex = -chPfcSum.mex;
178  // retVal.mey = -chPfcSum.mey;
179  // retVal.sumet = chPfcSum.sumet;
180  // retSumAbsPx = ;
181  // retSumAbsPy = ;
182  // }
184  retVal.mex = chHSPfcSum_.mex;
185  retVal.mey = chHSPfcSum_.mey;
186  retVal.sumet = chHSPfcSum_.sumet;
187  retSumAbsPx = chHSPfcSumAbsPx_;
188  retSumAbsPy = chHSPfcSumAbsPy_;
189  }
191  retVal.mex = chPUPfcSum_.mex;
192  retVal.mey = chPUPfcSum_.mey;
193  retVal.sumet = chPUPfcSum_.sumet;
194  retSumAbsPx = chPUPfcSumAbsPx_;
195  retSumAbsPy = chPUPfcSumAbsPy_;
196  }
198  retVal.mex = nUncPfcSum_.mex;
199  retVal.mey = nUncPfcSum_.mey;
200  retVal.sumet = nUncPfcSum_.sumet;
201  retSumAbsPx = nUncPfcSumAbsPx_;
202  retSumAbsPy = nUncPfcSumAbsPy_;
203  }
205  retVal.mex = chHSPfcSum_.mex + nHSJetSum_.mex;
206  retVal.mey = chHSPfcSum_.mey + nHSJetSum_.mey;
208  retSumAbsPx = chHSPfcSumAbsPx_ + nHSJetSumAbsPx_;
209  retSumAbsPy = chHSPfcSumAbsPy_ + nHSJetSumAbsPy_;
210  }
212  retVal.mex = chPUPfcSum_.mex + nHSJetSum_.mex;
213  retVal.mey = chPUPfcSum_.mey + nHSJetSum_.mey;
215  retSumAbsPx = chPUPfcSumAbsPx_ + nHSJetSumAbsPx_;
216  retSumAbsPy = chPUPfcSumAbsPy_ + nHSJetSumAbsPy_;
217  }
218 
219  sumAbsPx = retSumAbsPx;
220  sumAbsPy = retSumAbsPy;
221 
222  return retVal;
223 }
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12

◆ finalizeMEtData()

void NoPileUpMEtUtilities::finalizeMEtData ( CommonMETData metData)

Definition at line 19 of file NoPileUpMEtUtilities.cc.

References CommonMETData::met, CommonMETData::mex, CommonMETData::mey, CommonMETData::mez, CommonMETData::phi, and mathSSE::sqrt().

Referenced by computeCandidateSum().

19  {
20  metData.met = sqrt(metData.mex * metData.mex + metData.mey * metData.mey);
21  metData.mez = 0.;
22  metData.phi = atan2(metData.mey, metData.mex);
23 }
T sqrt(T t)
Definition: SSEVec.h:19

◆ selectCandidates()

reco::PUSubMETCandInfoCollection NoPileUpMEtUtilities::selectCandidates ( const reco::PUSubMETCandInfoCollection cands,
double  minPt,
double  maxPt,
int  type,
bool  isCharged,
int  isWithinJet 
)
private

Definition at line 107 of file NoPileUpMEtUtilities.cc.

References HLT_2024v12_cff::cands, reco::btau::jetPt, kAll, reco::PUSubMETCandInfo::kUndefined, and PV_cfg::maxPt.

Referenced by computeAllSums().

112  {
114  for (reco::PUSubMETCandInfoCollection::const_iterator cand = cands.begin(); cand != cands.end(); ++cand) {
115  if (isCharged && cand->charge() == 0)
116  continue;
117  double jetPt = cand->p4().pt();
118  if (jetPt < minPt || jetPt > maxPt)
119  continue;
120  if (type != reco::PUSubMETCandInfo::kUndefined && cand->type() != type)
121  continue;
122 
123  //for pf candidates
124  if (isWithinJet != NoPileUpMEtUtilities::kAll && (cand->isWithinJet() != isWithinJet))
125  continue;
126 
127  retVal.push_back(*cand);
128  }
129  return retVal;
130 }
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection
maxPt
Definition: PV_cfg.py:224

Member Data Documentation

◆ chHSPfcSum_

CommonMETData NoPileUpMEtUtilities::chHSPfcSum_
private

Definition at line 62 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ chHSPfcSumAbsPx_

double NoPileUpMEtUtilities::chHSPfcSumAbsPx_
private

Definition at line 68 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ chHSPfcSumAbsPy_

double NoPileUpMEtUtilities::chHSPfcSumAbsPy_
private

Definition at line 74 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ chPUPfcSum_

CommonMETData NoPileUpMEtUtilities::chPUPfcSum_
private

Definition at line 63 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ chPUPfcSumAbsPx_

double NoPileUpMEtUtilities::chPUPfcSumAbsPx_
private

Definition at line 69 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ chPUPfcSumAbsPy_

double NoPileUpMEtUtilities::chPUPfcSumAbsPy_
private

Definition at line 75 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ maxPtDef_

double NoPileUpMEtUtilities::maxPtDef_
private

Definition at line 60 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and NoPileUpMEtUtilities().

◆ minPtDef_

double NoPileUpMEtUtilities::minPtDef_
private

Definition at line 59 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and NoPileUpMEtUtilities().

◆ nHSJetSum_

CommonMETData NoPileUpMEtUtilities::nHSJetSum_
private

Definition at line 65 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ nHSJetSumAbsPx_

double NoPileUpMEtUtilities::nHSJetSumAbsPx_
private

Definition at line 71 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ nHSJetSumAbsPy_

double NoPileUpMEtUtilities::nHSJetSumAbsPy_
private

Definition at line 77 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ nPUJetSum_

CommonMETData NoPileUpMEtUtilities::nPUJetSum_
private

Definition at line 66 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

◆ nPUJetSumAbsPx_

double NoPileUpMEtUtilities::nPUJetSumAbsPx_
private

Definition at line 72 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

◆ nPUJetSumAbsPy_

double NoPileUpMEtUtilities::nPUJetSumAbsPy_
private

Definition at line 78 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

◆ nUncPfcSum_

CommonMETData NoPileUpMEtUtilities::nUncPfcSum_
private

Definition at line 64 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ nUncPfcSumAbsPx_

double NoPileUpMEtUtilities::nUncPfcSumAbsPx_
private

Definition at line 70 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

◆ nUncPfcSumAbsPy_

double NoPileUpMEtUtilities::nUncPfcSumAbsPy_
private

Definition at line 76 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().