StandardPhaseSpace.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/Math.h>
20 #include <momemta/Module.h>
21 #include <momemta/ParameterSet.h>
22 #include <momemta/Types.h>
23 
49 class StandardPhaseSpace: public Module {
50  public:
51 
52  StandardPhaseSpace(PoolPtr pool, const ParameterSet& parameters): Module(pool, parameters.getModuleName()) {
53  std::vector<InputTag> input_particles_tags = parameters.get<std::vector<InputTag>>("particles");
54  for (auto& t: input_particles_tags)
55  input_particles.push_back(get<LorentzVector>(t));
56  };
57 
58  virtual Status work() override {
59 
60  *phase_space = 1;
61  for (const auto& p: input_particles) {
62  *phase_space *= SQ(p->P()) * sin(p->Theta()) / (2.0 * p->E() * CB(2. * M_PI));
63  }
64 
65  return Status::OK;
66  }
67 
68  private:
69 
70  // Inputs
71  std::vector<Value<LorentzVector>> input_particles;
72 
73  // Outputs
74  std::shared_ptr<double> phase_space = produce<double>("phase_space");
75 };
76 
77 REGISTER_MODULE(StandardPhaseSpace)
78  .Inputs("particles")
79  .Output("phase_space");
Mathematical functions.
Parent class for all the modules.
Definition: Module.h:37
A class encapsulating a lua table.
Definition: ParameterSet.h:82
#define SQ(x)
Compute .
Definition: Math.h:25
Module(PoolPtr pool, const std::string &name)
Constructor.
Definition: Module.h:61
#define CB(x)
Compute .
Definition: Math.h:27
virtual Status work() override
Main function.
Compute the phase space density for observed particles (not concerned by the change of variable) ...