Belle II Software  release-08-01-10
softwareTriggerVariableManager.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 
9 #include <hlt/softwaretrigger/core/SoftwareTriggerCut.h>
10 #include <gtest/gtest.h>
11 
12 using namespace std;
13 
14 namespace Belle2 {
19  namespace SoftwareTrigger {
20 
22  TEST(SoftwareTriggerVarialeManagerTest, pickVariables)
23  {
24  SoftwareTriggerObject softwareTriggerObject;
25  softwareTriggerObject["one_variable"] = 1.1;
26 
27  // Normal user case
28  const auto compiledFirstCut = SoftwareTriggerCut::compile("one_variable == 1.1", 1);
29  EXPECT_EQ(SoftwareTriggerCutResult::c_accept, compiledFirstCut->checkPreScaled(softwareTriggerObject));
30 
31  // Unregistered variable
32  EXPECT_THROW(SoftwareTriggerCut::compile("two_variable == 1.1", 1)->checkPreScaled(softwareTriggerObject),
33  std::out_of_range);
34 
35  softwareTriggerObject["two_variable"] = 2.2;
36 
37  // Now it is registered
38  const auto compiledSecondCut = SoftwareTriggerCut::compile("two_variable == 2.2", 1);
39  EXPECT_EQ(SoftwareTriggerCutResult::c_accept, compiledSecondCut->checkPreScaled(softwareTriggerObject));
40 
41  // Check should fail
42  softwareTriggerObject["two_variable"] = 2.3;
43  EXPECT_EQ(SoftwareTriggerCutResult::c_noResult, compiledSecondCut->checkPreScaled(softwareTriggerObject));
44  }
45  }
47 }
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.