Dear Rooters,
first of all, Happy New Year and thanks for help I have received so far.
I wonder whether I have encountered today a bug or at least an unpleasant feature
of root (Version 3.05_03, official installation at DESY/Hamburg).
This is what happens:
I create a root file containing a tree with the programm consisting of the three parts
given below
(myMain.cc + 2 files, testbeam_event.cc + testbeam_beamevent.hh,
containing the definition of an event object from which an event dictionary and
a shared library are well created).
The root-file is well created and it can be opened but when I try to scan the tree
I receive a sementation violation.
i.e.
root [0] gSystem->Load(“libEvent.so”);
root [1] TFile f(“my.root”)
root [2] t = (TTree*) f.Get(“T”)
root [3] t->Scan()
- Row * fUniqueID * fBits * CellID * Energy * fEvtHdr.f * fEvtHdr.f * fEvtHdr.f *
*** Break *** segmentation violation
Generating stack trace…
0x401d52ca in StackTrace__11TUnixSystem + 0x2e6
from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x401d3a2f in DispatchSignals__11TUnixSystem8ESignals + 0xc7 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x401d2cd0 in GetSize__C8TWebFile + 0xc4 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x401d6b93 in GetSockOpt__11TUnixSystemiiPi + 0x30f from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x40e76e58 in killpg + 0x58 from /lib/libc.so.6
0x40c769c5 in ReadLeaves__14TBranchElementR7TBuffer + 0x969 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTree.so
0x40c6e852 in GetEntry__7TBranchii + 0x19a from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTree.so
0x40c75777 in GetEntry__14TBranchElementii + 0x1cb from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTree.so
0x4160ffb2 in EvalInstance__12TTreeFormulai + 0x27a from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTreePlayer.so
0x41611e85 in PrintValue__C12TTreeFormulai + 0x18d from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTreePlayer.so
0x4161be8e in Scan__11TTreePlayerPCcN21ii + 0xdca from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTreePlayer.so
0x40c8ee13 in Scan__5TTreePCcN21ii + 0x5b from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTree.so
0x40ca9d00 in G__cpp_dllrevG__Tree + 0x7754 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libTree.so
0x40616625 in G__call_cppfunc + 0x291 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x40604668 in G__interpret_func + 0x814 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x405ea4a7 in G__getfunction + 0x14ef from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x4067d313 in G__getstructmem + 0x80f from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x40676def in G__getvariable + 0x6bf from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x405e2019 in G__getitem + 0x4f9 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x405e08e2 in G__getexpr + 0x9092 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x4062f1ad in G__exec_function + 0x1a9 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x4063679d in G__exec_statement + 0x2c01 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x405c6dd5 in G__exec_tempfile_core + 0x2dd from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x405c6f95 in G__exec_tempfile_fp + 0x25 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x4063f819 in G__process_cmd + 0x52e1 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCint.so
0x4018bdc1 in ProcessLine__5TCintPCcPQ212TInterpreter10EErrorCode + 0xa1 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x401161a1 in ProcessLine__12TApplicationPCcbPi + 0x5f1 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x40dd1e6b in HandleTermInput__5TRint + 0x197 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libRint.so
0x40dd0f89 in Notify__17TTermInputHandler + 0x29 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libRint.so
0x40dea5d8 in ReadNotify__17TTermInputHandler at /data/gcc-2.95.3/hierhinein/gcc/…/…/gcc-2.95.3/gcc/cp/new.cc:0 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libRint.so
0x401d3da9 in CheckDescriptors__11TUnixSystem + 0xd9 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x401d35e5 in DispatchOneEvent__11TUnixSystemb + 0xb5 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x40161499 in InnerLoop__7TSystem + 0x31 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x40161409 in Run__7TSystem + 0x79 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
0x40116bd6 in Run__12TApplicationb + 0x32 from /pro0x40dd1887 in Run__5TRintb + 0x2df from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libRint.so
0x080487f7 in main + 0x83 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/bin/root.exe
0x40e66c5f in __libc_start_main + 0xcf from /lib/libc.so.6
0x080486a1 in _start + 0x21 from /products/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/bin/root.exe
ducts/ROOT/3.05_03/ROOT-linux24-gcc-2.95.3/lib/libCore.so
Root >
… so a serious crash
The funny thing is now that by typing e.g.
Root > t->Scan(“Energy”)
the problems somehow gets circumvented, because afterwards
root [5] t->Scan()
looks fine .
BTW. I observe the same behaviour when testing the ‘Event’ example
under $ROOTSYS/test (official installation at DESY/Hamburg).
I don’t observe the problem under version 3.02_07.
Does anyone have a clue to the problem ? Thanks in advance.
Cheers,
Roman
Here is the code of my example:
#include <stdlib.h>
#include “TROOT.h”
#include “TFile.h”
#include “TNetFile.h”
#include “TRandom.h”
#include “TTree.h”
#include “TBranch.h”
#include “TClonesArray.h”
#include “TStopwatch.h”
#include “testbeam_event.hh”
int main(int argc, char argv)
{
float eneg;
int CellId;
int evtnum;
TFile root_outfile;
TTree t_tree;
TestBeam_Eventh *event;
int nb;
root_outfile = new TFile(“my.root”,“RECREATE”,“TTree benchmark ROOT file”);
root_outfile->SetCompressionLevel(1);
// cout << “outfile =” << " " << &root_outfile << endl;
t_tree = new TTree(“T”,“ROOT”);
cout << “t_tree =” << " " << &t_tree << endl;
// create a pointer to an event object
event = new TestBeam_Eventh();
TTree::SetBranchStyle(1);
TBranch *branch = t_tree->Branch(“event_not_split”, “TestBeam_Eventh”, &event, 64000,2);
branch->SetAutoDelete(kFALSE);
//do everything about root file here
char etype[20];
event->SetHeader(0, 200, 180104);
sprintf(etype,“type%d”,evtnum%5);
event->Build(0, 1.);
nb += t_tree->Fill();
root_outfile->Write();
t_tree->Print();
root_outfile->Close();
}
testbeam_event.hh
#ifndef TestBeam_Event_h
#define TestBeam_Event_h
#include “TObject.h”
#include “TClonesArray.h”
#include “TRefArray.h”
#include “TRef.h”
#include “TH1.h”
#include “TMath.h”
#include “TRandom.h”
#include “TDirectory.h”
#include “TProcessID.h”
#include <iostream.h>
class TDirectory;
class TestBeam_EventHeader {
private:
Int_t fEvtNum;
Int_t fRun;
Int_t fDate;
public:
TestBeam_EventHeader();
virtual ~TestBeam_EventHeader();
void Set(Int_t i, Int_t r, Int_t d) { fEvtNum = i; fRun = r; fDate = d; }
Int_t GetEvtNum() const { return fEvtNum; }
Int_t GetRun() const { return fRun; }
Int_t GetDate() const { return fDate; }
ClassDef(TestBeam_EventHeader,1) //Event Header
};
class TestBeam_Eventh : public TObject {
public:
TestBeam_Eventh();
virtual ~TestBeam_Eventh();
void Build(Int_t inp_CellID, Float_t inp_eneg) {
CellID = inp_CellID;
Energy = inp_eneg;
}
void SetHeader(Int_t i, Int_t run, Int_t date) {
//fNCells = 0;
fEvtHdr.Set(i, run, date);
}
//void SetType(char *type) {strcpy(fType,type);}
ClassDef(TestBeam_Eventh,1)
private:
//char fType[20]; //event type
Int_t CellID; // CellId of the cell
Float_t Energy; // Energy of cell
TestBeam_EventHeader fEvtHdr;
};
#endif
testbeam_event.cc
#include “TRandom.h”
#include “TDirectory.h”
#include “TProcessID.h”
#include "testbeam_event.hh"
ClassImp(TestBeam_EventHeader)
ClassImp(TestBeam_Eventh)
TestBeam_EventHeader::TestBeam_EventHeader() : fEvtNum(0), fRun(0),
fDate(0) {}
TestBeam_EventHeader::~TestBeam_EventHeader() {}
TestBeam_Eventh::TestBeam_Eventh() {}
TestBeam_Eventh::~TestBeam_Eventh() {}
P.S.: The ‘add attachment’ tool here on this posting side didn’t work at all for me
I could never verify what I have tried to attach. e.g. the 'Posted Attachment’
mentioned there never appears (mozilla v1.3)