Belle II Software light-2406-ragdoll
Collaboration diagram for mdst:

Modules

 mdst data objects
 
 mdst modules
 

Classes

class  BeamParametersFitter
 Fitter calculating BeamParameters from CollisionBoostVector and CollisionInvariantMass. More...
 
class  BeamSpot
 This class contains the beam spot position and size modeled as a gaussian distribution in space. More...
 
class  CollisionAxisCMS
 This class contains the measured values of the orientation of the collision axis in the CM system obtained by pure Lorentz boost angleXZ = atan(pHERcms.X / pHERcms.Z) angleYZ = atan(pHERcms.Y / pHERcms.Z) where pHERcms is HER momentum in CM system obtained by boost. More...
 
class  CollisionBoostVector
 This class contains the measured average boost vector vec(beta) = (beta_x, beta_y, beta_z) = vec(p_e+e-)/E_e+e- of the center-of-mass system in the lab frame and its uncertainty. More...
 
class  CollisionInvariantMass
 This class contains the measured average center-of-mass energy, which is equal to the invariant mass of the colliding beams, and its uncertainty. More...
 
class  DBRepresentationOfSoftwareTriggerCut
 Class to handle storing SoftwareTriggerCuts in the database. More...
 
class  SoftwareTriggerCutBase
 Base class for the SoftwareTriggerCut and its DBRepresentation. More...
 
class  SoftwareTriggerMenu
 Class to handle storing the trigger menu in the database. More...
 
class  TRGGDLDBBadrun
 The payload class for GDL badrun. More...
 
class  TRGGDLDBFTDLBits
 The payload class for FTDL output bit. More...
 
class  TRGGDLDBInputBits
 The payload class for GDL input bit. More...
 
class  TRGGDLDBPrescales
 The payload class for GDL psnm. More...
 
class  TTDOffsets
 This class contains information to correct the information obtained from the TTD (simple offsets) More...
 
class  BeamSpotTest
 
class  ECLClusterTest
 Test class for the Track object. More...
 
class  EventLevelTrackingInfoTest
 Unit tests for the event level tracking information. More...
 
class  HitPatternCDCTest
 Unit tests for the CDC hit Patterns. More...
 
class  HitPatternVXDTest
 
class  KlIdTest
 Test class for the KlId object. More...
 
class  TrackTest
 Test class for the Track object. More...
 
class  TrackFitResultTest
 Set up a few arrays and objects in the datastore. More...
 
class  V0Test
 Set up a few arrays and objects in the datastore. More...
 

Functions

 TEST_F (BeamSpotTest, Basic)
 Constructor, copy constructor, comparison, setters and getters.
 
 TEST_F (ECLClusterTest, Constructors)
 Test default constructor.
 
 TEST_F (ECLClusterTest, SettersAndGetters)
 Test setter and getter.
 
 TEST_F (EventLevelTrackingInfoTest, settersNGettersCDC)
 Test simple Setters, Getters, and Hassers for the CDC related part.
 
 TEST_F (EventLevelTrackingInfoTest, settersNGettersVXD)
 Test simple Setters and Getters for the VXD related part.
 
 TEST_F (EventLevelTrackingInfoTest, settersNGettersFlagBlock)
 Test simple Setters and Getters for the VXD related part.
 
 TEST_F (HitPatternCDCTest, settersNGetters)
 Test simple Setters, Getters, and Hassers.
 
 TEST_F (HitPatternCDCTest, SetNGetTotalNumberOfHits)
 This tests if the total number of hits is set and read correctly.
 
 TEST_F (HitPatternCDCTest, getLongestContRunInSL)
 Test if the longest run in a superlayer is returned correctly.
 
 TEST_F (HitPatternCDCTest, getFirstLastLayer)
 Test if getFirst/LastLayer returns the proper value.
 
 TEST_F (HitPatternVXDTest, NumberingScheme)
 Test the numbering scheme in the static variables.
 
 TEST_F (HitPatternVXDTest, General)
 Constructor and some general getters.
 
 TEST_F (HitPatternVXDTest, SVDSetterAndGetter)
 Test simple Setters and Getters for SVD.
 
 TEST_F (HitPatternVXDTest, PXDSetterAndGetter)
 Test simple Setters and Getters for the PXD.
 
 TEST_F (HitPatternVXDTest, NGetters)
 Test total number of hit getters.
 
 TEST_F (HitPatternVXDTest, getNLayers)
 Test the getNLayer functions.
 
 TEST_F (HitPatternVXDTest, getFirstLastLayer)
 Test the getters for First/Last Layer.
 
 TEST_F (KlIdTest, SettersAndGetters)
 Test setter and getter.
 
TrackFitResult const * addDummyTrack (StoreArray< TrackFitResult > &trackFitResults, Const::ChargedStable particeType)
 Utility function to create dummy TrackFitResults.
 
 TEST_F (TrackTest, settersNGetters)
 Test simple Setters and Getters.
 
 TEST_F (TrackTest, getTrackFitResultWithClosestMass)
 Test simple Setters and Getters.
 
 TEST_F (TrackFitResultTest, Getters)
 Test simple Setters and Getters.
 
 TEST_F (TrackFitResultTest, ErrorPropagation)
 Test if the error propagation of the covariance matrix works properly.
 
 TEST_F (TrackFitResultTest, Charge)
 Test get charge.
 
 TEST_F (V0Test, IndexGetters)
 Test Index Getter.
 
 TEST_F (V0Test, PointerGetters)
 Test Pointer Getter.
 

Detailed Description

Function Documentation

◆ addDummyTrack()

TrackFitResult const * addDummyTrack ( StoreArray< TrackFitResult > &  trackFitResults,
Const::ChargedStable  particeType 
)

Utility function to create dummy TrackFitResults.

Definition at line 35 of file track.cc.

36 {
37 const ROOT::Math::XYZVector dummyVector3;
38 const TMatrixDSym dummyMatrix(6);
39 const int charge = 1;
40 const float pValue = 1.;
41 const float bField = 1.5;
42
43 const auto newFitRes = trackFitResults.appendNew(dummyVector3, dummyVector3, dummyMatrix, charge, particeType, pValue,
44 bField, 0, 0, 0);
45 return newFitRes;
46 }

◆ TEST_F() [1/25]

TEST_F ( BeamSpotTest  ,
Basic   
)

Constructor, copy constructor, comparison, setters and getters.

Definition at line 25 of file BeamSpotUT.cc.

