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

Backport of generator parameter scan functionality to 71x #19443

Merged
merged 57 commits into from Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d36b7d7
Revert "Count BB4L FSR vetos"
bendavid Jun 27, 2017
498806b
Revert "Count emission veto for internal partons"
bendavid Jun 27, 2017
adb782b
Revert "b4l veto algorithm by Tomas Jezo"
bendavid Jun 27, 2017
a6ac1cc
Revert "Read compressed lhe weights"
bendavid Jun 27, 2017
102da8a
Revert "Powheg-RES hook"
bendavid Jun 27, 2017
f82adf1
Revert "Updates to Resonance Decay Filter"
bendavid Jun 27, 2017
b4a6480
Revert "Bugfix for PR #16176"
bendavid Jun 27, 2017
2689615
Revert "actual pt hook code -71x"
bendavid Jun 27, 2017
4939a91
Revert "include the pt hook in the pythia8 hadronizer"
bendavid Jun 27, 2017
af29c5a
Revert "example for using the pt hook filter"
bendavid Jun 27, 2017
6f5d0a8
making user.dec for pythia8 evtgen plugin an option
alberto-sanchez Dec 8, 2015
7d64f85
initial implementation of pythia config randomization
bendavid Jan 21, 2016
b5e8760
workaround for random number generatoin in beginLumi and add example
bendavid Jan 22, 2016
4c0466a
update resetting of random number seed so that it only relies on the …
bendavid Jan 28, 2016
2983c85
re-arrange use of random numbers
bendavid Feb 18, 2016
8f75d75
clean up inheritance of pythia8 interface
bendavid Feb 18, 2016
ff4f440
fully re-initialize pythia8 (delete and reinstantiate main object) to…
bendavid Feb 18, 2016
c177cf6
add randomized config information to GenEventInfoProduct
bendavid Feb 18, 2016
60b7e47
extend random config storage to GenLumiInfoProduct plus a few fixes
bendavid Feb 18, 2016
6aa6c79
make ConfigDescription optional
bendavid Feb 19, 2016
d5daf74
update examples
bendavid Feb 19, 2016
bb3b6df
further fix to examples
bendavid Feb 19, 2016
103f670
add full list of userhooks also for internal generation
bendavid Feb 22, 2016
788073a
remove debug printout
bendavid Feb 22, 2016
6dafa34
further updates to random seed initialization and initial support for…
bendavid Feb 24, 2016
4ac645a
automatically determine number of events per lumi section from source…
bendavid Feb 24, 2016
a3e0da5
revert DataFormats changes and add new GenLumiInfoHeader which is pro…
bendavid Feb 24, 2016
391a501
enforce strict error handling in lhe production script
bendavid Feb 24, 2016
b7bf5e4
update examples and add example for madgraph parameter scan
bendavid Feb 24, 2016
0f50875
add GenLumiInfoHeader to relevant event content definitions
bendavid Feb 24, 2016
aeec7da
fill weight information in events
bendavid Feb 29, 2016
5aebdb5
add lhe header and weight name information to GenLumiInfoHeader
bendavid Feb 29, 2016
33b8a17
populate additional lhe information within limitations of current pyt…
bendavid Feb 29, 2016
6a2d1f3
restore lhe cleanup
bendavid Feb 29, 2016
278ef69
check for missing lhe init information
bendavid Mar 4, 2016
2ee90e0
remove debug printout
bendavid Mar 4, 2016
0186376
fix missing file close, and add protection for maximum random seed ne…
bendavid Apr 10, 2016
ffed76d
adding pt filter hook
alberto-sanchez Jun 22, 2016
c3be58a
integrating pt filter hook in pythia8
alberto-sanchez Jun 22, 2016
08006a2
phase space of selected quark can be adjusted
alberto-sanchez Sep 5, 2016
df83508
using pT() function of pythia8/event
alberto-sanchez Sep 5, 2016
b6fbcb8
example for using the pt hook filter
alberto-sanchez Sep 28, 2016
364d81b
Adding fucntionality to ResonanceDecayFilter to treat udsc or udscb q…
DavidMorse Jul 26, 2016
7552192
Adding fucntionality to ResonanceDecayFilter to treat udsc or udscb q…
DavidMorse Jul 26, 2016
e8fddd8
Fixing fucntionality to ResonanceDecayFilter to treat udsc or udscb q…
DavidMorse Jul 27, 2016
fdb087c
Adding functionality to ResonanceDecayFilter to treat udsc or udscb q…
DavidMorse Jul 27, 2016
0849263
Adding functionality to ResonanceDecayFilter to treat udsc or udscb q…
DavidMorse Jul 27, 2016
f525ae8
simplify and improve handling of lhe weight information following upd…
bendavid Mar 11, 2016
8cf4710
shower weights and labels saving
pmandrik Nov 7, 2016
f16dc57
First version of PowhegResHook
mseidel42 Nov 10, 2016
960361a
Test config
mseidel42 Nov 10, 2016
91d36ed
Use new pythia8 settings flag
mseidel42 Nov 10, 2016
2aee65d
Bugfix for hadronic W decays
mseidel42 Nov 18, 2016
0d15d49
Read compressed LHE weights
mseidel42 Jan 23, 2017
4b9df30
Powheg-bb4l FSR veto
mseidel42 May 19, 2017
dd888e5
Implement comments from @davidlange6
mseidel42 May 31, 2017
6843d68
More abs->std::abs
mseidel42 Jun 1, 2017
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
Expand Up @@ -15,6 +15,7 @@
'keep LHERunInfoProduct_*_*_*',
'keep LHEEventProduct_*_*_*',
'keep GenRunInfoProduct_generator_*_*',
'keep GenLumiInfoHeader_generator_*_*',
'keep GenLumiInfoProduct_generator_*_*',
'keep GenEventInfoProduct_generator_*_*',
'keep edmHepMCProduct_generator_*_*',
Expand All @@ -29,6 +30,7 @@
'keep LHERunInfoProduct_*_*_*',
'keep LHEEventProduct_*_*_*',
'keep GenRunInfoProduct_generator_*_*',
'keep GenLumiInfoHeader_generator_*_*',
'keep GenLumiInfoProduct_generator_*_*',
'keep GenEventInfoProduct_generator_*_*',
'keep edmHepMCProduct_generator_*_*',
Expand All @@ -43,6 +45,7 @@
'keep LHERunInfoProduct_*_*_*',
'keep LHEEventProduct_*_*_*',
'keep GenRunInfoProduct_generator_*_*',
'keep GenLumiInfoHeader_generator_*_*',
'keep GenLumiInfoProduct_generator_*_*',
'keep GenEventInfoProduct_generator_*_*',
'keep GenFilterInfo_*_*_*',
Expand Down
1 change: 1 addition & 0 deletions GeneratorInterface/Core/BuildFile.xml
@@ -1,6 +1,7 @@
<use name="FWCore/Concurrency"/>
<use name="FWCore/ServiceRegistry"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/Framework"/>
<use name="SimDataFormats/GeneratorProducts"/>
<use name="GeneratorInterface/LHEInterface"/>
<use name="heppdt"/>
Expand Down
23 changes: 22 additions & 1 deletion GeneratorInterface/Core/interface/BaseHadronizer.h
Expand Up @@ -20,13 +20,18 @@

