Loading [MathJax]/extensions/tex2jax.js

Search Results

 /*
  *  MoMEMta: a modular implementation of the Matrix Element Method
  *  Copyright (C) 2016  Universite catholique de Louvain (UCL), Belgium
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 
 #include <momemta/Logging.h>
 #include <momemta/Module.h>
 #include <momemta/ParameterSet.h>
 #include <momemta/Types.h>
 #include <momemta/Math.h>
 
 #include <Math/DistFunc.h>
 
 class GaussianTransferFunctionOnPtBase: public Module {
     public:
 
         GaussianTransferFunctionOnPtBase(PoolPtr pool, const ParameterSet& parameters): Module(pool, parameters.getModuleName()) {
             m_reco_input = get<LorentzVector>(parameters.get<InputTag>("reco_particle"));
 
             m_sigma = parameters.get<double>("sigma", 0.10);
             m_sigma_range = parameters.get<double>("sigma_range", 5);
             m_min_Pt = parameters.get<double>("min_Pt", 0.);
         }
 
     protected:
         double m_min_Pt;
         double m_sigma;
         double m_sigma_range;
 
         // Input
         Value<LorentzVector> m_reco_input;
 };
 
 class GaussianTransferFunctionOnPt: public GaussianTransferFunctionOnPtBase {
     public:
         GaussianTransferFunctionOnPt(PoolPtr pool, const ParameterSet& parameters): GaussianTransferFunctionOnPtBase(pool, parameters) {
             m_ps_point = get<double>(parameters.get<InputTag>("ps_point"));
         }
 
         virtual Status work() override {
             // Estimate the width over which to integrate using the width of the TF at Pt_rec ...
             const double sigma_Pt_rec = m_reco_input->Pt() * m_sigma;
 
             const double cosh_eta = std::cosh(m_reco_input->Eta());
             double range_min = std::max(m_min_Pt, m_reco_input->Pt() - (m_sigma_range * sigma_Pt_rec));
             double range_max = m_reco_input->Pt() + (m_sigma_range * sigma_Pt_rec);
             double range = (range_max - range_min);
 
             double gen_Pt = range_min + range * (*m_ps_point);
 
             // To change the particle's Pt without changing its direction and mass:
             const double gen_E = std::sqrt(SQ(m_reco_input->M()) + SQ(cosh_eta * gen_Pt));
 
             output->SetCoordinates(
                     gen_Pt * std::cos(m_reco_input->Phi()),
                     gen_Pt * std::sin(m_reco_input->Phi()),
                     gen_Pt * std::sinh(m_reco_input->Eta()),
                     gen_E);
 
             // ... but compute the width of the TF at Pt_gen!
             const double sigma_Pt_gen = gen_Pt * m_sigma;
 
             // Compute TF*jacobian, where the jacobian includes the transformation of [0,1]->[range_min,range_max] and d|P|/dPt = cosh(eta)
             *TF_times_jacobian = ROOT::Math::normal_pdf(gen_Pt, sigma_Pt_gen, m_reco_input->Pt()) * range * cosh_eta;
 
             return Status::OK;
         }
 
     private:
         // Input
         Value<double> m_ps_point;
 
         // Outputs
         std::shared_ptr<LorentzVector> output = produce<LorentzVector>("output");
         std::shared_ptr<double> TF_times_jacobian = produce<double>("TF_times_jacobian");
 
 };
 
 class GaussianTransferFunctionOnPtEvaluator: public GaussianTransferFunctionOnPtBase {
     public:
         GaussianTransferFunctionOnPtEvaluator(PoolPtr pool, const ParameterSet& parameters): GaussianTransferFunctionOnPtBase(pool, parameters) {
             m_gen_input = get<LorentzVector>(parameters.get<InputTag>("gen_particle"));
         }
 
         virtual Status work() override {
             // Compute TF value
             *TF_value = ROOT::Math::normal_pdf(m_gen_input->Pt(), m_gen_input->Pt() * m_sigma, m_reco_input->Pt());
 
             return Status::OK;
         }
 
     private:
         // Input
         Value<LorentzVector> m_gen_input;
 
         // Outputs
         std::shared_ptr<double> TF_value = produce<double>("TF");
 
 };
 
 REGISTER_MODULE(GaussianTransferFunctionOnPt)
         .Input("ps_point")
         .Input("reco_particle")
         .Output("output")
         .Output("TF_times_jacobian")
         .Attr("sigma:double=0.10")
         .Attr("sigma_range:double=5")
         .Attr("min_Pt:double=0");
 
 REGISTER_MODULE(GaussianTransferFunctionOnPtEvaluator)
         .Input("gen_particle")
         .Input("reco_particle")
         .Output("TF")
         .Attr("sigma:double=0.10")
         .Attr("sigma_range:double=5")
         .Attr("min_Pt:double=0");
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages