impy-project / chromo

Hadronic Interaction Model interface in PYthon
Other
30 stars 7 forks source link

'CompositeTarget' object has no attribute 'copy' #163

Closed jncots closed 11 months ago

jncots commented 1 year ago

EventData.copy() produces an error, if kinematics contains CompositeTarget:

File [~/chromo/src/chromo/kinematics.py:121](https://vscode-remote+ssh-002dremote-002bvscode.vscode-resource.vscode-cdn.net/hetghome/antonpr/quick_tests/09_pythia_afterburner/~/chromo/src/chromo/kinematics.py:121), in EventKinematicsBase.copy(self)
    117 def copy(self):
    118     return EventKinematicsBase(
    119         self.frame,
    120         self.p1,
--> 121         self.p2.copy() if isinstance(self.p2, CompositeTarget) else self.p2,
    122         self.ecm,
    123         self.plab,
    124         self.elab,
    125         self.ekin,
    126         (self.beams[0].copy(), self.beams[1].copy()),
    127         self._gamma_cm,
    128         self._betagamma_cm,
    129     )

AttributeError: 'CompositeTarget' object has no attribute 'copy'
jncots commented 1 year ago

In addition to that:

  File "/hetghome/antonpr/quick_tests/09_pythia_afterburner/pythia_test.py", line 33, in init_event
    return event.copy()
  File "/hetghome/antonpr/chromo/src/chromo/common.py", line 246, in copy
    copies = self.__getstate__()
  File "/hetghome/antonpr/chromo/src/chromo/common.py", line 233, in __getstate__
    self.parents.copy(),
AttributeError: 'NoneType' object has no attribute 'copy'