Commit d24b9f45 authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska
Browse files

Merge branch '21.6' into '21.6-mp'

# Conflicts:
#   Projects/AthGeneration/version.txt
parents 185734f7 12d7d059
......@@ -526,7 +526,7 @@ namespace asg
ANA_MSG_ERROR ("trying to initialize ToolHandleArray property " << val_name << " with empty handle");
return StatusCode::FAILURE;
}
//strip the parent name
std::string tool_name = toolHandle.name();
tools.push_back (toolHandle.type() + "/" + tool_name);
......@@ -1130,6 +1130,9 @@ namespace asg
return detail::AnaToolHandleMode::USER;
#endif
if (m_config.empty() && !m_handleUser->typeAndName().empty() && (m_handleUser->type() != this->type() || m_handleUser->name() != this->name()))
return detail::AnaToolHandleMode::USER;
if (m_config.empty() && m_name.empty())
return detail::AnaToolHandleMode::EMPTY;
......
......@@ -56,9 +56,10 @@ StatusCode HepMCTruthReader::execute() {
if (cntr==0) {
HepMC::GenVertex* signalProcessVtx = genEvt->signal_process_vertex();
ATH_MSG_INFO("Signal process vertex position: (" << signalProcessVtx->position().x()
<< ", " << signalProcessVtx->position().y() << ", " << signalProcessVtx->position().z() << "). Pointer: "
<< signalProcessVtx);
ATH_MSG_INFO("Signal process vertex position: (" << (signalProcessVtx?signalProcessVtx->position().x():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().y():0)
<< ", " << (signalProcessVtx?signalProcessVtx->position().z():0)
<< "). Pointer: " << signalProcessVtx);
}
printEvent(genEvt);
......
......@@ -131,6 +131,8 @@ class EvgenConfig(TransformConfig):
self.nEventsPerJob = 10000
self.maxeventsstrategy = "ABORT"
self.specialConfig = "NONE"
# for the sake of Generate_tf leave minevents for a while
self.minevents = 5000
## Explicitly block MC11/12 settings of efficiency, input*base, or weighting attrs
def __setattr__(self, name, value):
......
......@@ -21,13 +21,13 @@ import PyJobTransforms.trfArgClasses as trfArgClasses
ListOfDefaultPositionalKeys=['--AMIConfig', '--AMITag', '--argJSON', '--asetup', '--athena', '--athenaMPMergeTargetSize', '--athenaopts', '--attempt', '--checkEventCount', '--command', '--dumpJSON', '--dumpPickle', '--ecmEnergy', '--env', '--eventAcceptanceEfficiency', '--evgenJobOpts', '--execOnly', '--fileValidation', '--firstEvent', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNT_PreFile', '--inputFileValidation', '--inputGenConfFile', '--inputGeneratorFile', '--jobConfig', '--jobid', '--maxEvents', '--orphanKiller', '--outputEVNTFile', '--outputEVNT_PreFile', '--outputFileValidation', '--outputNTUP_TRUTHFile', '--outputTXTFile', '--parallelFileValidation', '--postExec', '--postInclude', '--preExec', '--preInclude', '--printEvts', '--randomSeed', '--reportName', '--reportType', '--rivetAnas', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--steering', '--taskid', '--tcmalloc', '--valgrind', '--valgrindbasicopts', '--valgrindextraopts', '--lheOnly', '--localPath', '--cleanOut', '--saveList']
class EvgenExecutor(athenaExecutor):
"Specialised trf executor class for event generation jobs"
def __init__(self, name="generate", skeleton=None, substep=None, inData=set(), outData=set()):
athenaExecutor.__init__(self, name=name, skeletonFile=skeleton, substep=substep, tryDropAndReload=False, inData=inData, outData=outData)
"Specialised trf executor class for event generation jobs"
def __init__(self, name="generate", skeleton=None, substep=None, inData=set(), outData=set()):
athenaExecutor.__init__(self, name=name, skeletonFile=skeleton, substep=substep, inputEventTest=False, tryDropAndReload=False, inData=inData, outData=outData)
# def __init__(self, name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", substep=None, inData=["inNULL"], outData=["EVNT", "EVNT_Pre", "TXT"]):
# athenaExecutor.__init__(self, name=name, skeletonFile=skeleton, substep=substep, tryDropAndReload=False, inData=inData, outData=outData)
def preExecute(self, input=set(), output=set()):
def preExecute(self, input=set(), output=set()):
"Get input tarball, unpack and set up env if an evgenJobOpts arg was provided."
## First call the base class preExecute
......
......@@ -50,8 +50,12 @@ assert evgenConfig.generators
if any(gen in ranluxlist for gen in evgenConfig.generators):
evgenLog.info("Using RanLux random numbers!")
atRndmGenSvc = svcMgr.AtRanluxGenSvc
atRndmGenSvc.EventReseeding = False
print "Events will not be reseeded (RunLuxGenSvc) "
else:
atRndmGenSvc = svcMgr.AtRndmGenSvc
atRndmGenSvc.EventReseeding = False
print "Events will not be reseeded (RndmGenSvc) "
## Pass the random seed from the transform command line into each used generator's seed config string
seedstrs = []
......
......@@ -217,8 +217,6 @@ if len(jofiles) !=1:
sys.exit(1)
#jofile = dsid + '/' + jofiles[0]
jofile = jofiles[0]
#include("EvgenJobTransforms/check_jo_consistency.py")
#check_consistency(jofile)
joparts = (os.path.basename(jofile)).split(".")
#jo = runArgs.jobConfig[0]
......@@ -243,6 +241,13 @@ if joparts[0].startswith("mc") and all(c in string.digits for c in joparts[0][2:
evgenLog.error(jofile + " has too few physicsShort fields separated by '_': should contain <generators>(_<tune+PDF_if_available>)_<process>. Please rename.")
sys.exit(1)
## NOTE: a further check on physicsShort consistency is done below, after fragment loading
check_jofiles="/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/scripts/check_jo_consistency.py"
if os.path.exists(check_jofiles):
include(check_jofiles)
check_naming(os.path.basename(jofile))
else:
evgenLog.error("check_jo_consistency.py not found")
sys.exit(1)
## Include the JO fragment
include(jofile)
......
......@@ -205,7 +205,14 @@ if joparts[0].startswith("mc") and all(c in string.digits for c in joparts[0][2:
evgenLog.error(jofile + " has too few physicsShort fields separated by '_': should contain <generators>(_<tune+PDF_if_available>)_<process>. Please rename.")
sys.exit(1)
## NOTE: a further check on physicsShort consistency is done below, after fragment loading
check_jofiles="/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/scripts/check_jo_consistency.py"
if os.path.exists(check_jofiles):
evgenLog.info("Checking offical JO file name consistency")
include(check_jofiles)
check_naming(os.path.basename(jofile))
else:
evgenLog.error("check_jo_consistency.py not found")
sys.exit(1)
## Include the JO fragment
include(jofile)
include("EvgenJobTransforms/LHEonly.py")
......
......@@ -50,7 +50,7 @@ public:
bool m_doHist;
bool m_beamEnergyTest, m_vtxNaNTest, m_vtxDisplacedTest, m_momNaNTest, m_lifeTimeTest, m_energyG4Test;
bool m_energyImbalanceTest, m_momImbalanceTest, m_negativeEnergyTest, m_tachyonsTest, m_unstableNoVtxTest;
bool m_pi0NoVtxTest, m_undisplacedDaughtersTest;
bool m_pi0NoVtxTest, m_undisplacedDaughtersTest, m_unknownPDGIDTest;
std::vector<int> m_vertexStatuses;
......@@ -84,13 +84,14 @@ public:
int m_Status1ShortLifetime;
int m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate;
int m_nonG4_energyCheckRate;
int m_unknownPDGIDCheckRate;
std::string m_paramFile;
std::ifstream G4file;
std::ifstream susyFile;
std::string m_unknownPDGIDFile;
vector<int> m_G4pdgID_tab;
vector<int> m_SusyPdgID_tab;
vector<int> m_uknownPDGID_tab;
TruthHelper::IsGenNonInteracting nonint;
/// @todo Can we use the GenAnalysis / AthHistoAlg methods for histo management?
......
......@@ -196,14 +196,14 @@ class LogicalExpressionFilter( PyAthena.Alg ):
response = bool(eval(self.cmd)) if self.cmd else True
if self.Sampling==0:
mc[0].weights().push_back( int(response) )
elif not response:
# self.msg.info('Failed filter with sampling %s and weight %s'%(self.Sampling,mc[0].weights()[0]))
response = random.random()<self.Sampling
if self.Sampling>0 and self.Sampling<=1 and not response:
for a in xrange(len(mc[0].weights())): mc[0].weights()[a] /= self.Sampling
mc[0].weights().push_back( int(response) )
event_weight /= self.Sampling
# self.msg.info('Now filter is %s and weight %s'%(response,mc[0].weights()[0]))
response = random.random()<self.Sampling
if self.Sampling==0:
mc[0].weights().push_back( int(response) )
self.nEventsProcessed+=1
self.nEventsProcessedWeighted+=event_weight
......
This diff is collapsed.
......@@ -13,15 +13,17 @@ class DirectPhotonFilter : public GenFilter {
public:
DirectPhotonFilter(const std::string& name, ISvcLocator* pSvcLocator);
virtual StatusCode filterInitialize();
virtual StatusCode filterEvent();
private:
double m_Ptmin;
double m_Ptmax;
std::vector<double> m_Ptmin;
std::vector<double> m_Ptmax;
double m_EtaRange;
int m_NPhotons;
size_t m_NPhotons;
bool m_AllowSUSYDecay;
bool m_OrderPhotons;
};
......
......@@ -8,12 +8,22 @@ if not hasattr( filtSeq, "DirectPhotonFilter" ):
"""
DirectPhotonFilter = filtSeq.DirectPhotonFilter
# Old method of pt cut - maintained for backwards compatibility
# DirectPhotonFilter.Ptcut = 10000.
DirectPhotonFilter.NPhotons = 1
# apply cut inclusively for any photon in the event (False) or
# ordered by pT for the given number of photons (True, default)
DirectPhotonFilter.OrderPhotons = True
# if OrderPhotons=True: can contain multiple values for leading, subleading, ...
# if OrderPhotons=False: the first value will be used for the inclusive cut
DirectPhotonFilter.Ptmin = [ 10000. ]
DirectPhotonFilter.Ptmin = 10000.
DirectPhotonFilter.Ptmax = 100000000.
# optional, unlimited by default
DirectPhotonFilter.Ptmax = [ 100000000. ]
# eta range
DirectPhotonFilter.Etacut = 2.50
DirectPhotonFilter.NPhotons = 1
DirectPhotonFilter.AllowSUSYDecay = False
# Accept also prompt photons from SUSY decays
DirectPhotonFilter.AllowSUSYDecay = True
"""
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "GeneratorFilters/DirectPhotonFilter.h"
#include <limits>
#include <algorithm>
DirectPhotonFilter::DirectPhotonFilter(const std::string& name, ISvcLocator* pSvcLocator)
: GenFilter(name, pSvcLocator)
{
declareProperty("Ptmin",m_Ptmin = 10000.);
declareProperty("Ptmax",m_Ptmax = 100000000.);
declareProperty("Etacut", m_EtaRange = 2.50);
declareProperty("NPhotons", m_NPhotons = 1);
declareProperty("OrderPhotons",m_OrderPhotons = true);
declareProperty("Ptmin",m_Ptmin = std::vector<double>(m_NPhotons, 10000.));
declareProperty("Ptmax",m_Ptmax = std::vector<double>(m_NPhotons, std::numeric_limits<double>::max()));
declareProperty("Etacut", m_EtaRange = 2.50);
declareProperty("AllowSUSYDecay",m_AllowSUSYDecay = false);
// Backward compatibility aliases
declareProperty("Ptcut", m_Ptmin = 10000.);
declareProperty("Ptcut", m_Ptmin = std::vector<double>(m_NPhotons, 10000.));
}
StatusCode DirectPhotonFilter::filterInitialize() {
StatusCode DirectPhotonFilter::filterEvent() {
int NPhotons = 0;
McEventCollection::const_iterator itr;
for (itr = events()->begin(); itr!=events()->end(); ++itr) {
const HepMC::GenEvent* genEvt = (*itr);
ATH_MSG_DEBUG("----->>> Process : " << genEvt->signal_process_id());
for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) {
if (((*pitr)->pdg_id() == 22)) {
if( ((*pitr)->momentum().perp() >= m_Ptmin) && ((*pitr)->momentum().perp() <= m_Ptmax) &&
fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){
ATH_MSG_DEBUG("Generic photon found with status = " << (*pitr)->status() << " " << (*pitr)->barcode());
ATH_MSG_INFO("Initialising DirectPhoton filter with OrderPhotons="<<m_OrderPhotons);
HepMC::GenVertex* CandProdVertex = (*pitr)->production_vertex();
ATH_MSG_DEBUG("Candidate production vertex ID = " << CandProdVertex->id());
ATH_MSG_DEBUG("Candidate production vertex barcode = " << CandProdVertex->barcode());
if (m_Ptmin.size()>m_NPhotons || m_Ptmax.size()>m_NPhotons) {
ATH_MSG_ERROR("Too many Ptmin/max for given NPhotons");
return StatusCode::FAILURE;
}
HepMC::GenVertex::particle_iterator firstChild = (*pitr)->production_vertex()->particles_begin(HepMC::children);
HepMC::GenVertex::particle_iterator endChild = (*pitr)->production_vertex()->particles_end(HepMC::children);
HepMC::GenVertex::particle_iterator thisChild = firstChild;
for (; thisChild != endChild; ++thisChild) {
ATH_MSG_DEBUG("Looping on Production (children) vertex : " << (*thisChild)->pdg_id() << " " << (*thisChild)->barcode());
}
if (!m_OrderPhotons && (m_Ptmin.size()>1 || m_Ptmax.size()>1)) {
ATH_MSG_ERROR("Too many Ptmin/max requirements for OrderPhotons=false case.");
return StatusCode::FAILURE;
}
HepMC::GenVertex::particle_iterator firstChild1 = (*pitr)->production_vertex()->particles_begin(HepMC::parents);
HepMC::GenVertex::particle_iterator endChild1 = (*pitr)->production_vertex()->particles_end(HepMC::parents);
HepMC::GenVertex::particle_iterator thisChild1 = firstChild1;
for (; thisChild1 != endChild1; ++thisChild1) {
ATH_MSG_DEBUG("Looping on Production (parents) vertex : " << (*thisChild1)->pdg_id() << " " << (*thisChild1)->barcode());
}
}
}
// allow specifying only one pTmin/max to be applied to all (further) photons
// for backward compatibility
if (m_Ptmin.size()<m_NPhotons) {
size_t origsize = m_Ptmin.size();
double lastPt = m_Ptmin.back();
m_Ptmin.resize(m_NPhotons);
for (size_t i=origsize; i<m_NPhotons; ++i) m_Ptmin[i]=lastPt;
}
if (m_Ptmax.size()<m_NPhotons) {
size_t origsize = m_Ptmax.size();
double lastPt = m_Ptmax.back();
m_Ptmax.resize(m_NPhotons);
for (size_t i=origsize; i<m_NPhotons; ++i) m_Ptmax[i]=lastPt;
}
return StatusCode::SUCCESS;
}
// Check for a photon with desired kinematics
if ( ((*pitr)->pdg_id() == 22) ){
if( (*pitr)->status() == 1 &&
((*pitr)->momentum().perp() >= m_Ptmin) && ((*pitr)->momentum().perp() <= m_Ptmax) &&
fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange){
bool DirectPhotonFilterCmpByPt(HepMC::GenParticle* p1, HepMC::GenParticle* p2) {
return (p1->momentum().perp()<p2->momentum().perp());
}
// The following lines are for cross checking purpose when using different generators
HepMC::GenVertex* CandProdVertex = (*pitr)->production_vertex();
ATH_MSG_DEBUG("Candidate production vertex ID = " << CandProdVertex->id());
ATH_MSG_DEBUG("Candidate production vertex barcode = " << CandProdVertex->barcode());
StatusCode DirectPhotonFilter::filterEvent() {
std::vector<HepMC::GenParticle*> promptPhotonsInEta;
for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) {
const HepMC::GenEvent* genEvt = (*itr);
ATH_MSG_DEBUG("----->>> Process : " << genEvt->signal_process_id());
HepMC::GenVertex::particle_iterator firstChild = (*pitr)->production_vertex()->particles_begin(HepMC::children);
HepMC::GenVertex::particle_iterator endChild = (*pitr)->production_vertex()->particles_end(HepMC::children);
HepMC::GenVertex::particle_iterator thisChild = firstChild;
for(; thisChild != endChild; ++thisChild) {
ATH_MSG_DEBUG("Looping on Production (children) vertex : " << (*thisChild)->pdg_id() << " " << (*thisChild)->barcode());
// Find all prompt photons with within given eta range
for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) {
if ((*pitr)->pdg_id() == 22 &&
(*pitr)->status() == 1 &&
fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange) {
// iterate over parent particles to exclude photons from hadron decays
HepMC::GenVertex* prodVtx = (*pitr)->production_vertex();
bool fromHadron(false);
for (auto parent = prodVtx->particles_begin(HepMC::parents);
parent != prodVtx->particles_end(HepMC::parents); ++parent) {
int pdgindex = abs((*parent)->pdg_id());
ATH_MSG_DEBUG("Looping on Production (parents) vertex : " << (*parent)->pdg_id() << " " << (*parent)->barcode());
if (pdgindex > 100) {
fromHadron = true;
if (m_AllowSUSYDecay && ( (pdgindex > 1000000 && pdgindex < 1000040) || (pdgindex > 2000000 && pdgindex < 2000016) ) ) fromHadron = false;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////
//
// 1) once a status = 1 photon is found check where it comes from : loop on incoming particle
//
// Pythia : - a photon from HP comes out with status=3 and then turned into a status = 1 photon
// - coming from the status-3 photon.
// : - a photon from brem comes out directly with a status=1
// Herwig : - NOT CHECKED on HP !
// - a photon from brem comes out with different status but always turned into a
// status=1 photon at the end coming from a photon with a different status.
//
// So requiring a status=1 photon coming from q/CLHEP::g saves brem photons in Pythia. Requiring
// a status=1 photon coming from a photon should save HP photons in Pythia and Brem in
// Herwig
//
// 2) the second option is to ask for a status = 1 photon which doesn't come from a PDG>100
// particle. In this way we should veto 'background photon'
//
//////////////////////////////////////////////////////////////////////////////////////////////
HepMC::GenVertex::particle_iterator firstChild1 = (*pitr)->production_vertex()->particles_begin(HepMC::parents);
HepMC::GenVertex::particle_iterator endChild1 = (*pitr)->production_vertex()->particles_end(HepMC::parents);
HepMC::GenVertex::particle_iterator thisChild1 = firstChild1;
if (!fromHadron) promptPhotonsInEta.push_back((*pitr));
else ATH_MSG_DEBUG("non-prompt photon ignored");
}
}
}
bool fromHadron(false);
for (; thisChild1 != endChild1; ++thisChild1) {
int pdgindex = abs((*thisChild1)->pdg_id());
ATH_MSG_DEBUG("Looping on Production (parents) vertex : " << (*thisChild1)->pdg_id() << " " << (*thisChild1)->barcode());
if (pdgindex > 100) {
fromHadron = true;
if (m_AllowSUSYDecay && ( (pdgindex > 1000000 && pdgindex < 1000040) || (pdgindex > 2000000 && pdgindex < 2000016) ) ) fromHadron = false;
ATH_MSG_DEBUG("event kept");
}
}
if (!fromHadron) NPhotons++;
} // if( (*pitr)->status()==1 && ...
} // if( ((*pitr)->pdg_id() == 22) )
if (promptPhotonsInEta.size()<m_NPhotons) {
setFilterPassed(false);
}
else {
for (auto photon: promptPhotonsInEta) {
ATH_MSG_DEBUG("Found prompt photon with pt="<<photon->momentum().perp());
}
if (m_OrderPhotons) { // apply cuts to leading/subleading/... photon as specified
std::sort(promptPhotonsInEta.begin(), promptPhotonsInEta.end(), DirectPhotonFilterCmpByPt);
bool pass = true;
for (size_t i = 0; i < m_NPhotons; ++i) {
double pt = promptPhotonsInEta[i]->momentum().perp();
if (pt < m_Ptmin[i] || pt > m_Ptmax[i]) {
ATH_MSG_DEBUG(" rejected pt="<<pt);
pass = false;
}
}
if (pass) ATH_MSG_DEBUG("Passed!");
setFilterPassed(pass);
}
else { // just require NPhotons to pass m_Ptmin/max[0]
size_t NPhotons=0;
for (size_t i = 0; i < promptPhotonsInEta.size(); ++i) {
double pt = promptPhotonsInEta[i]->momentum().perp();
if (pt > m_Ptmin[0] && pt < m_Ptmax[0]) ++NPhotons;
}
if (NPhotons>=m_NPhotons) ATH_MSG_DEBUG("Passed!");
setFilterPassed(NPhotons>=m_NPhotons);
}
}
if (NPhotons >= m_NPhotons) return StatusCode::SUCCESS;
setFilterPassed(false);
return StatusCode::SUCCESS;
}
# $Id$
################################################################################
# Package: Herwig7_i
################################################################################
......@@ -17,9 +16,10 @@ atlas_depends_on_subdirs(
# External dependencies:
find_package( Boost )
find_package( Herwig3 )
find_package( Herwig3 COMPONENTS HerwigAPI )
find_package( ThePEG )
find_package( GSL )
find_package( OpenLoops )
# Remove the --as-needed linker flags:
atlas_disable_as_needed()
......@@ -28,10 +28,10 @@ atlas_disable_as_needed()
atlas_add_component( Herwig7_i
Herwig7_i/*.h src/*.cxx src/components/*.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HERWIG3_INCLUDE_DIRS}
${THEPEG_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS}
PRIVATE_DEFINITIONS -DHWVERSION=\"${HERWIG7_LCGVERSION}\"
LINK_LIBRARIES ${HERWIG3_LCGROOT}/lib/Herwig/libHerwigAPI.so ${Boost_LIBRARIES}
${HERWIG7_LIBRARIES} ${THEPEG_LIBRARIES} ${GSL_LIBRARIES}
${THEPEG_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS} ${OPENLOOPS_INCLUDE_DIRS}
PRIVATE_DEFINITIONS -DHWVERSION=\"${HERWIG3_LCGVERSION}\"
LINK_LIBRARIES ${HERWIG3_LIBRARIES} ${Boost_LIBRARIES}
${THEPEG_LIBRARIES} ${GSL_LIBRARIES} ${OPENLOOPS_LIBRARIES}
GeneratorModulesLib EventInfo GaudiKernel PathResolver )
# Install files from the package:
......@@ -39,6 +39,7 @@ atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/common/*.py )
atlas_install_runtime( share/file/*.pdt share/file/*.dat )
# Set up some environment variables for Herwig.
set( Herwig7Environment_DIR ${CMAKE_CURRENT_SOURCE_DIR}
CACHE PATH "Location of HerwigppEnvironment.cmake" )
CACHE PATH "Location of Herwig7Environment.cmake" )
find_package( Herwig7Environment )
......@@ -6,17 +6,14 @@
# Set the environment variable(s):
find_package( Herwig3 )
find_package ( ThePEG )
find_package( ThePEG )
if( HERWIG3_FOUND AND THEPEG_FOUND )
get_filename_component( _herwig3Path "${HERWIG3_LCGROOT}" DIRECTORY )
set( HERWIG7ENVIRONMENT_ENVIRONMENT
FORCESET HERWIG7_PATH ${_herwig3Path}/${LCG_PLATFORM}
FORCESET HERWIG7VER ${HERWIG3_LCGVERSION}
set( HERWIG7ENVIRONMENT_ENVIRONMENT
FORCESET HERWIG7_PATH ${HERWIG3_LCGROOT}
FORCESET HERWIG7VER ${HERWIG3_LCGVERSION}
FORCESET THEPEGVER ${THEPEG_LCGVERSION})
unset( _herwig3Path )
endif()
# Silently declare the module found:
set( HERWIG7ENVIRONMENT_FOUND TRUE )
......@@ -291,7 +291,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
## \param[in] ps_tune_name name identifying the PS/hadronization tune
## \param[in] ue_tune_name name identifying the UE/MPI tune
## \return Nothing, adds the corresponding commands directly to the generator configuration object
def tune_commands(self, ps_tune_name = "H7-PS-MMHT2014LO", ue_tune_name = "H7-UE-MMHT"):
def tune_commands(self, ps_tune_name = "H7-PS-MMHT2014LO", ue_tune_name = "H7.1-Default"):
cmds = """
## -------------
......@@ -299,7 +299,7 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
## -------------
"""
self.ps_tune_commands(tune_name = ps_tune_name)
# self.ps_tune_commands(tune_name = ps_tune_name) # the name of the default PS tune may be obsolete
self.ue_tune_commands(tune_name = ue_tune_name)
......@@ -337,15 +337,15 @@ set /Herwig/Partons/RemnantPDF:MaxFlav {}
##
## \param[in] tune_name name identifying the UE/MPI tune
## \return Nothing, adds the corresponding commands directly to the generator configuration object
def ue_tune_commands(self, tune_name = "H7-UE-MMHT"):
def ue_tune_commands(self, tune_name = "H7.1-Default"):
cmds = """
## Underlying event tune settings
"""
if tune_name == "H7-UE-MMHT":
if tune_name == "H7.1-Default":
cmds += """
# > The underlying event tune "H7-UE-MMHT" is already
# > The underlying event tune "H7.1-Default" is already
# > configured in Herwig7 via the default settings.
"""
# elif tune_name == "some-other-name":
......
......@@ -255,6 +255,31 @@ def generate(run_card_loc='run_card.dat',param_card_loc='param_card.dat',mode=0,
# Check if process is NLO or LO
isNLO=is_NLO_run(proc_dir=proc_dir)
# use f2py2 if f2py not available
if reweight_card_loc is not None:
from distutils.spawn import find_executable
if find_executable('f2py') is not None:
mglog.info('Found f2py, can run reweighting.')
elif find_executable('f2py2') is not None:
mglog.info('f2py is called f2py2 on this machine, will update configuration')
if isNLO:
config_card=proc_dir+'/Cards/amcatnlo_configuration.txt'
else:
config_card=proc_dir+'/Cards/me5_configuration.txt'
shutil.move(config_card,config_card+'.old')
oldcard = open(config_card+'.old','r')
newcard = open(config_card,'w')
for line in oldcard:
if 'f2py_compiler' in line:
newcard.write(' f2py_compiler = f2py2\n')
else:
newcard.write(line)
oldcard.close()
newcard.close()
else:
mglog.error('Could not find f2py or f2py2, needed for reweighting')
return 1
if grid_pack:
#Running in gridpack mode
mglog.info('Started generating gridpack at '+str(time.asctime()))
......@@ -659,7 +684,8 @@ def generate_from_gridpack(run_name='Test',gridpack_dir='madevent/',nevents=-1,r
mglog.info( sorted( os.listdir( currdir ) ) )
mglog.info('For your information, ls of '+gridpack_dir+':')
mglog.info( sorted( os.listdir( gridpack_dir ) ) )
if is_version_or_newer([2,6,3]):
modify_run_card(gridpack_dir+'/Cards/run_card.dat',gridpack_dir+'/Cards/run_card.backup',{'python_seed' : random_seed})
run_card_consistency_check(isNLO=isNLO,path=gridpack_dir)
generate = subprocess.Popen([gridpack_dir+'/bin/run.sh',str(int(nevents)),str(int(random_seed))],stdin=subprocess.PIPE)
generate.communicate()
......@@ -825,15 +851,7 @@ def getMadGraphVersion():
def setupFastjet(isNLO, proc_dir=None):
mglog.info('Path to fastjet install dir:%s'%os.environ['FASTJETPATH'])