X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PMD%2FMakePMDResMisAlignment.C;h=f83902db11dbcf62e689cce94326afe64eb2063f;hb=c55bd1a616406e84d0a686691557d2177cf24c94;hp=fcc8ad5d3187f80cba65aef0228b1371967f6cee;hpb=1895a097f0a10aa676c803ff663b1c31836edddf;p=u%2Fmrichter%2FAliRoot.git diff --git a/PMD/MakePMDResMisAlignment.C b/PMD/MakePMDResMisAlignment.C index fcc8ad5d318..f83902db11d 100644 --- a/PMD/MakePMDResMisAlignment.C +++ b/PMD/MakePMDResMisAlignment.C @@ -34,17 +34,43 @@ void MakePMDResMisAlignment(){ // Steel plate */ - if(!gGeoManager) TGeoManager::Import("geometry.root"); - // needed for the constructors with local coordinates not to fail + const char* macroname = "MakePMDResMisAlignment.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="/ALIC_1/EPM1_1"; - const char *Sector2="/ALIC_1/EPM2_1"; - const char *Sector3="/ALIC_1/EPM3_1"; - const char *Sector4="/ALIC_1/EPM4_1"; + const char *Sector1="PMD/Sector1"; + const char *Sector2="PMD/Sector2"; + const char *Sector3="PMD/Sector3"; + const char *Sector4="PMD/Sector4"; //Sectors 1 and 4 @@ -87,38 +113,37 @@ void MakePMDResMisAlignment(){ //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")){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // Create a File to store the alignment data - TFile f("PMDresidualMisalignment.root","RECREATE"); - if(!f) {cerr<<"cannot open file for output\n";} - + const char* filename = "PMDresidualMisalignment.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("Residual 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); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete();