DDASToys for NSCLDAQ  6.2-000
DDASFitHit.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Jeromy Tompkins
13  Aaron Chester
14  FRIB
15  Michigan State University
16  East Lansing, MI 48824-1321
17 */
18 
25 #ifndef DDASFITHIT_H
26 #define DDASFITHIT_H
27 
28 #include <DDASHit.h> // Base class
29 
30 #include <stdexcept>
31 
32 #include "fit_extensions.h" // Defines HitExtension.
33 
34 namespace ddastoys {
35 
45  class DDASFitHit : public ddasfmt::DDASHit
46  {
47  private:
48  bool m_haveExtension;
49  HitExtension m_extension;
50 
51  public:
52  DDASFitHit() { Reset(); }
53  virtual ~DDASFitHit() {}
54 
63  if (this != &rhs) {
64  ddasfmt::DDASHit::operator=(rhs);
65  m_haveExtension = false;
66  if (rhs.hasExtension()) {
67  auto ext = rhs.getExtension();
68  setExtension(ext);
69  }
70  }
71  return *this;
72  }
73 
75  void Reset() {
76  m_haveExtension = false;
77  ddasfmt::DDASHit::Reset(); // Reset base class membrers.
78  }
83  void setExtension(const HitExtension& extension) {
84  m_extension = extension;
85  m_haveExtension = true;
86  }
91  bool hasExtension() const { return m_haveExtension; }
97  const HitExtension& getExtension() const {
98  if (m_haveExtension) {
99  return m_extension;
100  } else {
101  throw std::logic_error(
102  "Asked for extension for event with none"
103  );
104  }
105  }
106  };
107 
108 } // namespace ddastoys
109 
110 #endif
Encapsulates data for DDAS hits that may have fitted traces.
Definition: DDASFitHit.h:46
DDASFitHit()
Constructor.
Definition: DDASFitHit.h:52
DDASFitHit & operator=(const DDASFitHit &rhs)
Assignment operator.
Definition: DDASFitHit.h:62
const HitExtension & getExtension() const
Get the extension data from the current hit.
Definition: DDASFitHit.h:97
void setExtension(const HitExtension &extension)
Set the hit extension information for this hit.
Definition: DDASFitHit.h:83
bool hasExtension() const
Check whether hit has a fit extension.
Definition: DDASFitHit.h:91
void Reset()
Reset the hit information.
Definition: DDASFitHit.h:75
virtual ~DDASFitHit()
Destructor.
Definition: DDASFitHit.h:53
Define structs used by fitting functions and to extend DDAS hits.
The data structure appended to each fit hit.
Definition: fit_extensions.h:82