GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Full sim: all detected particles have PDG ID zero
Re: Full sim: all detected particles have PDG ID zero [message #9390 is a reply to message #9366] Mon, 14 September 2009 11:17 Go to previous messageGo to previous message
Ralf Kliemt is currently offline  Ralf Kliemt
Messages: 507
Registered: May 2007
Location: GSI, Darmstadt
first-grade participant

From: *to.infn.it
Hi,

You're right. When calling TF1 * fDensityFunction = new TF1(); you create a new object which is not deleted, when assinging the other object in the constructor. As far as I see it you don't need the new command. Just providing a pointer which is not stored in the class.
I would add a fDensityFunction = new TF1(); in the other constructor to be sure to have at least one object there.

You should also protect your code from crashing when trying to access the external TF1* by checking it before using a functionality i.e. line 152:

if(fDensityFunction) fZ=fDensityFunction->GetRandom();
else fz=SomeOtherRandom();


Kind Regards, Ralf.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon2.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Simulation crashes after "singular matrix" in digitization macro
Next Topic: Analyse MC hits per event in different detectors
Goto Forum:
  


Current Time: Sat Apr 27 07:05:37 CEST 2024

Total time taken to generate the page: 0.00975 seconds