X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PMD%2FMakePMDFullMisAlignment.C;h=846f167194a723ebd0083a6372c20645f7643903;hb=3beb22a291f56f185956869183744e9a40b0e52b;hp=4bf94c77801bd77e3b2297a8199a76702df15916;hpb=5bd470e1b1c911e7926a0c41c3a52937ebef34de;p=u%2Fmrichter%2FAliRoot.git diff --git a/PMD/MakePMDFullMisAlignment.C b/PMD/MakePMDFullMisAlignment.C index 4bf94c77801..846f167194a 100644 --- a/PMD/MakePMDFullMisAlignment.C +++ b/PMD/MakePMDFullMisAlignment.C @@ -35,13 +35,39 @@ void MakePMDFullMisAlignment(){ // Steel plate */ - if(!gGeoManager) TGeoManager::Import("geometry.root"); - // needed for the constructors with local coordinates not to fail + const char* macroname = "MakePMDFullMisAlignment.C"; + + // 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 + } Float_t max_trans=0.1; Float_t max_rot=0.1; - TString path; const char *Sector1="PMD/Sector1"; const char *Sector2="PMD/Sector2"; const char *Sector3="PMD/Sector3"; @@ -88,37 +114,37 @@ void MakePMDFullMisAlignment(){ //Create a TClonesArray of Align Object to store displacement Angles - TClonesArray *array = new TClonesArray("AliAlignObjAngles",10); + TClonesArray *array = new TClonesArray("AliAlignObjParams",10); TClonesArray &alobj = *array; - AliAlignObjAngles o; - 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); - new(alobj[0]) AliAlignObjAngles(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); - new(alobj[1]) AliAlignObjAngles(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); - new(alobj[2]) AliAlignObjAngles(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); - new(alobj[3]) AliAlignObjAngles(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); + new(alobj[0]) AliAlignObjParams(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); + new(alobj[1]) AliAlignObjParams(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE); + new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); + new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE); - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data - TFile f("PMDfullMisalignment.root","RECREATE"); - if(!f) {cerr<<"cannot open file for output\n";} + const char* filename = "PMDfullMisalignment.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,"PMDAlignObjs ","kSingleKey"); + f.WriteObject(array,"PMDAlignObjs","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(""); md->SetComment("Full misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); - AliCDBId id("PMD/Align/Data",0,9999999); + AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete();