From 32236ea780482359e7caf57cabb2383e5efd83fd Mon Sep 17 00:00:00 2001 From: alla Date: Mon, 7 Apr 2008 12:22:27 +0000 Subject: [PATCH] misalignment macro from Tomek --- T0/MakeT0FullMisAlignment.C | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/T0/MakeT0FullMisAlignment.C b/T0/MakeT0FullMisAlignment.C index 32cb0950960..d2cec2eede9 100644 --- a/T0/MakeT0FullMisAlignment.C +++ b/T0/MakeT0FullMisAlignment.C @@ -1,3 +1,106 @@ +void MakeT0FullMisAlignment(){ + // Create TClonesArray of full misalignment objects for T0 + // + TClonesArray *array = new TClonesArray("AliAlignObjParams",30); + TClonesArray &alobj = *array; + + Double_t dx, dy, dz, dpsi, dtheta, dphi; + TRandom *rnd = new TRandom(4321); + Double_t sigmatr = 0.05; // sigma for shifts in cm + Double_t sigmarot = 0.3; // sigma for tilts in degrees + + TString symName, sn; + + Int_t iIndex=0; + AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; + UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); + + Int_t j=0; + for (Int_t imod=0; imod<24; imod++){ + if (imod < 12){ + sn="T0/C/PMT"; + }else{ + sn="T0/A/PMT"; + } + symName = sn; + symName += imod+1; + + 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[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, +dtheta, dphi, kTRUE); + } + + const char* macroname = "MakeT0FullMisAlignment.C"; + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "T0fullMisalignment.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,"T0AlignObjs","kSingleKey"); + 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("Tomasz Malkiewicz"); + md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and +sigmarot=0.3 in the local RS"); + md->SetAliRootVersion(gSystem->Getenv("$ARVERSION")); + AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity()); + storage->Put(array,id,md); + } + + array->Delete(); +} + + + + + + + + + + + + + + + + + + + + + + + + void MakeT0FullMisAlignment(){ // Create TClonesArray of full misalignment objects for T0 // -- 2.39.3