source: Sophya/trunk/AddOn/TAcq/brproc.cc@ 3652

Last change on this file since 3652 was 3652, checked in by ansari, 16 years ago

Ajout calcul histogramme des valeurs echantillons en temps, Reza 15/06/2009

File size: 19.8 KB
RevLine 
[3635]1#include "racquproc.h"
2
3#include <stdlib.h>
[3642]4#include <string.h>
[3635]5#include <unistd.h>
6#include <fstream>
7#include <signal.h>
8
9#include "pexceptions.h"
10#include "tvector.h"
[3646]11#include "ntuple.h"
[3647]12#include "datatable.h"
[3652]13#include "histos.h"
[3635]14#include "fioarr.h"
15#include "timestamp.h"
16#include "ctimer.h"
17#include "fftpserver.h"
18#include "fftwserver.h"
19
20#include "FFTW/fftw3.h"
21
22
23#include "pciewrap.h"
24#include "brpaqu.h"
25#include "brproc.h"
26
27
28//---------------------------------------------------------------
29// Classe thread de traitement donnees ADC avec 2 voies par frame
30//---------------------------------------------------------------
31
[3649]32// Mutex pour eviter le plantage du a FFTW qui ne semble pas thread-safe
33static ZMutex* pmutfftw=NULL;
34
[3645]35/* --Methode-- */
[3640]36BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean,
[3652]37 uint_4 nmax, bool fghist, bool fgnotrl, int card)
[3635]38 : memgr(mem)
39{
40 nmax_ = nmax;
41 nmean_ = nmean;
42 stop_ = false;
43 path_ = path;
[3640]44 fgnotrl_ = fgnotrl;
[3652]45 fghist_ = fghist;
[3645]46 card_ = card;
[3649]47 if (pmutfftw==NULL) pmutfftw=new ZMutex;
[3635]48}
49
[3645]50/* --Methode-- */
[3635]51void BRProcARaw2C::Stop()
52{
53 stop_=true;
54 // cout <<" BRProcARaw2C::Stop ... > STOP " << endl;
55}
56
57
58static inline r_4 Zmod2(complex<r_4> z)
59{ return (z.real()*z.real()+z.imag()*z.imag()); }
60
[3645]61static inline string card2name_(int card)
62{
63 if (card==2) return " (Chan3,4) ";
64 else return " (Chan1,2) ";
65}
66/* --Methode-- */
[3635]67void BRProcARaw2C::run()
68{
69 setRC(1);
70 try {
[3640]71 Timer tm("BRProcARaw2C", false);
[3635]72 TimeStamp ts;
[3646]73 BRPaqChecker pcheck(!fgnotrl_); // Verification/comptage des paquets
[3640]74
75 size_t totnbytesout = 0;
76 size_t totnbytesproc = 0;
77
[3635]78 cout << " BRProcARaw2C::run() - Starting " << ts << " NMaxMemZones=" << nmax_
[3645]79 << " NMean=" << nmean_ << card2name_(card_) << endl;
[3635]80 cout << " BRProcARaw2C::run()... - Output Data Path: " << path_ << endl;
81 char fname[512];
82// sprintf(fname,"%s/proc.log",path_.c_str());
83// ofstream filog(fname);
84// filog << " BRProcARaw2C::run() - starting log file " << ts << endl;
85// filog << " ... NMaxMemZones=" << nmax_ << " NMean=" << nmean_ << " Step=" << step_ << endl;
86
[3647]87/*----DELETE NTuple
[3646]88 const char* nnames[8] = {"fcs","tts","s1","s2","s12","s12re","s12im","s12phi"};
89 NTuple nt(8, nnames);
90 double xnt[10];
91 uint_4 nmnt = 0;
92 double ms1,ms2,ms12,ms12re,ms12im,ms12phi;
[3647]93----*/
[3652]94// Time sample histograms
95 Histo h1(-0.5, 255.5, 256);
96 Histo h2(-0.5, 255.5, 256);
[3635]97// Initialisation pour calcul FFT
[3640]98 TVector< complex<r_4> > cfour1; // composant TF
[3635]99 uint_4 paqsz = memgr.PaqSize();
100 uint_4 procpaqsz = memgr.ProcPaqSize();
[3646]101
102
[3635]103 BRPaquet pq(NULL, NULL, paqsz);
104 TVector<r_4> vx(pq.DataSize()/2);
[3648]105 int szfour = pq.DataSize()/2/2+1;
106 cfour1.SetSize(szfour);
107/*
[3635]108 vx = (r_4)(0.);
109 FFTPackServer ffts;
[3640]110 ffts.FFTForward(vx, cfour1);
[3648]111 szfour = cfour1.Size();
112*/
113
[3640]114 TVector< complex<r_4> > cfour2(cfour1.Size());
[3635]115
[3640]116 TVector<r_4> spectreV1(cfour1.Size());
117 TVector<r_4> spectreV2(cfour1.Size());
118 TVector< complex<r_4> > visiV12( cfour1.Size() );
[3635]119
[3646]120 cout << " *DBG*BRProcARaw2C PaqSz=" << paqsz << " ProcPaqSize=" << procpaqsz
121 << " procpaqsz/2=" << procpaqsz/2 << " cfour1.Size()=" << cfour1.Size()
122 << " *8=" << cfour1.Size()*8 << endl;
[3635]123
[3649]124 pmutfftw->lock();
[3640]125 fftwf_plan plan1 = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(),
126 (fftwf_complex*)cfour1.Data(), FFTW_ESTIMATE);
127 fftwf_plan plan2 = fftwf_plan_dft_r2c_1d(vx.Size(), vx.Data(),
128 (fftwf_complex*)cfour2.Data(), FFTW_ESTIMATE);
[3649]129 pmutfftw->unlock();
[3640]130
[3635]131 uint_4 ifile = 0;
[3646]132 uint_4 nzm = 0;
[3647]133
134 uint_4 curfc=0;
135 uint_8 curtt=0;
136 uint_8 firsttt=0;
137 bool fgfirst=true;
[3635]138 for (uint_4 kmz=0; kmz<nmax_; kmz++) {
139 if (stop_) break;
140 int mid = memgr.FindMemZoneId(MemZA_ProcA);
141 Byte* buff = memgr.GetMemZone(mid);
142 if (buff == NULL) {
[3640]143 cout << " BRProcARaw2C::run()/ERROR memgr.GetMemZone(" << mid << ") -> NULL" << endl;
144 break;
[3635]145 }
146 Byte* procbuff = memgr.GetProcMemZone(mid);
147 if (procbuff == NULL) {
[3640]148 cout << " BRProcARaw2C::run()/ERROR memgr.GetProcMemZone(" << mid << ") -> NULL" << endl;
149 break;
[3635]150 }
[3647]151//---- DELETE nmnt=0; ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.;
[3645]152 for(uint_4 i=0; i<memgr.NbPaquets(); i++) {
[3640]153 BRPaquet paq(NULL, buff+i*paqsz, paqsz);
154 if (!pcheck.Check(paq)) continue; // on ne traite que les paquets OK
[3647]155 if (fgfirst) { firsttt=paq.TimeTag(); fgfirst=false; }
156 curfc=paq.FrameCounter();
157 curtt=paq.TimeTag()-firsttt;
[3635]158// Traitement voie 1
[3652]159 if (fghist_) {
160 for(sa_size_t j=0; j<vx.Size(); j++) {
161 r_4 vts=(r_4)(*(paq.Data1()+j));
162 h1.Add((r_8)vts);
163 vx(j) = vts-127.5;
164 }
165 }
166 else {
167 for(sa_size_t j=0; j<vx.Size(); j++)
168 vx(j) = (r_4)(*(paq.Data1()+j))-127.5;
169 }
[3640]170// fftwf_complex* coeff1 = (fftwf_complex*)(procbuff+i*procpaqsz);
[3646]171 fftwf_execute(plan1);
172// complex<r_4>* zp1 = (complex<r_4>*)(vx.Data());
[3640]173// ffts.FFTForward(vx, cfour1);
[3635]174 for(sa_size_t j=0; j<spectreV1.Size(); j++)
[3640]175 spectreV1(j) += Zmod2(cfour1(j));
176 memcpy(procbuff+i*procpaqsz, cfour1.Data(), sizeof(complex<r_4>)*cfour1.Size());
[3635]177// Traitement voie 2
[3652]178 if (fghist_) {
179 for(sa_size_t j=0; j<vx.Size(); j++) {
180 r_4 vts=(r_4)(*(paq.Data2()+j));
181 h2.Add((r_8)vts);
182 vx(j) = vts-127.5;
183 }
184 }
185 else {
186 for(sa_size_t j=0; j<vx.Size(); j++)
187 vx(j) = (r_4)(*(paq.Data2()+j))-127.5;
188 }
[3646]189 fftwf_execute(plan2);
[3635]190 for(sa_size_t j=0; j<spectreV2.Size(); j++)
[3640]191 spectreV2(j) += Zmod2(cfour2(j)); // Zmod2(zp2[j]);
192 memcpy(procbuff+i*procpaqsz+procpaqsz/2, cfour2.Data(), sizeof(complex<r_4>)*cfour2.Size());
[3635]193
194// Calcul correlation (visibilite V1 * V2)
[3640]195 for(sa_size_t j=0; j<visiV12.Size(); j++)
196 visiV12(j)+=cfour1(j)*conj(cfour2(j));
197// for(sa_size_t j=0; j<visiV12.Size(); j++) visiV12(j)+=zp1[j]*zp2[j];
[3647]198 if (nzm==0) {
199 spectreV1.Info()["StartFC"] = curfc;
200 spectreV2.Info()["StartFC"] = curfc;
201 visiV12.Info()["StartFC"] = curfc;
202 spectreV1.Info()["StartTT"] = curtt;
203 spectreV2.Info()["StartTT"] = curtt;
204 visiV12.Info()["StartTT"] = curtt;
205 }
[3640]206 nzm++;
[3647]207/*----DELETE
[3646]208 if (nmnt==0) { xnt[0]=paq.FrameCounter(); xnt[1]=paq.TimeTag(); }
209 for(sa_size_t j=2700; j<2800; j++) {
210 ms1 += Zmod2(cfour1(j)); ms2 += Zmod2(cfour2(j));
211 complex<r_4> zvis = cfour1(j)*conj(cfour2(j));
212 ms12 += Zmod2(zvis); ms12re += zvis.real(); ms12im += zvis.imag();
213 ms12phi+= atan2(zvis.imag(),zvis.real());
214 }
215 nmnt++;
[3647]216----*/
[3640]217 totnbytesproc += paq.DataSize();
218 totnbytesout += (2*sizeof(complex<r_4>)*cfour1.Size());
[3635]219
[3640]220 } // Fin de boucle sur les paquets d'une zone
[3647]221
222/*---- DELETE
[3646]223 if (nmnt>0) {
224 double fnorm = (double)nmnt*(2800-2700);
225 xnt[2] = ms1 /= fnorm;
226 xnt[3] = ms2 /= fnorm;
227 xnt[4] = ms12 /= fnorm;
228 xnt[5] = ms12re /= fnorm;
229 xnt[6] = ms12im /= fnorm;
230 xnt[7] = ms12phi /= fnorm;
231 nt.Fill(xnt);
232 }
[3647]233----*/
[3640]234 if ((nzm >= nmean_) || ((kmz==(nmax_-1))&&(nzm>1))) {
[3635]235 spectreV1 /= (r_4)(nzm);
236 spectreV2 /= (r_4)(nzm);
237
238 visiV12 /= complex<r_4>((r_4)nzm, 0.);
239
240 spectreV1.Info()["NPaqMoy"] = nzm;
241 spectreV2.Info()["NPaqMoy"] = nzm;
242 visiV12.Info()["NPaqMoy"] = nzm;
[3647]243 spectreV1.Info()["EndFC"] = curfc;
244 spectreV2.Info()["EndFC"] = curfc;
245 visiV12.Info()["EndFC"] = curfc;
246 spectreV1.Info()["EndTT"] = curtt;
247 spectreV2.Info()["EndTT"] = curtt;
248 visiV12.Info()["EndTT"] = curtt;
[3652]249 {
[3635]250 sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile);
251 POutPersist po(fname);
[3645]252 string tag1="specV1";
253 string tag2="specV2";
254 string tag12="visiV12";
[3652]255 string tagh1="tshV1";
256 string tagh2="tshV2";
[3645]257 if (card_==2) {
258 tag1 = "specV3";
259 tag2 = "specV4";
[3652]260 tagh1 = "tshV1";
261 tagh2 = "tshV2";
[3645]262 tag12="visiV34";
263 }
264 po << PPFNameTag(tag1) << spectreV1;
265 po << PPFNameTag(tag2) << spectreV2;
266 po << PPFNameTag(tag12) << visiV12;
[3652]267 if (fghist_) {
268 po << PPFNameTag(tagh1) << h1;
269 po << PPFNameTag(tagh2) << h2;
270 }
271 }
[3635]272 spectreV1 = (r_4)(0.);
273 spectreV2 = (r_4)(0.);
274 visiV12 = complex<r_4>(0., 0.);
[3652]275 if (fghist_) {
276 h1.Zero();
277 h2.Zero();
278 }
[3635]279 nzm = 0; ifile++;
280// ts.SetNow();
281// filog << ts << " : proc file " << fname << endl;
[3645]282 cout << " BRProcARaw2C::run() created file " << fname << card2name_(card_) << endl;
[3640]283 }
[3635]284
285 memgr.FreeMemZone(mid, MemZS_ProcA);
[3640]286 } // Fin de boucle sur les zones a traiter
[3645]287 cout << " ------------ BRProcARaw2C::run() END " << card2name_(card_)
288 << " ------------ " << endl;
[3647]289/*---- DELETE
290 {
291 nt.Info()["FirstTT"]=firsttt;
[3646]292 cout << nt;
293 sprintf(fname,"%s_nt.ppf",path_.c_str());
294 POutPersist po(fname);
295 po << PPFNameTag("ntv12") << nt;
296 cout << " BRProcARaw2C::run() created NTuple file " << fname << card2name_(card_) << endl;
[3647]297 }
298---- */
[3640]299 ts.SetNow();
300 tm.SplitQ();
301 cout << " TotalProc= " << totnbytesproc/(1024*1024) << " MBytes, rate= "
302 << (double)(totnbytesproc)/1024./tm.PartialElapsedTimems() << " MB/s"
303 << " ProcDataOut=" << totnbytesout/(1024*1024) << " MB" << endl;
304 cout << pcheck;
[3645]305 cout << " BRProcARaw2C::run()/Timing: " << card2name_(card_) << endl;
[3640]306 tm.Print();
307 cout << " ---------------------------------------------------------- " << endl;
308
[3635]309 }
310 catch (PException& exc) {
311 cout << " BRProcARaw2C::run()/catched PException " << exc.Msg() << endl;
312 setRC(3);
313 return;
314 }
315 catch(...) {
316 cout << " BRProcARaw2C::run()/catched unknown ... exception " << endl;
317 setRC(4);
318 return;
319 }
320 setRC(0);
321 return;
322}
323
[3645]324//---------------------------------------------------------------------
325// Classe thread de traitement 2 x 2 voies/frames (Apres BRProcARaw2C)
326//---------------------------------------------------------------------
[3635]327
[3645]328/* --Methode-- */
329BRProcBRaw4C::BRProcBRaw4C(RAcqMemZoneMgr& mem1, RAcqMemZoneMgr& mem2,
330 string& path, uint_4 nmean, uint_4 nmax, bool fgnotrl)
331 : memgr1(mem1), memgr2(mem2)
332{
333 nmax_ = nmax;
334 nmean_ = nmean;
335 stop_ = false;
336 path_ = path;
337 fgnotrl_ = fgnotrl;
338}
[3635]339
[3645]340/* --Methode-- */
341void BRProcBRaw4C::Stop()
342{
343 stop_=true;
344 // cout <<" BRProcBRaw4C::Stop ... > STOP " << endl;
345}
[3635]346
[3645]347
348/* --Methode-- */
349void BRProcBRaw4C::run()
350{
351 setRC(1);
352 try {
353 Timer tm("BRProcBRaw4C", false);
354 TimeStamp ts;
[3646]355 BRPaqChecker pcheck1(!fgnotrl_); // Verification/comptage des paquets
356 BRPaqChecker pcheck2(!fgnotrl_); // Verification/comptage des paquets
[3645]357
358 size_t totnbytesout = 0;
359 size_t totnbytesproc = 0;
360
361 cout << " BRProcBRaw4C::run() - Starting " << ts << " NMaxMemZones=" << nmax_
362 << " NMean=" << nmean_ << endl;
363 cout << " BRProcBRaw4C::run()... - Output Data Path: " << path_ << endl;
364
365 uint_4 paqsz = memgr1.PaqSize();
366 uint_4 procpaqsz = memgr1.ProcPaqSize();
367 if ((paqsz != memgr2.PaqSize())||(procpaqsz!= memgr2.ProcPaqSize())) {
368 cout << "BRProcBRaw4C::run()/ERROR : different paquet size -> stop \n ...(PaqSz1="
369 << paqsz << " Sz2=" << memgr2.PaqSize() << " ProcPaqSz1="
370 << procpaqsz << " Sz2=" << memgr2.ProcPaqSize() << " )" << endl;
371 setRC(9);
372 return;
373 }
374
375 TVector< complex<r_4> > cfour; // composant TF
[3648]376 BRPaquet pq(NULL, NULL, paqsz);
[3646]377/*
[3645]378 TVector<r_4> vx(pq.DataSize()/2);
379 vx = (r_4)(0.);
380 FFTPackServer ffts;
381 ffts.FFTForward(vx, cfour);
382
383 TVector< complex<r_4> > visiV13( cfour.Size() );
384 TVector< complex<r_4> > visiV14( cfour.Size() );
385 TVector< complex<r_4> > visiV23( cfour.Size() );
386 TVector< complex<r_4> > visiV24( cfour.Size() );
[3646]387*/
[3648]388 int szfour = pq.DataSize()/2/2+1;
389// int szfour = (paqsz-40)/2+1;
[3646]390 TVector< complex<r_4> > visiV13( szfour );
391 TVector< complex<r_4> > visiV14( szfour );
392 TVector< complex<r_4> > visiV23( szfour );
393 TVector< complex<r_4> > visiV24( szfour );
394 // cout << " *DBG*AAAAA ---- Vectors OK" << endl;
395 cout << " *DBG*BRProcBRaw4C PaqSz=" << paqsz << " ProcPaqSize=" << procpaqsz
396 << " procpaqsz/2=" << procpaqsz/2 << " cfour.Size()=" << szfour
397 << " *8=" << szfour*8 << endl;
[3645]398
[3647]399 DataTable dt;
400 dt.AddLongColumn("fc1");
[3651]401 dt.AddLongColumn("tt1");
[3647]402 dt.AddLongColumn("fc2");
403 dt.AddLongColumn("tt2");
404 DataTableRow dtr = dt.EmptyRow();
405
[3645]406 uint_4 nzm = 0;
407 uint_4 totnoksfc = 0;
408 uint_4 totnokpaq = 0;
409 uint_4 totnpaq = 0;
410 uint_4 ifile = 0;
[3647]411
412 uint_4 curfc=0;
413 uint_8 curtt=0;
414 uint_4 curfc2=0;
415 uint_8 curtt2=0;
416 uint_8 firsttt=0;
417 uint_8 firsttt2=0;
418 bool fgfirst=true;
[3645]419 for (uint_4 kmz=0; kmz<nmax_; kmz++) {
420 uint_4 noksfc = 0;
421 uint_4 nokpaq = 0;
422 if (stop_) break;
[3646]423 // cout << " *DBG*BBBBB" << kmz << endl;
424
[3645]425 int mid1 = memgr1.FindMemZoneId(MemZA_ProcB);
426 Byte* buff1 = memgr1.GetMemZone(mid1);
427 if (buff1 == NULL) {
428 cout << " BRProcBRaw4C::run()/ERROR memgr.GetMemZone(" << mid1 << ") -> NULL" << endl;
429 break;
430 }
431 Byte* procbuff1 = memgr1.GetProcMemZone(mid1);
432 if (procbuff1 == NULL) {
433 cout << " BRProcBRaw4C::run()/ERROR memgr.GetProcMemZone(" << mid1 << ") -> NULL" << endl;
434 break;
435 }
436 int mid2 = memgr2.FindMemZoneId(MemZA_ProcB);
437 Byte* buff2 = memgr2.GetMemZone(mid2);
438 if (buff1 == NULL) {
439 cout << " BRProcBRaw4C::run()/ERROR memgr.GetMemZone(" << mid2 << ") -> NULL" << endl;
440 break;
441 }
442 Byte* procbuff2 = memgr2.GetProcMemZone(mid2);
443 if (procbuff2 == NULL) {
444 cout << " BRProcBRaw4C::run()/ERROR memgr.GetProcMemZone(" << mid2 << ") -> NULL" << endl;
445 break;
446 }
447 uint_4 i1,i2;
448 i1=i2=0;
[3646]449// cout << " *DBG*CCCCCC " << kmz << " memgr1.NbPaquets() =" << memgr1.NbPaquets() << endl;
[3645]450 while((i1<memgr1.NbPaquets())&&(i2<memgr2.NbPaquets())) {
451 BRPaquet paq1(NULL, buff1+i1*paqsz, paqsz);
452 BRPaquet paq2(NULL, buff2+i2*paqsz, paqsz);
453 totnpaq++;
454// cout << " DBG["<<kmz<<"] i1,i2=" << i1 <<","<<i2<<" FC1,FC2=" <<paq1.FrameCounter()
455//<<","<<paq2.FrameCounter()<<endl;
456 // on ne traite que les paquets OK
457 if (!pcheck1.Check(paq1)) { i1++; continue; }
458 if (!pcheck2.Check(paq2)) { i2++; continue; }
459 nokpaq++;
460 if (paq1.FrameCounter()<paq2.FrameCounter()) { i1++; continue; }
461 if (paq2.FrameCounter()<paq1.FrameCounter()) { i2++; continue; }
462// cout << " DBG["<<kmz<<"]OKOK i1,i2=" << i1 <<","<<i2<<" FC1,FC2=" <<paq1.FrameCounter()
463// <<","<<paq2.FrameCounter()<<endl;
464
[3646]465 if ((i1>=memgr1.NbPaquets())||(i2>=memgr1.NbPaquets())) {
466 cout << " *BUG*BUG i1=" << i1 << " i2=" << i2 << endl;
467 break;
468 }
[3645]469 // Les deux framecounters sont identiques ...
470 noksfc++;
[3647]471 curfc=paq1.FrameCounter();
472 curfc2=paq2.FrameCounter();
473 if (fgfirst) {
[3651]474 firsttt=paq1.TimeTag(); firsttt2=paq2.TimeTag();
[3647]475 cout << " BRProcBRaw4C()/Info First FC="<<curfc<<" , "<<curfc2<<" -> TT="
476 << firsttt<<" , "<<firsttt2 <<endl;
477 fgfirst=false;
478 }
479 curtt=paq1.TimeTag()-firsttt;
480 curtt2=paq2.TimeTag()-firsttt2;
481 dtr[0]=curfc; dtr[1]=curtt;
482 dtr[2]=curfc2; dtr[3]=curtt2;
483 dt.AddRow(dtr);
484
[3645]485 complex<r_4>* zp1 = (complex<r_4>*)(procbuff1+i1*procpaqsz);
486 complex<r_4>* zp2 = (complex<r_4>*)(procbuff1+i1*procpaqsz+procpaqsz/2);
487 complex<r_4>* zp3 = (complex<r_4>*)(procbuff2+i2*procpaqsz);
488 complex<r_4>* zp4 = (complex<r_4>*)(procbuff2+i2*procpaqsz+procpaqsz/2);
489 for(sa_size_t j=0; j<visiV13.Size(); j++) {
490 visiV13(j)+=zp1[j]*conj(zp3[j]);
491 visiV14(j)+=zp1[j]*conj(zp4[j]);
492 visiV23(j)+=zp2[j]*conj(zp3[j]);
493 visiV24(j)+=zp2[j]*conj(zp4[j]);
494 }
[3647]495 if (nzm==0) {
496 visiV13.Info()["StartFC"] = curfc;
497 visiV14.Info()["StartFC"] = curfc;
498 visiV23.Info()["StartFC"] = curfc;
499 visiV24.Info()["StartFC"] = curfc;
500 visiV13.Info()["StartTT"] = curtt;
501 visiV14.Info()["StartTT"] = curtt;
502 visiV23.Info()["StartTT"] = curtt;
503 visiV24.Info()["StartTT"] = curtt;
504 }
[3645]505 nzm++; i1++; i2++;
506 totnbytesproc += 2*paq1.DataSize();
507 } // Fin de boucle sur les paquets d'une zone
[3646]508 memgr1.FreeMemZone(mid1, MemZS_ProcB);
509 memgr2.FreeMemZone(mid2, MemZS_ProcB);
510
[3645]511 if ((nzm >= nmean_) || ((kmz==(nmax_-1))&&(nzm>1))) {
512 visiV13 /= complex<r_4>((r_4)nzm, 0.);
513 visiV14 /= complex<r_4>((r_4)nzm, 0.);
514 visiV23 /= complex<r_4>((r_4)nzm, 0.);
515 visiV24 /= complex<r_4>((r_4)nzm, 0.);
516 visiV13.Info()["NPaqMoy"] = nzm;
517 visiV14.Info()["NPaqMoy"] = nzm;
518 visiV23.Info()["NPaqMoy"] = nzm;
519 visiV24.Info()["NPaqMoy"] = nzm;
[3647]520 visiV13.Info()["EndFC"] = curfc;
521 visiV14.Info()["EndFC"] = curfc;
522 visiV23.Info()["EndFC"] = curfc;
523 visiV24.Info()["EndFC"] = curfc;
524 visiV13.Info()["EndTT"] = curtt;
525 visiV14.Info()["EndTT"] = curtt;
526 visiV23.Info()["EndTT"] = curtt;
527 visiV24.Info()["EndTT"] = curtt;
[3645]528 char fname[512];
529 {
530 sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile);
531 POutPersist po(fname);
532 po << PPFNameTag("visiV13") << visiV13;
533 po << PPFNameTag("visiV14") << visiV14;
534 po << PPFNameTag("visiV23") << visiV23;
535 po << PPFNameTag("visiV24") << visiV24;
536 }
537 visiV13 = complex<r_4>(0., 0.);
538 visiV14 = complex<r_4>(0., 0.);
539 visiV23 = complex<r_4>(0., 0.);
540 visiV24 = complex<r_4>(0., 0.);
[3646]541 nzm = 0; ifile++;
[3645]542// ts.SetNow();
543// filog << ts << " : proc file " << fname << endl;
544 cout << " BRProcBRaw4C::run() created file " << fname << endl;
545 }
546 double okfrac = (nokpaq>1)?((double)noksfc/(double)nokpaq*100.):0.;
[3646]547 cout << "BRProcBRaw4C ["<<kmz<<"] NOKPaq=" << nokpaq << " NSameFC=" << noksfc
[3645]548 << " (" << okfrac << " %)" << endl;
549 totnokpaq += nokpaq;
550 totnoksfc += noksfc;
551 } // Fin de boucle sur les zones a traiter
552 cout << " ------------------ BRProcBRaw4C::run() END ----------------- " << endl;
[3647]553 {
554 dt.Info()["FirstTT1"]=firsttt;
555 dt.Info()["FirstTT2"]=firsttt2;
556 cout << dt;
557 char fname[512];
558 sprintf(fname,"%s_fctt.ppf",path_.c_str());
559 POutPersist po(fname);
560 po << PPFNameTag("ttfc") << dt;
561 cout << " BRProcBRaw4C::run() created TimeTag/FrameCounter file " << fname << endl;
562 }
[3645]563 ts.SetNow();
564 tm.SplitQ();
565 cout << " TotalProc= " << totnbytesproc/(1024*1024) << " MBytes, rate= "
566 << (double)(totnbytesproc)/1024./tm.PartialElapsedTimems() << " MB/s" << endl;
567 double totokfrac = (totnokpaq>1)?((double)totnoksfc/(double)totnokpaq*100.):0.;
568 cout << " NOkPaq1,2=" << totnokpaq << " /TotNPaq=" << totnpaq << " TotNSameFC="
569 << totnoksfc << " (" << totokfrac << " %)" << endl;
570// cout << pcheck1;
571// cout << pcheck2;
572 cout << " BRProcBRaw4C::run()/Timing: \n";
573 tm.Print();
574 cout << " ---------------------------------------------------------- " << endl;
575}
576 catch (PException& exc) {
577 cout << " BRProcBRaw4C::run()/catched PException " << exc.Msg() << endl;
578 setRC(3);
579 return;
580 }
581 catch(...) {
582 cout << " BRProcBRaw4C::run()/catched unknown ... exception " << endl;
583 setRC(4);
584 return;
585 }
586 setRC(0);
587 return;
588}
589
590
Note: See TracBrowser for help on using the repository browser.