// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL // Eric Aubourg // Christophe Magneville // Reza Ansari // $Id: rztoi.cc,v 1.9 2001-11-14 14:10:13 aubourg Exp $ #include "config.h" #include "array.h" #include "rztoi.h" #include "toimanager.h" #include "pexceptions.h" #include "fftpserver.h" #include "ctimer.h" RzTOIProc::RzTOIProc(int w1, int w2, int nmax) { cout << "RzTOIProc::RzTOIProc() Width= " << w1 << "," << w2 << " NMax=" << nmax; _width1 = w1; _width2 = w2; _nmax = nmax; } void RzTOIProc::init() { cout << "RzTOIProc::init" << endl; declareInput("in"); declareOutput("out"); name = "rzproc"; upExtra = 1; } void RzTOIProc::run() { // TOIManager* mgr = TOIManager::getManager(); int snb = getMinIn(); int sne = getMaxIn(); int istart, iend; int ilast; ilast = istart = snb; iend = sne; int ii, jj; try { Timer tm("RzTOIProc::run()"); FFTPackServer ffts; bool fgppf = false; int nkv = 0; // int nkvmx = 8; #define nkvmx 8 Vector vkin[nkvmx]; Vector vkout[nkvmx]; TVector< complex > vkfft[nkvmx]; if (outppf.length() > 0) fgppf = true; Vector vin, vout, vsave(_width2); TVector< complex > vfft; double vlast = 0.; for (int k=0; k<_nmax; k++) { // istart = snb + k*_width1; istart = snb + k*_width1 - k*_width2; iend = istart +_width1; cout << "---RzTOIProc::run() - Processing bloc k= " << k << " istart= " << istart << " iend= " << iend << endl; if (iend > sne) { cout << " RzTOIProc::run() - iend > getMaxIn() -> break " << endl; break; } // Vector vin = getData(0, istart, iend); vin.ReSize(_width1); if (k == 0) { jj = 0; for(ii=istart; ii End of getData() for bloc " << k << endl; vout.ReSize(vin.Size()); // cout << " DBG : Bloc[" << k << "] FirstSN=" << istart // << " LastSN= " << istart+vout.Size()-_width2-1 << endl; int i; for(i=0; i> End of putData() for bloc[" << k << "] FirstSN=" << istart << " LastSN= " << istart+vout.Size()-_width2-1 << " Mean vout= " << vout.Sum()/vout.Size() << endl; vin -= vout; TVector< complex > vfft; ffts.FFTForward(vin, vfft); ilast = iend; /* if (fgppf) { string nom; nom = "in" + (string)MuTyV(k); ppo->PutObject(vin, nom); nom = "out" + (string)MuTyV(k); ppo->PutObject(vout, nom); nom = "fft" + (string)MuTyV(k); ppo->PutObject(vfft, nom); } */ if (fgppf && (nkv < nkvmx) ) { vkin[nkv] = vin; vkout[nkv] = vout; vkfft[nkv] = vfft; nkv++; } tm.Split("End of bloc"); } if (fgppf) { cout << " Writing to Out PPF ... " << endl; POutPersist ppo(outppf); for(int kkk=0; kkk" << istart << endl; for(ii=_wsz-1; ii>=0; ii--) vin(ii) = getData(0, ii+istart); } else { // On parcourt vers l'avant cout << " ... Processing bloc[" << kb << "] SampleNum=" << istart << " ->" << istart+_wsz << endl; for(ii=0; ii<_wsz; ii++) vin(ii) = getData(0, ii+istart); } for(ii=0; ii<_wsz; ii++) putData(0, ii+istart, vin(ii)*_fact); snlast = istart+_wsz; } cout << " ... Processing remaining Samples - SN=" << snlast << " ->" << sne << endl; for(ii=snlast; ii<=sne; ii++) { val = getData(0, ii); putData(0, ii, val*_fact); } } catch (PException & e) { cout << "RzSimpleTOIProc exception " << (string)typeid(e).name() << "\n Msg= " << e.Msg() << endl; } }