26 {
27 BeamSpot bs;
28 EXPECT_EQ(bs.getIPPosition().X(), 0.);
29 EXPECT_EQ(bs.getIPPosition().Y(), 0.);
30 EXPECT_EQ(bs.getIPPosition().Z(), 0.);
31
32 std::function<float (int, int)> sizeElement = [ & sizeElement](int i, int j) {
33 return j >= i ? (i + 1) + 10 * (j + 1) : sizeElement(j, i) ;
34 };
35
36 std::function<float (int, int)> errorElement = [& errorElement](int i, int j) {
37 return j >= i ? 100 + (i + 1) + 10 * (j + 1) : errorElement(j, i);
38 };
39
40 TMatrixDSym size(3), positionError(3);
41 for (int i = 0; i < 3; i++)
42 for (int j = i; j < 3; j++) {
43 size(i, j) = size(j, i) = sizeElement(i, j);
44 positionError(i, j) = positionError(j, i) = errorElement(i, j);
45 }
46
47 TVector3 position;
48 position.SetXYZ(1., 2., 3.);
49
50 bs.setSizeCovMatrix(size);
51 bs.setIP(position, positionError);
52
53 TVector3 testPosition = bs.getIPPosition();
54 EXPECT_EQ(testPosition.X(), 1.);
55 EXPECT_EQ(testPosition.Y(), 2.);
56 EXPECT_EQ(testPosition.Z(), 3.);
57
58 TMatrixDSym testError = bs.getIPPositionCovMatrix();
59 for (int i = 0; i < 3; i++)
60 for (int j = 0; j < 3; j++)
61 EXPECT_EQ(testError(i, j), errorElement(i, j));
62
63 TMatrixDSym testSize = bs.getSizeCovMatrix();
64 for (int i = 0; i < 3; i++)
65 for (int j = 0; j < 3; j++)
66 EXPECT_EQ(testSize(i, j), sizeElement(i, j));
67
68
69 TMatrixDSym testCovVertex = bs.getCovVertex();
70 for (int i = 0; i < 3; i++)
71 for (int j = 0; j < 3; j++)
72 EXPECT_EQ(testCovVertex(i, j), (sizeElement(i, j) + errorElement(i, j)));
73
74 EXPECT_EQ(bs.getGlobalUniqueID(), 1);
75 BeamSpot bs2(bs);
76 EXPECT_EQ(bs == bs2, true);
77
78 BeamSpot bs3;
79 bs3 = bs;
80 EXPECT_EQ(bs == bs3, true);
81
82 BeamSpot bs4;
83 bs4 = bs3;
84 size(2, 2) = 0.;
85
86 bs3.setSizeCovMatrix(size);
87 size(2, 2) = std::numeric_limits<double>::min();
88 bs4.setSizeCovMatrix(size);
89
90 EXPECT_EQ(bs4 == bs3, false);
91 }

◆ TEST_F() [2/25]

TEST_F ( ECLClusterTest  ,
Constructors   
)

Test default constructor.

Definition at line 29 of file eclCluster.cc.

30 {
31 ECLCluster myECLCluster;
32
33 EXPECT_EQ(exp(-5.), myECLCluster.getEnergy(ECLCluster::EHypothesisBit::c_nPhotons));
34 EXPECT_EQ(exp(-5.), myECLCluster.getEnergyRaw());
35 EXPECT_EQ(exp(-5.), myECLCluster.getEnergyHighestCrystal());
36 EXPECT_EQ(0, myECLCluster.getTheta());
37 EXPECT_EQ(0, myECLCluster.getPhi());
38 EXPECT_EQ(0, myECLCluster.getR());
39 EXPECT_EQ(0, myECLCluster.getTime());
40 EXPECT_EQ(0, myECLCluster.getDeltaTime99());
41 EXPECT_EQ(0, myECLCluster.getStatus());
42 EXPECT_EQ(0, myECLCluster.getNumberOfCrystals());
43 EXPECT_EQ(0, myECLCluster.getLAT());
44 EXPECT_EQ(0, myECLCluster.getAbsZernike40());
45 EXPECT_EQ(0, myECLCluster.getAbsZernike51());
46 EXPECT_EQ(0, myECLCluster.getZernikeMVA());
47 EXPECT_EQ(0, myECLCluster.getE1oE9());
48 EXPECT_EQ(0, myECLCluster.getE9oE21());
49
50 EXPECT_EQ(0, myECLCluster.getUncertaintyEnergy());
51 EXPECT_EQ(0, myECLCluster.getUncertaintyTheta());
52 EXPECT_EQ(0, myECLCluster.getUncertaintyPhi());
53
54 EXPECT_FALSE(myECLCluster.isTrack());
55 EXPECT_TRUE(myECLCluster.isNeutral());
56
57 double x = myECLCluster.getClusterPosition().X();
58 double y = myECLCluster.getClusterPosition().Y();
59 double z = myECLCluster.getClusterPosition().Z();
60 EXPECT_EQ(0, x);
61 EXPECT_EQ(0, y);
62 EXPECT_EQ(0, z);
63
64 const auto error3x3 = myECLCluster.getCovarianceMatrix3x3();
65 EXPECT_EQ(0, error3x3(0, 0));
66 EXPECT_EQ(0, error3x3(0, 1));
67 EXPECT_EQ(0, error3x3(0, 2));
68 EXPECT_EQ(0, error3x3(1, 0));
69 EXPECT_EQ(0, error3x3(1, 1));
70 EXPECT_EQ(0, error3x3(1, 2));
71 EXPECT_EQ(0, error3x3(2, 0));
72 EXPECT_EQ(0, error3x3(2, 1));
73 EXPECT_EQ(0, error3x3(2, 2));
74
75 } // default constructor

◆ TEST_F() [3/25]

TEST_F ( ECLClusterTest  ,
SettersAndGetters   
)

Test setter and getter.

Definition at line 78 of file eclCluster.cc.

