Belle II Software light-2406-ragdoll
EventT0 Class Reference

Storage element for the eventwise T0 estimation. More...

#include <EventT0.h>

Inheritance diagram for EventT0:
Collaboration diagram for EventT0:

Classes

struct  EventT0Component
 Structure for storing the extracted event t0s together with its detector and its uncertainty. More...
 

Public Member Functions

bool hasEventT0 () const
 Check if a final event t0 is set.
 
double getEventT0 () const
 Return the final event t0, if one is set. Else, return NAN.
 
std::optional< EventT0ComponentgetEventT0Component () const
 Return the final event t0, if one is set. Else, return an empty optional.
 
double getEventT0Uncertainty () const
 Return the final event t0 uncertainty, if one is set. Else, return NAN.
 
void setEventT0 (double eventT0, double eventT0Uncertainty, const Const::DetectorSet &detector, const std::string &algorithm="")
 Replace/set the final double T0 estimation.
 
void setEventT0 (const EventT0Component &eventT0)
 Replace/set the final double T0 estimation.
 
void addTemporaryEventT0 (const EventT0Component &eventT0)
 Add another temporary double T0 estimation.
 
const std::vector< EventT0Component > & getTemporaryEventT0s () const
 Return the list of all temporary event t0 estimations.
 
const std::vector< EventT0ComponentgetTemporaryEventT0s (Const::EDetector detector) const
 Return the list of all temporary event t0 estimations for a specific detector.
 
bool hasTemporaryEventT0 (const Const::DetectorSet &detectorSet=Const::allDetectors) const
 Check if one of the detectors in the given set has a temporary t0 estimation.
 
Const::DetectorSet getTemporaryDetectors () const
 Get the detectors that have determined temporary event T0s.
 
unsigned long getNumberOfTemporaryEventT0s () const
 Return the number of stored event T0s.
 
std::optional< EventT0ComponentgetBestSVDTemporaryEventT0 () const
 Return the best SVD-based EventT0 candidate if it exists.
 
std::optional< EventT0ComponentgetBestCDCTemporaryEventT0 () const
 Return the best CDC-based EventT0 candidate if it exists.
 
std::optional< EventT0ComponentgetBestTOPTemporaryEventT0 () const
 Return the best TOP-based EventT0 candidate if it exists.
 
std::optional< EventT0ComponentgetBestECLTemporaryEventT0 () const
 Return the best ECL-based EventT0 candidate if it exists.
 
bool isEventT0Of (Const::EDetector detector) const
 Is the current EventT0 value based on information of the detector.
 
bool isSVDEventT0 () const
 Is m_eventT0 based on SVD information?
 
bool isCDCEventT0 () const
 Is m_eventT0 based on CDC information?
 
bool isTOPEventT0 () const
 Is m_eventT0 based on TOP information?
 
bool isECLEventT0 () const
 Is m_eventT0 based on ECL information?
 
void clearTemporaries ()
 Clear the list of temporary event T0 estimations.
 
void clearEventT0 ()
 Clear the final EventT0, this is neded in case some algorithm has set one for an itertive t0 finding procedure and none was set in the beginning.
 

Private Attributes

std::vector< EventT0Componentm_temporaryEventT0List
 Internal storage of the temporary event t0 list.
 
EventT0Component m_eventT0
 Internal storage for the final event t0.
 
bool m_hasEventT0 = false
 Internal storage of the final eventT0 is set.
 

Detailed Description

Storage element for the eventwise T0 estimation.

It can store a double value with uncertainty together with the detector component.

Additionally, it can store an arbitrary number of temporary event t0 estimations not to be used for the final decision.

Definition at line 29 of file EventT0.h.

Member Function Documentation

◆ addTemporaryEventT0()

void addTemporaryEventT0 ( const EventT0Component eventT0)

Add another temporary double T0 estimation.

Definition at line 102 of file EventT0.cc.

103{
104 m_temporaryEventT0List.push_back(eventT0);
105}
std::vector< EventT0Component > m_temporaryEventT0List
Internal storage of the temporary event t0 list.
Definition: EventT0.h:151

◆ clearEventT0()

void clearEventT0 ( )

Clear the final EventT0, this is neded in case some algorithm has set one for an itertive t0 finding procedure and none was set in the beginning.

Definition at line 112 of file EventT0.cc.

113{
114 m_hasEventT0 = false;
115}
bool m_hasEventT0
Internal storage of the final eventT0 is set.
Definition: EventT0.h:155

◆ clearTemporaries()

void clearTemporaries ( )

Clear the list of temporary event T0 estimations.

Definition at line 107 of file EventT0.cc.

108{
110}

