test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual ~PFRecoTauMassPlugin();
30  void operator()(PFTau&) const;
31  virtual void beginEvent();
32  virtual void endEvent();
33 
34  private:
35 
37 };
38 
40  : RecoTauModifierPlugin(cfg, std::move(iC))
41 {
42  verbosity_ = ( cfg.exists("verbosity") ) ?
43  cfg.getParameter<int>("verbosity") : 0;
44 }
45 
47 {}
48 
50 {}
51 
53 {
54  if ( verbosity_ ) {
55  std::cout << "<PFRecoTauMassPlugin::operator()>:" << std::endl;
56  std::cout << "tau: Pt = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi() << ", mass = " << tau.mass() << " (decayMode = " << tau.decayMode() << ")" << std::endl;
57  }
58 
60  double tauEn = tau.energy();
61  const double chargedPionMass = 0.13957; // GeV
62  if ( tauEn < chargedPionMass ) tauEn = chargedPionMass;
63  double tauP_modified = TMath::Sqrt(tauEn*tauEn - chargedPionMass*chargedPionMass);
64  double tauPx_modified = TMath::Cos(tau.phi())*TMath::Sin(tau.theta())*tauP_modified;
65  double tauPy_modified = TMath::Sin(tau.phi())*TMath::Sin(tau.theta())*tauP_modified;
66  double tauPz_modified = TMath::Cos(tau.theta())*tauP_modified;
67  reco::Candidate::LorentzVector tauP4_modified(tauPx_modified, tauPy_modified, tauPz_modified, tauEn);
68  if ( verbosity_ ) {
69  std::cout << "--> setting tauP4: Pt = " << tauP4_modified.pt() << ", eta = " << tauP4_modified.eta() << ", phi = " << tauP4_modified.phi() << ", mass = " << tauP4_modified.mass() << std::endl;
70  }
71  tau.setP4(tauP4_modified);
72  }
73 }
74 
76 {}
77 
78 }} // end namespace reco::tau
79 
81 
T getParameter(std::string const &) const
tuple cfg
Definition: looper.py:293
virtual double energy() const final
energy
bool exists(std::string const &parameterName) const
checks if a parameter exists
virtual double phi() const final
momentum azimuthal angle
hadronicDecayMode decayMode() const
Definition: PFTau.cc:212
PFRecoTauMassPlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
def move
Definition: eostools.py:510
virtual double mass() const final
mass
virtual void setP4(const LorentzVector &p4) final
set 4-momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
virtual double theta() const final
momentum polar angle
tuple cout
Definition: gather_cfg.py:145
#define DEFINE_EDM_PLUGIN(factory, type, name)
virtual double eta() const final
momentum pseudorapidity
virtual double pt() const final
transverse momentum