#include "TVectorD.h" // DEMO macro // Main function is function // with name identical to file name (ex0 in this case) void ex0() { // Declare a histogram // #bins,min,max TH1* h1 = new TH1F("h1","title1",100, 0, 10) ; TH1* h2 = new TH1F("h2","title2",100, 0, 10) ; for (int i=0 ; i<1000 ; i++) { // Draw a random number from a Gaussian distribution with mean 5 and width 1 Double_t ran1 = gRandom->Gaus(5,1) ; // Draw a random number from a uniform distribution between 0 and 10 Double_t ran2 = gRandom->Uniform(0,10) ; // Fill one entry in a histogram h1->Fill(ran1) ; // Fill one entry in a histogram h2->Fill(ran2) ; } // Draw histogram on a canvas // A TCanvas object is automatically created when you do this h1->Draw() ; // h2->Draw() ; // Create a vector of length 3 with element type 'double' TVectorD vec(3) ; // Fill vector element (index starts at zero) vec(0) = 5.0 ; // Print contents of vector vec.Print() ; // Create a matrix of size (3x4) with element type 'double' TMatrixD matrix(3,3) ; // Fill matrix element matrix(0,0)=1 ; // Print contents of matrix matrix.Print() ; }