9#include <framework/gearbox/Const.h>
12#include <gtest/gtest.h>
15#include <tracking/spacePointCreation/SpacePointTrackCand.h>
39 r1.SetAngles(45, 20, 30);
40 TGeoTranslation t1(-10, 10, 1);
41 TGeoCombiTrans c1(t1, r1);
42 TGeoHMatrix transform = c1;
45 return sensorInfoBase;
58 PXDCluster aCluster =
PXDCluster(aVxdID, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
65 std::vector<const SVDCluster*> a2HitCluster = { &aUCluster, &aVCluster };
68 SVDCluster anotherUCluster =
SVDCluster(anotherVxdID,
true, 0.23, 0.1, 0.01, 0.001, 1, 1, 1, 1.0);
69 std::vector<const SVDCluster*> a1HitCluster = { &anotherUCluster };
72 const std::vector<const Belle2::SpacePoint*> aSpacePointVec = { &aPXDSpacePoint, &aSVDSpacePoint, &anotherSVDSpacePoint };
80 EXPECT_EQ(aSpacePointTC.
getNHits(), aSpacePointVec.size());
87 const std::vector<const SpacePoint*> returnSPVector = aSpacePointTC.
getHits();
88 for (
unsigned int i = 0; i < aSpacePointTC.
getNHits(); i++) {
89 EXPECT_TRUE(returnSPVector[i] == aSpacePointVec[i]);
103 PXDCluster aCluster =
PXDCluster(aVxdID, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
110 std::vector<const SVDCluster*> a2HitCluster = { &aUCluster, &aVCluster };
113 SVDCluster anotherUCluster =
SVDCluster(anotherVxdID,
true, 0.23, 0.1, 0.01, 0.001, 1, 1, 1, 1.0);
114 std::vector<const SVDCluster*> a1HitCluster = { &anotherUCluster };
117 const std::vector<const Belle2::SpacePoint*> aSpacePointVec = { &aPXDSpacePoint, &aSVDSpacePoint };
118 const std::vector<const Belle2::SpacePoint*> sameSpacePointVec = { &aPXDSpacePoint, &aSVDSpacePoint };
119 const std::vector<const Belle2::SpacePoint*> anotherSpacePointVec = { &aPXDSpacePoint, &anotherSVDSpacePoint };
126 EXPECT_TRUE(aSpacePointTC == anotherSpacePointTC);
130 EXPECT_TRUE(aSpacePointTC == anotherSpacePointTC);
133 anotherSpacePointTC.
addSpacePoint(&anotherSVDSpacePoint, 1.0);
135 EXPECT_FALSE(aSpacePointTC == anotherSpacePointTC);
140 EXPECT_FALSE(aSpacePointTC == changedSVDSpacePointTC);
141 EXPECT_FALSE(changedSVDSpacePointTC == anotherSpacePointTC);
148 EXPECT_TRUE(newSpacePointTC == aSpacePointTC);
152 EXPECT_TRUE(newSpacePointTC == anotherSpacePointTC);
185 PXDCluster aCluster =
PXDCluster(aVxdID1, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
193 std::vector<const SVDCluster*> UVClusterVec1 = { &aUCluster, &aVCluster };
194 std::vector<const SVDCluster*> VClusterVec = { &aVCluster };
195 std::vector<const SVDCluster*> UClusterVec = { &aUCluster };
207 std::vector<const SVDCluster*> UVClusterVec2 = { &aUCluster2, &aVCluster2 };
208 std::vector<const SVDCluster*> VClusterVec2 = { &aVCluster2 };
209 std::vector<const SVDCluster*> UClusterVec2 = { &aUCluster2 };
230 EXPECT_TRUE(subTrackCand1 == shortTC1);
231 std::vector<double> sortParams1 = { 1.23, 2.34, 3.45 };
233 EXPECT_EQ(sortParams1.size(), sortParamsTC1.size());
234 for (
unsigned int i = 0; i < sortParamsTC1.size(); ++i) { EXPECT_DOUBLE_EQ(sortParams1.at(i), sortParamsTC1.at(i)); }
237 EXPECT_TRUE(subTrackCand2 == shortTC2);
238 std::vector<double> sortParams2 = { 3.45, 4.56, 5.67, 6.78 };
240 EXPECT_EQ(sortParams2.size(), sortParamsTC2.size());
241 for (
unsigned int i = 0; i < sortParamsTC2.size(); ++i) { EXPECT_DOUBLE_EQ(sortParams2.at(i), sortParamsTC2.at(i)); }
244 unsigned int nHits = fullTrackCand.
getNHits();
246 SpacePointTrackCand::SPTCIndexOutOfBounds);
249 SpacePointTrackCand::SPTCIndexOutOfBounds);
250 ASSERT_THROW(fullTrackCand.
getHitsInRange(0, 10), SpacePointTrackCand::SPTCIndexOutOfBounds);
252 SpacePointTrackCand::SPTCIndexOutOfBounds);
253 ASSERT_THROW(fullTrackCand.
getHitsInRange(2, -1), SpacePointTrackCand::SPTCIndexOutOfBounds);
255 SpacePointTrackCand::SPTCIndexOutOfBounds);
257 SpacePointTrackCand::SPTCIndexOutOfBounds);
259 SpacePointTrackCand::SPTCIndexOutOfBounds);
261 SpacePointTrackCand::SPTCIndexOutOfBounds);
280 unsigned short int newStatus = 0;
339 int maxUsedStatus = pow(2, n);
344 int maxPossibleStatus = pow(2, maxN);
348 int impossibleStatus = maxPossibleStatus * 2;
375 PXDCluster aCluster =
PXDCluster(aVxdID1, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
383 std::vector<const SVDCluster*> UVClusterVec1 = { &aUCluster, &aVCluster };
384 std::vector<const SVDCluster*> VClusterVec = { &aVCluster };
385 std::vector<const SVDCluster*> UClusterVec = { &aUCluster };
401 EXPECT_TRUE(expectedTC == fullTrackCand);
403 std::vector<double> expectedSortParams = { 1.23, 3.45, 4.56 };
405 EXPECT_EQ(expectedSortParams.size(), sortParams.size());
406 for (
unsigned int i = 0; i < sortParams.size(); ++i) { EXPECT_DOUBLE_EQ(sortParams.at(i), expectedSortParams.at(i)); }
420 PXDCluster aCluster =
PXDCluster(aVxdID1, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
427 std::vector<const SVDCluster*> UVClusterVec1 = { &aUCluster, &aVCluster };
428 std::vector<const SVDCluster*> VClusterVec = { &aVCluster };
429 std::vector<const SVDCluster*> UClusterVec = { &aUCluster };
438 std::vector<const SVDCluster*> UVClusterVec2 = { &aUCluster2, &aVCluster2 };
439 std::vector<const SVDCluster*> VClusterVec2 = { &aVCluster2 };
440 std::vector<const SVDCluster*> UClusterVec2 = { &aUCluster2 };
471 EXPECT_TRUE(sorted == sortedConstructed);
474 EXPECT_TRUE(nothingChanged == sortedConstructed);
477 std::vector<double> sortParams1 = { 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 6.0};
482 EXPECT_TRUE(unsorted == unsortedConstructed);
int getPDGCode() const
PDG code.
static const ChargedStable electron
electron particle
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Test class for the SpacePointTrackCand class.
VXD::SensorInfoBase createSensorInfo(VxdID aVxdID, double width=1., double length=1., double width2=-1.)
this is a small helper function to create a sensorInfo to be used
Storage for (VXD) SpacePoint-based track candidates.
const std::vector< double > & getSortingParameters() const
get the sorting parameters
void setSortingParameters(const std::vector< double > &sortParams)
set the sorting parameters
unsigned int getNHits() const
get the number of hits (space points) in the track candidate
int getPdgCode() const
get pdg code
const std::vector< const Belle2::SpacePoint * > & getHits() const
get hits (space points) of track candidate
void removeSpacePoint(int indexInTrackCand)
remove a SpacePoint (and its sorting parameter) from the SpacePointTrackCand
unsigned short int getRefereeStatus(unsigned short int bitmask=USHRT_MAX) const
Return the referee status code of the SpacePointTrackCand.
bool checkedSameSensors() const
Check if the SpacePointTrackCand has been checked for consecutive hits on same sensor.
int getMcTrackID() const
get the MC Track ID
void clearRefereeStatus()
clear the referee status.
void removeRefereeStatus(unsigned short int bitmask)
remove a referee status
@ c_curlingTrack
bit 8: SPTC is curling (resp.
@ c_checkedTrueHits
bit 5: All SpacePoints of the SPTC have a relation to at least one TrueHit.
@ c_hitsLowDistance
bit 3: SPTC has two (or more) SpacePoints that are not far enough apart.
@ c_checkedClean
bit 1: SPTC shows no 'problematic' behaviour.
@ c_initialState
This is the initialState, which will always be set in the beginning and at reset.
@ c_isActive
bit 11: SPTC is active (i.e.
@ c_checkedSameSensors
bit 6: It has been checked, if two consecutive SpacePoints are on the same sensor for this SPTC.
@ c_checkedByReferee
bit 0: SPTC has been checked by a Referee (all possible tests).
@ c_hitsOnSameSensor
bit 2: SPTC has two (or more) SpacePoints on same sensor.
bool isCurling() const
get if the TrackCand is curling.
bool hasHitsOnSameSensor() const
Check if the SpacePointTrackCand contains consecutive SpacePoints that are on the same sensor WARNING...
void addSpacePoint(const SpacePoint *newSP, double sortParam)
add a new SpacePoint and its according sorting parameter to the track candidate
void setRefereeStatus(unsigned short int bitmask)
set referee status (resets the complete to the passed status!)
void resetRefereeStatus()
resets the referee status to the initial value
const std::vector< const Belle2::SpacePoint * > getHitsInRange(int firstInd, int lastInd) const
get hits (SpacePoints) in range (indices of SpacePoint inside SpacePointTrackCand) including first in...
bool hasRefereeStatus(unsigned int short bitmask) const
Check if the SpacePointTrackCand has the status characterized by the bitmask.
const std::vector< double > getSortingParametersInRange(int firstIndex, int lastIndex) const
get the sorting parameters in range (indices of SpacePoints inside SpacePointTrackCand) including fir...
double getChargeSeed() const
get charge
void addRefereeStatus(unsigned short int bitmask)
add a referee status
void setPdgCode(int pdgCode)
set a hypothesis for the particle by setting a pdgcode (will also set the appropriate charge)
const std::vector< const Belle2::SpacePoint * > getSortedHits() const
get hits (space points) sorted by their respective sorting parameter
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Base class to provide Sensor Information for PXD and SVD.
void setTransformation(const TGeoHMatrix &transform, bool reco=false)
Set the transformation matrix of the Sensor.
Class to uniquely identify a any structure of the PXD and SVD.
Abstract base class for different kinds of events.