Belle II Software  release-08-01-10
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, std::tuple< double, double > invMassRangeKshort, std::tuple< double, double > invMassRangeLambda, std::tuple< double, double > invMassRangePhoton)
 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, bool &isForceStored, bool &isHitRemoved)
 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, ROOT::Math::XYZVector &vertexPos, const bool forceStore)
 fit V0 vertex using RecoTrack's as inputs. More...
 
RecoTrackcopyRecoTrack (RecoTrack *origRecoTrack)
 Create a copy of RecoTrack. More...
 
RecoTrackcopyRecoTrackAndFit (RecoTrack *origRecoTrack, const int trackPDG)
 Create a copy of RecoTrack and fit the Track. More...
 
bool removeInnerHits (RecoTrack *prevRecoTrack, RecoTrack *recoTrack, const int trackPDG, const ROOT::Math::XYZVector &vertexPosition)
 Remove inner hits from RecoTrack at once. More...
 
int checkSharedInnermostCluster (const RecoTrack *recoTrackPlus, const RecoTrack *recoTrackMinus)
 Compare innermost hits of daughter pairs to check if they are the same (shared) or not. 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 ROOT::Math::XYZVector &vertexPosition)
 Extrapolate the fit results to the perigee to the vertex.
 
bool extrapolateToVertex (genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus, const ROOT::Math::XYZVector &vertexPosition, unsigned int &hasInnerHitStatus)
 Extrapolate the fit results to the perigee to the vertex. More...
 
TrackFitResultbuildTrackFitResult (const genfit::Track &track, const RecoTrack *recoTrack, const genfit::MeasuredStateOnPlane &msop, const double Bz, const Const::ParticleType &trackHypothesis, const int sharedInnermostCluster)
 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.
 
std::tuple< double, double > m_invMassRangeKshort
 invariant mass cut for Kshort.
 
std::tuple< double, double > m_invMassRangeLambda
 invariant mass cut for Lambda.
 
std::tuple< double, double > m_invMassRangePhoton
 invariant mass cut for Photon.
 
int m_v0FitterMode
 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_forcestore
 true only if the V0Fitter mode is 1
 
bool m_useOnlyOneSVDHitPair
 false only if the V0Fitter mode is 3
 

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 39 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 43 of file V0Fitter.cc.

