How to resolve *Break* segmentation violation in root

Hi, I am running a code/script,during which I am facing the problem of Break segmentation violation many times.Due to which output root file is created but it doesn’t contained any histogram.

How can I resolve this error.

Can you share the code? I’ve had this happen when I loop too many times but there are also other reasons. I can take a look at your code and try to help you :slight_smile:

I am sharing the part of code where this Break occur.

The crash seems to be related to TTree. That’s not really where I shine :sweat_smile:. @pcanal any idea?

Can you provide some code (real code, not a screen dump) reproducing the problem ?

Thank you Sir for your concern , but I am not able to provide code.

I am afraid it will be difficult to help you further in that case.

Without knowing more of your code or files, you should check and protect against:
1 - is “nNEventCount” larger than the number of events in “chain”?
2 - is “nTracks” a valid value (that won’t break “passTrack”)?
But there can be other problems that can’t be seen just from the lines you showed.