TClonesArray *array = new TClonesArray("AliAlignObjAngles",30);
TClonesArray &alobj = *array;
- if(!gGeoManager) TGeoManager::Import("geometry.root");
+ if(!AliGeomManager::GetGeometry()){
+ if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
+ AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+ AliCDBManager::Instance()->SetRun(0);
+ AliGeomManager::LoadGeometry();
+ }
// needed for the constructors with local coordinates not to fail
AliAlignObjAngles a;
new(alobj[j++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
}
- if(!gSystem->Getenv("$TOCDB")){
+ const char* macroname = "MakeT0ResMisAlignment.C";
+ if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
// save on file
- TFile f("T0residualMisalignment.root","RECREATE");
- if(!f) cerr<<"cannot open file for output\n";
+ const char* filename = "T0residualMisalignment.root";
+ TFile f(filename,"RECREATE");
+ if(!f){
+ Error(macroname,"cannot open file for output\n");
+ return;
+ }
+ Info(macroname,"Saving alignment objects to the file %s", filename);
f.cd();
- f.WriteObject(array,"T0ResidualObjs ","kSingleKey");
+ f.WriteObject(array,"T0AlignObjs","kSingleKey");
f.Close();
}else{
// save in CDB storage
- const char* Storage = gSystem->Getenv("$STORAGE");
+ TString Storage = gSystem->Getenv("STORAGE");
+ if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+ Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+ return;
+ }
+ Info(macroname,"Saving alignment objects in CDB storage %s",
+ Storage.Data());
AliCDBManager* cdb = AliCDBManager::Instance();
- AliCDBStorage* storage = cdb->GetStorage(Storage);
+ AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+ if(!storage){
+ Error(macroname,"Unable to open storage %s\n",Storage.Data());
+ return;
+ }
AliCDBMetaData* md = new AliCDBMetaData();
md->SetResponsible("Tomasz Malkiewicz");
md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
- AliCDBId id("T0/Align/Data",0,9999999);
+ AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
storage->Put(array,id,md);
}