Old version vs. New Version Installation Processes

Yes. It worked. Thanks,

Done,

One more trivial issue:

[code]#include
#include “TFile.h”
#include “TF2.h”
#include “TH1.h”
#include “TH1F.h”
#include “TH2F.h”
#include “TCanvas.h”
#include “TFitResult.h”
#include “TMath.h”
#include “TGraphErrors.h”
#include “TGraph2DErrors.h”
#include “TLegend.h”
#include “TApplication.h”
#include “TGraphPolar.h”
#include “TLatex.h”
#include “TProfile.h”
#include “TRandom3.h”
#include “TStyle.h”

#include <math.h>

// Toy Monte Carlo example.
// Check pull distribution to compare chi2 and binned
// log-likelihood methods.

pull(int n_toys = 10000, int n_tot_entries = 100, int nbins = 40, bool do_chi2=true)
{
TString method_prefix("Log-Likelihood “);
if (do_chi2)
method_prefix=”#chi^{2} ";

 // Create histo
 TH1F* h4 = new TH1F(method_prefix+"h4",
                     method_prefix+" Random Gauss",
                     nbins,-4,4);
 h4->SetMarkerStyle(21);
 h4->SetMarkerSize(0.8);
 h4->SetMarkerColor(kRed);

 // Histogram for sigma and pull
 TH1F* sigma = new TH1F(method_prefix+"sigma",
                        method_prefix+"sigma from gaus fit",
                        50,0.5,1.5);
 TH1F* pull = new TH1F(method_prefix+"pull",
                       method_prefix+"pull from gaus fit",
                       50,-4.,4.);

 // Make nice canvases
 TCanvas* c0 = new TCanvas(method_prefix+"Gauss",
                         method_prefix+"Gauss",0,0,320,240);
 c0->SetGrid();

 // Make nice canvases
 TCanvas* c1 = new TCanvas(method_prefix+"Result",
                         method_prefix+"Sigma-Distribution",
                         0,300,600,400);
 c0->cd();

 float sig, mean;
 for (int i=0; i<n_toys; i++){
  // Reset histo contents
     h4->Reset();
  // Fill histo
     for ( int j = 0; j<n_tot_entries; j++ )
     h4->Fill(gRandom->Gaus());
  // perform fit
     if (do_chi2) h4->Fit("gaus","q"); // Chi2 fit
     else h4->Fit("gaus","lq"); // Likelihood fit
  // some control output on the way
     if (!(i%100)){
         h4->Draw("ep");
         c0->Update();}

  // Get sigma from fit
     TF1 *fit = h4->GetFunction("gaus");
     sig = fit->GetParameter(2);
     mean= fit->GetParameter(1);
     sigma->Fill(sig);
     pull->Fill(mean/sig * sqrt(n_tot_entries));
    } // end of toy MC loop
  // print result
     c1->cd();
     pull->Draw();

}

void macro9(){
int n_toys=10000;
int n_tot_entries=100;
int n_bins=40;
std::cout << “Performing Pull Experiment with chi2 \n”;
pull(n_toys,n_tot_entries,n_bins,true);
std::cout << “Performing Pull Experiment with Log Likelihood\n”;
pull(n_toys,n_tot_entries,n_bins,false);
}

#ifndef CINT
void StandaloneApplication(int argc, char** argv) {
// eventually, evaluate the application parameters argc, argv
// ==>> here the ROOT macro is called
macro9();
}
// This is the standard “main” of C++ starting
// a ROOT application
int main(int argc, char** argv) {
TApplication app(“ROOT Application”, &argc, argv);
StandaloneApplication(app.Argc(), app.Argv());
app.Run();
return 0;
}
#endif
[/code]

And error message during compilation:

[quote]Example9.C:26:85: error: ISO C++ forbids declaration of ‘pull’ with no type [-fpermissive]
pull(int n_toys = 10000, int n_tot_entries = 100, int nbins = 40, bool do_chi2=true)[/quote]

“void” type is missing:)

I am practicing 7.2.1: Storing Simple N-Tuple from the documentation.
I have made the following macro under the name Example10:

[code]#include
#include “TFile.h”
#include “TF2.h”
#include “TH1.h”
#include “TH1F.h”
#include “TH2F.h”
#include “TCanvas.h”
#include “TFitResult.h”
#include “TMath.h”
#include “TGraphErrors.h”
#include “TGraph2DErrors.h”
#include “TLegend.h”
#include “TApplication.h”
#include “TGraphPolar.h”
#include “TLatex.h”
#include “TNtuple.h”
#include “TProfile.h”
#include “TRandom3.h”
#include “TStyle.h”

#include <math.h>

// Fill an n-tuple and write it to a file simulating measurement of
// conductivity of a material in different conditions of pressure
// and temperature.

void write_ntuple_to_file(){

// Initialise the TNtuple
TNtuple cond_data("cond_data",
                  "Example N-Tuple",
                  "Potential:Current:Temperature:Pressure");

// Fill it randomly to fake the acquired data
float pot,cur,temp,pres;
for (int i=0;i<10000;++i){
    pot=gRandom->Uniform(0.,10.);      // get voltage
    temp=gRandom->Uniform(250.,350.);  // get temperature
    pres=gRandom->Uniform(0.5,1.5);    // get pressure
    cur=pot/(10.+0.05*(temp-300.)-0.2*(pres-1.)); // current

// add some random smearing (measurement errors)
pot*=gRandom->Gaus(1.,0.01); // 1% error on voltage
temp+=gRandom->Gaus(0.,0.3); // 0.3 abs. error on temp.
pres*=gRandom->Gaus(1.,0.02);// 1% error on pressure
cur*=gRandom->Gaus(1.,0.01); // 1% error on current
// write to ntuple
cond_data.Fill(pot,cur,temp,pres);
}

// Open a file, save the ntuple and close the file
TFile ofile("conductivity_experiment.root","RECREATE");
cond_data.Write();
ofile.Close();

}

#ifndef CINT
int main() {
return 0;
}
#endif
[/code]

Running the following commands seem to be free of any problem:

g++ -o Example10.exe Example10.C `root-config --cflags --libs`
./Example10.exe

However, when I am typing the following command to open the Root file in an interactive session, it is not working:

root cond_data.root

I don’t know where to look for the file that is supposed to be created somewhere.

I reinstalled the root and the issue is resolved. Something was wrong with my installation process.