+ } else { // use local copy of OCDB
+ TString tmpdir=gSystem->WorkingDirectory();
+ if (gSystem->AccessPathName(tmpdir))
+ tmpdir = "/tmp";
+ tmpdir+="/";
+ tmpdir+=gSystem->GetUid();
+ tmpdir+="-";
+ TDatime t;
+ tmpdir+=t.Get();
+ tmpdir+="-";
+ Int_t counter = 0;
+ fLocalOcdb = tmpdir;
+ fLocalOcdb += Form("%d%d%d",gRandom->Integer(999999999),gRandom->Integer(999999999),gRandom->Integer(999999999));
+ while (!gSystem->AccessPathName(fLocalOcdb)) {
+ fLocalOcdb = tmpdir;
+ fLocalOcdb += Form("%d%d%d",gRandom->Integer(999999999),gRandom->Integer(999999999),gRandom->Integer(999999999));
+ counter++;
+ if (counter>100) {
+ AliFatal(Form("Could not create local directory for OCDB at %s",tmpdir.Data()));
+ }
+ }
+ gSystem->MakeDirectory(fLocalOcdb);
+ TString filename(Form("$ALICE_ROOT/PWG/EMCAL/data/%d.dat",year));
+ TString cmd(Form("cd %s && tar -xf %s",fLocalOcdb.Data(),filename.Data()));
+ Int_t ret = gSystem->Exec(cmd);
+ if (ret==0) {
+ TString locdb("local://");
+ locdb+=fLocalOcdb;
+ locdb+="/";
+ locdb+=year;
+ AliInfo(Form("Setting up local OCDB at %s",locdb.Data()));
+ man->SetDefaultStorage(locdb);
+ fLocalOcdbStor = locdb;
+ } else {
+ AliFatal(Form("Could not set up local OCDB at %s",fLocalOcdb.Data()));
+ }