Hello,
I couldn't quite figure out why my code is randomly crashing with segfaults until I started to test around segments of it and came to a bizarre conclusion, that vectors are behaving oddly:
[oberon] /home/mario/pythia > root -l -b root [0] TLorentzVector p1 = TLorentzVector(1,2,3,4) root [1] p1.M()
root [2] vector<TLorentzVector> tst; root [3] tst.push_back(p1) root [4] tst.size()
Or for example:
[oberon] /home/mario/pythia > root -l -b root [0] TLorentzVector p1 = TLorentzVector(1,2,3,4) root [1] TLorentzVector p2 = TLorentzVector(3,4,7,10) root [2] vector<TLorentzVector> tst; root [3] tst.size()
root [4] tst.push_back(p1) root [5] tst.push_back(p2) root [6] tst.clear()
what am I doing wrong? This seems to be some basic misunderstanding on my part on vectors. Am I not supposed to clear them? And if I'm not, then why is the function there? Am I misusing it? What I'd like to do is to have two vectors of TLorentzVector type. One for positive particles, other for negative and then I could fill them at every event, iterate over them to generate plots and then at the end of the event clear them for the next event. How am I supposed to do that without using the clear function?
"Physics is like sex, sure it may give some practical results, but that's not why we do it"
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:59 MET