◆ getBestCDCTemporaryEventT0()

std::optional< EventT0::EventT0Component > getBestCDCTemporaryEventT0 ( ) const

Return the best CDC-based EventT0 candidate if it exists.

Definition at line 128 of file EventT0.cc.

129{
130 if (hasTemporaryEventT0(Const::EDetector::CDC)) {
131 std::vector<EventT0::EventT0Component> cdcT0s = getTemporaryEventT0s(Const::EDetector::CDC);
132 // The most accurate CDC EventT0 candidate is the last one in the list
133 return std::make_optional(cdcT0s.back());
134 }
135
136 return {};
137}
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

◆ getBestECLTemporaryEventT0()

std::optional< EventT0::EventT0Component > getBestECLTemporaryEventT0 ( ) const

Return the best ECL-based EventT0 candidate if it exists.

Definition at line 150 of file EventT0.cc.

151{
152 if (hasTemporaryEventT0(Const::EDetector::ECL)) {
153 std::vector<EventT0::EventT0Component> eclT0s = getTemporaryEventT0s(Const::EDetector::ECL);
154 // The most accurate ECL EevenT0 is assumed to be the one with smallest chi2/quality
155 auto eclBestT0 = std::min_element(eclT0s.begin(), eclT0s.end(), [](EventT0::EventT0Component c1,
156 EventT0::EventT0Component c2) {return c1.quality < c2.quality;});
157 return std::make_optional(*eclBestT0);
158 }
159
160 return {};
161}
Structure for storing the extracted event t0s together with its detector and its uncertainty.
Definition: EventT0.h:33

◆ getBestSVDTemporaryEventT0()

std::optional< EventT0::EventT0Component > getBestSVDTemporaryEventT0 ( ) const

Return the best SVD-based EventT0 candidate if it exists.

Definition at line 117 of file EventT0.cc.

118{
119 if (hasTemporaryEventT0(Const::EDetector::SVD)) {
120 std::vector<EventT0::EventT0Component> svdT0s = getTemporaryEventT0s(Const::EDetector::SVD);
121 // The most accurate SVD EventT0 candidate is the last one in the list
122 return std::make_optional(svdT0s.back());
123 }
124
125 return {};
126}

◆ getBestTOPTemporaryEventT0()

std::optional< EventT0::EventT0Component > getBestTOPTemporaryEventT0 ( ) const

Return the best TOP-based EventT0 candidate if it exists.

Definition at line 139 of file EventT0.cc.

140{
141 if (hasTemporaryEventT0(Const::EDetector::TOP)) {
142 std::vector<EventT0::EventT0Component> topT0s = getTemporaryEventT0s(Const::EDetector::TOP);
143 // The most accurate TOP EventT0 candidate is the last one in the list, though there should only be one at max anyway
144 return std::make_optional(topT0s.back());
145 }
146
147 return {};
148}

◆ getEventT0()

double getEventT0 ( ) const

Return the final event t0, if one is set. Else, return NAN.

Definition at line 25 of file EventT0.cc.

26{
27 B2ASSERT("Not EventT0 available, but someone tried to acces it. Check with hasEventT0() method before!", hasEventT0());
28 return m_eventT0.eventT0;
29}
EventT0Component m_eventT0
Internal storage for the final event t0.
Definition: EventT0.h:153
bool hasEventT0() const
Check if a final event t0 is set.
Definition: EventT0.cc:19
double eventT0
Storage of the T0 estimation.
Definition: EventT0.h:44

◆ getEventT0Component()

std::optional< EventT0::EventT0Component > getEventT0Component ( ) const

Return the final event t0, if one is set. Else, return an empty optional.

Definition at line 31 of file EventT0.cc.

32{
33 if (hasEventT0()) {
34 return std::make_optional(m_eventT0);
35 }
36
37 return {};
38}

◆ getEventT0Uncertainty()

double getEventT0Uncertainty ( ) const

Return the final event t0 uncertainty, if one is set. Else, return NAN.

Definition at line 41 of file EventT0.cc.

42{
44}
double eventT0Uncertainty
Storage of the uncertainty of the T0 estimation.
Definition: EventT0.h:46

◆ getNumberOfTemporaryEventT0s()

unsigned long getNumberOfTemporaryEventT0s ( ) const

Return the number of stored event T0s.

Definition at line 97 of file EventT0.cc.

98{
99 return m_temporaryEventT0List.size();
100}

◆ getTemporaryDetectors()

Const::DetectorSet getTemporaryDetectors ( ) const

Get the detectors that have determined temporary event T0s.

Definition at line 86 of file EventT0.cc.

