8#include <tracking/modules/vxdCDCTrackMerger/VXDCDCTrackMergerModule.h>
10#include <tracking/trackFitting/fitter/base/TrackFitter.h>
17 Module(), m_CDC_wall_radius(16.25)
20 "This module merges tracks which are reconstructed, separately, in the silicon (PXD+VXD) and in the CDC");
29 "Maximum distance between extrapolated tracks on the CDC wall",
46 B2DEBUG(29,
"VXDCDCTrackMerger: input Number of CDC Tracks: " << nCDCTracks);
51 "VXDCDCTrackMerger: input Number of VXD Tracks: " << nVXDTracks);
74 if (!cdcTrack.wasFitSuccessful())
82 bool matched_track =
false;
85 double this_chi_2 = std::numeric_limits<double>::max();
86 double chi_2_max_this_cdc_track = std::numeric_limits<double>::max();
88 genfit::MeasuredStateOnPlane cdc_sop =
89 cdcTrack.getMeasuredStateOnPlaneFromFirstHit();
91 cdcpos = cdc_sop.getPos();
92 cdcmom = cdc_sop.getMom();
94 B2DEBUG(29,
"CDCTrack extrapolation to cylinder failed!");
99 int currentVxdTrack = -1;
100 int bestMatchedVxdTrack = 0;
104 if (!vxdTrack.wasFitSuccessful()) {
114 genfit::MeasuredStateOnPlane vxd_sop =
115 vxdTrack.getMeasuredStateOnPlaneFromLastHit();
117 vxdpos = vxd_sop.getPos();
118 vxdmom = vxd_sop.getMom();
119 }
catch (genfit::Exception
const&) {
121 B2DEBUG(29,
"VXDTrack extrapolation to cylinder failed!");
126 if (TMath::Sqrt((cdcpos - vxdpos) * (cdcpos - vxdpos)) <
m_merge_radius) {
127 genfit::MeasuredStateOnPlane vxd_sop;
128 genfit::MeasuredStateOnPlane cdc_sop;
130 vxd_sop = vxdTrack.getMeasuredStateOnPlaneFromLastHit();
131 cdc_sop = cdcTrack.getMeasuredStateOnPlaneFromFirstHit();
133 vxd_sop.extrapolateToPlane(cdc_sop.getPlane());
134 }
catch (genfit::Exception
const&) {
136 B2DEBUG(29,
"VXDTrack extrapolation to plane failed!");
141 TMatrixDSym inv_covmtrx = (vxd_sop.getCov() + cdc_sop.getCov()).Invert();
142 TVectorD state_diff = cdc_sop.getState() - vxd_sop.getState();
143 state_diff *= inv_covmtrx;
144 this_chi_2 = state_diff * (cdc_sop.getState() - vxd_sop.getState());
146 B2WARNING(
"Matrix is singular!");
150 if ((this_chi_2 < chi_2_max_this_cdc_track) && (this_chi_2 > 0)) {
151 matched_track =
true;
152 chi_2_max_this_cdc_track = this_chi_2;
153 bestMatchedVxdTrack = currentVxdTrack;
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...
This is the Reconstruction Event-Data Model Track.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Algorithm class to handle the fitting of RecoTrack objects.
StoreArray< RecoTrack > m_VXDRecoTracks
StoreArray of the VXD Track collection.
StoreArray< RecoTrack > m_CDCRecoTracks
StoreArray of the CDC Track collection.
void initialize() override
Use this to initialize resources or memory your module needs.
void event() override
Called once for each event.
VXDCDCTrackMergerModule()
Constructor, for setting module description and parameters.
std::string m_VXDRecoTrackColName
StoreArray name of the VXD Track collection.
double m_merge_radius
Maximum distance between extrapolated tracks on the CDC wall.
std::string m_CDCRecoTrackColName
StoreArray name of the CDC Track collection.
double m_CDC_wall_radius
Radius of the inner CDC wall in centimeters.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.