Belle II Software light-2406-ragdoll
sk_variables.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <gtest/gtest.h>
9#include "utilities/TestParticleFactory.h"
10
11#include <analysis/dataobjects/Particle.h>
12#include <mdst/dataobjects/Track.h>
13#include <mdst/dataobjects/ECLCluster.h>
14#include <mdst/dataobjects/KLMCluster.h>
15#include <framework/gearbox/Gearbox.h>
16#include <framework/datastore/StoreArray.h>
17#include <analysis/utility/PCmsLabTransform.h>
18
19#include <analysis/variables/SpecificKinematicVariables.h>
20#include <analysis/variables/Variables.h>
21
22#include <analysis/VariableManager/Manager.h>
23
24using namespace std;
25using namespace Belle2;
26using namespace Belle2::Variable;
27using namespace ROOT::Math;
28
29namespace {
30 class SpecificKinematicVariablesTest : public ::testing::Test {
31 protected:
33 void SetUp() override
34 {
35
37 StoreArray<ECLCluster> myECLClusters;
38 StoreArray<KLMCluster> myKLMClusters;
40 StoreArray<Track> myTracks;
41 StoreArray<Particle> myParticles;
42 myECLClusters.registerInDataStore();
43 myKLMClusters.registerInDataStore();
44 myTFRs.registerInDataStore();
45 myTracks.registerInDataStore();
46 myParticles.registerInDataStore();
48
51 PxPyPzEVector b0momentum(.20, 0., 0., 4.85);
52 b0momentum = T.rotateCmsToLab() * b0momentum;
53 PxPyPzEVector pimomentum(0.1, 0, 2.5, sqrt(0.139 * 0.139 + 2.5 * 2.5));
54 PxPyPzEVector emomentum(0., 0, 1., 1.);
55 ROOT::Math::XYZVector ipposition(0, 0, 0);
56 factory.produceParticle(string("^B0 -> pi- e+"), b0momentum, ipposition);
57 myParticles[0]->set4Vector(pimomentum); //pion
58 myParticles[1]->set4Vector(emomentum); //electron
59 }
60
62 void TearDown() override
63 {
65 }
66 };
67
68 TEST_F(SpecificKinematicVariablesTest, REC_q2BhSimple)
69 {
70 StoreArray<Particle> myParticles;
71 B2INFO("Cos: " << cosThetaBetweenParticleAndNominalB(myParticles[2]));
72 EXPECT_FLOAT_EQ(7.90905, REC_q2BhSimple(myParticles[2])); // B-meson
73 }
74 TEST_F(SpecificKinematicVariablesTest, REC_q2Bh)
75 {
76 StoreArray<Particle> myParticles;
77 EXPECT_FLOAT_EQ(7.8716288, REC_q2Bh(myParticles[2])); // B-meson
78 }
79 TEST_F(SpecificKinematicVariablesTest, REC_MissM2)
80 {
81 StoreArray<Particle> myParticles;
82 EXPECT_FLOAT_EQ(0.1534055, REC_MissM2(myParticles[2])); // B-meson
83 }
84
85}
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86
Class to hold Lorentz transformations from/to CMS and boost vector.
const ROOT::Math::LorentzRotation rotateCmsToLab() const
Returns Lorentz transformation from CMS to Lab.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
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.
Definition: ClusterUtils.h:24
STL namespace.