TAlienCollection.h

Go to the documentation of this file.
00001 // @(#)root/alien:$Id: TAlienCollection.h 23026 2008-04-07 16:48:41Z rdm $
00002 // Author: Andreas-Joachim Peters 9/5/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TAlienCollection
00013 #define ROOT_TAlienCollection
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TAlienCollection                                                     //
00018 //                                                                      //
00019 // Class which manages collection of files on AliEn middleware.         //
00020 // The file collection is in the form of an XML file.                   //
00021 //                                                                      //
00022 // The internal list is managed as follows:                             //
00023 // TList* ===> TMap*(file) ===> TMap*(attributes)                       //
00024 //                                                                      //
00025 //////////////////////////////////////////////////////////////////////////
00026 
00027 #ifndef ROOT_TGridCollection
00028 #include "TGridCollection.h"
00029 #endif
00030 #ifndef ROOT_TString
00031 #include "TString.h"
00032 #endif
00033 #ifndef ROOT_TList
00034 #include "TList.h"
00035 #endif
00036 #ifndef ROOT_TFileStager
00037 #include "TFileStager.h"
00038 #endif
00039 
00040 
00041 class TFileCollection;
00042 
00043 class TAlienCollection : public TGridCollection {
00044 
00045 private:
00046    TString      fXmlFile;            // collection XML file
00047    TList       *fFileGroupList;      //-> list with event file maps
00048    TIter       *fFileGroupListIter;  //! event file list iterator
00049    TMap        *fCurrent;            //! current event file map
00050    UInt_t       fNofGroups;          // number of file groups
00051    UInt_t       fNofGroupfiles;      // number of files per group
00052    Bool_t       fHasSUrls;           // defines if SURLs are present in the collection
00053    Bool_t       fHasSelection;       // defines if the user made some selection on the files to be exported for processing
00054    Bool_t       fHasOnline;          // defines if the collection was checked for the online status
00055    TString      fLastOutFileName;    // keeps the latest outputfilename produced with GetOutputFileName
00056    TFileStager *fFileStager;         //! pointer to the file stager object
00057    TString      fExportUrl;          // defines the url where to store back this collection
00058    TString      fInfoComment;        // comment in the info section of the XML file
00059    TString      fCollectionName;     // name of the collection in the collection section of the XML file
00060    TList       *fTagFilterList;      //-> list of TObjStrings with tags to filter out in export operations
00061 
00062    virtual void ParseXML(UInt_t maxentries);
00063    Bool_t ExportXML(TFile * file, Bool_t selected, Bool_t online,
00064                     const char *name, const char *comment);
00065 
00066 public:
00067    TAlienCollection() : fFileGroupList(0), fFileGroupListIter(0), fCurrent(0),
00068        fNofGroups(0), fNofGroupfiles(0), fHasSUrls(0), fHasSelection(0),
00069        fFileStager(0), fExportUrl(""), fInfoComment(""), fCollectionName("unnamed"), fTagFilterList(0)
00070       { }
00071    TAlienCollection(TList *eventlist, UInt_t ngroups = 0,
00072                     UInt_t ngroupfiles = 0);
00073    TAlienCollection(const char *localCollectionFile, UInt_t maxentries);
00074 
00075    virtual ~TAlienCollection();
00076 
00077    TFileCollection* GetFileCollection(const char* name = "", const char* title = "") const;
00078 
00079    void        Reset();
00080    TMap       *Next();
00081    Bool_t      Remove(TMap * map);
00082    const char *GetTURL(const char *name = "") ;
00083    const char *GetSURL(const char *name = "") ;
00084    const char *GetLFN(const char *name = "") ;
00085    Long64_t    GetSize(const char *name = "") ;
00086    Bool_t      IsOnline(const char *name = "") ;
00087    Bool_t      IsSelected(const char *name = "") ;
00088    void        Status();
00089    void        SetTag(const char *tag, const char *value, TMap * tagmap);
00090    Bool_t      SelectFile(const char *name, Int_t /*start*/ = -1, Int_t /*stop*/ = -1);
00091    Bool_t      DeselectFile(const char *name, Int_t /*start*/ = -1, Int_t /*stop*/ = -1);
00092    Bool_t      InvertSelection();
00093    Bool_t      DownscaleSelection(UInt_t scaler = 2);
00094    Bool_t      ExportXML(const char *exporturl, Bool_t selected, Bool_t online,
00095                          const char *name, const char *comment);
00096    const char *GetExportUrl() {
00097      if (fExportUrl.Length()) return fExportUrl; else return 0;
00098    } // return's (if defined) the export url protected:
00099 
00100    Bool_t      SetExportUrl(const char *exporturl = 0);
00101 
00102    void        Print(Option_t * opt) const;
00103    TFile      *OpenFile(const char *filename) ;
00104 
00105    TEntryList *GetEntryList(const char *name) ;
00106 
00107    TList      *GetFileGroupList() const { return fFileGroupList; }
00108 
00109    UInt_t      GetNofGroups() const { return fNofGroups; }
00110 
00111    UInt_t      GetNofGroupfiles() const { return fNofGroupfiles; }
00112 
00113    Bool_t      OverlapCollection(TGridCollection *comparator);
00114    void        Add(TGridCollection *addcollection);
00115    Bool_t      Stage(Bool_t bulk = kFALSE, Option_t* option = "");
00116    Bool_t      Prepare(Bool_t bulk = kFALSE) { return Stage(bulk,"option=0"); }
00117 
00118    Bool_t      CheckIfOnline(Bool_t bulk = kFALSE);
00119    TDSet      *GetDataset(const char *type, const char *objname = "*", const char *dir = "/");
00120 
00121    TGridResult *GetGridResult(const char *filename = "",
00122                               Bool_t onlyonline = kTRUE,
00123                               Bool_t publicaccess = kFALSE);
00124 
00125    Bool_t      LookupSUrls(Bool_t verbose = kTRUE);
00126 
00127    TList      *GetTagFilterList() const { return fTagFilterList; }
00128 
00129    void        SetTagFilterList(TList * filterlist) { if (fTagFilterList)
00130      delete fTagFilterList; fTagFilterList = filterlist;
00131    }
00132 
00133    const char* GetCollectionName() const { return fCollectionName.Data(); }
00134    const char* GetInfoComment() const { return fInfoComment.Data(); }
00135 
00136    static TGridCollection *Open(const char *collectionurl,
00137                                 UInt_t maxentries = 1000000);
00138    static TGridCollection *OpenQuery(TGridResult * queryresult,
00139                                      Bool_t nogrouping = kFALSE);
00140    static TAlienCollection *OpenAlienCollection(TGridResult * queryresult,
00141                                              Option_t* option = "");
00142 
00143    const char *GetOutputFileName(const char *infile, Bool_t rename = kTRUE, const char *suffix="root");
00144 
00145    ClassDef(TAlienCollection, 1) // Manages collection of files on AliEn
00146 };
00147 
00148 #endif

Generated on Tue Jul 5 14:45:28 2011 for ROOT_528-00b_version by  doxygen 1.5.1