79 {
80 ECLCluster myECLCluster;
81 // Pick some arbitrary numbers to test with
82 const bool isTrack = true;
83 const double energy = 1.165;
84 const float theta = 1.2;
85 const float phi = 1.2;
86 const double r = 1.2;
87 const double energyDepSum = 12.3;
88 const double time = 17.2;
89 const double deltaTime99 = 1.1;
90 const double E9oE21 = 0.1;
91 const double highestEnergy = 32.1;
92 const double lat = 0.5;
93 const double nOfCrystals = 4;
94 const ECLCluster::EStatusBit status = ECLCluster::EStatusBit::c_PulseShapeDiscrimination;
95 // Energy->[0], Phi->[2], Theta->[5]
96 double error[6] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6};
97
98 myECLCluster.setEnergy(energy);
99 myECLCluster.setE9oE21(E9oE21);
100 myECLCluster.setEnergyRaw(energyDepSum);
101 myECLCluster.setTheta(theta);
102 myECLCluster.setPhi(phi);
103 myECLCluster.setR(r);
104 myECLCluster.setTime(time);
105 myECLCluster.setDeltaTime99(deltaTime99);
106 myECLCluster.setEnergyHighestCrystal(highestEnergy);
107 myECLCluster.setStatus(status);
108 myECLCluster.setNumberOfCrystals(nOfCrystals);
109 myECLCluster.setLAT(lat);
110 myECLCluster.setCovarianceMatrix(error);
111 myECLCluster.setIsTrack(isTrack);
112 myECLCluster.setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
113
114 EXPECT_FLOAT_EQ(energy, myECLCluster.getEnergy(ECLCluster::EHypothesisBit::c_nPhotons));
115 EXPECT_FLOAT_EQ(E9oE21, myECLCluster.getE9oE21());
116 EXPECT_FLOAT_EQ(energyDepSum, myECLCluster.getEnergyRaw());
117 EXPECT_FLOAT_EQ(theta, myECLCluster.getTheta());
118 EXPECT_FLOAT_EQ(phi, myECLCluster.getPhi());
119 EXPECT_FLOAT_EQ(r, myECLCluster.getR());
120 EXPECT_FLOAT_EQ(time, myECLCluster.getTime());
121 EXPECT_FLOAT_EQ(deltaTime99, myECLCluster.getDeltaTime99());
122 EXPECT_FLOAT_EQ(highestEnergy, myECLCluster.getEnergyHighestCrystal());
123 EXPECT_TRUE(myECLCluster.hasStatus(status));
124 EXPECT_FLOAT_EQ(nOfCrystals, myECLCluster.getNumberOfCrystals());
125 EXPECT_FLOAT_EQ(lat, myECLCluster.getLAT());
126
127 EXPECT_FLOAT_EQ(error[0], myECLCluster.getUncertaintyEnergy()*myECLCluster.getUncertaintyEnergy());
128 EXPECT_FLOAT_EQ(error[5], myECLCluster.getUncertaintyTheta()*myECLCluster.getUncertaintyTheta());
129 EXPECT_FLOAT_EQ(error[2], myECLCluster.getUncertaintyPhi()*myECLCluster.getUncertaintyPhi());
130
131 EXPECT_TRUE(myECLCluster.isTrack());
132 EXPECT_FALSE(myECLCluster.isNeutral());
133
134 const auto error3x3 = myECLCluster.getCovarianceMatrix3x3();
135 EXPECT_FLOAT_EQ(error[0], error3x3(0, 0));
136 EXPECT_FLOAT_EQ(error[1], error3x3(0, 1));
137 EXPECT_FLOAT_EQ(error[3], error3x3(0, 2));
138 EXPECT_FLOAT_EQ(error[1], error3x3(1, 0));
139 EXPECT_FLOAT_EQ(error[2], error3x3(1, 1));
140 EXPECT_FLOAT_EQ(error[4], error3x3(1, 2));
141 EXPECT_FLOAT_EQ(error[3], error3x3(2, 0));
142 EXPECT_FLOAT_EQ(error[4], error3x3(2, 1));
143 EXPECT_FLOAT_EQ(error[5], error3x3(2, 2));
144
145 } // default constructor

◆ TEST_F() [4/25]

TEST_F ( EventLevelTrackingInfoTest  ,
settersNGettersCDC   
)

Test simple Setters, Getters, and Hassers for the CDC related part.

Definition at line 23 of file eventLevelTrackingInfo.cc.

24 {
25 // Test proper initialization for an empty afterimage.
26 EventLevelTrackingInfo eventLevelTrackingInfo;
27 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssigned(), 0);
28 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssignedPostCleaning(), 0);
29
30 //Let's set the total number CDC hits in the afterimage
31 eventLevelTrackingInfo.setNCDCHitsNotAssigned(324);
32 eventLevelTrackingInfo.setNCDCHitsNotAssignedPostCleaning(257);
33
34 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssigned(), 324);
35 EXPECT_EQ(eventLevelTrackingInfo.getNCDCHitsNotAssignedPostCleaning(), 257);
36
37 //Let's set and get information for the various layers:
38 eventLevelTrackingInfo.setCDCLayer(9); // SL1
39 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCLayer(9));
40 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCLayer(10));
41 eventLevelTrackingInfo.setCDCLayer(23);
42 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCLayer(23));
43 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCLayer(55));
44
45 EXPECT_B2FATAL(eventLevelTrackingInfo.setCDCLayer(56));
46 EXPECT_B2FATAL(eventLevelTrackingInfo.hasCDCLayer(56));
47
48 //Let's have a look at the SuperLayers ...
49 EXPECT_TRUE(eventLevelTrackingInfo.hasCDCSLayer(1));
50 EXPECT_FALSE(eventLevelTrackingInfo.hasCDCSLayer(5));
51
52 //Let's set and get the information on unused segments:
53 eventLevelTrackingInfo.setNCDCSegments(21);
54 EXPECT_EQ(eventLevelTrackingInfo.getNCDCSegments(), 21);
55 eventLevelTrackingInfo.setNCDCSegments(300);
56 EXPECT_EQ(eventLevelTrackingInfo.getNCDCSegments(), 255);
57 }

◆ TEST_F() [5/25]

TEST_F ( EventLevelTrackingInfoTest  ,
settersNGettersFlagBlock   
)

Test simple Setters and Getters for the VXD related part.

Definition at line 82 of file eventLevelTrackingInfo.cc.

83 {
84 EventLevelTrackingInfo eventLevelTrackingInfo;
85 EXPECT_EQ(eventLevelTrackingInfo.hasUnspecifiedTrackFindingFailure(), false);
86 EXPECT_EQ(eventLevelTrackingInfo.hasAnErrorFlag(), false);
87 EXPECT_EQ(eventLevelTrackingInfo.hasVXDTF2AbortionFlag(), false);
88 eventLevelTrackingInfo.setUnspecifiedTrackFindingFailure();
89 EXPECT_EQ(eventLevelTrackingInfo.hasUnspecifiedTrackFindingFailure(), true);
90 EXPECT_EQ(eventLevelTrackingInfo.hasAnErrorFlag(), true);
91 EXPECT_EQ(eventLevelTrackingInfo.hasVXDTF2AbortionFlag(), false);
92
93 EventLevelTrackingInfo eventLevelTrackingInfo2;
94 EXPECT_EQ(eventLevelTrackingInfo2.hasVXDTF2AbortionFlag(), false);
95 EXPECT_EQ(eventLevelTrackingInfo2.hasAnErrorFlag(), false);
96 EXPECT_EQ(eventLevelTrackingInfo2.hasUnspecifiedTrackFindingFailure(), false);
97 eventLevelTrackingInfo2.setVXDTF2AbortionFlag();
98 EXPECT_EQ(eventLevelTrackingInfo2.hasVXDTF2AbortionFlag(), true);
99 EXPECT_EQ(eventLevelTrackingInfo2.hasAnErrorFlag(), true);
100 EXPECT_EQ(eventLevelTrackingInfo2.hasUnspecifiedTrackFindingFailure(), false);
101 }

