X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ACORDE%2FMakeACORDEFullMisAlignment.C;h=2d02d01680a2baf0f66fe2ddc000d870318717f6;hb=b4bfafe9aa47a7bd74a7601aef9554deb892f277;hp=b8af83b96b9e6b89e161585125f5c1e45ead3e92;hpb=79ea46fb88b9b97615e4f9707fcdd7e6cad7ea93;p=u%2Fmrichter%2FAliRoot.git diff --git a/ACORDE/MakeACORDEFullMisAlignment.C b/ACORDE/MakeACORDEFullMisAlignment.C index b8af83b96b9..2d02d01680a 100644 --- a/ACORDE/MakeACORDEFullMisAlignment.C +++ b/ACORDE/MakeACORDEFullMisAlignment.C @@ -1,93 +1,93 @@ -void MakeACORDEFullMisAlignment(){ - // Create TClonesArray of full misalignment objects for ACORDE - // - const char* macroname = "MakeACORDEFullMisAlignment.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; - - //load geom from local file till ACORDE is not switched on by default in standard config-files - 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 - - } - // AliGeomManager::LoadGeometry("geometry.root"); - - TClonesArray *array = new TClonesArray("AliAlignObjParams",60); - TClonesArray &alobj = *array; - - TRandom *rnd = new TRandom(4321); - Int_t j = 0; - Double_t dx, dy, dz, dpsi, dtheta, dphi; - - // RS = local - // sigma translation = 1 mm - // sigma rotation = 0.5 degrees - Double_t sigmatr = 2; - Double_t sigmarot = 1; - - TString symname; - TString basename = "ACORDE/Array"; - Int_t iIndex=0; - AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; - UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); - - for (Int_t imod=0; imod<60; imod++){ - 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); - symname = basename; - symname += imod; - new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE); - } - - if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ - // save on file - const char* filename = "ACORDEfullMisalignment.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,"ACORDEAlignObjs","kSingleKey"); - f.Close(); - }else{ - // save in CDB storage - AliCDBMetaData* md = new AliCDBMetaData(); - md->SetResponsible("E. Cuautle & M. Rodriguez"); - md->SetComment("Full misalignment for ACORDE"); - md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); - AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity()); - storage->Put(array,id,md); - } - - array->Delete(); - -} - +void MakeACORDEFullMisAlignment(){ + // Create TClonesArray of full misalignment objects for ACORDE + // + const char* macroname = "MakeACORDEFullMisAlignment.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; + + //load geom from local file till ACORDE is not switched on by default in standard config-files + 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 + + } + // AliGeomManager::LoadGeometry("geometry.root"); + + TClonesArray *array = new TClonesArray("AliAlignObjParams",60); + TClonesArray &alobj = *array; + + TRandom *rnd = new TRandom(4321); + Int_t j = 0; + Double_t dx, dy, dz, dpsi, dtheta, dphi; + + // RS = local + // sigma translation = 1 mm + // sigma rotation = 0.5 degrees + Double_t sigmatr = 2; + Double_t sigmarot = 1; + + TString symname; + TString basename = "ACORDE/Array"; + Int_t iIndex=0; + AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; + UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); + + for (Int_t imod=0; imod<60; imod++){ + 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); + symname = basename; + symname += imod; + new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz,dpsi, dtheta, dphi, kFALSE); + } + + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "ACORDEfullMisalignment.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,"ACORDEAlignObjs","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("E. Cuautle & M. Rodriguez"); + md->SetComment("Full misalignment for ACORDE"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("ACORDE/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); + } + + array->Delete(); + +} +