 |
Belle II Software
release-05-02-19
|
10 #include <tracking/modules/trackCreator/TrackCreatorModule.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <framework/logging/Logger.h>
15 #include <mdst/dataobjects/MCParticle.h>
16 #include <mdst/dataobjects/Track.h>
17 #include <mdst/dataobjects/TrackFitResult.h>
19 #include <tracking/dataobjects/RecoTrack.h>
20 #include <tracking/trackFitting/trackBuilder/factories/TrackBuilder.h>
21 #include <tracking/trackFitting/fitter/base/TrackFitter.h>
31 "Build Tracks with the TrackFitResults. Needs RecoTracks as input, creates Belle2::Tracks and Belle2::TrackFitResults as output.");
32 setPropertyFlags(c_ParallelProcessingCertified);
35 addParam(
"recoTrackColName", m_recoTrackColName,
"Name of collection holding the RecoTracks (input).",
37 addParam(
"mcParticleColName", m_mcParticleColName,
"Name of collection holding the MCParticles (input, optional).",
40 addParam(
"trackColName", m_trackColName,
"Name of collection holding the Tracks (output).", m_trackColName);
41 addParam(
"trackFitResultColName", m_trackFitResultColName,
"Name of collection holding the TrackFitResult (output).",
42 m_trackFitResultColName);
44 addParam(
"beamSpot", m_beamSpot,
45 "BeamSpot (and BeamAxis) define the coordinate system in which the tracks will be extrapolated to the perigee.",
47 addParam(
"beamAxis", m_beamAxis,
48 "(BeamSpot and )BeamAxis define the coordinate system in which the tracks will be extrapolated to the perigee.",
50 addParam(
"pdgCodes", m_pdgCodes,
51 "PDG codes for which TrackFitResults will be created.",
54 addParam(
"useClosestHitToIP", m_useClosestHitToIP,
"Flag to turn on special handling which measurement "
55 "to choose; especially useful for Cosmics.", m_useClosestHitToIP);
56 addParam(
"useBFieldAtHit", m_useBFieldAtHit,
"Flag to calculate the BField at the used hit "
57 "(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 recoTracks.isRequired();
68 const bool mcParticlesPresent = mcParticles.isOptional();
73 const bool trackFitResultsRegistered = trackFitResults.registerInDataStore();
75 B2ASSERT((tracksRegistered and trackFitResultsRegistered),
"Could not register output store arrays.");
77 tracks.registerRelationTo(recoTracks);
79 if (mcParticlesPresent) {
80 tracks.registerRelationTo(mcParticles);
83 B2ASSERT(
"BeamSpot should have exactly 3 parameters",
m_beamSpot.size() == 3);
86 B2ASSERT(
"BeamAxis should have exactly 3 parameters",
m_beamAxis.size() == 3);
94 B2DEBUG(20,
"RecoTrack StoreArray does not contain any RecoTracks.");
100 for (
auto& recoTrack : recoTracks) {
104 B2DEBUG(200,
"Trying to fit with PDG = " << pdg);
TrackBuilder class to create the Track/TrackFitResult mdst output from the RecoTrack.
bool m_useClosestHitToIP
Flag to turn on special handling which measurement to choose; especially useful for Cosmics.
bool fit(RecoTrack &recoTrack, genfit::AbsTrackRep *trackRepresentation) const
Fit a reco track with a given non-default track representation.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
std::string m_trackColName
Name of collection holding the Tracks (output).
void event() override
Build/fit the track fit results.
TVector3 m_beamAxisAsTVector
BeamAxis as TVector3.
Algorithm class to handle the fitting of RecoTrack objects.
void initialize() override
Require and register the store arrays.
Abstract base class for different kinds of events.
std::string m_trackFitResultColName
Name of collection holding the TrackFitResult (output).
std::string m_recoTrackColName
Name of collection holding the RecoTracks (input).
std::vector< int > m_pdgCodes
PDG codes for which TrackFitResults will be created.
TVector3 m_beamSpotAsTVector
BeamSpot as TVector3.
std::vector< double > m_beamAxis
BeamAxis define the coordinate system in which the tracks will be extrapolated to the perigee.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
The ParticleType class for identifying different particle types.
Accessor to arrays stored in the data store.
std::string m_mcParticleColName
Name of collection holding the MCParticles (input, optional).
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.
int getEntries() const
Get the number of objects in the array.
Takes RecoTracks coming from the event reconstructions and fits them with the configured list of part...