◆ TEST_F() [6/25]

TEST_F ( EventLevelTrackingInfoTest  ,
settersNGettersVXD   
)

Test simple Setters and Getters for the VXD related part.

Definition at line 60 of file eventLevelTrackingInfo.cc.

61 {
62 EventLevelTrackingInfo eventLevelTrackingInfo;
63 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3), 0);
64 eventLevelTrackingInfo.setNVXDClustersInLayer(3, true, 81);
65 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3), 81);
66 eventLevelTrackingInfo.setNVXDClustersInLayer(2, true, 3456);
67 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(2), 3456);
68 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3, true), 81);
69 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(3, false), 0);
70 EXPECT_B2FATAL(eventLevelTrackingInfo.getNVXDClustersInLayer(56));
71
72 eventLevelTrackingInfo.setNVXDClustersInLayer(6, true, 300);
73 EXPECT_EQ(eventLevelTrackingInfo.getNVXDClustersInLayer(6, true), 255);
74
75 eventLevelTrackingInfo.setSVDFirstSampleTime(-128);
76 EXPECT_EQ(eventLevelTrackingInfo.getSVDFirstSampleTime(), -128);
77 eventLevelTrackingInfo.setSVDFirstSampleTime(127);
78 EXPECT_EQ(eventLevelTrackingInfo.getSVDFirstSampleTime(), 127);
79 }

◆ TEST_F() [7/25]

TEST_F ( HitPatternCDCTest  ,
getFirstLastLayer   
)

Test if getFirst/LastLayer returns the proper value.

Definition at line 97 of file hitPatternCDC.cc.

98 {
99 HitPatternCDC myHitPatternCDC(0);
100 myHitPatternCDC.setNHits(123); //arbitrary number to check if this layer is masked out correctly
101
102 unsigned short firstLayer = 5;
103 unsigned short lastLayer = 46;
104 myHitPatternCDC.setLayer(firstLayer);
105 myHitPatternCDC.setLayer(lastLayer);
106 EXPECT_EQ(firstLayer, myHitPatternCDC.getFirstLayer());
107 EXPECT_EQ(lastLayer, myHitPatternCDC.getLastLayer());
108
109 myHitPatternCDC.resetPattern();
110 EXPECT_EQ(-1, myHitPatternCDC.getFirstLayer());
111 EXPECT_EQ(-1, myHitPatternCDC.getLastLayer());
112 }

◆ TEST_F() [8/25]

TEST_F ( HitPatternCDCTest  ,
getLongestContRunInSL   
)

Test if the longest run in a superlayer is returned correctly.

Definition at line 80 of file hitPatternCDC.cc.

81 {
82 unsigned long long int initValue = static_cast<unsigned long long int>(0xEEEEEEEEEEEEEEL); // 11101110...11101110
83 HitPatternCDC myHitPatternCDC(initValue);
84 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(0));
85 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(1));
86 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(2));
87 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(3));
88 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(4));
89 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(5));
90 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(6));
91 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(7));
92 EXPECT_EQ(3, myHitPatternCDC.getLongestContRunInSL(8));
93
94 }

◆ TEST_F() [9/25]

TEST_F ( HitPatternCDCTest  ,
SetNGetTotalNumberOfHits   
)

This tests if the total number of hits is set and read correctly.

Definition at line 63 of file hitPatternCDC.cc.

64 {
65 unsigned long long int initValue = static_cast<unsigned long long int>(0xAAAAAAAAAAAAAAAAL); //101010...101010
66 HitPatternCDC myHitPatternCDC(initValue);
67 EXPECT_EQ(170, myHitPatternCDC.getNHits());
68 unsigned short int nHits1 = 255;
69 myHitPatternCDC.setNHits(nHits1);
70 EXPECT_EQ(nHits1, myHitPatternCDC.getNHits());
71 unsigned short int nHits2 = 0;
72 myHitPatternCDC.setNHits(nHits2);
73 EXPECT_EQ(nHits2, myHitPatternCDC.getNHits());
74 unsigned short int nHits3 = 93;
75 myHitPatternCDC.setNHits(nHits3);
76 EXPECT_EQ(nHits3, myHitPatternCDC.getNHits());
77 }

◆ TEST_F() [10/25]

TEST_F ( HitPatternCDCTest  ,
settersNGetters   
)

Test simple Setters, Getters, and Hassers.

Definition at line 22 of file hitPatternCDC.cc.

23 {
24 // Test proper initialization.
25 unsigned long initValue = 66560; // python >>> 2 ** 16 + 2 ** 10
26 HitPatternCDC hitPatternCDC(initValue);
27 EXPECT_EQ(initValue, hitPatternCDC.getInteger());
28
29 HitPatternCDC hitPatternCDC2;
30 EXPECT_EQ(0, hitPatternCDC2.getNHits());
31
32 // Test setting and getting individual bits
33 short layer = 5;
34 hitPatternCDC2.setLayer(layer);
35 EXPECT_EQ(true, hitPatternCDC2.hasLayer(5));
36
37 // Test of SuperLayer getters; setters don't make sense.
38 // Reminder: Start counting from 0 here.
39 // Even -> Axial Layer; Odd -> Stereo Layer
40 HitPatternCDC hitPatternCDC3;
41 hitPatternCDC3.setLayer(9); // SL 1
42 hitPatternCDC3.setLayer(15); // SL 2
43 hitPatternCDC3.setLayer(21); // SL 3
44
45 EXPECT_FALSE(hitPatternCDC3.hasSLayer(0));
46 EXPECT_TRUE(hitPatternCDC3.hasSLayer(1));
47
48 // Test Axial and Stereo requests.
49 EXPECT_TRUE(hitPatternCDC3.hasAxialLayer());
50 EXPECT_TRUE(hitPatternCDC3.hasStereoLayer());
51 EXPECT_FALSE(hitPatternCDC2.hasStereoLayer());
52
53 hitPatternCDC3.resetLayer(15);
54 EXPECT_FALSE(hitPatternCDC3.hasAxialLayer());
55
56 // Test resetting of super layers.
57 hitPatternCDC3.resetSLayer(1);
58 hitPatternCDC3.resetSLayer(3);
59 EXPECT_EQ(0, hitPatternCDC3.getNHits());
60 } // settersNGetters

