CMS 3D CMS Logo

PFRecoTauMassPlugin.cc
Go to the documentation of this file.
1 /*
2  * =============================================================================
3  * Filename: PFRecoTauMassPlugin.cc
4  *
5  * Description: Set mass of taus reconstructed in 1prong0pi0 decay mode
6  * to charged pion mass
7  *
8  * Created: 27/10/2015 10:30:00
9  *
10  * Authors: Christian Veelken (Tallinn)
11  *
12  * =============================================================================
13  */
14 
16 
19 
20 #include <TMath.h>
21 
22 namespace reco { namespace tau {
23 
25 {
26  public:
27 
29  ~PFRecoTauMassPlugin() override;
30  void operator()(PFTau&) const override;
31  void beginEvent() override;
32  void endEvent() override;
33 
34  private:
35 
37 };
38 
40  : RecoTauModifierPlugin(cfg, std::move(iC))
41 {
42  verbosity_ = cfg.getParameter<int>("verbosity");
43 }
44 
46 {}
47 
49 {}
50 
52 {
53  if ( verbosity_ ) {
54  std::cout << "<PFRecoTauMassPlugin::operator()>:" << std::endl;
55  std::cout << "tau: Pt = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << ", mass = " << tau.mass() << " (decayMode = " << tau.decayMode() << ")" << std::endl;
56  }
57 
59  double tauEn = tau.energy();
60  const double chargedPionMass = 0.13957; // GeV
61  if ( tauEn < chargedPionMass ) tauEn = chargedPionMass;
62  double tauP_modified = TMath::Sqrt(tauEn*tauEn - chargedPionMass*chargedPionMass);
63  double tauPx_modified = TMath::Cos(tau.phi())*TMath::Sin(tau.theta())*tauP_modified;
64  double tauPy_modified = TMath::Sin(tau.phi())*TMath::Sin(tau.theta())*tauP_modified;
65  double tauPz_modified = TMath::Cos(tau.theta())*tauP_modified;
66  reco::Candidate::LorentzVector tauP4_modified(tauPx_modified, tauPy_modified, tauPz_modified, tauEn);
67  if ( verbosity_ ) {
68  std::cout << "--> setting tauP4: Pt = " << tauP4_modified.pt() << ", eta = " << tauP4_modified.eta() << ", phi = " << tauP4_modified.phi() << ", mass = " << tauP4_modified.mass() << std::endl;
69  }
70  tau.setP4(tauP4_modified);
71  }
72 }
73 
75 {}
76 
77 }} // end namespace reco::tau
78 
80 
T getParameter(std::string const &) const
double eta() const final
momentum pseudorapidity
double theta() const final
momentum polar angle
double pt() const final
transverse momentum
void operator()(PFTau &) const override
hadronicDecayMode decayMode() const
Definition: PFTau.cc:315
PFRecoTauMassPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
double energy() const final
energy
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
fixed size matrix
#define DEFINE_EDM_PLUGIN(factory, type, name)
double phi() const final
momentum azimuthal angle
void setP4(const LorentzVector &p4) final
set 4-momentum
def move(src, dest)
Definition: eostools.py:511
double mass() const final
mass