Page MenuHomeHEPForge

No OneTemporary

diff --git a/Decay/EvtGen/EvtGenDecayer.cc b/Decay/EvtGen/EvtGenDecayer.cc
--- a/Decay/EvtGen/EvtGenDecayer.cc
+++ b/Decay/EvtGen/EvtGenDecayer.cc
@@ -1,140 +1,143 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the EvtGenDecayer class.
//
#include "EvtGenDecayer.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/PDT/DecayMode.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
bool EvtGenDecayer::accept(const DecayMode &) const {
return true;
}
ParticleVector EvtGenDecayer::decay(const DecayMode & dm,
const Particle & parent) const {
ParticleVector output;
if(evtOpt_==0)
output=evtgen_->decay(parent,false,dm);
else if(evtOpt_==1)
output=evtgen_->decay(parent, true,dm);
else
throw Exception() << "Unknown option in EvtGenDecayer::decay() "
<< Exception::runerror;
if(check_) {
Lorentz5Momentum ptotal=parent.momentum();
int charge=parent.dataPtr()->iCharge();
for(unsigned int ix=0;ix<output.size();++ix) {
ptotal-=output[ix]->momentum();
charge-=output[ix]->dataPtr()->iCharge();
checkDecay(output[ix]);
}
if(abs(ptotal.x())>0.001*MeV||abs(ptotal.y())>0.001*MeV||
abs(ptotal.z())>0.001*MeV||abs(ptotal.e())>0.001*MeV) {
generator()->log() << "Decay of " << parent.PDGName()
<< " violates momentum conservation in"
<< "EvtGenDecayer::decay\n";
}
if(charge!=0) {
generator()->log() << "Decay of " << parent.PDGName()
<< " violates charge conservation in"
<< "EvtGenDecayer::decay\n";
}
}
return output;
}
+
IBPtr EvtGenDecayer::clone() const {
return new_ptr(*this);
}
IBPtr EvtGenDecayer::fullclone() const {
return new_ptr(*this);
}
void EvtGenDecayer::persistentOutput(PersistentOStream & os) const {
os << evtgen_ << check_ << evtOpt_;
}
void EvtGenDecayer::persistentInput(PersistentIStream & is, int) {
is >> evtgen_ >> check_ >> evtOpt_;
}
// The following static variable is needed for the type
// description system in ThePEG.
DescribeClass<EvtGenDecayer,Decayer>
- describeThePEGEvtGenDecayer("Herwig::EvtGenDecayer", "HwEvtGenInterface.so");
+describeHerwigEvtGenDecayer("Herwig::EvtGenDecayer",
+ "HwEvtGenInterface.so");
void EvtGenDecayer::Init() {
static ClassDocumentation<EvtGenDecayer> documentation
("The EvtGenDecayer class allows the EvtGen decay package to be used as"
" a decayer inside Herwig");
static Reference<EvtGenDecayer,EvtGenInterface> interfaceEvtGen
("EvtGen",
"Pointer to the EvtGenInterface object which encapsulates the EvtGen decay package.",
&EvtGenDecayer::evtgen_, false, false, true, false, false);
static Switch<EvtGenDecayer,bool> interfaceCheck
("Check",
"Perform some basic checks of the decay",
&EvtGenDecayer::check_, false, false, false);
static SwitchOption interfaceCheckCheck
(interfaceCheck,
"Yes",
"Perform the checks",
true);
static SwitchOption interfaceCheckNoCheck
(interfaceCheck,
"No",
"Don't perform the checks",
false);
static Switch<EvtGenDecayer,unsigned int> interfaceOption
("Option",
"The way in which EvtGen is used.",
&EvtGenDecayer::evtOpt_, 0, false, false);
static SwitchOption interfaceOptionParent
(interfaceOption,
"Parent",
"EvtGen decays the particle and returns the decay products to be decayed by"
" Herwig++.",
0);
static SwitchOption interfaceOptionAll
(interfaceOption,
"All",
"EvtGen decays the particle and all the unstable particles produced in the decay.",
1);
}
void EvtGenDecayer::checkDecay(PPtr in) const {
Lorentz5Momentum ptotal=in->momentum();
int charge = in->dataPtr()->iCharge();
if(in->children().empty()) return;
for(unsigned int ix=0;ix<in->children().size();++ix) {
checkDecay(in->children()[ix]);
ptotal-=in->children()[ix]->momentum();
charge-=in->children()[ix]->dataPtr()->iCharge();
}
if(abs(ptotal.x())>MeV||abs(ptotal.y())>MeV||
abs(ptotal.z())>MeV||abs(ptotal.e())>MeV) {
generator()->log()
<< "Decay of " << in->PDGName() << " violates momentum conservation"
<< "in EvtGenDecayer::checkDecay";
}
if(charge!=0) generator()->log() << "Decay of " << in->PDGName()
<< " violates charge conservation in "
<< "EvtGenDecayer::checkDecay\n";
}
+
diff --git a/Decay/EvtGen/EvtGenInterface.cc b/Decay/EvtGen/EvtGenInterface.cc
--- a/Decay/EvtGen/EvtGenInterface.cc
+++ b/Decay/EvtGen/EvtGenInterface.cc
@@ -1,991 +1,992 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the EvtGenInterface class.
//
#include "EvtGenInterface.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/DecayMode.h"
#include "Herwig/Decay/DecayVertex.h"
#include "Herwig/Decay/GeneralDecayMatrixElement.h"
#include "EvtGenBase/EvtRandom.hh"
#include "EvtGenBase/EvtAbsRadCorr.hh"
#include "EvtGenExternal/EvtExternalGenList.hh"
#include "EvtGenBase/EvtScalarParticle.hh"
#include "EvtGenBase/EvtDiracParticle.hh"
#include "EvtGenBase/EvtVectorParticle.hh"
#include "EvtGenBase/EvtRaritaSchwingerParticle.hh"
#include "EvtGenBase/EvtTensorParticle.hh"
#include "EvtGenBase/EvtStringParticle.hh"
#include "EvtGenBase/EvtHighSpinParticle.hh"
#include "EvtGenBase/EvtDecayTable.hh"
#ifndef EVTGEN_PREFIX
#error Makefile.am needs to define EVTGEN_PREFIX
#endif
using namespace Herwig;
-EvtGenInterface::EvtGenInterface() : decayName_(string(EVTGEN_PREFIX)+"/share/DECAY2010.DEC"),
- pdtName_(string(EVTGEN_PREFIX)+"/share/evt.pdl"),
+const string prefix=EVTGEN_PREFIX "";
+
+EvtGenInterface::EvtGenInterface() : decayName_(prefix+"/share/DECAY_2010.DEC"),
+ pdtName_(prefix+"/share/evt.pdl"),
reDirect_(true),checkConv_(false)
{}
EvtGenInterface::~EvtGenInterface() {}
IBPtr EvtGenInterface::clone() const {
return new_ptr(*this);
}
IBPtr EvtGenInterface::fullclone() const {
return new_ptr(*this);
}
void EvtGenInterface::persistentOutput(PersistentOStream & os) const {
- os << pdtName_ << reDirect_ << userDecays_ << checkConv_ << convID_;
+ os << decayName_ << pdtName_ << reDirect_
+ << userDecays_ << checkConv_ << convID_;
}
void EvtGenInterface::persistentInput(PersistentIStream & is, int) {
- is >> pdtName_ >> reDirect_ >> userDecays_ >> checkConv_ >> convID_;
+ is >> decayName_ >> pdtName_ >> reDirect_
+ >> userDecays_ >> checkConv_ >> convID_;
}
// The following static variable is needed for the type
// description system in ThePEG.
DescribeClass<EvtGenInterface,Interfaced>
- describeHerwigEvtGenInterface("Herwig::EvtGenInterface",
- "HwEvtGenInterface.so");
+describeHerwigEvtGenInterface("Herwig::EvtGenInterface",
+ "HwEvtGenInterface.so");
void EvtGenInterface::Init() {
static ClassDocumentation<EvtGenInterface> documentation
("The EvtGenInterface class is the main class for the use of the EvtGen "
"decay package with Herwig");
static Parameter<EvtGenInterface,string> interfaceDecay_File
("Decay_File",
"The name of the file for the EvtGen decays.",
- &EvtGenInterface::decayName_, string(EVTGEN_PREFIX)+"/share/DECAY2010.DEC",
+ &EvtGenInterface::decayName_, prefix+"/share/DECAY_2010.DEC",
false, false);
static Parameter<EvtGenInterface,string> interfacePDT_File
("PDTFile",
"The name of the file for the EvtGen particle data.",
- &EvtGenInterface::pdtName_, string(EVTGEN_PREFIX)+"/share/evt.pdl",
+ &EvtGenInterface::pdtName_, prefix+"/share/evt.pdl",
false, false);
static Switch<EvtGenInterface,bool> interfaceRedirect
("Redirect",
"By default cerr and cout are redirected when EvtGen is running to"
" allow us to catch errors, due to EvtGen's poor internal error "
"handling. This can be a problem for debugging and so can be switched off.",
&EvtGenInterface::reDirect_, true, false, false, false);
static SwitchOption interfaceRedirectYes
(interfaceRedirect,
"Yes",
"Redirect the output",
true);
static SwitchOption interfaceRedirectNo
(interfaceRedirect,
"No",
"Don't redirect the output",
false);
static Switch<EvtGenInterface,bool> interfaceCheckConversion
("CheckConversion",
"Check the conversion of particles to and from EvtGen",
&EvtGenInterface::checkConv_, false, false, false);
static SwitchOption interfaceCheckConversionfalse
(interfaceCheckConversion,
"No",
"Don't check the conversion",
false);
static SwitchOption interfaceCheckConversionCheck
(interfaceCheckConversion,
"Yes",
"Check the conversion",
true);
static ParVector<EvtGenInterface,long> interfaceOutputModes
("OutputModes",
"Particles for which to output the EvtGen decay modes"
" so they can be read into Herwig++",
&EvtGenInterface::convID_, -1, long(0), 0, 0,
false, false, Interface::nolimits);
static ParVector<EvtGenInterface,string> interfaceUserDecays
("UserDecays",
"List of user decay files to be loaded",
- &EvtGenInterface::userDecays_, -1, "", 0, 0,
+ &EvtGenInterface::userDecays_, -1, "", "", "",
false, false, Interface::nolimits);
-
}
void EvtGenInterface::doinitrun() {
Interfaced::doinitrun();
// redirect cerr and cout if needed
std::streambuf *temp[2]={cout.rdbuf(),cerr.rdbuf()};
if(reDirect_) {
std::streambuf *psbuf = generator()->log().rdbuf();
cout.rdbuf(psbuf);
cerr.rdbuf(psbuf);
}
// output the EvtGen initialization info to the log file
generator()->log() << "Initializing EvtGen \n";
// set up the random number generator for EvtGen
generator()->log() << "Setting EvtGen random number generator"
- << " to the Herwig one.\n";
+ << " to the Herwig one.\n";
evtrnd_ = new EvtGenRandom(const_ptr_cast<Ptr<RandomGenerator>::pointer>
- (&(UseRandom::current())));
+ (&(UseRandom::current())));
EvtRandom::setRandomEngine(evtrnd_);
// PHOTOS STUFF
EvtAbsRadCorr* radCorrEngine = 0;
std::list<EvtDecayBase*> extraModels;
EvtExternalGenList genList;
radCorrEngine = genList.getPhotosModel();
extraModels = genList.getListOfModels();
// Initialize EvtGen
evtgen_ = new EvtGen(decayName_.c_str(),pdtName_.c_str(),
- evtrnd_, radCorrEngine, &extraModels);
+ evtrnd_, radCorrEngine, &extraModels);
// additional user decays
for(unsigned int ix=0;ix<userDecays_.size();++ix)
evtgen_->readUDecay(userDecays_[ix].c_str());
// check the conversion of particles if needed
if(checkConv_) checkConversion();
// convert any particle decay modes which are needed
for(unsigned int ix=0;ix<convID_.size();++ix) {
outputEvtGenDecays(convID_[ix]);
}
// that's the lot
generator()->log() << "Finished initialisation of EvtGen \n";
if(reDirect_) {
cout.rdbuf(temp[0]);
cerr.rdbuf(temp[1]);
}
}
+
ParticleVector EvtGenInterface::decay(const Particle &parent,
bool recursive, const DecayMode & dm) const {
// redirect cout to the log file
ostringstream stemp;
std::streambuf *temp[2]={cout.rdbuf(),cerr.rdbuf()};
if(reDirect_) {
std::streambuf *psbuf[2] ={generator()->log().rdbuf(),stemp.rdbuf()};
cout.rdbuf(psbuf[0]);
cerr.rdbuf(psbuf[1]);
}
// generate the decay
ParticleVector output;
EvtId parID(EvtGenID(parent.id()));
try {
- EvtDecayBase *decayer;
+ EvtDecayBase *decayer = NULL;
// create evtgen particle for the parent
EvtParticle* particle = EvtGenParticle(parent);
// simplest case, evtgen selects mode and recursively decays, use their standard mechanism
if(dm.wildProductMatcher() && recursive) {
evtgen_->generateDecay(particle);
- decayer=EvtDecayTable::getInstance()->getDecay(parID.getAlias(),particle->getChannel());
}
// otherwise we're in control
else {
// select the EvtGen decayer to use
if(dm.wildProductMatcher()) {
- decayer = EvtDecayTable::getInstance()->getDecayFunc(particle);
+ decayer = EvtDecayTable::getInstance()->getDecayFunc(particle);
}
// otherwise we should pick one
else {
- int imode(EvtGenChannel(dm));
- decayer = EvtDecayTable::getInstance()->getDecay(parID.getAlias(),imode);
- particle->setChannel(imode);
+ int imode(EvtGenChannel(dm));
+ decayer = EvtDecayTable::getInstance()->getDecay(parID.getAlias(),imode);
+ particle->setChannel(imode);
}
// must be a decayer
if(!decayer) throw Exception() << "Could find EvtGen decayer in EvtGen::decay()"
- << Exception::runerror;
+ << Exception::runerror;
// masses of the children
bool massTreeOK(true);
if ( particle->getNDaug() == 0 )
- massTreeOK = particle->generateMassTree();
+ massTreeOK = particle->generateMassTree();
if ( ! massTreeOK ) {
- // delete the EvtGen particle
- particle->deleteDaughters();
- delete particle;
- particle = 0;
- throw Exception() << "EvtGen could not decay " << EvtPDL::name(particle->getId())
- <<" with mass "<< particle->mass()
- <<" to decay channel number "<< particle->getChannel() << "\n"
- << Exception::eventerror;
+ // delete the EvtGen particle
+ particle->deleteDaughters();
+ delete particle;
+ particle = 0;
+ throw Exception() << "EvtGen could not decay " << EvtPDL::name(particle->getId())
+ <<" with mass "<< particle->mass()
+ <<" to decay channel number "<< particle->getChannel() << "\n"
+ << Exception::eventerror;
}
// mixing ???
// static EvtId BS0=EvtPDL::getId("B_s0");
// static EvtId BSB=EvtPDL::getId("anti-B_s0");
// static EvtId BD0=EvtPDL::getId("B0");
// static EvtId BDB=EvtPDL::getId("anti-B0");
// // static EvtId D0=EvtPDL::getId("D0");
// // static EvtId D0B=EvtPDL::getId("anti-D0");
-
// EvtId thisId=getId();
// // remove D0 mixing for now..
// // if ( _ndaug==1 && (thisId==BS0||thisId==BSB||thisId==BD0||thisId==BDB||thisId==D0||thisId==D0B) ) {
// if ( _ndaug==1 && (thisId==BS0||thisId==BSB||thisId==BD0||thisId==BDB) ) {
// p=p->getDaug(0);
// decayer = EvtDecayTable::getInstance()->getDecayFunc(p);
// }
assert(decayer !=0 );
// perform decay
decayer->makeDecay(particle,recursive);
}
// cast the decayer
EvtDecayAmp *damp = dynamic_cast<EvtDecayAmp*>(decayer);
// translate the decay products
output=decayProducts(particle);
// set spin information if needed
tSpinPtr pspin(getSpinInfo(parent));
// if has spin information translate it
if(damp) {
ParticleVector products;
unsigned int nbeforerad=decayer->getNDaug();
for(unsigned int ix=0;ix<nbeforerad;++ix) products.push_back(output[ix]);
constructVertex(parent,products,damp);
}
// otherwise
else {
pspin->develop();
RhoDMatrix rhotemp(pspin->iSpin());
pspin->DMatrix()=rhotemp;
}
pspin->decay();
if(recursive) {
pspin->developed();
pspin->DMatrix()=ThePEGSpinDensity(particle->getSpinDensityBackward(),
ThePEGID(particle->getId()));
}
// delete the EvtGen particle
particle->deleteDaughters();
delete particle;
particle = 0;
}
catch ( ... ) {
// change stream back
if(reDirect_) {
cout.rdbuf(temp[0]);
cerr.rdbuf(temp[1]);
}
throw;
}
// change stream back
if(reDirect_) {
cout.rdbuf(temp[0]);
cerr.rdbuf(temp[1]);
string stemp2=stemp.str();
if(stemp2.length()>0)
throw Exception() << "EvtGen report error in EvtGen::decay "
<< "killing event\n"
<< "Error was " << stemp2
<< Exception::eventerror;
}
// return the decay products
return output;
}
EvtParticle * EvtGenInterface::EvtGenParticle(const Particle & part) const {
// convert the momentum
Lorentz5Momentum inmom(part.momentum());
EvtVector4R p4(EvtGenMomentum(inmom));
EvtParticle *evtpart;
// EvtGen ID and spin type
EvtId id = EvtGenID(part.id());
EvtSpinType::spintype thisSpin=EvtPDL::getSpinType(id);
// boost to the rest frame to get the basis states right
PPtr decay(const_ptr_cast<PPtr>(new_ptr(part)));
decay->transform(LorentzRotation(-inmom.boostVector()));
// get spin information so can transfer to EvtGen
tcSpinPtr spin(dynamic_ptr_cast<tcSpinPtr>(part.spinInfo()));
if(spin) spin->decay();
// don't convert neutrinos, aren't decays so waste of time
if ( thisSpin == EvtSpinType::NEUTRINO) {
throw Exception() << "Tried to convert a neutrino to EvtGen in "
<< "EvtGen::EvtParticle. This should not be needed as"
<< "EvtGen does not decay neutrinos"
<< Exception::eventerror;
}
// don't convert photons, aren't decays so waste of time
else if ( thisSpin == EvtSpinType::PHOTON ) {
throw Exception() << "Tried to convert a photon to EvtGen in "
<< "EvtGen::EvtParticle. This should not be needed as"
<< "EvtGen does not decay photons"
<< Exception::eventerror;
}
// scalar particles
else if ( thisSpin == EvtSpinType::SCALAR ) {
// create particle
EvtScalarParticle * myPart = new EvtScalarParticle;
myPart->init(id, p4);
// set rho matrix if needed
tcScalarSpinPtr sp(dynamic_ptr_cast<tcScalarSpinPtr>(spin));
if(sp) {
myPart->setSpinDensityForward(EvtGenSpinDensity(sp->rhoMatrix()));
}
else {
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
}
evtpart=myPart;
}
else if ( thisSpin == EvtSpinType::DIRAC ) {
EvtDiracParticle *myPart =new EvtDiracParticle;
// get the spin info
tcFermionSpinPtr sp(dynamic_ptr_cast<tcFermionSpinPtr>(spin));
// has spin info transfer
if(sp) {
vector<EvtDiracSpinor> prod,decay;
// transfer spinors
for(unsigned int ix=0;ix<2;++ix) {
prod .push_back(EvtGenSpinor(sp->getProductionBasisState(ix)));
decay.push_back(EvtGenSpinor(sp->getDecayBasisState (ix)));
}
myPart->init(id, p4,prod[0],prod[1],decay[0],decay[1]);
// set the density matrix
myPart->setSpinDensityForward(EvtGenSpinDensity(sp->rhoMatrix()));
}
// no spin info
else {
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
}
evtpart=myPart;
}
// vector particles
else if ( thisSpin == EvtSpinType::VECTOR ) {
EvtVectorParticle *myPart=new EvtVectorParticle;
// get the spin info
tcVectorSpinPtr sp(dynamic_ptr_cast<tcVectorSpinPtr>(spin));
// has spin info transfer
if(sp) {
// transfer polarization vectors
vector<EvtVector4C> eps;
for(unsigned int ix=0;ix<3;++ix) {
eps.push_back(EvtGenPolarization(sp->getDecayBasisState(ix)));
}
myPart->init(id, p4,eps[0],eps[1],eps[2]);
// set spin density matrix
myPart->setSpinDensityForward(EvtGenSpinDensity(sp->rhoMatrix()));
}
// no spin info
else {
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
}
evtpart=myPart;
}
// spin 3/2 particles
else if ( thisSpin == EvtSpinType::RARITASCHWINGER ) {
EvtRaritaSchwingerParticle *myPart=new EvtRaritaSchwingerParticle;
// get the spin info
tcRSFermionSpinPtr sp(dynamic_ptr_cast<tcRSFermionSpinPtr>(spin));
// has spin info transfer
if(sp) {
// transfer spinors
vector<EvtRaritaSchwinger> prod,decay;
for(unsigned int ix=0;ix<4;++ix) {
prod .push_back(EvtGenRSSpinor(sp->getProductionBasisState(ix)));
decay.push_back(EvtGenRSSpinor(sp->getDecayBasisState(ix) ));
}
myPart->init(id, p4,
prod[0] ,prod[1] ,prod[2] , prod[3],
decay[0],decay[1],decay[2],decay[3]);
// set spin density matrix
myPart->setSpinDensityForward(EvtGenSpinDensity(sp->rhoMatrix()));
}
// no spin info
else {
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
}
evtpart=myPart;
}
// spin-2 particles
else if ( thisSpin == EvtSpinType::TENSOR ) {
EvtTensorParticle *myPart =new EvtTensorParticle;
tcTensorSpinPtr sp(dynamic_ptr_cast<tcTensorSpinPtr>(spin));
// has spin info transfer
if(sp) {
// transfer the polarization tensors
vector<EvtTensor4C> eps;
for(unsigned int ix=0;ix<5;++ix) {
eps.push_back(EvtGenTensor(sp->getDecayBasisState(ix)));
}
myPart->init(id, p4,eps[0],eps[1],eps[2],eps[3],eps[4]);
// set spin density matrix
myPart->setSpinDensityForward(EvtGenSpinDensity(sp->rhoMatrix()));
}
// no spin info
else {
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
}
evtpart=myPart;
}
// shouldn't be doing this but here for safety
else if ( thisSpin == EvtSpinType::STRING ) {
EvtStringParticle *myPart;
myPart=new EvtStringParticle;
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
evtpart=myPart;
}
// high spin particles
else if ( thisSpin == EvtSpinType::SPIN3 || thisSpin == EvtSpinType::SPIN5HALF ||
thisSpin == EvtSpinType::SPIN4 || thisSpin == EvtSpinType::SPIN7HALF) {
EvtHighSpinParticle *myPart;
myPart=new EvtHighSpinParticle;
myPart->init(id, p4);
EvtSpinDensity rho;
rho.setDiag(EvtSpinType::getSpinStates(thisSpin));
myPart->setSpinDensityForward(rho);
evtpart=myPart;
}
else {
throw Exception() << "Can't convert particle to EvtGen "
<< part << Exception::eventerror;
}
// boost particle back and return the particle
decay->boost(inmom.boostVector());
return evtpart;
}
// convert from ThePEG to EvtGen
EvtId EvtGenInterface::EvtGenID(int id, bool exception) const {
EvtId output;
int absid=abs(id),ispin(absid%10),isgn(id/absid);
// handle the easy cases
if(
//quarks(+excited)
absid<=8||
// leptons(+exicted)
(absid>=11&&absid<=18)||
// SM(+extensions) gauge bosons and higgs
(absid>=21&&absid<=25)||(absid>=32&&absid<=37)||
// 1 1S0, 1 3S1 and 1 3P2 1 3D3 mesons are the same
(absid>100&&absid<600&&ispin%2==1&&ispin<=9)||
// 2 1S0, 2 3S1 are the same
(absid>100100&&absid<100600&&(ispin==1||ispin==3))||
// 1 3d1 goes to 3s in evtgen
(absid>30100&&absid<30600&&ispin==3) ||
// 1 3p0 most same
(absid>10100&&absid<10600&&ispin==1) ||
// mixed kaons and diffractive states
(absid>=100&&absid<=3000&&ispin==0)) {
output = EvtPDL::evtIdFromStdHep(id);
}
// lowest baryon multiplets and diquarks are almost the same
else if(absid>1000&&absid<6000&&ispin>=1&&ispin<=4) {
// special for lambda_c(2625)
if(absid==4124) output = EvtPDL::evtIdFromStdHep(isgn*(absid+10000));
else output = EvtPDL::evtIdFromStdHep(id);
}
// 1 1P1 mesons are the same apart from D_s1
else if(absid>10100&&absid<10600&&(ispin==3)) {
if(absid==10433) output = EvtPDL::evtIdFromStdHep(isgn*20433);
else output = EvtPDL::evtIdFromStdHep(id);
}
// 1 3P1 mesons are the sameapart from D_s1
else if(absid>20100&&absid<20600&&(ispin==3)) {
if(absid==20433) output = EvtPDL::evtIdFromStdHep(isgn*10433);
else output = EvtPDL::evtIdFromStdHep(id);
}
// excited baryons
else if(((absid>10000&&absid<16000)||(absid>20000&&absid<26000)||
(absid>30000&&absid<36000))&&(ispin==2||ispin==4)) {
output=EvtPDL::evtIdFromStdHep(id);
}
// special for any bottomonium states
else if((absid%1000)/10==55) {
output=EvtPDL::evtIdFromStdHep(id);
}
// special meson codes
else if (absid>9000000) {
// f_0/a_0(980) goes into f_0/a_0(980)
if(absid==9000111||absid==9000211||absid==9010221) {
output=EvtPDL::evtIdFromStdHep(id);
}
// sigma
else if(absid==9000221) {
output=EvtPDL::evtIdFromStdHep(id);
}
// psi(4040)
else if(absid==9000443) {
output=EvtPDL::evtIdFromStdHep(50443);
}
// f_0(1500)
else if(absid==9030221) {
output=EvtPDL::evtIdFromStdHep(9020221);
}
}
// check its O.K.
if(output.getAlias()==-1&&exception) {
throw Exception() << "Can't find the EvtGen Id for particle "
<< getParticleData(id)->PDGName()
<< " with PDG code = "
<< id << " in EvtGen::EvtGenID"
<< Exception::eventerror;
}
return output;
}
ParticleVector EvtGenInterface::decayProducts(EvtParticle *part, bool boost) const {
ParticleVector output,temp;
for(unsigned int ix=0,N=part->getNDaug();ix<N;++ix) {
// get the daughter particle
EvtParticle * daug = part->getDaug(ix);
// may just have been used for mass generation, so check has valid momentum
if(!daug->hasValidP4()) continue;
// get the Herwig ParticleData object
int id=ThePEGID(daug->getId());
tcPDPtr pd=getParticleData(id);
// if easy to convert do it
if(pd) output.push_back(ThePEGParticle(daug,pd));
// special for EvtGen particles like string we don't need to include
else if(id==90) {
// check if needs to be decayed by EvtGen
if(EvtPDL::getStdHep(daug->getId())==92||daug->isDecayed()) {
// add the particles
ParticleVector temp(decayProducts(daug,EvtPDL::getStdHep(daug->getId())!=92));
if(EvtPDL::getStdHep(daug->getId())==92) {
Lorentz5Momentum pstring(ThePEGMomentum(daug->getP4(),daug->mass()));
Boost bv(-pstring.x()/pstring.e(),-pstring.y()/pstring.e(),-pstring.z()/pstring.e());
for(unsigned int ix=0;ix<temp.size();++ix) {
temp[ix]->deepBoost(bv);
}
}
for(unsigned int iy=0;iy<temp.size();++iy) output.push_back(temp[iy]);
}
else if(!daug->isDecayed()) {
EvtDecayBase *decayer = EvtDecayTable::getInstance()->getDecayFunc(daug);
// must be a decayer
if(!decayer) throw Exception() << "Could find EvtGen decayer in "
<< "EvtGenInterface::decayProducts()"
<< Exception::runerror;
// If there are already daughters, then this step is already done!
// figure out the masses
if ( daug->getNDaug() == 0 ) daug->generateMassTree();
// perform decay
decayer->makeDecay(daug,false);
// add the particles
ParticleVector temp(decayProducts(daug));
for(unsigned int iy=0;iy<temp.size();++iy) output.push_back(temp[iy]);
}
}
else {
throw Exception() << "Tried to convert an unknown particle, PDG code = " << id
<< " from EvtGen in EvtGen::decayproducts which is "
<< " unknown to Herwig++. Killing event."
<< Exception::eventerror;
}
}
// boost to lab
if(output.size()>0) {
if(boost) {
Boost bv=ThePEGMomentum(part->getP4(),part->mass()).boostVector();
for(unsigned int ix=0; ix<output.size(); ++ix) output[ix]->deepBoost(bv);
}
}
return output;
}
void EvtGenInterface::ThePEGSpin(PPtr peg,EvtParticle *evt) const {
// if no corresponding ThePEG spin type return
if(evt->getSpinType()==EvtSpinType::STRING||
evt->getSpinType()==EvtSpinType::SPIN3||evt->getSpinType()==EvtSpinType::SPIN4||
evt->getSpinType()==EvtSpinType::SPIN5HALF||
evt->getSpinType()==EvtSpinType::SPIN7HALF) return;
// now deal with the other cases
// scalars
unsigned int ix;
SpinPtr spin;
if(evt->getSpinType()==EvtSpinType::SCALAR) {
ScalarSpinPtr sca(new_ptr(ScalarSpinInfo(peg->momentum(),true)));
spin=sca;
}
// massless spin 1/2
else if(evt->getSpinType()==EvtSpinType::NEUTRINO) {
FermionSpinPtr fer(new_ptr(FermionSpinInfo(peg->momentum(),true)));
spin=fer;
ix=peg->id()<0;
fer->setBasisState(ix,ThePEGSpinor(evt->spParentNeutrino()));
ix=peg->id()>0;
fer->setBasisState(ix,LorentzSpinor<SqrtEnergy>());
}
// massive spin-1/2
else if(evt->getSpinType()==EvtSpinType::DIRAC) {
FermionSpinPtr fer(new_ptr(FermionSpinInfo(peg->momentum(),true)));
spin=fer;
for(ix=0;ix<2;++ix) {
fer->setBasisState(ix,ThePEGSpinor(evt->spParent(ix)));
}
}
// massless vectors
else if(evt->getSpinType()==EvtSpinType::PHOTON) {
VectorSpinPtr vec(new_ptr(VectorSpinInfo(peg->momentum(),true)));
spin=vec;
for(ix=0;ix<1;++ix) {
vec->setBasisState(2*ix,ThePEGPolarization(evt->epsParentPhoton(ix)));}
vec->setBasisState(1,LorentzVector<Complex>());
}
// massive vectors
else if(evt->getSpinType()==EvtSpinType::VECTOR) {
VectorSpinPtr vec(new_ptr(VectorSpinInfo(peg->momentum(),true)));
spin=vec;
for(ix=0;ix<3;++ix) {
vec->setBasisState(ix,ThePEGPolarization(evt->epsParent(ix)));
}
}
// massive spin 3/2
else if(evt->getSpinType()==EvtSpinType::RARITASCHWINGER) {
RSFermionSpinPtr rs(new_ptr(RSFermionSpinInfo(peg->momentum(),true)));
spin=rs;
for(ix=0;ix<4;++ix) {
rs->setBasisState(ix,ThePEGRSSpinor(evt->spRSParent(ix)));}
}
// tensors
else if(evt->getSpinType()==EvtSpinType::TENSOR) {
TensorSpinPtr ten(new_ptr(TensorSpinInfo(peg->momentum(),true)));
spin=ten;
for(ix=0;ix<5;++ix) {
ten->setBasisState(ix,ThePEGTensor(evt->epsTensorParent(ix)));
}
}
else {
throw Exception() << "Unknown EvtGen spin type in EvtGen::ThePEGSpin() "
<< Exception::runerror;
}
// set the spininfo
peg->spinInfo(spin);
// final set up if the particle has decayed
if(evt->getSpinDensityForward().getDim()!=0) {
spin->rhoMatrix()=ThePEGSpinDensity(evt->getSpinDensityForward(),peg->id());
}
if(evt->isDecayed()) {
spin->decayed(true);
spin->develop();
if(evt->getSpinDensityBackward().getDim()!=0) {
spin->DMatrix()=ThePEGSpinDensity(evt->getSpinDensityBackward(),peg->id());
}
}
}
// convert from EvtGen to ThePEG
int EvtGenInterface::ThePEGID(EvtId eid,bool exception) const {
int output(0);
int id(EvtPDL::getStdHep(eid)),absid(abs(id)),ispin(absid%10),isgn(id/absid);
// handle the easy cases
// special particles like string which we delete and include decay products
if(absid==92||absid==41||absid==42||absid==43||absid==44||
absid==30343||absid==30353||
absid==30363||absid==30373||absid==30383) {
output=90;
}
//quarks(+excited)
else if(absid<=8||
// leptons(+excited)
(absid>=11&&absid<=18)||
// SM gauge bosons and higgs
(absid>=21&&absid<=25)||(absid>=32&&absid<=37)||
// 1 1S0, 1 3S1 and 1 3P2 mesons are the same
(absid>100&&absid<600&&(ispin%2==1&&ispin<9))||
// 2 1S0 and 2 3S1 mesons are the same
(absid>100100&&absid<100600&&(ispin==1||ispin==3))||
// 1 3p0 are the same
(absid>10100&&absid<10600&&ispin==1) ||
// 3d1 are the same
(absid>30100&&absid<30600&&ispin==3) ||
// lowest baryon multiplets and diquarks
(absid>1000&&absid<6000&&ispin>=1&&ispin<=4)||
// mixed kaons and diffractive states
(absid>=100&&absid<=3000&&ispin==0)) {
output=id;
}
// 1 1P1 mesons are the same apart from D_s1
else if (absid>10100&&absid<10600&&(ispin==3)) {
if(absid==10433) output=isgn*20433;
else output=id;
}
// 1 3P1 mesons are the same apart from D_s1
else if(absid>20100&&absid<20600&&(ispin==3)) {
if(absid==20433) output=isgn*10433;
else output=id;
}
// special for the virtual W (we don't distinguish so return W)
else if(absid==89) return id/absid*24;
// excited baryons
else if(((absid>10000&&absid<16000)||(absid>20000&&absid<26000)||
(absid>30000&&absid<36000))&&(ispin==2||ispin==4)) {
// most cases
if(absid!=14124) output=id;
// lambda_c(2625)
else output=isgn*(absid-10000);
}
// bottomium
else if((absid%1000)/10==55) {
output = id;
}
// special mesons
else if(absid>9000000) {
// f_0/a_0(980) goes into f_0/a_0(980)
if(absid==9000111||absid==9000211||absid==9010221) {
output=id;
}
// sigma
else if(absid==9000221) {
output=id;
}
// psi(4040)
else if(absid==9000443) {
output=id;
}
// f_0(1500)
else if(absid==9020221) {
output=9030221;
}
}
// check its O.K.
if(output==0&&exception) {
throw Exception() << "Can't find the ThePEG id for particle "
<< EvtPDL::name(eid)
<< " with PDG code = "
<< id << " in EvtGen::ThePEGID"
<< Exception::eventerror;
}
return output;
}
RhoDMatrix EvtGenInterface::ThePEGSpinDensity(const EvtSpinDensity & rho, int id) const {
RhoDMatrix output;
unsigned int ix,iy;
// special for neutrinos
if(abs(id)%2==0&&abs(id)>=12&&abs(id)<=16) {
output = RhoDMatrix(PDT::Spin1Half, false);
if(id>0) output(0,0)=ThePEGComplex(rho.get(0,0));
else output(1,1)=ThePEGComplex(rho.get(0,0));
}
// special for photons
else if(id==ParticleID::gamma) {
output = RhoDMatrix(PDT::Spin1, false);
for(ix=0;ix<2;++ix) {
for(iy=0;iy<2;++iy) output(2*ix,2*iy)=ThePEGComplex(rho.get(ix,iy));
}
}
// normal behaviour
else {
unsigned int ndim(abs(rho.getDim()));
if(ndim!=0) {
output = RhoDMatrix(PDT::Spin(ndim));
for(ix=0;ix<ndim;++ix) {
for(iy=0;iy<ndim;++iy) output(ix,iy)=ThePEGComplex(rho.get(ix,iy));
}
}
else if(ndim==0) {
output = RhoDMatrix(PDT::Spin0);
}
}
return output;
}
-
void EvtGenInterface::checkConversion() const {
// check the translation of particles from ThePEG to EvtGen.
ParticleMap::const_iterator pit = generator()->particles().begin();
ParticleMap::const_iterator pend = generator()->particles().end();
generator()->log() << "Testing conversion of particles from ThePEG to EvtGen\n";
EvtId etemp;
for(;pit!=pend;++pit) {
generator()->log() << pit->first << " ";
etemp=EvtGenID(pit->first,false);
if(etemp.getAlias()>=0) {
generator()->log() << pit->second->PDGName() << "\t becomes "
<< EvtPDL::name(etemp) << "\t "
<< EvtPDL::getStdHep(etemp);
if(ThePEGID(etemp,false)-pit->first!=0) {
generator()->log() << " and converting back to ThePEG fails";
}
generator()->log() << "\n";
}
else {
generator()->log() << pit->second->PDGName()
<< " has no match in EvtGen \n";
}
}
// test the conversion the other way
generator()->log() << "Testing conversion of particles from EvtGen to ThePEG\n";
int idtemp;
tcPDPtr ptemp;
for(unsigned int ix=0;ix<EvtPDL::entries();++ix) {
generator()->log() << EvtPDL::getStdHep(EvtPDL::getEntry(ix)) << " "
<< EvtPDL::name(EvtPDL::getEntry(ix));
idtemp=ThePEGID(EvtPDL::getEntry(ix),false);
ptemp=getParticleData(idtemp);
if(ptemp) {
generator()->log() << " becomes " << ptemp->PDGName() << " "
<< ptemp->id();
if(EvtGenID(ptemp->id(),false)!=EvtPDL::getEntry(ix)) {
generator()->log() << " and converting back to EvtGEN fails ";
}
generator()->log() << "\n";
}
else {
generator()->log() << " has no match in ThePEG \n";
}
}
}
void EvtGenInterface::outputEvtGenDecays(long parentid) const {
// output the decay modes from EvtGen so we can read them in
EvtId parent(EvtGenID(parentid));
// get evtids for children
generator()->log() << "Outputting decays for "
<< getParticleData(parentid)->PDGName() << "\n";
for(int ix=0;ix<EvtDecayTable::getInstance()->getNMode(parent.getAlias());++ix) {
EvtDecayBase* decayer=EvtDecayTable::getInstance()->getDecay(parent.getAlias(),ix);
vector<long> pegid;
for(int iy=0;iy<decayer->getNDaug();++iy) {
pegid.push_back(ThePEGID(decayer->getDaug(iy),false));
}
for(unsigned int iy=pegid.size();iy<7;++iy) pegid.push_back(0);
double br=decayer->getBranchingFraction();
generator()->log()
<< "insert into decay_modes (incomingID,BR,decayon,star,outgoingID1,"
<< "outgoingID2,outgoingID3,outgoingID4,outgoingID5,outgoingID6,outgoingID7,"
<< "description,decayer) values (" << parentid << "," << br << ",'on','*',";
for(int iy=0;iy<7;++iy) {
generator()->log() << pegid[iy] << ",";
}
generator()->log() << "'Decay of %name% with branching "
<< "ratio taken from EvtGen.',3);\n";
}
}
int EvtGenInterface::EvtGenChannel(const DecayMode & dm) const {
// get evtid for parent
EvtId parent(EvtGenID(dm.parent()->id()));
// get evtids for children
EvtId daugs[20];
unsigned int ndaug(0);
ParticleMSet::const_iterator pit = dm.products().begin();
ParticleMSet::const_iterator pend = dm.products().end();
EvtId etemp;
for( ;pit!=pend&&ndaug<20;++pit) {
etemp=EvtGenID((**pit).id());
daugs[ndaug]=etemp;
ndaug++;
}
if(ndaug>=20) throw Exception() << "Too many decay products "
<< "in EvtGen::EvtGenChannel"
<< Exception::eventerror;
// find the channel
int output=EvtDecayTable::getInstance()->inChannelList(parent,ndaug,daugs);
if(output<0) {
string dmode;
dmode = "decay of " + dm.parent()->PDGName() + " -> ";
pit = dm.products().begin();
pend = dm.products().end();
for( ;pit!=pend&&ndaug<20;++pit) dmode += (**pit).PDGName()+" ";
throw Exception() << "Can't find EVtGen decay mode in EvtGenChannel for "
<< dmode << " in EvtGen::EvtGenChannel"
<< Exception::runerror;
}
return output;
}
// translate the matrix element to our form
void EvtGenInterface::constructVertex(const Particle & parent,
ParticleVector products,
EvtDecayAmp* damp) const {
unsigned int ix,iy;
vector <PDT::Spin> outspin;
for(ix=0;ix<products.size();++ix) {
outspin.push_back(products[ix]->dataPtr()->iSpin());
}
vector<int> constants(products.size()+2,0);
unsigned int nstate(1),idtemp;
for(ix=outspin.size();ix>0;--ix) {
idtemp=abs(products[ix-1]->id());
if(idtemp==ParticleID::gamma) {
nstate*=2;
constants[ix]=nstate;
}
else if(idtemp%2==0&&idtemp>=12&&idtemp<=16) {
constants[ix]=nstate;
}
else {
nstate*=outspin[ix-1];
constants[ix]=nstate;
}
}
PDT::Spin inspin(parent.dataPtr()->iSpin());
nstate*=inspin;
constants[0]=nstate;
constants[outspin.size()+1]=1;
- int eind[10];
+ int eind[10]={0,0,0,0,0,0,0,0,0,0};
unsigned int iloc;
vector<unsigned int> hind(outspin.size()+1,0);
DecayMEPtr newME = new_ptr(GeneralDecayMatrixElement(inspin,outspin));
for(ix=0;ix<nstate;++ix) {
iloc=0;
hind[0]=ix/constants[1];
if(inspin!=PDT::Spin0) {
eind[iloc]=hind[0];
++iloc;
}
for(iy=0;iy<outspin.size();++iy) {
if(outspin[iy]==PDT::Spin0) {
hind[iy+1]=0;
}
else if(products[iy]->id()==ParticleID::gamma) {
hind[iy+1]=2*(ix%constants[iy+1])/constants[iy+2];
eind[iloc]=hind[iy+1]/2;
++iloc;
}
else if(constants[iy+1]==1) {
hind[iy+1]=products[iy]->id()<0;
}
else {
hind[iy+1]=(ix%constants[iy+1])/constants[iy+2];
eind[iloc]=hind[iy+1];++iloc;
}
}
if(iloc==0) eind[0]=0;
(*newME)(hind)=ThePEGComplex(damp->amplitude().getAmp(eind));
}
// create the decay vertex
VertexPtr vertex(new_ptr(DecayVertex()));
DVertexPtr Dvertex(dynamic_ptr_cast<DVertexPtr>(vertex));
// set the incoming particle for the decay vertex
dynamic_ptr_cast<tcSpinPtr>(parent.spinInfo())->decayVertex(vertex);
for(ix=0;ix<products.size();++ix) {
dynamic_ptr_cast<tcSpinPtr>(products[ix]->spinInfo())
->productionVertex(vertex);
}
// set the matrix element
Dvertex->ME(newME);
}
diff --git a/Decay/EvtGen/EvtGenInterface.h b/Decay/EvtGen/EvtGenInterface.h
--- a/Decay/EvtGen/EvtGenInterface.h
+++ b/Decay/EvtGen/EvtGenInterface.h
@@ -1,465 +1,465 @@
// -*- C++ -*-
#ifndef Herwig_EvtGenInterface_H
#define Herwig_EvtGenInterface_H
//
// This is the declaration of the EvtGenInterface class.
//
#include "EvtGenInterface.fh"
-#include "EvtGenRandom.h"
#include "ThePEG/Interface/Interfaced.h"
#include "ThePEG/Vectors/Lorentz5Vector.h"
#include "ThePEG/Helicity/ScalarSpinInfo.h"
#include "ThePEG/Helicity/FermionSpinInfo.h"
#include "ThePEG/Helicity/VectorSpinInfo.h"
#include "ThePEG/Helicity/RSFermionSpinInfo.h"
#include "ThePEG/Helicity/TensorSpinInfo.h"
#include "ThePEG/EventRecord/Particle.h"
+#include "EvtGenRandom.h"
#include "EvtGen/EvtGen.hh"
#include "EvtGenBase/EvtParticle.hh"
#include "EvtGenBase/EvtSpinDensity.hh"
#include "EvtGenBase/EvtVector4R.hh"
#include "EvtGenBase/EvtVector4C.hh"
#include "EvtGenBase/EvtTensor4C.hh"
#include "EvtGenBase/EvtDiracSpinor.hh"
#include "EvtGenBase/EvtRaritaSchwinger.hh"
#include "EvtGenBase/EvtDecayAmp.hh"
+namespace Herwig {
+
+using namespace ThePEG;
+
/**
* The EvtGenInterface class is the main class for the use of the EvtGen decay
* package with Herwig.
*
* @see \ref EvtGenInterfaceInterfaces "The interfaces"
* defined for EvtGenInterface.
*/
-namespace Herwig {
-
-using namespace ThePEG;
-
class EvtGenInterface: public Interfaced {
public:
/** @name Standard constructors and destructors. */
//@{
/**
* The default constructor.
*/
EvtGenInterface();
/**
* The destructor.
*/
virtual ~EvtGenInterface();
//@}
public:
/**
* Use EvtGen to perform a decay
* @param parent The decaying particle
* @param dm The decaymode
* @return The decay products
*/
ParticleVector decay(const Particle &parent,
bool recursive, const DecayMode & dm) const;
public:
/** @name Functions used by the persistent I/O system. */
//@{
/**
* Function used to write out object persistently.
* @param os the persistent output stream written to.
*/
void persistentOutput(PersistentOStream & os) const;
/**
* Function used to read in object persistently.
* @param is the persistent input stream read from.
* @param version the version number of the object when written.
*/
void persistentInput(PersistentIStream & is, int version);
//@}
/**
* The standard Init function used to initialize the interfaces.
* Called exactly once for each class by the class description system
* before the main function starts or
* when this class is dynamically loaded.
*/
static void Init();
protected:
/** @name Functions to convert between EvtGen and Herwig classes */
//@{
/**
* Convert a particle to an EvtGen particle.
* @param part The particle to be converted.
*/
EvtParticle *EvtGenParticle(const Particle & part) const;
/**
* Return the decay products of an EvtGen particle in as ThePEG particles
* @param evtpart The EvtGen particle
*/
ParticleVector decayProducts(EvtParticle* evtpart, bool boost=true) const;
/**
* Convert a Lorentz5Momentum to a real EvtGen 4-vector
* @param mom The momentum to be converted
*/
EvtVector4R EvtGenMomentum(const Lorentz5Momentum & mom) const {
return EvtVector4R(mom.t()/GeV,mom.x()/GeV,mom.y()/GeV,mom.z()/GeV);
}
-
+
/**
* Convert a PDG code from ThePEG into an EvtGen particle id
* @param id The PDG code
* @param exception Whether or not to throw an Exception if fails
*/
EvtId EvtGenID(int id,bool exception=true) const;
/**
* Convert a LorentzSpinor to an EvtGen one. The spinor is converted to the
* EvtGen Dirac representation/
* @param sp The LorentzSpinor
*/
EvtDiracSpinor EvtGenSpinor(const LorentzSpinor<SqrtEnergy> & sp) const {
InvSqrtEnergy norm(sqrt(0.5)/sqrt(GeV));
EvtDiracSpinor output;
output.set(EvtGenComplex(-norm*( sp.s1()+sp.s3())),
EvtGenComplex(-norm*( sp.s2()+sp.s4())),
EvtGenComplex(-norm*(-sp.s1()+sp.s3())),
EvtGenComplex(-norm*(-sp.s2()+sp.s4())));
return output;
}
/**
* Convert a LorentzPolarizationVector to a complex EvtGen 4-vector
* @param eps The polarization vector to be converted
*/
EvtVector4C EvtGenPolarization(const LorentzPolarizationVector & eps) const {
return EvtVector4C(EvtGenComplex(eps.t()),EvtGenComplex(eps.x()),
EvtGenComplex(eps.y()),EvtGenComplex(eps.z()));
}
/**
* Convert our Rarita-Schwinger spinor to the EvtGen one
* @param sp Our RS Spinor
*/
EvtRaritaSchwinger EvtGenRSSpinor(const LorentzRSSpinor<SqrtEnergy> & sp) const {
InvSqrtEnergy norm(sqrt(0.5)/sqrt(GeV));
complex<double> out[4][4];
for(unsigned int ix=0;ix<4;++ix) {
out[ix][0] =-norm*( sp(ix,0)+sp(ix,2));
out[ix][1] =-norm*( sp(ix,1)+sp(ix,3));
out[ix][2] =-norm*(-sp(ix,0)+sp(ix,2));
out[ix][3] =-norm*(-sp(ix,1)+sp(ix,3));
}
EvtRaritaSchwinger output;
unsigned int ix,iy;
// remember we have vec,spin and evtgen spin,vec
for(ix=0;ix<4;++ix) {
for(iy=0;iy<4;++iy) output.set(ix,iy,EvtGenComplex(out[iy][ix]));
}
return output;
}
/**
* Convert our tensor to the EvtGen one.
* @param ten Our tensor
*/
EvtTensor4C EvtGenTensor(const LorentzTensor<double> & ten) const {
EvtTensor4C output;
unsigned int ix,iy;
for(ix=0;ix<4;++ix){
for(iy=0;iy<4;++iy) output.set(ix,iy,EvtGenComplex(ten(ix,iy)));
}
return output;
}
/**
* Convert a spin density matrix to an EvtGen spin density matrix.
* @param rho The spin density matrix to be converted.
*/
EvtSpinDensity EvtGenSpinDensity(const RhoDMatrix & rho) const {
EvtSpinDensity rhoout;
unsigned int ix,iy,ispin(rho.iSpin());
rhoout.setDim(ispin);
for(ix=0;ix<ispin;++ix) {
for(iy=0;iy<ispin;++iy)
rhoout.set(ix,iy,EvtGenComplex(rho(ix,iy)));
}
return rhoout;
}
/**
* Convert from our complex to the EvtGen one
*/
EvtComplex EvtGenComplex(Complex c) const {
return EvtComplex(c.real(),c.imag());
}
//@}
/**
* Functions to convert between EvtGen and Herwig classes
*/
//@{
/**
* Convert a particle from an EvtGen one to ThePEG one.
* @param part The EvtGen particle.
* @param pd Pointer to the particle data object of ThePEG for the particle.
* @param spin Convert the spin information as well
*/
PPtr ThePEGParticle(EvtParticle *part, tcPDPtr pd,bool spin=true) const {
PPtr output(new_ptr(Particle(pd)));
output->set5Momentum(ThePEGMomentum(part->getP4(),part->mass()));
if(spin) ThePEGSpin(output,part);
// make the daughters
ParticleVector daug(decayProducts(part,spin));
for(unsigned int ix=0;ix<daug.size();++ix) output->addChild(daug[ix]);
return output;
}
/**
* Set the SpinInfo for a ThePEG particle using an EvtGen particle
* @param pegpart ThePEG particle.
* @param evtpart The EvtGen particle.
*/
void ThePEGSpin(PPtr pegpart,EvtParticle *evtpart) const;
/**
* Convert an EvtGen EvtId to a PDG code in our conventions
* @param id The EvtGen ID.
* @param exception Whether or not to throw an Exception if fails
*/
int ThePEGID(EvtId id,bool exception=true) const;
/**
* Convert from EvtGen momentum to Lorentz5Momentum
* @param mom The EvtGen 4-momentum
* @param mass The mass
*/
Lorentz5Momentum ThePEGMomentum(const EvtVector4R & mom,double mass) const {
return Lorentz5Momentum(mom.get(1)*GeV,mom.get(2)*GeV,
mom.get(3)*GeV,mom.get(0)*GeV,mass*GeV);
}
/**
* Convert from EvtGen complex to ours
*/
Complex ThePEGComplex(EvtComplex c) const {
return Complex(real(c),imag(c));
}
/**
* Convert a spin density to a ThePEG one from an EvtGen one
* @param rho The spin density matrix to be converted
* @param id The PDG code of the particle to get special cases right.
*/
RhoDMatrix ThePEGSpinDensity(const EvtSpinDensity & rho, int id) const;
/**
* Convert an EvtDiracSpinor a LorentzSpinor. This spinor is converted to
* the default Dirac matrix representation used by ThePEG.
* @param sp The EvtDiracSpinor
*/
LorentzSpinor<SqrtEnergy> ThePEGSpinor(const EvtDiracSpinor & sp) const {
SqrtEnergy norm(sqrt(0.5)*sqrt(GeV));
vector<complex<SqrtEnergy> > evtSpin(4);
for(unsigned int ix=0;ix<4;++ix) evtSpin[ix] = -norm*ThePEGComplex(sp.get_spinor(ix));
return LorentzSpinor<SqrtEnergy>(evtSpin[0]-evtSpin[2],evtSpin[1]-evtSpin[3],
evtSpin[0]+evtSpin[2],evtSpin[1]+evtSpin[3]);
}
/**
* Convert an EvtGen complex 4-vector to a LorentzPolarizationVector
* @param eps The complex 4-vector to be converted.
*/
LorentzPolarizationVector ThePEGPolarization(const EvtVector4C & eps) const {
return LorentzPolarizationVector(conj(ThePEGComplex(eps.get(1))),
conj(ThePEGComplex(eps.get(2))),
conj(ThePEGComplex(eps.get(3))),
conj(ThePEGComplex(eps.get(0))));
}
/**
* Convert an EvtGen Rarita-Schwinger spinor to ours
* @param sp The EvtGen RS spinor.
*/
LorentzRSSpinor<SqrtEnergy> ThePEGRSSpinor(const EvtRaritaSchwinger & sp) const {
complex<SqrtEnergy> evtSpin[4][4];
SqrtEnergy norm(sqrt(0.5)*sqrt(GeV));
// normalisation and swap vec,spin order
for(unsigned int ix=0;ix<4;++ix) {
for(unsigned int iy=0;iy<4;++iy) evtSpin[ix][iy]=-norm*ThePEGComplex(sp.get(iy,ix));
}
LorentzRSSpinor<SqrtEnergy> output;
for(unsigned int ix=0;ix<4;++ix) {
output(ix,0) = evtSpin[ix][0] - evtSpin[ix][2];
output(ix,1) = evtSpin[ix][1] - evtSpin[ix][3];
output(ix,2) = evtSpin[ix][0] + evtSpin[ix][2];
output(ix,3) = evtSpin[ix][1] + evtSpin[ix][3];
}
// output.changeRep(Helicity::defaultDRep);
return output;
}
/**
* Convert an EvtGen tensor to ThePEG
* @param ten The EvtGen tensor
*/
LorentzTensor<double> ThePEGTensor(const EvtTensor4C & ten) const {
LorentzTensor<double> output;
unsigned int ix,iy;
for(ix=0;ix<4;++ix) {
for(iy=0;iy<4;++iy)output(ix,iy)=conj(ThePEGComplex(ten.get(ix,iy)));
}
return output;
}
//@}
/**
* Check the conversion of particles between Herwig++ and EvtGen
*/
void checkConversion() const;
/**
* Output the EvtGen decay modes for a given particle
* @param id The PDG code of the particle to output
*/
void outputEvtGenDecays(long id) const;
/**
* Find the location in the EvtGen list of decay channels for
* a given decay mode.
*/
int EvtGenChannel(const DecayMode &dm) const;
/**
* Check the particle has SpinInfo and if not create it
* @param part The particle
*/
tSpinPtr getSpinInfo(const Particle &part) const {
// return spin info if exists
if(part.spinInfo()) {
return dynamic_ptr_cast<tSpinPtr>(const_ptr_cast<tPPtr>(&part)->spinInfo());
}
// otherwise make it
tPPtr ptemp(const_ptr_cast<tPPtr>(&part));
PDT::Spin spin(part.dataPtr()->iSpin());
SpinPtr pspin;
if(spin==PDT::Spin0) pspin=new_ptr(ScalarSpinInfo(part.momentum(),true));
else if(spin==PDT::Spin1Half) pspin=new_ptr(FermionSpinInfo(part.momentum(),true));
else if(spin==PDT::Spin1) pspin=new_ptr(VectorSpinInfo(part.momentum(),true));
else if(spin==PDT::Spin3Half) pspin=new_ptr(RSFermionSpinInfo(part.momentum(),true));
else if(spin==PDT::Spin2) pspin=new_ptr(TensorSpinInfo(part.momentum(),true));
else throw Exception() << "Can't create spinInfo for decaying particle in "
<< "EvtGen::checkSpinInfo for spin " << spin << "particle "
<< Exception::eventerror;
ptemp->spinInfo(pspin);
return pspin;
}
/**
* Construct the DecayVertex for Herwig using the information from
* EvtGen
* @param parent The decaying particle
* @param products The outgoing particles
* @param damp Pointer to the EvtGen decayer
*/
void constructVertex(const Particle & parent,ParticleVector products,
EvtDecayAmp* damp) const;
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const;
/** Make a clone of this object, possibly modifying the cloned object
* to make it sane.
* @return a pointer to the new object.
*/
virtual IBPtr fullclone() const;
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object. Called in the run phase just before
* a run begins.
*/
virtual void doinitrun();
//@}
private:
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
EvtGenInterface & operator=(const EvtGenInterface &);
private:
/**
* Names of the various EvtGen parameter files
*/
//@{
/**
* The name of the file containing the decays
*/
string decayName_;
/**
* The name of the file containing the particle data
*/
string pdtName_;
/**
* Names of addition user specified decays
*/
vector<string> userDecays_;
//@}
/**
* Whether or not to redirect cout and cerr when EvtGen is running
*/
bool reDirect_;
/**
* Check the conversion of the particles
*/
bool checkConv_;
/**
* Particles for which to output the EvtGen decays
*/
vector<long> convID_;
private:
/**
* Pointer to the random number generator for EvtGen
*/
EvtRandomEngine * evtrnd_;
- /*
+ /**
* Main EvtGen object
*/
EvtGen * evtgen_;
};
}
#endif /* Herwig_EvtGenInterface_H */
diff --git a/Decay/EvtGen/Makefile.am b/Decay/EvtGen/Makefile.am
--- a/Decay/EvtGen/Makefile.am
+++ b/Decay/EvtGen/Makefile.am
@@ -1,11 +1,11 @@
pkglib_LTLIBRARIES = HwEvtGenInterface.la
HwEvtGenInterface_la_SOURCES = \
EvtGenInterface.cc EvtGenInterface.h EvtGenInterface.fh \
EvtGenRandom.h \
EvtGenDecayer.cc EvtGenDecayer.h
HwEvtGenInterface_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0
-
+HwEvtGenInterface_la_LIBADD = $(EVTGENLIBS)
HwEvtGenInterface_la_CPPFLAGS = $(AM_CPPFLAGS) $(EVTGENINCLUDE) \
-DEVTGEN_PREFIX="\"$(EVTGENPREFIX)\""
diff --git a/m4/herwig.m4 b/m4/herwig.m4
--- a/m4/herwig.m4
+++ b/m4/herwig.m4
@@ -1,927 +1,930 @@
# check for gcc bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34130
AC_DEFUN([HERWIG_CHECK_ABS_BUG],
[
AC_REQUIRE([HERWIG_COMPILERFLAGS])
if test "$GCC" = "yes"; then
AC_MSG_CHECKING([for gcc abs bug])
AC_RUN_IFELSE([
AC_LANG_PROGRAM(
[[ int foo (int i) { return -2 * __builtin_abs(i - 2); } ]],
[[ if ( foo(1) != -2 || foo(3) != -2 ) return 1; ]]
)],
[ AC_MSG_RESULT([not found. Compiler is ok.]) ],
[
AC_MSG_RESULT([found. Builtin abs() is buggy.])
AC_MSG_CHECKING([if -fno-builtin-abs works])
oldcxxflags=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -fno-builtin-abs"
AC_RUN_IFELSE([
AC_LANG_PROGRAM(
[[
#include <cstdlib>
int foo (int i) { return -2 * std::abs(i - 2); }
]],
[[
if (foo(1) != -2 || foo(3) != -2) return 1;
]]
)],
[
AC_MSG_RESULT([yes. Setting -fno-builtin-abs.])
AM_CXXFLAGS="$AM_CXXFLAGS -fno-builtin-abs"
AM_CFLAGS="$AM_CFLAGS -fno-builtin-abs"
],
[
AC_MSG_RESULT([no. Setting -fno-builtin.])
AC_MSG_WARN([
*****************************************************************************
For this version of gcc, -fno-builtin-abs alone did not work to avoid the
gcc abs() bug. Instead, all gcc builtin functions are now disabled.
Update gcc if possible.
*****************************************************************************])
AM_CXXFLAGS="$AM_CXXFLAGS -fno-builtin"
AM_CFLAGS="$AM_CFLAGS -fno-builtin"
]
)
CXXFLAGS=$oldcxxflags
]
)
fi
])
dnl ##### THEPEG #####
AC_DEFUN([HERWIG_CHECK_THEPEG],
[
defaultlocation="${prefix}"
test "x$defaultlocation" = xNONE && defaultlocation="${ac_default_prefix}"
AC_MSG_CHECKING([for libThePEG in])
AC_ARG_WITH(thepeg,
AC_HELP_STRING([--with-thepeg=DIR],[location of ThePEG installation]),
[],
[with_thepeg="${defaultlocation}"])
AC_MSG_RESULT([$with_thepeg])
if test "x$with_thepeg" = "xno"; then
AC_MSG_ERROR([Cannot build Herwig++ without ThePEG. Please set --with-thepeg.])
fi
THEPEGLDFLAGS="-L${with_thepeg}/lib/ThePEG"
THEPEGHASLHAPDF="no"
if test -e ${with_thepeg}/lib/ThePEG/ThePEGLHAPDF.so ; then
THEPEGHASLHAPDF="yes"
fi
if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then
THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG"
if test -e ${with_thepeg}/lib64/ThePEG/ThePEGLHAPDF.so ; then
THEPEGHASLHAPDF="yes"
fi
fi
if test "x$THEPEGHASLHAPDF" == "xno" ; then
AC_MSG_ERROR([Herwig++ requires ThePEG to be build with lhapdf.])
fi
THEPEGHASFASTJET="no"
if test -e ${with_thepeg}/lib/ThePEG/FastJetFinder.so ; then
THEPEGHASFASTJET="yes"
fi
if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then
THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG"
if test -e ${with_thepeg}/lib64/ThePEG/FastJetFinder.so ; then
THEPEGHASFASTJET="yes"
fi
fi
if test "x$THEPEGHASFASTJET" == "xno" ; then
AC_MSG_ERROR([Herwig++ requires ThePEG to be build with FastJet.])
fi
THEPEGPATH="${with_thepeg}"
oldldflags="$LDFLAGS"
oldlibs="$LIBS"
LDFLAGS="$LDFLAGS $THEPEGLDFLAGS"
AC_CHECK_LIB([ThePEG],[debugThePEG],[],
[AC_MSG_ERROR([No ThePEG libraries in $THEPEGLDFLAGS. Please set --with-thepeg.])])
AC_SUBST([THEPEGLIB],[-lThePEG])
AC_SUBST(THEPEGLDFLAGS)
AC_SUBST(THEPEGPATH)
AC_SUBST(THEPEGHASLHAPDF)
AC_SUBST(THEPEGHASFASTJET)
LIBS="$oldlibs"
LDFLAGS="$oldldflags"
AC_MSG_CHECKING([for ThePEG headers in])
AC_ARG_WITH([thepeg-headers],
AC_HELP_STRING([--with-thepeg-headers=DIR],[location of ThePEG include directory]),
[],
[with_thepeg_headers="${with_thepeg}/include"])
AC_MSG_RESULT([$with_thepeg_headers])
if test "x$with_thepeg_headers" = "xno"; then
AC_MSG_ERROR([Cannot build Herwig++ without ThePEG headers. Please set --with-thepeg-headers.])
fi
THEPEGINCLUDE="-I$with_thepeg_headers"
oldcppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $THEPEGINCLUDE"
AC_CHECK_HEADER([ThePEG/Config/ThePEG.h],[],
[AC_MSG_ERROR([No ThePEG headers in $with_thepeg_headers. Please set --with-thepeg-headers.])])
CPPFLAGS="$oldcppflags"
AC_SUBST(THEPEGINCLUDE)
AC_MSG_CHECKING([for HepMCAnalysis.so in ThePEG])
THEPEGHASHEPMC="no"
if test -e ${with_thepeg}/lib/ThePEG/HepMCAnalysis.so ; then
THEPEGHASHEPMC="yes"
fi
if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then
THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG"
if test -e ${with_thepeg}/lib64/ThePEG/HepMCAnalysis.so ; then
THEPEGHASHEPMC="yes"
fi
fi
if test "x$THEPEGHASHEPMC" == "xno" ; then
CREATE_HEPMC="# create"
AC_MSG_RESULT([not found])
else
CREATE_HEPMC="create"
AC_MSG_RESULT([found])
fi
AC_SUBST([CREATE_HEPMC])
AC_MSG_CHECKING([for RivetAnalysis.so in ThePEG])
THEPEGHASRIVET="no"
if test -e ${with_thepeg}/lib/ThePEG/RivetAnalysis.so ; then
THEPEGHASRIVET="yes"
fi
if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then
THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG"
if test -e ${with_thepeg}/lib64/ThePEG/RivetAnalysis.so ; then
THEPEGHASRIVET="yes"
fi
fi
if test "x$THEPEGHASRIVET" == "xno" ; then
CREATE_RIVET="# create"
AC_MSG_RESULT([not found])
else
CREATE_RIVET="create"
AC_MSG_RESULT([found])
fi
AC_SUBST([CREATE_RIVET])
])
dnl ##### LOOPTOOLS #####
AC_DEFUN([HERWIG_LOOPTOOLS],
[
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([HERWIG_COMPILERFLAGS])
AC_MSG_CHECKING([if Looptools build works])
enable_looptools=yes
if test "x$GCC" = "xyes"; then
case "${host}" in
x86_64-*|*-darwin1*)
AM_FCFLAGS="$AM_FCFLAGS -fdefault-integer-8"
;;
esac
AC_LANG_PUSH([Fortran])
oldFCFLAGS="$FCFLAGS"
FCFLAGS="$AM_FCFLAGS"
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([],[ print *[,]"Hello"]),
[],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([needs gfortran on 64bit machines])]
)
FCFLAGS="$oldFCFLAGS"
AC_LANG_POP([Fortran])
fi
AC_MSG_RESULT([$enable_looptools])
AC_SUBST([F77],[$FC])
AC_SUBST([FFLAGS],[$FCFLAGS])
AC_SUBST([AM_FFLAGS],[$AM_FCFLAGS])
AC_SUBST([FLIBS],[$FCLIBS])
])
dnl ##### VBFNLO #####
AC_DEFUN([HERWIG_CHECK_VBFNLO],
[
AC_MSG_CHECKING([for VBFNLO])
AC_ARG_WITH([vbfnlo],
AS_HELP_STRING([--with-vbfnlo=DIR], [Installation path of VBFNLO]),
[],
[with_vbfnlo=no]
)
AC_MSG_RESULT([$with_vbfnlo])
AS_IF([test "x$with_vbfnlo" != "xno"],
[AC_CHECK_FILES(
${with_vbfnlo}/lib/VBFNLO/libVBFNLO.so,
[have_vbfnlo=lib], [have_vbfnlo=no])],
[have_vbfnlo=no])
AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ],
[AC_CHECK_FILES(
${with_vbfnlo}/lib64/VBFNLO/libVBFNLO.so,
[have_vbfnlo=lib64], [have_vbfnlo=no])])
AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ],
[AC_CHECK_FILES(
${with_vbfnlo}/lib/VBFNLO/libVBFNLO.dylib,
[have_vbfnlo=lib], [have_vbfnlo=no])])
AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ],
[AC_CHECK_FILES(
${with_vbfnlo}/lib64/VBFNLO/libVBFNLO.dylib,
[have_vbfnlo=lib64], [have_vbfnlo=no])])
AS_IF([test "x$have_vbfnlo" = "xlib"],
[VBFNLOLIBS=${with_vbfnlo}/lib/VBFNLO
AC_SUBST(VBFNLOLIBS)
])
AS_IF([test "x$have_vbfnlo" = "xlib64"],
[VBFNLOLIBS=${with_vbfnlo}/lib64/VBFNLO
AC_SUBST(VBFNLOLIBS)
])
AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno"],
[AC_MSG_ERROR([vbfnlo requested but not found])])
AM_CONDITIONAL(HAVE_VBFNLO,[test "x$have_vbfnlo" = "xlib" -o "x$have_vbfnlo" = "xlib64"])
if test "x$have_vbfnlo" = "xlib" -o "x$have_vbfnlo" = "xlib64" ; then
VBFNLOINCLUDE=${with_vbfnlo}/include
AC_SUBST(VBFNLOINCLUDE)
VBFNLOLIB=${with_vbfnlo}/${have_vbfnlo}/VBFNLO
AC_SUBST(VBFNLOLIB)
LOAD_VBFNLO="library"
CREATE_VBFNLO="create"
INSERT_VBFNLO="insert"
SET_VBFNLO="set"
DO_VBFNLO="do"
MKDIR_VBFNLO="mkdir"
else
LOAD_VBFNLO="# library"
CREATE_VBFNLO="# create"
INSERT_VBFNLO="# insert"
SET_VBFNLO="# set"
DO_VBFNLO="# do"
MKDIR_VBFNLO="# mkdir"
fi
AC_SUBST([LOAD_VBFNLO])
AC_SUBST([CREATE_VBFNLO])
AC_SUBST([INSERT_VBFNLO])
AC_SUBST([SET_VBFNLO])
AC_SUBST([DO_VBFNLO])
AC_SUBST([MKDIR_VBFNLO])
])
dnl ##### njet #####
AC_DEFUN([HERWIG_CHECK_NJET],
[
AC_MSG_CHECKING([for njet])
AC_ARG_WITH([njet],
AS_HELP_STRING([--with-njet=DIR], [Installation path of njet]),
[],
[with_njet=no]
)
AC_MSG_RESULT([$with_njet])
AS_IF([test "x$with_njet" != "xno"],
[AC_CHECK_FILES(
${with_njet}/lib/libnjet2.so,
[have_njet=lib], [have_njet=no])],
[have_njet=no])
AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno" ],
[AC_CHECK_FILES(
${with_njet}/lib64/libnjet2.so,
[have_njet=lib64], [have_njet=no])])
AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno" ],
[AC_CHECK_FILES(
${with_njet}/lib/libnjet2.dylib,
[have_njet=lib], [have_njet=no])])
AS_IF([test "x$have_njet" = "xlib"],
[NJETLIBPATH=${with_njet}/lib
AC_SUBST(NJETLIBPATH)
NJETINCLUDEPATH=${with_njet}/include
AC_SUBST(NJETINCLUDEPATH)
NJETPREFIX=${with_njet}
AC_SUBST(NJETPREFIX)
])
AS_IF([test "x$have_njet" = "xlib64"],
[NJETLIBPATH=${with_njet}/lib64
AC_SUBST(NJETLIBPATH)
NJETINCLUDEPATH=${with_njet}/include
AC_SUBST(NJETINCLUDEPATH)
NJETPREFIX=${with_njet}
AC_SUBST(NJETPREFIX)
])
AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno"],
[AC_MSG_ERROR([njet requested but not found])])
AM_CONDITIONAL(HAVE_NJET,[test "x$have_njet" = "xlib" -o "x$have_njet" = "xlib64"])
if test "x$have_njet" = "xlib" -o "x$have_njet" = "xlib64" ; then
LOAD_NJET="library"
CREATE_NJET="create"
INSERT_NJET="insert"
DO_NJET="do"
else
LOAD_NJET="# library"
CREATE_NJET="# create"
INSERT_NJET="# insert"
DO_NJET="# do"
fi
AC_SUBST([LOAD_NJET])
AC_SUBST([CREATE_NJET])
AC_SUBST([INSERT_NJET])
AC_SUBST([DO_NJET])
])
dnl ##### gosam #####
AC_DEFUN([HERWIG_CHECK_GOSAM],
[
AC_MSG_CHECKING([for gosam])
AC_ARG_WITH([gosam],
AS_HELP_STRING([--with-gosam=DIR], [Installation path of gosam]),
[],
[with_gosam=no]
)
AC_MSG_RESULT([$with_gosam])
AS_IF([test "x$with_gosam" != "xno"],
[AC_CHECK_FILES(
${with_gosam}/bin/gosam.py,
[have_gosam=lib], [have_gosam=no])],
[have_gosam=no])
AS_IF([test "x$have_gosam" = "xlib"],
[GOSAMPREFIX=${with_gosam}
AC_SUBST(GOSAMPREFIX)
])
AS_IF([test "x$with_gosam" != "xno" -a "x$have_gosam" = "xno"],
[AC_MSG_ERROR([GoSam requested but not found])])
AM_CONDITIONAL(HAVE_GOSAM,[test "x$have_gosam" = "xlib" ])
if test "x$have_gosam" = "xlib" ; then
LOAD_GOSAM="library"
CREATE_GOSAM="create"
INSERT_GOSAM="insert"
DO_GOSAM="do"
else
LOAD_GOSAM="# library"
CREATE_GOSAM="# create"
INSERT_GOSAM="# insert"
DO_GOSAM="# do"
fi
AC_SUBST([LOAD_GOSAM])
AC_SUBST([CREATE_GOSAM])
AC_SUBST([INSERT_GOSAM])
AC_SUBST([DO_GOSAM])
])
dnl ##### gosam-contrib #####
AC_DEFUN([HERWIG_CHECK_GOSAM_CONTRIB],
[
AC_MSG_CHECKING([for gosam-contrib])
AC_ARG_WITH([gosam-contrib],
AS_HELP_STRING([--with-gosam-contrib=DIR], [Installation path of gosam-contrib]),
[],
[with_gosam_contrib=no]
)
AC_MSG_RESULT([$with_gosam_contrib])
AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"],
[AC_CHECK_FILES(
${with_gosam}/lib/libsamurai.so,
[with_gosam_contrib=${with_gosam}], [])
])
AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"],
[AC_CHECK_FILES(
${with_gosam}/lib64/libsamurai.so,
[with_gosam_contrib=${with_gosam}], [])
])
AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"],
[AC_CHECK_FILES(
${with_gosam}/lib/libsamurai.dylib,
[with_gosam_contrib=${with_gosam}], [])
])
AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"],
[AC_CHECK_FILES(
${with_gosam}/lib64/libsamurai.dylib,
[with_gosam_contrib=${with_gosam}], [])
])
AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"],
[AC_MSG_ERROR([GoSam requested without requesting GoSam-Contrib])])
AS_IF([test "x$with_gosam_contrib" != "xno"],
[AC_CHECK_FILES(
${with_gosam_contrib}/lib/libsamurai.so,
[have_gosam_contrib=lib], [have_gosam_contrib=no])],
[have_gosam_contrib=no])
AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ],
[AC_CHECK_FILES(
${with_gosam_contrib}/lib64/libsamurai.so,
[have_gosam_contrib=lib64], [have_gosam_contrib=no])])
AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ],
[AC_CHECK_FILES(
${with_gosam_contrib}/lib/libsamurai.dylib,
[have_gosam_contrib=lib], [have_gosam_contrib=no])])
AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ],
[AC_CHECK_FILES(
${with_gosam_contrib}/lib64/libsamurai.dylib,
[have_gosam_contrib=lib64], [have_gosam_contrib=no])])
AS_IF([test "x$have_gosam_contrib" != "xno"],
[GOSAMCONTRIBPREFIX=${with_gosam_contrib}
AC_SUBST(GOSAMCONTRIBPREFIX)
])
AS_IF([test "x$have_gosam_contrib" = "xlib"],
[GOSAMCONTRIBLIBS=${with_gosam_contrib}/lib
AC_SUBST(GOSAMCONTRIBLIBS)
])
AS_IF([test "x$have_gosam_contrib" = "xlib64"],
[GOSAMCONTRIBLIBS=${with_gosam_contrib}/lib64
AC_SUBST(GOSAMCONTRIBLIBS)
])
AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno"],
[AC_MSG_ERROR([GoSam-Contrib requested but not found])])
AM_CONDITIONAL(HAVE_GOSAM_CONTRIB,[test "x$have_gosam_contrib" = "xlib" -o "x$have_gosam_contrib" = "xlib64"])
if test "x$have_gosam_contrib" = "xlib" -o "x$have_gosam_contrib" = "xlib64" ; then
LOAD_GOSAM_CONTRIB="library"
CREATE_GOSAM_CONTRIB="create"
INSERT_GOSAM_CONTRIB="insert"
else
LOAD_GOSAM_CONTRIB="# library"
CREATE_GOSAM_CONTRIB="# create"
INSERT_GOSAM_CONTRIB="# insert"
fi
AC_SUBST([LOAD_GOSAM_CONTRIB])
AC_SUBST([CREATE_GOSAM_CONTRIB])
AC_SUBST([INSERT_GOSAM_CONTRIB])
])
dnl ##### OpenLoops #####
AC_DEFUN([HERWIG_CHECK_OPENLOOPS],
[
AC_MSG_CHECKING([for OpenLoops])
AC_ARG_WITH([openloops],
AS_HELP_STRING([--with-openloops=DIR], [Installation path of OpenLoops]),
[],
[with_openloops=no]
)
AC_MSG_RESULT([$with_openloops])
AS_IF([test "x$with_openloops" != "xno"],
[AC_CHECK_FILES(
${with_openloops}/lib/libopenloops.so,
[have_openloops=lib], [have_openloops=no])],
[have_openloops=no])
AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ],
[AC_CHECK_FILES(
${with_openloops}/lib/libopenloops.dylib,
[have_openloops=lib], [have_openloops=no])])
AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ],
[AC_CHECK_FILES(
${with_openloops}/lib64/libopenloops.so,
[have_openloops=lib64], [have_openloops=no])])
AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ],
[AC_CHECK_FILES(
${with_openloops}/lib64/libopenloops.dylib,
[have_openloops=lib64], [have_openloops=no])])
AS_IF([test "x$have_openloops" = "xlib"],
[OPENLOOPSLIBS=${with_openloops}/lib
AC_SUBST(OPENLOOPSLIBS)
])
AS_IF([test "x$have_openloops" = "xlib64"],
[OPENLOOPSLIBS=${with_openloops}/lib64
AC_SUBST(OPENLOOPSLIBS)
])
AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno"],
[AC_MSG_ERROR([OpenLoops requested but not found])])
AM_CONDITIONAL(HAVE_OPENLOOPS,[test "x$have_openloops" = "xlib" -o "x$have_openloops" = "xlib64"])
if test "x$have_openloops" = "xlib" -o "x$have_openloops" = "xlib64" ; then
OPENLOOPSPREFIX=${with_openloops}
LOAD_OPENLOOPS="library"
CREATE_OPENLOOPS="create"
INSERT_OPENLOOPS="insert"
SET_OPENLOOPS="set"
DO_OPENLOOPS="do"
MKDIR_OPENLOOPS="mkdir"
else
LOAD_OPENLOOPS="# library"
CREATE_OPENLOOPS="# create"
INSERT_OPENLOOPS="# insert"
SET_OPENLOOPS="# set"
DO_OPENLOOPS="# do"
MKDIR_OPENLOOPS="# mkdir"
fi
AC_SUBST([OPENLOOPSPREFIX])
AC_SUBST([LOAD_OPENLOOPS])
AC_SUBST([CREATE_OPENLOOPS])
AC_SUBST([INSERT_OPENLOOPS])
AC_SUBST([SET_OPENLOOPS])
AC_SUBST([DO_OPENLOOPS])
AC_SUBST([MKDIR_OPENLOOPS])
])
#########################################
dnl ##### madgraph #####
AC_DEFUN([HERWIG_CHECK_MADGRAPH],
[
AC_MSG_CHECKING([for MadGraph])
AC_ARG_WITH([madgraph],
AS_HELP_STRING([--with-madgraph=DIR], [Installation path of MadGraph]),
[],
[with_madgraph=no]
)
AC_MSG_RESULT([$with_madgraph])
AS_IF([test "x$with_madgraph" != "xno"],
[AC_CHECK_FILES(
${with_madgraph}/bin/mg5_aMC,
[have_madgraph=yes], [have_madgraph=no])],
[have_madgraph=no])
AS_IF([test "x$have_madgraph" = "xyes"],
[MADGRAPHPREFIX=${with_madgraph}
AC_SUBST(MADGRAPHPREFIX)
])
AS_IF([test "x$with_madgraph" != "xno" -a "x$have_madgraph" = "xno"],
[AC_MSG_ERROR([MadGraph requested but not found])])
AM_CONDITIONAL(HAVE_MADGRAPH,[test "x$have_madgraph" = "xyes" ])
if test "x$have_madgraph" = "xyes" ; then
LOAD_MADGRAPH="library"
CREATE_MADGRAPH="create"
INSERT_MADGRAPH="insert"
SET_MADGRAPH="set"
DO_MADGRAPH="do"
else
LOAD_MADGRAPH="# library"
CREATE_MADGRAPH="# create"
INSERT_MADGRAPH="# insert"
SET_MADGRAPH="# set"
DO_MADGRAPH="# do"
fi
AC_SUBST([LOAD_MADGRAPH])
AC_SUBST([CREATE_MADGRAPH])
AC_SUBST([INSERT_MADGRAPH])
AC_SUBST([SET_MADGRAPH])
AC_SUBST([DO_MADGRAPH])
])
dnl ##### EvtGen #####
AC_DEFUN([HERWIG_CHECK_EVTGEN],
[
AC_MSG_CHECKING([for evtgen])
AC_ARG_WITH([evtgen],
AS_HELP_STRING([--with-evtgen=DIR], [Installation path of EvtGen]),
[],
[with_evtgen=no]
)
AC_MSG_RESULT([$with_evtgen])
AS_IF([test "x$with_evtgen" != "xno"],
[AC_CHECK_FILES(
- ${with_evtgen}/lib/libEvtGen.so,
+ ${with_evtgen}/lib/libEvtGenExternal.so,
[have_evtgen=lib], [have_evtgen=no])],
[have_evtgen=no])
AS_IF([test "x$have_evtgen" = "xlib"],
[EVTGENPREFIX=${with_evtgen}
AC_SUBST(EVTGENPREFIX)
])
AS_IF([test "x$with_evtgen" != "xno" -a "x$have_evtgen" = "xno"],
[AC_MSG_ERROR([EvtGen requested but not found])])
AM_CONDITIONAL(HAVE_EVTGEN,[test "x$have_evtgen" = "xlib" ])
if test "x$have_evtgen" = "xlib" ; then
LOAD_EVTGEN="library"
CREATE_EVTGEN="create"
INSERT_EVTGEN="insert"
DO_EVTGEN="do"
+ EVTGENLIBS="-L$with_evtgen/lib -lEvtGen -lEvtGenExternal"
else
LOAD_EVTGEN="# library"
CREATE_EVTGEN="# create"
INSERT_EVTGEN="# insert"
DO_EVTGEN="# do"
+ EVTGENLIBS=""
fi
AC_SUBST([LOAD_EVTGEN])
AC_SUBST([CREATE_EVTGEN])
AC_SUBST([INSERT_EVTGEN])
AC_SUBST([DO_EVTGEN])
+AC_SUBST([EVTGENLIBS])
])
dnl ##### PDF PATH #####
AC_DEFUN([HERWIG_PDF_PATH],
[
AC_MSG_CHECKING([which Herwig++ PDF data to use])
AC_ARG_WITH(pdf,
AC_HELP_STRING([--with-pdf=DIR],[installation path of Herwig++PDF data tarball]),
[],
[with_pdf=${prefix}]
)
HERWIG_PDF_PREFIX=${with_pdf}/share/Herwig++PDF
if test -f "${HERWIG_PDF_PREFIX}/mrst/2008/mrstMCal.dat"; then
AC_MSG_RESULT([$with_pdf])
localPDFneeded=false
else
AC_MSG_RESULT([Using built-in PDF data set. For other data sets, set --with-pdf.])
HERWIG_PDF_PREFIX=PDF
localPDFneeded=true
fi
HERWIG_PDF_DEFAULT=${HERWIG_PDF_PREFIX}/mrst/2008/mrstMCal.dat
HERWIG_PDF_NLO=${HERWIG_PDF_PREFIX}/mrst/2002/mrst2002nlo.dat
HERWIG_PDF_POMERON=${HERWIG_PDF_PREFIX}/diffraction/
AM_CONDITIONAL(WANT_LOCAL_PDF,[test "x$localPDFneeded" = "xtrue"])
AC_SUBST(HERWIG_PDF_DEFAULT)
AC_SUBST(HERWIG_PDF_NLO)
AC_SUBST(HERWIG_PDF_POMERON)
])
dnl ###### GSL ######
AC_DEFUN([HERWIG_CHECK_GSL],
[
AC_MSG_CHECKING([for gsl location])
GSLINCLUDE=""
GSLLIBS=""
AC_ARG_WITH(gsl,
AC_HELP_STRING([--with-gsl=DIR],[location of gsl installation @<:@default=system libs@:>@]),
[],
[with_gsl=system])
if test "x$with_gsl" = "xno"; then
AC_MSG_ERROR([libgsl is required. Please install the GNU scientific library and header files.])
fi
if test "x$with_gsl" = "xsystem"; then
AC_MSG_RESULT([in system libraries])
oldlibs="$LIBS"
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(gslcblas,main)
AC_CHECK_LIB(gsl,main,[],
[
AC_MSG_ERROR([Cannot find libgsl. Please install the GNU scientific library and header files or use --with-gsl=.])
]
)
GSLLIBS="$LIBS"
GSLPATH="$with_gsl"
LIBS=$oldlibs
else
if test "`uname -m`" = "x86_64" -a -e "$with_gsl/lib64/libgsl.a" -a -d "$with_gsl/include/gsl"; then
AC_MSG_RESULT([found in $with_gsl])
GSLLIBS="-L$with_gsl/lib64 -R$with_gsl/lib64 -lgslcblas -lgsl"
GSLINCLUDE="-I$with_gsl/include"
GSLPATH="$with_gsl"
elif test -e "$with_gsl/lib/libgsl.a" -a -d "$with_gsl/include/gsl"; then
AC_MSG_RESULT([found in $with_gsl])
GSLLIBS="-L$with_gsl/lib -R$with_gsl/lib -lgslcblas -lgsl"
GSLINCLUDE="-I$with_gsl/include"
GSLPATH="$with_gsl"
else
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Can't find $with_gsl/lib/libgsl.a or the headers in $with_gsl/include])
fi
fi
AC_SUBST(GSLINCLUDE)
AC_SUBST(GSLLIBS)
AC_SUBST(GSLPATH)
])
dnl ##### COMPILERFLAGS #####
AC_DEFUN([HERWIG_COMPILERFLAGS],
[
AC_REQUIRE([HERWIG_CHECK_GSL])
AC_REQUIRE([HERWIG_CHECK_THEPEG])
AC_REQUIRE([BOOST_REQUIRE])
AC_REQUIRE([AX_COMPILER_VENDOR])
AM_CPPFLAGS="-I\$(top_builddir)/include $THEPEGINCLUDE \$(GSLINCLUDE) \$(BOOST_CPPFLAGS)"
AC_MSG_CHECKING([for debugging mode])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[debug mode, use --enable-debug=slow for additional options that slow down the run.]),
[],
[enable_debug=no]
)
AC_MSG_RESULT([$enable_debug])
if test "x$enable_debug" = "xno"; then
debugflags=""
else
debugflags="-g"
fi
dnl -Wfloat-equal -fvisibility-inlines-hidden -Wctor-dtor-privacy -Weffc++
if test -n "$GCC"; then
warnflags="-ansi -pedantic -Wall -Wextra -Wno-overloaded-virtual"
if test "x$enable_debug" = "xslow"; then
debugflags="$debugflags -fno-inline"
AM_CPPFLAGS="$AM_CPPFLAGS -D_GLIBCXX_DEBUG"
fi
fi
dnl do an actual capability check on ld instead of this workaround
case "${host}" in
*-darwin*)
;;
*)
AM_LDFLAGS="-Wl,--enable-new-dtags"
;;
esac
case "${ax_cv_cxx_compiler_vendor}" in
gnu)
AM_CXXFLAGS="-ansi -pedantic -Wall -W"
;;
clang)
AM_CXXFLAGS="-ansi -pedantic -Wall -Wno-overloaded-virtual -Wno-unused-function"
dnl -Wno-unneeded-internal-declaration
;;
intel)
AM_CXXFLAGS="-strict-ansi -Wall -wd13000,1418,981,444,383,1599,1572,2259,980"
;;
esac
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CFLAGS, ["$warnflags $debugflags"])
AC_SUBST(AM_CXXFLAGS,["$AM_CXXFLAGS $warnflags $debugflags"])
AC_SUBST(AM_FCFLAGS, ["$debugflags"])
AC_SUBST(AM_LDFLAGS)
])
AC_DEFUN([HERWIG_ENABLE_MODELS],
[
AC_MSG_CHECKING([if BSM models should be built])
AC_ARG_ENABLE(models,
AC_HELP_STRING([--disable-models],[Turn off compilation of BSM models.]),
[],
[enable_models=yes]
)
AC_MSG_RESULT([$enable_models])
LOAD_BSM=""
if test "$enable_models" = "yes"; then
LOAD_BSM="read BSMlibs.in"
fi
AC_SUBST(LOAD_BSM)
AM_CONDITIONAL(WANT_BSM,[test "$enable_models" = "yes"])
])
AC_DEFUN([HERWIG_OVERVIEW],
[
FCSTRING=`$FC --version | head -1`
CXXSTRING=`$CXX --version | head -1`
CCSTRING=`$CC --version | head -1`
if test "x$PYTHON" != "x:"
then
python_was_found="yes, using Python $PYTHON_VERSION"
else
python_was_found="no, requires Python >= 2.6"
fi
cat << _HW_EOF_ > config.herwig
*****************************************************
*** $PACKAGE_STRING configuration summary
*** Please include this information in bug reports!
***--------------------------------------------------
*** Prefix: $prefix
***
*** BSM models: $enable_models
*** UFO converter: ${python_was_found}
***
*** Herwig debug mode: $enable_debug
***
*** ThePEG: $with_thepeg
*** ThePEG headers: $with_thepeg_headers
***
*** GoSam: $with_gosam
*** GoSam-Contrib: $with_gosam_contrib
*** MadGraph: $with_madgraph
*** njet: $with_njet
*** OpenLoops: $with_openloops
*** VBFNLO: $with_vbfnlo
***
*** EvtGen: $with_evtgen
*** GSL: $with_gsl
*** boost: ${BOOST_CPPFLAGS:-system}
*** Fastjet: ${fjconfig}
***
*** Host: $host
*** CC: $CCSTRING
*** CXX: $CXXSTRING
*** FC: $FCSTRING
***
*** CXXFLAGS: $CXXFLAGS
*****************************************************
_HW_EOF_
])

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 3:47 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3796496
Default Alt Text
(80 KB)

Event Timeline