test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Constructor & Destructor Documentation

NoPileUpMEtUtilities::NoPileUpMEtUtilities ( )

Definition at line 9 of file NoPileUpMEtUtilities.cc.

References maxPtDef_, and minPtDef_.

9  {
10  minPtDef_=-1;
11  maxPtDef_=1000000;
12 }
NoPileUpMEtUtilities::~NoPileUpMEtUtilities ( )

Definition at line 14 of file NoPileUpMEtUtilities.cc.

14  {
15 }

Member Function Documentation

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

Definition at line 32 of file NoPileUpMEtUtilities.cc.

References reco::deltaR2(), HLT_25ns14e33_v1_cff::invert, and metsig::jet.

Referenced by NoPileUpPFMEtProducer::produce().

34  {
36  for ( reco::PUSubMETCandInfoCollection::const_iterator jet = jets.begin();
37  jet != jets.end(); ++jet ) {
38  bool isOverlap = false;
39  for ( std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin();
40  lepton != leptons.end(); ++lepton ) {
41  if ( deltaR2(jet->p4(), *lepton) < dRoverlap*dRoverlap ) {
42  isOverlap = true;
43  break;
44  }
45  }
46  if ( (!isOverlap && !invert) || (isOverlap && invert) ) retVal.push_back(*jet);
47  }
48  return retVal;
49 }
vector< PseudoJet > jets
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
reco::PUSubMETCandInfoCollection NoPileUpMEtUtilities::cleanPFCandidates ( const reco::PUSubMETCandInfoCollection pfCandidates,
const std::vector< reco::Candidate::LorentzVector > &  leptons,
double  dRoverlap,
bool  invert 
)

Definition at line 86 of file NoPileUpMEtUtilities.cc.

References reco::deltaR2(), and HLT_25ns14e33_v1_cff::invert.

Referenced by NoPileUpPFMEtProducer::produce().

88  {
89 // invert: false = PFCandidates are required not to overlap with leptons
90 // true = PFCandidates are required to overlap with leptons
91 
93  for ( reco::PUSubMETCandInfoCollection::const_iterator pfCandidate = pfCandidates.begin();
94  pfCandidate != pfCandidates.end(); ++pfCandidate ) {
95  bool isOverlap = false;
96  for ( std::vector<reco::Candidate::LorentzVector>::const_iterator lepton = leptons.begin();
97  lepton != leptons.end(); ++lepton ) {
98  if ( deltaR2(pfCandidate->p4(), *lepton) < dRoverlap*dRoverlap ) {
99  isOverlap = true;
100  break;
101  }
102  }
103  if ( (!isOverlap && !invert) || (isOverlap && invert) ) retVal.push_back(*pfCandidate);
104  }
105  return retVal;
106 }
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
std::vector< reco::PUSubMETCandInfo > PUSubMETCandInfoCollection
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
void NoPileUpMEtUtilities::computeAllSums ( const reco::PUSubMETCandInfoCollection jets,
const reco::PUSubMETCandInfoCollection pfCandidates 
)

Definition at line 139 of file NoPileUpMEtUtilities.cc.

References chHSPfcSum_, chHSPfcSumAbsPx_, chHSPfcSumAbsPy_, chPUPfcSum_, chPUPfcSumAbsPx_, chPUPfcSumAbsPy_, computeCandidateSum(), 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_, and selectCandidates().

140  {
141 
145 
149 
153 
157 
162 
163  //not used so far
164  //_chPfcSum = computeCandidateSum(pfcsCh, false, &_chPfcSumAbsPx, &_chPfcSumAbsPy);
168 
171 
172 }
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
vector< PseudoJet > jets
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)
CommonMETData NoPileUpMEtUtilities::computeCandidateSum ( const reco::PUSubMETCandInfoCollection cands,
bool  neutralFracOnly,
double &  sumAbsPx,
double &  sumAbsPy 
)
private

Definition at line 53 of file NoPileUpMEtUtilities.cc.

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

Referenced by computeAllSums().

54  {
55 
56  CommonMETData retVal;
57  retVal.mex = 0.;
58  retVal.mey = 0.;
59  retVal.sumet = 0.;
60  double retVal_sumAbsPx = 0.;
61  double retVal_sumAbsPy = 0.;
62  double pFrac=1;
63  for ( reco::PUSubMETCandInfoCollection::const_iterator cand = cands.begin();
64  cand != cands.end(); ++cand ) {
65 
66  pFrac=1;
67  if(neutralFracOnly) pFrac = (1-cand->chargedEnFrac() );
68 
69  retVal.mex += cand->p4().px()*pFrac;
70  retVal.mey += cand->p4().py()*pFrac;
71  retVal.sumet += cand->p4().pt()*pFrac;
72  retVal_sumAbsPx += std::abs(cand->p4().px());
73  retVal_sumAbsPy += std::abs(cand->p4().py());
74  }
75  finalizeMEtData(retVal);
76  sumAbsPx = retVal_sumAbsPx;
77  sumAbsPy = retVal_sumAbsPy;
78  return retVal;
79 }
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 &)
CommonMETData NoPileUpMEtUtilities::computeRecoil ( int  metType,
double &  sumAbsPx,
double &  sumAbsPy 
)

Definition at line 175 of file NoPileUpMEtUtilities.cc.

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

