source: MML/trunk/machine/SOLEIL/StorageRing/insertions/idCalcFldIntFromElecBeamMeasForUndSOLEIL_1.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.4 KB
Line 
1function outStruct = idCalcFldIntFromElecBeamMeasForUndSOLEIL_1(idName, dirMeasData, fileNameMeasMain, fileNameMeasBkgr, dirModel, arIndsBPMsToSkip, kick2x_rad, kick2z_rad)
2
3%Calculates effective first and second horizontal and vertical field
4%integrals of SOLEIL undulator from one measurement of COD (read from the files: fileNameMeasMain, fileNameMeasBkgr)
5
6GeomParUnd = idGetGeomParamForUndSOLEIL(idName);
7
8ElecBeamModelData = idReadElecBeamModel(dirModel);
9[mCODx, vR0x] = idCreateModelOrbDistMatr('x', ElecBeamModelData, GeomParUnd);
10[mCODz, vR0z] = idCreateModelOrbDistMatr('z', ElecBeamModelData, GeomParUnd);
11
12dirStart = pwd;
13if strcmp(dirMeasData, '') == 0
14        cd(dirMeasData);
15end
16ElecBeamMeasMain = load(char(fileNameMeasMain));
17ElecBeamMeasBkgr = load(char(fileNameMeasBkgr));
18cd(dirStart);
19
20[outStruct.I1X, outStruct.I2X, outStruct.I1Z, outStruct.I2Z] = idCalcFldIntFromElecBeamMeas(ElecBeamMeasMain, ElecBeamMeasBkgr, mCODx, mCODz, arIndsBPMsToSkip, GeomParUnd.idLen, GeomParUnd.idKickOfst, ElecBeamModelData.E, kick2x_rad, kick2z_rad, vR0x, vR0z);
21
22outStruct.DX_Meas = ElecBeamMeasMain.X - ElecBeamMeasBkgr.X;
23outStruct.DZ_Meas = ElecBeamMeasMain.Z - ElecBeamMeasBkgr.Z;
24outStruct.KicksX = idLeastSqLinFit(mCODx, outStruct.DX_Meas, arIndsBPMsToSkip);
25outStruct.KicksZ = idLeastSqLinFit(mCODz, outStruct.DZ_Meas, arIndsBPMsToSkip);
26outStruct.DX_Fit = mCODx*outStruct.KicksX;
27outStruct.DZ_Fit = mCODz*outStruct.KicksZ;
Note: See TracBrowser for help on using the repository browser.