8#include <gtest/gtest.h>
10#include <TMatrixFSym.h>
14#include <analysis/VariableManager/Manager.h>
15#include <analysis/VariableManager/Utility.h>
17#include <analysis/dataobjects/Particle.h>
18#include <analysis/dataobjects/ParticleExtraInfoMap.h>
19#include <analysis/dataobjects/ParticleList.h>
20#include <framework/dataobjects/EventExtraInfo.h>
21#include <analysis/dataobjects/RestOfEvent.h>
22#include <analysis/utility/ReferenceFrame.h>
23#include <framework/datastore/StoreArray.h>
24#include <framework/datastore/StoreObjPtr.h>
25#include <framework/utilities/TestHelpers.h>
26#include <framework/logging/Logger.h>
27#include <framework/gearbox/Gearbox.h>
29#include <mdst/dataobjects/Track.h>
30#include <mdst/dataobjects/ECLCluster.h>
31#include <mdst/dataobjects/KLMCluster.h>
33#include <analysis/variables/Variables.h>
35#include "utilities/TestParticleFactory.h"
38using namespace Belle2::Variable;
43 class InclusiveVariablesTest :
public ::testing::Test {
69 ROOT::Math::XYZVector ipposition(0, 0, 0);
70 ROOT::Math::PxPyPzEVector b0momentum(3, 0, 0, 5);
71 factory.
produceParticle(
string(
"^B0 -> [^K*0 -> [^K_S0 -> ^pi+ ^pi-] [^pi0 -> ^gamma ^gamma]] ^e+ ^e-"),
72 b0momentum, ipposition);
76 void TearDown()
override
81 TEST_F(InclusiveVariablesTest, nCompositeDaughters)
85 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 1);
87 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 1);
89 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 0);
91 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 0);
93 TEST_F(InclusiveVariablesTest, nCompositeAllGenerationDaughters)
97 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 3);
99 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 1);
101 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 1);
103 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 1);
105 TEST_F(InclusiveVariablesTest, nPhotonDaughters)
109 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 2);
111 TEST_F(InclusiveVariablesTest, nDaughterNeutralHadrons)
115 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 0);
117 TEST_F(InclusiveVariablesTest, nChargedDaughters)
121 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 4);
123 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 2);
125 EXPECT_EQ(std::get<int>(var->function(myParticles[9])), 2);
128 TEST_F(InclusiveVariablesTest, daughterAverageOf)
132 EXPECT_FLOAT_EQ(std::get<double>(var->function(myParticles[9])),
float(313 + 11 - 11) / 3);
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.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
static Manager & Instance()
get singleton instance.
This is a class, which generates DataStore particles, according to the provided decay string e....
const Belle2::Particle * produceParticle(const std::string &decayString, const ROOT::Math::PxPyPzEVector &momentum, const ROOT::Math::XYZVector &vertex)
Main method to produce particles.
Abstract base class for different kinds of events.