CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
TauMETAlgo Class Reference

#include <TauMETAlgo.h>

Public Member Functions

virtual void run (edm::Event &, const edm::EventSetup &, edm::Handle< reco::PFTauCollection >, edm::Handle< reco::CaloJetCollection >, double, double, const JetCorrector &, const std::vector< reco::CaloMET > &, double, double, double, bool, double, bool, double, bool, double, bool, std::vector< reco::CaloMET > *corrMET)
 
virtual void run (edm::Event &, const edm::EventSetup &, edm::Handle< reco::PFTauCollection >, edm::Handle< reco::CaloJetCollection >, double, double, const JetCorrector &, const std::vector< reco::MET > &, double, double, double, bool, double, bool, double, bool, double, bool, std::vector< reco::MET > *corrMET)
 
 TauMETAlgo ()
 
virtual ~TauMETAlgo ()
 

Detailed Description

Definition at line 31 of file TauMETAlgo.h.

Constructor & Destructor Documentation

TauMETAlgo::TauMETAlgo ( )

Definition at line 14 of file TauMETAlgo.cc.

14 {}
TauMETAlgo::~TauMETAlgo ( )
virtual

Definition at line 15 of file TauMETAlgo.cc.

15 {}

Member Function Documentation

void TauMETAlgo::run ( edm::Event iEvent,
const edm::EventSetup iSetup,
edm::Handle< reco::PFTauCollection tauHandle,
edm::Handle< reco::CaloJetCollection calojetHandle,
double  jetPTthreshold,
double  jetEMfracLimit,
const JetCorrector correctedjets,
const std::vector< reco::CaloMET > &  uncorMET,
double  jetMatchDeltaR,
double  tauMinEt,
double  tauEtaMax,
bool  useSeedTrack,
double  seedTrackPt,
bool  useTrackIsolation,
double  trackIsolationMinPt,
bool  useECALIsolation,
double  gammaIsolationMinPt,
bool  useProngStructure,
std::vector< reco::CaloMET > *  corrMET 
)
virtual

Definition at line 17 of file TauMETAlgo.cc.

References edm::RefVector< C, T, F >::begin(), dtNoiseDBValidation_cfg::cerr, JetCorrector::correction(), delta, deltaR(), edm::RefVector< C, T, F >::end(), reco::CaloMET::getSpecific(), reco::MET::mEtCorr(), CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), query::result, mathSSE::sqrt(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

Referenced by cms::TauMET::produce().

22  {
23 
24  // std::cerr << "TauMETAlgo::run -> Test.. " << std::endl;
25 
26  double DeltaPx = 0.0;
27  double DeltaPy = 0.0;
28  double DeltaSumET = 0.0;
29  for(PFTauCollection::size_type iPFTau=0;iPFTau<tauHandle->size();iPFTau++) {
30  PFTauRef thePFTau(tauHandle,iPFTau);
31  bool matchFlag = false;
32  bool goodTau = false;
33  if((fabs(thePFTau->eta()) <= tauEtaMax) && (thePFTau->et() >= tauMinEt)) {
34  goodTau = true;
35  if(useSeedTrack) {
36  if(!(thePFTau->leadPFChargedHadrCand())) {goodTau = false;}
37  else {
38  if(thePFTau->leadPFChargedHadrCand()->et() < seedTrackPt) {goodTau = false;}
39  }
40  }
41  if(useTrackIsolation) {
42  PFCandidateRefVector PFTauProdIsolCHCands = (*thePFTau).isolationPFChargedHadrCands();
43  for(PFCandidateRefVector::const_iterator iChargedHadrCand=PFTauProdIsolCHCands.begin();
44  iChargedHadrCand!=PFTauProdIsolCHCands.end();++iChargedHadrCand) {
45  if((**iChargedHadrCand).pt() > trackIsolationMinPt) {goodTau = false;}
46  }
47  }
48  if(useECALIsolation) {
49  PFCandidateRefVector PFTauProdIsolGammaCands = (*thePFTau).isolationPFGammaCands();
50  for(PFCandidateRefVector::const_iterator iGammaCand=PFTauProdIsolGammaCands.begin();
51  iGammaCand!=PFTauProdIsolGammaCands.end();++iGammaCand) {
52  if((**iGammaCand).et() > gammaIsolationMinPt) {goodTau = false;}
53  }
54  }
55  if(useProngStructure) {
56  if((thePFTau->signalPFChargedHadrCands().size() != 1) && (thePFTau->signalPFChargedHadrCands().size() != 3)) {goodTau = false;}
57  }
58  }
59  if(goodTau) {
60  for(CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();calojetIter != calojetHandle->end();++calojetIter) {
61  if(deltaR(calojetIter->p4(),thePFTau->p4())<jetMatchDeltaR) {
62  if( calojetIter->pt() > jetPTthreshold && calojetIter->emEnergyFraction() < jetEMfracLimit ) {
63  double correct = correctedjets.correction (*calojetIter);
64  DeltaPx += ((correct * calojetIter->px()) - thePFTau->px());
65  DeltaPy += ((correct * calojetIter->py()) - thePFTau->py());
66  DeltaSumET += ((correct * calojetIter->et()) - thePFTau->et());
67  } else {
68  DeltaPx += (calojetIter->px() - thePFTau->px());
69  DeltaPy += (calojetIter->py() - thePFTau->py());
70  DeltaSumET += (calojetIter->et() - thePFTau->et());
71  }
72  if(matchFlag) {std::cerr << "### TauMETAlgo - ERROR: Multiple jet matches!!!! " << std::endl;}
73  matchFlag = true;
74  }
75  }
76  }
77  }
79  delta.mex = DeltaPx;
80  delta.mey = DeltaPy;
81  delta.sumet = - DeltaSumET;
82  const CaloMET* u = &(uncorMET.front());
83  double corrMetPx = u->px() + delta.mex;
84  double corrMetPy = u->py() + delta.mey;
85  MET::LorentzVector correctedMET4vector( corrMetPx, corrMetPy, 0., sqrt(corrMetPx*corrMetPx + corrMetPy*corrMetPy));
86  std::vector<CorrMETData> corrections = u->mEtCorr();
87  corrections.push_back(delta);
89  result = CaloMET(u->getSpecific(), (u->sumEt() + delta.sumet), corrections, correctedMET4vector, u->vertex());
90  corrMET->push_back(result);
91  }
dbl * delta
Definition: mlp_gen.cc:36
virtual const Point & vertex() const
vertex position
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
uint16_t size_type
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
SpecificCaloMETData getSpecific() const
Definition: CaloMET.h:79
double sumEt() const
Definition: MET.h:48
T sqrt(T t)
Definition: SSEVec.h:46
tuple result
Definition: query.py:137
double sumet
Definition: CorrMETData.h:20
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:63
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double px() const
x coordinate of momentum vector
a MET correction term
Definition: CorrMETData.h:14
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
virtual double py() const
y coordinate of momentum vector
math::PtEtaPhiELorentzVectorF LorentzVector
void TauMETAlgo::run ( edm::Event iEvent,
const edm::EventSetup iSetup,
edm::Handle< reco::PFTauCollection tauHandle,
edm::Handle< reco::CaloJetCollection calojetHandle,
double  jetPTthreshold,
double  jetEMfracLimit,
const JetCorrector correctedjets,
const std::vector< reco::MET > &  uncorMET,
double  jetMatchDeltaR,
double  tauMinEt,
double  tauEtaMax,
bool  useSeedTrack,
double  seedTrackPt,
bool  useTrackIsolation,
double  trackIsolationMinPt,
bool  useECALIsolation,
double  gammaIsolationMinPt,
bool  useProngStructure,
std::vector< reco::MET > *  corrMET 
)
virtual

Definition at line 93 of file TauMETAlgo.cc.

References edm::RefVector< C, T, F >::begin(), dtNoiseDBValidation_cfg::cerr, JetCorrector::correction(), delta, deltaR(), edm::RefVector< C, T, F >::end(), reco::MET::mEtCorr(), CorrMETData::mex, CorrMETData::mey, reco::LeafCandidate::px(), reco::LeafCandidate::py(), query::result, mathSSE::sqrt(), CorrMETData::sumet, reco::MET::sumEt(), and reco::LeafCandidate::vertex().

98  {
99 
100  std::cerr << "TauMETAlgo::run -> Test.. " << std::endl;
101 
102  double DeltaPx = 0.0;
103  double DeltaPy = 0.0;
104  double DeltaSumET = 0.0;
105  for(PFTauCollection::size_type iPFTau=0;iPFTau<tauHandle->size();iPFTau++) {
106  PFTauRef thePFTau(tauHandle,iPFTau);
107  bool matchFlag = false;
108  bool goodTau = false;
109  if((fabs(thePFTau->eta()) <= tauEtaMax) && (thePFTau->et() >= tauMinEt)) {
110  goodTau = true;
111  if(useSeedTrack) {
112  if(!(thePFTau->leadPFChargedHadrCand())) {goodTau = false;}
113  else {
114  if(thePFTau->leadPFChargedHadrCand()->et() < seedTrackPt) {goodTau = false;}
115  }
116  }
117  if(useTrackIsolation) {
118  PFCandidateRefVector PFTauProdIsolCHCands = (*thePFTau).isolationPFChargedHadrCands();
119  for(PFCandidateRefVector::const_iterator iChargedHadrCand=PFTauProdIsolCHCands.begin();
120  iChargedHadrCand!=PFTauProdIsolCHCands.end();++iChargedHadrCand) {
121  if((**iChargedHadrCand).pt() > trackIsolationMinPt) {goodTau = false;}
122  }
123  }
124  if(useECALIsolation) {
125  PFCandidateRefVector PFTauProdIsolGammaCands = (*thePFTau).isolationPFGammaCands();
126  for(PFCandidateRefVector::const_iterator iGammaCand=PFTauProdIsolGammaCands.begin();
127  iGammaCand!=PFTauProdIsolGammaCands.end();++iGammaCand) {
128  if((**iGammaCand).et() > gammaIsolationMinPt) {goodTau = false;}
129  }
130  }
131  if(useProngStructure) {
132  if((thePFTau->signalPFChargedHadrCands().size() != 1) && (thePFTau->signalPFChargedHadrCands().size() != 3)) {goodTau = false;}
133  }
134  }
135  if(goodTau) {
136  for(CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();calojetIter != calojetHandle->end();++calojetIter) {
137  if(deltaR(calojetIter->p4(),thePFTau->p4())<jetMatchDeltaR) {
138  if( calojetIter->pt() > jetPTthreshold && calojetIter->emEnergyFraction() < jetEMfracLimit ) {
139  double correct = correctedjets.correction (*calojetIter);
140  DeltaPx += ((correct * calojetIter->px()) - thePFTau->px());
141  DeltaPy += ((correct * calojetIter->py()) - thePFTau->py());
142  DeltaSumET += ((correct * calojetIter->et()) - thePFTau->et());
143  } else {
144  DeltaPx += (calojetIter->px() - thePFTau->px());
145  DeltaPy += (calojetIter->py() - thePFTau->py());
146  DeltaSumET += (calojetIter->et() - thePFTau->et());
147  }
148  if(matchFlag) {std::cerr << "### TauMETAlgo - ERROR: Multiple jet matches!!!! " << std::endl;}
149  matchFlag = true;
150  }
151  }
152  }
153  }
155  delta.mex = DeltaPx;
156  delta.mey = DeltaPy;
157  delta.sumet = - DeltaSumET;
158  const MET* u = &(uncorMET.front());
159  double corrMetPx = u->px() + delta.mex;
160  double corrMetPy = u->py() + delta.mey;
161  MET::LorentzVector correctedMET4vector( corrMetPx, corrMetPy, 0., sqrt(corrMetPx*corrMetPx + corrMetPy*corrMetPy));
162  std::vector<CorrMETData> corrections = u->mEtCorr();
163  corrections.push_back(delta);
164  MET result;
165  result = MET((u->sumEt() + delta.sumet), corrections, correctedMET4vector, u->vertex());
166  corrMET->push_back(result);
167  }
dbl * delta
Definition: mlp_gen.cc:36
virtual const Point & vertex() const
vertex position
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
uint16_t size_type
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
double sumEt() const
Definition: MET.h:48
Definition: MET.h:32
T sqrt(T t)
Definition: SSEVec.h:46
tuple result
Definition: query.py:137
double sumet
Definition: CorrMETData.h:20
std::vector< CorrMETData > mEtCorr() const
Definition: MET.h:63
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double px() const
x coordinate of momentum vector
a MET correction term
Definition: CorrMETData.h:14
double mey
Definition: CorrMETData.h:18
double mex
Definition: CorrMETData.h:17
virtual double py() const
y coordinate of momentum vector
math::PtEtaPhiELorentzVectorF LorentzVector