#include "simtoipr.h" #include "toimanager.h" #include "pexceptions.h" #include "ctimer.h" SimpleDeglitcher::SimpleDeglitcher(int wsz, double ns, int maxnpt) { if (wsz < 5) wsz = 5; if (wsz%2 == 0) wsz++; if (maxnpt > wsz) maxnpt = wsz; cout << "SimpleDeglitcher::SimpleDeglitcher() WSize= " << wsz << " nSig=" << ns << " maxNPt=" << maxnpt << endl; wsize = wsz; nsig = ns; maxpoints = maxnpt; totnscount = glnscount = glcount = 0; deglitchdone = false; } SimpleDeglitcher::~SimpleDeglitcher() { } void SimpleDeglitcher::PrintStatus(ostream & os) { os << "\n ------------------------------------------------------ \n" << " SimpleDeglitcher::PrintStatus() - WindowSize=" << WSize() << " NbSigmas=" << NbSigmas() << " MaxPoints=" << MaxPoints() << endl; TOIProcessor::PrintStatus(os); if (deglitchdone) os << " Deglitching performed " << endl; else os << " NO deglitching done " << endl; double nst = (TotalSampleCount() > 0) ? TotalSampleCount() : 1.; os << " TotalSampleCount=" << TotalSampleCount() << " GlitchCount= " << GlitchCount() << " GlitchSampleCount=" << GlitchSampleCount() << "( " << (double)GlitchSampleCount()*100./nst << " % )" << endl; os << " ------------------------------------------------------ " << endl; } void SimpleDeglitcher::init() { cout << "SimpleDeglitcher::init" << endl; declareInput("in"); declareOutput("out"); declareOutput("mean"); declareOutput("sigma"); declareOutput("incopie"); name = "SimpleDeglitcher"; // upExtra = 1; A quoi ca sert ? } void SimpleDeglitcher::run() { // TOIManager* mgr = TOIManager::getManager(); int snb = getMinIn(); int sne = getMaxIn(); bool fgout = checkOutputTOIIndex(0); bool fgmean = checkOutputTOIIndex(1); bool fgsigma = checkOutputTOIIndex(2); bool fgincopie = checkOutputTOIIndex(3); if (!checkInputTOIIndex(0)) { cerr << " SimpleDeglitcher::run() - Input TOI (in) not connected! " << endl; throw ParmError("SimpleDeglitcher::run() Input TOI (in) not connected!"); } if (!fgout && !fgmean && !fgsigma &&!fgincopie) { cerr << " SimpleDeglitcher::run() - No Output TOI connected! " << endl; throw ParmError("SimpleDeglitcher::run() No output TOI connected!"); } if (!fgout) { cout << "Warning: SimpleDeglitcher::run() - No TOI connected to out \n" << " No deglitching would be performed !" << endl; } cout << " SimpleDeglitcher::run() SNRange=" << snb << " - " << sne << endl; try { Timer tm("SimpleDeglitcher::run()"); // Le debut int wsz2 = wsize/2; Vector vin(wsize); int k; for(k=0; k= maxpoints) { // serie de points > seuil for(ii=kgl; ii<=k; ii++) // -> Donc pas glitch putData(0, ii+snb, vin(ii%wsize), 0); lastput = snb+k; fgglitch = false; } } else { if (kgl < 0) { // debut possible de glitch fgglitch = true; kgl = k; } else { // On est toujours dans une serie > seuil putData(0, k+snb, valcur, 0); lastput = snb+k; } } } // if (k%5000 == 0) cout << " ---DBG2: K=" << k << " glcount=" // << glcount << " LastPut= " << lastput << endl; } // Fin de Boucle sur les num-sample //DBG cout << " La fin lastput=" << lastput << " SNE=" << sne; //DBG for(k=lastput-snb+1; kwsz2) && (k