ComPWA
Common Partial-Wave-Analysis Framework
Event.cpp
Go to the documentation of this file.
1 // Copyright (c) 2013, 2017 The ComPWA Team.
2 // This file is part of the ComPWA framework, check
3 // https://github.com/ComPWA/ComPWA/license.txt for details.
4 
5 #include <algorithm>
6 
7 #include "Core/Event.hpp"
8 
9 namespace ComPWA {
10 
11 std::ostream &operator<<(std::ostream &os, const Event &ev) {
12  os << "Event: weight=" << ev.Weight << "\n";
13  os << "Particle four-momenta (N=" << ev.FourMomenta.size() << "):\n";
14  for (auto const &x : ev.FourMomenta)
15  os << x << std::endl;
16 
17  return os;
18 }
19 
20 double calculateInvariantMass(const Event &ev) {
21  FourMomentum p4;
22  for (auto x : ev.FourMomenta)
23  p4 += x;
24  return p4.invariantMass();
25 }
26 
27 double getMaximumSampleWeight(const EventCollection &Sample) {
28  double MaxWeight(0.0);
29  auto MaxIterator =
30  std::max_element(Sample.Events.begin(), Sample.Events.end(),
31  [](const Event &a, const Event &b) -> bool {
32  return a.Weight < b.Weight;
33  });
34  if (MaxIterator != Sample.Events.end())
35  MaxWeight = MaxIterator->Weight;
36  return MaxWeight;
37 }
38 
39 } // namespace ComPWA
ComPWA four momentum class.
double invariantMass() const
std::ostream & operator<<(std::ostream &os, const Event &ev)
Definition: Event.cpp:11
std::vector< Event > Events
Definition: Event.hpp:34
double Weight
Definition: Event.hpp:22
std::vector< FourMomentum > FourMomenta
Definition: Event.hpp:21
double calculateInvariantMass(const Event &ev)
Definition: Event.cpp:20
Data structure containing all kinematic information of a physics event.
Definition: Event.hpp:20
double getMaximumSampleWeight(const EventCollection &Sample)
Definition: Event.cpp:27