22 #define TSelEventGen_cxx 46 : fBaseDir(""), fNEvents(100000), fNTracks(100), fNTracksMax(-1),
47 fRegenerate(
kFALSE), fTotalGen(0), fFilesGenerated(0),
48 fGenerateFun(0), fChain(0)
53 fBaseDir.Remove(fBaseDir.Last(
'/'));
54 fBaseDir.Remove(fBaseDir.Last(
'/'));
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" 239 TString::Format(
"PROOF_FilesGenerated_%s_%s", hostname.Data(), thisordinal.Data());
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);
337 if (
fInput && (elemPair = dynamic_cast<TPair *>
339 if ((fCurrent = dynamic_cast<TDSetElement *>(elemPair->
Value()))) {
340 Info(
"Process",
"entry %lld: file: '%s'", entry, fCurrent->
GetName());
342 Error(
"Process",
"entry %lld: no file specified!", entry);
362 if (!strcmp(basedirurl.GetProtocol(),
"file")) {
381 if (entries_file == neventstogenerate) {
383 Info(
"Process",
"bench file (%s, entries=%lld) exists:" 384 " skipping generation.", filename.Data(), entries_file);
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),
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!");
void SetFile(const char *file)
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TSelectorList * fOutput
! List of objects created during processing
static TMD5 * FileChecksum(const char *file)
Returns checksum of specified file.
virtual void Delete(Option_t *option="")
Delete this tree from memory or/and disk.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
static void FilterLocalroot(TString &path, const char *url="root://dum/")
If 'path' is local and 'dsrv' is Xrootd, apply 'path.Localroot' settings, if any. ...
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 Int_t Fill()
Fill all branches.
const char * GetProtocol() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void SlaveBegin(TTree *tree)
The SlaveBegin() function is called after the Begin() function.
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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...
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...
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...
const char * AsString() const
Return message digest as string.
virtual void SlaveTerminate()
The SlaveTerminate() function is called after all entries or objects have been processed.
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
Make a file system directory.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
This class defines a UUID (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDent...
const char * GetFile() const
Manages an element of a TDSet.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual void Terminate()
The Terminate() function is the last function to be called during a query.
This code implements the MD5 message-digest algorithm.
The TNamed class is the base class for all named ROOT classes.
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 ].
virtual const char * GetOption() const
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
R__EXTERN TSystem * gSystem
Long64_t fStatus
Selector status.
static void GetLocalServer(TString &dsrv)
Extract LOCALDATASERVER info in 'dsrv'.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TFile * GetCurrentFile() const
Return pointer to the current file.
void SetName(const char *name)
R__EXTERN TRandom * gRandom
ULong_t Hash(const void *txt, Int_t ntxt)
Calculates hash index from any char string.
Class used by TMap to store (key,value) pairs.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
virtual const char * HostName()
Return the system's host name.
Describe directory structure in memory.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
virtual Long64_t GetSize() const
Returns the current file size.
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 ...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
const char * AsString() const
Return UUID as string. Copy string immediately since it will be reused.
virtual Long64_t GetEntries() const
Mother of all ROOT objects.
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.
TList * fInput
List of objects available during processing.
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
R__EXTERN TProofServ * gProofServ
virtual void Add(TObject *obj)
virtual void Init(TTree *tree)
Selector for event file generation.
A TTree object has a header with a name and a title.
const AParamType & GetVal() const
Class describing a generic file including meta information.
virtual void Begin(TTree *)
The Begin() function is called at the start of the query.
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
const char * GetDataDir() const
const char * GetOrdinal() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual const char * GetName() const
Return name of this collection.
virtual const char * GetTitle() const
Returns title of object.
virtual void Close(Option_t *option="")
Close a file.
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
const char * Data() const