8 #include <mdst/dataobjects/Track.h>
9 #include <mdst/dataobjects/TrackFitResult.h>
10 #include <framework/gearbox/Const.h>
11 #include <framework/datastore/StoreArray.h>
12 #include <gtest/gtest.h>
37 const ROOT::Math::XYZVector dummyVector3;
38 const TMatrixDSym dummyMatrix(6);
40 const float pValue = 1.;
41 const float bField = 1.5;
43 const auto newFitRes = trackFitResults.
appendNew(dummyVector3, dummyVector3, dummyMatrix, charge, particeType, pValue,
54 DataStore::Instance().setInitializeActive(
true);
60 const auto myElectron =
addDummyTrack(myResults, Const::electron);
63 EXPECT_EQ(myPion->getArrayIndex(), 0);
64 EXPECT_EQ(myKaon->getArrayIndex(), 1);
65 EXPECT_EQ(myElectron->getArrayIndex(), 2);
66 EXPECT_EQ(myMuon->getArrayIndex(), 3);
90 EXPECT_EQ(allResults.size(), 3);
93 auto countPion = std::count_if(allResults.begin(), allResults.end(),
94 [myPion](std::pair<Const::ChargedStable, const TrackFitResult*> fitPair)
95 {return (fitPair.first == Const::pion) && (fitPair.second->getArrayIndex() == myPion->getArrayIndex());});
96 auto countMuon = std::count_if(allResults.begin(), allResults.end(),
97 [myMuon](std::pair<Const::ChargedStable, const TrackFitResult*> fitPair)
98 {return (fitPair.first == Const::muon) && (fitPair.second->getArrayIndex() == myMuon->getArrayIndex());});
99 auto countElectron = std::count_if(allResults.begin(), allResults.end(),
100 [](std::pair<Const::ChargedStable, const TrackFitResult*> fitPair)
101 {return fitPair.first == Const::electron;});
102 auto countKaon = std::count_if(allResults.begin(), allResults.end(),
103 [myKaon](std::pair<Const::ChargedStable, const TrackFitResult*> fitPair)
104 {return (fitPair.first == Const::kaon) && (fitPair.second->getArrayIndex() == myKaon->getArrayIndex());});
106 EXPECT_EQ(countPion, 1);
107 EXPECT_EQ(countMuon, 1);
108 EXPECT_EQ(countElectron, 0);
109 EXPECT_EQ(countKaon, 1);
113 Track trackQITest1(0.5);
123 DataStore::Instance().setInitializeActive(
true);
129 const auto myElectron =
addDummyTrack(myResults, Const::electron);
139 EXPECT_EQ(Const::kaon.getPDGCode(), fitCloseToKaonMass->getParticleType().getPDGCode());
144 EXPECT_EQ(Const::electron.getPDGCode(), wantPionButHaveElectronFit->getParticleType().getPDGCode());
149 EXPECT_EQ(Const::electron.getPDGCode(), wantMuonButHaveElectronFit->getParticleType().getPDGCode());
154 EXPECT_EQ(Const::kaon.getPDGCode(), wantProtonButHaveKaonFit->getParticleType().getPDGCode());
Provides a type-safe way to pass members of the chargedStableSet set.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
Values of the result of a track fit with a given particle hypothesis.
Const::ParticleType getParticleType() const
Getter for ParticleType of the mass hypothesis of the track fit.
Test class for the Track object.
Class that bundles various TrackFitResults.
std::vector< ChargedStableTrackFitResultPair > getTrackFitResults() const
Deafult Access to all track fit results at the same time.
const TrackFitResult * getTrackFitResult(const Const::ChargedStable &chargedStable) const
Default Access to TrackFitResults.
float getQualityIndicator() const
Getter for quality indicator for classification of fake vs.
void setTrackFitResultIndex(const Const::ChargedStable &chargedStable, short index)
Set an index (for positive values) or unavailability-code (index = -1) for a specific mass hypothesis...
unsigned int getNumberOfFittedHypotheses() const
Returns the number of fitted hypothesis which are stored in this track.
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for a fit hypothesis with the closest mass.
TrackFitResult const * addDummyTrack(StoreArray< TrackFitResult > &trackFitResults, Const::ChargedStable particeType)
Utility function to create dummy TrackFitResults.
TEST_F(TrackTest, getTrackFitResultWithClosestMass)
Test simple Setters and Getters.
Abstract base class for different kinds of events.