9 #include <tracking/modules/eventTimeExtractor/SVDEventT0EstimatorModule.h>
10 #include <framework/datastore/RelationArray.h>
11 #include <framework/geometry/B2Vector3.h>
12 #include <tracking/dataobjects/RecoTrack.h>
30 setDescription(
"This module estimates the EventT0 as the average of cluster time of SVD clusters associated to tracks. The EventT0 is set to NaN if there are not RecoTracks or there are not SVD clusters associated to tracks or RecoTrack pt < ptMin OR RecoTrack pz < pzMin. The EventT0 estimated is added to the temporaryEventT0s to the StoreObjPtr as EventT0Component that cointains: eventT0, eventT0_error, detector=SVD, algorithm, quality.");
35 addParam(
"EventT0",
m_eventT0Name,
"Name of the StoreObjPtr with the input EventT0", std::string(
""));
38 "Cut on minimum absolute value of the longitudinal momentum, abs(pz), for RecoTrack selection",
62 double evtT0 = std::numeric_limits<double>::quiet_NaN();
63 double evtT0Err = std::numeric_limits<double>::quiet_NaN();
64 double armTimeSum = 0;
65 double armTimeErrSum = 0;
66 double quality = std::numeric_limits<double>::quiet_NaN();
67 int numberOfSVDClusters = 0;
68 int numberOfRecoTracksUsed = 0;
69 float outgoingArmTime = 0;
70 float ingoingArmTime = 0;
71 float outgoingArmTimeError = 0;
72 float ingoingArmTimeError = 0;
76 const B2Vector3D& p = recoTrack.getMomentumSeed();
85 outgoingArmTime = recoTrack.getOutgoingArmTime();
86 ingoingArmTime = recoTrack.getIngoingArmTime();
87 outgoingArmTimeError = recoTrack.getOutgoingArmTimeError();
88 ingoingArmTimeError = recoTrack.getIngoingArmTimeError();
89 bool hasOutgoingArm = recoTrack.hasOutgoingArmTime();
90 bool hasIngoingArm = recoTrack.hasIngoingArmTime();
93 if (hasOutgoingArm && hasIngoingArm) {
95 if (outgoingArmTime <= ingoingArmTime) {
96 armTimeSum += outgoingArmTime * recoTrack.getNSVDHitsOfOutgoingArm();
97 armTimeErrSum += outgoingArmTimeError * outgoingArmTimeError * recoTrack.getNSVDHitsOfOutgoingArm() *
98 (recoTrack.getNSVDHitsOfOutgoingArm() - 1);
99 numberOfSVDClusters += recoTrack.getNSVDHitsOfOutgoingArm();
101 armTimeSum += ingoingArmTime * recoTrack.getNSVDHitsOfIngoingArm();
102 armTimeErrSum += ingoingArmTimeError * ingoingArmTimeError * recoTrack.getNSVDHitsOfIngoingArm() *
103 (recoTrack.getNSVDHitsOfIngoingArm() - 1);
104 numberOfSVDClusters += recoTrack.getNSVDHitsOfIngoingArm();
106 numberOfRecoTracksUsed += 1;
107 }
else if (hasOutgoingArm && !hasIngoingArm) {
108 armTimeSum += outgoingArmTime * recoTrack.getNSVDHitsOfOutgoingArm();
109 armTimeErrSum += outgoingArmTimeError * outgoingArmTimeError * recoTrack.getNSVDHitsOfOutgoingArm() *
110 (recoTrack.getNSVDHitsOfOutgoingArm() - 1);
111 numberOfSVDClusters += recoTrack.getNSVDHitsOfOutgoingArm();
112 numberOfRecoTracksUsed += 1;
113 }
else if (!hasOutgoingArm && hasIngoingArm) {
114 armTimeSum += ingoingArmTime * recoTrack.getNSVDHitsOfIngoingArm();
115 armTimeErrSum += ingoingArmTimeError * ingoingArmTimeError * recoTrack.getNSVDHitsOfIngoingArm() *
116 (recoTrack.getNSVDHitsOfIngoingArm() - 1);
117 numberOfSVDClusters += recoTrack.getNSVDHitsOfIngoingArm();
118 numberOfRecoTracksUsed += 1;
124 if ((numberOfRecoTracksUsed == 0) || !(
m_eventT0.isValid()))
return;
128 evtT0 = armTimeSum / numberOfSVDClusters;
129 quality = numberOfSVDClusters;
132 if (numberOfSVDClusters > 1)
133 evtT0Err =
std::sqrt(armTimeErrSum / (numberOfSVDClusters * (numberOfSVDClusters - 1)));
139 m_eventT0->addTemporaryEventT0(evtT0Component);
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...
double m_absPzSelection
Cut on abs(pz) for RecoTrack selection.
StoreObjPtr< EventT0 > m_eventT0
EventT0 StoreObjPtr.
virtual void initialize() override
Initialize the SVDEventT0Estimator.
std::string m_algorithm
name of the algorithm used to evaluate SVD-eventT0
virtual void event() override
This method is the core of the SVDEventT0Estimator.
std::string m_recoTracksName
name of RecoTracks StoreArray
double m_ptSelection
Cut on pt for RecoTrack selection.
std::string m_eventT0Name
name of StoreObj EventT0
StoreArray< RecoTrack > m_recoTracks
RecoTracks StoreArray.
virtual ~SVDEventT0EstimatorModule()
default destructor
SVDEventT0EstimatorModule()
Constructor defining the parameters.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
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.