** Changed in: kaliveda/1.8
       Status: Confirmed => Fix Committed

-- 
You received this bug notification because you are a member of KaliVeda
Development Team, which is subscribed to KaliVeda.
https://bugs.launchpad.net/bugs/1071230

Title:
  Erreur de lecture des functions d'identifications avec
  KVTGID::ReadFromAsciiFile(...)

Status in KaliVeda data analysis framework:
  Fix Committed
Status in KaliVeda 1.8 series:
  Fix Committed
Status in KaliVeda e494s-dev series:
  Fix Committed

Bug description:
  KVROOT:
  /afs/in2p3.fr/throng/indra/.kvroot-1.8.6_gcc-4.1.2_x86_64_root-5.33.01

  La lecture des fonctions d'identifications (KVTGID) ne se fait pas 
correctement avec la fonction membre 
  KVTGID::ReadFromAsciiFile(...). Le programme suivant montre le problème que 
j'ai rencontré:

  ######### File: test.cpp  ######################

  #include "Riostream.h"
  #include "KVTGID.h"
  #include "KVNumberList.h"
  #include "KVIDTelescope.h"

  void testIOofKVTGID(){

        //////////////////////////////////
        //  Building a KVTGID object  //
        //////////////////////////////////
        
        TString f1name  = "test_write.dat";
        TString f2name = "test_read.dat";

        KVTGID *tgid = KVTGID::MakeTGID("my_tgid",1,1,0,1);
        KVNumberList runlist("69-666");
        tgid->SetValidRuns(runlist);
        KVIDTelescope *tel = new KVIDTelescope();
        tel->SetName("MyIDtel");
        tgid->AddIDTelescope(tel);
        tgid->SetVarX("my_X");
        tgid->SetVarY("my_Y");
        tgid->SetIDmin(2);
        tgid->SetIDmax(20);
        Double_t par[] = {1,2,3,4,5,6,7,8,9,10};
        tgid->SetLTGParameters(par);

        /////////////////////////////////////////////////////////
        // Checking the method KVTGID::WriteToAscciFile //
        /////////////////////////////////////////////////////////
        
        ofstream ofile1(f1name.Data());
        tgid->WriteToAsciiFile(ofile1);
        ofile1.close();

        ////////////////////////////////////////////////////////////
        // Checking the method KVTGID::ReadFromAsciiFile  //
        ////////////////////////////////////////////////////////////
        
        ifstream ifile1 ( f1name.Data() );
        ofstream ofile2 ( f2name.Data() );

          TString s;

        while ( ifile1.good() ) {
                //read a line
                s.ReadLine ( ifile1 );
                if ( s.BeginsWith ( "++" ) ) {
                //New fit
                //Get name of class by stripping off the '+' at the start of 
the line
                s.Remove ( 0, s.Index("::")+2 );

                        // Make new identification function
                        KVTGID *fit = NULL;

                        // Read one fit in ifile1
                        fit = KVTGID::ReadFromAsciiFile(s.Data(),ifile1);

                        // Write this read fit in ofile2
                        fit->WriteToAsciiFile(ofile2);
                }
        }

        ifile1.close();
        ofile2.close();
  }

  #########################################################

  Le programme construit une fonction d'identification 'tgid' et écrit ses 
paramétres dans le fichier ascii "test_write.dat".
  Ensuite ce fichier est lu par la méthode KVTGID::WriteFromAsciiFile(...) et 
la fonction chargée et de nouveau écrite dans un second fichier ascii 
"test_read.dat".

  Les fichiers de sortie obtenus sont:

  
  ## File: test_write.dat ########       ## File: test_read.dat #########

  ++KVTGID::my_tgid                      ++KVTGID::my_tgid
  Type=1                                 Type=1
  LightEnergyDependence=1                LightEnergyDependence=0
  ZorA=0                                 ZorA=0
  Functional=KVTGIDFunctions::fede       Functional=KVTGIDFunctions::fede
  Runs=69-666                            Runs=
  IDTelescopes=/MyIDtel/                 IDTelescopes=Ɇ}ÿ
  <VARX> my_X                            <VARX> my_X
  <VARY> my_Y                            <VARY> my_Y
  ZMIN=2  ZMAX=20                        ZMIN=2  ZMAX=20
  Lambda= 1.0000000000000e+00            Lambda= 0.0000000000000e+00
  Alpha= 2.0000000000000e+00             Alpha= 0.0000000000000e+00
  Beta= 3.0000000000000e+00              Beta= 0.0000000000000e+00
  Mu= 4.0000000000000e+00                Mu= 0.0000000000000e+00
  Nu= 5.0000000000000e+00                Nu= 0.0000000000000e+00
  Xi= 6.0000000000000e+00                Xi= 0.0000000000000e+00
  G= 7.0000000000000e+00                 G= 0.0000000000000e+00
  Pdx= 8.0000000000000e+00               Pdx= 0.0000000000000e+00
  Pdy= 9.0000000000000e+00               Pdy= 0.0000000000000e+00
  Eta= 1.0000000000000e+01               !
  !
  ######################################################################


  (j'ai essayé de mettre les deux fichiers cote à cote, j'espère que
  launchpad gardera la mise en page)

  On voit que l'écriture fonctionne correctement mais lorsque le fichier ascii 
est relu il y a quelques problèmes,
  les deux fichiers devraient être identiques.

To manage notifications about this bug go to:
https://bugs.launchpad.net/kaliveda/+bug/1071230/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~kaliveda-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kaliveda-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to