46  : m_validation(enableValidation), m_recoTracksName(recoTracksName), m_v0FitterMode(1), m_forcestore(false),
48 {
49  m_trackFitResults.isRequired(trackFitResultsName);
51  //Relation to RecoTracks from Tracks is already tested at the module level.
52 
53  if (m_validation) {
54  B2DEBUG(24, "Register DataStore for validation.");
55  m_validationV0s.registerInDataStore(v0ValidationVerticesName, DataStore::c_ErrorIfAlreadyRegistered);
56  m_v0s.registerRelationTo(m_validationV0s);
57  }
58 
61 
63  m_copiedRecoTracks.registerInDataStore(copiedRecoTracksName,
66 
69 
70 
71  B2ASSERT("Material effects not set up. Please use SetupGenfitExtrapolationModule.",
72  genfit::MaterialEffects::getInstance()->isInitialized());
73  B2ASSERT("Magnetic field not set up. Please use SetupGenfitExtrapolationModule.",
74  genfit::FieldManager::getInstance()->isInitialized());
75 }
@ c_WriteOut
Object/array should be saved by output modules.
Definition: DataStore.h:70
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
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:53
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.
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.
Definition: StoreArray.h:140
bool m_useOnlyOneSVDHitPair
false only if the V0Fitter mode is 3
Definition: V0Fitter.h:170
StoreArray< V0ValidationVertex > m_validationV0s
V0ValidationVertex (output, optional).
Definition: V0Fitter.h:160
StoreArray< RecoTrack > m_copiedRecoTracks
RecoTrack used to refit tracks (output)
Definition: V0Fitter.h:161
bool m_forcestore
true only if the V0Fitter mode is 1
Definition: V0Fitter.h:169
bool m_validation
Validation flag.
Definition: V0Fitter.h:155
StoreArray< V0 > m_v0s
V0 (output).
Definition: V0Fitter.h:159
StoreArray< TrackFitResult > m_trackFitResults
TrackFitResult (output).
Definition: V0Fitter.h:158
std::string m_recoTracksName
RecoTrackColName (input).
Definition: V0Fitter.h:156
StoreArray< RecoTrack > m_recoTracks
RecoTrack (input)
Definition: V0Fitter.h:157
int m_v0FitterMode
0: store V0 at the first vertex fit, regardless of inner hits, 1: remove hits inside the V0 vertex po...
Definition: V0Fitter.h:168
static FieldManager * getInstance()
Get singleton instance.
Definition: FieldManager.h:119

Member Function Documentation

◆ checkSharedInnermostCluster()

int checkSharedInnermostCluster ( const RecoTrack recoTrackPlus,
const RecoTrack recoTrackMinus 
)
private

Compare innermost hits of daughter pairs to check if they are the same (shared) or not.

For SVD hits, compare U- and V- hit pair.

Parameters
recoTrackPlus,recoTrackMinusinput RecoTrack pair
Returns
If 1D- or 2D-hits are shared as the innermost hits among V0 daughters. 0x1(0x2) bit represents V/z(U/r-phi)-hit share. -1 for exception.

If 1D- or 2D-hits are shared as the innermost hits among V0 daughters. 0x1(0x2) bit in flag represents V/z(U/r-phi)-hit share.

if the innermost hit is a SVD U-hit, check the next hit in addition note: for the SVD pair hits, U-hit should be first and the V-hit the next in the sorted RecoHitInformation array.

Definition at line 625 of file V0Fitter.cc.

◆ copyRecoTrack()

RecoTrack * copyRecoTrack ( RecoTrack origRecoTrack)
private

Create a copy of RecoTrack.

Track fit should be executed in removeInnerHits function.

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

Definition at line 487 of file V0Fitter.cc.

◆ copyRecoTrackAndFit()

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

Create a copy of RecoTrack and fit the Track.

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 495 of file V0Fitter.cc.

◆ extrapolateToVertex()

bool extrapolateToVertex ( genfit::MeasuredStateOnPlane stPlus,
genfit::MeasuredStateOnPlane stMinus,
const ROOT::Math::XYZVector &  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 141 of file V0Fitter.cc.

◆ fitAndStore()

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

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

remove hits inside the V0 vertex position

Initialize status flag for counting

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 205 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 108 of file V0Fitter.cc.

◆ removeInnerHits()

bool removeInnerHits ( RecoTrack prevRecoTrack,
RecoTrack recoTrack,
const int  trackPDG,
const ROOT::Math::XYZVector &  vertexPosition 
)
private

Remove inner hits from RecoTrack at once.

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
prevRecoTrackoriginal RecoTrack
recoTrackinput RecoTrack, updated in this function
trackPDGsigned PDG used for the track fit hypothesis
vertexPositionV0 vertex position
Returns

original track information

only a positive PDG number is allowed for the input

disable inner hits

true for sorted info.

true for sorted info.

check recohits one by one whether the vertex is outside/inside them

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

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

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.

N removed hits should not reach 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.

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 518 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 77 of file V0Fitter.cc.

◆ vertexFitWithRecoTracks()

bool vertexFitWithRecoTracks ( const Track trackPlus,
const Track trackMinus,
RecoTrack recoTrackPlus,
RecoTrack recoTrackMinus,
const Const::ParticleType v0Hypothesis,
unsigned int &  hasInnerHitStatus,
ROOT::Math::XYZVector &  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.

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.

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

store V0

Before storing, apply invariant mass cut.

Reconstruct invariant mass.

To build the trackFitResult, use the magnetic field at the origin = (0, 0, 0); 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

Definition at line 348 of file V0Fitter.cc.


The documentation for this class was generated from the following files: