FlatTransferFunctionOnPhi.cc
1 /*
2  * MoMEMta: a modular implementation of the Matrix Element Method
3  * Copyright (C) 2016 Universite catholique de Louvain (UCL), Belgium
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include <momemta/ParameterSet.h>
20 #include <momemta/Module.h>
21 #include <momemta/Types.h>
22 #include <momemta/Utils.h>
23 
24 #include <Math/RotationZ.h>
25 
59  public:
60 
61  FlatTransferFunctionOnPhi(PoolPtr pool, const ParameterSet& parameters): Module(pool, parameters.getModuleName()) {
62  m_ps_point = get<double>(parameters.get<InputTag>("ps_point"));
63  m_input = get<LorentzVector>(parameters.get<InputTag>("reco_particle"));
64  };
65 
66  virtual Status work() override {
67 
68  const double& ps_point = *m_ps_point;
69  const LorentzVector& reco_particle = *m_input;
70 
71  m_Rotation.SetAngle(2*M_PI*ps_point);
72 
73  *output = m_Rotation*reco_particle;
74 
75  // Compute TF*jacobian, ie the jacobian of the transformation of [0,1]->[0,2pi]
76  *TF_times_jacobian = 2*M_PI;
77 
78  return Status::OK;
79  }
80 
81  private:
82  ROOT::Math::RotationZ m_Rotation;
83 
84  // Inputs
85  Value<double> m_ps_point;
86  Value<LorentzVector> m_input;
87 
88  // Outputs
89  std::shared_ptr<LorentzVector> output = produce<LorentzVector>("output");
90  std::shared_ptr<double> TF_times_jacobian = produce<double>("TF_times_jacobian");
91 };
92 
93 REGISTER_MODULE(FlatTransferFunctionOnPhi)
94  .Input("ps_point")
95  .Input("reco_particle")
96  .Output("output")
97  .Output("TF_times_jacobian");
virtual Status work() override
Main function.
An identifier of a module&#39;s output.
Definition: InputTag_fwd.h:37
Parent class for all the modules.
Definition: Module.h:37
A class encapsulating a lua table.
Definition: ParameterSet.h:82
Module(PoolPtr pool, const std::string &name)
Constructor.
Definition: Module.h:61
Flat transfer function on Phi (mainly for testing purposes).