22#define TSelEventGen_cxx
46 : fBaseDir(
""), fNEvents(100000), fNTracks(100), fNTracksMax(-1),
47 fRegenerate(
kFALSE), fTotalGen(0), fFilesGenerated(0),
48 fGenerateFun(0), fChain(0)
77 Error(
"Begin",
"object 'PROOF_FilesToProcess' found but not a map"
80 Error(
"Begin",
"object 'PROOF_FilesToProcess' not found");
108 while ((obj = nxt())){
113 if (sinput.
Contains(
"PROOF_BenchmarkBaseDir")){
131 Warning(
"SlaveBegin",
"\"%s\" directory is not writable or not existing,"
132 " using default directory: %s",
138 Info(
"SlaveBegin",
"using non local base directory \"%s\"",
fBaseDir.
Data());
141 Info(
"SlaveBegin",
"using default directory: %s",
147 Error(
"SlaveBegin",
"PROOF_BenchmarkBaseDir not type TNamed");
151 if (sinput.
Contains(
"PROOF_BenchmarkNEvents")){
158 Error(
"SlaveBegin",
"PROOF_BenchmarkEvents not type TParameter"
163 if (sinput.
Contains(
"PROOF_BenchmarkNTracks")){
170 Error(
"SlaveBegin",
"PROOF_BenchmarkNTracks not type TParameter"
175 if (sinput.
Contains(
"PROOF_BenchmarkNTracksMax")){
182 Error(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax not type TParameter"
187 if (sinput.
Contains(
"PROOF_BenchmarkRegenerate")){
191 found_regenerate=
kTRUE;
194 Error(
"SlaveBegin",
"PROOF_BenchmarkRegenerate not type TParameter"
199 if (sinput.
Contains(
"PROOF_GenerateFun")){
202 Error(
"SlaveBegin",
"PROOF_GenerateFun requires the TMacro object in the input list");
209 Warning(
"SlaveBegin",
"PROOF_BenchmarkBaseDir not found; using default:"
213 Warning(
"SlaveBegin",
"PROOF_BenchmarkNEvents not found; using default:"
217 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracks not found; using default:"
221 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax not found; using default:"
224 Warning(
"SlaveBegin",
"PROOF_BenchmarkNTracksMax must be larger then"
225 " fNTracks=%d ; ignoring",
fNTracks);
229 if (!found_regenerate){
230 Warning(
"SlaveBegin",
"PROOF_BenchmarkRegenerate not found; using"
268 if (!
f ||
f->IsZombie())
return 0;
270 Event *
event=
new Event();
272 TTree* eventtree=
new TTree(
"EventTree",
"Event Tree");
275 const Int_t buffersize=32000;
276 eventtree->
Branch(
"event",
"Event", &ep, buffersize, 1);
285 Info(
"GenerateFiles",
"Generating %s", filename);
286 while (sizenevents--){
292 event->Build(i++, ntrks, 0);
293 size_generated+=eventtree->
Fill();
296 Info(
"GenerateFiles",
"%s generated with %lld entries", filename,
nentries);
340 Info(
"Process",
"entry %lld: file: '%s'", entry, fCurrent->
GetName());
342 Error(
"Process",
"entry %lld: no file specified!", entry);
377 if (
f && !
f->IsZombie()){
381 if (entries_file == neventstogenerate) {
383 Info(
"Process",
"bench file (%s, entries=%lld) exists:"
384 " skipping generation.", filename.
Data(), entries_file);
385 filesize =
f->GetSize();
399 Long_t devid, devbsz, devbtot, devbfree;
402 Long_t szneed = 1024 * 1024 * 1024, tomb = 1024 * 1024;
403 if (devbfree * devbsz < szneed || devbfree < 0.1 * devbtot) {
404 Error(
"Process",
"not enough free space on device (%ld MB < {%ld, %ld} MB):"
405 " skipping generation of: %s",
406 (devbfree * devbsz) / tomb,
407 szneed / tomb, (
Long_t) (0.1 * devbtot * devbsz / tomb),
423 if (
f && !
f->IsZombie()) {
424 filesize =
f->GetSize();
428 Error(
"Process",
"can not open generated file: %s", filename.
Data());
439 if (!strcmp(
TUrl(filename,
kTRUE).GetProtocol(),
"file"))
464 Info(
"SlaveTerminate",
465 "list '%s' of files generated by this worker added to the output list",
469 Warning(
"SlaveTerminate",
"no list of generated files defined!");
471 Warning(
"SlaveTerminate",
"list of generated files is empty!");
R__EXTERN TProofServ * gProofServ
R__EXTERN TRandom * gRandom
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=0)
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::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
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 on [ 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 object has a header with a name and a title.
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.
virtual void Delete(Option_t *option="")
Delete this tree from memory or/and disk.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
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.