1 | function 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 | |
---|
6 | GeomParUnd = idGetGeomParamForUndSOLEIL(idName); |
---|
7 | |
---|
8 | ElecBeamModelData = idReadElecBeamModel(dirModel); |
---|
9 | [mCODx, vR0x] = idCreateModelOrbDistMatr('x', ElecBeamModelData, GeomParUnd); |
---|
10 | [mCODz, vR0z] = idCreateModelOrbDistMatr('z', ElecBeamModelData, GeomParUnd); |
---|
11 | |
---|
12 | dirStart = pwd; |
---|
13 | if strcmp(dirMeasData, '') == 0 |
---|
14 | cd(dirMeasData); |
---|
15 | end |
---|
16 | ElecBeamMeasMain = load(char(fileNameMeasMain)); |
---|
17 | ElecBeamMeasBkgr = load(char(fileNameMeasBkgr)); |
---|
18 | cd(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 | |
---|
22 | outStruct.DX_Meas = ElecBeamMeasMain.X - ElecBeamMeasBkgr.X; |
---|
23 | outStruct.DZ_Meas = ElecBeamMeasMain.Z - ElecBeamMeasBkgr.Z; |
---|
24 | outStruct.KicksX = idLeastSqLinFit(mCODx, outStruct.DX_Meas, arIndsBPMsToSkip); |
---|
25 | outStruct.KicksZ = idLeastSqLinFit(mCODz, outStruct.DZ_Meas, arIndsBPMsToSkip); |
---|
26 | outStruct.DX_Fit = mCODx*outStruct.KicksX; |
---|
27 | outStruct.DZ_Fit = mCODz*outStruct.KicksZ; |
---|