Belle II Software  release-06-01-15
EventT0.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <framework/gearbox/Const.h>
11 #include <TObject.h>
12 
13 #include <boost/optional.hpp>
14 
15 #include <vector>
16 #include <cmath>
17 
18 namespace Belle2 {
30  class EventT0 : public TObject {
31 
32  public:
36  EventT0Component() = default;
37 
39  EventT0Component(double eventT0_, double eventT0Uncertainty_, const Const::DetectorSet& detectorSet_,
40  const std::string& algorithm_ = "", double quality_ = NAN) :
41  eventT0(eventT0_), eventT0Uncertainty(eventT0Uncertainty_), detectorSet(detectorSet_),
42  algorithm(algorithm_), quality(quality_) {}
43 
45  double eventT0 = NAN;
47  double eventT0Uncertainty = NAN;
55  std::string algorithm = "";
57  double quality = NAN;
58 
59  ClassDefNV(EventT0Component, 3)
60  };
61 
63  bool hasEventT0() const;
64 
66  double getEventT0() const;
67 
69  boost::optional<EventT0Component> getEventT0Component() const;
70 
72  double getEventT0Uncertainty() const;
73 
75  void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet& detector, const std::string& algorithm = "");
76 
78  void setEventT0(const EventT0Component& eventT0);
79 
81  void addTemporaryEventT0(const EventT0Component& eventT0);
82 
84  const std::vector<EventT0Component>& getTemporaryEventT0s() const;
85 
87  const std::vector<EventT0Component> getTemporaryEventT0s(Const::EDetector detector) const;
88 
90  bool hasTemporaryEventT0(const Const::DetectorSet& detectorSet = Const::allDetectors) const;
91 
94 
96  unsigned long getNumberOfTemporaryEventT0s() const;
97 
99  void clearTemporaries();
100 
106  void clearEventT0();
107 
108  private:
110  std::vector<EventT0Component> m_temporaryEventT0List;
114  bool m_hasEventT0 = false;
115 
116  ClassDef(EventT0, 5)
117  };
119 }
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:71
static const DetectorSet allDetectors
The set of all detectors.
Definition: Const.h:279
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Storage element for the eventwise T0 estimation.
Definition: EventT0.h:30
std::vector< EventT0Component > m_temporaryEventT0List
Internal storage of the temporary event t0 list.
Definition: EventT0.h:110
boost::optional< EventT0Component > getEventT0Component() const
Return the final event t0, if one is set. Else, return an empty optional.
Definition: EventT0.cc:31
EventT0Component m_eventT0
Internal storage for the final event t0.
Definition: EventT0.h:112
void clearTemporaries()
Clear the list of temporary event T0 estimations.
Definition: EventT0.cc:107
void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet &detector, const std::string &algorithm="")
Replace/set the final double T0 estimation.
Definition: EventT0.cc:47
double getEventT0() const
Return the final event t0, if one is set. Else, return NAN.
Definition: EventT0.cc:25
void clearEventT0()
Clear the final EventT0, this is neded in case some algorithm has set one for an itertive t0 finding ...
Definition: EventT0.cc:112
bool hasEventT0() const
Check if a final event t0 is set.
Definition: EventT0.cc:19
void addTemporaryEventT0(const EventT0Component &eventT0)
Add another temporary double T0 estimation.
Definition: EventT0.cc:102
bool m_hasEventT0
Internal storage of the final eventT0 is set.
Definition: EventT0.h:114
const std::vector< EventT0Component > & getTemporaryEventT0s() const
Return the list of all temporary event t0 estimations.
Definition: EventT0.cc:70
bool hasTemporaryEventT0(const Const::DetectorSet &detectorSet=Const::allDetectors) const
Check if one of the detectors in the given set has a temporary t0 estimation.
Definition: EventT0.cc:59
unsigned long getNumberOfTemporaryEventT0s() const
Return the number of stored event T0s.
Definition: EventT0.cc:97
Const::DetectorSet getTemporaryDetectors() const
Get the detectors that have determined temporary event T0s.
Definition: EventT0.cc:86
double getEventT0Uncertainty() const
Return the final event t0 uncertainty, if one is set. Else, return NAN.
Definition: EventT0.cc:41
Abstract base class for different kinds of events.
Structure for storing the extracted event t0s together with its detector and its uncertainty.
Definition: EventT0.h:34
double quality
Storage for the internal quality estimation for a single algorithm. Only comparable for all temporari...
Definition: EventT0.h:57
double eventT0
Storage of the T0 estimation.
Definition: EventT0.h:45
Const::DetectorSet detectorSet
Storage of the detector, who has determined the event T0.
Definition: EventT0.h:53
EventT0Component(double eventT0_, double eventT0Uncertainty_, const Const::DetectorSet &detectorSet_, const std::string &algorithm_="", double quality_=NAN)
Convenience constructor.
Definition: EventT0.h:39
EventT0Component()=default
Empty constructor for ROOT.
double eventT0Uncertainty
Storage of the uncertainty of the T0 estimation.
Definition: EventT0.h:47
std::string algorithm
Storage for which algorithm created the event t0.
Definition: EventT0.h:55