Hello,
I have a class to limit the global time of a track (geant4-11.1), as follows:
Code snippet
class TrackTimeLimiter : public G4VProcess {
G4double maxTime;
G4double limit;
class ParticleChange : public G4ParticleChange {
public:
ParticleChange() : G4ParticleChange() { }
};
ParticleChange change;
public:
TrackTimeLimiter(double _maxTime) :
G4VProcess("TrackTimeLimiter",fUserDefined), change() {
maxTime = _maxTime;
limit = 0.0;
}
G4VProcess *clone() { return new TrackTimeLimiter(*this); }
...
}
However, errors occur when compiling with geant4-11.1. Could you please take a look and figure out the problem?
Compilation errors
/home/g4bl/BLCMDphysics.cc: In member function ‘G4VProcess* TrackTimeLimiter::clone()’:
/home/g4bl/BLCMDphysics.cc:154:57: error: use of deleted function ‘TrackTimeLimiter::TrackTimeLimiter(const TrackTimeLimiter&)’
154 | G4VProcess *clone() { return new TrackTimeLimiter(*this); }
| ^
/home/g4bl/BLCMDphysics.cc:139:7: note: ‘TrackTimeLimiter::TrackTimeLimiter(const TrackTimeLimiter&)’ is implicitly deleted because the default definition would be ill-formed:
139 | class TrackTimeLimiter : public G4VProcess {
| ^~~~~~~~~~~~~~~~
/home/g4bl/BLCMDphysics.cc:139:7: error: use of deleted function ‘TrackTimeLimiter::ParticleChange::ParticleChange(const TrackTimeLimiter::ParticleChange&)’
/home/g4bl/BLCMDphysics.cc:142:8: note: ‘TrackTimeLimiter::ParticleChange::ParticleChange(const TrackTimeLimiter::ParticleChange&)’ is implicitly deleted because the default definition would be ill-formed:
142 | class ParticleChange : public G4ParticleChange {
| ^~~~~~~~~~~~~~
/home/g4bl/BLCMDphysics.cc:142:8: error: use of deleted function ‘G4ParticleChange::G4ParticleChange(const G4ParticleChange&)’
In file included from /home/geant4-11.1.0-gcc9.3-c++17/include/Geant4/G4VProcess.hh:51,
from /home/geant4-11.1.0-gcc9.3-c++17/include/Geant4/G4VContinuousDiscreteProcess.hh:43,
from /home/geant4-11.1.0-gcc9.3-c++17/include/Geant4/G4VEnergyLossProcess.hh:54,
from /home/geant4-11.1.0-gcc9.3-c++17/include/Geant4/G4MuIonisation.hh:76,
from /home/g4bl/BLCMDphysics.cc:23:
/home/geant4-11.1.0-gcc9.3-c++17/include/Geant4/G4ParticleChange.hh:65:5: note: declared here
65 | G4ParticleChange(const G4ParticleChange& right) = delete;
| ^~~~~~~~~~~~~~~~
Thanks,
Y