8#include <tracking/modules/trackCreator/TrackCreatorModule.h>
10#include <framework/logging/Logger.h>
12#include <mdst/dataobjects/MCParticle.h>
13#include <mdst/dataobjects/Track.h>
14#include <mdst/dataobjects/TrackFitResult.h>
16#include <tracking/trackFitting/trackBuilder/factories/TrackBuilder.h>
17#include <tracking/trackFitting/fitter/base/TrackFitter.h>
27 "Build Tracks with the TrackFitResults. Needs RecoTracks as input, creates Belle2::Tracks and Belle2::TrackFitResults as output.");
39 "BeamSpot (and BeamAxis) define the coordinate system in which the tracks will be extrapolated to the perigee.",
42 "(BeamSpot and )BeamAxis define the coordinate system in which the tracks will be extrapolated to the perigee.",
45 "PDG codes for which TrackFitResults will be created.",
51 "(closest to IP or first one), instead of the one at the POCA. Use this for cosmics to prevent problems, when cosmics reconstruction end up in the QCS magnet.",
65 B2ASSERT(
"Could not register output store arrays.", (tracksRegistered and trackFitResultsRegistered));
70 B2ASSERT(
"BeamSpot should have exactly 3 parameters",
m_beamSpot.size() == 3);
73 B2ASSERT(
"BeamAxis should have exactly 3 parameters",
m_beamAxis.size() == 3);
80 B2FATAL(
"TrackFitMomentumRange parameters are not available.");
86 B2DEBUG(20,
"RecoTrack StoreArray does not contain any RecoTracks.");
95 B2DEBUG(25,
"Trying to fit with PDG = " << pdg);
97 pdg) <<
"\tSeed p: " << recoTrack.getMomentumSeed().R());
The ParticleType class for identifying different particle types.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
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...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
TrackBuilder class to create the Track/TrackFitResult mdst output from the RecoTrack.
bool storeTrackFromRecoTrack(RecoTrack &recoTrack, const bool useClosestHitToIP=false, const bool useBFieldAtHit=false)
Stores a Belle2 Track from a Reco Track.
std::vector< double > m_beamSpot
BeamSpot define the coordinate system in which the tracks will be extrapolated to the perigee.
B2Vector3D m_beamSpotAsTVector
BeamSpot as B2Vector3D.
void initialize() override
Require and register the store arrays.
B2Vector3D m_beamAxisAsTVector
BeamAxis as B2Vector3D.
void event() override
Build/fit the track fit results.
DBObjPtr< TrackFitMomentumRange > m_trackFitMomentumRange
TrackFitMomentumRange Database OjbPtr.
TrackCreatorModule()
Constructor adding the description and properties.
bool m_useBFieldAtHit
Flag to calculate the BField at the used hit (closest to IP or first one), instead of the one at the ...
bool m_useClosestHitToIP
Flag to turn on special handling which measurement to choose; especially useful for Cosmics.
std::vector< double > m_beamAxis
BeamAxis define the coordinate system in which the tracks will be extrapolated to the perigee.
std::string m_trackColName
Name of collection holding the Tracks (output).
void beginRun() override
Called when entering a new run, to load TrackFitMomentumRange parameters.
std::string m_recoTrackColName
Name of collection holding the RecoTracks (input).
std::vector< int > m_pdgCodes
PDG codes for which TrackFitResults will be created.
std::string m_trackFitResultColName
Name of collection holding the TrackFitResult (output).
StoreArray< RecoTrack > m_RecoTracks
RecoTracks StoreArray.
Algorithm class to handle the fitting of RecoTrack objects.
bool fit(RecoTrack &recoTrack, genfit::AbsTrackRep *trackRepresentation, bool resortHits=false) const
Fit a reco track with a given non-default track representation.
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.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Abstract base class for different kinds of events.