CMS 3D CMS Logo

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 
31 #include <algorithm>
32 
33 namespace reco {
34  namespace tau {
35 
37  public:
40  void operator()(PFTau&) const override;
41  void beginEvent() override;
42 
43  private:
44  double dRcone_;
45  };
46 
49  : RecoTauModifierPlugin(cfg, std::move(iC)), dRcone_(cfg.getParameter<double>("dRcone")) {}
50 
52 
54 
56  reco::Candidate::LorentzVector tauAltP4(0., 0., 0., 0.);
57 
58  std::vector<reco::CandidatePtr> pfJetConstituents = tau.jetRef()->getJetConstituents();
59  for (std::vector<reco::CandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin();
60  pfJetConstituent != pfJetConstituents.end();
61  ++pfJetConstituent) {
62  double dR = deltaR((*pfJetConstituent)->p4(), tau.p4());
63  if (dR < dRcone_)
64  tauAltP4 += (*pfJetConstituent)->p4();
65  }
66 
67  tau.setalternatLorentzVect(tauAltP4);
68  }
69 
70  } // namespace tau
71 } // namespace reco
72 
76  "RecoTauEnergyRecoveryPlugin2");
RecoTauEnergyRecoveryPlugin2(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
fixed size matrix
#define DEFINE_EDM_PLUGIN(factory, type, name)
def move(src, dest)
Definition: eostools.py:511