Difference ROOT5.34 & ROOT6.04.16

I’ve used working script at ROOT5.34
but
I cann’t use it at ROOT6.04.16

The first lines of script are:

 void fitADC(){

TFile *hf=new TFile("ADC.root");

   Double_t par[9];
 Int_t Nbins=h1->GetNbinsX();
 Double_t xmin=h1->GetXaxis()->GetXmin();
 Double_t xmax=h1->GetXaxis()->GetXmax();
 Double_t binwid=(xmax-xmin)/Nbins;
 cout<<"  Nbins="<<Nbins<<"  xmin="<<xmin<<"  xmax="<<xmax<< endl;
 TH1F *h1minbg  = new TH1F("h1minbg","",Nbins,xmin,xmax);
 for(Int_t i=210;i<400;i++)
   {
     h1minbg->SetBinContent(i+1,h1->GetBinContent(i+1)-exp(9.348-0.007638*i));
     h1minbg->SetBinError(i+1,h1->GetBinError(i+1));
   }

/// Histogram h1 with 1000 channels is in ADC.root

The output looks like:

.x ../MyROOT/ADCread/fitADC.C

In file included from input_line_9:1:
/home/evd/MyROOT/ADCread/fitADC.C:61:14: error: use of undeclared identifier 'h1'
 Int_t Nbins=h1->GetNbinsX();
             ^
/home/evd/MyROOT/ADCread/fitADC.C:62:16: error: use of undeclared identifier 'h1'
 Double_t xmin=h1->GetXaxis()->GetXmin();
               ^
/home/evd/MyROOT/ADCread/fitADC.C:63:16: error: use of undeclared identifier 'h1'
 Double_t xmax=h1->GetXaxis()->GetXmax();
               ^
/home/evd/MyROOT/ADCread/fitADC.C:69:33: error: use of undeclared identifier 'h1'
     h1minbg->SetBinContent(i+1,h1->GetBinContent(i+1)-exp(9.348-0.007638*i));
                                ^
/home/evd/MyROOT/ADCread/fitADC.C:70:31: error: use of undeclared identifier 'h1'
     h1minbg->SetBinError(i+1,h1->GetBinError(i+1));
                              ^

What is the differnce between two versions?

Try with: TH1F *h1; hf->GetObject("h1", h1);

ROOT 6.04.16 installed at VirtualBox with opeSUSE13.1, also ROOT5.34
ROOT5.34 installed at several computers with KUBUNTU

Thank you Pepe Le Pew, it works.

Please help me. With this code, I can run it perfectly in root 5, but I can’t run it in root 6.prob_vac.C (14.0 KB)

Try to precompile your macro using ACLiC and fix all bugs and warnings reported by your compiler (in ROOT 5 and / or ROOT 6, there should be no big differences):

root [0] .L probmu2et2k_vac.C++

Sorry, I am using root 6. I try to modify this code in root 6, but I can’t run it.

You can start with this: probmu2et2k_vac.C (2.9 KB)

thank you very much!!!

Please help me. How I can modify my code to adjust the root6.cc plot as same as the root5.cc plot. appearance_nu_mode_0.cc (5.5 KB) root5.pdf (14.8 KB) root6.pdf (18.2 KB)

// ...
h1->Draw("HIST");
// ...
h2->Draw("HIST SAME");
// ...
h3->Draw("HIST SAME");
// ...
h4->Draw("HIST SAME");
// ...
h5->Draw("HIST SAME");
// ...
h6->Draw("HIST SAME");
// ...

Thank for your help.

Welll, it seems the parakeet “rule” is invalid for the function glbGetRuleRatePtr…
This is not a ROOT function. May be check the related documentation.

I can’t run this code in root 6 plot_eventrate_app.C (6.7 KB) but It can run in root 5. What errors?

This screen dump shows you define several time “leg0” that’s invalid C++.
and titleStyle is undeclared…

you should see these errors with root5 also running with AClic:

root [0] .x plot_eventrate_app.C++

Can you help me for this code?Data.zip (3.3 KB) run.py file can run perfectly in root5, but I can’t run it in root 6. Thanks.

When I run your python script I get:

% python run.py
0.125	9.6437907107	5.4795756055	7.9888417672	2.6207436077
0.175	51.9526406533	37.4747872288	42.1912957549	16.6879400502
0.225	66.620755538	49.7655007297	48.8769712192	22.7004158603
0.275	72.6895306269	51.5873796756	50.863630749	22.003540989
0.325	88.5861226252	63.8789131041	62.91843373	28.6912751678
0.375	101.4115218394	77.4003378101	76.9887182443	38.7316259727
0.425	134.509247112	106.3167216018	101.796228435	60.1824021081
0.475	166.3735879056	140.1592299241	134.654341829	92.3714332771
0.525	188.4125654724	163.5337236188	168.8567958167	121.204759748
0.575	204.9258497103	180.7505616504	186.9518672541	136.6142380698
0.625	204.8522392308	181.9574949574	182.2260880306	135.9183925557
0.675	185.1229949323	161.6126334432	164.7527483839	121.7986988924
0.725	150.649571587	130.1839917351	140.5649112694	101.6377074155
0.775	125.392180277	105.5287712566	121.7482603862	84.1633384115
0.825	98.9063118533	79.6411997179	100.917157327	64.6755465887
0.875	76.7176596448	59.9129236975	83.4417589657	49.8836826286
0.925	60.0620618132	43.8784211476	66.637501544	36.4330711903
0.975	46.4727494005	31.5385119955	55.2013422819	27.6845637584
1.025	35.9595371373	22.2774306751	45.1095236135	18.9350269692
1.075	28.512610293	16.0951771863	38.3723802857	13.5391361634
1.125	23.5250913588	12	32.97648948	10.1576975337
1.175	19.1518109814	8.6567947393	28.9239099107	8.1154527113
1.225	16.6212462745	7.4006657811	25.5424712809	6.7484662577

What should I do next ?

I want to write the code to plot the histogram from that data.

I am a bit puzzle because run.py is not a ROOT script. And you said it runs with ROOT 5 … that’s not possible, it is not a ROOT script.
Seems to me you are trying to generate a ROOT macro which you will execute after in ROOT ? why are you not directly writing a ROOT macro ?