All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Event.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // \brief Definition of event object for LArSoft
4 //
5 // \author brebel@fnal.gov
6 //
7 ////////////////////////////////////////////////////////////////////////////
9 
11 #include "messagefacility/MessageLogger/MessageLogger.h"
12 
13 #include <iomanip>
14 #include <ostream>
15 #include <algorithm> // for std::sort
16 
17 namespace recob{
18 
19  //----------------------------------------------------------------------
21  :
22  Event(util::kBogusI)
23  {
24  }
25 
26  //----------------------------------------------------------------------
27  Event::Event(int id)
28  : fID(id)
29  {
30  }
31 
32  //----------------------------------------------------------------------
33  double Event::Energy() const
34  {
35  // loop over all vertex objects and get the
36  mf::LogWarning("Event") << "Event::Energy() is not yet defined. Need to decide "
37  << " how to calculate energy of Vertex"
38  << " Return util:kBogusD for now.";
39 
40  return util::kBogusD;
41  }
42 
43  //----------------------------------------------------------------------
44  double Event::SigmaEnergy() const
45  {
46  // loop over all vertex objects and get the
47  mf::LogWarning("Event") << "Event::SigmaEnergy() is not yet defined. Need to decide "
48  << " how to calculate uncertainty in energy of Prong/Vertex"
49  << " Return util:kBogusD for now.";
50 
51  return util::kBogusD;
52  }
53 
54  //----------------------------------------------------------------------
55  const recob::Vertex* Event::PrimaryVertex( std::vector<const recob::Vertex*>& vtxs ) const
56  {
57  // sort the vertices, set the first one in z to be the primary
58  std::sort(vtxs.begin(), vtxs.end());
59  return vtxs.front();
60  }
61 
62  //----------------------------------------------------------------------
63  // ostream operator.
64  //
65  std::ostream& operator<< (std::ostream& o, const Event & a)
66  {
67 
68  o << std::setprecision(5);
69  o << "Event " << a.fID << std::setw(5)
70  << " Energy = " << a.Energy() << " +/- " << a.SigmaEnergy() << std::endl;
71 
72  return o;
73  }
74 
75 
76  //----------------------------------------------------------------------
77  // < operator.
78  //
79  bool operator < (const Event & a, const Event & b)
80  {
81 
82  return a.Energy() < b.Energy();
83 
84  }
85 
86 
87 }
int fID
id for this event
Definition: Event.h:28
bool operator<(Cluster const &a, Cluster const &b)
Definition: Cluster.cxx:196
double Energy() const
Definition: Event.cxx:33
constexpr int kBogusI
obviously bogus integer value
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
process_name gaushit a
Represents the Event implemented as a self balancing binary search tree.
double SigmaEnergy() const
Definition: Event.cxx:44
constexpr double kBogusD
obviously bogus double value
const recob::Vertex * PrimaryVertex(std::vector< const recob::Vertex * > &vtxs) const
Definition: Event.cxx:55
Collection of Physical constants used in LArSoft.
std::ostream & operator<<(std::ostream &o, Cluster const &c)
Definition: Cluster.cxx:173