9 #include <reconstruction/modules/EventT0Combiner/EventT0Combiner.h>
19 setDescription(
"Module to combine the EventT0 values from multiple sub-detectors");
25 "Only if no SVD value could be found "
26 "(which is very rare for BBbar events, and around 5% of low multiplicity events), the best ECL value will be set\n" +
28 "select the ECL t0 information which is closest in time "
29 "to the best SVD value and these two values will be combined to one final value." +
38 B2DEBUG(20,
"EventT0 object not created, cannot do EventT0 combination");
43 const auto bestSVDHypo =
m_eventT0->getBestSVDTemporaryEventT0();
45 if (not bestSVDHypo) {
46 B2DEBUG(20,
"No SVD time hypotheses available, stopping");
51 B2DEBUG(20,
"Best SVD time hypothesis t0 = " << bestSVDHypo->eventT0 <<
" +- " << bestSVDHypo->eventT0Uncertainty);
55 B2DEBUG(20,
"Setting SVD time hypothesis t0 = " << bestSVDHypo->eventT0 <<
" +- " << bestSVDHypo->eventT0Uncertainty <<
56 " as new final value.");
61 const auto bestCDCHypo =
m_eventT0->getBestCDCTemporaryEventT0();
62 if (not bestCDCHypo) {
63 B2DEBUG(20,
"No CDC EventT0 candiate, exiting.");
67 B2DEBUG(20,
"Setting CDC time hypothesis t0 = " << bestCDCHypo->eventT0 <<
" +- " << bestCDCHypo->eventT0Uncertainty <<
68 " as new final value.");
73 auto eclHypos =
m_eventT0->getTemporaryEventT0s(Const::EDetector::ECL);
75 if (eclHypos.size() == 0) {
76 B2DEBUG(20,
"No ECL t0 hypothesis available, exiting");
81 double bestDistance = std::numeric_limits<double>::max();
82 bool foundMatch =
false;
83 for (
auto const& eclHypo : eclHypos) {
85 double dist = std::abs(eclHypo.eventT0 - bestSVDHypo->eventT0);
86 B2DEBUG(20,
"Checking compatibility of ECL t0 = " << eclHypo.eventT0 <<
" +- " << eclHypo.eventT0Uncertainty <<
" distance = " <<
88 if (dist < bestDistance) {
89 eclBestMatch = eclHypo;
101 B2DEBUG(20,
"Combined T0 from SVD and ECL is t0 = " << combined.eventT0 <<
" +- " << combined.eventT0Uncertainty);
107 B2DEBUG(20,
"No sufficient match found between SVD and ECL timing, setting best SVD t0 = " << bestSVDHypo->eventT0 <<
" +- " <<
108 bestSVDHypo->eventT0Uncertainty);
117 if (measurements.size() == 0) {
118 B2FATAL(
"Need at least one EvenT0 Measurement to do a sensible combination.");
121 double eventT0 = 0.0f;
122 double preFactor = 0.0f;
126 for (
auto const& meas : measurements) {
127 usedDetectorSet += meas.detectorSet;
128 const double oneOverUncertaintySquared = 1.0f / std::pow(meas.eventT0Uncertainty, 2.0);
129 eventT0 += meas.eventT0 * oneOverUncertaintySquared;
130 preFactor += oneOverUncertaintySquared;
133 eventT0 /= preFactor;
134 const auto eventT0unc =
std::sqrt(1.0f / preFactor);
The DetectorSet class for sets of detector IDs in the form of EDetector values.
const std::string m_combinationModeCombineSVDandECL
In this mode, the SVD t0 value (if available) will be used to select the ECL t0 information which is ...
std::string m_paramCombinationMode
Mode to combine the t0 values of the sub-detectors.
StoreObjPtr< EventT0 > m_eventT0
Access to global EventT0 which will be read and updated.
void event() override
This method is called for each event.
const std::string m_combinationModePreferCDC
In this mode, the CDC t0 value (if available) will be set as the final T0 value.
const std::string m_combinationModePreferSVD
In this mode, the SVD t0 value (if available) will be set as the final T0 value.
EventT0::EventT0Component computeCombination(std::vector< EventT0::EventT0Component > measurements) const
computes the new average between multiple, un-correlated sub-detector measurements
EventT0CombinerModule()
Default constructor.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.
Structure for storing the extracted event t0s together with its detector and its uncertainty.
double eventT0
Storage of the T0 estimation.
double eventT0Uncertainty
Storage of the uncertainty of the T0 estimation.