◆ TEST_F() [11/25]

TEST_F ( HitPatternVXDTest  ,
General   
)

Constructor and some general getters.

Definition at line 34 of file hitPatternVXD.cc.

35 {
36 unsigned int initValue = 16776960;
37 std::bitset<32> initValueAsBitset(static_cast<std::string>("00000000111111111111111100000000"));
38
39 HitPatternVXD myHitPattern(initValue);
40 EXPECT_EQ(initValueAsBitset, myHitPattern.getBitset());
41 EXPECT_EQ(initValue, myHitPattern.getInteger());
42
43 }

◆ TEST_F() [12/25]

TEST_F ( HitPatternVXDTest  ,
getFirstLastLayer   
)

Test the getters for First/Last Layer.

Definition at line 142 of file hitPatternVXD.cc.

143 {
144 HitPatternVXD myHitPattern(0);
145 // random choices
146 const unsigned short firstLayerPXD = 1;
147 const unsigned short lastLayerPXD = 2;
148 const unsigned short firstLayerSVD = 4;
149 const unsigned short lastLayerSVD = 6;
150
151 // set SVD
152 myHitPattern.setSVDLayer(3, 0, 0);
153 myHitPattern.setSVDLayer(4, 3, 0);
154 myHitPattern.setSVDLayer(5, 0, 1);
155 myHitPattern.setSVDLayer(6, 1, 1);
156 // set PXD normal
157 myHitPattern.setPXDLayer(1, 1, HitPatternVXD::PXDMode::normal);
158 myHitPattern.setPXDLayer(2, 2, HitPatternVXD::PXDMode::normal);
159 // set PXD gated
160 myHitPattern.setPXDLayer(1, 1, HitPatternVXD::PXDMode::gated);
161 myHitPattern.setPXDLayer(2, 2, HitPatternVXD::PXDMode::gated);
162
163 EXPECT_EQ(firstLayerSVD, myHitPattern.getFirstSVDLayer());
164 EXPECT_EQ(lastLayerSVD, myHitPattern.getLastSVDLayer());
165 EXPECT_EQ(firstLayerPXD, myHitPattern.getFirstPXDLayer(HitPatternVXD::PXDMode::normal));
166 EXPECT_EQ(lastLayerPXD, myHitPattern.getLastPXDLayer(HitPatternVXD::PXDMode::normal));
167 EXPECT_EQ(firstLayerPXD, myHitPattern.getFirstPXDLayer(HitPatternVXD::PXDMode::gated));
168 EXPECT_EQ(lastLayerPXD, myHitPattern.getLastPXDLayer(HitPatternVXD::PXDMode::gated));
169 }

◆ TEST_F() [13/25]

TEST_F ( HitPatternVXDTest  ,
getNLayers   
)

Test the getNLayer functions.

Definition at line 114 of file hitPatternVXD.cc.

115 {
116 HitPatternVXD myHitPattern(0);
117 const unsigned short nSVD = 3;
118 const unsigned short nPXDnormal = 2;
119 const unsigned short nPXDgated = 1;
120
121 // set SVD
122 myHitPattern.setSVDLayer(3, 1, 3);
123 myHitPattern.setSVDLayer(4, 0, 0);
124 myHitPattern.setSVDLayer(5, 1, 1);
125 myHitPattern.setSVDLayer(6, 0, 1);
126 // set PXD normal
127 myHitPattern.setPXDLayer(1, 1, HitPatternVXD::PXDMode::normal);
128 myHitPattern.setPXDLayer(2, 2, HitPatternVXD::PXDMode::normal);
129 // set PXD gated
130 myHitPattern.setPXDLayer(1, 0, HitPatternVXD::PXDMode::gated);
131 myHitPattern.setPXDLayer(2, 2, HitPatternVXD::PXDMode::gated);
132
133 EXPECT_EQ(nSVD, myHitPattern.getNSVDLayers());
134 EXPECT_EQ(nPXDnormal, myHitPattern.getNPXDLayers(HitPatternVXD::PXDMode::normal));
135 EXPECT_EQ(nPXDgated, myHitPattern.getNPXDLayers(HitPatternVXD::PXDMode::gated));
136 EXPECT_EQ(nSVD + nPXDnormal, myHitPattern.getNVXDLayers(HitPatternVXD::PXDMode::normal));
137 EXPECT_EQ(nSVD + nPXDgated, myHitPattern.getNVXDLayers(HitPatternVXD::PXDMode::gated));
138
139 }

◆ TEST_F() [14/25]

TEST_F ( HitPatternVXDTest  ,
NGetters   
)

Test total number of hit getters.

Definition at line 101 of file hitPatternVXD.cc.

102 {
103 HitPatternVXD myHitPattern(16777215);
104 const unsigned short svdHits = 24;
105 const unsigned short pxdHits = 12;
106 const unsigned short ndf = 2 * pxdHits + svdHits;
107 EXPECT_EQ(svdHits, myHitPattern.getNSVDHits());
108 EXPECT_EQ(pxdHits, myHitPattern.getNPXDHits());
109 EXPECT_EQ(ndf, myHitPattern.getNdf());
110
111 }

◆ TEST_F() [15/25]

TEST_F ( HitPatternVXDTest  ,
NumberingScheme   
)

Test the numbering scheme in the static variables.

Definition at line 25 of file hitPatternVXD.cc.

26 {
27 const std::list<unsigned short> pxdNumbering = {1, 2};
28 const std::list<unsigned short> svdNumbering = {3, 4, 5, 6};
29 EXPECT_EQ(pxdNumbering, HitPatternVXD::s_PXDLayerNumbers);
30 EXPECT_EQ(svdNumbering, HitPatternVXD::s_SVDLayerNumbers);
31 }

◆ TEST_F() [16/25]

TEST_F ( HitPatternVXDTest  ,
PXDSetterAndGetter   
)

Test simple Setters and Getters for the PXD.

Definition at line 68 of file hitPatternVXD.cc.

