source: Sophya/trunk/ArchTOIPipe/ProcWSophya/simtoipr.cc@ 1467

Last change on this file since 1467 was 1467, checked in by ansari, 24 years ago

Debug de SimpleDeglitcher, ajout de SimpleFanOut , Reza 12/4/2001

File size: 19.0 KB
RevLine 
[1462]1#include "array.h"
[1442]2#include "simtoipr.h"
[1454]3#include <math.h>
[1442]4#include "toimanager.h"
5#include "pexceptions.h"
6#include "ctimer.h"
7
8SimpleDeglitcher::SimpleDeglitcher(int wsz, double ns, int maxnpt)
9{
10 if (wsz < 5) wsz = 5;
11 if (wsz%2 == 0) wsz++;
12 if (maxnpt > wsz) maxnpt = wsz;
13
14 cout << "SimpleDeglitcher::SimpleDeglitcher() WSize= " << wsz
15 << " nSig=" << ns << " maxNPt=" << maxnpt << endl;
16
17 wsize = wsz;
18 nsig = ns;
19 maxpoints = maxnpt;
[1454]20 totnscount = glnscount = glcount = out_range_nscount = 0;
[1443]21 deglitchdone = false;
[1454]22 SetRange(-9.e39, 9.e39);
[1442]23}
24
25SimpleDeglitcher::~SimpleDeglitcher()
26{
27}
28
[1454]29
[1443]30void SimpleDeglitcher::PrintStatus(ostream & os)
31{
32 os << "\n ------------------------------------------------------ \n"
33 << " SimpleDeglitcher::PrintStatus() - WindowSize=" << WSize()
34 << " NbSigmas=" << NbSigmas() << " MaxPoints=" << MaxPoints() << endl;
[1454]35 os << " Range_Min= " << range_min << " Range_Max= " << range_max << endl;
[1443]36 TOIProcessor::PrintStatus(os);
37 if (deglitchdone) os << " Deglitching performed " << endl;
38 else os << " NO deglitching done " << endl;
[1454]39 double nst = (ProcessedSampleCount() > 0) ? ProcessedSampleCount() : 1.;
40 os << " ProcessedSampleCount=" << ProcessedSampleCount()
41 << " OutOfRangeSampleCount=" << OutOfRangeSampleCount() << endl;
42 os << " GlitchCount= " << GlitchCount()
43 << " GlitchSampleCount=" << GlitchSampleCount()
[1443]44 << "( " << (double)GlitchSampleCount()*100./nst << " % )" << endl;
45 os << " ------------------------------------------------------ " << endl;
46}
47
[1442]48void SimpleDeglitcher::init() {
49 cout << "SimpleDeglitcher::init" << endl;
50 declareInput("in");
51 declareOutput("out");
52 declareOutput("mean");
53 declareOutput("sigma");
[1443]54 declareOutput("incopie");
[1442]55 name = "SimpleDeglitcher";
56 // upExtra = 1; A quoi ca sert ?
57}
58
59void SimpleDeglitcher::run() {
60
61 // TOIManager* mgr = TOIManager::getManager();
62 int snb = getMinIn();
63 int sne = getMaxIn();
64
65 bool fgout = checkOutputTOIIndex(0);
66 bool fgmean = checkOutputTOIIndex(1);
67 bool fgsigma = checkOutputTOIIndex(2);
[1443]68 bool fgincopie = checkOutputTOIIndex(3);
[1442]69
70 if (!checkInputTOIIndex(0)) {
71 cerr << " SimpleDeglitcher::run() - Input TOI (in) not connected! "
72 << endl;
73 throw ParmError("SimpleDeglitcher::run() Input TOI (in) not connected!");
74 }
[1443]75 if (!fgout && !fgmean && !fgsigma &&!fgincopie) {
[1442]76 cerr << " SimpleDeglitcher::run() - No Output TOI connected! "
77 << endl;
78 throw ParmError("SimpleDeglitcher::run() No output TOI connected!");
79 }
80
81 if (!fgout) {
82 cout << "Warning: SimpleDeglitcher::run() - No TOI connected to out \n"
83 << " No deglitching would be performed !" << endl;
84 }
85
[1443]86 cout << " SimpleDeglitcher::run() SNRange=" << snb << " - " << sne << endl;
[1442]87 try {
[1443]88 Timer tm("SimpleDeglitcher::run()");
[1442]89 Vector vin(wsize);
[1467]90
91 int wrec = maxpoints*2;
92 Vector vrec(wrec);
93
[1454]94 TVector<int_8> vfg(wsize);
[1467]95 int wsz2 = wsize/2;
96 // Le debut
[1442]97 int k;
[1467]98 for(k=0; k<wsz2; k++)
[1464]99 getData(0, k+snb, vin(k), vfg(k));
100
[1467]101 int nokdebut = 0.;
102 double s = 0.;
103 double mean = 0.;
104 double s2 = 0.;
105 double sigma = 0.;
106 for(k=0; k<wsz2; k++) {
107 if ( vfg(k) != 0) continue;
108 if ( (vin(k) < range_min) || (vin(k) > range_max) ) continue;
109 s += vin(k);
110 s2 += vin(k)*vin(k);
111 nokdebut++;
[1454]112 }
[1467]113 if (nokdebut > 0) {
114 mean = s/nokdebut;
115 if (nokdebut > 1) sigma = sqrt(s2/nokdebut-mean*mean);
116 }
117 for(k=wsz2; k<wsize; k++) {
118 vin(k) = mean;
119 vfg(k) = 0;
120 }
[1454]121
[1467]122 for(k=0; k<wrec; k++) {
123 if ( (vin(k) < range_min) || (vin(k) > range_max) ) vrec(k)=mean;
124 else vrec(k)=vin(k);
125 }
126
127 bool fgokdebut = false;
128
[1442]129 int kgl = -1;
130 int ii,lastput;
131 bool fgglitch = false;
132 double valcur,valsub,valadd;
[1467]133 double lastvalok = mean;
[1454]134 uint_8 fgcur;
[1467]135 bool fgokcur=false;
[1454]136 // Boucle sur les sampleNum
137
[1467]138 int knext;
139 int kfin = sne-snb;
140 for(k=0;k<=kfin;k++) {
[1442]141 totnscount++;
[1443]142// if (k%10000 == 0) cout << " DBG: K=" << k << endl;
[1467]143 knext = k+wsz2;
[1442]144 // Calcul mean-sigma
[1467]145 if (knext<=kfin) {
146 valsub = vin(knext%wsize);
147 getData(0, knext+snb, vin(knext%wsize), vfg(knext%wsize));
148 valadd = vin(knext%wsize);
149 if ( (valadd < range_min) || (valadd > range_max) ) {
[1454]150 valadd = mean;
[1467]151 fgokcur = false;
152 }
153 else fgokcur = true;
154 if ( (valsub < range_min) || (valsub > range_max) )
155 valsub = mean;
156 if (!fgokdebut && fgokcur) {
157 s += valadd;
158 s2 += valadd*valadd;
159 nokdebut++;
160 mean = s/nokdebut;
161 if (nokdebut > 1) sigma = sqrt(s2/nokdebut-mean*mean);
162 if (nokdebut >= wsize) {
163 fgokdebut = true;
164 cout << " SimpleDeglitcher::DebugInfo - nokdebut=" << nokdebut
165 << " k=" << k << " knext=" << knext
166 << "\n ...DebugInfo mean=" << mean
167 << " sigma=" << sigma << " s=" << s << " s2=" << s2 << endl;
168 }
169 }
170 else {
171 s += (valadd-valsub);
172 s2 += (valadd*valadd-valsub*valsub);
173 mean = s/wsize;
174 sigma = sqrt(s2/wsize-mean*mean);
175 }
[1442]176 }
177
[1467]178
[1442]179 // On gere les sorties Mean et Sigma
180 if (fgmean)
181 putData(1, k+snb, mean, 0);
182 if (fgsigma)
183 putData(2, k+snb, sigma, 0);
[1454]184 if (fgincopie)
185 putData(3, k+snb, vin(k%wsize), vfg(k%wsize));
[1442]186
[1454]187 if ( (valcur < range_min) || (valcur > range_max) ) {
188 vin(k%wsize) = valcur = mean;
189 vfg(k%wsize) |= 2;
190 out_range_nscount++;
191 }
[1467]192 valcur = vin(k%wsize);
193 fgcur = vfg(k%wsize);
[1443]194
[1442]195 if (!fgout) continue; // Pas de sortie out (deglitche)
196
[1443]197
198// if (k<100) {
199// cout << "DBG-A-Deglitch[" << k << "] mean="
200// << mean << " sigma=" << sigma << " valcur="
201// << valcur << " Kgl=" << kgl ;
202// if (fgglitch) cout << " In Glitch" ;
203// cout << endl;
204// }
[1442]205
[1467]206 double curnsig = nsig;
207 if (fgglitch) curnsig /= 2.;
208
209 if (valcur < mean+curnsig*sigma) { // inferieur au seuil
[1442]210 if (fgglitch) {
211 if (k-kgl < maxpoints) { // On vient de detecter un glitch
212 glcount++;
[1467]213 double recval = vrec.Sum()/wrec;
[1442]214 for(ii=kgl; ii<k; ii++) {
[1467]215 putData(0, ii+snb, recval, vfg(ii%wsize)|5);
[1442]216 glnscount++;
217 }
218 lastput = snb+k-1;
219 }
220 else {
221 for(ii=kgl; ii<k; ii++) {
[1454]222 putData(0, ii+snb, vin(ii%wsize), vfg(ii%wsize));
[1442]223 }
224 lastput = snb+k-1;
225 }
226 }
227 putData(0, k+snb, valcur, 0);
228 lastput = snb+k;
229 kgl = -1; fgglitch = false;
[1467]230 vrec(k%wrec) = lastvalok = valcur;
[1442]231 }
232 else { // Superieur au seuil
233 if (fgglitch) {
234 if (k-kgl+1 >= maxpoints) { // serie de points > seuil
235 for(ii=kgl; ii<=k; ii++) // -> Donc pas glitch
[1454]236 putData(0, ii+snb, vin(ii%wsize), vfg(ii%wsize));
[1442]237 lastput = snb+k;
238 fgglitch = false;
[1467]239 vrec(k%wrec) = lastvalok = valcur;
[1442]240 }
241 }
242 else {
243 if (kgl < 0) { // debut possible de glitch
244 fgglitch = true; kgl = k;
245 }
246 else { // On est toujours dans une serie > seuil
[1454]247 putData(0, k+snb, valcur, fgcur);
[1442]248 lastput = snb+k;
249 }
[1467]250 vrec(k%wrec) = lastvalok;
[1442]251 }
252 }
253
[1443]254// if (k%5000 == 0) cout << " ---DBG2: K=" << k << " glcount="
255// << glcount << " LastPut= " << lastput << endl;
256 } // Fin de Boucle sur les num-sample
257
258 //DBG cout << " La fin lastput=" << lastput << " SNE=" << sne;
259 //DBG for(k=lastput-snb+1; k<sne-snb; k++)
260 //DBG putData(0, k+snb, vin(k%wsize), 0);
261 // cout << " DBG3- OUT of try bloc ! " << endl;
262 cout << " SimpleDeglitcher::run() - End of processing "
[1454]263 << " ProcessedSampleCount=" << ProcessedSampleCount()
[1443]264 << " GlitchCount= " << GlitchCount() << endl;
265 if (fgout) deglitchdone = true;
[1442]266 } // Bloc try
267 catch (PException & exc) {
268 cerr << "SimpleDeglitcher: Catched Exception " << (string)typeid(exc).name()
269 << "\n .... Msg= " << exc.Msg() << endl;
270 }
271}
272
273
[1454]274// -------------------------------------------------------------------
275// Classe SimpleFilter : Filtre simple ds le domaine temporel
276// -------------------------------------------------------------------
[1442]277
[1454]278string SimpleFilter::FilterKind2String(FilterKind fk)
279{
280 switch (fk) {
281 case UserFilter :
282 return ("UserFilter");
283 break;
284 case MeanFilter :
285 return ("MeanFilter");
286 break;
287 case SumFilter :
288 return ("SumFilter");
289 break;
290 case GaussFilter :
291 return ("GaussFilter");
292 break;
293 case DiffFilter :
294 return ("DiffFilter");
295 break;
296 default :
297 return ("ErrorFilterKind");
298 break;
299 }
300 return("");
301}
302
[1442]303SimpleFilter::SimpleFilter(int wsz, FilterKind fk, double a, double s)
304{
305 if (wsz < 3) wsz = 3;
306 if (wsz%2 == 0) wsz++;
307 cout << "SimpleFilter::SimpleFilter() wsz= " << wsz
[1454]308 << " FilterKind=" << FilterKind2String(fk) << endl;
[1442]309 wsize = wsz;
310 totnscount = 0;
311 coef = new double[wsz];
[1467]312 for(int k=0; k<wsz; k++) coef[k] = 0.;
[1454]313 switch (fk) {
314 case UserFilter :
315 throw ParmError("SimpleFilter: Error in filter Kind (UserFilter)!");
[1467]316 // break;
[1454]317 case MeanFilter :
318 for(int kk=0; kk<wsz; kk++)
319 coef[kk] = a/wsize;
320 break;
321 case SumFilter :
322 for(int kk=0; kk<wsz; kk++)
323 coef[kk] = a;
324 break;
325 case GaussFilter :
326 for(int kk=-(wsz/2); kk<=(wsz/2); kk++)
[1467]327 coef[kk+(wsz/2)] = a*exp(-(double)(kk*kk)/(s*s));
[1454]328 break;
329 case DiffFilter :
330 for(int kk=0; kk<wsz; kk++)
331 coef[kk] = -a/wsize;
332 coef[wsz/2+1] += 1.;
333 break;
334 default :
335 throw ParmError("SimpleFilter: Error in filter Kind (UnknownFilter)!");
[1467]336 // break;
[1454]337 }
[1442]338}
339
[1454]340SimpleFilter::SimpleFilter(Vector const & vc)
341{
342 int wsz = vc.Size();
343 if (wsz < 3) wsz = 3;
344 if (wsz%2 == 0) wsz++;
345 FilterKind fk = UserFilter;
346 cout << "SimpleFilter::SimpleFilter(Vector & vc) vc.Size()= "
347 << vc.Size() << " WSize=" << wsz
348 << " FilterKind=" << FilterKind2String(fk) << endl;
349 wsize = wsz;
350 totnscount = 0;
351 coef = new double[wsz];
352 for(int kk=0; kk<vc.Size(); kk++)
353 coef[kk] = vc(kk);
354 for(int kk=vc.Size(); kk<wsz; kk++)
355 coef[kk] = 0.;
356}
357
[1442]358SimpleFilter::~SimpleFilter()
359{
360 delete[] coef;
361}
362
[1443]363void SimpleFilter::PrintStatus(ostream & os)
364{
365 os << "\n ------------------------------------------------------ \n"
366 << " SimpleFilter::PrintStatus() - WindowSize=" << WSize()
367 << " FilterKind= " << Type() << endl;
368 TOIProcessor::PrintStatus(os);
369 os << " Coeff= " ;
370 for(int k=0; k<wsize; k++) os << coef[k] << " " ;
371 os << endl;
[1454]372 os << " ProcessedSampleCount=" << ProcessedSampleCount() << endl;
[1443]373 os << " ------------------------------------------------------ " << endl;
374}
375
[1442]376void SimpleFilter::init() {
377 cout << "SimpleFilter::init" << endl;
378 declareInput("in");
379 declareOutput("out");
[1443]380 declareOutput("incopie");
[1442]381 name = "SimpleFilter";
382 // upExtra = 1;
383}
384
385void SimpleFilter::run() {
386 // TOIManager* mgr = TOIManager::getManager();
387 int snb = getMinIn();
388 int sne = getMaxIn();
389
390 bool fgout = checkOutputTOIIndex(0);
[1443]391 bool fgincopie = checkOutputTOIIndex(1);
[1442]392
393 if (!checkInputTOIIndex(0)) {
394 cerr << " SimpleFilter::run() - Input TOI (in) not connected! "
395 << endl;
396 throw ParmError("SimpleFilter::run() Input TOI (in) not connected!");
397 }
398 if (!fgout) {
399 cerr << " SimpleFilter::run() - No Output TOI connected! "
400 << endl;
401 throw ParmError("SimpleFilter::run() No output TOI connected!");
402 }
[1443]403
404 cout << " SimpleFilter::run() SNRange=" << snb << " - " << sne << endl;
[1442]405
406
407 try {
[1443]408 Timer tm("SimpleFilter::run()");
[1442]409 // Le debut
410 int wsz2 = wsize/2;
411 Vector vin(wsize);
[1454]412 TVector<int_8> vfg(wsize);
[1442]413 int k;
[1464]414 for(k=0; k<wsize; k++)
415 getData(0, k+snb, vin(k%wsize), vfg(k%wsize));
416
[1442]417 double mean = vin.Sum()/wsize;
[1454]418 for(k=wsz2+1; k<wsize; k++) {
419 vin(k) = mean;
420 vfg(k) = 0;
421 }
422 int knext;
423 bool fgfin = false;
424 // Boucle sur les sampleNum
[1443]425 for(k=0;k<=sne-snb;k++) {
[1442]426 double sortie = 0;
[1467]427 for(int ii=-wsz2; ii<=wsz2; ii++) {
428 sortie += vin((ii+k+wsize)%wsize)*coef[ii+wsz2];
[1442]429 }
[1454]430 putData(0,k+snb,sortie,vfg(k%wsize));
431 if (fgincopie)
432 putData(1, k+snb, vin(k%wsize), vfg(k%wsize));
433 knext = k+wsz2+1;
[1464]434 if (knext<=(sne-snb))
435 getData(0, knext+snb, vin(knext%wsize), vfg(knext%wsize));
436
[1454]437 else {
438 if (!fgfin) {
439 mean = vin.Sum()/wsize;
440 fgfin = true;
441 }
442 vin(knext%wsize) = mean;
443 vfg(knext%wsize) = 0;
444 }
445 totnscount++;
[1442]446 } // Boucle sur les num-sample
[1443]447 cout << " SimpleFilter::run() - End of processing " << endl;
[1442]448 } // Bloc try
449
450 catch (PException & exc) {
451 cerr << "SimpleFilter: Catched Exception " << (string)typeid(exc).name()
452 << "\n .... Msg= " << exc.Msg() << endl;
453 }
[1454]454}
[1442]455
[1454]456// ---------------------------------------------------------------
457// -------------------- Classe SimpleAdder -----------------------
458// ---------------------------------------------------------------
[1442]459
[1454]460SimpleAdder::SimpleAdder(int nbinput)
461 : gains(nbinput)
462{
463 if (nbinput < 1)
464 throw ParmError("SimpleAdder::SimpleAdder() NbInput < 1 !");
465 nb_input = nbinput;
466 for(int k=0; k<nb_input; k++) gains(k) = 1.;
467 totnscount = 0;
[1442]468}
[1454]469
470SimpleAdder::~SimpleAdder()
471{
472}
473
474void SimpleAdder::SetGain(int num, double g)
475{
476 if ((num < 0) || (num >= nb_input))
477 throw RangeCheckError("SimpleAdder::SetGain() Out of range input number!");
478 gains(num) = g;
479 return;
480}
481
482double SimpleAdder::Gain(int num)
483{
484 if ((num < 0) || (num >= nb_input))
485 throw RangeCheckError("SimpleAdder::Gain() Out of range input number!");
486 return gains(num);
487}
488
489void SimpleAdder::PrintStatus(ostream & os)
490{
491 os << "\n ------------------------------------------------------ \n"
492 << " SimpleAdder::PrintStatus() - NbInput=" << NbInput() << endl;
493 TOIProcessor::PrintStatus(os);
494 os << " Gains= " ;
495 for(int k=0; k<nb_input; k++) os << gains(k) << " " ;
496 os << endl;
497 os << " ProcessedSampleCount=" << ProcessedSampleCount() << endl;
498 os << " ------------------------------------------------------ " << endl;
499}
500
501void SimpleAdder::init() {
502 cout << "SimpleAdder::init NbInput=" << nb_input << endl;
503 char buff[32];
504 for(int k=0; k<nb_input; k++) {
505 sprintf(buff,"in%d", k);
506 declareInput(buff);
507 }
508
509 declareOutput("out");
510 name = "SimpleAdder";
511 // upExtra = 1;
512}
513
514void SimpleAdder::run() {
515 // TOIManager* mgr = TOIManager::getManager();
516 int snb = getMinIn();
517 int sne = getMaxIn();
518
519 bool fgout = checkOutputTOIIndex(0);
520 string msg_err;
521 for(int ki=0;ki<nb_input;ki++) {
522 if (!checkInputTOIIndex(ki)) {
523 msg_err = "SimpleAdder::run() - Input TOI (" + getInName(ki) +
524 " not connected!";
525 cerr << msg_err << endl;
526 throw ParmError(msg_err);
527 }
528 }
529 if (!fgout) {
530 cerr << " SimpleAdder::run() - No Output TOI connected! "
531 << endl;
532 throw ParmError("SimpleAdder::run() No output TOI connected!");
533 }
534
535 cout << " SimpleAdder::run() SNRange=" << snb << " - " << sne << endl;
536
537
538 try {
539 Timer tm("SimpleAdder::run()");
540 int k,i;
541 double out = 0.;
[1464]542 double valin = 0.;
543 int_8 fgin = 0;
544 int_8 fgout = 0;
[1454]545 for(k=snb;k<=sne;k++) {
546 out = 0;
547 fgout = 0;
548 for(i=0; i<nb_input; i++) {
[1464]549 getData(i, k, valin, fgin);
550 out += gains(i)*valin;
551 fgout = fgout | fgin;
[1454]552 }
553 putData(0,k,out,fgout);
554 totnscount++;
555 } // Boucle sur les num-sample
556 cout << " SimpleAdder::run() - End of processing " << endl;
557 } // Bloc try
558
559 catch (PException & exc) {
560 cerr << "SimpleAdder: Catched Exception " << (string)typeid(exc).name()
561 << "\n .... Msg= " << exc.Msg() << endl;
562 }
563}
564
565
[1467]566// ---------------------------------------------------------------
567// -------------------- Classe SimpleFanOut -----------------------
568// ---------------------------------------------------------------
[1454]569
[1467]570SimpleFanOut::SimpleFanOut(int nbinput, int mfanout)
571{
572 if (nbinput < 1)
573 throw ParmError("SimpleFanOut::SimpleFanOut() NbInput < 1 !");
574 if (mfanout < 1)
575 throw ParmError("SimpleFanOut::SimpleFanOut() M_FanOut < 1 !");
576
577 nb_input = nbinput;
578 m_fanout = mfanout;
579 totnscount = 0;
580}
581
582SimpleFanOut::~SimpleFanOut()
583{
584}
585
586
587void SimpleFanOut::PrintStatus(ostream & os)
588{
589 os << "\n ------------------------------------------------------ \n"
590 << " SimpleFanOut::PrintStatus() - NbInput=" << NbInput()
591 << " M_FanOut=" << MFanOut() << endl;
592 TOIProcessor::PrintStatus(os);
593 os << endl;
594 os << " ProcessedSampleCount=" << ProcessedSampleCount() << endl;
595 os << " ------------------------------------------------------ " << endl;
596}
597
598void SimpleFanOut::init() {
599 cout << "SimpleFanOut::init NbInput=" << nb_input << endl;
600 char buff[64];
601 for(int k=0; k<nb_input; k++) {
602 sprintf(buff,"in%d", k);
603 declareInput(buff);
604 for(int j=0; j<m_fanout; j++) {
605 sprintf(buff,"out%d_%d", k, j);
606 declareOutput(buff);
607 }
608 }
609
610 name = "SimpleFanOut";
611 // upExtra = 1;
612}
613
614void SimpleFanOut::run() {
615 // TOIManager* mgr = TOIManager::getManager();
616 int snb = getMinIn();
617 int sne = getMaxIn();
618
619 TVector<int_4> in_index(nb_input);
620 TMatrix<int_4> out_index(nb_input, m_fanout);
621 in_index = -1;
622 out_index = -1;
623 int nbconin = 0;
624 bool fggin = false;
625 char buff[64];
626 for(int ki=0;ki<nb_input;ki++) {
627 sprintf(buff,"in%d", ki);
628 int idx = getInputTOIIndex(buff);
629 if (!checkInputTOIIndex(idx)) continue;
630 nbconin++;
631 in_index(ki) = idx;
632 bool fgout = false;
633 for(int jo=0; jo<m_fanout; jo++) {
634 sprintf(buff,"out%d_%d", ki, jo);
635 int odx = getOutputTOIIndex(buff);
636 if (checkOutputTOIIndex(odx)) {
637 out_index(ki, jo) = odx;
638 fgout = true;
639 }
640 }
641 if (!fgout) {
642 string msg_err =
643 "SimpleFanOut::run() - No connected Output for Input TOI ("
644 + getInName(ki) + ") !";
645 cerr << msg_err << endl;
646 throw ParmError(msg_err);
647 }
648 }
649 if (nbconin == 0) {
650 cerr << " SimpleFanOut::run() - No Input TOI connected! "
651 << endl;
652 throw ParmError("SimpleFanOut::run() No Inout TOI connected!");
653 }
654
655 /*
656 for(int ki=0;ki<nb_input;ki++) {
657 cout << " SimpleFanOut::run() In(" << ki << ") Index=" << in_index(ki)
658 << " Name=" << getInName(in_index(ki)) << endl;
659 for(int jo=0; jo<m_fanout; jo++)
660 cout << " .... Out(" << ki << "," << jo << ") Index=" << out_index(ki, jo)
661 << " Name=" << getOutName(out_index(ki, jo)) << endl;
662 }
663 */
664 cout << " SimpleFanOut::run() SNRange=" << snb << " - " << sne << endl;
665
666
667 try {
668 Timer tm("SimpleFanOut::run()");
669 double valin = 0.;
670 int_8 fgin = 0;
671 for(int k=snb;k<=sne;k++) {
672 for(int i=0;i<nb_input;i++) {
673 if (in_index(i) < 0) continue;
674 valin = 0;
675 fgin = 0;
676 getData(in_index(i), k, valin, fgin);
677 for(int j=0; j<m_fanout; j++) {
678 if (out_index(i, j) < 0) continue;
679 putData(out_index(i, j), k, valin, fgin);
680 }
681 }
682 totnscount++;
683 } // Boucle sur les num-sample
684 cout << " SimpleFanOut::run() - End of processing "
685 << " ProcessedSampleCount=" << ProcessedSampleCount() << endl;
686 } // Bloc try
687
688 catch (PException & exc) {
689 cerr << "SimpleFanOut: Catched Exception " << (string)typeid(exc).name()
690 << "\n .... Msg= " << exc.Msg() << endl;
691 }
692}
693
694
695
Note: See TracBrowser for help on using the repository browser.