I have some code which goes through a list of root data files, allows me to select a particular area of a 2D histogram (using TCut) and then plot the gamma ray energies associated with a detector (say Branch “NAI_19_E”) in a 1D Histo only when those gamma rays are coincident with that TCut set on the 2D Histo.
Apart from some random segmentation faults, the code does what I require it to do.I shall copy the error and code below. Any help is appreciated.
============THE CODE=======================
{
gROOT->Reset();
gStyle->SetPalette(1);
ifstream infile;
infile.open("/home/nppatt/bin/files.dat");
if (!infile) {
cout << “Can’t load files” << endl;
}
Int_t i;
i=1;
char filename[100];
char name[100];
UShort_t channel19;
TCanvas c1(“CHIO:TTRI_PL”);
TCanvas c2(“NAI19”);
TH1F *na19 = new TH1F(“na19”,“Na19”,16000,0,16000);
while (!infile.eof()) {
infile.getline(filename,100);
if (filename[0] == '’) {
cout <>hsqrt(1000,6000,7200,1000,1500,6000)","",“colz”);
c1.WaitPrimitive(name,“CutG”);
tt->Draw(">> list",name);
TEventList list = (TEventList*) gDirectory->Get(“list”);
tt->SetEventList(list);
Int_t nentry = list->GetN();
cout << nentry << endl;
for (Int_t j=0;jGetEntry(list->GetEntry(j));
na19->Fill(channel19);
}
f.Close();
c2.cd();
na19.Draw();
i++;
}
}
}
Nick.
*** Break *** segmentation violation
Generating stack trace…
0xb4bd75e3 in TH1Editor::SetModel(TVirtualPad*, TObject*, int) + 0x1fbd from /home/nppatt/root/lib/libGed.so
0xb4bc4f62 in TGedEditor::SetModel(TVirtualPad*, TObject*, int) + 0x1c4 from /home/nppatt/root/lib/libGed.so
0xb4c4befa in from /home/nppatt/root/lib/libGed.so
0xb749cd1f in G__CallFunc::Execute(void*) + 0xc3 from /home/nppatt/root/lib/libCint.so
0xb78c1cf5 in TQConnection::ExecuteMethod(long*, int) + 0xdd from /home/nppatt/root/lib/libCore.so
0xb78c5a1e in TQObject::Emit(char const*, long*) + 0x234 from /home/nppatt/root/lib/libCore.so
0xb6db6f5d in TCanvas::Selected(TVirtualPad*, TObject*, int) + 0x43 from /home/nppatt/root/lib/libGpad.so
0xb6db6eb3 in TCanvas::Pick(int, int, TObject*) + 0x12d from /home/nppatt/root/lib/libGpad.so
0xb6dbb86f in TCanvas::HandleInput(EEventType, int, int) at TCanvas.cxx:0 from /home/nppatt/root/lib/libGpad.so
0xb61d66d0 in TRootCanvas::HandleContainerButton(Event_t*) + 0x86 from /home/nppatt/root/lib/libGui.so
0xb61d7399 in TRootContainer::HandleButton(Event_t*) + 0xdb from /home/nppatt/root/lib/libGui.so
0xb614107d in TGFrame::HandleEvent(Event_t*) at TGFrame.cxx:0 from /home/nppatt/root/lib/libGui.so
0xb611806d in TGClient::HandleEvent(Event_t*) + 0xef from /home/nppatt/root/lib/libGui.so
0xb61180e9 in TGClient::ProcessOneEvent() + 0x67 from /home/nppatt/root/lib/libGui.so
0xb611818e in TGClient::HandleInput() + 0x24 from /home/nppatt/root/lib/libGui.so
0xb61181c6 in TGInputHandler::Notify() + 0x20 from /home/nppatt/root/lib/libGui.so
0xb79c9c82 in TUnixSystem::DispatchOneEvent(bool) + 0x50 from /home/nppatt/root/lib/libCore.so
0xb78e3df2 in TSystem::ProcessEvents() + 0x42 from /home/nppatt/root/lib/libCore.so
0xb6dd87fa in TPad::WaitPrimitive(char const*, char const*) + 0x140 from /home/nppatt/root/lib/libGpad.so
0xb6dfb648 in from /home/nppatt/root/lib/libGpad.so
0xb745e99d in G__ExceptionWrapper + 0x57 from /home/nppatt/root/lib/libCint.so
0xb7482897 in G__exec_asm at bc_exec.cxx:0 from /home/nppatt/root/lib/libCint.so
0xb7535ede in G__exec_loop + 0x624 from /home/nppatt/root/lib/libCint.so
0xb753636e in G__exec_while + 0x92 from /home/nppatt/root/lib/libCint.so
0xb75345ce in G__exec_statement at v6_parse.cxx:0 from /home/nppatt/root/lib/libCint.so
0xb74bd3aa in G__exec_tempfile_core + 0x35c from /home/nppatt/root/lib/libCint.so
0xb74bd5e0 in G__exec_tempfile + 0x2e from /home/nppatt/root/lib/libCint.so
0xb75404b6 in G__process_cmd + 0x4ff8 from /home/nppatt/root/lib/libCint.so
0xb7933083 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0x129 from /home/nppatt/root/lib/libCore.so
0xb7930500 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) + 0x4a from /home/nppatt/root/lib/libCore.so
0xb78679d7 in TApplication::ProcessFile(char const*, int*) + 0x62b from /home/nppatt/root/lib/libCore.so
0xb78648e0 in TApplication::ProcessLine(char const*, bool, int*) + 0x63e from /home/nppatt/root/lib/libCore.so
0xb697572c in TRint::Run(bool) + 0x234 from /home/nppatt/root/lib/libRint.so
0x08048d17 in main + 0x87 from /home/nppatt/root/bin/root.exe
0xb6727ea2 in __libc_start_main + 0xd2 from /lib/tls/i686/cmov/libc.so.6
0x08048c11 in TApplicationImp::ShowMembers(TMemberInspector&, char*) + 0x31 from /home/nppatt/root/bin/root.exe
CHIO_TTRI_PL.cpp (1.2 KB)