Project
Loading...
Searching...
No Matches
ConfigContext.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13#include <regex>
14#include <sys/stat.h>
15#include <unistd.h>
16
17namespace o2::framework
18{
19
21 : mOptions{options}, mServices{services}, mArgc{argc}, mArgv{argv} {}
22
24{
25 bool helpasked = false;
26 for (int argi = 0; argi < mArgc; ++argi) {
27 if (strcmp(mArgv[argi], "--help") == 0 || (strcmp(mArgv[argi], "-h") == 0)) {
28 helpasked = true;
29 break;
30 }
31 }
32 return helpasked;
33}
34
35bool ConfigContext::mayRun(std::string_view processor) const
36{
37 std::string_view id;
38 for (int argi = 0; argi + 1 < mArgc; ++argi) {
39 if (strcmp(mArgv[argi], "--id") == 0) {
40 id = mArgv[argi + 1];
41 }
42 }
43 // The driver, a device without a workflow on stdin and clones, which keep the
44 // name of their template, build everything.
45 struct stat s;
46 if (id.empty() || fstat(STDIN_FILENO, &s) != 0 || !(S_ISFIFO(s.st_mode) || S_ISREG(s.st_mode)) || !mOptions.get<std::string>("clone").empty()) {
47 return true;
48 }
49 // Pipelined devices get a _t<N> suffix, DDS ones a _dds<...> one.
50 auto name = std::regex_replace(std::regex_replace(std::string{id}, std::regex{"_dds.*"}, ""), std::regex{"_t[0-9]+$"}, "");
51 return id == processor || name == processor;
52}
53
54} // namespace o2::framework
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
ConfigContext(ConfigParamRegistry &options, ServiceRegistryRef services, int argc, char **argv)
bool mayRun(std::string_view processor) const
GLuint const GLchar * name
Definition glcorearb.h:781
GLuint id
Definition glcorearb.h:650
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
void empty(int)