Belle II Software  release-05-02-19
EventT0.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <framework/gearbox/Const.h>
13 #include <TObject.h>
14 
15 #include <boost/optional.hpp>
16 
17 #include <vector>
18 #include <cmath>
19 
20 namespace Belle2 {
32  class EventT0 : public TObject {
33 
34  public:
36  struct EventT0Component {
38  EventT0Component() = default;
39 
41  EventT0Component(double eventT0_, double eventT0Uncertainty_, const Const::DetectorSet& detectorSet_,
42  const std::string& algorithm_ = "", double quality_ = NAN) :
43  eventT0(eventT0_), eventT0Uncertainty(eventT0Uncertainty_), detectorSet(detectorSet_),
44  algorithm(algorithm_), quality(quality_) {}
45 
47  double eventT0 = NAN;
49  double eventT0Uncertainty = NAN;
57  std::string algorithm = "";
59  double quality = NAN;
60 
61  ClassDefNV(EventT0Component, 3)
62  };
63 
65  bool hasEventT0() const;
66 
68  double getEventT0() const;
69 
71  boost::optional<EventT0Component> getEventT0Component() const;
72 
74  double getEventT0Uncertainty() const;
75 
77  void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet& detector, const std::string& algorithm = "");
78 
80  void setEventT0(const EventT0Component& eventT0);
81 
83  void addTemporaryEventT0(const EventT0Component& eventT0);
84 
86  const std::vector<EventT0Component>& getTemporaryEventT0s() const;
87 
89  const std::vector<EventT0Component> getTemporaryEventT0s(Const::EDetector detector) const;
90 
92  bool hasTemporaryEventT0(const Const::DetectorSet& detectorSet = Const::allDetectors) const;
93 
96 
98  unsigned long getNumberOfTemporaryEventT0s() const;
99 
101  void clearTemporaries();
102 
108  void clearEventT0();
109 
110  private:
112  std::vector<EventT0Component> m_temporaryEventT0List;
116  bool m_hasEventT0 = false;
117 
118  ClassDef(EventT0, 5)
119  };
121 }
Belle2::EventT0::getTemporaryDetectors
Const::DetectorSet getTemporaryDetectors() const
Get the detectors that have determined temporary event T0s.
Definition: EventT0.cc:88
Belle2::EventT0::m_hasEventT0
bool m_hasEventT0
Internal storage of the final eventT0 is set.
Definition: EventT0.h:124
Belle2::EventT0
Storage element for the eventwise T0 estimation.
Definition: EventT0.h:40
Belle2::EventT0::getNumberOfTemporaryEventT0s
unsigned long getNumberOfTemporaryEventT0s() const
Return the number of stored event T0s.
Definition: EventT0.cc:99
Belle2::EventT0::hasEventT0
bool hasEventT0() const
Check if a final event t0 is set.
Definition: EventT0.cc:21
Belle2::EventT0::m_eventT0
EventT0Component m_eventT0
Internal storage for the final event t0.
Definition: EventT0.h:122
Belle2::EventT0::EventT0Component::algorithm
std::string algorithm
Storage for which algorithm created the event t0.
Definition: EventT0.h:65
Belle2::EventT0::EventT0Component::eventT0
double eventT0
Storage of the T0 estimation.
Definition: EventT0.h:55
Belle2::EventT0::EventT0Component::eventT0Uncertainty
double eventT0Uncertainty
Storage of the uncertainty of the T0 estimation.
Definition: EventT0.h:57
Belle2::EventT0::clearTemporaries
void clearTemporaries()
Clear the list of temporary event T0 estimations.
Definition: EventT0.cc:109
Belle2::Const::DetectorSet
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:66
Belle2::EventT0::setEventT0
void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet &detector, const std::string &algorithm="")
Replace/set the final double T0 estimation.
Definition: EventT0.cc:49
Belle2::EventT0::m_temporaryEventT0List
std::vector< EventT0Component > m_temporaryEventT0List
Internal storage of the temporary event t0 list.
Definition: EventT0.h:120
Belle2::Const::EDetector
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:44
Belle2::EventT0::getEventT0Component
boost::optional< EventT0Component > getEventT0Component() const
Return the final event t0, if one is set. Else, return an empty optional.
Definition: EventT0.cc:33
Belle2::EventT0::EventT0Component
Structure for storing the extracted event t0s together with its detector and its uncertainty.
Definition: EventT0.h:44
Belle2::EventT0::EventT0Component::detectorSet
Const::DetectorSet detectorSet
Storage of the detector, who has determined the event T0.
Definition: EventT0.h:63
Belle2::EventT0::EventT0Component::quality
double quality
Storage for the internal quality estimation for a single algorithm. Only comparable for all temporari...
Definition: EventT0.h:67
Belle2::EventT0::getEventT0Uncertainty
double getEventT0Uncertainty() const
Return the final event t0 uncertainty, if one is set. Else, return NAN.
Definition: EventT0.cc:43
Belle2::Const::allDetectors
static const DetectorSet allDetectors
The set of all detectors.
Definition: Const.h:274
Belle2::EventT0::hasTemporaryEventT0
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:61
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EventT0::clearEventT0
void clearEventT0()
Clear the final EventT0, this is neded in case some algorithm has set one for an itertive t0 finding ...
Definition: EventT0.cc:114
Belle2::EventT0::getEventT0
double getEventT0() const
Return the final event t0, if one is set. Else, return NAN.
Definition: EventT0.cc:27
Belle2::EventT0::getTemporaryEventT0s
const std::vector< EventT0Component > & getTemporaryEventT0s() const
Return the list of all temporary event t0 estimations.
Definition: EventT0.cc:72
Belle2::EventT0::EventT0Component::EventT0Component
EventT0Component()=default
Empty constructor for ROOT.
Belle2::EventT0::addTemporaryEventT0
void addTemporaryEventT0(const EventT0Component &eventT0)
Add another temporary double T0 estimation.
Definition: EventT0.cc:104