Belle II Software  release-05-02-19
V0Fitter Class Reference

V0Fitter class to create V0 mdst's from reconstructed tracks. More...

#include <V0Fitter.h>

Collaboration diagram for V0Fitter:

Public Member Functions

 V0Fitter (const std::string &trackFitResultsName="", const std::string &v0sName="", const std::string &v0ValidationVerticesName="", const std::string &recoTracksName="", const std::string &copiedRecoTracksName="CopiedRecoTracks", bool enableValidation=false)
 Constructor for the V0Fitter. More...
 
void initializeCuts (double beamPipeRadius, double vertexChi2CutOutside)
 Initialize the cuts which will be applied during the fit and store process.
 
void setFitterMode (int fitterMode)
 set V0 fitter mode. More...
 
bool fitAndStore (const Track *trackPlus, const Track *trackMinus, const Const::ParticleType &v0Hypothesis)
 Fit V0 with given hypothesis and store if fit was successful. More...
 
std::pair< Const::ParticleType, Const::ParticleTypegetTrackHypotheses (const Const::ParticleType &v0Hypothesis) const
 Get track hypotheses for a given v0 hypothesis.
 

Private Member Functions

bool vertexFitWithRecoTracks (const Track *trackPlus, const Track *trackMinus, RecoTrack *recoTrackPlus, RecoTrack *recoTrackMinus, const Const::ParticleType &v0Hypothesis, unsigned int &hasInnerHitStatus, TVector3 &vertexPos, const bool forceStore)
 fit V0 vertex using RecoTrack's as inputs. More...
 
RecoTrackcopyRecoTrack (RecoTrack *origRecoTrack, const int trackPDG)
 Create a copy of RecoTrack. More...
 
bool removeInnerHits (RecoTrack *origRecoTrack, RecoTrack *recoTrack, const int trackPDG, unsigned int &nRemoveHits)
 Remove inner hits from RecoTrack. More...
 
bool rejectCandidate (genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus)
 Starting point: point closest to axis where either track is defined This is intended to reject tracks that curl away before meeting, there are corner cases where this could throw away legitimate candidates, namely where one track makes a full circle through the detector without hitting any detectors then making it past Rstart without hitting the detector there – while still being part of the V0. More...
 
bool fitGFRaveVertex (genfit::Track &trackPlus, genfit::Track &trackMinus, genfit::GFRaveVertex &vertex)
 Fit the V0 vertex. More...
 
bool extrapolateToVertex (genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus, const TVector3 &vertexPosition)
 Extrapolate the fit results to the perigee to the vertex.
 
bool extrapolateToVertex (genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus, const TVector3 &vertexPosition, unsigned int &hasInnerHitStatus)
 Extrapolate the fit results to the perigee to the vertex. More...
 
double getBzAtVertex (const TVector3 &vertexPosition)
 Getter for magnetic field in z direction at the vertex position.
 
TrackFitResultbuildTrackFitResult (const genfit::Track &track, const RecoTrack *recoTrack, const genfit::MeasuredStateOnPlane &msop, const double Bz, const Const::ParticleType &trackHypothesis)
 Build TrackFitResult of V0 Track and set relation to genfit Track.
 

Private Attributes

bool m_validation
 Validation flag.
 
std::string m_recoTracksName
 RecoTrackColName (input).
 
StoreArray< RecoTrackm_recoTracks
 RecoTrack (input)
 
StoreArray< TrackFitResultm_trackFitResults
 TrackFitResult (output).
 
StoreArray< V0m_v0s
 V0 (output).
 
StoreArray< V0ValidationVertexm_validationV0s
 V0ValidationVertex (output, optional).
 
StoreArray< RecoTrackm_copiedRecoTracks
 RecoTrack used to refit tracks (output)
 
double m_beamPipeRadius
 Radius where inside/outside beampipe is defined.
 
double m_vertexChi2CutOutside
 Chi2 cut outside beampipe.
 
int m_v0FitterMode
 
bool m_forcestore
 0: store V0 at the first vertex fit, regardless of inner hits, 1: remove hits inside the V0 vertex position, 2: mode 1 + don't use SVD hits if there is only one available SVD hit-pair (default)
 
bool m_useOnlyOneSVDHitPair
 true only if the V0Fitter mode is 1
 

Friends