69 {
70 HitPatternVXD myHitPattern(0);
71
72 for (const auto layerId : HitPatternVXD::s_PXDLayerNumbers) {
73 for (unsigned int nHits = 0; nHits <= 3; ++nHits) {
74 myHitPattern.setPXDLayer(layerId, nHits, HitPatternVXD::PXDMode::normal);
75 EXPECT_EQ(nHits, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::normal));
76 myHitPattern.resetPXDLayer(layerId, HitPatternVXD::PXDMode::normal);
77 EXPECT_EQ(0, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::normal));
78
79 myHitPattern.setPXDLayer(layerId, nHits, HitPatternVXD::PXDMode::gated);
80 EXPECT_EQ(nHits, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::gated));
81 myHitPattern.resetPXDLayer(layerId, HitPatternVXD::PXDMode::gated);
82 EXPECT_EQ(0, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::gated));
83 }
84 }
85
86 for (const auto layerId : HitPatternVXD::s_PXDLayerNumbers) {
87 unsigned int nHits = 4;
88 myHitPattern.setPXDLayer(layerId, nHits, HitPatternVXD::PXDMode::normal);
89 EXPECT_EQ(3, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::normal));
90 myHitPattern.resetPXDLayer(layerId, HitPatternVXD::PXDMode::normal);
91 EXPECT_EQ(0, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::normal));
92
93 myHitPattern.setPXDLayer(layerId, nHits, HitPatternVXD::PXDMode::gated);
94 EXPECT_EQ(3, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::gated));
95 myHitPattern.resetPXDLayer(layerId, HitPatternVXD::PXDMode::gated);
96 EXPECT_EQ(0, myHitPattern.getPXDLayer(layerId, HitPatternVXD::PXDMode::gated));
97 }
98 }

◆ TEST_F() [17/25]

TEST_F ( HitPatternVXDTest  ,
SVDSetterAndGetter   
)

Test simple Setters and Getters for SVD.

Definition at line 46 of file hitPatternVXD.cc.

47 {
48 HitPatternVXD myHitPattern(0);
49
50 for (const auto layerId : HitPatternVXD::s_SVDLayerNumbers) {
51 unsigned short uHits = 2;
52 unsigned short vHits = 1;
53 myHitPattern.setSVDLayer(layerId, uHits, vHits);
54 EXPECT_EQ(uHits, myHitPattern.getSVDLayer(layerId).first);
55 EXPECT_EQ(vHits, myHitPattern.getSVDLayer(layerId).second);
56 myHitPattern.resetSVDLayer(layerId);
57 EXPECT_EQ(0, myHitPattern.getSVDLayer(layerId).first);
58 EXPECT_EQ(0, myHitPattern.getSVDLayer(layerId).second);
59 uHits = 4;
60 vHits = 4;
61 myHitPattern.setSVDLayer(layerId, uHits, vHits);
62 EXPECT_EQ(3, myHitPattern.getSVDLayer(layerId).first);
63 EXPECT_EQ(3, myHitPattern.getSVDLayer(layerId).second);
64 }
65 }

◆ TEST_F() [18/25]

TEST_F ( KlIdTest  ,
SettersAndGetters   
)

Test setter and getter.

Definition at line 30 of file KlIdTest.cc.

31 {
32
33 DataStore::Instance().setInitializeActive(true);
34 StoreArray<ECLCluster> eclClusters;
35 eclClusters.registerInDataStore();
36 StoreArray<KLMCluster> klmClusters;
37 klmClusters.registerInDataStore();
38 StoreArray<KlId> klids;
39 klids.registerInDataStore();
40 klmClusters.registerRelationTo(klids);
41 eclClusters.registerRelationTo(klids);
42
43
44 const KlId* klid = klids.appendNew();
45 const KLMCluster* klmCluster = klmClusters.appendNew();
46 const ECLCluster* eclCluster = eclClusters.appendNew();
47
48 EXPECT_FALSE(klid->isECL());
49 EXPECT_FALSE(klid->isKLM());
50 EXPECT_TRUE(std::isnan(klid->getKlId()));
51
52 klmCluster->addRelationTo(klid, 0.5);
53 eclCluster->addRelationTo(klid, 0.5);
54
55 EXPECT_TRUE(klid->isECL());
56 EXPECT_TRUE(klid->isKLM());
57 EXPECT_EQ(0.5, klid->getKlId());
58
59 }

◆ TEST_F() [19/25]

TEST_F ( TrackFitResultTest  ,
Charge   
)

Test get charge.

Definition at line 151 of file trackFitResult.cc.

152 {
153 auto bField = 1.5;
154 auto pValue = 0.45;
155 ROOT::Math::XYZVector position(0., 0., 0.);
156 ROOT::Math::XYZVector momentum(1., 1., 1.);
157 TMatrixDSym cov6(6);
158 auto pType = Belle2::Const::electron;
159
160 auto charge = -1.0;
161 Belle2::TrackFitResult myResultMinus(position, momentum, cov6, charge, pType, pValue, bField, 0, 0, 0);
162 EXPECT_EQ(myResultMinus.getChargeSign(), charge);
163
164 charge = 0;
165 Belle2::TrackFitResult myResultNull(position, momentum, cov6, charge, pType, pValue, bField, 0, 0, 0);
166 EXPECT_EQ(myResultNull.getChargeSign(), charge);
167
168 charge = +1.0;
169 Belle2::TrackFitResult myResultPlus(position, momentum, cov6, charge, pType, pValue, bField, 0, 0, 0);
170 EXPECT_EQ(myResultPlus.getChargeSign(), charge);
171 }
static const ChargedStable electron
electron particle
Definition: Const.h:659
Values of the result of a track fit with a given particle hypothesis.

◆ TEST_F() [20/25]

TEST_F ( TrackFitResultTest  ,
ErrorPropagation   
)

Test if the error propagation of the covariance matrix works properly.

Definition at line 82 of file trackFitResult.cc.

83 {
84 TRandom3 generator;
85 unsigned int nCases = 1;
86 double absError = 1e-6;
87
88 for (unsigned int iCase = 0; iCase < nCases; ++iCase) {
89
90 auto bField = 1.5;
91 auto pType = Belle2::Const::electron;
92 auto pValue = 0.45;
93 std::vector<float> tau;
94 for (int i = 0; i < 5; ++i) {
95 // does not matter what is appended here, we only test the cov matrix
96 tau.push_back(1);
97 }
98 std::vector<float> cov(15);
99 for (auto& element : cov) {
100 element = generator.Gaus(1e-4);
101 }
102 Belle2::TrackFitResult myResult(tau, cov, pType, pValue, 0, 0, 0);
103 TMatrixDSym covariance(myResult.getCovariance6());
104
105 for (int i = 0; i < 5; ++i)
106 for (int j = i; j < 5; ++j)
107 EXPECT_EQ(covariance(i, j), covariance(j, i));
108
109 TMatrixDSym cov6(6);
110 for (unsigned int row = 0; row < 6; ++row) {
111 for (unsigned int col = 0; col < 6; ++col) {
112 cov6(row, col) = covariance(row, col);
113 }
114 }
115 Belle2::TrackFitResult myResult2(myResult.getPosition(), myResult.getMomentum(), cov6,
116 myResult.getChargeSign(), pType, pValue, bField, 0, 0, 0);
117
118 TMatrixDSym myResultCov5 = myResult.getCovariance5();
119 TMatrixDSym myResult2Cov5 = myResult2.getCovariance5();
120
121 EXPECT_NEAR(myResultCov5(0, 0), myResult2Cov5(0, 0), absError);
122 EXPECT_NEAR(myResultCov5(0, 1), myResult2Cov5(0, 1), absError);
123 EXPECT_NEAR(myResultCov5(0, 2), myResult2Cov5(0, 2), absError);
124 EXPECT_NEAR(myResultCov5(0, 3), myResult2Cov5(0, 3), absError);
125 EXPECT_NEAR(myResultCov5(0, 4), myResult2Cov5(0, 4), absError);
126 EXPECT_NEAR(myResultCov5(1, 0), myResult2Cov5(1, 0), absError);
127 EXPECT_NEAR(myResultCov5(1, 1), myResult2Cov5(1, 1), absError);
128 EXPECT_NEAR(myResultCov5(1, 2), myResult2Cov5(1, 2), absError);
129 EXPECT_NEAR(myResultCov5(1, 3), myResult2Cov5(1, 3), absError);
130 EXPECT_NEAR(myResultCov5(1, 4), myResult2Cov5(1, 4), absError);
131 EXPECT_NEAR(myResultCov5(2, 0), myResult2Cov5(2, 0), absError);
132 EXPECT_NEAR(myResultCov5(2, 1), myResult2Cov5(2, 1), absError);
133 EXPECT_NEAR(myResultCov5(2, 2), myResult2Cov5(2, 2), absError);
134 EXPECT_NEAR(myResultCov5(2, 3), myResult2Cov5(2, 3), absError);
135 EXPECT_NEAR(myResultCov5(2, 4), myResult2Cov5(2, 4), absError);
136 EXPECT_NEAR(myResultCov5(3, 0), myResult2Cov5(3, 0), absError);
137 EXPECT_NEAR(myResultCov5(3, 1), myResult2Cov5(3, 1), absError);
138 EXPECT_NEAR(myResultCov5(3, 2), myResult2Cov5(3, 2), absError);
139 EXPECT_NEAR(myResultCov5(3, 3), myResult2Cov5(3, 3), absError);
140 EXPECT_NEAR(myResultCov5(3, 4), myResult2Cov5(3, 4), absError);
141 EXPECT_NEAR(myResultCov5(4, 0), myResult2Cov5(4, 0), absError);
142 EXPECT_NEAR(myResultCov5(4, 1), myResult2Cov5(4, 1), absError);
143 EXPECT_NEAR(myResultCov5(4, 2), myResult2Cov5(4, 2), absError);
144 EXPECT_NEAR(myResultCov5(4, 3), myResult2Cov5(4, 3), absError);
145 EXPECT_NEAR(myResultCov5(4, 4), myResult2Cov5(4, 4), absError);
146
147 }
148 } // Testcases error propagation

◆ TEST_F() [21/25]

TEST_F ( TrackFitResultTest  ,
Getters   
)

Test simple Setters and Getters.

Definition at line 36 of file trackFitResult.cc.

37 {
38 TRandom3 generator;
39 unsigned int nCases = 1;
40 double absError = 1e-6;
41 double bField = 1.5;
42
43 for (unsigned int i = 0; i < nCases; ++i) {
44
45 short int charge = generator.Uniform(-1, 1) > 0 ? 1 : -1;
46 Const::ParticleType pType = Const::electron;
47 float pValue = 0.45;
48
49 // Generate a random put orthogonal pair of vectors in the r-phi plane
50 TVector2 d(generator.Uniform(-1, 1), generator.Uniform(-1, 1));
51 TVector2 pt(generator.Uniform(-1, 1), generator.Uniform(-1, 1));
52 d.Set(d.X(), -(d.X()*pt.Px()) / pt.Py());
53 // Add a random z component
54 ROOT::Math::XYZVector position(d.X(), d.Y(), generator.Uniform(-1, 1));
55 ROOT::Math::XYZVector momentum(pt.Px(), pt.Py(), generator.Uniform(-1, 1));
56
57 TMatrixDSym cov6(6);
58
59 // Set up class for testing
60 TrackFitResult myResult(position, momentum, cov6, charge, pType, pValue, bField, 0, 0, 0);
61
62 // Test all vector elements
63 EXPECT_NEAR(position.X(), myResult.getPosition().X(), absError);
64 EXPECT_NEAR(position.Y(), myResult.getPosition().Y(), absError);
65 EXPECT_NEAR(position.Z(), myResult.getPosition().Z(), absError);
66 EXPECT_NEAR(momentum.X(), myResult.getMomentum().X(), absError);
67 EXPECT_NEAR(momentum.Y(), myResult.getMomentum().Y(), absError);
68 EXPECT_NEAR(momentum.Z(), myResult.getMomentum().Z(), absError);
69
70 // Test getter for transverse momentum
71 EXPECT_NEAR(momentum.Rho(), myResult.getTransverseMomentum(), absError);
72
73 // Test other variables
74 EXPECT_EQ(charge, myResult.getChargeSign());
75 EXPECT_EQ(pValue, myResult.getPValue());
76 EXPECT_EQ(pType, myResult.getParticleType());
77
78 }
79 } // Testcases for getters

◆ TEST_F() [22/25]

TEST_F ( TrackTest  ,
getTrackFitResultWithClosestMass   
)

Test simple Setters and Getters.

Definition at line 119 of file track.cc.

