Reading Tree and looping electrons and muons separately

Hello,
I am trying to create a TChain and I have successfully created two trees I need to read and plot histograms from. I need to plot by reading 5 branches ejets_2015, ejets_2016, mujets_2015, mujets_2016 (separate electron and muon cases in the plots), jet_e (restrict size of jet_e ==4).

Unfortunately, ROOT is crashing repeatedly. I have attached the code.

Any hint/help is appreciated.
Thank you

Best,
Shreya
ROOT_macro_forum .txt (4.74 KB)

Hi,

what is exactly crashing? Can you share a simple reproducer and input data that shows the issue you have?

D

Hello,
It is crashing at the ch->GetEntry(ievt); line for ttH events from the Tree.

Best,
Shreya

Hi,

what exactly is going wrong (stacktrace)? What about the minimal reproducer?

Hello,
The stack trace is as below -

0x00002b7915bace86 in TBufferFile::ReadFastArray(float*, int) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libRIO.so
#6 0x00002b7915ad3e29 in int TStreamerInfoActions::VectorLooper::ReadCollectionBasicType(TBuffer&, void*, TStreamerInfoActions::TConfiguration const*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libRIO.so
#7 0x00002b7915babb05 in TBufferFile::ApplySequence(TStreamerInfoActions::TActionSequence const&, void*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libRIO.so
#8 0x00002b791db1d119 in TBranchElement::ReadLeavesMember(TBuffer&) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libTree.so
#9 0x00002b791dafd7e2 in TBranch::GetEntry(long long, int) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libTree.so
#10 0x00002b791db28aa1 in TBranchElement::GetEntry(long long, int) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libTree.so
#11 0x00002b791dad7553 in TTree::GetEntry(long long, int) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libTree.so
#12 0x00002b7920f83ea0 in overlay_hist() ()
#13 0x00002b7920f82042 in __cling_Un1Qu30(void*) ()
#14 0x00002b7913a96be8 in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#15 0x00002b7913a9ce69 in cling::Interpreter::EvaluateInternal(std::basic_string<char, std::char_traits, std::allocator > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#16 0x00002b7913a9d08f in cling::Interpreter::echo(std::basic_string<char, std::char_traits, std::allocator > const&, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#17 0x00002b7913b475f9 in cling::MetaSema::actOnxCommand(llvm::StringRef, llvm::StringRef, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#18 0x00002b7913b53479 in cling::MetaParser::isXCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#19 0x00002b7913b5450e in cling::MetaParser::isCommand(cling::MetaSema::ActionResult&, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so
#20 0x00002b7913b411b3 in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCling.so

Also the ch->GetEntry(ievt); works if I comment out the if statements (for the conditions in the code).

At least:
vector * jet_e_ttH = new vector;
vector * jet_e_ttbar = new vector;

Hello Pepe,
I commented out all the jet_e related lines and it worked, I will try this out !

Thanks :slight_smile:
Shreya

Hello,
That works fine !
Thanks a lot.

Best,
Shreya