Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeating fix on 71x #5652

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 19 additions & 3 deletions SimG4Core/Generators/src/Generator.cc
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
7 changes: 5 additions & 2 deletions Validation/EventGenerator/src/HepMCValidationHelper.cc
@@ -1,7 +1,7 @@
#include "Validation/EventGenerator/interface/HepMCValidationHelper.h"
#include "DataFormats/Math/interface/deltaR.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <cassert>
#include <limits>
#include "TLorentzVector.h"

Expand Down Expand Up @@ -184,7 +184,10 @@ namespace HepMCValidationHelper {
for (unsigned int i = 0; i < taus.size(); ++i){
std::vector<const HepMC::GenParticle*> taudaughters;
findDescendents(taus[i], taudaughters);
assert(taudaughters.size()>0);
if ( taudaughters.size()<=0 ) {
edm::LogError("HepMCValidationHelper") << "Tau with no daughters. This is a bug. Fix it";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the status of this in 73X?
Is it still waiting for a forward port?

I see https://github.com/cms-sw/cmssw/blob/CMSSW_7_3_X/Validation/EventGenerator/src/HepMCValidationHelper.cc
(and the blame there suggests an interesting history of this assert coming in and going back and forth)

 assert(taudaughters.size()>0);
if ( taudaughters.size()==0 ) {
edm::LogError("HepMCValidationHelper") << "Tau with no daughters. This is a bug. Fix it";
continue;
}

My problem with this is a crash in a relval 1313 workflow (QCD)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slava, I guess you are running on some old GEN-SIM which had some of the problematic simulation interface code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job is reading /CMSSW_7_2_0_pre4/RelValQCD_Pt_3000_3500_13/GEN-SIM/POSTLS172_V3-v2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, pretty sure that is one of the releases with bugged GEN-SIM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running in the head of 73X (CMSSW_7_3_X_2014-10-07-0200)

do we have a set of samples with the GEN-SIM fixed?
(I should better move to HN though)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything was fixed in 7_2_0_pre7 and GEN-SIM was redone for the relvals AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

720pre5 or pre7

On Oct 7, 2014, at 4:43 PM, Slava Krutelyov notifications@github.com
wrote:

In Validation/EventGenerator/src/HepMCValidationHelper.cc:

@@ -184,7 +184,10 @@ namespace HepMCValidationHelper {
for (unsigned int i = 0; i < taus.size(); ++i){
std::vector<const HepMC::GenParticle*> taudaughters;
findDescendents(taus[i], taudaughters);

  •  assert(taudaughters.size()>0);
    
  •  if ( taudaughters.size()<=0 ) {
    
  • edm::LogError("HepMCValidationHelper") << "Tau with no daughters. This is a bug. Fix it";

I'm running in the head of 73X (CMSSW_7_3_X_2014-10-07-0200)

do we have a set of samples with the GEN-SIM fixed?
(I should better move to HN though)


Reply to this email directly or view it on GitHub.

//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
std::vector<const HepMC::GenParticle*> forIsolation;
Expand Down