Belle II Software  release-05-02-19
variableCutParser.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Keck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <analysis/VariableManager/Utility.h>
12 #include <analysis/dataobjects/Particle.h>
13 
14 #include <iostream>
15 #include <string>
16 #include <memory>
17 
18 using namespace Belle2;
19 
20 int main()
21 {
22  std::string condition;
23  std::cout <<
24  "This program allows you to test variable conditions (see the VariableManager section at https://software.belle2.org/).\n";
25  std::cout << "Please input a condition " << std::flush;
26  std::getline(std::cin, condition);
27 
28  std::unique_ptr<Variable::Cut> cut = Variable::Cut::compile(condition);
29 
30  cut->print();
31 
32  TLorentzVector momentum(1, 2, 3, 4);
33  Particle p(momentum, 421);
34  std::cout << "This condition is: " << (cut->check(&p) ? "True" : "False") << std::endl;
35 
36  return 0;
37 }
Belle2::GeneralCut::compile
static std::unique_ptr< GeneralCut > compile(const std::string &cut)
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead y...
Definition: GeneralCut.h:114
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77