Belle II Software prerelease-11-00-00a
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 (bool fromTrackCreator=false) const
 Return the final event t0, if one is set.
 
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 needed 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 113 of file EventT0.cc.

114{
115 m_temporaryEventT0List.push_back(eventT0);
116}
std::vector< EventT0Component > m_temporaryEventT0List
Internal storage of the temporary event t0 list.
Definition EventT0.h:153

◆ clearEventT0()

void clearEventT0 ( )

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

Definition at line 123 of file EventT0.cc.

124{
125 m_hasEventT0 = false;
126}
bool m_hasEventT0
Internal storage of the final eventT0 is set.
Definition EventT0.h:157

◆ clearTemporaries()

void clearTemporaries ( )

Clear the list of temporary event T0 estimations.

Definition at line 118 of file EventT0.cc.

119{
121}

◆ getBestCDCTemporaryEventT0()

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

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

Definition at line 139 of file EventT0.cc.

140{
141 if (hasTemporaryEventT0(Const::EDetector::CDC)) {
142 std::vector<EventT0::EventT0Component> cdcT0s = getTemporaryEventT0s(Const::EDetector::CDC);
143 // The most accurate CDC EventT0 candidate is the last one in the list
144 return std::make_optional(cdcT0s.back());
145 }
146
147 return {};
148}
const std::vector< EventT0Component > & getTemporaryEventT0s() const
Return the list of all temporary event t0 estimations.
Definition EventT0.cc:81
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:70

◆ getBestECLTemporaryEventT0()

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

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

Definition at line 161 of file EventT0.cc.

162{
163 if (hasTemporaryEventT0(Const::EDetector::ECL)) {
164 std::vector<EventT0::EventT0Component> eclT0s = getTemporaryEventT0s(Const::EDetector::ECL);
165 // The most accurate ECL EevenT0 is assumed to be the one with smallest chi2/quality
166 auto eclBestT0 = std::min_element(eclT0s.begin(), eclT0s.end(), [](EventT0::EventT0Component c1,
167 EventT0::EventT0Component c2) {return c1.quality < c2.quality;});
168 return std::make_optional(*eclBestT0);
169 }
170
171 return {};
172}

◆ getBestSVDTemporaryEventT0()

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

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

Definition at line 128 of file EventT0.cc.

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

◆ getBestTOPTemporaryEventT0()

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

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

Definition at line 150 of file EventT0.cc.

151{
152 if (hasTemporaryEventT0(Const::EDetector::TOP)) {
153 std::vector<EventT0::EventT0Component> topT0s = getTemporaryEventT0s(Const::EDetector::TOP);
154 // The most accurate TOP EventT0 candidate is the last one in the list, though there should only be one at max anyway
155 return std::make_optional(topT0s.back());
156 }
157
158 return {};
159}

◆ getEventT0()

double getEventT0 ( bool fromTrackCreator = false) const

Return the final event t0, if one is set.

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

Else, return NAN.

Parameters
fromTrackCreatorIf true, return the event t0 for track creator with different preferences

Definition at line 25 of file EventT0.cc.

26{
27 B2ASSERT("Not EventT0 available, but someone tried to access it. Check with hasEventT0() method before!", hasEventT0());
28
29 //if EventT0 is needed by Track Creator, first check SVD and CDC
30 //use the combined eventT0 only as last resort
31 if (fromTrackCreator) {
32 const auto svdT0 = this->getBestSVDTemporaryEventT0();
33 if (svdT0) return svdT0->eventT0;
34 else {
35 const auto cdcT0 = this->getBestCDCTemporaryEventT0();
36 if (cdcT0) return cdcT0->eventT0;
37 }
38 }
39 return m_eventT0.eventT0;
40}
EventT0Component m_eventT0
Internal storage for the final event t0.
Definition EventT0.h:155
std::optional< EventT0Component > getBestCDCTemporaryEventT0() const
Return the best CDC-based EventT0 candidate if it exists.
Definition EventT0.cc:139
bool hasEventT0() const
Check if a final event t0 is set.
Definition EventT0.cc:19
std::optional< EventT0Component > getBestSVDTemporaryEventT0() const
Return the best SVD-based EventT0 candidate if it exists.
Definition EventT0.cc:128

◆ getEventT0Component()

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

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

Definition at line 42 of file EventT0.cc.

