Belle II Software  release-08-01-10
NewV0Fitter Class Reference

Improved V0 fitter class. More...

#include <NewV0Fitter.h>

Collaboration diagram for NewV0Fitter:

Classes

struct  FittedTrack
 Structure to save track data of the last successful iteration. More...
 

Public Member Functions

 NewV0Fitter (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. More...
 
void initializeCuts (double vertexDistanceCut, double vertexChi2Cut, const std::tuple< double, double > &invMassRangeKshort, const std::tuple< double, double > &invMassRangeLambda, const std::tuple< double, double > &invMassRangePhoton)
 Initialization of cuts applied during the fit and store process. More...
 
void setFitterMode (int fitterMode)
 Setter for the 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 results if fit is successful. More...
 

Static Public Member Functions

static std::pair< Const::ParticleType, Const::ParticleTypegetTrackHypotheses (const Const::ParticleType &v0Hypothesis)
 Returns daughter particle types for a given V0 hypothesis. More...
 

Private Types

enum  ErrorStatus {
  c_NoTrackRepresentation = -4 ,
  c_VertexFitFailed = -3 ,
  c_ExtrapolationFailed = -2 ,
  c_NotSelected = -1
}
 Error status codes returned by the vertexFit method. More...
 
enum  EInnerHitBits {
  c_BitTrackPlus = 0x1 ,
  c_BitTrackMinus = 0x2
}
 Bits used to signal that track has hits inside the V0 vertex. More...
 

Private Member Functions

int vertexFit (const RecoTrack *recoTrackPlus, const RecoTrack *recoTrackMinus, int pdgTrackPlus, int pdgTrackMinus, const Const::ParticleType &v0Hypothesis)
 Performs a vertex fit. More...
 
const genfit::AbsTrackRepgetTrackRepresentation (const RecoTrack *recoTrack, int pdgCode)
 Returns track representation for a given PDG code. More...
 
bool setCardinalRep (genfit::Track &gfTrack, int pdgCode)
 Sets cardinal representation of a given genfit track and PDG code. More...
 
bool fitGFRaveVertex (genfit::Track &trackPlus, genfit::Track &trackMinus, genfit::GFRaveVertex &vertex)
 Genfit Rave vertex fit called by vertexFit method. More...
 
int extrapolateToVertex (genfit::MeasuredStateOnPlane &statePlus, genfit::MeasuredStateOnPlane &stateMinus, const genfit::GFRaveVertex &vertex)
 Extrapolation of both tracks to the vertex. More...
 
RecoTrackcopyRecoTrack (const RecoTrack *origRecoTrack, const genfit::MeasuredStateOnPlane &state)
 Make a copy of reco track. More...
 
const RecoTrackremoveHitsAndRefit (const RecoTrack *origRecoTrack, const RecoTrack *lastRecoTrack, const Const::ParticleType &ptype)
 Remove track inner hits and refit the track. More...
 
int isInnermostClusterShared (const RecoTrack *recoTrackPlus, const RecoTrack *recoTrackMinus)
 Returns bit flags indicating that the innermost cluster is shared between both tracks. More...
 
const TrackFitResultsaveTrackFitResult (const FittedTrack &trk, int sharedInnermostCluster)
 Append track fit result to the collection. More...
 

Private Attributes

std::string m_recoTracksName
 name of the RecoTracks collection
 
StoreArray< RecoTrackm_recoTracks
 RecoTracks collection.
 
StoreArray< TrackFitResultm_trackFitResults
 TrackFitResults collection.
 
StoreArray< V0m_v0s
 V0s collection.
 
StoreArray< V0ValidationVertexm_validationV0s
 V0ValidationVertex collection (optional)
 
StoreArray< RecoTrackm_copiedRecoTracks
 copied RecoTracks collection
 
double m_vertexDistanceCut = 0
 cut on the transverse radius
 
double m_vertexChi2Cut = 0
 Chi2 cut.
 
std::map< int, std::pair< double, double > > m_invMassCuts
 invariant mass cuts, key = abs(PDG)
 
int m_fitterMode = 1
 fitter mode
 
bool m_validation = false
 validation flag
 
genfit::GFRaveVertex m_fittedVertex
 last successfully fitted vertex
 
double m_momentum = 0
 momentum of last successfully fitted vertex
 
double m_invMass = 0
 invariant mass of last successfully fitted vertex
 
FittedTrack m_trkPlus
 positively charged track data of last successfully fitted vertex
 
FittedTrack m_trkMinus
 negatively charged track data of last successfully fitted vertex
 

Detailed Description

Improved V0 fitter class.

Definition at line 30 of file NewV0Fitter.h.

Member Enumeration Documentation

◆ EInnerHitBits

enum EInnerHitBits
private

Bits used to signal that track has hits inside the V0 vertex.

Enumerator
c_BitTrackPlus 

positive track has inner hits

c_BitTrackMinus 

negative track has inner hits

Definition at line 139 of file NewV0Fitter.h.

139  {
140  c_BitTrackPlus = 0x1,
141  c_BitTrackMinus = 0x2
142  };
@ c_BitTrackMinus
negative track has inner hits
Definition: NewV0Fitter.h:141
@ c_BitTrackPlus
positive track has inner hits
Definition: NewV0Fitter.h:140

◆ ErrorStatus

enum ErrorStatus
private

Error status codes returned by the vertexFit method.

Enumerator
c_NoTrackRepresentation 

no track representation for given PDG code

c_VertexFitFailed 

vertex fit failed

c_ExtrapolationFailed 

track extrapolation failed

c_NotSelected 

fitted vertex not passing the cuts

Definition at line 128 of file NewV0Fitter.h.

Constructor & Destructor Documentation

◆ NewV0Fitter()

NewV0Fitter ( 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.

Parameters
trackFitResultsNamename of the StoreArray TrackFitResults
v0sNamename of the StoreArray V0s
v0ValidationVerticesNamename of the StoreArray V0ValidationVertex
recoTracksNamename of the StoreArray RecoTracks
copiedRecoTracksNamename of the StoreArray of copied RecoTracks
enableValidationon true store additional data for validation

Definition at line 27 of file NewV0Fitter.cc.

30  : m_recoTracksName(recoTracksName), m_validation(enableValidation)
31 {
32  B2ASSERT("V0Fitter: material effects not set up. Please use SetupGenfitExtrapolationModule.",
33  genfit::MaterialEffects::getInstance()->isInitialized());
34  B2ASSERT("V0Fitter: magnetic field not set up. Please use SetupGenfitExtrapolationModule.",
35  genfit::FieldManager::getInstance()->isInitialized());
36 
38  m_trackFitResults.isRequired(trackFitResultsName);
39 
44 
45  if (m_validation) {
46  m_validationV0s.registerInDataStore(v0ValidationVerticesName, DataStore::c_ErrorIfAlreadyRegistered);
47  m_v0s.registerRelationTo(m_validationV0s);
48  }
49 
50 }
@ 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
StoreArray< V0ValidationVertex > m_validationV0s
V0ValidationVertex collection (optional)
Definition: NewV0Fitter.h:235
StoreArray< RecoTrack > m_copiedRecoTracks
copied RecoTracks collection
Definition: NewV0Fitter.h:236
bool m_validation
validation flag
Definition: NewV0Fitter.h:243
StoreArray< V0 > m_v0s
V0s collection.
Definition: NewV0Fitter.h:234
StoreArray< TrackFitResult > m_trackFitResults
TrackFitResults collection.
Definition: NewV0Fitter.h:233
std::string m_recoTracksName
name of the RecoTracks collection
Definition: NewV0Fitter.h:231
StoreArray< RecoTrack > m_recoTracks
RecoTracks collection.
Definition: NewV0Fitter.h:232
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
static FieldManager * getInstance()
Get singleton instance.
Definition: FieldManager.h:119

Member Function Documentation

◆ copyRecoTrack()

RecoTrack * copyRecoTrack ( const RecoTrack origRecoTrack,
const genfit::MeasuredStateOnPlane state 
)
private

Make a copy of reco track.

Parameters
origRecoTracksource
statemeasured state for the track fit seeding
Returns
a copy of source

Definition at line 396 of file NewV0Fitter.cc.

◆ extrapolateToVertex()

int extrapolateToVertex ( genfit::MeasuredStateOnPlane statePlus,
genfit::MeasuredStateOnPlane stateMinus,
const genfit::GFRaveVertex vertex 
)
private

Extrapolation of both tracks to the vertex.

On success the return value indicates if tracks have inner hits (see EInnerHitBits).

Parameters
statePlusmeasured state of positively charged track from which the extrapolation is performed [in/out]
stateMinusmeasured state of negatively charged track from which the extrapolation is performed [in/out]
vertexvertex
Returns
value >= 0 on success, value < 0 on failure

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 286 of file NewV0Fitter.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 results if fit is successful.

Parameters
trackPluspositively charged track
trackMinusnegatively charged track
v0HypothesisV0 hypothesis
isForceStoredtrue if V0 is forced to store when hit removal failed [out]
isHitRemovedtrue if inner hits have been removed (or at least tried to be removed) [out]
Returns
true on success

Initialize status flags and result storage

Get related recoTracks

PDG codes actually used in track fitting

initial vertex fit

try to refit tracks by removing inner hits and refit the vertex

Usually this procedure converges in up to 3 iterations (mostly in a single iteration), but for a small fraction of track pairs it does not converge at all, so we set the limit at 5.

save the results

Definition at line 83 of file NewV0Fitter.cc.

◆ fitGFRaveVertex()

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

Genfit Rave vertex fit called by vertexFit method.

Parameters
trackPluspositively charged genfit track
trackMinusnegatively charged genfit track
vertexfitted vertex [out]
Returns
true on success

Definition at line 254 of file NewV0Fitter.cc.

◆ getTrackHypotheses()

std::pair< Const::ParticleType, Const::ParticleType > getTrackHypotheses ( const Const::ParticleType v0Hypothesis)
static

Returns daughter particle types for a given V0 hypothesis.

Parameters
v0HypothesisV0 hypothesis
Returns
a pair of daughter particle types

Definition at line 67 of file NewV0Fitter.cc.

◆ getTrackRepresentation()

const genfit::AbsTrackRep * getTrackRepresentation ( const RecoTrack recoTrack,
int  pdgCode 
)
private

Returns track representation for a given PDG code.

Parameters
recoTracktrack
pdgCodePDG code
Returns
track representation on success or nullptr on failure

Definition at line 229 of file NewV0Fitter.cc.

◆ initializeCuts()

void initializeCuts ( double  vertexDistanceCut,
double  vertexChi2Cut,
const std::tuple< double, double > &  invMassRangeKshort,
const std::tuple< double, double > &  invMassRangeLambda,
const std::tuple< double, double > &  invMassRangePhoton 
)

Initialization of cuts applied during the fit and store process.

Parameters
vertexDistanceCutcut on the transverse radius to cut-off vertices within the beam pipe
vertexChi2Cutcut on the vertex chi^2
invMassRangeKshortselection mass window for Ks
invMassRangeLambdaselection mass window for Lambda
invMassRangePhotonselection mass window for converted gamma

Definition at line 53 of file NewV0Fitter.cc.

◆ isInnermostClusterShared()

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

Returns bit flags indicating that the innermost cluster is shared between both tracks.

Bit 0 is set if U cluster is shared, bit 1 is set if V cluster is shared, and both if shared cluster is PXD.

Parameters
recoTrackPluspositively charged track
recoTrackMinusnegatively charged track
Returns
bit flags

Definition at line 409 of file NewV0Fitter.cc.

◆ removeHitsAndRefit()

const RecoTrack * removeHitsAndRefit ( const RecoTrack origRecoTrack,
const RecoTrack lastRecoTrack,
const Const::ParticleType ptype 
)
private

Remove track inner hits and refit the track.

On success return the refitted one, otherwise return the track of last iteration (or the original one if no hits need to be removed).

Parameters
origRecoTrackoriginal track
lastRecoTracktrack at last hit-removal iteration
ptypeparticle type for refit
Returns
refitted track on success, lastRecoTrack on failure, origRecoTrack if no hits removed

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 308 of file NewV0Fitter.cc.

◆ saveTrackFitResult()

const TrackFitResult * saveTrackFitResult ( const FittedTrack trk,
int  sharedInnermostCluster 
)
private

Append track fit result to the collection.

Parameters
trktrack data
sharedInnermostClusterbit flags of shared innermost clusters
Returns
track fit result

Definition at line 463 of file NewV0Fitter.cc.

◆ setCardinalRep()

bool setCardinalRep ( genfit::Track gfTrack,
int  pdgCode 
)
private

Sets cardinal representation of a given genfit track and PDG code.

Parameters
gfTrackgenfit track [in/out]
pdgCodePDG code
Returns
true on success

Definition at line 239 of file NewV0Fitter.cc.

◆ setFitterMode()

void setFitterMode ( int  fitterMode)
inline

Setter for the fitter mode.

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

Parameters
fitterModefitter mode

Definition at line 101 of file NewV0Fitter.h.

◆ vertexFit()

int vertexFit ( const RecoTrack recoTrackPlus,
const RecoTrack recoTrackMinus,
int  pdgTrackPlus,
int  pdgTrackMinus,
const Const::ParticleType v0Hypothesis 
)
private

Performs a vertex fit.

On success the return value indicates if tracks have inner hits or not (see EInnerHitBits). On failure it returns ErrorStatus code.

Parameters
recoTrackPluspositively charged track
recoTrackMinusnegatively charged track
pdgTrackPlusPDG code used in the fit of positively charged track (closest mass to V0 daughter)
pdgTrackMinusPDG code used in the fit of negatively charged track (closest mass to V0 daughter)
v0HypothesisV0 hypothesis
Returns
value >= 0 on success, value < 0 on failure

Definition at line 165 of file NewV0Fitter.cc.


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