Commit 4d75328a authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Amelioration des prints et ajout d'option pour mieux controler fit/simplex sur...

Amelioration des prints et ajout d'option pour mieux controler fit/simplex sur l'ajustement simultane des 6 cross-cor, Reza 22/02/2019
parent 4d013c7c
......@@ -91,6 +91,7 @@ static vector<string> trksetfiles; // datacard files defining the track/data s
// ---- fit simultane sur les 6 cross-correlations
static bool do_baselinefit = false; // if true , perform baseline fit
static bool fg_fixbaseline = false; // if true , do phases fit with fixed baselines
static bool do_baselinesimplex = false; // if true , perform baseline determination using Simplex minimisation
//--- End of list of global parameters
......@@ -138,14 +139,21 @@ int main (int narg, char* arg[])
v_trk.push_back(tks);
}
string cxbofile = "cxb6_"+outfilename;
string cxbckfile = "cxb6_"+checkfilename;
CxBaselineFitter cxbfit(v_acxd, v_trk);
//cxbfit.doSimplexMinimize();
cxbfit.initFitParams();
cxbfit.saveExpectedCx(cxbckfile);
if (do_baselinesimplex) {
cxbfit.doSimplexMinimize();
cxbckfile="cxb6s_"+checkfilename;
cxbfit.saveExpectedCx(cxbckfile);
// cxbfit.doCheck();
}
if (do_baselinefit) {
CxBaselineFitter cxbfit(v_acxd, v_trk);
string cxbofile = "cxb6_"+outfilename;
string cxbckfile = "cxb6_"+checkfilename;
//cxbfit.doSimplexMinimize();
cxbfit.initFitParams();
// cxbfit.doCheck();
cxbfit.dofit(cxbofile,fg_fixbaseline);
cxbckfile = "cxb6f_"+checkfilename;
cxbfit.saveExpectedCx(cxbckfile);
}
Timer tm("trkacxfit");
......@@ -183,7 +191,7 @@ int decode_args(int narg, char* arg[])
cout << " trkacxfit : fit array geometry and \n"
<< " Usage: trkacxfit [-options] track_Set_1 [track_Set_2] [track_Set_3 ...] \n"
<< " options: -inp def_input_path -out OutFileName -ckf CheckFileName \n"
<< " -docx6f -fixb -ngb -D dish_diameter -prt PrintLevel \n"<<endl;
<< " -docx6f -fixb -docx6s -ngb -D dish_diameter -prt PrintLevel \n"<<endl;
if (!fglonghelp) {
cout << " trkacxfit -h to get option description " << endl;
return 2;
......@@ -196,6 +204,7 @@ int decode_args(int narg, char* arg[])
<< " ac_JJ_ or cx_JJ_ where JJ=1...n is the track_set number \n"
<< " -docx6f : Perform simultaneous fit over 6 cross-corr (baseline and phases determination) - default NO \n"
<< " -fixb : perform the previous fit (docx6f) with fixed baselines - default NO \n"
<< " -docx6s : try simplex minimisation over 6 cross-corr (baseline and phases determination) - default NO \n"
<< " -ngb : Use non gaussian beam profile (Bessel j1(angle) - default Gaussian beam) \n"
<< " -D dish_diameter : define effective dish diameter (in meter D*eff , def=4.5) \n"
<< " -prt PrintLevel: specify print level \n"
......@@ -213,6 +222,7 @@ int decode_args(int narg, char* arg[])
fggaussbeam=true;
do_baselinefit=false;
fg_fixbaseline=false;
do_baselinesimplex=false;
vector<string> lastargs;
while (narg>1) {
......@@ -230,6 +240,9 @@ int decode_args(int narg, char* arg[])
else if (fbo=="-fixb") { // Perform the previous docx6f fit with fixed baselines (phases only)
fg_fixbaseline=true; arg++; narg--; lastargs.clear();
}
else if (fbo=="-docx6s") { // Perform simultaneous fit over 6 cross-corr
do_baselinesimplex=true; arg++; narg--; lastargs.clear();
}
else if (fbo=="-inp") { // output file name
if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; }
default_input_path=arg[2]; arg+=2; narg-=2; lastargs.clear();
......@@ -258,7 +271,8 @@ int decode_args(int narg, char* arg[])
cout << " Beam: D_dish (initial guess)="<<D_dish<<" GaussianBeam ? "<<(fggaussbeam?"Yes":"No")<<endl;
cout << " OutFileName= "<<outfilename<<" CheckFileName= "<<checkfilename<<endl;
cout << " Perform baseline fit ? " << (do_baselinefit?"Yes":"No")
<<(fg_fixbaseline?" With FIXED baselines":" (Phases & baselines)")<<endl;
<<(fg_fixbaseline?" With FIXED baselines":" (Phases & baselines)")
<<" Simplex-Minimisation ? "<<(do_baselinesimplex?"Yes":"No")<<endl;
cout << " --- TrackSetFiles: (NbFiles="<<lastargs.size()<<" default directory: "<<default_input_path<<")"<<endl;
trksetfiles = lastargs;
for (size_t i=0; i<trksetfiles.size(); i++) {
......
......@@ -682,9 +682,19 @@ int ACxSetFitter::doCxfit(string outfilenamecx, bool useAac)
v_err_Acx[ii][j]=err_A;
ofr <<setw(8)<<A<<" "<<setw(8)<<err_A<<" ";
}
ofr << endl;
ofr << endl;
}
cout << " --- Fitted phases: ";
for(size_t i=0; i<NB_CXCORS; i++) cout<<setw(6)<<Angle(v_phase[i]).ToDegree()<<" ; "; cout<<endl;
double dphi23=v_phase[1]-v_phase[0]; if (dphi23<0.) dphi23+=(2.*M_PI);
double dphi24=v_phase[2]-v_phase[0]; if (dphi24<0.) dphi24+=(2.*M_PI);
double dphi34=v_phase[2]-v_phase[1]; if (dphi34<0.) dphi34+=(2.*M_PI);
cout<<" Cx-2x3: "<<setw(6)<<Angle(dphi23).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[3]).ToDegree()<<endl;
cout<<" Cx-2x4: "<<setw(6)<<Angle(dphi24).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[4]).ToDegree()<<endl;
cout<<" Cx-3x4: "<<setw(6)<<Angle(dphi34).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[5]).ToDegree()<<endl;
ofr<<"# Cx-2x3: "<<setw(6)<<Angle(dphi23).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[3]).ToDegree()<<endl;
ofr<<"# Cx-2x4: "<<setw(6)<<Angle(dphi24).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[4]).ToDegree()<<endl;
ofr<<"# Cx-3x4: "<<setw(6)<<Angle(dphi34).ToDegree()<<" ==? "<<setw(6)<<Angle(v_phase[5]).ToDegree()<<endl;
fit_cx_done=true;
acxd_.v_cxbeams=v_cxbeams;
acxd_.v_phase=v_phase;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment