Read error

#0  0x00007f9f21998c3a in __GI___wait4 (pid=56925, stat_loc=stat_loc
entry=0x7fffda3e9c28, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x00007f9f21998bfb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fffda3e9c28, options=options
entry=0) at waitpid.c:38
#2  0x00007f9f21907f67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007f9f223d649e in TUnixSystem::StackTrace() () from /home/yxx/root2/lib/libCore.so
#4  0x00007f9f223d3325 in TUnixSystem::DispatchSignals(ESignals) () from /home/yxx/root2/lib/libCore.so
#5  <signal handler called>
#6  0x000055e1712e34b8 in int TTree::SetBranchAddress<int>(char const*, int*, TBranch**) ()
#7  0x000055e1712e2aec in main ()

code:

        int eventID0, blockID0, crystalID_axial0, crystalID_tangential0, DOI_ID0; 
	double timeStamp0, totalEdep0;
        int eventID1, blockID1, crystalID_axial1, crystalID_tangential1, DOI_ID1;
	double timeStamp1, totalEdep1;
	double  spositionX, spositionY, spositionZ;
        ......
        TFile *f = new TFile("resultSingles.root","READ");
	TTree *Singles = (TTree*)gDirectory->Get("Singles");
 
	Singles->SetBranchAddress("eventID0",&eventID0);
	Singles->SetBranchAddress("blockID0",&blockID0);
	Singles->SetBranchAddress("crystalID_axial0",&crystalID_axial0);
	Singles->SetBranchAddress("crystalID_tangential0",&crystalID_tangential0);
	Singles->SetBranchAddress("DOI_ID0",&DOI_ID0);
	Singles->SetBranchAddress("timeStamp0",&timeStamp0);
	Singles->SetBranchAddress("totalEdep0",&totalEdep0);

	Singles->SetBranchAddress("eventID1",&eventID1);
	Singles->SetBranchAddress("blockID1",&blockID1);
	Singles->SetBranchAddress("crystalID_axial1",&crystalID_axial1);
	Singles->SetBranchAddress("crystalID_tangential1",&crystalID_tangential1);
	Singles->SetBranchAddress("DOI_ID1",&DOI_ID1);
	Singles->SetBranchAddress("timeStamp1",&timeStamp1);
	Singles->SetBranchAddress("totalEdep1",&totalEdep1);

	Singles->SetBranchAddress("spositionX",&spositionX);
	Singles->SetBranchAddress("spositionY",&spositionY);
	Singles->SetBranchAddress("spositionZ",&spositionZ);

_ROOT Version:v6.26.10
_Platform:linux Ubuntu
_Compiler:c++


Welcome to the ROOT Forum!
That might be one of the SetBranchAddress which is wrong, and BTW, you should initialize your variables to 0, like int eventID0 = 0 and are you sure all those branches are integers?

Valgrind might points to the real problem.

Also can you copy/paste the result of Singles->Print(); ?

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