Changeset 3652 in Sophya for trunk/AddOn/TAcq/brproc.cc


Ignore:
Timestamp:
Jun 15, 2009, 10:57:12 AM (16 years ago)
Author:
ansari
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/brproc.cc

    r3651 r3652  
    1111#include "ntuple.h"
    1212#include "datatable.h"
     13#include "histos.h"
    1314#include "fioarr.h"
    1415#include "timestamp.h"
     
    3435/* --Methode-- */
    3536BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean,
    36                            uint_4 nmax, bool fgnotrl, int card)
     37                           uint_4 nmax, bool fghist, bool fgnotrl, int card)
    3738  :  memgr(mem)
    3839{
     
    4243  path_ = path;
    4344  fgnotrl_ = fgnotrl;
     45  fghist_ = fghist;
    4446  card_ = card;
    4547  if (pmutfftw==NULL) pmutfftw=new ZMutex; 
     
    9092    double ms1,ms2,ms12,ms12re,ms12im,ms12phi;
    9193----*/
     94// Time sample histograms
     95   Histo h1(-0.5, 255.5, 256);
     96   Histo h2(-0.5, 255.5, 256);
    9297// Initialisation pour calcul FFT
    9398    TVector< complex<r_4> > cfour1;  // composant TF
     
    152157        curtt=paq.TimeTag()-firsttt;
    153158// Traitement voie 1       
    154             for(sa_size_t j=0; j<vx.Size(); j++)
    155               vx(j) = (r_4)(*(paq.Data1()+j))-127.5;
     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        }
    156170//        fftwf_complex* coeff1 = (fftwf_complex*)(procbuff+i*procpaqsz);
    157171            fftwf_execute(plan1);
     
    162176        memcpy(procbuff+i*procpaqsz, cfour1.Data(), sizeof(complex<r_4>)*cfour1.Size());
    163177// Traitement voie 2       
    164             for(sa_size_t j=0; j<vx.Size(); j++)
    165               vx(j) = (r_4)(*(paq.Data2()+j))-127.5;
    166 
     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        }
    167189        fftwf_execute(plan2);
    168190        for(sa_size_t j=0; j<spectreV2.Size(); j++)
     
    225247        spectreV2.Info()["EndTT"] = curtt;
    226248        visiV12.Info()["EndTT"] = curtt;
    227             {
     249        {
    228250        sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile);
    229251        POutPersist po(fname);
     
    231253        string tag2="specV2";
    232254        string tag12="visiV12";
     255        string tagh1="tshV1";
     256        string tagh2="tshV2";
    233257        if (card_==2) {
    234258          tag1 = "specV3";
    235259          tag2 = "specV4";
     260          tagh1 = "tshV1";
     261          tagh2 = "tshV2";
    236262          tag12="visiV34";
    237263        }
     
    239265        po << PPFNameTag(tag2) << spectreV2;
    240266        po << PPFNameTag(tag12) << visiV12;
    241             }
     267        if (fghist_) {
     268          po << PPFNameTag(tagh1) << h1;
     269          po << PPFNameTag(tagh2) << h2;
     270        }
     271        }
    242272        spectreV1 = (r_4)(0.);
    243273        spectreV2 = (r_4)(0.);
    244274        visiV12 = complex<r_4>(0., 0.);
     275        if (fghist_) {
     276          h1.Zero();
     277          h2.Zero();
     278        }
    245279        nzm = 0;  ifile++;
    246280//        ts.SetNow();
Note: See TracChangeset for help on using the changeset viewer.