Belle II Software development
|
V0Fitter class to create V0 mdst's from reconstructed tracks. More...
#include <V0Fitter.h>
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. | |
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. | |
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. | |
std::pair< Const::ParticleType, Const::ParticleType > | getTrackHypotheses (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. | |
RecoTrack * | copyRecoTrack (RecoTrack *origRecoTrack) |
Create a copy of RecoTrack. | |
RecoTrack * | copyRecoTrackAndFit (RecoTrack *origRecoTrack, const int trackPDG) |
Create a copy of RecoTrack and fit the Track. | |
bool | removeInnerHits (RecoTrack *prevRecoTrack, RecoTrack *recoTrack, const int trackPDG, const ROOT::Math::XYZVector &vertexPosition) |
Remove inner hits from RecoTrack at once. | |
int | checkSharedInnermostCluster (const RecoTrack *recoTrackPlus, const RecoTrack *recoTrackMinus) |
Compare innermost hits of daughter pairs to check if they are the same (shared) or not. | |
bool | fitGFRaveVertex (genfit::Track &trackPlus, genfit::Track &trackMinus, genfit::GFRaveVertex &vertex) |
Fit the V0 vertex. | |
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. | |
TrackFitResult * | buildTrackFitResult (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< RecoTrack > | m_recoTracks |
RecoTrack (input) | |
StoreArray< TrackFitResult > | m_trackFitResults |
TrackFitResult (output). | |
StoreArray< V0 > | m_v0s |
V0 (output). | |
StoreArray< V0ValidationVertex > | m_validationV0s |
V0ValidationVertex (output, optional). | |
StoreArray< RecoTrack > | m_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 |
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.
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.
|
private |
Build TrackFitResult of V0 Track and set relation to genfit Track.
Definition at line 165 of file V0Fitter.cc.
|
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.
recoTrackPlus,recoTrackMinus | input RecoTrack pair |
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.
Create a copy of RecoTrack.
Track fit should be executed in removeInnerHits function.
origRecoTrack | original RecoTrack |
Definition at line 487 of file V0Fitter.cc.
Create a copy of RecoTrack and fit the Track.
origRecoTrack | original RecoTrack |
trackPDG | signed PDG used for the track fit hypothesis |
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.
|
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.
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.
|
private |
Fit the V0 vertex.
trackPlus | |
trackMinus | |
vertex | Result of the fit is returned via reference. |
Definition at line 108 of file V0Fitter.cc.
std::pair< Const::ParticleType, Const::ParticleType > getTrackHypotheses | ( | const Const::ParticleType & | v0Hypothesis | ) | const |
Get track hypotheses for a given v0 hypothesis.
Definition at line 189 of file V0Fitter.cc.
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.
Definition at line 94 of file V0Fitter.cc.
|
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 function. If track fit fails, return false.
prevRecoTrack | original RecoTrack |
recoTrack | input RecoTrack, updated in this function |
trackPDG | signed PDG used for the track fit hypothesis |
vertexPosition | V0 vertex position |
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
fit recoTrack
check fit status of original track
Definition at line 518 of file V0Fitter.cc.
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.
|
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.
trackPlus | Track of positively-charged daughter |
trackMinus | Track of negatively-charged daughter |
recoTrackPlus | RecoTrack of positively-charged daughter |
recoTrackMinus | RecoTrack of negatively-charged daughter |
v0Hypothesis | ParticleType used in vertex fitting |
hasInnerHitStatus | store a result of this function. if the plus(minus) track has hits inside the V0 vertex position, 0x1(0x2) bit is set. |
vertexPos | store a result of this function. the fitted vertex position is stored. |
forceStore | if true, store the fitted V0 to the DataStore even if there are some inside hits. |
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.
|
friend |
Definition at line 41 of file V0Fitter.h.
|
friend |
Definition at line 40 of file V0Fitter.h.
|
friend |
Definition at line 42 of file V0Fitter.h.
|
private |
Radius where inside/outside beampipe is defined.
Definition at line 163 of file V0Fitter.h.
|
private |
RecoTrack used to refit tracks (output)
Definition at line 161 of file V0Fitter.h.
|
private |
true only if the V0Fitter mode is 1
Definition at line 169 of file V0Fitter.h.
|
private |
invariant mass cut for Kshort.
Definition at line 165 of file V0Fitter.h.
|
private |
invariant mass cut for Lambda.
Definition at line 166 of file V0Fitter.h.
|
private |
invariant mass cut for Photon.
Definition at line 167 of file V0Fitter.h.
|
private |
RecoTrack (input)
Definition at line 157 of file V0Fitter.h.
|
private |
RecoTrackColName (input).
Definition at line 156 of file V0Fitter.h.
|
private |
TrackFitResult (output).
Definition at line 158 of file V0Fitter.h.
|
private |
false only if the V0Fitter mode is 3
Definition at line 170 of file V0Fitter.h.
|
private |
|
private |
V0 (output).
Definition at line 159 of file V0Fitter.h.
|
private |
Validation flag.
Definition at line 155 of file V0Fitter.h.
|
private |
V0ValidationVertex (output, optional).
Definition at line 160 of file V0Fitter.h.
|
private |
Chi2 cut outside beampipe.
Definition at line 164 of file V0Fitter.h.