Belle II Software development
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/datastore/StoreArray.h>
16#include <analysis/utility/PCmsLabTransform.h>
17
18#include <analysis/variables/SpecificKinematicVariables.h>
19#include <analysis/variables/Variables.h>
20
21using namespace std;
22using namespace Belle2;
23using namespace Belle2::Variable;
24using namespace ROOT::Math;
25
26namespace {
27 class SpecificKinematicVariablesTest : public ::testing::Test {
28 protected:
30 void SetUp() override
31 {
32
34 StoreArray<ECLCluster> myECLClusters;
35 StoreArray<KLMCluster> myKLMClusters;
37 StoreArray<Track> myTracks;
38 StoreArray<Particle> myParticles;
39 myECLClusters.registerInDataStore();
40 myKLMClusters.registerInDataStore();
41 myTFRs.registerInDataStore();
42 myTracks.registerInDataStore();
43 myParticles.registerInDataStore();
45
48 PxPyPzEVector b0momentum(.20, 0., 0., 4.85);
49 b0momentum = T.rotateCmsToLab() * b0momentum;
50 PxPyPzEVector pimomentum(0.1, 0, 2.5, sqrt(0.139 * 0.139 + 2.5 * 2.5));
51 PxPyPzEVector emomentum(0., 0, 1., 1.);
52 ROOT::Math::XYZVector ipposition(0, 0, 0);
53 factory.produceParticle(string("^B0 -> pi- e+"), b0momentum, ipposition);
54 myParticles[0]->set4Vector(pimomentum); //pion
55 myParticles[1]->set4Vector(emomentum); //electron
56 }
57
59 void TearDown() override
60 {
62 }
63 };
64
65 TEST_F(SpecificKinematicVariablesTest, REC_q2BhSimple)
66 {
67 StoreArray<Particle> myParticles;
68 B2INFO("Cos: " << cosThetaBetweenParticleAndNominalB(myParticles[2]));
69 EXPECT_FLOAT_EQ(7.90905, REC_q2BhSimple(myParticles[2])); // B-meson
70 }
71 TEST_F(SpecificKinematicVariablesTest, REC_q2Bh)
72 {
73 StoreArray<Particle> myParticles;
74 EXPECT_FLOAT_EQ(7.8716288, REC_q2Bh(myParticles[2])); // B-meson
75 }
76 TEST_F(SpecificKinematicVariablesTest, REC_MissM2)
77 {
78 StoreArray<Particle> myParticles;
79 EXPECT_FLOAT_EQ(0.1534055, REC_MissM2(myParticles[2])); // B-meson
80 }
81
82}
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:53
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:93
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:85
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.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.
STL namespace.