LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Event.cxx
Go to the documentation of this file.
1 //
3 // \brief Definition of event object for LArSoft
4 //
5 // \author brebel@fnal.gov
6 //
9 
12 
14 
15 #include "TMath.h"
16 
17 #include <iomanip>
18 #include <iostream>
19 
20 namespace recob{
21 
22  //----------------------------------------------------------------------
24  :
26  {
27  }
28 
29  //----------------------------------------------------------------------
30  Event::Event(int id)
31  : fID(id)
32  {
33  }
34 
35  //----------------------------------------------------------------------
36  double Event::Energy() const
37  {
38  // loop over all vertex objects and get the
39  mf::LogWarning("Event") << "Event::Energy() is not yet defined. Need to decide "
40  << " how to calculate energy of Vertex"
41  << " Return util:kBogusD for now.";
42 
43  return util::kBogusD;
44  }
45 
46  //----------------------------------------------------------------------
47  double Event::SigmaEnergy() const
48  {
49  // loop over all vertex objects and get the
50  mf::LogWarning("Event") << "Event::SigmaEnergy() is not yet defined. Need to decide "
51  << " how to calculate uncertainty in energy of Prong/Vertex"
52  << " Return util:kBogusD for now.";
53 
54  return util::kBogusD;
55  }
56 
57  //----------------------------------------------------------------------
58  const recob::Vertex* Event::PrimaryVertex( std::vector<const recob::Vertex*>& vtxs ) const
59  {
60  // sort the vertices, set the first one in z to be the primary
61  std::sort(vtxs.begin(), vtxs.end());
62  return vtxs.front();
63  }
64 
65  //----------------------------------------------------------------------
66  // ostream operator.
67  //
68  std::ostream& operator<< (std::ostream& o, const Event & a)
69  {
70 
71  o << std::setprecision(5);
72  o << "Event " << a.fID << std::setw(5)
73  << " Energy = " << a.Energy() << " +/- " << a.SigmaEnergy() << std::endl;
74 
75  return o;
76  }
77 
78 
79  //----------------------------------------------------------------------
80  // < operator.
81  //
82  bool operator < (const Event & a, const Event & b)
83  {
84 
85  return a.Energy() < b.Energy();
86 
87  }
88 
89 
90 }
int fID
id for this event
Definition: Event.h:28
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
Reconstruction base classes.
double Energy() const
Definition: Event.cxx:36
constexpr int kBogusI
obviously bogus integer value
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
friend bool operator<(const Event &a, const Event &b)
Definition: Event.cxx:82
friend std::ostream & operator<<(std::ostream &o, const Event &a)
Definition: Event.cxx:68
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
double SigmaEnergy() const
Definition: Event.cxx:47
constexpr double kBogusD
obviously bogus double value
const recob::Vertex * PrimaryVertex(std::vector< const recob::Vertex * > &vtxs) const
Definition: Event.cxx:58