Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/alien:$Id$
2// Author: Andreas-Joachim Peters 9/5/2005
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TAlienCollection
13#define ROOT_TAlienCollection
16// //
17// TAlienCollection //
18// //
19// Class which manages collection of files on AliEn middleware. //
20// The file collection is in the form of an XML file. //
21// //
22// The internal list is managed as follows: //
23// TList* ===> TMap*(file) ===> TMap*(attributes) //
24// //
27#include "TGridCollection.h"
28#include "TString.h"
29#include "TList.h"
30#include "TFileStager.h"
33class TFileCollection;
38 TString fXmlFile; // collection XML file
39 TList *fFileGroupList; //-> list with event file maps
40 TIter *fFileGroupListIter; //! event file list iterator
41 TMap *fCurrent; //! current event file map
42 UInt_t fNofGroups; // number of file groups
43 UInt_t fNofGroupfiles; // number of files per group
44 Bool_t fHasSUrls; // defines if SURLs are present in the collection
45 Bool_t fHasSelection; // defines if the user made some selection on the files
46 // to be exported for processing
47 Bool_t fHasOnline; // defines if the collection was checked for the online status
48 TString fLastOutFileName; // keeps the latest outputfilename produced with GetOutputFileName
49 TFileStager *fFileStager; //! pointer to the file stager object
50 TString fExportUrl; // defines the url where to store back this collection
51 TString fInfoComment; // comment in the info section of the XML file
52 TString fCollectionName; // name of the collection in the collection section of the XML file
53 TList *fTagFilterList; //-> list of TObjStrings with tags to filter out in export operations
55 virtual void ParseXML(UInt_t maxentries);
56 Bool_t ExportXML(TFile * file, Bool_t selected, Bool_t online,
57 const char *name, const char *comment);
63 fCollectionName("unnamed"), fTagFilterList(0)
64 { }
65 TAlienCollection(TList *eventlist, UInt_t ngroups = 0,
66 UInt_t ngroupfiles = 0);
67 TAlienCollection(const char *localCollectionFile, UInt_t maxentries);
69 virtual ~TAlienCollection();
71 TFileCollection* GetFileCollection(const char* name = "", const char* title = "") const;
73 void Reset();
74 TMap *Next();
75 Bool_t Remove(TMap * map);
76 const char *GetTURL(const char *name = "") ;
77 const char *GetSURL(const char *name = "") ;
78 const char *GetLFN(const char *name = "") ;
79 Long64_t GetSize(const char *name = "") ;
80 Bool_t IsOnline(const char *name = "") ;
81 Bool_t IsSelected(const char *name = "") ;
82 void Status();
83 void SetTag(const char *tag, const char *value, TMap * tagmap);
84 Bool_t SelectFile(const char *name, Int_t /*start*/ = -1, Int_t /*stop*/ = -1);
85 Bool_t DeselectFile(const char *name, Int_t /*start*/ = -1, Int_t /*stop*/ = -1);
88 Bool_t ExportXML(const char *exporturl, Bool_t selected, Bool_t online,
89 const char *name, const char *comment);
90 const char *GetExportUrl() {
91 if (fExportUrl.Length()) return fExportUrl; else return 0;
92 } // return's (if defined) the export url protected:
94 Bool_t SetExportUrl(const char *exporturl = 0);
96 void Print(Option_t * opt) const;
97 TFile *OpenFile(const char *filename) ;
99 TEntryList *GetEntryList(const char *name) ;
103 UInt_t GetNofGroups() const { return fNofGroups; }
108 void Add(TGridCollection *addcollection);
109 void AddFast(TGridCollection *addcollection);
110 Bool_t Stage(Bool_t bulk = kFALSE, Option_t* option = "");
111 Bool_t Prepare(Bool_t bulk = kFALSE) { return Stage(bulk,"option=0"); }
114 TDSet *GetDataset(const char *type, const char *objname = "*", const char *dir = "/");
116 TGridResult *GetGridResult(const char *filename = "",
117 Bool_t onlyonline = kTRUE,
118 Bool_t publicaccess = kFALSE);
120 Bool_t LookupSUrls(Bool_t verbose = kTRUE);
124 void SetTagFilterList(TList * filterlist) { if (fTagFilterList)
125 delete fTagFilterList; fTagFilterList = filterlist;
126 }
128 const char* GetCollectionName() const { return fCollectionName.Data(); }
129 const char* GetInfoComment() const { return fInfoComment.Data(); }
131 static TGridCollection *Open(const char *collectionurl,
132 UInt_t maxentries = 1000000);
133 static TGridCollection *OpenQuery(TGridResult * queryresult,
134 Bool_t nogrouping = kFALSE);
136 Option_t* option = "");
138 const char *GetOutputFileName(const char *infile, Bool_t rename = kTRUE, const char *suffix="root");
140 ClassDef(TAlienCollection, 1) // Manages collection of files on AliEn
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
void Print(Option_t *opt) const
Print event file collection.
const char * GetExportUrl()
TList * GetTagFilterList() const
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.
const char * GetInfoComment() const
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 Prepare(Bool_t bulk=kFALSE)
Bool_t CheckIfOnline(Bool_t bulk=kFALSE)
Run an online check if files are currently accessible (staged) or offline (to be staged).
TList * GetFileGroupList() const
virtual ~TAlienCollection()
Clean up event file collection.
const char * GetCollectionName() const
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...
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).
This class implements a data set to be used for PROOF processing.
Definition TDSet.h:153
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition TFile.h:54
A doubly linked list.
Definition TList.h:44
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition TMap.h:40
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
Definition file.py:1