X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FMakeEMCALResMisAlignment.C;h=ff5e5cd0ebe8286ca7473ab2d63a38fd59b06162;hb=43b007a468b878cc1e60bbc83da103479573a0a7;hp=7812ab72ff8ddb6618cfb9f0b85f2b1228922e97;hpb=90dbf5fb2b3b943ac8b441443b53a86cc3db5c54;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/MakeEMCALResMisAlignment.C b/EMCAL/MakeEMCALResMisAlignment.C index 7812ab72ff8..ff5e5cd0ebe 100644 --- a/EMCAL/MakeEMCALResMisAlignment.C +++ b/EMCAL/MakeEMCALResMisAlignment.C @@ -1,16 +1,44 @@ void MakeEMCALResMisAlignment(){ // Create TClonesArray of residual misalignment objects for EMCAL // - TClonesArray *array = new TClonesArray("AliAlignObjParams",10); + const char* macroname = "MakeEMCALResMisAlignment.C"; + const AliEMCALGeometry *emcalGeom = AliEMCALGeometry::GetInstance(AliEMCALGeometry::GetDefaultGeometryName(),""); + if(!emcalGeom) { + Error("MakeEMCALResMisAlignment","Cannot obtain AliEMCALGeometry singleton\n"); + return; + } + + TClonesArray *array = new TClonesArray("AliAlignObjParams",emcalGeom->GetNumberOfSuperModules()); TClonesArray &alobj = *array; - if(!AliGeomManager::GetGeometry()){ - if(!(AliCDBManager::Instance())->IsDefaultStorageSet()) - AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); - AliCDBManager::Instance()->SetRun(0); - AliGeomManager::LoadGeometry(); - } - AliAlignObjParams 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; @@ -29,7 +57,7 @@ void MakeEMCALResMisAlignment(){ // sigma translation = 1mm // sigma rotation = 0.1 degree TRandom *rnd = new TRandom(4321); - Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS + Double_t sigmatr = 0.05; // max shift in cm w.r.t. local RS Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS for(i=0; i<10; i++){ @@ -56,8 +84,7 @@ void MakeEMCALResMisAlignment(){ new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - const char* macroname = "MakeEMCALResMisAlignment.C"; - if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file const char* filename = "EMCALresidualMisalignment.root"; TFile f(filename,"RECREATE"); @@ -71,22 +98,9 @@ void MakeEMCALResMisAlignment(){ f.Close(); }else{ // save in CDB storage - 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; - } - Info(macroname,"Saving alignment objects in CDB storage %s", - Storage.Data()); - AliCDBManager* cdb = AliCDBManager::Instance(); - AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); - if(!storage){ - Error(macroname,"Unable to open storage %s\n",Storage.Data()); - return; - } AliCDBMetaData* md = new AliCDBMetaData(); - md->SetResponsible("Jennifer Clay"); - md->SetComment("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS"); + md->SetResponsible("Jennifer Klay"); + md->SetComment("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.1 in the local RS"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md);