Changeset 3652 in Sophya for trunk/AddOn/TAcq/mcrd.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/mcrd.cc

    r3650 r3652  
    6161static int GPaqSz=16424;
    6262static double LossRate=0.1;
     63
     64static bool fg4c=false;  // true -> 4 channels (2 fibers)
     65static bool fgrdfits=true;  // false -> Don't read fits files, generate paquets
     66static bool fgnotrl=false;   // true -> fichier fits SANS Trailer de frame (< mai 2009)
     67static bool fghist=false;   // true -> histo des valeurs des time sample
     68
    6369// ----
    6470int Usage(bool fgshort=true);
    6571// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    66 int Proc1FRawA(string& outname, string& inpath, int jf1, int jf2, bool fgnotrl=false,
    67                bool fgrdfile=true);
     72int Proc1FRawA(string& outname, string& inpath, int jf1, int jf2);
    6873// Pour traitement (calcul FFT et visibilites (ProcA,ProcB) 2 fibre, 4 voies RAW)
    69 int Proc2FRawAB(string& outname, string& path1, string& path2, int jf1, int jf2,
    70                 bool fgnotrl=false, bool fgrdfile=true);
     74int Proc2FRawAB(string& outname, string& path1, string& path2, int jf1, int jf2);
    7175
    7276//----------------------------------------------------
     
    8286  try {
    8387    string act = arg[1];
    84     bool fg4c=false;  // true -> 4 channels (2 fibers)
    85     bool fgrdfits=true;  // false -> Don't read fits files, generate paquets
    86     bool fgnotrl=false;   // true -> fichier fits SANS Trailer de frame (< mai 2009)
     88    fg4c=false;  // true -> 4 channels (2 fibers)
     89    fgrdfits=true;  // false -> Don't read fits files, generate paquets
     90    fgnotrl=false;   // true -> fichier fits SANS Trailer de frame (< mai 2009)
     91    fghist=false;   // true -> histo des valeurs des time sample
    8792    if (act.substr(0,2)=="-4") fg4c=true;
    88     if (act.substr(2)=="g")  fgrdfits=false;
    89     else if (act.substr(2)=="nt")  fgnotrl=true;
     93    if (act.length()>2) {
     94      for(size_t ks=2; ks<act.length(); ks++) {
     95        if(act[ks]=='g') fgrdfits=false;
     96        else if(act[ks]=='n') fgnotrl=true;
     97        else if(act[ks]=='h') fghist=true;
     98      }
     99    }
    90100    if (fg4c && (narg<6)) return Usage(true);
    91101
     
    107117    ResourceUsage resu;
    108118    if (fg4c)
    109       rc =  Proc2FRawAB(outname, inpath, inpath2, imin, imax, fgnotrl, fgrdfits);
     119      rc =  Proc2FRawAB(outname, inpath, inpath2, imin, imax);
    110120    else
    111       rc =  Proc1FRawA(outname, inpath, imin, imax, fgnotrl, fgrdfits);
     121      rc =  Proc1FRawA(outname, inpath, imin, imax);
    112122    cout << resu ;
    113123  }
     
    135145
    136146// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    137 int Proc1FRawA(string& outname, string& inpath, int imin, int imax,
    138                bool fgnotrl, bool fgrdfile)
     147int Proc1FRawA(string& outname, string& inpath, int imin, int imax)
    139148{
    140149  vector<string> infiles;
     
    146155  uint_4 nmaxz;
    147156  uint_4 paqsz, npaqf;
    148   if (fgrdfile) {
     157  if (fgrdfits) {
    149158    DecodeMiniFitsHeader(infiles[0],paqsz, npaqf, fgnotrl);
    150159    nmaxz = infiles.size()*npaqf/NPaqinZone;
     
    167176
    168177  outname += "/Ch12";
    169   BRProcARaw2C proc(mmgr, outname, NMean, nmaxz, fgnotrl);
     178  BRProcARaw2C proc(mmgr, outname, NMean, nmaxz, fghist, fgnotrl);
    170179
    171180  cout << " mcrd/Proc1FRawA: Starting threads (reader, proc) ... " << endl;
    172181
    173   if (fgrdfile) reader.start();
     182  if (fgrdfits) reader.start();
    174183  else pcird.start();
    175184
     
    177186  sleep(1);
    178187  cout << " mcrd/Proc1FRawA: Waiting for reader thread to finish ... " << endl;
    179   if (fgrdfile) reader.join();
     188  if (fgrdfits) reader.join();
    180189  else pcird.join();
    181190  cout << " mcrd/Proc1FRawA: Reader finished, waiting for process thread to finish ... " << endl;
     
    189198
    190199// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    191 int Proc2FRawAB(string& outname, string& path1, string& path2, int imin, int imax,
    192                bool fgnotrl, bool fgrdfile)
     200int Proc2FRawAB(string& outname, string& path1, string& path2, int imin, int imax)
    193201{
    194202  vector<string> infiles1;
     
    203211  uint_4 nmaxz;
    204212  uint_4 paqsz, npaqf;
    205   if (fgrdfile) {
     213  if (fgrdfits) {
    206214    DecodeMiniFitsHeader(infiles1[0],paqsz, npaqf, fgnotrl);
    207215    nmaxz = infiles1.size()*npaqf/NPaqinZone;
     
    235243  string outname1 = outname;
    236244  outname1 += "/Ch12";
    237   BRProcARaw2C proc1(mmgr1, outname1, NMean, nmaxz, fgnotrl);
     245  BRProcARaw2C proc1(mmgr1, outname1, NMean, nmaxz, fghist, fgnotrl);
    238246  string outname2 = outname;
    239247  outname2 += "/Ch34";
    240   BRProcARaw2C proc2(mmgr2, outname2, NMean, nmaxz, fgnotrl,2);
     248  BRProcARaw2C proc2(mmgr2, outname2, NMean, nmaxz, fghist, fgnotrl,2);
    241249  string outname12 = outname;
    242250  outname12 += "/Ch1234";
     
    245253  cout << " mcrd/Proc2FRawAB: Starting threads (reader1,2, procA1,2, procAB) ... " << endl;
    246254//  cout << "[1]--- CR to continue ..." << endl;   char ans[32]; gets(ans);
    247   if (fgrdfile) {
     255  if (fgrdfits) {
    248256    reader1.start();
    249257    reader2.start();
     
    260268  sleep(1);
    261269  cout << " mcrd/Proc2FRawAB: Waiting for reader threads to finish ... " << endl;
    262   if (fgrdfile) {
     270  if (fgrdfits) {
    263271    reader1.join();
    264272    reader2.join();
     
    291299    return 1;
    292300  }
    293   cout << " ACT= -2 , -2g , -2nt -> 1 fiber, 2 raw channel processing (ProcA)\n"
    294        << " ACT= -4 , -4g , -4g , -4nt -> 2 fibers, 4 raw channels (ProcA, ProcB)\n"
    295        << "   nt (notrl) -> FITS files without frame trailer \n"
    296        << "   g (generate paquets) -> generate paquets instead of reading fits files" <<endl;
     301  cout << " ACT= -2[ghn] -> 1 fiber, 2 raw channel processing (ProcA)\n"
     302       << " ACT= -4[ghn] -> 2 fibers, 4 raw channels (ProcA, ProcB)\n"
     303       << "   n (notrl) -> FITS files without frame trailer \n"
     304       << "   g (generate paquets) -> generate paquets instead of reading fits files\n"
     305       << "   h (time sample histograms) -> compute time sample histograms also \n"
     306       << "   Example: ACT = -2h  1 fiber, 2 raw channels and compute time sample histograms" <<endl;
    297307  cout << " OutPath : Output directory name " << endl;
    298308  cout << " InPath [InPath2] Imin,Imax: Input fits files directory name(s)\n"
Note: See TracChangeset for help on using the changeset viewer.