Root 5 and Root 6 incompatibilities

I am trying to use ROOT 6 to run the following code

[code]#include “persistence1d.hpp”

using namespace std;
using namespace p1d;

double extrema_root_forum()
{
cout << “Opening root file” << endl;
TFile *MyFile = new TFile(“FIMG6.root”,“READ”);
if ( MyFile->IsOpen() ) printf(“File opened successfully\n”);
cout << “Drawing Histogram” << endl;
FIMG6_EV_1->Draw();
cout << “Saving Histogram as C code” << endl;

std::vector<double> *v = new std::vector<double>(FIMG6_EV_1->GetNbinsX());
for (int i = 0; i < FIMG6_EV_1->GetNbinsX(); i++) v->at(i) = FIMG6_EV_1->GetBinContent(i + 1);
return v[0];//------------------Test Point
Persistence1D p;
p.RunPersistence(v);
p.PrintResults();
//return 0;

}[/code]

The reason I am using ROOT6 is to run persistence class which can be found people.mpi-inf.mpg.de/~weinkauf/ … nce1d.html

I’ve tested the code until Test Point in ROOT5 and is working like a charm. When going to ROOT 6 I get the following error

In file included from input_line_29:1: /afs/cern.ch/work/a/astamato/private/PSA-FIMG/Persistence1D/src/persistence1d/extrema_root_forum.C:23:5: error: use of undeclared identifier 'FIMG6_EV_1' FIMG6_EV_1->Draw();

Why cannot I run this code in ROOT6?

Thank you very miuch in advance!

TH1F *FIMG6_EV_1; MyFile->GetObject(“FIMG6_EV_1”, FIMG6_EV_1);

Thank you very much!
This seems to help to access the histogram, however I cannot run Persistence.

My code is

[code]#include “persistence1d.hpp”

using namespace std;
using namespace p1d;

/** To use ROOT6 run these commands and then execute the macro using root -q extrema_root_forum.C

source /afs/cern.ch/sw/lcg/external/gcc/4.8/x86_64-slc6/setup.csh
source /afs/cern.ch/sw/lcg/app/releases/ROOT/6.02.02/x86_64-slc6-gcc48-opt/root/bin/thisroot.csh

*/

double extrema_root_forum()
{
cout << “Opening root file” << endl;
TFile *MyFile = new TFile(“FIMG6.root”,“READ”);
if ( MyFile->IsOpen() ) printf(“File opened successfully\n”);
cout << “Drawing Histogram” << endl;
TH1F *FIMG6_EV_1;
MyFile->GetObject(“FIMG6_EV_1”, FIMG6_EV_1);
FIMG6_EV_1->Draw();
cout << “Saving Histogram as C code” << endl;

std::vector<double> *v = new std::vector<double>(FIMG6_EV_1->GetNbinsX());
for (int i = 0; i < FIMG6_EV_1->GetNbinsX(); i++) v->at(i) = FIMG6_EV_1->GetBinContent(i + 1);
return v[0];
Persistence1D p;
p.RunPersistence(v);
p.PrintResults();
return 0;

}[/code]

Although it seems that I can draw the histogram, I cannot seem to fill the vector. Runing the code using root -b -q extrema_root_forum.C gives me the following error

Processing extrema_root_forum.C... In file included from input_line_29:1: /afs/cern.ch/work/a/astamato/private/PSA-FIMG/Persistence1D/src/persistence1d/extrema_root_forum.C:28:22: error: reference to type 'const std::vector<float>' could not bind to an lvalue of type 'std::vector<double> *' p.RunPersistence(v); ^ ./persistence1d.hpp:128:48: note: passing argument to parameter 'InputData' here bool RunPersistence(const std::vector<float>& InputData) ^

I tried to use TH1D or make the vector float to match the TH1F but it didn’t seem to work.

Try:
p.RunPersistence(*v);

[quote=“Wile E. Coyote”]Try:
p.RunPersistence(*v);[/quote]

This really worked!!!
Why * made it work?