X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FMakeEMCALFullMisAlignment.C;h=8689aaccf17451585155112888302185ae125d0b;hb=4e67b745f9153cfd124fbeb8dd3572928e4347d1;hp=c89ac02f0fe2dd5237930f6a31f6e51747a0cb8d;hpb=a24be56b08ef731a32c600e49534f4c4beb9370c;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/MakeEMCALFullMisAlignment.C b/EMCAL/MakeEMCALFullMisAlignment.C index c89ac02f0fe..8689aaccf17 100644 --- a/EMCAL/MakeEMCALFullMisAlignment.C +++ b/EMCAL/MakeEMCALFullMisAlignment.C @@ -1,13 +1,21 @@ -void MakeEMCALFullMisAlignment(){ +enum SurveyDataType_t { kSurvey = 0, kDummy = 1}; + +void MakeEMCALFullMisAlignment(TString geoname = "EMCAL_FIRSTYEARv1",TString surveyFilename = "emcal_survey_FIRSTYEARv1.txt",SurveyDataType_t type = kSurvey){ // Create TClonesArray of full misalignment objects for EMCAL // - TClonesArray *array = new TClonesArray("AliAlignObjParams",10); - TClonesArray &alobj = *array; const char* macroname = "MakeEMCALFullMisAlignment.C"; + if(geoname=="")geoname=AliEMCALGeometry::GetDefaultGeometryName(); + const AliEMCALGeometry *emcalGeom = AliEMCALGeometry::GetInstance(geoname,""); + if(!emcalGeom) { + Error("MakeEMCALFullMisAlignment","Cannot obtain AliEMCALGeometry singleton\n"); + return; + } + TClonesArray *array = new TClonesArray("AliAlignObjParams",emcalGeom->GetNumberOfSuperModules()); + TClonesArray &alobj = *array; // Activate CDB storage and load geometry from CDB AliCDBManager* cdb = AliCDBManager::Instance(); - if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); + if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); cdb->SetRun(0); AliCDBStorage* storage; @@ -30,50 +38,15 @@ void MakeEMCALFullMisAlignment(){ TGeoManager* geom = (TGeoManager*) entry->GetObject(); AliGeomManager::SetGeometry(geom); }else{ - AliGeomManager::LoadGeometry(); //load geom from default CDB storage + AliGeomManager::LoadGeometry(); //load geom from default CDB + //storage } - Double_t dx, dy, dz, dpsi, dtheta, dphi; - TRandom *rnd = new TRandom(4321); - Double_t sigmatr = 0.1; // max shift in cm w.r.t. local RS - Double_t sigmarot = 0.1; // max rot in degrees w.r.t. local RS - - // null shifts and rotations - const TString basepath = "EMCAL/FullSupermodule"; - const TString hbasepath = "EMCAL/HalfSupermodule"; - TString pathstr; + AliEMCALSurvey emcalSurvey(surveyFilename,type); + emcalSurvey.CreateAliAlignObjParams(alobj); - Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT - AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; - UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity - Int_t i; - Int_t j=0; - - for(i=0; i<10; i++){ - 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); - pathstr=basepath; - pathstr+=(i+1); - cout<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); - pathstr=hbasepath; - pathstr+=(i+1); - new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); - } + // ************************* 2nd step *************** if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ // save on file @@ -90,8 +63,9 @@ void MakeEMCALFullMisAlignment(){ }else{ // save in CDB storage AliCDBMetaData* md = new AliCDBMetaData(); - md->SetResponsible("Jennifer Clay"); - md->SetComment("Full misalignment for EMCAL"); + md->SetResponsible("Jennifer Klay"); + md->SetComment("Full misalignment for EMCAL_FIRSTYEAR based on survey information"); + md->AddDateToComment(); md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity()); storage->Put(array,id,md);