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 AliEn 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"
24 #include "TAlienResult.h"
26 // --- Standard library ---
28 // --- AliRoot header files ---
30 #include "AliPHOSAliEnFile.h"
32 ClassImp(AliPHOSAliEnFile) ;
34 //____________________________________________________________________________
35 AliPHOSAliEnFile::AliPHOSAliEnFile()
37 // default ctor; Doing initialisation ;
39 fGrid = TGrid::Connect("alien://aliendb1.cern.ch:15000/?direct") ;
41 Fatal("ctor", "Cannot connect to alien://aliendb1.cern.ch:15000/?direct") ;
43 fRoot = "/alice/production/aliprod" ;
44 if ( !fGrid->OpenDir(fRoot) )
45 Fatal("ctor", "Cannot find directory %s ", fRoot.Data() ) ;
58 //____________________________________________________________________________
59 AliPHOSAliEnFile::~AliPHOSAliEnFile()
63 //____________________________________________________________________________
64 TString AliPHOSAliEnFile::GetLFN() const
66 TString fileName(Pwd()) ;
67 fileName += "galice.root" ;
68 if ( !fGrid->GetAccessPath(fileName) ) {
69 Warning("GetLFN", "file %s does not exist", fileName.Data()) ;
73 fileName.Prepend("alien://") ;
77 //____________________________________________________________________________
78 void AliPHOSAliEnFile::Copy(AliPHOSAliEnFile & lfn)
80 //Copy method used by the Copy ctor
91 //____________________________________________________________________________
92 void AliPHOSAliEnFile::Help()
94 // Prints information on available lfn's
100 //____________________________________________________________________________
101 void AliPHOSAliEnFile::ListEvents() const
103 // list the available events for the current path and run selected
106 sprintf(path, "%s/%s-%s/%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data()) ;
107 Info("ListEvents", "Searching %s", path) ;
108 Grid_ResultHandle_t gr = fGrid->Find(path, "galice.root") ;
109 TAlienResult ar(gr) ;
113 //____________________________________________________________________________
114 void AliPHOSAliEnFile::ListRuns() const
116 // list the available runs for the current path selected
119 sprintf(path, "%s/%s-%s/%s/%s", fRoot.Data(), fYear.Data(), fProd.Data(), fVers.Data(), fType.Data()) ;
120 Info("ListEvents", "Searching %s", path) ;
121 Grid_ResultHandle_t gr = fGrid->OpenDir(path) ;
122 TAlienResult ar(gr) ;
126 //____________________________________________________________________________
127 Bool_t AliPHOSAliEnFile::SetYearProd(TString year, TString prod)
129 // set the year and verifies if the directory exists
132 sprintf(tempo, "/%s-%s", year.Data(), prod.Data()) ;
134 TString path(fRoot) ;
136 if ( !fGrid->OpenDir(path) )
137 Error("ctor", "Cannot find directory %s ", path.Data() ) ;
147 //____________________________________________________________________________
148 Bool_t AliPHOSAliEnFile::SetVers(TString vers)
150 // set the year and verifies if the directory exists
153 sprintf(tempo, "/%s-%s/%s", fYear.Data(), fProd.Data(), vers.Data()) ;
156 TString path(fRoot) ;
158 if ( !fGrid->OpenDir(path) )
159 Error("ctor", "Cannot find directory %s ", path.Data() ) ;
168 //____________________________________________________________________________
169 Bool_t AliPHOSAliEnFile::SetType(TString type)
171 // set the year and verifies if the directory exists
174 sprintf(tempo, "/%s-%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), type.Data()) ;
176 TString path(fRoot) ;
178 if ( !fGrid->OpenDir(path) )
179 Error("ctor", "Cannot find directory %s ", path.Data() ) ;
188 //____________________________________________________________________________
189 Bool_t AliPHOSAliEnFile::SetPath(TString year, TString prod, TString vers, TString type)
191 // set the year and verifies if the directory exists
194 sprintf(tempo, "/%s-%s/%s/%s", year.Data(), prod.Data(), vers.Data(), type.Data()) ;
196 TString path(fRoot) ;
198 if ( !fGrid->OpenDir(path) )
199 Error("ctor", "Cannot find directory %s ", path.Data() ) ;
211 //____________________________________________________________________________
212 Bool_t AliPHOSAliEnFile::SetRun(Int_t run)
214 // set the year and verifies if the directory exists
217 TString zero("00000") ;
220 Int_t nzero = zero.Length() - srun.Length() ;
222 for (index = 0 ; index < nzero ; index++)
226 sprintf(tempo, "/%s-%s/%s/%s/%s", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), srun.Data()) ;
228 TString path(fRoot) ;
230 if ( !fGrid->OpenDir(path) )
231 Error("ctor", "Cannot find directory %s ", path.Data() ) ;
240 //____________________________________________________________________________
241 Bool_t AliPHOSAliEnFile::SetEvt(Int_t evt)
243 // set the year and verifies if the directory exists
246 TString zero("00000") ;
249 Int_t nzero = zero.Length() - sevt.Length() ;
251 for (index = 0 ; index < nzero ; index++)
255 sprintf(tempo, "/%s-%s/%s/%s/%s/%s/", fYear.Data(), fProd.Data(), fVers.Data(), fType.Data(), fRun.Data(), sevt.Data()) ;
256 TString path(fRoot) ;
258 if ( !fGrid->OpenDir(path) )
259 Error("ctor", "Cannot find directory %s ", path.Data() ) ;