43{
44 if (hasEventT0()) {
45 return std::make_optional(m_eventT0);
46 }
47
48 return {};
49}

◆ getEventT0Uncertainty()

double getEventT0Uncertainty ( ) const

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

Definition at line 52 of file EventT0.cc.

53{
54 return m_eventT0.eventT0Uncertainty;
55}

◆ getNumberOfTemporaryEventT0s()

unsigned long getNumberOfTemporaryEventT0s ( ) const

Return the number of stored event T0s.

Definition at line 108 of file EventT0.cc.

109{
110 return m_temporaryEventT0List.size();
111}

◆ getTemporaryDetectors()

Const::DetectorSet getTemporaryDetectors ( ) const

Get the detectors that have determined temporary event T0s.

Definition at line 97 of file EventT0.cc.

98{
99 Const::DetectorSet temporarySet;
100
101 for (const EventT0Component& eventT0Component : m_temporaryEventT0List) {
102 temporarySet += eventT0Component.detectorSet;
103 }
104
105 return temporarySet;
106}
Structure for storing the extracted event t0s together with its detector and its uncertainty.
Definition EventT0.h:33

◆ getTemporaryEventT0s() [1/2]

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

Return the list of all temporary event t0 estimations.

Definition at line 81 of file EventT0.cc.

82{
84}

◆ 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 86 of file EventT0.cc.

87{
88 std::vector<EventT0::EventT0Component> detectorT0s;
89
90 const auto lmdSelectDetector = [detector](EventT0::EventT0Component const & c) {return c.detectorSet.contains(detector);};
91 std::copy_if(m_temporaryEventT0List.begin(), m_temporaryEventT0List.end(),
92 std::back_inserter(detectorT0s), lmdSelectDetector);
93 return detectorT0s;
94}

◆ 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 70 of file EventT0.cc.

71{
72 for (const EventT0Component& eventT0Component : m_temporaryEventT0List) {
73 if (detectorSet.contains(eventT0Component.detectorSet)) {
74 return true;
75 }
76 }
77
78 return false;
79}
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 125 of file EventT0.h.

126 {
127 return isEventT0Of(Const::EDetector::CDC);
128 }

◆ isECLEventT0()

bool isECLEventT0 ( ) const
inline

Is m_eventT0 based on ECL information?

Definition at line 135 of file EventT0.h.

136 {
137 return isEventT0Of(Const::EDetector::ECL);
138 }

◆ 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 111 of file EventT0.h.

112 {
113 if (hasTemporaryEventT0(detector)) {
114 return m_eventT0.detectorSet.contains(detector);
115 }
116 return false;
117 }

◆ isSVDEventT0()

bool isSVDEventT0 ( ) const
inline

Is m_eventT0 based on SVD information?

Definition at line 120 of file EventT0.h.

121 {
122 return isEventT0Of(Const::EDetector::SVD);
123 }

◆ isTOPEventT0()

bool isTOPEventT0 ( ) const
inline

Is m_eventT0 based on TOP information?

Definition at line 130 of file EventT0.h.

131 {
132 return isEventT0Of(Const::EDetector::TOP);
133 }

◆ setEventT0() [1/2]

void setEventT0 ( const EventT0Component & eventT0)

Replace/set the final double T0 estimation.

Definition at line 64 of file EventT0.cc.

65{
66 m_eventT0 = eventT0;
67 m_hasEventT0 = true;
68}

◆ 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 58 of file EventT0.cc.

60{
61 setEventT0(EventT0Component(eventT0, eventT0Uncertainty, detector, algorithm));
62}
void setEventT0(double eventT0, double eventT0Uncertainty, const Const::DetectorSet &detector, const std::string &algorithm="")
Replace/set the final double T0 estimation.
Definition EventT0.cc:58

Member Data Documentation

◆ m_eventT0

EventT0Component m_eventT0
private

Internal storage for the final event t0.

Definition at line 155 of file EventT0.h.

◆ m_hasEventT0

bool m_hasEventT0 = false
private

Internal storage of the final eventT0 is set.

Definition at line 157 of file EventT0.h.

◆ m_temporaryEventT0List

std::vector<EventT0Component> m_temporaryEventT0List
private

Internal storage of the temporary event t0 list.

Definition at line 153 of file EventT0.h.


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