class V0FitterTest_GetTrackHypotheses_Test
 
class V0FitterTest_EnableValidation_Test
 
class V0FitterTest_InitializeCuts_Test
 

Detailed Description

V0Fitter class to create V0 mdst's from reconstructed tracks.

To use this class, give the V0Fitter a positive and a negative charged track and call the fitAndStore function.

v0Fitter.fitAndStore(B2TrackPositive, B2TrackNegative, V0HypothesisParticleType);

Definition at line 32 of file V0Fitter.h.

Constructor & Destructor Documentation

◆ V0Fitter()

V0Fitter ( const std::string &  trackFitResultsName = "",
const std::string &  v0sName = "",
const std::string &  v0ValidationVerticesName = "",
const std::string &  recoTracksName = "",
const std::string &  copiedRecoTracksName = "CopiedRecoTracks",
bool  enableValidation = false 
)

Constructor for the V0Fitter.

m_recoTracks

register m_copiedRecoTracks

relation : m_recoTracks <--> m_copiedRecoTracks

Definition at line 34 of file V0Fitter.cc.

37  : m_validation(enableValidation), m_recoTracksName(recoTracksName), m_v0FitterMode(1), m_forcestore(false),
39 {
40  m_trackFitResults.isRequired(trackFitResultsName);
42  //Relation to RecoTracks from Tracks is already tested at the module level.
43 
44  if (m_validation) {
45  B2DEBUG(24, "Register DataStore for validation.");
46  m_validationV0s.registerInDataStore(v0ValidationVerticesName, DataStore::c_ErrorIfAlreadyRegistered);
47  m_v0s.registerRelationTo(m_validationV0s);
48  }
49 
51  m_recoTracks.isRequired(m_recoTracksName);
52 
54  m_copiedRecoTracks.registerInDataStore(copiedRecoTracksName,
57 
59  m_copiedRecoTracks.registerRelationTo(m_recoTracks);
60 
61 
62  B2ASSERT(genfit::MaterialEffects::getInstance()->isInitialized(),
63  "Material effects not set up. Please use SetupGenfitExtrapolationModule.");
64  B2ASSERT(genfit::FieldManager::getInstance()->isInitialized(),
65  "Magnetic field not set up. Please use SetupGenfitExtrapolationModule.");
66 }

Member Function Documentation

◆ copyRecoTrack()

RecoTrack * copyRecoTrack ( RecoTrack origRecoTrack,
const int  trackPDG 
)
private

Create a copy of RecoTrack.

Parameters
origRecoTrackoriginal RecoTrack
trackPDGsigned PDG used for the track fit hypothesis
Returns
copied RecoTrack stored in the m_copiedRecoTracks, nullptr if track fit fails (this should not happen)

original track information

only a positive PDG number is allowed for the input

fit newRecoTrack

check fit status of original track

Definition at line 436 of file V0Fitter.cc.

◆ extrapolateToVertex()

bool extrapolateToVertex ( genfit::MeasuredStateOnPlane stPlus,
genfit::MeasuredStateOnPlane stMinus,
const TVector3 &  vertexPosition,
unsigned int &  hasInnerHitStatus 
)
private

Extrapolate the fit results to the perigee to the vertex.

used in the fitAndStore function.

If the daughter tracks have hits inside the V0 vertex, bits in the hasInnerHiStatus variable are set.

if tracks have hits inside the V0 vertex position, bits in hasInnerHitStatus are set.

initialize

extrapolate the first (innermost) hit to the V0 vertex position the value will be positive (negative) if the direction of the extrapolation is (counter)momentum-wise

plus track has hits inside the V0 vertex.

minus track has hits inside the V0 vertex.

This shouldn't ever happen, but I can see the extrapolation code trying several windings before giving up, so this happens occasionally. Something more stable would perhaps be desirable.

Definition at line 144 of file V0Fitter.cc.

◆ fitAndStore()

bool fitAndStore ( const Track trackPlus,
const Track trackMinus,
const Const::ParticleType v0Hypothesis 
)

Fit V0 with given hypothesis and store if fit was successful.

remove hits inside the V0 vertex position

Existence of corresponding RecoTrack already checked at the module level;

hasInnerHitStatus: 0x1: plus track has hits inside the V0 vertex. 0x2: minus track has hits inside the V0 vertex.

fitted vertex position

Try V0 vertex fit. If the fit fails, return false. If hasInnerHitStatus evaluated in the vertexFitWithRecoTracks function results to be 0 (no hits inside the V0 vertex position in both tracks), TrackFitResult and V0 objects are build and stored, and then terminate this function with returning true. If hasInnerHitStatus!=0, objects are not stored and the tracks are refitted with removing inner hit later.

If one or two tracks have hits inside the V0 vertex. (0x1(0x2) bit in hasInnerHitStatus represents plus(minus)-track), redo vertex fit after refitting the track(s) with removing innermost hit in the track(s). Repeat until all the inner hits are removed or the vertex fit fails.

PDG code (positive number) used as the track hypothesis in the track fitting.

positive number

positive number

If the track has a hit inside the V0 vertex position, use refitted RecoTrack with removing inner hits in the next V0 vertex fit. Else, use the original RecoTrack.

for plus-charged track

if the track refit fails, break out of this loop and revert back to the original vertex fit with the original tracks.

for minus-charged track

if the track refit fails, break out of this loop and revert back to the original vertex fit with the original tracks.

V0 vertex fit

if vertex fit fails, break out of this loop and revert back to the original vertex fit with the original tracks.

end of the while loop

if failflag==true, revert back to the original vertex fit with the original tracks.

Definition at line 209 of file V0Fitter.cc.

◆ fitGFRaveVertex()

bool fitGFRaveVertex ( genfit::Track trackPlus,
genfit::Track trackMinus,
genfit::GFRaveVertex vertex 
)
private

Fit the V0 vertex.

Parameters
trackPlus
trackMinus
vertexResult of the fit is returned via reference.
Returns

Definition at line 111 of file V0Fitter.cc.

◆ rejectCandidate()

bool rejectCandidate ( genfit::MeasuredStateOnPlane stPlus,
genfit::MeasuredStateOnPlane stMinus 
)
private

Starting point: point closest to axis where either track is defined This is intended to reject tracks that curl away before meeting, there are corner cases where this could throw away legitimate candidates, namely where one track makes a full circle through the detector without hitting any detectors then making it past Rstart without hitting the detector there – while still being part of the V0.

Unlikely, I didn't find a single example in MC. On the other hand it rejects impossible candidates.

Parameters
stPlusMeasuredStateOnPlane of positively-charged daughter
stMinusMeasuredStateOnPlane of negatively-charged daughter
Returns

Definition at line 93 of file V0Fitter.cc.

◆ removeInnerHits()

bool removeInnerHits ( RecoTrack origRecoTrack,
RecoTrack recoTrack,
const int  trackPDG,
unsigned int &  nRemoveHits 
)
private

Remove inner hits from RecoTrack.

Hits are removed from the minus-end of the momentum direction. For SVD hits, remove U- and V- hit pair at once. Input RecoTrack is fitted in the funcion. If track fit fails, return false.

Parameters
origRecoTrackoriginal RecoTrack
recoTrackinput RecoTrack, updated in this function
trackPDGsigned PDG used for the track fit hypothesis
nRemoveHitsthe number of removed hits. This can be incremented in the function if the outermost removed hit is an SVD U-hit.
Returns

original track information

only a positive PDG number is allowed for the input

disable inner hits

true for sorted info.

N removed hits should not exceed N hits in the track

if the last removed hit is a SVD U-hit, remove the next hit (SVD V-hit as the pair) in addition note: for the SVD pair hits, U-hit should be first and the V-hit the next in the sorted RecoHitInformation array.

N removed hits should not exceed N hits in the track

if N of remaining SVD hit-pair is only one, don't use the SVD hits

SVD U-hit

SVD V-hit

not SVD hit (CDC)

fit recoTrack

check fit status of original track

Definition at line 460 of file V0Fitter.cc.

◆ setFitterMode()

void setFitterMode ( int  fitterMode)

set V0 fitter mode.

switch the mode of fitAndStore function. 0: store V0 at the first vertex fit, regardless of inner hits 1: remove hits inside the V0 vertex position 2: mode 1 + don't use SVD hits if there is only one available SVD hit-pair (default)

Definition at line 68 of file V0Fitter.cc.

◆ vertexFitWithRecoTracks()

bool vertexFitWithRecoTracks ( const Track trackPlus,
const Track trackMinus,
RecoTrack recoTrackPlus,
RecoTrack recoTrackMinus,
const Const::ParticleType v0Hypothesis,
unsigned int &  hasInnerHitStatus,
TVector3 &  vertexPos,
const bool  forceStore 
)
private

fit V0 vertex using RecoTrack's as inputs.

Fit V0 vertex using RecoTracks as inputs.

Return true (false) if the vertex fit has done well (failed). If RecoTracks have hits inside the fitted V0 vertex position, bits in hasInnerHitStatus are set. If there are no inside hits, store the V0 to the DataStore.

Parameters
trackPlusTrack of positively-charged daughter
trackMinusTrack of negatively-charged daughter
recoTrackPlusRecoTrack of positively-charged daughter
recoTrackMinusRecoTrack of negatively-charged daughter
v0HypothesisParticleType used in vertex fitting
hasInnerHitStatusstore a result of this function. if the plus(minus) track has hits inside the V0 vertex position, 0x1(0x2) bit is set.
vertexPosstore a result of this function. the fitted vertex position is stored.
forceStoreif true, store the fitted V0 to the DataStore even if there are some inside hits.
Returns

Store V0 and TrackFitResults if hasInnerHitStatus==0 or forceStore==true.

make a clone, not use the reference so that the genfit::Track and its TrackReps will not be altered.

make a clone, not use the reference so that the genfit::Track and its TrackReps will not be altered.

If existing, pass to the genfit::Track the correct cardinal representation

The two vectors should always have the same size, and this never happen

make a clone, not use the reference so that the genfit::MeasuredStateOnPlane and its TrackReps will not be altered.

Update the tracks (genfit::MeasuredStateOnPlane) after vertex fitGFRaveVertex() looks not to give any changes to the input genfit::Track's (I'm not sure..) make a clone, not use the reference so that the genfit::MeasuredStateOnPlane and its TrackReps will not be altered.

