Greetings all,
Following on from Rene’s advice I have been using ACLiC to hunt down coding problems with various scripts that I am using.
I have a series of scripts for sorting data from our experiments. For a long data run this sort is the most time consuming part of data analysis and so running it in compiled form is likely to present substantial time savings.
The script runs without problems in interpreted mode but it fails during compilation.
I have produced a short test script which illustrates the problem and the smallest available data file that I could make to work with it. The TTree in the attached file is unimaginatively named “TREE”.
[code]#include “TCanvas.h”
#include “TF1.h”
#include “TH1F.h”
#include “TFile.h”
#include “TTree.h”
void TestSort(){
TFile *f1=TFile::Open( “Test.root”, “READ” );
TTree T = (TTree)f1->Get(“TREE”); //EDITED AFTER UPLOAD TO REPLACE UNDECLARED IDENTIFIER “tree_name”
TCanvas *c1 = new TCanvas(“c1”,“Sorting canvas”,10,10,900,700);
TH1F *spectrum = new TH1F(“spectrum”, “”,4000,10,4010);
c1->cd(1);
TREE->Draw(“X.GE4>>spectrum”); //Error is generated for this line
spectrum->SetLineColor(2);
}[/code]
Any guidance you can give me on what I am doing wrong would be greatly appreciated.
Problem found with
ROOT 5.24/00 (trunk@29257, Jun 30 2009, 09:23:51 on win32)
CINT/ROOT C/C++ Interpreter version 5.17.00, Dec 21, 2008
and duplicated in
ROOT 5.18/00b (branches/v5-18-00-patches@22563, Mar 20 2009, 00:45:00 on linuxx8664gcc)
CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
TestSort.C (444 Bytes)
Test.root (15.4 KB)