tt_fullyleptonic.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 
20 #include <momemta/ConfigurationReader.h>
21 #include <momemta/Logging.h>
22 #include <momemta/MoMEMta.h>
23 #include <momemta/Unused.h>
24 
25 #include <TH1D.h>
26 
27 #include <chrono>
28 
29 using namespace std::chrono;
30 using namespace momemta;
31 
32 int main(int argc, char** argv) {
33 
34  UNUSED(argc);
35  UNUSED(argv);
36 
37  logging::set_level(logging::level::debug);
38 
39  ParameterSet lua_parameters;
40  lua_parameters.set("USE_TF", true);
41  lua_parameters.set("USE_PERM", true);
42 
43  ConfigurationReader configuration("../examples/tt_fullyleptonic.lua", lua_parameters);
44 
45  // Change top mass
46  configuration.getGlobalParameters().set("top_mass", 173.);
47 
48  MoMEMta weight(configuration.freeze());
49 
50  // Electron
51  Particle electron { "electron", LorentzVector(16.171895980835, -13.7919054031372, -3.42997527122497, 21.5293197631836), -11 };
52  // b-quark
53  Particle b1 { "bjet1", LorentzVector(-55.7908325195313, -111.59294128418, -122.144721984863, 174.66259765625), 5 };
54  // Muon
55  Particle muon { "muon", LorentzVector(-18.9018573760986, 10.0896110534668, -0.602926552295686, 21.4346446990967), +13 };
56  // Anti b-quark
57  Particle b2 { "bjet2", LorentzVector(71.3899612426758, 96.0094833374023, -77.2513122558594, 142.492813110352), -5 };
58 
59  auto start_time = system_clock::now();
60  std::vector<std::pair<double, double>> weights = weight.computeWeights({muon, electron, b1, b2});
61  auto end_time = system_clock::now();
62 
63  LOG(debug) << "Result:";
64  for (const auto& r: weights) {
65  LOG(debug) << r.first << " +- " << r.second;
66  }
67 
68  LOG(debug) << "Integration status: " << (int) weight.getIntegrationStatus();
69 
70  InputTag dmemInputTag {"dmem", "hist"};
71  bool exists = weight.getPool().exists(dmemInputTag);
72 
73  LOG(debug) << "Hist in pool: " << exists;
74 
75  if (exists) {
76  Value<TH1D> dmem = weight.getPool().get<TH1D>(dmemInputTag);
77  LOG(debug) << "DMEM integral: " << dmem->Integral();
78  }
79 
80  LOG(info) << "Weight computed in " << std::chrono::duration_cast<milliseconds>(end_time - start_time).count() << "ms";
81 
82 
83  return 0;
84 }
A lua configuration file parser.
A MoMEMta instance.
Definition: MoMEMta.h:44
std::enable_if< std::is_same< T, bool >::value||std::is_same< T, InputTag >::value >::type set(const std::string &name, const T &value)
Change the value of a given parameter. If the parameter does not exist, it&#39;s first created...
Definition: ParameterSet.h:160
Definition: Graph.h:21
An identifier of a module&#39;s output.
Definition: InputTag_fwd.h:37
Describe a reco particle. Used as input of MoMEMta::computeWeights.
Definition: Particle.h:30
A class encapsulating a lua table.
Definition: ParameterSet.h:82
A class representing a value produced by a module.
Definition: Value.h:30