For some reasons, I have in my code a function called CreateHisto which create a vector of histograms and each element of the vector is a TH1F. I have a for loop which create one histogram for each index, and I also want that the name of these histograms are different according to the different index.
However I receive a segmentation violation. Could you help me? I hope that what I want to do it’s clear.
unfortunately it doesn’t work and I get again segmentation violation.
The error is the following:
[code]The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at http://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 0x00007f5e524f882f in __strlen_sse42 () from /lib64/libc.so.6 #6 0x00007f5e54ac2b45 in TString::TString(char const*) () from /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/lib/libCore.so #7 0x00007f5e5b342c11 in MyxAODAnalysis::CreateHisto(char*, char*, int, double, double) () at /afs/cern.ch/work/a/amurrone/TheoryTau/TheoryUncIchep/Root/MyxAODAnalysis.cxx:113 #8 0x00007f5e5b342e93 in MyxAODAnalysis::initialize() () at /afs/cern.ch/work/a/amurrone/TheoryTau/TheoryUncIchep/Root/MyxAODAnalysis.cxx:176 #9 0x00007f5e57d82a81 in EL::Worker::changeAlgState(EL::Worker::AlgInitState, EL::Worker::AlgExecState, EL::Worker::InputState) () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #10 0x00007f5e57d8360f in EL::Worker::algsExecute() () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #11 0x00007f5e57d8d7f3 in EL::DirectWorker::run() () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #12 0x00007f5e57db4e10 in EL::DirectDriver::doSubmit(EL::Job const&, std::basic_string<char, std::char_traits, std::allocator > const&) const () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #13 0x00007f5e57db8f76 in EL::Driver::submitOnly(EL::Job const&, std::basic_string<char, std::char_traits, std::allocator > const&) const () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #14 0x00007f5e57db9849 in EL::Driver::submit(EL::Job const&, std::basic_string<char, std::char_traits, std::allocator > const&) const () from /afs/cern.ch/work/a/amurrone/TheoryTau/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libEventLoop.so #15 0x0000000000402947 in main () at /afs/cern.ch/work/a/amurrone/TheoryTau/TheoryUncIchep/util/testRun.cxx:112[/code]
Line 113 of MyxAODAnalysis.cxx is the one with "TString nameh = … "
sorry, I have another question related to this topic. I want to save histograms in a root tree but as they are vector<TH1F*> and not simply TH1F, at run time it gives me this error:
Is there a way to have the output stored in a tree?
Yes, there is. As hinted by the error message you need to generate an explicit dictionary for vector<TH1F*>. You can do so in several ways including adding
#pragma link C++ class vector<TH1F*>+;
to one of you LinkDef.h files.