 |
Belle II Software
release-05-02-19
|
11 #include <framework/core/Module.h>
12 #include <framework/core/Path.h>
13 #include <framework/core/Environment.h>
14 #include <framework/core/ModuleManager.h>
15 #include <framework/logging/LogConfig.h>
16 #include <framework/core/InputController.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/dataobjects/FileMetaData.h>
20 #include <boost/filesystem.hpp>
28 namespace fs = boost::filesystem;
49 unsigned int numEventsFromArgument = getNumberEventsOverride();
50 if (numEventsFromArgument != 0
51 && (numEventsFromInput == 0 || numEventsFromArgument < numEventsFromInput))
52 return numEventsFromArgument;
54 return numEventsFromInput;
60 if (fileMetaData)
return fileMetaData->isMC();
67 if (!m_outputFileOverrideModule.empty()) {
68 B2WARNING(
"Module '" << module <<
"' requested to handle -o which has already been handled by '" << module <<
"', ignoring");
71 if (!m_outputFileOverride.empty()) {
72 m_outputFileOverrideModule = module;
73 std::swap(s, m_outputFileOverride);
85 m_numberEventsOverride(0),
86 m_inputFilesOverride(),
87 m_entrySequencesOverride(),
88 m_outputFileOverride(
""),
89 m_numberProcessesOverride(-1),
91 m_visualizeDataFlow(false),
100 const char* envarReleaseDir = getenv(
"BELLE2_RELEASE_DIR");
101 const char* envarLocalDir = getenv(
"BELLE2_LOCAL_DIR");
102 const char* envarAnalysisDir = getenv(
"BELLE2_ANALYSIS_DIR");
103 if (!envarReleaseDir and !envarLocalDir) {
104 B2FATAL(
"The basf2 environment is not set up. Please execute the 'setuprel' script first.");
108 const char* envarSubDir = getenv(
"BELLE2_SUBDIR");
110 B2FATAL(
"The environment variable BELLE2_SUBDIR is not set. Please execute the 'setuprel' script first.");
113 const char* envarExtDir = getenv(
"BELLE2_EXTERNALS_DIR");
115 B2FATAL(
"The environment variable BELLE2_EXTERNALS_DIR is not set. Please execute the 'setuprel' script first.");
119 std::string added_dirs = fs::initial_path().string();
122 if (envarAnalysisDir) {
123 const string analysisModules = (fs::path(envarAnalysisDir) /
"modules" / envarSubDir).
string();
125 added_dirs +=
" " + analysisModules;
129 const string localModules = (fs::path(envarLocalDir) /
"modules" / envarSubDir).
string();
131 added_dirs +=
" " + localModules;
134 if (envarReleaseDir) {
135 const string centralModules = (fs::path(envarReleaseDir) /
"modules" / envarSubDir).
string();
137 added_dirs +=
" " + centralModules;
141 B2ERROR(
"No modules found! Did you forget to run 'scons'? Module paths added: " << added_dirs);
153 #ifdef __INTEL_COMPILER
154 #pragma warning (disable:1478) //[[deprecated]]
155 #pragma warning (disable:1786) //[[deprecated("message")]]
157 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
162 const std::list<ModulePtr>& modules = path->buildModulePathList(
true);
166 std::vector<std::string> inputFiles = m->getFileNames(
false);
167 for (
const string& file : inputFiles) {
172 std::vector<std::string> outputFiles = m->getFileNames(
true);
173 for (
const string& file : outputFiles) {
void setJobInformation(const std::shared_ptr< Path > &path)
Set info from path executed by the framework.
const std::list< std::string > & getModuleSearchPaths() const
Returns a reference to the list of the modules search filepaths.
std::string m_jobInfoOutput
Output for printJobInformation(), generated by setJobInformation().
@ c_Output
This module is an output module (writes data).
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
void addModuleSearchPath(const std::string &path)
Adds a new filepath to the list of filepaths which are searched for a requested module.
bool isMC() const
Do we have generated, not real data?
Environment()
Set up environment from standard BELLE2_ environment variables.
std::string consumeOutputFileOverride(const std::string &moduleName)
Return overriden output file name, or "" if none was set.
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
~Environment()
The Environment destructor.
const std::list< std::string > & getModuleSearchPaths() const
Returns a list of file paths searched for module libraries.
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
unsigned int getNumberOfEvents() const
Return the number of events, from either input or EventInfoSetter, or -n command line override (if le...
This class stores all environment information required to run the framework, such as module or data f...
@ c_Persistent
Object is available during entire execution time.
void setExternalsPath(const std::string &externalsPath)
Sets the path which points to the externals directory of the framework.
@ c_Input
This module is an input module (reads data).
static Environment & Instance()
Static method to get a reference to the Environment instance.
void printJobInformation() const
Print information on input/output files in current steering file, used by –dry-run.