*** Break *** segmentation violation ==

Can someone please help me resolve this error?

Events->Process("Analyze.C")
Warning in <TFile::Append>: Replacing existing TH1: Events (Potential memory leak).
Error in <TTreeReaderValueBase::CreateProxy()>: The branch event contains data of type unsigned long long. It cannot be accessed by a TTreeReaderValue<int>
Error in <TTreeReaderValue::Get()>: Value reader not properly initialized, did you call TTreeReader::Set(Next)Entry() or TTreeReader::Next()?

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
    gdb.printing.register_pretty_printer(gdb.current_objfile(),
    gdb.printing.register_pretty_printer(gdb.current_objfile(),
#0  0x00007f5bef77960c in waitpid () from /lib64/libc.so.6
#1  0x00007f5bef6f6f62 in do_system () from /lib64/libc.so.6
#2  0x00007f5bf02603fc in TUnixSystem::StackTrace() () from /usr/lib64/root/libCore.so.6.24
#3  0x00007f5bf026231a in TUnixSystem::DispatchSignals(ESignals) () from /usr/lib64/root/libCore.so.6.24
#4  <signal handler called>
#5  0x00007f5bf0934605 in ?? ()
#6  0x000000000298d550 in ?? ()
#7  0x0000000002eaa050 in ?? ()
#8  0x0000000002eaa050 in ?? ()
#9  0x0000000011e44000 in ?? ()
#10 0x00007f5be806a0d0 in ?? () from /usr/lib64/root/libCling.so
#11 0x0000000602eced90 in ?? ()
#12 0x00007f5bf0933290 in ?? ()
#13 0x0000000002eced90 in ?? ()
#14 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5  0x00007f5bf0934605 in ?? ()
#6  0x000000000298d550 in ?? ()
#7  0x0000000002eaa050 in ?? ()
#8  0x0000000002eaa050 in ?? ()
#9  0x0000000011e44000 in ?? ()
#10 0x00007f5be806a0d0 in ?? () from /usr/lib64/root/libCling.so
#11 0x0000000602eced90 in ?? ()
#12 0x00007f5bf0933290 in ?? ()
#13 0x0000000002eced90 in ?? ()
#14 0x0000000000000000 in ?? ()
===========================================================


Root > 

Hi @deshah,

welcome to the root forum. Could you please attach your code so we can take a look what might be going on?

Cheers,
Marta

#define Analyze_cxx
#include "Analyze.h"
#include <TH2.h>
#include <TStyle.h>

TH1* hist = NULL;

void Analyze::Begin(TTree * /*tree*/)
{
   // The Begin() function is called at the start of the query.
   // When running with PROOF Begin() is only called on the client.
   // The tree argument is deprecated (on PROOF 0 is passed).

   TString option = GetOption();
   hist = new TH1D("Events","Events Hist", 10, 10, 10);

}

void Analyze::SlaveBegin(TTree * /*tree*/){}

Bool_t Analyze::Process(Long64_t entry)
{
   // The Process() function is called for each entry in the tree (or possibly
   // keyed object in the case of PROOF) to be processed. The entry argument
   // specifies which entry in the currently loaded tree is to be processed.
   // When processing keyed objects with PROOF, the object is already loaded
   // and is available via the fObject pointer.
   //
   // This function should contain the \"body\" of the analysis. It can contain
   // simple or elaborate selection criteria, run algorithms on the data
   // of the event and typically fill histograms.
   //
   // The processing can be stopped by calling Abort().
   //
   // Use fStatus to set the return value of TTree::Process().
   //
   // The return value is currently not used.

   fReader.SetEntry(entry);

   GetEntry(entry);
   hist->Fill(*event);

   return kTRUE;
}

void Analyze::SlaveTerminate()
{
   // The SlaveTerminate() function is called after all entries or objects
   // have been processed. When running with PROOF SlaveTerminate() is called
   // on each slave server.
}

void Analyze::Terminate()
{
   // The Terminate() function is the last function to be called during
   // a query. It always runs on the client, it can be used to present
   // the results graphically or save the results to file.

   hist->Draw();
}

Hi @deshah,

thank you for sharing your code. I believe a similar issue was discussed in this post: Filling a histogram using selectors. Let us know if the solution suggested there (especially the last reply) works for you.

Cheers,
Marta

The suggestion does work. However, now i have a new error. For some objects inside the TTree, I have the following error:

Error in <TTreeReaderValueBase::CreateProxy()>: The branch GenIsolatedPhoton_mass contains data of type {UNDETERMINED TYPE}, which does not have a dictionary.

Hi @deshah,

I’m happy that the first problem was solved. If you can share a minimal reproducer with me, so all the files I would need to run your code (including the data), I can try to help a bit more.

Cheers,
Marta

Nevermind. I was able to solve the problem on my own. (for those looking for a solution) The segmentation fault also occurred because I didn’t change the name of the graphs each time I was making a new one to test. Thank you for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.