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 //_________________________________________________________________________
18 // To navigate in the Grid catalogue (very elementary)
19 // check here : /afs/cern.ch/user/p/peters/public/README.ALIEN
20 //-- Author: Yves Schutz (CERN)
22 // --- ROOT system ---
23 #include "TObjString.h"
25 #include "TGridResult.h"
27 // --- Standard library ---
29 // --- AliRoot header files ---
31 #include "AliPHOSGridFile.h"
33 ClassImp(AliPHOSGridFile)
35 //____________________________________________________________________________
36 AliPHOSGridFile::AliPHOSGridFile(TString grid)
38 // default ctor; Doing initialisation ;
41 fGrid = TGrid::Connect("alien://aliendb1.cern.ch:15000/?direct") ;
43 Error("AliPHOSGridFile", " %s is an unknown grid system", grid.Data()) ;
45 Error("ctor", "Cannot connect to alien://aliendb1.cern.ch:15000/?direct") ;
47 fRoot = "/alice/production/aliprod" ;
48 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
49 if ( !fGrid->OpenDir(fRoot) )
50 Error("ctor", "Cannot find directory %s ", fRoot.Data() ) ;
52 Error("AliPHOSGridFile", "needs to be ported to new TGrid");
65 //____________________________________________________________________________
66 AliPHOSGridFile::~AliPHOSGridFile()
70 //____________________________________________________________________________
71 TString AliPHOSGridFile::GetLFN() const
73 TString fileName(Pwd()) ;
74 fileName += "galice.root" ;
75 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
76 if ( !fGrid->GetAccessPath(fileName) ) {
77 AliWarning(Form("file %s does not exist", fileName.Data())) ;
81 fileName.Prepend("alien://") ;
83 Error("GetLFN", "needs to be ported to new TGrid");
88 //____________________________________________________________________________
89 void AliPHOSGridFile::Copy(AliPHOSGridFile & lfn)
91 //Copy method used by the Copy ctor
102 //____________________________________________________________________________
103 void AliPHOSGridFile::Help()
105 // Prints information on available lfn's
111 //____________________________________________________________________________
112 void AliPHOSGridFile::ListEvents() const
114 // list the available events for the current path and run selected
117 sprintf(path, "%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
118 AliInfo(Form("Searching %s", path)) ;
119 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
120 Grid_ResultHandle_t gr = fGrid->Find(path, "galice.root") ;
124 Error("ListEvents", "needs to be ported to new TGrid");
128 //____________________________________________________________________________
129 void AliPHOSGridFile::ListRuns() const
131 // list the available runs for the current path selected
134 sprintf(path, "%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
135 AliInfo(Form("Searching %s", path)) ;
136 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
137 Grid_ResultHandle_t gr = fGrid->OpenDir(path) ;
141 Error("ListRuns", "needs to be ported to new TGrid");
145 //____________________________________________________________________________
146 Bool_t AliPHOSGridFile::SetYearProd(TString year, TString prod)
148 // set the year and verifies if the directory exists
151 sprintf(tempo, "/%s-%s", year.Data(), prod.Data()) ;
153 TString path(fRoot) ;
155 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
156 if ( !fGrid->OpenDir(path) ) {
157 AliError(Form("Cannot find directory %s", path.Data() )) ;
165 Error("SetYearProd", "needs to be ported to new TGrid");
170 //____________________________________________________________________________
171 Bool_t AliPHOSGridFile::SetVers(TString vers)
173 // set the year and verifies if the directory exists
176 sprintf(tempo, "/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
179 TString path(fRoot) ;
181 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
182 if ( !fGrid->OpenDir(path) ) {
183 AliError(Form("Cannot find directory %s ", path.Data() )) ;
190 Error("SetVers", "needs to be ported to new TGrid");
195 //____________________________________________________________________________
196 Bool_t AliPHOSGridFile::SetType(TString type)
198 // set the year and verifies if the directory exists
201 sprintf(tempo, "/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
203 TString path(fRoot) ;
205 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
206 if ( !fGrid->OpenDir(path) ) {
207 AliError(Form("Cannot find directory %s ", path.Data() )) ;
214 Error("SetType", "needs to be ported to new TGrid");
219 //____________________________________________________________________________
220 Bool_t AliPHOSGridFile::SetPath(TString year, TString prod, TString vers, TString type)
222 // set the year and verifies if the directory exists
225 sprintf(tempo, "/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
227 TString path(fRoot) ;
229 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
230 if ( !fGrid->OpenDir(path) ) {
231 AliError(Form("Cannot find directory %s ", path.Data() )) ;
241 Error("SetPath", "needs to be ported to new TGrid");
246 //____________________________________________________________________________
247 Bool_t AliPHOSGridFile::SetRun(Int_t run)
249 // set the year and verifies if the directory exists
252 TString zero("00000") ;
255 Int_t nzero = zero.Length() - srun.Length() ;
257 for (index = 0 ; index < nzero ; index++)
261 sprintf(tempo, "/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.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() )) ;
274 Error("SetRun", "needs to be ported to new TGrid");
279 //____________________________________________________________________________
280 Bool_t AliPHOSGridFile::SetEvt(Int_t evt)
282 // set the year and verifies if the directory exists
285 TString zero("00000") ;
288 Int_t nzero = zero.Length() - sevt.Length() ;
290 for (index = 0 ; index < nzero ; index++)
294 sprintf(tempo, "/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
295 TString path(fRoot) ;
297 #if ROOT_VERSION_CODE < ROOT_VERSION(5,0,0)
298 if ( !fGrid->OpenDir(path) ) {
299 AliError(Form("Cannot find directory %s ", path.Data() )) ;
306 Error("SetEvt", "needs to be ported to new TGrid");