#include <stdio.h>
#include <stdlib.h>
#include "math.h"
#include <iostream.h>
#include <string>

// Pour le test 
#include "histinit.h"
#include "histos.h"
#include "histos2.h"
#include "psighand.h"


#include "fmath.h"
#include "nbrandom.h"

void tdcr(AnyDataObj * obj)
{
Histo & h = *(dynamic_cast<Histo *>(obj));
h.Print();
}

int main(int narg, char* arg[])
{

  SophyaInit();
  SophyaConfigureSignalhandling(true,true,true);
  try { 
  Histo *h;
  float x;


  h = new Histo(0., 200., 100);  // Creation histo (AVEC new )
  for(int i=0; i<100; i++)  // Remplissage d'histo
    { x = (2*i+1.);  h->Add(x, x*(200.-x)); }
  cout << " Appel tdcr(histo) " << endl;
  tdcr(h);
  cout << " Appel tdcr(histo2D) " << endl;
  Histo2D * h2 = new Histo2D(0., 1., 10, 0., 1., 10);
  tdcr(h2);
  //  cout << " Appel tdcr(NULL) " << endl;
  //  tdcr(NULL);
  cout << " End --- exit .... " << endl;
}
  catch (PThrowable & exc) {
    cerr << " catched Exception " << exc.Msg() << endl;
  }  
  catch (...) {
    cerr << " catched unknown (...) exception " << endl; 
  }  
}