87{
88 Const::DetectorSet temporarySet;
89
90 for (const EventT0Component& eventT0Component : m_temporaryEventT0List) {
91 temporarySet += eventT0Component.detectorSet;
92 }
93
94 return temporarySet;
95}
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:80

◆ getTemporaryEventT0s() [1/2]

const std::vector< EventT0::EventT0Component > & getTemporaryEventT0s ( ) const

Return the list of all temporary event t0 estimations.

Definition at line 70 of file EventT0.cc.

71{
73}

◆ getTemporaryEventT0s() [2/2]

const std::vector< EventT0::EventT0Component > getTemporaryEventT0s ( Const::EDetector  detector) const

Return the list of all temporary event t0 estimations for a specific detector.

Definition at line 75 of file EventT0.cc.

76{
77 std::vector<EventT0::EventT0Component> detectorT0s;
78
79 const auto lmdSelectDetector = [detector](EventT0::EventT0Component const & c) {return c.detectorSet.contains(detector);};
80 std::copy_if(m_temporaryEventT0List.begin(), m_temporaryEventT0List.end(),
81 std::back_inserter(detectorT0s), lmdSelectDetector);
82 return detectorT0s;
83}

◆ hasEventT0()

bool hasEventT0 ( ) const

Check if a final event t0 is set.

Definition at line 19 of file EventT0.cc.

20{
21 return m_hasEventT0;
22}

◆ 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 at line 59 of file EventT0.cc.

60{
61 for (const EventT0Component& eventT0Component : m_temporaryEventT0List) {
62 if (detectorSet.contains(eventT0Component.detectorSet)) {
63 return true;
64 }
65 }
66
67 return false;
68}
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:235

◆ isCDCEventT0()

bool isCDCEventT0 ( ) const
inline

Is m_eventT0 based on CDC information?

Definition at line 123 of file EventT0.h.

124 {
125 return isEventT0Of(Const::EDetector::CDC);
126 }
bool isEventT0Of(Const::EDetector detector) const
Is the current EventT0 value based on information of the detector.
Definition: EventT0.h:109

◆ isECLEventT0()

bool isECLEventT0 ( ) const
inline

Is m_eventT0 based on ECL information?

Definition at line 133 of file EventT0.h.

134 {
135 return isEventT0Of(Const::EDetector::ECL);
136 }

◆ isEventT0Of()

bool isEventT0Of ( Const::EDetector  detector) const
inline

Is the current EventT0 value based on information of the detector.

Parameters
detectorThe detector for which one wants to know whether m_eventT0 is based on it
Returns
true if m_eventT0 is based on the detector under question, false otherwise

Definition at line 109 of file EventT0.h.

110 {
111 if (hasTemporaryEventT0(detector)) {
112 return m_eventT0.detectorSet.contains(detector);
113 }
114 return false;
115 }
Const::DetectorSet detectorSet
Storage of the detector, who has determined the event T0.
Definition: EventT0.h:52

◆ isSVDEventT0()

bool isSVDEventT0 ( ) const
inline

Is m_eventT0 based on SVD information?

Definition at line 118 of file EventT0.h.

119 {
120 return isEventT0Of(Const::EDetector::SVD);
121 }

◆ isTOPEventT0()

bool isTOPEventT0 ( ) const
inline

Is m_eventT0 based on TOP information?

Definition at line 128 of file EventT0.h.

129 {
130 return isEventT0Of(Const::EDetector::TOP);
131 }

◆ setEventT0() [1/2]

void setEventT0 ( const EventT0Component eventT0)

Replace/set the final double T0 estimation.

Definition at line 53 of file EventT0.cc.

54{
55 m_eventT0 = eventT0;
56 m_hasEventT0 = true;
57}

◆ setEventT0() [2/2]

void setEventT0 ( double  eventT0,
double  eventT0Uncertainty,
const Const::DetectorSet detector,
const std::string &  algorithm = "" 
)

Replace/set the final double T0 estimation.

Definition at line 47 of file EventT0.cc.

49{
50 setEventT0(EventT0Component(eventT0, eventT0Uncertainty, detector, algorithm));
51}
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

Member Data Documentation

◆ m_eventT0

EventT0Component m_eventT0
private

Internal storage for the final event t0.

Definition at line 153 of file EventT0.h.

◆ m_hasEventT0

bool m_hasEventT0 = false
private

Internal storage of the final eventT0 is set.

Definition at line 155 of file EventT0.h.

◆ m_temporaryEventT0List

std::vector<EventT0Component> m_temporaryEventT0List
private

Internal storage of the temporary event t0 list.

Definition at line 151 of file EventT0.h.


The documentation for this class was generated from the following files: