11#include <framework/datastore/RelationsObject.h>
12#include <framework/datastore/StoreArray.h>
13#include <tracking/dataobjects/RecoTrack.h>
15#include <framework/database/DBObjPtr.h>
16#include <mdst/dbobjects/BeamSpot.h>
17#include <mdst/dataobjects/Track.h>
18#include <analysis/VertexFitting/RaveInterface/RaveVertexFitter.h>
20#include <Math/Vector3D.h>
58 PXD2TrackBase(
const ROOT::Math::XYZVector& vertex,
const T& track_p,
const T& track_m):
88 const std::string& recoTracksName =
"",
89 const std::string& pxdInterceptsName =
"",
90 const std::string& pxdTrackClustersName =
"PXDClustersFromTracks"
105 const std::string& recoTracksName,
106 const std::string& pxdInterceptsName,
107 const std::string& pxdTrackClustersName
115 auto track1Ptr = recoTracks[0]->getRelated<
Track>(
"Tracks");
116 auto track2Ptr = recoTracks[1]->getRelated<
Track>(
"Tracks");
117 if (!track1Ptr or !track2Ptr)
return false;
122 if (!tfr1Ptr or !tfr2Ptr)
return false;
125 if (tfr1Ptr->getPValue() <= 0 or tfr2Ptr->getPValue() <= 0)
return false;
128 if (tfr1Ptr->getChargeSign() * tfr2Ptr->getChargeSign() >= 0)
return false;
132 B2DEBUG(20,
"B Field = " << bField <<
" T");
139 B2DEBUG(20,
"Adding tracks to RaveVertexFitter failed.");
142 if (rvf.
fit() == 0)
return false;
144 auto vertex = rvf.
getPos();
152 B2DEBUG(20,
"Vertex = (" << m_vx
159 auto ip = ROOT::Math::XYZVector(beamSpotDB->getIPPosition());
160 if (tfr1Ptr->getChargeSign() > 0) {
161 m_track_p.setValues(*recoTracks[0], ip, recoTracksName, pxdInterceptsName, pxdTrackClustersName);
162 m_track_m.setValues(*recoTracks[1], ip, recoTracksName, pxdInterceptsName, pxdTrackClustersName);
164 m_track_p.setValues(*recoTracks[1], ip, recoTracksName, pxdInterceptsName, pxdTrackClustersName);
165 m_track_m.setValues(*recoTracks[0], ip, recoTracksName, pxdInterceptsName, pxdTrackClustersName);
static ROOT::Math::XYZVector getFieldInTesla(const ROOT::Math::XYZVector &pos)
return the magnetic field at a given position in Tesla.
static const ChargedStable pion
charged pion particle
Class for accessing objects in the database.
Class PXD2TrackBase: Event data container for performance and calibration studies.
float m_vy
Position of the vertex in y.
float m_vz
Position of the vertex in z.
ROOT::Math::XYZVector getVertex() const
Get the vertex.
const T & getTrackP() const
Get the track with positive charge.
T m_track_m
Track with the negative charge.
const T & getTrackM() const
Get the track with negative charge.
float m_vx
Position of the vertex in x.
PXD2TrackBase()
default constructor for ROOT
T baseType
The base type for a track structure.
PXD2TrackBase(const ROOT::Math::XYZVector &vertex, const T &track_p, const T &track_m)
Standard constructor.
T m_track_p
Track with the positive charge.
Defines interface for accessing relations of objects in StoreArray.
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Accessor to arrays stored in the data store.
bool isValid() const
Check wether the array was registered.
int getEntries() const
Get the number of objects in the array.
Class that bundles various TrackFitResults.
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
static void initialize(int verbosity=1, double MagneticField=1.5)
Set everything up so everything needed for vertex fitting is there.
static RaveSetup * getInstance()
get the pointer to the instance to get/set any of options stored in RaveSetup
void reset()
frees memory allocated by initialize().
The RaveVertexFitter class is part of the RaveInterface together with RaveSetup.
int fit(std::string options="default")
do the vertex fit with all tracks previously added with the addTrack or addMother function.
void addTrack(const Particle *const aParticlePtr)
add a track (in the format of a Belle2::Particle) to set of tracks that should be fitted to a vertex
B2Vector3D getPos(VecSize vertexId=0) const
get the position of the fitted vertex.
virtual bool setValues(const StoreArray< RecoTrack > &recoTracks, const std::string &recoTracksName="", const std::string &pxdInterceptsName="", const std::string &pxdTrackClustersName="PXDClustersFromTracks")
Set values from RecoTrack collection.
Abstract base class for different kinds of events.