Belle II Software development
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 <cmath>
14#include <optional>
15#include <vector>
16
17namespace Belle2 {
29 class EventT0 : public TObject {
30
31 public:
35 EventT0Component() = default;
36
38 EventT0Component(double eventT0_, double eventT0Uncertainty_, const Const::DetectorSet& detectorSet_,
39 const std::string& algorithm_ = "", double quality_ = NAN) :
40 eventT0(eventT0_), eventT0Uncertainty(eventT0Uncertainty_), detectorSet(detectorSet_),
41 algorithm(algorithm_), quality(quality_) {}
42
44 double eventT0 = NAN;
46 double eventT0Uncertainty = NAN;
54 std::string algorithm = "";
56 double quality = NAN;
57
58 ClassDefNV(EventT0Component, 3)
59 };
60
62 bool hasEventT0() const;
63
65 double getEventT0() const;
66
68 std::optional<EventT0Component> getEventT0Component() const;
69
71 double getEventT0Uncertainty() const;
72
74 void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet& detector, const std::string& algorithm = "");
75
77 void setEventT0(const EventT0Component& eventT0);
78
80 void addTemporaryEventT0(const EventT0Component& eventT0);
81
83 const std::vector<EventT0Component>& getTemporaryEventT0s() const;
84
86 const std::vector<EventT0Component> getTemporaryEventT0s(Const::EDetector detector) const;
87
89 bool hasTemporaryEventT0(const Const::DetectorSet& detectorSet = Const::allDetectors) const;
90
93
95 unsigned long getNumberOfTemporaryEventT0s() const;
96
98 std::optional<EventT0Component> getBestSVDTemporaryEventT0() const;
100 std::optional<EventT0Component> getBestCDCTemporaryEventT0() const;
102 std::optional<EventT0Component> getBestTOPTemporaryEventT0() const;
104 std::optional<EventT0Component> getBestECLTemporaryEventT0() const;
105
109 bool isEventT0Of(Const::EDetector detector) const
110 {
111 if (hasTemporaryEventT0(detector)) {
112 return m_eventT0.detectorSet.contains(detector);
113 }
114 return false;
115 }
116
118 bool isSVDEventT0() const
119 {
120 return isEventT0Of(Const::EDetector::SVD);
121 }
123 bool isCDCEventT0() const
124 {
125 return isEventT0Of(Const::EDetector::CDC);
126 }
128 bool isTOPEventT0() const
129 {
130 return isEventT0Of(Const::EDetector::TOP);
131 }
133 bool isECLEventT0() const
134 {
135 return isEventT0Of(Const::EDetector::ECL);
136 }
137
138
140 void clearTemporaries();
141
147 void clearEventT0();
148
149 private:
151 std::vector<EventT0Component> m_temporaryEventT0List;
155 bool m_hasEventT0 = false;
156
157 ClassDef(EventT0, 5)
158 };
160}
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:80
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:235
static const DetectorSet allDetectors
The set of all detectors.
Definition: Const.h:398
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Storage element for the eventwise T0 estimation.
Definition: EventT0.h:29
std::vector< EventT0Component > m_temporaryEventT0List
Internal storage of the temporary event t0 list.
Definition: EventT0.h:151
EventT0Component m_eventT0
Internal storage for the final event t0.
Definition: EventT0.h:153
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
std::optional< EventT0Component > getBestECLTemporaryEventT0() const
Return the best ECL-based EventT0 candidate if it exists.
Definition: EventT0.cc:150
std::optional< EventT0Component > getEventT0Component() const
Return the final event t0, if one is set. Else, return an empty optional.
Definition: EventT0.cc:31
double getEventT0() const
Return the final event t0, if one is set. Else, return NAN.
Definition: EventT0.cc:25
std::optional< EventT0Component > getBestCDCTemporaryEventT0() const
Return the best CDC-based EventT0 candidate if it exists.
Definition: EventT0.cc:128
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
bool isCDCEventT0() const
Is m_eventT0 based on CDC information?
Definition: EventT0.h:123
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:155
const std::vector< EventT0Component > & getTemporaryEventT0s() const
Return the list of all temporary event t0 estimations.
Definition: EventT0.cc:70
std::optional< EventT0Component > getBestTOPTemporaryEventT0() const
Return the best TOP-based EventT0 candidate if it exists.
Definition: EventT0.cc:139
std::optional< EventT0Component > getBestSVDTemporaryEventT0() const
Return the best SVD-based EventT0 candidate if it exists.
Definition: EventT0.cc:117
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
bool isEventT0Of(Const::EDetector detector) const
Is the current EventT0 value based on information of the detector.
Definition: EventT0.h:109
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
bool isTOPEventT0() const
Is m_eventT0 based on TOP information?
Definition: EventT0.h:128
bool isECLEventT0() const
Is m_eventT0 based on ECL information?
Definition: EventT0.h:133
bool isSVDEventT0() const
Is m_eventT0 based on SVD information?
Definition: EventT0.h:118
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:33
double quality
Storage for the internal quality estimation for a single algorithm. Only comparable for all temporari...
Definition: EventT0.h:56
double eventT0
Storage of the T0 estimation.
Definition: EventT0.h:44
Const::DetectorSet detectorSet
Storage of the detector, who has determined the event T0.
Definition: EventT0.h:52
EventT0Component(double eventT0_, double eventT0Uncertainty_, const Const::DetectorSet &detectorSet_, const std::string &algorithm_="", double quality_=NAN)
Convenience constructor.
Definition: EventT0.h:38
EventT0Component()=default
Empty constructor for ROOT.
double eventT0Uncertainty
Storage of the uncertainty of the T0 estimation.
Definition: EventT0.h:46
std::string algorithm
Storage for which algorithm created the event t0.
Definition: EventT0.h:54