]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Replacing TAlienCollection with TGridResult (P.Christakouglou)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Oct 2005 11:59:34 +0000 (11:59 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Oct 2005 11:59:34 +0000 (11:59 +0000)
STEER/AliTagCreator.cxx
STEER/AliTagCreator.h

index cae76a9959226c9e169c13d16f81de58cc69c50d..9112448171ffd447aa95d050dd376f5f3aa032ed 100644 (file)
@@ -30,7 +30,7 @@
 
 //ROOT-AliEn
 #include <TGrid.h>
-#include <TAlienCollection.h>
+//#include <TAlienCollection.h>
 #include <TGridResult.h>
 #include <TFileMerger.h>
 #include <TMap.h>
@@ -62,15 +62,16 @@ AliTagCreator::AliTagCreator() //local mode
   fUser = "";
   fPasswd = "";  
   fSE = "";   
-  fCollectionFile = "";
   fHost = "";
   fPort = 0; 
+  fresult = 0;
 }
 
 //______________________________________________________________________________
 AliTagCreator::AliTagCreator(const char *host, Int_t port, const char *username)
 {
   //==============Default constructor for a AliTagCreator==================
+  fresult = 0;
   fHost = host;
   fUser = username;
   fPort = port;
@@ -94,6 +95,7 @@ AliTagCreator::AliTagCreator(const char *host, Int_t port, const char *username)
 AliTagCreator::AliTagCreator(const char *host, Int_t port, const char *username, const char *passwd)
 {
   //==============Default constructor for a AliTagCreator==================
+  fresult = 0;
   fHost = host;
   fUser = username;
   fPasswd = passwd;
@@ -150,53 +152,27 @@ Bool_t AliTagCreator::ConnectToGrid(const char *host, Int_t port, const char *us
 }
 
 //______________________________________________________________________________
-Bool_t AliTagCreator::ReadESDCollection(const char *CollectionFile)
+Bool_t AliTagCreator::ReadESDCollection(TGridResult *res)
 {
-  fCollectionFile = CollectionFile;
+  fresult = res;
+  Int_t NEntries = fresult->GetEntries();
 
-  gSystem->Load("libXMLIO.so");
-  gSystem->Load("libXMLParser.so");
-  //define the tag collection
-  TAlienCollection *collection = new TAlienCollection(fCollectionFile.Data());
-  collection->Reset();
-
-  TMap *map;
-  TPair *pair;
-   
   TString gridname = "alien://";
-  Int_t gridnameSize = gridname.Sizeof();
-  TString Esd = "AliEsds.root";
-  
-  TString EsdFilePath;
   TString AlienUrl;
-  TString lfn;
   const char *guid;
-  TString EsdPattern = "/alien";
  
   Int_t counter = 0;
-  while((map = collection->Next()))
-    { 
-      TIter next(map->GetTable());
+  for(Int_t i = 0; i < NEntries; i++)
+    {
+      AlienUrl = gridname;
+      AlienUrl += fresult->GetKey(i,"lfn");
+      guid = fresult->GetKey(i,"guid");
+      TFile *f = TFile::Open(AlienUrl,"READ");
+      CreateTag(f,guid,counter);
+      f->Close();
+      delete f;         
       counter += 1;
-      while ((pair = (TPair*) next()))
-       {
-         EsdFilePath = pair->Key()->GetName();
-         AlienUrl = collection->GetTURL(EsdFilePath);
-         EsdFilePath = pair->Value()->GetName();
-         
-         lfn = EsdFilePath.Replace(0,gridnameSize-1,EsdFilePath,0);
-         //TAlienFile *f = new TAlienFile(AlienUrl,"READ");
-         //TFile *f = new TFile(AlienUrl,"READ");
-         TFile *f = TFile::Open(AlienUrl,"READ");
-        
-         TGridResult* result = gGrid->Ls(lfn,"-b");
-         guid = result->GetKey(0,"guid");
-         
-         CreateTag(f,guid,counter);
-         f->Close();
-         delete f;
-       }//key loop
-    }//collection loop
+    }//grid result loop
 
   return kTRUE;
 }
index 2f2d31d52e4efc703aba6d3a94d3a7186e7632d6..05e78154104ee8adb192a6ca66c4519f6ca9649e 100644 (file)
@@ -27,6 +27,7 @@
 #include <TObject.h>
 #include <TFile.h>
 #include <TSystem.h>
+#include <TGridResult.h>
 
 
 
@@ -36,11 +37,10 @@ class AliTagCreator : public TObject {
   TString fUser; //the username in AliEn
   TString fPasswd;   //the username's password
   TString fSE;   //the defined storage element
-  TString fCollectionFile; //the xml collection file
   TString fHost; //the defined AliEn host
   Int_t fPort;  //the defined port for the host login
-  
-  //void CreateTag(TAlienFile* file, const char *guid, Int_t Counter);
+  TGridResult *fresult; //the results from the grid query
+
   void CreateTag(TFile* file, const char *guid, Int_t Counter);
 
  public:
@@ -51,7 +51,7 @@ class AliTagCreator : public TObject {
 
   void SetSE(const char *se);
   Bool_t ConnectToGrid(const char *host, Int_t port, const char *username);
-  Bool_t ReadESDCollection(const char *CollectionFile);
+  Bool_t ReadESDCollection(TGridResult *result);
   Bool_t StoreGridTagFile(const char *localpath, const char *gridpath);
 
   ClassDef(AliTagCreator,0)