Project
Loading...
Searching...
No Matches
GeneratorFileOrCmd.h
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
14#ifndef ALICEO2_EVENTGEN_GENERATORFILEORCMD_H_
15#define ALICEO2_EVENTGEN_GENERATORFILEORCMD_H_
17#include <list>
18#include <string>
19
20namespace o2
21{
22namespace conf
23{
24class SimConfig;
25}
26namespace eventgen
27{
28
37 const conf::SimConfig& config);
38 // Configure with local parameters
39 void setup(const FileOrCmdGenConfig& param,
40 const conf::SimConfig& config);
48 void setCmd(const std::string& cmd) { mCmd = cmd; }
54 void setCmdPid(const pid_t cmdPid) { mCmdPid = cmdPid; }
62 void setNEvents(unsigned int nev) { mNEvents = nev; }
70 void setSeed(unsigned long seed) { mSeed = seed; }
78 void setBmax(float bmax) { mBmax = bmax; }
84 void setFileNames(const std::string& filenames);
90 void setOutputSwitch(const std::string& opt) { mOutputSwitch = opt; }
97 void setSeedSwitch(const std::string& opt) { mSeedSwitch = opt; }
104 void setNEventsSwitch(const std::string& opt) { mNEventsSwitch = opt; }
112 void setBmaxSwitch(const std::string& opt) { mBmaxSwitch = opt; }
119 void setBackgroundSwitch(const std::string& opt) { mBackgroundSwitch = opt; }
121 void setWait(int miliseconds = 500) { mWait = miliseconds; }
122
123 protected:
130 virtual std::string makeCmdLine() const;
141 virtual bool executeCmdLine(const std::string& cmd);
156 virtual bool terminateCmd(unsigned int graceMillis = 0);
162 static constexpr unsigned int sStopGraceMillis = 5000;
171 virtual bool makeTemp(const bool&);
177 virtual bool removeTemp() const;
185 virtual bool makeFifo() const;
196 virtual bool ensureFiles();
201 virtual void waitForData(const std::string& filename) const;
208 std::string mCmd = "";
213 std::list<std::string> mFileNames;
217 std::string mTemporary;
223 unsigned int mNEvents = 0;
229 unsigned long mSeed = 0;
235 float mBmax = -1.f;
241 std::string mOutputSwitch = ">";
246 std::string mSeedSwitch = "-s";
251 std::string mNEventsSwitch = "-n";
256 std::string mBmaxSwitch = "-b";
261 std::string mBackgroundSwitch = "&";
265 int mWait = 500;
269 int mCmdPid = -1;
270};
271
272} // namespace eventgen
273} // namespace o2
274#endif
275// Local Variables:
276// mode: C++
277// End:
GLenum GLfloat param
Definition glcorearb.h:271
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
void setCmdPid(const pid_t cmdPid)
void setBackgroundSwitch(const std::string &opt)
void setSeedSwitch(const std::string &opt)
void setWait(int miliseconds=500)
void setFileNames(const std::string &filenames)
void setup(const GeneratorFileOrCmdParam &param, const conf::SimConfig &config)
std::list< std::string > mFileNames
void setSeed(unsigned long seed)
void setNEventsSwitch(const std::string &opt)
void setOutputSwitch(const std::string &opt)
static constexpr unsigned int sStopGraceMillis
virtual bool terminateCmd(unsigned int graceMillis=0)
void setCmd(const std::string &cmd)
virtual std::string makeCmdLine() const
virtual void waitForData(const std::string &filename) const
virtual bool executeCmdLine(const std::string &cmd)
virtual bool makeTemp(const bool &)
void setBmaxSwitch(const std::string &opt)