8#include <mdst/dataobjects/HitPatternVXD.h>
9#include <gtest/gtest.h>
27 const std::list<unsigned short> pxdNumbering = {1, 2};
28 const std::list<unsigned short> svdNumbering = {3, 4, 5, 6};
36 unsigned int initValue = 16776960;
37 std::bitset<32> initValueAsBitset(
static_cast<std::string
>(
"00000000111111111111111100000000"));
40 EXPECT_EQ(initValueAsBitset, myHitPattern.
getBitset());
41 EXPECT_EQ(initValue, myHitPattern.
getInteger());
51 unsigned short uHits = 2;
52 unsigned short vHits = 1;
54 EXPECT_EQ(uHits, myHitPattern.
getSVDLayer(layerId).first);
55 EXPECT_EQ(vHits, myHitPattern.
getSVDLayer(layerId).second);
57 EXPECT_EQ(0, myHitPattern.
getSVDLayer(layerId).first);
58 EXPECT_EQ(0, myHitPattern.
getSVDLayer(layerId).second);
62 EXPECT_EQ(3, myHitPattern.
getSVDLayer(layerId).first);
63 EXPECT_EQ(3, myHitPattern.
getSVDLayer(layerId).second);
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));
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));
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));
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));
104 const unsigned short svdHits = 24;
105 const unsigned short pxdHits = 12;
106 const unsigned short ndf = 2 * pxdHits + svdHits;
109 EXPECT_EQ(ndf, myHitPattern.
getNdf());
117 const unsigned short nSVD = 3;
118 const unsigned short nPXDnormal = 2;
119 const unsigned short nPXDgated = 1;
127 myHitPattern.
setPXDLayer(1, 1, HitPatternVXD::PXDMode::normal);
128 myHitPattern.
setPXDLayer(2, 2, HitPatternVXD::PXDMode::normal);
130 myHitPattern.
setPXDLayer(1, 0, HitPatternVXD::PXDMode::gated);
131 myHitPattern.
setPXDLayer(2, 2, HitPatternVXD::PXDMode::gated);
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));
146 const unsigned short firstLayerPXD = 1;
147 const unsigned short lastLayerPXD = 2;
148 const unsigned short firstLayerSVD = 4;
149 const unsigned short lastLayerSVD = 6;
157 myHitPattern.
setPXDLayer(1, 1, HitPatternVXD::PXDMode::normal);
158 myHitPattern.
setPXDLayer(2, 2, HitPatternVXD::PXDMode::normal);
160 myHitPattern.
setPXDLayer(1, 1, HitPatternVXD::PXDMode::gated);
161 myHitPattern.
setPXDLayer(2, 2, HitPatternVXD::PXDMode::gated);
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));
Hit pattern of the VXD within a track.
short getLastSVDLayer() const
Get the last activated SVD layer index.
static const std::list< unsigned short > s_SVDLayerNumbers
For iterating through layers.
void resetSVDLayer(const unsigned short layerId)
Reset the number of hits in a specific layer of the SVD.
unsigned short getNSVDLayers() const
Returns the total number of activated layers of the SVD.
unsigned short getNPXDLayers(const PXDMode &mode=PXDMode::normal) const
Returns the total number of activated layers of the PXD.
unsigned int getInteger() const
Getter for the underlying integer.
short getFirstSVDLayer() const
Get the first activated SVD layer index.
void setSVDLayer(const unsigned short layerId, unsigned short uHits, unsigned short vHits)
Set the number of hits in a specific layer of the SVD.
unsigned short getNVXDLayers(const PXDMode &pxdmode=PXDMode::normal) const
Return the total number of activated layers in the VXD depending on the mode of the PXD.
void resetPXDLayer(const unsigned short layerId, const PXDMode &mode=PXDMode::normal)
Reset the number of hits in a specific layer of the PXD.
static const std::list< unsigned short > s_PXDLayerNumbers
For iterating through layers.
unsigned short getNPXDHits() const
Get total number of hits in the PXD.
unsigned short getNSVDHits() const
Get total number of hits in the SVD.
void setPXDLayer(const unsigned short layerId, unsigned short nHits, const PXDMode &mode=PXDMode::normal)
Set the number of hits in a specific layer of the PXD.
short getLastPXDLayer(const PXDMode &mode=PXDMode::normal) const
Returns the last activated layer of the PXD depending on the mode.
std::bitset< 32 > getBitset() const
Getter for underlying bitset.
unsigned short getPXDLayer(const unsigned short layerId, const PXDMode &mode=PXDMode::normal) const
Get the number of hits in a specific layer of the PXD.
short getFirstPXDLayer(const PXDMode &mode=PXDMode::normal) const
Returns the first activated layer of the PXD depending on the mode.
unsigned short getNdf() const
Get degrees of freedom in PXD and SVD.
std::pair< const unsigned short, const unsigned short > getSVDLayer(const unsigned short layerId) const
Get the number of hits in a specific layer of the SVD.
Abstract base class for different kinds of events.