Skip to content

Commit

Permalink
* add checks that fPrimaryGenerator and fPhotonBeamGenerator are
Browse files Browse the repository at this point in the history
  defined whenever we go to use them [rtj]
  • Loading branch information
rjones30 committed Aug 10, 2020
1 parent cd76220 commit a13b7b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/GlueXPrimaryGeneratorAction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ GlueXPrimaryGeneratorAction &GlueXPrimaryGeneratorAction::operator=(const
if (fSourceType == SOURCE_TYPE_HDDM) {
fPrimaryGenerator = new GlueXPrimaryGenerator(fHDDMistream);
}
else if (fSourceType == SOURCE_TYPE_COBREMS_GEN) {
clone_photon_beam_generator();
}
else if (fSourceType == SOURCE_TYPE_PARTICLE_GUN) {
fParticleGun->SetParticleDefinition(fGunParticle.partDef);
}
if (fPhotonBeamGenerator) {
clone_photon_beam_generator();
}
fBeamvertex = src.fBeamvertex;
fBeamvertex_activated = src.fBeamvertex_activated;
return *this;
Expand Down Expand Up @@ -882,6 +882,8 @@ void GlueXPrimaryGeneratorAction::GeneratePrimariesHDDM(G4Event* anEvent)
}
z = fTargetCenterZ + (G4UniformRand() - 0.5) * fTargetLength;
}
assert (fPrimaryGenerator != 0);
assert (fPhotonBeamGenerator != 0);
double ttag = fPhotonBeamGenerator->GenerateTriggerTime(anEvent);
double trel = (z - fRFreferencePlaneZ) / beamVelocity;
fPrimaryGenerator->SetParticlePosition(G4ThreeVector(x,y,z));
Expand Down

0 comments on commit a13b7b7

Please sign in to comment.