X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=VZERO%2FMakeVZEROFullMisAlignment.C;h=9d839415536292f991b6b07b2df20dcdc784a22d;hb=40078e005d06e3b3004dd8f87ee0b10ae8c74123;hp=d5c649faf52a7371fb0ca7ba790fd851bb22f6d2;hpb=d3a9c52a8e655e35c86c18170ff4c8eacc2c7196;p=u%2Fmrichter%2FAliRoot.git diff --git a/VZERO/MakeVZEROFullMisAlignment.C b/VZERO/MakeVZEROFullMisAlignment.C index d5c649faf52..9d839415536 100644 --- a/VZERO/MakeVZEROFullMisAlignment.C +++ b/VZERO/MakeVZEROFullMisAlignment.C @@ -1,27 +1,50 @@ void MakeVZEROFullMisAlignment(){ // Create TClonesArray of full misalignment objects for VZERO // - if(!gGeoManager) TGeoManager::Import("geometry.root"); - // needed for the constructors with local coordinates not to fail + const char* macroname = "MakeVZEROFullMisAlignment.C"; - TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray *array = new TClonesArray("AliAlignObjParams",10); TClonesArray &alobj = *array; - AliAlignObjAngles a; + // 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; + + if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ + 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; + } + 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 + } Double_t dx, dy, dz, dpsi, dtheta, dphi; TRandom *rnd = new TRandom(4321); Double_t sigmatr = 0.1; // max shift in cm Double_t sigmarot = 0.5; // max rot in degrees - // null shifts and rotations - const char *V0right="VZERO/V0C"; const char *V0left="VZERO/V0A"; Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT - AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; - UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; + UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); dx = rnd->Gaus(0.,sigmatr); dy = rnd->Gaus(0.,sigmatr); @@ -29,37 +52,45 @@ void MakeVZEROFullMisAlignment(){ dpsi = rnd->Gaus(0.,sigmarot); dtheta = rnd->Gaus(0.,sigmarot); dphi = rnd->Gaus(0.,sigmarot); - new(alobj[0]) AliAlignObjAngles(V0right, volid, dx, dy, dz, dpsi, dtheta, - dphi, kFALSE); + new(alobj[0]) AliAlignObjParams(V0right, volid, dx, dy, dz, dpsi, dtheta, + dphi, kFALSE); + AliAlignObjParams* itsalobj = (AliAlignObjParams*) alobj.UncheckedAt(0); + itsalobj->ApplyToGeometry(); + dx = rnd->Gaus(0.,sigmatr); dy = rnd->Gaus(0.,sigmatr); dz = rnd->Gaus(0.,sigmatr); dpsi = rnd->Gaus(0.,sigmarot); dtheta = rnd->Gaus(0.,sigmarot); dphi = rnd->Gaus(0.,sigmarot); - new(alobj[1]) AliAlignObjAngles(V0left, volid, dx, dy, dz, dpsi, dtheta, + new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE); + AliAlignObjParams* itsalobj = (AliAlignObjParams*) alobj.UncheckedAt(1); + itsalobj->ApplyToGeometry(); - if(!gSystem->Getenv("$TOCDB")){ - // save on file - TFile f("V0fullMisalignment.root","RECREATE"); - if(!f) cerr<<"cannot open file for output\n"; - f.cd(); - f.WriteObject(array,"V0FullObjs ","kSingleKey"); - f.Close(); + if(TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "VZEROfullMisalignment.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,"VZEROAlignObjs","kSingleKey"); + f.Close(); }else{ - // save in CDB storage - const char* Storage = gSystem->Getenv("$STORAGE"); - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBStorage* storage = cdb->GetStorage(Storage); - AliCDBMetaData* md = new AliCDBMetaData(); - md->SetResponsible("Brigitte Cheynis"); - md->SetComment("Alignment objects for V0 full misalignment"); - md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); - AliCDBId id("VZERO/Align/Data",0,9999999); - storage->Put(array,id,md); + // save in CDB storage + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Brigitte Cheynis"); + md->SetComment("Alignment objects for V0 full misalignment"); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("VZERO/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); } + array->Print(); array->Delete(); }