From: hristov Date: Tue, 11 Oct 2005 11:59:34 +0000 (+0000) Subject: Replacing TAlienCollection with TGridResult (P.Christakouglou) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=09c52d4a503bc2643b4c5de9d20bec63a91f1c55;p=u%2Fmrichter%2FAliRoot.git Replacing TAlienCollection with TGridResult (P.Christakouglou) --- diff --git a/STEER/AliTagCreator.cxx b/STEER/AliTagCreator.cxx index cae76a99592..9112448171f 100644 --- a/STEER/AliTagCreator.cxx +++ b/STEER/AliTagCreator.cxx @@ -30,7 +30,7 @@ //ROOT-AliEn #include -#include +//#include #include #include #include @@ -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; } diff --git a/STEER/AliTagCreator.h b/STEER/AliTagCreator.h index 2f2d31d52e4..05e78154104 100644 --- a/STEER/AliTagCreator.h +++ b/STEER/AliTagCreator.h @@ -27,6 +27,7 @@ #include #include #include +#include @@ -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)