175  {
176  CommonMETData retVal;
177  double retSumAbsPx = 0.;
178  double retSumAbsPy = 0.;
179 
180  //never used....
181  // if(metType==NoPileUpMEtUtilities::kChMET) {
182  // CommonMETData chPfcSum = computeCandidateSum(_pfcsCh, false, &trackSumAbsPx, &trackSumAbsPy);
183  // retVal.mex = -chPfcSum.mex;
184  // retVal.mey = -chPfcSum.mey;
185  // retVal.sumet = chPfcSum.sumet;
186  // retSumAbsPx = ;
187  // retSumAbsPy = ;
188  // }
190  retVal.mex = chHSPfcSum_.mex;
191  retVal.mey = chHSPfcSum_.mey;
192  retVal.sumet = chHSPfcSum_.sumet;
193  retSumAbsPx = chHSPfcSumAbsPx_;
194  retSumAbsPy = chHSPfcSumAbsPy_;
195  }
197  retVal.mex = chPUPfcSum_.mex;
198  retVal.mey = chPUPfcSum_.mey;
199  retVal.sumet = chPUPfcSum_.sumet;
200  retSumAbsPx = chPUPfcSumAbsPx_;
201  retSumAbsPy = chPUPfcSumAbsPy_;
202  }
204  retVal.mex = nUncPfcSum_.mex;
205  retVal.mey = nUncPfcSum_.mey;
206  retVal.sumet = nUncPfcSum_.sumet;
207  retSumAbsPx = nUncPfcSumAbsPx_;
208  retSumAbsPy = nUncPfcSumAbsPy_;
209  }
211  retVal.mex = chHSPfcSum_.mex + nHSJetSum_.mex;
212  retVal.mey = chHSPfcSum_.mey + nHSJetSum_.mey;
214  retSumAbsPx = chHSPfcSumAbsPx_ + nHSJetSumAbsPx_;
215  retSumAbsPy = chHSPfcSumAbsPy_ + nHSJetSumAbsPy_;
216  }
218  retVal.mex = chPUPfcSum_.mex + nHSJetSum_.mex;
219  retVal.mey = chPUPfcSum_.mey + nHSJetSum_.mey;
221  retSumAbsPx = chPUPfcSumAbsPx_ + nHSJetSumAbsPx_;
222  retSumAbsPy = chPUPfcSumAbsPy_ + nHSJetSumAbsPy_;
223  }
224 
225  sumAbsPx = retSumAbsPx;
226  sumAbsPy = retSumAbsPy;
227 
228  return retVal;
229 }
Structure containing data common to all types of MET.
Definition: CommonMETData.h:12
tuple metType
MET
Definition: autophobj.py:211
void NoPileUpMEtUtilities::finalizeMEtData ( CommonMETData metData)

Definition at line 22 of file NoPileUpMEtUtilities.cc.

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

Referenced by computeCandidateSum().

22  {
23  metData.met = sqrt(metData.mex*metData.mex + metData.mey*metData.mey);
24  metData.mez = 0.;
25  metData.phi = atan2(metData.mey, metData.mex);
26 }
T sqrt(T t)
Definition: SSEVec.h:48
reco::PUSubMETCandInfoCollection NoPileUpMEtUtilities::selectCandidates ( const reco::PUSubMETCandInfoCollection cands,
double  minPt,
double  maxPt,
int  type,
bool  isCharged,
int  isWithinJet 
)
private

Definition at line 110 of file NoPileUpMEtUtilities.cc.

References reco::btau::jetPt, kAll, and reco::PUSubMETCandInfo::kUndefined.

Referenced by computeAllSums().

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

Member Data Documentation

CommonMETData NoPileUpMEtUtilities::chHSPfcSum_
private

Definition at line 64 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::chHSPfcSumAbsPx_
private

Definition at line 70 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::chHSPfcSumAbsPy_
private

Definition at line 76 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

CommonMETData NoPileUpMEtUtilities::chPUPfcSum_
private

Definition at line 65 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::chPUPfcSumAbsPx_
private

Definition at line 71 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::chPUPfcSumAbsPy_
private

Definition at line 77 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::maxPtDef_
private

Definition at line 62 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and NoPileUpMEtUtilities().

double NoPileUpMEtUtilities::minPtDef_
private

Definition at line 61 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and NoPileUpMEtUtilities().

CommonMETData NoPileUpMEtUtilities::nHSJetSum_
private

Definition at line 67 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::nHSJetSumAbsPx_
private

Definition at line 73 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::nHSJetSumAbsPy_
private

Definition at line 79 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

CommonMETData NoPileUpMEtUtilities::nPUJetSum_
private

Definition at line 68 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

double NoPileUpMEtUtilities::nPUJetSumAbsPx_
private

Definition at line 74 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

double NoPileUpMEtUtilities::nPUJetSumAbsPy_
private

Definition at line 80 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums().

CommonMETData NoPileUpMEtUtilities::nUncPfcSum_
private

Definition at line 66 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::nUncPfcSumAbsPx_
private

Definition at line 72 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().

double NoPileUpMEtUtilities::nUncPfcSumAbsPy_
private

Definition at line 78 of file NoPileUpMEtUtilities.h.

Referenced by computeAllSums(), and computeRecoil().