#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"

#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"

#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"
#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"

#include "CLHEP/Random/RandomEngine.h"


// foward declarations
namespace edm {
Expand All @@ -48,7 +53,8 @@ namespace gen {
GenRunInfoProduct &getGenRunInfo() { return genRunInfo_; }
HepMC::GenEvent *getGenEvent() { return genEvent_.release(); }
GenEventInfoProduct *getGenEventInfo() { return genEventInfo_.release(); }

virtual GenLumiInfoHeader *getGenLumiInfoHeader() const;

void resetEvent(HepMC::GenEvent *event) { genEvent_.reset(event); }
void resetEventInfo(GenEventInfoProduct *eventInfo) { genEventInfo_.reset(eventInfo); }

Expand All @@ -66,6 +72,14 @@ namespace gen {
void setRandomEngine(CLHEP::HepRandomEngine* v) { doSetRandomEngine(v); }

std::vector<std::string> const& sharedResources() const { return doSharedResources(); }

int randomIndex() const { return randomIndex_; }
const std::string &randomInitConfigDescription() const { return randomInitConfigDescriptions_[randomIndex_]; }
const std::string &gridpackPath() const { return gridpackPaths_[std::max(randomIndex_,0)]; }

void randomizeIndex(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine);
void generateLHE(edm::LuminosityBlock const& lumi, CLHEP::HepRandomEngine* rengine);
void cleanLHE();

protected:
GenRunInfoProduct& runInfo() { return genRunInfo_; }
Expand All @@ -74,6 +88,8 @@ namespace gen {

lhef::LHEEvent* lheEvent() { return lheEvent_.get(); }
lhef::LHERunInfo *lheRunInfo() { return lheRunInfo_.get(); }
int randomIndex_;
std::string lheFile_;

private:

Expand All @@ -91,6 +107,11 @@ namespace gen {
edm::Event *edmEvent_;

static const std::vector<std::string> theSharedResources;

std::vector<double> randomInitWeights_;
std::vector<std::string> randomInitConfigDescriptions_;
std::vector<std::string> gridpackPaths_;

};

} // namespace gen
Expand Down
24 changes: 23 additions & 1 deletion GeneratorInterface/Core/interface/GeneratorFilter.h
Expand Up @@ -24,18 +24,21 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/RandomEngineSentry.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "CLHEP/Random/RandomEngine.h"

// #include "GeneratorInterface/ExternalDecays/interface/ExternalDecayDriver.h"

//#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"

namespace edm
{
template <class HAD, class DEC> class GeneratorFilter : public one::EDFilter<EndRunProducer,
BeginLuminosityBlockProducer,
EndLuminosityBlockProducer,
one::WatchLuminosityBlocks,
one::SharedResources>
Expand All @@ -53,6 +56,7 @@ namespace edm
virtual bool filter(Event& e, EventSetup const& es) override;
virtual void endRunProduce(Run &, EventSetup const&) override;
virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
virtual void beginLuminosityBlockProduce(LuminosityBlock&, EventSetup const&) override;
virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
virtual void endLuminosityBlockProduce(LuminosityBlock &, EventSetup const&) override;

Expand Down Expand Up @@ -99,6 +103,7 @@ namespace edm
usesResource(resource);
}
}

// This handles the case where there are no shared resources, because you
// have to declare something when the SharedResources template parameter was used.
if(sharedResources.empty() && (!decayer_ || decayer_->sharedResources().empty())) {
Expand All @@ -107,6 +112,7 @@ namespace edm

produces<edm::HepMCProduct>();
produces<GenEventInfoProduct>();
produces<GenLumiInfoHeader, edm::InLumi>();
produces<GenLumiInfoProduct, edm::InLumi>();
produces<GenRunInfoProduct, edm::InRun>();

Expand Down Expand Up @@ -186,6 +192,7 @@ namespace edm
// create GenEventInfoProduct from HepMC event in case hadronizer didn't provide one
genEventInfo.reset(new GenEventInfoProduct(event.get()));
}

ev.put(genEventInfo);

std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
Expand Down Expand Up @@ -215,11 +222,19 @@ namespace edm
template <class HAD, class DEC>
void
GeneratorFilter<HAD, DEC>::beginLuminosityBlock( LuminosityBlock const& lumi, EventSetup const& es )
{}

template <class HAD, class DEC>
void
GeneratorFilter<HAD, DEC>::beginLuminosityBlockProduce( LuminosityBlock &lumi, EventSetup const& es )
{
nEventsInLumiBlock_ = 0;
RandomEngineSentry<HAD> randomEngineSentry(&hadronizer_, lumi.index());
RandomEngineSentry<DEC> randomEngineSentryDecay(decayer_, lumi.index());

hadronizer_.randomizeIndex(lumi,randomEngineSentry.randomEngine());
hadronizer_.generateLHE(lumi,randomEngineSentry.randomEngine());

if ( !hadronizer_.readSettings(0) )
throw edm::Exception(errors::Configuration)
<< "Failed to read settings for the hadronizer "
Expand All @@ -245,12 +260,18 @@ namespace edm
<< "Failed to initialize hadronizer "
<< hadronizer_.classname()
<< " for internal parton generation\n";

std::auto_ptr<GenLumiInfoHeader> genLumiInfoHeader(hadronizer_.getGenLumiInfoHeader());
lumi.put(genLumiInfoHeader);

}

template <class HAD, class DEC>
void
GeneratorFilter<HAD, DEC>::endLuminosityBlock(LuminosityBlock const&, EventSetup const&)
{}
{
hadronizer_.cleanLHE();
}

template <class HAD, class DEC>
void
Expand Down Expand Up @@ -279,6 +300,7 @@ namespace edm
std::auto_ptr<GenLumiInfoProduct> genLumiInfo(new GenLumiInfoProduct());
genLumiInfo->setHEPIDWTUP(-1);
genLumiInfo->setProcessInfo( GenLumiProcess );

lumi.put(genLumiInfo);

nEventsInLumiBlock_ = 0;
Expand Down
20 changes: 18 additions & 2 deletions GeneratorInterface/Core/interface/HadronizerFilter.h
Expand Up @@ -28,6 +28,7 @@
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/TypeID.h"
#include "DataFormats/Provenance/interface/BranchDescription.h"
#include "CLHEP/Random/RandomEngine.h"

// #include "GeneratorInterface/ExternalDecays/interface/ExternalDecayDriver.h"

Expand All @@ -44,13 +45,15 @@

#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h"
#include "SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"


namespace edm
{
template <class HAD, class DEC> class HadronizerFilter : public one::EDFilter<EndRunProducer,
BeginLuminosityBlockProducer,
EndLuminosityBlockProducer,
one::WatchRuns,
one::WatchLuminosityBlocks,
Expand All @@ -71,6 +74,7 @@ namespace edm
virtual void endRun(Run const&, EventSetup const&) override;
virtual void endRunProduce(Run &, EventSetup const&) override;
virtual void beginLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
virtual void beginLuminosityBlockProduce(LuminosityBlock&, EventSetup const&) override;
virtual void endLuminosityBlock(LuminosityBlock const&, EventSetup const&) override;
virtual void endLuminosityBlockProduce(LuminosityBlock &, EventSetup const&) override;

Expand Down Expand Up @@ -154,6 +158,7 @@ namespace edm

produces<edm::HepMCProduct>();
produces<GenEventInfoProduct>();
produces<GenLumiInfoHeader, edm::InLumi>();
produces<GenLumiInfoProduct, edm::InLumi>();
produces<GenRunInfoProduct, edm::InRun>();
if(filter_)
Expand Down Expand Up @@ -269,7 +274,6 @@ namespace edm
finalEvent->weights()[0] *= multihadweight;
}


ev.put(finalGenEventInfo);

std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
Expand Down Expand Up @@ -338,13 +342,20 @@ namespace edm
template <class HAD, class DEC>
void
HadronizerFilter<HAD,DEC>::beginLuminosityBlock(LuminosityBlock const& lumi, EventSetup const& es)
{}

template <class HAD, class DEC>
void
HadronizerFilter<HAD,DEC>::beginLuminosityBlockProduce(LuminosityBlock &lumi, EventSetup const& es)
{
lhef::LHERunInfo* lheRunInfo = hadronizer_.getLHERunInfo().get();
lheRunInfo->initLumi();

RandomEngineSentry<HAD> randomEngineSentry(&hadronizer_, lumi.index());
RandomEngineSentry<DEC> randomEngineSentryDecay(decayer_, lumi.index());


hadronizer_.randomizeIndex(lumi,randomEngineSentry.randomEngine());

if ( !hadronizer_.readSettings(1) )
throw edm::Exception(errors::Configuration)
<< "Failed to read settings for the hadronizer "
Expand Down Expand Up @@ -374,6 +385,10 @@ namespace edm
<< "Failed to initialize hadronizer "
<< hadronizer_.classname()
<< " for external parton generation\n";

std::auto_ptr<GenLumiInfoHeader> genLumiInfoHeader(hadronizer_.getGenLumiInfoHeader());
lumi.put(genLumiInfoHeader);

}

template <class HAD, class DEC>
Expand Down Expand Up @@ -410,6 +425,7 @@ namespace edm
std::auto_ptr<GenLumiInfoProduct> genLumiInfo(new GenLumiInfoProduct());
genLumiInfo->setHEPIDWTUP(lheRunInfo->getHEPRUP()->IDWTUP);
genLumiInfo->setProcessInfo( GenLumiProcess );

lumi.put(genLumiInfo);


Expand Down