Apply cuts. We have one set of cuts inside the beam pipe, the other outside.

store V0

To build the trackFitResult, use the magnetic field at the origin; the helix is extrapolated to the IP in a constant magnetic field and material effects are neglected so that the vertexing tool executed on the MDST object will find again this vertex position

Reconstruct invariant mass.

Definition at line 310 of file V0Fitter.cc.


The documentation for this class was generated from the following files:
Belle2::V0Fitter::m_v0s
StoreArray< V0 > m_v0s
V0 (output).
Definition: V0Fitter.h:153
Belle2::RecoTrack::registerRequiredRelations
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
Definition: RecoTrack.cc:42
Belle2::V0Fitter::m_forcestore
bool m_forcestore
0: store V0 at the first vertex fit, regardless of inner hits, 1: remove hits inside the V0 vertex po...
Definition: V0Fitter.h:160
Belle2::V0Fitter::m_trackFitResults
StoreArray< TrackFitResult > m_trackFitResults
TrackFitResult (output).
Definition: V0Fitter.h:152
Belle2::V0Fitter::m_recoTracksName
std::string m_recoTracksName
RecoTrackColName (input).
Definition: V0Fitter.h:150
Belle2::V0Fitter::m_copiedRecoTracks
StoreArray< RecoTrack > m_copiedRecoTracks
RecoTrack used to refit tracks (output)
Definition: V0Fitter.h:155
Belle2::V0Fitter::m_useOnlyOneSVDHitPair
bool m_useOnlyOneSVDHitPair
true only if the V0Fitter mode is 1
Definition: V0Fitter.h:161
Belle2::DataStore::c_WriteOut
@ c_WriteOut
Object/array should be saved by output modules.
Definition: DataStore.h:72
Belle2::V0Fitter::m_recoTracks
StoreArray< RecoTrack > m_recoTracks
RecoTrack (input)
Definition: V0Fitter.h:151
Belle2::DataStore::c_ErrorIfAlreadyRegistered
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:74
genfit::FieldManager::getInstance
static FieldManager * getInstance()
Get singleton instance.
Definition: FieldManager.h:119
Belle2::V0Fitter::m_validation
bool m_validation
Validation flag.
Definition: V0Fitter.h:149
Belle2::V0Fitter::m_validationV0s
StoreArray< V0ValidationVertex > m_validationV0s
V0ValidationVertex (output, optional).
Definition: V0Fitter.h:154