| [1738] | 1 | // ArchTOIPipe           (C)     CEA/DAPNIA/SPP IN2P3/LAL | 
|---|
|  | 2 | //                               Eric Aubourg | 
|---|
|  | 3 | //                               Christophe Magneville | 
|---|
|  | 4 | //                               Reza Ansari | 
|---|
| [1760] | 5 | // $Id: simtst.cc,v 1.18 2001-11-13 16:01:39 aubourg Exp $ | 
|---|
| [1738] | 6 |  | 
|---|
| [1478] | 7 | /*   Test de processeurs ds simtoipr.cc   - Reza Avril 2001 | 
|---|
|  | 8 |  | 
|---|
|  | 9 | ----------------   Exemple d'appel  --------------------- | 
|---|
| [1484] | 10 | csh> simtst -start 104385384 -end 104399964 -range -500,500 \ | 
|---|
|  | 11 | -intoi boloMuV_26 -wtoi 8192 -wdegli 1024 \ | 
|---|
|  | 12 | inputbolo.fits filt.fits xx.ppf | 
|---|
|  | 13 | # Avec Filtre de Fourier | 
|---|
|  | 14 | csh> simtst -start 104385384 -end 104399964 -range -500,500 \ | 
|---|
|  | 15 | -intoi boloMuV_26 -wtoi 8192 -wdegli 1024 \ | 
|---|
|  | 16 | -wfft 4096 -keepfft 5 -killfreq 15,4,2.5 \ | 
|---|
|  | 17 | inputbolo.fits filtfft.fits spectre.ppf | 
|---|
|  | 18 | # Autre exemple b545k02 | 
|---|
|  | 19 | cool> ./simtst -start 104389122 -end 104649122 -range -1000.,1000. -intoi boloMu | 
|---|
|  | 20 | V_23 -wtoi 8192 -wdegli 1024 -wfft 4096 -keepfft 5 -killfreq 15,4,2.5 Cmv/b545k02 | 
|---|
|  | 21 | 2_16.00_16.49.fits b545.fits b545.ppf | 
|---|
|  | 22 |  | 
|---|
| [1478] | 23 | */ | 
|---|
|  | 24 |  | 
|---|
|  | 25 |  | 
|---|
|  | 26 |  | 
|---|
| [1462] | 27 | #include "machdefs.h" | 
|---|
| [1468] | 28 | #include <math.h> | 
|---|
| [1462] | 29 | #include "array.h" | 
|---|
| [1442] | 30 | #include <unistd.h> | 
|---|
|  | 31 | #include "toi.h" | 
|---|
|  | 32 | #include "toiprocessor.h" | 
|---|
|  | 33 | #include "fitstoirdr.h" | 
|---|
|  | 34 | #include "fitstoiwtr.h" | 
|---|
|  | 35 | #include "toisqfilter.h" | 
|---|
|  | 36 | #include "toimanager.h" | 
|---|
|  | 37 | #include "simtoipr.h" | 
|---|
| [1500] | 38 | #include "nooppr.h" | 
|---|
| [1442] | 39 | #include "toiseqbuff.h" | 
|---|
|  | 40 | #include "timing.h" | 
|---|
|  | 41 | #include "sambainit.h" | 
|---|
| [1760] | 42 | #include <stdexcept> | 
|---|
| [1442] | 43 |  | 
|---|
|  | 44 | void Usage(bool fgerr) | 
|---|
|  | 45 | { | 
|---|
|  | 46 | cout << endl; | 
|---|
|  | 47 | if (fgerr) { | 
|---|
| [1484] | 48 | cout << " simtst : Argument Error ! simtst -h for usage " << endl; | 
|---|
| [1442] | 49 | exit(1); | 
|---|
|  | 50 | } | 
|---|
|  | 51 | else { | 
|---|
| [1484] | 52 | cout << "\n Usage : simtst [-intoi toiname] [-start snb] [-end sne] \n" | 
|---|
|  | 53 | << "         [-dbg] [-wtoi sz] [-wdegli sz] [-range min,max] \n" | 
|---|
| [1500] | 54 | << "         [-degli ns,ns2,mxpt,mnpt,wrec] [-gfilt wsz,sigma] \n" | 
|---|
|  | 55 | << "         [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf] \n" | 
|---|
|  | 56 | << "         [-nooutflg] [-nowrtms] [-nowrticd] \n" | 
|---|
| [1483] | 57 | << "         inFitsName outFitsName  outPPFName \n" | 
|---|
| [1442] | 58 | << "   -dbg : sets TOISeqBuffered debug level to 1 \n" | 
|---|
|  | 59 | << "   -start snb : sets the start sample num \n" | 
|---|
|  | 60 | << "   -end sne : sets the end sample num \n" | 
|---|
| [1454] | 61 | << "   -range min,max : sets the acceptable range for intoi \n" | 
|---|
|  | 62 | << "              default= -16000,16000\n" | 
|---|
| [1467] | 63 | << "   -intoi toiName : select input TOI name (def boloMuV_27)\n" | 
|---|
|  | 64 | << "   -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n" | 
|---|
|  | 65 | << "   -wdegli sz : sets deglitcher window size (def= 512) \n" | 
|---|
| [1500] | 66 | << "   -degli ns,ns2,maxnpt,minnpt,wrec : sets deglitcher parameters\n" | 
|---|
|  | 67 | << "   -gfilt wsz,sigma : Gaussian filter window size and sigma\n" | 
|---|
| [1479] | 68 | << "   -wfft sz : Activate Fourier filter and sets its width \n" | 
|---|
|  | 69 | << "   -keepfft n : Keeps n spectra (if Fourier filter activated) \n" | 
|---|
| [1484] | 70 | << "   -killfreq bf,nharm,sigf : kills nharm frequency, basefreq=bf \n" | 
|---|
| [1500] | 71 | << "              with a gaussian with width=sigf \n" | 
|---|
|  | 72 | << "   -nooutflg : Don't write flags to output FITS \n" | 
|---|
|  | 73 | << "   -nowrtms : Don't write mean/sigma TOI's \n" | 
|---|
|  | 74 | << "   -nowrticd : Don't write incopie,degli,deglioffset TOI's \n" | 
|---|
| [1442] | 75 | << endl; | 
|---|
|  | 76 | } | 
|---|
|  | 77 | } | 
|---|
|  | 78 |  | 
|---|
|  | 79 | int main(int narg, char** arg) { | 
|---|
|  | 80 |  | 
|---|
|  | 81 | if ((narg > 1) && (strcmp(arg[1],"-h") == 0) ) Usage(false); | 
|---|
|  | 82 |  | 
|---|
|  | 83 | cout << "simtst starting - Decoding arguments " << " narg=" << narg << endl; | 
|---|
|  | 84 |  | 
|---|
|  | 85 | bool fgdbg = false; | 
|---|
| [1483] | 86 | bool fgsetstart = false; | 
|---|
| [1479] | 87 | int wtoi = 8192; | 
|---|
|  | 88 | int wdegli = 512; | 
|---|
| [1500] | 89 |  | 
|---|
| [1479] | 90 | int wfft = 4096; | 
|---|
|  | 91 | int keepfft = 0; | 
|---|
| [1442] | 92 | int nmax = 10; | 
|---|
| [1483] | 93 | int istart = 0; | 
|---|
| [1442] | 94 | int iend = 0; | 
|---|
| [1501] | 95 |  | 
|---|
| [1454] | 96 | double range_min = -16000; | 
|---|
|  | 97 | double range_max = 16000.; | 
|---|
| [1500] | 98 |  | 
|---|
|  | 99 | // Deglitcher parameters | 
|---|
|  | 100 | double degli_ns1 = 3.; | 
|---|
|  | 101 | double degli_ns2 = 1.5; | 
|---|
|  | 102 | int degli_minnpt = 2; | 
|---|
|  | 103 | int degli_maxnpt = 4; | 
|---|
|  | 104 | int degli_wrec = 10; | 
|---|
|  | 105 |  | 
|---|
|  | 106 | // Gaussian filter parameters | 
|---|
|  | 107 | int gfilt_wsz = 16; | 
|---|
|  | 108 | double gfilt_sigma = 2.; | 
|---|
|  | 109 |  | 
|---|
|  | 110 | // File names | 
|---|
| [1442] | 111 | string infile; | 
|---|
|  | 112 | string outfile; | 
|---|
| [1483] | 113 | string outppfname; | 
|---|
| [1467] | 114 | string intoi = "boloMuV_27"; | 
|---|
| [1500] | 115 |  | 
|---|
|  | 116 | bool fg_wrtflag = true; | 
|---|
|  | 117 | bool fg_nowrtms = false; | 
|---|
|  | 118 | bool fg_nowrticd = false; | 
|---|
|  | 119 |  | 
|---|
|  | 120 |  | 
|---|
| [1479] | 121 | bool fg_f_filt = false; | 
|---|
| [1484] | 122 | bool fg_killfreq = false; | 
|---|
|  | 123 | int bf_killfreq = 1; | 
|---|
|  | 124 | int nharm_killfreq = 1; | 
|---|
|  | 125 | double sigf_killfreq = 1.; | 
|---|
| [1442] | 126 |  | 
|---|
|  | 127 | if (narg < 4) Usage(true); | 
|---|
|  | 128 | int ko=1; | 
|---|
|  | 129 | // decoding arguments | 
|---|
|  | 130 | for(int ia=1; ia<narg; ia++) { | 
|---|
|  | 131 | if (strcmp(arg[ia],"-start") == 0) { | 
|---|
|  | 132 | if (ia == narg-1) Usage(true);  // -start est suivi d'un argument | 
|---|
|  | 133 | istart = atoi(arg[ia+1]); ia++; | 
|---|
| [1483] | 134 | fgsetstart = true; | 
|---|
| [1442] | 135 | } | 
|---|
|  | 136 | else if (strcmp(arg[ia],"-end") == 0) { | 
|---|
|  | 137 | if (ia == narg-1) Usage(true); | 
|---|
|  | 138 | iend = atoi(arg[ia+1]); ia++; | 
|---|
|  | 139 | } | 
|---|
| [1467] | 140 | else if (strcmp(arg[ia],"-wtoi") == 0) { | 
|---|
| [1442] | 141 | if (ia == narg-1) Usage(true); | 
|---|
| [1479] | 142 | wtoi = atoi(arg[ia+1]); ia++; | 
|---|
| [1442] | 143 | } | 
|---|
| [1467] | 144 | else if (strcmp(arg[ia],"-wdegli") == 0) { | 
|---|
| [1442] | 145 | if (ia == narg-1) Usage(true); | 
|---|
| [1479] | 146 | wdegli = atoi(arg[ia+1]); ia++; | 
|---|
| [1442] | 147 | } | 
|---|
| [1500] | 148 | else if (strcmp(arg[ia],"-degli") == 0) { | 
|---|
|  | 149 | if (ia == narg-1) Usage(true); | 
|---|
|  | 150 | sscanf(arg[ia+1],"%lf,%lf,%d,%d,%d",  °li_ns1, °li_ns2, | 
|---|
|  | 151 | °li_maxnpt, °li_minnpt, °li_wrec); | 
|---|
|  | 152 | ia++; | 
|---|
|  | 153 | } | 
|---|
|  | 154 | else if (strcmp(arg[ia],"-gfilt") == 0) { | 
|---|
|  | 155 | if (ia == narg-1) Usage(true); | 
|---|
|  | 156 | sscanf(arg[ia+1],"%d,%lf", &gfilt_wsz, &gfilt_sigma); | 
|---|
|  | 157 | ia++; | 
|---|
|  | 158 | } | 
|---|
| [1479] | 159 | else if (strcmp(arg[ia],"-wfft") == 0) { | 
|---|
|  | 160 | if (ia == narg-1) Usage(true); | 
|---|
|  | 161 | wfft = atoi(arg[ia+1]); ia++; | 
|---|
|  | 162 | fg_f_filt = true; | 
|---|
|  | 163 | } | 
|---|
|  | 164 | else if (strcmp(arg[ia],"-keepfft") == 0) { | 
|---|
|  | 165 | if (ia == narg-1) Usage(true); | 
|---|
|  | 166 | keepfft = atoi(arg[ia+1]); ia++; | 
|---|
|  | 167 | } | 
|---|
| [1484] | 168 | else if (strcmp(arg[ia],"-killfreq") == 0) { | 
|---|
|  | 169 | if (ia == narg-1) Usage(true); | 
|---|
|  | 170 | sscanf(arg[ia+1],"%d,%d,%lf",&bf_killfreq, &nharm_killfreq, &sigf_killfreq); | 
|---|
|  | 171 | fg_killfreq = true; | 
|---|
|  | 172 | ia++; | 
|---|
|  | 173 | } | 
|---|
| [1454] | 174 | else if (strcmp(arg[ia],"-range") == 0) { | 
|---|
|  | 175 | if (ia == narg-1) Usage(true); | 
|---|
|  | 176 | sscanf(arg[ia+1],"%lf,%lf",&range_min, &range_max); | 
|---|
|  | 177 | ia++; | 
|---|
|  | 178 | } | 
|---|
|  | 179 | else if (strcmp(arg[ia],"-intoi") == 0) { | 
|---|
|  | 180 | if (ia == narg-1) Usage(true); | 
|---|
|  | 181 | intoi = arg[ia+1]; ia++; | 
|---|
|  | 182 | } | 
|---|
| [1442] | 183 | else if (strcmp(arg[ia],"-dbg") == 0)  fgdbg = true; | 
|---|
| [1500] | 184 | else if (strcmp(arg[ia],"-nooutflg") == 0)  fg_wrtflag = false; | 
|---|
|  | 185 | else if (strcmp(arg[ia],"-nowrtms") == 0)  fg_nowrtms = true; | 
|---|
|  | 186 | else if (strcmp(arg[ia],"-nowrticd") == 0)  fg_nowrticd = true; | 
|---|
| [1442] | 187 |  | 
|---|
|  | 188 | else { ko = ia; break; }  // Debut des noms | 
|---|
|  | 189 | } | 
|---|
|  | 190 |  | 
|---|
| [1479] | 191 | if (iend < istart) iend = istart+wtoi*(nmax+5); | 
|---|
| [1483] | 192 | if ((narg-ko) < 3)  Usage(true); | 
|---|
| [1442] | 193 | infile = arg[ko]; | 
|---|
|  | 194 | outfile = arg[ko+1]; | 
|---|
| [1483] | 195 | outppfname = arg[ko+2]; | 
|---|
| [1442] | 196 |  | 
|---|
|  | 197 | cout << " Initializing SOPHYA ... " << endl; | 
|---|
|  | 198 | SophyaInit(); | 
|---|
|  | 199 | InitTim(); | 
|---|
|  | 200 |  | 
|---|
| [1484] | 201 | cout << ">>>> simtst: Infile= " << infile << " outFile=" | 
|---|
| [1479] | 202 | << outfile << endl; | 
|---|
|  | 203 | cout << ">>>> Window Size WTOI= " << wtoi << " WDEGLI= " << wdegli | 
|---|
| [1442] | 204 | << "  iStart= " << istart << " iEnd= " << iend << endl; | 
|---|
| [1454] | 205 | cout << ">>>> InTOIName= " << intoi << endl; | 
|---|
| [1479] | 206 |  | 
|---|
| [1442] | 207 | try { | 
|---|
|  | 208 | TOIManager* mgr = TOIManager::getManager(); | 
|---|
|  | 209 |  | 
|---|
|  | 210 | //  mgr->setRequestedSample(11680920,11710584); | 
|---|
|  | 211 | //  mgr->setRequestedSample(104121000, 104946120); | 
|---|
| [1629] | 212 | if (fgsetstart) | 
|---|
| [1483] | 213 | mgr->setRequestedSample(istart, iend); | 
|---|
| [1629] | 214 |  | 
|---|
| [1442] | 215 | //    FITSTOIReader r("/data/Archeops/bolo11.fits); | 
|---|
|  | 216 | FITSTOIReader r(infile); | 
|---|
|  | 217 | cout << "reader created" << endl; | 
|---|
|  | 218 | //    FITSTOIWriter w("/data/Archeops/rz.fits"); | 
|---|
|  | 219 | FITSTOIWriter w(outfile); | 
|---|
|  | 220 | cout << "fits writer created" << endl; | 
|---|
|  | 221 |  | 
|---|
|  | 222 |  | 
|---|
| [1479] | 223 | int w1 = wtoi; | 
|---|
| [1491] | 224 | int w2 = (fg_f_filt) ? wfft+3*w1 : w1; | 
|---|
| [1479] | 225 |  | 
|---|
| [1454] | 226 | //    char * colname[5] = {"MJD", "UTC","boloMuV_11","magnFlux","pivot"}; | 
|---|
| [1442] | 227 | TOISeqBuffered * toiin = new TOISeqBuffered("f2in", w1); | 
|---|
|  | 228 | if (fgdbg) toiin->setDebugLevel(1); | 
|---|
| [1467] | 229 | TOISeqBuffered * toidegli = new TOISeqBuffered("degli", w1); | 
|---|
|  | 230 | if (fgdbg) toidegli->setDebugLevel(1); | 
|---|
| [1442] | 231 | TOISeqBuffered * toimean = new TOISeqBuffered("mean", w1); | 
|---|
|  | 232 | if (fgdbg) toimean->setDebugLevel(1); | 
|---|
| [1479] | 233 | TOISeqBuffered * toisig = new TOISeqBuffered("sigma", w2); | 
|---|
| [1442] | 234 | if (fgdbg) toisig->setDebugLevel(1); | 
|---|
| [1483] | 235 | TOISeqBuffered * toiincopie = new TOISeqBuffered("incopie", w2); | 
|---|
| [1443] | 236 | if (fgdbg) toiincopie->setDebugLevel(1); | 
|---|
| [1442] | 237 |  | 
|---|
|  | 238 |  | 
|---|
|  | 239 |  | 
|---|
|  | 240 | // Connecting TOI to FITSTOIReader Processor | 
|---|
|  | 241 | //    for(kk=0; kk<5; kk++) { | 
|---|
|  | 242 | //      r.addOutput(colname[kk], toitab[kk]); | 
|---|
|  | 243 | //    } | 
|---|
|  | 244 |  | 
|---|
| [1454] | 245 | //    int kk = 2; | 
|---|
|  | 246 | r.addOutput(intoi, toiin); | 
|---|
| [1442] | 247 | //  toi->dbg=true; | 
|---|
|  | 248 | //  r.addOutput("boloMuV_11", toi); | 
|---|
|  | 249 | cout << " connecting in/out to RzTOIProcessor ... " << endl; | 
|---|
|  | 250 |  | 
|---|
|  | 251 | //    TOIProcessor * filt = NULL; | 
|---|
|  | 252 |  | 
|---|
|  | 253 | cout << " Creating SimpleDeglitcher() " << endl; | 
|---|
| [1479] | 254 | SimpleDeglitcher degl(wdegli); | 
|---|
| [1500] | 255 | degl.SetDetectionParam(degli_ns1, degli_ns2, degli_maxnpt, | 
|---|
|  | 256 | degli_minnpt, degli_wrec); | 
|---|
|  | 257 |  | 
|---|
| [1454] | 258 | cout << " Setting Range for deglitcher: " << range_min | 
|---|
|  | 259 | << " - " << range_max << endl; | 
|---|
| [1479] | 260 |  | 
|---|
| [1454] | 261 | degl.SetRange(range_min, range_max); | 
|---|
| [1442] | 262 | degl.addInput("in", toiin); | 
|---|
| [1467] | 263 | degl.addOutput("out", toidegli); | 
|---|
| [1442] | 264 | degl.addOutput("mean", toimean); | 
|---|
|  | 265 | degl.addOutput("sigma", toisig); | 
|---|
| [1443] | 266 | degl.addOutput("incopie", toiincopie); | 
|---|
| [1467] | 267 |  | 
|---|
|  | 268 | cout << " Creating a FanOut SimpleFanOut Object " << endl; | 
|---|
|  | 269 | SimpleFanOut fanout(2,2); | 
|---|
|  | 270 | TOISeqBuffered * toidegli0 = new TOISeqBuffered("degli0", w1); | 
|---|
|  | 271 | if (fgdbg) toidegli0->setDebugLevel(1); | 
|---|
| [1479] | 272 | TOISeqBuffered * toidegli1 = new TOISeqBuffered("degli1", w2); | 
|---|
| [1442] | 273 |  | 
|---|
| [1467] | 274 | TOISeqBuffered * toimean0 = new TOISeqBuffered("mean0", w1); | 
|---|
|  | 275 | if (fgdbg) toimean0->setDebugLevel(1); | 
|---|
| [1479] | 276 | TOISeqBuffered * toimean1 = new TOISeqBuffered("mean1", w2); | 
|---|
| [1467] | 277 | if (fgdbg) toimean1->setDebugLevel(1); | 
|---|
|  | 278 |  | 
|---|
|  | 279 | fanout.addInput("in0", toidegli); | 
|---|
|  | 280 | fanout.addOutput("out0_0", toidegli0); | 
|---|
|  | 281 | fanout.addOutput("out0_1", toidegli1); | 
|---|
|  | 282 | fanout.addInput("in1", toimean); | 
|---|
|  | 283 | fanout.addOutput("out1_0", toimean0); | 
|---|
|  | 284 | fanout.addOutput("out1_1", toimean1); | 
|---|
|  | 285 |  | 
|---|
|  | 286 | cout << " Creating an Adder SimpleAdder Object " << endl; | 
|---|
|  | 287 | SimpleAdder adder(2); | 
|---|
|  | 288 | adder.addInput("in0", toidegli0); | 
|---|
|  | 289 | adder.addInput("in1", toimean0); | 
|---|
|  | 290 | adder.SetGain(0, 1.); | 
|---|
|  | 291 | adder.SetGain(1, -1.); | 
|---|
|  | 292 | TOISeqBuffered * toideglioff = new TOISeqBuffered("deglioff", w1); | 
|---|
|  | 293 | if (fgdbg) toideglioff->setDebugLevel(1); | 
|---|
|  | 294 | adder.addOutput("out", toideglioff); | 
|---|
|  | 295 |  | 
|---|
|  | 296 | cout << " Creating a GaussianFilter SimpleFilter Object " << endl; | 
|---|
| [1531] | 297 | double G_sigma = gfilt_sigma; | 
|---|
| [1468] | 298 | double G_a = 1./(G_sigma*sqrt(M_PI*2.)); | 
|---|
| [1531] | 299 | SimpleFilter filt(gfilt_wsz, SimpleFilter::GaussFilter, G_a, G_sigma); | 
|---|
| [1467] | 300 |  | 
|---|
|  | 301 | filt.addInput("in", toideglioff); | 
|---|
|  | 302 | TOISeqBuffered * toiout = new TOISeqBuffered("out", w1); | 
|---|
|  | 303 | if (fgdbg) toiout->setDebugLevel(1); | 
|---|
| [1479] | 304 | TOISeqBuffered * toideglioffcopie = new TOISeqBuffered("deglioffcopie", w2); | 
|---|
| [1467] | 305 | if (fgdbg) toideglioffcopie->setDebugLevel(1); | 
|---|
|  | 306 | filt.addOutput("out", toiout); | 
|---|
|  | 307 | filt.addOutput("incopie", toideglioffcopie); | 
|---|
|  | 308 |  | 
|---|
| [1484] | 309 | Vector fcoef(wfft/2+1); | 
|---|
|  | 310 | //    fcoef = RegularSequence(1., -2./wfft); | 
|---|
|  | 311 | fcoef = 1.; | 
|---|
|  | 312 | for(int kfk=0; kfk<nharm_killfreq; kfk++) { | 
|---|
|  | 313 | double cfreq = bf_killfreq*(kfk+1); | 
|---|
|  | 314 | double xfreq = 0.; | 
|---|
|  | 315 | for(int kfj=cfreq-3.*sigf_killfreq; kfj<= cfreq+3.*sigf_killfreq; kfj++) { | 
|---|
|  | 316 | if ( (kfj < 0) || (kfj >= fcoef.Size() ) )  continue; | 
|---|
|  | 317 | xfreq = (cfreq-kfj)/sigf_killfreq; | 
|---|
| [1531] | 318 | fcoef(kfj) -= exp(-xfreq*xfreq/2.0); | 
|---|
| [1484] | 319 | } | 
|---|
|  | 320 | } | 
|---|
| [1479] | 321 | cout << " Creating Fourier Filter ... " << endl; | 
|---|
|  | 322 | SimpleFourierFilter sfft(fcoef); | 
|---|
| [1483] | 323 | sfft.KeepSpectra(outppfname, keepfft); | 
|---|
| [1484] | 324 | sfft.ComputeMeanSpectra(true); | 
|---|
| [1479] | 325 | TOISeqBuffered * toifft = NULL; | 
|---|
|  | 326 | TOISeqBuffered * toifiltcopie = NULL; | 
|---|
|  | 327 |  | 
|---|
|  | 328 | if (fg_f_filt) { | 
|---|
|  | 329 | cout << " Connecting Fourier Filter ... " << endl; | 
|---|
|  | 330 | toifft = new TOISeqBuffered("fftout", w1); | 
|---|
|  | 331 | toifiltcopie = new TOISeqBuffered("filtcopie", w1); | 
|---|
|  | 332 | sfft.addInput("in",toiout); | 
|---|
|  | 333 | sfft.addOutput("out", toifft); | 
|---|
|  | 334 | sfft.addOutput("incopie", toifiltcopie); | 
|---|
|  | 335 | } | 
|---|
|  | 336 |  | 
|---|
| [1467] | 337 | cout << " Connecting to output (FitsWriter) " << endl; | 
|---|
|  | 338 |  | 
|---|
| [1500] | 339 |  | 
|---|
|  | 340 | // Pour connecter les lignes non connectees au FitsWriter | 
|---|
|  | 341 | NoOpProcessor noop[3]; | 
|---|
|  | 342 |  | 
|---|
|  | 343 | if (fg_nowrticd) noop[0].addInput("in", toiincopie); | 
|---|
|  | 344 | else w.addInput("in", toiincopie); | 
|---|
|  | 345 |  | 
|---|
| [1479] | 346 | if (fg_f_filt) { | 
|---|
| [1541] | 347 | w.addInput("filtout", toifiltcopie, fg_wrtflag); | 
|---|
|  | 348 | w.addInput("fftout", toifft, fg_wrtflag); | 
|---|
| [1479] | 349 | } | 
|---|
| [1541] | 350 | else   w.addInput("filtout", toiout, fg_wrtflag); | 
|---|
| [1442] | 351 |  | 
|---|
| [1500] | 352 | if (fg_nowrticd) { | 
|---|
|  | 353 | noop[1].addInput("in", toidegli1); | 
|---|
|  | 354 | noop[1].addInput("in2", toideglioffcopie); | 
|---|
|  | 355 | } | 
|---|
|  | 356 | else { | 
|---|
|  | 357 | w.addInput("degli", toidegli1); | 
|---|
|  | 358 | w.addInput("deglioff", toideglioffcopie); | 
|---|
|  | 359 | } | 
|---|
|  | 360 | if (fg_nowrtms) { | 
|---|
|  | 361 | noop[2].addInput("in", toimean1); | 
|---|
|  | 362 | noop[2].addInput("in2", toisig); | 
|---|
|  | 363 | } | 
|---|
|  | 364 | else { | 
|---|
|  | 365 | w.addInput("mean", toimean1); | 
|---|
|  | 366 | w.addInput("sigma", toisig); | 
|---|
|  | 367 | } | 
|---|
|  | 368 |  | 
|---|
| [1442] | 369 | cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl; | 
|---|
|  | 370 | r.PrintStatus(cout); | 
|---|
| [1467] | 371 | cout << " ------ FanOut::PrintStatus() : ----- " << endl; | 
|---|
|  | 372 | fanout.PrintStatus(cout); | 
|---|
|  | 373 | cout << " ------ Adder::PrintStatus() : ----- " << endl; | 
|---|
|  | 374 | adder.PrintStatus(cout); | 
|---|
|  | 375 | cout << " ------ Filter::PrintStatus() : ----- " << endl; | 
|---|
|  | 376 | filt.PrintStatus(cout); | 
|---|
| [1442] | 377 | cout << "----- FITSWriterTOI::PrintStatus() : ----- " << endl; | 
|---|
|  | 378 | w.PrintStatus(cout); | 
|---|
|  | 379 |  | 
|---|
| [1501] | 380 |  | 
|---|
|  | 381 |  | 
|---|
| [1442] | 382 | PrtTim("starting threads"); | 
|---|
|  | 383 | r.start(); | 
|---|
|  | 384 | degl.start(); | 
|---|
| [1467] | 385 | fanout.start(); | 
|---|
|  | 386 | adder.start(); | 
|---|
|  | 387 | filt.start(); | 
|---|
| [1479] | 388 | if (fg_f_filt) sfft.start(); | 
|---|
| [1442] | 389 | w.start(); | 
|---|
| [1500] | 390 | if (fg_nowrticd) { | 
|---|
|  | 391 | noop[0].start(); | 
|---|
|  | 392 | noop[1].start(); | 
|---|
|  | 393 | } | 
|---|
|  | 394 | if (fg_nowrtms) | 
|---|
|  | 395 | noop[2].start(); | 
|---|
| [1442] | 396 |  | 
|---|
| [1501] | 397 |  | 
|---|
|  | 398 | // ------------------- Impression continu de stat ------------------------ | 
|---|
| [1629] | 399 | ProcSampleCounter<SimpleFilter> stats(filt); | 
|---|
|  | 400 | stats.InfoMessage() = "simtst/Info"; | 
|---|
|  | 401 | stats.PrintStats(); | 
|---|
| [1501] | 402 | // ----------------------------------------------------------------------- | 
|---|
|  | 403 |  | 
|---|
| [1467] | 404 | /* | 
|---|
| [1454] | 405 | for(int jj=0; jj<3; jj++) { | 
|---|
|  | 406 | cout << *toiin; | 
|---|
| [1467] | 407 | cout << *toimean; | 
|---|
|  | 408 | cout << *toimean1; | 
|---|
| [1454] | 409 | cout << *toiout; | 
|---|
|  | 410 | sleep(1); | 
|---|
|  | 411 | } | 
|---|
|  | 412 | */ | 
|---|
|  | 413 |  | 
|---|
| [1442] | 414 | mgr->joinAll(); | 
|---|
|  | 415 | PrtTim("End threads"); | 
|---|
|  | 416 |  | 
|---|
|  | 417 | //    cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl; | 
|---|
|  | 418 | //    r.PrintStatus(cout); | 
|---|
|  | 419 | //    cout << "----- FITSWriterTOI::PrintStatus() : ----- " << endl; | 
|---|
|  | 420 | //    w.PrintStatus(cout); | 
|---|
|  | 421 |  | 
|---|
| [1467] | 422 | cout << " ------ toiin, toidegli and toiout Status information ------- " << endl; | 
|---|
| [1442] | 423 | cout << *toiin; | 
|---|
| [1467] | 424 | cout << *toidegli; | 
|---|
| [1442] | 425 | cout << *toiout; | 
|---|
| [1491] | 426 | if (fg_f_filt) { | 
|---|
|  | 427 | cout << *toisig; | 
|---|
|  | 428 | cout << *toimean1; | 
|---|
|  | 429 | } | 
|---|
| [1467] | 430 | cout << degl; | 
|---|
|  | 431 | cout << filt; | 
|---|
|  | 432 | cout << adder; | 
|---|
| [1479] | 433 | if (fg_f_filt) cout << sfft ; | 
|---|
| [1467] | 434 |  | 
|---|
| [1442] | 435 | } | 
|---|
|  | 436 | catch (PThrowable & exc) { | 
|---|
| [1500] | 437 | cerr << "\n simtst: Catched Exception \n" << (string)typeid(exc).name() | 
|---|
| [1442] | 438 | << " - Msg= " << exc.Msg() << endl; | 
|---|
|  | 439 | } | 
|---|
|  | 440 | catch (const std::exception & sex) { | 
|---|
| [1500] | 441 | cerr << "\n simtst: Catched std::exception \n" | 
|---|
| [1442] | 442 | << (string)typeid(sex).name() << endl; | 
|---|
|  | 443 | } | 
|---|
|  | 444 | catch (...) { | 
|---|
| [1500] | 445 | cerr << "\n simtst: some other exception was caught ! " << endl; | 
|---|
| [1442] | 446 | } | 
|---|
|  | 447 |  | 
|---|
|  | 448 | return(0); | 
|---|
|  | 449 | } | 
|---|