Belle II Software light-2406-ragdoll
Framework.h
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#pragma once
10
11#include <boost/python/list.hpp>
12#include <boost/python/dict.hpp>
13
14#include <framework/core/Module.h>
15#include <framework/core/Path.h>
16#include <framework/gearbox/Const.h>
17
18#include <string>
19
20namespace Belle2 {
28 class Framework {
29 public:
33 Framework();
34
38 virtual ~Framework();
39
48 static void addModuleSearchPath(const std::string& path);
49
55 static void setExternalsPath(const std::string& path);
56
69 static ModulePtr registerModule(const std::string& moduleName);
70
84 static ModulePtr registerModule(const std::string& moduleName, const std::string& sharedLibPath);
85
95 static void process(PathPtr startPath, long maxEvent = 0);
96
100 static void setNumberProcesses(int numProcesses);
101
105 static int getNumberProcesses();
106
112 static void setPicklePath(const std::string& path);
113
119 static std::string getPicklePath();
120
126 static void setStreamingObjects(const boost::python::list& streamingObjects);
127
133 static void setRealm(const std::string& realm);
134
138 static void setRunType(const Const::ERunType runType);
139
144 static void setCosmicRun();
145
151 static void setBeamRun();
152
158 static void writeSimulationSteps();
159
183 static std::string findFile(const std::string& filename, const std::string& type, bool ignore_errors = false);
184
185 //--------------------------------------------------
186 // Python API
187 //--------------------------------------------------
188
194 static boost::python::list getModuleSearchPathsPython();
195
201 static boost::python::dict getAvailableModulesPython();
202
208 static boost::python::list getRegisteredModulesPython();
209
213 static void exposePythonAPI();
214 };
215
217} //end of namespace Belle2
ERunType
Enum for identifying run type (beam or cosmic)
Definition: Const.h:64
This class combines all subsystems of the framework, and exports the main interface to Python.
Definition: Framework.h:28
static boost::python::list getRegisteredModulesPython()
Returns a list of all registered modules.
Definition: Framework.cc:282
static void writeSimulationSteps()
Function for writing the simulation steps of each event into csv files.
Definition: Framework.cc:231
static std::string findFile(const std::string &filename, const std::string &type, bool ignore_errors=false)
Find a file.
Definition: Framework.cc:239
static void setRunType(const Const::ERunType runType)
Function to set the run type (beam or cosmic)
Definition: Framework.cc:216
static void setBeamRun()
Function to set that the script is running on beam data (by default it runs on beam data,...
Definition: Framework.cc:226
static boost::python::list getModuleSearchPathsPython()
Returns a list of all module search paths known to the framework.
Definition: Framework.cc:263
static void setNumberProcesses(int numProcesses)
Function to set number of worker processes for parallel processing.
Definition: Framework.cc:168
static void exposePythonAPI()
Exposes methods of the Framework class to Python.
Definition: Framework.cc:313
static void setCosmicRun()
Function to set that the script is running on cosmics data (by default it runs on beam data)
Definition: Framework.cc:221
static void setRealm(const std::string &realm)
Function to set the execution realm.
Definition: Framework.cc:197
static boost::python::dict getAvailableModulesPython()
Returns a dictionary containing the found modules and the filenames of the shared libraries in which ...
Definition: Framework.cc:273
static void setStreamingObjects(const boost::python::list &streamingObjects)
Function to set streaming objects for Tx module.
Definition: Framework.cc:191
static std::string getPicklePath()
Function to get the path to the file where the pickled path is stored.
Definition: Framework.cc:186
static ModulePtr registerModule(const std::string &moduleName)
Registers a new module to the framework and returns a shared pointer.
Definition: Framework.cc:76
static void setPicklePath(const std::string &path)
Function to set the path to the file where the pickled path is stored.
Definition: Framework.cc:180
static void setExternalsPath(const std::string &path)
Sets the path in which the externals of the framework are located.
Definition: Framework.cc:70
virtual ~Framework()
Destructor.
Definition: Framework.cc:51
static int getNumberProcesses()
Function to get number of worker processes for parallel processing.
Definition: Framework.cc:174
Framework()
Constructor.
Definition: Framework.cc:39
static void addModuleSearchPath(const std::string &path)
Adds a new filepath to the list of filepaths which are searched for modules.
Definition: Framework.cc:64
static void process(PathPtr startPath, long maxEvent=0)
Processes up to maxEvent events by starting with the first module in the specified path.
Definition: Framework.cc:88
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:43
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24