9 #include <tracking/modules/FlippedRecoTracksMerger/FlippedRecoTracksMergerModule.h>
10 #include <tracking/trackFitting/fitter/base/TrackFitter.h>
19 setDescription(
"This module will check the 2 flipping QIs of one RecoTrack and update the original RecoTrack, Track and TrackFitResults if the flipped one should be taken (according to the 2 flipping QIs)");
23 "Name of the input StoreArray");
25 "Name of the input StoreArray for flipped tracks");
50 B2WARNING(
"DBobjects : TrackFlippingCuts not found!");
55 if (!(*m_flipCutsFromDB).getOnOffInfo())
return;
62 if (not recoTrack.wasFitSuccessful()) {
73 auto trackFitResult = track->getTrackFitResultWithClosestMass(
Const::pion);
74 if (trackFitResult->getTransverseMomentum() > (*m_flipCutsFromDB).getPtCut())
continue;
76 double mvaFlipCut = (*m_flipCutsFromDB).getSecondCut();
79 if (isnan(recoTrack.get2ndFlipQualityIndicator()) or (recoTrack.get2ndFlipQualityIndicator() < mvaFlipCut))
continue;
83 if (!flippedRecoTrack)
continue;
90 B2WARNING(
"Consistency check of genfit track failed. Will skip this track candidate.");
96 if (!trackFlipped)
continue;
97 std::vector<Track::ChargedStableTrackFitResultPair> fitResultsAfter =
99 std::vector<Track::ChargedStableTrackFitResultPair> fitResultsBefore = track->getTrackFitResults();
102 track->setFlippedAndRefitted();
105 for (
auto fitResult : fitResultsBefore) {
106 auto iterFitResult = std::find_if(fitResultsAfter.begin(),
109 if (iterFitResult == fitResultsAfter.end()) {
110 track->setTrackFitResultIndex(fitResult.first, -1);
111 fitResult.second->mask();
117 for (
auto fitResult : fitResultsAfter) {
119 auto oldFitResultPairIter = std::find_if(fitResultsBefore.begin(),
123 if (oldFitResultPairIter != fitResultsBefore.end()) {
124 oldFitResultPairIter->second->updateTrackFitResult(*fitResult.second);
128 const int newTrackFitResultArrayIndex = newFitResult->
getArrayIndex();
129 track->setTrackFitResultIndex(fitResult.first, newTrackFitResultArrayIndex);
133 recoTrack.flipTrackDirectionAndCharge();
static const ChargedStable pion
charged pion particle
std::string m_param_bklmHitsStoreArrayName
StoreArray name of the BKLM hits.
StoreArray< RecoTrack > m_inputRecoTracks
store array for the input RecoTracks
std::string m_inputStoreArrayNameFlipped
Name of the input StoreArray for flipped tracks.
std::string m_param_pxdHitsStoreArrayName
StoreArray name of the PXD hits.
void initialize() override
Declare required StoreArray.
void event() override
Event processing.
std::string m_param_eklmHitsStoreArrayName
StoreArray name of the EKLM hits.
StoreArray< TrackFitResult > m_trackFitResults
StoreArray of TrackFitResult, only default name should be considered here.
std::string m_param_svdHitsStoreArrayName
StoreArray name of the SVD hits.
std::string m_inputStoreArrayName
Name of the input StoreArray.
std::string m_param_cdcHitsStoreArrayName
StoreArray name of the CDC hits.
FlippedRecoTracksMergerModule()
Constructor of the module. Setting up parameters and description.
OptionalDBObjPtr< TrackFlippingCuts > m_flipCutsFromDB
flipping cuts could be read from the DB
StoreArray< RecoTrack > m_inputRecoTracksFlipped
store array for the input flipped RecoTracks
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...
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
static void swapGenfitTrack(RecoTrack &recoTrack, const genfit::Track *track)
Set the genfit track of a Recotrack copying the information from another genfit track.
This is the Reconstruction Event-Data Model Track.
const genfit::Track & getGenfitTrack() const
Returns genfit track.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Values of the result of a track fit with a given particle hypothesis.
void updateTrackFitResult(const TrackFitResult &input)
update the TrackFitResults
Class that bundles various TrackFitResults.
std::vector< ChargedStableTrackFitResultPair > getTrackFitResultsByName(const std::string trackFitResultsName) const
Access to all track fit results at the same time (from TrackFitResult with specified name)
std::pair< Const::ChargedStable, TrackFitResult * > ChargedStableTrackFitResultPair
Pair to hold the particle hypothesis used for the fit as first entry and the result of the track fit ...
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
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.
Abstract base class for different kinds of events.