1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 /* History of cvs commits:
20 * Revision 1.5 2005/05/28 14:19:04 schutz
21 * Compilation warnings fixed by T.P.
25 //_________________________________________________________________________
26 // To navigate in the Grid catalogue (very elementary)
27 // check here : /afs/cern.ch/user/p/peters/public/README.ALIEN
28 //-- Author: Yves Schutz (CERN)
30 // --- ROOT system ---
31 #include "TObjString.h"
33 #include "TGridResult.h"
35 // --- Standard library ---
37 // --- AliRoot header files ---
39 #include "AliPHOSGridFile.h"
41 ClassImp(AliPHOSGridFile)
43 //____________________________________________________________________________
44 AliPHOSGridFile::AliPHOSGridFile(TString grid):
46 fRoot("/alice/production/aliprod"),
55 // default ctor; Doing initialisation ;
57 fGrid = TGrid::Connect("alien://aliendb1.cern.ch:15000/?direct") ;
59 Error("AliPHOSGridFile", " %s is an unknown grid system", grid.Data()) ;
61 Error("ctor", "Cannot connect to alien://aliendb1.cern.ch:15000/?direct") ;
63 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
64 if ( !fGrid->OpenDir(fRoot) )
65 Error("ctor", "Cannot find directory %s ", fRoot.Data() ) ;
67 Error("AliPHOSGridFile", "needs to be ported to new TGrid");
73 //____________________________________________________________________________
74 AliPHOSGridFile::AliPHOSGridFile(const AliPHOSGridFile &rhs) :
90 //____________________________________________________________________________
91 AliPHOSGridFile::~AliPHOSGridFile()
95 //____________________________________________________________________________
96 TString AliPHOSGridFile::GetLFN() const
98 TString fileName(Pwd()) ;
99 fileName += "galice.root" ;
100 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
101 if ( !fGrid->GetAccessPath(fileName) ) {
102 AliWarning(Form("file %s does not exist", fileName.Data())) ;
106 fileName.Prepend("alien://") ;
108 Error("GetLFN", "needs to be ported to new TGrid");
113 //____________________________________________________________________________
114 void AliPHOSGridFile::Copy(TObject & obj)const
116 //Copy method used by the Copy ctor
117 AliPHOSGridFile &lfn = static_cast<AliPHOSGridFile &>(obj);
118 /* incorrect Copy, destination is OBJ, not this.
138 //____________________________________________________________________________
139 void AliPHOSGridFile::Help()
141 // Prints information on available lfn's
147 //____________________________________________________________________________
148 void AliPHOSGridFile::ListEvents() const
150 // list the available events for the current path and run selected
153 sprintf(path, "%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
154 AliInfo(Form("Searching %s", path)) ;
155 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
156 Grid_ResultHandle_t gr = fGrid->Find(path, "galice.root") ;
160 Error("ListEvents", "needs to be ported to new TGrid");
164 //____________________________________________________________________________
165 void AliPHOSGridFile::ListRuns() const
167 // list the available runs for the current path selected
170 sprintf(path, "%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
171 AliInfo(Form("Searching %s", path)) ;
172 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
173 Grid_ResultHandle_t gr = fGrid->OpenDir(path) ;
177 Error("ListRuns", "needs to be ported to new TGrid");
181 //____________________________________________________________________________
182 Bool_t AliPHOSGridFile::SetYearProd(TString year, TString prod)
184 // set the year and verifies if the directory exists
187 sprintf(tempo, "/%s-%s", year.Data(), prod.Data()) ;
189 TString path(fRoot) ;
191 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
192 if ( !fGrid->OpenDir(path) ) {
193 AliError(Form("Cannot find directory %s", path.Data() )) ;
201 Error("SetYearProd", "needs to be ported to new TGrid");
206 //____________________________________________________________________________
207 Bool_t AliPHOSGridFile::SetVers(TString vers)
209 // set the year and verifies if the directory exists
212 sprintf(tempo, "/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
215 TString path(fRoot) ;
217 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
218 if ( !fGrid->OpenDir(path) ) {
219 AliError(Form("Cannot find directory %s ", path.Data() )) ;
226 Error("SetVers", "needs to be ported to new TGrid");
231 //____________________________________________________________________________
232 Bool_t AliPHOSGridFile::SetType(TString type)
234 // set the year and verifies if the directory exists
237 sprintf(tempo, "/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
239 TString path(fRoot) ;
241 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
242 if ( !fGrid->OpenDir(path) ) {
243 AliError(Form("Cannot find directory %s ", path.Data() )) ;
250 Error("SetType", "needs to be ported to new TGrid");
255 //____________________________________________________________________________
256 Bool_t AliPHOSGridFile::SetPath(TString year, TString prod, TString vers, TString type)
258 // set the year and verifies if the directory exists
261 sprintf(tempo, "/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
263 TString path(fRoot) ;
265 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
266 if ( !fGrid->OpenDir(path) ) {
267 AliError(Form("Cannot find directory %s ", path.Data() )) ;
277 Error("SetPath", "needs to be ported to new TGrid");
282 //____________________________________________________________________________
283 Bool_t AliPHOSGridFile::SetRun(Int_t run)
285 // set the year and verifies if the directory exists
288 TString zero("00000") ;
291 Int_t nzero = zero.Length() - srun.Length() ;
293 for (index = 0 ; index < nzero ; index++)
297 sprintf(tempo, "/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.Data()) ;
299 TString path(fRoot) ;
301 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
302 if ( !fGrid->OpenDir(path) ) {
303 AliError(Form("Cannot find directory %s ", path.Data() )) ;
310 Error("SetRun", "needs to be ported to new TGrid");
315 //____________________________________________________________________________
316 Bool_t AliPHOSGridFile::SetEvt(Int_t evt)
318 // set the year and verifies if the directory exists
321 TString zero("00000") ;
324 Int_t nzero = zero.Length() - sevt.Length() ;
326 for (index = 0 ; index < nzero ; index++)
330 sprintf(tempo, "/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
331 TString path(fRoot) ;
333 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
334 if ( !fGrid->OpenDir(path) ) {
335 AliError(Form("Cannot find directory %s ", path.Data() )) ;
342 Error("SetEvt", "needs to be ported to new TGrid");