ErrorPropTest.h File Reference

#include "ValueErr.h"
#include "TObject.h"
#include "TRandom.h"
#include <iostream>

Go to the source code of this file.

Classes

class  ErrorData1
class  ErrorData2

Functions

void errproptest (void)

Function Documentation

void errproptest ( void   ) 

Definition at line 9 of file ErrorPropTest.cxx.

References MuELoss::a, n, ValueErr< T >::Print(), and ErrorData2::Print().

00010 {
00011   Double_t a = 1;
00012   DoubleErr ae = a;
00013   cout << " Assigning double to DoubleErr: " << a << " = " << ae << endl;
00014   
00015   DoubleErr be = 2;
00016   Double_t b = be;
00017   cout << "Assigning DoulbeErr to double: " << be << " = " << b << endl;
00018 
00019   DoubleErr x(3,0.5);
00020   DoubleErr y(2,1.0);
00021   Double_t  k(2);
00022   cout << "x:     " << x << endl;
00023   cout << "y:     " << y << endl;
00024   cout << "k:     " << k << endl;
00025   cout << "x + k: " << x+k << endl;
00026   cout << "k + x: " << k+x << endl;
00027   cout << "x + y: " << x+y << endl;
00028   cout << endl;
00029   cout << "x - k: " << x-k << endl;
00030   cout << "k - x: " << k-x << endl;
00031   cout << "x - y: " << x-y << endl;
00032   cout << endl;
00033   cout << "x * k: " << x*k << endl;
00034   cout << "k * x: " << k*x << endl;
00035   cout << "x * y: " << x*y << endl;
00036   cout << "x * 3: " << x*3 << endl;
00037   cout << endl;
00038   cout << "x / k: " << x/k << endl;
00039   cout << "k / x: " << k/x << endl;
00040   cout << "x / y: " << x/y << endl;
00041   cout << endl;
00042   cout << "x+= k: " << (x+=k) << endl;
00043   cout << "x+= 3: " << (x+=3) << endl;
00044   cout << endl;
00045   cout << "fmod(y,0.5): " << fmod(y,0.3) << endl;
00046   y.Print();
00047 
00048 
00049   cout << "Testing read/write of objects with ValueErr data members." << endl;
00050   
00051   cout << "Writing: " << endl; 
00052   TFile fsave("errorprop0.root","RECREATE");
00053   ErrorData2 ed2;
00054   ed2.Print();
00055   ed2.Write("ed2");
00056   fsave.Close();
00057 
00058 
00059   cout << "Reading: " << endl;
00060   TFile fread("errorprop0.root");
00061   fread.Get("ed2")->Print();
00062   fread.Close();
00063 
00064 
00065 
00066   return; // Skip the rest...................................
00067 
00068   // Bulk test of write:
00069   const int n = 100;
00070 
00071   TClonesArray a1("ErrorData1",n);
00072   for(int i = 0; i<n; i++) {
00073     new(a1[i]) ErrorData1();
00074   }
00075   TFile f1("errorprop1.root","RECREATE");
00076   a1.Write("array");
00077   f1.Close();
00078 
00079 
00080   TClonesArray a2("ErrorData2",n);
00081   for(int i = 0; i<n; i++) {
00082     new(a2[i]) ErrorData2();
00083   }
00084   TFile f2("errorprop2.root","RECREATE");
00085   a2.Write("array");
00086   f2.Close();
00087 
00088 
00089 }


Generated on 2 Nov 2017 for loon by  doxygen 1.6.1