10#include <klm/dataobjects/KLMMuidLikelihood.h>
13#include <framework/datastore/StoreArray.h>
14#include <framework/gearbox/Const.h>
21#include <gtest/gtest.h>
60 m_muid->setPDGCode(pdg);
61 EXPECT_EQ(m_muid->getPDGCode(), pdg);
62 EXPECT_EQ(m_muid->getOutcome(), 0);
63 EXPECT_EQ(m_muid->getHitLayer(), -1);
64 EXPECT_FLOAT_EQ(m_muid->getLogL_mu(), -1.0E20);
68 float efficiency = 0.2;
69 m_muid->setExtBKLMEfficiencyValue(layer, efficiency);
70 EXPECT_FLOAT_EQ(m_muid->getExtBKLMEfficiencyValue(layer), efficiency);
71 m_muid->setExtEKLMEfficiencyValue(layer, efficiency);
72 EXPECT_FLOAT_EQ(m_muid->getExtEKLMEfficiencyValue(layer), efficiency);
77 std::bitset<30> bitPattern(std::string(
"111111"));
78 unsigned int pattern =
static_cast<unsigned int>(bitPattern.to_ulong());
79 m_muid->setHitLayerPattern(pattern);
80 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
81 EXPECT_EQ(m_muid->getTotalBarrelHits(), 6);
82 EXPECT_EQ(m_muid->getTotalEndcapHits(), 0);
83 m_muid->setExtLayerPattern(pattern);
84 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(5));
85 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(6));
86 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
89 bitPattern = std::bitset<30>(std::string(
"1000000000000000"));
90 pattern =
static_cast<unsigned int>(bitPattern.to_ulong());
91 m_muid->setHitLayerPattern(pattern);
92 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
93 EXPECT_EQ(m_muid->getTotalBarrelHits(), 0);
94 EXPECT_EQ(m_muid->getTotalEndcapHits(), 1);
95 m_muid->setExtLayerPattern(pattern);
96 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(0));
97 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
98 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(1));
101 bitPattern = std::bitset<30>(std::string(
"10101000000000111000"));
102 pattern =
static_cast<unsigned int>(bitPattern.to_ulong());
103 m_muid->setHitLayerPattern(pattern);
104 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
105 EXPECT_EQ(m_muid->getTotalBarrelHits(), 3);
106 EXPECT_EQ(m_muid->getTotalEndcapHits(), 3);
107 m_muid->setExtLayerPattern(pattern);
108 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(4));
109 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(0));
110 EXPECT_FALSE(m_muid->isExtrapolatedEndcapLayerCrossed(10));
113 bitPattern = std::bitset<30>(std::string(
"11111111111111111111111111111"));
114 pattern =
static_cast<unsigned int>(bitPattern.to_ulong());
115 m_muid->setHitLayerPattern(pattern);
116 EXPECT_EQ(m_muid->getHitLayerPattern(), pattern);
117 EXPECT_EQ(m_muid->getTotalBarrelHits(), 15);
118 EXPECT_EQ(m_muid->getTotalEndcapHits(), 14);
119 m_muid->setExtLayerPattern(pattern);
120 EXPECT_TRUE(m_muid->isExtrapolatedBarrelLayerCrossed(14));
121 EXPECT_FALSE(m_muid->isExtrapolatedBarrelLayerCrossed(15));
122 EXPECT_TRUE(m_muid->isExtrapolatedEndcapLayerCrossed(13));
int getPDGCode() const
PDG code.
static const ChargedStable muon
muon particle
static DataStore & Instance()
Instance of singleton Store.
void setInitializeActive(bool active)
Setter for m_initializeActive.
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Test class for the KLMMuidLikelihood object.
KLMMuidLikelihood * m_muid
Pointer to a Muid object.
void SetUp() override
Register KLMMuidLikelihood in the DataStore.
void TearDown() override
Clear the DataStore.
Class to store the likelihoods from KLM with additional information related to the extrapolation.
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.
Abstract base class for different kinds of events.