Belle II Software  release-05-01-25
evtBCLFF.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Markus Prim *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <generators/evtgen/models/EvtBCLFF.h>
11 #include <generators/evtgen/EvtGenInterface.h>
12 #include <framework/utilities/FileSystem.h>
13 
14 #include <EvtGenBase/EvtId.hh>
15 #include <EvtGenBase/EvtPDL.hh>
16 
17 #include <gtest/gtest.h>
18 
19 #include <string>
20 
21 namespace Belle2 {
28  class EvtBCLFFTest : public ::testing::Test {
29  protected:
31  static void SetUpTestCase()
32  {
33  std::string decayFileName = FileSystem::findFile("decfiles/dec/DECAY_BELLE2.DEC");
34  s_evtgen = EvtGenInterface::createEvtGen(decayFileName, true);
35  }
36 
38  static void TearDownTestCase()
39  {
40  delete s_evtgen;
41  s_evtgen = nullptr;
42  }
43 
45  static EvtGen* s_evtgen;
46  };
47 
48 
49  EvtGen* EvtBCLFFTest::s_evtgen = nullptr;
50 
52  TEST_F(EvtBCLFFTest, Scalar)
53  {
54  EvtId B0 = EvtPDL::getId("B0");
55  EvtId M = EvtPDL::getId("pi+");
56  const auto mB = EvtPDL::getMeanMass(B0);
57  const auto mB2 = mB * mB;
58  const auto mM = EvtPDL::getMeanMass(M);
59  const auto mM2 = mM * mM;
60  const auto q2min = 0.0;
61  const auto q2max = mB2 + mM2 - 2 * mB * mM;
62 
63  int nArguments = 8;
64  double arguments[] = {0.419, -0.495, -0.43, 0.22, 0.510, -1.700, 1.53, 4.52};
65 
66  EvtBCLFF bclff(nArguments, arguments);
67 
68  double fplus = 0;
69  double fzero = 0;
70 
71  bclff.getscalarff(B0, M, q2min, 0, &fplus, &fzero);
72 
73  ASSERT_NEAR(0.253, fplus, 0.003);
74  ASSERT_NEAR(0.253, fzero, 0.003);
75 
76  bclff.getscalarff(B0, M, q2max, 0, &fplus, &fzero);
77 
78  ASSERT_NEAR(7.620, fplus, 0.003);
79  ASSERT_NEAR(1.006, fzero, 0.003);
80 
81 
82  } // Scalar Tests
83 
85  TEST_F(EvtBCLFFTest, Vector)
86  {
87  EvtId B0 = EvtPDL::getId("B0");
88  EvtId M = EvtPDL::getId("rho+");
89  const auto mB = EvtPDL::getMeanMass(B0);
90  const auto mB2 = mB * mB;
91  const auto mM = EvtPDL::getMeanMass(M);
92  const auto mM2 = mM * mM;
93  const auto q2min = 0.0;
94  const auto q2max = mB2 + mM2 - 2 * mB * mM;
95 
96  int nArguments = 11;
97  double arguments[] = { -0.833, 1.331, 0.262, 0.394, 0.163, 0.297, 0.759, 0.465, 0.327, -0.86 , 1.802};
98 
99  EvtBCLFF bclFF(nArguments, arguments);
100 
101  double A0 = 0;
102  double A1 = 0;
103  double A2 = 0;
104  double V = 0;
105 
106  bclFF.getvectorff(B0, M, q2min, 0, &A1, &A2, &V, &A0);
107 
108  ASSERT_NEAR(0.356, A0, 0.003);
109  ASSERT_NEAR(0.262, A1, 0.003);
110  ASSERT_NEAR(0.327, V, 0.003);
111 
112  bclFF.getvectorff(B0, M, q2max, 0, &A1, &A2, &V, &A0);
113 
114  ASSERT_NEAR(2.123, A0, 0.003);
115  ASSERT_NEAR(0.497, A1, 0.003);
116  ASSERT_NEAR(2.014, V, 0.003);
117 
118  } // Vector Tests
119 
121 }
Belle2::EvtGenInterface::createEvtGen
static EvtGen * createEvtGen(const std::string &decayFileName, bool coherentMixing)
Create and initialize an EvtGen instance:
Definition: EvtGenInterface.cc:51
Belle2::EvtBCLFFTest
The fixture for testing the EvtBCLFF.
Definition: evtBCLFF.cc:36
Belle2::EvtBCLFFTest::TearDownTestCase
static void TearDownTestCase()
cleans up after the test
Definition: evtBCLFF.cc:46
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST_F
TEST_F(GlobalLabelTest, LargeNumberOfTimeDependentParameters)
Test large number of time-dep params for registration and retrieval.
Definition: globalLabel.cc:65
Belle2::EvtBCLFFTest::s_evtgen
static EvtGen * s_evtgen
pointer to the evtgen instance
Definition: evtBCLFF.cc:53
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:147
Belle2::EvtBCLFFTest::SetUpTestCase
static void SetUpTestCase()
sets up the test
Definition: evtBCLFF.cc:39