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/ParameterSet.h>
 #include <momemta/Module.h>
 #include <momemta/Types.h>
 #include <momemta/Math.h>
 
 class FlatTransferFunctionOnP: public Module {
     public:
 
         FlatTransferFunctionOnP(PoolPtr pool, const ParameterSet& parameters): Module(pool, parameters.getModuleName()) {
             m_ps_point = get<double>(parameters.get<InputTag>("ps_point"));
             m_input = get<LorentzVector>(parameters.get<InputTag>("reco_particle"));
 
             m_PMin = parameters.get<double>("min");
             m_PMax = parameters.get<double>("max");
         };
 
         virtual Status work() override {
 
             const double& ps_point = *m_ps_point;
             const LorentzVector& reco_particle = *m_input;
 
             const double range = m_PMax - m_PMin;
             const double gen_P = m_PMin + range*ps_point;
 
             // To change the particle's |P| without changing its direction and mass:
             double gen_E = sqrt(SQ(gen_P) + SQ(reco_particle.M()));
             output->SetCoordinates(
                 gen_P * std::sin(reco_particle.Theta()) * std::cos(reco_particle.Phi()),
                 gen_P * std::sin(reco_particle.Theta()) * std::sin(reco_particle.Phi()),
                 gen_P * std::cos(reco_particle.Theta()),
                 gen_E);
 
             // Compute TF*jacobian, ie the jacobian of the transformation of [0,1]->[range_min,range_max]
             *TF_times_jacobian = range;
 
             return Status::OK;
         }
 
     private:
 
         double m_PMin, m_PMax;
 
         // Inputs
         Value<double> m_ps_point;
         Value<LorentzVector> m_input;
 
         // Outputs
         std::shared_ptr<LorentzVector> output = produce<LorentzVector>("output");
         std::shared_ptr<double> TF_times_jacobian = produce<double>("TF_times_jacobian");
 };
 
 REGISTER_MODULE(FlatTransferFunctionOnP)
         .Input("ps_point")
         .Input("reco_particle")
         .Output("output")
         .Output("TF_times_jacobian")
         .Attr("min:double")
         .Attr("max:double");
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages