22#define TSelEventGen_cxx
45 : fBaseDir(
""), fNEvents(100000), fNTracks(100), fNTracksMax(-1),
46 fRegenerate(
kFALSE), fTotalGen(0), fFilesGenerated(0),
47 fGenerateFun(0), fChain(0)
76 Error(
"Begin",
"object 'PROOF_FilesToProcess' found but not a map"
79 Error(
"Begin",
"object 'PROOF_FilesToProcess' not found");
107 while ((obj = nxt())){
112 if (sinput.
Contains(
"PROOF_BenchmarkBaseDir")){
130 Warning(
"SlaveBegin",
"\"%s\" directory is not writable or not existing,"
131 " using default directory: %s",
137 Info(
"SlaveBegin",
"using non local base directory \"%s\"",
fBaseDir.
Data());
140 Info(
"SlaveBegin",
"using default directory: %s",
146 Error(
"SlaveBegin",
"PROOF_BenchmarkBaseDir not type TNamed");
150 if (sinput.
Contains(
"PROOF_BenchmarkNEvents")){
157 Error(
"SlaveBegin",
"PROOF_BenchmarkEvents not type TParameter"
162 if (sinput.
Contains(
"PROOF_BenchmarkNTracks")){
169 Error(
"SlaveBegin",
"PROOF_BenchmarkNTracks not type TParameter"
174 if (sinput.
Contains(
"PROOF_BenchmarkNTracksMax")){
181 Error(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax not type TParameter"
186 if (sinput.
Contains(
"PROOF_BenchmarkRegenerate")){
190 found_regenerate=
kTRUE;
193 Error(
"SlaveBegin",
"PROOF_BenchmarkRegenerate not type TParameter"
198 if (sinput.
Contains(
"PROOF_GenerateFun")){
201 Error(
"SlaveBegin",
"PROOF_GenerateFun requires the TMacro object in the input list");
208 Warning(
"SlaveBegin",
"PROOF_BenchmarkBaseDir not found; using default:"
212 Warning(
"SlaveBegin",
"PROOF_BenchmarkNEvents not found; using default:"
216 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracks not found; using default:"
220 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax not found; using default:"
223 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax must be larger then"
224 " fNTracks=%d ; ignoring",
fNTracks);
228 if (!found_regenerate){
229 Warning(
"SlaveBegin",
"PROOF_BenchmarkRegenerate not found; using"
267 if (!
f ||
f->IsZombie())
return 0;
269 Event *
event=
new Event();
271 TTree* eventtree=
new TTree(
"EventTree",
"Event Tree");
274 const Int_t buffersize=32000;
275 eventtree->
Branch(
"event",
"Event", &ep, buffersize, 1);
284 Info(
"GenerateFiles",
"Generating %s", filename);
285 while (sizenevents--){
291 event->Build(i++, ntrks, 0);
292 size_generated+=eventtree->
Fill();
295 Info(
"GenerateFiles",
"%s generated with %lld entries", filename,
nentries);
339 Info(
"Process",
"entry %lld: file: '%s'", entry, fCurrent->
GetName());
341 Error(
"Process",
"entry %lld: no file specified!", entry);
376 if (
f && !
f->IsZombie()){
380 if (entries_file == neventstogenerate) {
382 Info(
"Process",
"bench file (%s, entries=%lld) exists:"
383 " skipping generation.", filename.
Data(), entries_file);
384 filesize =
f->GetSize();
398 Long_t devid, devbsz, devbtot, devbfree;
401 Long_t szneed = 1024 * 1024 * 1024, tomb = 1024 * 1024;
402 if (devbfree * devbsz < szneed || devbfree < 0.1 * devbtot) {
403 Error(
"Process",
"not enough free space on device (%ld MB < {%ld, %ld} MB):"
404 " skipping generation of: %s",
405 (devbfree * devbsz) / tomb,
406 szneed / tomb, (
Long_t) (0.1 * devbtot * devbsz / tomb),
422 if (
f && !
f->IsZombie()) {
423 filesize =
f->GetSize();
427 Error(
"Process",
"can not open generated file: %s", filename.
Data());
438 if (!strcmp(
TUrl(filename,
kTRUE).GetProtocol(),
"file"))
463 Info(
"SlaveTerminate",
464 "list '%s' of files generated by this worker added to the output list",
468 Warning(
"SlaveTerminate",
"no list of generated files defined!");
470 Warning(
"SlaveTerminate",
"list of generated files is empty!");
R__EXTERN TProofServ * gProofServ
R__EXTERN TRandom * gRandom
void Printf(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual const char * GetName() const
Return name of this collection.
void SetName(const char *name)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Manages an element of a TDSet.
Describe directory structure in memory.
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
Class describing a generic file including meta information.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
This code implements the MD5 message-digest algorithm.
const char * AsString() const
Return message digest as string.
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
Class supporting a collection of lines with C++ code.
virtual Long_t Exec(const char *params=0, Int_t *error=0)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Class used by TMap to store (key,value) pairs.
const char * GetOrdinal() const
static void GetLocalServer(TString &dsrv)
Extract LOCALDATASERVER info in 'dsrv'.
static void FilterLocalroot(TString &path, const char *url="root://dum/")
If 'path' is local and 'dsrv' is Xrootd, apply 'path.Localroot' settings, if any.
const char * GetDataDir() const
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
Selector for event file generation.
virtual void Init(TTree *tree)
virtual void Begin(TTree *)
The Begin() function is called at the start of the query.
TSelEventGen()
pointer to the analyzed TTree or TChain
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
virtual Bool_t Process(Long64_t entry)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
Long64_t GenerateFiles(const char *filename, Long64_t sizenevents)
Generate files for IO-bound run Input parameters filename: The name of the file to be generated sizen...
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
TList * fInput
List of objects available during processing.
TSelectorList * fOutput
! List of objects created during processing
Long64_t fStatus
Selector status.
virtual const char * GetOption() const
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual int GetFsInfo(const char *path, Long_t *id, Long_t *bsize, Long_t *blocks, Long_t *bfree)
Get info about a file system: fs type, block size, number of blocks, number of free blocks.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual const char * HostName()
Return the system's host name.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
TFile * GetCurrentFile() const
Return pointer to the current file.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
virtual Long64_t GetEntries() const
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
virtual void Delete(Option_t *option="")
Delete this tree from memory or/and disk.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
This class represents a WWW compatible URL.
const char * GetFile() const
const char * GetHostFQDN() const
Return fully qualified domain name of url host.
const char * GetProtocol() const
void SetFile(const char *file)
ULong_t Hash(const void *txt, Int_t ntxt)
Calculates hash index from any char string.