X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=T0%2FMakeT0ResMisAlignment.C;h=8de03af29e839ccabddaf66c1cc69f0ea455c8f3;hb=fc82f9c728657eb056ac5f19312f8df4b7171ef1;hp=49c4f62c7cb206ab9577afa373afed6b6e37141a;hpb=d3a9c52a8e655e35c86c18170ff4c8eacc2c7196;p=u%2Fmrichter%2FAliRoot.git diff --git a/T0/MakeT0ResMisAlignment.C b/T0/MakeT0ResMisAlignment.C index 49c4f62c7cb..8de03af29e8 100644 --- a/T0/MakeT0ResMisAlignment.C +++ b/T0/MakeT0ResMisAlignment.C @@ -1,62 +1,66 @@ void MakeT0ResMisAlignment(){ // Create TClonesArray of residual misalignment objects for T0 // - TClonesArray *array = new TClonesArray("AliAlignObjAngles",30); + TClonesArray *array = new TClonesArray("AliAlignObjParams",4); TClonesArray &alobj = *array; - if(!gGeoManager) TGeoManager::Import("geometry.root"); - // needed for the constructors with local coordinates not to fail - - AliAlignObjAngles a; - Double_t dx, dy, dz, dpsi, dtheta, dphi; - TRandom *rnd = new TRandom(4321); - Double_t sigmatr = 0.05; // max shift in cm - Double_t sigmarot = 0.3; // max rot in degrees + TRandom3 *rnd = new TRandom3(4321); + Double_t sigmatr = 0.006; // max shift in cm + Double_t sigmarot = 0.001; // max rot in degrees - TString symName, sn; + TString symName; Int_t iIndex=0; - AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer; - UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex); + 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; - + for (Int_t imod=0; imod<2; imod++) + { + symName="/ALIC_1/0STR_1"; + if(imod==1) symName="/ALIC_1/0STL_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++]) AliAlignObjAngles(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); + new(alobj[imod]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); } - if(!gSystem->Getenv("$TOCDB")){ + const char* macroname = "MakeT0ResMisAlignment.C"; + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file - TFile f("T0residualMisalignment.root","RECREATE"); - if(!f) cerr<<"cannot open file for output\n"; + const char* filename = "T0residualMisalignment.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,"T0ResidualObjs ","kSingleKey"); + f.WriteObject(array,"T0AlignObjs","kSingleKey"); f.Close(); }else{ // save in CDB storage - const char* Storage = gSystem->Getenv("$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); + 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("Residual 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,9999999); + AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); }