65 if (localcollectionfile != 0) {
122 coll +=
"/aliencollection.";
125 ::Error(
"TAlienCollection::Open",
"Cannot make a local copy of collection with url %s",
135 ::Error(
"TAlienCollection::Open",
"Cannot remove the local copy of the collection %s",
169 while ((filemap = ((
TMap *) fileiter->
Next()))) {
183 filelist->
Add(filegroup);
213 while ((filemap = ((
TMap *) fileiter->
Next()))) {
222 && ((bname != prev_bname) && (dname == prev_dname)
232 filelist->
Add(filegroup);
237 filegroup =
new TMap();
247 filelist->
Add(filegroup);
301 Error(
"ParseXML",
"cannot find the <alien> tag in %s",
308 Error(
"ParseXML",
"cannot find the <collection> tag in %s",
313 if (xml.
GetAttr(xcollection,
"name")) {
321 Error(
"ParseXML",
"cannot find the <event> tag in %s",
372 if (oevlist && strlen(oevlist->
GetName())) {
390 attributes->
Add(
new TObjString(
"seStringlist"), oseStringlist);
392 if (osurl && strlen(osurl->
GetName())) {
396 if (osselect && strlen(osselect->
GetName())) {
400 if (osonline && strlen(osonline->
GetName())) {
405 if (ossexporturl && strlen(ossexporturl->
GetName())) {
420 }
while ((xfile = xml.
GetNext(xfile)));
425 if (xml.
GetAttr(xevent,
"comment")) {
433 if (xml.
GetAttr(xevent,
"url")) {
439 if (parsedentries >= maxentries)
441 }
while ((xevent = xml.
GetNext(xevent)));
475 onlinegroups = offlinegroups = onlinefiles = offlinefiles = totalfiles =
476 totalfilesize = onlinefilesize = offlinefilesize = 0;
477 while ((nextgroup = (
TMap *) statuslist->
Next())) {
487 while ((attributes = (
TMap *) nextfile->
Next())) {
517 Info(
"Status",
"=========================================");
518 Info(
"Status",
" Tot. Number of files: %u", totalfiles);
519 Info(
"Status",
" Tot. Size: %0.2f GB",
520 totalfilesize / 1024.0 / 1024.0 / 1024.0);
521 Info(
"Status",
" Number of file groups: %u",
gc);
522 Info(
"Status",
"Number of files per group: %u", fc);
523 Info(
"Status",
"-----------------------------------------");
524 Info(
"Status",
"Online (staged [selected]):");
525 Info(
"Status",
" Number of file groups: %u", onlinegroups);
526 Info(
"Status",
" Number of files: %u", onlinefiles);
527 Info(
"Status",
" Size: %0.2f GB",
528 onlinefilesize / 1024.0 / 1024.0 / 1024.0);
529 Info(
"Status",
" Fraction avail: %0.2f %%",
530 100.0 * onlinefilesize / (onlinefilesize + offlinefilesize +
532 Info(
"Status",
"-----------------------------------------");
533 Info(
"Status",
"Offline (to be staged [selected]):");
534 Info(
"Status",
" Number of file groups: %u", offlinegroups);
535 Info(
"Status",
" Number of files: %u", offlinefiles);
536 Info(
"Status",
" Size: %0.2f GB",
537 offlinefilesize / 1024.0 / 1024.0 / 1024.0);
538 Info(
"Status",
" Fraction miss: %0.2f %%",
539 100.0 * offlinefilesize / (onlinefilesize + offlinefilesize +
541 Info(
"Status",
"=========================================\n");
552 if ((!tag) || (!
value) || (!tagmap)) {
558 tagmap->
Remove(keyobject);;
574 while ((nextgroup = (
TMap *)
Next())) {
579 if ( ((nstart == -1 ) && (nstop == -1)) ||
580 ((nstart != -1 ) && (cnt >= nstart) && (nstop == -1)) ||
581 ((nstart != -1 ) && (cnt >= nstart) && (nstop != -1) && (cnt <= nstop)) ||
582 ((nstop != -1 ) && (cnt <= nstop) && (nstart == -1))) {
583 while ((attributes = (
TMap *) nextfile->
Next())) {
606 while ((nextgroup = (
TMap *)
Next())) {
611 if ( ((nstart == -1 ) && (nstop == -1)) ||
612 ((nstart != -1 ) && (cnt >= nstart) && (nstop == -1)) ||
613 ((nstart != -1 ) && (cnt >= nstart) && (nstop != -1) && (cnt <= nstop)) ||
614 ((nstop != -1 ) && (cnt <= nstop) && (nstart == -1))) {
615 while ((attributes = (
TMap *) nextfile->
Next())) {
639 while ((nextgroup = (
TMap *)
Next())) {
644 while ((attributes = (
TMap *) nextfile->
Next())) {
666 while ((nextgroup = (
TMap *)
Next())) {
672 while ((attributes = (
TMap *) nextfile->
Next())) {
765 if (selected ==
TString(
"1")) {
789 Error(
"GetEntryList",
"cannot get evelist of file %s",
filename);
806 Error(
"GetLFN",
"cannot get LFN");
821 return ssize.
Atoll();
838 while ((filemap = (
TMap *) next())) {
840 Info(
"Print",
"printing element %d", count);
912 while ((overlapmap = this->
Next())) {
916 while ((comparator->
Next())) {
937 if ((!addcollection)) {
941 addcollection->
Reset();
944 while ((addmap = addcollection->
Next())) {
953 "File group with lfn %s exists already in this collection - skipping",
971 if ((!addcollection)) {
974 addcollection->
Reset();
975 TMap *addmap, *clonemap;
976 while ((addmap = addcollection->
Next())) {
991 while ((filemap =
Next())) {
995 while ((attributes = (
TMap *) nextfile->
Next())) {
1002 Info(
"LookupSUrls",
"Lookup SURL for %s [%u/%u]",
1024 Info(
"LookupSUrls",
"SURL = %s", surl.
Data());
1045 "You have to execute LookupSUrls() before you can stage this collection");
1053 while ((filemap =
Next())) {
1057 while ((attributes = (
TMap *) nextfile->
Next())) {
1069 Info(
"Stage",
"[%05u/%05u] <Staged> : %s", fc,
1074 Error(
"Stage",
"[%05u/%05u] <Failed to stage> : %s",
1087 while ((filemap =
Next())) {
1090 while ((attributes = (
TMap *) nextfile->
Next())) {
1118 Error(
"CheckIfOnline",
1119 "You have to execute LookupSUrls() before you can prepare this collection");
1128 while ((filemap =
Next())) {
1132 while ((attributes = (
TMap *) nextfile->
Next())) {
1145 Info(
"CheckIfOnline",
"[%05u/%05u] <Online> : %s", fc,
1151 Info(
"CheckIfOnline",
"[%05u/%05u]<Offline> : %s", fc,
1185 while ((filemap =
Next())) {
1189 while ((attributes = (
TMap *) nextfile->
Next())) {
1211 while ((filemap =
Next())) {
1215 while ((attributes = (
TMap *) nextfile->
Next())) {
1223 Info(
"CheckIfOnline",
"[%05u/%05u] <Online> : %s", fc,
1229 Info(
"CheckIfOnline",
"[%05u/%05u]<Offline> : %s", fc,
1240 GetValue(attributes->
GetName()))->
1245 GetValue(attributes->
GetName()))->
1250 GetValue(attributes->
GetName()))->
1254 GetValue(attributes->
GetName()))->
1283 const char *
name ,
const char *comment)
1288 if ((exporturl == 0) || (
TString(exporturl) ==
"")) {
1291 "You used the option to store to the collection export url, but this is not defined!");
1295 TUrl expfn(exporturl);
1298 options +=
",filetype=raw";
1300 options =
"filetype=raw";
1305 Error(
"ExportXML",
"Cannot open export URL %s", expfn.
GetUrl());
1310 exportfile->
Close();
1319 const char *comment)
1325 "<?xml version=\"1.0\"?>\n<alien>\n <collection name=\"%s\">\n",
1327 if ((exportfile->
WriteBuffer(outline, strlen(outline)))) {
1328 Error(
"ExportXML",
"Error writing XML to export file");
1329 exportfile->
Close();
1336 filegroups->
Reset();
1338 while ((nextgroup = (
TMap *) filegroups->
Next())) {
1345 while ((attributes = (
TMap *) nextfile->
Next())) {
1354 if ((!selected) || isselected) {
1359 snprintf(outline,4096,
" <event name=\"%d\">\n", groupcnt);
1360 if ((exportfile->
WriteBuffer(outline, strlen(outline)))) {
1361 Error(
"ExportXML",
"Error writing XML to export file");
1362 exportfile->
Close();
1365 while ((attributes = (
TMap *) nextfile->
Next())) {
1375 WriteBuffer(outline, strlen(outline)))) {
1377 "Error writing XML to export file");
1378 exportfile->
Close();
1383 ((
TMap *) nextgroup->
1384 GetValue(attributes->
GetName()))->MakeIterator();
1394 while ((filtertag = (
TObjString *) next())) {
1405 GetValue(attributes->
1409 snprintf(outline,4096,
"%s=\"%s\" ",
1419 for (
Int_t i = 0; i < xmlentrylist->
GetN(); i++) {
1422 slist += xmlentrylist->
GetEntry(i);
1424 snprintf(outline,4096,
"%s=\"%s\" ",
1429 WriteBuffer(outline, strlen(outline)))) {
1431 "Error writing XML to export file");
1432 exportfile->
Close();
1441 WriteBuffer(outline, strlen(outline)))) {
1443 "Error writing XML to export file");
1444 exportfile->
Close();
1453 snprintf(outline,4096,
" </event>\n");
1454 if ((exportfile->
WriteBuffer(outline, strlen(outline)))) {
1455 Error(
"ExportXML",
"Error writing XML to export file");
1456 exportfile->
Close();
1467 if ((exportfile->
WriteBuffer(outline, strlen(outline)))) {
1468 Error(
"ExportXML",
"Error writing XML to export file");
1469 exportfile->
Close();
1477 " <info comment=\"%s\" />\n</collection>\n</alien>\n",
1479 if ((exportfile->
WriteBuffer(outline, strlen(outline)))) {
1480 Error(
"ExportXML",
"Error writing XML to export file");
1481 exportfile->
Close();
1500 "There is no remote url defined in this collection");
1521 Bool_t rename,
const char* suffix)
1552 char rootfile[4096];
1554 while ((item = fscanf(fp,
"%4095s", rootfile)) == 1) {
1558 rootbasenosuffix = rootbase(0, rootbase.
First(
'.'));;
1565 newrootname += rootbasenosuffix;
1567 newrootname += firstrun;
1569 newrootname += firstevent;
1571 newrootname += lastrun;
1573 newrootname += lastevent;
1575 newrootname += nevents;
1577 newrootname += suffix;
1578 Info(
"GetOutputFilename",
"Renaming File %s to %s", rootfile,
1579 newrootname.
Data());
1603 while ((
group =
dynamic_cast<TMap*
>(next()))) {
1606 while ((key =
dynamic_cast<TObjString*
> (next2()))) {
1623 collection->
Add(fileInfo);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
void Print(Option_t *opt) const
Print event file collection.
const char * GetExportUrl()
Bool_t IsSelected(const char *name="")
Get a file's online tag. Returns false if not online or CheckIfOnline was never executed,...
const char * GetLFN(const char *name="")
Get a file's LFN. Returns 0 in case of error.
const char * GetSURL(const char *name="")
Get a file's storage URL (SURL). Returns 0 in case of error.
const char * GetTURL(const char *name="")
Get a file's transport URL (TURL). Returns 0 in case of error.
void Reset()
Reset file iterator.
Bool_t Remove(TMap *map)
Return next event file map.
Bool_t ExportXML(TFile *file, Bool_t selected, Bool_t online, const char *name, const char *comment)
Internal Export function to write a collection as an XML file. See above.
TMap * Next()
Return next event file map.
void Add(TGridCollection *addcollection)
adds <addcollection> to this collection - equal elements are skipped
Bool_t InvertSelection()
Invert the selection.
UInt_t GetNofGroupfiles() const
static TAlienCollection * OpenAlienCollection(TGridResult *queryresult, Option_t *option="")
Static method used to create an Alien event collection, by creating collection from a TGridResult Get...
void Status()
Prints statistics, selection and status about the loaded collection.
Bool_t LookupSUrls(Bool_t verbose=kTRUE)
retrieves all the SURLS for the LFNS
TDSet * GetDataset(const char *type, const char *objname="*", const char *dir="/")
Return a TDSet from a collection.
TString fExportUrl
pointer to the file stager object
Bool_t OverlapCollection(TGridCollection *comparator)
return kTRUE if comparator overlaps with this all objects in this collection, which are not defined i...
static TGridCollection * OpenQuery(TGridResult *queryresult, Bool_t nogrouping=kFALSE)
Static method used to create an Alien event collection, by creating collection from a TGridResult Que...
TFileCollection * GetFileCollection(const char *name="", const char *title="") const
creates a TFileCollection objects and fills it with the information from this collection note that TF...
TFileStager * fFileStager
virtual void ParseXML(UInt_t maxentries)
Parse event file collection XML file.
TMap * fCurrent
event file list iterator
TEntryList * GetEntryList(const char *name)
Get a file's event list. Returns 0 in case of error.
void SetTagFilterList(TList *filterlist)
Bool_t DownscaleSelection(UInt_t scaler=2)
downscales the selection with scaler
TFile * OpenFile(const char *filename)
Open the file specified by <filename> from the currently active file group in the collection via its ...
Long64_t GetSize(const char *name="")
Get a file's LFN. Returns 0 in case of error.
TGridResult * GetGridResult(const char *filename="", Bool_t onlyonline=kTRUE, Bool_t publicaccess=kFALSE)
Return a TGridResult.
static TGridCollection * Open(const char *collectionurl, UInt_t maxentries=1000000)
Static method used to create an Alien event collection, by reading an XML collection from the specifi...
Bool_t DeselectFile(const char *name, Int_t=-1, Int_t=-1)
Deselects the file <filename> from the loaded collection All files can be deselected using "*" as <fi...
UInt_t GetNofGroups() const
UInt_t fNofGroups
current event file map
Bool_t IsOnline(const char *name="")
Get a file's online tag. Returns false if not online or CheckIfOnline was never executed,...
Bool_t SetExportUrl(const char *exporturl=0)
Set the 'default' export URL for an XML collection. A collection can be restored to the export URL us...
void SetTag(const char *tag, const char *value, TMap *tagmap)
Set's a key value pair in a tagmap. If it is existing, the existing tag is overwritten....
const char * GetOutputFileName(const char *infile, Bool_t rename=kTRUE, const char *suffix="root")
Adds to a file given by infile the collection identification , f.e.
Bool_t CheckIfOnline(Bool_t bulk=kFALSE)
Run an online check if files are currently accessible (staged) or offline (to be staged).
virtual ~TAlienCollection()
Clean up event file collection.
Bool_t SelectFile(const char *name, Int_t=-1, Int_t=-1)
Selects all files with name <filename> in the collection All files can be selected using "*" as filen...
TIter * fFileGroupListIter
void AddFast(TGridCollection *addcollection)
adds <addcollection> to this collection - NO check for identical elements
Bool_t Stage(Bool_t bulk=kFALSE, Option_t *option="")
Execute the 'stage' method for all files in this collection (trigger staging).
static TString SUrl(const char *lfn)
Get surl from lfn by asking AliEn catalog.
const char * GetName() const override
Return name of this collection.
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
This class implements a data set to be used for PROOF processing.
virtual Bool_t Add(const char *file, const char *objname=0, const char *dir=0, Long64_t first=0, Long64_t num=-1, const char *msd=0)
Add file to list of files to be analyzed.
A List of entry numbers in a TTree or TChain.
virtual Long64_t GetEntry(Long64_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
virtual Long64_t GetN() const
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Int_t Update(Long64_t avgsize=-1)
Update accumulated information about the elements of the collection (e.g.
Int_t Add(TFileInfo *info)
Add TFileInfo to the collection.
Class describing a generic file including meta information.
static TFileStager * Open(const char *stager)
Open a stager, after having loaded the relevant plug-in.
virtual TList * GetStaged(TCollection *pathlist)
Retrieves the staging (online) status for a list of path names.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual Bool_t WriteBuffer(const char *buf, Int_t len)
Write a buffer to the file.
virtual Bool_t Cp(const char *dst, Bool_t progressbar=kTRUE, UInt_t buffersize=1000000)
Allows to copy this file to the dst URL.
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.
void Close(Option_t *option="") override
Close a file.
virtual const char * GetLFN(const char *="")
Iterator abstract base class.
virtual TObject * Next()=0
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
void Add(TObject *obj) override
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
TObject * FindObject(const char *keyname) const override
Check if a (key,value) pair exists with keyname as name of the key.
TObject * Remove(TObject *key) override
Remove the (key,value) pair with key from the map.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Create an iterator for TMap.
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
Collectable string class.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
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.
Int_t Atoi() const
Return integer value of string.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Long64_t Atoll() const
Return long long value of string.
virtual FILE * OpenPipe(const char *command, const char *mode)
Open a pipe.
virtual int Rename(const char *from, const char *to)
Rename a file.
virtual int ClosePipe(FILE *pipe)
Close the pipe.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
virtual int Unlink(const char *name)
Unlink, i.e.
virtual const char * TempDirectory() const
Return a user configured or systemwide directory to create temporary files in.
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 * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
void SetOptions(const char *opt)
const char * GetOptions() const
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped