Search Results
FlatTransferFunctionOnTheta.cc
/*
* 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/Utils.h>
class FlatTransferFunctionOnTheta: public Module {
public:
FlatTransferFunctionOnTheta(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"));
};
virtual Status work() override {
const double& ps_point = *m_ps_point;
const LorentzVector& reco_particle = *m_input;
const double new_theta = M_PI*ps_point;
// Set the output vector's theta angle using the generated value, keeping the input's |P|, phi and E
output->SetCoordinates(
reco_particle.P() * std::sin(new_theta) * std::cos(reco_particle.Phi()),
reco_particle.P() * std::sin(new_theta) * std::sin(reco_particle.Phi()),
reco_particle.P() * std::cos(new_theta),
reco_particle.E());
// Compute TF*jacobian, ie the jacobian of the transformation of [0,1]->[0,pi]
*TF_times_jacobian = M_PI;
return Status::OK;
}
private:
// 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(FlatTransferFunctionOnTheta)
.Input("ps_point")
.Input("reco_particle")
.Output("output")
.Output("TF_times_jacobian");