CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoTauEnergyRecoveryPlugin2.cc
Go to the documentation of this file.
1 /*
2  * =============================================================================
3  * Filename: RecoTauEnergyRecoveryPlugin2.cc
4  *
5  * Description: Set tau energy to sum of **all** PFCandidates
6  * (regardless of PFCandidate type and whether
7  * PFCandidate passes or fails quality cuts)
8  *
9  * NOTE: use for testing only,
10  * this code has **not** yet been commissioned !!
11  *
12  * Created: 02/02/2013 17:09:00
13  *
14  * Authors: Christian Veelken (LLR)
15  *
16  * =============================================================================
17  */
18 
28 
30 
32 
33 #include <algorithm>
34 
35 namespace reco { namespace tau {
36 
38 {
39  public:
40 
43  void operator()(PFTau&) const override;
44  virtual void beginEvent() override;
45 
46  private:
47 
48  double dRcone_;
49 };
50 
52  : RecoTauModifierPlugin(cfg, std::move(iC)),
53  dRcone_(cfg.getParameter<double>("dRcone"))
54 {}
55 
57 {}
58 
60 {}
61 
63 {
64  reco::Candidate::LorentzVector tauAltP4(0.,0.,0.,0.);
65 
66  std::vector<reco::PFCandidatePtr> pfJetConstituents = tau.jetRef()->getPFConstituents();
67  for ( std::vector<reco::PFCandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin();
68  pfJetConstituent != pfJetConstituents.end(); ++pfJetConstituent ) {
69  double dR = deltaR((*pfJetConstituent)->p4(), tau.p4());
70  if ( dR < dRcone_ ) tauAltP4 += (*pfJetConstituent)->p4();
71  }
72 
73  tau.setalternatLorentzVect(tauAltP4);
74 }
75 
76 }} // end namespace reco::tau
77 
81  "RecoTauEnergyRecoveryPlugin2");
const PFJetRef & jetRef() const
Definition: PFTau.cc:54
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
RecoTauEnergyRecoveryPlugin2(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
void setalternatLorentzVect(const math::XYZTLorentzVector &)
Definition: BaseTau.cc:24
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:41
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector