Belle II Software  release-05-01-25
V0Fitter.cc
1 #include <tracking/v0Finding/fitter/V0Fitter.h>
2 
3 #include <framework/logging/Logger.h>
4 #include <framework/datastore/StoreArray.h>
5 #include <tracking/v0Finding/dataobjects/VertexVector.h>
6 #include <tracking/dataobjects/RecoTrack.h>
7 #include <tracking/trackFitting/fitter/base/TrackFitter.h>
8 #include <tracking/trackFitting/trackBuilder/factories/TrackBuilder.h>
9 
10 #include <mdst/dataobjects/HitPatternVXD.h>
11 #include <mdst/dataobjects/HitPatternCDC.h>
12 #include <mdst/dataobjects/Track.h>
13 #include <mdst/dataobjects/TrackFitResult.h>
14 #include <cdc/dataobjects/CDCRecoHit.h>
15 #include <pxd/reconstruction/PXDRecoHit.h>
16 #include <svd/reconstruction/SVDRecoHit.h>
17 #include <svd/reconstruction/SVDRecoHit2D.h>
18 
19 #include <genfit/Track.h>
20 #include <genfit/TrackPoint.h>
21 #include <genfit/MeasuredStateOnPlane.h>
22 #include <genfit/GFRaveVertexFactory.h>
23 #include <genfit/GFRaveVertex.h>
24 #include <genfit/FieldManager.h>
25 #include <genfit/MaterialEffects.h>
26 #include <genfit/FitStatus.h>
27 #include <genfit/KalmanFitStatus.h>
28 #include <genfit/KalmanFitterInfo.h>
29 
30 #include <framework/utilities/IOIntercept.h>
31 
32 using namespace Belle2;
33 
34 V0Fitter::V0Fitter(const std::string& trackFitResultsName, const std::string& v0sName,
35  const std::string& v0ValidationVerticesName, const std::string& recoTracksName,
36  const std::string& copiedRecoTracksName, bool enableValidation)
37  : m_validation(enableValidation), m_recoTracksName(recoTracksName), m_v0FitterMode(1), m_forcestore(false),
38  m_useOnlyOneSVDHitPair(true)
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 }
67 
68 void V0Fitter::setFitterMode(int fitterMode)
69 {
70  if (not(0 <= fitterMode && fitterMode <= 2)) {
71  B2FATAL("Invalid fitter mode!");
72  } else {
73  m_v0FitterMode = fitterMode;
74  if (fitterMode == 0)
75  m_forcestore = true;
76  else
77  m_forcestore = false;
78  if (fitterMode == 2)
79  m_useOnlyOneSVDHitPair = false;
80  else
82  }
83 }
84 
85 void V0Fitter::initializeCuts(double beamPipeRadius,
86  double vertexChi2CutOutside)
87 {
88  m_beamPipeRadius = beamPipeRadius;
89  m_vertexChi2CutOutside = vertexChi2CutOutside;
90 }
91 
92 
94 {
95  const TVector3& posPlus = stPlus.getPos();
96  const TVector3& posMinus = stMinus.getPos();
97 
98  const double Rstart = std::min(posPlus.Perp(), posMinus.Perp());
99  try {
100  stPlus.extrapolateToCylinder(Rstart);
101  stMinus.extrapolateToCylinder(Rstart);
102  } catch (...) {
103  B2DEBUG(22, "Extrapolation to cylinder failed.");
104  return true;
105  }
106 
107  return false;
108 }
109 
110 
112 {
113  VertexVector vertexVector;
114  std::vector<genfit::Track*> trackPair {&trackPlus, &trackMinus};
115 
116  try {
118  logCapture("V0Fitter GFRaveVertexFactory", LogConfig::c_Debug, LogConfig::c_Debug);
119  logCapture.start();
120 
121  genfit::GFRaveVertexFactory vertexFactory;
122  vertexFactory.findVertices(&vertexVector.v, trackPair);
123  } catch (...) {
124  B2ERROR("Exception during vertex fit.");
125  return false;
126  }
127 
128  if (vertexVector.size() != 1) {
129  B2DEBUG(21, "Vertex fit failed. Size of vertexVector not 1, but: " << vertexVector.size());
130  return false;
131  }
132 
133  if ((*vertexVector[0]).getNTracks() != 2) {
134  B2DEBUG(20, "Wrong number of tracks in vertex.");
135  return false;
136  }
137 
138  vertex = *vertexVector[0];
139  return true;
140 }
141 
145  const TVector3& vertexPosition, unsigned int& hasInnerHitStatus)
146 {
148  hasInnerHitStatus = 0;
149 
150  try {
153  double extralengthPlus = stPlus.extrapolateToPoint(vertexPosition);
154  double extralengthMinus = stMinus.extrapolateToPoint(vertexPosition);
155  if (extralengthPlus > 0) hasInnerHitStatus |= 0x1;
156  if (extralengthMinus > 0) hasInnerHitStatus |= 0x2;
157  } catch (...) {
161  B2DEBUG(22, "Could not extrapolate track to vertex.");
162  return false;
163  }
164  return true;
165 }
166 
167 double V0Fitter::getBzAtVertex(const TVector3& vertexPosition)
168 {
169  double Bx, By, Bz;
170  genfit::FieldManager::getInstance()->getFieldVal(vertexPosition.X(), vertexPosition.Y(), vertexPosition.Z(),
171  Bx, By, Bz);
172  Bz = Bz / 10;
173  return Bz;
174 }
175 
176 
178  const genfit::MeasuredStateOnPlane& msop, const double Bz,
179  const Const::ParticleType& trackHypothesis)
180 {
181  const uint64_t hitPatternCDCInitializer = TrackBuilder::getHitPatternCDCInitializer(*recoTrack);
182  const uint32_t hitPatternVXDInitializer = TrackBuilder::getHitPatternVXDInitializer(*recoTrack);
183 
184  TrackFitResult* v0TrackFitResult
185  = m_trackFitResults.appendNew(msop.getPos(), msop.getMom(),
186  msop.get6DCov(), msop.getCharge(),
187  trackHypothesis,
188  track.getFitStatus()->getPVal(),
189  Bz, hitPatternCDCInitializer, hitPatternVXDInitializer, track.getFitStatus()->getNdf());
190  return v0TrackFitResult;
191 }
192 
193 std::pair<Const::ParticleType, Const::ParticleType> V0Fitter::getTrackHypotheses(const Const::ParticleType& v0Hypothesis) const
194 {
195  if (v0Hypothesis == Const::Kshort) {
196  return std::make_pair(Const::pion, Const::pion);
197  } else if (v0Hypothesis == Const::photon) {
198  return std::make_pair(Const::electron, Const::electron);
199  } else if (v0Hypothesis == Const::Lambda) {
200  return std::make_pair(Const::proton, Const::pion);
201  } else if (v0Hypothesis == Const::antiLambda) {
202  return std::make_pair(Const::pion, Const::proton);
203  }
204  B2FATAL("Given V0Hypothesis not available.");
205  return std::make_pair(Const::invalidParticle, Const::invalidParticle); // return something to avoid triggering cppcheck
206 }
207 
209 bool V0Fitter::fitAndStore(const Track* trackPlus, const Track* trackMinus,
210  const Const::ParticleType& v0Hypothesis)
211 {
213  RecoTrack* recoTrackPlus = trackPlus->getRelated<RecoTrack>(m_recoTracksName);
214  RecoTrack* recoTrackMinus = trackMinus->getRelated<RecoTrack>(m_recoTracksName);
215 
219  unsigned int hasInnerHitStatus = 0;
220 
222  TVector3 vertexPos(0, 0, 0);
223 
229  if (not vertexFitWithRecoTracks(trackPlus, trackMinus, recoTrackPlus, recoTrackMinus, v0Hypothesis,
230  hasInnerHitStatus, vertexPos, m_forcestore))
231  return false;
232 
233  if ((hasInnerHitStatus == 0) or m_forcestore)
234  return true;
235 
240  bool failflag = false;
241  unsigned int nRemoveHitsPlus = 0;
242  unsigned int nRemoveHitsMinus = 0;
243 
245  const auto trackHypotheses = getTrackHypotheses(v0Hypothesis);
246  const int pdg_trackPlus = trackPlus->getTrackFitResultWithClosestMass(
247  trackHypotheses.first)->getParticleType().getPDGCode();
248  const int pdg_trackMinus = trackMinus->getTrackFitResultWithClosestMass(
249  trackHypotheses.second)->getParticleType().getPDGCode();
250 
251  RecoTrack* recoTrackPlus_forRefit = copyRecoTrack(recoTrackPlus, pdg_trackPlus);
252  RecoTrack* recoTrackMinus_forRefit = copyRecoTrack(recoTrackMinus, pdg_trackMinus);
253 
254  if ((recoTrackPlus_forRefit == nullptr) or (recoTrackMinus_forRefit == nullptr))
255  return false;
256 
257  while (hasInnerHitStatus != 0) {
260 
262  if (hasInnerHitStatus & 0x1) {
263  ++nRemoveHitsPlus;
266  if (not removeInnerHits(recoTrackPlus, recoTrackPlus_forRefit, pdg_trackPlus, nRemoveHitsPlus)) {
267  failflag = true;
268  break;
269  }
270  }
271 
273  if (hasInnerHitStatus & 0x2) {
274  ++nRemoveHitsMinus;
277  if (not removeInnerHits(recoTrackMinus, recoTrackMinus_forRefit, -1 * pdg_trackMinus, nRemoveHitsMinus)) {
278  failflag = true;
279  break;
280  }
281  }
282 
284  hasInnerHitStatus = 0;
287  if (not vertexFitWithRecoTracks(trackPlus, trackMinus, recoTrackPlus_forRefit, recoTrackMinus_forRefit,
288  v0Hypothesis, hasInnerHitStatus, vertexPos, false)) {
289  //B2WARNING("vertex refit failed.");
290  failflag = true;
291  break;
292  }
293  }
294 
296  if (failflag) {
297  bool forcestore = true;
298  if (not vertexFitWithRecoTracks(trackPlus, trackMinus, recoTrackPlus, recoTrackMinus, v0Hypothesis,
299  hasInnerHitStatus, vertexPos, forcestore)) {
300  B2WARNING("original vertex fit fails. this should not happen.");
301  return false;
302  }
303  }
304 
305  return true;
306 }
307 
310 bool V0Fitter::vertexFitWithRecoTracks(const Track* trackPlus, const Track* trackMinus,
311  RecoTrack* recoTrackPlus, RecoTrack* recoTrackMinus,
312  const Const::ParticleType& v0Hypothesis,
313  unsigned int& hasInnerHitStatus, TVector3& vertexPos,
314  const bool forceStore)
315 {
316  const auto trackHypotheses = getTrackHypotheses(v0Hypothesis);
317 
319  *recoTrackPlus);
320  const int pdgTrackPlus = trackPlus->getTrackFitResultWithClosestMass(trackHypotheses.first)->getParticleType().getPDGCode();
321  genfit::AbsTrackRep* plusRepresentation = recoTrackPlus->getTrackRepresentationForPDG(pdgTrackPlus);
322  if ((plusRepresentation == nullptr) or (not recoTrackPlus->wasFitSuccessful(plusRepresentation))) {
323  B2ERROR("Track hypothesis with closest mass not available. Should never happen, but I can continue savely anyway.");
324  return false;
325  }
326 
328  *recoTrackMinus);
329  const int pdgTrackMinus = trackMinus->getTrackFitResultWithClosestMass(trackHypotheses.second)->getParticleType().getPDGCode();
330  genfit::AbsTrackRep* minusRepresentation = recoTrackMinus->getTrackRepresentationForPDG(pdgTrackMinus);
331  if ((minusRepresentation == nullptr) or (not recoTrackMinus->wasFitSuccessful(minusRepresentation))) {
332  B2ERROR("Track hypothesis with closest mass not available. Should never happen, but I can continue savely anyway.");
333  return false;
334  }
335 
337  std::vector<genfit::AbsTrackRep*> repsPlus = gfTrackPlus.getTrackReps();
338  std::vector<genfit::AbsTrackRep*> repsMinus = gfTrackMinus.getTrackReps();
339  if (repsPlus.size() == repsMinus.size()) {
340  for (unsigned int id = 0; id < repsPlus.size(); id++) {
341  if (abs(repsPlus[id]->getPDG()) == pdgTrackPlus)
342  gfTrackPlus.setCardinalRep(id);
343  if (abs(repsMinus[id]->getPDG()) == pdgTrackMinus)
344  gfTrackMinus.setCardinalRep(id);
345  }
346  }
348  else {
349  for (unsigned int id = 0; id < repsPlus.size(); id++) {
350  if (abs(repsPlus[id]->getPDG()) == pdgTrackPlus)
351  gfTrackPlus.setCardinalRep(id);
352  }
353  for (unsigned int id = 0; id < repsMinus.size(); id++) {
354  if (abs(repsMinus[id]->getPDG()) == pdgTrackMinus)
355  gfTrackMinus.setCardinalRep(id);
356  }
357  }
358 
360  genfit::MeasuredStateOnPlane stPlus = recoTrackPlus->getMeasuredStateOnPlaneFromFirstHit(plusRepresentation);
361  genfit::MeasuredStateOnPlane stMinus = recoTrackMinus->getMeasuredStateOnPlaneFromFirstHit(minusRepresentation);
362 
363  if (rejectCandidate(stPlus, stMinus)) {
364  return false;
365  }
366 
368  if (not fitGFRaveVertex(gfTrackPlus, gfTrackMinus, vert)) {
369  return false;
370  }
371 
375  stPlus = gfTrackPlus.getFittedState();
376  stMinus = gfTrackMinus.getFittedState();
377 
378  const TVector3& posVert(vert.getPos());
379  vertexPos = posVert;
380 
383  if (posVert.Perp() < m_beamPipeRadius) {
384  return false;
385  } else {
386  if (vert.getChi2() > m_vertexChi2CutOutside) {
387  B2DEBUG(22, "Vertex outside beam pipe, chi^2 too large.");
388  return false;
389  }
390  }
391 
392  B2DEBUG(22, "Vertex accepted.");
393 
394  if (not extrapolateToVertex(stPlus, stMinus, posVert, hasInnerHitStatus)) {
395  return false;
396  }
397 
399  if (forceStore || hasInnerHitStatus == 0) {
403  const TVector3 origin(0, 0, 0);
404  const double Bz = getBzAtVertex(origin);
405 
406  TrackFitResult* tfrPlusVtx = buildTrackFitResult(gfTrackPlus, recoTrackPlus, stPlus, Bz, trackHypotheses.first);
407  TrackFitResult* tfrMinusVtx = buildTrackFitResult(gfTrackMinus, recoTrackMinus, stMinus, Bz, trackHypotheses.second);
408 
409  B2DEBUG(20, "Creating new V0.");
410  auto v0 = m_v0s.appendNew(std::make_pair(trackPlus, tfrPlusVtx),
411  std::make_pair(trackMinus, tfrMinusVtx));
412 
413  if (m_validation) {
414  B2DEBUG(24, "Create StoreArray and Output for validation.");
415  const genfit::GFRaveTrackParameters* tr0 = vert.getParameters(0);
416  const genfit::GFRaveTrackParameters* tr1 = vert.getParameters(1);
417  TLorentzVector lv0, lv1;
419  lv0.SetVectM(tr0->getMom(), trackHypotheses.first.getMass());
420  lv1.SetVectM(tr1->getMom(), trackHypotheses.second.getMass());
421  auto validationV0 = m_validationV0s.appendNew(
422  std::make_pair(trackPlus, tfrPlusVtx),
423  std::make_pair(trackMinus, tfrMinusVtx),
424  vert.getPos(),
425  vert.getCov(),
426  (lv0 + lv1).P(),
427  (lv0 + lv1).M(),
428  vert.getChi2()
429  );
430  v0->addRelationTo(validationV0);
431  }
432  }
433  return true;
434 }
435 
436 RecoTrack* V0Fitter::copyRecoTrack(RecoTrack* origRecoTrack, const int trackPDG)
437 {
439  Const::ChargedStable particleUsedForFitting(std::abs(trackPDG));
440  const genfit::AbsTrackRep* origTrackRep = origRecoTrack->getTrackRepresentationForPDG(std::abs(
441  trackPDG));
442 
443  RecoTrack* newRecoTrack = origRecoTrack->copyToStoreArray(m_copiedRecoTracks);
444  newRecoTrack->addHitsFromRecoTrack(origRecoTrack);
445  newRecoTrack->addRelationTo(origRecoTrack);
446 
448  TrackFitter fitter;
449  if (not fitter.fit(*newRecoTrack, particleUsedForFitting)) {
450  B2WARNING("track fit failed for copied RecoTrack.");
452  if (not origRecoTrack->wasFitSuccessful(origTrackRep))
453  B2WARNING("\t original track fit was also failed.");
454  return nullptr;
455  }
456 
457  return newRecoTrack;
458 }
459 
460 bool V0Fitter::removeInnerHits(RecoTrack* origRecoTrack, RecoTrack* recoTrack,
461  const int trackPDG, unsigned int& nRemoveHits)
462 {
464  Const::ChargedStable particleUsedForFitting(std::abs(trackPDG));
465  const genfit::AbsTrackRep* origTrackRep = origRecoTrack->getTrackRepresentationForPDG(std::abs(
466  trackPDG));
467 
469  const std::vector<RecoHitInformation*>& recoHitInformations = recoTrack->getRecoHitInformations(true);
470  if (recoHitInformations.size() < nRemoveHits) {
471  B2WARNING("N removed hits exceeds N hits in the track.");
472  return false;
473  }
474  for (unsigned int i = 0 ; i < nRemoveHits ; ++i) {
475  recoHitInformations[i]->setUseInFit(false);
476  }
479  if (recoHitInformations[nRemoveHits - 1]->getTrackingDetector() == RecoHitInformation::RecoHitDetector::c_SVD) {
480  if (recoHitInformations.size() < nRemoveHits + 1) {
481  B2WARNING("N removed hits exceeds N hits in the track.");
482  return false;
483  }
484  if (recoHitInformations[nRemoveHits]->getTrackingDetector() == RecoHitInformation::RecoHitDetector::c_SVD) {
485  const SVDCluster* lastRemovedSVDHit = recoHitInformations[nRemoveHits - 1]->getRelatedTo<SVDCluster>();
486  const SVDCluster* nextSVDHit = recoHitInformations[nRemoveHits] ->getRelatedTo<SVDCluster>();
487  if (lastRemovedSVDHit->getSensorID() == nextSVDHit->getSensorID() &&
488  lastRemovedSVDHit->isUCluster() && !(nextSVDHit->isUCluster())) {
489  recoHitInformations[nRemoveHits]->setUseInFit(false);
490  ++nRemoveHits;
491  }
492  }
493  }
494 
496  if (!m_useOnlyOneSVDHitPair &&
497  recoHitInformations[nRemoveHits - 1]->getTrackingDetector() == RecoHitInformation::RecoHitDetector::c_SVD &&
498  recoHitInformations.size() > nRemoveHits + 2) {
499  if (recoHitInformations[nRemoveHits ]->getTrackingDetector() == RecoHitInformation::RecoHitDetector::c_SVD &&
500  recoHitInformations[nRemoveHits + 1]->getTrackingDetector() == RecoHitInformation::RecoHitDetector::c_SVD &&
501  recoHitInformations[nRemoveHits + 2]->getTrackingDetector() != RecoHitInformation::RecoHitDetector::c_SVD) {
502  recoHitInformations[nRemoveHits ]->setUseInFit(false);
503  recoHitInformations[nRemoveHits + 1]->setUseInFit(false);
504  nRemoveHits += 2;
505  }
506  }
507 
509  TrackFitter fitter;
510  if (not fitter.fit(*recoTrack, particleUsedForFitting)) {
511  B2WARNING("track fit failed.");
513  if (not origRecoTrack->wasFitSuccessful(origTrackRep))
514  B2WARNING("\t original track fit was also failed.");
515  return false;
516  }
517 
518  return true;
519 }
Belle2::V0Fitter::fitAndStore
bool fitAndStore(const Track *trackPlus, const Track *trackMinus, const Const::ParticleType &v0Hypothesis)
Fit V0 with given hypothesis and store if fit was successful.
Definition: V0Fitter.cc:209
Belle2::V0Fitter::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)
fit V0 vertex using RecoTrack's as inputs.
Definition: V0Fitter.cc:310
Belle2::V0Fitter::m_v0s
StoreArray< V0 > m_v0s
V0 (output).
Definition: V0Fitter.h:153
Belle2::Const::photon
static const ParticleType photon
photon particle
Definition: Const.h:547
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::getBzAtVertex
double getBzAtVertex(const TVector3 &vertexPosition)
Getter for magnetic field in z direction at the vertex position.
Definition: V0Fitter.cc:167
Belle2::VertexVector::size
size_t size() const noexcept
Return size of vertex vector.
Definition: VertexVector.h:29
Belle2::RecoTrack::addHitsFromRecoTrack
size_t addHitsFromRecoTrack(const RecoTrack *recoTrack, unsigned int sortingParameterOffset=0, bool reversed=false, boost::optional< double > optionalMinimalWeight=boost::none)
Add all hits from another RecoTrack to this RecoTrack.
Definition: RecoTrack.cc:230
Belle2::RecoTrack::wasFitSuccessful
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition: RecoTrack.cc:326
genfit::GFRaveTrackParameters
GFRaveTrackParameters class Contains a pointer to the original genfit::Track, the weight of the track...
Definition: GFRaveTrackParameters.h:51
Belle2::V0Fitter::m_trackFitResults
StoreArray< TrackFitResult > m_trackFitResults
TrackFitResult (output).
Definition: V0Fitter.h:152
genfit::GFRaveVertex
GFRaveVertex class.
Definition: GFRaveVertex.h:48
Belle2::VertexVector::v
std::vector< genfit::GFRaveVertex * > v
Fitted vertices.
Definition: VertexVector.h:35
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::V0Fitter::m_recoTracksName
std::string m_recoTracksName
RecoTrackColName (input).
Definition: V0Fitter.h:150
genfit::GFRaveVertexFactory
Vertex factory for producing GFRaveVertex objects from Track objects.
Definition: GFRaveVertexFactory.h:64
Belle2::RecoTrackGenfitAccess::getGenfitTrack
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition: RecoTrack.cc:389
Belle2::Const::invalidParticle
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition: Const.h:554
Belle2::Const::Kshort
static const ParticleType Kshort
K^0_S particle.
Definition: Const.h:550
genfit::Track::getTrackReps
const std::vector< genfit::AbsTrackRep * > & getTrackReps() const
Return the track representations as a list of pointers.
Definition: Track.h:132
Belle2::Const::electron
static const ChargedStable electron
electron particle
Definition: Const.h:533
Belle2::RecoTrack::getMeasuredStateOnPlaneFromFirstHit
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlaneFromFirstHit(const genfit::AbsTrackRep *representation=nullptr) const
Return genfit's MeasuredStateOnPlane for the first hit in a fit useful for extrapolation of measureme...
Definition: RecoTrack.cc:580
Belle2::RecoTrack::getTrackRepresentationForPDG
genfit::AbsTrackRep * getTrackRepresentationForPDG(int pdgCode)
Return an already created track representation of the given reco track for the PDG.
Definition: RecoTrack.cc:453
Belle2::V0Fitter::m_copiedRecoTracks
StoreArray< RecoTrack > m_copiedRecoTracks
RecoTrack used to refit tracks (output)
Definition: V0Fitter.h:155
genfit::Track
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
genfit::FieldManager::getFieldVal
TVector3 getFieldVal(const TVector3 &position)
This does NOT use the cache!
Definition: FieldManager.h:63
Belle2::RelationsInterface::addRelationTo
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Definition: RelationsObject.h:144
Belle2::Const::ParticleType::getPDGCode
int getPDGCode() const
PDG code.
Definition: Const.h:349
Belle2::V0Fitter::extrapolateToVertex
bool extrapolateToVertex(genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus, const TVector3 &vertexPosition)
Extrapolate the fit results to the perigee to the vertex.
Belle2::V0Fitter::m_beamPipeRadius
double m_beamPipeRadius
Radius where inside/outside beampipe is defined.
Definition: V0Fitter.h:157
genfit::AbsTrackRep
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Belle2::RelationsInterface::getRelated
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Definition: RelationsObject.h:280
Belle2::V0Fitter::m_useOnlyOneSVDHitPair
bool m_useOnlyOneSVDHitPair
true only if the V0Fitter mode is 1
Definition: V0Fitter.h:161
Belle2::RecoTrack::copyToStoreArray
RecoTrack * copyToStoreArray(StoreArray< RecoTrack > &storeArray) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition: RecoTrack.cc:506
Belle2::V0Fitter::copyRecoTrack
RecoTrack * copyRecoTrack(RecoTrack *origRecoTrack, const int trackPDG)
Create a copy of RecoTrack.
Definition: V0Fitter.cc:436
Belle2::TrackFitResult
Values of the result of a track fit with a given particle hypothesis.
Definition: TrackFitResult.h:59
Belle2::V0Fitter::rejectCandidate
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...
Definition: V0Fitter.cc:93
Belle2::V0Fitter::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.
Definition: V0Fitter.cc:34
Belle2::DataStore::c_WriteOut
@ c_WriteOut
Object/array should be saved by output modules.
Definition: DataStore.h:72
Belle2::TrackFitter
Algorithm class to handle the fitting of RecoTrack objects.
Definition: TrackFitter.h:116
Belle2::V0Fitter::buildTrackFitResult
TrackFitResult * buildTrackFitResult(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.
Definition: V0Fitter.cc:177
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::Const::pion
static const ChargedStable pion
charged pion particle
Definition: Const.h:535
Belle2::TrackBuilder::getHitPatternCDCInitializer
static uint64_t getHitPatternCDCInitializer(const RecoTrack &recoTrack)
Get the HitPattern in the CDC.
Definition: TrackBuilder.cc:195
Belle2::TrackFitResult::getParticleType
Const::ParticleType getParticleType() const
Getter for ParticleType of the mass hypothesis of the track fit.
Definition: TrackFitResult.h:154
Belle2::Track::getTrackFitResultWithClosestMass
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
Definition: Track.cc:70
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VertexVector
Need this container for exception-safe cleanup, GFRave's interface isn't exception-safe as is.
Definition: VertexVector.h:17
Belle2::V0Fitter::getTrackHypotheses
std::pair< Const::ParticleType, Const::ParticleType > getTrackHypotheses(const Const::ParticleType &v0Hypothesis) const
Get track hypotheses for a given v0 hypothesis.
Definition: V0Fitter.cc:193
Belle2::V0Fitter::setFitterMode
void setFitterMode(int fitterMode)
set V0 fitter mode.
Definition: V0Fitter.cc:68
Belle2::TrackBuilder::getHitPatternVXDInitializer
static uint32_t getHitPatternVXDInitializer(const RecoTrack &recoTrack)
Get the HitPattern in the VXD.
Definition: TrackBuilder.cc:138
Belle2::V0Fitter::initializeCuts
void initializeCuts(double beamPipeRadius, double vertexChi2CutOutside)
Initialize the cuts which will be applied during the fit and store process.
Definition: V0Fitter.cc:85
Belle2::IOIntercept::InterceptOutput::start
bool start()
Start intercepting the output.
Definition: IOIntercept.h:165
Belle2::Const::antiLambda
static const ParticleType antiLambda
Anti-Lambda particle.
Definition: Const.h:553
genfit::Track::getFittedState
const MeasuredStateOnPlane & getFittedState(int id=0, const AbsTrackRep *rep=nullptr, bool biased=true) const
Shortcut to get FittedStates.
Definition: Track.cc:285
Belle2::SVDCluster::isUCluster
bool isUCluster() const
Get the direction of strips.
Definition: SVDCluster.h:118
genfit::GFRaveVertex::getPos
TVector3 getPos() const
get Position
Definition: GFRaveVertex.h:67
Belle2::V0Fitter::m_vertexChi2CutOutside
double m_vertexChi2CutOutside
Chi2 cut outside beampipe.
Definition: V0Fitter.h:158
Belle2::SVDCluster::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDCluster.h:110
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
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::RecoTrack::getRecoHitInformations
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
Definition: RecoTrack.cc:531
Belle2::Const::ParticleType
The ParticleType class for identifying different particle types.
Definition: Const.h:284
Belle2::Const::proton
static const ChargedStable proton
proton particle
Definition: Const.h:537
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
Belle2::IOIntercept::OutputToLogMessages
Capture stdout and stderr and convert into log messages.
Definition: IOIntercept.h:236
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:36
Belle2::Track
Class that bundles various TrackFitResults.
Definition: Track.h:35
genfit::FieldManager::getInstance
static FieldManager * getInstance()
Get singleton instance.
Definition: FieldManager.h:119
Belle2::V0Fitter::fitGFRaveVertex
bool fitGFRaveVertex(genfit::Track &trackPlus, genfit::Track &trackMinus, genfit::GFRaveVertex &vertex)
Fit the V0 vertex.
Definition: V0Fitter.cc:111
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
Belle2::V0Fitter::removeInnerHits
bool removeInnerHits(RecoTrack *origRecoTrack, RecoTrack *recoTrack, const int trackPDG, unsigned int &nRemoveHits)
Remove inner hits from RecoTrack.
Definition: V0Fitter.cc:460
Belle2::Const::Lambda
static const ParticleType Lambda
Lambda particle.
Definition: Const.h:552
genfit::GFRaveVertex::getCov
TMatrixDSym getCov() const
get 3x3 covariance (error) of position.
Definition: GFRaveVertex.h:70