TGenPhaseSpace doubts for manipulation

I’m posting this question here because the section, newbies hasn’t gotten a response in three days. I need to manipulate the raubold lynch method in TGenPhaseSpace. The very first thing that I did was just to copy the code and change the name of the class form TGenPhaseSpace to TMyGen. In https://root.cern.ch/root/Using.html you guys say that a new class need to have

ClassDef(ClassName,ClassVersionID)  //The class title

in the .h file, and also

ClassImp(ClassName)

in the .cxx file.

Nevertheless, I get a message like this:

IncrementalExecutor::executeFunction: symbol '_ZN6TMyGen8GenerateEv' unresolved while linking function '_GLOBAL__sub_I_cling_module_4'!
You are probably missing the definition of TMyGen::Generate()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN6TMyGen8GetDecayEi' unresolved while linking function '_GLOBAL__sub_I_cling_module_4'!
You are probably missing the definition of TMyGen::GetDecay(int)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN6TMyGen8SetDecayER14TLorentzVectoriPKdPKc' unresolved while linking function '_GLOBAL__sub_I_cling_module_4'!
You are probably missing the definition of TMyGen::SetDecay(TLorentzVector&, int, double const*, char const*)
Maybe you need to load the corresponding shared library?

I must remark the fact that I have not manipulated the TGenPhaseSpace archives except in changing names.

Thanks.

Hi @danny

Sorry for the delay, let me discuss this with some of my colleagues and I will get back to you.

Enric

HI @danny

Can you attach here the file you are trying to compile? Is there any reference to TGenPhaseSpace left in the file?

Cheers,
Enric

I’ll post here the exact copies of TGenPhaseSpace* (TMyGen.C and TMyGen.h) that I manipulated, and the file I’m trying to compile using the changed TGenPhaseSpace*.
TMyGen.C (6.5 KB)
TMyGen.h (1.5 KB)
Omega_2018_myclass.C (15.9 KB)

Thanks.

So if I understand correctly, you basically copied TGenPhaseSpace.h and TGenPhaseSpace.cxx into TMyGen.C and TMyGen.h, and then modified the implementation of some method in TMyGen.C?

If that is what you would like to do, you could also make TMyGen a subclass of TGenPhaseSpace and override the methods whose behaviour you want to change.

I have not modified the implementation of any method in TMyGen.C yet. I just wanted to check it would do the same as TGenPhaseSpace, before going into changing anything else. But yes, you are correct, so, now my question would be how can I make TMyGen a subclass of TGenPhaseSpace?

Thanks so much

You need to use C++ inheritance, you can look for resources on the internet, e.g.:

http://www.cplusplus.com/doc/tutorial/inheritance/

So your TMyGen.h will start with something like:

#include "TGenPhaseSpace.h"

class TMyGen : public TGenPhaseSpace {
...

and your TMyGen.cxx will implement those methods of TGenPhaseSpace you want to override.

And when building my code will I call TGenPhaseSpace like the regular example?

 TGenPhaseSpace event,event1, event2;
 event.SetDecay(W, 2, masses);

Thanks.

No, you would call your TMyGen instead, which has the behaviour that you redefined.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.