120 {
121 //Create some TrackFitResults in the the DataStore.
122 //PDGCode of the TrackFitResult will be used in the test to identify the TFR.
123 DataStore::Instance().setInitializeActive(true);
124 StoreArray<TrackFitResult> myResults;
125 myResults.registerInDataStore();
126
127 // add two fit results
128 const auto myKaon = addDummyTrack(myResults, Const::kaon);
129 const auto myElectron = addDummyTrack(myResults, Const::electron);
130
131 Track mytrack1;
132 mytrack1.setTrackFitResultIndex(Const::electron, myElectron->getArrayIndex());
133 mytrack1.setTrackFitResultIndex(Const::kaon, myKaon->getArrayIndex());
134
135 EXPECT_EQ(mytrack1.getNumberOfFittedHypotheses(), 2);
136
137 // check for correct hypothesis if we request a fitted particle
138 const auto fitCloseToKaonMass = mytrack1.getTrackFitResultWithClosestMass(Const::kaon);
139 EXPECT_EQ(Const::kaon.getPDGCode(), fitCloseToKaonMass->getParticleType().getPDGCode());
140 EXPECT_EQ(mytrack1.getTrackFitResult(Const::kaon)->getArrayIndex(), fitCloseToKaonMass->getArrayIndex());
141
142 // check to get Pion fit
143 const auto wantPionButHaveElectronFit = mytrack1.getTrackFitResultWithClosestMass(Const::pion);
144 EXPECT_EQ(Const::electron.getPDGCode(), wantPionButHaveElectronFit->getParticleType().getPDGCode());
145 EXPECT_EQ(mytrack1.getTrackFitResult(Const::electron)->getArrayIndex(), wantPionButHaveElectronFit->getArrayIndex());
146
147 // check to get Electron fit
148 const auto wantMuonButHaveElectronFit = mytrack1.getTrackFitResultWithClosestMass(Const::muon);
149 EXPECT_EQ(Const::electron.getPDGCode(), wantMuonButHaveElectronFit->getParticleType().getPDGCode());
150 EXPECT_EQ(mytrack1.getTrackFitResult(Const::electron)->getArrayIndex(), wantMuonButHaveElectronFit->getArrayIndex());
151
152 // check to get Proton fit
153 const auto wantProtonButHaveKaonFit = mytrack1.getTrackFitResultWithClosestMass(Const::proton);
154 EXPECT_EQ(Const::kaon.getPDGCode(), wantProtonButHaveKaonFit->getParticleType().getPDGCode());
155 EXPECT_EQ(mytrack1.getTrackFitResult(Const::kaon)->getArrayIndex(), wantProtonButHaveKaonFit->getArrayIndex());
156
157 }

◆ TEST_F() [23/25]

TEST_F ( TrackTest  ,
settersNGetters   
)

Test simple Setters and Getters.

Definition at line 50 of file track.cc.

51 {
52 //Create some TrackFitResults in the the DataStore.
53 //PDGCode of the TrackFitResult will be used in the test to identify the TFR.
54 DataStore::Instance().setInitializeActive(true);
55 StoreArray<TrackFitResult> myResults;
56 myResults.registerInDataStore();
57
58 const auto myPion = addDummyTrack(myResults, Const::pion);
59 const auto myKaon = addDummyTrack(myResults, Const::kaon);
60 const auto myElectron = addDummyTrack(myResults, Const::electron);
61 const auto myMuon = addDummyTrack(myResults, Const::muon);
62
63 EXPECT_EQ(myPion->getArrayIndex(), 0);
64 EXPECT_EQ(myKaon->getArrayIndex(), 1);
65 EXPECT_EQ(myElectron->getArrayIndex(), 2);
66 EXPECT_EQ(myMuon->getArrayIndex(), 3);
67
68 Track mytrack1;
69 mytrack1.setTrackFitResultIndex(Const::pion, myPion->getArrayIndex());
70 mytrack1.setTrackFitResultIndex(Const::muon, myMuon->getArrayIndex());
71 mytrack1.setTrackFitResultIndex(Const::kaon, myKaon->getArrayIndex());
72
73 EXPECT_EQ(mytrack1.getNumberOfFittedHypotheses(), 3);
74 // If the index of the corresponding particle is set, the correct particle should be returned.
75 EXPECT_EQ(mytrack1.getTrackFitResult(Const::pion)->getParticleType(), Const::pion);
76 EXPECT_EQ(mytrack1.getTrackFitResult(Const::kaon)->getParticleType(), Const::kaon);
77 EXPECT_EQ(mytrack1.getTrackFitResult(Const::muon)->getParticleType(), Const::muon);
78 // If the index of the corresponding particle is *not* set, a nullptr should be returned.
79 EXPECT_EQ(mytrack1.getTrackFitResult(Const::electron), nullptr);
80
81 // If the index of the corresponding particle is set, the correct particle should be returned.
82 EXPECT_EQ(mytrack1.getTrackFitResult(Const::pion)->getArrayIndex(), myPion->getArrayIndex());
83 EXPECT_EQ(mytrack1.getTrackFitResult(Const::kaon)->getArrayIndex(), myKaon->getArrayIndex());
84 EXPECT_EQ(mytrack1.getTrackFitResult(Const::muon)->getArrayIndex(), myMuon->getArrayIndex());
85 // If the index of the corresponding particle is *not* set, a nullptr should be returned.
86 EXPECT_EQ(mytrack1.getTrackFitResult(Const::electron), nullptr);
87
88 const auto allResults = mytrack1.getTrackFitResults();
89 // should return all hypothesis which were added before
90 EXPECT_EQ(allResults.size(), 3);
91
92 // check that all correct hypothesis are returned and the electron is not
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());});
105
106 EXPECT_EQ(countPion, 1);
107 EXPECT_EQ(countMuon, 1);
108 EXPECT_EQ(countElectron, 0);
109 EXPECT_EQ(countKaon, 1);
110
111 Track trackQITest;
112 EXPECT_EQ(trackQITest.getQualityIndicator(), 0.);
113 Track trackQITest1(0.5);
114 EXPECT_EQ(trackQITest1.getQualityIndicator(), 0.5);
115 }

◆ TEST_F() [24/25]

TEST_F ( V0Test  ,
IndexGetters   
)

Test Index Getter.

Definition at line 52 of file v0.cc.

53 {
54 V0 myV0;
55 EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackIndices()));
56 EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackIndices()));
57 EXPECT_EQ(m_default_index, std::get<0>(myV0.getTrackFitResultIndices()));
58 EXPECT_EQ(m_default_index, std::get<1>(myV0.getTrackFitResultIndices()));
59
60 } // Testcases for Index Getter

◆ TEST_F() [25/25]

TEST_F ( V0Test  ,
PointerGetters   
)

Test Pointer Getter.

Definition at line 63 of file v0.cc.

64 {
65 V0 myV0;
66 EXPECT_ANY_THROW(std::get<0>(myV0.getTracks()));
67 EXPECT_ANY_THROW(std::get<1>(myV0.getTracks()));
68 EXPECT_ANY_THROW(std::get<0>(myV0.getTrackFitResults()));
69 EXPECT_ANY_THROW(std::get<1>(myV0.getTrackFitResults()));
70 } // Testcases for Pointer Getter