[2014] | 1 | // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
|
---|
| 2 | // Eric Aubourg
|
---|
| 3 | // Christophe Magneville
|
---|
| 4 | // Reza Ansari
|
---|
| 5 |
|
---|
| 6 | /* Traitement simple des donnees Archeops KS1-3 - Reza Juin 2002
|
---|
| 7 |
|
---|
| 8 | ---------------- Exemple d'appel ---------------------
|
---|
| 9 | csh> aksj02 -start 104385384 -end 104399964 -range -500,500 \
|
---|
| 10 | -intoi boloMuV_26 -wtoi 8192 -wclean 512,5 \
|
---|
| 11 | inputbolo.fits filt.fits xx.ppf
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | #include "machdefs.h"
|
---|
| 17 | #include <math.h>
|
---|
| 18 | #include <unistd.h>
|
---|
| 19 |
|
---|
| 20 | #include "toimanager.h"
|
---|
| 21 | #include "cgt.h"
|
---|
| 22 | #include "fitstoirdr.h"
|
---|
| 23 | #include "fitstoiwtr.h"
|
---|
| 24 | #include "simtoipr.h"
|
---|
| 25 | #include "simoffset.h"
|
---|
| 26 | #include "simcleaner.h"
|
---|
| 27 | #include "nooppr.h"
|
---|
| 28 | #include "timing.h"
|
---|
| 29 | #include "histinit.h"
|
---|
| 30 | #include "psighand.h"
|
---|
| 31 | #include <stdexcept>
|
---|
| 32 |
|
---|
| 33 | void Usage(bool fgerr)
|
---|
| 34 | {
|
---|
| 35 | cout << endl;
|
---|
| 36 | if (fgerr) {
|
---|
| 37 | cout << " aksj02 : Argument Error ! aksj02 -h for usage " << endl;
|
---|
| 38 | exit(1);
|
---|
| 39 | }
|
---|
| 40 | else {
|
---|
| 41 | cout << "\n Usage : aksj02 [-intoi toiname] [-start snb] [-end sne] \n"
|
---|
[2054] | 42 | << " [-dbg] [-wtoi sz] [-wclean wsz,nbw] [-range min,max] [-cleannsig nsig]\n"
|
---|
[2014] | 43 | << " [-soff wsz,nptfit,degpol] [-soffnt PPFName] \n"
|
---|
[2028] | 44 | << " [-soff2 wsz,nptfit,degpol] [-soff2nt PPFName] \n"
|
---|
[2047] | 45 | << " [-bgal toiname] [-bgalfile pointFitsName] [-bgalnf N]\n"
|
---|
| 46 | << " [-bgalcut bmin,bmax] [-bgal2cut bmin,bmax] \n"
|
---|
[2028] | 47 | << " [-gfilt wsz,sigma] \n"
|
---|
[2054] | 48 | << " [-nooutflg] [-wrtms] [-wrtifo] [-noprstat] [-useseqbuff] \n"
|
---|
[2014] | 49 | << " inFitsName outFitsName \n"
|
---|
| 50 | << " -dbg : sets TOISeqBuffered debug level to 1 \n"
|
---|
| 51 | << " -start snb : sets the start sample num \n"
|
---|
| 52 | << " -end sne : sets the end sample num \n"
|
---|
| 53 | << " -range min,max : sets the acceptable range for intoi \n"
|
---|
| 54 | << " default= -16000,16000\n"
|
---|
| 55 | << " -intoi toiName : select input TOI name (def bolo)\n"
|
---|
| 56 | << " -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
|
---|
| 57 | << " -wclean wsz,nbw : sets cleaner window parameters (256,5) \n"
|
---|
[2054] | 58 | << " -cleannsig nsig : Sets cleanner ThrNSig (default = 999999.) \n"
|
---|
[2014] | 59 | << " -soff wsz,nptfit,degpol : set SimpleOffsetEstimator parameters\n"
|
---|
| 60 | << " -soffnt PPFName : Writes out SimpleOffsetEstimator NTuple \n"
|
---|
[2028] | 61 | << " -bgalcut bmin,bmax: Galactic latitude cut (in degree) for SimpleOffsetEstimator\n"
|
---|
| 62 | << " -bgal toiname: Galactic latitude toiname \n"
|
---|
| 63 | << " -bgalfile pointFitsName: Pointing FITS file name (for gal. latitude) \n"
|
---|
[2047] | 64 | << " -bgalnf n: Number of bgalfiles pointFitsName%d.fits \n"
|
---|
[2028] | 65 | << " -soff2 wsz,nptfit,degpol : set SimpleOffsetEstimator_2 parameters\n"
|
---|
| 66 | << " -soff2nt PPFName : Writes out SimpleOffsetEstimator_2 NTuple \n"
|
---|
| 67 | << " -bgal2cut bmin,bmax: Galactic latitude cut (in degree) for SimpleOffsetEstimator_2\n"
|
---|
[2014] | 68 | << " -gfilt wsz,sigma : Activate gaussian filter (par= window size, sigma) \n"
|
---|
| 69 | // << " -wfft sz : Activate Fourier filter and sets its width \n"
|
---|
| 70 | // << " -keepfft n : Keeps n spectra (if Fourier filter activated) \n"
|
---|
| 71 | // << " -killfreq bf,nharm,sigf : kills nharm frequency, basefreq=bf \n"
|
---|
| 72 | // << " with a gaussian with width=sigf \n"
|
---|
| 73 | << " -nooutflg : Don't write flags to output FITS \n"
|
---|
| 74 | << " -wrtms : Write mean/sigma TOI's from cleaner \n"
|
---|
| 75 | << " -wrtifo : Write incopie flagged TOI's from cleaner/ offset from SimpleOffsetEstimator \n"
|
---|
[2050] | 76 | << " -noprstat : DO NOT PrintStat with ProcSampleCounter \n"
|
---|
[2014] | 77 | << " -useseqbuff : Use TOISeqBuffered TOI's (default: TOISegmented) \n"
|
---|
| 78 | << endl;
|
---|
| 79 | }
|
---|
| 80 | if (fgerr) exit(1);
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | int main(int narg, char** arg) {
|
---|
| 84 |
|
---|
| 85 | if ((narg > 1) && (strcmp(arg[1],"-h") == 0) ) Usage(false);
|
---|
| 86 |
|
---|
| 87 | cout << "aksj02 starting - Decoding arguments " << " narg=" << narg << endl;
|
---|
| 88 |
|
---|
| 89 | bool fgdbg = false;
|
---|
| 90 | bool fgsetstart = false;
|
---|
| 91 |
|
---|
[2050] | 92 | bool fgprstat = true;
|
---|
[2014] | 93 | bool fgsegmented = true;
|
---|
| 94 |
|
---|
| 95 | int dbglev = 0;
|
---|
| 96 |
|
---|
| 97 | int wtoi = 8192;
|
---|
| 98 | int wdegli = 512;
|
---|
| 99 |
|
---|
| 100 | int nmax = 10;
|
---|
| 101 | int istart = 0;
|
---|
| 102 | int iend = 0;
|
---|
| 103 |
|
---|
| 104 | double range_min = -16000;
|
---|
| 105 | double range_max = 16000.;
|
---|
| 106 |
|
---|
| 107 | // cleaner parameters
|
---|
[2047] | 108 | int clean_wsz = 256;
|
---|
| 109 | int clean_nbw = 5;
|
---|
[2054] | 110 | double clean_nsig = 999999.;
|
---|
[2014] | 111 |
|
---|
| 112 | // SimpleOffsetEstimator parameters
|
---|
| 113 | int soff_mwsz = 256;
|
---|
| 114 | int soff_nptfit = 5;
|
---|
| 115 | int soff_degpol = 2;
|
---|
| 116 | bool soff_nt = false;
|
---|
| 117 | string soff_nt_ppfname = "";
|
---|
| 118 |
|
---|
| 119 | // SimpleOffsetEstimator (2) parameters
|
---|
| 120 | bool soff2_dofg = false;
|
---|
| 121 | int soff2_mwsz = 256;
|
---|
| 122 | int soff2_nptfit = 5;
|
---|
| 123 | int soff2_degpol = 2;
|
---|
| 124 | bool soff2_nt = false;
|
---|
| 125 | string soff2_nt_ppfname = "";
|
---|
| 126 |
|
---|
| 127 | // Gaussian filter parameters
|
---|
| 128 | bool gfilt_fg = false;
|
---|
| 129 | int gfilt_wsz = 16;
|
---|
| 130 | double gfilt_sigma = 2.;
|
---|
| 131 |
|
---|
| 132 | // Coordinate file for galactic cut
|
---|
| 133 | string pointfile = "pointgal.fits";
|
---|
[2028] | 134 | double bmin = -10;
|
---|
| 135 | double bmax = 10.;
|
---|
| 136 | bool bgalcut = false;
|
---|
[2014] | 137 | string bgaltoi = "bgal";
|
---|
[2028] | 138 | bool bgalfile = false;
|
---|
| 139 | double bmin2 = -10;
|
---|
| 140 | double bmax2 = 10.;
|
---|
| 141 | bool bgal2cut = false;
|
---|
[2047] | 142 | int bgalNbFiles = 0;
|
---|
[2014] | 143 |
|
---|
| 144 | // File names
|
---|
| 145 | string infile;
|
---|
| 146 | string outfile;
|
---|
| 147 | string outppfname;
|
---|
| 148 | string intoi = "bolo";
|
---|
| 149 |
|
---|
| 150 | bool fg_wrtflag = true;
|
---|
| 151 | bool fg_wrtms = false;
|
---|
| 152 | bool fg_wrtifo = false;
|
---|
| 153 |
|
---|
| 154 |
|
---|
| 155 | bool fg_f_filt = false;
|
---|
| 156 |
|
---|
| 157 | if (narg < 4) Usage(true);
|
---|
| 158 | int ko=1;
|
---|
| 159 | // decoding arguments
|
---|
| 160 | for(int ia=1; ia<narg; ia++) {
|
---|
| 161 | if (strcmp(arg[ia],"-start") == 0) {
|
---|
| 162 | if (ia == narg-1) Usage(true); // -start est suivi d'un argument
|
---|
| 163 | istart = atoi(arg[ia+1]); ia++;
|
---|
| 164 | fgsetstart = true;
|
---|
| 165 | }
|
---|
| 166 | else if (strcmp(arg[ia],"-end") == 0) {
|
---|
| 167 | if (ia == narg-1) Usage(true);
|
---|
| 168 | iend = atoi(arg[ia+1]); ia++;
|
---|
| 169 | }
|
---|
| 170 | else if (strcmp(arg[ia],"-wtoi") == 0) {
|
---|
| 171 | if (ia == narg-1) Usage(true);
|
---|
| 172 | wtoi = atoi(arg[ia+1]); ia++;
|
---|
| 173 | }
|
---|
| 174 | else if (strcmp(arg[ia],"-wclean") == 0) {
|
---|
| 175 | if (ia == narg-1) Usage(true);
|
---|
| 176 | wdegli = atoi(arg[ia+1]); ia++;
|
---|
| 177 | sscanf(arg[ia+1],"%d,%d", &clean_wsz, &clean_nbw);
|
---|
| 178 | }
|
---|
[2054] | 179 | else if (strcmp(arg[ia],"-cleannsig") == 0) {
|
---|
| 180 | if (ia == narg-1) Usage(true);
|
---|
| 181 | clean_nsig = atof(arg[ia+1]); ia++;
|
---|
| 182 | }
|
---|
| 183 | else if (strcmp(arg[ia],"-cleannsig") == 0) {
|
---|
| 184 | if (ia == narg-1) Usage(true);
|
---|
| 185 | clean_nsig = atof(arg[ia+1]); ia++;
|
---|
| 186 | }
|
---|
[2014] | 187 | else if (strcmp(arg[ia],"-soff") == 0) {
|
---|
| 188 | if (ia == narg-1) Usage(true);
|
---|
| 189 | sscanf(arg[ia+1],"%d,%d,%d", &soff_mwsz, &soff_nptfit, &soff_degpol);
|
---|
| 190 | ia++;
|
---|
| 191 | }
|
---|
| 192 | else if (strcmp(arg[ia],"-soffnt") == 0) {
|
---|
| 193 | soff_nt = true;
|
---|
| 194 | soff_nt_ppfname = arg[ia+1]; ia++;
|
---|
| 195 | }
|
---|
| 196 | else if (strcmp(arg[ia],"-soff2") == 0) {
|
---|
| 197 | if (ia == narg-1) Usage(true);
|
---|
| 198 | soff2_dofg = true;
|
---|
| 199 | sscanf(arg[ia+1],"%d,%d,%d", &soff2_mwsz, &soff2_nptfit, &soff2_degpol);
|
---|
| 200 | ia++;
|
---|
| 201 | }
|
---|
[2028] | 202 | else if (strcmp(arg[ia],"-soff2nt") == 0) {
|
---|
[2014] | 203 | soff2_nt = true;
|
---|
| 204 | soff2_nt_ppfname = arg[ia+1]; ia++;
|
---|
| 205 | }
|
---|
| 206 | else if (strcmp(arg[ia],"-gfilt") == 0) {
|
---|
| 207 | if (ia == narg-1) Usage(true);
|
---|
| 208 | sscanf(arg[ia+1],"%d,%lf", &gfilt_wsz, &gfilt_sigma);
|
---|
| 209 | gfilt_fg = true;
|
---|
| 210 | ia++;
|
---|
| 211 | }
|
---|
| 212 | else if (strcmp(arg[ia],"-bgalcut") == 0) {
|
---|
| 213 | if (ia == narg-1) Usage(true);
|
---|
| 214 | sscanf(arg[ia+1],"%lf,%lf", &bmin, &bmax);
|
---|
| 215 | bgalcut = true;
|
---|
| 216 | ia++;
|
---|
| 217 | }
|
---|
[2028] | 218 | else if (strcmp(arg[ia],"-bgal2cut") == 0) {
|
---|
| 219 | if (ia == narg-1) Usage(true);
|
---|
| 220 | sscanf(arg[ia+1],"%lf,%lf", &bmin2, &bmax2);
|
---|
| 221 | bgal2cut = true;
|
---|
| 222 | ia++;
|
---|
| 223 | }
|
---|
[2014] | 224 | else if (strcmp(arg[ia],"-bgalfile") == 0) {
|
---|
| 225 | if (ia == narg-1) Usage(true);
|
---|
| 226 | pointfile = arg[ia+1];
|
---|
[2028] | 227 | bgalfile = true;
|
---|
[2014] | 228 | ia++;
|
---|
| 229 | }
|
---|
[2047] | 230 | else if (strcmp(arg[ia],"-bgalnf") == 0) {
|
---|
| 231 | if (ia == narg-1) Usage(true);
|
---|
| 232 | bgalNbFiles = atoi(arg[ia+1]);
|
---|
| 233 | ia++;
|
---|
| 234 | }
|
---|
[2014] | 235 | else if (strcmp(arg[ia],"-bgal") == 0) {
|
---|
| 236 | if (ia == narg-1) Usage(true);
|
---|
| 237 | bgaltoi = arg[ia+1];
|
---|
| 238 | ia++;
|
---|
| 239 | }
|
---|
| 240 | else if (strcmp(arg[ia],"-range") == 0) {
|
---|
| 241 | if (ia == narg-1) Usage(true);
|
---|
| 242 | sscanf(arg[ia+1],"%lf,%lf",&range_min, &range_max);
|
---|
| 243 | ia++;
|
---|
| 244 | }
|
---|
| 245 | else if (strcmp(arg[ia],"-intoi") == 0) {
|
---|
| 246 | if (ia == narg-1) Usage(true);
|
---|
| 247 | intoi = arg[ia+1]; ia++;
|
---|
| 248 | }
|
---|
| 249 | else if (strcmp(arg[ia],"-dbg") == 0) fgdbg = true;
|
---|
| 250 | else if (strcmp(arg[ia],"-nooutflg") == 0) fg_wrtflag = false;
|
---|
| 251 | else if (strcmp(arg[ia],"-wrtms") == 0) fg_wrtms = true;
|
---|
| 252 | else if (strcmp(arg[ia],"-wrtifo") == 0) fg_wrtifo = true;
|
---|
| 253 |
|
---|
| 254 | else if (strcmp(arg[ia],"-prstat") == 0) fgprstat = true;
|
---|
[2050] | 255 | else if (strcmp(arg[ia],"-noprstat") == 0) fgprstat = false;
|
---|
[2014] | 256 | else if (strcmp(arg[ia],"-useseqbuff") == 0) fgsegmented = false;
|
---|
| 257 |
|
---|
| 258 | else { ko = ia; break; } // Debut des noms
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | if (iend < istart) iend = istart+wtoi*(nmax+5);
|
---|
| 262 | if ((narg-ko) < 2) Usage(true);
|
---|
| 263 | infile = arg[ko];
|
---|
| 264 | outfile = arg[ko+1];
|
---|
| 265 | // outppfname = arg[ko+2];
|
---|
| 266 |
|
---|
| 267 | cout << " Initializing SOPHYA ... " << endl;
|
---|
| 268 | SophyaInit();
|
---|
| 269 | SophyaConfigureSignalhandling(true);
|
---|
| 270 |
|
---|
| 271 | InitTim();
|
---|
[2024] | 272 | if ((soff2_dofg == true) && (wtoi < 32768)) wtoi = 32768;
|
---|
[2028] | 273 | if (!bgalfile) bgalcut = bgal2cut = false;
|
---|
| 274 |
|
---|
[2014] | 275 | cout << ">>>> aksj02: Infile= " << infile << " outFile="
|
---|
| 276 | << outfile << endl;
|
---|
| 277 | cout << ">>>> Window Size WTOI= " << wtoi << " WDEGLI= " << wdegli
|
---|
| 278 | << " iStart= " << istart << " iEnd= " << iend << endl;
|
---|
| 279 | cout << ">>>> InTOIName= " << intoi << endl;
|
---|
| 280 |
|
---|
| 281 | try {
|
---|
| 282 | TOIManager* mgr = TOIManager::getManager();
|
---|
| 283 |
|
---|
| 284 | // mgr->setRequestedSample(11680920,11710584);
|
---|
| 285 | // mgr->setRequestedSample(104121000, 104946120);
|
---|
| 286 | if (fgsetstart)
|
---|
| 287 | mgr->setRequestedSample(istart, iend);
|
---|
| 288 |
|
---|
| 289 | cout << "> Creating FITSTOIReader object - InFile=" << infile << endl;
|
---|
| 290 | FITSTOIReader r(infile);
|
---|
| 291 |
|
---|
| 292 | cout << "> Creating SimpleCleaner() " << endl;
|
---|
| 293 | SimpleCleaner cleaner(clean_wsz, clean_nbw);
|
---|
| 294 | cout << " Setting Range for cleaner: " << range_min
|
---|
| 295 | << " - " << range_max << endl;
|
---|
| 296 | cleaner.SetRange(range_min, range_max);
|
---|
[2054] | 297 | cleaner.SetCleanForMeanThrNSig(clean_nsig);
|
---|
[2014] | 298 |
|
---|
| 299 | cout << "> Creating SimpleOffsetEstimator(" << soff_mwsz << "," << soff_nptfit
|
---|
| 300 | << "," << soff_degpol << ")" << endl;
|
---|
| 301 | SimpleOffsetEstimator offes(soff_mwsz, soff_nptfit, soff_degpol);
|
---|
| 302 | offes.SavePolyNTuple(soff_nt, soff_nt_ppfname);
|
---|
| 303 |
|
---|
[2035] | 304 | SimpleOffsetEstimator* offes2 = NULL;
|
---|
[2014] | 305 | if (soff2_dofg) {
|
---|
| 306 | cout << "> Creating 2nd SimpleOffsetEstimator(" << soff2_mwsz << "," << soff2_nptfit
|
---|
| 307 | << "," << soff2_degpol << ")" << endl;
|
---|
[2031] | 308 | offes2 = new SimpleOffsetEstimator(soff2_mwsz, soff2_nptfit, soff2_degpol);
|
---|
| 309 | offes2->SavePolyNTuple(soff2_nt, soff2_nt_ppfname);
|
---|
[2014] | 310 | }
|
---|
| 311 |
|
---|
[2031] | 312 | SimpleFilter *filt = NULL;
|
---|
| 313 | if (gfilt_fg) {
|
---|
[2014] | 314 | cout << "> Creating a GaussianFilter SimpleFilter Object " << endl;
|
---|
[2031] | 315 | double G_sigma = gfilt_sigma;
|
---|
| 316 | double G_a = 1./(G_sigma*sqrt(M_PI*2.));
|
---|
| 317 | filt = new SimpleFilter(gfilt_wsz, SimpleFilter::GaussFilter, G_a, G_sigma);
|
---|
| 318 | }
|
---|
[2014] | 319 |
|
---|
| 320 | FITSTOIReader* rbgal = NULL;
|
---|
[2028] | 321 | if (bgalfile) { // if Galactic cut
|
---|
[2047] | 322 | string pointfileI = pointfile;
|
---|
| 323 | MuTyV numf=0;
|
---|
| 324 | if(bgalNbFiles > 0) {
|
---|
| 325 | pointfileI += (string)numf + ".fits";
|
---|
| 326 | }
|
---|
| 327 | cout << "> Creating bgal FITSTOIReader object - InFile=" << pointfileI
|
---|
[2014] | 328 | << " bgaltoiname= " << bgaltoi << endl;
|
---|
[2047] | 329 | rbgal = new FITSTOIReader(pointfileI);
|
---|
| 330 | if(bgalNbFiles > 0)
|
---|
| 331 | for(int kff=1; kff<bgalNbFiles; kff++) {
|
---|
| 332 | numf=kff;
|
---|
| 333 | pointfileI = pointfile;
|
---|
| 334 | pointfileI += (string)numf + ".fits";
|
---|
| 335 | cout << " bgal FITSTOIReader.addFile( " << pointfileI << " )" << endl;
|
---|
| 336 | rbgal->addFile( pointfileI );
|
---|
| 337 | }
|
---|
| 338 |
|
---|
[2028] | 339 | }
|
---|
| 340 |
|
---|
| 341 | if (bgalfile && bgalcut) {
|
---|
[2014] | 342 | cout << " offes.SetBGalCut( " << bmin << "," << bmax << ")" << endl;
|
---|
| 343 | offes.SetBGalCut(bmin, bmax);
|
---|
| 344 | }
|
---|
[2028] | 345 | if (soff2_dofg && bgalfile && bgal2cut) {
|
---|
| 346 | cout << " offes2.SetBGalCut( " << bmin2 << "," << bmax2 << ")" << endl;
|
---|
[2031] | 347 | offes2->SetBGalCut(bmin, bmax);
|
---|
[2028] | 348 | }
|
---|
[2014] | 349 |
|
---|
| 350 | cout << "> Creating FITSTOIWriter OutFitsName= " << outfile << endl;
|
---|
| 351 | FITSTOIWriter w(outfile);
|
---|
| 352 |
|
---|
| 353 | CGT plombier(fgsegmented, wtoi);
|
---|
| 354 | plombier.SetDebugLevel(dbglev);
|
---|
| 355 |
|
---|
| 356 | cout << "> Connecting Processors through plombier ... " << endl;
|
---|
| 357 | string inname = "in";
|
---|
| 358 | string outname = "out";
|
---|
| 359 | plombier.Connect(r, intoi, cleaner, inname);
|
---|
| 360 | plombier.Connect(cleaner, "out", offes, "in");
|
---|
[2028] | 361 |
|
---|
| 362 | if (soff2_dofg && bgalcut && bgal2cut ) {
|
---|
[2014] | 363 | inname = "bgal";
|
---|
[2028] | 364 | outname = "bgalcopie";
|
---|
[2014] | 365 | plombier.Connect(*rbgal, bgaltoi, offes, inname);
|
---|
[2031] | 366 | plombier.Connect(offes, outname, *offes2, inname);
|
---|
[2014] | 367 | }
|
---|
[2028] | 368 | else if (soff2_dofg && bgal2cut) {
|
---|
| 369 | inname = "bgal";
|
---|
[2031] | 370 | plombier.Connect(*rbgal, bgaltoi, *offes2, inname);
|
---|
[2028] | 371 | }
|
---|
| 372 | else if (bgalcut) {
|
---|
| 373 | inname = "bgal";
|
---|
| 374 | plombier.Connect(*rbgal, bgaltoi, offes, inname);
|
---|
| 375 | }
|
---|
[2014] | 376 |
|
---|
| 377 | if (soff2_dofg) {
|
---|
| 378 | inname = "in";
|
---|
| 379 | outname = "out";
|
---|
[2031] | 380 | plombier.Connect(offes, outname, *offes2, inname);
|
---|
[2014] | 381 | }
|
---|
| 382 |
|
---|
| 383 | if (gfilt_fg) {
|
---|
| 384 | if (soff2_dofg)
|
---|
[2031] | 385 | plombier.Connect(*offes2, "out", *filt, "in");
|
---|
[2014] | 386 | else
|
---|
[2031] | 387 | plombier.Connect(offes, "out", *filt, "in");
|
---|
| 388 | plombier.Connect(*filt, "out", w, "outfcln", "", 0, fg_wrtflag);
|
---|
[2014] | 389 | }
|
---|
[2027] | 390 | else {
|
---|
| 391 | if (soff2_dofg)
|
---|
[2031] | 392 | plombier.Connect(*offes2, "out", w, "outcln", "", 0, fg_wrtflag);
|
---|
[2027] | 393 | else
|
---|
| 394 | plombier.Connect(offes, "out", w, "outcln", "", 0, fg_wrtflag);
|
---|
| 395 | }
|
---|
[2014] | 396 |
|
---|
| 397 | if (fg_wrtifo) {
|
---|
[2036] | 398 | plombier.Connect(offes, "incopie", w, "inflg", "", 1.5*wtoi, fg_wrtflag);
|
---|
| 399 | plombier.Connect(offes, "offset", w, "offset", "", 1.5*wtoi);
|
---|
[2014] | 400 | if (soff2_dofg)
|
---|
[2036] | 401 | plombier.Connect(*offes2, "offset", w, "offset2", "", 2*wtoi);
|
---|
[2014] | 402 | }
|
---|
| 403 | if (fg_wrtms) {
|
---|
[2036] | 404 | plombier.Connect(cleaner, "mean", w, "mean", "", 3*wtoi);
|
---|
| 405 | plombier.Connect(cleaner, "sigma", w, "sigma", "", 3*wtoi);
|
---|
[2014] | 406 | }
|
---|
| 407 |
|
---|
| 408 | cout << "> Plombier status before start" << endl;
|
---|
| 409 | cout << plombier ;
|
---|
| 410 |
|
---|
| 411 | cout << cleaner;
|
---|
| 412 | cout << offes;
|
---|
[2031] | 413 | if (soff2_dofg) cout << *offes2;
|
---|
[2025] | 414 | cout << w;
|
---|
[2014] | 415 |
|
---|
| 416 | PrtTim("starting processors");
|
---|
| 417 | plombier.Start();
|
---|
| 418 |
|
---|
| 419 |
|
---|
| 420 | // ------------------- Impression continu de stat ------------------------
|
---|
| 421 | if (fgprstat) {
|
---|
| 422 | ProcSampleCounter<SimpleOffsetEstimator> stats(offes);
|
---|
| 423 | stats.InfoMessage() = "aksj02/Info";
|
---|
| 424 | stats.PrintStats();
|
---|
| 425 | }
|
---|
| 426 | // -----------------------------------------------------------------------
|
---|
| 427 |
|
---|
| 428 | cout << cleaner;
|
---|
| 429 | cout << offes;
|
---|
[2031] | 430 | if (soff2_dofg) cout << *offes2;
|
---|
| 431 | if (gfilt_fg) cout << *filt;
|
---|
[2014] | 432 | cout << w;
|
---|
| 433 |
|
---|
| 434 | mgr->joinAll();
|
---|
| 435 | PrtTim("End threads");
|
---|
| 436 | if (bgalcut) delete rbgal;
|
---|
[2031] | 437 | if (gfilt_fg) delete filt;
|
---|
| 438 | if (soff2_dofg) delete offes2;
|
---|
[2014] | 439 | }
|
---|
| 440 | catch (PThrowable & exc) {
|
---|
| 441 | cerr << "\n aksj02: Catched Exception \n" << (string)typeid(exc).name()
|
---|
| 442 | << " - Msg= " << exc.Msg() << endl;
|
---|
| 443 | }
|
---|
| 444 | catch (const std::exception & sex) {
|
---|
| 445 | cerr << "\n aksj02: Catched std::exception \n"
|
---|
| 446 | << (string)typeid(sex).name() << endl;
|
---|
| 447 | }
|
---|
| 448 | catch (...) {
|
---|
| 449 | cerr << "\n aksj02: some other exception was caught ! " << endl;
|
---|
| 450 | }
|
---|
| 451 |
|
---|
| 452 | return(0);
|
---|
| 453 | }
|
---|