+void AliCDBManager::SetDefaultStorageFromRun(Int_t run) {
+// set default storage from the run number - to be used only with raw data
+
+ // if lock is ON, cannot activate more storages!
+ if(fLock) {
+ if (fDefaultStorage) {
+ AliFatal("Lock is ON, and default storage is already set: "
+ "cannot activate default storage from run number");
+ }
+ }
+
+ // retrieve XML file from alien
+ if(!gGrid) {
+ TGrid::Connect("alien://","");
+ if(!gGrid) {
+ AliError("Connection to alien failed!");
+ return;
+ }
+ }
+ TUUID uuid;
+ TString rndname = "/tmp/";
+ rndname += "OCDBFolderXML.";
+ rndname += uuid.AsString();
+ rndname += ".xml";
+ AliDebug(2, Form("file to be copied = %s", fgkOCDBFolderXMLfile.Data()));
+ if (!TFile::Cp(fgkOCDBFolderXMLfile.Data(), rndname.Data())) {
+ AliFatal(Form("Cannot make a local copy of OCDBFolder xml file in %s",rndname.Data()));
+ }
+ AliCDBHandler* saxcdb = new AliCDBHandler();
+ saxcdb->SetRun(run);
+ TSAXParser *saxParser = new TSAXParser();
+ saxParser->ConnectToHandler("AliCDBHandler", saxcdb);
+ saxParser->ParseFile(rndname.Data());
+ AliInfo(Form(" LHC folder = %s", saxcdb->GetOCDBFolder().Data()));
+ AliInfo(Form(" LHC period start run = %d", saxcdb->GetStartRunRange()));
+ AliInfo(Form(" LHC period end run = %d", saxcdb->GetEndRunRange()));
+ fLHCPeriod = saxcdb->GetOCDBFolder();
+ fStartRunLHCPeriod = saxcdb->GetStartRunRange();
+ fEndRunLHCPeriod = saxcdb->GetEndRunRange();
+
+ SetDefaultStorage(fLHCPeriod.Data());
+ if(!fDefaultStorage) AliFatal(Form("%s storage not there! Please check!",fLHCPeriod.Data()));