void MakeTOFResMisAlignment(){ // Create TClonesArray of residual misalignment objects for TOF // TClonesArray *array = new TClonesArray("AliAlignObjAngles",2000); TClonesArray &alobj = *array; if(!AliGeomManager::GetGeometry()){ if(!(AliCDBManager::Instance())->IsDefaultStorageSet()) AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); AliCDBManager::Instance()->SetRun(0); AliGeomManager::LoadGeometry(); } // needed for the constructors with local coordinates not to fail AliAlignObjAngles a; AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF; Int_t i; Int_t j=0; Double_t dx=0.; Double_t dy=0.; Double_t dz=0.; Double_t dpsi, dtheta, dphi; TRandom *rnd = new TRandom(4357); Double_t sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS for(i=0; iGaus(0.,sigmatr); dz = rnd->Gaus(0.,sigmatr); dpsi = 0.; dtheta = 0.; dphi = 0.; new(alobj[j]) AliAlignObjAngles(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kFALSE); j++; } const char* macroname = "MakeTOFResMisAlignment.C"; if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ // save on file const char* filename = "TOFresidualMisalignment.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,"TOFAlignObjs","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("Silvia Arcelli"); md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS"); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md); } array->Delete(); }