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:
22 //_________________________________________________________________________
23 // To navigate in the Grid catalogue (very elementary)
24 // check here : /afs/cern.ch/user/p/peters/public/README.ALIEN
25 //-- Author: Yves Schutz (CERN)
27 // --- ROOT system ---
28 #include "TObjString.h"
30 #include "TGridResult.h"
32 // --- Standard library ---
34 // --- AliRoot header files ---
36 #include "AliPHOSGridFile.h"
38 ClassImp(AliPHOSGridFile)
40 //____________________________________________________________________________
41 AliPHOSGridFile::AliPHOSGridFile(TString grid)
43 // default ctor; Doing initialisation ;
46 fGrid = TGrid::Connect("alien://aliendb1.cern.ch:15000/?direct") ;
48 Error("AliPHOSGridFile", " %s is an unknown grid system", grid.Data()) ;
50 Error("ctor", "Cannot connect to alien://aliendb1.cern.ch:15000/?direct") ;
52 fRoot = "/alice/production/aliprod" ;
53 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
54 if ( !fGrid->OpenDir(fRoot) )
55 Error("ctor", "Cannot find directory %s ", fRoot.Data() ) ;
57 Error("AliPHOSGridFile", "needs to be ported to new TGrid");
70 //____________________________________________________________________________
71 AliPHOSGridFile::~AliPHOSGridFile()
75 //____________________________________________________________________________
76 TString AliPHOSGridFile::GetLFN() const
78 TString fileName(Pwd()) ;
79 fileName += "galice.root" ;
80 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
81 if ( !fGrid->GetAccessPath(fileName) ) {
82 AliWarning(Form("file %s does not exist", fileName.Data())) ;
86 fileName.Prepend("alien://") ;
88 Error("GetLFN", "needs to be ported to new TGrid");
93 //____________________________________________________________________________
94 void AliPHOSGridFile::Copy(TObject & obj)const
96 //Copy method used by the Copy ctor
97 AliPHOSGridFile &lfn = static_cast<AliPHOSGridFile &>(obj);
98 /* incorrect Copy, destination is OBJ, not this.
118 //____________________________________________________________________________
119 void AliPHOSGridFile::Help()
121 // Prints information on available lfn's
127 //____________________________________________________________________________
128 void AliPHOSGridFile::ListEvents() const
130 // list the available events for the current path and run selected
133 sprintf(path, "%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
134 AliInfo(Form("Searching %s", path)) ;
135 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
136 Grid_ResultHandle_t gr = fGrid->Find(path, "galice.root") ;
140 Error("ListEvents", "needs to be ported to new TGrid");
144 //____________________________________________________________________________
145 void AliPHOSGridFile::ListRuns() const
147 // list the available runs for the current path selected
150 sprintf(path, "%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
151 AliInfo(Form("Searching %s", path)) ;
152 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
153 Grid_ResultHandle_t gr = fGrid->OpenDir(path) ;
157 Error("ListRuns", "needs to be ported to new TGrid");
161 //____________________________________________________________________________
162 Bool_t AliPHOSGridFile::SetYearProd(TString year, TString prod)
164 // set the year and verifies if the directory exists
167 sprintf(tempo, "/%s-%s", year.Data(), prod.Data()) ;
169 TString path(fRoot) ;
171 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
172 if ( !fGrid->OpenDir(path) ) {
173 AliError(Form("Cannot find directory %s", path.Data() )) ;
181 Error("SetYearProd", "needs to be ported to new TGrid");
186 //____________________________________________________________________________
187 Bool_t AliPHOSGridFile::SetVers(TString vers)
189 // set the year and verifies if the directory exists
192 sprintf(tempo, "/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
195 TString path(fRoot) ;
197 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
198 if ( !fGrid->OpenDir(path) ) {
199 AliError(Form("Cannot find directory %s ", path.Data() )) ;
206 Error("SetVers", "needs to be ported to new TGrid");
211 //____________________________________________________________________________
212 Bool_t AliPHOSGridFile::SetType(TString type)
214 // set the year and verifies if the directory exists
217 sprintf(tempo, "/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
219 TString path(fRoot) ;
221 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
222 if ( !fGrid->OpenDir(path) ) {
223 AliError(Form("Cannot find directory %s ", path.Data() )) ;
230 Error("SetType", "needs to be ported to new TGrid");
235 //____________________________________________________________________________
236 Bool_t AliPHOSGridFile::SetPath(TString year, TString prod, TString vers, TString type)
238 // set the year and verifies if the directory exists
241 sprintf(tempo, "/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
243 TString path(fRoot) ;
245 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
246 if ( !fGrid->OpenDir(path) ) {
247 AliError(Form("Cannot find directory %s ", path.Data() )) ;
257 Error("SetPath", "needs to be ported to new TGrid");
262 //____________________________________________________________________________
263 Bool_t AliPHOSGridFile::SetRun(Int_t run)
265 // set the year and verifies if the directory exists
268 TString zero("00000") ;
271 Int_t nzero = zero.Length() - srun.Length() ;
273 for (index = 0 ; index < nzero ; index++)
277 sprintf(tempo, "/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.Data()) ;
279 TString path(fRoot) ;
281 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
282 if ( !fGrid->OpenDir(path) ) {
283 AliError(Form("Cannot find directory %s ", path.Data() )) ;
290 Error("SetRun", "needs to be ported to new TGrid");
295 //____________________________________________________________________________
296 Bool_t AliPHOSGridFile::SetEvt(Int_t evt)
298 // set the year and verifies if the directory exists
301 TString zero("00000") ;
304 Int_t nzero = zero.Length() - sevt.Length() ;
306 for (index = 0 ; index < nzero ; index++)
310 sprintf(tempo, "/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
311 TString path(fRoot) ;
313 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
314 if ( !fGrid->OpenDir(path) ) {
315 AliError(Form("Cannot find directory %s ", path.Data() )) ;
322 Error("SetEvt", "needs to be ported to new TGrid");