Skip to content

Commit

Permalink
make Vladimirs change const correct
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlange6 committed Oct 1, 2014
1 parent ce428bc commit 19520d4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions SimG4Core/Generators/src/Generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ Generator::~Generator()
delete fLumiFilter;
}

void Generator::HepMC2G4(const HepMC::GenEvent * evt, G4Event * g4evt)
void Generator::HepMC2G4(const HepMC::GenEvent * evt_orig, G4Event * g4evt)
{

HepMC::GenEvent *evt=new HepMC::GenEvent(*evt_orig);

if ( *(evt->vertices_begin()) == 0 ) {
throw SimG4Exception("SimG4CoreGenerator: Corrupted Event - GenEvent with no vertex");
}
Expand Down Expand Up @@ -374,7 +376,22 @@ void Generator::HepMC2G4(const HepMC::GenEvent * evt, G4Event * g4evt)
G4PrimaryVertex* g4vtx = new G4PrimaryVertex(0.0, 0.0, 0.0, 0.0);
if ( verbose > 1 ) g4vtx->Print();
g4evt->AddPrimaryVertex(g4vtx);
} else {
// restore original particle status
// to avoid problem downstream
for(HepMC::GenEvent::vertex_const_iterator vitr= evt->vertices_begin(); vitr != evt->vertices_end(); ++vitr ) {
HepMC::GenVertex::particle_iterator pitr;
for (pitr= (*vitr)->particles_begin(HepMC::children);
pitr != (*vitr)->particles_end(HepMC::children); ++pitr){
int status = (*pitr)->status();
if(status > 1000) {
(*pitr)->set_status(status - 1000);
}
}
}
}

delete evt;
}

void Generator::particleAssignDaughters( G4PrimaryParticle* g4p,
Expand Down Expand Up @@ -447,8 +464,7 @@ void Generator::particleAssignDaughters( G4PrimaryParticle* g4p,
double dd = std::sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)+(z1-z2)*(z1-z2));
particleAssignDaughters(g4daught,*vpdec,dd);
}
// this line is the source of the "tau-bug" in 7_2_0_pre5
//(*vpdec)->set_status(1000+(*vpdec)->status());
(*vpdec)->set_status(1000+(*vpdec)->status());
g4p->SetDaughter(g4daught);

if ( verbose > 1 ) g4daught->Print();
Expand Down
2 changes: 1 addition & 1 deletion Validation/EventGenerator/src/HepMCValidationHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace HepMCValidationHelper {
findDescendents(taus[i], taudaughters);
if ( taudaughters.size()<=0 ) {
edm::LogError("HepMCValidationHelper") << "Tau with no daughters. This is a bug. Fix it";
abort();
//comment out for now to be safe abort();
}
const HepMC::FourVector& taumom = taus[i]->momentum();
//remove the daughters from the list of particles to compute isolation
Expand Down

0 comments on commit 19520d4

Please sign in to comment.