Logo ROOT  
Reference Guide
TAlienCollection.h
Go to the documentation of this file.
1 // @(#)root/alien:$Id$
2 // Author: Andreas-Joachim Peters 9/5/2005
3 
4 /*************************************************************************
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  *************************************************************************/
11 
12 #ifndef ROOT_TAlienCollection
13 #define ROOT_TAlienCollection
14 
15 //////////////////////////////////////////////////////////////////////////
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 // //
25 //////////////////////////////////////////////////////////////////////////
26 
27 #include "TGridCollection.h"
28 #include "TString.h"
29 #include "TList.h"
30 #include "TFileStager.h"
31 
32 
33 class TFileCollection;
34 
36 
37 private:
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
54 
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);
58 
59 public:
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);
68 
69  virtual ~TAlienCollection();
70 
71  TFileCollection* GetFileCollection(const char* name = "", const char* title = "") const;
72 
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);
87  Bool_t DownscaleSelection(UInt_t scaler = 2);
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:
93 
94  Bool_t SetExportUrl(const char *exporturl = 0);
95 
96  void Print(Option_t * opt) const;
97  TFile *OpenFile(const char *filename) ;
98 
99  TEntryList *GetEntryList(const char *name) ;
100 
101  TList *GetFileGroupList() const { return fFileGroupList; }
102 
103  UInt_t GetNofGroups() const { return fNofGroups; }
104 
106 
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"); }
112 
114  TDSet *GetDataset(const char *type, const char *objname = "*", const char *dir = "/");
115 
116  TGridResult *GetGridResult(const char *filename = "",
117  Bool_t onlyonline = kTRUE,
118  Bool_t publicaccess = kFALSE);
119 
121 
122  TList *GetTagFilterList() const { return fTagFilterList; }
123 
124  void SetTagFilterList(TList * filterlist) { if (fTagFilterList)
125  delete fTagFilterList; fTagFilterList = filterlist;
126  }
127 
128  const char* GetCollectionName() const { return fCollectionName.Data(); }
129  const char* GetInfoComment() const { return fInfoComment.Data(); }
130 
131  static TGridCollection *Open(const char *collectionurl,
132  UInt_t maxentries = 1000000);
133  static TGridCollection *OpenQuery(TGridResult * queryresult,
134  Bool_t nogrouping = kFALSE);
135  static TAlienCollection *OpenAlienCollection(TGridResult * queryresult,
136  Option_t* option = "");
137 
138  const char *GetOutputFileName(const char *infile, Bool_t rename = kTRUE, const char *suffix="root");
139 
140  ClassDef(TAlienCollection, 1) // Manages collection of files on AliEn
141 };
142 
143 #endif
TAlienCollection::fXmlFile
TString fXmlFile
Definition: TAlienCollection.h:38
TAlienCollection::TAlienCollection
TAlienCollection()
Definition: TAlienCollection.h:60
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TAlienCollection::GetFileGroupList
TList * GetFileGroupList() const
Definition: TAlienCollection.h:101
TAlienCollection::OverlapCollection
Bool_t OverlapCollection(TGridCollection *comparator)
return kTRUE if comparator overlaps with this all objects in this collection, which are not defined i...
Definition: TAlienCollection.cxx:901
TGridCollection
Definition: TGridCollection.h:34
TAlienCollection::fLastOutFileName
TString fLastOutFileName
Definition: TAlienCollection.h:48
TAlienCollection::OpenQuery
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...
Definition: TAlienCollection.cxx:195
TAlienCollection::Status
void Status()
Prints statistics, selection and status about the loaded collection.
Definition: TAlienCollection.cxx:456
TAlienCollection::GetInfoComment
const char * GetInfoComment() const
Definition: TAlienCollection.h:129
TAlienCollection::GetCollectionName
const char * GetCollectionName() const
Definition: TAlienCollection.h:128
TString::Data
const char * Data() const
Definition: TString.h:369
TAlienCollection::LookupSUrls
Bool_t LookupSUrls(Bool_t verbose=kTRUE)
retrieves all the SURLS for the LFNS
Definition: TAlienCollection.cxx:985
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TAlienCollection::fNofGroupfiles
UInt_t fNofGroupfiles
Definition: TAlienCollection.h:43
TAlienCollection::GetSURL
const char * GetSURL(const char *name="")
Get a file's storage URL (SURL). Returns 0 in case of error.
Definition: TAlienCollection.cxx:716
TAlienCollection::GetTURL
const char * GetTURL(const char *name="")
Get a file's transport URL (TURL). Returns 0 in case of error.
Definition: TAlienCollection.cxx:699
Int_t
int Int_t
Definition: RtypesCore.h:45
TAlienCollection::SetTagFilterList
void SetTagFilterList(TList *filterlist)
Definition: TAlienCollection.h:124
TAlienCollection::ExportXML
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.
Definition: TAlienCollection.cxx:1317
TAlienCollection::GetNofGroups
UInt_t GetNofGroups() const
Definition: TAlienCollection.h:103
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TAlienCollection::GetTagFilterList
TList * GetTagFilterList() const
Definition: TAlienCollection.h:122
TList.h
TAlienCollection::Reset
void Reset()
Reset file iterator.
Definition: TAlienCollection.cxx:278
TString
Definition: TString.h:136
TAlienCollection::fExportUrl
TString fExportUrl
pointer to the file stager object
Definition: TAlienCollection.h:50
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TAlienCollection::DownscaleSelection
Bool_t DownscaleSelection(UInt_t scaler=2)
downscales the selection with scaler
Definition: TAlienCollection.cxx:660
TAlienCollection::Remove
Bool_t Remove(TMap *map)
Return next event file map.
Definition: TAlienCollection.cxx:687
TAlienCollection::GetNofGroupfiles
UInt_t GetNofGroupfiles() const
Definition: TAlienCollection.h:105
TString.h
bool
TAlienCollection::Next
TMap * Next()
Return next event file map.
Definition: TAlienCollection.cxx:447
TAlienCollection::GetGridResult
TGridResult * GetGridResult(const char *filename="", Bool_t onlyonline=kTRUE, Bool_t publicaccess=kFALSE)
Return a TGridResult.
Definition: TAlienCollection.cxx:873
TAlienCollection::fTagFilterList
TList * fTagFilterList
Definition: TAlienCollection.h:53
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TAlienCollection::fCurrent
TMap * fCurrent
event file list iterator
Definition: TAlienCollection.h:41
TAlienCollection::OpenFile
TFile * OpenFile(const char *filename)
Open the file specified by <filename> from the currently active file group in the collection via its ...
Definition: TAlienCollection.cxx:145
TAlienCollection::fHasSelection
Bool_t fHasSelection
Definition: TAlienCollection.h:45
TGridResult
Definition: TGridResult.h:31
TFileStager
Definition: TFileStager.h:36
TAlienCollection::AddFast
void AddFast(TGridCollection *addcollection)
adds <addcollection> to this collection - NO check for identical elements
Definition: TAlienCollection.cxx:969
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TAlienCollection::GetExportUrl
const char * GetExportUrl()
Definition: TAlienCollection.h:90
TAlienCollection::GetSize
Long64_t GetSize(const char *name="")
Get a file's LFN. Returns 0 in case of error.
Definition: TAlienCollection.cxx:813
TAlienCollection::GetLFN
const char * GetLFN(const char *name="")
Get a file's LFN. Returns 0 in case of error.
Definition: TAlienCollection.cxx:796
TAlienCollection::IsOnline
Bool_t IsOnline(const char *name="")
Get a file's online tag. Returns false if not online or CheckIfOnline was never executed,...
Definition: TAlienCollection.cxx:733
TAlienCollection::ParseXML
virtual void ParseXML(UInt_t maxentries)
Parse event file collection XML file.
Definition: TAlienCollection.cxx:288
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TAlienCollection::fFileGroupList
TList * fFileGroupList
Definition: TAlienCollection.h:39
TAlienCollection::InvertSelection
Bool_t InvertSelection()
Invert the selection.
Definition: TAlienCollection.cxx:633
TAlienCollection::~TAlienCollection
virtual ~TAlienCollection()
Clean up event file collection.
Definition: TAlienCollection.cxx:95
TGridCollection.h
TDSet
Definition: TDSet.h:153
TAlienCollection::DeselectFile
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...
Definition: TAlienCollection.cxx:601
TFile
Definition: TFile.h:54
TAlienCollection::Prepare
Bool_t Prepare(Bool_t bulk=kFALSE)
Definition: TAlienCollection.h:111
unsigned int
TEntryList
Definition: TEntryList.h:25
TAlienCollection::Print
void Print(Option_t *opt) const
Print event file collection.
Definition: TAlienCollection.cxx:832
TAlienCollection::IsSelected
Bool_t IsSelected(const char *name="")
Get a file's online tag. Returns false if not online or CheckIfOnline was never executed,...
Definition: TAlienCollection.cxx:756
TAlienCollection::CheckIfOnline
Bool_t CheckIfOnline(Bool_t bulk=kFALSE)
Run an online check if files are currently accessible (staged) or offline (to be staged).
Definition: TAlienCollection.cxx:1115
TAlienCollection::SetTag
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....
Definition: TAlienCollection.cxx:549
TAlienCollection::OpenAlienCollection
static TAlienCollection * OpenAlienCollection(TGridResult *queryresult, Option_t *option="")
Static method used to create an Alien event collection, by creating collection from a TGridResult Get...
Definition: TAlienCollection.cxx:158
file
Definition: file.py:1
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TAlienCollection::fHasOnline
Bool_t fHasOnline
Definition: TAlienCollection.h:47
TAlienCollection::Add
void Add(TGridCollection *addcollection)
adds <addcollection> to this collection - equal elements are skipped
Definition: TAlienCollection.cxx:935
TAlienCollection::fFileStager
TFileStager * fFileStager
Definition: TAlienCollection.h:49
TAlienCollection
Definition: TAlienCollection.h:35
name
char name[80]
Definition: TGX11.cxx:110
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
TAlienCollection::GetOutputFileName
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.
Definition: TAlienCollection.cxx:1520
TIter
Definition: TCollection.h:233
TAlienCollection::fInfoComment
TString fInfoComment
Definition: TAlienCollection.h:51
TFileStager.h
TAlienCollection::SetExportUrl
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...
Definition: TAlienCollection.cxx:1493
TAlienCollection::GetDataset
TDSet * GetDataset(const char *type, const char *objname="*", const char *dir="/")
Return a TDSet from a collection.
Definition: TAlienCollection.cxx:849
ROOT::TMetaUtils::propNames::comment
static const std::string comment("comment")
type
int type
Definition: TGX11.cxx:121
TAlienCollection::Open
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...
Definition: TAlienCollection.cxx:112
TAlienCollection::fNofGroups
UInt_t fNofGroups
current event file map
Definition: TAlienCollection.h:42
TAlienCollection::SelectFile
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...
Definition: TAlienCollection.cxx:568
TAlienCollection::fFileGroupListIter
TIter * fFileGroupListIter
Definition: TAlienCollection.h:40
TAlienCollection::fCollectionName
TString fCollectionName
Definition: TAlienCollection.h:52
TAlienCollection::fHasSUrls
Bool_t fHasSUrls
Definition: TAlienCollection.h:44
TList
Definition: TList.h:44
TAlienCollection::GetFileCollection
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...
Definition: TAlienCollection.cxx:1597
TAlienCollection::GetEntryList
TEntryList * GetEntryList(const char *name)
Get a file's event list. Returns 0 in case of error.
Definition: TAlienCollection.cxx:779
TAlienCollection::Stage
Bool_t Stage(Bool_t bulk=kFALSE, Option_t *option="")
Execute the 'stage' method for all files in this collection (trigger staging).
Definition: TAlienCollection.cxx:1041
TFileCollection
Definition: TFileCollection.h:39
TMap
Definition: TMap.h:40