+ // Activate CDB storage and load geometry from CDB
+ AliCDBManager* cdb = AliCDBManager::Instance();
+ if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ cdb->SetRun(0);
+
+ AliCDBStorage* storage;
+ TString Storage;
+
+ if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
+ 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;
+ }
+ storage = cdb->GetStorage(Storage.Data());
+ if(!storage){
+ Error(macroname,"Unable to open storage %s\n",Storage.Data());
+ return;
+ }
+ AliCDBPath path("GRP","Geometry","Data");
+ AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+ if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+ entry->SetOwner(0);
+ TGeoManager* geom = (TGeoManager*) entry->GetObject();
+ AliGeomManager::SetGeometry(geom);
+ }else{
+ AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+ }
+
+ // load FRAME full misalignment objects (if needed, the macro
+ // for FRAME has to be ran in advance) and apply them to geometry
+ AliCDBPath fpath("GRP","Align","Data");
+ AliCDBEntry *eFrame;
+ if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
+ Info(macroname,"Loading FRAME alignment objects from CDB storage %s",
+ Storage.Data());
+ eFrame = storage->Get(fpath.GetPath(),cdb->GetRun());
+ }else{
+ eFrame = cdb->Get(fpath.GetPath());
+ }
+ if(!eFrame) Fatal(macroname,"Could not get the specified CDB entry!");
+ TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
+ arFrame->Sort();
+ Int_t nvols = arFrame->GetEntriesFast();
+ Bool_t flag = kTRUE;
+ for(Int_t j=0; j<nvols; j++)
+ {
+ AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
+ if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
+ }
+ if(!flag) Fatal(macroname,"Error in the application of FRAME objects");
+
+ // Sigmas for the chambers
+ Double_t smdx = 0.3; // 3 mm
+ Double_t smdy = 0.3; // 3 mm
+ Double_t smdz = 0.3; // 3 mm
+ Double_t smrx = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
+ Double_t smry = 2.0 / 1000.0 / TMath::Pi()*180; // 2.0 mrad
+ Double_t smrz = 0.4 / 1000.0 / TMath::Pi()*180; // 0.4 mrad
+ // Truncation for the chambers
+ Double_t cutSmdx = 3.0 * smdx;
+ Double_t cutSmdy = 3.0 * smdy;
+ Double_t cutSmdz = 3.0 * smdz;