Page MenuHomeHEPForge

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/.hgignore b/.hgignore
new file mode 100644
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,84 @@
+syntax: glob
+*~
+*.so
+*.Plo
+*.la
+*.lai
+*.so.*
+*.a
+*.o
+*.lo
+Makefile
+Makefile.in
+*.codereplace
+include/*
+*.{out,log,run,tex}
+*-BR.spc
+Config/config.{guess,h,h.in,sub}
+\.svn/.*
+.*/Makefile
+.*/Makefile\.in
+.*/\.deps
+.*/\.libs
+.*/.*\.l[ao]
+.*/.*\.so\.*
+.*/.*\.o
+.*~
+autom4te.cache
+config.herwig
+config.log
+config.status
+configure
+include/Herwig\+\+
+Config/config.guess
+Config/config.h
+Config/config.h.in
+Config/config.sub
+Config/depcomp
+Config/install-sh
+Config/missing
+Config/stamp-h1
+Contrib/make_makefiles.sh
+Doc/HerwigDefaults.in
+Doc/fixinterfaces.pl
+Doc/refman.conf
+Doc/refman.h
+(src|Utilities)/version.tmp
+(src|Utilities)/version.tmp.new
+INSTALL
+*.Po
+Makefile
+Makefile.in
+Utilities/versionstring.h
+aclocal.m4
+autom4te.cache/output.{0,1}
+autom4te.cache/requests
+autom4te.cache/traces.{0,1}
+config.herwig
+config.status
+configure
+confdefs.h
+conftest.c
+conftest.err
+include/done-all-links
+libtool
+src/herwigopts.h
+src/herwigopts.c
+src/defaults/Analysis.in
+src/herwig-config
+src/.*\.(run|tex|out|log|rpo|spc|top|dump|dot|aux|pdf|ps|png|svg)
+lib/done-all-links
+libtool
+src/Herwig++
+src/HerwigDefaults.rpo
+src/Makefile-UserModules
+src/defaults/Analysis.in
+src/Herwig\+\+
+src/defaults/PDF.in
+src/defaults/done-all-links
+src/herwig-config
+src/versionstring.h
+src/versionstring.h
+src/tune
+src/tests/.*\.(time|mult|Bmult|chisq)
+Tests/.*/.*\.(top|ps|pyc|info)
diff --git a/AUTHORS b/AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,28 +1,34 @@
============
Herwig++ 2.5
============
Please contact <herwig@projects.hepforge.org> for any queries.
========
Authors:
========
-Manuel Baehr
Stefan Gieseke
-Martyn Gigg
David Grellscheid
Keith Hamilton
-Seyi Latunde-Dada
+Andreas Papaefstathiou
Simon Plaetzer
Peter Richardson
Christian Roehr
+Pavel Ruzicka
+Alex Schofield
Mike Seymour
-Alexander Sherstnev
-Jon Tully
+Andrzej Siódmok
+Louise Suter
Bryan Webber
+David Winn
===============
Former authors:
===============
+Manuel Baehr
+Martyn Gigg
+Seyi Latunde-Dada
Alberto Ribon
Philip Stephens
+Alexander Sherstnev
+Jon Tully
diff --git a/Analysis/BasicConsistency.cc b/Analysis/BasicConsistency.cc
--- a/Analysis/BasicConsistency.cc
+++ b/Analysis/BasicConsistency.cc
@@ -1,323 +1,323 @@
// -*- C++ -*-
//
// BasicConsistency.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the BasicConsistency class.
//
#include "BasicConsistency.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/EventRecord/Event.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Utilities/EnumParticles.h"
#include "ThePEG/PDT/DecayMode.h"
using namespace Herwig;
using namespace ThePEG;
BasicConsistency::BasicConsistency()
: _epsmom(ZERO),_checkquark(true), _checkcharge(true),
_checkcluster(true), _checkBR(true),
_absolutemomentumtolerance(1*MeV), _relativemomentumtolerance(1e-5)
{}
IBPtr BasicConsistency::clone() const {
return new_ptr(*this);
}
IBPtr BasicConsistency::fullclone() const {
return new_ptr(*this);
}
void BasicConsistency::analyze(tEventPtr event, long, int, int) {
bool writeEvent=false;
set<tcPPtr> particles;
event->selectFinalState(inserter(particles));
int charge(-event->incoming().first->dataPtr()->iCharge()
-event->incoming().second->dataPtr()->iCharge());
Lorentz5Momentum
ptotal(-event->incoming().first->momentum()
-event->incoming().second->momentum());
const Energy beamenergy = ptotal.m();
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
if (_checkquark && (*it)->coloured()) {
cerr << "Had quarks in final state in event "
<< event->number()
<< '\n';
generator()->log() << "Had quarks in final state in event "
<< event->number() << '\n';
writeEvent = true;
}
- else if( _checkcluster && (**it).id()==ExtraParticleID::Cluster) {
+ else if( _checkcluster && (**it).id()==ParticleID::Cluster) {
cerr << "Had clusters in final state in event "
<< event->number()
<< '\n';
generator()->log() << "Had clusters in final state in event "
<< event->number() << '\n';
writeEvent = true;
}
charge += (*it)->dataPtr()->iCharge();
ptotal += (*it)->momentum();
bool problem=false;
LorentzDistance test;
for(unsigned int ix=0;ix<5;++ix) {
switch (ix) {
case 0:
test = (*it)->vertex();
break;
case 1:
test = (*it)->labVertex();
break;
case 2:
test = (*it)->decayVertex();
break;
case 3:
test = (*it)->labDecayVertex();
break;
case 4:
test = (*it)->lifeLength();
break;
}
problem |=
isnan(test.x()/mm) || isnan(test.y()/mm) ||
isnan(test.z()/mm) || isnan(test.t()/mm) ||
isinf(test.x()/mm) || isinf(test.y()/mm) ||
isinf(test.z()/mm) || isinf(test.t()/mm);
}
if(problem) {
generator()->log() << "Problem with position of " << **it << "\n"
<< (*it)->vertex()/mm << "\n"
<< (*it)->labVertex()/mm << "\n"
<< (*it)->decayVertex()/mm << "\n"
<< (*it)->labDecayVertex()/mm << "\n"
<< (*it)->lifeLength()/mm << "\n";
}
}
if ( _checkcharge && charge != 0 ) {
cerr << "\nCharge imbalance by "
<< charge
<< "in event "
<< event->number()
<< '\n';
generator()->log() << "Charge imbalance by "
<< charge
<< "in event "
<< event->number() << '\n';
writeEvent = true;
}
Energy mag = ptotal.m();
Energy ee = ptotal.e();
if (isnan(mag/MeV)) {
cerr << "\nMomentum is 'nan'; " << ptotal/MeV
<< " MeV in event " << event->number() << '\n';
generator()->log() <<"\nMomentum is 'nan'; " << ptotal/MeV
<< " MeV in event " << event->number() << '\n';
writeEvent = true;
}
const Energy epsilonmax = max( _absolutemomentumtolerance,
_relativemomentumtolerance * beamenergy );
if (abs(mag) > epsilonmax || abs(ee) > epsilonmax) {
cerr << "\nMomentum imbalance by " << ptotal/MeV
<< " MeV in event " << event->number() << '\n';
generator()->log() <<"\nMomentum imbalance by " << ptotal/MeV
<< " MeV in event " << event->number() << '\n';
writeEvent = true;
}
if (abs(mag) > _epsmom)
_epsmom = abs(mag);
if (abs(ee) > _epsmom)
_epsmom = abs(ee);
if (abs(ptotal.x()) > _epsmom)
_epsmom = abs(ptotal.x());
if (abs(ptotal.y()) > _epsmom)
_epsmom = abs(ptotal.y());
if (abs(ptotal.z()) > _epsmom)
_epsmom = abs(ptotal.z());
particles.clear();
event->select(inserter(particles), ThePEG::AllSelector());
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
bool problem=false;
LorentzDistance test;
for(unsigned int ix=0;ix<5;++ix) {
switch (ix) {
case 0:
test = (*it)->vertex();
break;
case 1:
test = (*it)->labVertex();
break;
case 2:
test = (*it)->decayVertex();
break;
case 3:
test = (*it)->labDecayVertex();
break;
case 4:
test = (*it)->lifeLength();
break;
}
problem |= isnan(test.m2()/mm/mm) || isinf(test.m2()/mm/mm);
}
if(problem) {
generator()->log() << "Problem with position of " << **it << "\n"
<< (*it)->vertex()/mm << "\n"
<< (*it)->labVertex()/mm << "\n"
<< (*it)->decayVertex()/mm << "\n"
<< (*it)->labDecayVertex()/mm << "\n"
<< (*it)->lifeLength()/mm << "\n";
writeEvent=true;
}
}
if(writeEvent) generator()->log() << *event;
}
void BasicConsistency::persistentOutput(PersistentOStream & os) const {
os << _checkquark << _checkcharge << _checkcluster << _checkBR
<< ounit(_absolutemomentumtolerance,MeV) << _relativemomentumtolerance;
}
void BasicConsistency::persistentInput(PersistentIStream & is, int) {
is >> _checkquark >> _checkcharge >> _checkcluster >> _checkBR
>> iunit(_absolutemomentumtolerance,MeV) >> _relativemomentumtolerance;
}
ClassDescription<BasicConsistency> BasicConsistency::initBasicConsistency;
// Definition of the static class description member.
void BasicConsistency::Init() {
static ClassDocumentation<BasicConsistency> documentation
("The BasicConsistency analysis handler checks for"
" momentum and charge conservation.");
static Switch<BasicConsistency,bool> interfaceCheckQuark
("CheckQuark",
"Check whether there are quarks in the final state",
&BasicConsistency::_checkquark, true, false, false);
static SwitchOption interfaceCheckQuarkCheck
(interfaceCheckQuark,
"Yes",
"Check for quarks",
true);
static SwitchOption interfaceCheckQuarkNoCheck
(interfaceCheckQuark,
"No",
"Don't check for quarks",
false);
static Switch<BasicConsistency,bool> interfaceCheckCharge
("CheckCharge",
"Check whether charge is conserved",
&BasicConsistency::_checkcharge, true, false, false);
static SwitchOption interfaceCheckChargeCheck
(interfaceCheckCharge,
"Yes",
"Check charge conservation",
true);
static SwitchOption interfaceCheckChargeNoCheck
(interfaceCheckCharge,
"No",
"Don't check charge conservation",
false);
static Switch<BasicConsistency,bool> interfaceCheckCluster
("CheckCluster",
"Check whether there are clusters in the final state",
&BasicConsistency::_checkcluster, true, false, false);
static SwitchOption interfaceCheckClusterCheck
(interfaceCheckCluster,
"Yes",
"Check for clusters",
true);
static SwitchOption interfaceCheckClusterNoCheck
(interfaceCheckCluster,
"No",
"Don't check for clusters",
false);
static Switch<BasicConsistency,bool> interfaceCheckBranchingRatios
("CheckBranchingRatios",
"Check whether the branching ratios of the particles add up to one.",
&BasicConsistency::_checkBR, true, false, false);
static SwitchOption interfaceCheckBranchingRatiosYes
(interfaceCheckBranchingRatios,
"Yes",
"Perform the check",
true);
static SwitchOption interfaceCheckBranchingRatiosNo
(interfaceCheckBranchingRatios,
"No",
"Don't perform the check",
false);
static Parameter<BasicConsistency,Energy> interfaceAbsoluteMomentumTolerance
("AbsoluteMomentumTolerance",
"The value of the momentum imbalance above which warnings are issued/MeV.\n"
"Final tolerance is the larger of AbsoluteMomentumTolerance and\n"
"RelativeMomentumTolerance*beam energy.",
&BasicConsistency::_absolutemomentumtolerance, MeV, 1*MeV, ZERO, 1e10*GeV,
false, false, true);
static Parameter<BasicConsistency,double> interfaceRelativeMomentumTolerance
("RelativeMomentumTolerance",
"The value of the momentum imbalance as a fraction of the beam energy\n"
"above which warnings are issued.\n"
"Final tolerance is the larger of AbsoluteMomentumTolerance and\n"
"RelativeMomentumTolerance*beam energy.",
&BasicConsistency::_relativemomentumtolerance, 1e-5, 0.0, 1.0,
false, false, true);
}
void BasicConsistency::dofinish() {
AnalysisHandler::dofinish();
cout << "\nBasicConsistency: maximum 4-momentum violation: "
<< _epsmom/MeV << " MeV\n";
}
void BasicConsistency::doinitrun() {
AnalysisHandler::doinitrun();
static double eps=1e-12;
for(ParticleMap::const_iterator it=generator()->particles().begin();
it!=generator()->particles().end();++it) {
if(it->second->stable()) continue;
double total(0.);
for(DecaySet::const_iterator dit=it->second->decayModes().begin();
dit!=it->second->decayModes().end();++dit) {
if((**dit).on()) total +=(**dit).brat();
}
if(abs(total-1.)>eps) {
cerr << "Warning: Total BR for "
<< it->second->PDGName()
<< " does not add up to 1. sum = " << total << "\n";
}
}
}
diff --git a/Analysis/LEPMultiplicityCount.cc b/Analysis/LEPMultiplicityCount.cc
--- a/Analysis/LEPMultiplicityCount.cc
+++ b/Analysis/LEPMultiplicityCount.cc
@@ -1,421 +1,421 @@
// -*- C++ -*-
//
// LEPMultiplicityCount.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the LEPMultiplicityCount class.
//
#include "LEPMultiplicityCount.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/EventRecord/StandardSelectors.h"
#include "ThePEG/EventRecord/Event.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Utilities/EnumParticles.h"
#include "Herwig++/Hadronization/Cluster.h"
#include <iostream>
#include <sstream>
#include <fstream>
using namespace Herwig;
using namespace ThePEG;
IBPtr LEPMultiplicityCount::clone() const {
return new_ptr(*this);
}
IBPtr LEPMultiplicityCount::fullclone() const {
return new_ptr(*this);
}
LEPMultiplicityCount::LEPMultiplicityCount() : _makeHistograms(false)
{
// Average particle multiplicities in hadronic Z decay
// PDG 2006 with 2007 partial update
// all charged
_data[0] = MultiplicityInfo(20.76, 0.16, lightMeson); // all charged
// gamma
_data[22] = MultiplicityInfo(20.97, 1.17, lightMeson);
// pi+, pi0, eta
_data[211] = MultiplicityInfo(17.03, 0.16, lightMeson);
_data[111] = MultiplicityInfo( 9.76, 0.26, lightMeson);
_data[221] = MultiplicityInfo( 1.01, 0.08, lightMeson);
// rho+, rho0, omega, eta'
_data[213] = MultiplicityInfo( 2.40, 0.49, lightMeson);
_data[113] = MultiplicityInfo( 1.24, 0.10, lightMeson);
_data[223] = MultiplicityInfo( 1.02, 0.06, lightMeson);
_data[331] = MultiplicityInfo( 0.17, 0.05, lightMeson);
// f_0(980), a_0(980), phi
_data[10221] = MultiplicityInfo(0.147, 0.011, other);
_data[9000211] = MultiplicityInfo(0.27, 0.14, other);
_data[333] = MultiplicityInfo(0.098, 0.006, strangeMeson);
// f_2(1270), f_1(1285), f_2'(1525), K+, K0
_data[225] = MultiplicityInfo(0.169, 0.025, other);
_data[20223] = MultiplicityInfo(0.165, 0.051, other);
_data[335] = MultiplicityInfo(0.012, 0.006, other);
_data[321] = MultiplicityInfo(2.24, 0.04, strangeMeson);
_data[311] = MultiplicityInfo(2.039, 0.025, lightMeson);
// K*+(892), K*0(892), K*_2(1430)
_data[323] = MultiplicityInfo(0.72, 0.05, strangeMeson);
_data[313] = MultiplicityInfo(0.739, 0.022, strangeMeson);
_data[315] = MultiplicityInfo(0.073, 0.023, strangeMeson);
// D+, D0, D_s+
_data[411] = MultiplicityInfo(0.187, 0.020, other);
_data[421] = MultiplicityInfo(0.462, 0.026, other);
_data[431] = MultiplicityInfo(0.131, 0.028, other);
// D*+(2010), J/Psi(1S), Psi(2S)
_data[413] = MultiplicityInfo(0.183, 0.008, other);
_data[443] = MultiplicityInfo(0.0056, 0.0007, other);
_data[100443] = MultiplicityInfo(0.0023, 0.0007, other);
// p, Delta++(1232), Lambda, Sigma+, Sigma-, Sigma0
_data[2212] = MultiplicityInfo(1.046, 0.026, lightBaryon);
_data[2224] = MultiplicityInfo(0.087, 0.033, lightBaryon);
_data[3122] = MultiplicityInfo(0.388, 0.009, lightBaryon);
_data[3222] = MultiplicityInfo(0.107, 0.010, lightBaryon);
_data[3112] = MultiplicityInfo(0.082, 0.007, lightBaryon);
_data[3212] = MultiplicityInfo(0.076, 0.010, lightBaryon);
// Sigma*+, Sigma*-, Xi-, Xi*0, Omega-
_data[3224] = MultiplicityInfo(0.0239, 0.0021, lightBaryon);
_data[3114] = MultiplicityInfo(0.0240, 0.0024, lightBaryon);
_data[3312] = MultiplicityInfo(0.0258, 0.0009, lightBaryon);
_data[3324] = MultiplicityInfo(0.0059, 0.0011, lightBaryon);
_data[3334] = MultiplicityInfo(0.00164, 0.00028, lightBaryon);
// Lambda_c+
_data[4122] = MultiplicityInfo(0.078, 0.024, other);
// old values from 1.0 paper
// _data[433] = MultiplicityInfo(0.096, 0.046, other);
_data[2112] = MultiplicityInfo(0.991, 0.054, lightBaryon);
// _data[2214] = MultiplicityInfo(0., 0., lightBaryon);
// _data[2114] = MultiplicityInfo(0., 0., lightBaryon);
// values unknown
// B mesons
// _data[513] = MultiplicityInfo(0.28, 0.04, other); // flavour averaged value!
_data[513] = MultiplicityInfo(0., 0., other);
_data[511] = MultiplicityInfo(0., 0., other); // B0
_data[521] = MultiplicityInfo(0., 0., other); // B+
_data[531] = MultiplicityInfo(0., 0., other); // B_s
_data[541] = MultiplicityInfo(0., 0., other); // B_c
// B baryons
_data[5122] = MultiplicityInfo(0., 0., other); // Lambda_b
_data[5112] = MultiplicityInfo(0., 0., other); // Sig_b-
_data[5212] = MultiplicityInfo(0., 0., other); // Sig_b0
_data[5222] = MultiplicityInfo(0., 0., other); // Sig_b+
_data[5132] = MultiplicityInfo(0., 0., other); // Xi_b-
_data[5232] = MultiplicityInfo(0., 0., other); // Xi_b0
_data[5312] = MultiplicityInfo(0., 0., other); // Xi'_b-
_data[5322] = MultiplicityInfo(0., 0., other); // Xi'_b0
_data[5332] = MultiplicityInfo(0., 0., other); // Omega_b-
}
namespace {
bool isLastCluster(tcPPtr p) {
- if ( p->id() != ExtraParticleID::Cluster )
+ if ( p->id() != ParticleID::Cluster )
return false;
for ( size_t i = 0, end = p->children().size();
i < end; ++i ) {
- if ( p->children()[i]->id() == ExtraParticleID::Cluster )
+ if ( p->children()[i]->id() == ParticleID::Cluster )
return false;
}
return true;
}
Energy parentClusterMass(tcPPtr p) {
if (p->parents().empty())
return -1.0*MeV;
tcPPtr parent = p->parents()[0];
- if (parent->id() == ExtraParticleID::Cluster) {
+ if (parent->id() == ParticleID::Cluster) {
if ( isLastCluster(parent) )
return parent->mass();
else
return p->mass();
}
else
return parentClusterMass(parent);
}
bool isPrimaryCluster(tcPPtr p) {
- if ( p->id() != ExtraParticleID::Cluster )
+ if ( p->id() != ParticleID::Cluster )
return false;
if( p->parents().empty())
return false;
for ( size_t i = 0, end = p->parents().size();
i < end; ++i ) {
if ( !(p->parents()[i]->dataPtr()->coloured()) )
return false;
}
return true;
}
}
void LEPMultiplicityCount::analyze(tEventPtr event, long, int, int) {
set<tcPPtr> particles;
event->selectFinalState(inserter(particles));
map <long,long> eventcount;
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
if((*it)->dataPtr()->charged())
++eventcount[0];
long ID = abs( (*it)->id() );
++_finalstatecount[ID];
}
// ========
StepVector steps = event->primaryCollision()->steps();
particles.clear();
steps[0]->select(inserter(particles), ThePEG::AllSelector());
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
long ID = (*it)->id();
++_collisioncount[ID];
}
// =======
particles.clear();
if (steps.size() > 2) {
for ( StepVector::const_iterator it = steps.begin()+2;
it != steps.end(); ++it ) {
(**it).select(inserter(particles), ThePEG::AllSelector());
}
}
if( _makeHistograms )
- _histograms.insert(make_pair(ExtraParticleID::Cluster,
+ _histograms.insert(make_pair(ParticleID::Cluster,
Histogram(0.0,10.0,200)));
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
long ID = abs( (*it)->id() );
if(ID==ParticleID::K0) continue;
if(ID==ParticleID::K_L0||ID==ParticleID::K_S0) ID=ParticleID::K0;
if ( _makeHistograms && isLastCluster(*it) ) {
- _histograms[ExtraParticleID::Cluster] += (*it)->mass()/GeV;
+ _histograms[ParticleID::Cluster] += (*it)->mass()/GeV;
tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it);
if (clu) {
_clusters.insert(make_pair(clu->clusterId(), Histogram(0.0,10.0,200)));
_clusters[clu->clusterId()] += (*it)->mass()/GeV;
}
}
if( _makeHistograms && isPrimaryCluster(*it) ) {
_primary.insert(make_pair(0, Histogram(0.0,20.0,400)));
_primary[0] += (*it)->mass()/GeV;
tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it);
if(clu) {
_primary.insert(make_pair(clu->clusterId(), Histogram(0.0,20.0,400)));
_primary[clu->clusterId()] += (*it)->mass()/GeV;
}
}
if (_data.find(ID) != _data.end()) {
++eventcount[ID];
if (_makeHistograms
&& ! (*it)->parents().empty()
- && (*it)->parents()[0]->id() == ExtraParticleID::Cluster) {
+ && (*it)->parents()[0]->id() == ParticleID::Cluster) {
_histograms.insert(make_pair(ID,Histogram(0.0,10.0,200)));
_histograms[ID] += parentClusterMass(*it)/GeV;
}
}
}
for(map<long,MultiplicityInfo>::iterator it = _data.begin();
it != _data.end(); ++it) {
long currentcount
= eventcount.find(it->first) == eventcount.end() ? 0
: eventcount[it->first];
it->second.count += currentcount;
}
}
void LEPMultiplicityCount::analyze(const tPVector & ) {}
void LEPMultiplicityCount::dofinish() {
useMe();
string filename = generator()->filename() + ".mult";
ofstream outfile(filename.c_str());
outfile <<
"\nParticle multiplicities (compared to LEP data):\n"
" ID Name simMult obsMult obsErr Sigma\n";
for (map<long,MultiplicityInfo>::const_iterator it = _data.begin();
it != _data.end();
++it)
{
MultiplicityInfo multiplicity = it->second;
string name = (it->first==0 ? "All chgd" :
generator()->getParticleData(it->first)->PDGName() );
ios::fmtflags oldFlags = outfile.flags();
outfile << std::scientific << std::showpoint
<< std::setprecision(3)
<< setw(7) << it->first << ' '
<< setw(9) << name << ' '
<< setw(2) << multiplicity.simMultiplicity() << " | "
<< setw(2) << multiplicity.obsMultiplicity << " +/- "
<< setw(2) << multiplicity.obsError << ' '
<< std::showpos << std::setprecision(1)
<< multiplicity.nSigma() << ' '
<< multiplicity.bargraph()
<< std::noshowpos;
outfile << '\n';
outfile.flags(oldFlags);
}
outfile << "\nCount of particles involved in hard process:\n";
for (map<long,long>::const_iterator it = _collisioncount.begin();
it != _collisioncount.end(); ++ it) {
string name = generator()->getParticleData(it->first)->PDGName();
outfile << name << '\t' << it->second << '\n';
}
outfile << "\nFinal state particle count:\n";
for (map<long,long>::const_iterator it = _finalstatecount.begin();
it != _finalstatecount.end(); ++ it) {
string name = generator()->getParticleData(it->first)->PDGName();
outfile << name << '\t' << it->second << '\n';
}
outfile.close();
if (_makeHistograms) {
Histogram piratio
= _histograms[ParticleID::piplus].ratioWith(_histograms[ParticleID::pi0]);
Histogram Kratio
= _histograms[ParticleID::Kplus].ratioWith(_histograms[ParticleID::K0]);
using namespace HistogramOptions;
string histofilename = filename + ".top";
ofstream outfile2(histofilename.c_str());
for (map<int,Histogram>::const_iterator it = _primary.begin();
it != _primary.end(); ++it) {
ostringstream title1;
title1 << "Primary Cluster " << it->first;
string title = title1.str();
it->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"",
"N (200 bins)","","Cluster mass [GeV]");
}
- map<long,Histogram>::const_iterator cit = _histograms.find(ExtraParticleID::Cluster);
+ map<long,Histogram>::const_iterator cit = _histograms.find(ParticleID::Cluster);
string title = generator()->getParticleData(cit->first)->PDGName();
cit->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"",
"N (200 bins)","","Parent cluster mass [GeV]");
for (map<int,Histogram>::const_iterator it = _clusters.begin();
it != _clusters.end(); ++it) {
ostringstream title1;
title1 << "Final Cluster " << it->first;
string title = title1.str();
it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"",
"N (200 bins)","","Cluster mass [GeV]");
}
for (map<long,Histogram>::const_iterator it = _histograms.begin();
it != _histograms.end(); ++it) {
string title = generator()->getParticleData(it->first)->PDGName();
it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"",
"N (200 bins)","","Parent cluster mass [GeV]");
}
piratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","pi+ / pi0","",
"","","Parent cluster mass [GeV]");
Kratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","K+ / K0","",
"","","Parent cluster mass [GeV]");
outfile2.close();
}
AnalysisHandler::dofinish();
}
ClassDescription<LEPMultiplicityCount> LEPMultiplicityCount::initLEPMultiplicityCount;
// Definition of the static class description member.
void LEPMultiplicityCount::Init() {
static ParVector<LEPMultiplicityCount,long> interfaceparticlecodes
("ParticleCodes",
"The PDG code for the particles",
&LEPMultiplicityCount::_particlecodes,
0, 0, 0, -10000000, 10000000, false, false, true);
static ParVector<LEPMultiplicityCount,double> interfaceMultiplicity
("Multiplicity",
"The multiplicity for the particle",
&LEPMultiplicityCount::_multiplicity,
0, 0, 0, 0., 1000., false, false, true);
static ParVector<LEPMultiplicityCount,double> interfaceError
("Error",
"The error on the multiplicity for the particle",
&LEPMultiplicityCount::_error,
0, 0, 0, 0., 1000., false, false, true);
static ParVector<LEPMultiplicityCount,unsigned int> interfaceSpecies
("Species",
"The type of particle",
&LEPMultiplicityCount::_species,
0, 0, other, 0, other, false, false, true);
static Switch<LEPMultiplicityCount,bool> interfaceHistograms
("Histograms",
"Set to On if detailed histograms are required.",
&LEPMultiplicityCount::_makeHistograms, false, true, false);
static SwitchOption interfaceHistogramsOn
(interfaceHistograms,
"Yes",
"Generate histograms of cluster mass dependence.",
true);
static SwitchOption interfaceHistogramsOff
(interfaceHistograms,
"No",
"Do not generate histograms.",
false);
static ClassDocumentation<LEPMultiplicityCount> documentation
("The LEPMultiplicityCount class count the multiplcities of final-state particles"
" and compares them with LEP data.",
"The LEP multiplicity analysis uses data from PDG 2006 \\cite{Yao:2006px}.",
"%\\cite{Yao:2006px}\n"
"\\bibitem{Yao:2006px}\n"
" W.~M.~Yao {\\it et al.} [Particle Data Group],\n"
" %``Review of particle physics,''\n"
" J.\\ Phys.\\ G {\\bf 33} (2006) 1.\n"
" %%CITATION = JPHGB,G33,1;%%\n"
);
}
void LEPMultiplicityCount::persistentOutput(PersistentOStream & os) const {
os << _particlecodes << _multiplicity << _error << _species << _makeHistograms;
}
void LEPMultiplicityCount::persistentInput(PersistentIStream & is, int) {
is >> _particlecodes >> _multiplicity >> _error >> _species >> _makeHistograms;
}
diff --git a/Analysis/SimpleLHCAnalysis.cc b/Analysis/SimpleLHCAnalysis.cc
--- a/Analysis/SimpleLHCAnalysis.cc
+++ b/Analysis/SimpleLHCAnalysis.cc
@@ -1,160 +1,163 @@
// -*- C++ -*-
//
// SimpleLHCAnalysis.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SimpleLHCAnalysis class.
//
#include "SimpleLHCAnalysis.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/EventRecord/Event.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
SimpleLHCAnalysis::SimpleLHCAnalysis() :
_ptZ(4,Histogram(0.,250.,250)),
_ptWp(4,Histogram(0.,250.,250)),
_ptWm(4,Histogram(0.,250.,250)),
_mZ(0.,250.,250), _mWp(0.,250.,250), _mWm(0.,250.,250),
_rapZ(-10.,10.,100),_rapWp(-10.,10.,100),_rapWm(-10.,10.,100),
_phiZ(-Constants::pi,Constants::pi,100),
_phiWp(-Constants::pi,Constants::pi,100),
_phiWm(-Constants::pi,Constants::pi,100)
{}
void sumMomenta(Lorentz5Momentum & psum, tPPtr parent) {
if(!parent->children().empty()) {
for(unsigned int ix=0;ix<parent->children().size();++ix)
sumMomenta(psum,parent->children()[ix]);
}
else
psum += parent->momentum();
}
void SimpleLHCAnalysis::analyze(tEventPtr event, long, int, int) {
// AnalysisHandler::analyze(event, ieve, loop, state);
// Rotate to CMS, extract final state particles and call analyze(particles).
// find the Z
Lorentz5Momentum pz;
StepVector::const_iterator sit =event->primaryCollision()->steps().begin();
StepVector::const_iterator stest =event->primaryCollision()->steps().end();
StepVector::const_iterator send=sit;
++send;
if(send==stest) --send;
++send;
if(send==stest) --send;
++send;
for(;sit!=send;++sit) {
ParticleSet part=(**sit).all();
ParticleSet::const_iterator iter = part.begin(), end = part.end();
for( ;iter!=end;++iter) {
if((**iter).children().size()!=2) continue;
if((**iter).id()==ParticleID::Z0||(**iter).id()==ParticleID::gamma) {
pz=Lorentz5Momentum();
sumMomenta(pz,*iter);
+ pz.rescaleMass();
double pt = pz.perp()/GeV;
double mz = pz.m()/GeV;
if(mz>20.&&mz<80.) _ptZ[1].addWeighted(pt,event->weight());
else if (mz>80.&&mz<100.) _ptZ[2].addWeighted(pt,event->weight());
else if (mz>100.) _ptZ[3].addWeighted(pt,event->weight());
_ptZ[0].addWeighted(pt ,event->weight());
_mZ .addWeighted(mz ,event->weight());
_rapZ .addWeighted(pz.rapidity(),event->weight());
_phiZ .addWeighted(pz.phi() ,event->weight());
}
else if ((**iter).id()==ParticleID::Wplus) {
pz=Lorentz5Momentum();
sumMomenta(pz,*iter);
+ pz.rescaleMass();
double pt = pz.perp()/GeV;
double mz = pz.m()/GeV;
if(mz>20.&&mz<80.) _ptWp[1].addWeighted(pt,event->weight());
else if (mz>80.&&mz<100.) _ptWp[2].addWeighted(pt,event->weight());
else if (mz>100.) _ptWp[3].addWeighted(pt,event->weight());
_ptWp[0].addWeighted(pt ,event->weight());
_mWp .addWeighted(mz ,event->weight());
_rapWp .addWeighted(pz.rapidity(),event->weight());
_phiWp .addWeighted(pz.phi() ,event->weight());
}
else if ((**iter).id()==ParticleID::Wminus) {
pz=Lorentz5Momentum();
sumMomenta(pz,*iter);
+ pz.rescaleMass();
double pt = pz.perp()/GeV;
double mz = pz.m()/GeV;
if(mz>20.&&mz<80.) (_ptWm[1]).addWeighted(pt,event->weight());
else if (mz>80.&&mz<100.) (_ptWm[2]).addWeighted(pt,event->weight());
else if (mz>100.) (_ptWm[3]).addWeighted(pt,event->weight());
_ptWm[0].addWeighted(pt ,event->weight());
_mWm .addWeighted(mz ,event->weight());
_rapWm .addWeighted(pz.rapidity(),event->weight());
_phiWm .addWeighted(pz.phi() ,event->weight());
}
}
}
}
NoPIOClassDescription<SimpleLHCAnalysis> SimpleLHCAnalysis::initSimpleLHCAnalysis;
// Definition of the static class description member.
void SimpleLHCAnalysis::Init() {
static ClassDocumentation<SimpleLHCAnalysis> documentation
("The SimpleLHCAnalysis class performs a simple analysis of W and"
" Z production in hadron-hadron collisions");
}
void SimpleLHCAnalysis::dofinish() {
AnalysisHandler::dofinish();
string fname = generator()->filename() + string("-") + name() + string(".top");
ofstream outfile(fname.c_str());
string title;
using namespace HistogramOptions;
for(unsigned int ix=0;ix<4;++ix) {
if(ix==0){title="pt of Z for all masses ";}
else if(ix==1){title="pt of Z for mass 40-80 GeV";}
else if(ix==2){title="pt of Z for mass 80-100 GeV";}
else if(ix==3){title="pt of Z for mass 100- GeV";}
_ptZ[ix].topdrawOutput(outfile,Frame,"BLACK",title);
_ptZ[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title);
if(ix==0){title="pt of Wp for all masses ";}
else if(ix==1){title="pt of Wp for mass 40-80 GeV";}
else if(ix==2){title="pt of Wp for mass 80-100 GeV";}
else if(ix==3){title="pt of Wp for mass 100- GeV";}
_ptWp[ix].topdrawOutput(outfile,Frame,"BLACK",title);
_ptWp[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title);
if(ix==0){title="pt of Wm for all masses ";}
else if(ix==1){title="pt of Wm for mass 40-80 GeV";}
else if(ix==2){title="pt of Wm for mass 80-100 GeV";}
else if(ix==3){title="pt of Wm for mass 100- GeV";}
_ptWm[ix].topdrawOutput(outfile,Frame,"BLACK",title);
_ptWm[ix].topdrawOutput(outfile,Frame|Ylog,"BLACK",title);
}
_mZ.topdrawOutput(outfile,Frame,"BLACK","Mass of Z");
_mZ.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Z");
_mWp.topdrawOutput(outfile,Frame,"BLACK","Mass of Wp");
_mWp.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Wp");
_mWm.topdrawOutput(outfile,Frame,"BLACK","Mass of Wm");
_mWm.topdrawOutput(outfile,Frame|Ylog,"BLACK", "Mass of Wm");
_rapZ.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Z");
_rapZ.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Z");
_rapWp.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Wp");
_rapWp.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Wp");
_rapWm.topdrawOutput(outfile,Frame,"BLACK","Rapidity of Wm");
_rapWm.topdrawOutput(outfile,Frame|Ylog,"BLACK","Rapidity of Wm");
_phiZ.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Z");
_phiWp.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Wp");
_phiWm.topdrawOutput(outfile,Frame,"BLACK","Azimuth of Wm");
}
diff --git a/Config/ltmain.sh b/Config/ltmain.sh
--- a/Config/ltmain.sh
+++ b/Config/ltmain.sh
@@ -1,9636 +1,8406 @@
-
-# libtool (GNU libtool) 2.4
+# Generated from ltmain.m4sh.
+
+# ltmain.sh (GNU libtool) 2.2.6b
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
#
-# --config show all configuration variables
-# --debug enable verbose shell tracing
-# -n, --dry-run display commands without modifying any files
-# --features display basic configuration information and exit
-# --mode=MODE use operation mode MODE
-# --preserve-dup-deps don't remove duplicate dependency libraries
-# --quiet, --silent don't print informational messages
-# --no-quiet, --no-silent
-# print informational messages (default)
-# --tag=TAG use configuration variables from tag TAG
-# -v, --verbose print more informational messages than default
-# --no-verbose don't print the extra informational messages
-# --version print version information
-# -h, --help, --help-all print short, long, or detailed help message
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print informational messages (default)
+# --version print version information
+# -h, --help print short or long help message
#
# MODE must be one of the following:
#
-# clean remove files from the build directory
-# compile compile a source file into a libtool object
-# execute automatically set library path, then run a program
-# finish complete the installation of libtool libraries
-# install install libraries or executables
-# link create a library or an executable
-# uninstall remove libraries from an installed directory
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
#
-# MODE-ARGS vary depending on the MODE. When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# MODE-ARGS vary depending on the MODE.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
-# host-triplet: $host
-# shell: $SHELL
-# compiler: $LTCC
-# compiler flags: $LTCFLAGS
-# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.4
-# automake: $automake_version
-# autoconf: $autoconf_version
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.2.6b
+# automake: $automake_version
+# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
-
-PROGRAM=libtool
+
+PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=2.4
+VERSION=2.2.6b
TIMESTAMP=""
-package_revision=1.3293
+package_revision=1.3017
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
-
# NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
$lt_unset CDPATH
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
: ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${EGREP="grep -E"}
-: ${FGREP="grep -F"}
-: ${GREP="grep"}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
-: ${SED="sed"}
+: ${SED="/bin/sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
- if test "X$func_dirname_result" = "X${1}"; then
- func_dirname_result="${3}"
- else
- func_dirname_result="$func_dirname_result${2}"
- fi
-} # func_dirname may be replaced by extended shell implementation
-
-
-# func_basename file
-func_basename ()
-{
- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
-
-
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
- # Extract subdirectory from the argument.
- func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
- if test "X$func_dirname_result" = "X${1}"; then
- func_dirname_result="${3}"
- else
- func_dirname_result="$func_dirname_result${2}"
- fi
- func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
- case ${2} in
- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
- esac
-} # func_stripname may be replaced by extended shell implementation
-
-
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
- s@/\./@/@g
- t dotsl
- s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
-
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-# value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
- # Start from root dir and reassemble the path.
- func_normal_abspath_result=
- func_normal_abspath_tpath=$1
- func_normal_abspath_altnamespace=
- case $func_normal_abspath_tpath in
- "")
- # Empty path, that just means $cwd.
- func_stripname '' '/' "`pwd`"
- func_normal_abspath_result=$func_stripname_result
- return
- ;;
- # The next three entries are used to spot a run of precisely
- # two leading slashes without using negated character classes;
- # we take advantage of case's first-match behaviour.
- ///*)
- # Unusual form of absolute path, do nothing.
- ;;
- //*)
- # Not necessarily an ordinary path; POSIX reserves leading '//'
- # and for example Cygwin uses it to access remote file shares
- # over CIFS/SMB, so we conserve a leading double slash if found.
- func_normal_abspath_altnamespace=/
- ;;
- /*)
- # Absolute path, do nothing.
- ;;
- *)
- # Relative path, prepend $cwd.
- func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
- ;;
- esac
- # Cancel out all the simple stuff to save iterations. We also want
- # the path to end with a slash for ease of parsing, so make sure
- # there is one (and only one) here.
- func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
- while :; do
- # Processed it all yet?
- if test "$func_normal_abspath_tpath" = / ; then
- # If we ascended to the root using ".." the result may be empty now.
- if test -z "$func_normal_abspath_result" ; then
- func_normal_abspath_result=/
- fi
- break
- fi
- func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$pathcar"`
- func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$pathcdr"`
- # Figure out what to do with it
- case $func_normal_abspath_tcomponent in
- "")
- # Trailing empty path component, ignore it.
- ;;
- ..)
- # Parent dir; strip last assembled component from result.
- func_dirname "$func_normal_abspath_result"
- func_normal_abspath_result=$func_dirname_result
- ;;
- *)
- # Actual path component, append it.
- func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
- ;;
- esac
- done
- # Restore leading double-slash if one was found on entry.
- func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
}
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-# value returned in "$func_relative_path_result"
-func_relative_path ()
-{
- func_relative_path_result=
- func_normal_abspath "$1"
- func_relative_path_tlibdir=$func_normal_abspath_result
- func_normal_abspath "$2"
- func_relative_path_tbindir=$func_normal_abspath_result
-
- # Ascend the tree starting from libdir
- while :; do
- # check if we have found a prefix of bindir
- case $func_relative_path_tbindir in
- $func_relative_path_tlibdir)
- # found an exact match
- func_relative_path_tcancelled=
- break
- ;;
- $func_relative_path_tlibdir*)
- # found a matching prefix
- func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
- func_relative_path_tcancelled=$func_stripname_result
- if test -z "$func_relative_path_result"; then
- func_relative_path_result=.
- fi
- break
- ;;
- *)
- func_dirname $func_relative_path_tlibdir
- func_relative_path_tlibdir=${func_dirname_result}
- if test "x$func_relative_path_tlibdir" = x ; then
- # Have to descend all the way to the root!
- func_relative_path_result=../$func_relative_path_result
- func_relative_path_tcancelled=$func_relative_path_tbindir
- break
- fi
- func_relative_path_result=../$func_relative_path_result
- ;;
- esac
- done
-
- # Now calculate path; take care to avoid doubling-up slashes.
- func_stripname '' '/' "$func_relative_path_result"
- func_relative_path_result=$func_stripname_result
- func_stripname '/' '/' "$func_relative_path_tcancelled"
- if test "x$func_stripname_result" != x ; then
- func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
- fi
-
- # Normalisation. If bindir is libdir, return empty string,
- # else relative path ending with a slash; either way, target
- # file name can be directly appended.
- if test ! -z "$func_relative_path_result"; then
- func_stripname './' '' "$func_relative_path_result/"
- func_relative_path_result=$func_stripname_result
- fi
-}
+# Generated shell functions inserted here.
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
# The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
+case $progname in
+ -*) progname=./$progname ;;
+esac
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=:
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
-
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes. A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
- $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+ $ECHO "$progname${mode+: }$mode: $*"
}
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
- $ECHO "$*"
-}
-
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+ $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
}
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+ $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
# bash bug again:
:
}
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
- my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
done
- my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+ my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
- $ECHO "$my_tmpdir"
+ $ECHO "X$my_tmpdir" | $Xsed
}
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
{
case $1 in
*[\\\`\"\$]*)
- func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
esac
}
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
{
case $1 in
*[\\\`\"]*)
- my_arg=`$ECHO "$1" | $SED \
+ my_arg=`$ECHO "X$1" | $Xsed \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
}
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
{
my_cmd="$1"
my_fail_exp="${2-:}"
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
fi
}
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result. All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
- case $1 in
- [0-9]* | *[!a-zA-Z0-9_]*)
- func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
- ;;
- * )
- func_tr_sh_result=$1
- ;;
- esac
-}
+
+
# func_version
# Echo version message to standard output and exit.
func_version ()
{
- $opt_debug
-
- $SED -n '/(C)/!b go
- :more
- /\./!{
- N
- s/\n# / /
- b more
- }
- :go
- /^# '$PROGRAM' (GNU /,/# warranty; / {
+ $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
- $opt_debug
-
- $SED -n '/^# Usage:/,/^# *.*--help/ {
+ $SED -n '/^# Usage:/,/# -h/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
- echo
+ $ECHO
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
+# func_help
+# Echo long help message to standard output and exit.
func_help ()
{
- $opt_debug
-
$SED -n '/^# Usage:/,/# Report bugs to/ {
- :print
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
p
- d
- }
- /^# .* home page:/b print
- /^# General help using/b print
- ' < "$progpath"
- ret=$?
- if test -z "$1"; then
- exit $ret
- fi
+ }' < "$progpath"
+ exit $?
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
- $opt_debug
-
- func_error "missing argument for $1."
+ func_error "missing argument for $1"
exit_cmd=exit
}
-
-# func_split_short_opt shortopt
-# Set func_split_short_opt_name and func_split_short_opt_arg shell
-# variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
-{
- my_sed_short_opt='1s/^\(..\).*$/\1/;q'
- my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
-
- func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
- func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
-
-
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
-{
- my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
- my_sed_long_arg='1s/^--[^=]*=//'
-
- func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
- func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
-
exit_cmd=:
+# Check that we have a working $ECHO.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell, and then maybe $ECHO will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
# Global variables.
+# $mode is unset
nonopt=
+execute_dlfiles=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
-
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
- func_quote_for_eval "${2}"
- eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
-
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
-
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
-
-
-# func_lo2o object
-func_lo2o ()
-{
- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
-
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
-
-
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
# Now print the configurations for the tags.
for tagname in $taglist; do
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
done
exit $?
}
# func_features
# Display the features supported by this script.
func_features ()
{
- echo "host: $host"
+ $ECHO "host: $host"
if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
+ $ECHO "enable shared libraries"
else
- echo "disable shared libraries"
+ $ECHO "disable shared libraries"
fi
if test "$build_old_libs" = yes; then
- echo "enable static libraries"
+ $ECHO "enable static libraries"
else
- echo "disable static libraries"
+ $ECHO "disable static libraries"
fi
exit $?
}
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
+# Parse options once, thoroughly. This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
+
+ # Shorthand for --mode=foo, only valid as the first argument
+ case $1 in
+ clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+ compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+ execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+ finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+ link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+ uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+ esac
+
+ # Parse non-mode specific arguments:
+ while test "$#" -gt 0; do
+ opt="$1"
+ shift
+
+ case $opt in
+ --config) func_config ;;
+
+ --debug) preserve_args="$preserve_args $opt"
+ func_echo "enabling shell trace mode"
+ opt_debug='set -x'
+ $opt_debug
+ ;;
+
+ -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ execute_dlfiles="$execute_dlfiles $1"
+ shift
+ ;;
+
+ --dry-run | -n) opt_dry_run=: ;;
+ --features) func_features ;;
+ --finish) mode="finish" ;;
+
+ --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ case $1 in
+ # Valid mode arguments:
+ clean) ;;
+ compile) ;;
+ execute) ;;
+ finish) ;;
+ install) ;;
+ link) ;;
+ relink) ;;
+ uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+ esac
+
+ mode="$1"
+ shift
+ ;;
+
+ --preserve-dup-deps)
+ opt_duplicate_deps=: ;;
+
+ --quiet|--silent) preserve_args="$preserve_args $opt"
+ opt_silent=:
+ ;;
+
+ --verbose| -v) preserve_args="$preserve_args $opt"
+ opt_silent=false
+ ;;
+
+ --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ preserve_args="$preserve_args $opt $1"
+ func_enable_tag "$1" # tagname is set here
+ shift
+ ;;
+
+ # Separate optargs to long options:
+ -dlopen=*|--mode=*|--tag=*)
+ func_opt_split "$opt"
+ set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) opt_help=: ;;
+ --version) func_version ;;
+
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+
+ *) nonopt="$opt"
+ break
+ ;;
+ esac
+ done
+
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+ ;;
+ esac
+
+ # Having warned about all mis-specified options, bail out if
+ # anything was wrong.
+ $exit_cmd $EXIT_FAILURE
+}
+
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
fi
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
- shift; set dummy --mode clean ${1+"$@"}; shift
- ;;
-compile|compil|compi|comp|com|co|c)
- shift; set dummy --mode compile ${1+"$@"}; shift
- ;;
-execute|execut|execu|exec|exe|ex|e)
- shift; set dummy --mode execute ${1+"$@"}; shift
- ;;
-finish|finis|fini|fin|fi|f)
- shift; set dummy --mode finish ${1+"$@"}; shift
- ;;
-install|instal|insta|inst|ins|in|i)
- shift; set dummy --mode install ${1+"$@"}; shift
- ;;
-link|lin|li|l)
- shift; set dummy --mode link ${1+"$@"}; shift
- ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
- shift; set dummy --mode uninstall ${1+"$@"}; shift
- ;;
-esac
-
-
-
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
-
-
-# Parse options once, thoroughly. This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
- # this just eases exit handling
- while test $# -gt 0; do
- opt="$1"
- shift
- case $opt in
- --debug|-x) opt_debug='set -x'
- func_echo "enabling shell trace mode"
- $opt_debug
- ;;
- --dry-run|--dryrun|-n)
- opt_dry_run=:
- ;;
- --config)
- opt_config=:
-func_config
- ;;
- --dlopen|-dlopen)
- optarg="$1"
- opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
- shift
- ;;
- --preserve-dup-deps)
- opt_preserve_dup_deps=:
- ;;
- --features)
- opt_features=:
-func_features
- ;;
- --finish)
- opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
- ;;
- --help)
- opt_help=:
- ;;
- --help-all)
- opt_help_all=:
-opt_help=': help-all'
- ;;
- --mode)
- test $# = 0 && func_missing_arg $opt && break
- optarg="$1"
- opt_mode="$optarg"
-case $optarg in
- # Valid mode arguments:
- clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
- # Catch anything else as an error
- *) func_error "invalid argument for $opt"
- exit_cmd=exit
- break
- ;;
-esac
- shift
- ;;
- --no-silent|--no-quiet)
- opt_silent=false
-func_append preserve_args " $opt"
- ;;
- --no-verbose)
- opt_verbose=false
-func_append preserve_args " $opt"
- ;;
- --silent|--quiet)
- opt_silent=:
-func_append preserve_args " $opt"
- opt_verbose=false
- ;;
- --verbose|-v)
- opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
- ;;
- --tag)
- test $# = 0 && func_missing_arg $opt && break
- optarg="$1"
- opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
- shift
- ;;
-
- -\?|-h) func_usage ;;
- --help) func_help ;;
- --version) func_version ;;
-
- # Separate optargs to long options:
- --*=*)
- func_split_long_opt "$opt"
- set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
- shift
- ;;
-
- # Separate non-argument short options:
- -\?*|-h*|-n*|-v*)
- func_split_short_opt "$opt"
- set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
- shift
- ;;
-
- --) break ;;
- -*) func_fatal_help "unrecognized option \`$opt'" ;;
- *) set dummy "$opt" ${1+"$@"}; shift; break ;;
- esac
- done
-
- # Validate options:
-
- # save first non-option argument
- if test "$#" -gt 0; then
- nonopt="$opt"
- shift
- fi
-
- # preserve --debug
- test "$opt_debug" = : || func_append preserve_args " --debug"
-
- case $host in
- *cygwin* | *mingw* | *pw32* | *cegcc*)
- # don't eliminate duplications in $postdeps and $predeps
- opt_duplicate_compiler_generated_deps=:
- ;;
- *)
- opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
- ;;
- esac
-
- $opt_help || {
- # Sanity checks first:
- func_check_version_match
-
- if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- func_fatal_configuration "not configured to build any kind of library"
- fi
-
- # Darwin sucks
- eval std_shrext=\"$shrext_cmds\"
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
- func_error "unrecognized option \`-dlopen'"
- $ECHO "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$opt_mode' for more information."
- }
-
-
- # Bail if the options were screwed
- $exit_cmd $EXIT_FAILURE
-}
-
-
-
-
## ----------- ##
## Main. ##
## ----------- ##
+$opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
test -f "$1" &&
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
- func_dirname_and_basename "$1" "" "."
- func_stripname '' '.exe' "$func_basename_result"
- func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+ func_ltwrapper_scriptname_result=""
+ if func_ltwrapper_executable_p "$1"; then
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+ fi
}
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
esac
}
-# func_resolve_sysroot PATH
-# Replace a leading = in PATH with a sysroot. Store the result into
-# func_resolve_sysroot_result
-func_resolve_sysroot ()
-{
- func_resolve_sysroot_result=$1
- case $func_resolve_sysroot_result in
- =*)
- func_stripname '=' '' "$func_resolve_sysroot_result"
- func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
- ;;
- esac
-}
-
-# func_replace_sysroot PATH
-# If PATH begins with the sysroot, replace it with = and
-# store the result into func_replace_sysroot_result.
-func_replace_sysroot ()
-{
- case "$lt_sysroot:$1" in
- ?*:"$lt_sysroot"*)
- func_stripname "$lt_sysroot" '' "$1"
- func_replace_sysroot_result="=$func_stripname_result"
- ;;
- *)
- # Including no sysroot.
- func_replace_sysroot_result=$1
- ;;
- esac
-}
-
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
# if one wasn't chosen via the "--tag" command line option.
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
func_infer_tag ()
{
$opt_debug
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
- func_append_quoted CC_quoted "$arg"
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
done
- CC_expanded=`func_echo_all $CC`
- CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@ in
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
- " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
# Blanks at the start of $base_compile will cause this to fail
# if we don't check for them as well.
*)
for z in $available_tags; do
if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
# Evaluate the configuration.
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
CC_quoted=
for arg in $CC; do
# Double-quote args containing other shell metacharacters.
- func_append_quoted CC_quoted "$arg"
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
done
- CC_expanded=`func_echo_all $CC`
- CC_quoted_expanded=`func_echo_all $CC_quoted`
case "$@ " in
- " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
- " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
# Assume this is the tagged configuration we want.
tagname=$z
break
;;
esac
fi
done
# If $tagname still isn't set, then no tagged configuration
# was found and let the user know that the "--tag" command
# line option must be used.
if test -z "$tagname"; then
func_echo "unable to infer tagged configuration"
func_fatal_error "specify a tag with \`--tag'"
# else
# func_verbose "using $tagname tagged configuration"
fi
;;
esac
fi
}
# func_write_libtool_object output_name pic_name nonpic_name
# Create a libtool object file (analogous to a ".la" file),
# but don't create it if we're doing a dry run.
func_write_libtool_object ()
{
write_libobj=${1}
if test "$build_libtool_libs" = yes; then
write_lobj=\'${2}\'
else
write_lobj=none
fi
if test "$build_old_libs" = yes; then
write_oldobj=\'${3}\'
else
write_oldobj=none
fi
$opt_dry_run || {
cat >${write_libobj}T <<EOF
# $write_libobj - a libtool object file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object=$write_lobj
# Name of the non-PIC object
non_pic_object=$write_oldobj
EOF
$MV "${write_libobj}T" "${write_libobj}"
}
}
-
-##################################################
-# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
-##################################################
-
-# func_convert_core_file_wine_to_w32 ARG
-# Helper function used by file name conversion functions when $build is *nix,
-# and $host is mingw, cygwin, or some other w32 environment. Relies on a
-# correctly configured wine environment available, with the winepath program
-# in $build's $PATH.
-#
-# ARG is the $build file name to be converted to w32 format.
-# Result is available in $func_convert_core_file_wine_to_w32_result, and will
-# be empty on error (or when ARG is empty)
-func_convert_core_file_wine_to_w32 ()
-{
- $opt_debug
- func_convert_core_file_wine_to_w32_result="$1"
- if test -n "$1"; then
- # Unfortunately, winepath does not exit with a non-zero error code, so we
- # are forced to check the contents of stdout. On the other hand, if the
- # command is not found, the shell will set an exit code of 127 and print
- # *an error message* to stdout. So we must check for both error code of
- # zero AND non-empty stdout, which explains the odd construction:
- func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
- if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
- func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
- $SED -e "$lt_sed_naive_backslashify"`
- else
- func_convert_core_file_wine_to_w32_result=
- fi
- fi
-}
-# end: func_convert_core_file_wine_to_w32
-
-
-# func_convert_core_path_wine_to_w32 ARG
-# Helper function used by path conversion functions when $build is *nix, and
-# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
-# configured wine environment available, with the winepath program in $build's
-# $PATH. Assumes ARG has no leading or trailing path separator characters.
-#
-# ARG is path to be converted from $build format to win32.
-# Result is available in $func_convert_core_path_wine_to_w32_result.
-# Unconvertible file (directory) names in ARG are skipped; if no directory names
-# are convertible, then the result may be empty.
-func_convert_core_path_wine_to_w32 ()
-{
- $opt_debug
- # unfortunately, winepath doesn't convert paths, only file names
- func_convert_core_path_wine_to_w32_result=""
- if test -n "$1"; then
- oldIFS=$IFS
- IFS=:
- for func_convert_core_path_wine_to_w32_f in $1; do
- IFS=$oldIFS
- func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
- if test -n "$func_convert_core_file_wine_to_w32_result" ; then
- if test -z "$func_convert_core_path_wine_to_w32_result"; then
- func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
- else
- func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
- fi
- fi
- done
- IFS=$oldIFS
- fi
-}
-# end: func_convert_core_path_wine_to_w32
-
-
-# func_cygpath ARGS...
-# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
-# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
-# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
-# (2), returns the Cygwin file name or path in func_cygpath_result (input
-# file name or path is assumed to be in w32 format, as previously converted
-# from $build's *nix or MSYS format). In case (3), returns the w32 file name
-# or path in func_cygpath_result (input file name or path is assumed to be in
-# Cygwin format). Returns an empty string on error.
-#
-# ARGS are passed to cygpath, with the last one being the file name or path to
-# be converted.
-#
-# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
-# environment variable; do not put it in $PATH.
-func_cygpath ()
-{
- $opt_debug
- if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
- func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
- if test "$?" -ne 0; then
- # on failure, ensure result is empty
- func_cygpath_result=
- fi
- else
- func_cygpath_result=
- func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
- fi
-}
-#end: func_cygpath
-
-
-# func_convert_core_msys_to_w32 ARG
-# Convert file name or path ARG from MSYS format to w32 format. Return
-# result in func_convert_core_msys_to_w32_result.
-func_convert_core_msys_to_w32 ()
-{
- $opt_debug
- # awkward: cmd appends spaces to result
- func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
- $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
-}
-#end: func_convert_core_msys_to_w32
-
-
-# func_convert_file_check ARG1 ARG2
-# Verify that ARG1 (a file name in $build format) was converted to $host
-# format in ARG2. Otherwise, emit an error message, but continue (resetting
-# func_to_host_file_result to ARG1).
-func_convert_file_check ()
-{
- $opt_debug
- if test -z "$2" && test -n "$1" ; then
- func_error "Could not determine host file name corresponding to"
- func_error " \`$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback:
- func_to_host_file_result="$1"
- fi
-}
-# end func_convert_file_check
-
-
-# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
-# Verify that FROM_PATH (a path in $build format) was converted to $host
-# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
-# func_to_host_file_result to a simplistic fallback value (see below).
-func_convert_path_check ()
-{
- $opt_debug
- if test -z "$4" && test -n "$3"; then
- func_error "Could not determine the host path corresponding to"
- func_error " \`$3'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback. This is a deliberately simplistic "conversion" and
- # should not be "improved". See libtool.info.
- if test "x$1" != "x$2"; then
- lt_replace_pathsep_chars="s|$1|$2|g"
- func_to_host_path_result=`echo "$3" |
- $SED -e "$lt_replace_pathsep_chars"`
- else
- func_to_host_path_result="$3"
- fi
- fi
-}
-# end func_convert_path_check
-
-
-# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
-# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
-# and appending REPL if ORIG matches BACKPAT.
-func_convert_path_front_back_pathsep ()
-{
- $opt_debug
- case $4 in
- $1 ) func_to_host_path_result="$3$func_to_host_path_result"
- ;;
- esac
- case $4 in
- $2 ) func_append func_to_host_path_result "$3"
- ;;
- esac
-}
-# end func_convert_path_front_back_pathsep
-
-
-##################################################
-# $build to $host FILE NAME CONVERSION FUNCTIONS #
-##################################################
-# invoked via `$to_host_file_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# Result will be available in $func_to_host_file_result.
-
-
-# func_to_host_file ARG
-# Converts the file name ARG from $build format to $host format. Return result
-# in func_to_host_file_result.
-func_to_host_file ()
-{
- $opt_debug
- $to_host_file_cmd "$1"
-}
-# end func_to_host_file
-
-
-# func_to_tool_file ARG LAZY
-# converts the file name ARG from $build format to toolchain format. Return
-# result in func_to_tool_file_result. If the conversion in use is listed
-# in (the comma separated) LAZY, no conversion takes place.
-func_to_tool_file ()
-{
- $opt_debug
- case ,$2, in
- *,"$to_tool_file_cmd",*)
- func_to_tool_file_result=$1
- ;;
- *)
- $to_tool_file_cmd "$1"
- func_to_tool_file_result=$func_to_host_file_result
- ;;
- esac
-}
-# end func_to_tool_file
-
-
-# func_convert_file_noop ARG
-# Copy ARG to func_to_host_file_result.
-func_convert_file_noop ()
-{
- func_to_host_file_result="$1"
-}
-# end func_convert_file_noop
-
-
-# func_convert_file_msys_to_w32 ARG
-# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper. Returns result in
-# func_to_host_file_result.
-func_convert_file_msys_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_msys_to_w32 "$1"
- func_to_host_file_result="$func_convert_core_msys_to_w32_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_w32
-
-
-# func_convert_file_cygwin_to_w32 ARG
-# Convert file name ARG from Cygwin to w32 format. Returns result in
-# func_to_host_file_result.
-func_convert_file_cygwin_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
- # LT_CYGPATH in this case.
- func_to_host_file_result=`cygpath -m "$1"`
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_cygwin_to_w32
-
-
-# func_convert_file_nix_to_w32 ARG
-# Convert file name ARG from *nix to w32 format. Requires a wine environment
-# and a working winepath. Returns result in func_to_host_file_result.
-func_convert_file_nix_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_file_wine_to_w32 "$1"
- func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_w32
-
-
-# func_convert_file_msys_to_cygwin ARG
-# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_file_msys_to_cygwin ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_msys_to_w32 "$1"
- func_cygpath -u "$func_convert_core_msys_to_w32_result"
- func_to_host_file_result="$func_cygpath_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_cygwin
-
-
-# func_convert_file_nix_to_cygwin ARG
-# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
-# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
-# in func_to_host_file_result.
-func_convert_file_nix_to_cygwin ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
- func_convert_core_file_wine_to_w32 "$1"
- func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
- func_to_host_file_result="$func_cygpath_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_cygwin
-
-
-#############################################
-# $build to $host PATH CONVERSION FUNCTIONS #
-#############################################
-# invoked via `$to_host_path_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# The result will be available in $func_to_host_path_result.
-#
-# Path separators are also converted from $build format to $host format. If
-# ARG begins or ends with a path separator character, it is preserved (but
-# converted to $host format) on output.
-#
-# All path conversion functions are named using the following convention:
-# file name conversion function : func_convert_file_X_to_Y ()
-# path conversion function : func_convert_path_X_to_Y ()
-# where, for any given $build/$host combination the 'X_to_Y' value is the
-# same. If conversion functions are added for new $build/$host combinations,
-# the two new functions must follow this pattern, or func_init_to_host_path_cmd
-# will break.
-
-
-# func_init_to_host_path_cmd
-# Ensures that function "pointer" variable $to_host_path_cmd is set to the
-# appropriate value, based on the value of $to_host_file_cmd.
-to_host_path_cmd=
-func_init_to_host_path_cmd ()
-{
- $opt_debug
- if test -z "$to_host_path_cmd"; then
- func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
- to_host_path_cmd="func_convert_path_${func_stripname_result}"
- fi
-}
-
-
-# func_to_host_path ARG
-# Converts the path ARG from $build format to $host format. Return result
-# in func_to_host_path_result.
-func_to_host_path ()
-{
- $opt_debug
- func_init_to_host_path_cmd
- $to_host_path_cmd "$1"
-}
-# end func_to_host_path
-
-
-# func_convert_path_noop ARG
-# Copy ARG to func_to_host_path_result.
-func_convert_path_noop ()
-{
- func_to_host_path_result="$1"
-}
-# end func_convert_path_noop
-
-
-# func_convert_path_msys_to_w32 ARG
-# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper. Returns result in
-# func_to_host_path_result.
-func_convert_path_msys_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # Remove leading and trailing path separator characters from ARG. MSYS
- # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
- # and winepath ignores them completely.
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
- func_to_host_path_result="$func_convert_core_msys_to_w32_result"
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_msys_to_w32
-
-
-# func_convert_path_cygwin_to_w32 ARG
-# Convert path ARG from Cygwin to w32 format. Returns result in
-# func_to_host_file_result.
-func_convert_path_cygwin_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_cygwin_to_w32
-
-
-# func_convert_path_nix_to_w32 ARG
-# Convert path ARG from *nix to w32 format. Requires a wine environment and
-# a working winepath. Returns result in func_to_host_file_result.
-func_convert_path_nix_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
- func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_nix_to_w32
-
-
-# func_convert_path_msys_to_cygwin ARG
-# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_path_msys_to_cygwin ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
- func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
- func_to_host_path_result="$func_cygpath_result"
- func_convert_path_check : : \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" : "$1"
- fi
-}
-# end func_convert_path_msys_to_cygwin
-
-
-# func_convert_path_nix_to_cygwin ARG
-# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
-# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
-# func_to_host_file_result.
-func_convert_path_nix_to_cygwin ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # Remove leading and trailing path separator characters from
- # ARG. msys behavior is inconsistent here, cygpath turns them
- # into '.;' and ';.', and winepath ignores them completely.
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
- func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
- func_to_host_path_result="$func_cygpath_result"
- func_convert_path_check : : \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" : "$1"
- fi
-}
-# end func_convert_path_nix_to_cygwin
-
-
# func_mode_compile arg...
func_mode_compile ()
{
$opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
suppress_opt=yes
suppress_output=
arg_mode=normal
libobj=
later=
pie_flag=
for arg
do
case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
arg_mode=normal
;;
target )
libobj="$arg"
arg_mode=normal
continue
;;
normal )
# Accept any command-line options.
case $arg in
-o)
test -n "$libobj" && \
func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
-pie | -fpie | -fPIE)
- func_append pie_flag " $arg"
+ pie_flag="$pie_flag $arg"
continue
;;
-shared | -static | -prefer-pic | -prefer-non-pic)
- func_append later " $arg"
+ later="$later $arg"
continue
;;
-no-suppress)
suppress_opt=no
continue
;;
-Xcompiler)
arg_mode=arg # the next one goes into the "base_compile" arg list
continue # The current "srcfile" will either be retained or
;; # replaced later. I would guess that would be a bug.
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
lastarg=
save_ifs="$IFS"; IFS=','
for arg in $args; do
IFS="$save_ifs"
- func_append_quoted lastarg "$arg"
+ func_quote_for_eval "$arg"
+ lastarg="$lastarg $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$lastarg"
lastarg=$func_stripname_result
# Add the arguments to base_compile.
- func_append base_compile " $lastarg"
+ base_compile="$base_compile $lastarg"
continue
;;
*)
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
lastarg="$srcfile"
srcfile="$arg"
;;
esac # case $arg
;;
esac # case $arg_mode
# Aesthetically quote the previous argument.
- func_append_quoted base_compile "$lastarg"
+ func_quote_for_eval "$lastarg"
+ base_compile="$base_compile $func_quote_for_eval_result"
done # for arg
case $arg_mode in
arg)
func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
test -z "$libobj" && {
func_basename "$srcfile"
libobj="$func_basename_result"
}
;;
esac
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
case $libobj in
*.[cCFSifmso] | \
*.ada | *.adb | *.ads | *.asm | \
*.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
- *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+ *.[fF][09]? | *.for | *.java | *.obj | *.sx)
func_xform "$libobj"
libobj=$func_xform_result
;;
esac
case $libobj in
*.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
func_infer_tag $base_compile
for arg in $later; do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
continue
;;
-static)
build_libtool_libs=no
build_old_libs=yes
continue
;;
-prefer-pic)
pic_mode=yes
continue
;;
-prefer-non-pic)
pic_mode=no
continue
;;
esac
done
func_quote_for_eval "$libobj"
test "X$libobj" != "X$func_quote_for_eval_result" \
&& $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
&& func_warning "libobj name \`$libobj' may not contain shell special characters."
func_dirname_and_basename "$obj" "/" ""
objname="$func_basename_result"
xdir="$func_dirname_result"
lobj=${xdir}$objdir/$objname
test -z "$base_compile" && \
func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
removelist="$obj $lobj $libobj ${libobj}T"
else
removelist="$lobj $libobj ${libobj}T"
fi
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
# non-PIC code in shared libraries is not supported
pic_mode=default
fi
# Calculate the filename of the output object if compiler does
# not support -o with -c
if test "$compiler_c_o" = no; then
- output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
lockfile="$output_obj.lock"
else
output_obj=
need_locks=no
lockfile=
fi
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
func_echo "Waiting for $lockfile to be removed"
sleep 2
done
elif test "$need_locks" = warn; then
if test -f "$lockfile"; then
$ECHO "\
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
- func_append removelist " $output_obj"
+ removelist="$removelist $output_obj"
$ECHO "$srcfile" > "$lockfile"
fi
$opt_dry_run || $RM $removelist
- func_append removelist " $lockfile"
+ removelist="$removelist $lockfile"
trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
- func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
- srcfile=$func_to_tool_file_result
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
func_quote_for_eval "$srcfile"
qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
command="$base_compile $qsrcfile"
fi
func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
- func_append command " -o $lobj"
+ command="$command -o $lobj"
fi
func_show_eval_locale "$command" \
'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed, then go on to compile the next one
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
func_show_eval '$MV "$output_obj" "$lobj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
suppress_output=' >/dev/null 2>&1'
fi
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
- func_append command " -o $obj"
+ command="$command -o $obj"
fi
# Suppress compiler output if we already did a PIC compilation.
- func_append command "$suppress_output"
+ command="$command$suppress_output"
func_show_eval_locale "$command" \
'$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
$ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
but it should contain:
$srcfile
This indicates that another process is trying to use the same
temporary object file, and libtool could not work around it because
your compiler does not support \`-c' and \`-o' together. If you
repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
$opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
func_show_eval '$MV "$output_obj" "$obj"' \
'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
fi
$opt_dry_run || {
func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
# Unlock the critical section if it was locked
if test "$need_locks" != no; then
removelist=$lockfile
$RM "$lockfile"
fi
}
exit $EXIT_SUCCESS
}
$opt_help || {
- test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+test "$mode" = compile && func_mode_compile ${1+"$@"}
}
func_mode_help ()
{
# We need to display help for each of the modes.
- case $opt_mode in
+ case $mode in
"")
# Generic help is extracted from the usage comments
# at the start of this file.
func_help
;;
clean)
$ECHO \
"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
Remove files from the build directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, object or program, all the files associated
with it are deleted. Otherwise, only FILE itself is deleted using RM."
;;
compile)
$ECHO \
"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
Compile a source file into a libtool library object.
This mode accepts the following additional options:
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
-no-suppress do not suppress compiler output for multiple passes
- -prefer-pic try to build PIC objects only
- -prefer-non-pic try to build non-PIC objects only
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
-shared do not build a \`.o' file suitable for static linking
-static only build a \`.o' file suitable for static linking
- -Wc,FLAG pass FLAG directly to the compiler
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
from the given SOURCEFILE.
The output file name is determined by removing the directory component from
SOURCEFILE, then substituting the C source code suffix \`.c' with the
library object suffix, \`.lo'."
;;
execute)
$ECHO \
"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
Automatically set library path, then run a program.
This mode accepts the following additional options:
-dlopen FILE add the directory containing FILE to the library path
This mode sets the library path environment variable according to \`-dlopen'
flags.
If any of the ARGS are libtool executable wrappers, then they are translated
into their corresponding uninstalled binary, and any of their required library
directories are added to the library path.
Then, COMMAND is executed, with ARGS as arguments."
;;
finish)
$ECHO \
"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
Complete the installation of libtool libraries.
Each LIBDIR is a directory that contains libtool libraries.
The commands that this mode executes may require superuser privileges. Use
the \`--dry-run' option if you just want to see what would be executed."
;;
install)
$ECHO \
"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
Install executables or libraries.
INSTALL-COMMAND is the installation command. The first component should be
either the \`install' or \`cp' program.
The following components of INSTALL-COMMAND are treated specially:
- -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+ -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
The rest of the components are interpreted as arguments to that command (only
BSD-compatible install options are recognized)."
;;
link)
$ECHO \
"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
Link object files or libraries together to form another library, or to
create an executable program.
LINK-COMMAND is a command using the C compiler that you would use to create
a program from several object files.
The following components of LINK-COMMAND are treated specially:
-all-static do not do any dynamic linking at all
-avoid-version do not add a version suffix if possible
- -bindir BINDIR specify path to binaries directory (for systems where
- libraries must be found in the PATH setting at runtime)
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-export-symbols SYMFILE
try to export only the symbols listed in SYMFILE
-export-symbols-regex REGEX
try to export only the symbols matching REGEX
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-module build a library that can dlopened
-no-fast-install disable the fast-install mode
-no-install link a not-installable executable
-no-undefined declare that a library does not refer to external symbols
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
-objectlist FILE Use a list of object files found in FILE to specify objects
-precious-files-regex REGEX
don't remove output files matching REGEX
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
-shared only do dynamic linking of libtool libraries
-shrext SUFFIX override the standard shared library file extension
-static do not do any dynamic linking of uninstalled libtool libraries
-static-libtool-libs
do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
specify library version info [each variable defaults to 0]
-weak LIBNAME declare that the target provides the LIBNAME interface
- -Wc,FLAG
- -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
- -Wl,FLAG
- -Xlinker FLAG pass linker-specific FLAG directly to the linker
- -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
All other options (arguments beginning with \`-') are ignored.
Every other argument is treated as a filename. Files ending in \`.la' are
treated as uninstalled libtool libraries, other files are standard or library
object files.
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
only library objects (\`.lo' files) may be specified, and \`-rpath' is
required, except when creating a convenience library.
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
using \`ar' and \`ranlib', or on Windows using \`lib'.
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
is created, otherwise an executable program is created."
;;
uninstall)
$ECHO \
"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
Remove libraries from an installation directory.
RM is the name of the program to use to delete files associated with each FILE
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
to RM.
If FILE is a libtool library, all the files associated with it are deleted.
Otherwise, only FILE itself is deleted using RM."
;;
*)
- func_fatal_help "invalid operation mode \`$opt_mode'"
+ func_fatal_help "invalid operation mode \`$mode'"
;;
esac
- echo
+ $ECHO
$ECHO "Try \`$progname --help' for more information about other modes."
+
+ exit $?
}
-# Now that we've collected a possible --mode arg, show help if necessary
-if $opt_help; then
- if test "$opt_help" = :; then
- func_mode_help
- else
- {
- func_help noexit
- for opt_mode in compile link execute install finish uninstall clean; do
- func_mode_help
- done
- } | sed -n '1p; 2,$s/^Usage:/ or: /p'
- {
- func_help noexit
- for opt_mode in compile link execute install finish uninstall clean; do
- echo
- func_mode_help
- done
- } |
- sed '1d
- /^When reporting/,/^Report/{
- H
- d
- }
- $x
- /information about other modes/d
- /more detailed .*MODE/d
- s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
- fi
- exit $?
-fi
+ # Now that we've collected a possible --mode arg, show help if necessary
+ $opt_help && func_mode_help
# func_mode_execute arg...
func_mode_execute ()
{
$opt_debug
# The first argument is the command name.
cmd="$nonopt"
test -z "$cmd" && \
func_fatal_help "you must specify a COMMAND"
# Handle -dlopen flags immediately.
- for file in $opt_dlopen; do
+ for file in $execute_dlfiles; do
test -f "$file" \
|| func_fatal_help "\`$file' is not a file"
dir=
case $file in
*.la)
- func_resolve_sysroot "$file"
- file=$func_resolve_sysroot_result
-
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$lib' is not a valid libtool archive"
# Read the libtool library.
dlname=
library_names=
func_source "$file"
# Skip this library if it cannot be dlopened.
if test -z "$dlname"; then
# Warn if it was a shared library.
test -n "$library_names" && \
func_warning "\`$file' was not linked with \`-export-dynamic'"
continue
fi
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test -f "$dir/$objdir/$dlname"; then
- func_append dir "/$objdir"
+ dir="$dir/$objdir"
else
if test ! -f "$dir/$dlname"; then
func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
fi
fi
;;
*.lo)
# Just add the directory containing the .lo file.
func_dirname "$file" "" "."
dir="$func_dirname_result"
;;
*)
func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
continue
;;
esac
# Get the absolute pathname.
absdir=`cd "$dir" && pwd`
test -n "$absdir" && dir="$absdir"
# Now add the directory to shlibpath_var.
if eval "test -z \"\$$shlibpath_var\""; then
eval "$shlibpath_var=\"\$dir\""
else
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
fi
done
# This variable tells wrapper scripts just to set shlibpath_var
# rather than running their programs.
libtool_execute_magic="$magic"
# Check if any of the arguments is a wrapper script.
args=
for file
do
case $file in
- -* | *.la | *.lo ) ;;
+ -*) ;;
*)
# Do a test to see if this is really a libtool program.
if func_ltwrapper_script_p "$file"; then
func_source "$file"
# Transform arg to wrapped name.
file="$progdir/$program"
elif func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
func_source "$func_ltwrapper_scriptname_result"
# Transform arg to wrapped name.
file="$progdir/$program"
fi
;;
esac
# Quote arguments (to preserve shell metacharacters).
- func_append_quoted args "$file"
+ func_quote_for_eval "$file"
+ args="$args $func_quote_for_eval_result"
done
if test "X$opt_dry_run" = Xfalse; then
if test -n "$shlibpath_var"; then
# Export the shlibpath_var.
eval "export $shlibpath_var"
fi
# Restore saved environment variables
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var
else
$lt_unset $lt_var
fi"
done
# Now prepare to actually exec the command.
exec_cmd="\$cmd$args"
else
# Display what would be done.
if test -n "$shlibpath_var"; then
eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
- echo "export $shlibpath_var"
+ $ECHO "export $shlibpath_var"
fi
$ECHO "$cmd$args"
exit $EXIT_SUCCESS
fi
}
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+test "$mode" = execute && func_mode_execute ${1+"$@"}
# func_mode_finish arg...
func_mode_finish ()
{
$opt_debug
- libs=
- libdirs=
+ libdirs="$nonopt"
admincmds=
- for opt in "$nonopt" ${1+"$@"}
- do
- if test -d "$opt"; then
- func_append libdirs " $opt"
-
- elif test -f "$opt"; then
- if func_lalib_unsafe_p "$opt"; then
- func_append libs " $opt"
- else
- func_warning "\`$opt' is not a valid libtool archive"
- fi
-
- else
- func_fatal_error "invalid argument \`$opt'"
- fi
- done
-
- if test -n "$libs"; then
- if test -n "$lt_sysroot"; then
- sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
- sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
- else
- sysroot_cmd=
- fi
-
- # Remove sysroot references
- if $opt_dry_run; then
- for lib in $libs; do
- echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
- done
- else
- tmpdir=`func_mktempdir`
- for lib in $libs; do
- sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
- > $tmpdir/tmp-la
- mv -f $tmpdir/tmp-la $lib
- done
- ${RM}r "$tmpdir"
- fi
- fi
-
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
for libdir in $libdirs; do
if test -n "$finish_cmds"; then
# Do each command in the finish commands.
func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
'"$cmd"'"'
fi
if test -n "$finish_eval"; then
# Do the single finish_eval.
eval cmds=\"$finish_eval\"
- $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $opt_dry_run || eval "$cmds" || admincmds="$admincmds
$cmds"
fi
done
fi
# Exit here if they wanted silent mode.
$opt_silent && exit $EXIT_SUCCESS
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- $ECHO " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $ECHO " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $ECHO " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
-
- echo "See any operating system documentation about shared libraries for"
- case $host in
- solaris2.[6789]|solaris2.1[0-9])
- echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
- echo "pages."
- ;;
- *)
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- ;;
- esac
- echo "----------------------------------------------------------------------"
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
+ $ECHO "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ $ECHO
+ $ECHO "If you ever happen to want to link against installed libraries"
+ $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+ $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $ECHO "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $ECHO " during execution"
fi
+ if test -n "$runpath_var"; then
+ $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
+ $ECHO " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $ECHO
+
+ $ECHO "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ $ECHO "pages."
+ ;;
+ *)
+ $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS
}
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+test "$mode" = finish && func_mode_finish ${1+"$@"}
# func_mode_install arg...
func_mode_install ()
{
$opt_debug
# There may be an optional sh(1) argument at the beginning of
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
- case $nonopt in *shtool*) :;; *) false;; esac; then
+ $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
# Aesthetically quote it.
func_quote_for_eval "$nonopt"
install_prog="$func_quote_for_eval_result "
arg=$1
shift
else
install_prog=
arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
func_quote_for_eval "$arg"
- func_append install_prog "$func_quote_for_eval_result"
- install_shared_prog=$install_prog
- case " $install_prog " in
- *[\\\ /]cp\ *) install_cp=: ;;
- *) install_cp=false ;;
- esac
+ install_prog="$install_prog$func_quote_for_eval_result"
# We need to accept at least all the BSD install flags.
dest=
files=
opts=
prev=
install_type=
isdir=no
stripme=
- no_mode=:
for arg
do
- arg2=
if test -n "$dest"; then
- func_append files " $dest"
+ files="$files $dest"
dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
-f)
- if $install_cp; then :; else
- prev=$arg
- fi
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
;;
-g | -m | -o)
prev=$arg
;;
-s)
stripme=" -s"
continue
;;
-*)
;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
- if test "x$prev" = x-m && test -n "$install_override_mode"; then
- arg2=$install_override_mode
- no_mode=false
- fi
prev=
else
dest=$arg
continue
fi
;;
esac
# Aesthetically quote the argument.
func_quote_for_eval "$arg"
- func_append install_prog " $func_quote_for_eval_result"
- if test -n "$arg2"; then
- func_quote_for_eval "$arg2"
- fi
- func_append install_shared_prog " $func_quote_for_eval_result"
+ install_prog="$install_prog $func_quote_for_eval_result"
done
test -z "$install_prog" && \
func_fatal_help "you must specify an install program"
test -n "$prev" && \
func_fatal_help "the \`$prev' option requires an argument"
- if test -n "$install_override_mode" && $no_mode; then
- if $install_cp; then :; else
- func_quote_for_eval "$install_override_mode"
- func_append install_shared_prog " -m $func_quote_for_eval_result"
- fi
- fi
-
if test -z "$files"; then
if test -z "$dest"; then
func_fatal_help "no file or destination specified"
else
func_fatal_help "you must specify a destination"
fi
fi
# Strip any trailing slash from the destination.
func_stripname '' '/' "$dest"
dest=$func_stripname_result
# Check to see that the destination is a directory.
test -d "$dest" && isdir=yes
if test "$isdir" = yes; then
destdir="$dest"
destname=
else
func_dirname_and_basename "$dest" "" "."
destdir="$func_dirname_result"
destname="$func_basename_result"
# Not a directory, so check to see that there is only one file specified.
set dummy $files; shift
test "$#" -gt 1 && \
func_fatal_help "\`$dest' is not a directory"
fi
case $destdir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
for file in $files; do
case $file in
*.lo) ;;
*)
func_fatal_help "\`$destdir' must be an absolute directory name"
;;
esac
done
;;
esac
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
staticlibs=
future_libdirs=
current_libdirs=
for file in $files; do
# Do each installation.
case $file in
*.$libext)
# Do the static libraries later.
- func_append staticlibs " $file"
+ staticlibs="$staticlibs $file"
;;
*.la)
- func_resolve_sysroot "$file"
- file=$func_resolve_sysroot_result
-
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$file" \
|| func_fatal_help "\`$file' is not a valid libtool archive"
library_names=
old_library=
relink_command=
func_source "$file"
# Add the libdir to current_libdirs if it is the destination.
if test "X$destdir" = "X$libdir"; then
case "$current_libdirs " in
*" $libdir "*) ;;
- *) func_append current_libdirs " $libdir" ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
esac
else
# Note the libdir as a future libdir.
case "$future_libdirs " in
*" $libdir "*) ;;
- *) func_append future_libdirs " $libdir" ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
esac
fi
func_dirname "$file" "/" ""
dir="$func_dirname_result"
- func_append dir "$objdir"
+ dir="$dir$objdir"
if test -n "$relink_command"; then
# Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+ inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
# Don't allow the user to place us outside of our expected
# location b/c this prevents finding dependent libraries that
# are installed to the same prefix.
# At present, this check doesn't affect windows .dll's that
# are installed into $libdir/../bin (currently, that works fine)
# but it's something to keep an eye on.
test "$inst_prefix_dir" = "$destdir" && \
func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
- relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
else
- relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
fi
func_warning "relinking \`$file'"
func_show_eval "$relink_command" \
'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
fi
# See the names of the shared library.
set dummy $library_names; shift
if test -n "$1"; then
realname="$1"
shift
srcname="$realname"
test -n "$relink_command" && srcname="$realname"T
# Install the shared library and build the symlinks.
- func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
'exit $?'
tstripme="$stripme"
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
case $realname in
*.dll.a)
tstripme=""
;;
esac
;;
esac
if test -n "$tstripme" && test -n "$striplib"; then
func_show_eval "$striplib $destdir/$realname" 'exit $?'
fi
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
# Try `ln -sf' first, because the `ln' binary might depend on
# the symlink we replace! Solaris /bin/ln does not understand -f,
# so we also need to try rm && ln -s.
for linkname
do
test "$linkname" != "$realname" \
&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
done
fi
# Do each command in the postinstall commands.
lib="$destdir/$realname"
func_execute_cmds "$postinstall_cmds" 'exit $?'
fi
# Install the pseudo-library for information purposes.
func_basename "$file"
name="$func_basename_result"
instname="$dir/$name"i
func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
# Maybe install the static library, too.
- test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
;;
*.lo)
# Install (i.e. copy) a libtool object.
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# Deduce the name of the destination old-style object file.
case $destfile in
*.lo)
func_lo2o "$destfile"
staticdest=$func_lo2o_result
;;
*.$objext)
staticdest="$destfile"
destfile=
;;
*)
func_fatal_help "cannot copy a libtool object to \`$destfile'"
;;
esac
# Install the libtool object if requested.
test -n "$destfile" && \
func_show_eval "$install_prog $file $destfile" 'exit $?'
# Install the old object if enabled.
if test "$build_old_libs" = yes; then
# Deduce the name of the old-style object file.
func_lo2o "$file"
staticobj=$func_lo2o_result
func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
fi
exit $EXIT_SUCCESS
;;
*)
# Figure out destination file name, if it wasn't already specified.
if test -n "$destname"; then
destfile="$destdir/$destname"
else
func_basename "$file"
destfile="$func_basename_result"
destfile="$destdir/$destfile"
fi
# If the file is missing, and there is a .exe on the end, strip it
# because it is most likely a libtool script we actually want to
# install
stripped_ext=""
case $file in
*.exe)
if test ! -f "$file"; then
func_stripname '' '.exe' "$file"
file=$func_stripname_result
stripped_ext=".exe"
fi
;;
esac
# Do a test to see if this is really a libtool program.
case $host in
*cygwin* | *mingw*)
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
wrapper=$func_ltwrapper_scriptname_result
else
func_stripname '' '.exe' "$file"
wrapper=$func_stripname_result
fi
;;
*)
wrapper=$file
;;
esac
if func_ltwrapper_script_p "$wrapper"; then
notinst_deplibs=
relink_command=
func_source "$wrapper"
# Check the variables that should have been set.
test -z "$generated_by_libtool_version" && \
func_fatal_error "invalid libtool wrapper script \`$wrapper'"
finalize=yes
for lib in $notinst_deplibs; do
# Check to see that each library is installed.
libdir=
if test -f "$lib"; then
func_source "$lib"
fi
- libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
if test -n "$libdir" && test ! -f "$libfile"; then
func_warning "\`$lib' has not been installed in \`$libdir'"
finalize=no
fi
done
relink_command=
func_source "$wrapper"
outputname=
if test "$fast_install" = no && test -n "$relink_command"; then
$opt_dry_run || {
if test "$finalize" = yes; then
tmpdir=`func_mktempdir`
func_basename "$file$stripped_ext"
file="$func_basename_result"
outputname="$tmpdir/$file"
# Replace the output file specification.
- relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
$opt_silent || {
func_quote_for_expand "$relink_command"
eval "func_echo $func_quote_for_expand_result"
}
if eval "$relink_command"; then :
else
func_error "error: relink \`$file' with the above command before installing it"
$opt_dry_run || ${RM}r "$tmpdir"
continue
fi
file="$outputname"
else
func_warning "cannot relink \`$file'"
fi
}
else
# Install the binary that we compiled earlier.
- file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
fi
fi
# remove .exe since cygwin /usr/bin/install will append another
# one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
*.exe:*.exe)
# this is ok
;;
*.exe:*)
destfile=$destfile.exe
;;
*:*.exe)
func_stripname '' '.exe' "$destfile"
destfile=$func_stripname_result
;;
esac
;;
esac
func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
$opt_dry_run || if test -n "$outputname"; then
${RM}r "$tmpdir"
fi
;;
esac
done
for file in $staticlibs; do
func_basename "$file"
name="$func_basename_result"
# Set up the ranlib parameters.
oldlib="$destdir/$name"
func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
if test -n "$stripme" && test -n "$old_striplib"; then
func_show_eval "$old_striplib $oldlib" 'exit $?'
fi
# Do each command in the postinstall commands.
func_execute_cmds "$old_postinstall_cmds" 'exit $?'
done
test -n "$future_libdirs" && \
func_warning "remember to run \`$progname --finish$future_libdirs'"
if test -n "$current_libdirs"; then
# Maybe just do a dry run.
$opt_dry_run && current_libdirs=" -n$current_libdirs"
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
else
exit $EXIT_SUCCESS
fi
}
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
+test "$mode" = install && func_mode_install ${1+"$@"}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
# a dlpreopen symbol table.
func_generate_dlsyms ()
{
$opt_debug
my_outputname="$1"
my_originator="$2"
my_pic_p="${3-no}"
my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
my_dlsyms=
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
if test -n "$NM" && test -n "$global_symbol_pipe"; then
my_dlsyms="${my_outputname}S.c"
else
func_error "not configured to extract global symbols from dlpreopened files"
fi
fi
if test -n "$my_dlsyms"; then
case $my_dlsyms in
"") ;;
*.c)
# Discover the nlist of each of the dlfiles.
nlist="$output_objdir/${my_outputname}.nm"
func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
# Parse the name list into a source file.
func_verbose "creating $output_objdir/$my_dlsyms"
$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
#ifdef __cplusplus
extern \"C\" {
#endif
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
-#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
-#endif
-
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
- relocations are performed -- see ld's documentation on pseudo-relocs. */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data. */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
/* External symbol declarations for the compiler. */\
"
if test "$dlself" = yes; then
func_verbose "generating symbol list for \`$output'"
$opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
# Add our own program objects to the symbol list.
- progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
for progfile in $progfiles; do
- func_to_tool_file "$progfile" func_convert_file_msys_to_w32
- func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
- $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ func_verbose "extracting global C symbols from \`$progfile'"
+ $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
done
if test -n "$exclude_expsyms"; then
$opt_dry_run || {
eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
if test -n "$export_symbols_regex"; then
$opt_dry_run || {
eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
}
fi
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
export_symbols="$output_objdir/$outputname.exp"
$opt_dry_run || {
$RM $export_symbols
eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
case $host in
*cygwin* | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
;;
esac
}
else
$opt_dry_run || {
eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
- *cygwin* | *mingw* | *cegcc* )
+ *cygwin | *mingw* | *cegcc* )
eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
;;
esac
}
fi
fi
for dlprefile in $dlprefiles; do
func_verbose "extracting global C symbols from \`$dlprefile'"
func_basename "$dlprefile"
name="$func_basename_result"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- # if an import library, we need to obtain dlname
- if func_win32_import_lib_p "$dlprefile"; then
- func_tr_sh "$dlprefile"
- eval "curr_lafile=\$libfile_$func_tr_sh_result"
- dlprefile_dlbasename=""
- if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
- # Use subshell, to avoid clobbering current variable values
- dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
- if test -n "$dlprefile_dlname" ; then
- func_basename "$dlprefile_dlname"
- dlprefile_dlbasename="$func_basename_result"
- else
- # no lafile. user explicitly requested -dlpreopen <import library>.
- $sharedlib_from_linklib_cmd "$dlprefile"
- dlprefile_dlbasename=$sharedlib_from_linklib_result
- fi
- fi
- $opt_dry_run || {
- if test -n "$dlprefile_dlbasename" ; then
- eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
- else
- func_warning "Could not compute DLL name from $name"
- eval '$ECHO ": $name " >> "$nlist"'
- fi
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
- $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
- }
- else # not an import lib
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- fi
- ;;
- *)
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- ;;
- esac
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
done
$opt_dry_run || {
# Make sure we have at least an empty file.
test -f "$nlist" || : > "$nlist"
if test -n "$exclude_expsyms"; then
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
$MV "$nlist"T "$nlist"
fi
# Try sorting and uniquifying the output.
if $GREP -v "^: " < "$nlist" |
if sort -k 3 </dev/null >/dev/null 2>&1; then
sort -k 3
else
sort +2
fi |
uniq > "$nlist"S; then
:
else
$GREP -v "^: " < "$nlist" > "$nlist"S
fi
if test -f "$nlist"S; then
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
else
- echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
fi
- echo >> "$output_objdir/$my_dlsyms" "\
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
/* The mapping between symbol names and symbols. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
-extern LT_DLSYM_CONST lt_dlsymlist
+"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs. */"
+ lt_dlsym_const= ;;
+ *osf5*)
+ echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+ lt_dlsym_const= ;;
+ *)
+ lt_dlsym_const=const ;;
+ esac
+
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[];
-LT_DLSYM_CONST lt_dlsymlist
+$lt_dlsym_const lt_dlsymlist
lt_${my_prefix}_LTX_preloaded_symbols[] =
{\
{ \"$my_originator\", (void *) 0 },"
case $need_lib_prefix in
no)
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
*)
eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
;;
esac
- echo >> "$output_objdir/$my_dlsyms" "\
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt_${my_prefix}_LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif\
"
} # !$opt_dry_run
pic_flag_for_symtable=
case "$compile_command " in
*" -static "*) ;;
*)
case $host in
# compiling the symbol table file with pic_flag works around
# a FreeBSD bug that causes programs to crash when -lm is
# linked before any other PIC object. But we must not use
# pic_flag when linking with -static. The problem exists in
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
*-*-hpux*)
pic_flag_for_symtable=" $pic_flag" ;;
*)
if test "X$my_pic_p" != Xno; then
pic_flag_for_symtable=" $pic_flag"
fi
;;
esac
;;
esac
symtab_cflags=
for arg in $LTCFLAGS; do
case $arg in
-pie | -fpie | -fPIE) ;;
- *) func_append symtab_cflags " $arg" ;;
+ *) symtab_cflags="$symtab_cflags $arg" ;;
esac
done
# Now compile the dynamic symbol file.
func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
# Clean up the generated files.
func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
# Transform the symbol file into the correct name.
symfileobj="$output_objdir/${my_outputname}S.$objext"
case $host in
*cygwin* | *mingw* | *cegcc* )
if test -f "$output_objdir/$my_outputname.def"; then
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
else
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
fi
;;
*)
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
;;
esac
;;
*)
func_fatal_error "unknown suffix for \`$my_dlsyms'"
;;
esac
else
# We keep going just in case the user didn't refer to
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
# really was required.
# Nullify the symbol file.
- compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
fi
}
# func_win32_libid arg
# return the library type of file 'arg'
#
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-# Despite the name, also deal with 64 bit binaries.
func_win32_libid ()
{
$opt_debug
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
*ar\ archive\ import\ library*) # definitely import
win32_libid_type="x86 archive import"
;;
*ar\ archive*) # could be an import, or static
- # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
- $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 |
$SED -n -e '
1,100{
/ I /{
s,.*,import,
p
q
}
}'`
case $win32_nmres in
import*) win32_libid_type="x86 archive import";;
*) win32_libid_type="x86 archive static";;
esac
fi
;;
*DLL*)
win32_libid_type="x86 DLL"
;;
*executable*) # but shell scripts are "executable" too...
case $win32_fileres in
*MS\ Windows\ PE\ Intel*)
win32_libid_type="x86 DLL"
;;
esac
;;
esac
$ECHO "$win32_libid_type"
}
-# func_cygming_dll_for_implib ARG
-#
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-# Invoked by eval'ing the libtool variable
-# $sharedlib_from_linklib_cmd
-# Result is available in the variable
-# $sharedlib_from_linklib_result
-func_cygming_dll_for_implib ()
-{
- $opt_debug
- sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
-}
-
-# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
-#
-# The is the core of a fallback implementation of a
-# platform-specific function to extract the name of the
-# DLL associated with the specified import library LIBNAME.
-#
-# SECTION_NAME is either .idata$6 or .idata$7, depending
-# on the platform and compiler that created the implib.
-#
-# Echos the name of the DLL associated with the
-# specified import library.
-func_cygming_dll_for_implib_fallback_core ()
-{
- $opt_debug
- match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
- $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
- $SED '/^Contents of section '"$match_literal"':/{
- # Place marker at beginning of archive member dllname section
- s/.*/====MARK====/
- p
- d
- }
- # These lines can sometimes be longer than 43 characters, but
- # are always uninteresting
- /:[ ]*file format pe[i]\{,1\}-/d
- /^In archive [^:]*:/d
- # Ensure marker is printed
- /^====MARK====/p
- # Remove all lines with less than 43 characters
- /^.\{43\}/!d
- # From remaining lines, remove first 43 characters
- s/^.\{43\}//' |
- $SED -n '
- # Join marker and all lines until next marker into a single line
- /^====MARK====/ b para
- H
- $ b para
- b
- :para
- x
- s/\n//g
- # Remove the marker
- s/^====MARK====//
- # Remove trailing dots and whitespace
- s/[\. \t]*$//
- # Print
- /./p' |
- # we now have a list, one entry per line, of the stringified
- # contents of the appropriate section of all members of the
- # archive which possess that section. Heuristic: eliminate
- # all those which have a first or second character that is
- # a '.' (that is, objdump's representation of an unprintable
- # character.) This should work for all archives with less than
- # 0x302f exports -- but will fail for DLLs whose name actually
- # begins with a literal '.' or a single character followed by
- # a '.'.
- #
- # Of those that remain, print the first one.
- $SED -e '/^\./d;/^.\./d;q'
-}
-
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
- $opt_debug
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
- test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
- $opt_debug
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
- test -n "$func_cygming_ms_implib_tmp"
-}
-
-# func_cygming_dll_for_implib_fallback ARG
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-#
-# This fallback implementation is for use when $DLLTOOL
-# does not support the --identify-strict option.
-# Invoked by eval'ing the libtool variable
-# $sharedlib_from_linklib_cmd
-# Result is available in the variable
-# $sharedlib_from_linklib_result
-func_cygming_dll_for_implib_fallback ()
-{
- $opt_debug
- if func_cygming_gnu_implib_p "$1" ; then
- # binutils import library
- sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
- elif func_cygming_ms_implib_p "$1" ; then
- # ms-generated import library
- sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
- else
- # unknown
- sharedlib_from_linklib_result=""
- fi
-}
# func_extract_an_archive dir oldlib
func_extract_an_archive ()
{
$opt_debug
f_ex_an_ar_dir="$1"; shift
f_ex_an_ar_oldlib="$1"
- if test "$lock_old_archive_extraction" = yes; then
- lockfile=$f_ex_an_ar_oldlib.lock
- until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
- func_echo "Waiting for $lockfile to be removed"
- sleep 2
- done
- fi
- func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
- 'stat=$?; rm -f "$lockfile"; exit $stat'
- if test "$lock_old_archive_extraction" = yes; then
- $opt_dry_run || rm -f "$lockfile"
- fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
:
else
func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
fi
}
# func_extract_archives gentop oldlib ...
func_extract_archives ()
{
$opt_debug
my_gentop="$1"; shift
my_oldlibs=${1+"$@"}
my_oldobjs=""
my_xlib=""
my_xabs=""
my_xdir=""
for my_xlib in $my_oldlibs; do
# Extract the objects.
case $my_xlib in
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
*) my_xabs=`pwd`"/$my_xlib" ;;
esac
func_basename "$my_xlib"
my_xlib="$func_basename_result"
my_xlib_u=$my_xlib
while :; do
case " $extracted_archives " in
*" $my_xlib_u "*)
func_arith $extracted_serial + 1
extracted_serial=$func_arith_result
my_xlib_u=lt$extracted_serial-$my_xlib ;;
*) break ;;
esac
done
extracted_archives="$extracted_archives $my_xlib_u"
my_xdir="$my_gentop/$my_xlib_u"
func_mkdir_p "$my_xdir"
case $host in
*-darwin*)
func_verbose "Extracting $my_xabs"
# Do not bother doing anything if just a dry run
$opt_dry_run || {
darwin_orig_dir=`pwd`
cd $my_xdir || exit $?
darwin_archive=$my_xabs
darwin_curdir=`pwd`
darwin_base_archive=`basename "$darwin_archive"`
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
if test -n "$darwin_arches"; then
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
darwin_arch=
func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
for darwin_arch in $darwin_arches ; do
func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
$LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
cd "$darwin_curdir"
$RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
done # $darwin_arches
## Okay now we've a bunch of thin objects, gotta fatten them up :)
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
darwin_file=
darwin_files=
for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
$LIPO -create -output "$darwin_file" $darwin_files
done # $darwin_filelist
$RM -rf unfat-$$
cd "$darwin_orig_dir"
else
cd $darwin_orig_dir
func_extract_an_archive "$my_xdir" "$my_xabs"
fi # $darwin_arches
} # !$opt_dry_run
;;
*)
func_extract_an_archive "$my_xdir" "$my_xabs"
;;
esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
done
func_extract_archives_result="$my_oldobjs"
}
+
+# func_emit_wrapper_part1 [arg=no]
+#
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
+{
+ func_emit_wrapper_part1_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part1_arg1=$1
+ fi
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ ECHO=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$ECHO works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$ECHO will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $ECHO "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+ func_emit_wrapper_part2_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part2_arg1=$1
+ fi
+
+ $ECHO "\
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+# end: func_emit_wrapper_part2
+
+
# func_emit_wrapper [arg=no]
#
# Emit a libtool wrapper script on stdout.
# Don't directly open a file because we may want to
# incorporate the script contents within a cygwin/mingw
# wrapper executable. Must ONLY be called from within
# func_mode_link because it depends on a number of variables
# set therein.
#
# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
# variable will take. If 'yes', then the emitted script
# will assume that the directory in which it is stored is
# the $objdir directory. This is a cygwin/mingw-specific
# behavior.
func_emit_wrapper ()
{
- func_emit_wrapper_arg1=${1-no}
-
- $ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+ func_emit_wrapper_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_arg1=$1
+ fi
+
+ # split this up so that func_emit_cwrapperexe_src
+ # can call each part independently.
+ func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+ func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin. Calling this function does no harm for other
+# $host/$build combinations not listed above.
#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variables:
- generated_by_libtool_version='$macro_version'
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$ECHO are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- file=\"\$0\""
-
- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
- $ECHO "\
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
{
- eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
- ECHO=\"$qECHO\"
- fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's $0 value, followed by "$@".
-lt_option_debug=
-func_parse_lt_options ()
-{
- lt_script_arg0=\$0
- shift
- for lt_opt
- do
- case \"\$lt_opt\" in
- --lt-debug) lt_option_debug=1 ;;
- --lt-dump-script)
- lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
- test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
- lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
- cat \"\$lt_dump_D/\$lt_dump_F\"
- exit 0
- ;;
- --lt-*)
- \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
- exit 1
- ;;
+ func_to_host_path_result="$1"
+ if test -n "$1" ; then
+ case $host in
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ case $build in
+ *mingw* ) # actually, msys
+ # awkward: cmd appends spaces to result
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_path_tmp1=`cygpath -w "$1"`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # Unfortunately, winepath does not exit with a non-zero
+ # error code, so we are forced to check the contents of
+ # stdout. On the other hand, if the command is not
+ # found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both
+ # error code of zero AND non-empty stdout, which explains
+ # the odd construction:
+ func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ # Allow warning below.
+ func_to_host_path_result=""
+ fi
+ ;;
+ esac
+ if test -z "$func_to_host_path_result" ; then
+ func_error "Could not determine host path corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_path_result="$1"
+ fi
+ ;;
esac
- done
-
- # Print the debug banner immediately:
- if test -n \"\$lt_option_debug\"; then
- echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
fi
}
-
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
{
- lt_dump_args_N=1;
- for lt_arg
- do
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
- lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
- done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2* | *-cegcc*)
- $ECHO "\
- if test -n \"\$lt_option_debug\"; then
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
- func_lt_dump_args \${1+\"\$@\"} 1>&2
- fi
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $ECHO "\
- if test -n \"\$lt_option_debug\"; then
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
- func_lt_dump_args \${1+\"\$@\"} 1>&2
- fi
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
- ;;
- esac
- $ECHO "\
- \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
- exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from \$@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
- for lt_wr_arg
- do
- case \$lt_wr_arg in
- --lt-*) ;;
- *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
- esac
- shift
- done
- func_exec_program_core \${1+\"\$@\"}
-}
-
- # Parse options
- func_parse_lt_options \"\$0\" \${1+\"\$@\"}
-
- # Find the directory that this script lives in.
- thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
- done
-
- # Usually 'no', except on cygwin/mingw when embedded into
- # the cwrapper.
- WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
- if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
- # special case for '.'
- if test \"\$thisdir\" = \".\"; then
- thisdir=\`pwd\`
- fi
- # remove .libs from thisdir
- case \"\$thisdir\" in
- *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
- $objdir ) thisdir=. ;;
+ func_to_host_pathlist_result="$1"
+ if test -n "$1" ; then
+ case $host in
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_to_host_pathlist_tmp2="$1"
+ # Once set for this call, this variable should not be
+ # reassigned. It is used in tha fallback case.
+ func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e 's|^:*||' -e 's|:*$||'`
+ case $build in
+ *mingw* ) # Actually, msys.
+ # Awkward: cmd appends spaces to result.
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # unfortunately, winepath doesn't convert pathlists
+ func_to_host_pathlist_result=""
+ func_to_host_pathlist_oldIFS=$IFS
+ IFS=:
+ for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+ IFS=$func_to_host_pathlist_oldIFS
+ if test -n "$func_to_host_pathlist_f" ; then
+ func_to_host_path "$func_to_host_pathlist_f"
+ if test -n "$func_to_host_path_result" ; then
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_to_host_pathlist_result="$func_to_host_path_result"
+ else
+ func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+ fi
+ fi
+ fi
+ IFS=:
+ done
+ IFS=$func_to_host_pathlist_oldIFS
+ ;;
+ esac
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_error "Could not determine the host path(s) corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This may break if $1 contains DOS-style drive
+ # specifications. The fix is not to complicate the expression
+ # below, but for the user to provide a working wine installation
+ # with winepath so that path translation in the cross-to-mingw
+ # case works properly.
+ lt_replace_pathsep_nix_to_dos="s|:|;|g"
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_replace_pathsep_nix_to_dos"`
+ fi
+ # Now, add the leading and trailing path separators back
+ case "$1" in
+ :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+ ;;
+ esac
+ case "$1" in
+ *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+ ;;
+ esac
+ ;;
esac
fi
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $ECHO "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" ||
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $MKDIR \"\$progdir\"
- else
- $RM \"\$progdir/\$file\"
- fi"
-
- $ECHO "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $ECHO \"\$relink_command_output\" >&2
- $RM \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $RM \"\$progdir/\$program\";
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $RM \"\$progdir/\$file\"
- fi"
- else
- $ECHO "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $ECHO "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # fixup the dll searchpath if we need to.
- #
- # Fix the DLL searchpath if we need to. Do this before prepending
- # to shlibpath, because on Windows, both are PATH and uninstalled
- # libraries must come first.
- if test -n "$dllsearchpath"; then
- $ECHO "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $ECHO "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- $ECHO "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
- func_exec_program \${1+\"\$@\"}
- fi
- else
- # The program doesn't exist.
- \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
- \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
- \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
}
-
+# end: func_to_host_pathlist
# func_emit_cwrapperexe_src
# emit the source code for a wrapper executable on stdout
# Must ONLY be called from within func_mode_link because
# it depends on a number of variable set therein.
func_emit_cwrapperexe_src ()
{
cat <<EOF
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
The $output program cannot be directly executed until all the libtool
libraries that it depends on are installed.
This wrapper executable should never be moved out of the build directory.
If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "$SHELL $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
*/
EOF
cat <<"EOF"
-#ifdef _MSC_VER
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER
# include <direct.h>
# include <process.h>
# include <io.h>
+# define setmode _setmode
#else
# include <unistd.h>
# include <stdint.h>
# ifdef __CYGWIN__
# include <io.h>
+# define HAVE_SETENV
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
# endif
#endif
#include <malloc.h>
#include <stdarg.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
-/* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
-# ifdef __STRICT_ANSI__
-int _putenv (const char *);
-# endif
-#elif defined(__CYGWIN__)
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-/* #elif defined (other platforms) ... */
-#endif
-
-/* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
-# define setmode _setmode
-# define stat _stat
-# define chmod _chmod
-# define getcwd _getcwd
-# define putenv _putenv
-# define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-# define _INTPTR_T_DEFINED
-# define intptr_t int
-# endif
-#elif defined(__MINGW32__)
-# define setmode _setmode
-# define stat _stat
-# define chmod _chmod
-# define getcwd _getcwd
-# define putenv _putenv
-#elif defined(__CYGWIN__)
-# define HAVE_SETENV
-# define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
-#endif
-
#if defined(PATH_MAX)
# define LT_PATHMAX PATH_MAX
#elif defined(MAXPATHLEN)
# define LT_PATHMAX MAXPATHLEN
#else
# define LT_PATHMAX 1024
#endif
#ifndef S_IXOTH
# define S_IXOTH 0
#endif
#ifndef S_IXGRP
# define S_IXGRP 0
#endif
-/* path handling portability macros */
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#endif
+
#ifndef DIR_SEPARATOR
# define DIR_SEPARATOR '/'
# define PATH_SEPARATOR ':'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
# define HAVE_DOS_BASED_FILE_SYSTEM
# define FOPEN_WB "wb"
# ifndef DIR_SEPARATOR_2
# define DIR_SEPARATOR_2 '\\'
# endif
# ifndef PATH_SEPARATOR_2
# define PATH_SEPARATOR_2 ';'
# endif
#endif
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
#ifndef PATH_SEPARATOR_2
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
#else /* PATH_SEPARATOR_2 */
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
#endif /* PATH_SEPARATOR_2 */
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
#ifndef FOPEN_WB
# define FOPEN_WB "w"
#endif
#ifndef _O_BINARY
# define _O_BINARY 0
#endif
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
#define XFREE(stale) do { \
if (stale) { free ((void *) stale); stale = 0; } \
} while (0)
-#if defined(LT_DEBUGWRAPPER)
-static int lt_debug = 1;
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+}
#else
-static int lt_debug = 0;
+# define LTWRAPPER_DEBUGPRINTF(args)
#endif
-const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+const char *program_name = NULL;
void *xmalloc (size_t num);
char *xstrdup (const char *string);
const char *base_name (const char *name);
char *find_executable (const char *wrapper);
char *chase_symlinks (const char *pathspec);
int make_executable (const char *path);
int check_executable (const char *path);
char *strendzap (char *str, const char *pat);
-void lt_debugprintf (const char *file, int line, const char *fmt, ...);
-void lt_fatal (const char *file, int line, const char *message, ...);
-static const char *nonnull (const char *s);
-static const char *nonempty (const char *s);
+void lt_fatal (const char *message, ...);
void lt_setenv (const char *name, const char *value);
char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
void lt_update_exe_path (const char *name, const char *value);
void lt_update_lib_path (const char *name, const char *value);
-char **prepare_spawn (char **argv);
-void lt_dump_script (FILE *f);
+
+static const char *script_text_part1 =
EOF
+ func_emit_wrapper_part1 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+
+static const char *script_text_part2 =
+EOF
+ func_emit_wrapper_part2 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
+
+ cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
const char * LIB_PATH_VARNAME = "$shlibpath_var";
EOF
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- func_to_host_path "$temp_rpath"
+ func_to_host_pathlist "$temp_rpath"
cat <<EOF
-const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
EOF
else
cat <<"EOF"
const char * LIB_PATH_VALUE = "";
EOF
fi
if test -n "$dllsearchpath"; then
- func_to_host_path "$dllsearchpath:"
+ func_to_host_pathlist "$dllsearchpath:"
cat <<EOF
const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
EOF
else
cat <<"EOF"
const char * EXE_PATH_VARNAME = "";
const char * EXE_PATH_VALUE = "";
EOF
fi
if test "$fast_install" = yes; then
cat <<EOF
const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
EOF
else
cat <<EOF
const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
EOF
fi
cat <<"EOF"
#define LTWRAPPER_OPTION_PREFIX "--lt-"
-
+#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
+
+static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
-static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
+ /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
+ /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
+ /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
int
main (int argc, char *argv[])
{
char **newargz;
int newargc;
char *tmp_pathspec;
char *actual_cwrapper_path;
char *actual_cwrapper_name;
char *target_name;
char *lt_argv_zero;
intptr_t rval = 127;
int i;
program_name = (char *) xstrdup (base_name (argv[0]));
- newargz = XMALLOC (char *, argc + 1);
-
- /* very simple arg parsing; don't want to rely on getopt
- * also, copy all non cwrapper options to newargz, except
- * argz[0], which is handled differently
- */
- newargc=0;
+ LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
+ LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+ /* very simple arg parsing; don't want to rely on getopt */
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], dumpscript_opt) == 0)
{
EOF
case "$host" in
*mingw* | *cygwin* )
# make stdout use "unix" line endings
echo " setmode(1,_O_BINARY);"
;;
esac
cat <<"EOF"
- lt_dump_script (stdout);
+ printf ("%s", script_text_part1);
+ printf ("%s", script_text_part2);
return 0;
}
- if (strcmp (argv[i], debug_opt) == 0)
- {
- lt_debug = 1;
- continue;
- }
- if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
- {
- /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
- namespace, but it is not one of the ones we know about and
- have already dealt with, above (inluding dump-script), then
- report an error. Otherwise, targets might begin to believe
- they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
- namespace. The first time any user complains about this, we'll
- need to make LTWRAPPER_OPTION_PREFIX a configure-time option
- or a configure.ac-settable value.
- */
- lt_fatal (__FILE__, __LINE__,
- "unrecognized %s option: '%s'",
- ltwrapper_option_prefix, argv[i]);
- }
- /* otherwise ... */
- newargz[++newargc] = xstrdup (argv[i]);
}
- newargz[++newargc] = NULL;
-
-EOF
- cat <<EOF
- /* The GNU banner must be the first non-error debug message */
- lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
-EOF
- cat <<"EOF"
- lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
- lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
-
+
+ newargz = XMALLOC (char *, argc + 1);
tmp_pathspec = find_executable (argv[0]);
if (tmp_pathspec == NULL)
- lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
- lt_debugprintf (__FILE__, __LINE__,
- "(main) found exe (before symlink chase) at: %s\n",
- tmp_pathspec);
+ lt_fatal ("Couldn't find %s", argv[0]);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+ tmp_pathspec));
actual_cwrapper_path = chase_symlinks (tmp_pathspec);
- lt_debugprintf (__FILE__, __LINE__,
- "(main) found exe (after symlink chase) at: %s\n",
- actual_cwrapper_path);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+ actual_cwrapper_path));
XFREE (tmp_pathspec);
- actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
strendzap (actual_cwrapper_path, actual_cwrapper_name);
/* wrapper name transforms */
strendzap (actual_cwrapper_name, ".exe");
tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
XFREE (actual_cwrapper_name);
actual_cwrapper_name = tmp_pathspec;
tmp_pathspec = 0;
/* target_name transforms -- use actual target program name; might have lt- prefix */
target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
strendzap (target_name, ".exe");
tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
XFREE (target_name);
target_name = tmp_pathspec;
tmp_pathspec = 0;
- lt_debugprintf (__FILE__, __LINE__,
- "(main) libtool target name: %s\n",
- target_name);
+ LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+ target_name));
EOF
cat <<EOF
newargz[0] =
XMALLOC (char, (strlen (actual_cwrapper_path) +
strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
strcpy (newargz[0], actual_cwrapper_path);
strcat (newargz[0], "$objdir");
strcat (newargz[0], "/");
EOF
cat <<"EOF"
/* stop here, and copy so we don't have to do this twice */
tmp_pathspec = xstrdup (newargz[0]);
/* do NOT want the lt- prefix here, so use actual_cwrapper_name */
strcat (newargz[0], actual_cwrapper_name);
/* DO want the lt- prefix here if it exists, so use target_name */
lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
XFREE (tmp_pathspec);
tmp_pathspec = NULL;
EOF
case $host_os in
mingw*)
cat <<"EOF"
{
char* p;
while ((p = strchr (newargz[0], '\\')) != NULL)
{
*p = '/';
}
while ((p = strchr (lt_argv_zero, '\\')) != NULL)
{
*p = '/';
}
}
EOF
;;
esac
cat <<"EOF"
XFREE (target_name);
XFREE (actual_cwrapper_path);
XFREE (actual_cwrapper_name);
lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
lt_setenv ("DUALCASE", "1"); /* for MSK sh */
- /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
- be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
- because on Windows, both *_VARNAMEs are PATH but uninstalled
- libraries must come first. */
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
- lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
-
- lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
- nonnull (lt_argv_zero));
+
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+ {
+ if (argv[i][env_set_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_set_opt_len + 1;
+ lt_opt_process_env_set (p);
+ }
+ else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_set (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_set_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+ {
+ if (argv[i][env_prepend_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_prepend_opt_len + 1;
+ lt_opt_process_env_prepend (p);
+ }
+ else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_prepend_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+ {
+ if (argv[i][env_append_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_append_opt_len + 1;
+ lt_opt_process_env_append (p);
+ }
+ else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_append (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_append_opt);
+ continue;
+ }
+ if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal ("Unrecognized option in %s namespace: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+ LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
for (i = 0; i < newargc; i++)
{
- lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
- i, nonnull (newargz[i]));
+ LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
}
EOF
case $host_os in
mingw*)
cat <<"EOF"
/* execv doesn't actually work on mingw as expected on unix */
- newargz = prepare_spawn (newargz);
rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
if (rval == -1)
{
/* failed to start process */
- lt_debugprintf (__FILE__, __LINE__,
- "(main) failed to launch target \"%s\": %s\n",
- lt_argv_zero, nonnull (strerror (errno)));
+ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
return 127;
}
return rval;
EOF
;;
*)
cat <<"EOF"
execv (lt_argv_zero, newargz);
return rval; /* =127, but avoids unused variable warning */
EOF
;;
esac
cat <<"EOF"
}
void *
xmalloc (size_t num)
{
void *p = (void *) malloc (num);
if (!p)
- lt_fatal (__FILE__, __LINE__, "memory exhausted");
+ lt_fatal ("Memory exhausted");
return p;
}
char *
xstrdup (const char *string)
{
return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
string) : NULL;
}
const char *
base_name (const char *name)
{
const char *base;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
if (isalpha ((unsigned char) name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
if (IS_DIR_SEPARATOR (*name))
base = name + 1;
return base;
}
int
check_executable (const char *path)
{
struct stat st;
- lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
- nonempty (path));
+ LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
if ((!path) || (!*path))
return 0;
if ((stat (path, &st) >= 0)
&& (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
return 1;
else
return 0;
}
int
make_executable (const char *path)
{
int rval = 0;
struct stat st;
- lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
- nonempty (path));
+ LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
if ((!path) || (!*path))
return 0;
if (stat (path, &st) >= 0)
{
rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
}
return rval;
}
/* Searches for the full path of the wrapper. Returns
newly allocated full path name if found, NULL otherwise
Does not chase symlinks, even on platforms that support them.
*/
char *
find_executable (const char *wrapper)
{
int has_slash = 0;
const char *p;
const char *p_next;
/* static buffer for getcwd */
char tmp[LT_PATHMAX + 1];
int tmp_len;
char *concat_name;
- lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
- nonempty (wrapper));
+ LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n",
+ wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
if ((wrapper == NULL) || (*wrapper == '\0'))
return NULL;
/* Absolute path? */
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
else
{
#endif
if (IS_DIR_SEPARATOR (wrapper[0]))
{
concat_name = xstrdup (wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
}
#endif
for (p = wrapper; *p; p++)
if (*p == '/')
{
has_slash = 1;
break;
}
if (!has_slash)
{
/* no slashes; search PATH */
const char *path = getenv ("PATH");
if (path != NULL)
{
for (p = path; *p; p = p_next)
{
const char *q;
size_t p_len;
for (q = p; *q; q++)
if (IS_PATH_SEPARATOR (*q))
break;
p_len = q - p;
p_next = (*q == '\0' ? q : q + 1);
if (p_len == 0)
{
/* empty path: current directory */
if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
- nonnull (strerror (errno)));
+ lt_fatal ("getcwd failed");
tmp_len = strlen (tmp);
concat_name =
XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
}
else
{
concat_name =
XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, p, p_len);
concat_name[p_len] = '/';
strcpy (concat_name + p_len + 1, wrapper);
}
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
}
}
/* not found in PATH; assume curdir */
}
/* Relative path | not found in path: prepend cwd */
if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
- nonnull (strerror (errno)));
+ lt_fatal ("getcwd failed");
tmp_len = strlen (tmp);
concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
memcpy (concat_name, tmp, tmp_len);
concat_name[tmp_len] = '/';
strcpy (concat_name + tmp_len + 1, wrapper);
if (check_executable (concat_name))
return concat_name;
XFREE (concat_name);
return NULL;
}
char *
chase_symlinks (const char *pathspec)
{
#ifndef S_ISLNK
return xstrdup (pathspec);
#else
char buf[LT_PATHMAX];
struct stat s;
char *tmp_pathspec = xstrdup (pathspec);
char *p;
int has_symlinks = 0;
while (strlen (tmp_pathspec) && !has_symlinks)
{
- lt_debugprintf (__FILE__, __LINE__,
- "checking path component for symlinks: %s\n",
- tmp_pathspec);
+ LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+ tmp_pathspec));
if (lstat (tmp_pathspec, &s) == 0)
{
if (S_ISLNK (s.st_mode) != 0)
{
has_symlinks = 1;
break;
}
/* search backwards for last DIR_SEPARATOR */
p = tmp_pathspec + strlen (tmp_pathspec) - 1;
while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
p--;
if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
{
/* no more DIR_SEPARATORS left */
break;
}
*p = '\0';
}
else
{
- lt_fatal (__FILE__, __LINE__,
- "error accessing file \"%s\": %s",
- tmp_pathspec, nonnull (strerror (errno)));
+ char *errstr = strerror (errno);
+ lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
}
}
XFREE (tmp_pathspec);
if (!has_symlinks)
{
return xstrdup (pathspec);
}
tmp_pathspec = realpath (pathspec, buf);
if (tmp_pathspec == 0)
{
- lt_fatal (__FILE__, __LINE__,
- "could not follow symlinks for %s", pathspec);
+ lt_fatal ("Could not follow symlinks for %s", pathspec);
}
return xstrdup (tmp_pathspec);
#endif
}
char *
strendzap (char *str, const char *pat)
{
size_t len, patlen;
assert (str != NULL);
assert (pat != NULL);
len = strlen (str);
patlen = strlen (pat);
if (patlen <= len)
{
str += len - patlen;
if (strcmp (str, pat) == 0)
*str = '\0';
}
return str;
}
-void
-lt_debugprintf (const char *file, int line, const char *fmt, ...)
-{
- va_list args;
- if (lt_debug)
- {
- (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
- va_start (args, fmt);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
- }
-}
-
static void
-lt_error_core (int exit_status, const char *file,
- int line, const char *mode,
+lt_error_core (int exit_status, const char *mode,
const char *message, va_list ap)
{
- fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ fprintf (stderr, "%s: %s: ", program_name, mode);
vfprintf (stderr, message, ap);
fprintf (stderr, ".\n");
if (exit_status >= 0)
exit (exit_status);
}
void
-lt_fatal (const char *file, int line, const char *message, ...)
+lt_fatal (const char *message, ...)
{
va_list ap;
va_start (ap, message);
- lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
va_end (ap);
}
-static const char *
-nonnull (const char *s)
-{
- return s ? s : "(null)";
-}
-
-static const char *
-nonempty (const char *s)
-{
- return (s && !*s) ? "(empty)" : nonnull (s);
-}
-
void
lt_setenv (const char *name, const char *value)
{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_setenv) setting '%s' to '%s'\n",
- nonnull (name), nonnull (value));
+ LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
{
#ifdef HAVE_SETENV
/* always make a copy, for consistency with !HAVE_SETENV */
char *str = xstrdup (value);
setenv (name, str, 1);
#else
int len = strlen (name) + 1 + strlen (value) + 1;
char *str = XMALLOC (char, len);
sprintf (str, "%s=%s", name, value);
if (putenv (str) != EXIT_SUCCESS)
{
XFREE (str);
}
#endif
}
}
char *
lt_extend_str (const char *orig_value, const char *add, int to_end)
{
char *new_value;
if (orig_value && *orig_value)
{
int orig_value_len = strlen (orig_value);
int add_len = strlen (add);
new_value = XMALLOC (char, add_len + orig_value_len + 1);
if (to_end)
{
strcpy (new_value, orig_value);
strcpy (new_value + orig_value_len, add);
}
else
{
strcpy (new_value, add);
strcpy (new_value + add_len, orig_value);
}
}
else
{
new_value = xstrdup (add);
}
return new_value;
}
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+ const char *p;
+ int len;
+ if (!arg || !*arg)
+ return 1;
+
+ p = strchr (arg, (int)'=');
+
+ if (!p)
+ return 1;
+
+ *value = xstrdup (++p);
+
+ len = strlen (arg) - strlen (*value);
+ *name = XMALLOC (char, len);
+ strncpy (*name, arg, len-1);
+ (*name)[len - 1] = '\0';
+
+ return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+ }
+
+ lt_setenv (name, value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 1);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
void
lt_update_exe_path (const char *name, const char *value)
{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
- nonnull (name), nonnull (value));
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
/* some systems can't cope with a ':'-terminated path #' */
int len = strlen (new_value);
while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
{
new_value[len-1] = '\0';
}
lt_setenv (name, new_value);
XFREE (new_value);
}
}
void
lt_update_lib_path (const char *name, const char *value)
{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
- nonnull (name), nonnull (value));
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
if (name && *name && value && *value)
{
char *new_value = lt_extend_str (getenv (name), value, 0);
lt_setenv (name, new_value);
XFREE (new_value);
}
}
-EOF
- case $host_os in
- mingw*)
- cat <<"EOF"
-
-/* Prepares an argument vector before calling spawn().
- Note that spawn() does not by itself call the command interpreter
- (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
- ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&v);
- v.dwPlatformId == VER_PLATFORM_WIN32_NT;
- }) ? "cmd.exe" : "command.com").
- Instead it simply concatenates the arguments, separated by ' ', and calls
- CreateProcess(). We must quote the arguments since Win32 CreateProcess()
- interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
- special way:
- - Space and tab are interpreted as delimiters. They are not treated as
- delimiters if they are surrounded by double quotes: "...".
- - Unescaped double quotes are removed from the input. Their only effect is
- that within double quotes, space and tab are treated like normal
- characters.
- - Backslashes not followed by double quotes are not special.
- - But 2*n+1 backslashes followed by a double quote become
- n backslashes followed by a double quote (n >= 0):
- \" -> "
- \\\" -> \"
- \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-char **
-prepare_spawn (char **argv)
-{
- size_t argc;
- char **new_argv;
- size_t i;
-
- /* Count number of arguments. */
- for (argc = 0; argv[argc] != NULL; argc++)
- ;
-
- /* Allocate new argument vector. */
- new_argv = XMALLOC (char *, argc + 1);
-
- /* Put quoted arguments into the new argument vector. */
- for (i = 0; i < argc; i++)
- {
- const char *string = argv[i];
-
- if (string[0] == '\0')
- new_argv[i] = xstrdup ("\"\"");
- else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
- {
- int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
- size_t length;
- unsigned int backslashes;
- const char *s;
- char *quoted_string;
- char *p;
-
- length = 0;
- backslashes = 0;
- if (quote_around)
- length++;
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- length += backslashes + 1;
- length++;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- length += backslashes + 1;
-
- quoted_string = XMALLOC (char, length + 1);
-
- p = quoted_string;
- backslashes = 0;
- if (quote_around)
- *p++ = '"';
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- {
- unsigned int j;
- for (j = backslashes + 1; j > 0; j--)
- *p++ = '\\';
- }
- *p++ = c;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- {
- unsigned int j;
- for (j = backslashes; j > 0; j--)
- *p++ = '\\';
- *p++ = '"';
- }
- *p = '\0';
-
- new_argv[i] = quoted_string;
- }
- else
- new_argv[i] = (char *) string;
- }
- new_argv[argc] = NULL;
-
- return new_argv;
-}
-EOF
- ;;
- esac
-
- cat <<"EOF"
-void lt_dump_script (FILE* f)
-{
-EOF
- func_emit_wrapper yes |
- $SED -e 's/\([\\"]\)/\\\1/g' \
- -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
-
- cat <<"EOF"
-}
+
EOF
}
# end: func_emit_cwrapperexe_src
-# func_win32_import_lib_p ARG
-# True if ARG is an import lib, as indicated by $file_magic_cmd
-func_win32_import_lib_p ()
-{
- $opt_debug
- case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
- *import*) : ;;
- *) false ;;
- esac
-}
-
# func_mode_link arg...
func_mode_link ()
{
$opt_debug
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
# flag for every libtool invocation.
# allow_undefined=no
# FIXME: Unfortunately, there are problems with the above when trying
# to make a dll which has undefined symbols, in which case not
# even a static library is built. For now, we need to specify
# -no-undefined on the libtool link line when we can be certain
# that all symbols are satisfied, otherwise we get a static library.
allow_undefined=yes
;;
*)
allow_undefined=yes
;;
esac
libtool_args=$nonopt
base_compile="$nonopt $@"
compile_command=$nonopt
finalize_command=$nonopt
compile_rpath=
finalize_rpath=
compile_shlibpath=
finalize_shlibpath=
convenience=
old_convenience=
deplibs=
old_deplibs=
compiler_flags=
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
new_inherited_linker_flags=
avoid_version=no
- bindir=
dlfiles=
dlprefiles=
dlself=no
export_dynamic=no
export_symbols=
export_symbols_regex=
generated=
libobjs=
ltlibs=
module=no
no_install=no
objs=
non_pic_objects=
precious_files_regex=
prefer_static_libs=no
preload=no
prev=
prevarg=
release=
rpath=
xrpath=
perm_rpath=
temp_rpath=
thread_safe=no
vinfo=
vinfo_number=no
weak_libs=
single_module="${wl}-single_module"
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
-shared)
test "$build_libtool_libs" != yes && \
func_fatal_configuration "can not build a shared library"
build_old_libs=no
break
;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
-static)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=built
;;
-static-libtool-libs)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
;;
esac
build_libtool_libs=no
build_old_libs=yes
break
;;
esac
done
# See if our shared archives depend on static archives.
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
# Go through the arguments, transforming them on the way.
while test "$#" -gt 0; do
arg="$1"
shift
func_quote_for_eval "$arg"
qarg=$func_quote_for_eval_unquoted_result
func_append libtool_args " $func_quote_for_eval_result"
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
case $prev in
output)
func_append compile_command " @OUTPUT@"
func_append finalize_command " @OUTPUT@"
;;
esac
case $prev in
- bindir)
- bindir="$arg"
- prev=
- continue
- ;;
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
func_append compile_command " @SYMFILE@"
func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
*.la | *.lo) ;; # We handle these cases below.
force)
if test "$dlself" = no; then
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
self)
if test "$prev" = dlprefiles; then
dlself=yes
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
dlself=yes
else
dlself=needless
export_dynamic=yes
fi
prev=
continue
;;
*)
if test "$prev" = dlfiles; then
- func_append dlfiles " $arg"
+ dlfiles="$dlfiles $arg"
else
- func_append dlprefiles " $arg"
+ dlprefiles="$dlprefiles $arg"
fi
prev=
continue
;;
esac
;;
expsyms)
export_symbols="$arg"
test -f "$arg" \
|| func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
expsyms_regex)
export_symbols_regex="$arg"
prev=
continue
;;
framework)
case $host in
*-*-darwin*)
case "$deplibs " in
*" $qarg.ltframework "*) ;;
- *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
;;
esac
;;
esac
prev=
continue
;;
inst_prefix)
inst_prefix_dir="$arg"
prev=
continue
;;
objectlist)
if test -f "$arg"; then
save_arg=$arg
moreargs=
for fil in `cat "$save_arg"`
do
-# func_append moreargs " $fil"
+# moreargs="$moreargs $fil"
arg=$fil
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- func_append dlfiles " $pic_object"
+ dlfiles="$dlfiles $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
- func_append dlprefiles " $pic_object"
+ dlprefiles="$dlprefiles $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
precious_regex)
precious_files_regex="$arg"
prev=
continue
;;
release)
release="-$arg"
prev=
continue
;;
rpath | xrpath)
# We need an absolute path.
case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
case "$rpath " in
*" $arg "*) ;;
- *) func_append rpath " $arg" ;;
+ *) rpath="$rpath $arg" ;;
esac
else
case "$xrpath " in
*" $arg "*) ;;
- *) func_append xrpath " $arg" ;;
+ *) xrpath="$xrpath $arg" ;;
esac
fi
prev=
continue
;;
shrext)
shrext_cmds="$arg"
prev=
continue
;;
weak)
- func_append weak_libs " $arg"
+ weak_libs="$weak_libs $arg"
prev=
continue
;;
xcclinker)
- func_append linker_flags " $qarg"
- func_append compiler_flags " $qarg"
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xcompiler)
- func_append compiler_flags " $qarg"
+ compiler_flags="$compiler_flags $qarg"
prev=
func_append compile_command " $qarg"
func_append finalize_command " $qarg"
continue
;;
xlinker)
- func_append linker_flags " $qarg"
- func_append compiler_flags " $wl$qarg"
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
prev=
func_append compile_command " $wl$qarg"
func_append finalize_command " $wl$qarg"
continue
;;
*)
eval "$prev=\"\$arg\""
prev=
continue
;;
esac
fi # test -n "$prev"
prevarg="$arg"
case $arg in
-all-static)
if test -n "$link_static_flag"; then
# See comment for -static flag below, for more details.
func_append compile_command " $link_static_flag"
func_append finalize_command " $link_static_flag"
fi
continue
;;
-allow-undefined)
# FIXME: remove this flag sometime in the future.
func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
avoid_version=yes
continue
;;
- -bindir)
- prev=bindir
- continue
- ;;
-
-dlopen)
prev=dlfiles
continue
;;
-dlpreopen)
prev=dlprefiles
continue
;;
-export-dynamic)
export_dynamic=yes
continue
;;
-export-symbols | -export-symbols-regex)
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
else
prev=expsyms_regex
fi
continue
;;
-framework)
prev=framework
continue
;;
-inst-prefix-dir)
prev=inst_prefix
continue
;;
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
func_append compile_command " $arg"
func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
- func_stripname "-L" '' "$arg"
- if test -z "$func_stripname_result"; then
+ func_stripname '-L' '' "$arg"
+ dir=$func_stripname_result
+ if test -z "$dir"; then
if test "$#" -gt 0; then
func_fatal_error "require no space between \`-L' and \`$1'"
else
func_fatal_error "need path for \`-L' option"
fi
fi
- func_resolve_sysroot "$func_stripname_result"
- dir=$func_resolve_sysroot_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
test -z "$absdir" && \
func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
case "$deplibs " in
- *" -L$dir "* | *" $arg "*)
- # Will only happen for absolute or sysroot arguments
- ;;
+ *" -L$dir "*) ;;
*)
- # Preserve sysroot, but never include relative directories
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
- *) func_append deplibs " -L$dir" ;;
- esac
- func_append lib_search_path " $dir"
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
;;
esac
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
::) dllsearchpath=$dir;;
- *) func_append dllsearchpath ":$dir";;
+ *) dllsearchpath="$dllsearchpath:$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
- *) func_append dllsearchpath ":$testbindir";;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
esac
continue
;;
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
# These systems don't actually have a C or math library (as such)
continue
;;
*-*-os2*)
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
- func_append deplibs " System.ltframework"
+ deplibs="$deplibs System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
test "X$arg" = "X-lc" && continue
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
test "X$arg" = "X-lc" && continue
;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
esac
fi
- func_append deplibs " $arg"
+ deplibs="$deplibs $arg"
continue
;;
-module)
module=yes
continue
;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
# Darwin uses the -arch flag to determine output architecture.
- -model|-arch|-isysroot|--sysroot)
- func_append compiler_flags " $arg"
+ -model|-arch|-isysroot)
+ compiler_flags="$compiler_flags $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- func_append compiler_flags " $arg"
+ compiler_flags="$compiler_flags $arg"
func_append compile_command " $arg"
func_append finalize_command " $arg"
case "$new_inherited_linker_flags " in
*" $arg "*) ;;
- * ) func_append new_inherited_linker_flags " $arg" ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
esac
continue
;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-no-fast-install)
fast_install=no
continue
;;
-no-install)
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
func_warning "\`-no-install' is ignored for $host"
func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
esac
continue
;;
-no-undefined)
allow_undefined=no
continue
;;
-objectlist)
prev=objectlist
continue
;;
-o) prev=output ;;
-precious-files-regex)
prev=precious_regex
continue
;;
-release)
prev=release
continue
;;
-rpath)
prev=rpath
continue
;;
-R)
prev=xrpath
continue
;;
-R*)
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
- =*)
- func_stripname '=' '' "$dir"
- dir=$lt_sysroot$func_stripname_result
- ;;
*)
func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
*" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
+ *) xrpath="$xrpath $dir" ;;
esac
continue
;;
-shared)
# The effects of -shared are defined in a previous loop.
continue
;;
-shrext)
prev=shrext
continue
;;
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
# would be equivalent was wrong. It would break on at least
# Digital Unix and AIX.
continue
;;
-thread-safe)
thread_safe=yes
continue
;;
-version-info)
prev=vinfo
continue
;;
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
-weak)
prev=weak
continue
;;
-Wc,*)
func_stripname '-Wc,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
- func_append arg " $func_quote_for_eval_result"
- func_append compiler_flags " $func_quote_for_eval_result"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Wl,*)
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
func_quote_for_eval "$flag"
- func_append arg " $wl$func_quote_for_eval_result"
- func_append compiler_flags " $wl$func_quote_for_eval_result"
- func_append linker_flags " $func_quote_for_eval_result"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+ linker_flags="$linker_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
-Xcompiler)
prev=xcompiler
continue
;;
-Xlinker)
prev=xlinker
continue
;;
-XCClinker)
prev=xcclinker
continue
;;
# -msg_* for osf cc
-msg_*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
- # Flags to be passed through unchanged, with rationale:
- # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
- # -r[0-9][0-9]* specify processor for the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
- # +DA*, +DD* enable 64-bit mode for the HP compiler
- # -q* compiler args for the IBM compiler
- # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
- # -F/path path to uninstalled frameworks, gcc on darwin
- # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
- # @file GCC response files
- # -tp=* Portland pgcc target processor selection
- # --sysroot=* for sysroot support
- # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -F/path gives path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+ # @file GCC response files
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
- -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
func_append compile_command " $arg"
func_append finalize_command " $arg"
- func_append compiler_flags " $arg"
+ compiler_flags="$compiler_flags $arg"
continue
;;
# Some other compiler flag.
-* | +*)
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
*.$objext)
# A standard object.
- func_append objs " $arg"
+ objs="$objs $arg"
;;
*.lo)
# A libtool-controlled object.
# Check to see that this really is a libtool object.
if func_lalib_unsafe_p "$arg"; then
pic_object=
non_pic_object=
# Read the .lo file
func_source "$arg"
if test -z "$pic_object" ||
test -z "$non_pic_object" ||
test "$pic_object" = none &&
test "$non_pic_object" = none; then
func_fatal_error "cannot find name of object for \`$arg'"
fi
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
pic_object="$xdir$pic_object"
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- func_append dlfiles " $pic_object"
+ dlfiles="$dlfiles $pic_object"
prev=
continue
else
# If libtool objects are unsupported, then we need to preload.
prev=dlprefiles
fi
fi
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
- func_append dlprefiles " $pic_object"
+ dlprefiles="$dlprefiles $pic_object"
prev=
fi
# A PIC object.
func_append libobjs " $pic_object"
arg="$pic_object"
fi
# Non-PIC object.
if test "$non_pic_object" != none; then
# Prepend the subdirectory the object is found in.
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
else
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
func_append non_pic_objects " $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
if $opt_dry_run; then
# Extract subdirectory from the argument.
func_dirname "$arg" "/" ""
xdir="$func_dirname_result"
func_lo2o "$arg"
pic_object=$xdir$objdir/$func_lo2o_result
non_pic_object=$xdir$func_lo2o_result
func_append libobjs " $pic_object"
func_append non_pic_objects " $non_pic_object"
else
func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
*.$libext)
# An archive.
- func_append deplibs " $arg"
- func_append old_deplibs " $arg"
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
continue
;;
*.la)
# A libtool-controlled library.
- func_resolve_sysroot "$arg"
if test "$prev" = dlfiles; then
# This library was specified with -dlopen.
- func_append dlfiles " $func_resolve_sysroot_result"
+ dlfiles="$dlfiles $arg"
prev=
elif test "$prev" = dlprefiles; then
# The library was specified with -dlpreopen.
- func_append dlprefiles " $func_resolve_sysroot_result"
+ dlprefiles="$dlprefiles $arg"
prev=
else
- func_append deplibs " $func_resolve_sysroot_result"
+ deplibs="$deplibs $arg"
fi
continue
;;
# Some other compiler argument.
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
func_quote_for_eval "$arg"
arg="$func_quote_for_eval_result"
;;
esac # arg
# Now actually substitute the argument into the commands.
if test -n "$arg"; then
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
done # argument parsing loop
test -n "$prev" && \
func_fatal_help "the \`$prevarg' option requires an argument"
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
eval arg=\"$export_dynamic_flag_spec\"
func_append compile_command " $arg"
func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
func_basename "$output"
outputname="$func_basename_result"
libobjs_save="$libobjs"
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
else
shlib_search_path=
fi
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
func_dirname "$output" "/" ""
output_objdir="$func_dirname_result$objdir"
- func_to_tool_file "$output_objdir/"
- tool_output_objdir=$func_to_tool_file_result
# Create the object directory.
func_mkdir_p "$output_objdir"
# Determine the type of output
case $output in
"")
func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
*.la) linkmode=lib ;;
*) linkmode=prog ;; # Anything else should be a program.
esac
specialdeplibs=
libs=
# Find all interdependent deplibs by searching for libraries
# that are linked more than once (e.g. -la -lb -la)
for deplib in $deplibs; do
- if $opt_preserve_dup_deps ; then
+ if $opt_duplicate_deps ; then
case "$libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append libs " $deplib"
+ libs="$libs $deplib"
done
if test "$linkmode" = lib; then
libs="$predeps $libs $compiler_lib_search_path $postdeps"
# Compute libraries that are listed more than once in $predeps
# $postdeps and mark them as special (i.e., whose duplicates are
# not to be eliminated).
pre_post_deps=
if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
- *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
esac
- func_append pre_post_deps " $pre_post_dep"
+ pre_post_deps="$pre_post_deps $pre_post_dep"
done
fi
pre_post_deps=
fi
deplibs=
newdependency_libs=
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
notinst_path= # paths that contain not-installed libtool libraries
case $linkmode in
lib)
passes="conv dlpreopen link"
for file in $dlfiles $dlprefiles; do
case $file in
*.la) ;;
*)
func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
;;
prog)
compile_deplibs=
finalize_deplibs=
alldeplibs=no
newdlfiles=
newdlprefiles=
passes="conv scan dlopen dlpreopen link"
;;
*) passes="conv"
;;
esac
for pass in $passes; do
# The preopen pass in lib mode reverses $deplibs; put it back here
# so that -L comes before libs that need it for instance...
if test "$linkmode,$pass" = "lib,link"; then
## FIXME: Find the place where the list is rebuilt in the wrong
## order, and fix it there properly
tmp_deplibs=
for deplib in $deplibs; do
tmp_deplibs="$deplib $tmp_deplibs"
done
deplibs="$tmp_deplibs"
fi
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
deplibs=
fi
if test "$linkmode" = prog; then
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
# Collect and forward deplibs of preopened libtool libs
for lib in $dlprefiles; do
# Ignore non-libtool-libs
dependency_libs=
- func_resolve_sysroot "$lib"
case $lib in
- *.la) func_source "$func_resolve_sysroot_result" ;;
+ *.la) func_source "$lib" ;;
esac
# Collect preopened libtool deplibs, except any this library
# has declared as weak libs
for deplib in $dependency_libs; do
- func_basename "$deplib"
- deplib_base=$func_basename_result
+ deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
case " $weak_libs " in
*" $deplib_base "*) ;;
- *) func_append deplibs " $deplib" ;;
+ *) deplibs="$deplibs $deplib" ;;
esac
done
done
libs="$dlprefiles"
fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
for deplib in $libs; do
lib=
found=no
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- func_append compiler_flags " $deplib"
+ compiler_flags="$compiler_flags $deplib"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
- * ) func_append new_inherited_linker_flags " $deplib" ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
esac
fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
func_warning "\`-l' is ignored for archives/objects"
continue
fi
func_stripname '-l' '' "$deplib"
name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
fi
for searchdir in $searchdirs; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
if test -f "$lib"; then
if test "$search_ext" = ".la"; then
found=yes
else
found=no
fi
break 2
fi
done
done
if test "$found" != yes; then
# deplib doesn't seem to be a libtool library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
else # deplib is a libtool library
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
# We need to do some special things here, and not later.
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
if func_lalib_p "$lib"; then
library_names=
old_library=
func_source "$lib"
for l in $old_library $library_names; do
ll="$l"
done
if test "X$ll" = "X$old_library" ; then # only static version available
found=no
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
fi
continue
fi
fi
;;
*) ;;
esac
fi
fi
;; # -l
*.ltframework)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
deplibs="$deplib $deplibs"
if test "$linkmode" = lib ; then
case "$new_inherited_linker_flags " in
*" $deplib "*) ;;
- * ) func_append new_inherited_linker_flags " $deplib" ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
esac
fi
fi
continue
;;
-L*)
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
prog)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
if test "$pass" = scan; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
*)
func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
func_stripname '-R' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- dir=$func_resolve_sysroot_result
+ dir=$func_stripname_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
+ *) xrpath="$xrpath $dir" ;;
esac
fi
deplibs="$deplib $deplibs"
continue
;;
- *.la)
- func_resolve_sysroot "$deplib"
- lib=$func_resolve_sysroot_result
- ;;
+ *.la) lib="$deplib" ;;
*.$libext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
continue
fi
case $linkmode in
lib)
# Linking convenience modules into shared libraries is allowed,
# but linking other static libraries is non-portable.
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
valid_a_lib=no
case $deplibs_check_method in
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
- if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
valid_a_lib=yes
fi
;;
pass_all)
valid_a_lib=yes
;;
esac
if test "$valid_a_lib" != yes; then
- echo
+ $ECHO
$ECHO "*** Warning: Trying to link with static lib archive $deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because the file extensions .$libext of this argument makes me believe"
- echo "*** that it is just a static archive that I should not use here."
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which you do not appear to have"
+ $ECHO "*** because the file extensions .$libext of this argument makes me believe"
+ $ECHO "*** that it is just a static archive that I should not use here."
else
- echo
+ $ECHO
$ECHO "*** Warning: Linking the shared library $output against the"
$ECHO "*** static library $deplib is not portable!"
deplibs="$deplib $deplibs"
fi
;;
esac
continue
;;
prog)
if test "$pass" != link; then
deplibs="$deplib $deplibs"
else
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
continue
;;
esac # linkmode
;; # *.$libext
*.lo | *.$objext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
elif test "$linkmode" = prog; then
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
- func_append newdlprefiles " $deplib"
+ newdlprefiles="$newdlprefiles $deplib"
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- func_append newdlfiles " $deplib"
+ newdlfiles="$newdlfiles $deplib"
fi
fi
continue
;;
%DEPLIBS%)
alldeplibs=yes
continue
;;
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
else
func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
fi
# Check to see that this really is a libtool archive.
func_lalib_unsafe_p "$lib" \
|| func_fatal_error "\`$lib' is not a valid libtool archive"
func_dirname "$lib" "" "."
ladir="$func_dirname_result"
dlname=
dlopen=
dlpreopen=
libdir=
library_names=
old_library=
inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
avoidtemprpath=
# Read the .la file
func_source "$lib"
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
- *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
esac
done
fi
- dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && func_append dlfiles " $dlopen"
- test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
fi
if test "$pass" = conv; then
# Only check for convenience libraries
deplibs="$lib $deplibs"
if test -z "$libdir"; then
if test -z "$old_library"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
- func_append convenience " $ladir/$objdir/$old_library"
- func_append old_convenience " $ladir/$objdir/$old_library"
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
- if $opt_preserve_dup_deps ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append tmp_libs " $deplib"
+ tmp_libs="$tmp_libs $deplib"
done
continue
fi # $pass = conv
# Get the name of the library we link against.
linklib=
- if test -n "$old_library" &&
- { test "$prefer_static_libs" = yes ||
- test "$prefer_static_libs,$installed" = "built,no"; }; then
- linklib=$old_library
- else
- for l in $old_library $library_names; do
- linklib="$l"
- done
- fi
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
if test -z "$linklib"; then
func_fatal_error "cannot find name of link library for \`$lib'"
fi
# This library was specified with -dlopen.
if test "$pass" = dlopen; then
if test -z "$libdir"; then
func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no; then
# If there is no dlname, no dlopen support or we're linking
# statically, we need to preload. We also need to preload any
# dependent libraries so libltdl's deplib preloader doesn't
# bomb out in the load deplibs phase.
- func_append dlprefiles " $lib $dependency_libs"
+ dlprefiles="$dlprefiles $lib $dependency_libs"
else
- func_append newdlfiles " $lib"
+ newdlfiles="$newdlfiles $lib"
fi
continue
fi # $pass = dlopen
# We need an absolute path.
case $ladir in
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
*)
abs_ladir=`cd "$ladir" && pwd`
if test -z "$abs_ladir"; then
func_warning "cannot determine absolute directory name of \`$ladir'"
func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
func_basename "$lib"
laname="$func_basename_result"
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
- if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
else
- dir="$lt_sysroot$libdir"
- absdir="$lt_sysroot$libdir"
+ dir="$libdir"
+ absdir="$libdir"
fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
dir="$ladir"
absdir="$abs_ladir"
# Remove this search path later
- func_append notinst_path " $abs_ladir"
+ notinst_path="$notinst_path $abs_ladir"
else
dir="$ladir/$objdir"
absdir="$abs_ladir/$objdir"
# Remove this search path later
- func_append notinst_path " $abs_ladir"
+ notinst_path="$notinst_path $abs_ladir"
fi
fi # $installed = yes
func_stripname 'lib' '.la' "$laname"
name=$func_stripname_result
# This library was specified with -dlpreopen.
if test "$pass" = dlpreopen; then
if test -z "$libdir" && test "$linkmode" = prog; then
func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
fi
- case "$host" in
- # special handling for platforms with PE-DLLs.
- *cygwin* | *mingw* | *cegcc* )
- # Linker will automatically link against shared library if both
- # static and shared are present. Therefore, ensure we extract
- # symbols from the import library if a shared library is present
- # (otherwise, the dlopen module name will be incorrect). We do
- # this by putting the import library name into $newdlprefiles.
- # We recover the dlopen module name by 'saving' the la file
- # name in a special purpose variable, and (later) extracting the
- # dlname from the la file.
- if test -n "$dlname"; then
- func_tr_sh "$dir/$linklib"
- eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
- func_append newdlprefiles " $dir/$linklib"
- else
- func_append newdlprefiles " $dir/$old_library"
- # Keep a list of preopened convenience libraries to check
- # that they are being used correctly in the link pass.
- test -z "$libdir" && \
- func_append dlpreconveniencelibs " $dir/$old_library"
- fi
- ;;
- * )
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- func_append newdlprefiles " $dir/$old_library"
- # Keep a list of preopened convenience libraries to check
- # that they are being used correctly in the link pass.
- test -z "$libdir" && \
- func_append dlpreconveniencelibs " $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- func_append newdlprefiles " $dir/$dlname"
- else
- func_append newdlprefiles " $dir/$linklib"
- fi
- ;;
- esac
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
fi # $pass = dlpreopen
if test -z "$libdir"; then
# Link the convenience library
if test "$linkmode" = lib; then
deplibs="$dir/$old_library $deplibs"
elif test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$dir/$old_library $compile_deplibs"
finalize_deplibs="$dir/$old_library $finalize_deplibs"
else
deplibs="$lib $deplibs" # used for prog,scan pass
fi
continue
fi
if test "$linkmode" = prog && test "$pass" != link; then
- func_append newlib_search_path " $ladir"
+ newlib_search_path="$newlib_search_path $ladir"
deplibs="$lib $deplibs"
linkalldeplibs=no
if test "$link_all_deplibs" != no || test -z "$library_names" ||
test "$build_libtool_libs" = no; then
linkalldeplibs=yes
fi
tmp_libs=
for deplib in $dependency_libs; do
case $deplib in
-L*) func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
deplibs="$deplib $deplibs"
else
# Need to hardcode shared library paths
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
- if $opt_preserve_dup_deps ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append tmp_libs " $deplib"
+ tmp_libs="$tmp_libs $deplib"
done # for deplib
continue
fi # $linkmode = prog...
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
test "$prefer_static_libs,$installed" = "built,yes"; } ||
test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath:" in
*"$absdir:"*) ;;
- *) func_append temp_rpath "$absdir:" ;;
+ *) temp_rpath="$temp_rpath$absdir:" ;;
esac
fi
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
- *) func_append compile_rpath " $absdir" ;;
+ *) compile_rpath="$compile_rpath $absdir"
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
esac
;;
esac
fi # $linkmode,$pass = prog,link...
if test "$alldeplibs" = yes &&
{ test "$deplibs_check_method" = pass_all ||
{ test "$build_libtool_libs" = yes &&
test -n "$library_names"; }; }; then
# We only need to search for static libraries
continue
fi
fi
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
case $host in
*cygwin* | *mingw* | *cegcc*)
# No point in relinking DLLs because paths are not encoded
- func_append notinst_deplibs " $lib"
+ notinst_deplibs="$notinst_deplibs $lib"
need_relink=no
;;
*)
if test "$installed" = no; then
- func_append notinst_deplibs " $lib"
+ notinst_deplibs="$notinst_deplibs $lib"
need_relink=yes
fi
;;
esac
# This is a shared library
# Warn about portability, can't link against -module's on some
# systems (darwin). Don't bleat about dlopened modules though!
dlopenmodule=""
for dlpremoduletest in $dlprefiles; do
if test "X$dlpremoduletest" = "X$lib"; then
dlopenmodule="$dlpremoduletest"
break
fi
done
if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
- echo
+ $ECHO
if test "$linkmode" = prog; then
$ECHO "*** Warning: Linking the executable $output against the loadable module"
else
$ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
$ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
# Hardcode the library path.
# Skip directories that are in the system default run-time
# search path.
case " $sys_lib_dlsearch_path " in
*" $absdir "*) ;;
*)
case "$compile_rpath " in
*" $absdir "*) ;;
- *) func_append compile_rpath " $absdir" ;;
+ *) compile_rpath="$compile_rpath $absdir"
esac
;;
esac
case " $sys_lib_dlsearch_path " in
*" $libdir "*) ;;
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
esac
;;
esac
fi
if test -n "$old_archive_from_expsyms_cmds"; then
# figure out the soname
set dummy $library_names
shift
realname="$1"
shift
libname=`eval "\\$ECHO \"$libname_spec\""`
# use dlname if we got it. it's perfectly good, no?
if test -n "$dlname"; then
soname="$dlname"
elif test -n "$soname_spec"; then
# bleh windows
case $host in
*cygwin* | mingw* | *cegcc*)
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
esac
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
# Make a new name for the extract_expsyms_cmds to use
soroot="$soname"
func_basename "$soroot"
soname="$func_basename_result"
func_stripname 'lib' '.dll' "$soname"
newlib=libimp-$func_stripname_result.a
# If the library has no export list, then create one now
if test -f "$output_objdir/$soname-def"; then :
else
func_verbose "extracting exported symbol list from \`$soname'"
func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
fi
# Create $newlib
if test -f "$output_objdir/$newlib"; then :; else
func_verbose "generating import library for \`$soname'"
func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
linklib=$newlib
fi # test -n "$old_archive_from_expsyms_cmds"
- if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ if test "$linkmode" = prog || test "$mode" != relink; then
add_shlibpath=
add_dir=
add=
lib_linked=yes
case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
add="$dir/$linklib"
case $host in
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
# if the lib is a (non-dlopened) module then we can not
# link against it, someone is ignoring the earlier warnings
if /usr/bin/file -L $add 2> /dev/null |
$GREP ": [^:]* bundle" >/dev/null ; then
if test "X$dlopenmodule" != "X$lib"; then
$ECHO "*** Warning: lib $linklib is a module, not a shared library"
if test -z "$old_library" ; then
- echo
- echo "*** And there doesn't seem to be a static archive available"
- echo "*** The link will probably fail, sorry"
+ $ECHO
+ $ECHO "*** And there doesn't seem to be a static archive available"
+ $ECHO "*** The link will probably fail, sorry"
else
add="$dir/$old_library"
fi
elif test -n "$old_library"; then
add="$dir/$old_library"
fi
fi
esac
elif test "$hardcode_minus_L" = no; then
case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
esac
add_dir="-L$dir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = no; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
relink)
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
- func_append add_dir " -L$inst_prefix_dir$libdir"
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
add="-l$name"
else
lib_linked=no
fi
;;
*) lib_linked=no ;;
esac
if test "$lib_linked" != yes; then
func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
- *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
esac
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
test -n "$add" && compile_deplibs="$add $compile_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
if test "$hardcode_direct" != yes &&
test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
- *) func_append finalize_shlibpath "$libdir:" ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
fi
fi
fi
- if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ if test "$linkmode" = prog || test "$mode" = relink; then
add_shlibpath=
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
if test "$hardcode_direct" = yes &&
test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
- *) func_append finalize_shlibpath "$libdir:" ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
add="-l$name"
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
add="$inst_prefix_dir$libdir/$linklib"
else
add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
- func_append add_dir " -L$inst_prefix_dir$libdir"
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
add="-l$name"
fi
if test "$linkmode" = prog; then
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
fi
fi
elif test "$linkmode" = prog; then
# Here we assume that one of hardcode_direct or hardcode_minus_L
# is not unsupported. This is valid on all known static and
# shared platforms.
if test "$hardcode_direct" != unsupported; then
test -n "$old_library" && linklib="$old_library"
compile_deplibs="$dir/$linklib $compile_deplibs"
finalize_deplibs="$dir/$linklib $finalize_deplibs"
else
compile_deplibs="-l$name -L$dir $compile_deplibs"
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
fi
elif test "$build_libtool_libs" = yes; then
# Not a shared library
if test "$deplibs_check_method" != pass_all; then
# We're trying link a shared library against a static one
# but the system doesn't support it.
# Just print a warning and add the library to dependency_libs so
# that the program can be linked against the static library.
- echo
+ $ECHO
$ECHO "*** Warning: This system can not link to static lib archive $lib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which you do not appear to have."
if test "$module" = yes; then
- echo "*** But as you try to build a module library, libtool will still create "
- echo "*** a static module, that should work as long as the dlopening application"
- echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ $ECHO "*** But as you try to build a module library, libtool will still create "
+ $ECHO "*** a static module, that should work as long as the dlopening application"
+ $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ $ECHO
+ $ECHO "*** However, this would only work if libtool was able to extract symbol"
+ $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $ECHO "*** not find such a program. So, this module is probably useless."
+ $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
else
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
fi # link shared/static library?
if test "$linkmode" = lib; then
if test -n "$dependency_libs" &&
{ test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes ||
test "$link_static" = yes; }; then
# Extract -R from dependency_libs
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
-R*) func_stripname '-R' '' "$libdir"
temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
- *) func_append xrpath " $temp_xrpath";;
+ *) xrpath="$xrpath $temp_xrpath";;
esac;;
- *) func_append temp_deplibs " $libdir";;
+ *) temp_deplibs="$temp_deplibs $libdir";;
esac
done
dependency_libs="$temp_deplibs"
fi
- func_append newlib_search_path " $absdir"
+ newlib_search_path="$newlib_search_path $absdir"
# Link against this library
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
- case $deplib in
- -L*) func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result";;
- *) func_resolve_sysroot "$deplib" ;;
- esac
- if $opt_preserve_dup_deps ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
- *" $func_resolve_sysroot_result "*)
- func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append tmp_libs " $func_resolve_sysroot_result"
+ tmp_libs="$tmp_libs $deplib"
done
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
- path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
- func_resolve_sysroot "$deplib"
- deplib=$func_resolve_sysroot_result
func_dirname "$deplib" "" "."
- dir=$func_dirname_result
+ dir="$func_dirname_result"
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
func_warning "cannot determine absolute directory name of \`$dir'"
absdir="$dir"
fi
;;
esac
if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
if test -f "$absdir/$objdir/$depdepl" ; then
depdepl="$absdir/$objdir/$depdepl"
darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
if test -z "$darwin_install_name"; then
darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
fi
- func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
- func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
path=
fi
fi
;;
*)
path="-L$absdir/$objdir"
;;
esac
else
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
test "$absdir" != "$libdir" && \
func_warning "\`$deplib' seems to be moved"
path="-L$absdir"
fi
;;
esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
if test "$pass" = link; then
if test "$linkmode" = "prog"; then
compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
else
- compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
fi
fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
for deplib in $save_deplibs; do
deplibs="$deplib $deplibs"
done
fi
if test "$pass" != dlopen; then
if test "$pass" != conv; then
# Make sure lib_search_path contains only unique directories.
lib_search_path=
for dir in $newlib_search_path; do
case "$lib_search_path " in
*" $dir "*) ;;
- *) func_append lib_search_path " $dir" ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
esac
done
newlib_search_path=
fi
if test "$linkmode,$pass" != "prog,link"; then
vars="deplibs"
else
vars="compile_deplibs finalize_deplibs"
fi
for var in $vars dependency_libs; do
# Add libraries to $var in reverse order
eval tmp_libs=\"\$$var\"
new_libs=
for deplib in $tmp_libs; do
# FIXME: Pedantically, this is the right thing to do, so
# that some nasty dependency loop isn't accidentally
# broken:
#new_libs="$deplib $new_libs"
# Pragmatically, this seems to cause very few problems in
# practice:
case $deplib in
-L*) new_libs="$deplib $new_libs" ;;
-R*) ;;
*)
# And here is the reason: when a library appears more
# than once as an explicit dependence of a library, or
# is implicitly linked in more than once by the
# compiler, it is considered special, and multiple
# occurrences thereof are not removed. Compare this
# with having the same library being listed as a
# dependency of multiple other libraries: in this case,
# we know (pedantically, we assume) the library does not
# need to be listed more than once, so we keep only the
# last copy. This is not always right, but it is rare
# enough that we require users that really mean to play
# such unportable linking tricks to link the library
# using -Wl,-lname, so that libtool does not consider it
# for duplicate removal.
case " $specialdeplibs " in
*" $deplib "*) new_libs="$deplib $new_libs" ;;
*)
case " $new_libs " in
*" $deplib "*) ;;
*) new_libs="$deplib $new_libs" ;;
esac
;;
esac
;;
esac
done
tmp_libs=
for deplib in $new_libs; do
case $deplib in
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
- *) func_append tmp_libs " $deplib" ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
esac
;;
- *) func_append tmp_libs " $deplib" ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
esac
done
eval $var=\"$tmp_libs\"
done # for var
fi
# Last step: remove runtime libs from dependency_libs
# (they stay in deplibs)
tmp_libs=
for i in $dependency_libs ; do
case " $predeps $postdeps $compiler_lib_search_path " in
*" $i "*)
i=""
;;
esac
if test -n "$i" ; then
- func_append tmp_libs " $i"
+ tmp_libs="$tmp_libs $i"
fi
done
dependency_libs=$tmp_libs
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
fi
if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for archives"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for archives"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for archives"
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for archives"
test -n "$release" && \
func_warning "\`-release' is ignored for archives"
test -n "$export_symbols$export_symbols_regex" && \
func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
oldlibs="$output"
- func_append objs "$old_deplibs"
+ objs="$objs$old_deplibs"
;;
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
case $outputname in
lib*)
func_stripname 'lib' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
test "$module" = no && \
func_fatal_help "libtool library \`$output' must begin with \`lib'"
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
func_stripname '' '.la' "$outputname"
name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
func_stripname '' '.la' "$outputname"
libname=$func_stripname_result
fi
;;
esac
if test -n "$objs"; then
if test "$deplibs_check_method" != pass_all; then
func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
else
- echo
+ $ECHO
$ECHO "*** Warning: Linking the shared library $output against the non-libtool"
$ECHO "*** objects $objs is not portable!"
- func_append libobjs " $objs"
+ libobjs="$libobjs $objs"
fi
fi
test "$dlself" != no && \
func_warning "\`-dlopen self' is ignored for libtool libraries"
set dummy $rpath
shift
test "$#" -gt 1 && \
func_warning "ignoring multiple \`-rpath's for a libtool library"
install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
if test "$build_libtool_libs" = yes; then
# Building a libtool convenience library.
# Some compilers have problems with a `.al' extension so
# convenience libraries should have the same extension an
# archive normally would.
oldlibs="$output_objdir/$libname.$libext $oldlibs"
build_libtool_libs=convenience
build_old_libs=yes
fi
test -n "$vinfo" && \
func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
test -n "$release" && \
func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
shift
IFS="$save_ifs"
test -n "$7" && \
func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
# to make the code below a bit more comprehensible
case $vinfo_number in
yes)
number_major="$1"
number_minor="$2"
number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
# and those that subtract age and use age as
# a minor version. But, then there is irix
# which has an extra 1 added just for fun
#
case $version_type in
darwin|linux|osf|windows|none)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
- freebsd-aout|freebsd-elf|qnx|sunos)
+ freebsd-aout|freebsd-elf|sunos)
current="$number_major"
revision="$number_minor"
age="0"
;;
irix|nonstopux)
func_arith $number_major + $number_minor
current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
esac
;;
no)
current="$1"
revision="$2"
age="$3"
;;
esac
# Check that each of the things are valid numbers.
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "CURRENT \`$current' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "REVISION \`$revision' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
func_error "AGE \`$age' must be a nonnegative integer"
func_fatal_error "\`$vinfo' is not valid version information"
;;
esac
if test "$age" -gt "$current"; then
func_error "AGE \`$age' is greater than the current interface number \`$current'"
func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
major=
versuffix=
verstring=
case $version_type in
none) ;;
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
func_arith $current + 1
minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
freebsd-aout)
major=".$current"
versuffix=".$current.$revision";
;;
freebsd-elf)
major=".$current"
versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
func_arith $current - $age
else
func_arith $current - $age + 1
fi
major=$func_arith_result
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
esac
verstring="$verstring_prefix$major.$revision"
# Add in all the interfaces that we are compatible with.
loop=$revision
while test "$loop" -ne 0; do
func_arith $revision - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
# Before this point, $major must not contain `.'.
major=.$major
versuffix="$major.$revision"
;;
linux)
func_arith $current - $age
major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
func_arith $current - $age
major=.$func_arith_result
versuffix=".$current.$age.$revision"
verstring="$current.$age.$revision"
# Add in all the interfaces that we are compatible with.
loop=$age
while test "$loop" -ne 0; do
func_arith $current - $loop
iface=$func_arith_result
func_arith $loop - 1
loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
# Make executables depend on our current version.
- func_append verstring ":${current}.0"
+ verstring="$verstring:${current}.0"
;;
qnx)
major=".$current"
versuffix=".$current"
;;
sunos)
major=".$current"
versuffix=".$current.$revision"
;;
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
func_arith $current - $age
major=$func_arith_result
versuffix="-$major"
;;
*)
func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
# Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then
major=
case $version_type in
darwin)
# we can't check for "0.0" in archive_cmds due to quoting
# problems, so we reset it completely
verstring=
;;
*)
verstring="0.0"
;;
esac
if test "$need_version" = no; then
versuffix=
else
versuffix=".0.0"
fi
fi
# Remove version info from name if versioning should be avoided
if test "$avoid_version" = yes && test "$need_version" = no; then
major=
versuffix=
verstring=""
fi
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if test "$allow_undefined_flag" = unsupported; then
func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
else
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
fi
func_generate_dlsyms "$libname" "$libname" "yes"
- func_append libobjs " $symfileobj"
+ libobjs="$libobjs $symfileobj"
test "X$libobjs" = "X " && libobjs=
- if test "$opt_mode" != relink; then
+ if test "$mode" != relink; then
# Remove our outputs, but don't remove object files since they
# may have been created when compiling PIC objects.
removelist=
tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
*.$objext | *.gcno)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
then
continue
fi
fi
- func_append removelist " $p"
+ removelist="$removelist $p"
;;
*) ;;
esac
done
test -n "$removelist" && \
func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- func_append oldlibs " $output_objdir/$libname.$libext"
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
# Transform .lo files to .o files.
- oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
fi
# Eliminate all temporary directories.
#for path in $notinst_path; do
- # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
- # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
- # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+ # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
temp_xrpath=
for libdir in $xrpath; do
- func_replace_sysroot "$libdir"
- func_append temp_xrpath " -R$func_replace_sysroot_result"
+ temp_xrpath="$temp_xrpath -R$libdir"
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
dependency_libs="$temp_xrpath $dependency_libs"
fi
fi
# Make sure dlfiles contains only unique files that won't be dlpreopened
old_dlfiles="$dlfiles"
dlfiles=
for lib in $old_dlfiles; do
case " $dlprefiles $dlfiles " in
*" $lib "*) ;;
- *) func_append dlfiles " $lib" ;;
+ *) dlfiles="$dlfiles $lib" ;;
esac
done
# Make sure dlprefiles contains only unique files
old_dlprefiles="$dlprefiles"
dlprefiles=
for lib in $old_dlprefiles; do
case "$dlprefiles " in
*" $lib "*) ;;
- *) func_append dlprefiles " $lib" ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
esac
done
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C library is in the System framework
- func_append deplibs " System.ltframework"
+ deplibs="$deplibs System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
;;
*-*-sco3.2v5* | *-*-sco5v6*)
# Causes problems with __ctype
;;
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
*)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
- func_append deplibs " -lc"
+ deplibs="$deplibs -lc"
fi
;;
esac
fi
# Transform deplibs into only deplibs that can be linked in shared.
name_save=$name
libname_save=$libname
release_save=$release
versuffix_save=$versuffix
major_save=$major
# I'm not sure if I'm treating the release correctly. I think
# release should show up in the -l (ie -lgmp5) so we don't want to
# add it in twice. Is that correct?
release=""
versuffix=""
major=""
newdeplibs=
droppeddeps=no
case $deplibs_check_method in
pass_all)
# Don't check for shared/static. Everything works.
# This might be a little naive. We might want to check
# whether the library exists or not. But this is on
# osf3 & osf4 and I'm not really sure... Just
# implementing what was already the behavior.
newdeplibs=$deplibs
;;
test_compile)
# This code stresses the "libraries are programs" paradigm to its
# limits. Maybe even breaks it. We compile a program, linking it
# against the deplibs as a proxy for the library. Then we can check
# whether they linked in statically or dynamically with ldd.
$opt_dry_run || $RM conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
ldd_output=`ldd conftest`
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
else
droppeddeps=yes
- echo
+ $ECHO
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which I believe you do not have"
- echo "*** because a test_compile did reveal that the linker did not use it for"
- echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which I believe you do not have"
+ $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+ $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
fi
fi
;;
*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
;;
esac
done
else
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
case $i in
-l*)
func_stripname -l '' "$i"
name=$func_stripname_result
$opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
i=""
;;
esac
fi
if test -n "$i" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
set dummy $deplib_matches; shift
deplib_match=$1
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
else
droppeddeps=yes
- echo
+ $ECHO
$ECHO "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because a test_compile did reveal that the linker did not use this one"
- echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which you do not appear to have"
+ $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+ $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
fi
fi
else
droppeddeps=yes
- echo
+ $ECHO
$ECHO "*** Warning! Library $i is needed by this library but I was not able to"
- echo "*** make it link in! You will probably need to install it or some"
- echo "*** library that it depends on before this library will be fully"
- echo "*** functional. Installing it before continuing would be even better."
+ $ECHO "*** make it link in! You will probably need to install it or some"
+ $ECHO "*** library that it depends on before this library will be fully"
+ $ECHO "*** functional. Installing it before continuing would be even better."
fi
;;
*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
;;
esac
done
fi
;;
file_magic*)
set dummy $deplibs_check_method; shift
file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
- if test -n "$file_magic_glob"; then
- libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
- else
- libnameglob=$libname
- fi
- test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- if test "$want_nocaseglob" = yes; then
- shopt -s nocaseglob
- potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
- $nocaseglob
- else
- potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
- fi
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
# Follow soft links.
if ls -lLd "$potent_lib" 2>/dev/null |
$GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
# endless loop below, in case of cyclic links.
# We might still enter an endless loop, since a link
# loop can be closed while we follow links,
# but so what?
potlib="$potent_lib"
while test -h "$potlib" 2>/dev/null; do
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
done
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
$SED -e 10q |
$EGREP "$file_magic_regex" > /dev/null; then
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
- echo
+ $ECHO
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which you do not appear to have"
+ $ECHO "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for file magic test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a file magic. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
match_pattern*)
set dummy $deplibs_check_method; shift
match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
for a_deplib in $deplibs; do
case $a_deplib in
-l*)
func_stripname -l '' "$a_deplib"
name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
libname=`eval "\\$ECHO \"$libname_spec\""`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
$EGREP "$match_pattern_regex" > /dev/null; then
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
done
done
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
- echo
+ $ECHO
$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
+ $ECHO "*** I have the capability to make that library automatically link in when"
+ $ECHO "*** you link to this library. But I can only do this if you have a"
+ $ECHO "*** shared version of the library, which you do not appear to have"
+ $ECHO "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
$ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
else
$ECHO "*** with $libname and none of the candidates passed a file format test"
$ECHO "*** using a regex pattern. Last file checked: $potlib"
fi
fi
;;
*)
# Add a -L argument.
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
;;
esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
- tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
+ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
for i in $predeps $postdeps ; do
# can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
done
fi
- case $tmp_deplibs in
- *[!\ \ ]*)
- echo
+ if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
+ $GREP . >/dev/null; then
+ $ECHO
if test "X$deplibs_check_method" = "Xnone"; then
- echo "*** Warning: inter-library dependencies are not supported in this platform."
+ $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
else
- echo "*** Warning: inter-library dependencies are not known to be supported."
+ $ECHO "*** Warning: inter-library dependencies are not known to be supported."
fi
- echo "*** All declared inter-library dependencies are being dropped."
+ $ECHO "*** All declared inter-library dependencies are being dropped."
droppeddeps=yes
- ;;
- esac
+ fi
;;
esac
versuffix=$versuffix_save
major=$major_save
release=$release_save
libname=$libname_save
name=$name_save
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library with the System framework
- newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
esac
if test "$droppeddeps" = yes; then
if test "$module" = yes; then
- echo
- echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO
+ $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
$ECHO "*** dependencies of module $libname. Therefore, libtool will create"
- echo "*** a static module, that should work as long as the dlopening"
- echo "*** application is linked with the -dlopen flag."
+ $ECHO "*** a static module, that should work as long as the dlopening"
+ $ECHO "*** application is linked with the -dlopen flag."
if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ $ECHO
+ $ECHO "*** However, this would only work if libtool was able to extract symbol"
+ $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $ECHO "*** not find such a program. So, this module is probably useless."
+ $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
else
- echo "*** The inter-library dependencies that have been dropped here will be"
- echo "*** automatically added whenever a program is linked with this library"
- echo "*** or is declared to -dlopen it."
+ $ECHO "*** The inter-library dependencies that have been dropped here will be"
+ $ECHO "*** automatically added whenever a program is linked with this library"
+ $ECHO "*** or is declared to -dlopen it."
if test "$allow_undefined" = no; then
- echo
- echo "*** Since this library must not contain undefined symbols,"
- echo "*** because either the platform does not support them or"
- echo "*** it was explicitly requested with -no-undefined,"
- echo "*** libtool will only create a static version of it."
+ $ECHO
+ $ECHO "*** Since this library must not contain undefined symbols,"
+ $ECHO "*** because either the platform does not support them or"
+ $ECHO "*** it was explicitly requested with -no-undefined,"
+ $ECHO "*** libtool will only create a static version of it."
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
build_old_libs=yes
else
build_libtool_libs=no
fi
fi
fi
fi
# Done checking deplibs!
deplibs=$newdeplibs
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
case $host in
*-*-darwin*)
- newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $deplibs " in
*" -L$path/$objdir "*)
- func_append new_libs " -L$path/$objdir" ;;
+ new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
done
deplibs="$new_libs"
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
dlname=
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
- test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
- func_replace_sysroot "$libdir"
- libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append dep_rpath " $flag"
+ dep_rpath="$dep_rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
- *) func_apped perm_rpath " $libdir" ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
if test -n "$hardcode_libdir_flag_spec_ld"; then
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
else
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
fi
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
fi
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
fi
shlibpath="$finalize_shlibpath"
- test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
# Get the real and link names of the library.
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
shift
realname="$1"
shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
else
soname="$realname"
fi
if test -z "$dlname"; then
dlname=$soname
fi
lib="$output_objdir/$realname"
linknames=
for link
do
- func_append linknames " $link"
+ linknames="$linknames $link"
done
# Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
test "X$libobjs" = "X " && libobjs=
delfiles=
if test -n "$export_symbols" && test -n "$include_expsyms"; then
$opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
export_symbols="$output_objdir/$libname.uexp"
- func_append delfiles " $export_symbols"
+ delfiles="$delfiles $export_symbols"
fi
orig_export_symbols=
case $host_os in
cygwin* | mingw* | cegcc*)
if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
# exporting using user supplied symfile
if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
# and it's NOT already a .def file. Must figure out
# which of the given symbols are data symbols and tag
# them as such. So, trigger use of export_symbols_cmds.
# export_symbols gets reassigned inside the "prepare
# the list of exported symbols" if statement, so the
# include_expsyms logic still works.
orig_export_symbols="$export_symbols"
export_symbols=
always_export_symbols=yes
fi
fi
;;
esac
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
- for cmd1 in $cmds; do
+ for cmd in $cmds; do
IFS="$save_ifs"
- # Take the normal branch if the nm_file_list_spec branch
- # doesn't work or if tool conversion is not needed.
- case $nm_file_list_spec~$to_tool_file_cmd in
- *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
- try_normal_branch=yes
- eval cmd=\"$cmd1\"
- func_len " $cmd"
- len=$func_len_result
- ;;
- *)
- try_normal_branch=no
- ;;
- esac
- if test "$try_normal_branch" = yes \
- && { test "$len" -lt "$max_cmd_len" \
- || test "$max_cmd_len" -le -1; }
- then
+ eval cmd=\"$cmd\"
+ func_len " $cmd"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
func_show_eval "$cmd" 'exit $?'
skipped_export=false
- elif test -n "$nm_file_list_spec"; then
- func_basename "$output"
- output_la=$func_basename_result
- save_libobjs=$libobjs
- save_output=$output
- output=${output_objdir}/${output_la}.nm
- func_to_tool_file "$output"
- libobjs=$nm_file_list_spec$func_to_tool_file_result
- func_append delfiles " $output"
- func_verbose "creating $NM input file list: $output"
- for obj in $save_libobjs; do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result"
- done > "$output"
- eval cmd=\"$cmd1\"
- func_show_eval "$cmd" 'exit $?'
- output=$save_output
- libobjs=$save_libobjs
- skipped_export=false
else
# The command line is too long to execute in one step.
func_verbose "using reloadable object file for export list..."
skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
fi
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
fi
if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
case " $convenience " in
*" $test_deplib "*) ;;
*)
- func_append tmp_deplibs " $test_deplib"
+ tmp_deplibs="$tmp_deplibs $test_deplib"
;;
esac
done
deplibs="$tmp_deplibs"
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec" &&
test "$compiler_needs_object" = yes &&
test -z "$libobjs"; then
# extract the archives, so we have objects to list.
# TODO: could optimize this to just extract one archive.
whole_archive_flag_spec=
fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $convenience
- func_append libobjs " $func_extract_archives_result"
+ libobjs="$libobjs $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
fi
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
- func_append linker_flags " $flag"
+ linker_flags="$linker_flags $flag"
fi
# Make a backup of the uninstalled library when relinking
- if test "$opt_mode" = relink; then
+ if test "$mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
eval test_cmds=\"$module_expsym_cmds\"
cmds=$module_expsym_cmds
else
eval test_cmds=\"$module_cmds\"
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
eval test_cmds=\"$archive_expsym_cmds\"
cmds=$archive_expsym_cmds
else
eval test_cmds=\"$archive_cmds\"
cmds=$archive_cmds
fi
fi
if test "X$skipped_export" != "X:" &&
func_len " $test_cmds" &&
len=$func_len_result &&
test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
# The command line is too long to link in one step, link piecewise
# or, if using GNU ld and skipped_export is not :, use a linker
# script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
# want to use save_libobjs as it was before
# whole_archive_flag_spec was expanded, because we can't
# assume the linker understands whole_archive_flag_spec.
# This may have to be revisited, in case too many
# convenience libraries get linked in and end up exceeding
# the spec.
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
fi
save_output=$output
- func_basename "$output"
- output_la=$func_basename_result
+ output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
test_cmds=
concat_cmds=
objlist=
last_robj=
k=1
if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_verbose "creating GNU ld script: $output"
- echo 'INPUT (' > $output
+ $ECHO 'INPUT (' > $output
for obj in $save_libobjs
do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result" >> $output
+ $ECHO "$obj" >> $output
done
- echo ')' >> $output
- func_append delfiles " $output"
- func_to_tool_file "$output"
- output=$func_to_tool_file_result
+ $ECHO ')' >> $output
+ delfiles="$delfiles $output"
elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
output=${output_objdir}/${output_la}.lnk
func_verbose "creating linker input file list: $output"
: > $output
set x $save_libobjs
shift
firstobj=
if test "$compiler_needs_object" = yes; then
firstobj="$1 "
shift
fi
for obj
do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result" >> $output
+ $ECHO "$obj" >> $output
done
- func_append delfiles " $output"
- func_to_tool_file "$output"
- output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ delfiles="$delfiles $output"
+ output=$firstobj\"$file_list_spec$output\"
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
output=$output_objdir/$output_la-${k}.$objext
eval test_cmds=\"$reload_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
if test "X$objlist" = X ||
test "$len" -lt "$max_cmd_len"; then
func_append objlist " $obj"
else
# The command $test_cmds is almost too long, add a
# command to the queue.
if test "$k" -eq 1 ; then
# The first file doesn't have a previous command to add.
- reload_objs=$objlist
- eval concat_cmds=\"$reload_cmds\"
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
else
# All subsequent reloadable object files will link in
# the last one created.
- reload_objs="$objlist $last_robj"
- eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
fi
last_robj=$output_objdir/$output_la-${k}.$objext
func_arith $k + 1
k=$func_arith_result
output=$output_objdir/$output_la-${k}.$objext
- objlist=" $obj"
+ objlist=$obj
func_len " $last_robj"
func_arith $len0 + $func_len_result
len=$func_arith_result
fi
done
# Handle the remaining objects by creating one last
# reloadable object file. All subsequent reloadable object
# files will link in the last one created.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- reload_objs="$objlist $last_robj"
- eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
if test -n "$last_robj"; then
eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
fi
- func_append delfiles " $output"
+ delfiles="$delfiles $output"
else
output=
fi
if ${skipped_export-false}; then
func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
$opt_dry_run || $RM $export_symbols
libobjs=$output
# Append the command to create the export file.
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
if test -n "$last_robj"; then
eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
fi
fi
test -n "$save_libobjs" &&
func_verbose "creating a temporary reloadable object file: $output"
# Loop through the commands generated above and execute them.
save_ifs="$IFS"; IFS='~'
for cmd in $concat_cmds; do
IFS="$save_ifs"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
+ if test "$mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
if test -n "$export_symbols_regex" && ${skipped_export-false}; then
func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
fi
fi
if ${skipped_export-false}; then
if test -n "$export_symbols" && test -n "$include_expsyms"; then
tmp_export_symbols="$export_symbols"
test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
fi
if test -n "$orig_export_symbols"; then
# The given exports_symbols file has to be filtered, so filter it.
func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
# FIXME: $output_objdir/$libname.filter potentially contains lots of
# 's' commands which not all seds can handle. GNU sed should be fine
# though. Also, the filter scales superlinearly with the number of
# global variables. join(1) would be nice here, but unfortunately
# isn't a blessed tool.
$opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
export_symbols=$output_objdir/$libname.def
$opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
fi
libobjs=$output
# Restore the value of output.
output=$save_output
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
# Do each of the archive commands.
if test "$module" = yes && test -n "$module_cmds" ; then
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
cmds=$module_expsym_cmds
else
cmds=$module_cmds
fi
else
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
cmds=$archive_expsym_cmds
else
cmds=$archive_cmds
fi
fi
fi
if test -n "$delfiles"; then
# Append the command to remove temporary files to $cmds.
eval cmds=\"\$cmds~\$RM $delfiles\"
fi
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $dlprefiles
- func_append libobjs " $func_extract_archives_result"
+ libobjs="$libobjs $func_extract_archives_result"
test "X$libobjs" = "X " && libobjs=
fi
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
$opt_silent || {
func_quote_for_expand "$cmd"
eval "func_echo $func_quote_for_expand_result"
}
$opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
+ if test "$mode" = relink; then
( cd "$output_objdir" && \
$RM "${realname}T" && \
$MV "${realname}U" "$realname" )
fi
exit $lt_exit
}
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
+ if test "$mode" = relink; then
$opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
func_show_eval '${RM}r "$gentop"'
fi
fi
exit $EXIT_SUCCESS
fi
# Create links to the real library.
for linkname in $linknames; do
if test "$realname" != "$linkname"; then
func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
# If -module or -export-dynamic was specified, set the dlname.
if test "$module" = yes || test "$export_dynamic" = yes; then
# On all known operating systems, these are identical.
dlname="$soname"
fi
fi
;;
obj)
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
func_warning "\`-dlopen' is ignored for objects"
fi
case " $deplibs" in
*\ -l* | *\ -L*)
func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
test -n "$rpath" && \
func_warning "\`-rpath' is ignored for objects"
test -n "$xrpath" && \
func_warning "\`-R' is ignored for objects"
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for objects"
test -n "$release" && \
func_warning "\`-release' is ignored for objects"
case $output in
*.lo)
test -n "$objs$old_deplibs" && \
func_fatal_error "cannot build library object \`$output' from non-libtool objects"
libobj=$output
func_lo2o "$libobj"
obj=$func_lo2o_result
;;
*)
libobj=
obj="$output"
;;
esac
# Delete the old objects.
$opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
# different ones for PIC/non-PIC, this we'll have to duplicate
# the extraction.
reload_conv_objs=
gentop=
# reload_cmds runs $LD directly, so let us get rid of
# -Wl from whole_archive_flag_spec and hope we can get by with
# turning comma into space..
wl=
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $convenience
reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
- # If we're not building shared, we need to use non_pic_objs
- test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
-
# Create the old-style object.
- reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+ reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
func_execute_cmds "$reload_cmds" 'exit $?'
# Exit if we aren't doing a library object file.
if test -z "$libobj"; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
fi
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
# Create an invalid libtool object if no PIC, so that we don't
# accidentally link it into a program.
# $show "echo timestamp > $libobj"
# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
if test -n "$pic_flag" || test "$pic_mode" != default; then
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
;;
prog)
case $host in
*cygwin*) func_stripname '' '.exe' "$output"
output=$func_stripname_result.exe;;
esac
test -n "$vinfo" && \
func_warning "\`-version-info' is ignored for programs"
test -n "$release" && \
func_warning "\`-release' is ignored for programs"
test "$preload" = yes \
&& test "$dlopen_support" = unknown \
&& test "$dlopen_self" = unknown \
&& test "$dlopen_self_static" = unknown && \
func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library is the System framework
- compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
- finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
esac
case $host in
*-*-darwin*)
# Don't allow lazy linking, it breaks C++ global constructors
# But is supposedly fixed on 10.4 or later (yay!).
if test "$tagname" = CXX ; then
case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10.[0123])
- func_append compile_command " ${wl}-bind_at_load"
- func_append finalize_command " ${wl}-bind_at_load"
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
;;
esac
fi
# Time to change all our "foo.ltframework" stuff back to "-framework foo"
- compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
;;
esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
for path in $notinst_path; do
case " $new_libs " in
*" -L$path/$objdir "*) ;;
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
- func_append new_libs " -L$path/$objdir" ;;
+ new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
done
for deplib in $compile_deplibs; do
case $deplib in
-L*)
case " $new_libs " in
*" $deplib "*) ;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
done
compile_deplibs="$new_libs"
- func_append compile_command " $compile_deplibs"
- func_append finalize_command " $finalize_deplibs"
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
for libdir in $rpath $xrpath; do
# This is the magic to use -rpath.
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
fi
# Now hardcode the library paths
rpath=
hardcode_libdirs=
for libdir in $compile_rpath $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ rpath="$rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
- *) func_append perm_rpath " $libdir" ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
::) dllsearchpath=$libdir;;
- *) func_append dllsearchpath ":$libdir";;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
::) dllsearchpath=$testbindir;;
- *) func_append dllsearchpath ":$testbindir";;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
esac
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
compile_rpath="$rpath"
rpath=
hardcode_libdirs=
for libdir in $finalize_rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
# Just accumulate the unique libdirs.
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ rpath="$rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_perm_rpath " $libdir" ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
esac
fi
done
# Substitute the hardcoded libdirs into the rpath.
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
eval rpath=\" $hardcode_libdir_flag_spec\"
fi
finalize_rpath="$rpath"
if test -n "$libobjs" && test "$build_old_libs" = yes; then
# Transform all the library objects into standard objects.
- compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
- finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
fi
func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
# template prelinking step
if test -n "$prelink_cmds"; then
func_execute_cmds "$prelink_cmds" 'exit $?'
fi
wrappers_required=yes
case $host in
- *cegcc* | *mingw32ce*)
- # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
- wrappers_required=no
- ;;
*cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
+ *cegcc)
+ # Disable wrappers for cegcc, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
*)
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
esac
if test "$wrappers_required" = no; then
# Replace the output file specification.
- compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
exit_status=0
func_show_eval "$link_command" 'exit_status=$?'
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
-
# Delete the generated files.
if test -f "$output_objdir/${outputname}S.${objext}"; then
func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $exit_status
fi
if test -n "$compile_shlibpath$finalize_shlibpath"; then
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
fi
if test -n "$finalize_shlibpath"; then
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
fi
compile_var=
finalize_var=
if test -n "$runpath_var"; then
if test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
if test -n "$finalize_perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $finalize_perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
fi
if test "$no_install" = yes; then
# We don't need to create a wrapper script.
link_command="$compile_var$compile_command$compile_rpath"
# Replace the output file specification.
- link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
$opt_dry_run || $RM $output
# Link the executable and exit
func_show_eval "$link_command" 'exit $?'
-
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
-
exit $EXIT_SUCCESS
fi
if test "$hardcode_action" = relink; then
# Fast installation is not supported
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
func_warning "this platform does not like uninstalled shared libraries"
func_warning "\`$output' will be relinked during installation"
else
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
- relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
else
# fast_install is set to needless
relink_command=
fi
else
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
fi
fi
# Replace the output file specification.
- link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+ link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
# Delete the old output files.
$opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
func_show_eval "$link_command" 'exit $?'
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output_objdir/$outputname"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
-
# Now create the wrapper script.
func_verbose "creating $output"
# Quote the relink command for shipping.
if test -n "$relink_command"; then
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $ECHO for shipping.
+ if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
fi
# Only actually do things if not in dry run mode.
$opt_dry_run || {
# win32 will think the script is a binary if it has
# a .exe suffix, so we strip it off here.
case $output in
*.exe) func_stripname '' '.exe' "$output"
output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
func_stripname '' '.exe' "$outputname"
outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
func_dirname_and_basename "$output" "" "."
output_name=$func_basename_result
output_path=$func_dirname_result
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
# The wrapper executable is built using the $host compiler,
# because it contains $host paths and files. If cross-
# compiling, it, like the target executable, must be
# executed on the $host or under an emulation environment.
$opt_dry_run || {
$LTCC $LTCFLAGS -o $cwrapper $cwrappersource
$STRIP $cwrapper
}
# Now, create the wrapper script for func_source use:
func_ltwrapper_scriptname $cwrapper
$RM $func_ltwrapper_scriptname_result
trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host" ; then
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
fi
}
;;
* )
$RM $output
trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
func_emit_wrapper no > $output
chmod +x $output
;;
esac
}
exit $EXIT_SUCCESS
;;
esac
# See if we need to build an old-fashioned archive.
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
if test "$build_libtool_libs" = module; then
oldobjs="$libobjs_save"
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
if test "$preload" = yes && test -f "$symfileobj"; then
- func_append oldobjs " $symfileobj"
+ oldobjs="$oldobjs $symfileobj"
fi
fi
addlibs="$old_convenience"
fi
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $addlibs
- func_append oldobjs " $func_extract_archives_result"
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
# Add any objects from preloaded convenience libraries
if test -n "$dlprefiles"; then
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $dlprefiles
- func_append oldobjs " $func_extract_archives_result"
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
# static archive out of a convenience library, or when linking
# the entirety of a libtool archive into another (currently
# not supported by libtool).
if (for obj in $oldobjs
do
func_basename "$obj"
$ECHO "$func_basename_result"
done | sort | sort -uc >/dev/null 2>&1); then
:
else
- echo "copying selected object files to avoid basename conflicts..."
+ $ECHO "copying selected object files to avoid basename conflicts..."
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
func_basename "$obj"
objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
while :; do
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
func_arith $counter + 1
counter=$func_arith_result
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- func_append oldobjs " $gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
;;
- *) func_append oldobjs " $obj" ;;
+ *) oldobjs="$oldobjs $obj" ;;
esac
done
fi
eval cmds=\"$old_archive_cmds\"
func_len " $cmds"
len=$func_len_result
if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cmds=$old_archive_cmds
- elif test -n "$archiver_list_spec"; then
- func_verbose "using command file archive linking..."
- for obj in $oldobjs
- do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result"
- done > $output_objdir/$libname.libcmd
- func_to_tool_file "$output_objdir/$libname.libcmd"
- oldobjs=" $archiver_list_spec$func_to_tool_file_result"
- cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$oldobjs
oldobjs=
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
last_oldobj=$obj
done
eval test_cmds=\"$old_archive_cmds\"
func_len " $test_cmds"
len0=$func_len_result
len=$len0
for obj in $save_oldobjs
do
func_len " $obj"
func_arith $len + $func_len_result
len=$func_arith_result
func_append objlist " $obj"
if test "$len" -lt "$max_cmd_len"; then
:
else
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
len=$len0
fi
done
RANLIB=$save_RANLIB
oldobjs=$objlist
if test "X$oldobjs" = "X" ; then
eval cmds=\"\$concat_cmds\"
else
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
fi
fi
fi
func_execute_cmds "$cmds" 'exit $?'
done
test -n "$generated" && \
func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
func_verbose "creating $output"
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
func_quote_for_eval "$var_value"
relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
# Only create the output if not a dry run.
$opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
break
fi
output="$output_objdir/$outputname"i
# Replace all uninstalled libtool libraries with the installed ones
newdependency_libs=
for deplib in $dependency_libs; do
case $deplib in
*.la)
func_basename "$deplib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "\`$deplib' is not a valid libtool archive"
- func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ newdependency_libs="$newdependency_libs $libdir/$name"
;;
- -L*)
- func_stripname -L '' "$deplib"
- func_replace_sysroot "$func_stripname_result"
- func_append newdependency_libs " -L$func_replace_sysroot_result"
- ;;
- -R*)
- func_stripname -R '' "$deplib"
- func_replace_sysroot "$func_stripname_result"
- func_append newdependency_libs " -R$func_replace_sysroot_result"
- ;;
- *) func_append newdependency_libs " $deplib" ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
newdlfiles=
for lib in $dlfiles; do
case $lib in
*.la)
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
- func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ newdlfiles="$newdlfiles $libdir/$name"
;;
- *) func_append newdlfiles " $lib" ;;
+ *) newdlfiles="$newdlfiles $lib" ;;
esac
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
*.la)
# Only pass preopened files to the pseudo-archive (for
# eventual linking with the app. that links it) if we
# didn't already link the preopened objects directly into
# the library:
func_basename "$lib"
name="$func_basename_result"
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
test -z "$libdir" && \
func_fatal_error "\`$lib' is not a valid libtool archive"
- func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ newdlprefiles="$newdlprefiles $libdir/$name"
;;
esac
done
dlprefiles="$newdlprefiles"
else
newdlfiles=
for lib in $dlfiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
- func_append newdlfiles " $abs"
+ newdlfiles="$newdlfiles $abs"
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
case $lib in
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
- func_append newdlprefiles " $abs"
+ newdlprefiles="$newdlprefiles $abs"
done
dlprefiles="$newdlprefiles"
fi
$RM $output
# place dlname in correct position for cygwin
- # In fact, it would be nice if we could use this code for all target
- # systems that can't hard-code library paths into their executables
- # and that have no shared library path variable independent of PATH,
- # but it turns out we can't easily determine that from inspecting
- # libtool variables, so we have to hard-code the OSs to which it
- # applies here; at the moment, that means platforms that use the PE
- # object format with DLL files. See the long comment at the top of
- # tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
- # If a -bindir argument was supplied, place the dll there.
- if test "x$bindir" != x ;
- then
- func_relative_path "$install_libdir" "$bindir"
- tdlname=$func_relative_path_result$dlname
- else
- # Otherwise fall back on heuristic.
- tdlname=../bin/$dlname
- fi
- ;;
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
$ECHO > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='$tdlname'
# Names of this library.
library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags='$new_inherited_linker_flags'
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
# Names of additional weak libraries provided by this library
weak_library_names='$weak_libs'
# Version information for $libname.
current=$current
age=$age
revision=$revision
# Is this an already installed library?
installed=$installed
# Should we warn about portability when linking against -modules?
shouldnotlink=$module
# Files to dlopen/dlpreopen
dlopen='$dlfiles'
dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
$ECHO >> $output "\
relink_command=\"$relink_command\""
fi
done
}
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
;;
esac
exit $EXIT_SUCCESS
}
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+{ test "$mode" = link || test "$mode" = relink; } &&
func_mode_link ${1+"$@"}
# func_mode_uninstall arg...
func_mode_uninstall ()
{
$opt_debug
RM="$nonopt"
files=
rmforce=
exit_status=0
# This variable tells wrapper scripts just to set variables rather
# than running their programs.
libtool_install_magic="$magic"
for arg
do
case $arg in
- -f) func_append RM " $arg"; rmforce=yes ;;
- -*) func_append RM " $arg" ;;
- *) func_append files " $arg" ;;
+ -f) RM="$RM $arg"; rmforce=yes ;;
+ -*) RM="$RM $arg" ;;
+ *) files="$files $arg" ;;
esac
done
test -z "$RM" && \
func_fatal_help "you must specify an RM program"
rmdirs=
+ origobjdir="$objdir"
for file in $files; do
func_dirname "$file" "" "."
dir="$func_dirname_result"
if test "X$dir" = X.; then
- odir="$objdir"
+ objdir="$origobjdir"
else
- odir="$dir/$objdir"
+ objdir="$dir/$origobjdir"
fi
func_basename "$file"
name="$func_basename_result"
- test "$opt_mode" = uninstall && odir="$dir"
-
- # Remember odir for removal later, being careful to avoid duplicates
- if test "$opt_mode" = clean; then
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
case " $rmdirs " in
- *" $odir "*) ;;
- *) func_append rmdirs " $odir" ;;
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
esac
fi
# Don't error if the file doesn't exist and rm -f was used.
if { test -L "$file"; } >/dev/null 2>&1 ||
{ test -h "$file"; } >/dev/null 2>&1 ||
test -f "$file"; then
:
elif test -d "$file"; then
exit_status=1
continue
elif test "$rmforce" = yes; then
continue
fi
rmfiles="$file"
case $name in
*.la)
# Possibly a libtool archive, so verify it.
if func_lalib_p "$file"; then
func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
- func_append rmfiles " $odir/$n"
+ rmfiles="$rmfiles $objdir/$n"
done
- test -n "$old_library" && func_append rmfiles " $odir/$old_library"
-
- case "$opt_mode" in
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+ case "$mode" in
clean)
- case " $library_names " in
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
*" $dlname "*) ;;
- *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
- test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
esac
fi
;;
*.lo)
# Possibly a libtool object, so verify it.
if func_lalib_p "$file"; then
# Read the .lo file
func_source $dir/$name
# Add PIC object to the list of files to remove.
if test -n "$pic_object" &&
test "$pic_object" != none; then
- func_append rmfiles " $dir/$pic_object"
+ rmfiles="$rmfiles $dir/$pic_object"
fi
# Add non-PIC object to the list of files to remove.
if test -n "$non_pic_object" &&
test "$non_pic_object" != none; then
- func_append rmfiles " $dir/$non_pic_object"
+ rmfiles="$rmfiles $dir/$non_pic_object"
fi
fi
;;
*)
- if test "$opt_mode" = clean ; then
+ if test "$mode" = clean ; then
noexename=$name
case $file in
*.exe)
func_stripname '' '.exe' "$file"
file=$func_stripname_result
func_stripname '' '.exe' "$name"
noexename=$func_stripname_result
# $file with .exe has already been added to rmfiles,
# add $file without .exe
- func_append rmfiles " $file"
+ rmfiles="$rmfiles $file"
;;
esac
# Do a test to see if this is a libtool program.
if func_ltwrapper_p "$file"; then
if func_ltwrapper_executable_p "$file"; then
func_ltwrapper_scriptname "$file"
relink_command=
func_source $func_ltwrapper_scriptname_result
- func_append rmfiles " $func_ltwrapper_scriptname_result"
+ rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
else
relink_command=
func_source $dir/$noexename
fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
- func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
if test "$fast_install" = yes && test -n "$relink_command"; then
- func_append rmfiles " $odir/lt-$name"
+ rmfiles="$rmfiles $objdir/lt-$name"
fi
if test "X$noexename" != "X$name" ; then
- func_append rmfiles " $odir/lt-${noexename}.c"
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
fi
fi
fi
;;
esac
func_show_eval "$RM $rmfiles" 'exit_status=1'
done
+ objdir="$origobjdir"
# Try to remove the ${objdir}s in the directories where we deleted files
for dir in $rmdirs; do
if test -d "$dir"; then
func_show_eval "rmdir $dir >/dev/null 2>&1"
fi
done
exit $exit_status
}
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
func_mode_uninstall ${1+"$@"}
-test -z "$opt_mode" && {
+test -z "$mode" && {
help="$generic_help"
func_fatal_help "you must specify a MODE"
}
test -z "$exec_cmd" && \
- func_fatal_help "invalid operation mode \`$opt_mode'"
+ func_fatal_help "invalid operation mode \`$mode'"
if test -n "$exec_cmd"; then
eval exec "$exec_cmd"
exit $EXIT_FAILURE
fi
exit $exit_status
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
# choices, we go for a static library, that is the most portable,
# since we can't tell whether shared libraries were disabled because
# the user asked for that or because the platform doesn't support
# them. This is particularly important on AIX, because we don't
# support having both static and shared libraries enabled at the same
# time on that platform, so we default to a shared-only configuration.
# If a disable-shared tag is given, we'll fallback to a static-only
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
build_libtool_libs=no
build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
# vi:sw=2
diff --git a/Contrib/MCPWNLO/EPEM/LEPAnalysis/MyMultiplicityCount.cc b/Contrib/MCPWNLO/EPEM/LEPAnalysis/MyMultiplicityCount.cc
--- a/Contrib/MCPWNLO/EPEM/LEPAnalysis/MyMultiplicityCount.cc
+++ b/Contrib/MCPWNLO/EPEM/LEPAnalysis/MyMultiplicityCount.cc
@@ -1,472 +1,472 @@
// -*- C++ -*-
//
// MyMultiplicityCount.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2007 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MyMultiplicityCount class.
//
#include "MyMultiplicityCount.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/EventRecord/StandardSelectors.h"
#include "ThePEG/EventRecord/Event.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Utilities/EnumParticles.h"
#include "Herwig++/Hadronization/Cluster.h"
#include <iostream>
#include <sstream>
#include <fstream>
using namespace Herwig;
using namespace ThePEG;
// string MultiplicityInfo::bargraph()
// {
// if (obsMultiplicity == 0.0) return " ? ";
// else if (nSigma() >= 6.0) return "-----|---->";
// else if (nSigma() >= 5.0) return "-----|----*";
// else if (nSigma() >= 4.0) return "-----|---*-";
// else if (nSigma() >= 3.0) return "-----|--*--";
// else if (nSigma() >= 2.0) return "-----|-*---";
// else if (nSigma() >= 1.0) return "-----|*----";
// else if (nSigma() > -1.0) return "-----*-----";
// else if (nSigma() > -2.0) return "----*|-----";
// else if (nSigma() > -3.0) return "---*-|-----";
// else if (nSigma() > -4.0) return "--*--|-----";
// else if (nSigma() > -5.0) return "-*---|-----";
// else if (nSigma() > -6.0) return "*----|-----";
// else return "<----|-----";
// }
IBPtr MyMultiplicityCount::clone() const {
return new_ptr(*this);
}
IBPtr MyMultiplicityCount::fullclone() const {
return new_ptr(*this);
}
MyMultiplicityCount::MyMultiplicityCount() : _makeHistograms(false)
{
// Average particle multiplicities in hadronic Z decay
// PDG 2006 with 2007 partial update
// all charged
_data[0] = MyMultiplicityInfo(20.76, 0.16, lightMeson); // all charged
// gamma
_data[22] = MyMultiplicityInfo(20.97, 1.17, lightMeson);
// pi+, pi0, eta
_data[211] = MyMultiplicityInfo(17.03, 0.16, lightMeson);
_data[111] = MyMultiplicityInfo( 9.76, 0.26, lightMeson);
_data[221] = MyMultiplicityInfo( 1.01, 0.08, lightMeson);
// rho+, rho0, omega, eta'
_data[213] = MyMultiplicityInfo( 2.40, 0.49, lightMeson);
_data[113] = MyMultiplicityInfo( 1.24, 0.10, lightMeson);
_data[223] = MyMultiplicityInfo( 1.02, 0.06, lightMeson);
_data[331] = MyMultiplicityInfo( 0.17, 0.05, lightMeson);
// f_0(980), a_0(980), phi
_data[10221] = MyMultiplicityInfo(0.147, 0.011, other);
_data[9000211] = MyMultiplicityInfo(0.27, 0.14, other);
_data[333] = MyMultiplicityInfo(0.098, 0.006, strangeMeson);
// f_2(1270), f_1(1285), f_2'(1525), K+, K0
_data[225] = MyMultiplicityInfo(0.169, 0.025, other);
_data[20223] = MyMultiplicityInfo(0.165, 0.051, other);
_data[335] = MyMultiplicityInfo(0.012, 0.006, other);
_data[321] = MyMultiplicityInfo(2.24, 0.04, strangeMeson);
_data[311] = MyMultiplicityInfo(2.039, 0.025, lightMeson);
// K*+(892), K*0(892), K*_2(1430)
_data[323] = MyMultiplicityInfo(0.72, 0.05, strangeMeson);
_data[313] = MyMultiplicityInfo(0.739, 0.022, strangeMeson);
_data[315] = MyMultiplicityInfo(0.073, 0.023, strangeMeson);
// D+, D0, D_s+
_data[411] = MyMultiplicityInfo(0.187, 0.020, other);
_data[421] = MyMultiplicityInfo(0.462, 0.026, other);
_data[431] = MyMultiplicityInfo(0.131, 0.028, other);
// D*+(2010), J/Psi(1S), Psi(2S)
_data[413] = MyMultiplicityInfo(0.183, 0.008, other);
_data[443] = MyMultiplicityInfo(0.0056, 0.0007, other);
_data[100443] = MyMultiplicityInfo(0.0023, 0.0007, other);
// p, Delta++(1232), Lambda, Sigma+, Sigma-, Sigma0
_data[2212] = MyMultiplicityInfo(1.046, 0.026, lightBaryon);
_data[2224] = MyMultiplicityInfo(0.087, 0.033, lightBaryon);
_data[3122] = MyMultiplicityInfo(0.388, 0.009, lightBaryon);
_data[3222] = MyMultiplicityInfo(0.107, 0.010, lightBaryon);
_data[3112] = MyMultiplicityInfo(0.082, 0.007, lightBaryon);
_data[3212] = MyMultiplicityInfo(0.076, 0.010, lightBaryon);
// Sigma*+, Sigma*-, Xi-, Xi*0, Omega-
_data[3224] = MyMultiplicityInfo(0.0239, 0.0021, lightBaryon);
_data[3114] = MyMultiplicityInfo(0.0240, 0.0024, lightBaryon);
_data[3312] = MyMultiplicityInfo(0.0258, 0.0009, lightBaryon);
_data[3324] = MyMultiplicityInfo(0.0059, 0.0011, lightBaryon);
_data[3334] = MyMultiplicityInfo(0.00164, 0.00028, lightBaryon);
// Lambda_c+
_data[4122] = MyMultiplicityInfo(0.078, 0.024, other);
// old values from 1.0 paper
// _data[433] = MyMultiplicityInfo(0.096, 0.046, other);
_data[2112] = MyMultiplicityInfo(0.991, 0.054, lightBaryon);
// _data[2214] = MyMultiplicityInfo(0., 0., lightBaryon);
// _data[2114] = MyMultiplicityInfo(0., 0., lightBaryon);
// values unknown
// B mesons
// _data[513] = MyMultiplicityInfo(0.28, 0.04, other); // flavour averaged value!
_data[513] = MyMultiplicityInfo(0., 0., other);
_data[511] = MyMultiplicityInfo(0., 0., other); // B0
_data[521] = MyMultiplicityInfo(0., 0., other); // B+
_data[531] = MyMultiplicityInfo(0., 0., other); // B_s
_data[541] = MyMultiplicityInfo(0., 0., other); // B_c
// B baryons
_data[5122] = MyMultiplicityInfo(0., 0., other); // Lambda_b
_data[5112] = MyMultiplicityInfo(0., 0., other); // Sig_b-
_data[5212] = MyMultiplicityInfo(0., 0., other); // Sig_b0
_data[5222] = MyMultiplicityInfo(0., 0., other); // Sig_b+
_data[5132] = MyMultiplicityInfo(0., 0., other); // Xi_b-
_data[5232] = MyMultiplicityInfo(0., 0., other); // Xi_b0
_data[5312] = MyMultiplicityInfo(0., 0., other); // Xi'_b-
_data[5322] = MyMultiplicityInfo(0., 0., other); // Xi'_b0
_data[5332] = MyMultiplicityInfo(0., 0., other); // Omega_b-
}
namespace {
bool isLastCluster(tcPPtr p) {
- if ( p->id() != ExtraParticleID::Cluster )
+ if ( p->id() != ParticleID::Cluster )
return false;
for ( size_t i = 0, end = p->children().size();
i < end; ++i ) {
- if ( p->children()[i]->id() == ExtraParticleID::Cluster )
+ if ( p->children()[i]->id() == ParticleID::Cluster )
return false;
}
return true;
}
Energy parentClusterMass(tcPPtr p) {
if (p->parents().empty())
return -1.0*MeV;
tcPPtr parent = p->parents()[0];
- if (parent->id() == ExtraParticleID::Cluster) {
+ if (parent->id() == ParticleID::Cluster) {
if ( isLastCluster(parent) )
return parent->mass();
else
return p->mass();
}
else
return parentClusterMass(parent);
}
bool isPrimaryCluster(tcPPtr p) {
- if ( p->id() != ExtraParticleID::Cluster )
+ if ( p->id() != ParticleID::Cluster )
return false;
if( p->parents().empty())
return false;
for ( size_t i = 0, end = p->parents().size();
i < end; ++i ) {
if ( !(p->parents()[i]->dataPtr()->coloured()) )
return false;
}
return true;
}
}
void MyMultiplicityCount::analyze(tEventPtr event, long, int, int) {
string infile = "EPEM.dat";
ifstream normin;
string stringin = "";
double normfac = 1;
double stringdoub = 0;
bool next = 0, filerror = 0;
normin.open(infile.c_str());
if(!normin) { cerr << "Error: Failed to open file " << infile << endl; filerror = 1; normfac = 1.; }
if(!filerror) {
while(normin) {
normin >> stringin;
if(next) { normin >> stringdoub; normfac = stringdoub; break; }
if(stringin == "NORMFACTOR") { next = 1; }
}
}
double eventweight = generator()->currentEvent()->weight();
set<tcPPtr> particles;
event->selectFinalState(inserter(particles));
map <long,long> eventcount;
eventcount.insert(make_pair(0,0));
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
if((*it)->dataPtr()->charged())
// ++eventcount[0];
eventcount[0] = eventcount[0] + eventweight;
long ID = abs( (*it)->id() );
_finalstatecount.insert(make_pair(ID,0));
// ++_finalstatecount[ID];
_finalstatecount[ID] = _finalstatecount[ID] + eventweight;
}
StepVector steps = event->primaryCollision()->steps();
particles.clear();
steps[0]->select(inserter(particles), ThePEG::AllSelector());
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
long ID = (*it)->id();
_collisioncount.insert(make_pair(ID,0));
// ++_collisioncount[ID];
_collisioncount[ID] = _collisioncount[ID] + eventweight;
}
// =======
particles.clear();
if (steps.size() > 2) {
for ( StepVector::const_iterator it = steps.begin()+2;
it != steps.end(); ++it ) {
(**it).select(inserter(particles), ThePEG::AllSelector());
}
}
if( _makeHistograms )
- _histograms.insert(make_pair(ExtraParticleID::Cluster,
+ _histograms.insert(make_pair(ParticleID::Cluster,
Histogram(0.0,10.0,200)));
for(set<tcPPtr>::const_iterator it = particles.begin();
it != particles.end(); ++it) {
long ID = abs( (*it)->id() );
if(ID==ParticleID::K0) continue;
if(ID==ParticleID::K_L0||ID==ParticleID::K_S0) ID=ParticleID::K0;
if ( _makeHistograms && isLastCluster(*it) ) {
- _histograms[ExtraParticleID::Cluster] += (*it)->mass()/GeV;
+ _histograms[ParticleID::Cluster] += (*it)->mass()/GeV;
tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it);
if (clu) {
_clusters.insert(make_pair(clu->clusterId(), Histogram(0.0,10.0,200)));
_clusters[clu->clusterId()] += (*it)->mass()/GeV;
}
}
if( _makeHistograms && isPrimaryCluster(*it) ) {
_primary.insert(make_pair(0, Histogram(0.0,20.0,400)));
_primary[0] += (*it)->mass()/GeV;
tcClusterPtr clu = dynamic_ptr_cast<tcClusterPtr>(*it);
if(clu) {
_primary.insert(make_pair(clu->clusterId(), Histogram(0.0,20.0,400)));
_primary[clu->clusterId()] += (*it)->mass()/GeV;
}
}
if (_data.find(ID) != _data.end()) {
eventcount.insert(make_pair(ID,0));
// ++eventcount[ID];
eventcount[ID] = eventcount[ID] +eventweight;
if (_makeHistograms
&& ! (*it)->parents().empty()
- && (*it)->parents()[0]->id() == ExtraParticleID::Cluster) {
+ && (*it)->parents()[0]->id() == ParticleID::Cluster) {
_histograms.insert(make_pair(ID,Histogram(0.0,10.0,200)));
_histograms[ID] += parentClusterMass(*it)/GeV;
}
}
}
for(map<long,MyMultiplicityInfo>::iterator it = _data.begin();
it != _data.end(); ++it) {
long currentcount
= eventcount.find(it->first) == eventcount.end() ? 0
: eventcount[it->first];
it->second.count += currentcount;
}
}
void MyMultiplicityCount::analyze(const tPVector & ) {}
void MyMultiplicityCount::dofinish() {
string infile = "EPEM.dat";
ifstream normin;
string stringin = "";
double normfac = 1;
double stringdoub = 0;
bool next = 0, filerror = 0;
normin.open(infile.c_str());
if(!normin) { cerr << "Error: Failed to open file " << infile << endl; filerror = 1; normfac = 1.; }
if(!filerror) {
while(normin) {
normin >> stringin;
if(next) { normin >> stringdoub; normfac = stringdoub; break; }
if(stringin == "NORMFACTOR") { next = 1; }
}
}
string filename = generator()->filename() + ".mult";
ofstream outfile(filename.c_str());
outfile <<
"\nParticle multiplicities (compared to LEP data):\n"
" ID Name simMult obsMult obsErr Sigma\n";
for (map<long,MyMultiplicityInfo>::const_iterator it = _data.begin();
it != _data.end();
++it)
{
MyMultiplicityInfo multiplicity = it->second;
double newmultiplicity = multiplicity.simMultiplicity()*normfac;
string name = (it->first==0 ? "All chgd" :
generator()->getParticleData(it->first)->PDGName() );
ios::fmtflags oldFlags = outfile.flags();
outfile << std::scientific << std::showpoint
<< std::setprecision(3)
<< setw(7) << it->first << ' '
<< setw(9) << name << ' '
<< setw(2) << newmultiplicity << " | "
<< setw(2) << multiplicity.obsMultiplicity << " +/- "
<< setw(2) << multiplicity.obsError << ' '
<< std::showpos << std::setprecision(1)
<< (newmultiplicity-multiplicity.obsMultiplicity)/multiplicity.obsError << ' '
<< multiplicity.nSigma() << ' '
<< multiplicity.bargraph()
<< std::noshowpos;
outfile << '\n';
outfile.flags(oldFlags);
}
outfile << "\nCount of particles involved in hard process:\n";
for (map<long,long>::const_iterator it = _collisioncount.begin();
it != _collisioncount.end(); ++ it) {
string name = generator()->getParticleData(it->first)->PDGName();
outfile << name << '\t' << it->second << '\n';
}
outfile << "\nFinal state particle count:\n";
for (map<long,long>::const_iterator it = _finalstatecount.begin();
it != _finalstatecount.end(); ++ it) {
string name = generator()->getParticleData(it->first)->PDGName();
outfile << name << '\t' << it->second << '\n';
}
outfile.close();
if (_makeHistograms) {
Histogram piratio
= _histograms[ParticleID::piplus].ratioWith(_histograms[ParticleID::pi0]);
Histogram Kratio
= _histograms[ParticleID::Kplus].ratioWith(_histograms[ParticleID::K0]);
using namespace HistogramOptions;
string histofilename = filename + ".top";
ofstream outfile2(histofilename.c_str());
for (map<int,Histogram>::const_iterator it = _primary.begin();
it != _primary.end(); ++it) {
ostringstream title1;
title1 << "Primary Cluster " << it->first;
string title = title1.str();
it->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"",
"N (200 bins)","","Cluster mass [GeV]");
}
- map<long,Histogram>::const_iterator cit = _histograms.find(ExtraParticleID::Cluster);
+ map<long,Histogram>::const_iterator cit = _histograms.find(ParticleID::Cluster);
string title = generator()->getParticleData(cit->first)->PDGName();
cit->second.topdrawOutput(outfile2,Frame|Ylog,"BLACK",title,"",
"N (200 bins)","","Parent cluster mass [GeV]");
for (map<int,Histogram>::const_iterator it = _clusters.begin();
it != _clusters.end(); ++it) {
ostringstream title1;
title1 << "Final Cluster " << it->first;
string title = title1.str();
it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"",
"N (200 bins)","","Cluster mass [GeV]");
}
for (map<long,Histogram>::const_iterator it = _histograms.begin();
it != _histograms.end(); ++it) {
string title = generator()->getParticleData(it->first)->PDGName();
it->second.topdrawOutput(outfile2,Frame|Rawcount|Ylog,"BLACK",title,"",
"N (200 bins)","","Parent cluster mass [GeV]");
}
piratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","pi+ / pi0","",
"","","Parent cluster mass [GeV]");
Kratio.topdrawOutput(outfile2,Frame|Rawcount,"BLACK","K+ / K0","",
"","","Parent cluster mass [GeV]");
outfile2.close();
}
AnalysisHandler::dofinish();
}
ClassDescription<MyMultiplicityCount> MyMultiplicityCount::initMyMultiplicityCount;
// Definition of the static class description member.
void MyMultiplicityCount::Init() {
static ParVector<MyMultiplicityCount,long> interfaceparticlecodes
("ParticleCodes",
"The PDG code for the particles",
&MyMultiplicityCount::_particlecodes,
0, 0, 0, -10000000, 10000000, false, false, true);
static ParVector<MyMultiplicityCount,double> interfaceMultiplicity
("Multiplicity",
"The multiplicity for the particle",
&MyMultiplicityCount::_multiplicity,
0, 0, 0, 0., 1000., false, false, true);
static ParVector<MyMultiplicityCount,double> interfaceError
("Error",
"The error on the multiplicity for the particle",
&MyMultiplicityCount::_error,
0, 0, 0, 0., 1000., false, false, true);
static ParVector<MyMultiplicityCount,unsigned int> interfaceSpecies
("Species",
"The type of particle",
&MyMultiplicityCount::_species,
0, 0, other, 0, other, false, false, true);
static Switch<MyMultiplicityCount,bool> interfaceHistograms
("Histograms",
"Set to On if detailed histograms are required.",
&MyMultiplicityCount::_makeHistograms, false, true, false);
static SwitchOption interfaceHistogramsOn
(interfaceHistograms,
"Yes",
"Generate histograms of cluster mass dependence.",
true);
static SwitchOption interfaceHistogramsOff
(interfaceHistograms,
"No",
"Do not generate histograms.",
false);
static ClassDocumentation<MyMultiplicityCount> documentation
("The MyMultiplicityCount class count the multiplcities of final-state particles"
" and compares them with LEP data.");
}
void MyMultiplicityCount::persistentOutput(PersistentOStream & os) const {
os << _particlecodes << _multiplicity << _error << _species << _makeHistograms;
}
void MyMultiplicityCount::persistentInput(PersistentIStream & is, int) {
is >> _particlecodes >> _multiplicity >> _error >> _species >> _makeHistograms;
}
diff --git a/Decay/General/GeneralTwoBodyDecayer.cc b/Decay/General/GeneralTwoBodyDecayer.cc
--- a/Decay/General/GeneralTwoBodyDecayer.cc
+++ b/Decay/General/GeneralTwoBodyDecayer.cc
@@ -1,418 +1,484 @@
// -*- C++ -*-
//
// GeneralTwoBodyDecayer.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the GeneralTwoBodyDecayer class.
//
#include "GeneralTwoBodyDecayer.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/DecayMode.h"
#include "ThePEG/Utilities/Exception.h"
using namespace Herwig;
ParticleVector GeneralTwoBodyDecayer::decay(const Particle & parent,
const tPDVector & children) const {
// return empty vector if products heavier than parent
Energy mout(ZERO);
for(tPDVector::const_iterator it=children.begin();
it!=children.end();++it) mout+=(**it).massMin();
if(mout>parent.mass()) return ParticleVector();
// generate the decay
bool cc;
int imode=modeNumber(cc,parent.dataPtr(),children);
// generate the kinematics
ParticleVector decay=generate(generateIntermediates(),cc,imode,parent);
// make the colour connections
colourConnections(parent, decay);
// return the answer
return decay;
}
void GeneralTwoBodyDecayer::doinit() {
DecayIntegrator::doinit();
assert( _theVertex );
assert( _incoming && _outgoing.size()==2);
_theVertex->init();
//create phase space mode
tPDVector extpart(3);
extpart[0] = _incoming;
extpart[1] = _outgoing[0];
extpart[2] = _outgoing[1];
addMode(new_ptr(DecayPhaseSpaceMode(extpart, this)), _maxweight, vector<double>());
}
int GeneralTwoBodyDecayer::modeNumber(bool & cc, tcPDPtr parent,
const tPDVector & children) const {
long parentID = parent->id();
long id1 = children[0]->id();
long id2 = children[1]->id();
cc = false;
long out1 = _outgoing[0]->id();
long out2 = _outgoing[1]->id();
if( parentID == _incoming->id() &&
((id1 == out1 && id2 == out2) ||
(id1 == out2 && id2 == out1)) ) {
return 0;
}
else if(_incoming->CC() && parentID == _incoming->CC()->id()) {
cc = true;
if( _outgoing[0]->CC()) out1 = _outgoing[0]->CC()->id();
if( _outgoing[1]->CC()) out2 = _outgoing[1]->CC()->id();
if((id1 == out1 && id2 == out2) ||
(id1 == out2 && id2 == out1)) return 0;
}
return -1;
}
void GeneralTwoBodyDecayer::
colourConnections(const Particle & parent,
const ParticleVector & out) const {
PDT::Colour incColour(parent.data().iColour());
PDT::Colour outaColour(out[0]->data().iColour());
PDT::Colour outbColour(out[1]->data().iColour());
//incoming colour singlet
if(incColour == PDT::Colour0) {
// colour triplet-colourantitriplet
if((outaColour == PDT::Colour3 && outbColour == PDT::Colour3bar) ||
(outaColour == PDT::Colour3bar && outbColour == PDT::Colour3)) {
bool ac(out[0]->id() < 0);
out[0]->colourNeighbour(out[1],!ac);
}
//colour octet
else if(outaColour == PDT::Colour8 && outbColour == PDT::Colour8) {
out[0]->colourNeighbour(out[1]);
out[0]->antiColourNeighbour(out[1]);
}
// colour singlets
else if(outaColour == PDT::Colour0 && outbColour == PDT::Colour0) {
}
// unknown
else
throw Exception() << "Unknown outgoing colours for decaying "
<< "colour singlet in "
<< "GeneralTwoBodyDecayer::colourConnections "
<< outaColour << " " << outbColour
<< Exception::runerror;
}
//incoming colour triplet
else if(incColour == PDT::Colour3) {
// colour triplet + singlet
if(outaColour == PDT::Colour3 && outbColour == PDT::Colour0) {
out[0]->incomingColour(const_ptr_cast<tPPtr>(&parent));
}
//opposite order
else if(outaColour == PDT::Colour0 && outbColour == PDT::Colour3) {
out[1]->incomingColour(const_ptr_cast<tPPtr>(&parent));
}
// octet + triplet
else if(outaColour == PDT::Colour8 && outbColour == PDT::Colour3) {
out[0]->incomingColour(const_ptr_cast<tPPtr>(&parent));
out[1]->antiColourNeighbour(out[0]);
}
//opposite order
else if(outaColour == PDT::Colour3 && outbColour == PDT::Colour8) {
out[1]->incomingColour(const_ptr_cast<tPPtr>(&parent));
out[0]->antiColourNeighbour(out[1]);
}
else if(outaColour == PDT::Colour3bar && outaColour == PDT::Colour3bar) {
tColinePtr col[2] = {ColourLine::create(out[0],true),
ColourLine::create(out[1],true)};
parent.colourLine()->setSinkNeighbours(col[0],col[1]);
}
else
throw Exception() << "Unknown outgoing colours for decaying "
<< "colour triplet in "
<< "GeneralTwoBodyDecayer::colourConnections() "
<< outaColour << " " << outbColour
<< Exception::runerror;
}
// incoming colour anti triplet
else if(incColour == PDT::Colour3bar) {
// colour antitriplet +singlet
if(outaColour == PDT::Colour3bar && outbColour == PDT::Colour0) {
out[0]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
}
//opposite order
else if(outaColour == PDT::Colour0 && outbColour == PDT::Colour3bar) {
out[1]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
}
//octet + antitriplet
else if(outaColour == PDT::Colour3bar && outbColour == PDT::Colour8) {
out[1]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
out[0]->colourNeighbour(out[1]);
}
//opposite order
else if(outaColour == PDT::Colour8 && outbColour == PDT::Colour3bar) {
out[0]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
out[1]->colourNeighbour(out[0]);
}
else if(outaColour == PDT::Colour3 && outbColour == PDT::Colour3) {
tColinePtr col[2] = {ColourLine::create(out[0]),
ColourLine::create(out[1])};
parent.antiColourLine()->setSourceNeighbours(col[0],col[1]);
}
else
throw Exception() << "Unknown outgoing colours for decaying "
<< "colour antitriplet "
<< "in GeneralTwoBodyDecayer::colourConnections() "
<< outaColour << " " << outbColour
<< Exception::runerror;
}
//incoming colour octet
else if(incColour == PDT::Colour8) {
// triplet-antitriplet
if(outaColour == PDT::Colour3&&outbColour == PDT::Colour3bar) {
out[0]->incomingColour(const_ptr_cast<tPPtr>(&parent));
out[1]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
}
// opposite order
else if(outbColour == PDT::Colour3&&outaColour == PDT::Colour3bar) {
out[0]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
out[1]->incomingColour(const_ptr_cast<tPPtr>(&parent));
}
// neutral octet
else if(outaColour == PDT::Colour0&&outbColour == PDT::Colour8) {
out[1]->incomingColour(const_ptr_cast<tPPtr>(&parent));
out[1]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
}
else if(outbColour == PDT::Colour0&&outaColour == PDT::Colour8) {
out[0]->incomingColour(const_ptr_cast<tPPtr>(&parent));
out[0]->incomingAntiColour(const_ptr_cast<tPPtr>(&parent));
}
else
throw Exception() << "Unknown outgoing colours for decaying "
- << "colour octet "
- << "in GeneralTwoBodyDecayer::colourConnections() "
- << outaColour << " " << outbColour
- << Exception::runerror;
+ << "colour octet "
+ << "in GeneralTwoBodyDecayer::colourConnections() "
+ << outaColour << " " << outbColour
+ << Exception::runerror;
+ }
+ else if(incColour == PDT::Colour6) {
+ if(outaColour == PDT::Colour3 && outbColour == PDT::Colour3) {
+ tPPtr tempParent = const_ptr_cast<tPPtr>(&parent);
+ Ptr<MultiColour>::pointer parentColour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ (tempParent->colourInfo());
+
+ tColinePtr line1 = const_ptr_cast<tColinePtr>(parentColour->colourLines()[0]);
+ line1->addColoured(dynamic_ptr_cast<tPPtr>(out[0]));
+
+ tColinePtr line2 = const_ptr_cast<tColinePtr>(parentColour->colourLines()[1]);
+ line2->addColoured(dynamic_ptr_cast<tPPtr>(out[1]));
+ }
+ else
+ throw Exception() << "Unknown outgoing colours for decaying "
+ << "colour sextet "
+ << "in GeneralTwoBodyDecayer::colourConnections() "
+ << outaColour << " " << outbColour
+ << Exception::runerror;
+ }
+ else if(incColour == PDT::Colour6bar) {
+ if(outaColour == PDT::Colour3bar && outbColour == PDT::Colour3bar) {
+ tPPtr tempParent = const_ptr_cast<tPPtr>(&parent);
+ Ptr<MultiColour>::pointer parentColour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ (tempParent->colourInfo());
+
+ tColinePtr line1 = const_ptr_cast<tColinePtr>(parentColour->antiColourLines()[0]);
+ line1->addAntiColoured(dynamic_ptr_cast<tPPtr>(out[0]));
+
+ tColinePtr line2 = const_ptr_cast<tColinePtr>(parentColour->antiColourLines()[1]);
+ line2->addAntiColoured(dynamic_ptr_cast<tPPtr>(out[1]));
+ }
+ else
+ throw Exception() << "Unknown outgoing colours for decaying "
+ << "colour anti-sextet "
+ << "in GeneralTwoBodyDecayer::colourConnections() "
+ << outaColour << " " << outbColour
+ << Exception::runerror;
}
else
throw Exception() << "Unknown incoming colour in "
<< "GeneralTwoBodyDecayer::colourConnections() "
<< incColour
<< Exception::runerror;
}
bool GeneralTwoBodyDecayer::twoBodyMEcode(const DecayMode & dm, int & mecode,
double & coupling) const {
assert(dm.parent()->id() == _incoming->id());
ParticleMSet::const_iterator pit = dm.products().begin();
long id1 = (*pit)->id();
++pit;
long id2 = (*pit)->id();
long id1t(_outgoing[0]->id()), id2t(_outgoing[1]->id());
mecode = -1;
coupling = 1.;
if( id1 == id1t && id2 == id2t ) {
return true;
}
else if( id1 == id2t && id2 == id1t ) {
return false;
}
else
assert(false);
return false;
}
void GeneralTwoBodyDecayer::persistentOutput(PersistentOStream & os) const {
os << _theVertex << _incoming << _outgoing << _maxweight;
}
void GeneralTwoBodyDecayer::persistentInput(PersistentIStream & is, int) {
is >> _theVertex >> _incoming >> _outgoing >> _maxweight;
}
AbstractClassDescription<GeneralTwoBodyDecayer>
GeneralTwoBodyDecayer::initGeneralTwoBodyDecayer;
// Definition of the static class description member.
void GeneralTwoBodyDecayer::Init() {
static ClassDocumentation<GeneralTwoBodyDecayer> documentation
("This class is designed to be a base class for all 2 body decays"
"in a general model");
}
double GeneralTwoBodyDecayer::brat(const DecayMode &, const Particle & p,
double oldbrat) const {
ParticleVector children = p.children();
if( children.size() != 2 || !p.data().widthGenerator() )
return oldbrat;
// partial width for this mode
Energy scale = p.mass();
Energy pwidth =
partialWidth( make_pair(p.dataPtr(), scale),
make_pair(children[0]->dataPtr(), children[0]->mass()),
make_pair(children[1]->dataPtr(), children[1]->mass()) );
Energy width = p.data().widthGenerator()->width(p.data(), scale);
return pwidth/width;
}
void GeneralTwoBodyDecayer::doinitrun() {
DecayIntegrator::doinitrun();
for(unsigned int ix=0;ix<numberModes();++ix) {
double fact = pow(1.5,int(mode(ix)->externalParticles(0)->iSpin())-1);
mode(ix)->setMaxWeight(fact*mode(ix)->maxWeight());
}
}
double GeneralTwoBodyDecayer::colourFactor(tcPDPtr in, tcPDPtr out1,
tcPDPtr out2) const {
// identical particle symmetry factor
double output = out1->id()==out2->id() ? 0.5 : 1.;
// colour neutral incoming particle
if(in->iColour()==PDT::Colour0) {
// both colour neutral
if(out1->iColour()==PDT::Colour0 && out2->iColour()==PDT::Colour0)
output *= 1.;
// colour triplet/ antitriplet
else if((out1->iColour()==PDT::Colour3 && out2->iColour()==PDT::Colour3bar) ||
(out1->iColour()==PDT::Colour3bar && out2->iColour()==PDT::Colour3 ) ) {
output *= 3.;
}
// colour octet colour octet
else if(out1->iColour()==PDT::Colour8 && out2->iColour()==PDT::Colour8 ) {
output *= 8.;
}
else
throw Exception() << "Unknown colour for the outgoing particles"
<< " for decay colour neutral particle in "
<< "GeneralTwoBodyDecayer::colourFactor() for "
<< in->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< Exception::runerror;
}
// triplet
else if(in->iColour()==PDT::Colour3) {
// colour triplet + neutral
if((out1->iColour()==PDT::Colour0 && out2->iColour()==PDT::Colour3) ||
(out1->iColour()==PDT::Colour3 && out2->iColour()==PDT::Colour0) ) {
output *= 1.;
}
// colour triplet + octet
else if((out1->iColour()==PDT::Colour8 && out2->iColour()==PDT::Colour3) ||
(out1->iColour()==PDT::Colour3 && out2->iColour()==PDT::Colour8) ) {
output *= 4./3.;
}
// colour anti triplet anti triplet
else if(out1->iColour()==PDT::Colour3bar &&
out2->iColour()==PDT::Colour3bar) {
output *= 2.;
}
else
throw Exception() << "Unknown colour for the outgoing particles"
<< " for decay colour triplet particle in "
<< "GeneralTwoBodyDecayer::colourFactor() for "
<< in->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< Exception::runerror;
}
// anti triplet
else if(in->iColour()==PDT::Colour3bar) {
// colour anti triplet + neutral
if((out1->iColour()==PDT::Colour0 && out2->iColour()==PDT::Colour3bar ) ||
(out1->iColour()==PDT::Colour3bar && out2->iColour()==PDT::Colour0 ) ) {
output *= 1.;
}
// colour anti triplet + octet
else if((out1->iColour()==PDT::Colour8 && out2->iColour()==PDT::Colour3bar ) ||
(out1->iColour()==PDT::Colour3bar && out2->iColour()==PDT::Colour8 ) ) {
output *= 4./3.;
}
// colour triplet triplet
else if(out1->iColour()==PDT::Colour3 &&
out2->iColour()==PDT::Colour3) {
output *= 2.;
}
else
throw Exception() << "Unknown colour for the outgoing particles"
<< " for decay colour anti triplet particle in "
<< "GeneralTwoBodyDecayer::colourFactor() for "
<< in->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< Exception::runerror;
}
else if(in->iColour()==PDT::Colour8) {
// colour octet + neutral
if((out1->iColour()==PDT::Colour0 && out2->iColour()==PDT::Colour8 ) ||
(out1->iColour()==PDT::Colour8 && out2->iColour()==PDT::Colour0 ) ) {
output *= 1.;
}
// colour triplet/antitriplet
else if((out1->iColour()==PDT::Colour3 && out2->iColour()==PDT::Colour3bar) ||
(out1->iColour()==PDT::Colour3bar && out2->iColour()==PDT::Colour3 ) ) {
output *= 0.5;
}
else
throw Exception() << "Unknown colour for the outgoing particles"
<< " for decay colour octet particle in "
<< "GeneralTwoBodyDecayer::colourFactor() for "
<< in->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< Exception::runerror;
}
+ else if(in->iColour()==PDT::Colour6) {
+ // colour sextet -> triplet triplet
+ if( out1->iColour()==PDT::Colour3 && out2->iColour()==PDT::Colour3 ) {
+ output *= 1.;
+ }
+ else
+ throw Exception() << "Unknown colour for the outgoing particles"
+ << " for decay colour sextet particle in "
+ << "GeneralTwoBodyDecayer::colourFactor() for "
+ << in->PDGName() << " -> "
+ << out1->PDGName() << " " << out2->PDGName()
+ << Exception::runerror;
+ }
+ else if(in->iColour()==PDT::Colour6bar) {
+ // colour sextet -> triplet triplet
+ if( out1->iColour()==PDT::Colour3bar && out2->iColour()==PDT::Colour3bar ) {
+ output *= 1.;
+ }
+ else
+ throw Exception() << "Unknown colour for the outgoing particles"
+ << " for decay colour anti-sextet particle in "
+ << "GeneralTwoBodyDecayer::colourFactor() for "
+ << in->PDGName() << " -> "
+ << out1->PDGName() << " " << out2->PDGName()
+ << Exception::runerror;
+ }
else
throw Exception() << "Unknown colour "
<< in->iColour() << " for the decaying particle in "
<< "GeneralTwoBodyDecayer::colourFactor() for "
<< in->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< Exception::runerror;
return output;
}
Energy GeneralTwoBodyDecayer::partialWidth(PMPair inpart, PMPair outa,
PMPair outb) const {
// select the number of the mode
tPDVector children;
children.push_back(const_ptr_cast<PDPtr>(outa.first));
children.push_back(const_ptr_cast<PDPtr>(outb.first));
bool cc;
int nmode=modeNumber(cc,inpart.first,children);
tcPDPtr newchild[2] = {mode(nmode)->externalParticles(1),
mode(nmode)->externalParticles(2)};
// make the particles
Lorentz5Momentum pparent = Lorentz5Momentum(inpart.second);
PPtr parent = inpart.first->produceParticle(pparent);
Lorentz5Momentum pout[2];
double ctheta,phi;
Kinematics::generateAngles(ctheta,phi);
Kinematics::twoBodyDecay(pparent, outa.second, outb.second,
ctheta, phi,pout[0],pout[1]);
if( ( !cc && outa.first!=newchild[0]) ||
( cc && !(( outa.first->CC() && outa.first->CC() == newchild[0])||
( !outa.first->CC() && outa.first == newchild[0]) )))
swap(pout[0],pout[1]);
ParticleVector decay;
decay.push_back(newchild[0]->produceParticle(pout[0]));
decay.push_back(newchild[1]->produceParticle(pout[1]));
double me = me2(-1,*parent,decay,Initialize);
Energy pcm = Kinematics::pstarTwoBodyDecay(inpart.second,
outa.second, outb.second);
return me/(8.*Constants::pi)*pcm;
}
void GeneralTwoBodyDecayer::setDecayInfo(PDPtr incoming,PDPair outgoing,
VertexBasePtr vertex) {
_incoming=incoming;
_outgoing.clear();
_outgoing.push_back(outgoing.first );
_outgoing.push_back(outgoing.second);
_theVertex = vertex;
}
diff --git a/Decay/HwDecayHandler.cc b/Decay/HwDecayHandler.cc
--- a/Decay/HwDecayHandler.cc
+++ b/Decay/HwDecayHandler.cc
@@ -1,235 +1,235 @@
// -*- C++ -*-
//
// HwDecayHandler.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the HwDecayHandler class.
//
#include "HwDecayHandler.h"
#include "ThePEG/Handlers/EventHandler.h"
#include "ThePEG/Handlers/Hint.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/PDT/DecayMode.h"
#include "ThePEG/PDT/Decayer.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/EventRecord/Step.h"
#include "ThePEG/EventRecord/Collision.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "DecayIntegrator.h"
#include "DecayPhaseSpaceMode.h"
#include "ThePEG/PDT/MixedParticleData.h"
#include "Herwig++/Utilities/EnumParticles.h"
using namespace Herwig;
using namespace ThePEG::Helicity;
void HwDecayHandler::
handle(EventHandler &, const tPVector & tagged,
const Hint &) {
// First go through the tagged particles for unstable ones
tPVector parents;
for(int i = 0, N = tagged.size(); i<N; ++i) {
if(tagged[i]) {
// add to parents if not stable
if(!tagged[i]->data().stable() &&
- tagged[i]->data().id() != ExtraParticleID::Remnant &&
+ tagged[i]->data().id() != ParticleID::Remnant &&
_excluded.find( tagged[i]->dataPtr() ) == _excluded.end() ) {
parents.push_back(tagged[i]);
}
// if stable and has spinInfo set the developed flag
else {
develop(tagged[i]);
}
}
}
// if nothing to be decayed return
if(parents.empty()) return;
useMe();
// Create a new step, decay all particles and add their children to the step
StepPtr newstep = _newstep ? newStep() : currentStep();
for(int i = 0, N = parents.size(); i<N; ++i) {
performDecay(newstep->find(parents[i]), *newstep);
}
}
// perform decay method including modifications for spin correlations
// and for the decayer to specify intermediate decay products
void HwDecayHandler::performDecay(tPPtr parent, Step & s) const {
long ntry = 0;
tcSpinPtr hwspin;
tcMixedParticleDataPtr
mixdata=dynamic_ptr_cast<tcMixedParticleDataPtr>(parent->dataPtr());
if(mixdata) {
pair<bool,Length> mixing = mixdata->generateLifeTime();
develop(parent);
parent->setLifeLength(Distance());
PPtr newparent;
if(mixing.first) {
newparent = parent->dataPtr()->CC()->
produceParticle(parent->momentum());
}
else {
newparent = parent->dataPtr() ->
produceParticle(parent->momentum());
}
newparent->setLabVertex(parent->labDecayVertex());
Lorentz5Distance lifeLength(mixing.second,
parent->momentum().vect()*
(mixing.second/parent->mass()));
newparent->setLifeLength(lifeLength);
s.addDecayProduct(parent, newparent);
parent = newparent;
}
else if ( maxLifeTime() >= ZERO ) {
if( ( lifeTimeOption() && parent->lifeLength().tau() > maxLifeTime())||
(!lifeTimeOption() && parent->data().cTau() > maxLifeTime()) ) {
parent->setLifeLength(Distance());
develop(parent);
return;
}
}
while ( true ) {
// exit if fails
if ( ++ntry >= maxLoop() )
throw Exception() << "Too many tries " << maxLoop() << "to generate decay of "
<< *parent << "in "
<< "HwDecayHandler::performDecay" << Exception::eventerror;
// select the decay mode
tDMPtr dm(parent->data().selectMode(*parent));
// check we found a decay mode and it had a decayer
if ( !dm ) {
generator()->log() << *generator()->currentEvent() << "\n";
generator()->log() << *parent << "\n";
throw Exception() << "No DecayModes for " << parent->PDGName()
<< " in HwDecayHandler::performDecay"
<< Exception::eventerror;
}
if ( !dm->decayer() ) throw Exception() << "No decayer for DecayMode of "
<< parent->PDGName()
<< " in HwDecayHandler::performDecay"
<< Exception::eventerror;
try {
ParticleVector children = dm->decayer()->decay(*dm, *parent);
if(children.empty()) continue;
assert(parent->children().empty());
// generate radiation in the decay
tDecayIntegratorPtr hwdec=dynamic_ptr_cast<tDecayIntegratorPtr>(dm->decayer());
if (hwdec && hwdec->canGeneratePhotons())
children = hwdec->generatePhotons(*parent,children);
// set up parent
parent->decayMode(dm);
// add children
for ( int i = 0, N = children.size(); i < N; ++i ) {
children[i]->setLabVertex(parent->labDecayVertex());
if ( !s.addDecayProduct(parent, children[i]) )
throw Exception() << "Failed to add child "
<< children[i]->PDGName()
<< " in decay of " << parent->PDGName()
<< Exception::eventerror;
}
parent->scale(ZERO);
// loop over the children
for ( int i = 0, N = children.size(); i < N; ++i ) {
// if the child has already been decayed add products to the record
if(children[i]->decayed()) addDecayedParticle(children[i],s);
// if not stable decay the child
else if (!children[i]->data().stable() &&
_excluded.find( children[i]->dataPtr() ) == _excluded.end() ) {
performDecay(children[i], s);
}
// if stable and has spinInfo set up decay matrices etc.
else {
develop(children[i]);
}
}
// sort out the spinInfo for the parent after the decays
if(parent->spinInfo()) parent->spinInfo()->develop();
return;
}
catch (Veto)
{}
}
}
// method to add an intermediate which has already been decayed to the event record
void HwDecayHandler::addDecayedParticle(tPPtr parent, Step & s) const {
for ( int i = 0, N = parent->children().size(); i < N; ++i ) {
parent->children()[i]->setLabVertex(parent->labDecayVertex());
s.addDecayProduct(parent->children()[i]);
}
parent->scale(ZERO);
for ( int i = 0, N = parent->children().size(); i < N; ++i ) {
if((parent->children()[i])->decayed()) {
for(unsigned int ix=0;ix<(parent->children()[i])->children().size();++ix)
addDecayedParticle(parent->children()[i],s);
}
else if ( ! parent->children()[i]->data().stable() &&
_excluded.find( parent->children()[i]->dataPtr() ) == _excluded.end() ) {
performDecay(parent->children()[i], s);
}
else {
develop(parent->children()[i]);
}
}
return;
}
void HwDecayHandler::persistentOutput(PersistentOStream & os) const {
os << _newstep << _excluded << _excludedVector;
}
void HwDecayHandler::persistentInput(PersistentIStream & is, int) {
is >> _newstep >> _excluded >> _excludedVector;
}
ClassDescription<HwDecayHandler> HwDecayHandler::initHwDecayHandler;
void HwDecayHandler::Init() {
static ClassDocumentation<HwDecayHandler> documentation
("This is the handler for decays in Herwig++.",
"Decays in Herwig++ include full spin correlations, based on \\cite{Richardson:2001df}.",
"%\\cite{Richardson:2001df}\n"
"\\bibitem{Richardson:2001df}\n"
" P.~Richardson,\n"
" ``Spin correlations in Monte Carlo simulations,''\n"
" JHEP {\\bf 0111}, 029 (2001)\n"
" [arXiv:hep-ph/0110108].\n"
" %%CITATION = JHEPA,0111,029;%%\n"
);
static Switch<HwDecayHandler,bool> interfaceNewStep
("NewStep",
"Add the particles in a new step",
&HwDecayHandler::_newstep, true, false, false);
static SwitchOption interfaceNewStepNew
(interfaceNewStep,
"Yes",
"Add particles in a new step",
true);
static SwitchOption interfaceNewStepCurrent
(interfaceNewStep,
"No",
"Add them in the current step",
false);
static RefVector<HwDecayHandler,ParticleData> interfaceExcluded
("Excluded",
"Particles which should not be decayed",
&HwDecayHandler::_excludedVector, -1, false, false, true, false, false);
}
void HwDecayHandler::doinit() {
DecayHandler::doinit();
_excluded = set<tcPDPtr>(_excludedVector.begin(),_excludedVector.end());
}
diff --git a/Decay/Makefile.am b/Decay/Makefile.am
--- a/Decay/Makefile.am
+++ b/Decay/Makefile.am
@@ -1,23 +1,23 @@
SUBDIRS = FormFactors Tau Baryon VectorMeson Perturbative \
WeakCurrents ScalarMeson TensorMeson Partonic General Radiation
noinst_LTLIBRARIES = libHwDecay.la
pkglib_LTLIBRARIES = Hw64Decay.la HwMamboDecay.la
Hw64Decay_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:0:0
Hw64Decay_la_SOURCES = Hw64Decayer.h Hw64Decayer.cc
-HwMamboDecay_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:1:0
+HwMamboDecay_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:2:0
HwMamboDecay_la_SOURCES = MamboDecayer.h MamboDecayer.cc
libHwDecay_la_LIBADD = $(top_builddir)/PDT/libHwPDT.la
libHwDecay_la_SOURCES = \
DecayIntegrator.cc DecayIntegrator.fh DecayIntegrator.h \
DecayPhaseSpaceChannel.cc DecayPhaseSpaceChannel.fh \
DecayPhaseSpaceChannel.h \
DecayPhaseSpaceMode.cc DecayPhaseSpaceMode.fh \
DecayPhaseSpaceMode.h \
HwDecayerBase.cc HwDecayerBase.fh HwDecayerBase.h \
HwDecayHandler.cc HwDecayHandler.h\
DecayVertex.fh DecayVertex.h DecayVertex.cc \
DecayMatrixElement.h DecayMatrixElement.cc
diff --git a/Decay/MamboDecayer.cc b/Decay/MamboDecayer.cc
--- a/Decay/MamboDecayer.cc
+++ b/Decay/MamboDecayer.cc
@@ -1,433 +1,479 @@
// -*- C++ -*-
//
// MamboDecayer.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MamboDecayer class.
//
#include "MamboDecayer.h"
#include <ThePEG/Interface/ClassDocumentation.h>
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Utilities/UtilityBase.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "Herwig++/Utilities/Kinematics.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Reference.h"
using namespace Herwig;
using namespace ThePEG;
bool MamboDecayer::accept(tcPDPtr, const tPDVector & ) const {
return true;
}
void MamboDecayer::persistentOutput(PersistentOStream & os) const {
os << _maxweight;
}
void MamboDecayer::persistentInput(PersistentIStream & is, int) {
is >> _maxweight;
}
ClassDescription<MamboDecayer> MamboDecayer::initMamboDecayer;
void MamboDecayer::Init() {
static ClassDocumentation<MamboDecayer> documentation
("Decayer class that implements MAMBO algorithm of Kleiss-"
"Stirling.",
"The MAMBO algorithm of \\cite{Kleiss:1991rn} was used for high"
" multiplicity decays",
"\\bibitem{Kleiss:1991rn} R.~Kleiss and W.~J.~Stirling,\n"
"Nucl.\\ Phys.\\ B {\\bf 385} (1992) 413.\n"
"%%CITATION = NUPHA,B385,413;%%\n");
static Parameter<MamboDecayer,double> interfaceMaximumWeight
("MaxWeight",
"Maximum phase-space weight",
&MamboDecayer::_maxweight, 10.0, 1.0, 50.,
false, false, true);
}
ParticleVector MamboDecayer::decay(const Particle & parent,
const tPDVector & children) const {
useMe();
const int N = children.size();
ParticleVector out(N);
if(N == 1) {
out[0] = children[0]->produceParticle(parent.momentum());
return out;
}
Energy totalMass(ZERO);
for(int i = 0; i < N; ++i) {
totalMass += children[i]->mass();
}
if(totalMass > parent.mass()) {
generator()->log() << "MamboDecayer::decay - The Decay mode "
<< parent.PDGName() << "->";
for(int i = 0; i < N; ++i)
generator()->log() << children[i]->PDGName() << " ";
generator()->log() << " cannot proceed as there is not "
<< "enough phase space.\n";
out.clear();
return out;
}
double wgt(0.);
vector<Lorentz5Momentum> productMomentum(N);
do {
for(int i = 0; i < N; ++i)
productMomentum[i].setMass(children[i]->mass());
wgt = calculateMomentum(productMomentum,parent.mass());
}
while(wgt < _maxweight*UseRandom::rnd());
//set output momenta
int iter = 0;
for(tPDVector::const_iterator it=children.begin();iter<N;
++iter,++it) {
out[iter] = (*it)->produceParticle(productMomentum[iter]);
}
colourConnections(parent, out);
finalBoost(parent, out);
setScales(parent, out);
return out;
}
double MamboDecayer::calculateMomentum(vector<Lorentz5Momentum> & mom,
Energy comEn) const {
const int N = mom.size();
Energy rmtot(ZERO);
Energy2 rm2tot(ZERO);
for(int i = 0;i < N;++i) {
rmtot += mom[i].mass();
rm2tot += mom[i].mass2();
}
Energy wb = sqrt( (N*sqr(comEn) - sqr(rmtot))/N/N/(N - 1.) ) - rmtot/N;
Energy wmax = (2.0/3.0)*wb;
const Energy tol(1e-12*MeV);
long double r(0.), sf1(0.);
Energy2 sm2f2(ZERO);
Energy sf(ZERO), sff1(ZERO), w(ZERO),
wold(wmax), err(ZERO);
unsigned int iter(0), maxiter(50);
do {
sf = ZERO; sf1 = 0.; sff1 = ZERO; sm2f2 = ZERO;
for(int i = 0;i < N;++i) {
r = abs(mom[i].mass()/wold);
Energy f(ZERO);
long double f1(0.);
if (r == 0.0) {
f=2.*wold;
f1=2.;
}
else {
long double fk0(0.), fkp(0.);
BesselFns(r, fk0, fkp);
f = wold*(2.0 + r*fk0);
f1 = 2.- r*r*fkp;
}
sf += f;
sf1 += f1;
sff1 += f*f1;
sm2f2 -= f*f;
}
Energy u1 = 2.*(sf*sf1 - sff1);
Energy2 u0 = sf*sf + sm2f2 + rm2tot - sqr(comEn);
w = wold - u0/u1;
err = abs(w - wold);
wold = w;
++iter;
}
while(err > tol && iter < maxiter);
long double xu,xv;
vector<long double> alpha(N),um(N),vm(N);
for(int i = 0;i < N;++i) {
alpha[i] = 2.*(mom[i].mass()/w);
xu = (1.-alpha[i]+sqrt(1.+alpha[i]*alpha[i]))/2.;
xv = (3.-alpha[i]+sqrt(9.+ 4.*alpha[i]+alpha[i]*alpha[i]))/2.;
um[i] = exp(-xu/2.)*pow((xu*(xu+alpha[i])),0.25l);
vm[i] = xv*exp(-xv/2.)*pow((xv*(xv+alpha[i])),0.25l);
}
//start k-momenta generation
long double u(0.),v(0.),x(0.);
vector<Lorentz5Momentum> qk(N);
Lorentz5Momentum qktot;
do {
qktot=LorentzMomentum();
for(int i=0;i<N;++i) {
long double usq(0.),bound(0.);
do {
u = UseRandom::rnd()*um[i];
v = UseRandom::rnd()*vm[i];
x = v/u;
usq = u*u;
bound = exp(-x)*sqrt(x*(x+alpha[i]));
}
while(usq>bound);
double ck,phi;
Kinematics::generateAngles(ck,phi);
double sk = sqrt(1.0-ck*ck);
Energy qkv = w*sqrt(x*(x+alpha[i]));
qk[i] = Lorentz5Momentum(qkv*sk*sin(phi),qkv*sk*cos(phi),qkv*ck,
mom[i].mass()+w*x);
qktot += qk[i];
}
qktot.rescaleMass();
x = sqrt(comEn*comEn/qktot.mass2());
}
while(x>1.0);
//Perform lorentz boost from k to q
vector<Lorentz5Momentum> q(N);
Energy q0=ZERO, q1=ZERO, q2=ZERO, q3=ZERO;
long double t=0.;
vector<Energy2> qsq(N);
for(int i = 0;i<N;++i){
q3 = (qk[i]*qktot)/qktot.mass();
t = (q3+qk[i].e())/(qktot.e()+qktot.mass());
q2 = qk[i].z()-qktot.z()*t;
q1 = qk[i].y()-qktot.y()*t;
q0 = qk[i].x()-qktot.x()*t;
q[i] = Lorentz5Momentum(x*q0,x*q1,x*q2,x*q3);
qsq[i] = sqr(q[i].e())-x*x*mom[i].mass2();
}
long double xiold(1.),xi(0.);
vector<Energy> en(N);
iter = 0;
do {
Energy f = -comEn;
Energy f1 = ZERO;
for(int i = 0; i < N; ++i) {
en[i] = sqrt((xiold*xiold*qsq[i]) + mom[i].mass2());
f += en[i];
f1 += qsq[i]/en[i];
}
xi = xiold - f/(xiold*f1);
err = abs(xi-xiold)*MeV;
xiold = xi;
++iter;
}
while(err > tol && iter < maxiter);
//Now have desired momenta
for(int i = 0;i < N;++i)
mom[i] = Lorentz5Momentum(xi*q[i].x(),xi*q[i].y(),xi*q[i].z(),en[i]);
//Calculate weight of distribution
double s1(1.);
Energy s2(ZERO),s3(ZERO);
double wxi(0.);
for(int i=0;i<N;++i) {
s1 *= q[i].e()/mom[i].e();
s2 += mom[i].mass2()/q[i].e();
s3 += mom[i].mass2()/mom[i].e();
}
wxi = pow(xi,(3*N-3))*s1*(comEn-x*x*s2)/(comEn-s3);
return wxi;
}
void MamboDecayer::colourConnections(const Particle & parent,
ParticleVector & out) const {
const int N = out.size();
// fix 3-gluon colour lines / general colour lines
if(N == 3 && out[0]->id()==ParticleID::g && out[1]->id()==ParticleID::g
&& out[2]->id()== ParticleID::g ) {
out[0]->antiColourNeighbour(out[2]);
out[0]->colourNeighbour(out[1]);
out[1]->colourNeighbour(out[2]);
}
// incoming colour3/3bar state
else if(parent.data().iColour() == PDT::Colour3 ||
parent.data().iColour() == PDT::Colour3bar) {
PPtr pparent = const_ptr_cast<PPtr>(&parent);
// find outgoing coloured particles
tParticleVector trip,anti,oct;
for(int i=0;i < N;++i) {
if(out[i]->data().iColour() == PDT::Colour3)
trip.push_back(out[i]);
else if(out[i]->data().iColour() == PDT::Colour3bar)
anti.push_back(out[i]);
else if(out[i]->data().iColour() == PDT::Colour8)
oct .push_back(out[i]);
}
// 3 -> 3 + neutral
if(parent.data().iColour() == PDT::Colour3&&trip.size()==1&&
oct.size()==0&&anti.size()==0) {
trip[0]->incomingColour(pparent);
}
// 3bar -> 3bar + neutral
else if(parent.data().iColour() == PDT::Colour3bar&&trip.size()==0&&
oct.size()==0&&anti.size()==1) {
anti[0]->incomingColour(pparent,true);
}
// sink
else if(parent.data().iColour() == PDT::Colour3 &&
anti.size()==2 && oct.size()==0 && trip.size()==0) {
tColinePtr col[2] = {ColourLine::create(anti[0],true),
ColourLine::create(anti[1],true)};
parent.colourLine()->setSinkNeighbours(col[0],col[1]);
}
// source
else if(parent.data().iColour() == PDT::Colour3bar &&
trip.size()==2 && oct.size()==0 && anti.size()==0) {
tColinePtr col[2] = {ColourLine::create(trip[0]),
ColourLine::create(trip[1])};
parent.antiColourLine()->setSourceNeighbours(col[0],col[1]);
}
// 3 -> 3 + 8 + neutral
else if(parent.data().iColour() == PDT::Colour3&&trip.size()==1&&
oct.size()==1&&anti.size()==0) {
oct [0]->incomingColour(pparent);
oct [0]-> colourNeighbour(trip[0]);
trip[0]->antiColourNeighbour(oct[0]);
}
// 3bar -> 3bar + 8 + neutral
else if(parent.data().iColour() == PDT::Colour3bar&&trip.size()==0&&
oct.size()==1&&anti.size()==1) {
oct [0]->incomingColour(pparent,true);
oct [0]->antiColourNeighbour(anti[0]);
anti[0]-> colourNeighbour(oct[0]);
}
// 3 -> 3 + 3 + 3bar
else if(parent.data().iColour() == PDT::Colour3&&trip.size()==2&&
oct.size()==0&&anti.size()==1) {
int id1 = abs(pparent->id())%10;
int ip(0),io(1);
for(unsigned int ix=0;ix<trip.size();++ix) {
int id2 = abs(trip[ix]->id())%10;
if(id1==id2 || (id1%2==0&&id1==id2+1) ||
(id1%2==1&&id2==id1+1)) {
ip = ix;
io = 1-int(ix);
break;
}
}
trip[io]->antiColourNeighbour(anti[ 0]);
anti[0 ]->colourNeighbour(trip[io]);
trip[ip]->incomingColour(pparent);
}
// 3bar -> 3bar + 3 + 3bar
else if(parent.data().iColour() == PDT::Colour3bar&&trip.size()==1&&
oct.size()==0&&anti.size()==2) {
int id1 = abs(pparent->id())%10;
int ip(0),io(1);
for(unsigned int ix=0;ix<anti.size();++ix) {
int id2 = abs(anti[ix]->id())%10;
if(id1==id2 || (id1%2==0&&id1==id2+1) ||
(id1%2==1&&id2==id1+1)) {
ip = ix;
io = 1-int(ix);
break;
}
}
anti[io]-> colourNeighbour(trip[ 0]);
trip[0 ]->antiColourNeighbour(anti[io]);
anti[ip]->incomingColour(pparent,true);
}
else {
ostringstream dec;
for(unsigned int ix=0;ix<out.size();++ix) dec << out[ix]->PDGName() << " ";
throw Exception() << "Unknown colour for 3/3bar decay in MamboDecayer"
<< pparent->PDGName() << " -> " << dec.str()
<< Exception::runerror;
}
}
//incoming octet
else if(parent.data().iColour() == PDT::Colour8) {
PPtr pparent = const_ptr_cast<PPtr>(&parent);
- for(int i=0; i < N;++i) {
- if(out[i]->data().iColour() == PDT::Colour8) {
- out[i]->incomingColour(pparent);
- out[i]->incomingAntiColour(pparent);
+ tParticleVector trip,anti,oct;
+ for(int i=0;i < N;++i) {
+ if(out[i]->data().iColour() == PDT::Colour3)
+ trip.push_back(out[i]);
+ else if(out[i]->data().iColour() == PDT::Colour3bar)
+ anti.push_back(out[i]);
+ else if(out[i]->data().iColour() == PDT::Colour8)
+ oct .push_back(out[i]);
+ }
+ // decay to one octet
+ if(oct.size()==1&&trip.empty()&&anti.empty()) {
+ oct[0]->incomingColour(pparent);
+ oct[0]->incomingAntiColour(pparent);
+ }
+ // decay ot triplet/antitriplet
+ else if(trip.size()==1&&anti.size()==1&&oct.empty()) {
+ trip[0]->incomingColour(pparent,false);
+ anti[0]->incomingColour(pparent,true );
+ }
+ // baryon number violating decay to quarks
+ else if(trip.size()==3&&anti.empty()&&oct.empty()) {
+ unsigned int iloc = UseRandom::irnd(3);
+ tColinePtr col[2];
+ for(unsigned int ix=0;ix<trip.size();++ix) {
+ if(ix==iloc) {
+ trip[ix]->incomingColour(pparent);
+ }
+ else {
+ if(col[0]) col[1] = ColourLine::create(trip[ix]);
+ else col[0] = ColourLine::create(trip[ix]);
+ }
}
- else if(out[i]->data().iColour() == PDT::Colour3 ||
- out[i]->data().iColour() == PDT::Colour3bar) {
- out[i]->incomingColour(pparent,out[i]->id() < 0);
+ parent.antiColourLine()->setSourceNeighbours(col[0],col[1]);
+ }
+ // baryon number violating decay to antiquarks
+ else if(anti.size()==3&&trip.empty()&&oct.empty()) {
+ unsigned int iloc = UseRandom::irnd(3);
+ tColinePtr col[2];
+ for(unsigned int ix=0;ix<anti.size();++ix) {
+ if(ix==iloc) {
+ anti[ix]->incomingColour(pparent,true);
+ }
+ else {
+ if(col[0]) col[1] = ColourLine::create(anti[ix],true);
+ else col[0] = ColourLine::create(anti[ix],true);
+ }
}
+ parent.colourLine()->setSinkNeighbours(col[0],col[1]);
+ }
+ else {
+ ostringstream dec;
+ for(unsigned int ix=0;ix<out.size();++ix) dec << out[ix]->PDGName() << " ";
+ throw Exception() << "Unknown colour for octet decay in MamboDecayer"
+ << pparent->PDGName() << " -> " << dec.str()
+ << Exception::runerror;
}
}
else if(N==3 && parent.data().iColour() == PDT::Colour0&&
out[0]->data().iColour() == PDT::Colour3 &&
out[1]->data().iColour() == PDT::Colour3 &&
out[2]->data().iColour() == PDT::Colour3) {
tColinePtr col[3] = {ColourLine::create(out[0]),
ColourLine::create(out[1]),
ColourLine::create(out[2])};
col[0]->setSourceNeighbours(col[1],col[2]);
}
else if(N==3 && parent.data().iColour() == PDT::Colour0&&
out[0]->data().iColour() == PDT::Colour3bar &&
out[1]->data().iColour() == PDT::Colour3bar &&
out[2]->data().iColour() == PDT::Colour3bar) {
tColinePtr col[3] = {ColourLine::create(out[0],true),
ColourLine::create(out[1],true),
ColourLine::create(out[2],true)};
col[0]->setSinkNeighbours(col[1],col[2]);
}
//everything else
else {
for ( int i = 0; i < N; ++i ) {
if ( !out[i]->coloured() )
continue;
else if(i + 1 >= N) {
throw Exception()
<< "MamboDecayer::colourConnections() - "
<< "Cannot find appropriate configuration."
<< Exception::warning;
}
if ( out[i]->hasColour() )
out[i]->antiColourNeighbour(out[i + 1]);
if ( out[i]->hasAntiColour() )
out[i]->colourNeighbour(out[i + 1]);
++i; // skip the one that's linked up already
}
}
}
void MamboDecayer::dataBaseOutput(ofstream & output, bool header) const {
if(header) output << "update decayers set parameters=\"";
// parameters for the PartonicDecayerBase base class
output << "newdef " << name() << ":MaxWeight " << _maxweight << " \n";
if(header) output << "\n\" where BINARY ThePEGName=\""
<< fullName() << "\";" << endl;
}
void MamboDecayer::doinitrun() {
HwDecayerBase::doinitrun();
_a0[0] = 0.5;
_a0[1] = 0.375;
_a0[2] = 0.375;
_a0[3] = 0.4921875;
_a0[4] = 0.84375;
_a0[5] = 1.854492188,
_a0[6] = 5.0625;
_a0[7] = 16.58578491;
_a0[8] = 63.33398438;
_a0[9] = 275.6161079;
_a1[0] = 0.5;
_a1[1] = 0.75;
_a1[2] = 1.125;
_a1[3] = 1.96875;
_a1[4] = 4.21875;
_a1[5] = 11.12695313;
_a1[6] = 35.4375;
_a1[7] = 132.6862793;
_a1[8] = 570.0058594;
_a1[9] = 2756.161079;
}
diff --git a/Decay/VectorMeson/Makefile.am b/Decay/VectorMeson/Makefile.am
--- a/Decay/VectorMeson/Makefile.am
+++ b/Decay/VectorMeson/Makefile.am
@@ -1,17 +1,17 @@
pkglib_LTLIBRARIES = HwVMDecay.la
HwVMDecay_la_SOURCES = \
a1ThreePionCLEODecayer.cc a1ThreePionCLEODecayer.h \
a1SimpleDecayer.cc a1SimpleDecayer.h\
a1ThreePionDecayer.cc a1ThreePionDecayer.h \
PVectorMesonVectorPScalarDecayer.cc PVectorMesonVectorPScalarDecayer.h \
VectorMeson2FermionDecayer.cc VectorMeson2FermionDecayer.h \
VectorMeson2MesonDecayer.cc VectorMeson2MesonDecayer.h \
VectorMeson3PionDecayer.cc VectorMeson3PionDecayer.h \
VectorMesonPScalarFermionsDecayer.cc VectorMesonPScalarFermionsDecayer.h \
VectorMesonPVectorPScalarDecayer.cc VectorMesonPVectorPScalarDecayer.h \
VectorMesonVectorPScalarDecayer.cc VectorMesonVectorPScalarDecayer.h \
VectorMesonVectorScalarDecayer.cc VectorMesonVectorScalarDecayer.h \
VectorMesonVectorVectorDecayer.cc VectorMesonVectorVectorDecayer.h \
OniumToOniumPiPiDecayer.cc OniumToOniumPiPiDecayer.h
-HwVMDecay_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:0:0
+HwVMDecay_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:1:0
diff --git a/Doc/HerwigDefaults.in.in b/Doc/HerwigDefaults.in.in
--- a/Doc/HerwigDefaults.in.in
+++ b/Doc/HerwigDefaults.in.in
@@ -1,49 +1,50 @@
# @configure_input@
#
# output interfaces for documentation
# the following need to come first
globallibrary Herwig.so
library HwWeakCurrents.so
#
library Hw64Decay.so
library HwAnalysis.so
library HwFormFactors.so
library HwLEPAnalysis.so
library HwTevatronAnalysis.so
library HwMamboDecay.so
library HwMEHadronFast.so
library HwMEHadron.so
library HwMEDIS.so
library HwMELepton.so
library HwMEGammaGamma.so
library HwMEGammaHadron.so
library HwPowhegMEHadron.so
library HwPowhegMELepton.so
library SimpleKTCut.so
library HwMPI.so
library HwMRST.so
library HwReggeonPDF.so
library HwPomeronPDF.so
library HwPomeronFlux.so
library HwPartonicDecay.so
library HwPerturbativeDecay.so
library HwPerturbativeHiggsDecay.so
library HwShower.so
library HwSMDecay.so
library HwTauDecay.so
library HwTMDecay.so
library HwBaryonDecay.so
library HwSOPHTY.so
library HwUA5.so
library HwVMDecay.so
library HwSatPDF.so
library HwIncomingPhotonEvolver.so
@LOAD_SUSY@
@LOAD_NMSSM@
@LOAD_RS@
@LOAD_TRP@
@LOAD_UED@
@LOAD_ADD@
@LOAD_LEPTOQUARKS@
+@LOAD_SEXTET@
@LOAD_FASTJET@
doxygendump Herwig:: AllInterfaces.h
diff --git a/Hadronization/Cluster.cc b/Hadronization/Cluster.cc
--- a/Hadronization/Cluster.cc
+++ b/Hadronization/Cluster.cc
@@ -1,247 +1,247 @@
// -*- C++ -*-
//
// Cluster.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the Cluster class.
//
#include "Cluster.h"
#include <ThePEG/Repository/UseRandom.h>
#include <ThePEG/Repository/CurrentGenerator.h>
#include <ThePEG/PDT/ParticleData.h>
#include "ClusterHadronizationHandler.h"
#include <ThePEG/Utilities/DescribeClass.h>
using namespace Herwig;
DescribeNoPIOClass<Cluster,Particle>
describeCluster("Herwig::Cluster","");
PPtr Cluster::clone() const {
return new_ptr(*this);
}
PPtr Cluster::fullclone() const {
return clone();
}
tcCluHadHdlPtr Cluster::_clusterHadHandler = tcCluHadHdlPtr();
Energy2 Cluster::_mg2 = ZERO;
Cluster::Cluster()
: Particle(CurrentGenerator::current().
- getParticleData(long(ExtraParticleID::Cluster))),
+ getParticleData(long(ParticleID::Cluster))),
_isAvailable(true),
_hasReshuffled(false),
_component(),
_original(),
_isBeamRemnant(),
_isPerturbative(),
_numComp(0),
_id(0) {}
Cluster::Cluster(tPPtr p1, tPPtr p2, tPPtr p3)
: Particle(CurrentGenerator::current().
- getParticleData(long(ExtraParticleID::Cluster))),
+ getParticleData(long(ParticleID::Cluster))),
_isAvailable(true), _hasReshuffled(false)
{
if(!dataPtr()) {
cerr << "Cluster Particle Data not defined. Cannot complete Hadronization "
- << "without ParticleData for id " << ExtraParticleID::Cluster << '\n';
+ << "without ParticleData for id " << ParticleID::Cluster << '\n';
}
_component.push_back(new_ptr(Particle(*p1)));
_component.push_back(new_ptr(Particle(*p2)));
if(p3) _component.push_back(new_ptr(Particle(*p3)));
_original.push_back(p1);
_original.push_back(p2);
if(p3) _original.push_back(p3);
_isPerturbative.push_back(initPerturbative(p1));
_isPerturbative.push_back(initPerturbative(p2));
if(p3) _isPerturbative.push_back(initPerturbative(p3));
else _isPerturbative.push_back(false);
for(int i = 0; i<3; i++) _isBeamRemnant.push_back(false);
if(p3) {
_numComp = 3;
_id = 100*abs(p1->id()) + 10*abs(p2->id()) + abs(p3->id());
} else {
_numComp = 2;
if(p2->id() > 10)
_id = 10*abs(p2->id()/100) + abs(p1->id());
else if(p1->id() > 10)
_id = 10*abs(p1->id()/100) + abs(p2->id());
else
_id = 10*abs(p1->id()) + abs(p2->id());
}
calculateP();
calculateX();
}
Cluster::Cluster(tcEventPDPtr x)
: Particle(x),
_isAvailable(false),
_hasReshuffled(false),
_component(),
_original(),
_isBeamRemnant(),
_isPerturbative(),
_numComp(0),
_id(0) {}
Cluster::Cluster(const Particle &x)
: Particle(x),
_isAvailable(false),
_hasReshuffled(false),
_component(),
_original(),
_isBeamRemnant(),
_isPerturbative(),
_numComp(0),
_id(0) {}
Energy Cluster::sumConstituentMasses() const
{
if(_numComp == 3) {
return _component[0]->mass() +
_component[1]->mass() +
_component[2]->mass();
} else if(_numComp == 2)
return _component[0]->mass() + _component[1]->mass();
else return ZERO;
}
void Cluster::calculateP() {
Lorentz5Momentum m;
for(int i = 0; i<_numComp; i++)
m += _component[i]->momentum();
m.rescaleMass();
set5Momentum(m);
}
void Cluster::calculateX() {
if ( _numComp != 2 ) {
// Only in the case of two components we have a definition of cluster
// position in terms of the two components.
setVertex(LorentzPoint());
} else {
// Get the needed parameters.
assert(_clusterHadHandler);
Energy2 vmin2 = _clusterHadHandler->minVirtuality2();
Length dmax = _clusterHadHandler->maxDisplacement();
// Get the positions and displacements of the two components (Lab frame).
LorentzPoint pos1 = _component[0]->vertex();
Lorentz5Momentum p1 = _component[0]->momentum();
LorentzDistance displace1 = -log( UseRandom::rnd() ) *
hbarc * p1 * (1 / sqrt(sqr(p1.m2() - p1.mass2()) + sqr(vmin2)));
if ( abs( displace1.m() ) > dmax ) {
displace1 *= dmax / abs( displace1.m() );
}
LorentzPoint pos2 = _component[1]->vertex();
Lorentz5Momentum p2 = _component[1]->momentum();
LorentzDistance displace2 = -log( UseRandom::rnd() ) *
hbarc * p2 * (1 / sqrt(sqr(p2.m2() - p2.mass2()) + sqr(vmin2)));
if ( abs( displace2.m() ) > dmax ) {
displace2 *= dmax / abs( displace2.m() );
}
double s1 = 0.0, s2 = 0.0;
Lorentz5Momentum pcl = p1 + p2;
if ( abs( pcl.vect().dot( displace1.vect() ) ) > 1.0e-20*MeV*mm &&
abs( pcl.vect().dot( displace2.vect() ) ) > 1.0e-20*MeV*mm ) {
// The displacement with the smallest projection along pcl.vect()
// is scaled up such that both displacements have equal projections
// along pcl.vect().
double ratio = ( abs( pcl.vect().dot( displace1.vect() ) ) /
abs( pcl.vect().dot( displace2.vect() ) ) );
if ( pcl.vect().dot(displace1.vect()) *
pcl.vect().dot(displace2.vect()) < 0.0*sqr(MeV*mm) ) {
ratio *= -1;
}
if ( abs( ratio ) > 1.0 ) {
displace2 *= ratio;
} else {
displace1 *= ratio;
}
// Now determine the s1 and s2 values.
double s1minusS2 = ( pcl.vect().dot( pos2.vect() - pos1.vect() ) /
pcl.vect().dot( displace1.vect() ) );
if ( s1minusS2 < 0 ) {
s1 = 1.0;
s2 = s1 - s1minusS2;
} else if ( s1minusS2 > 0 ) {
s2 = 1;
s1 = s2 + s1minusS2;
}
}
// Now, finally, determine the cluster position
setVertex(0.5 * (pos1 + pos2 + s1*displace1 + s2*displace2));
} // end else part of if ( _collecCompPtr.size() != 2 )
}
bool Cluster::isBeamCluster() const {
for(int i = 0; i<_numComp; i++)
if(_isBeamRemnant[i]) return true;
return false;
}
void Cluster::isBeamCluster(tPPtr part) {
for(int i = 0; i<_numComp; i++) {
if(_original[i] == part) {
_isBeamRemnant[i] = true;
break;
}
}
}
bool Cluster::isStatusFinal() const {
int s = children().size();
for(unsigned int i = 0; i<children().size(); i++)
if(children()[i]->PDGName() == "Cluster") s--;
return ( s > 0);
}
tPPtr Cluster::particle(int i) const {
return (i < _numComp) ? _component[i] : PPtr();
}
tPPtr Cluster::colParticle(bool anti) const {
if ( _numComp != 2 ) return PPtr();
if ( _original[0]->hasColour(anti) ) return _original[0];
else if ( _original[1]->hasColour(anti) ) return _original[1];
else return PPtr();
}
tPPtr Cluster::antiColParticle() const {
return colParticle(true);
}
bool Cluster::isPerturbative(int i) const {
return _isPerturbative[i];
}
bool Cluster::isBeamRemnant(int i) const {
return _isBeamRemnant[i];
}
void Cluster::setBeamRemnant(int i, bool b) {
if(i < _numComp)
_isBeamRemnant[i] = b;
}
void Cluster::setPointerClusterHadHandler(tcCluHadHdlPtr gp) {
_clusterHadHandler = gp;
_mg2=sqr(_clusterHadHandler->
getParticleData(ParticleID::g)->constituentMass());
}
diff --git a/Hadronization/Cluster.h b/Hadronization/Cluster.h
--- a/Hadronization/Cluster.h
+++ b/Hadronization/Cluster.h
@@ -1,290 +1,290 @@
// -*- C++ -*-
//
// Cluster.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_Cluster_H
#define HERWIG_Cluster_H
#include <ThePEG/EventRecord/Particle.h>
#include "Herwig++/Utilities/EnumParticles.h"
#include "CluHadConfig.h"
#include "ClusterHadronizationHandler.fh"
#include "Cluster.fh"
namespace Herwig {
using namespace ThePEG;
/** \ingroup Hadronization
* \class Cluster
* \brief This class describes a cluster object.
* \author Philip Stephens
* \author Alberto Ribon
*
* This class represents a cluster, which is a colour singlet made usually
* of two components (quark-antiquark, quark-diquark, antiquark-antidiquark)
* or rarely by three components (quark-quark-quark, antiquark-antiquark-
* antiquark). A reference to the container with the pointers to its
* Components is provided.
*
* The class provides access to the pointers which point to:
*
* - The cluster parent. In the case that the cluster it is a fission
* product of a heavy cluster the parent is a cluster. If the cluster
* is formed from the perturbative partons then the parents will be
* the colour connected partons that formed the cluster.
* - The children (usually two). In the case the cluster is a
* heavy cluster that undergoes fission the children are clusters.
* Occasionally the cluster has been "redefined" (re-interpreted). For
* example in the case that three quark or anti-quark components
* have been redefined as two components (quark+diquark, or antiquark+
* antidiquark).
* - The (eventual) reshuffling partner, necessary for energy-momentum
* conservation when light clusters are decayed into single hadron. Not
* all clusters will have a reshuffling partner.
*
* Notice that in order to determine the cluster position from the positions
* of the components, the Cluster class needs some parameters.
* Because the Cluster class is neither interfaced nor persistent,
* a static pointer to the ClusterHadronizationHandler class instance,
* where the parameters are, is used. This static pointer is
* set via the method setPointerClusterHadHandler(), during the
* run initialization, doinitrun() of ClusterHadronizationHandler.
*
* @see ClusterHadronizationHandler
*/
class Cluster : public Particle {
public:
/** @name Standard constructors and destructors. */
//@{
/**
* Default constructor.
*/
Cluster();
/**
* Constructor with a particleData pointer
*/
Cluster(tcEventPDPtr);
/**
* This creates a cluster from 2 (or 3) partons.
*/
Cluster(tPPtr part1, tPPtr part2, tPPtr part3 = tPPtr());
/**
* Also a constructor where a particle is given not a cluster.
*/
Cluster(const Particle &);
//@}
/**
* Set the static pointer to the ClusterHadronizationHandler object.
* The pointer is set in ClusterHadronizationHandler::doinitrun().
*/
static void setPointerClusterHadHandler(tcCluHadHdlPtr gp);
/**
* Number of quark (diquark) constituents (normally two).
*/
int numComponents() const
{ return _numComp; }
/**
* Sum of the constituent masses of the components of the cluster.
*/
Energy sumConstituentMasses() const;
/**
* Returns the ith constituent.
*/
tPPtr particle(int i) const;
/**
* Returns the original constituent carrying colour
*/
tPPtr colParticle(bool anti = false) const;
/**
* Returns the original constituent carrying anticolour
*/
tPPtr antiColParticle() const;
/**
* Returns whether the ith constituent is from a perturbative process.
*/
bool isPerturbative(int) const;
/**
* Indicates whether the ith constituent is a beam remnant.
*/
bool isBeamRemnant(int) const;
/**
* Sets whether the ith constituent is a beam remnant.
*/
void setBeamRemnant(int,bool);
/**
* Returns the clusters id, not the same as the PDG id.
*/
int clusterId() const { return _id; }
public:
/**
* Returns true when a constituent is a beam remnant.
*/
bool isBeamCluster() const;
/**
* Set the pointer to the reshuffling partner cluster.
*/
void flagAsReshuffled()
{ _hasReshuffled = true; }
/**
* Sets the component (if any) that points to "part" as a beam remnant.
*/
void isBeamCluster(tPPtr part);
/**
* Returns true if this cluster is to be handled by the hadronization.
*/
bool isAvailable() const
{ return _isAvailable; }
/**
* Sets the value of availability.
*/
void isAvailable(bool inputAvailable)
{ _isAvailable = inputAvailable; }
/**
* Return true if the cluster does not have cluster parent.
*/
bool isStatusInitial() const
{ return parents().empty(); }
/**
* Return true if the cluster does not have cluster children and
* it is not already decayed (i.e. it does not have hadron children)
* (to be used only after the fission of heavy clusters).
*/
bool isReadyToDecay() const
{ return children().empty(); }
/**
* Return true if the cluster has one and only one cluster children
* and no hadron children: that means either that its three quarks or
* anti-quarks components have been redefined as two components
* (quark+diquark, or antiquark+antidiquark), or that the cluster
* has been used as a partner for the momentum reshuffling necessary
* to conserve energy-momentum when a light cluster is decayed into
* a single hadron (notice that this latter light cluster has
* isRedefined() false, because it has an hadron child).
* In both cases, the unique cluster children is the new redefined
* cluster. The two cases can be distinguish by the next method.
*/
bool isRedefined() const {
return ( children().size() == 1
- && children()[0]->id() == ExtraParticleID::Cluster );
+ && children()[0]->id() == ParticleID::Cluster );
}
/**
* Return true when it has a reshuffling partner.
* Notice that a cluster can have hasBeenReshuffled() true but
* isRedefined() false: this is the case of a light cluster
* that decays into a single hadron.
*/
bool hasBeenReshuffled() const
{ return _hasReshuffled; }
/**
* Return true if the cluster has hadron children.
*/
bool isStatusFinal() const;
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual PPtr 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 PPtr fullclone() const;
//@}
private:
/**
* Private and non-existent assignment operator.
*/
Cluster & operator=(const Cluster &);
/**
* Calculate the 5-momentum vector of the cluster
* The 5-momentum of the cluster is given by
* \f[ P = \sum_i p_i \f]
* and the mass of the cluster is \f$m^2 = P^2\f$
*/
void calculateP();
/**
* Calculate the 4-position vector of the cluster
* Displacement of the ith constituent given by momentum \f$p_i\f$
* vertex \f$x_i\f$ and mass \f$m_i\f$ is
* \f[ D_i = -C \log(r) \frac{p_i}{\sqrt{(p_i^2 - m_i^2)^2 + v^4}} \f]
* where \f$r\f$ is a random number [0,1],
* \f$v\f$ is the minimum virtuality and \f$C\f$ is
* a conversion factor from GeV to millimeters. We can then find the
* difference in \f$s\f$ factors as
* \f[ (s_1-s_2) = \frac{(\vec{p}_1 + \vec{p}_2) \cdot (\vec{x}_2 -
* \vec{x}_1)}{(\vec{p}_1 + \vec{p}_2) \cdot \vec{D}_1}.
* \f]
* if \f$s_2>s_1\f$ then \f$s_1 = 1.0\f$ otherwise \f$s_2 = 1.0\f$.
* These are then used to determine the value of the clusters vertex as
* \f[ X = \frac{1}{2} ( x_1 +x_2 + s_1 D_1 + s_2 D_2). \f]
*/
void calculateX();
/**
* Determines whether constituent p is perturbative or not.
*/
bool initPerturbative(tPPtr p)
{ return p->scale() > _mg2; }
/**
* This is needed to determine if a cluster is from a perturbative quark.
*/
static tcCluHadHdlPtr _clusterHadHandler;
/**
* The gluon mass is needed to determine if a cluster is from a perturbative quark
*/
static Energy2 _mg2;
bool _isAvailable; //!< Whether the cluster is hadronizing
bool _hasReshuffled; //!< Whether the cluster has been reshuffled
ParticleVector _component; //!< The constituent partons
tParticleVector _original; //!< The original components
vector<bool> _isBeamRemnant; //!< Whether a parton is a beam remnant
vector<bool> _isPerturbative; //!< Whether a parton is perturbative
int _numComp; //!< The number of constituents
long _id; //!< The id of this cluster
};
} // end namespace Herwig
#endif // HERWIG_Cluster_H
diff --git a/Hadronization/ClusterFinder.cc b/Hadronization/ClusterFinder.cc
--- a/Hadronization/ClusterFinder.cc
+++ b/Hadronization/ClusterFinder.cc
@@ -1,343 +1,344 @@
// -*- C++ -*-
//
// ClusterFinder.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the ClusterFinder class.
//
#include "ClusterFinder.h"
#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/PDT/StandardMatchers.h>
#include <ThePEG/PDT/EnumParticles.h>
#include <ThePEG/Repository/EventGenerator.h>
#include <ThePEG/EventRecord/Collision.h>
#include "CheckId.h"
#include "Herwig++/Utilities/EnumParticles.h"
#include "Cluster.h"
#include <ThePEG/Utilities/DescribeClass.h>
using namespace Herwig;
DescribeNoPIOClass<ClusterFinder,Interfaced>
describeClusterFinder("Herwig::ClusterFinder","");
IBPtr ClusterFinder::clone() const {
return new_ptr(*this);
}
IBPtr ClusterFinder::fullclone() const {
return new_ptr(*this);
}
void ClusterFinder::Init() {
static ClassDocumentation<ClusterFinder> documentation
("This class is responsible of finding clusters.");
}
ClusterVector ClusterFinder::formClusters(const PVector & partons)
{
set<tPPtr> examinedSet; // colour particles already included in a cluster
map<tColinePtr, pair<tPPtr,tPPtr> > quarkQuark; // quark quark
map<tColinePtr, pair<tPPtr,tPPtr> > aQuarkQuark; // anti quark anti quark
ParticleSet inputParticles(partons.begin(),partons.end());
ClusterVector clusters;
-
+
// Loop over all current particles.
for(PVector::const_iterator pit=partons.begin();pit!=partons.end();++pit){
// Skip to the next particle if it is not coloured or already examined.
assert(*pit);
assert((*pit)->dataPtr());
if(!(**pit).data().coloured()
|| examinedSet.find(*pit) != examinedSet.end()) {
continue;
}
// We assume that a cluster is made of, at most, 3 constituents although
// in most cases the number will be 2; however, for baryon violating decays
// (for example in Susy model without R parity conservation) we can have 3
// constituents. In the latter case, a quark (antiquark) do not have an
// anticolour (colour) partner as usual, but its colour line either stems
// from a colour source, or ends in a colour sink. In the case of double
// baryon violating decays, but with overall baryon conservation
// ( for instance:
// tilde_u_R -> dbar_1 + dbar_2
// tilde_u_R_star -> d1 + d2
// where tilde_u_R and tilde_u_R_star are colour connected )
// a special treatment is needed, because first we have to process all
// partons in the current step, and then for each left pair of quarks which
// stem from a colour source we have to find the corresponding pair of
// anti-quarks which ends in a colour sink and is connected with the
// above colour source. These special pairs are kept into the maps:
// spec/CluHadConfig.hialQuarkQuarkMap and specialAntiQuarkAntiQuarkMap.
tParticleVector connected(3);
int iElement = 0;
connected[iElement++] = *pit;
bool specialCase = false;
if((*pit)->hasColour()) {
tPPtr partner =
(*pit)->colourLine()->getColouredParticle(partons.begin(),
partons.end(),
true);
if(partner) {
connected[iElement++]= partner;
}
// colour source : baryon-violating process
else {
if((*pit)->colourLine()->sourceNeighbours() != tColinePair()) {
tColinePair sourcePair = (*pit)->colourLine()->sourceNeighbours();
tColinePtr intCL = tColinePtr();
for(int i = 0; i < 2; ++i) {
tColinePtr pLine = i==0 ? sourcePair.first : sourcePair.second;
int saveNumElements = iElement;
for(tPVector::const_iterator cit = pLine->coloured().begin();
cit != pLine->coloured().end(); ++cit ) {
ParticleSet::const_iterator cjt = inputParticles.find(*cit);
if(cjt!=inputParticles.end()) connected[iElement++]= (*cit);
}
if(iElement == saveNumElements) intCL = pLine;
}
if(intCL && iElement == 2) {
specialCase = true;
pair<tPPtr,tPPtr> qp=pair<tPPtr,tPPtr>(connected[0],connected[1]);
quarkQuark.insert(pair<tColinePtr,pair<tPPtr,tPPtr> >(intCL,qp));
}
else if(iElement != 3) {
throw Exception() << "Colour connections fail in the hadronization for "
<< **pit << "in ClusterFinder::formClusters"
<< " for a coloured particle."
<< " Failed to find particles from a source"
<< Exception::runerror;
}
}
else {
throw Exception() << "Colour connections fail in the hadronization for "
<< **pit << "in ClusterFinder::formClusters for"
<< " a coloured particle"
<< Exception::runerror;
}
}
}
if((*pit)->hasAntiColour()) {
tPPtr partner =
(*pit)->antiColourLine()->getColouredParticle(partons.begin(),
partons.end(),
false);
if(partner) {
connected[iElement++]=partner;
}
// colour sink : baryon-violating process
else {
if((*pit)->antiColourLine()->sinkNeighbours() != tColinePair()) {
tColinePair sinkPair = (*pit)->antiColourLine()->sinkNeighbours();
tColinePtr intCL = tColinePtr();
for(int i = 0; i < 2; ++i) {
tColinePtr pLine = i==0 ? sinkPair.first : sinkPair.second;
int saveNumElements = iElement;
for(tPVector::const_iterator cit = pLine->antiColoured().begin();
cit != pLine->antiColoured().end(); ++cit ) {
ParticleSet::const_iterator cjt = inputParticles.find(*cit);
if(cjt!=inputParticles.end()) connected[iElement++]= (*cit);
}
if(iElement == saveNumElements) intCL = pLine;
}
if(intCL && iElement == 2) {
specialCase = true;
pair<tPPtr,tPPtr> aqp=pair<tPPtr,tPPtr>(connected[0],connected[1]);
aQuarkQuark.insert(pair<tColinePtr,pair<tPPtr,tPPtr> >(intCL,aqp));
}
else if( iElement !=3) {
throw Exception() << "Colour connections fail in the hadronization for "
<< **pit << "in ClusterFinder::formClusters for"
<< " an anti-coloured particle."
<< " Failed to find particles from a sink"
<< Exception::runerror;
}
}
else {
throw Exception() << "Colour connections fail in the hadronization for "
<< **pit << "in ClusterFinder::formClusters for"
<< " an anti-coloured particle"
<< Exception::runerror;
}
}
}
if(!specialCase) {
// Tag the components of the found cluster as already examined.
for (int i=0; i<iElement; ++i) examinedSet.insert(connected[i]);
// Create the cluster object with the colour connected particles
ClusterPtr cluPtr = new_ptr(Cluster(connected[0],connected[1],
connected[2]));
// add to the step
connected[0]->addChild(cluPtr);
connected[1]->addChild(cluPtr);
if(connected[2]) connected[2]->addChild(cluPtr);
clusters.push_back(cluPtr);
// Check if any of the components is a beam remnant, and if this
// is the case then inform the cluster.
// this will only work for baryon collisions
for (int i=0; i<iElement; ++i) {
if(!connected[i]->parents().empty()&&
- connected[i]->parents()[0]->id()==ExtraParticleID::Remnant&&
+ connected[i]->parents()[0]->id()==ParticleID::Remnant&&
DiquarkMatcher::Check(connected[i]->id()))
cluPtr->isBeamCluster(connected[i]);
}
}
}
// Treat now the special cases, if any. The idea is to find for each pair
// of quarks coming from a common colour source the corresponding pair of
// antiquarks coming from a common colour sink, connected to the above
// colour source via the same colour line. Then, randomly couple one of
// the two quarks with one of the two antiquarks, and do the same with the
// quark and antiquark left.
for(map<tColinePtr, pair<tPPtr,tPPtr> >::const_iterator
cit = quarkQuark.begin(); cit != quarkQuark.end(); ++cit ) {
tColinePtr coline = cit->first;
pair<tPPtr,tPPtr> quarkPair = cit->second;
if(aQuarkQuark.find( coline ) != aQuarkQuark.end()) {
pair<tPPtr,tPPtr> antiQuarkPair = aQuarkQuark.find(coline)->second;
ClusterPtr cluPtr1, cluPtr2;
if ( UseRandom::rndbool() ) {
cluPtr1 = new_ptr(Cluster(quarkPair.first , antiQuarkPair.first));
cluPtr2 = new_ptr(Cluster(quarkPair.second , antiQuarkPair.second));
quarkPair.first->addChild(cluPtr1);
antiQuarkPair.first->addChild(cluPtr1);
quarkPair.second->addChild(cluPtr2);
antiQuarkPair.second->addChild(cluPtr2);
} else {
cluPtr1 = new_ptr(Cluster(quarkPair.first , antiQuarkPair.second));
cluPtr2 = new_ptr(Cluster(quarkPair.second , antiQuarkPair.first));
quarkPair.second->addChild(cluPtr2);
antiQuarkPair.first->addChild(cluPtr2);
quarkPair.first->addChild(cluPtr1);
antiQuarkPair.second->addChild(cluPtr1);
}
clusters.push_back(cluPtr1);
clusters.push_back(cluPtr2);
}
else {
throw Exception() << "ClusterFinder::formClusters : "
<< "***Skip event: unable to match pairs in "
<< "Baryon-violating processes***"
<< Exception::eventerror;
}
}
return clusters;
}
void ClusterFinder::reduceToTwoComponents(ClusterVector & clusters)
{
// In order to preserve all of the information, we do not modify the
// directly the 3-component clusters, but instead we define new clusters,
// which are related to the original ones by a child-parent relationship,
// by considering two randomly chosen components as a diquark (or anti-diquark).
// These new clusters are first added to the vector vecNewRedefinedCluPtr,
// and at the end, when all input clusters have been examined, the elements of
// this vector will be copied in collecCluPtr (the reason is that it is not
// allowed to modify a STL container while iterating over it).
vector<tClusterPtr> redefinedClusters;
tParticleVector vec(3);
for(ClusterVector::iterator cluIter = clusters.begin() ;
cluIter != clusters.end() ; ++cluIter) {
if ( ! (*cluIter)->isAvailable()
|| (*cluIter)->numComponents() != 3 ) continue;
for(int i = 0; i<(*cluIter)->numComponents(); i++)
vec[i] = (*cluIter)->particle(i);
// Randomly selects two components to be considered as a (anti)diquark
// and place them as the second and third element of vec.
int choice = UseRandom::rnd3(1.0, 1.0, 1.0);
switch (choice) {
case 0:
break;
case 1:
swap(vec[0],vec[1]);
break;
case 2:
swap(vec[0],vec[2]);
break;
}
+
tcPDPtr temp1 = vec[1]->dataPtr();
tcPDPtr temp2 = vec[2]->dataPtr();
tcPDPtr dataDiquark = CheckId::makeDiquark(temp1,temp2);
if(!dataDiquark)
throw Exception() << "Could not make a diquark from"
<< temp1->PDGName() << " and "
<< temp2->PDGName()
<< " in ClusterFinder::reduceToTwoComponents()"
<< Exception::eventerror;
// Create the new cluster (with two components) and assign to it the same
// momentum and position of the original (with three components) one.
// Furthermore, assign to the diquark component a momentum given by the
// sum of the two original components from which has been formed; for the
// position, we are assuming, very simply, that the diquark position is
// the average positions of the two original components.
// Notice that the mass (5-th component of the 5-momentum) of the diquark
// is set by hand to the constituent mass of the diquark (which is equal
// to the sum of the constituent masses of the two quarks which form the
// diquark) because the sum of 5-component vectors do add only the "normal"
// 4-components, not the 5-th one. After that, the 5-momentum of the diquark
// is in an inconsistent state, because the mass (5-th component) is not
// equal to the invariant mass obtained from the 4-momemtum. This is not
// unique to this kind of component (all perturbative components are in
// a similar situation), but it is not harmful.
PPtr diquark = dataDiquark->produceParticle();
vec[1]->addChild(diquark);
vec[2]->addChild(diquark);
ClusterPtr nclus = new_ptr(Cluster(vec[0],diquark));
//vec[0]->addChild(nclus);
//diquark->addChild(nclus);
(*cluIter)->addChild(nclus);
nclus->set5Momentum((*cluIter)->momentum());
nclus->setVertex((*cluIter)->vertex());
for(int i = 0; i<nclus->numComponents(); i++) {
if(nclus->particle(i)->id() == dataDiquark->id()) {
nclus->particle(i)->set5Momentum(Lorentz5Momentum(vec[1]->momentum()
+ vec[2]->momentum(), dataDiquark->constituentMass()));
nclus->particle(i)->setVertex(0.5*(vec[1]->vertex()
+ vec[2]->vertex()));
}
}
// Set the parent/children relationship between the original cluster
// (the one with three components) with the new one (the one with two components)
// and add the latter to the vector of new redefined clusters.
//(*cluIter)->addChild(nclus);
redefinedClusters.push_back(nclus);
}
// Add to collecCluPtr all of the redefined new clusters (indeed the
// pointers to them are added) contained in vecNewRedefinedCluPtr.
/// \todo why do we keep the original of the redefined clusters?
for (tClusterVector::const_iterator it = redefinedClusters.begin();
it != redefinedClusters.end(); ++it) {
clusters.push_back(*it);
}
}
diff --git a/Hadronization/ClusterHadronizationHandler.cc b/Hadronization/ClusterHadronizationHandler.cc
--- a/Hadronization/ClusterHadronizationHandler.cc
+++ b/Hadronization/ClusterHadronizationHandler.cc
@@ -1,309 +1,313 @@
// -*- C++ -*-
//
// ClusterHadronizationHandler.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the ClusterHadronizationHandler class.
//
#include "ClusterHadronizationHandler.h"
#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/Persistency/PersistentOStream.h>
#include <ThePEG/Persistency/PersistentIStream.h>
#include <ThePEG/Interface/Parameter.h>
#include <ThePEG/Interface/Reference.h>
#include <ThePEG/Handlers/EventHandler.h>
#include <ThePEG/Handlers/Hint.h>
#include <ThePEG/PDT/ParticleData.h>
#include <ThePEG/EventRecord/Particle.h>
#include <ThePEG/EventRecord/Step.h>
#include <ThePEG/PDT/PDT.h>
#include <ThePEG/PDT/EnumParticles.h>
#include <ThePEG/Utilities/Throw.h>
#include "Herwig++/Utilities/EnumParticles.h"
#include "CluHadConfig.h"
#include "Cluster.h"
#include <ThePEG/Utilities/DescribeClass.h>
using namespace Herwig;
DescribeClass<ClusterHadronizationHandler,HadronizationHandler>
describeClusterHadronizationHandler("Herwig::ClusterHadronizationHandler","");
IBPtr ClusterHadronizationHandler::clone() const {
return new_ptr(*this);
}
IBPtr ClusterHadronizationHandler::fullclone() const {
return new_ptr(*this);
}
void ClusterHadronizationHandler::persistentOutput(PersistentOStream & os)
const {
os << _partonSplitter
<< _clusterFinder
<< _colourReconnector
<< _clusterFissioner
<< _lightClusterDecayer
<< _clusterDecayer
<< ounit(_minVirtuality2,GeV2)
<< ounit(_maxDisplacement,mm)
<< _underlyingEventHandler;
}
void ClusterHadronizationHandler::persistentInput(PersistentIStream & is, int) {
is >> _partonSplitter
>> _clusterFinder
>> _colourReconnector
>> _clusterFissioner
>> _lightClusterDecayer
>> _clusterDecayer
>> iunit(_minVirtuality2,GeV2)
>> iunit(_maxDisplacement,mm)
>> _underlyingEventHandler;
}
void ClusterHadronizationHandler::Init() {
static ClassDocumentation<ClusterHadronizationHandler> documentation
("This is the main handler class for the Cluster Hadronization",
"The hadronization was performed using the cluster model of \\cite{Webber:1983if}.",
"%\\cite{Webber:1983if}\n"
"\\bibitem{Webber:1983if}\n"
" B.~R.~Webber,\n"
" ``A QCD Model For Jet Fragmentation Including Soft Gluon Interference,''\n"
" Nucl.\\ Phys.\\ B {\\bf 238}, 492 (1984).\n"
" %%CITATION = NUPHA,B238,492;%%\n"
// main manual
);
static Reference<ClusterHadronizationHandler,PartonSplitter>
interfacePartonSplitter("PartonSplitter",
"A reference to the PartonSplitter object",
&Herwig::ClusterHadronizationHandler::_partonSplitter,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterFinder>
interfaceClusterFinder("ClusterFinder",
"A reference to the ClusterFinder object",
&Herwig::ClusterHadronizationHandler::_clusterFinder,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ColourReconnector>
interfaceColourReconnector("ColourReconnector",
"A reference to the ColourReconnector object",
&Herwig::ClusterHadronizationHandler::_colourReconnector,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterFissioner>
interfaceClusterFissioner("ClusterFissioner",
"A reference to the ClusterFissioner object",
&Herwig::ClusterHadronizationHandler::_clusterFissioner,
false, false, true, false);
static Reference<ClusterHadronizationHandler,LightClusterDecayer>
interfaceLightClusterDecayer("LightClusterDecayer",
"A reference to the LightClusterDecayer object",
&Herwig::ClusterHadronizationHandler::_lightClusterDecayer,
false, false, true, false);
static Reference<ClusterHadronizationHandler,ClusterDecayer>
interfaceClusterDecayer("ClusterDecayer",
"A reference to the ClusterDecayer object",
&Herwig::ClusterHadronizationHandler::_clusterDecayer,
false, false, true, false);
static Parameter<ClusterHadronizationHandler,Energy2> interfaceMinVirtuality2
("MinVirtuality2",
"Minimum virtuality^2 of partons to use in calculating distances (unit [GeV2]).",
&ClusterHadronizationHandler::_minVirtuality2, GeV2, 0.1*GeV2, ZERO, 10.0*GeV2,false,false,false);
static Parameter<ClusterHadronizationHandler,Length> interfaceMaxDisplacement
("MaxDisplacement",
"Maximum displacement that is allowed for a particle (unit [millimeter]).",
&ClusterHadronizationHandler::_maxDisplacement, mm, 1.0e-10*mm,
0.0*mm, 1.0e-9*mm,false,false,false);
static Reference<ClusterHadronizationHandler,StepHandler> interfaceUnderlyingEventHandler
("UnderlyingEventHandler",
"Pointer to the handler for the Underlying Event. "
"Set to NULL to disable.",
&ClusterHadronizationHandler::_underlyingEventHandler, false, false, true, true, false);
}
void ClusterHadronizationHandler::doinitrun() {
HadronizationHandler::doinitrun();
// The run initialization is used here to all Cluster to have access to the
// ClusterHadronizationHandler class instance, via a static pointer.
Cluster::setPointerClusterHadHandler(this);
}
namespace {
void extractChildren(tPPtr p, set<PPtr> & all) {
if (p->children().empty()) return;
for (PVector::const_iterator child = p->children().begin();
child != p->children().end(); ++child) {
all.insert(*child);
extractChildren(*child, all);
}
}
}
void ClusterHadronizationHandler::
handle(EventHandler & ch, const tPVector & tagged,
const Hint &) {
useMe();
PVector currentlist(tagged.begin(),tagged.end());
// set the scale for coloured particles to just above the gluon mass squared
// if less than this so they are classed as perturbative
Energy2 Q02 = 1.01*sqr(getParticleData(ParticleID::g)->constituentMass());
for(unsigned int ix=0;ix<currentlist.size();++ix) {
if(currentlist[ix]->scale()<Q02) currentlist[ix]->scale(Q02);
}
// split the gluons
_partonSplitter->split(currentlist);
// form the clusters
ClusterVector clusters =
_clusterFinder->formClusters(currentlist);
_clusterFinder->reduceToTwoComponents(clusters);
// perform colour reconnection if needed and then
// decay the clusters into one hadron
bool lightOK = false;
short tried = 0;
const ClusterVector savedclusters = clusters;
tPVector finalHadrons; // only needed for partonic decayer
while (!lightOK && tried++ < 10) {
+ // no colour reconnection with baryon-number-violating (BV) clusters
+ ClusterVector CRclusters, BVclusters;
+ CRclusters.reserve( clusters.size() );
+ BVclusters.reserve( clusters.size() );
+ for (size_t ic = 0; ic < clusters.size(); ++ic) {
+ ClusterPtr cl = clusters.at(ic);
+ bool hasClusterParent = false;
+ for (unsigned int ix=0; ix < cl->parents().size(); ++ix) {
+ if (cl->parents()[ix]->id() == ParticleID::Cluster) {
+ hasClusterParent = true;
+ break;
+ }
+ }
+ if (cl->numComponents() > 2 || hasClusterParent) BVclusters.push_back(cl);
+ else CRclusters.push_back(cl);
+ }
+
// colour reconnection
- _colourReconnector->rearrange(ch,clusters);
+ _colourReconnector->rearrange(CRclusters);
// tag new clusters as children of the partons to hadronize
- _setChildren(clusters);
+ _setChildren(CRclusters);
+
+ // recombine vectors of (possibly) reconnected and BV clusters
+ clusters.clear();
+ clusters.insert( clusters.end(), CRclusters.begin(), CRclusters.end() );
+ clusters.insert( clusters.end(), BVclusters.begin(), BVclusters.end() );
// fission of heavy clusters
// NB: during cluster fission, light hadrons might be produced straight away
finalHadrons = _clusterFissioner->fission(clusters,isSoftUnderlyingEventON());
lightOK = _lightClusterDecayer->decay(clusters,finalHadrons);
// if the decay of the light clusters was not successful, undo the cluster
// fission and decay steps and revert to the original state of the event
// record
if (!lightOK) {
clusters = savedclusters;
for_each(clusters.begin(),
clusters.end(),
mem_fun(&Particle::undecay));
}
}
if (!lightOK)
throw Exception("CluHad::handle(): tried LightClusterDecayer 10 times!",
Exception::eventerror);
// decay the remaining clusters
_clusterDecayer->decay(clusters,finalHadrons);
// *****************************************
// *****************************************
// *****************************************
StepPtr pstep = newStep();
set<PPtr> allDecendants;
for (tPVector::const_iterator it = tagged.begin();
it != tagged.end(); ++it) {
extractChildren(*it, allDecendants);
}
for(set<PPtr>::const_iterator it = allDecendants.begin();
it != allDecendants.end(); ++it) {
// this is a workaround because the set sometimes
// re-orders parents after their children
if ((*it)->children().empty())
pstep->addDecayProduct(*it);
else {
pstep->addDecayProduct(*it);
pstep->addIntermediate(*it);
}
}
// *****************************************
// *****************************************
// *****************************************
// soft underlying event if needed
if (isSoftUnderlyingEventON()) {
assert(_underlyingEventHandler);
ch.performStep(_underlyingEventHandler,Hint::Default());
}
// zero all positions
// extract all particles from the event
tEventPtr event=ch.currentEvent();
vector<tPPtr> particles;
particles.reserve(256);
event->select(back_inserter(particles), ThePEG::AllSelector());
// and the final-state particles
set<tPPtr> finalstate;
event->selectFinalState(inserter(finalstate));
for(vector<tPPtr>::const_iterator pit=particles.begin();
pit!=particles.end();++pit) {
// if a final-state particle just zero production
if(finalstate.find(*pit)!=finalstate.end()) {
(**pit).setVertex(LorentzPoint());
}
// if not zero the lot
else {
(**pit).setVertex(LorentzPoint());
(**pit).setLifeLength(LorentzDistance());
}
}
}
void ClusterHadronizationHandler::_setChildren(ClusterVector clusters) const {
// erase existing information about the partons' children
tPVector partons;
for (ClusterVector::const_iterator cl = clusters.begin();
cl != clusters.end(); cl++) {
- if((**cl). numComponents()!=2) continue;
- bool hasClusterParent = false;
- for(unsigned int ix=0;ix<(**cl).parents().size();++ix) {
- if((**cl).parents()[ix]->id()==ExtraParticleID::Cluster) {
- hasClusterParent = true;
- break;
- }
- }
- if(hasClusterParent) continue;
partons.push_back( (*cl)->colParticle() );
partons.push_back( (*cl)->antiColParticle() );
}
for_each(partons.begin(), partons.end(), mem_fun(&Particle::undecay));
// give new parents to the clusters: their constituents
for (ClusterVector::iterator cl = clusters.begin();
cl != clusters.end(); cl++) {
- if((**cl).numComponents()!=2) continue;
- bool hasClusterParent = false;
- for(unsigned int ix=0;ix<(**cl).parents().size();++ix) {
- if((**cl).parents()[ix]->id()==ExtraParticleID::Cluster) {
- hasClusterParent = true;
- break;
- }
- }
- if(hasClusterParent) continue;
(*cl)->colParticle()->addChild(*cl);
(*cl)->antiColParticle()->addChild(*cl);
}
}
diff --git a/Hadronization/ColourReconnector.cc b/Hadronization/ColourReconnector.cc
--- a/Hadronization/ColourReconnector.cc
+++ b/Hadronization/ColourReconnector.cc
@@ -1,205 +1,385 @@
// -*- C++ -*-
//
// ColourReconnector.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the ColourReconnector class.
//
#include "ColourReconnector.h"
#include "Cluster.h"
+#include "Herwig++/Utilities/Maths.h"
-#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/Interface/Switch.h>
#include "ThePEG/Interface/Parameter.h"
#include <ThePEG/Persistency/PersistentOStream.h>
#include <ThePEG/Persistency/PersistentIStream.h>
#include <ThePEG/Repository/UseRandom.h>
#include <algorithm>
#include <ThePEG/Utilities/DescribeClass.h>
+
using namespace Herwig;
+typedef ClusterVector::const_iterator CluVecIt;
+
DescribeClass<ColourReconnector,Interfaced>
describeColourReconnector("Herwig::ColourReconnector","");
IBPtr ColourReconnector::clone() const {
return new_ptr(*this);
}
IBPtr ColourReconnector::fullclone() const {
return new_ptr(*this);
}
-void ColourReconnector::rearrange(EventHandler &,
- ClusterVector & clusters) {
+void ColourReconnector::rearrange(ClusterVector & clusters) {
if (_clreco == 0) return;
- ClusterVector newClusters = clusters;
+ // need at least two clusters
+ if (clusters.size() < 2) return;
+
+ // do the colour reconnection
+ switch (_algorithm) {
+ case 0: _doRecoPlain(clusters);
+ break;
+ case 1: _doRecoStatistical(clusters);
+ break;
+ }
+
+ return;
+}
+
+
+Energy2 ColourReconnector::_clusterMassSum(const PVector q,
+ const PVector aq) const {
+ const size_t nclusters = q.size();
+ assert (aq.size() == nclusters);
+ Energy2 sum = ZERO;
+ for (size_t i = 0; i < nclusters; i++)
+ sum += ( q.at(i)->momentum() + aq.at(i)->momentum() ).m2();
+ return sum;
+}
+
+
+bool ColourReconnector::_containsColour8(const ClusterVector cv,
+ const vector<size_t> P) const {
+ assert (P.size() == cv.size());
+ for (size_t i = 0; i < cv.size(); i++) {
+ tcPPtr p = cv.at(i)->colParticle();
+ tcPPtr q = cv.at(P[i])->antiColParticle();
+ if (isColour8(p, q)) return true;
+ }
+ return false;
+}
+
+
+void ColourReconnector::_doRecoStatistical(ClusterVector & cv) const {
+
+ const size_t nclusters = cv.size();
+
+ // initially, enumerate (anti)quarks as given in the cluster vector
+ ParticleVector q, aq;
+ for (size_t i = 0; i < nclusters; i++) {
+ q.push_back( cv.at(i)->colParticle() );
+ aq.push_back( cv.at(i)->antiColParticle() );
+ }
+
+ // annealing scheme
+ Energy2 t, delta;
+ Energy2 lambda = _clusterMassSum(q,aq);
+ const unsigned _ntries = _triesPerStepFactor * nclusters;
+
+ // find appropriate starting temperature by measuring the largest lambda
+ // difference in some dry-run random rearrangements
+ {
+ vector<Energy2> typical;
+ for (int i = 0; i < 10; i++) {
+ const pair <int,int> toswap = _shuffle(q,aq,5);
+ ParticleVector newaq = aq;
+ swap (newaq[toswap.first], newaq[toswap.second]);
+ Energy2 newlambda = _clusterMassSum(q,newaq);
+ typical.push_back( abs(newlambda - lambda) );
+ }
+ t = _initTemp * Math::median(typical);
+ }
+
+ // anneal in up to _annealingSteps temperature steps
+ for (unsigned step = 0; step < _annealingSteps; step++) {
+
+ // For this temperature step, try to reconnect _ntries times. Stop the
+ // algorithm if no successful reconnection happens.
+ unsigned nSuccess = 0;
+ for (unsigned it = 0; it < _ntries; it++) {
+
+ // make a random rearrangement
+ const unsigned maxtries = 10;
+ const pair <int,int> toswap = _shuffle(q,aq,maxtries);
+ const int i = toswap.first;
+ const int j = toswap.second;
+
+ // stop here if we cannot find any allowed reconfiguration
+ if (i == -1) break;
+
+ // create a new antiquark vector with the two partons swapped
+ ParticleVector newaq = aq;
+ swap (newaq[i], newaq[j]);
+
+ // Check if lambda would decrease. If yes, accept the reconnection. If no,
+ // accept it only with a probability given by the current Boltzmann
+ // factor. In the latter case we set p = 0 if the temperature is close to
+ // 0, to avoid division by 0.
+ Energy2 newlambda = _clusterMassSum(q,newaq);
+ delta = newlambda - lambda;
+ double prob = 1.0;
+ if (delta > ZERO) prob = ( abs(t) < 1e-8*MeV2 ) ? 0.0 : exp(-delta/t);
+ if (UseRandom::rnd() < prob) {
+ lambda = newlambda;
+ swap (newaq, aq);
+ nSuccess++;
+ }
+ }
+ if (nSuccess == 0) break;
+
+ // reduce temperature
+ t *= _annealingFactor;
+ }
+
+ // construct the new cluster vector
+ ClusterVector newclusters;
+ for (size_t i = 0; i < nclusters; i++) {
+ ClusterPtr cl = new_ptr( Cluster( q.at(i), aq.at(i) ) );
+ newclusters.push_back(cl);
+ }
+ swap(newclusters,cv);
+ return;
+}
+
+
+void ColourReconnector::_doRecoPlain(ClusterVector & cv) const {
+
+ ClusterVector newcv = cv;
// try to avoid systematic errors by randomising the reconnection order
long (*p_irnd)(long) = UseRandom::irnd;
- random_shuffle( newClusters.begin(), newClusters.end(), p_irnd );
+ random_shuffle( newcv.begin(), newcv.end(), p_irnd );
// iterate over all clusters
- for (ClusterVector::iterator currentCl=newClusters.begin();
- currentCl != newClusters.end(); currentCl++) {
+ for (CluVecIt cit = newcv.begin(); cit != newcv.end(); cit++) {
- // find cluster, where the new clusters are lighter
- ClusterPtr candidate = _findRecoPartner(*currentCl, newClusters);
+ // find the cluster which, if reconnected with *cit, would result in the
+ // smallest sum of cluster masses
+ // NB this method returns *cit if no reconnection partner can be found
+ ClusterPtr candidate = _findRecoPartner(*cit, newcv);
// skip this cluster if no possible reshuffling partner can be found
- if (candidate == *currentCl) continue;
+ if (candidate == *cit) continue;
// accept the reconnection with probability _preco.
if (UseRandom::rnd() < _preco) {
- pair <ClusterPtr,ClusterPtr> reconnected =
- _reconnect(*currentCl, candidate);
+ pair <ClusterPtr,ClusterPtr> reconnected = _reconnect(*cit, candidate);
- // Replace the clusters in the ClusterVector. The order of the partons in
- // the cluster vector carrying colour (i.e. not anticolour) is preserved.
+ // Replace the clusters in the ClusterVector. The order of the
+ // colour-triplet partons in the cluster vector is retained here.
- // replace *currentCl by reconnected.first
- replace( newClusters.begin(), newClusters.end(), *currentCl,
- reconnected.first );
+ // replace *cit by reconnected.first
+ replace( newcv.begin(), newcv.end(), *cit, reconnected.first );
// replace candidate by reconnected.second
- replace( newClusters.begin(), newClusters.end(), candidate,
- reconnected.second );
+ replace( newcv.begin(), newcv.end(), candidate, reconnected.second );
}
}
- // override pristine clusters with the new ones
- swap(clusters,newClusters);
+ swap(cv,newcv);
+ return;
}
ClusterPtr ColourReconnector::_findRecoPartner(ClusterPtr cl,
- ClusterVector cv) const {
+ ClusterVector cv) const {
+
ClusterPtr candidate = cl;
- // check not a BV cluster
- if(cl->numComponents()>2) return candidate;
- bool hasClusterParent = false;
- for(unsigned int ix=0;ix<candidate->parents().size();++ix) {
- if(candidate->parents()[ix]->id()==ExtraParticleID::Cluster) {
- hasClusterParent = true;
- break;
- }
- }
- if(hasClusterParent) return candidate;
- // loop over other clusters
Energy minMass = 1*TeV;
- for (ClusterVector::const_iterator cit=cv.begin(); cit != cv.end(); ++cit) {
- // check not a BV cluster
- if((**cit).numComponents()>2) continue;
- bool hasClusterParent = false;
- for(unsigned int ix=0;ix<(**cit).parents().size();++ix) {
- if((**cit).parents()[ix]->id()==ExtraParticleID::Cluster) {
- hasClusterParent = true;
- break;
- }
- }
- if(hasClusterParent) continue;
+ for (CluVecIt cit=cv.begin(); cit != cv.end(); ++cit) {
+
// don't allow colour octet clusters
- if ( _isColour8( cl->colParticle(),
- (*cit)->antiColParticle() ) ||
- _isColour8( (*cit)->colParticle(),
- cl->antiColParticle() ) ) {
+ if ( isColour8( cl->colParticle(),
+ (*cit)->antiColParticle() ) ||
+ isColour8( (*cit)->colParticle(),
+ cl->antiColParticle() ) ) {
continue;
}
// momenta of the old clusters
Lorentz5Momentum p1 = cl->colParticle()->momentum() +
cl->antiColParticle()->momentum();
Lorentz5Momentum p2 = (*cit)->colParticle()->momentum() +
(*cit)->antiColParticle()->momentum();
// momenta of the new clusters
Lorentz5Momentum p3 = cl->colParticle()->momentum() +
(*cit)->antiColParticle()->momentum();
Lorentz5Momentum p4 = (*cit)->colParticle()->momentum() +
cl->antiColParticle()->momentum();
Energy oldMass = abs( p1.m() ) + abs( p2.m() );
Energy newMass = abs( p3.m() ) + abs( p4.m() );
if ( newMass < oldMass && newMass < minMass ) {
minMass = newMass;
candidate = *cit;
}
}
return candidate;
}
-bool ColourReconnector::_isColour8(tPPtr p1, tPPtr p2) const {
+pair <ClusterPtr,ClusterPtr>
+ColourReconnector::_reconnect(ClusterPtr c1, ClusterPtr c2) const {
+
+ // choose the other possibility to form two clusters from the given
+ // constituents
+ ClusterPtr newCluster1
+ = new_ptr( Cluster( c1->colParticle(), c2->antiColParticle() ) );
+ ClusterPtr newCluster2
+ = new_ptr( Cluster( c2->colParticle(), c1->antiColParticle() ) );
+
+ return pair <ClusterPtr,ClusterPtr> (newCluster1, newCluster2);
+}
+
+
+pair <int,int> ColourReconnector::_shuffle
+ (const PVector q, const PVector aq, unsigned maxtries) const {
+
+ const size_t nclusters = q.size();
+ assert (nclusters > 1);
+ assert (aq.size() == nclusters);
+
+ int i, j;
+ unsigned tries = 0;
+ bool octet;
+
+ do {
+ // find two different random integers in the range [0, nclusters)
+ i = UseRandom::irnd( nclusters );
+ do { j = UseRandom::irnd( nclusters ); } while (i == j);
+
+ // check if one of the two potential clusters would be a colour octet state
+ octet = isColour8( q.at(i), aq.at(j) ) || isColour8( q.at(j), aq.at(i) ) ;
+ tries++;
+ } while (octet && tries < maxtries);
+
+ if (octet) i = j = -1;
+ return make_pair(i,j);
+}
+
+
+bool ColourReconnector::isColour8(cPPtr p, cPPtr q) {
bool octet = false;
+
// make sure we have a triplet and an anti-triplet
-
- if ( ( p1->hasColour() && p2->hasAntiColour() ) ||
- ( p1->hasAntiColour() && p2->hasColour() ) ) {
- if ( !p1->parents().empty()>0 && !p2->parents().empty() ) {
- // true if p1 and p2 are originated from the same gluon
- octet = ( p1->parents()[0] == p2->parents()[0] ) &&
- ( p1->parents()[0]->data().iColour() == PDT::Colour8 );
+ if ( ( p->hasColour() && q->hasAntiColour() ) ||
+ ( p->hasAntiColour() && q->hasColour() ) ) {
+ if ( !p->parents().empty() && !q->parents().empty() ) {
+ // true if p and q are originated from a colour octet
+ octet = ( p->parents()[0] == q->parents()[0] ) &&
+ ( p->parents()[0]->data().iColour() == PDT::Colour8 );
}
}
+
return octet;
}
-pair <ClusterPtr,ClusterPtr> ColourReconnector::_reconnect(ClusterPtr c1,
- ClusterPtr c2) const {
- // choose the other possibility to form two clusters, that have no netto
- // colour
- ClusterPtr newCluster1 = new_ptr( Cluster( c1->colParticle(),
- c2->antiColParticle() ) );
- ClusterPtr newCluster2 = new_ptr( Cluster( c2->colParticle(),
- c1->antiColParticle() ) );
- return pair <ClusterPtr,ClusterPtr> (newCluster1,newCluster2);
-}
-
-
void ColourReconnector::persistentOutput(PersistentOStream & os) const {
- os << _clreco << _preco;
+ os << _clreco << _preco << _algorithm << _initTemp << _annealingFactor
+ << _annealingSteps << _triesPerStepFactor;
}
void ColourReconnector::persistentInput(PersistentIStream & is, int) {
- is >> _clreco >> _preco;
+ is >> _clreco >> _preco >> _algorithm >> _initTemp >> _annealingFactor
+ >> _annealingSteps >> _triesPerStepFactor;
}
void ColourReconnector::Init() {
static ClassDocumentation<ColourReconnector> documentation
("This class is responsible of the colour reconnection.");
static Switch<ColourReconnector,int> interfaceColourReconnection
("ColourReconnection",
"Colour reconnections",
&ColourReconnector::_clreco, 0, true, false);
static SwitchOption interfaceColourReconnectionOff
(interfaceColourReconnection,
"No",
"Colour reconnections off",
0);
static SwitchOption interfaceColourReconnectionOn
(interfaceColourReconnection,
"Yes",
"Colour reconnections on",
1);
+
+ static Parameter<ColourReconnector,double> interfaceMtrpAnnealingFactor
+ ("AnnealingFactor",
+ "The annealing factor is the ratio of the temperatures in two successive "
+ "temperature steps.",
+ &ColourReconnector::_annealingFactor, 0.9, 0.0, 1.0,
+ false, false, Interface::limited);
+
+ static Parameter<ColourReconnector,unsigned> interfaceMtrpAnnealingSteps
+ ("AnnealingSteps",
+ "Number of temperature steps in the statistical annealing algorithm",
+ &ColourReconnector::_annealingSteps, 50, 1, 10000,
+ false, false, Interface::limited);
+
+ static Parameter<ColourReconnector,double> interfaceMtrpTriesPerStepFactor
+ ("TriesPerStepFactor",
+ "The number of reconnection tries per temperature steps is the number of "
+ "clusters times this factor.",
+ &ColourReconnector::_triesPerStepFactor, 5.0, 0.0, 100.0,
+ false, false, Interface::limited);
+
+
+ static Parameter<ColourReconnector,double> interfaceMtrpInitialTemp
+ ("InitialTemperature",
+ "Factor used to determine the initial temperature from the median of the "
+ "energy change in a few random rearrangements.",
+ &ColourReconnector::_initTemp, 0.1, 0.00001, 100.0,
+ false, false, Interface::limited);
+
+
static Parameter<ColourReconnector,double> interfaceRecoProb
("ReconnectionProbability",
"Probability that a found reconnection possibility is actually accepted",
&ColourReconnector::_preco, 0.5, 0.0, 1.0,
false, false, Interface::limited);
+
+ static Switch<ColourReconnector,int> interfaceAlgorithm
+ ("Algorithm",
+ "Specifies the colour reconnection algorithm",
+ &ColourReconnector::_algorithm, 0, true, false);
+ static SwitchOption interfaceAlgorithmPlain
+ (interfaceAlgorithm,
+ "Plain",
+ "Plain colour reconnection as in Herwig++ 2.5.0",
+ 0);
+ static SwitchOption interfaceAlgorithmStatistical
+ (interfaceAlgorithm,
+ "Statistical",
+ "Statistical colour reconnection using simulated annealing",
+ 1);
+
}
diff --git a/Hadronization/ColourReconnector.h b/Hadronization/ColourReconnector.h
--- a/Hadronization/ColourReconnector.h
+++ b/Hadronization/ColourReconnector.h
@@ -1,143 +1,234 @@
// -*- C++ -*-
//
// ColourReconnector.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_ColourReconnector_H
#define HERWIG_ColourReconnector_H
#include <ThePEG/Interface/Interfaced.h>
#include "CluHadConfig.h"
#include "ColourReconnector.fh"
+namespace Herwig {
-namespace Herwig {
using namespace ThePEG;
/** \ingroup Hadronization
* \class ColourReconnector
* \brief Class for changing colour reconnections of partons.
* \author Alberto Ribon, Christian Roehr
*
* This class does the nonperturbative colour rearrangement, after the
* nonperturbative gluon splitting and the "normal" cluster formation.
* It uses the list of particles in the event record, and the collections of
* "usual" clusters which is passed to the main method. If the colour
* reconnection is actually accepted, then the previous collections of "usual"
* clusters is first deleted and then the new one is created.
*
* * @see \ref ColourReconnectorInterfaces "The interfaces"
* defined for ColourReconnector.
*/
class ColourReconnector: public Interfaced {
public:
/** @name Standard constructors and destructors. */
//@{
/**
* Default constructor.
*/
- ColourReconnector() : _clreco( 0 ), _preco( 0.5 )
+ ColourReconnector() :
+ _algorithm(0),
+ _annealingFactor(0.9),
+ _annealingSteps(50),
+ _clreco(0),
+ _initTemp(0.1),
+ _preco(0.5),
+ _triesPerStepFactor(5.0)
{}
//@}
/**
* Does the colour rearrangement, starting out from the list of particles in
* the event record and the collection of "usual" clusters passed as
* arguments. If the actual rearrangement is accepted, the initial collection of
* clusters is overridden by the old ones.
*/
- void rearrange(EventHandler & ch,
- ClusterVector & clusters);
-
+ void rearrange(ClusterVector & clusters);
+
+
+private:
+
+ /** PRIVATE MEMBER FUNCTIONS */
+
+ /**
+ * @brief Calculates the sum of the squared cluster masses.
+ * @arguments q, aq vectors containing the quarks and antiquarks respectively
+ * @return Sum of cluster squared masses M^2_{q[i],aq[i]}.
+ */
+ Energy2 _clusterMassSum(const PVector q, const PVector aq) const;
+
+
+ /**
+ * @brief Examines whether the cluster vector (under the given permutation of
+ * the antiquarks) contains colour-octet clusters
+ * @param cv Cluster vector
+ * @param P Permutation, a vector of permutated indices from 0 to
+ * cv.size()-1
+ */
+ bool _containsColour8(const ClusterVector cv, const vector<size_t> P) const;
+
+ /**
+ * @brief A Metropolis-type algorithm which finds a local minimum in the
+ * total sum of cluster masses
+ * @arguments cv cluster vector
+ */
+ void _doRecoStatistical(ClusterVector & cv) const;
+
+ /**
+ * @brief Plain colour reconnection as used in Herwig++ 2.5.0
+ * @arguments cv cluster vector
+ */
+ void _doRecoPlain(ClusterVector & cv) const;
+
+ /**
+ * @brief Finds the cluster in cv which, if reconnected with the given
+ * cluster cl, would result in the smallest sum of cluster masses.
+ * If no reconnection partner can be found, a pointer to the
+ * original Cluster cl is returned.
+ * @arguments cv cluster vector
+ * cl cluster which wants to have a reconnection partner
+ * @return pointer to the found cluster, or the original cluster pointer if
+ * no mass-reducing combination can be found
+ */
+ ClusterPtr _findRecoPartner(ClusterPtr cl, ClusterVector cv) const;
+
+ /**
+ * @brief Reconnects the constituents of the given clusters to the (only)
+ * other possible cluster combination.
+ * @return pair of pointers to the two new clusters
+ */
+ pair <ClusterPtr,ClusterPtr> _reconnect(ClusterPtr c1, ClusterPtr c2) const;
+
+ /**
+ * @brief At random, swap two antiquarks, if not excluded by the
+ * constraint that there must not be any colour-octet clusters.
+ * @arguments q, aq vectors containing the quarks and antiquarks respectively
+ * maxtries maximal number of tries to find a non-colour-octet
+ * reconfiguration
+ * @return Pair of ints indicating the indices of the antiquarks to be
+ * swapped. Returns (-1,-1) if no valid reconfiguration could be
+ * found after maxtries trials
+ */
+ pair <int,int>
+ _shuffle(const PVector q, const PVector aq, unsigned maxtries = 10) const;
+
+
+ /** DATA MEMBERS */
+
+ /**
+ * Specifies the colour reconnection algorithm to be used.
+ */
+ int _algorithm;
+
+ /**
+ * The annealing factor is the ratio of two successive temperature steps:
+ * T_n = _annealingFactor * T_(n-1)
+ */
+ double _annealingFactor;
+
+ /**
+ * Number of temperature steps in the statistical annealing algorithm
+ */
+ unsigned _annealingSteps;
+
+ /**
+ * Do we do colour reconnections?
+ */
+ int _clreco;
+
+ /**
+ * Factor used to determine the initial temperature according to
+ * InitialTemperature = _initTemp * median {energy changes in a few random
+ * rearrangements}
+ */
+ double _initTemp;
+
+ /**
+ * Probability that a found reconnection possibility is actually accepted.
+ */
+ double _preco;
+
+ /**
+ * The number of tries per temperature steps is the number of clusters times
+ * this factor.
+ */
+ double _triesPerStepFactor;
+
+ /**
+ * @return true, if the two partons are splitting products of the same
+ * gluon
+ */
+ static bool isColour8(cPPtr p, cPPtr q);
+
+
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);
//@}
/**
* Standard Init function used to initialize the interfaces.
*/
static void Init();
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;
//@}
+
private:
/**
* Private and non-existent assignment operator.
*/
ColourReconnector & operator=(const ColourReconnector &);
- /**
- * Do we do colour reconnections?
- */
- int _clreco;
-
- /**
- * Probability that a found reconnection possibility is actually accepted.
- */
- double _preco;
-
-
-private:
-
- /**
- * Returns the Cluster (within the ClusterVector cv) where the sum of the
- * invariant Cluster masses becomes minimal in the case of a colour
- * reconnection with cl. If no reconnection partner can be found, a pointer to
- * the original Cluster cl is returned.
- */
- ClusterPtr _findRecoPartner(ClusterPtr cl, ClusterVector cv) const;
-
- /**
- * @return true, if the two partons are splitting products of the same
- * gluon
- */
- bool _isColour8(tPPtr p1, tPPtr p2) const;
-
- /**
- * Reconnects the constituents of the given clusters to the (only) other
- * possible cluster combination.
- */
- pair <ClusterPtr,ClusterPtr> _reconnect(ClusterPtr c1, ClusterPtr c2) const;
};
}
#endif /* HERWIG_ColourReconnector_H */
diff --git a/Hadronization/HadronSelector.cc b/Hadronization/HadronSelector.cc
--- a/Hadronization/HadronSelector.cc
+++ b/Hadronization/HadronSelector.cc
@@ -1,822 +1,824 @@
// -*- C++ -*-
//
// HadronSelector.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the HadronSelector class.
//
#include "HadronSelector.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include <ThePEG/PDT/EnumParticles.h>
#include <ThePEG/Repository/EventGenerator.h>
#include <ThePEG/Repository/CurrentGenerator.h>
#include <ThePEG/Repository/Repository.h>
#include "CheckId.h"
#include <ThePEG/Utilities/DescribeClass.h>
using namespace Herwig;
DescribeAbstractClass<HadronSelector,Interfaced>
describeHadronSelector("Herwig::HadronSelector","");
namespace {
int abs(PDT::Colour c) {
return c > 0 ? c : -c;
}
// debug helper
void dumpTable(const HadronSelector::HadronTable & tbl) {
typedef HadronSelector::HadronTable::const_iterator TableIter;
for (TableIter it = tbl.begin(); it != tbl.end(); ++it) {
cerr << it->first.first << ' '
<< it->first.second << '\n';
for (HadronSelector::KupcoData::const_iterator jt = it->second.begin();
jt != it->second.end(); ++jt) {
cerr << '\t' << *jt << '\n';
}
}
}
bool weightIsLess (pair<tcPDPtr,double> a, pair<tcPDPtr,double> b) {
return a.second < b.second;
}
}
ostream & Herwig::operator<< (ostream & os,
const HadronSelector::HadronInfo & hi ) {
os << std::scientific << std::showpoint
<< std::setprecision(4)
<< setw(2)
<< hi.id << '\t'
// << hi.ptrData << ' '
<< hi.swtef << '\t'
<< hi.wt << '\t'
<< hi.overallWeight << '\t'
<< ounit(hi.mass,GeV);
return os;
}
HadronSelector::HadronSelector(unsigned int opt)
: _pwtDquark( 1.0 ),_pwtUquark( 1.0 ),_pwtSquark( 1.0 ),_pwtCquark( 1.0 ),
_pwtBquark( 1.0 ),_pwtDIquark( 1.0 ),
_weight1S0(Nmax,1.),_weight3S1(Nmax,1.),_weight1P1(Nmax,1.),_weight3P0(Nmax,1.),
_weight3P1(Nmax,1.),_weight3P2(Nmax,1.),_weight1D2(Nmax,1.),_weight3D1(Nmax,1.),
_weight3D2(Nmax,1.),_weight3D3(Nmax,1.),
_repwt(Lmax,vector<vector<double> >(Jmax,vector<double>(Nmax))),
_sngWt( 1.0 ),_decWt( 1.0 ),
_topt(opt),_trial(0)
{
// The mixing angles
// the ideal mixing angle
const double idealAngleMix = atan( sqrt(0.5) ) * 180.0 / Constants::pi;
// \eta-\eta' mixing angle
_etamix = -23.0;
// phi-omega mixing angle
_phimix = +36.0;
// h_1'-h_1 mixing angle
_h1mix = idealAngleMix;
// f_0(1710)-f_0(1370) mixing angle
_f0mix = idealAngleMix;
// f_1(1420)-f_1(1285)\f$ mixing angle
_f1mix = idealAngleMix;
// f'_2-f_2\f$ mixing angle
_f2mix = +26.0;
// eta_2(1870)-eta_2(1645) mixing angle
_eta2mix = idealAngleMix;
// phi(???)-omega(1650) mixing angle
_omhmix = idealAngleMix;
// phi_3-omega_3 mixing angle
_ph3mix = +28.0;
// eta(1475)-eta(1295) mixing angle
_eta2Smix = idealAngleMix;
// phi(1680)-omega(1420) mixing angle
_phi2Smix = idealAngleMix;
}
void HadronSelector::persistentOutput(PersistentOStream & os) const {
os << _partons << _pwtDquark << _pwtUquark << _pwtSquark
<< _pwtCquark << _pwtBquark << _pwtDIquark
<< _etamix << _phimix << _h1mix << _f0mix << _f1mix << _f2mix
<< _eta2mix << _omhmix << _ph3mix << _eta2Smix << _phi2Smix
<< _weight1S0 << _weight3S1 << _weight1P1 << _weight3P0 << _weight3P1
<< _weight3P2 << _weight1D2 << _weight3D1 << _weight3D2 << _weight3D3
<< _forbidden << _sngWt << _decWt << _repwt << _pwt
<< _table;
}
void HadronSelector::persistentInput(PersistentIStream & is, int) {
is >> _partons >> _pwtDquark >> _pwtUquark >> _pwtSquark
>> _pwtCquark >> _pwtBquark
>> _pwtDIquark>> _etamix >> _phimix >> _h1mix >> _f0mix >> _f1mix >> _f2mix
>> _eta2mix >> _omhmix >> _ph3mix >> _eta2Smix >> _phi2Smix
>> _weight1S0 >> _weight3S1 >> _weight1P1 >> _weight3P0 >> _weight3P1
>> _weight3P2 >> _weight1D2 >> _weight3D1 >> _weight3D2 >> _weight3D3
>> _forbidden >> _sngWt >> _decWt >> _repwt >> _pwt
>> _table;
}
void HadronSelector::Init() {
static ClassDocumentation<HadronSelector> documentation
("There is no documentation for the HadronSelector class");
static Parameter<HadronSelector,double>
interfacePwtDquark("PwtDquark","Weight for choosing a quark D",
&HadronSelector::_pwtDquark, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfacePwtUquark("PwtUquark","Weight for choosing a quark U",
&HadronSelector::_pwtUquark, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfacePwtSquark("PwtSquark","Weight for choosing a quark S",
&HadronSelector::_pwtSquark, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfacePwtCquark("PwtCquark","Weight for choosing a quark C",
&HadronSelector::_pwtCquark, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfacePwtBquark("PwtBquark","Weight for choosing a quark B",
&HadronSelector::_pwtBquark, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfacePwtDIquark("PwtDIquark","Weight for choosing a DIquark",
&HadronSelector::_pwtDIquark, 0, 1.0, 0.0, 100.0,
false,false,false);
static Parameter<HadronSelector,double>
interfaceSngWt("SngWt","Weight for singlet baryons",
&HadronSelector::_sngWt, 0, 1.0, 0.0, 10.0,
false,false,false);
static Parameter<HadronSelector,double>
interfaceDecWt("DecWt","Weight for decuplet baryons",
&HadronSelector::_decWt, 0, 1.0, 0.0, 10.0,
false,false,false);
static RefVector<HadronSelector,ParticleData> interfacePartons
("Partons",
"The partons which are to be considered as the consistuents of the hadrons.",
&HadronSelector::_partons, -1, false, false, true, false, false);
static RefVector<HadronSelector,ParticleData> interfaceForbidden
("Forbidden",
"The PDG codes of the particles which cannot be produced in the hadronization.",
&HadronSelector::_forbidden, -1, false, false, true, false, false);
//
// mixing angles
//
// the ideal mixing angle
const double idealAngleMix = atan( sqrt(0.5) ) * 180.0 / Constants::pi;
static Parameter<HadronSelector,double> interface11S0Mixing
("11S0Mixing",
"The mixing angle for the I=0 mesons from the 1 1S0 multiplet,"
" i.e. eta and etaprime.",
&HadronSelector::_etamix, -23., -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13S1Mixing
("13S1Mixing",
"The mixing angle for the I=0 mesons from the 1 3S1 multiplet,"
" i.e. phi and omega.",
&HadronSelector::_phimix, +36., -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface11P1Mixing
("11P1Mixing",
"The mixing angle for the I=0 mesons from the 1 1P1 multiplet,"
" i.e. h_1' and h_1.",
&HadronSelector::_h1mix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13P0Mixing
("13P0Mixing",
"The mixing angle for the I=0 mesons from the 1 3P0 multiplet,"
" i.e. f_0(1710) and f_0(1370).",
&HadronSelector::_f0mix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13P1Mixing
("13P1Mixing",
"The mixing angle for the I=0 mesons from the 1 3P1 multiplet,"
" i.e. f_1(1420) and f_1(1285).",
&HadronSelector::_f1mix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13P2Mixing
("13P2Mixing",
"The mixing angle for the I=0 mesons from the 1 3P2 multiplet,"
" i.e. f'_2 and f_2.",
&HadronSelector::_f2mix, 26.0, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface11D2Mixing
("11D2Mixing",
"The mixing angle for the I=0 mesons from the 1 1D2 multiplet,"
" i.e. eta_2(1870) and eta_2(1645).",
&HadronSelector::_eta2mix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13D0Mixing
("13D0Mixing",
"The mixing angle for the I=0 mesons from the 1 3D0 multiplet,"
" i.e. eta_2(1870) phi(?) and omega(1650).",
&HadronSelector::_omhmix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface13D1Mixing
("13D1Mixing",
"The mixing angle for the I=0 mesons from the 1 3D1 multiplet,"
" i.e. phi_3 and omega_3.",
&HadronSelector::_ph3mix, 28.0, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface21S0Mixing
("21S0Mixing",
"The mixing angle for the I=0 mesons from the 2 1S0 multiplet,"
" i.e. eta(1475) and eta(1295).",
&HadronSelector::_eta2Smix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
static Parameter<HadronSelector,double> interface23S1Mixing
("23S1Mixing",
"The mixing angle for the I=0 mesons from the 1 3S1 multiplet,"
" i.e. phi(1680) and omega(1420).",
&HadronSelector::_phi2Smix, idealAngleMix, -180., 180.,
false, false, Interface::limited);
//
// the meson weights
//
static ParVector<HadronSelector,double> interface1S0Weights
("1S0Weights",
"The weights for the 1S0 multiplets start with n=1.",
&HadronSelector::_weight1S0, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3S1Weights
("3S1Weights",
"The weights for the 3S1 multiplets start with n=1.",
&HadronSelector::_weight3S1, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface1P1Weights
("1P1Weights",
"The weights for the 1P1 multiplets start with n=1.",
&HadronSelector::_weight1P1, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3P0Weights
("3P0Weights",
"The weights for the 3P0 multiplets start with n=1.",
&HadronSelector::_weight3P0, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3P1Weights
("3P1Weights",
"The weights for the 3P1 multiplets start with n=1.",
&HadronSelector::_weight3P1, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3P2Weights
("3P2Weights",
"The weights for the 3P2 multiplets start with n=1.",
&HadronSelector::_weight3P2, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface1D2Weights
("1D2Weights",
"The weights for the 1D2 multiplets start with n=1.",
&HadronSelector::_weight1D2, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3D1Weights
("3D1Weights",
"The weights for the 3D1 multiplets start with n=1.",
&HadronSelector::_weight3D1, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3D2Weights
("3D2Weights",
"The weights for the 3D2 multiplets start with n=1.",
&HadronSelector::_weight3D2, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static ParVector<HadronSelector,double> interface3D3Weights
("3D3Weights",
"The weights for the 3D3 multiplets start with n=1.",
&HadronSelector::_weight3D3, Nmax, 1.0, 0.0, 100.0,
false, false, Interface::limited);
static Switch<HadronSelector,unsigned int> interfaceTrial
("Trial",
"A Debugging option to only produce certain types of hadrons",
&HadronSelector::_trial, 0, false, false);
static SwitchOption interfaceTrialAll
(interfaceTrial,
"All",
"Produce all the hadrons",
0);
static SwitchOption interfaceTrialPions
(interfaceTrial,
"Pions",
"Only produce pions",
1);
static SwitchOption interfaceTrialSpin2
(interfaceTrial,
"Spin2",
"Only mesons with spin less than or equal to two are produced",
2);
static SwitchOption interfaceTrialSpin3
(interfaceTrial,
"Spin3",
"Only hadrons with spin less tan or equal to three are produced",
3);
}
double HadronSelector::mixingStateWeight(long id) {
switch(id) {
case ParticleID::eta: return 0.5*probabilityMixing(_etamix ,1);
case ParticleID::etaprime: return 0.5*probabilityMixing(_etamix ,2);
case ParticleID::phi: return 0.5*probabilityMixing(_phimix ,1);
case ParticleID::omega: return 0.5*probabilityMixing(_phimix ,2);
case ParticleID::hprime_1: return 0.5*probabilityMixing(_h1mix ,1);
case ParticleID::h_1: return 0.5*probabilityMixing(_h1mix ,2);
case 10331: return 0.5*probabilityMixing(_f0mix ,1);
case 10221: return 0.5*probabilityMixing(_f0mix ,2);
case ParticleID::fprime_1: return 0.5*probabilityMixing(_f1mix ,1);
case ParticleID::f_1: return 0.5*probabilityMixing(_f1mix ,2);
case ParticleID::fprime_2: return 0.5*probabilityMixing(_f2mix ,1);
case ParticleID::f_2: return 0.5*probabilityMixing(_f2mix ,2);
case 10335: return 0.5*probabilityMixing(_eta2mix ,1);
case 10225: return 0.5*probabilityMixing(_eta2mix ,2);
// missing phi member of 13D1 should be here
case 30223: return 0.5*probabilityMixing(_omhmix ,2);
case 337: return 0.5*probabilityMixing(_ph3mix ,1);
case 227: return 0.5*probabilityMixing(_ph3mix ,2);
case 100331: return 0.5*probabilityMixing(_eta2mix ,1);
case 100221: return 0.5*probabilityMixing(_eta2mix ,2);
case 100333: return 0.5*probabilityMixing(_phi2Smix,1);
case 100223: return 0.5*probabilityMixing(_phi2Smix,2);
default: return 1./3.;
}
}
void HadronSelector::doinit() {
Interfaced::doinit();
// the default partons allowed
// the quarks
for ( int ix=1; ix<=5; ++ix ) {
_partons.push_back(getParticleData(ix));
}
// the diquarks
for(unsigned int ix=1;ix<=5;++ix) {
for(unsigned int iy=1; iy<=ix;++iy) {
_partons.push_back(getParticleData(CheckId::makeDiquarkID(ix,iy)));
}
}
// set the weights for the various excited mesons
// set all to one to start with
for (int l = 0; l < Lmax; ++l ) {
for (int j = 0; j < Jmax; ++j) {
for (int n = 0; n < Nmax; ++n) {
_repwt[l][j][n] = 1.0;
}
}
}
// set the others from the relevant vectors
for( int ix=0;ix<max(int(_weight1S0.size()),int(Nmax));++ix)
_repwt[0][0][ix]=_weight1S0[ix];
for( int ix=0;ix<max(int(_weight3S1.size()),int(Nmax));++ix)
_repwt[0][1][ix]=_weight3S1[ix];
for( int ix=0;ix<max(int(_weight1P1.size()),int(Nmax));++ix)
_repwt[1][1][ix]=_weight1P1[ix];
for( int ix=0;ix<max(int(_weight3P0.size()),int(Nmax));++ix)
_repwt[1][0][ix]=_weight3P0[ix];
for( int ix=0;ix<max(int(_weight3P1.size()),int(Nmax));++ix)
_repwt[1][1][ix]=_weight3P1[ix];
for( int ix=0;ix<max(int(_weight3P2.size()),int(Nmax));++ix)
_repwt[1][2][ix]=_weight3P2[ix];
for( int ix=0;ix<max(int(_weight1D2.size()),int(Nmax));++ix)
_repwt[2][2][ix]=_weight1D2[ix];
for( int ix=0;ix<max(int(_weight3D1.size()),int(Nmax));++ix)
_repwt[2][1][ix]=_weight3D1[ix];
for( int ix=0;ix<max(int(_weight3D2.size()),int(Nmax));++ix)
_repwt[2][2][ix]=_weight3D2[ix];
for( int ix=0;ix<max(int(_weight3D3.size()),int(Nmax));++ix)
_repwt[2][3][ix]=_weight3D3[ix];
// weights for the different quarks etc
for(unsigned int ix=0; ix<_partons.size(); ++ix) {
_pwt[_partons[ix]]=1.;
}
_pwt[getParticleData(1)] = _pwtDquark;
_pwt[getParticleData(2)] = _pwtUquark;
_pwt[getParticleData(3)] = _pwtSquark;
_pwt[getParticleData(4)] = _pwtCquark;
_pwt[getParticleData(5)] = _pwtBquark;
_pwt[getParticleData(1103)] = _pwtDIquark * _pwtDquark * _pwtDquark;
_pwt[getParticleData(2101)] = 0.5 * _pwtDIquark * _pwtUquark * _pwtDquark;
_pwt[getParticleData(2203)] = _pwtDIquark * _pwtUquark * _pwtUquark;
_pwt[getParticleData(3101)] = 0.5 * _pwtDIquark * _pwtSquark * _pwtDquark;
_pwt[getParticleData(3201)] = 0.5 * _pwtDIquark * _pwtSquark * _pwtUquark;
_pwt[getParticleData(3303)] = _pwtDIquark * _pwtSquark * _pwtSquark;
// Commenting out heavy di-quark weights
_pwt[getParticleData(4101)] = 0.0;
_pwt[getParticleData(4201)] = 0.0;
_pwt[getParticleData(4301)] = 0.0;
_pwt[getParticleData(4403)] = 0.0;
_pwt[getParticleData(5101)] = 0.0;
_pwt[getParticleData(5201)] = 0.0;
_pwt[getParticleData(5301)] = 0.0;
_pwt[getParticleData(5401)] = 0.0;
_pwt[getParticleData(5503)] = 0.0;
// find the maximum
map<tcPDPtr,double>::iterator pit =
max_element(_pwt.begin(),_pwt.end(),weightIsLess);
double pmax = pit->second;
for(pit=_pwt.begin(); pit!=_pwt.end(); ++pit) {
pit->second/=pmax;
}
// construct the hadron tables
constructHadronTable();
// for debugging
// dumpTable(table());
}
void HadronSelector::constructHadronTable() {
// initialise the table
_table.clear();
for(unsigned int ix=0; ix<_partons.size(); ++ix) {
for(unsigned int iy=0; iy<_partons.size(); ++iy) {
if (!(DiquarkMatcher::Check(_partons[ix]->id())
&& DiquarkMatcher::Check(_partons[iy]->id())))
_table[make_pair(_partons[ix]->id(),_partons[iy]->id())] = KupcoData();
}
}
// get the particles from the event generator
ParticleMap particles = generator()->particles();
// loop over the particles
double maxdd(0.),maxss(0.),maxrest(0.);
for(ParticleMap::iterator it=particles.begin();
it!=particles.end(); ++it) {
long pid = it->first;
tPDPtr particle = it->second;
int pspin = particle->iSpin();
// Don't include hadrons which are explicitly forbidden
if(find(_forbidden.begin(),_forbidden.end(),particle)!=_forbidden.end())
continue;
// Don't include non-hadrons or antiparticles
if(pid < 100) continue;
// remove diffractive particles
if(pspin == 0) continue;
// K_0S and K_0L not made make K0 and Kbar0
if(pid==ParticleID::K_S0||pid==ParticleID::K_L0) continue;
// Debugging options
// Only include those with 2J+1 less than...5
if(_trial==2 && pspin >= 5) continue;
// Only include those with 2J+1 less than...7
if(_trial==3 && pspin >= 7) continue;
// Only include pions
if(_trial==1 && pid!=111 && pid!=211) continue;
+ // shouldn't be coloured
+ if(particle->coloured()) continue;
// Get the flavours
const int x4 = (pid/1000)%10;
const int x3 = (pid/100 )%10;
const int x2 = (pid/10 )%10;
const int x7 = (pid/1000000)%10;
const bool wantSusy = x7 == 1 || x7 == 2;
int flav1;
int flav2;
// Skip non-hadrons (susy particles, etc...)
if(x3 == 0 || x2 == 0) continue;
else if(x4 == 0) { // meson
flav1 = x2;
flav2 = x3;
}
else { // baryon
flav1 = CheckId::makeDiquarkID(x2,x3);
flav2 = x4;
}
if (wantSusy) flav2 += 1000000 * x7;
HadronInfo a(pid,
particle,
specialWeight(pid),
particle->mass());
// set the weight to the number of spin states
a.overallWeight = pspin;
// identical light flavours
if(flav1 == flav2 && flav1<=3) {
// ddbar> uubar> admixture states
if(flav1==1) {
if(_topt != 0) a.overallWeight *= 0.5*a.swtef;
_table[make_pair(1,1)].insert(a);
_table[make_pair(2,2)].insert(a);
if(_topt == 0 && a.overallWeight > maxdd) maxdd = a.overallWeight;
}
// load up ssbar> uubar> ddbar> admixture states
else {
a.wt = mixingStateWeight(pid);
a.overallWeight *= a.wt;
if(_topt != 0) a.overallWeight *= a.swtef;
_table[make_pair(1,1)].insert(a);
_table[make_pair(2,2)].insert(a);
if(_topt == 0 && a.overallWeight > maxdd) maxdd = a.overallWeight;
a.wt = (_topt != 0) ? 1.- 2.*a.wt : 1 - a.wt;
if(a.wt > 0) {
a.overallWeight = a.wt * a.swtef * pspin;
_table[make_pair(3,3)].insert(a);
if(_topt == 0 && a.overallWeight > maxss) maxss = a.overallWeight;
}
}
}
// light baryons with all quarks identical
else if((flav1 == 1 && flav2 == 1103) || (flav1 == 1103 && flav2 == 1) ||
(flav1 == 2 && flav2 == 2203) || (flav1 == 2203 && flav2 == 2) ||
(flav1 == 3 && flav2 == 3303) || (flav1 == 3303 && flav2 == 3)) {
if(_topt != 0) a.overallWeight *= 1.5*a.swtef;
_table[make_pair(flav1,flav2)].insert(a);
_table[make_pair(flav2,flav1)].insert(a);
if(_topt == 0 && a.overallWeight > maxrest) maxrest = a.overallWeight;
}
// all other cases
else {
if(_topt != 0) a.overallWeight *=a.swtef;
_table[make_pair(flav1,flav2)].insert(a);
if(flav1 != flav2) _table[make_pair(flav2,flav1)].insert(a);
if(_topt == 0 && a.overallWeight > maxrest) maxrest = a.overallWeight;
}
}
// Account for identical combos of diquark/quarks and symmetrical elements
// e.g. U UD = D UU
HadronTable::iterator tit;
for(tit=_table.begin();tit!=_table.end();++tit) {
if(tit->first.first>ParticleID::c) continue;
if(!DiquarkMatcher::Check(tit->first.second)) continue;
long k, l, sub;
if(tit->first.second>=ParticleID::bd_0) {
k = ParticleID::b;
sub = ParticleID::bd_0/100;
}
else if(tit->first.second>=ParticleID::cd_0) {
k = ParticleID::c;
sub = ParticleID::cd_0/100;
}
else if(tit->first.second>=ParticleID::sd_0) {
k = ParticleID::s;
sub = ParticleID::sd_0/100;
}
else if(tit->first.second>=ParticleID::ud_0) {
k = ParticleID::u;
sub = ParticleID::ud_0/100;
}
else if(tit->first.second==ParticleID::dd_1) {
k = ParticleID::d;
sub = ParticleID::dd_1/100;
}
else continue;
sub=tit->first.second/100-sub+1;
if(sub > tit->first.first) {
l = 1000*sub+100*tit->first.first+1;
}
else if(sub==tit->first.first) {
l = 1000*sub+ 100*tit->first.first+3;
}
else {
l = 100*sub +1000*tit->first.first+1;
}
if(tit->second.empty()) {
pair<long,long> newpair(k,l);
tit->second=_table[newpair];
newpair=make_pair(tit->first.second,tit->first.first);
_table[newpair]=tit->second;
};
}
// normalise weights to one for first option
if(_topt == 0) {
HadronTable::const_iterator tit;
KupcoData::iterator it;
for(tit=_table.begin();tit!=_table.end();++tit) {
double weight;
if(tit->first.first==tit->first.second) {
if(tit->first.first==1||tit->first.first==2) weight=1./maxdd;
else if (tit->first.first==3) weight=1./maxss;
else weight=1./maxrest;
}
else weight=1./maxrest;
for(it = tit->second.begin(); it!=tit->second.end(); ++it) {
it->rescale(weight);
}
}
}
}
double HadronSelector::specialWeight(long id) {
int pspin = id % 10;
// Only K0L and K0S have pspin == 0
if(pspin == 0) pspin = 1;
// Baryon : J = 1/2 or 3/2
else if(pspin == 2 || pspin == 4) {
if(pspin == 2) {
// Singlet (Lambda-like) baryon
if( (id/100)%10 < (id/10 )%10 ) return sqr(_sngWt);
// octet
else return 1.;
}
// Decuplet baryon
else return sqr(_decWt);
}
// Meson
else if(pspin % 2 == 1) {
// Total angular momentum
int j = (pspin - 1) / 2;
// related to Orbital angular momentum l
int nl = (id/10000 )%10;
int l = -999;
int n = (id/100000)%10; // Radial excitation
if(j == 0) l = nl;
else if(nl == 0) l = j - 1;
else if(nl == 1 || nl == 2) l = j;
else if(nl == 3) l = j + 1;
// Angular or Radial excited meson
if((l||j||n) && l>=0 && l<Lmax && j<Jmax && n<Nmax) {
return sqr(_repwt[l][j][n]);
}
}
return 1.0;
}
int HadronSelector::signHadron(tcPDPtr idQ1, tcPDPtr idQ2,
tcPDPtr hadron) const {
// This method receives in input three PDG ids, whose the
// first two have proper signs (corresponding to particles, id > 0,
// or antiparticles, id < 0 ), whereas the third one must
// be always positive (particle not antiparticle),
// corresponding to:
// --- quark-antiquark, or antiquark-quark, or
// quark-diquark, or diquark-quark, or
// antiquark-antidiquark, or antidiquark-antiquark
// for the first two input (idQ1, idQ2);
// --- meson or baryon for the third input (idHad):
// The method returns:
// --- + 1 if the two partons (idQ1, idQ2) are exactly
// the constituents for the hadron idHad;
// --- - 1 if the two partons (idQ1, idQ2) are exactly
// the constituents for the anti-hadron -idHad;
// --- + 0 otherwise.
// The method it is therefore useful to decide the
// sign of the id of the produced hadron as appeared
// in the vector _vecHad (where only hadron idHad > 0 are present)
// given the two constituent partons.
int sign = 0;
long idHad = hadron->id();
assert(idHad > 0);
int chargeIn = idQ1->iCharge() + idQ2->iCharge();
int chargeOut = hadron->iCharge();
// same charge
if( chargeIn == chargeOut && chargeIn !=0 ) sign = +1;
else if(chargeIn == -chargeOut && chargeIn !=0 ) sign = -1;
else if(chargeIn == 0 && chargeOut == 0 ) {
// In the case of same null charge, there are four cases:
// i) K0-like mesons, B0-like mesons, Bs-like mesons
// the PDG convention is to consider them "antiparticle" (idHad < 0)
// if the "dominant" (heavier) flavour (respectively, s, b)
// is a quark (idQ > 0): for instance, B0s = (b, sbar) has id < 0
// Remember that there is an important exception for K0L (id=130) and
// K0S (id=310): they don't have antiparticles, therefore idHad > 0
// always. We use below the fact that K0L and K0S are the unique
// hadrons having 0 the first (less significant) digit of their id.
// 2) D0-like mesons: the PDG convention is to consider them "particle"
// (idHad > 0) if the charm flavour is carried by a c: (c,ubar) has id>0
// 3) the remaining mesons should not have antiparticle, therefore their
// sign is always positive.
// 4) for baryons, that is when one of idQ1 and idQ2 is a (anti-) quark and
// the other one is a (anti-) diquark the sign is negative when both
// constituents are "anti", that is both with id < 0; positive otherwise.
// meson
if(abs(int(idQ1->iColour()))== 3 && abs(int(idQ2->iColour())) == 3 &&
!DiquarkMatcher::Check(idQ1->id()) && !DiquarkMatcher::Check(idQ2->id()))
{
int idQa = abs(idQ1->id());
int idQb = abs(idQ2->id());
int dominant = idQ2->id();
if(idQa > idQb) {
swap(idQa,idQb);
dominant = idQ1->id();
}
if((idQa==ParticleID::d && idQb==ParticleID::s) ||
(idQa==ParticleID::d && idQb==ParticleID::b) ||
(idQa==ParticleID::s && idQb==ParticleID::b)) {
// idHad%10 is zero for K0L,K0S
if (dominant < 0 || idHad%10 == 0) sign = +1;
else if(dominant > 0) sign = -1;
}
else if((idQa==ParticleID::u && idQb==ParticleID::c) ||
(idQa==ParticleID::u && idQb==ParticleID::t) ||
(idQa==ParticleID::c && idQb==ParticleID::t)) {
if (dominant > 0) sign = +1;
else if(dominant < 0) sign = -1;
}
else if(idQa==idQb) sign = +1;
// sets sign for Susy particles
else sign = (dominant > 0) ? +1 : -1;
}
// baryon
else if(DiquarkMatcher::Check(idQ1->id()) || DiquarkMatcher::Check(idQ2->id())) {
if (idQ1->id() > 0 && idQ2->id() > 0) sign = +1;
else if(idQ1->id() < 0 && idQ2->id() < 0) sign = -1;
}
}
if (sign == 0) {
cerr << "Could not work out sign for "
<< idQ1->PDGName() << ' '
<< idQ2->PDGName() << " => "
<< hadron->PDGName() << '\n';
assert(false);
}
return sign;
}
pair<tcPDPtr,tcPDPtr> HadronSelector::lightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2,
tcPDPtr ptr3) const {
// throw exception of id3!=0 as doesn't work
if ( ptr3 ) throw Exception()
<< "ptr3!=0 not yet implemented in HadronSelector::lightestHadronPair"
<< Exception::abortnow;
// charge
int totalcharge = ptr1->iCharge() + ptr2->iCharge();
if ( ptr3 ) totalcharge += ptr3->iCharge();
tcPDPtr vIdHad1[2]={tcPDPtr(),tcPDPtr()},vIdHad2[2]={tcPDPtr(),tcPDPtr()};
bool vOk[2] = {false, false};
Energy vMassPair[2] = { ZERO, ZERO };
for (int i = 0; i < 2; i++) {
tcPDPtr idPartner = i==0 ? getParticleData(ParticleID::d) : getParticleData(ParticleID::u);
// Change sign to idPartner (transform it into a anti-quark) if it is not
// possible to form a meson or a baryon.
assert (ptr1 && idPartner);
if (!CheckId::canBeHadron(ptr1, idPartner)) idPartner = idPartner->CC();
vIdHad1[i] = lightestHadron(ptr1, idPartner);
vIdHad2[i] = lightestHadron(ptr2, idPartner->CC());
if ( vIdHad1[i] && vIdHad2[i] &&
vIdHad1[i]->iCharge() + vIdHad2[i]->iCharge() == totalcharge ) {
vOk[i] = true;
vMassPair[i] = vIdHad1[i]->mass() + vIdHad2[i]->mass();
}
}
// Take the lightest pair compatible with charge conservation.
if ( vOk[0] && ( ! vOk[1] || vMassPair[0] <= vMassPair[1] ) ) {
return make_pair(vIdHad1[0],vIdHad2[0]);
}
else if ( vOk[1] && ( ! vOk[0] || vMassPair[1] < vMassPair[0] ) ) {
return make_pair(vIdHad1[1],vIdHad2[1]);
}
else {
return make_pair(tcPDPtr(),tcPDPtr());
}
}
Energy HadronSelector::massLightestBaryonPair(tcPDPtr ptr1, tcPDPtr ptr2) const {
// Make sure that we don't have any diquarks as input, return arbitrarily
// large value if we do
Energy currentSum = Constants::MaxEnergy;
for(unsigned int ix=0; ix<_partons.size(); ++ix) {
if(!DiquarkMatcher::Check(_partons[ix]->id())) continue;
HadronTable::const_iterator
tit1=_table.find(make_pair(abs(ptr1->id()),_partons[ix]->id())),
tit2=_table.find(make_pair(_partons[ix]->id(),abs(ptr2->id())));
if( tit1==_table.end() || tit2==_table.end()) continue;
if(tit1->second.empty()||tit2->second.empty()) continue;
Energy s = tit1->second.begin()->mass + tit2->second.begin()->mass;
if(currentSum > s) currentSum = s;
}
return currentSum;
}
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,27 +1,28 @@
SUBDIRS = include \
Utilities PDT Decay PDF Models \
Shower Hadronization MatrixElement \
UnderlyingEvent Analysis Looptools \
lib src Doc Contrib Tests
EXTRA_DIST = GUIDELINES
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --with-thepeg=$(THEPEGPATH)
ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = config.herwig
libclean:
find . -name '*.la' -print0 | xargs -0 rm -rf
cd lib && $(MAKE) $(AM_MAKEFLAGS) clean
+ cd src && $(MAKE) $(AM_MAKEFLAGS) clean
tests:
cd Tests && $(MAKE) $(AM_MAKEFLAGS) tests
## ThePEG registration
unregister:
cd src && $(MAKE) $(AM_MAKEFLAGS) unregister
register:
cd src && $(MAKE) $(AM_MAKEFLAGS) register
diff --git a/MatrixElement/DIS/Makefile.am b/MatrixElement/DIS/Makefile.am
--- a/MatrixElement/DIS/Makefile.am
+++ b/MatrixElement/DIS/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = HwMEDIS.la
HwMEDIS_la_SOURCES = \
DISBase.h DISBase.cc \
MENeutralCurrentDIS.cc MENeutralCurrentDIS.h \
MEChargedCurrentDIS.cc MEChargedCurrentDIS.h
-HwMEDIS_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 3:0:0
+HwMEDIS_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 4:0:0
diff --git a/MatrixElement/General/GeneralHardME.cc b/MatrixElement/General/GeneralHardME.cc
--- a/MatrixElement/General/GeneralHardME.cc
+++ b/MatrixElement/General/GeneralHardME.cc
@@ -1,624 +1,1001 @@
// -*- C++ -*-
//
// GeneralHardME.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the GeneralHardME class.
//
#include "GeneralHardME.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/MatrixElement/Tree2toNDiagram.h"
#include "ThePEG/Utilities/EnumIO.h"
#include "ThePEG/PDF/PolarizedBeamParticleData.h"
#include <numeric>
using namespace Herwig;
GeneralHardME::GeneralHardME() : incoming_(0, 0), outgoing_(0, 0),
diagrams_(0), numberOfDiagrams_(0),
colour_(0), numberOfFlows_(0) ,
debug_(false), scaleChoice_(0),
scaleFactor_(1.) {
massOption(vector<unsigned int>(2,1));
}
void GeneralHardME::setProcessInfo(const vector<HPDiagram> & alldiagrams,
ColourStructure colour,
bool debug, unsigned int scaleOption,
double scaleFactor) {
// external particles
incoming_ = alldiagrams.at(0).incoming;
outgoing_ = alldiagrams.at(0).outgoing;
diagrams_ = alldiagrams;
numberOfDiagrams_ = alldiagrams.size();
// debug option
debug_ = debug;
// scale choice
scaleChoice_ = scaleOption;
scaleFactor_ = scaleFactor;
// OffShell options
pair<bool, bool> offshell(make_pair(false, false));
vector<unsigned int> mopt(2,1);
if( getParticleData(outgoing_.first )->widthGenerator() ||
getParticleData(outgoing_.first )-> massGenerator()) {
offshell.first = true;
mopt[0] = 2;
}
if( getParticleData(outgoing_.second)->widthGenerator() ||
getParticleData(outgoing_.second)-> massGenerator() ) {
offshell.second = true;
mopt[1] = 2;
}
if(outgoing_.first == incoming_.first ||
outgoing_.first == incoming_.second )
mopt[0] = 0;
if(outgoing_.second == incoming_.first ||
outgoing_.second == incoming_.second )
mopt[1] = 0;
massOption(mopt);
if( offshell.first == true && offshell.second == true &&
abs(outgoing_.first) == abs(outgoing_.second) )
rescalingOption(3);
// colour structure
colourStructure_ = colour;
switch (colour) {
// colour neutral process
case Colour11to11:
colour_ = vector<DVector>(1,DVector(1,1.));
numberOfFlows_ = 1;
break;
// colour neutral -> 3 3bar or swap process
case Colour11to33bar: case Colour33barto11:
colour_ = vector<DVector>(1,DVector(1,3.));
numberOfFlows_ = 1;
break;
// colour neutral -> 8 8 process or swap
case Colour11to88: case Colour88to11 :
colour_ = vector<DVector>(1,DVector(1,8.));
numberOfFlows_ = 1;
break;
// colour 33 -> 33 or 3bar3bar -> 3bar3bar process
// or colour 33bar -> 33bar
case Colour33to33: case Colour3bar3barto3bar3bar:
case Colour33barto33bar:
- colour_ = vector<DVector>(4, DVector(4, 0.));
+ colour_ = vector<DVector>(6, DVector(6, 0.));
colour_[0][0] = colour_[1][1] = 2.;
colour_[2][2] = colour_[3][3] = 9.;
colour_[0][1] = colour_[1][0] = -2./3.;
colour_[0][2] = colour_[2][0] = 0.;
colour_[0][3] = colour_[3][0] = 4.;
colour_[1][2] = colour_[2][1] = 4.;
colour_[1][3] = colour_[3][1] = 0.;
colour_[2][3] = colour_[3][2] = 3.;
numberOfFlows_ = 4;
break;
+ // colour 3 3bar -> 6 6bar
+ case Colour33barto66bar: case Colour33barto6bar6:
+ colour_ = vector<DVector>(8, DVector(8, 0.));
+ // diagonals
+ for(unsigned int ix=0;ix<4;++ix){
+ colour_[ix][ix] = 1.5;
+ colour_[ix+4][ix+4] = 27./16.;
+ }
+ colour_[0][1] = colour_[1][0] = 0.5;
+ colour_[0][2] = colour_[2][0] = 0.5;
+ colour_[0][3] = colour_[3][0] = 0.;
+ colour_[0][4] = colour_[4][0] = 3./8.;
+ colour_[0][5] = colour_[5][0] = 1./8.;
+ colour_[0][6] = colour_[6][0] = 1./8.;
+ colour_[0][7] = colour_[7][0] = 0.;
+ // 1
+ colour_[1][2] = colour_[2][1] = 0.;
+ colour_[1][3] = colour_[3][1] = 0.5;
+ colour_[1][4] = colour_[4][1] = 1./8.;
+ colour_[1][5] = colour_[5][1] = 3./8.;
+ colour_[1][6] = colour_[6][1] = 0.;
+ colour_[1][7] = colour_[7][1] = 1./8.;
+ // 2
+ colour_[2][3] = colour_[3][2] = 0.5;
+ colour_[2][4] = colour_[4][2] = 1./8.;
+ colour_[2][5] = colour_[5][2] = 0.;
+ colour_[2][6] = colour_[6][2] = 3./8.;
+ colour_[2][7] = colour_[7][2] = 1./8.;
+ // 3
+ colour_[3][4] = colour_[4][3] = 0.;
+ colour_[3][5] = colour_[5][3] = 1./8.;
+ colour_[3][6] = colour_[6][3] = 1./8.;
+ colour_[3][7] = colour_[7][3] = 3./8.;
+ // 4
+ colour_[4][5] = colour_[5][4] = 9./16.;
+ colour_[4][6] = colour_[6][4] = 9./16.;
+ colour_[4][7] = colour_[7][4] = 3./16.;
+ // 5
+ colour_[5][6] = colour_[6][5] = 3./16.;
+ colour_[5][7] = colour_[7][5] = 9./16.;
+ //6
+ colour_[6][7] = colour_[7][6] = 9./16.;
+ numberOfFlows_ = 8;
+ break;
// colour 33bar -> 88, 88 -> 33bar
case Colour33barto88: case Colour88to33bar:
case Colour38to83: case Colour38to38:
case Colour3bar8to83bar: case Colour3bar8to3bar8:
colour_ = vector<DVector>(3, DVector(3, 0.));
colour_[0][0] = colour_[1][1] = 16./3.;
colour_[0][1] = colour_[1][0] = -2./3.;
colour_[2][2]=24.;
colour_[0][2] = colour_[2][0] = 4.;
colour_[1][2] = colour_[2][1] = 4.;
numberOfFlows_ = 3;
break;
case Colour88to88:
colour_ = vector<DVector>(6, DVector(6, 0.));
colour_[0][0] = colour_[1][1] = colour_[2][2]=92./3.;
colour_[0][1] = colour_[1][0] = -16./3.;
colour_[0][2] = colour_[2][0] = -16./3.;
colour_[2][1] = colour_[1][2] = -16./3.;
colour_[0][3] = colour_[3][0] = 64./3.;
colour_[0][4] = colour_[4][0] = 64./3.;
colour_[0][5] = colour_[5][0] = - 8./3.;
colour_[1][3] = colour_[3][1] = - 8./3.;
colour_[1][4] = colour_[4][1] = 64./3.;
colour_[1][5] = colour_[5][1] = 64./3.;
colour_[2][3] = colour_[3][2] = 64./3.;
colour_[2][4] = colour_[4][2] = - 8./3.;
colour_[2][5] = colour_[5][2] = 64./3.;
colour_[3][3] = colour_[4][4] = colour_[5][5] = 64.;
colour_[3][4] = colour_[4][3] = 8.;
colour_[3][5] = colour_[5][3] = 8.;
colour_[4][5] = colour_[5][4] = 8.;
numberOfFlows_ = 6;
break;
case Colour33barto18 : case Colour33barto81 :
case Colour38to13 : case Colour38to31 :
case Colour3bar8to13bar: case Colour3bar8to3bar1:
colour_ = vector<DVector>(1,DVector(1,4.));
numberOfFlows_ = 1;
break;
case Colour88to18 : case Colour88to81:
colour_ = vector<DVector>(1,DVector(1,24.));
numberOfFlows_ = 1;
break;
+ case Colour88to66bar:
+ colour_ = vector<DVector>(12, DVector(12, 0.));
+ // diagonals
+ for(unsigned int ix=0;ix<12;++ix) colour_[ix][ix] = 4.;
+ // 1 1 block
+ colour_[ 0][ 1] = colour_[ 1][ 0] = 4./3.;
+ colour_[ 0][ 2] = colour_[ 2][ 0] = 4./3.;
+ colour_[ 0][ 3] = colour_[ 3][ 0] = 0.5 ;
+ colour_[ 1][ 2] = colour_[ 2][ 1] = 0.5 ;
+ colour_[ 1][ 3] = colour_[ 3][ 1] = 4./3.;
+ colour_[ 2][ 3] = colour_[ 3][2] = 4./3.;
+ // 1 2 and 2 1 blocks
+ colour_[ 0][ 4] = colour_[ 4][ 0] = 4./3.;
+ colour_[ 1][ 5] = colour_[ 5][ 1] = 4./3.;
+ colour_[ 2][ 6] = colour_[ 6][ 2] = 4./3.;
+ colour_[ 3][ 7] = colour_[ 7][ 3] = 4./3.;
+ colour_[ 0][ 7] = colour_[ 7][ 0] = -1./6.;
+ colour_[ 1][ 6] = colour_[ 6][ 1] = -1./6.;
+ colour_[ 2][ 5] = colour_[ 5][ 2] = -1./6.;
+ colour_[ 3][ 4] = colour_[ 4][ 3] = -1./6.;
+ // 1 3 and 3 1 blocks
+ colour_[ 0][11] = colour_[11][ 0] = 4./3.;
+ colour_[ 1][10] = colour_[10][ 1] = 4./3.;
+ colour_[ 2][ 9] = colour_[ 9][ 2] = 4./3.;
+ colour_[ 3][ 8] = colour_[ 8][ 3] = 4./3.;
+ colour_[ 0][ 8] = colour_[ 8][ 0] = -1./6.;
+ colour_[ 1][ 9] = colour_[ 9][ 1] = -1./6.;
+ colour_[ 2][10] = colour_[10][ 2] = -1./6.;
+ colour_[ 3][11] = colour_[11][ 3] = -1./6.;
+ // 2 2 block
+ colour_[ 4][ 5] = colour_[ 5][ 4] = 4./3.;
+ colour_[ 4][ 6] = colour_[ 6][ 4] = 4./3.;
+ colour_[ 4][ 7] = colour_[ 7][ 4] = 0.5 ;
+ colour_[ 5][ 6] = colour_[ 6][ 5] = 0.5 ;
+ colour_[ 5][ 7] = colour_[ 7][ 5] = 4./3.;
+ colour_[ 6][ 7] = colour_[ 7][ 6] = 4./3.;
+ // 2 3 and 3 2 blocks
+ colour_[ 4][ 8] = colour_[ 8][ 4] = -0.5 ;
+ colour_[ 4][ 9] = colour_[ 9][ 4] = -1./6.;
+ colour_[ 4][10] = colour_[10][ 4] = -1./6.;
+ colour_[ 4][11] = colour_[11][ 4] = 0.5 ;
+ colour_[ 5][ 8] = colour_[ 8][ 5] = -1./6.;
+ colour_[ 5][ 9] = colour_[ 9][ 5] = -0.5 ;
+ colour_[ 5][10] = colour_[10][ 5] = 0.5 ;
+ colour_[ 5][11] = colour_[11][ 5] = -1./6.;
+ colour_[ 6][ 8] = colour_[ 8][ 6] = -1./6.;
+ colour_[ 6][ 9] = colour_[ 9][ 6] = 0.5 ;
+ colour_[ 6][10] = colour_[10][ 6] = -0.5 ;
+ colour_[ 6][11] = colour_[11][ 6] = -1./6.;
+ colour_[ 7][ 8] = colour_[ 8][ 7] = 0.5 ;
+ colour_[ 7][ 9] = colour_[ 9][ 7] = -1./6.;
+ colour_[ 7][10] = colour_[10][ 7] = -1./6.;
+ colour_[ 7][11] = colour_[11][ 7] = -0.5 ;
+ // 3 3 block
+ colour_[ 8][ 9] = colour_[ 9][ 8] = 4./3.;
+ colour_[ 8][10] = colour_[10][ 8] = 4./3.;
+ colour_[ 8][11] = colour_[11][ 8] = 0.5 ;
+ colour_[ 9][10] = colour_[10][ 9] = 0.5 ;
+ colour_[ 9][11] = colour_[11][ 9] = 4./3.;
+ colour_[10][11] = colour_[11][10] = 4./3.;
+ numberOfFlows_ = 12;
+ break;
+ case Colour33to61: case Colour33to16:
+ case Colour3bar3barto6bar1: case Colour3bar3barto16bar:
+ colour_ = vector<DVector>(2, DVector(2, 0.));
+ colour_[1][1] = colour_[0][0] = 9./4.;
+ colour_[0][1] = colour_[1][0] = 3./4.;
+ numberOfFlows_ = 2;
+ break;
+ case Colour38to3bar6: case Colour38to63bar:
+ colour_ = vector<DVector>(8, DVector(8, 0.));
+ // diagonals
+ for(unsigned int ix=0;ix<8;++ix) colour_[ix][ix] = 3.;
+ colour_[0][1] = colour_[1][0] = 1.;
+ colour_[0][2] = colour_[2][0] = 1.;
+ colour_[0][3] = colour_[3][0] = 0.;
+ colour_[0][4] = colour_[4][0] = 1.;
+ colour_[0][5] = colour_[5][0] = 3.;
+ colour_[0][6] = colour_[6][0] = 1.;
+ colour_[0][7] = colour_[7][0] = 0.;
+ // 1
+ colour_[1][2] = colour_[2][1] = 0.;
+ colour_[1][3] = colour_[3][1] = 1.;
+ colour_[1][4] = colour_[4][1] = 3.;
+ colour_[1][5] = colour_[5][1] = 1.;
+ colour_[1][6] = colour_[6][1] = 0.;
+ colour_[1][7] = colour_[7][1] = 1.;
+ // 2
+ colour_[2][3] = colour_[3][2] = 1.;
+ colour_[2][4] = colour_[4][2] = 0.;
+ colour_[2][5] = colour_[5][2] = 1.;
+ colour_[2][6] = colour_[6][2] = 3.;
+ colour_[2][7] = colour_[7][2] = 1.;
+ // 3
+ colour_[3][4] = colour_[4][3] = 1.;
+ colour_[3][5] = colour_[5][3] = 0.;
+ colour_[3][6] = colour_[6][3] = 1.;
+ colour_[3][7] = colour_[7][3] = 3.;
+ // 4
+ colour_[4][5] = colour_[5][4] = 1.;
+ colour_[4][6] = colour_[6][4] = 0.;
+ colour_[4][7] = colour_[7][4] = 1.;
+ // 5
+ colour_[5][6] = colour_[6][5] = 1.;
+ colour_[5][7] = colour_[7][5] = 0.;
+ //6
+ colour_[6][7] = colour_[7][6] = 1.;
+ numberOfFlows_ = 8;
+ break;
default:
assert(false);
}
}
void GeneralHardME::getDiagrams() const {
//get ParticleData pointers for external particles
tcPDPtr ina = getParticleData(getIncoming().first);
tcPDPtr inb = getParticleData(getIncoming().second);
tcPDPtr outa = getParticleData(getOutgoing().first);
tcPDPtr outb = getParticleData(getOutgoing().second);
for(HPCount idx = 0; idx < numberOfDiagrams_; ++idx) {
const HPDiagram & current = getProcessInfo()[idx];
tcPDPtr offshell = current.intermediate;
if(!offshell) continue;
//t-channel
if(current.channelType == HPDiagram::tChannel) {
if(offshell->id() < 0) offshell = offshell->CC();
if(current.ordered.second)
add(new_ptr((Tree2toNDiagram(3), ina, offshell,
inb, 1, outa, 2, outb, -(idx+1))));
else
add(new_ptr((Tree2toNDiagram(3), ina, offshell,
inb, 2, outa, 1, outb, -(idx+1))));
}
//s-channel
else if(current.channelType == HPDiagram::sChannel)
add(new_ptr((Tree2toNDiagram(2), ina, inb, 1, offshell,
3, outa, 3, outb, -(idx+1))));
else
throw MEException() << "getDiagrams() - Unknown diagram in matrix element "
<< fullName() << Exception::runerror;
}
}
unsigned int GeneralHardME::orderInAlphaS() const {
unsigned int order(0);
for(HPCount idx = 0; idx < numberOfDiagrams_; ++idx) {
unsigned int tOrder = diagrams_[idx].vertices.first->orderInGs() +
diagrams_[idx].vertices.second->orderInGs();
if(tOrder > order) order = tOrder;
}
return order;
}
unsigned int GeneralHardME::orderInAlphaEW() const {
unsigned int order(0);
for(HPCount idx = 0; idx < numberOfDiagrams_; ++idx) {
unsigned int tOrder = diagrams_[idx].vertices.first->orderInGem() +
diagrams_[idx].vertices.second->orderInGem();
if(tOrder > order) order = tOrder;
}
return order;
}
Selector<MEBase::DiagramIndex>
GeneralHardME::diagrams(const DiagramVector & diags) const {
Selector<DiagramIndex> sel;
for ( DiagramIndex i = 0; i < diags.size(); ++i ) {
if(abs(diags[i]->id()) == int(diagram_+1)) sel.insert(1., i);
}
return sel;
}
void GeneralHardME::persistentOutput(PersistentOStream & os) const {
os << incoming_ << outgoing_ << diagrams_ << colour_ << oenum(colourStructure_)
<< numberOfDiagrams_ << numberOfFlows_ << debug_
<< scaleChoice_ << scaleFactor_;
}
void GeneralHardME::persistentInput(PersistentIStream & is, int) {
is >> incoming_ >> outgoing_ >> diagrams_ >> colour_ >> ienum(colourStructure_)
>> numberOfDiagrams_ >> numberOfFlows_ >> debug_
>> scaleChoice_ >> scaleFactor_;
}
AbstractClassDescription<GeneralHardME> GeneralHardME::initGeneralHardME;
// Definition of the static class description member.
void GeneralHardME::Init() {
static ClassDocumentation<GeneralHardME> documentation
("This class is designed to be a base class for a specific spin "
"configuration where no matrix element exists, i.e. when processes "
"are created automaticlly for a different model.");
}
Selector<const ColourLines *>
GeneralHardME::colourGeometries(tcDiagPtr diag) const {
// get the current diagram
const HPDiagram & current = getProcessInfo()[abs(diag->id()) - 1];
Selector<const ColourLines *> sel;
switch(colourStructure_) {
case Colour11to11:
static ColourLines f11to11("");
sel.insert(1.,&f11to11);
break;
case Colour11to33bar:
static ColourLines f11to33bar[2]={ColourLines("4 -5"),
ColourLines("4 2 -5")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f11to33bar[1]);
else
sel.insert(1.,&f11to33bar[0]);
break;
case Colour11to88:
static ColourLines f11to88[2]={ColourLines("4 -5, 5 -4"),
ColourLines("4 2 -5,5 -2 4")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f11to88[1]);
else
sel.insert(1.,&f11to88[0]);
break;
case Colour33to33:
static ColourLines f33to33[4]={ColourLines("1 2 5, 3 -2 4"),
ColourLines("1 2 4, 3 -2 5"),
ColourLines("1 4, 3 5"),
ColourLines("1 5, 3 4")};
+ static ColourLines f33to33s[4]={ColourLines("1 3:1 4, 2 3:2 5"),
+ ColourLines("1 3:2 4, 2 3:1 5"),
+ ColourLines("1 3:1 5, 2 3:2 4"),
+ ColourLines("1 3:2 5, 2 3:1 4")};
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,current.ordered.second ? &f33to33[0] : &f33to33[1]);
+ else if(current.intermediate->iColour() == PDT::Colour6) {
+ sel.insert(1., &f33to33s[2*(flow_-2)+UseRandom::irnd(0,2)]);
+ }
else
sel.insert(1.,current.ordered.second ? &f33to33[2] : &f33to33[3]);
break;
case Colour3bar3barto3bar3bar:
static ColourLines
f3bar3barto3bar3bar[4]={ColourLines("-1 -2 -5, -3 2 -4"),
ColourLines("-1 -2 -4, -3 2 -5"),
ColourLines("-1 -4, -3 -5"),
ColourLines("-1 -5, -3 -4")};
+ static ColourLines f3bar3barto3bar3bars[2]
+ ={ColourLines("-1 -3:1 -4, -2 -3:2 -5"),
+ ColourLines("-1 -3:2 -4, -2 -3:1 -5")};
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,current.ordered.second ?
&f3bar3barto3bar3bar[0] : &f3bar3barto3bar3bar[1]);
+ else if(current.intermediate->iColour() == PDT::Colour6bar) {
+ sel.insert(1., &f3bar3barto3bar3bars[flow_]);
+ }
else
sel.insert(1.,current.ordered.second ?
&f3bar3barto3bar3bar[2] : &f3bar3barto3bar3bar[3]);
break;
case Colour33barto33bar:
static ColourLines
f33barto33bar[4]={ColourLines("1 2 -3, 4 -2 -5"),
ColourLines("1 3 4, -2 -3 -5"),
ColourLines("1 4, -3 -5"),
ColourLines("1 -2, 4 -5")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,current.intermediate->iColour() == PDT::Colour8 ?
&f33barto33bar[0] : &f33barto33bar[2]);
else
sel.insert(1.,current.intermediate->iColour() == PDT::Colour8 ?
&f33barto33bar[1] : &f33barto33bar[3]);
break;
case Colour33barto11:
static ColourLines f33barto11[2]={ColourLines("1 -2"),
ColourLines("1 2 -3")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f33barto11[1]);
else
sel.insert(1.,&f33barto11[0]);
break;
case Colour33barto88:
static ColourLines f33barto88[5]={ColourLines("1 4, -4 2 5, -5 -3"),
ColourLines("1 5, -5 2 4, -4 -3"),
ColourLines("1 3 4, -5 -3 -2, -4 5"),
ColourLines("1 3 5, -4 -3 -2, -5 4"),
ColourLines("1 -2,4 -5, 5 -4")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,current.ordered.second ? &f33barto88[0] : &f33barto88[1]);
else if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,&f33barto88[flow_+2]);
else
sel.insert(1.,&f33barto88[4]);
break;
case Colour33barto18:
static ColourLines f33barto18[3]={ColourLines("1 2 5, -3 -5"),
ColourLines("1 5, -5 2 -3"),
ColourLines("1 3 5,-2 -3 -5")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,current.ordered.second ? &f33barto18[0] : &f33barto18[1]);
else
sel.insert(1.,&f33barto18[2]);
break;
case Colour33barto81:
static ColourLines f33barto81[3]={ColourLines("1 4, -4 2 -3"),
ColourLines("-3 -4, 1 2 4"),
ColourLines("1 3 4,-2 -3 -4")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,current.ordered.second ? &f33barto81[0] : &f33barto81[1]);
else
sel.insert(1.,&f33barto81[2]);
break;
case Colour88to11:
static ColourLines f88barto11[2]={ColourLines("1 -2, 2 -1"),
ColourLines("1 -2 -3, 3 2 -1")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f88barto11[1]);
else
sel.insert(1.,&f88barto11[0]);
break;
case Colour88to33bar:
static ColourLines f88to33bar[5]={ColourLines("1 4, -3 -5, 3 2 -1"),
ColourLines("-1 -5, 1 2 -3, 3 4"),
ColourLines("2 -1, 1 3 4, -2 -3 -5"),
ColourLines("1 -2, -1 -3 -5, 2 3 4"),
ColourLines("1 -2, 2 -1, 4 -5")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,current.ordered.second ? &f88to33bar[0] : &f88to33bar[1]);
else if(current.intermediate->iColour() == PDT::Colour8 )
sel.insert(1.,&f88to33bar[flow_+2]);
else
sel.insert(1.,&f88to33bar[4]);
break;
case Colour88to88:
static ColourLines f88to88[15]={ColourLines("1 -2, -1 -3 -4, 4 -5, 2 3 5"),
ColourLines("-1 2, 1 3 4, -4 5, -2 -3 -5"),
ColourLines("1 -2, -1 -3 -5, 5 -4, 2 3 4"),
ColourLines("-1 2, 1 3 5, -5 4, -2 -3 -4"),
ColourLines("1 4, -1 -2 3, -3 -5, -4 2 5"),
ColourLines("-1 -4, 1 2 -3, 3 5, 4 -2 -5"),
ColourLines("1 4, -1 -2 -5, 3 5, -3 2 -4"),
ColourLines("-1 -4, 1 2 5, -3 -5, 3 -2 4"),
ColourLines("1 5, -1 -2 3, -3 -4, -5 2 4"),
ColourLines("-1 -5, 1 2 -3, 3 4, 5 -2 -4"),
ColourLines("1 5, -1 -2 -4, 3 4, -3 2 -5"),
ColourLines("-1 -5, 1 2 4, -3 -4, 3 -2 5"),
ColourLines("1 -2, 2 -1, 4 -5, 5 -4"),
ColourLines("1 4, -1 -4, 3 5, -5 -3"),
ColourLines("1 5, -1 -5, 3 4, -3 -4")};
if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iColour() == PDT::Colour8) {
if(flow_==0) {
sel.insert(0.5, &f88to88[0]);
sel.insert(0.5, &f88to88[1]);
}
else if(flow_==2) {
sel.insert(0.5, &f88to88[2]);
sel.insert(0.5, &f88to88[3]);
}
else
assert(false);
}
else {
sel.insert(1., &f88to88[12]);
}
}
else if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second) {
if(current.intermediate->iColour() == PDT::Colour8) {
if(flow_==0) {
sel.insert(0.25, &f88to88[4]);
sel.insert(0.25, &f88to88[5]);
}
else if(flow_==1) {
sel.insert(0.25, &f88to88[6]);
sel.insert(0.25, &f88to88[7]);
}
else
assert(false);
}
else
sel.insert(1., &f88to88[13]);
}
else {
if(current.intermediate->iColour() == PDT::Colour8) {
if(flow_==2) {
sel.insert(0.25, &f88to88[8]);
sel.insert(0.25, &f88to88[9]);
}
else if(flow_==1) {
sel.insert(0.25, &f88to88[10]);
sel.insert(0.25, &f88to88[11]);
}
else
assert(false);
}
else
sel.insert(1., &f88to88[14]);
}
}
break;
case Colour38to13:
static ColourLines f38to13[2]={ColourLines("1 2 -3, 3 5"),
ColourLines("1-2, 2 3 5" )};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f38to13[0]);
else
sel.insert(1.,&f38to13[1]);
break;
case Colour38to31:
static ColourLines f38to31[2]={ColourLines("1 2 -3, 3 4"),
ColourLines("1-2, 2 3 4 ")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f38to31[0]);
else
sel.insert(1.,&f38to31[1]);
break;
case Colour3bar8to13bar:
static ColourLines f3bar8to13bar[2]={ColourLines("-1 2 3, -3 -5 "),
ColourLines("-1 2, -5 -3 -2")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f3bar8to13bar[0]);
else
sel.insert(1.,&f3bar8to13bar[1]);
break;
case Colour3bar8to3bar1:
static ColourLines f3bar8to3bar1[2]={ColourLines("-1 2 3, -3 -4 "),
ColourLines("-1 2, -4 -3 -2")};
if(current.channelType == HPDiagram::tChannel)
sel.insert(1.,&f3bar8to3bar1[0]);
else
sel.insert(1.,&f3bar8to3bar1[1]);
break;
case Colour38to83:
static ColourLines f38to83[4]={ColourLines("1 4, -4 2 -3, 3 5"),
ColourLines("1 -2, 2 3 4, 5 -4"),
ColourLines("1 2 4, -4 -3, 3 -2 5"),
ColourLines("1 2 -3, -4 -2 5, 3 4")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f38to83[1]);
else {
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,&f38to83[flow_+2]);
else
sel.insert(1.,&f38to83[0]);
}
break;
case Colour38to38:
static ColourLines f38to38[4]={ColourLines("1 5, -5 2 -3, 3 4"),
ColourLines("1 -2, 2 3 5, 4 -5"),
ColourLines("1 2 5, -5 -3, 3 -2 4"),
ColourLines("1 2 -3, -5 -2 4, 3 5")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f38to38[1]);
else {
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,&f38to38[flow_+2]);
else
sel.insert(1.,&f38to38[0]);
}
break;
case Colour3bar8to83bar:
static ColourLines f3bar8to83bar[4]={ColourLines("-1 -4, 3 2 4, -3 -5"),
ColourLines("-1 2, -4 -3 -2, 4 -5"),
ColourLines("-1 -2 -4,-3 2 -5,3 4"),
ColourLines("-1 -2 3, -5 2 4, -3 -4")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f3bar8to83bar[1]);
else {
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,&f3bar8to83bar[flow_+2]);
else
sel.insert(1.,&f3bar8to83bar[0]);
}
break;
case Colour3bar8to3bar8:
static ColourLines f3bar8to3bar8[4]={ColourLines("-1 -5, 3 2 5, -3 -4"),
ColourLines("-1 2, -5 -3 -2, 5 -4"),
ColourLines("-1 -2 -5,-3 2 -4,3 5"),
ColourLines("-1 -2 3, -4 2 5, -3 -5")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f3bar8to3bar8[1]);
else {
if(current.intermediate->iColour() == PDT::Colour8)
sel.insert(1.,&f3bar8to3bar8[flow_+2]);
else
sel.insert(1.,&f3bar8to3bar8[0]);
}
break;
case Colour88to18:
static ColourLines f88to18[6]={ColourLines(" 1 3 5, -1 2, -2 -3 -5"),
ColourLines(" -1 -3 -5, 1 -2, 2 3 5"),
ColourLines(" 1 2 -3, -1 -2 -5, 3 5"),
ColourLines("-1 -2 3, 1 2 5, -3 -5"),
ColourLines(" 1 5, -1 2 3, -3 -2 -5"),
ColourLines("-1 -5, 1 -2 -3, 3 2 5")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f88to18[UseRandom::irnd(0,2)]);
else if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second)
sel.insert(1.,&f88to18[UseRandom::irnd(2,4)]);
else
sel.insert(1.,&f88to18[UseRandom::irnd(4,6)]);
}
break;
case Colour88to81:
static ColourLines f88to81[6]={ColourLines(" 1 3 4, -1 2, -2 -3 -4"),
ColourLines(" -1 -3 -4, 1 -2, 2 3 4"),
- ColourLines(" 1 4, -1 2 3, -3 -2 -4"),
- ColourLines("-1 -4, 1 -2 -3, 3 2 4"),
- ColourLines(" 1 2 -3, -1 -2 -4, 3 4"),
- ColourLines("-1 -2 3, 1 2 4, -3 -4")};
+ ColourLines(" 1 4, -1 2 3, -3 -2 -4"),
+ ColourLines(" -1 -4, 1 -2 -3, 3 2 4"),
+ ColourLines(" 1 2 -3, -1 -2 -4, 3 4"),
+ ColourLines(" -1 -2 3, 1 2 4, -3 -4")};
if(current.channelType == HPDiagram::sChannel)
sel.insert(1.,&f88to81[UseRandom::irnd(0,2)]);
else if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second)
sel.insert(1.,&f88to81[UseRandom::irnd(2,4)]);
else
sel.insert(1.,&f88to81[UseRandom::irnd(4,6)]);
}
break;
+ case Colour33barto66bar:
+ static ColourLines f33barto66bars[8]
+ ={ColourLines("1 3 4:1, -2 -3 -5:1, 4:2 -5:2"),
+ ColourLines("1 3 4:1, -2 -3 -5:2, 4:2 -5:1"),
+ ColourLines("1 3 4:2, -2 -3 -5:1, 4:1 -5:2"),
+ ColourLines("1 3 4:2, -2 -3 -5:2, 4:1 -5:1"),
+ ColourLines(""), ColourLines(""),
+ ColourLines(""), ColourLines(""),};
+ static ColourLines f33barto66bart[8]
+ ={ColourLines(""), ColourLines(""),
+ ColourLines(""), ColourLines(""),
+ ColourLines("1 4:1, 4:2 2 -5:1, -3 -5:2"),
+ ColourLines("1 4:1, 4:2 2 -5:2, -3 -5:1"),
+ ColourLines("1 4:2, 4:1 2 -5:1, -3 -5:2"),
+ ColourLines("1 4:2, 4:1 2 -5:2, -3 -5:1")};
+ if(current.channelType == HPDiagram::sChannel)
+ sel.insert(1.,&f33barto66bars[flow_]);
+ else if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1.,&f33barto66bart[flow_]);
+ else
+ assert(false);
+ }
+ break;
+ case Colour33barto6bar6:
+ static ColourLines f33barto6bar6s[8]
+ ={ColourLines("1 3 5:1, -2 -3 -4:1, -4:2 5:2"),
+ ColourLines("1 3 5:1, -2 -3 -4:2, -4:1 5:2"),
+ ColourLines("1 3 5:2, -2 -3 -4:1, -4:2 5:1"),
+ ColourLines("1 3 5:2, -2 -3 -4:2, -4:1 5:1"),
+ ColourLines(""), ColourLines(""),
+ ColourLines(""), ColourLines("")};
+ static ColourLines f33barto6bar6u[8]
+ ={ColourLines(""), ColourLines(""),
+ ColourLines(""), ColourLines(""),
+ ColourLines("1 5:1, 5:2 2 -4:1, -3 -4:2"),
+ ColourLines("1 5:1, 5:2 2 -4:2, -3 -4:1"),
+ ColourLines("1 5:2, 5:1 2 -4:1, -3 -4:2"),
+ ColourLines("1 5:2, 5:1 2 -4:2, -3 -4:1")};
+ if(current.channelType == HPDiagram::sChannel)
+ sel.insert(1.,&f33barto6bar6s[flow_]);
+ else if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ assert(false);
+ else
+ sel.insert(1.,&f33barto6bar6u[flow_]);
+ }
+ break;
+ case Colour88to66bar:
+ static ColourLines f88to66t[12]=
+ {ColourLines("1 4:2, 4:1 2:1 3, -1 2:2 -5:2, -3 -5:1"),
+ ColourLines("1 4:1, 4:2 2:2 3, -1 2:1 -5:2, -3 -5:1"),
+ ColourLines("1 4:2, 4:1 2:1 3, -1 2:2 -5:1, -3 -5:2"),
+ ColourLines("1 4:1, 4:2 2:2 3, -1 2:1 -5:1, -3 -5:2"),
+ ColourLines("1 4:2, 4:1 2:2 -5:2, -1 2:1 3, -3 -5:1"),
+ ColourLines("1 4:1, 4:2 2:2 -5:2, -1 2:1 3, -3 -5:1"),
+ ColourLines("1 4:2, 4:1 2:2 -5:1, -1 2:1 3, -3 -5:2"),
+ ColourLines("1 4:1, 4:2 2:2 -5:1, -1 2:1 3, -3 -5:2"),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines("")};
+ static ColourLines f88to66u[12]=
+ {ColourLines("1 2:2 4:2, 4:1 3, -1 -5:2, -3 2:1 -5:1"),
+ ColourLines("1 2:1 4:1, 4:2 3, -1 -5:2, -3 2:2 -5:1"),
+ ColourLines("1 2:2 4:2, 4:1 3, -1 -5:1, -3 2:1 -5:2"),
+ ColourLines("1 2:1 4:1, 4:2 3, -1 -5:1, -3 2:2 -5:2"),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("-1 -5:1, -5:2 2:2 4:1, 1 2:1 -3, 3 4:2"),
+ ColourLines("-1 -5:1, -5:2 2:2 4:2, 1 2:1 -3, 3 4:1"),
+ ColourLines("-1 -5:2, -5:1 2:2 4:1, 1 2:1 -3, 3 4:2"),
+ ColourLines("-1 -5:2, -5:1 2:2 4:2, 1 2:1 -3, 3 4:1")};
+ static ColourLines f88to66s[12]=
+ {ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("1 3 4:2, 4:1 -5:2, -1 2, -2 -3 -5:1"),
+ ColourLines("1 3 4:1, 4:2 -5:2, -1 2, -2 -3 -5:1"),
+ ColourLines("1 3 4:2, 4:1 -5:1, -1 2, -2 -3 -5:2"),
+ ColourLines("1 3 4:1, 4:2 -5:1, -1 2, -2 -3 -5:2"),
+ ColourLines("-1 -3 -5:1, -5:2 4:1, 1 -2, 2 3 4:2"),
+ ColourLines("-1 -3 -5:1, -5:2 4:2, 1 -2, 2 3 4:1"),
+ ColourLines("-1 -3 -5:2, -5:1 4:1, 1 -2, 2 3 4:2"),
+ ColourLines("-1 -3 -5:2, -5:1 4:2, 1 -2, 2 3 4:1")};
+ if(current.channelType == HPDiagram::sChannel)
+ sel.insert(1., &f88to66s[flow_]);
+ else if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second) {
+ sel.insert(1., &f88to66t[flow_]);
+ }
+ else {
+ sel.insert(1., &f88to66u[flow_]);
+ }
+ }
+ break;
+ case Colour33to61:
+ static ColourLines f33to61t[2]
+ ={ColourLines("1 4:1, 3 2 4:2"),
+ ColourLines("1 4:2, 3 2 4:1")};
+ static ColourLines f33to61u[2]
+ ={ColourLines("1 2 4:1, 3 4:2"),
+ ColourLines("1 2 4:2, 3 4:1")};
+ if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f33to61t[flow_]);
+ else
+ sel.insert(1., &f33to61u[flow_]);
+ }
+ else
+ assert(false);
+ break;
+ case Colour33to16:
+ static ColourLines f33to16t[2]
+ ={ColourLines("1 2 5:1, 3 5:2"),
+ ColourLines("1 2 5:2, 3 5:1")};
+ static ColourLines f33to16u[2]
+ ={ColourLines("1 5:1, 3 2 5:2"),
+ ColourLines("1 5:2, 3 2 5:1")};
+ if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f33to16t[flow_]);
+ else
+ sel.insert(1., &f33to16u[flow_]);
+ }
+ else
+ assert(false);
+ break;
+ case Colour3bar3barto6bar1:
+ static ColourLines f3bar3barto6bar1t[2]
+ ={ColourLines("-1 -4:1, -3 -2 -4:2"),
+ ColourLines("-1 -4:2, -3 -2 -4:1")};
+ static ColourLines f3bar3barto6bar1u[2]
+ ={ColourLines("-1 -2 -4:1, -3 -4:2"),
+ ColourLines("-1 -2 -4:2, -3 -4:1")};
+ if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f3bar3barto6bar1t[flow_]);
+ else
+ sel.insert(1., &f3bar3barto6bar1u[flow_]);
+ }
+ break;
+ case Colour3bar3barto16bar:
+ static ColourLines f3bar3barto16bart[2]
+ ={ColourLines("-1 -2 -5:1, -3 -5:2"),
+ ColourLines("-1 -2 -5:2, -3 -5:1")};
+ static ColourLines f3bar3barto16baru[2]
+ ={ColourLines("-1 -5:1, -3 -2 -5:2"),
+ ColourLines("-1 -5:2, -3 -2 -5:1")};
+ if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f3bar3barto16bart[flow_]);
+ else
+ sel.insert(1., &f3bar3barto16baru[flow_]);
+ }
+ break;
+ case Colour38to3bar6:
+ static ColourLines f38to3bar6t[8]
+ ={ColourLines("1 2:1 -3, -4 2:2 5:1, 3 5:2"),
+ ColourLines("1 2:1 -3, -4 2:2 5:2, 3 5:1"),
+ ColourLines("1 2:1 5:1, -4 2:2 -3, 3 5:2"),
+ ColourLines("1 2:1 5:2, -4 2:2 -3, 3 5:1"),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines("")};
+ static ColourLines f38to3bar6u[8]
+ ={ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("1 5:1, 3 2 5:2, -4 -3"),
+ ColourLines("1 5:2, 3 2 5:1, -4 -3"),
+ ColourLines(""),ColourLines("")};
+ static ColourLines f38to3bar6s[8]
+ ={ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("1 -2, 2 3 5:1, -4 5:2"),
+ ColourLines("1 -2, 2 3 5:2, -4 5:1")};
+ if(current.channelType == HPDiagram::sChannel)
+ sel.insert(1., &f38to3bar6s[flow_]);
+ else if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f38to3bar6t[flow_]);
+ else
+ sel.insert(1., &f38to3bar6u[flow_]);
+ }
+ break;
+ case Colour38to63bar:
+ static ColourLines f38to63baru[8]
+ ={ColourLines("1 2:1 -3, -5 2:2 4:1, 3 4:2"),
+ ColourLines("1 2:1 -3, -5 2:2 4:2, 3 4:1"),
+ ColourLines("1 2:1 4:1, -5 2:2 -3, 3 4:2"),
+ ColourLines("1 2:1 4:2, -5 2:2 -3, 3 4:1"),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines("")};
+ static ColourLines f38to63bart[8]
+ ={ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("1 4:1, 3 2 4:2, -5 -3"),
+ ColourLines("1 4:2, 3 2 4:1, -5 -3"),
+ ColourLines(""),ColourLines("")};
+ static ColourLines f38to63bars[8]
+ ={ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines(""),ColourLines(""),
+ ColourLines("1 -2, 2 3 4:1, -5 4:2"),
+ ColourLines("1 -2, 2 3 4:2, -5 4:1")};
+ if(current.channelType == HPDiagram::sChannel)
+ sel.insert(1., &f38to63bars[flow_]);
+ else if(current.channelType == HPDiagram::tChannel) {
+ if(current.ordered.second)
+ sel.insert(1., &f38to63bart[flow_]);
+ else
+ sel.insert(1., &f38to63baru[flow_]);
+ }
+ break;
default:
assert(false);
}
return sel;
}
double GeneralHardME::
selectColourFlow(vector<double> & flow,vector<double> & me,
double average) const {
// spin average
double output = 0.25*average;
// special for beam polarization
tcPolarizedBeamPDPtr beam[2] =
{dynamic_ptr_cast<tcPolarizedBeamPDPtr>(mePartonData()[0]),
dynamic_ptr_cast<tcPolarizedBeamPDPtr>(mePartonData()[1])};
if( beam[0] || beam[1] ) {
RhoDMatrix rho[2] =
{beam[0] ? beam[0]->rhoMatrix() : RhoDMatrix(mePartonData()[0]->iSpin()),
beam[1] ? beam[1]->rhoMatrix() : RhoDMatrix(mePartonData()[1]->iSpin())};
for(unsigned int ix = 0;ix<numberOfFlows();++ix)
flow[ix] = flowME_[ix].average(rho[0],rho[1]);
for(unsigned int ix = 0;ix<numberOfDiags();++ix)
me [ix] = diagramME_[ix].average(rho[0],rho[1]);
output = 0.;
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
output += real(getColourFactors()[ii][ij]*
flowME_[ii].average(flowME_[ij],rho[0],rho[1]));
// correction for photons and gluons
if(mePartonData()[0]->id()==ParticleID::g ||
mePartonData()[0]->id()==ParticleID::gamma) output *= 1.5;
if(mePartonData()[1]->id()==ParticleID::g ||
mePartonData()[1]->id()==ParticleID::gamma) output *= 1.5;
}
// select the colour flow
double maxWgt = UseRandom::rnd()*std::accumulate(flow.begin(),flow.end(),0.);
flow_ = flow.size();
for(unsigned int ix=0;ix<flow.size();++ix) {
if(flow[ix]>=maxWgt) {
flow_=ix;
break;
}
maxWgt -= flow[ix];
}
assert(flow_<flow.size());
// select the diagram
for(unsigned int ix=0;ix<numberOfDiags();++ix) {
const HPDiagram & current = getProcessInfo()[ix];
bool found=false;
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
if(current.colourFlow[iy].first==flow_) {
me[ix] *= sqr(current.colourFlow[iy].second);
found = true;
}
}
// set to zero if four point diagram or doesn't contribute to colour flow
if(!found || current.channelType == HPDiagram::fourPoint) me[ix]=0.;
}
maxWgt = UseRandom::rnd()*std::accumulate(me.begin(),me.end(),0.);
for(unsigned int ix=0;ix<me.size();++ix) {
if(me[ix]>maxWgt) {
diagram_=ix;
break;
}
maxWgt -= me[ix];
}
// colour factors
output /= max(1,abs(int(mePartonData()[0]->iColour())));
output /= max(1,abs(int(mePartonData()[1]->iColour())));
// identical particle factor
output *= mePartonData()[2]->id() == mePartonData()[3]->id() ? 0.5 : 1;
// return the answer
return output;
}
void GeneralHardME::doinitrun() {
HwMEBase::doinitrun();
for(unsigned int ix=0;ix<diagrams_.size();++ix) {
diagrams_[ix].vertices.first ->initrun();
diagrams_[ix].vertices.second->initrun();
}
}
diff --git a/MatrixElement/General/GeneralHardME.h b/MatrixElement/General/GeneralHardME.h
--- a/MatrixElement/General/GeneralHardME.h
+++ b/MatrixElement/General/GeneralHardME.h
@@ -1,501 +1,507 @@
// -*- C++ -*-
//
// GeneralHardME.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_GeneralHardME_H
#define HERWIG_GeneralHardME_H
//
// This is the declaration of the GeneralHardME class.
//
#include "Herwig++/MatrixElement/HwMEBase.h"
#include "ThePEG/Utilities/Exception.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Models/General/HPDiagram.h"
#include "Herwig++/MatrixElement/ProductionMatrixElement.h"
#include "Herwig++/MatrixElement/HardVertex.h"
#include "ThePEG/EventRecord/SpinInfo.h"
#include "ThePEG/PDF/PolarizedBeamParticleData.h"
#include "GeneralHardME.fh"
namespace Herwig {
using namespace ThePEG;
using Helicity::VertexBasePtr;
/**
* This defines the GeneralHardME class that is designed to serve as a
* base class for matrix elements of specific spin structures when those
* structures are created by a a general model, i.e. a SUSY production
* ME. It stores a vector of diagram structures that contain the required
* to calculate the matrix element.
*
* @see HwMEBase
*/
class GeneralHardME: public HwMEBase {
public:
/**
* Convenient typedef for size_type of HPDiagram vector
*/
typedef vector<HPDiagram>::size_type HPCount;
/**
* Enum for the possible colour structures
*/
enum ColourStructure {UNDEFINED,
- Colour11to11,Colour11to33bar,Colour11to88,
- Colour33to33,Colour33barto11,Colour33barto33bar,
- Colour33barto18,Colour33barto81,Colour33barto88,
- Colour38to13,Colour38to31,
- Colour38to83,Colour38to38,
- Colour3bar3barto3bar3bar,
- Colour3bar8to13bar,Colour3bar8to3bar1,
- Colour3bar8to83bar,Colour3bar8to3bar8,
- Colour88to11,Colour88to33bar,Colour88to88,
- Colour88to18,Colour88to81};
+ Colour11to11,Colour11to33bar,Colour11to88,
+ Colour33to33,Colour33barto11,Colour33barto33bar,
+ Colour33barto66bar, Colour33barto6bar6,
+ Colour33to61, Colour3bar3barto6bar1,
+ Colour33to16, Colour3bar3barto16bar,
+ Colour38to3bar6, Colour38to63bar,
+ Colour33barto18,Colour33barto81,Colour33barto88,
+ Colour38to13,Colour38to31,
+ Colour38to83,Colour38to38,
+ Colour3bar3barto3bar3bar,
+ Colour3bar8to13bar,Colour3bar8to3bar1,
+ Colour3bar8to83bar,Colour3bar8to3bar8,
+ Colour88to11,Colour88to33bar,
+ Colour88to66bar,Colour88to88,
+ Colour88to18,Colour88to81};
public:
/**
* The default constructor.
*/
GeneralHardME();
public:
/** @name Virtual functions required by the MEBase class. */
//@{
/**
* Return the order in \f$\alpha_S\f$ in which this matrix
* element is given.
*/
virtual unsigned int orderInAlphaS() const;
/**
* Return the order in \f$\alpha_{EW}\f$ in which this matrix
* element is given.
*/
virtual unsigned int orderInAlphaEW() const;
/**
* The matrix element for the kinematical configuration
* previously provided by the last call to setKinematics(), suitably
* scaled by sHat() to give a dimension-less number.
* @return the matrix element scaled with sHat() to give a
* dimensionless number.
*/
virtual double me2() const = 0;
/**
* Return the scale associated with the last set phase space point.
*/
virtual Energy2 scale() const {
if(scaleChoice_==0) {
return scaleFactor_*sHat();
}
else {
assert( scaleChoice_== 1 );
- Energy2 t = 0.5*(tHat()-meMomenta()[2].mass2());
- Energy2 u = 0.5*(uHat()-meMomenta()[3].mass2());
+ Energy2 mbar = 0.5*(meMomenta()[2].mass2()+meMomenta()[3].mass2());
+ Energy2 t = 0.5*(tHat()-mbar);
+ Energy2 u = 0.5*(uHat()-mbar);
Energy2 s = 0.5*sHat();
return scaleFactor_*4.*s*t*u/(s*s+t*t+u*u);
}
}
/**
* Add all possible diagrams with the add() function.
*/
virtual void getDiagrams() const;
/**
* Get diagram selector. With the information previously supplied with the
* setKinematics method, a derived class may optionally
* override this method to weight the given diagrams with their
* (although certainly not physical) relative probabilities.
* @param dv the diagrams to be weighted.
* @return a Selector relating the given diagrams to their weights.
*/
virtual Selector<DiagramIndex>
diagrams(const DiagramVector & dv) const;
/**
* Return a Selector with possible colour geometries for the selected
* diagram weighted by their relative probabilities.
* @param diag the diagram chosen.
* @return the possible colour geometries weighted by their
* relative probabilities.
*/
virtual Selector<const ColourLines *>
colourGeometries(tcDiagPtr diag) const;
//@}
/**
* Set the diagrams and matrix of colour factors.
* @param process vector of MEDiagram with information that
* will allow the diagrams to be created in the specific matrix element
* @param colour The colour structure for the process
* @param debug Whether to compare the numerical answer to an analytical
* formula (This is only stored for certain processes. It is intended
* for quick checks of the matrix elements).
* @param scaleOption The option of what scale to use
* @param scaleFactor The prefactor for the scale
*/
void setProcessInfo(const vector<HPDiagram> & process,
ColourStructure colour, bool debug,
unsigned int scaleOption,
double scaleFactor);
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 Standard Interfaced functions. */
//@{
/**
* Initialize this object. Called in the run phase just before
* a run begins.
*/
virtual void doinitrun();
//@}
protected:
/**
* A debugging function to test the value of me2 against an
* analytic function. This is to be overidden in an inheriting class.
*/
virtual void debug(double ) const {}
protected:
/**
* Access the HPDiagrams that store the required information
* to create the diagrams
*/
const vector<HPDiagram> & getProcessInfo() const {
return diagrams_;
}
/**
* Return the incoming pair
* @return Pair of particle ids for the incoming particles
*/
pair<long, long> getIncoming() const {
return incoming_;
}
/**
* Return the outgoing pair
* @return Pair of particle ids for the outgoing particles
*/
pair<long, long> getOutgoing() const {
return outgoing_;
}
/**
* Return the matrix of colour factors
*/
const vector<DVector> & getColourFactors() const {
return colour_;
}
/**
* Get the number of diagrams in this process
*/
HPCount numberOfDiags() const {
return numberOfDiagrams_;
}
/**
* Access number of colour flows
*/
size_t numberOfFlows() const {
return numberOfFlows_;
}
/**
* Whether to print the debug information
*/
bool debugME() const {
return debug_;
}
/**
* Set/Get Info on the selected diagram and colour flow
*/
//@{
/**
* Colour flow
*/
unsigned int colourFlow() const {return flow_;}
/**
* Colour flow
*/
void colourFlow(unsigned int flow) const {flow_=flow;}
/**
* Diagram
*/
unsigned int diagram() const {return diagram_;}
/**
* Diagram
*/
void diagram(unsigned int diag) const {diagram_=diag;}
//@}
/**
* Calculate weight and select colour flow
*/
double selectColourFlow(vector<double> & flow,
vector<double> & me,double average) const;
/**
* Access to the colour flow matrix element
*/
vector<ProductionMatrixElement> & flowME() const {
return flowME_;
}
/**
* Access to the diagram matrix element
*/
vector<ProductionMatrixElement> & diagramME() const {
return diagramME_;
}
/**
* Access to the colour structure
*/
ColourStructure colour() const {return colourStructure_;}
/**
* Extract the paricles from the subprocess
*/
ParticleVector hardParticles(tSubProPtr subp) {
ParticleVector output(4);
output[0] = subp->incoming().first;
output[1] = subp->incoming().second;
output[2] = subp->outgoing()[0];
output[3] = subp->outgoing()[1];
//ensure particle ordering is the same as it was when
//the diagrams were created
if( output[0]->id() != getIncoming().first )
swap(output[0], output[1]);
if( output[2]->id() != getOutgoing().first )
swap(output[2], output[3]);
// return answer
return output;
}
/**
* Set the rescaled momenta
*/
void setRescaledMomenta(const ParticleVector & external) {
cPDVector data(4);
vector<Lorentz5Momentum> momenta(4);
for( size_t i = 0; i < 4; ++i ) {
data[i] = external[i]->dataPtr();
momenta[i] = external[i]->momentum();
}
rescaleMomenta(momenta, data);
}
/**
* Create the vertes
*/
void createVertex(ProductionMatrixElement & me,
ParticleVector & external) {
HardVertexPtr hardvertex = new_ptr(HardVertex());
hardvertex->ME(me);
for(ParticleVector::size_type i = 0; i < 4; ++i) {
tSpinPtr spin = external[i]->spinInfo();
if(i<2) {
tcPolarizedBeamPDPtr beam =
dynamic_ptr_cast<tcPolarizedBeamPDPtr>(external[i]->dataPtr());
if(beam) spin->rhoMatrix() = beam->rhoMatrix();
}
spin->productionVertex(hardvertex);
}
}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is an abstract class with persistent data.
*/
static AbstractClassDescription<GeneralHardME> initGeneralHardME;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
GeneralHardME & operator=(const GeneralHardME &);
private:
/**
* External particles
*/
//@{
/**
* Store incoming particles
*/
pair<long, long> incoming_;
/**
* Store the outgoing particles
*/
pair<long, long> outgoing_;
//@}
/**
* Diagrams
*/
//@{
/**
* Store all diagrams as a vector of structures
*/
vector<HPDiagram> diagrams_;
/**
* Store the number of diagrams for fast retrieval
*/
HPCount numberOfDiagrams_;
//@}
/**
* Colour information
*/
//@{
/**
* The colour structure
*/
ColourStructure colourStructure_;
/**
* Store colour factors for ME calc.
*/
vector<DVector> colour_;
/**
* The number of colourflows.
*/
unsigned int numberOfFlows_;
//@}
/**
* Whether to test the value of me2 against the analytical function
*/
bool debug_;
/**
* The scale chocie
*/
unsigned int scaleChoice_;
/**
* The scale factor
*/
double scaleFactor_;
/**
* Info on the selected diagram and colour flow
*/
//@{
/**
* Colour flow
*/
mutable unsigned int flow_;
/**
* Diagram
*/
mutable unsigned int diagram_;
//@}
/**
* Storage of the matrix elements
*/
//@{
/**
* Matrix elements for the different colour flows
*/
mutable vector<ProductionMatrixElement> flowME_;
/**
* Matrix elements for the different Feynman diagrams
*/
mutable vector<ProductionMatrixElement> diagramME_;
//@}
};
/** Exception class to indicate a problem has occurred with setting
up to matrix element.*/
class MEException : public Exception {};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of GeneralHardME. */
template <>
struct BaseClassTrait<Herwig::GeneralHardME,1> {
/** Typedef of the first base class of GeneralHardME. */
typedef Herwig::HwMEBase NthBase;
};
/** This template specialization informs ThePEG about the name of
* the GeneralHardME class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::GeneralHardME>
: public ClassTraitsBase<Herwig::GeneralHardME> {
/** Return a platform-independent class name */
static string className() { return "Herwig::GeneralHardME"; }
};
/** @endcond */
}
#endif /* HERWIG_GeneralHardME_H */
diff --git a/MatrixElement/General/MEff2ff.cc b/MatrixElement/General/MEff2ff.cc
--- a/MatrixElement/General/MEff2ff.cc
+++ b/MatrixElement/General/MEff2ff.cc
@@ -1,810 +1,719 @@
// -*- C++ -*-
//
// MEff2ff.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2ff class.
//
#include "MEff2ff.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::VectorWaveFunction;
using ThePEG::Helicity::ScalarWaveFunction;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEff2ff::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
tensor_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1Half, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1Half, PDT::Spin1Half));
for(size_t ix = 0;ix < numberOfDiags(); ++ix) {
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(offshell->iSpin() == PDT::Spin0) {
AbstractFFSVertexPtr vert1 = dynamic_ptr_cast<AbstractFFSVertexPtr>
(current.vertices.first);
AbstractFFSVertexPtr vert2 = dynamic_ptr_cast<AbstractFFSVertexPtr>
(current.vertices.second);
scalar_[ix] = make_pair(vert1, vert2);
}
else if(offshell->iSpin() == PDT::Spin1) {
AbstractFFVVertexPtr vert1 = dynamic_ptr_cast<AbstractFFVVertexPtr>
(current.vertices.first);
AbstractFFVVertexPtr vert2 = dynamic_ptr_cast<AbstractFFVVertexPtr>
(current.vertices.second);
vector_[ix] = make_pair(vert1, vert2);
}
else if(offshell->iSpin() == PDT::Spin2) {
AbstractFFTVertexPtr vert1 = dynamic_ptr_cast<AbstractFFTVertexPtr>
(current.vertices.first);
AbstractFFTVertexPtr vert2 = dynamic_ptr_cast<AbstractFFTVertexPtr>
(current.vertices.second);
tensor_[ix] = make_pair(vert1, vert2);
}
}
}
void MEff2ff::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1Half, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1Half, PDT::Spin1Half));
}
double MEff2ff::me2() const {
- tcPDPtr ina(mePartonData()[0]), inb(mePartonData()[1]),
- outa(mePartonData()[2]), outb(mePartonData()[3]);
+ tcPDPtr ina (mePartonData()[0]), inb (mePartonData()[1]);
+ tcPDPtr outa(mePartonData()[2]), outb(mePartonData()[3]);
+ for(unsigned int ix=0;ix<4;++ix) {
+ spin_[ix].clear();
+ sbar_[ix].clear();
+ for(unsigned int ih=0;ih<2;++ih) {
+ spin_[ix].push_back(SpinorWaveFunction (rescaledMomenta()[ix],
+ mePartonData()[ix],
+ ih, ix<2 ? incoming : outgoing));
+ sbar_[ix].push_back(SpinorBarWaveFunction(rescaledMomenta()[ix],
+ mePartonData()[ix],
+ ih, ix<2 ? incoming : outgoing));
+ }
+ }
bool majorana(false);
if( (!outa->CC() && !outb->CC() ) ||
((abs(outa->id()) > 1000000 && abs(outa->id()) < 2000000) &&
(abs(outb->id()) > 1000000 && abs(outb->id()) < 2000000)) )
majorana = true;
-
double full_me(0.);
- vector<SpinorWaveFunction> spA(2), spB(2);
- vector<SpinorBarWaveFunction> spbA(2), spbB(2);
if( ina->id() > 0 && inb->id() < 0) {
- for(unsigned int ih = 0; ih < 2; ++ih) {
- spA[ih] = SpinorWaveFunction(rescaledMomenta()[0], ina, ih,
- incoming);
- spbA[ih] = SpinorBarWaveFunction(rescaledMomenta()[1], inb, ih,
- incoming);
- spB[ih] = SpinorWaveFunction(rescaledMomenta()[3], outb, ih, outgoing);
- spbB[ih] = SpinorBarWaveFunction(rescaledMomenta()[2], outa, ih, outgoing);
- }
- if(majorana) {
- vector<SpinorWaveFunction> spC(2);
- vector<SpinorBarWaveFunction> spbC(2);
- for(unsigned int ih = 0; ih < 2; ++ih) {
- spC[ih] = SpinorWaveFunction(rescaledMomenta()[2], outa, ih, outgoing);
- spbC[ih] = SpinorBarWaveFunction(rescaledMomenta()[3], outb, ih, outgoing);
- }
- ffb2mfmfHeME(spA, spbA, spbB, spB, spC, spbC, full_me,true);
- SpinorWaveFunction spOut2(rescaledMomenta()[2], outa, outgoing);
- SpinorBarWaveFunction spbarOut2(rescaledMomenta()[3], outb, outgoing);
- }
- else {
- ffb2ffbHeME(spA, spbA, spbB, spB, full_me,true);
- }
+ if(majorana) ffb2mfmfHeME(full_me,true);
+ else ffb2ffbHeME (full_me,true);
}
- else if( ina->id() > 0 && inb->id() > 0 ) {
- SpinorVector spA(2), spB(2);
- SpinorBarVector spbA(2), spbB(2);
- for(unsigned int ih = 0; ih < 2; ++ih) {
- spA[ih] = SpinorWaveFunction(rescaledMomenta()[0], ina, ih,
- incoming);
- spB[ih] = SpinorWaveFunction(rescaledMomenta()[1], inb, ih,
- incoming);
- spbA[ih] = SpinorBarWaveFunction(rescaledMomenta()[2], outa, ih,
- outgoing);
- spbB[ih] = SpinorBarWaveFunction(rescaledMomenta()[3], outb, ih,
- outgoing);
- }
- ff2ffHeME(spA, spB, spbA, spbB, full_me,true);
- }
- else if( ina->id() < 0 && inb->id() < 0 ) {
- SpinorVector spA(2), spB(2);
- SpinorBarVector spbA(2), spbB(2);
- for(unsigned int ih = 0; ih < 2; ++ih) {
- spbA[ih] = SpinorBarWaveFunction(rescaledMomenta()[0], ina, ih,
- incoming);
- spbB[ih] = SpinorBarWaveFunction(rescaledMomenta()[1], inb, ih,
- incoming);
- spA[ih] = SpinorWaveFunction(rescaledMomenta()[2], outa, ih,
- outgoing);
- spB[ih] = SpinorWaveFunction(rescaledMomenta()[3], outb, ih,
- outgoing);
- }
- fbfb2fbfbHeME(spbA, spbB, spA, spB, full_me,true);
- }
+ else if( ina->id() > 0 && inb->id() > 0 )
+ ff2ffHeME(full_me,true);
+ else if( ina->id() < 0 && inb->id() < 0 )
+ fbfb2fbfbHeME(full_me,true);
else
throw MEException()
<< "MEff2ff::me2() - Cannot find correct function to deal with process "
<< ina->PDGName() << "," << inb->PDGName() << "->" << outa->PDGName()
<< "," << outb->PDGName() << "\n";
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
return full_me;
}
ProductionMatrixElement
-MEff2ff::ffb2ffbHeME(SpinorVector & fin, SpinorBarVector & fbin,
- SpinorBarVector & fbout, SpinorVector & fout,
- double & me2, bool first) const {
- const Energy2 m2(scale());
+MEff2ff::ffb2ffbHeME(double & me2, bool first) const {
+ const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ifhel1 = 0; ifhel1 < 2; ++ifhel1) {
for(unsigned int ifhel2 = 0; ifhel2 < 2; ++ifhel2) {
for(unsigned int ofhel1 = 0; ofhel1 < 2; ++ofhel1) {
for(unsigned int ofhel2 = 0; ofhel2 < 2; ++ofhel2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2], fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2], sbar_[1][ifhel2]);
diag = scalar_[ix].first->
- evaluate(m2, fin[ifhel1], fbout[ofhel1], interS);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2], fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2], sbar_[1][ifhel2]);
diag = -vector_[ix].first->
- evaluate(m2, fin[ifhel1], fbout[ofhel1], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interV);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2], fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2], sbar_[1][ifhel2]);
diag = tensor_[ix].first->
- evaluate(m2, fin[ifhel1], fbout[ofhel1], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interT);
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = scalar_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interS);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = vector_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interV);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = tensor_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interT);
}
}
else assert(false);
me[ix] += norm(diag);
diagramME()[ix](ifhel1, ifhel2, ofhel1, ofhel2) = diag;
//Compute flows
for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifhel1, ifhel2, ofhel1, ofhel2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii) {
for(size_t ij = 0; ij < numberOfFlows(); ++ij) {
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
}
}
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
ProductionMatrixElement
-MEff2ff:: ff2ffHeME(SpinorVector & fin, SpinorVector & fin2,
- SpinorBarVector & fbout, SpinorBarVector & fbout2,
- double & me2, bool first) const {
+MEff2ff:: ff2ffHeME(double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ifhel1 = 0; ifhel1 < 2; ++ifhel1) {
for(unsigned int ifhel2 = 0; ifhel2 < 2; ++ifhel2) {
for(unsigned int ofhel1 = 0; ofhel1 < 2; ++ofhel1) {
for(unsigned int ofhel2 = 0; ofhel2 < 2; ++ofhel2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout2[ofhel2]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[3][ofhel2]);
diag = scalar_[ix].first->
- evaluate(q2, fin[ifhel1], fbout[ofhel1], interS);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interS);
}
else {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout[ofhel1]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[2][ofhel1]);
diag = scalar_[ix].first->
- evaluate(q2, fin[ifhel1], fbout2[ofhel2], interS);
+ evaluate(q2, spin_[0][ifhel1], sbar_[3][ofhel2], interS);
}
}
else if(offshell->iSpin() == PDT::Spin1) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout2[ofhel2]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[3][ofhel2]);
diag = vector_[ix].first->
- evaluate(q2, fin[ifhel1], fbout[ofhel1], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interV);
}
else {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout[ofhel1]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[2][ofhel1]);
diag = -vector_[ix].first->
- evaluate(q2, fin[ifhel1], fbout2[ofhel2], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[3][ofhel2], interV);
}
}
else if(offshell->iSpin() == PDT::Spin2) {
if(current.ordered.second) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout2[ofhel2]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[3][ofhel2]);
diag = tensor_[ix].first->
- evaluate(q2, fin[ifhel1], fbout[ofhel1], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interT);
}
else {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(q2, 3, offshell,fin2[ifhel2],fbout[ofhel1]);
+ evaluate(q2, 3, offshell,spin_[1][ifhel2],sbar_[2][ofhel1]);
diag = tensor_[ix].first->
- evaluate(q2, fin[ifhel1], fbout2[ofhel2], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[3][ofhel2], interT);
}
}
}
- else assert(false);
+ else if(current.channelType == HPDiagram::sChannel) {
+ if(offshell->iSpin() == PDT::Spin0) {
+ ScalarWaveFunction interS = scalar_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = scalar_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interS);
+ }
+ else if(offshell->iSpin() == PDT::Spin1) {
+ VectorWaveFunction interV = vector_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = vector_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interV);
+ }
+ else if(offshell->iSpin() == PDT::Spin2) {
+ TensorWaveFunction interT = tensor_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = tensor_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interT);
+ }
+ }
+ else
+ assert(false);
me[ix] += norm(diag);
diagramME()[ix](ifhel1, ifhel2, ofhel1, ofhel2) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
- current.colourFlow[iy].second * diag;
+ current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifhel1, ifhel2, ofhel1, ofhel2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
ProductionMatrixElement
-MEff2ff::fbfb2fbfbHeME(SpinorBarVector & fbin, SpinorBarVector & fbin2,
- SpinorVector & fout, SpinorVector & fout2,
- double & me2, bool first) const {
+MEff2ff::fbfb2fbfbHeME(double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ifhel1 = 0; ifhel1 < 2; ++ifhel1) {
for(unsigned int ifhel2 = 0; ifhel2 < 2; ++ifhel2) {
for(unsigned int ofhel1 = 0; ofhel1 < 2; ++ofhel1) {
for(unsigned int ofhel2 = 0; ofhel2 < 2; ++ofhel2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(q2, 3, offshell,fout2[ofhel2],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = scalar_[ix].first->
- evaluate(q2, fout[ofhel1], fbin[ifhel1], interS);
+ evaluate(q2, spin_[2][ofhel1], sbar_[0][ifhel1], interS);
}
else {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(q2, 3, offshell,fout[ofhel1],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = -scalar_[ix].first->
- evaluate(q2, fout2[ofhel2], fbin[ifhel1], interS);
+ evaluate(q2, spin_[3][ofhel2], sbar_[0][ifhel1], interS);
}
}
else if(offshell->iSpin() == PDT::Spin1) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(q2, 3, offshell,fout2[ofhel2],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = vector_[ix].first->
- evaluate(q2, fout[ofhel1], fbin[ifhel1], interV);
+ evaluate(q2, spin_[2][ofhel1], sbar_[0][ifhel1], interV);
}
else {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(q2, 3, offshell,fout[ofhel1],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = -vector_[ix].first->
- evaluate(q2, fout2[ofhel2], fbin[ifhel1], interV);
+ evaluate(q2, spin_[3][ofhel2], sbar_[0][ifhel1], interV);
}
}
else if(offshell->iSpin() == PDT::Spin2) {
if(current.ordered.second) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(q2, 3, offshell,fout2[ofhel2],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = tensor_[ix].first->
- evaluate(q2, fout[ofhel1], fbin[ifhel1], interT);
+ evaluate(q2, spin_[2][ofhel1], sbar_[0][ifhel1], interT);
}
else {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(q2, 3, offshell,fout[ofhel1],fbin2[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = -tensor_[ix].first->
- evaluate(q2, fout2[ofhel2], fbin[ifhel1], interT);
+ evaluate(q2, spin_[3][ofhel2], sbar_[0][ifhel1], interT);
}
}
}
+ else if(current.channelType == HPDiagram::sChannel) {
+ if(offshell->iSpin() == PDT::Spin0) {
+ ScalarWaveFunction interS = scalar_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = scalar_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interS);
+ }
+ else if(offshell->iSpin() == PDT::Spin1) {
+ VectorWaveFunction interV = vector_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = vector_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interV);
+ }
+ else if(offshell->iSpin() == PDT::Spin2) {
+ TensorWaveFunction interT = tensor_[ix].second->
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
+ diag = tensor_[ix].first->
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interT);
+ }
+ }
+ else {
+ assert(false);
+ }
me[ix] += norm(diag);
diagramME()[ix](ifhel1, ifhel2, ofhel1, ofhel2) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifhel1, ifhel2, ofhel1, ofhel2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
ProductionMatrixElement
-MEff2ff::ffb2mfmfHeME(SpinorVector & fin, SpinorBarVector & fbin,
- SpinorBarVector & fbout, SpinorVector & fout,
- SpinorVector & fout2, SpinorBarVector & fbout2,
- double & me2, bool first) const {
- const Energy2 m2(scale());
+MEff2ff::ffb2mfmfHeME(double & me2, bool first) const {
+ const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ifhel1 = 0; ifhel1 < 2; ++ifhel1) {
for(unsigned int ifhel2 = 0; ifhel2 < 2; ++ifhel2) {
for(unsigned int ofhel1 = 0; ofhel1 < 2; ++ofhel1) {
for(unsigned int ofhel2 = 0; ofhel2 < 2; ++ofhel2) {
vector<Complex> flows(numberOfFlows(),0.);
for(size_t ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = scalar_[ix].first->
- evaluate(m2, fin[ifhel1],fbout[ofhel1],interS);
+ evaluate(q2, spin_[0][ifhel1],sbar_[2][ofhel1],interS);
}
else {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(m2, 3, offshell,fout2[ofhel1],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = -scalar_[ix].first->
- evaluate(m2, fin[ifhel1],fbout2[ofhel2],interS);
+ evaluate(q2, spin_[0][ifhel1],sbar_[3][ofhel2],interS);
}
}
else if(offshell->iSpin() == PDT::Spin1) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = vector_[ix].first->
- evaluate(m2, fin[ifhel1], fbout[ofhel1], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interV);
}
else {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(m2, 3, offshell,fout2[ofhel1],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = vector_[ix].first->
- evaluate(m2, fin[ifhel1], fbout2[ofhel2], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[3][ofhel2], interV);
}
}
else if(offshell->iSpin() == PDT::Spin2) {
if(current.ordered.second) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(m2, 3, offshell,fout[ofhel2],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[3][ofhel2],sbar_[1][ifhel2]);
diag = tensor_[ix].first->
- evaluate(m2, fin[ifhel1], fbout[ofhel1], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[2][ofhel1], interT);
}
else {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(m2, 3, offshell,fout2[ofhel1],fbin[ifhel2]);
+ evaluate(q2, 3, offshell,spin_[2][ofhel1],sbar_[1][ifhel2]);
diag = tensor_[ix].first->
- evaluate(m2, fin[ifhel1], fbout2[ofhel2], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[3][ofhel2], interT);
}
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = scalar_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interS);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = vector_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interV);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interV);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].second->
- evaluate(m2, 1, offshell,fout[ofhel2],fbout[ofhel1]);
+ evaluate(q2, 1, offshell,spin_[3][ofhel2],sbar_[2][ofhel1]);
diag = tensor_[ix].first->
- evaluate(m2, fin[ifhel1], fbin[ifhel2], interT);
+ evaluate(q2, spin_[0][ifhel1], sbar_[1][ifhel2], interT);
}
}
else assert(false);
me[ix] += norm(diag);
diagramME()[ix](ifhel1, ifhel2, ofhel1, ofhel2) = diag;
//Compute flows
for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifhel1, ifhel2, ofhel1, ofhel2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2ff::constructVertex(tSubProPtr subp) {
// Hard process external particles
ParticleVector hardpro = hardParticles(subp);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(hardpro);
+ for(unsigned int ix=0;ix<4;++ix) {
+ spin_[ix].clear();
+ sbar_[ix].clear();
+ for(unsigned int ih=0;ih<2;++ih) {
+ SpinorWaveFunction (spin_[ix],hardpro[ix],
+ ix<2 ? incoming : outgoing,ix>1);
+ SpinorBarWaveFunction(sbar_[ix],hardpro[ix],
+ ix<2 ? incoming : outgoing,ix>1);
+ }
+ }
double dummy(0.);
//pick which process we are doing
if( hardpro[0]->id() > 0) {
- //common spinors
- SpinorVector spA;
- SpinorBarVector spbB;
- SpinorWaveFunction (spA, hardpro[0], incoming, false);
- SpinorBarWaveFunction(spbB, hardpro[2], outgoing,true);
- //ME spinors
- SpinorWaveFunction sp1r (rescaledMomenta()[0],
- hardpro[0]->dataPtr(), incoming);
- SpinorBarWaveFunction spb2r(rescaledMomenta()[2],
- hardpro[2]->dataPtr(), outgoing);
//majorana
- if(!hardpro[2]->dataPtr()->CC() || hardpro[2]->id() == 1000024 ||
- hardpro[2]->id() == 1000037) {
- SpinorVector spB, spC;
- SpinorBarVector spbA, spbC;
- SpinorBarWaveFunction(spbA, hardpro[1], incoming, false);
- SpinorWaveFunction (spB, hardpro[3], outgoing, true);
- //ME spinors
- SpinorBarWaveFunction spb1r(rescaledMomenta()[1],
- hardpro[1]->dataPtr(), incoming);
- SpinorWaveFunction sp2r (rescaledMomenta()[3],
- hardpro[3]->dataPtr(), outgoing);
- for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
- sp1r.reset(ihel);
- spA[ihel] = sp1r;
- spb1r.reset(ihel);
- spbA[ihel] = spb1r;
- spb2r.reset(ihel);
- spbB[ihel] = spb2r;
- sp2r.reset(ihel);
- spB[ihel] = sp2r;
- //extra spinors
- spC.push_back(SpinorWaveFunction(-spbB[ihel].momentum(),
- spbB[ihel].particle(),
- spbB[ihel].wave().bar().conjugate(),
- spbB[ihel].direction()));
- spbC.push_back(SpinorBarWaveFunction(-spB[ihel].momentum(),
- spB[ihel].particle(),
- spB[ihel].wave().bar().conjugate(),
- spB[ihel].direction()));
- }
- ProductionMatrixElement prodME = ffb2mfmfHeME(spA, spbA, spbB, spB, spC,
- spbC, dummy,false);
+ if( (!hardpro[2]->dataPtr()->CC() && !hardpro[3]->dataPtr()->CC() ) ||
+ ((abs(hardpro[2]->id()) > 1000000 && abs(hardpro[2]->id()) < 2000000) &&
+ (abs(hardpro[3]->id()) > 1000000 && abs(hardpro[3]->id()) < 2000000)) ) {
+ ProductionMatrixElement prodME = ffb2mfmfHeME(dummy,false);
createVertex(prodME,hardpro);
}
//ffbar->ffbar
else if( hardpro[1]->id() < 0 ) {
- SpinorVector spB;
- SpinorBarVector spbA;
- SpinorBarWaveFunction(spbA, hardpro[1], incoming, false);
- SpinorWaveFunction (spB , hardpro[3], outgoing, true);
- //ME spinors
- SpinorBarWaveFunction spb1r(rescaledMomenta()[1],
- hardpro[1]->dataPtr(), incoming);
- SpinorWaveFunction sp2r(rescaledMomenta()[3],
- hardpro[3]->dataPtr(), outgoing);
- for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
- sp1r.reset(ihel);
- spA[ihel] = sp1r;
- spb1r.reset(ihel);
- spbA[ihel] = spb1r;
- spb2r.reset(ihel);
- spbB[ihel] = spb2r;
- sp2r.reset(ihel);
- spB[ihel] = sp2r;
- }
- ProductionMatrixElement prodME = ffb2ffbHeME(spA, spbA, spbB, spB,
- dummy,false);
+ ProductionMatrixElement prodME = ffb2ffbHeME(dummy,false);
createVertex(prodME,hardpro);
}
//ff2ff
else {
- SpinorVector spB;
- SpinorBarVector spbA;
- SpinorWaveFunction(spB,hardpro[1],incoming, false);
- SpinorBarWaveFunction(spbA, hardpro[3], outgoing, true);
- SpinorWaveFunction sp2r(rescaledMomenta()[1],
- hardpro[1]->dataPtr(), incoming);
- SpinorBarWaveFunction spb1r(rescaledMomenta()[3],
- hardpro[3]->dataPtr(), outgoing);
- for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
- sp1r.reset(ihel);
- spA[ihel] = sp1r;
- sp2r.reset(ihel);
- spB[ihel] = sp2r;
- spb2r.reset(ihel);
- spbB[ihel] = spb2r;
- spb1r.reset(ihel);
- spbA[ihel] = spb1r;
-
- }
- ProductionMatrixElement prodME = ff2ffHeME(spA, spB, spbB, spbA,
- dummy,false);
+ ProductionMatrixElement prodME = ff2ffHeME(dummy,false);
createVertex(prodME,hardpro);
}
}
//fbarfbar->fbarfbar
else {
- SpinorVector spA, spB;
- SpinorBarVector spbA, spbB;
- SpinorBarWaveFunction(spbA,hardpro[0],incoming, false);
- SpinorBarWaveFunction(spbB,hardpro[1],incoming, false);
- SpinorWaveFunction(spA, hardpro[2], outgoing, true);
- SpinorWaveFunction(spB, hardpro[3], outgoing, true);
- //ME spinors
- SpinorBarWaveFunction spb1r(rescaledMomenta()[0],
- hardpro[0]->dataPtr(), incoming);
- SpinorBarWaveFunction spb2r(rescaledMomenta()[1],
- hardpro[1]->dataPtr(), incoming);
- SpinorWaveFunction sp1r (rescaledMomenta()[2],
- hardpro[2]->dataPtr(), outgoing);
- SpinorWaveFunction sp2r (rescaledMomenta()[3],
- hardpro[3]->dataPtr(), outgoing);
- for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
- spb1r.reset(ihel);
- spbA[ihel] = spb1r;
- spb2r.reset(ihel);
- spbB[ihel] = spb2r;
-
- sp1r.reset(ihel);
- spA[ihel] = sp1r;
- sp2r.reset(ihel);
- spB[ihel] = sp2r;
- }
- ProductionMatrixElement prodME = fbfb2fbfbHeME(spbA, spbB, spA, spB,
- dummy,false);
+ ProductionMatrixElement prodME = fbfb2fbfbHeME(dummy,false);
createVertex(prodME,hardpro);
}
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
}
void MEff2ff::persistentOutput(PersistentOStream & os) const {
os << scalar_ << vector_ << tensor_;
}
void MEff2ff::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> vector_ >> tensor_;
}
ClassDescription<MEff2ff> MEff2ff::initMEff2ff;
// Definition of the static class description member.
void MEff2ff::Init() {
static ClassDocumentation<MEff2ff> documentation
("This is the implementation of the matrix element for fermion-"
"antifermion -> fermion-antifermion.");
}
void MEff2ff::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = mePartonData()[0]->id();
long id2 = mePartonData()[1]->id();
long id3 = mePartonData()[2]->id();
long id4 = mePartonData()[3]->id();
long aid1 = abs(mePartonData()[0]->id());
long aid2 = abs(mePartonData()[1]->id());
long aid3 = abs(mePartonData()[2]->id());
long aid4 = abs(mePartonData()[3]->id());
if( (aid1 != 1 && aid1 != 2) || (aid2 != 1 && aid2 != 2) ) return;
double analytic(0.);
if( id3 == id4 && id3 == 1000021 ) {
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
int Nc = sm->Nc();
double Cf = (sqr(Nc) - 1.)/2./Nc;
Energy2 mgo2 = meMomenta()[3].m2();
long squark = (aid1 == 1) ? 1000001 : 1000002;
Energy2 muL2 = sqr(getParticleData(squark)->mass());
Energy2 deltaL = muL2 - mgo2;
Energy2 muR2 = sqr(getParticleData(squark + 1000000)->mass());
Energy2 deltaR = muR2 - mgo2;
Energy2 s(sHat());
Energy2 m3s = meMomenta()[2].m2();
Energy2 m4s = meMomenta()[3].m2();
Energy4 spt2 = uHat()*tHat() - m3s*m4s;
Energy2 t3(tHat() - m3s), u4(uHat() - m4s);
double Cl = 2.*spt2*( (u4*u4 - deltaL*deltaL) + (t3*t3 - deltaL*deltaL)
- (s*s/Nc/Nc) )/s/s/(u4 - deltaL)/(t3 - deltaL);
Cl += deltaL*deltaL*( (1./sqr(t3 - deltaL)) + (1./sqr(u4 - deltaL))
- ( sqr( (1./(t3 - deltaL)) -
(1./(u4 - deltaL)) )/Nc/Nc ) );
double Cr = 2.*spt2*( (u4*u4 - deltaR*deltaR) + (t3*t3 - deltaR*deltaR)
- (s*s/Nc/Nc) )/s/s/(u4 - deltaR)/(t3 - deltaR);
Cr += deltaR*deltaR*( (1./sqr(t3 - deltaR)) + (1./sqr(u4 - deltaR))
- ( sqr( (1./(t3 - deltaR))
- (1./(u4 - deltaR)) )/Nc/Nc ) );
analytic = gs4*Cf*(Cl + Cr)/4.;
}
else if( (aid3 == 5100001 || aid3 == 5100002 ||
aid3 == 6100001 || aid3 == 6100002) &&
(aid4 == 5100001 || aid4 == 5100002 ||
aid4 == 6100001 || aid4 == 6100002) ) {
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
Energy2 s(sHat());
Energy2 mf2 = meMomenta()[2].m2();
Energy2 t3(tHat() - mf2), u4(uHat() - mf2);
Energy4 s2(sqr(s)), t3s(sqr(t3)), u4s(sqr(u4));
bool iflav = (aid2 - aid1 == 0);
int alpha(aid3/1000000), beta(aid4/1000000);
bool oflav = ((aid3 - aid1) % 10 == 0);
if( alpha != beta ) {
if( ( id1 > 0 && id2 > 0) ||
( id1 < 0 && id2 < 0) ) {
if( iflav )
analytic = gs4*( mf2*(2.*s2*s/t3s/u4s - 4.*s/t3/u4)
+ 2.*sqr(s2)/t3s/u4s - 8.*s2/t3/u4 + 5. )/9.;
else
analytic = gs4*( -2.*mf2*(1./t3 + u4/t3s) + 0.5 + 2.*u4s/t3s)/9.;
}
else
analytic = gs4*( 2.*mf2*(1./t3 + u4/t3s) + 5./2. + 4.*u4/t3
+ 2.*u4s/t3s)/9.;
}
else {
if( ( id1 > 0 && id2 > 0) ||
( id1 < 0 && id2 < 0) ) {
if( iflav ) {
analytic = gs4*( mf2*(6.*t3/u4s + 6.*u4/t3s - s/t3/u4)
+ 2.*(3.*t3s/u4s + 3.*u4s/t3s
+ 4.*s2/t3/u4 - 5.) )/27.;
}
else
analytic = 2.*gs4*( -mf2*s/t3s + 0.25 + s2/t3s )/9.;
}
else {
if( iflav ) {
if( oflav )
analytic = gs4*( 2.*mf2*(4./s + s/t3s - 1./t3) + 23./6.+ 2.*s2/t3s
+ 8.*s/3./t3 + 6.*t3/s + 8.*t3s/s2 )/9.;
else
analytic = 4.*gs4*( 2.*mf2/s + (t3s + u4s)/s2)/9.;
}
else
analytic = gs4*(4.*mf2*s/t3s + 5. + 4.*s2/t3s + 8.*s/t3 )/18.;
}
}
if( id3 == id4 ) analytic /= 2.;
}
else return;
double diff = abs(analytic - me2);
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2
<< '\n';
}
}
diff --git a/MatrixElement/General/MEff2ff.h b/MatrixElement/General/MEff2ff.h
--- a/MatrixElement/General/MEff2ff.h
+++ b/MatrixElement/General/MEff2ff.h
@@ -1,282 +1,263 @@
// -*- C++ -*-
//
// MEff2ff.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_MEff2ff_H
#define HERWIG_MEff2ff_H
//
// This is the declaration of the MEff2ff class.
//
#include "GeneralHardME.h"
#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h"
#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h"
#include "Herwig++/MatrixElement/ProductionMatrixElement.h"
#include "ThePEG/Helicity/Vertex/AbstractFFSVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractFFVVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractFFTVertex.h"
namespace Herwig {
using namespace ThePEG;
using Helicity::SpinorWaveFunction;
using Helicity::SpinorBarWaveFunction;
/**
* This is the implementation of the \f$ 2\to 2\f$ matrix element for
* a \f$ \Psi \Psi \to \Psi \Psi\f$ process. It inherits from
* GeneralHardME and implements the appropriate virtual functions.
*
* @see \ref MEff2ffInterfaces "The Interfaces"
* defined for MEff2ff.
* @see GeneralHardME
*/
class MEff2ff: public GeneralHardME {
public:
/** Vector of SpinorWaveFunctions. */
typedef vector<SpinorWaveFunction> SpinorVector;
/** Vector of SpinorBarWaveFunctions. */
typedef vector<SpinorBarWaveFunction> SpinorBarVector;
public:
/**
* The default constructor.
*/
- MEff2ff() : scalar_(0), vector_(0), tensor_(0) {}
+ MEff2ff() : scalar_(0), vector_(0), tensor_(0), spin_(4), sbar_(4)
+ {}
public:
/** @name Virtual functions required by the MEBase class. */
//@{
/**
* The matrix element for the kinematical configuration
* previously provided by the last call to setKinematics(), suitably
* scaled by sHat() to give a dimension-less number.
* @return the matrix element scaled with sHat() to give a
* dimensionless number.
*/
virtual double me2() const;
//@}
private:
/** @name Functions to compute the ProductionMatrixElement. */
//@{
/**
* Compute the matrix element for \f$\Psi\bar{\Psi}\to\Psi\bar{\Psi}\f$
- * @param fin Spinors for first incoming particle
- * @param fbin SpinorBar Wavefunctions for second incoming particle
- * @param fbout SpinorBar Wavefunctions for outgoing particle
- * @param fout Spinors for first outgoing particle
* @param me2 colour averaged, spin summed ME
* @param first Whether or not first call to decide if colour decomposition etc
* should be calculated
* @return ProductionMatrixElement containing results of
* helicity calculations
*/
ProductionMatrixElement
- ffb2ffbHeME(SpinorVector & fin, SpinorBarVector & fbin,
- SpinorBarVector & fbout, SpinorVector & fout,
- double & me2, bool first) const;
+ ffb2ffbHeME(double & me2, bool first) const;
/**
* Compute the matrix element for \f$\Psi\Psi\to\Psi\Psi\f$
- * @param fin Spinors for first incoming particle
- * @param fin2 Spinors for second incoming particle
- * @param fbout SpinorBar for first outgoing particle
- * @param fbout2 SpinorBar Wavefunctions for outgoing particle
+ * @param first Whether or not first call to decide if colour decomposition etc
+ * should be calculated
+ * @return ProductionMatrixElement containing results of
+ * helicity calculations
+ */
+ ProductionMatrixElement ff2ffHeME(double & me2, bool first) const;
+
+ /**
+ * Compute the matrix element for
+ * \f$\bar{\Psi}\bar{\Psi}\to\bar{\Psi}\bar{\Psi}\f$
* @param me2 colour averaged, spin summed ME
* @param first Whether or not first call to decide if colour decomposition etc
* should be calculated
* @return ProductionMatrixElement containing results of
* helicity calculations
*/
- ProductionMatrixElement
- ff2ffHeME(SpinorVector & fin, SpinorVector & fin2,
- SpinorBarVector & fbout, SpinorBarVector & fbout2,
- double & me2, bool first) const;
-
- /**
- * Compute the matrix element for
- * \f$\bar{\Psi}\bar{\Psi}\to\bar{\Psi}\bar{\Psi}\f$
- * @param fbin SpinorBars for first incoming particle
- * @param fbin2 SpinorBars for second incoming particle
- * @param fout Spinors for first outgoing particle
- * @param fout2 Spinors Wavefunctions for outgoing particle
- * @param me2 colour averaged, spin summed ME
- * @param first Whether or not first call to decide if colour decomposition etc
- * should be calculated
- * @return ProductionMatrixElement containing results of
- * helicity calculations
- */
- ProductionMatrixElement
- fbfb2fbfbHeME(SpinorBarVector & fbin, SpinorBarVector & fbin2,
- SpinorVector & fout, SpinorVector & fout2,
- double & me2, bool first) const;
+ ProductionMatrixElement fbfb2fbfbHeME(double & me2, bool first) const;
/**
* Compute the matrix element for \f$\Psi\bar{\Psi}\to\lambda\lambda\f$
- * @param fin Spinors for first incoming particle
- * @param fbin SpinorBar Wavefunctions for second incoming particle
- * @param fbout SpinorBar Wavefunctions for first outgoing particle
- * @param fout Spinors for second outgoing particle
- * @param fout2 Spinor Wavefunctions for first outgoing particle
- * @param fbout2 SpinorBar Wavefunctions for second outgoing particle
* @param me2 colour averaged, spin summed ME
* @param first Whether or not first call to decide if colour decomposition etc
* should be calculated
* @return ProductionMatrixElement containing results of
* helicity calculations
*/
ProductionMatrixElement
- ffb2mfmfHeME(SpinorVector & fin, SpinorBarVector & fbin,
- SpinorBarVector & fbout, SpinorVector & fout,
- SpinorVector & fout2, SpinorBarVector & fbout2,
- double & me2, bool first) const;
+ ffb2mfmfHeME(double & me2, bool first) const;
//@}
/**
* Construct the vertex information for the spin correlations
* @param sub Pointer to the relevent SubProcess
*/
virtual void constructVertex(tSubProPtr sub);
protected:
/**
* A debugging function to test the value of me2 against an
* analytic function.
* @param me2 The value of the \f$ |\bar{\mathcal{M}}|^2 \f$
*/
virtual void debug(double me2) 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 Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
/**
* Initialize this object. Called in the run phase just before
* a run begins.
*/
virtual void doinitrun();
//@}
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is a concrete class with persistent data.
*/
static ClassDescription<MEff2ff> initMEff2ff;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
MEff2ff & operator=(const MEff2ff &);
private:
/**
* Store the vector of FFSVertex pairs
*/
vector<pair<AbstractFFSVertexPtr, AbstractFFSVertexPtr> > scalar_;
/**
* Store the vector of FFVVertex pairs
*/
vector<pair<AbstractFFVVertexPtr, AbstractFFVVertexPtr> > vector_;
/**
* Store the vector of FFTVertex pairs
*/
vector<pair<AbstractFFTVertexPtr, AbstractFFTVertexPtr> > tensor_;
+
+ /**
+ * Spinors
+ */
+ mutable vector<vector<SpinorWaveFunction> > spin_;
+
+ /**
+ * Barred spinors
+ */
+ mutable vector<vector<SpinorBarWaveFunction> > sbar_;
};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of MEff2ff. */
template <>
struct BaseClassTrait<Herwig::MEff2ff,1> {
/** Typedef of the first base class of MEff2ff. */
typedef Herwig::GeneralHardME NthBase;
};
/** This template specialization informs ThePEG about the name of
* the MEff2ff class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::MEff2ff>
: public ClassTraitsBase<Herwig::MEff2ff> {
/** Return a platform-independent class name */
static string className() { return "Herwig::MEff2ff"; }
};
/** @endcond */
}
#endif /* HERWIG_MEff2ff_H */
diff --git a/MatrixElement/General/MEff2ss.cc b/MatrixElement/General/MEff2ss.cc
--- a/MatrixElement/General/MEff2ss.cc
+++ b/MatrixElement/General/MEff2ss.cc
@@ -1,310 +1,311 @@
// -*- C++ -*-
//
// MEff2ss.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2ss class.
//
#include "MEff2ss.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::VectorWaveFunction;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEff2ss::doinit() {
GeneralHardME::doinit();
fermion_.resize(numberOfDiags());
scalar_ .resize(numberOfDiags());
vector_ .resize(numberOfDiags());
tensor_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0 , PDT::Spin0 ));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0 , PDT::Spin0 ));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() == PDT::Spin1Half)
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.second));
else
throw InitException() << "MEFF2ss:doinit() - t-channel"
<< " intermediate must be a fermion "
<< Exception::runerror;
}
else if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() == PDT::Spin0)
scalar_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractSSSVertexPtr>(current.vertices.second));
else if(current.intermediate->iSpin() == PDT::Spin1)
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVSSVertexPtr>(current.vertices.second));
else if(current.intermediate->iSpin() == PDT::Spin2)
tensor_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractSSTVertexPtr>(current.vertices.second));
else
throw InitException() << "MEFF2ss:doinit() - s-channel"
<< " intermediate must be a vector or tensor "
<< Exception::runerror;
}
else
throw InitException() << "MEFF2ss:doinit() - Cannot find correct "
<< "channel from diagram. Vertex not cast! "
<< Exception::runerror;
}
}
void MEff2ss::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0 , PDT::Spin0 ));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0 , PDT::Spin0 ));
}
double MEff2ss::me2() const {
// first setup wavefunctions for external particles
SpinorVector sp(2);
SpinorBarVector sbar(2);
for( unsigned int i = 0; i < 2; ++i ) {
sp[i] = SpinorWaveFunction (rescaledMomenta()[0],
mePartonData()[0], i, incoming);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[1],
mePartonData()[1], i, incoming);
}
ScalarWaveFunction sca1(rescaledMomenta()[2],
mePartonData()[2], 1., outgoing);
ScalarWaveFunction sca2(rescaledMomenta()[3],
mePartonData()[3], 1., outgoing);
// calculate the ME
double full_me(0.);
ff2ssME(sp, sbar, sca1, sca2, full_me,true);
// debugging tests if needed
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
// return the answer
return full_me;
}
ProductionMatrixElement
MEff2ss::ff2ssME(const SpinorVector & sp, const SpinorBarVector & sbar,
const ScalarWaveFunction & sca1,
const ScalarWaveFunction & sca2,
double & me2, bool first) const {
// scale
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int if1 = 0; if1 < 2; ++if1) {
for(unsigned int if2 = 0; if2 < 2; ++if2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr internal(current.intermediate);
if(current.channelType == HPDiagram::tChannel &&
internal->iSpin() == PDT::Spin1Half) {
if(current.ordered.second) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, 3, internal, sbar[if2], sca2);
diag = fermion_[ix].first->evaluate(q2, sp[if1], interFB, sca1);
}
else {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, 3, internal, sbar[if2], sca1);
diag = fermion_[ix].first->evaluate(q2, sp[if1], interFB, sca2);
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(internal->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 1, internal, sp[if1], sbar[if2]);
diag = scalar_[ix].second->evaluate(q2, interS, sca2, sca1);
}
else if(internal->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, sp[if1], sbar[if2]);
diag = vector_[ix].second->evaluate(q2, interV, sca2, sca1);
}
else if(internal->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 1, internal, sp[if1], sbar[if2]);
diag = tensor_[ix].second ->evaluate(q2, sca2, sca1, interT);
}
}
// diagram
me[ix] += norm(diag);
diagramME()[ix](if1,if2,0,0) = diag;
// contributions to the different colour flows
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](if1,if2,0,0) = flows[iy];
// contribution to the squared matrix element
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2ss::persistentOutput(PersistentOStream & os) const {
os << fermion_ << scalar_ << vector_ << tensor_;
}
void MEff2ss::persistentInput(PersistentIStream & is, int) {
is >> fermion_ >> scalar_ >> vector_ >> tensor_;
}
ClassDescription<MEff2ss> MEff2ss::initMEff2ss;
// Definition of the static class description member.
void MEff2ss::Init() {
static ClassDocumentation<MEff2ss> documentation
("MEff2ss implements the ME calculation of the fermion-antifermion "
"to scalar-scalar hard process.");
}
void MEff2ss::constructVertex(tSubProPtr sub) {
//get particles
ParticleVector ext = hardParticles(sub);
//First calculate wave functions with off-shell momenta
//to calculate correct spin information
SpinorVector sp;
SpinorBarVector sbar;
SpinorWaveFunction (sp , ext[0], incoming, false);
SpinorBarWaveFunction (sbar, ext[1], incoming, false);
ScalarWaveFunction sca1( ext[2], outgoing, true);
ScalarWaveFunction sca2( ext[3], outgoing, true);
// Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wave functions with rescaled momenta
SpinorWaveFunction spr(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
sca1 = ScalarWaveFunction(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
sca2 = ScalarWaveFunction(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
sbr.reset(ihel);
sbar[ihel] = sbr;
}
double dummy(0.);
ProductionMatrixElement pme = ff2ssME(sp, sbar, sca1, sca2, dummy,false);
#ifndef NDEBUG
if( debugME() ) debug(dummy/36.);
#endif
createVertex(pme,ext);
}
void MEff2ss::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = mePartonData()[0]->id();
long id2 = mePartonData()[1]->id();
long id3 = mePartonData()[2]->id();
long id4 = mePartonData()[3]->id();
if( (abs(id1) != 1 && abs(id1) != 2) || (abs(id2) != 1 && abs(id2) != 2) ||
( abs(id3) != 1000001 && abs(id3) != 1000002 &&
abs(id3) != 2000001 && abs(id3) != 2000002 ) ||
( abs(id4) != 1000001 && abs(id4) != 1000002 &&
abs(id4) != 2000001 && abs(id4) != 2000002 ) ) return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
int Nc = sm->Nc();
double Cf = (sqr(Nc) - 1)/2./Nc;
Energy2 s(sHat());
Energy2 mgos = sqr( getParticleData(ParticleID::SUSY_g)->mass());
Energy2 m3s = sqr(mePartonData()[2]->mass());
Energy2 m4s = sqr(mePartonData()[3]->mass());
Energy4 spt2 = uHat()*tHat() - m3s*m4s;
Energy2 tgl(tHat() - mgos), ugl(uHat() - mgos);
unsigned int alpha = abs(id3)/1000000;
unsigned int beta = abs(id4)/1000000;
bool iflav = ( abs(id1) == abs(id2) );
unsigned int oflav = ( abs(id3) - abs(id1) ) % 10;
double analytic(0.);
if( alpha != beta ) {
if( ( id1 > 0 && id2 > 0) ||
( id1 < 0 && id2 < 0) ) {
analytic = spt2/sqr(tgl);
if( iflav ) analytic += spt2/sqr(ugl);
}
else {
analytic = s*mgos/sqr(tgl);
}
}
else {
if( oflav != 0 ) {
analytic = 2.*spt2/sqr(s);
}
else if( ( id1 > 0 && id2 > 0) ||
( id1 < 0 && id2 < 0) ) {
analytic = s*mgos/sqr(tgl);
if( iflav ) {
analytic += s*mgos/sqr(ugl) - 2.*s*mgos/Nc/tgl/ugl;
}
analytic /= ( iflav ? 2. : 1.);
}
else {
analytic = spt2/sqr(tgl);
if( iflav ) {
analytic += 2.*spt2/sqr(s) - 2.*spt2/Nc/s/tgl;
}
}
}
analytic *= gs4*Cf/2./Nc;
double diff = abs(analytic - me2);
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2
<< '\n';
}
}
diff --git a/MatrixElement/General/MEff2sv.cc b/MatrixElement/General/MEff2sv.cc
--- a/MatrixElement/General/MEff2sv.cc
+++ b/MatrixElement/General/MEff2sv.cc
@@ -1,230 +1,232 @@
// -*- C++ -*-
//
// MEff2sv.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2sv class.
//
#include "MEff2sv.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEff2sv::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
fermion_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0,PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0,PDT::Spin1));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if( current.channelType == HPDiagram::sChannel ) {
if( current.intermediate->iSpin() == PDT::Spin0 )
scalar_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVSSVertexPtr>(current.vertices.second));
else if( current.intermediate->iSpin() == PDT::Spin1 )
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVSVertexPtr>(current.vertices.second));
}
else if( current.channelType == HPDiagram::tChannel ) {
if(current.intermediate->iSpin() == PDT::Spin1Half) {
if( current.ordered.second )
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.second));
else
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.second),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first));
}
}
}
}
void MEff2sv::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0,PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin0,PDT::Spin1));
}
void MEff2sv::persistentOutput(PersistentOStream & os) const {
os << scalar_ << vector_ << fermion_;
}
void MEff2sv::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> vector_ >> fermion_;
}
ClassDescription<MEff2sv> MEff2sv::initMEff2sv;
// Definition of the static class description member.
void MEff2sv::Init() {
static ClassDocumentation<MEff2sv> documentation
("MEff2sv implements the ME calculation of the fermion-antifermion "
"to vector-scalar hard process.");
}
double MEff2sv::me2() const {
//set up wavefunctions
SpinorVector ina(2);
SpinorBarVector inb(2);
VBVector outa(3);
ScalarWaveFunction sca(rescaledMomenta()[2], mePartonData()[2], Complex(1.),
outgoing);
for(unsigned int ih = 0; ih < 2; ++ih) {
ina[ih] = SpinorWaveFunction(rescaledMomenta()[0], mePartonData()[0],
ih, incoming);
inb[ih] = SpinorBarWaveFunction(rescaledMomenta()[1], mePartonData()[1],
ih, incoming);
outa[2*ih] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3],
2*ih, outgoing);
}
if( mePartonData()[2]->mass() > ZERO ) {
outa[1] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3],
1, outgoing);
}
double full_me(0.);
ffb2svHeME(ina, inb, sca, outa, full_me,true);
return full_me;
}
ProductionMatrixElement
MEff2sv::ffb2svHeME(SpinorVector & sp, SpinorBarVector & spbar,
ScalarWaveFunction & sca, VBVector & vec,
double & me2, bool first) const {
Energy2 m2(scale());
bool mv = mePartonData()[2]->mass() == ZERO;
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ovhel = 0; ovhel < 3; ++ovhel) {
if( mv && ovhel == 1 ) continue;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell(current.intermediate);
if( current.channelType == HPDiagram::sChannel ) {
if( offshell->iSpin() == PDT::Spin0 ) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(m2, 1, offshell, sp[ihel1], spbar[ihel2]);
diag = scalar_[ix].second->evaluate(m2, vec[ovhel], sca, interS);
}
else if( offshell->iSpin() == PDT::Spin1 ) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(m2, 1, offshell, sp[ihel1], spbar[ihel2]);
diag = vector_[ix].second->evaluate(m2, vec[ovhel], interV, sca);
}
else diag = 0.0;
}
else if( current.channelType == HPDiagram::tChannel ) {
if( offshell->iSpin() == PDT::Spin1Half ) {
if( current.ordered.second ) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(m2, 3, offshell, spbar[ihel2], vec[ovhel]);
diag = fermion_[ix].first->
evaluate(m2, sp[ihel1], interFB, sca);
}
else {
SpinorBarWaveFunction interFB = fermion_[ix].first->
evaluate(m2, 3, offshell, spbar[ihel2], sca);
diag = fermion_[ix].second->
evaluate(m2, sp[ihel1], interFB, vec[ovhel]);
}
}
}
else diag = 0.;
me[ix] += norm(diag);
diagramME()[ix](ihel1, ihel2, 0, ovhel) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ihel1, ihel2, 0, ovhel) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2sv::constructVertex(tSubProPtr sub) {
// Hard proces external particles
ParticleVector hdp = hardParticles(sub);
SpinorVector sp;
SpinorBarVector spbar;
VBVector vec;
bool mv(hdp[3]->dataPtr()->mass() == ZERO);
SpinorWaveFunction (sp, hdp[0], incoming, false);
SpinorBarWaveFunction (spbar, hdp[1], incoming, false);
ScalarWaveFunction sca ( hdp[2], outgoing, true);
VectorWaveFunction (vec, hdp[3], outgoing, true, mv);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(hdp);
// wavefunctions with rescaled momenta
SpinorWaveFunction spr(rescaledMomenta()[0],
hdp[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[1],
hdp[1]->dataPtr(), incoming);
sca = ScalarWaveFunction (rescaledMomenta()[2],
hdp[2]->dataPtr(), outgoing);
VectorWaveFunction vr(rescaledMomenta()[3],
hdp[3]->dataPtr(), mv, outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
sbr.reset(ihel);
spbar[ihel] = sbr;
vr.reset(2*ihel);
vec[2*ihel] = vr;
}
if( !mv ) {
vr.reset(1);
vec[1] = vr;
}
double dummy(0.);
ProductionMatrixElement prodme = ffb2svHeME(sp, spbar, sca, vec, dummy,false);
createVertex(prodme,hdp);
}
diff --git a/MatrixElement/General/MEff2tv.cc b/MatrixElement/General/MEff2tv.cc
--- a/MatrixElement/General/MEff2tv.cc
+++ b/MatrixElement/General/MEff2tv.cc
@@ -1,344 +1,345 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2tv class.
//
#include "MEff2tv.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
IBPtr MEff2tv::clone() const {
return new_ptr(*this);
}
IBPtr MEff2tv::fullclone() const {
return new_ptr(*this);
}
void MEff2tv::persistentOutput(PersistentOStream & os) const {
os << fermion_ << vector_ << fourPoint_;
}
void MEff2tv::persistentInput(PersistentIStream & is, int) {
is >> fermion_ >> vector_ >> fourPoint_;
}
ClassDescription<MEff2tv> MEff2tv::initMEff2tv;
// Definition of the static class description member.
void MEff2tv::Init() {
static ClassDocumentation<MEff2tv> documentation
("The MEff2tv class implements the general matrix element for "
"fermion-antifermion -> tensor vector");
}
double MEff2tv::me2() const {
// first setup wavefunctions for external particles
SpinorVector sp(2);
SpinorBarVector sbar(2);
VBVector vec(3);
TBVector ten(5);
bool tMass = meMomenta()[2].mass()!=ZERO;
bool vMass = meMomenta()[3].mass()!=ZERO;
for( unsigned int i = 0; i < 5; ++i ) {
if(i<2) {
sp[i] = SpinorWaveFunction (rescaledMomenta()[0],
mePartonData()[0], i, incoming);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[1],
mePartonData()[1], i, incoming);
}
if( tMass || i==0 || i==4) {
ten[i] = TensorWaveFunction(rescaledMomenta()[2], mePartonData()[2],i ,
outgoing);
}
if(i<3 && (i!=1||vMass) ) {
vec[i] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3],i ,
outgoing);
}
}
// calculate the ME
double full_me(0.);
ffb2tvHeME(sp, sbar, ten, vec, full_me,true);
// debugging tests if needed
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
// return the answer
return full_me;
}
void MEff2tv::doinit() {
GeneralHardME::doinit();
fermion_ .resize(numberOfDiags());
vector_ .resize(numberOfDiags());
fourPoint_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin2 , PDT::Spin1 ));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin2 , PDT::Spin1 ));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() != PDT::Spin1Half)
throw InitException() << "MEff2tv:doinit() - Cannot find correct "
<< "t-channel from diagram. Vertex not cast! "
<< Exception::runerror;
if( current.ordered.second )
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.second));
else
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.second),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first));
}
else if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() != PDT::Spin1)
throw InitException() << "MEff2tv:doinit() - Cannot find correct "
<< "s-channel from diagram. Vertex not cast! "
<< Exception::runerror;
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.second));
}
else if(current.channelType == HPDiagram::fourPoint) {
fourPoint_[i] =
dynamic_ptr_cast<AbstractFFVTVertexPtr>(current.vertices.first);
}
}
}
void MEff2tv::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin2 , PDT::Spin1 ));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin2 , PDT::Spin1 ));
}
ProductionMatrixElement MEff2tv::
ffb2tvHeME(SpinorVector & sp, SpinorBarVector & sb,
TBVector & ten, VBVector & vec,
double & me2,bool first) const {
// scale
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
bool tMass = meMomenta()[2].mass() != ZERO;
bool vMass = meMomenta()[3].mass() != ZERO;
// flow over the helicities and diagrams
for(unsigned int if1 = 0; if1 < 2; ++if1) {
for(unsigned int if2 = 0; if2 < 2; ++if2) {
for(unsigned int it=0; it<5; ++it) {
if( (it>0&&it<4) && !tMass ) continue;
for(unsigned int iv=0; iv<3;++iv) {
if(iv==1&&!vMass) continue;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr internal(current.intermediate);
if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2,5,internal,sb[if2],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,sp[if1],interFB,ten[it]);
}
else {
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2,5,internal,sp[if1],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,interF,sb[if2],ten[it]);
}
}
else if(current.channelType == HPDiagram::sChannel) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, sp[if1], sb[if2],vec[iv].mass());
diag = vector_[ix].second->evaluate(q2, interV, vec[iv],ten[it],
vec[iv].mass());
}
else if(current.channelType == HPDiagram::fourPoint) {
diag = fourPoint_[ix]->
evaluate(q2,sp[if1],sb[if2],vec[iv],ten[it]);
}
// diagram
me[ix] += norm(diag);
diagramME()[ix](if1,if2,it,iv) = diag;
// contributions to the different colour flows
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](if1,if2,it,iv) = flows[iy];
// contribution to the squared matrix element
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2tv::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = mePartonData()[0]->id();
long id2 = mePartonData()[1]->id();
long id4 = mePartonData()[3]->id();
if(id1==-id2&&id1<=5&&id4==ParticleID::g) {
unsigned int iloc(0);
for(;iloc<vector_.size();++iloc)
if(vector_[iloc].first) break;
double gs = abs(vector_[iloc].first->norm());
InvEnergy kappa = abs(vector_[iloc].second->norm())*UnitRemoval::InvE;
Energy2 mg2 = sqr(meMomenta()[2].mass());
double anal = sqr(gs)*sqr(kappa)/36.*(4.*uHat()*tHat()+sHat()*mg2)*
(sqr(tHat()-mg2)+sqr(uHat()-mg2))/sHat()/tHat()/uHat();
double diff = abs((anal - me2)/(anal+me2));
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << anal/me2
<< '\n';
}
}
else if(id1==-id2&&id1==ParticleID::eminus&&id4==ParticleID::gamma) {
unsigned int iloc(0);
for(;iloc<vector_.size();++iloc)
if(vector_[iloc].first) break;
double gs = abs(vector_[iloc].first->norm());
InvEnergy kappa = abs(vector_[iloc].second->norm())*UnitRemoval::InvE;
Energy2 mg2 = sqr(meMomenta()[2].mass());
double anal = sqr(gs)*sqr(kappa)/16./tHat()/uHat()/sHat()*
(4.*uHat()*tHat()+mg2*sHat())*(sqr(uHat()-mg2)+sqr(tHat()-mg2));
double diff = abs((anal - me2)/(anal+me2));
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << anal/me2
<< '\n';
}
}
else if(id1==-id2&&id1==ParticleID::eminus&&id4==ParticleID::Z0) {
unsigned int iloc(0);
for(;iloc<vector_.size();++iloc)
if(vector_[iloc].first) break;
double gs = abs(vector_[iloc].first->norm());
InvEnergy kappa = abs(vector_[iloc].second->norm())*UnitRemoval::InvE;
Energy2 mg2 = sqr(meMomenta()[2].mass());
Energy2 mz2 = sqr(meMomenta()[3].mass());
double sw2 = SM().sin2ThetaW();
double anal = sqr(gs)*sqr(kappa)/48./16./sw2/(1.-sw2)*
2.*(1.-4.*sw2+8.*sqr(sw2))/sqr(tHat())/sqr(uHat())/sqr(sHat()-mz2)*
(8.*pow<3,1>(mz2)*uHat()*tHat()*(3.*mg2*(mg2-uHat()-tHat())+4.*uHat()*tHat())
+2.*sqr(mz2)*uHat()*tHat()*(27.*pow<3,1>(mg2)-42.*sqr(mg2)*(uHat()+tHat())
+15.*mg2*(sqr(uHat())+sqr(tHat()))
+80.*mg2*uHat()*tHat()
-28.*(sqr(uHat())*tHat()+uHat()*sqr(tHat())))
+mz2*(3.*pow<4,1>(mg2)*(-sqr(uHat())-sqr(tHat())+12.*uHat()*tHat())
+6.*pow<3,1>(mg2)*(pow<3,1>(uHat())
-12.*(sqr(uHat())*tHat()+uHat()*sqr(tHat()))
+pow<3,1>(tHat()))
+3.*sqr(mg2)*(-pow<4,1>(uHat())+14.*pow<3,1>(uHat())*tHat()
+62.*sqr(uHat()*tHat())+14.*uHat()*pow<3,1>(tHat())
-pow<4,1>(tHat()))
+6.*mg2*(-pow<4,1>(uHat())*tHat()
-23.*(pow<3,1>(uHat())*sqr(tHat())+pow<3,1>(tHat())*sqr(uHat()))
-uHat()*pow<4,1>(tHat()))
+36.*(pow<4,1>(uHat())*sqr(tHat())+pow<4,1>(tHat())*sqr(uHat()))
+52.*pow<3,1>(tHat()*uHat()))
+3.*tHat()*uHat()*(-mg2+uHat()+tHat())*
(-sqr(mg2)+mg2*(uHat()+tHat())-4.*uHat()*tHat())*
(2.*sqr(mg2)-2.*mg2*(uHat()+tHat())+sqr(uHat())+sqr(tHat())));
double diff = abs((anal - me2)/(anal+me2));
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff
<< " anal : " << anal
<< " code : " << me2
<< " ratio: " << anal/me2
<< '\n';
}
}
}
void MEff2tv::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
vector<SpinorWaveFunction> sp;
SpinorWaveFunction(sp, ext[0], incoming, false);
vector<SpinorBarWaveFunction> sbar;
SpinorBarWaveFunction(sbar, ext[1], incoming, false);
vector<VectorWaveFunction> v2;
vector<TensorWaveFunction> t1;
bool mc = !(ext[2]->momentum().mass() > ZERO);
bool md = !(ext[3]->data() .mass() > ZERO);
TensorWaveFunction(t1, ext[2], outgoing, true, mc);
VectorWaveFunction(v2, ext[3], outgoing, true, md);
// Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
SpinorWaveFunction spr (rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
TensorWaveFunction tr1 (rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
VectorWaveFunction vr2 (rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
sbr.reset(ihel);
sbar[ihel] = sbr;
tr1.reset(4*ihel);
t1[4*ihel] = tr1;
vr2.reset(2*ihel);
v2[2*ihel] = vr2;
}
if( !mc ) {
for(unsigned int ihel=1;ihel<4;++ihel) {
tr1.reset(ihel);
t1[ihel] = tr1;
}
}
if( !md ) {
vr2.reset(1);
v2[1] = vr2;
}
double dummy(0.);
ProductionMatrixElement pme = ffb2tvHeME(sp, sbar, t1, v2,dummy,false);
createVertex(pme,ext);
}
diff --git a/MatrixElement/General/MEff2vs.cc b/MatrixElement/General/MEff2vs.cc
--- a/MatrixElement/General/MEff2vs.cc
+++ b/MatrixElement/General/MEff2vs.cc
@@ -1,227 +1,229 @@
// -*- C++ -*-
//
// MEff2vs.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2vs class.
//
#include "MEff2vs.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEff2vs::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
fermion_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1,PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1,PDT::Spin0));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if( current.channelType == HPDiagram::sChannel ) {
if( current.intermediate->iSpin() == PDT::Spin0 )
scalar_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVSSVertexPtr>(current.vertices.second));
else if( current.intermediate->iSpin() == PDT::Spin1 )
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVSVertexPtr>(current.vertices.second));
}
else if( current.channelType == HPDiagram::tChannel ) {
if(current.intermediate->iSpin() == PDT::Spin1Half) {
if( current.ordered.second )
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.second));
else
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.second),
dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first));
}
}
}
}
void MEff2vs::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1,PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1,PDT::Spin0));
}
void MEff2vs::persistentOutput(PersistentOStream & os) const {
os << scalar_ << vector_ << fermion_;
}
void MEff2vs::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> vector_ >> fermion_;
}
ClassDescription<MEff2vs> MEff2vs::initMEff2vs;
// Definition of the static class description member.
void MEff2vs::Init() {
static ClassDocumentation<MEff2vs> documentation
("MEff2vs implements the ME calculation of the fermion-antifermion "
"to vector-scalar hard process.");
}
double MEff2vs::me2() const {
//set up wavefunctions
SpinorVector ina(2);
SpinorBarVector inb(2);
VBVector outa(3);
ScalarWaveFunction sca(rescaledMomenta()[3], mePartonData()[3], Complex(1.),
outgoing);
for(unsigned int ih = 0; ih < 2; ++ih) {
ina[ih] = SpinorWaveFunction(rescaledMomenta()[0], mePartonData()[0],
ih, incoming);
inb[ih] = SpinorBarWaveFunction(rescaledMomenta()[1], mePartonData()[1],
ih, incoming);
outa[2*ih] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2],
2*ih, outgoing);
}
if( mePartonData()[2]->mass() > ZERO ) {
outa[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2],
1, outgoing);
}
double full_me(0.);
ffb2vsHeME(ina, inb, outa, sca, full_me,true);
return full_me;
}
ProductionMatrixElement
MEff2vs::ffb2vsHeME(SpinorVector & sp, SpinorBarVector & spbar,
VBVector & vec, ScalarWaveFunction & sca,
double & me2, bool first) const {
Energy2 m2(scale());
bool mv = mePartonData()[2]->mass() == ZERO;
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ovhel = 0; ovhel < 3; ++ovhel) {
if( mv && ovhel == 1 ) continue;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell(current.intermediate);
if( current.channelType == HPDiagram::sChannel ) {
if( offshell->iSpin() == PDT::Spin0 ) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(m2, 1, offshell, sp[ihel1], spbar[ihel2]);
diag = scalar_[ix].second->evaluate(m2, vec[ovhel], sca, interS);
}
else if( offshell->iSpin() == PDT::Spin1 ) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(m2, 1, offshell, sp[ihel1], spbar[ihel2]);
diag = vector_[ix].second->evaluate(m2, vec[ovhel], interV, sca);
}
else diag = 0.0;
}
else if( current.channelType == HPDiagram::tChannel ) {
if( offshell->iSpin() == PDT::Spin1Half ) {
if( current.ordered.second ) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(m2, 3, offshell, spbar[ihel2], sca);
diag = fermion_[ix].first->
evaluate(m2, sp[ihel1], interFB, vec[ovhel]);
}
else {
SpinorBarWaveFunction interFB = fermion_[ix].first->
evaluate(m2, 3, offshell, spbar[ihel2], vec[ovhel]);
diag = fermion_[ix].second->
evaluate(m2, sp[ihel1], interFB, sca);
}
}
}
else diag = 0.0;
me[ix] += norm(diag);
diagramME()[ix](ihel1, ihel2, ovhel, 0) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ihel1, ihel2, ovhel, 0) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2vs::constructVertex(tSubProPtr sub) {
// Hard proces external particles
ParticleVector hdp = hardParticles(sub);
// wavefunctions with real momenta
SpinorVector sp;
SpinorBarVector spbar;
VBVector vec;
bool mv(hdp[2]->dataPtr()->mass() == ZERO);
SpinorWaveFunction (sp, hdp[0], incoming, false);
SpinorBarWaveFunction (spbar, hdp[1], incoming, false);
VectorWaveFunction (vec, hdp[2], outgoing, true, mv);
ScalarWaveFunction sca( hdp[3], outgoing, true);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(hdp);
// wavefunctions with rescaled momenta
SpinorWaveFunction spr( rescaledMomenta()[0], hdp[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[1], hdp[1]->dataPtr(), incoming);
VectorWaveFunction vr( rescaledMomenta()[2], hdp[2]->dataPtr(), outgoing);
sca = ScalarWaveFunction( rescaledMomenta()[3], hdp[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
sbr.reset(ihel);
spbar[ihel] = sbr;
vr.reset(2*ihel);
vec[2*ihel] = vr;
}
if( !mv ) {
vr.reset(1);
vec[1] = vr;
}
double dummy(0.);
ProductionMatrixElement prodme = ffb2vsHeME(sp, spbar, vec, sca, dummy,false);
createVertex(prodme,hdp);
}
diff --git a/MatrixElement/General/MEff2vv.cc b/MatrixElement/General/MEff2vv.cc
--- a/MatrixElement/General/MEff2vv.cc
+++ b/MatrixElement/General/MEff2vv.cc
@@ -1,286 +1,288 @@
// -*- C++ -*-
//
// MEff2vv.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEff2vv class.
//
#include "MEff2vv.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::ScalarWaveFunction;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEff2vv::doinit() {
GeneralHardME::doinit();
fermion_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
tensor_.resize(numberOfDiags());
scalar_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1, PDT::Spin1));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() == PDT::Spin1Half)
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.second));
}
else if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() == PDT::Spin0)
scalar_[i] =
make_pair(dynamic_ptr_cast<AbstractFFSVertexPtr>(current.vertices.first ),
dynamic_ptr_cast<AbstractVVSVertexPtr>(current.vertices.second));
if(current.intermediate->iSpin() == PDT::Spin1)
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVVVertexPtr>(current.vertices.second));
if(current.intermediate->iSpin() == PDT::Spin2)
tensor_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.second));
}
}
}
void MEff2vv::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1Half,
PDT::Spin1, PDT::Spin1));
}
double MEff2vv::me2() const {
SpinorVector sp(2);
SpinorBarVector sbar(2);
// vector
bool mc = !(mePartonData()[2]->mass() > ZERO);
bool md = !(mePartonData()[3]->mass() > ZERO);
VBVector v1(3), v2(3);
for( unsigned int i = 0; i < 2; ++i ) {
sp[i] = SpinorWaveFunction(rescaledMomenta()[0], mePartonData()[0], i, incoming);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[1], mePartonData()[1], i,
incoming);
v1[2*i] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2],2*i ,
outgoing);
v2[2*i] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3], 2*i,
outgoing);
}
if( !mc ) v1[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 1,
outgoing);
if( !md ) v2[1] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3], 1,
outgoing);
double full_me(0.);
ff2vvME(sp, sbar, v1, mc, v2, md, full_me,true);
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
return full_me;
}
ProductionMatrixElement
MEff2vv::ff2vvME(const SpinorVector & sp, const SpinorBarVector sbar,
const VBVector & v1, bool m1, const VBVector & v2, bool m2,
double & me2, bool first) const {
const Energy2 q2 = scale();
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
//Loop over helicities and calculate diagrams
for(unsigned int if1 = 0; if1 < 2; ++if1) {
for(unsigned int if2 = 0; if2 < 2; ++if2) {
for(unsigned int vh1 = 0; vh1 < 3; ++vh1) {
if( vh1 == 1 && m1 ) ++vh1;
for(unsigned int vh2 = 0; vh2 < 3; ++vh2) {
if( vh2 == 1 && m2 ) ++vh2;
vector<Complex> flows(numberOfFlows(),0.);
//loop and calculate diagrams
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
Complex diag(0.);
if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() == PDT::Spin1Half) {
if(current.ordered.second) {
SpinorWaveFunction interF = fermion_[ix].first->
evaluate(q2, 3, offshell, sp[if1], v1[vh1]);
diag = fermion_[ix].second->
evaluate(q2, interF, sbar[if2],v2[vh2]);
}
else {
SpinorWaveFunction interF = fermion_[ix].first->
evaluate(q2, 3 , offshell, sp[if1], v2[vh2]);
diag = fermion_[ix].second->
evaluate(q2, interF, sbar[if2],v1[vh1]);
}
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 1, offshell, sp[if1], sbar[if2]);
diag = scalar_[ix].second->
evaluate(q2, v1[vh1], v2[vh2],interS);
}
else if(current.intermediate->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, offshell, sp[if1], sbar[if2]);
diag = vector_[ix].second->
evaluate(q2, v1[vh1],v2[vh2], interV);
}
else if(current.intermediate->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 1, offshell, sp[if1], sbar[if2]);
diag = tensor_[ix].second->
evaluate(q2, v1[vh1], v2[vh2],interT);
}
}
me[ix] += norm(diag);
diagramME()[ix](if1, if2, vh1, vh2) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](if1, if2, vh1, vh2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEff2vv::persistentOutput(PersistentOStream & os) const {
os << fermion_ << vector_ << tensor_ << scalar_;
}
void MEff2vv::persistentInput(PersistentIStream & is, int) {
is >> fermion_ >> vector_ >> tensor_ >> scalar_;
}
ClassDescription<MEff2vv> MEff2vv::initMEff2vv;
// Definition of the static class description member.
void MEff2vv::Init() {
static ClassDocumentation<MEff2vv> documentation
("This class implements the matrix element calculation of the 2->2 "
"process, fermion-antifermion -> vector vector");
}
void MEff2vv::constructVertex(tSubProPtr sub) {
//get particles
ParticleVector ext = hardParticles(sub);
vector<SpinorWaveFunction> sp;
SpinorWaveFunction(sp, ext[0], incoming, false);
vector<SpinorBarWaveFunction> sbar;
SpinorBarWaveFunction(sbar, ext[1], incoming, false);
vector<VectorWaveFunction> v1, v2;
bool mc = !(ext[2]->data().mass() > ZERO);
bool md = !(ext[3]->data().mass() > ZERO);
VectorWaveFunction(v1, ext[2], outgoing, true, mc);
VectorWaveFunction(v2, ext[3], outgoing, true, md);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wavefunctions with rescaled momenta
SpinorWaveFunction spr (rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
VectorWaveFunction vr1 (rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
VectorWaveFunction vr2 (rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
sbr.reset(ihel);
sbar[ihel] = sbr;
vr1.reset(2*ihel);
v1[2*ihel] = vr1;
vr2.reset(2*ihel);
v2[2*ihel] = vr2;
}
if( !mc ) {
vr1.reset(1);
v1[1] = vr1;
}
if( !md ) {
vr2.reset(1);
v2[1] = vr2;
}
double dummy(0.);
ProductionMatrixElement pme = ff2vvME(sp, sbar, v1, mc, v2, md, dummy,false);
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
createVertex(pme,ext);
}
void MEff2vv::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
if( (mePartonData()[0]->id() != 1 && mePartonData()[0]->id() != 2) ||
(mePartonData()[1]->id() != -1 && mePartonData()[1]->id() != -2) ||
mePartonData()[2]->id() != 5100021 ||
mePartonData()[3]->id() != 5100021 ) return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
Energy2 s(sHat());
Energy2 mf2 = meMomenta()[2].m2();
Energy2 t3(tHat() - mf2), u4(uHat() - mf2);
double analytic = gs4*( mf2*( (57.*s/t3/u4) - (4.*s*s*s/t3/t3/u4/u4)
- (108./s) )
+ (20.*s*s/t3/u4) - 93. + (108.*t3*u4/s/s) )/27.;
double diff = abs( analytic - me2 );
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: "
<< analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/General/MEfv2fs.cc b/MatrixElement/General/MEfv2fs.cc
--- a/MatrixElement/General/MEfv2fs.cc
+++ b/MatrixElement/General/MEfv2fs.cc
@@ -1,367 +1,371 @@
// -*- C++ -*-
//
// MEfv2fs.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEfv2fs class.
//
#include "MEfv2fs.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEfv2fs::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
fermion_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1Half, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1Half, PDT::Spin0));
for(size_t ix = 0; ix < numberOfDiags(); ++ix) {
HPDiagram curr = getProcessInfo()[ix];
if(curr.channelType == HPDiagram::tChannel) {
AbstractFFSVertexPtr ffs =
dynamic_ptr_cast<AbstractFFSVertexPtr>(curr.vertices.first);
if( curr.intermediate->iSpin() == PDT::Spin0 ) {
AbstractVSSVertexPtr vss =
dynamic_ptr_cast<AbstractVSSVertexPtr>(curr.vertices.second);
scalar_[ix] = make_pair(ffs, vss);
}
else {
AbstractFFVVertexPtr ffv =
dynamic_ptr_cast<AbstractFFVVertexPtr>(curr.vertices.second);
fermion_[ix] = make_pair(ffs, ffv);
}
}
else {
AbstractFFVVertexPtr ffv =
dynamic_ptr_cast<AbstractFFVVertexPtr>(curr.vertices.first);
AbstractFFSVertexPtr ffs =
dynamic_ptr_cast<AbstractFFSVertexPtr>(curr.vertices.second);
fermion_[ix] = make_pair(ffs, ffv);
}
}
}
void MEfv2fs::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1Half, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1Half, PDT::Spin0));
}
double MEfv2fs::me2() const {
//massless vector
VecWFVector vecIn(2);
ScalarWaveFunction scaOut(rescaledMomenta()[3], mePartonData()[3],
Complex(1.,0.), outgoing);
double fullme(0.);
if( mePartonData()[0]->id() > 0 ) {
SpinorVector spIn(2);
SpinorBarVector spbOut(2);
for(size_t ih = 0; ih < 2; ++ih) {
spIn[ih] = SpinorWaveFunction(rescaledMomenta()[0], mePartonData()[0], ih,
incoming);
spbOut[ih] = SpinorBarWaveFunction(rescaledMomenta()[2], mePartonData()[2], ih,
outgoing);
vecIn[ih] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*ih,
incoming);
}
fv2fbsHeME(spIn, vecIn, spbOut, scaOut, fullme,true);
}
else {
SpinorBarVector spbIn(2);
SpinorVector spOut(2);
for(size_t ih = 0; ih < 2; ++ih) {
spbIn[ih] = SpinorBarWaveFunction(rescaledMomenta()[0], mePartonData()[0], ih,
incoming);
spOut[ih] = SpinorWaveFunction(rescaledMomenta()[2], mePartonData()[2], ih,
outgoing);
vecIn[ih] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*ih,
incoming);
}
fbv2fsHeME(spbIn, vecIn, spOut, scaOut, fullme,true);
}
#ifndef NDEBUG
if( debugME() ) debug(fullme);
#endif
return fullme;
}
ProductionMatrixElement
MEfv2fs::fv2fbsHeME(const SpinorVector & spIn, const VecWFVector & vecIn,
const SpinorBarVector & spbOut,
const ScalarWaveFunction & scaOut,
double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ohel1 = 0; ohel1 < 2; ++ohel1) {
vector<Complex> flows(numberOfFlows(),0.);
for(size_t ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if( current.channelType == HPDiagram::tChannel ) {
if( offshell->iSpin() == PDT::Spin0 ) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 3, offshell, spIn[ihel1], spbOut[ohel1]);
diag = scalar_[ix].second->
evaluate(q2, vecIn[ihel2], scaOut, interS);
}
else if( offshell->iSpin() == PDT::Spin1Half ) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, 3, offshell,spbOut[ohel1],vecIn[ihel2]);
diag = fermion_[ix].first->
evaluate(q2, spIn[ihel1], interFB, scaOut);
}
else diag = 0.0;
}
else if( current.channelType == HPDiagram::sChannel ) {
// check if take intermediate massless
unsigned int propOpt =
abs(offshell->id()) != abs(spIn[ihel1].particle()->id()) ? 1 : 5;
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2, propOpt, offshell, spIn[ihel1], vecIn[ihel2]);
diag = fermion_[ix].first->
evaluate(q2, interF, spbOut[ohel1], scaOut);
}
else diag = 0.0;
me[ix] += norm(diag);
diagramME()[ix](ihel1, 2*ihel2, ohel1, 0) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
- for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
+ for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ihel1, 2*ihel2, ohel1, 0) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
ProductionMatrixElement
MEfv2fs::fbv2fsHeME(const SpinorBarVector & spbIn, const VecWFVector & vecIn,
const SpinorVector & spOut,
const ScalarWaveFunction & scaOut,
double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ohel1 = 0; ohel1 < 2; ++ohel1) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if( current.channelType == HPDiagram::tChannel ) {
if( offshell->iSpin() == PDT::Spin0 ) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 3, offshell, spOut[ohel1], spbIn[ihel1]);
diag = scalar_[ix].second->
evaluate(q2, vecIn[ihel2], interS, scaOut);
}
else if( offshell->iSpin() == PDT::Spin1Half ) {
SpinorBarWaveFunction interFB = fermion_[ix].first->
evaluate(q2, 3, offshell, spbIn[ihel1], scaOut);
diag = fermion_[ix].second->
evaluate(q2, spOut[ohel1], interFB, vecIn[ihel2]);
}
else diag = 0.0;
}
else if( current.channelType == HPDiagram::sChannel ) {
// check if take intermediate massless
unsigned int propOpt =
abs(offshell->id()) != abs(spbIn[ihel1].particle()->id()) ? 1 : 5;
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, propOpt, offshell, spbIn[ihel1], vecIn[ihel2]);
diag = fermion_[ix].first->
evaluate(q2, spOut[ohel1], interFB, scaOut);
}
else diag = 0.0;
me[ix] += norm(diag);
diagramME()[ix](ihel1, 2*ihel2, ohel1, 0) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ihel1, 2*ihel2, ohel1, 0) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEfv2fs::persistentOutput(PersistentOStream & os) const {
os << scalar_ << fermion_;
}
void MEfv2fs::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> fermion_;
}
ClassDescription<MEfv2fs> MEfv2fs::initMEfv2fs;
// Definition of the static class description member.
void MEfv2fs::Init() {
static ClassDocumentation<MEfv2fs> documentation
("This class implements the matrix element for a fermion-vector to "
"a fermioin-scalar.");
}
void MEfv2fs::constructVertex(tSubProPtr subp) {
ParticleVector external = hardParticles(subp);
//calculate production ME
VecWFVector vecIn;
VectorWaveFunction(vecIn, external[1], incoming, false, true);
ScalarWaveFunction scaOut(external[3], outgoing, true);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(external);
double dummy(0.);
if( external[0]->id() > 0 ) {
SpinorVector spIn;
SpinorBarVector spbOut;
SpinorWaveFunction (spIn, external[0], incoming, false);
SpinorBarWaveFunction(spbOut, external[2], outgoing, true);
SpinorWaveFunction spr (rescaledMomenta()[0],
external[0]->dataPtr(), incoming);
VectorWaveFunction vr (rescaledMomenta()[1],
external[1]->dataPtr(), incoming);
SpinorBarWaveFunction sbr (rescaledMomenta()[2],
external[2]->dataPtr(), outgoing);
scaOut = ScalarWaveFunction(rescaledMomenta()[3],
external[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
spIn[ihel] = spr;
vr.reset(2*ihel);
vecIn[ihel] = vr;
sbr.reset(ihel);
spbOut[ihel] = sbr;
}
ProductionMatrixElement prodME = fv2fbsHeME(spIn, vecIn, spbOut,
scaOut, dummy,false);
createVertex(prodME,external);
}
else {
SpinorBarVector spbIn;
SpinorVector spOut;
SpinorBarWaveFunction(spbIn, external[0], incoming, false);
SpinorWaveFunction (spOut, external[2], outgoing, true);
SpinorBarWaveFunction sbr (rescaledMomenta()[0],
external[0]->dataPtr(), incoming);
VectorWaveFunction vr (rescaledMomenta()[1],
external[1]->dataPtr(), incoming);
SpinorWaveFunction spr (rescaledMomenta()[2],
external[2]->dataPtr(), outgoing);
scaOut = ScalarWaveFunction(rescaledMomenta()[3],
external[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
sbr.reset(ihel);
spbIn[ihel] = sbr;
vr.reset(2*ihel);
vecIn[ihel] = vr;
spr.reset(ihel);
spOut[ihel] = spr;
}
ProductionMatrixElement prodME = fbv2fsHeME(spbIn, vecIn, spOut,
scaOut, dummy,false);
createVertex(prodME,external);
}
#ifndef NDEBUG
if( debugME() ) debug(dummy/96.);
#endif
}
void MEfv2fs::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = abs(mePartonData()[0]->id());
long id4 = abs(mePartonData()[3]->id());
if( (id1 != 1 && id1 != 2) || mePartonData()[1]->id() != 21 ||
mePartonData()[2]->id() != 1000021 ||
(id4 != 1000001 && id4 != 1000002 && id4 != 2000001 &&
id4 != 2000002) ) return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
int Nc = sm->Nc();
Energy2 m3s = sqr(mePartonData()[2]->mass());
Energy2 m4s = sqr(mePartonData()[3]->mass());
//formula has vf->fs so swap t and u
Energy2 s(sHat()), t3(uHat() - m3s), u4(tHat() - m4s);
double analytic = -gs4*( u4 + 2.*(m4s - m3s)*(1. + m3s/t3 + m4s/u4) )*
( sqr(u4) + sqr(s) - sqr(t3)/sqr(Nc) )/s/t3/u4/4.;
double diff = abs( analytic - me2);
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/General/MEfv2tf.cc b/MatrixElement/General/MEfv2tf.cc
--- a/MatrixElement/General/MEfv2tf.cc
+++ b/MatrixElement/General/MEfv2tf.cc
@@ -1,389 +1,391 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEfv2tf class.
//
#include "MEfv2tf.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
IBPtr MEfv2tf::clone() const {
return new_ptr(*this);
}
IBPtr MEfv2tf::fullclone() const {
return new_ptr(*this);
}
void MEfv2tf::persistentOutput(PersistentOStream & os) const {
os << fermion_ << vector_ << fourPoint_;
}
void MEfv2tf::persistentInput(PersistentIStream & is, int) {
is >> fermion_ >> vector_ >> fourPoint_;
}
ClassDescription<MEfv2tf> MEfv2tf::initMEfv2tf;
// Definition of the static class description member.
void MEfv2tf::Init() {
static ClassDocumentation<MEfv2tf> documentation
("The MEfv2tf class implements the general matrix element for "
"fermion-vector -> tensor fermion.");
}
double MEfv2tf::me2() const {
// check tensor mass
bool tMass = meMomenta()[2].mass()!=ZERO;
// first setup wavefunctions for external particles
SpinorVector sp(2);
SpinorBarVector sbar(2);
VBVector vec(3);
TBVector ten(5);
for( unsigned int i = 0; i < 5; ++i ) {
if(i<2) {
if(mePartonData()[0]->id()>0) {
sp[i] = SpinorWaveFunction (rescaledMomenta()[0],
mePartonData()[0], i, incoming);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[3],
mePartonData()[3], i, outgoing);
}
else {
sp[i] = SpinorWaveFunction (rescaledMomenta()[3],
mePartonData()[3], i, outgoing);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[0],
mePartonData()[0], i, incoming);
}
}
if( tMass || i==0 || i==4) {
ten[i] = TensorWaveFunction(rescaledMomenta()[2], mePartonData()[2],i ,
outgoing);
}
if(i!=1 &&i<3) {
vec[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1],i ,
incoming);
}
}
// calculate the ME
double full_me(0.);
if(mePartonData()[0]->id()>0) {
fv2tfHeME(sp,vec,ten,sbar,full_me,true);
}
else {
fbv2tfbHeME(sbar,vec,ten,sp,full_me,true);
}
// debugging tests if needed
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
// return the answer
return full_me;
}
void MEfv2tf::doinit() {
GeneralHardME::doinit();
fermion_ .resize(numberOfDiags());
vector_ .resize(numberOfDiags());
fourPoint_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1 ,
PDT::Spin2 , PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1 ,
PDT::Spin2 , PDT::Spin1Half));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if(current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() != PDT::Spin1Half)
throw InitException() << "MEfv2tf:doinit() - Cannot find correct "
<< "s-channel from diagram. Vertex not cast! "
<< Exception::runerror;
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.second),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first));
}
else if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() == PDT::Spin1Half)
fermion_[i] =
make_pair(dynamic_ptr_cast<AbstractFFTVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.second));
else if(current.intermediate->iSpin() == PDT::Spin1)
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractFFVVertexPtr>(current.vertices.first),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.second));
else
throw InitException() << "MEfv2tf:doinit() - Cannot find correct "
<< "t-channel from diagram. Vertex not cast! "
<< Exception::runerror;
}
else if(current.channelType == HPDiagram::fourPoint) {
fourPoint_[i] =
dynamic_ptr_cast<AbstractFFVTVertexPtr>(current.vertices.first);
}
}
}
void MEfv2tf::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1 ,
PDT::Spin2 , PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1 ,
PDT::Spin2 , PDT::Spin1Half));
}
ProductionMatrixElement MEfv2tf::fv2tfHeME(const SpinorVector & sp,
const VBVector & vec,
const TBVector & ten,
const SpinorBarVector & sb,
double & full_me, bool first) const {
// scale
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
bool tMass = meMomenta()[2].mass() != ZERO;
// flow over the helicities and diagrams
for(unsigned int if1 = 0; if1 < 2; ++if1) {
for(unsigned int iv=0; iv<3;iv+=2) {
for(unsigned int it=0; it<5; ++it) {
if( (it>0&&it<4) && !tMass ) continue;
for(unsigned int if2 = 0; if2 < 2; ++if2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr internal(current.intermediate);
if(current.channelType == HPDiagram::sChannel) {
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2,5,internal,sp[if1],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,interF,sb[if2],ten[it]);
}
else if(current.channelType == HPDiagram::tChannel) {
if(internal->iSpin()==PDT::Spin1Half) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2,5,internal,sb[if2],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,sp[if1],interFB,ten[it]);
}
else {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, sp[if1], sb[if2]);
diag = vector_[ix].second->evaluate(q2, interV, vec[iv],ten[it]);
}
}
else if(current.channelType == HPDiagram::fourPoint) {
diag = fourPoint_[ix]->
evaluate(q2,sp[if1],sb[if2],vec[iv],ten[it]);
}
// diagram
me[ix] += norm(diag);
diagramME()[ix](if1,iv,it,if2) = diag;
// contributions to the different colour flows
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](if1,iv,it,if2) = flows[iy];
// contribution to the squared matrix element
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
full_me += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
full_me = selectColourFlow(flow,me,full_me);
return flowME()[colourFlow()];
}
ProductionMatrixElement MEfv2tf::fbv2tfbHeME(const SpinorBarVector & sb,
const VBVector & vec,
const TBVector & ten,
const SpinorVector & sp,
double & full_me, bool first) const {
// scale
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
bool tMass = meMomenta()[2].mass() != ZERO;
// flow over the helicities and diagrams
for(unsigned int if1 = 0; if1 < 2; ++if1) {
for(unsigned int iv=0; iv<3;iv+=2) {
for(unsigned int it=0; it<5; ++it) {
if( (it>0&&it<4) && !tMass ) continue;
for(unsigned int if2 = 0; if2 < 2; ++if2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr internal(current.intermediate);
if(current.channelType == HPDiagram::sChannel) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2,5,internal,sb[if1],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,sp[if2],interFB,ten[it]);
}
else if(current.channelType == HPDiagram::tChannel) {
if(internal->iSpin()==PDT::Spin1Half) {
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2,5,internal,sp[if2],vec[iv]);
diag = fermion_[ix].first->
evaluate(q2,interF,sb[if1],ten[it]);
}
else {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, sp[if2], sb[if1]);
diag = vector_[ix].second->evaluate(q2, interV, vec[iv],ten[it]);
}
}
else if(current.channelType == HPDiagram::fourPoint) {
diag = fourPoint_[ix]->
evaluate(q2,sp[if2],sb[if1],vec[iv],ten[it]);
}
// diagram
me[ix] += norm(diag);
diagramME()[ix](if1,iv,it,if2) = diag;
// contributions to the different colour flows
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](if1,iv,it,if2) = flows[iy];
// contribution to the squared matrix element
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
full_me += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
full_me = selectColourFlow(flow,me,full_me);
return flowME()[colourFlow()];
}
void MEfv2tf::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = mePartonData()[0]->id();
long id2 = mePartonData()[1]->id();
long id4 = mePartonData()[3]->id();
if(id1==-id4||abs(id1)>5) return;
if(id2!=ParticleID::g) return;
unsigned int iloc(0);
for(;iloc<vector_.size();++iloc)
if(vector_[iloc].first) break;
double gs = abs(vector_[iloc].second->norm());
InvEnergy kappa = abs(vector_[iloc].first->norm())*UnitRemoval::InvE;
Energy2 mg2 = sqr(meMomenta()[2].mass());
double anal2 = -3./8.*sqr(gs)*sqr(kappa)/36.*(4.*sHat()*tHat()+uHat()*mg2)*
(sqr(tHat()-mg2)+sqr(sHat()-mg2))/sHat()/tHat()/uHat();
double diff = abs((anal2 - me2)/(anal2+me2));
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << anal2/me2 << '\n';
}
}
void MEfv2tf::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
VBVector v1;
vector<TensorWaveFunction> t3;
bool mc = !(ext[2]->momentum().mass() > ZERO);
SpinorVector sp;
SpinorBarVector sbar;
VectorWaveFunction(v1, ext[1], incoming, false, true);
TensorWaveFunction(t3, ext[2], outgoing, true, mc);
double dummy(0.);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wavefunctions with rescaled momenta
VectorWaveFunction vec(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
TensorWaveFunction ten(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
if( ext[0]->id() > 0 ) {
SpinorWaveFunction (sp , ext[0], incoming, false);
SpinorBarWaveFunction(sbar, ext[3], outgoing, true);
SpinorWaveFunction spr (rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
vec.reset(2*ihel);
v1[ihel] = vec;
ten.reset(4*ihel);
t3[4*ihel] = ten;
sbr.reset(ihel);
sbar[ihel] = sbr;
}
if( !mc ) {
for(unsigned int ihel=1;ihel<4;++ihel) {
ten.reset(ihel);
t3[ihel] = ten;
}
}
ProductionMatrixElement pme = fv2tfHeME(sp, v1, t3, sbar, dummy,false);
createVertex(pme,ext);
}
else {
SpinorBarWaveFunction(sbar, ext[0], incoming, false);
SpinorWaveFunction(sp, ext[3], outgoing, true);
SpinorBarWaveFunction sbr(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorWaveFunction spr (rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
sbr.reset(ihel);
sbar[ihel] = sbr;
vec.reset(2*ihel);
v1[ihel] = vec;
ten.reset(4*ihel);
t3[4*ihel] = ten;
spr.reset(ihel);
sp[ihel] = spr;
}
if( !mc ) {
for(unsigned int ihel=1;ihel<4;++ihel) {
ten.reset(ihel);
t3[ihel] = ten;
}
}
ProductionMatrixElement pme = fbv2tfbHeME(sbar, v1, t3, sp, dummy,false);
createVertex(pme,ext);
}
}
diff --git a/MatrixElement/General/MEfv2vf.cc b/MatrixElement/General/MEfv2vf.cc
--- a/MatrixElement/General/MEfv2vf.cc
+++ b/MatrixElement/General/MEfv2vf.cc
@@ -1,380 +1,384 @@
// -*- C++ -*-
//
// MEfv2vf.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEfv2vf class.
//
#include "MEfv2vf.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
using ThePEG::Helicity::SpinorWaveFunction;
using ThePEG::Helicity::SpinorBarWaveFunction;
using ThePEG::Helicity::VectorWaveFunction;
void MEfv2vf::doinit() {
GeneralHardME::doinit();
fermion_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1, PDT::Spin1Half));
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
HPDiagram diagram = getProcessInfo()[ix];
PDT::Spin offspin = diagram.intermediate->iSpin();
if(diagram.channelType == HPDiagram::sChannel ||
( diagram.channelType == HPDiagram::tChannel
&& offspin == PDT::Spin1Half)) {
AbstractFFVVertexPtr vert1 = dynamic_ptr_cast<AbstractFFVVertexPtr>
(diagram.vertices.first);
AbstractFFVVertexPtr vert2 = dynamic_ptr_cast<AbstractFFVVertexPtr>
(diagram.vertices.second);
fermion_[ix] = make_pair(vert1, vert2);
}
else {
if(offspin == PDT::Spin1) {
AbstractFFVVertexPtr vert1 = dynamic_ptr_cast<AbstractFFVVertexPtr>
(diagram.vertices.first);
AbstractVVVVertexPtr vert2 = dynamic_ptr_cast<AbstractVVVVertexPtr>
(diagram.vertices.second);
vector_[ix] = make_pair(vert1, vert2);
}
}
}
}
void MEfv2vf::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1Half, PDT::Spin1,
PDT::Spin1, PDT::Spin1Half));
}
double MEfv2vf::me2() const {
//wavefunctions
SpinorVector sp(2);
VBVector vecIn(2), vecOut(3);
SpinorBarVector spb(2);
double fullme(0.);
bool mc = !(mePartonData()[2]->mass() > ZERO);
if(mePartonData()[0]->id() > 0) {
for(unsigned int i = 0; i < 2; ++i) {
sp[i] = SpinorWaveFunction(rescaledMomenta()[0], mePartonData()[0], i,
incoming);
vecIn[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*i,
incoming);
vecOut[2*i] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 2*i,
outgoing);
spb[i] = SpinorBarWaveFunction(rescaledMomenta()[3], mePartonData()[3], i,
outgoing);
}
if( !mc )
vecOut[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 1,
outgoing);
fv2vfHeME(sp, vecIn, vecOut, mc, spb, fullme,true);
}
else {
for(unsigned int i = 0; i < 2; ++i) {
spb[i] = SpinorBarWaveFunction(rescaledMomenta()[0], mePartonData()[0], i,
incoming);
vecIn[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*i,
incoming);
vecOut[2*i] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 2*i,
outgoing);
sp[i] = SpinorWaveFunction(rescaledMomenta()[3], mePartonData()[3], i,
outgoing);
}
if( !mc )
vecOut[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 1,
outgoing);
fbv2vfbHeME(spb, vecIn, vecOut, mc, sp, fullme,true);
}
#ifndef NDEBUG
if( debugME() ) debug(fullme);
#endif
return fullme;
}
ProductionMatrixElement
MEfv2vf::fv2vfHeME(const SpinorVector & spIn, const VBVector & vecIn,
const VBVector & vecOut, bool mc,
const SpinorBarVector & spbOut,
double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
//loop over helicities
for(unsigned int ifh = 0; ifh < 2; ++ifh) {
for(unsigned int ivh = 0; ivh < 2; ++ivh) {
for(unsigned int ovh = 0; ovh < 3; ++ovh) {
if(mc && ovh == 1) ++ovh;
for(unsigned int ofh = 0; ofh < 2; ++ofh) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
//t-chan spin-1/2
if(offshell->iSpin() == PDT::Spin1Half) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, 3, offshell, spbOut[ofh], vecIn[ivh]);
diag = fermion_[ix].first->
evaluate(q2, spIn[ifh], interFB, vecOut[ovh]);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].second->
evaluate(q2, 3, offshell, vecIn[ivh], vecOut[ovh]);
diag = vector_[ix].first->
evaluate(q2, spIn[ifh], spbOut[ofh], interV);
}
else
diag = 0.0;
}
else if(current.channelType == HPDiagram::sChannel) {
SpinorBarWaveFunction interFB = fermion_[ix].second->
evaluate(q2, 1, offshell, spbOut[ofh], vecOut[ovh]);
diag = fermion_[ix].first->
evaluate(q2, spIn[ifh], interFB, vecIn[ivh]);
}
me[ix] += norm(diag);
diagramME()[ix](ifh, 2*ivh, ovh, ofh) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifh, 2*ivh, ovh, ofh) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
ProductionMatrixElement
MEfv2vf::fbv2vfbHeME(const SpinorBarVector & spbIn, const VBVector & vecIn,
const VBVector & vecOut, bool mc,
const SpinorVector & spOut,
double & me2, bool first) const {
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
me2 = 0.;
//loop over helicities
for(unsigned int ifh = 0; ifh < 2; ++ifh) {
for(unsigned int ivh = 0; ivh < 2; ++ivh) {
for(unsigned int ovh = 0; ovh < 3; ++ovh) {
if(mc && ovh == 1) ++ovh;
for(unsigned int ofh = 0; ofh < 2; ++ofh) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin1Half) {
SpinorBarWaveFunction interFB = fermion_[ix].first->
evaluate(q2, 3, offshell, spbIn[ifh], vecOut[ovh]);
diag = fermion_[ix].second->
evaluate(q2, spOut[ofh], interFB, vecIn[ivh]);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 3, offshell, spOut[ofh], spbIn[ifh]);
diag = vector_[ix].second->
evaluate(q2, vecIn[ivh], interV, vecOut[ovh]);
}
else diag = 0.0;
}
else if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin1Half) {
SpinorBarWaveFunction interFB = fermion_[ix].first->
evaluate(q2, 1, offshell, spbIn[ifh], vecIn[ivh]);
diag = fermion_[ix].second->
evaluate(q2, spOut[ofh], interFB, vecOut[ovh]);
}
}
me[ix] += norm(diag);
diagramME()[ix](ifh, ivh, ovh, ofh) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](ifh, ivh, ovh, ofh) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEfv2vf::persistentOutput(PersistentOStream & os) const {
os << fermion_ << vector_;
}
void MEfv2vf::persistentInput(PersistentIStream & is, int) {
is >> fermion_ >> vector_;
}
ClassDescription<MEfv2vf> MEfv2vf::initMEfv2vf;
// Definition of the static class description member.
void MEfv2vf::Init() {
static ClassDocumentation<MEfv2vf> documentation
("This is the implementation of the matrix element for a fermion-vector boson"
"to a vector-fermion.");
}
void MEfv2vf::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
VBVector v1, v3;
bool mc = !(ext[2]->data().mass() > ZERO);
SpinorVector sp;
SpinorBarVector sbar;
VectorWaveFunction(v1, ext[1], incoming, false, true);
VectorWaveFunction(v3, ext[2], outgoing, true, mc);
double dummy(0.);
//Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wavefunctions with rescaled momenta
VectorWaveFunction vir(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
VectorWaveFunction vor(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
if( ext[0]->id() > 0 ) {
SpinorWaveFunction (sp , ext[0], incoming, false);
SpinorBarWaveFunction(sbar, ext[3], outgoing, true);
SpinorWaveFunction spr (rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
spr.reset(ihel);
sp[ihel] = spr;
vir.reset(2*ihel);
v1[ihel] = vir;
vor.reset(2*ihel);
v3[2*ihel] = vor;
sbr.reset(ihel);
sbar[ihel] = sbr;
}
if( !mc ) {
vor.reset(1);
v3[1] = vor;
}
ProductionMatrixElement pme = fv2vfHeME(sp, v1, v3, mc, sbar, dummy,false);
createVertex(pme,ext);
}
else {
SpinorBarWaveFunction(sbar, ext[0], incoming, false);
SpinorWaveFunction(sp, ext[3], outgoing, true);
SpinorBarWaveFunction sbr(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
SpinorWaveFunction spr (rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
sbr.reset(ihel);
sbar[ihel] = sbr;
vir.reset(2*ihel);
v1[ihel] = vir;
vor.reset(2*ihel);
v3[2*ihel] = vor;
spr.reset(ihel);
sp[ihel] = spr;
}
if( !mc ) {
vor.reset(1);
v3[1] = vor;
}
ProductionMatrixElement pme = fbv2vfbHeME(sbar, v1, v3, mc, sp, dummy,false);
createVertex(pme,ext);
}
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
}
void MEfv2vf::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = abs(mePartonData()[0]->id());
long id4 = abs(mePartonData()[3]->id());
if( (id1 != 1 && id1 != 2) || mePartonData()[1]->id() != 21 ||
mePartonData()[2]->id() != 5100021 ||
(id4 != 5100001 && id4 != 5100002 &&
id4 != 6100001 && id4 != 6100002) ) return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
Energy2 s(sHat());
Energy2 mf2 = meMomenta()[2].m2();
// Energy4 spt2 = uHat()*tHat() - sqr(mf2);
//swap t and u as formula defines process vf->vf
Energy2 t3(uHat() - mf2), u4(tHat() - mf2);
Energy4 s2(sqr(s)), t3s(sqr(t3)), u4s(sqr(u4));
double analytic = -gs4*( 5.*s2/12./t3s + s2*s/t3s/u4 + 11.*s*u4/6./t3s
+ 5.*u4s/12./t3s + u4s*u4/s/t3s)/3.;
double diff = abs(analytic - me2);
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/General/MEvv2ff.cc b/MatrixElement/General/MEvv2ff.cc
--- a/MatrixElement/General/MEvv2ff.cc
+++ b/MatrixElement/General/MEvv2ff.cc
@@ -1,288 +1,289 @@
// -*- C++ -*-
//
// MEvv2ff.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEvv2ff class.
//
#include "MEvv2ff.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEvv2ff::doinit() {
GeneralHardME::doinit();
scalar_ .resize(numberOfDiags());
fermion_.resize(numberOfDiags());
vector_ .resize(numberOfDiags());
tensor_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1 , PDT::Spin1,
PDT::Spin1Half, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1 , PDT::Spin1,
PDT::Spin1Half, PDT::Spin1Half));
for( size_t i = 0; i < numberOfDiags(); ++i ) {
HPDiagram dg = getProcessInfo()[i];
if( dg.channelType == HPDiagram::tChannel ) {
AbstractFFVVertexPtr ffv1 =
dynamic_ptr_cast<AbstractFFVVertexPtr>(dg.vertices.first);
AbstractFFVVertexPtr ffv2 =
dynamic_ptr_cast<AbstractFFVVertexPtr>(dg.vertices.second);
fermion_[i] = make_pair(ffv1, ffv2);
}
else if( dg.channelType == HPDiagram::sChannel ) {
if( dg.intermediate->iSpin() == PDT::Spin0 ) {
AbstractVVSVertexPtr vvs =
dynamic_ptr_cast<AbstractVVSVertexPtr>(dg.vertices.first );
AbstractFFSVertexPtr ffs =
dynamic_ptr_cast<AbstractFFSVertexPtr>(dg.vertices.second);
scalar_[i] = make_pair(vvs,ffs);
}
else if( dg.intermediate->iSpin() == PDT::Spin1) {
AbstractVVVVertexPtr vvv =
dynamic_ptr_cast<AbstractVVVVertexPtr>(dg.vertices.first);
AbstractFFVVertexPtr ffv =
dynamic_ptr_cast<AbstractFFVVertexPtr>(dg.vertices.second);
vector_[i] = make_pair(vvv,ffv);
}
else if(dg.intermediate->iSpin() == PDT::Spin2) {
AbstractVVTVertexPtr vvt =
dynamic_ptr_cast<AbstractVVTVertexPtr>(dg.vertices.first);
AbstractFFTVertexPtr fft =
dynamic_ptr_cast<AbstractFFTVertexPtr>(dg.vertices.second);
tensor_[i] = make_pair(vvt,fft);
}
}
}
}
void MEvv2ff::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1Half, PDT::Spin1Half));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1Half, PDT::Spin1Half));
}
double MEvv2ff::me2() const {
// Set up wavefuctions
VBVector v1(2), v2(2);
SpinorVector sp(2); SpinorBarVector sbar(2);
for( size_t i = 0; i < 2; ++i ) {
v1[i] = VectorWaveFunction(rescaledMomenta()[0],mePartonData()[0], 2*i,
incoming);
v2[i] = VectorWaveFunction(rescaledMomenta()[1],mePartonData()[1], 2*i,
incoming);
sbar[i] = SpinorBarWaveFunction(rescaledMomenta()[2], mePartonData()[2], i,
outgoing);
sp[i] = SpinorWaveFunction(rescaledMomenta()[3], mePartonData()[3], i,
outgoing);
}
double full_me(0.);
vv2ffME(v1, v2, sbar, sp, full_me,true);
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
return full_me;
}
ProductionMatrixElement
MEvv2ff::vv2ffME(const VBVector & v1, const VBVector & v2,
const SpinorBarVector & sbar,const SpinorVector & sp,
double & me2, bool first) const {
const Energy mass = sp[0].mass();
const Energy2 q2 = scale();
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
//sum over vector helicities
for(unsigned int iv1 = 0; iv1 < 2; ++iv1) {
for(unsigned int iv2 = 0; iv2 < 2; ++iv2) {
//sum over fermion helicities
for(unsigned int of1 = 0; of1 < 2; ++of1) {
for(unsigned int of2 = 0; of2 < 2; ++of2) {
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
PDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel &&
offshell->iSpin() == PDT::Spin1Half) {
if(current.ordered.second) {
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2, 3, offshell, sp[of2], v2[iv2], mass);
diag = fermion_[ix].first->
evaluate(q2, interF, sbar[of1], v1[iv1]);
}
else {
SpinorWaveFunction interF = fermion_[ix].second->
evaluate(q2, 3, offshell, sp[of2], v1[iv1], mass);
diag = fermion_[ix].first->
evaluate(q2, interF, sbar[of1], v2[iv2]);
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 1, offshell, v1[iv1], v2[iv2]);
diag = scalar_[ix].second->
evaluate(q2, sp[of2], sbar[of1], interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, offshell, v1[iv1], v2[iv2]);
diag = vector_[ix].second->
evaluate(q2, sp[of2], sbar[of1], interV);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 1, offshell, v1[iv1], v2[iv2]);
diag = tensor_[ix].second->
evaluate(q2, sp[of2], sbar[of1], interT);
}
}
else diag = 0.;
me[ix] += norm(diag);
diagramME()[ix](2*iv1, 2*iv2, of1, of2) = diag;
//Compute flows
for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](2*iv1, 2*iv2, of1, of2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEvv2ff::persistentOutput(PersistentOStream & os) const {
os << scalar_ << fermion_ << vector_ << tensor_;
}
void MEvv2ff::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> fermion_ >> vector_ >> tensor_;
}
ClassDescription<MEvv2ff> MEvv2ff::initMEvv2ff;
// Definition of the static class description member.
void MEvv2ff::Init() {
static ClassDocumentation<MEvv2ff> documentation
("The MEvv2ff class handles the ME calculation for the general "
"spin configuration vector-vector to fermion-antifermion\n.");
}
void MEvv2ff::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
// wavefunction with real momenta
VBVector v1, v2;
VectorWaveFunction(v1, ext[0], incoming, false, true);
VectorWaveFunction(v2, ext[1], incoming, false, true);
SpinorBarVector sbar;
SpinorBarWaveFunction(sbar, ext[2], outgoing, true);
SpinorVector sp;
SpinorWaveFunction(sp, ext[3], outgoing, true);
// rescale momenta
setRescaledMomenta(ext);
// wavefuncions with rescaled momenta
VectorWaveFunction v1r(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
VectorWaveFunction v2r(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
SpinorBarWaveFunction sbr(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
SpinorWaveFunction spr(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
v1r.reset(2*ihel);
v1[ihel] = v1r;
v2r.reset(2*ihel);
v2[ihel] = v2r;
sbr.reset(ihel);
sbar[ihel] = sbr;
spr.reset(ihel);
sp[ihel] = spr;
}
double dummy(0.);
ProductionMatrixElement pme = vv2ffME(v1, v2, sbar, sp, dummy,false);
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
createVertex(pme,ext);
}
void MEvv2ff::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id3(abs(mePartonData()[2]->id())), id4(abs(mePartonData()[3]->id()));
if( mePartonData()[0]->id() != 21 || mePartonData()[1]->id() != 21 ||
id3 != id4 || (id3 != 1000021 && id3 != 5100002 && id3 != 5100001 &&
id3 != 6100002 && id3 != 6100001) )
return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
int Nc = sm->Nc();
Energy2 s(sHat());
Energy2 mf2 = meMomenta()[2].m2();
Energy4 spt2 = uHat()*tHat() - sqr(mf2);
Energy2 t3(tHat() - mf2), u4(uHat() - mf2);
double analytic(0.);
if( id3 == 1000021 ) {
analytic = gs4*sqr(Nc)*u4*t3*
( sqr(u4) + sqr(t3) + 4.*mf2*s*spt2/u4/t3 ) *
( 1./sqr(s*t3) + 1./sqr(s*u4) + 1./sqr(u4*t3) )/2./(Nc*Nc - 1.);
}
else {
double brac = sqr(s)/6./t3/u4 - 3./8.;
analytic = gs4*( -4.*sqr(mf2)*brac/t3/u4 + 4.*mf2*brac/s + brac
- 1./3. + 3.*t3*u4/4/s/s);
}
double diff = abs(analytic - me2);
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/General/MEvv2ss.cc b/MatrixElement/General/MEvv2ss.cc
--- a/MatrixElement/General/MEvv2ss.cc
+++ b/MatrixElement/General/MEvv2ss.cc
@@ -1,275 +1,295 @@
// -*- C++ -*-
//
// MEvv2ss.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEvv2ss class.
//
#include "MEvv2ss.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEvv2ss::doinit() {
GeneralHardME::doinit();
scalar1_.resize(numberOfDiags());
scalar2_.resize(numberOfDiags());
vector_ .resize(numberOfDiags());
tensor_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin0, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin0, PDT::Spin0));
for(size_t i = 0; i < numberOfDiags(); ++i ) {
HPDiagram dg = getProcessInfo()[i];
if( !dg.intermediate ) {
contact_ = dynamic_ptr_cast<AbstractVVSSVertexPtr>(dg.vertices.first);
}
else if(dg.channelType == HPDiagram::tChannel) {
AbstractVSSVertexPtr vss1 =
dynamic_ptr_cast<AbstractVSSVertexPtr>(dg.vertices.first);
AbstractVSSVertexPtr vss2 =
dynamic_ptr_cast<AbstractVSSVertexPtr>(dg.vertices.second);
scalar2_[i] = make_pair(vss1, vss2);
}
else {
if( dg.intermediate->iSpin() == PDT::Spin0 ) {
AbstractVVSVertexPtr vvs =
dynamic_ptr_cast<AbstractVVSVertexPtr>(dg.vertices.first);
AbstractSSSVertexPtr sss =
dynamic_ptr_cast<AbstractSSSVertexPtr>(dg.vertices.second);
scalar1_[i] = make_pair(vvs, sss);
}
else if( dg.intermediate->iSpin() == PDT::Spin1 ) {
AbstractVVVVertexPtr vvv =
dynamic_ptr_cast<AbstractVVVVertexPtr>(dg.vertices.first);
AbstractVSSVertexPtr vss =
dynamic_ptr_cast<AbstractVSSVertexPtr>(dg.vertices.second);
vector_[i] = make_pair(vvv, vss);
}
else if( dg.intermediate->iSpin() == PDT::Spin2 ) {
AbstractVVTVertexPtr vvt =
dynamic_ptr_cast<AbstractVVTVertexPtr>(dg.vertices.first);
AbstractSSTVertexPtr sst =
dynamic_ptr_cast<AbstractSSTVertexPtr>(dg.vertices.second);
tensor_[i] = make_pair(vvt, sst);
}
}
}
}
void MEvv2ss::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin0, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin0, PDT::Spin0));
}
double MEvv2ss::me2() const {
VBVector v1(2), v2(2);
for( size_t i = 0; i < 2; ++i ) {
v1[i] = VectorWaveFunction(rescaledMomenta()[0],mePartonData()[0], 2*i,
incoming);
v2[i] = VectorWaveFunction(rescaledMomenta()[1],mePartonData()[1], 2*i,
incoming);
}
ScalarWaveFunction sca1(rescaledMomenta()[2],mePartonData()[2],
Complex(1.,0.),outgoing);
ScalarWaveFunction sca2(rescaledMomenta()[3],mePartonData()[3],
Complex(1.,0.),outgoing);
double full_me(0.);
vv2ssME(v1, v2, sca1, sca2, full_me , true);
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
return full_me;
}
ProductionMatrixElement
MEvv2ss::vv2ssME(const VBVector & v1, const VBVector & v2,
const ScalarWaveFunction & sca1,
const ScalarWaveFunction & sca2,
double & me2, bool first) const {
const Energy2 m2(scale());
const Energy masst = sca1.mass(), massu = sca2.mass();
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
//loop over vector helicities
for(unsigned int iv1 = 0; iv1 < 2; ++iv1) {
for(unsigned int iv2 = 0; iv2 < 2; ++iv2) {
vector<Complex> flows(numberOfFlows(),0.);
// loop over diagrams
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
// do four-point diag first
if(current.channelType == HPDiagram::fourPoint) {
diag = contact_->evaluate(m2, v1[iv1], v2[iv2], sca1, sca2);
}
else {
tcPDPtr offshell = current.intermediate;
if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar2_[ix].first->
evaluate(m2, 3, offshell, v1[iv1], sca1, masst);
diag = scalar2_[ix].second->evaluate(m2, v2[iv2], interS, sca2);
}
else {
ScalarWaveFunction interS = scalar2_[ix].first->
evaluate(m2, 3, offshell, v1[iv1], sca2, massu);
diag = scalar2_[ix].second->evaluate(m2, v2[iv2], interS, sca1);
}
}
else if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar1_[ix].first->
evaluate(m2, 1, offshell, v1[iv1], v2[iv2]);
diag = scalar1_[ix].second->evaluate(m2, interS, sca1, sca2);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(m2, 1, offshell, v1[iv1], v2[iv2]);
diag = vector_[ix].second->evaluate(m2, interV, sca1, sca2);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(m2, 1, offshell, v1[iv1], v2[iv2]);
diag = tensor_[ix].second->evaluate(m2, sca1, sca2, interT);
}
}
else
diag = 0.;
}
me[ix] += norm(diag);
diagramME()[ix](2*iv1, 2*iv2, 0, 0) = diag;
//Compute flows
for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](2*iv1, 2*iv2, 0, 0) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEvv2ss::persistentOutput(PersistentOStream & os) const {
os << scalar1_ << scalar2_ << vector_ << tensor_ << contact_;
}
void MEvv2ss::persistentInput(PersistentIStream & is, int) {
is >> scalar1_ >> scalar2_ >> vector_ >> tensor_ >> contact_;
}
ClassDescription<MEvv2ss> MEvv2ss::initMEvv2ss;
// Definition of the static class description member.
void MEvv2ss::Init() {
static ClassDocumentation<MEvv2ss> documentation
("This class implements the ME for the vector-vector to scalar-scalar "
"hard-process");
}
void MEvv2ss::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
VBVector v1, v2;
// set up the wavefunctions with real momenta
VectorWaveFunction(v1, ext[0], incoming, false, true);
VectorWaveFunction(v2, ext[1], incoming, false, true);
ScalarWaveFunction sca1(ext[2], outgoing, true);
ScalarWaveFunction sca2(ext[3], outgoing, true);
// calculate rescaled moment
setRescaledMomenta(ext);
// wavefunctions with rescaled momenta
VectorWaveFunction v1r (rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
VectorWaveFunction v2r (rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
sca1 = ScalarWaveFunction(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
sca2 = ScalarWaveFunction(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
v1r.reset(2*ihel);
v1[ihel] = v1r;
v2r.reset(2*ihel);
v2[ihel] = v2r;
}
double dummy(0.);
ProductionMatrixElement pme = vv2ssME(v1, v2, sca1, sca2, dummy , false);
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
createVertex(pme,ext);
}
void MEvv2ss::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
- //SUSY gg>~q~q
+ if( mePartonData()[0]->id() != 21 || mePartonData()[1]->id() != 21) return;
long id3 = abs(mePartonData()[2]->id());
long id4 = abs(mePartonData()[3]->id());
- if( mePartonData()[0]->id() != 21 || mePartonData()[1]->id() != 21 ||
- (id3 < 1000001 && id3 > 1000006 ) || (id3 < 2000001 && id3 > 2000006 ) ||
- (id4 < 1000001 && id4 > 1000006 ) || (id4 < 2000001 && id4 > 2000006 ) )
+ int type = -1;
+ //SUSY gg>~q~q
+ if( ((id3 >= 1000001 && id3 <= 1000006 ) && (id4 >= 1000001 && id4 <= 1000006 ) ) ||
+ ((id3 >= 2000001 && id3 <= 2000006 ) && (id4 >= 2000001 && id4 <= 2000006 ) ) ) {
+ type = 0;
+ }
+ // Sextet production
+ else if(mePartonData()[2]->iColour() == PDT::Colour6 &&
+ mePartonData()[3]->iColour() == PDT::Colour6bar ) {
+ type = 1;
+ }
+ else {
return;
- tcSMPtr sm = generator()->standardModel();
- double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
- int Nc = sm->Nc();
+ }
+ double gs4 = sqr( 4.*Constants::pi*SM().alphaS(scale()));
+ int Nc = SM().Nc();
Energy4 s2 = sqr(sHat());
Energy2 m3s = meMomenta()[2].m2();
Energy2 m4s = meMomenta()[3].m2();
Energy4 spt2 = uHat()*tHat() - m3s*m4s;
- Energy4 t3s = sqr(tHat() - m3s);
- Energy4 u4s = sqr(uHat() - m4s);
-
- double analytic = gs4*Nc*( sqr(spt2) + s2*m3s*m4s ) *
- ( u4s + t3s - s2/sqr(Nc) )/2./(sqr(Nc) - 1.)/s2/t3s/u4s;
- double diff = abs(analytic - me2);
- if( diff > 1e-4 ) {
+ Energy2 t3 = tHat()-m3s, u4 = uHat()-m4s;
+ Energy4 t3s = sqr(t3) , u4s = sqr(u4);
+ Energy8 pre = gs4*(sqr(spt2) + s2*m3s*m4s);
+ // matrix element
+ double analytic(0.);
+ // triplet scalars
+ if(type==0) {
+ analytic = pre*Nc*
+ ( u4s + t3s - s2/sqr(Nc) )/2./(sqr(Nc) - 1.)/s2/t3s/u4s;
+ }
+ // sextet scalars
+ else if(type==1) {
+ analytic = pre*(Nc+2.)/(sqr(Nc)-1.)/Nc*
+ ((Nc+2.)*(Nc-1.)/t3s/u4s - sqr(Nc)/t3/u4/s2);
+ }
+ double diff = abs(analytic - me2)/(analytic+me2);
+ if( diff > 1e-10 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/General/MEvv2tv.cc b/MatrixElement/General/MEvv2tv.cc
--- a/MatrixElement/General/MEvv2tv.cc
+++ b/MatrixElement/General/MEvv2tv.cc
@@ -1,284 +1,285 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEvv2tv class.
//
#include "MEvv2tv.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
IBPtr MEvv2tv::clone() const {
return new_ptr(*this);
}
IBPtr MEvv2tv::fullclone() const {
return new_ptr(*this);
}
void MEvv2tv::persistentOutput(PersistentOStream & os) const {
os << vector_ << fourPoint_;
}
void MEvv2tv::persistentInput(PersistentIStream & is, int) {
is >> vector_ >> fourPoint_;
}
ClassDescription<MEvv2tv> MEvv2tv::initMEvv2tv;
// Definition of the static class description member.
void MEvv2tv::Init() {
static ClassDocumentation<MEvv2tv> documentation
("The MEvv2tv class implements the general matrix element "
"for vector vector -> tensor vector.");
}
double MEvv2tv::me2() const {
// check tensor and outgoing vector mass
bool tMass = meMomenta()[2].mass()!=ZERO;
bool vMass = meMomenta()[3].mass()!=ZERO;
// first setup wavefunctions for external particles
VBVector vec1(3),vec2(3),vec3(3);
TBVector ten(5);
for( unsigned int i = 0; i < 5; ++i ) {
if(i!=1 &&i<3) {
vec1[i] = VectorWaveFunction(rescaledMomenta()[0], mePartonData()[0],i ,
incoming);
vec2[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1],i ,
incoming);
}
if( tMass || i==0 || i==4) {
ten[i] = TensorWaveFunction(rescaledMomenta()[2], mePartonData()[2],i ,
outgoing);
}
if(i<3 && (i!=1||vMass) ) {
vec3[i] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3],i ,
outgoing);
}
}
// calculate the ME
double full_me(0.);
vv2tvHeME(vec1,vec2,ten,vec3,full_me,true);
// debugging tests if needed
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
// return the answer
return full_me;
}
void MEvv2tv::doinit() {
GeneralHardME::doinit();
vector_ .resize(numberOfDiags());
fourPoint_ .resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin2, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin2, PDT::Spin1));
for(HPCount i = 0; i < numberOfDiags(); ++i) {
const HPDiagram & current = getProcessInfo()[i];
if(current.channelType == HPDiagram::tChannel) {
if(current.intermediate->iSpin() != PDT::Spin1)
throw InitException() << "MEvv2tv:doinit() - Cannot find correct "
<< "t-channel from diagram. Vertex not cast! "
<< Exception::runerror;
if( current.ordered.second )
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractVVVVertexPtr>(current.vertices.second),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.first ));
else
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractVVVVertexPtr>(current.vertices.first ),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.second));
}
else if (current.channelType == HPDiagram::sChannel) {
if(current.intermediate->iSpin() != PDT::Spin1)
throw InitException() << "MEvv2tv:doinit() - Cannot find correct "
<< "s-channel from diagram. Vertex not cast! "
<< Exception::runerror;
vector_[i] =
make_pair(dynamic_ptr_cast<AbstractVVVVertexPtr>(current.vertices.first ),
dynamic_ptr_cast<AbstractVVTVertexPtr>(current.vertices.second));
}
else if(current.channelType == HPDiagram::fourPoint) {
fourPoint_[i] =
dynamic_ptr_cast<AbstractVVVTVertexPtr>(current.vertices.first);
}
}
}
void MEvv2tv::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin2, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin2, PDT::Spin1));
}
ProductionMatrixElement MEvv2tv::vv2tvHeME(const VBVector & vec1,
const VBVector & vec2,
const TBVector & ten,
const VBVector & vec3,
double & full_me, bool first) const {
// scale
const Energy2 q2(scale());
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
bool tMass = meMomenta()[2].mass() != ZERO;
bool vMass = meMomenta()[3].mass() != ZERO;
// flow over the helicities and diagrams
for(unsigned int iv1 = 0; iv1 < 3; iv1+=2) {
for(unsigned int iv2 = 0; iv2 < 3; iv2+=2) {
for(unsigned int it=0; it<5; ++it) {
if( (it>0&&it<4) && !tMass ) continue;
for(unsigned int iv3=0; iv3<3;++iv3) {
if(iv3==1&&!vMass) continue;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr internal(current.intermediate);
if(current.channelType == HPDiagram::tChannel) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, vec2[iv2], vec3[iv3]);
diag = vector_[ix].second->
evaluate(q2,interV,vec1[iv1],ten[it]);
}
else {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, vec3[iv3], vec1[iv1]);
diag = vector_[ix].second->
evaluate(q2,interV,vec2[iv2],ten[it]);
}
}
else if(current.channelType == HPDiagram::sChannel) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, internal, vec1[iv1], vec2[iv2]);
diag = vector_[ix].second->evaluate(q2, interV, vec3[iv3],ten[it]);
}
else if(current.channelType == HPDiagram::fourPoint) {
diag = fourPoint_[ix]->
evaluate(q2,vec1[iv1],vec2[iv2],vec3[iv3],ten[it]);
}
// diagram
me[ix] += norm(diag);
diagramME()[ix](iv1,iv2,it,iv3) = diag;
// contributions to the different colour flows
for(unsigned int iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
}
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](iv1,iv2,it,iv3) = flows[iy];
// contribution to the squared matrix element
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii)
for(unsigned int ij = 0; ij < numberOfFlows(); ++ij)
full_me += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
full_me = selectColourFlow(flow,me,full_me);
return flowME()[colourFlow()];
}
void MEvv2tv::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
long id1 = mePartonData()[0]->id();
long id2 = mePartonData()[1]->id();
long id4 = mePartonData()[3]->id();
if(id1 != ParticleID::g || id2 != ParticleID::g ||
id4 != ParticleID::g ) return;
unsigned int iloc(0);
for(;iloc<vector_.size();++iloc)
if(vector_[iloc].first) break;
double gs = abs(vector_[iloc].second->norm());
InvEnergy kappa = abs(vector_[iloc].first->norm())*UnitRemoval::InvE;
Energy2 mg2 = sqr(meMomenta()[2].mass());
double anal2 = 3./32.*sqr(gs)*sqr(kappa)/sHat()/tHat()/uHat()
*(pow<4,1>(sHat()-mg2)+pow<4,1>(tHat()-mg2)+pow<4,1>(uHat()-mg2));
double diff = abs((anal2 - me2)/(anal2+me2));
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << anal2/me2
<< '\n';
}
}
void MEvv2tv::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
// set wave functions with real momenta
VBVector v1, v2;
VectorWaveFunction(v1, ext[0], incoming, false, true);
VectorWaveFunction(v2, ext[1], incoming, false, true);
//function to calculate me2 expects massless incoming vectors
// and this constructor sets the '1' polarisation at element [2]
//in the vector
bool mc = !(ext[2]->momentum().mass() > ZERO);
bool md = !(ext[3]->data() .mass() > ZERO);
VBVector v4;
vector<TensorWaveFunction> t3;
TensorWaveFunction(t3, ext[2], outgoing, true, mc);
VectorWaveFunction(v4, ext[3], outgoing, true, md);
// Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wave functions with rescaled momenta
VectorWaveFunction vr1(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
VectorWaveFunction vr2(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
TensorWaveFunction tr3(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
VectorWaveFunction vr4(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
vr1.reset(2*ihel);
v1[ihel] = vr1;
vr2.reset(2*ihel);
v2[ihel] = vr2;
tr3.reset(4*ihel);
t3[4*ihel] = tr3;
vr4.reset(2*ihel);
v4[2*ihel] = vr4;
}
if( !md ) {
vr4.reset(1);
v4[1] = vr4;
}
if( !mc ) {
for(unsigned int ihel=1;ihel<4;++ihel) {
tr3.reset(ihel);
t3[ihel] = tr3;
}
}
double dummy(0.);
ProductionMatrixElement pme = vv2tvHeME(v1, v2, t3, v4,dummy,false);
createVertex(pme,ext);
}
diff --git a/MatrixElement/General/MEvv2vs.cc b/MatrixElement/General/MEvv2vs.cc
--- a/MatrixElement/General/MEvv2vs.cc
+++ b/MatrixElement/General/MEvv2vs.cc
@@ -1,260 +1,262 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEvv2vs class.
//
#include "MEvv2vs.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::ScalarWaveFunction;
using ThePEG::Helicity::VectorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
IBPtr MEvv2vs::clone() const {
return new_ptr(*this);
}
IBPtr MEvv2vs::fullclone() const {
return new_ptr(*this);
}
void MEvv2vs::persistentOutput(PersistentOStream & os) const {
os << scalar_ << vector_;
}
void MEvv2vs::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> vector_;
}
ClassDescription<MEvv2vs> MEvv2vs::initMEvv2vs;
// Definition of the static class description member.
void MEvv2vs::Init() {
static ClassDocumentation<MEvv2vs> documentation
("The MEvv2vs class implements the general matrix elements"
" for vector vector -> vector scalar");
}
void MEvv2vs::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin0));
for(size_t i = 0; i < numberOfDiags(); ++i) {
HPDiagram diag = getProcessInfo()[i];
tcPDPtr offshell = diag.intermediate;
assert(offshell);
if(offshell->iSpin() == PDT::Spin0) {
AbstractVVSVertexPtr vert1;
AbstractVSSVertexPtr vert2;
if(diag.channelType == HPDiagram::sChannel ||
(diag.channelType == HPDiagram::tChannel && diag.ordered.second)) {
vert1 = dynamic_ptr_cast<AbstractVVSVertexPtr>(diag.vertices.first );
vert2 = dynamic_ptr_cast<AbstractVSSVertexPtr>(diag.vertices.second);
}
else {
vert1 = dynamic_ptr_cast<AbstractVVSVertexPtr>(diag.vertices.second);
vert2 = dynamic_ptr_cast<AbstractVSSVertexPtr>(diag.vertices.first );
}
scalar_[i] = make_pair(vert1, vert2);
}
else if(offshell->iSpin() == PDT::Spin1) {
AbstractVVVVertexPtr vert1;
AbstractVVSVertexPtr vert2;
if(diag.channelType == HPDiagram::sChannel ||
(diag.channelType == HPDiagram::tChannel && diag.ordered.second)) {
vert1 = dynamic_ptr_cast<AbstractVVVVertexPtr>(diag.vertices.first );
vert2 = dynamic_ptr_cast<AbstractVVSVertexPtr>(diag.vertices.second);
}
else {
vert1 = dynamic_ptr_cast<AbstractVVVVertexPtr>(diag.vertices.second);
vert2 = dynamic_ptr_cast<AbstractVVSVertexPtr>(diag.vertices.first );
}
vector_[i] = make_pair(vert1, vert2);
}
}
}
void MEvv2vs::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin0));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin0));
}
double MEvv2vs::me2() const {
VBVector va(2), vb(2), vc(3);
for(unsigned int i = 0; i < 2; ++i) {
va[i] = VectorWaveFunction(rescaledMomenta()[0], mePartonData()[0], 2*i,
incoming);
vb[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*i,
incoming);
}
//always 0 and 2 polarisations
for(unsigned int i = 0; i < 2; ++i) {
vc[2*i] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 2*i,
outgoing);
}
bool mc = !(mePartonData()[2]->mass() > ZERO);
//massive vector, also 1
if( !mc )
vc[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 1,
outgoing);
ScalarWaveFunction sd(rescaledMomenta()[3], mePartonData()[3], outgoing);
double full_me(0.);
vv2vsHeME(va, vb, vc, mc, sd, full_me,true);
return full_me;
}
ProductionMatrixElement
MEvv2vs::vv2vsHeME(VBVector & vin1, VBVector & vin2,
VBVector & vout1, bool mc, ScalarWaveFunction & sd,
double & me2, bool first) const {
const Energy2 q2(scale());
const Energy mass = vout1[0].mass();
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ohel1 = 0; ohel1 < 3; ++ohel1) {
if(mc && ohel1 == 1) ++ohel1;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(!offshell) continue;
if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 1, offshell,vin1[ihel1], vin2[ihel2]);
diag = scalar_[ix].second->
evaluate(q2, vout1[ohel1], sd, interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, offshell, vin1[ihel1], vin2[ihel2]);
diag = vector_[ix].second->
evaluate(q2, vout1[ohel1], interV, sd);
}
else
assert(false);
}
else if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar_[ix].
first->evaluate(q2, 3, offshell, vin1[ihel1],vout1[ohel1], mass);
diag = scalar_[ix].second->
evaluate(q2, vin2[ihel2], sd, interS);
}
else {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 3, offshell, vin2[ihel2],vout1[ohel1], mass);
diag = scalar_[ix].second->
evaluate(q2, vin1[ihel1], sd, interS);
}
}
else if(offshell->iSpin() == PDT::Spin1) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].
first->evaluate(q2, 3, offshell, vin1[ihel1],vout1[ohel1], mass);
diag = vector_[ix].second->
evaluate(q2, vin2[ihel2], interV, sd);
}
else {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 3, offshell, vin2[ihel2],vout1[ohel1], mass);
diag = vector_[ix].second->
evaluate(q2, vin1[ihel1], interV, sd);
}
}
else
assert(false);
}
else
assert(false);
me[ix] += norm(diag);
diagramME()[ix](2*ihel1, 2*ihel2, ohel1,0) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](2*ihel1, 2*ihel2, ohel1, 0) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEvv2vs::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
// set wave functions with real momenta
VBVector v1, v2, v3;
VectorWaveFunction(v1, ext[0], incoming, false, true);
VectorWaveFunction(v2, ext[1], incoming, false, true);
//function to calculate me2 expects massless incoming vectors
// and this constructor sets the '1' polarisation at element [2]
//in the vector
bool mc = !(ext[2]->data().mass() > ZERO);
VectorWaveFunction(v3, ext[2], outgoing, true, mc);
ScalarWaveFunction sd(ext[3], outgoing, true);
// Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wave functions with rescaled momenta
VectorWaveFunction vr1(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
VectorWaveFunction vr2(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
VectorWaveFunction vr3(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
ScalarWaveFunction sr4(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
vr1.reset(2*ihel);
v1[ihel] = vr1;
vr2.reset(2*ihel);
v2[ihel] = vr2;
vr3.reset(2*ihel);
v3[2*ihel] = vr3;
}
if( !mc ) {
vr3.reset(1);
v3[1] = vr3;
}
double dummy(0.);
ProductionMatrixElement pme = vv2vsHeME(v1, v2, v3, mc, sd, dummy,false);
createVertex(pme,ext);
}
diff --git a/MatrixElement/General/MEvv2vv.cc b/MatrixElement/General/MEvv2vv.cc
--- a/MatrixElement/General/MEvv2vv.cc
+++ b/MatrixElement/General/MEvv2vv.cc
@@ -1,346 +1,349 @@
// -*- C++ -*-
//
// MEvv2vv.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MEvv2vv class.
//
#include "MEvv2vv.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
using ThePEG::Helicity::ScalarWaveFunction;
using ThePEG::Helicity::TensorWaveFunction;
using ThePEG::Helicity::incoming;
using ThePEG::Helicity::outgoing;
void MEvv2vv::doinit() {
GeneralHardME::doinit();
scalar_.resize(numberOfDiags());
vector_.resize(numberOfDiags());
tensor_.resize(numberOfDiags());
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin1));
for(size_t i = 0; i < numberOfDiags(); ++i) {
HPDiagram diag = getProcessInfo()[i];
tcPDPtr offshell = diag.intermediate;
if(!offshell)
fourPointVertex_ = dynamic_ptr_cast<AbstractVVVVVertexPtr>
(diag.vertices.first);
else if(offshell->iSpin() == PDT::Spin0) {
AbstractVVSVertexPtr vert1 = dynamic_ptr_cast<AbstractVVSVertexPtr>
(diag.vertices.first);
AbstractVVSVertexPtr vert2 = dynamic_ptr_cast<AbstractVVSVertexPtr>
(diag.vertices.second);
scalar_[i] = make_pair(vert1, vert2);
}
else if(offshell->iSpin() == PDT::Spin1) {
AbstractVVVVertexPtr vert1 = dynamic_ptr_cast<AbstractVVVVertexPtr>
(diag.vertices.first);
AbstractVVVVertexPtr vert2 = dynamic_ptr_cast<AbstractVVVVertexPtr>
(diag.vertices.second);
vector_[i] = make_pair(vert1, vert2);
}
else if(offshell->iSpin() == PDT::Spin2) {
AbstractVVTVertexPtr vert1 = dynamic_ptr_cast<AbstractVVTVertexPtr>
(diag.vertices.first);
AbstractVVTVertexPtr vert2 = dynamic_ptr_cast<AbstractVVTVertexPtr>
(diag.vertices.second);
tensor_[i] = make_pair(vert1, vert2);
}
}
}
void MEvv2vv::doinitrun() {
GeneralHardME::doinitrun();
flowME().resize(numberOfFlows(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin1));
diagramME().resize(numberOfDiags(),
ProductionMatrixElement(PDT::Spin1, PDT::Spin1,
PDT::Spin1, PDT::Spin1));
}
double MEvv2vv::me2() const {
VBVector va(2), vb(2), vc(3), vd(3);
for(unsigned int i = 0; i < 2; ++i) {
va[i] = VectorWaveFunction(rescaledMomenta()[0], mePartonData()[0], 2*i,
incoming);
vb[i] = VectorWaveFunction(rescaledMomenta()[1], mePartonData()[1], 2*i,
incoming);
}
//always 0 and 2 polarisations
for(unsigned int i = 0; i < 2; ++i) {
vc[2*i] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 2*i,
outgoing);
vd[2*i] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3], 2*i,
outgoing);
}
bool mc = !(mePartonData()[2]->mass() > ZERO);
//massive vector, also 1
if( !mc )
vc[1] = VectorWaveFunction(rescaledMomenta()[2], mePartonData()[2], 1,
outgoing);
bool md = !(mePartonData()[3]->mass() > ZERO);
if( !md )
vd[1] = VectorWaveFunction(rescaledMomenta()[3], mePartonData()[3], 1,
outgoing);
double full_me(0.);
vv2vvHeME(va, vb, vc, mc, vd, md, full_me,true);
#ifndef NDEBUG
if( debugME() ) debug(full_me);
#endif
return full_me;
}
ProductionMatrixElement
MEvv2vv::vv2vvHeME(VBVector & vin1, VBVector & vin2,
VBVector & vout1, bool mc, VBVector & vout2, bool md,
double & me2, bool first) const {
const Energy2 q2(scale());
const Energy mass = vout1[0].mass();
// weights for the selection of the diagram
vector<double> me(numberOfDiags(), 0.);
// weights for the selection of the colour flow
vector<double> flow(numberOfFlows(),0.);
// flow over the helicities and diagrams
for(unsigned int ihel1 = 0; ihel1 < 2; ++ihel1) {
for(unsigned int ihel2 = 0; ihel2 < 2; ++ihel2) {
for(unsigned int ohel1 = 0; ohel1 < 3; ++ohel1) {
if(mc && ohel1 == 1) ++ohel1;
for(unsigned int ohel2 = 0; ohel2 < 3; ++ohel2) {
if(md && ohel2 == 1) ++ohel2;
vector<Complex> flows(numberOfFlows(),0.);
for(HPCount ix = 0; ix < numberOfDiags(); ++ix) {
Complex diag(0.);
const HPDiagram & current = getProcessInfo()[ix];
tcPDPtr offshell = current.intermediate;
if(!offshell) continue;
if(current.channelType == HPDiagram::sChannel) {
if(offshell->iSpin() == PDT::Spin0) {
- ScalarWaveFunction interS = scalar_[ix].first->evaluate(q2, 1, offshell,
- vin1[ihel1], vin2[ihel2]);
+ ScalarWaveFunction interS =
+ scalar_[ix].first->evaluate(q2, 1, offshell,
+ vin1[ihel1], vin2[ihel2]);
diag = scalar_[ix].second->
evaluate(q2, vout1[ohel1], vout2[ohel2], interS);
}
else if(offshell->iSpin() == PDT::Spin1) {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 1, offshell, vin1[ihel1], vin2[ihel2]);
diag = vector_[ix].second->
evaluate(q2, vout1[ohel1], vout2[ohel2], interV);
- if(colour()==Colour88to88)
+ if(colour()==Colour88to88 || colour()==Colour88to66bar)
diag += fourPointVertex_->evaluate(q2, 0, vout1[ohel1], vin2[ihel2],
vout2[ohel2], vin1[ihel1]);
}
else if(offshell->iSpin() == PDT::Spin2) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 1, offshell, vin1[ihel1], vin2[ihel2]);
diag = tensor_[ix].second->
evaluate(q2, vout1[ohel1], vout2[ohel2],interT);
}
else
assert(false);
}
else if(current.channelType == HPDiagram::tChannel) {
if(offshell->iSpin() == PDT::Spin0) {
if(current.ordered.second) {
ScalarWaveFunction interS = scalar_[ix].
first->evaluate(q2, 3, offshell, vin1[ihel1],vout1[ohel1], mass);
diag = scalar_[ix].second->
evaluate(q2, vin2[ihel2], vout2[ohel2], interS);
}
else {
ScalarWaveFunction interS = scalar_[ix].first->
evaluate(q2, 3, offshell, vin2[ihel2],vout1[ohel1], mass);
diag = scalar_[ix].second->
evaluate(q2, vin1[ihel1], vout2[ohel2], interS);
}
}
else if(offshell->iSpin() == PDT::Spin1) {
if(current.ordered.second) {
VectorWaveFunction interV = vector_[ix].
first->evaluate(q2, 3, offshell, vin1[ihel1],vout1[ohel1], mass);
diag = vector_[ix].second->
evaluate(q2, vin2[ihel2], interV, vout2[ohel2]);
- if(colour()==Colour88to88)
+ if(colour()==Colour88to88 || colour()==Colour88to66bar)
diag += fourPointVertex_->evaluate(q2, 0, vin1[ihel1], vin2[ihel2],
vout1[ohel1], vout2[ohel2]);
}
else {
VectorWaveFunction interV = vector_[ix].first->
evaluate(q2, 3, offshell, vin2[ihel2],vout1[ohel1], mass);
diag = vector_[ix].second->
evaluate(q2, vin1[ihel1], interV, vout2[ohel2]);
- if(colour()==Colour88to88)
+ if(colour()==Colour88to88 || colour()==Colour88to66bar)
diag += fourPointVertex_->
evaluate(q2, 0, vin2[ihel2], vin1[ihel1],
vout1[ohel1], vout2[ohel2]);
}
}
else if(offshell->iSpin() == PDT::Spin2) {
if(current.ordered.second) {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 3, offshell, vin1[ihel1],vout1[ohel1], mass);
diag = tensor_[ix].second->
evaluate(q2, vin2[ihel2], vout2[ohel2], interT);
}
else {
TensorWaveFunction interT = tensor_[ix].first->
evaluate(q2, 3, offshell, vin2[ihel2],vout1[ohel1], mass);
diag = tensor_[ix].second->
evaluate(q2, vin1[ihel1], vout2[ohel2], interT);
}
}
else
assert(false);
}
else if(current.channelType == HPDiagram::fourPoint) {
- if(colour()==Colour88to88)
+ if(colour()==Colour88to88||colour()==Colour88to66bar)
diag = 0.;
else
diag = fourPointVertex_->evaluate(q2, 0, vin1[ihel1], vin2[ihel2],
vout1[ohel1], vout2[ohel2]);
}
else
assert(false);
me[ix] += norm(diag);
diagramME()[ix](2*ihel1, 2*ihel2, ohel1, ohel2) = diag;
//Compute flows
- for(size_t iy = 0; iy < current.colourFlow.size(); ++iy)
+ for(size_t iy = 0; iy < current.colourFlow.size(); ++iy) {
+ assert(current.colourFlow[iy].first<flows.size());
flows[current.colourFlow[iy].first] +=
current.colourFlow[iy].second * diag;
+ }
}
// MEs for the different colour flows
for(unsigned int iy = 0; iy < numberOfFlows(); ++iy)
flowME()[iy](2*ihel1, 2*ihel2, ohel1, ohel2) = flows[iy];
//Now add flows to me2 with appropriate colour factors
for(size_t ii = 0; ii < numberOfFlows(); ++ii)
for(size_t ij = 0; ij < numberOfFlows(); ++ij)
me2 += getColourFactors()[ii][ij]*(flows[ii]*conj(flows[ij])).real();
// contribution to the colour flow
for(unsigned int ii = 0; ii < numberOfFlows(); ++ii) {
flow[ii] += getColourFactors()[ii][ii]*norm(flows[ii]);
}
}
}
}
}
// if not computing the cross section return the selected colour flow
if(!first) return flowME()[colourFlow()];
me2 = selectColourFlow(flow,me,me2);
return flowME()[colourFlow()];
}
void MEvv2vv::persistentOutput(PersistentOStream & os) const {
os << scalar_ << vector_ << tensor_ << fourPointVertex_;
}
void MEvv2vv::persistentInput(PersistentIStream & is, int) {
is >> scalar_ >> vector_ >> tensor_ >> fourPointVertex_;
}
ClassDescription<MEvv2vv> MEvv2vv::initMEvv2vv;
// Definition of the static class description member.
void MEvv2vv::Init() {
static ClassDocumentation<MEvv2vv> documentation
("This is the implementation of the 2 to 2 ME for a pair"
"of massless vector-bosons to a pair of vector bosons");
}
void MEvv2vv::constructVertex(tSubProPtr sub) {
ParticleVector ext = hardParticles(sub);
// set wave functions with real momenta
VBVector v1, v2, v3, v4;
VectorWaveFunction(v1, ext[0], incoming, false, true);
VectorWaveFunction(v2, ext[1], incoming, false, true);
//function to calculate me2 expects massless incoming vectors
// and this constructor sets the '1' polarisation at element [2]
//in the vector
bool mc = !(ext[2]->data().mass() > ZERO);
bool md = !(ext[3]->data().mass() > ZERO);
VectorWaveFunction(v3, ext[2], outgoing, true, mc);
VectorWaveFunction(v4, ext[3], outgoing, true, md);
// Need to use rescale momenta to calculate matrix element
setRescaledMomenta(ext);
// wave functions with rescaled momenta
VectorWaveFunction vr1(rescaledMomenta()[0],
ext[0]->dataPtr(), incoming);
VectorWaveFunction vr2(rescaledMomenta()[1],
ext[1]->dataPtr(), incoming);
VectorWaveFunction vr3(rescaledMomenta()[2],
ext[2]->dataPtr(), outgoing);
VectorWaveFunction vr4(rescaledMomenta()[3],
ext[3]->dataPtr(), outgoing);
for( unsigned int ihel = 0; ihel < 2; ++ihel ) {
vr1.reset(2*ihel);
v1[ihel] = vr1;
vr2.reset(2*ihel);
v2[ihel] = vr2;
vr3.reset(2*ihel);
v3[2*ihel] = vr3;
vr4.reset(2*ihel);
v4[2*ihel] = vr4;
}
if( !mc ) {
vr3.reset(1);
v3[1] = vr3;
}
if( !md ) {
vr4.reset(1);
v4[1] = vr4;
}
double dummy(0.);
ProductionMatrixElement pme = vv2vvHeME(v1, v2, v3, mc, v4, md, dummy,false);
#ifndef NDEBUG
if( debugME() ) debug(dummy);
#endif
createVertex(pme,ext);
}
void MEvv2vv::debug(double me2) const {
if( !generator()->logfile().is_open() ) return;
if( mePartonData()[0]->id() != 21 || mePartonData()[1]->id() != 21 ||
mePartonData()[2]->id() != 5100021 ||
mePartonData()[3]->id() != 5100021 ) return;
tcSMPtr sm = generator()->standardModel();
double gs4 = sqr( 4.*Constants::pi*sm->alphaS(scale()) );
Energy2 s(sHat());
Energy2 mf2 = meMomenta()[2].m2();
Energy2 t3(tHat() - mf2), u4(uHat() - mf2);
Energy4 s2(sqr(s)), t3s(sqr(t3)), u4s(sqr(u4));
Energy4 num = s2 + t3s + u4s;
double analytic = 3.*mf2*( mf2*num/t3s/u4s - num/s/t3/u4 ) + 1.
+ sqr(num)*num/4./s2/t3s/u4s - t3*u4/s2;
analytic *= 9.*gs4/8.;
double diff = abs( analytic - me2 );
if( diff > 1e-4 ) {
generator()->log()
<< mePartonData()[0]->PDGName() << ","
<< mePartonData()[1]->PDGName() << "->"
<< mePartonData()[2]->PDGName() << ","
<< mePartonData()[3]->PDGName() << " difference: "
<< setprecision(10) << diff << " ratio: " << analytic/me2 << '\n';
}
}
diff --git a/MatrixElement/Lepton/MEee2gZ2qqSextet.cc b/MatrixElement/Lepton/MEee2gZ2qqSextet.cc
new file mode 100644
--- /dev/null
+++ b/MatrixElement/Lepton/MEee2gZ2qqSextet.cc
@@ -0,0 +1,1150 @@
+// -*- C++ -*-
+//
+// MEee2gZ2qq.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
+// Copyright (C) 2002-2011 The Herwig Collaboration
+//
+// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
+// Please respect the MCnet academic guidelines, see GUIDELINES for details.
+//
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the MEee2gZ2qqSextet class.
+//
+
+#include "MEee2gZ2qqSextet.h"
+#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Interface/Switch.h"
+#include "ThePEG/Interface/Parameter.h"
+#include "ThePEG/Interface/Reference.h"
+#include "ThePEG/Persistency/PersistentOStream.h"
+#include "ThePEG/Persistency/PersistentIStream.h"
+#include "ThePEG/PDT/EnumParticles.h"
+#include "ThePEG/MatrixElement/Tree2toNDiagram.h"
+#include "ThePEG/Handlers/StandardXComb.h"
+#include "Herwig++/MatrixElement/HardVertex.h"
+#include "Herwig++/Shower/Base/Evolver.h"
+#include "Herwig++/Shower/Base/KinematicsReconstructor.h"
+#include "Herwig++/Shower/Base/PartnerFinder.h"
+#include "ThePEG/PDF/PolarizedBeamParticleData.h"
+#include <numeric>
+
+using namespace Herwig;
+
+const double MEee2gZ2qqSextet::EPS_=0.00000001;
+
+void MEee2gZ2qqSextet::doinit() {
+ HwMEBase::doinit();
+ massOption(vector<unsigned int>(2,massopt_));
+ rescalingOption(3);
+ if(minflav_>maxflav_)
+ throw InitException() << "The minimum flavour " << minflav_
+ << "must be lower the than maximum flavour " << maxflav_
+ << " in MEee2gZ2qqSextet::doinit() "
+ << Exception::runerror;
+ // set the particle data objects
+ Z0_ = getParticleData(ParticleID::Z0);
+ gamma_ = getParticleData(ParticleID::gamma);
+ gluon_ = getParticleData(ParticleID::g);
+ // cast the SM pointer to the Herwig SM pointer
+ tcHwSMPtr hwsm= dynamic_ptr_cast<tcHwSMPtr>(standardModel());
+ // do the initialisation
+ if(hwsm) {
+ FFZVertex_ = hwsm->vertexFFZ();
+ FFPVertex_ = hwsm->vertexFFP();
+ FFGVertex_ = hwsm->vertexFFG();
+ }
+ else throw InitException() << "Wrong type of StandardModel object in "
+ << "MEee2gZ2qqSextet::doinit() the Herwig++ version must be used"
+ << Exception::runerror;
+}
+
+void MEee2gZ2qqSextet::getDiagrams() const {
+ // specific the diagrams
+ tcPDPtr ep = getParticleData(ParticleID::eplus);
+ tcPDPtr em = getParticleData(ParticleID::eminus);
+ tcPDPtr gamma = getParticleData(ParticleID::gamma);
+ tcPDPtr Z0 = getParticleData(ParticleID::Z0);
+ // setup the processes
+ for ( int i =minflav_; i<=maxflav_; ++i ) {
+ tcPDPtr qk = getParticleData(i);
+ tcPDPtr qb = qk->CC();
+ add(new_ptr((Tree2toNDiagram(2), em, ep, 1, gamma, 3, qk, 3, qb, -1)));
+ add(new_ptr((Tree2toNDiagram(2), em, ep, 1, Z0 , 3, qk, 3, qb, -2)));
+ }
+}
+
+Energy2 MEee2gZ2qqSextet::scale() const {
+ return sqr(getParticleData(ParticleID::Z0)->mass());
+// return sHat();
+}
+
+unsigned int MEee2gZ2qqSextet::orderInAlphaS() const {
+ return 0;
+}
+
+unsigned int MEee2gZ2qqSextet::orderInAlphaEW() const {
+ return 2;
+}
+
+Selector<MEBase::DiagramIndex>
+MEee2gZ2qqSextet::diagrams(const DiagramVector & diags) const {
+ double lastCont(0.5),lastBW(0.5);
+ if ( lastXCombPtr() ) {
+ lastCont = meInfo()[0];
+ lastBW = meInfo()[1];
+ }
+ Selector<DiagramIndex> sel;
+ for ( DiagramIndex i = 0; i < diags.size(); ++i ) {
+ if ( diags[i]->id() == -1 ) sel.insert(lastCont, i);
+ else if ( diags[i]->id() == -2 ) sel.insert(lastBW, i);
+ }
+ return sel;
+}
+
+Selector<const ColourLines *>
+MEee2gZ2qqSextet::colourGeometries(tcDiagPtr ) const {
+ static const ColourLines c1("-5:1 4:1, -5:2 4:2");
+ static const ColourLines c2("-5:1 4:2, -5:2 4:1");
+ Selector<const ColourLines *> sel;
+ sel.insert(0.5, &c1);
+ sel.insert(0.5, &c2);
+ return sel;
+}
+
+void MEee2gZ2qqSextet::persistentOutput(PersistentOStream & os) const {
+ os << FFZVertex_ << FFPVertex_ << FFGVertex_
+ << Z0_ << gamma_ << gluon_ << minflav_
+ << maxflav_ << massopt_ << alpha_ << ounit(pTmin_,GeV)
+ << preFactor_;
+}
+
+void MEee2gZ2qqSextet::persistentInput(PersistentIStream & is, int) {
+ is >> FFZVertex_ >> FFPVertex_ >> FFGVertex_
+ >> Z0_ >> gamma_ >> gluon_ >> minflav_
+ >> maxflav_ >> massopt_ >> alpha_ >> iunit(pTmin_,GeV)
+ >> preFactor_;
+}
+
+ClassDescription<MEee2gZ2qqSextet> MEee2gZ2qqSextet::initMEee2gZ2qqSextet;
+// Definition of the static class description member.
+void MEee2gZ2qqSextet::Init() {
+
+ static ClassDocumentation<MEee2gZ2qqSextet> documentation
+ ("The MEee2gZ2qqSextet class implements the matrix element for e+e- -> q qbar");
+
+ static Parameter<MEee2gZ2qqSextet,int> interfaceMinimumFlavour
+ ("MinimumFlavour",
+ "The PDG code of the quark with the lowest PDG code to produce.",
+ &MEee2gZ2qqSextet::minflav_, 1, 1, 6,
+ false, false, Interface::limited);
+
+ static Parameter<MEee2gZ2qqSextet,int> interfaceMaximumFlavour
+ ("MaximumFlavour",
+ "The PDG code of the quark with the highest PDG code to produce",
+ &MEee2gZ2qqSextet::maxflav_, 5, 1, 6,
+ false, false, Interface::limited);
+
+ static Switch<MEee2gZ2qqSextet,unsigned int> interfaceTopMassOption
+ ("TopMassOption",
+ "Option for the treatment of the top quark mass",
+ &MEee2gZ2qqSextet::massopt_, 1, false, false);
+ static SwitchOption interfaceTopMassOptionOnMassShell
+ (interfaceTopMassOption,
+ "OnMassShell",
+ "The top is produced on its mass shell",
+ 1);
+ static SwitchOption interfaceTopMassOption2
+ (interfaceTopMassOption,
+ "OffShell",
+ "The top is generated off-shell using the mass and width generator.",
+ 2);
+
+ static Reference<MEee2gZ2qqSextet,ShowerAlpha> interfaceCoupling
+ ("Coupling",
+ "Pointer to the object to calculate the coupling for the correction",
+ &MEee2gZ2qqSextet::alpha_, false, false, true, false, false);
+
+}
+
+double MEee2gZ2qqSextet::me2() const {
+ return loME(mePartonData(),rescaledMomenta(),true);
+}
+
+ProductionMatrixElement MEee2gZ2qqSextet::HelicityME(vector<SpinorWaveFunction> & fin,
+ vector<SpinorBarWaveFunction> & ain,
+ vector<SpinorBarWaveFunction> & fout,
+ vector<SpinorWaveFunction> & aout,
+ double & me,
+ double & cont,
+ double & BW ) const {
+ // the particles should be in the order
+ // for the incoming
+ // 0 incoming fermion (u spinor)
+ // 1 incoming antifermion (vbar spinor)
+ // for the outgoing
+ // 0 outgoing fermion (ubar spinor)
+ // 1 outgoing antifermion (v spinor)
+ // me to be returned
+ ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half,
+ PDT::Spin1Half,PDT::Spin1Half);
+ ProductionMatrixElement gamma (PDT::Spin1Half,PDT::Spin1Half,
+ PDT::Spin1Half,PDT::Spin1Half);
+ ProductionMatrixElement Zboson(PDT::Spin1Half,PDT::Spin1Half,
+ PDT::Spin1Half,PDT::Spin1Half);
+ // wavefunctions for the intermediate particles
+ VectorWaveFunction interZ,interG;
+ // temporary storage of the different diagrams
+ Complex diag1,diag2;
+ // sum over helicities to get the matrix element
+ unsigned int inhel1,inhel2,outhel1,outhel2;
+ double total[3]={0.,0.,0.};
+ for(inhel1=0;inhel1<2;++inhel1) {
+ for(inhel2=0;inhel2<2;++inhel2) {
+ // intermediate Z
+ interZ = FFZVertex_->evaluate(scale(),1,Z0_,fin[inhel1],ain[inhel2]);
+ // intermediate photon
+ interG = FFPVertex_->evaluate(scale(),1,gamma_,fin[inhel1],ain[inhel2]);
+ for(outhel1=0;outhel1<2;++outhel1) {
+ for(outhel2=0;outhel2<2;++outhel2) {
+ // first the Z exchange diagram
+ diag1 = FFZVertex_->evaluate(scale(),aout[outhel2],fout[outhel1],
+ interZ);
+ // then the photon exchange diagram
+ diag2 = FFPVertex_->evaluate(scale(),aout[outhel2],fout[outhel1],
+ interG);
+ // add up squares of individual terms
+ total[1] += norm(diag1);
+ Zboson(inhel1,inhel2,outhel1,outhel2) = diag1;
+ total[2] += norm(diag2);
+ gamma (inhel1,inhel2,outhel1,outhel2) = diag2;
+ // the full thing including interference
+ diag1 += diag2;
+ total[0] += norm(diag1);
+ output(inhel1,inhel2,outhel1,outhel2)=diag1;
+ }
+ }
+ }
+ }
+ for(int ix=0;ix<3;++ix) total[ix] *= 0.25;
+ tcPolarizedBeamPDPtr beam[2] =
+ {dynamic_ptr_cast<tcPolarizedBeamPDPtr>(mePartonData()[0]),
+ dynamic_ptr_cast<tcPolarizedBeamPDPtr>(mePartonData()[1])};
+ if( beam[0] || beam[1] ) {
+ RhoDMatrix rho[2] =
+ {beam[0] ? beam[0]->rhoMatrix() : RhoDMatrix(mePartonData()[0]->iSpin()),
+ beam[1] ? beam[1]->rhoMatrix() : RhoDMatrix(mePartonData()[1]->iSpin())};
+ total[0] = output.average(rho[0],rho[1]);
+ total[1] = Zboson.average(rho[0],rho[1]);
+ total[2] = gamma .average(rho[0],rho[1]);
+ }
+ // results
+ for(int ix=0;ix<3;++ix) total[ix]*= 3.;
+ cont = total[2];
+ BW = total[1];
+ me = total[0];
+ return output;
+}
+
+void MEee2gZ2qqSextet::constructVertex(tSubProPtr sub) {
+ // extract the particles in the hard process
+ ParticleVector hard;
+ hard.push_back(sub->incoming().first);
+ hard.push_back(sub->incoming().second);
+ hard.push_back(sub->outgoing()[0]);
+ hard.push_back(sub->outgoing()[1]);
+ if(hard[0]->id()<hard[1]->id()) swap(hard[0],hard[1]);
+ if(hard[2]->id()<hard[3]->id()) swap(hard[2],hard[3]);
+ vector<SpinorWaveFunction> fin,aout;
+ vector<SpinorBarWaveFunction> ain,fout;
+ // get wave functions for off-shell momenta for later on
+ SpinorWaveFunction( fin ,hard[0],incoming,false,true);
+ SpinorBarWaveFunction(ain ,hard[1],incoming,false,true);
+ SpinorBarWaveFunction(fout,hard[2],outgoing,true ,true);
+ SpinorWaveFunction( aout,hard[3],outgoing,true ,true);
+ // now rescale the momenta and compute the matrix element with the
+ // rescaled momenta for correlations
+ vector<Lorentz5Momentum> momenta;
+ cPDVector data;
+ for(unsigned int ix=0;ix<4;++ix) {
+ momenta.push_back(hard[ix]->momentum());
+ data .push_back(hard[ix]->dataPtr());
+ }
+ rescaleMomenta(momenta,data);
+ SpinorWaveFunction ein (rescaledMomenta()[0],data[0],incoming);
+ SpinorBarWaveFunction pin (rescaledMomenta()[1],data[1],incoming);
+ SpinorBarWaveFunction qkout(rescaledMomenta()[2],data[2],outgoing);
+ SpinorWaveFunction qbout(rescaledMomenta()[3],data[3],outgoing);
+ for(unsigned int ix=0;ix<2;++ix) {
+ ein.reset(ix) ; fin [ix] = ein ;
+ pin.reset(ix) ; ain [ix] = pin ;
+ qkout.reset(ix); fout[ix] = qkout;
+ qbout.reset(ix); aout[ix] = qbout;
+ }
+ // calculate the matrix element
+ double me,cont,BW;
+ ProductionMatrixElement prodme=HelicityME(fin,ain,fout,aout,me,cont,BW);
+ // construct the vertex
+ HardVertexPtr hardvertex=new_ptr(HardVertex());
+ // set the matrix element for the vertex
+ hardvertex->ME(prodme);
+ // set the pointers and to and from the vertex
+ for(unsigned int ix=0;ix<4;++ix) {
+ tSpinPtr spin = hard[ix]->spinInfo();
+ if(ix<2) {
+ tcPolarizedBeamPDPtr beam =
+ dynamic_ptr_cast<tcPolarizedBeamPDPtr>(hard[ix]->dataPtr());
+ if(beam) spin->rhoMatrix() = beam->rhoMatrix();
+ }
+ spin->productionVertex(hardvertex);
+ }
+}
+
+void MEee2gZ2qqSextet::rebind(const TranslationMap & trans) {
+ FFZVertex_ = trans.translate(FFZVertex_);
+ FFPVertex_ = trans.translate(FFPVertex_);
+ FFGVertex_ = trans.translate(FFGVertex_);
+ Z0_ = trans.translate(Z0_);
+ gamma_ = trans.translate(gamma_);
+ gluon_ = trans.translate(gluon_);
+ HwMEBase::rebind(trans);
+}
+
+IVector MEee2gZ2qqSextet::getReferences() {
+ IVector ret = HwMEBase::getReferences();
+ ret.push_back(FFZVertex_);
+ ret.push_back(FFPVertex_);
+ ret.push_back(FFGVertex_);
+ ret.push_back(Z0_ );
+ ret.push_back(gamma_ );
+ ret.push_back(gluon_ );
+ return ret;
+}
+
+void MEee2gZ2qqSextet::initializeMECorrection(ShowerTreePtr , double & initial,
+ double & final) {
+ d_Q_ = sqrt(sHat());
+ d_m_ = 0.5*(meMomenta()[2].mass()+meMomenta()[3].mass());
+ // set the other parameters
+ setRho(sqr(d_m_/d_Q_));
+ setKtildeSymm();
+ // otherwise can do it
+ initial=1.;
+ final =1.;
+}
+
+void MEee2gZ2qqSextet::applyHardMatrixElementCorrection(ShowerTreePtr tree) {
+ // get the quark and antiquark
+ ParticleVector qq;
+ map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cit;
+ for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit)
+ qq.push_back(cit->first->copy());
+ // ensure quark first
+ if(qq[0]->id()<0) swap(qq[0],qq[1]);
+ // get the momenta
+ vector<Lorentz5Momentum> newfs = applyHard(qq);
+ // return if no emission
+ if(newfs.size()!=3) return;
+ // perform final check to ensure energy greater than constituent mass
+ for (int i=0; i<2; i++) {
+ if (newfs[i].e() < qq[i]->data().constituentMass()) return;
+ }
+ if (newfs[2].e() < gluon_->constituentMass())
+ return;
+ // set masses
+ for (int i=0; i<2; i++) newfs[i].setMass(qq[i]->mass());
+ newfs[2].setMass(ZERO);
+ // decide which particle emits
+ bool firstEmits=
+ newfs[2].vect().perp2(newfs[0].vect())<
+ newfs[2].vect().perp2(newfs[1].vect());
+ // create the new quark, antiquark and gluon
+ PPtr newg = gluon_->produceParticle(newfs[2]);
+ PPtr newq,newa;
+ if(firstEmits) {
+ newq = qq[0]->dataPtr()->produceParticle(newfs[0]);
+ newa = new_ptr(Particle(*qq[1]));
+ qq[1]->antiColourLine()->removeAntiColoured(newa);
+ newa->set5Momentum(newfs[1]);
+ }
+ else {
+ newq = new_ptr(Particle(*qq[0]));
+ qq[0]->colourLine()->removeColoured(newq);
+ newq->set5Momentum(newfs[0]);
+ newa = qq[1]->dataPtr()->produceParticle(newfs[1]);
+ }
+ // get the original colour line
+ ColinePtr col;
+ if(qq[0]->id()>0) col=qq[0]->colourLine();
+ else col=qq[0]->antiColourLine();
+ // set the colour lines
+ if(firstEmits) {
+ col->addColoured(newq);
+ col->addAntiColoured(newg);
+ newa->colourNeighbour(newg);
+ }
+ else {
+ col->addAntiColoured(newa);
+ col->addColoured(newg);
+ newq->antiColourNeighbour(newg);
+ }
+ // change the existing quark and antiquark
+ PPtr orig;
+ for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) {
+ if(cit->first->progenitor()->id()==newq->id()) {
+ // remove old particles from colour line
+ col->removeColoured(cit->first->copy());
+ col->removeColoured(cit->first->progenitor());
+ // insert new particles
+ cit->first->copy(newq);
+ ShowerParticlePtr sp(new_ptr(ShowerParticle(*newq,1,true)));
+ cit->first->progenitor(sp);
+ tree->outgoingLines()[cit->first]=sp;
+ cit->first->perturbative(!firstEmits);
+ if(firstEmits) orig=cit->first->original();
+ }
+ else {
+ // remove old particles from colour line
+ col->removeAntiColoured(cit->first->copy());
+ col->removeColoured(cit->first->progenitor());
+ // insert new particles
+ cit->first->copy(newa);
+ ShowerParticlePtr sp(new_ptr(ShowerParticle(*newa,1,true)));
+ cit->first->progenitor(sp);
+ tree->outgoingLines()[cit->first]=sp;
+ cit->first->perturbative(firstEmits);
+ if(!firstEmits) orig=cit->first->original();
+ }
+ }
+ // add the gluon
+ ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true));
+ ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg));
+ gluon->perturbative(false);
+ tree->outgoingLines().insert(make_pair(gluon,sg));
+ tree->hardMatrixElementCorrection(true);
+}
+
+vector<Lorentz5Momentum> MEee2gZ2qqSextet::
+applyHard(const ParticleVector &p) {
+ double x, xbar;
+ vector<Lorentz5Momentum> fs;
+ // return if no emission
+ if (getHard(x, xbar) < UseRandom::rnd() || p.size() != 2) return fs;
+ // centre of mass energy
+ Lorentz5Momentum pcm = p[0]->momentum() + p[1]->momentum();
+ // momenta of quark,antiquark and gluon
+ Lorentz5Momentum pq, pa, pg;
+ if (p[0]->id() > 0) {
+ pq = p[0]->momentum();
+ pa = p[1]->momentum();
+ } else {
+ pa = p[0]->momentum();
+ pq = p[1]->momentum();
+ }
+ // boost to boson rest frame
+ Boost beta = (pcm.findBoostToCM());
+ pq.boost(beta);
+ pa.boost(beta);
+ // return if fails ?????
+ double xg = 2.-x-xbar;
+ if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return fs;
+ Axis u1, u2, u3;
+ // moduli of momenta in units of Q and cos theta
+ // stick to q direction?
+ // p1 is the one that is kept, p2 is the other fermion, p3 the gluon.
+ Energy e1, e2, e3;
+ Energy pp1, pp2, pp3;
+ bool keepq = true;
+ if (UseRandom::rnd() > sqr(x)/(sqr(x)+sqr(xbar)))
+ keepq = false;
+ if (keepq) {
+ pp1 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.;
+ pp2 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.;
+ e1 = d_Q_*x/2.;
+ e2 = d_Q_*xbar/2.;
+ u1 = pq.vect().unit();
+ } else {
+ pp2 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.;
+ pp1 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.;
+ e2 = d_Q_*x/2.;
+ e1 = d_Q_*xbar/2.;
+ u1 = pa.vect().unit();
+ }
+ pp3 = d_Q_*xg/2.;
+ e3 = pp3;
+ u2 = u1.orthogonal();
+ u2 /= u2.mag();
+ u3 = u1.cross(u2);
+ u3 /= u3.mag();
+ double ct2=-2., ct3=-2.;
+ if (pp1 == ZERO || pp2 == ZERO || pp3 == ZERO) {
+ bool touched = false;
+ if (pp1 == ZERO) {
+ ct2 = 1;
+ ct3 = -1;
+ touched = true;
+ }
+ if (pp2 == ZERO || pp3 == ZERO) {
+ ct2 = 1;
+ ct3 = 1;
+ touched = true;
+ }
+ if (!touched)
+ throw Exception() << "MEee2gZ2qqSextet::applyHard()"
+ << " did not set ct2/3"
+ << Exception::abortnow;
+ } else {
+ ct3 = (sqr(pp1)+sqr(pp3)-sqr(pp2))/(2.*pp1*pp3);
+ ct2 = (sqr(pp1)+sqr(pp2)-sqr(pp3))/(2.*pp1*pp2);
+ }
+ double phi = Constants::twopi*UseRandom::rnd();
+ double cphi = cos(phi);
+ double sphi = sin(phi);
+ double st2 = sqrt(1.-sqr(ct2));
+ double st3 = sqrt(1.-sqr(ct3));
+ ThreeVector<Energy> pv1, pv2, pv3;
+ pv1 = pp1*u1;
+ pv2 = -ct2*pp2*u1 + st2*cphi*pp2*u2 + st2*sphi*pp2*u3;
+ pv3 = -ct3*pp3*u1 - st3*cphi*pp3*u2 - st3*sphi*pp3*u3;
+ if (keepq) {
+ pq = Lorentz5Momentum(pv1, e1);
+ pa = Lorentz5Momentum(pv2, e2);
+ } else {
+ pa = Lorentz5Momentum(pv1, e1);
+ pq = Lorentz5Momentum(pv2, e2);
+ }
+ pg = Lorentz5Momentum(pv3, e3);
+ pq.boost(-beta);
+ pa.boost(-beta);
+ pg.boost(-beta);
+ fs.push_back(pq);
+ fs.push_back(pa);
+ fs.push_back(pg);
+ return fs;
+}
+
+double MEee2gZ2qqSextet::getHard(double &x1, double &x2) {
+ double w = 0.0;
+ double y1 = UseRandom::rnd(),y2 = UseRandom::rnd();
+ // simply double MC efficiency
+ // -> weight has to be divided by two (Jacobian)
+ if (y1 + y2 > 1) {
+ y1 = 1.-y1;
+ y2 = 1.-y2;
+ }
+ bool inSoft = false;
+ if (y1 < 0.25) {
+ if (y2 < 0.25) {
+ inSoft = true;
+ if (y1 < y2) {
+ y1 = 0.25-y1;
+ y2 = y1*(1.5 - 2.*y2);
+ } else {
+ y2 = 0.25 - y2;
+ y1 = y2*(1.5 - 2.*y1);
+ }
+ } else {
+ if (y2 < y1 + 2.*sqr(y1)) return w;
+ }
+ } else {
+ if (y2 < 0.25) {
+ if (y1 < y2 + 2.*sqr(y2)) return w;
+ }
+ }
+ // inside PS?
+ x1 = 1.-y1;
+ x2 = 1.-y2;
+ if(y1*y2*(1.-y1-y2) < d_rho_*sqr(y1+y2)) return w;
+ double k1 = getKfromX(x1, x2);
+ double k2 = getKfromX(x2, x1);
+ // Is it in the quark emission zone?
+ if (k1 < d_kt1_) return 0.0;
+ // No...is it in the anti-quark emission zone?
+ if (k2 < d_kt2_) return 0.0;
+ // Point is in dead zone: compute q qbar g weight
+ w = MEV(x1, x2);
+ // for axial:
+ // w = MEA(x1, x2);
+ // Reweight soft region
+ if (inSoft) {
+ if (y1 < y2) w *= 2.*y1;
+ else w *= 2.*y2;
+ }
+ // alpha and colour factors
+ Energy2 pt2 = sqr(d_Q_)*(1.-x1)*(1.-x2);
+ w *= 1./3./Constants::pi*alpha_->value(pt2);
+ return w;
+}
+
+bool MEee2gZ2qqSextet::softMatrixElementVeto(ShowerProgenitorPtr initial,
+ ShowerParticlePtr parent,Branching br) {
+ // check we should be applying the veto
+ if(parent->id()!=initial->progenitor()->id()||
+ br.ids[0]!=br.ids[1]||
+ br.ids[2]!=ParticleID::g) return false;
+ // calculate pt
+ double d_z = br.kinematics->z();
+ Energy d_qt = br.kinematics->scale();
+ Energy2 d_m2 = parent->momentum().m2();
+ Energy pPerp = (1.-d_z)*sqrt( sqr(d_z*d_qt) - d_m2);
+ // if not hardest so far don't apply veto
+ if(pPerp<initial->highestpT()) return false;
+ // calculate the weight
+ double weight = 0.;
+ if(parent->id()>0) weight = qWeightX(d_qt, d_z);
+ else weight = qbarWeightX(d_qt, d_z);
+ // compute veto from weight
+ bool veto = !UseRandom::rndbool(weight);
+ // if not vetoed reset max
+ if(!veto) initial->highestpT(pPerp);
+ // if vetoing reset the scale
+ if(veto) parent->setEvolutionScale(br.kinematics->scale());
+ // return the veto
+ return veto;
+}
+
+void MEee2gZ2qqSextet::setRho(double r) {
+ d_rho_ = r;
+ d_v_ = sqrt(1.-4.*d_rho_);
+}
+
+void MEee2gZ2qqSextet::setKtildeSymm() {
+ d_kt1_ = (1. + sqrt(1. - 4.*d_rho_))/2.;
+ setKtilde2();
+}
+
+void MEee2gZ2qqSextet::setKtilde2() {
+ double num = d_rho_ * d_kt1_ + 0.25 * d_v_ *(1.+d_v_)*(1.+d_v_);
+ double den = d_kt1_ - d_rho_;
+ d_kt2_ = num/den;
+}
+
+double MEee2gZ2qqSextet::getZfromX(double x1, double x2) {
+ double uval = u(x2);
+ double num = x1 - (2. - x2)*uval;
+ double den = sqrt(x2*x2 - 4.*d_rho_);
+ return uval + num/den;
+}
+
+double MEee2gZ2qqSextet::getKfromX(double x1, double x2) {
+ double zval = getZfromX(x1, x2);
+ return (1.-x2)/(zval*(1.-zval));
+}
+
+double MEee2gZ2qqSextet::MEV(double x1, double x2) {
+ // Vector part
+ double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_)
+ - 8.*d_rho_*(1.+2.*d_rho_);
+ double den = (1.+2.*d_rho_)*(1.-x1)*(1.-x2);
+ return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1))
+ - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_;
+}
+
+double MEee2gZ2qqSextet::MEA(double x1, double x2) {
+ // Axial part
+ double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_)
+ + 2.*d_rho_*((5.-x1-x2)*(5.-x1-x2) - 19.0 + 4*d_rho_);
+ double den = d_v_*d_v_*(1.-x1)*(1.-x2);
+ return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1))
+ - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_;
+}
+
+double MEee2gZ2qqSextet::u(double x2) {
+ return 0.5*(1. + d_rho_/(1.-x2+d_rho_));
+}
+
+void MEee2gZ2qqSextet::
+getXXbar(double kti, double z, double &x, double &xbar) {
+ double w = sqr(d_v_) + kti*(-1. + z)*z*(2. + kti*(-1. + z)*z);
+ if (w < 0) {
+ x = -1.;
+ xbar = -1;
+ } else {
+ x = (1. + sqr(d_v_)*(-1. + z) + sqr(kti*(-1. + z))*z*z*z
+ + z*sqrt(w)
+ - kti*(-1. + z)*z*(2. + z*(-2 + sqrt(w))))/
+ (1. - kti*(-1. + z)*z + sqrt(w));
+ xbar = 1. + kti*(-1. + z)*z;
+ }
+}
+
+double MEee2gZ2qqSextet::qWeight(double x, double xbar) {
+ double rval;
+ double xg = 2. - xbar - x;
+ // always return one in the soft gluon region
+ if(xg < EPS_) return 1.0;
+ // check it is in the phase space
+ if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0;
+ double k1 = getKfromX(x, xbar);
+ double k2 = getKfromX(xbar, x);
+ // Is it in the quark emission zone?
+ if(k1 < d_kt1_) {
+ rval = MEV(x, xbar)/PS(x, xbar);
+ // is it also in the anti-quark emission zone?
+ if(k2 < d_kt2_) rval *= 0.5;
+ return rval;
+ }
+ return 1.0;
+}
+
+double MEee2gZ2qqSextet::qbarWeight(double x, double xbar) {
+ double rval;
+ double xg = 2. - xbar - x;
+ // always return one in the soft gluon region
+ if(xg < EPS_) return 1.0;
+ // check it is in the phase space
+ if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0;
+ double k1 = getKfromX(x, xbar);
+ double k2 = getKfromX(xbar, x);
+ // Is it in the antiquark emission zone?
+ if(k2 < d_kt2_) {
+ rval = MEV(x, xbar)/PS(xbar, x);
+ // is it also in the quark emission zone?
+ if(k1 < d_kt1_) rval *= 0.5;
+ return rval;
+ }
+ return 1.0;
+}
+
+double MEee2gZ2qqSextet::qWeightX(Energy qtilde, double z) {
+ double x, xb;
+ getXXbar(sqr(qtilde/d_Q_), z, x, xb);
+ // if exceptionally out of phase space, leave this emission, as there
+ // is no good interpretation for the soft ME correction.
+ if (x < 0 || xb < 0) return 1.0;
+ return qWeight(x, xb);
+}
+
+double MEee2gZ2qqSextet::qbarWeightX(Energy qtilde, double z) {
+ double x, xb;
+ getXXbar(sqr(qtilde/d_Q_), z, xb, x);
+ // see above in qWeightX.
+ if (x < 0 || xb < 0) return 1.0;
+ return qbarWeight(x, xb);
+}
+
+double MEee2gZ2qqSextet::PS(double x, double xbar) {
+ double u = 0.5*(1. + d_rho_ / (1.-xbar+d_rho_));
+ double z = u + (x - (2.-xbar)*u)/sqrt(xbar*xbar - 4.*d_rho_);
+ double brack = (1.+z*z)/(1.-z)- 2.*d_rho_/(1-xbar);
+ // interesting: the splitting function without the subtraction
+ // term. Actually gives a much worse approximation in the collinear
+ // limit. double brack = (1.+z*z)/(1.-z);
+ double den = (1.-xbar)*sqrt(xbar*xbar - 4.*d_rho_);
+ return brack/den;
+}
+
+HardTreePtr MEee2gZ2qqSextet::generateHardest(ShowerTreePtr tree) {
+ // get the momenta of the incoming and outgoing partons
+ // incoming
+ ShowerProgenitorPtr
+ emProgenitor = tree->incomingLines().begin() ->first,
+ epProgenitor = tree->incomingLines().rbegin()->first;
+ // outgoing
+ ShowerProgenitorPtr
+ qkProgenitor = tree->outgoingLines().begin() ->first,
+ qbProgenitor = tree->outgoingLines().rbegin()->first;
+ // get the order right
+ if(emProgenitor->id()<0) swap(emProgenitor,epProgenitor);
+ if(qkProgenitor->id()<0) swap(qkProgenitor,qbProgenitor);
+ loMomenta_.resize(0);
+ // extract the momenta
+ loMomenta_.push_back(emProgenitor->progenitor()->momentum());
+ loMomenta_.push_back(epProgenitor->progenitor()->momentum());
+ loMomenta_.push_back(qkProgenitor->progenitor()->momentum());
+ loMomenta_.push_back(qbProgenitor->progenitor()->momentum());
+ // and ParticleData objects
+ partons_.resize(0);
+ partons_.push_back(emProgenitor->progenitor()->dataPtr());
+ partons_.push_back(epProgenitor->progenitor()->dataPtr());
+ partons_.push_back(qkProgenitor->progenitor()->dataPtr());
+ partons_.push_back(qbProgenitor->progenitor()->dataPtr());
+ partons_.push_back(gluon_);
+ // boost from lab to CMS frame with outgoing particles
+ // along the z axis
+ LorentzRotation eventFrame( ( loMomenta_[2] + loMomenta_[3] ).findBoostToCM() );
+ Lorentz5Momentum spectator = eventFrame*loMomenta_[2];
+ eventFrame.rotateZ( -spectator.phi() );
+ eventFrame.rotateY( -spectator.theta() );
+ eventFrame.invert();
+ // mass of the final-state system
+ Energy2 M2 = (loMomenta_[2]+loMomenta_[3]).m2();
+ Energy M = sqrt(M2);
+ double mu1 = loMomenta_[2].mass()/M;
+ double mu2 = loMomenta_[3].mass()/M;
+ double mu12 = sqr(mu1), mu22 = sqr(mu2);
+ double lambda = sqrt(1.+sqr(mu12)+sqr(mu22)-2.*mu12-2.*mu22-2.*mu12*mu22);
+ // max pT
+ Energy pTmax = 0.5*sqrt(M2)*
+ (1.-sqr(loMomenta_[2].mass()+loMomenta_[3].mass())/M2);
+ // max y
+ if ( pTmax < pTmin_ )
+ return HardTreePtr();
+ double ymax = acosh(pTmax/pTmin_);
+ // prefactor for the overestimate of the Sudakov
+ double a = 4./3.*alpha_->overestimateValue()/Constants::twopi*
+ 2.*ymax*preFactor_;
+ // variables for the emission
+ Energy pT[2];
+ double y[2],phi[2],x3[2],x1[2][2],x2[2][2];
+ double contrib[2][2];
+ // storage of the real emmision momenta
+ vector<Lorentz5Momentum> realMomenta[2][2]=
+ {{vector<Lorentz5Momentum>(5),vector<Lorentz5Momentum>(5)},
+ {vector<Lorentz5Momentum>(5),vector<Lorentz5Momentum>(5)}};
+ for(unsigned int ix=0;ix<2;++ix)
+ for(unsigned int iy=0;iy<2;++iy)
+ for(unsigned int iz=0;iz<2;++iz)
+ realMomenta[ix][iy][iz] = loMomenta_[iz];
+ // generate the emission
+ for(unsigned int ix=0;ix<2;++ix) {
+ if(ix==1) {
+ swap(mu1 ,mu2 );
+ swap(mu12,mu22);
+ }
+ pT[ix] = pTmax;
+ y [ix] = 0.;
+ bool reject = true;
+ do {
+ // generate pT
+ pT[ix] *= pow(UseRandom::rnd(),1./a);
+ if(pT[ix]<pTmin_) {
+ pT[ix] = -GeV;
+ break;
+ }
+ // generate y
+ y[ix] = -ymax+2.*UseRandom::rnd()*ymax;
+ // generate phi
+ phi[ix] = UseRandom::rnd()*Constants::twopi;
+ // calculate x3 and check in allowed region
+ x3[ix] = 2.*pT[ix]*cosh(y[ix])/M;
+ if(x3[ix] < 0. || x3[ix] > 1. -sqr( mu1 + mu2 ) ) continue;
+ // find the possible solutions for x1
+ double xT2 = sqr(2./M*pT[ix]);
+ double root = (-sqr(x3[ix])+xT2)*
+ (xT2*mu22+2.*x3[ix]-sqr(mu12)+2.*mu22+2.*mu12-sqr(x3[ix])-1.
+ +2.*mu12*mu22-sqr(mu22)-2.*mu22*x3[ix]-2.*mu12*x3[ix]);
+ double c1=2.*sqr(x3[ix])-4.*mu22-6.*x3[ix]+4.*mu12-xT2*x3[ix]
+ +2.*xT2-2.*mu12*x3[ix]+2.*mu22*x3[ix]+4.;
+ if(root<0.) continue;
+ x1[ix][0] = 1./(4.-4.*x3[ix]+xT2)*(c1-2.*sqrt(root));
+ x1[ix][1] = 1./(4.-4.*x3[ix]+xT2)*(c1+2.*sqrt(root));
+ // change sign of y if 2nd particle emits
+ if(ix==1) y[ix] *=-1.;
+ // loop over the solutions
+ for(unsigned int iy=0;iy<2;++iy) {
+ contrib[ix][iy]=0.;
+ // check x1 value allowed
+ if(x1[ix][iy]<2.*mu1||x1[ix][iy]>1.+mu12-mu22) continue;
+ // calculate x2 value and check allowed
+ x2[ix][iy] = 2.-x3[ix]-x1[ix][iy];
+ double root = max(0.,sqr(x1[ix][iy])-4.*mu12);
+ root = sqrt(root);
+ double x2min = 1.+mu22-mu12
+ -0.5*(1.-x1[ix][iy]+mu12-mu22)/(1.-x1[ix][iy]+mu12)*(x1[ix][iy]-2.*mu12+root);
+ double x2max = 1.+mu22-mu12
+ -0.5*(1.-x1[ix][iy]+mu12-mu22)/(1.-x1[ix][iy]+mu12)*(x1[ix][iy]-2.*mu12-root);
+ if(x2[ix][iy]<x2min||x2[ix][iy]>x2max) continue;
+ // check the z components
+ double z1 = sqrt(sqr(x1[ix][iy])-4.*mu12-xT2);
+ double z2 = -sqrt(sqr(x2[ix][iy])-4.*mu22);
+ double z3 = pT[ix]*sinh(y[ix])*2./M;
+ if(ix==1) z3 *=-1.;
+ if(abs(-z1+z2+z3)<1e-9) z1 *= -1.;
+ if(abs(z1+z2+z3)>1e-5) continue;
+ // construct the momenta
+ realMomenta[ix][iy][4] =
+ Lorentz5Momentum(pT[ix]*cos(phi[ix]),pT[ix]*sin(phi[ix]),
+ pT[ix]*sinh(y[ix]) ,pT[ix]*cosh(y[ix]),ZERO);
+ if(ix==0) {
+ realMomenta[ix][iy][2] =
+ Lorentz5Momentum(-pT[ix]*cos(phi[ix]),-pT[ix]*sin(phi[ix]),
+ z1*0.5*M,x1[ix][iy]*0.5*M,M*mu1);
+ realMomenta[ix][iy][3] =
+ Lorentz5Momentum(ZERO,ZERO, z2*0.5*M,x2[ix][iy]*0.5*M,M*mu2);
+ }
+ else {
+ realMomenta[ix][iy][2] =
+ Lorentz5Momentum(ZERO,ZERO,-z2*0.5*M,x2[ix][iy]*0.5*M,M*mu2);
+ realMomenta[ix][iy][3] =
+ Lorentz5Momentum(-pT[ix]*cos(phi[ix]),-pT[ix]*sin(phi[ix]),
+ -z1*0.5*M,x1[ix][iy]*0.5*M,M*mu1);
+ }
+ // boost the momenta back to the lab
+ for(unsigned int iz=2;iz<5;++iz)
+ realMomenta[ix][iy][iz] *= eventFrame;
+ // jacobian and prefactors for the weight
+ Energy J = M/sqrt(xT2)*abs(-x1[ix][iy]*x2[ix][iy]+2.*mu22*x1[ix][iy]
+ +x2[ix][iy]+x2[ix][iy]*mu12+mu22*x2[ix][iy]
+ -sqr(x2[ix][iy]))
+ /pow(sqr(x2[ix][iy])-4.*mu22,1.5);
+ // prefactors etc
+ contrib[ix][iy] = 0.5*pT[ix]/J/preFactor_/lambda;
+ // matrix element piece
+ contrib[ix][iy] *= alpha_->ratio(sqr(pT[ix]))*
+ meRatio(partons_,realMomenta[ix][iy],ix,false);
+ }
+ if(contrib[ix][0]+contrib[ix][1]>1.) {
+ ostringstream s;
+ s << "MEee2gZ2qqSextet::generateHardest weight for channel " << ix
+ << "is " << contrib[ix][0]+contrib[ix][1]
+ << " which is greater than 1";
+ generator()->logWarning( Exception(s.str(), Exception::warning) );
+ }
+ reject = UseRandom::rnd() > contrib[ix][0] + contrib[ix][1];
+ }
+ while (reject);
+ if(pT[ix]<pTmin_)
+ pT[ix] = -GeV;
+ }
+ if(pT[0]<ZERO && pT[1]<ZERO) {
+ qkProgenitor->maximumpT(pTmin_);
+ qbProgenitor->maximumpT(pTmin_);
+ return HardTreePtr();
+ }
+ // now pick the emission with highest pT
+ vector<Lorentz5Momentum> emmision;
+ unsigned int iemit=0,ispect=0;
+ Energy pTveto;
+ if(pT[0]>pT[1]) {
+ iemit = 2;
+ ispect = 3;
+ pTveto = pT[0];
+ if(UseRandom::rnd()<contrib[0][0]/(contrib[0][0]+contrib[0][1]))
+ emmision = realMomenta[0][0];
+ else
+ emmision = realMomenta[0][1];
+ }
+ else {
+ iemit = 3;
+ ispect = 2;
+ pTveto = pT[1];
+ if(UseRandom::rnd()<contrib[1][0]/(contrib[1][0]+contrib[1][1]))
+ emmision = realMomenta[1][0];
+ else
+ emmision = realMomenta[1][1];
+ }
+ // Make the particles for the hard tree
+ ShowerParticleVector hardParticles;
+ for(unsigned int ix=0;ix<partons_.size();++ix) {
+ hardParticles.push_back(new_ptr(ShowerParticle(partons_[ix],ix>=2)));
+ hardParticles.back()->set5Momentum(emmision[ix]);
+ }
+ ShowerParticlePtr parent(new_ptr(ShowerParticle(partons_[iemit],true)));
+ Lorentz5Momentum parentMomentum(emmision[iemit]+emmision[4]);
+ parentMomentum.setMass(partons_[iemit]->mass());
+ parent->set5Momentum(parentMomentum);
+ // Create the vectors of HardBranchings to create the HardTree:
+ vector<HardBranchingPtr> spaceBranchings,allBranchings;
+ // Incoming boson:
+ for(unsigned int ix=0;ix<2;++ix) {
+ spaceBranchings.push_back(new_ptr(HardBranching(hardParticles[ix],SudakovPtr(),
+ HardBranchingPtr(),
+ HardBranching::Incoming)));
+ allBranchings.push_back(spaceBranchings.back());
+ }
+ // Outgoing particles from hard emission:
+ HardBranchingPtr spectatorBranch(new_ptr(HardBranching(hardParticles[ispect],
+ SudakovPtr(),HardBranchingPtr(),
+ HardBranching::Outgoing)));
+ HardBranchingPtr emitterBranch(new_ptr(HardBranching(parent,SudakovPtr(),
+ HardBranchingPtr(),
+ HardBranching::Outgoing)));
+ emitterBranch->addChild(new_ptr(HardBranching(hardParticles[iemit],
+ SudakovPtr(),HardBranchingPtr(),
+ HardBranching::Outgoing)));
+ emitterBranch->addChild(new_ptr(HardBranching(hardParticles[4],
+ SudakovPtr(),HardBranchingPtr(),
+ HardBranching::Outgoing)));
+ if(iemit==0) {
+ allBranchings.push_back(emitterBranch);
+ allBranchings.push_back(spectatorBranch);
+ }
+ else {
+ allBranchings.push_back( spectatorBranch );
+ allBranchings.push_back( emitterBranch );
+ }
+ // Make the HardTree from the HardBranching vectors.
+ HardTreePtr hardtree = new_ptr(HardTree(allBranchings,spaceBranchings,
+ ShowerInteraction::QCD));
+ // Set the maximum pt for all other emissions
+ qkProgenitor->maximumpT(pTveto);
+ qbProgenitor->maximumpT(pTveto);
+ // Connect the particles with the branchings in the HardTree
+ hardtree->connect( qkProgenitor->progenitor(), allBranchings[2] );
+ hardtree->connect( qbProgenitor->progenitor(), allBranchings[3] );
+ // colour flow
+ ColinePtr newline=new_ptr(ColourLine());
+ for(set<HardBranchingPtr>::const_iterator cit=hardtree->branchings().begin();
+ cit!=hardtree->branchings().end();++cit) {
+ if((**cit).branchingParticle()->dataPtr()->iColour()==PDT::Colour3)
+ newline->addColoured((**cit).branchingParticle());
+ else if((**cit).branchingParticle()->dataPtr()->iColour()==PDT::Colour3bar)
+ newline->addAntiColoured((**cit).branchingParticle());
+ }
+ // Return the HardTree
+ return hardtree;
+}
+
+double MEee2gZ2qqSextet::meRatio(vector<cPDPtr> partons,
+ vector<Lorentz5Momentum> momenta,
+ unsigned int iemitter,bool subtract) const {
+ Lorentz5Momentum q = momenta[2]+momenta[3]+momenta[4];
+ Energy2 Q2=q.m2();
+ Energy2 lambda = sqrt((Q2-sqr(momenta[2].mass()+momenta[3].mass()))*
+ (Q2-sqr(momenta[2].mass()-momenta[3].mass())));
+ InvEnergy2 D[2];
+ double lome[2];
+ for(unsigned int iemit=0;iemit<2;++iemit) {
+ unsigned int ispect = iemit==0 ? 1 : 0;
+ Energy2 pipj = momenta[4 ] * momenta[2+iemit ];
+ Energy2 pipk = momenta[4 ] * momenta[2+ispect];
+ Energy2 pjpk = momenta[2+iemit] * momenta[2+ispect];
+ double y = pipj/(pipj+pipk+pjpk);
+ double z = pipk/( pipk+pjpk);
+ Energy mij = sqrt(2.*pipj+sqr(momenta[2+iemit].mass()));
+ Energy2 lamB = sqrt((Q2-sqr(mij+momenta[2+ispect].mass()))*
+ (Q2-sqr(mij-momenta[2+ispect].mass())));
+ Energy2 Qpk = q*momenta[2+ispect];
+ Lorentz5Momentum pkt =
+ lambda/lamB*(momenta[2+ispect]-Qpk/Q2*q)
+ +0.5/Q2*(Q2+sqr(momenta[2+ispect].mass())-sqr(momenta[2+ispect].mass()))*q;
+ Lorentz5Momentum pijt =
+ q-pkt;
+ double muj = momenta[2+iemit ].mass()/sqrt(Q2);
+ double muk = momenta[2+ispect].mass()/sqrt(Q2);
+ double vt = sqrt((1.-sqr(muj+muk))*(1.-sqr(muj-muk)))/(1.-sqr(muj)-sqr(muk));
+ double v = sqrt(sqr(2.*sqr(muk)+(1.-sqr(muj)-sqr(muk))*(1.-y))-4.*sqr(muk))
+ /(1.-y)/(1.-sqr(muj)-sqr(muk));
+ // dipole term
+ D[iemit] = 0.5/pipj*(2./(1.-(1.-z)*(1.-y))
+ -vt/v*(2.-z+sqr(momenta[2+iemit].mass())/pipj));
+ // matrix element
+ vector<Lorentz5Momentum> lomom(4);
+ lomom[0] = momenta[0];
+ lomom[1] = momenta[1];
+ if(iemit==0) {
+ lomom[2] = pijt;
+ lomom[3] = pkt ;
+ }
+ else {
+ lomom[3] = pijt;
+ lomom[2] = pkt ;
+ }
+ lome[iemit] = loME(partons,lomom,false)/3.;
+ }
+ InvEnergy2 ratio = realME(partons,momenta)
+ *abs(D[iemitter])/(abs(D[0]*lome[0])+abs(D[1]*lome[1]));
+ if(subtract)
+ return Q2*(ratio-2.*D[iemitter]);
+ else
+ return Q2*ratio;
+}
+
+double MEee2gZ2qqSextet::loME(const vector<cPDPtr> & partons,
+ const vector<Lorentz5Momentum> & momenta,
+ bool first) const {
+ // compute the spinors
+ vector<SpinorWaveFunction> fin,aout;
+ vector<SpinorBarWaveFunction> ain,fout;
+ SpinorWaveFunction ein (momenta[0],partons[0],incoming);
+ SpinorBarWaveFunction pin (momenta[1],partons[1],incoming);
+ SpinorBarWaveFunction qkout(momenta[2],partons[2],outgoing);
+ SpinorWaveFunction qbout(momenta[3],partons[3],outgoing);
+ for(unsigned int ix=0;ix<2;++ix) {
+ ein.reset(ix) ;
+ fin.push_back( ein );
+ pin.reset(ix) ;
+ ain.push_back( pin );
+ qkout.reset(ix);
+ fout.push_back(qkout);
+ qbout.reset(ix);
+ aout.push_back(qbout);
+ }
+ // compute the matrix element
+ double me,lastCont,lastBW;
+ HelicityME(fin,ain,fout,aout,me,lastCont,lastBW);
+ // save the components
+ if(first) {
+ DVector save;
+ save.push_back(lastCont);
+ save.push_back(lastBW);
+ meInfo(save);
+ }
+ // return the answer
+ return me;
+}
+
+InvEnergy2 MEee2gZ2qqSextet::realME(const vector<cPDPtr> & partons,
+ const vector<Lorentz5Momentum> & momenta) const {
+ // compute the spinors
+ vector<SpinorWaveFunction> fin,aout;
+ vector<SpinorBarWaveFunction> ain,fout;
+ vector<VectorWaveFunction> gout;
+ SpinorWaveFunction ein (momenta[0],partons[0],incoming);
+ SpinorBarWaveFunction pin (momenta[1],partons[1],incoming);
+ SpinorBarWaveFunction qkout(momenta[2],partons[2],outgoing);
+ SpinorWaveFunction qbout(momenta[3],partons[3],outgoing);
+ VectorWaveFunction gluon(momenta[4],partons[4],outgoing);
+ for(unsigned int ix=0;ix<2;++ix) {
+ ein.reset(ix) ;
+ fin.push_back( ein );
+ pin.reset(ix) ;
+ ain.push_back( pin );
+ qkout.reset(ix);
+ fout.push_back(qkout);
+ qbout.reset(ix);
+ aout.push_back(qbout);
+ gluon.reset(2*ix);
+ gout.push_back(gluon);
+ }
+ vector<Complex> diag(4,0.);
+ ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half,
+ PDT::Spin1Half,PDT::Spin1Half,
+ PDT::Spin1);
+ double total(0.);
+ for(unsigned int inhel1=0;inhel1<2;++inhel1) {
+ for(unsigned int inhel2=0;inhel2<2;++inhel2) {
+ // intermediate Z
+ VectorWaveFunction interZ =
+ FFZVertex_->evaluate(scale(),1,Z0_,fin[inhel1],ain[inhel2]);
+ // intermediate photon
+ VectorWaveFunction interG =
+ FFPVertex_->evaluate(scale(),1,gamma_,fin[inhel1],ain[inhel2]);
+ for(unsigned int outhel1=0;outhel1<2;++outhel1) {
+ for(unsigned int outhel2=0;outhel2<2;++outhel2) {
+ for(unsigned int outhel3=0;outhel3<2;++outhel3) {
+ SpinorBarWaveFunction off1 =
+ FFGVertex_->evaluate(scale(),3,partons[2],fout[outhel1],gout[outhel3]);
+ diag[0] = FFZVertex_->evaluate(scale(),aout[outhel2],off1,interZ);
+ diag[1] = FFPVertex_->evaluate(scale(),aout[outhel2],off1,interG);
+ SpinorWaveFunction off2 =
+ FFGVertex_->evaluate(scale(),3,partons[3],aout[outhel2],gout[outhel3]);
+ diag[2] = FFZVertex_->evaluate(scale(),off2,fout[outhel1],interZ);
+ diag[3] = FFPVertex_->evaluate(scale(),off2,fout[outhel1],interG);
+ // sum of diagrams
+ Complex sum = std::accumulate(diag.begin(),diag.end(),Complex(0.));
+ // matrix element
+ output(inhel1,inhel2,outhel1,outhel2,outhel3)=sum;
+ // me2
+ total += norm(sum);
+ }
+ }
+ }
+ }
+ }
+ // spin average
+ total *= 0.25;
+ tcPolarizedBeamPDPtr beam[2] =
+ {dynamic_ptr_cast<tcPolarizedBeamPDPtr>(partons[0]),
+ dynamic_ptr_cast<tcPolarizedBeamPDPtr>(partons[1])};
+ if( beam[0] || beam[1] ) {
+ RhoDMatrix rho[2] =
+ {beam[0] ? beam[0]->rhoMatrix() : RhoDMatrix(mePartonData()[0]->iSpin()),
+ beam[1] ? beam[1]->rhoMatrix() : RhoDMatrix(mePartonData()[1]->iSpin())};
+ total = output.average(rho[0],rho[1]);
+ }
+ // divide out the coupling
+ total /= norm(FFGVertex_->norm());
+ // return the total
+ return total*UnitRemoval::InvE2;
+}
diff --git a/MatrixElement/Lepton/MEee2gZ2qqSextet.h b/MatrixElement/Lepton/MEee2gZ2qqSextet.h
new file mode 100644
--- /dev/null
+++ b/MatrixElement/Lepton/MEee2gZ2qqSextet.h
@@ -0,0 +1,580 @@
+// -*- C++ -*-
+//
+// MEee2gZ2qq.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
+// Copyright (C) 2002-2011 The Herwig Collaboration
+//
+// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
+// Please respect the MCnet academic guidelines, see GUIDELINES for details.
+//
+#ifndef HERWIG_MEee2gZ2qqSextet_H
+#define HERWIG_MEee2gZ2qqSextet_H
+//
+// This is the declaration of the MEee2gZ2qqSextet class.
+//
+
+#include "Herwig++/MatrixElement/HwMEBase.h"
+#include "Herwig++/Models/StandardModel/StandardModel.h"
+#include "ThePEG/PDT/EnumParticles.h"
+#include "ThePEG/Repository/EventGenerator.h"
+#include "ThePEG/Utilities/Rebinder.h"
+#include "Herwig++/MatrixElement/ProductionMatrixElement.h"
+#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h"
+#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * The MEee2gZ2qqSextet class implements the matrix element
+ * for \f$e^+e^-\to Z/\gamma \to q\bar{q}\f$ including spin correlations.
+ * The class includes greater control over the type of quark produced than is available
+ * in the corresponding matrix element from ThePEG, in addition to spin correlations.
+ *
+ * @see \ref MEee2gZ2qqSextetInterfaces "The interfaces"
+ * defined for MEee2gZ2qqSextet.
+ */
+class MEee2gZ2qqSextet: public HwMEBase {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ MEee2gZ2qqSextet() : minflav_(1), maxflav_(5), massopt_(1), pTmin_(GeV),
+ preFactor_(6.)
+ {}
+
+ /**
+ * Members for hard corrections to the emission of QCD radiation
+ */
+ //@{
+ /**
+ * Has a POWHEG style correction
+ */
+ virtual bool hasPOWHEGCorrection() {return true;}
+
+ /**
+ * Has an old fashioned ME correction
+ */
+ virtual bool hasMECorrection() {return true;}
+
+ /**
+ * Initialize the ME correction
+ */
+ virtual void initializeMECorrection(ShowerTreePtr, double &,
+ double & );
+
+ /**
+ * Apply the hard matrix element correction to a given hard process or decay
+ */
+ virtual void applyHardMatrixElementCorrection(ShowerTreePtr);
+
+ /**
+ * Apply the soft matrix element correction
+ * @param initial The particle from the hard process which started the
+ * shower
+ * @param parent The initial particle in the current branching
+ * @param br The branching struct
+ * @return If true the emission should be vetoed
+ */
+ virtual bool softMatrixElementVeto(ShowerProgenitorPtr initial,
+ ShowerParticlePtr parent,
+ Branching br);
+
+ /**
+ * Apply the POWHEG style correction
+ */
+ virtual HardTreePtr generateHardest(ShowerTreePtr);
+ //@}
+
+ /** @name Virtual functions required by the MEBase class. */
+ //@{
+ /**
+ * Return the order in \f$\alpha_S\f$ in which this matrix
+ * element is given.
+ */
+ virtual unsigned int orderInAlphaS() const;
+
+ /**
+ * Return the order in \f$\alpha_{EW}\f$ in which this matrix
+ * element is given.
+ */
+ virtual unsigned int orderInAlphaEW() const;
+
+ /**
+ * The matrix element for the kinematical configuration
+ * previously provided by the last call to setKinematics(), suitably
+ * scaled by sHat() to give a dimension-less number.
+ * @return the matrix element scaled with sHat() to give a
+ * dimensionless number.
+ */
+ virtual double me2() const;
+
+ /**
+ * Return the scale associated with the last set phase space point.
+ */
+ virtual Energy2 scale() const;
+
+ /**
+ * Add all possible diagrams with the add() function.
+ */
+ virtual void getDiagrams() const;
+
+ /**
+ * Get diagram selector. With the information previously supplied with the
+ * setKinematics method, a derived class may optionally
+ * override this method to weight the given diagrams with their
+ * (although certainly not physical) relative probabilities.
+ * @param dv the diagrams to be weighted.
+ * @return a Selector relating the given diagrams to their weights.
+ */
+ virtual Selector<DiagramIndex> diagrams(const DiagramVector & dv) const;
+
+ /**
+ * Return a Selector with possible colour geometries for the selected
+ * diagram weighted by their relative probabilities.
+ * @param diag the diagram chosen.
+ * @return the possible colour geometries weighted by their
+ * relative probabilities.
+ */
+ virtual Selector<const ColourLines *>
+ colourGeometries(tcDiagPtr diag) const;
+
+ /**
+ * Construct the vertex of spin correlations.
+ */
+ virtual void constructVertex(tSubProPtr);
+ //@}
+
+
+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 Clone Methods. */
+ //@{
+ /**
+ * Make a simple clone of this object.
+ * @return a pointer to the new object.
+ */
+ virtual IBPtr clone() const {return new_ptr(*this);}
+
+ /** 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 {return new_ptr(*this);}
+ //@}
+
+protected:
+
+ /** @name Standard Interfaced functions. */
+ //@{
+ /**
+ * Initialize this object after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+
+ /**
+ * Rebind pointer to other Interfaced objects. Called in the setup phase
+ * after all objects used in an EventGenerator has been cloned so that
+ * the pointers will refer to the cloned objects afterwards.
+ * @param trans a TranslationMap relating the original objects to
+ * their respective clones.
+ * @throws RebindException if no cloned object was found for a given
+ * pointer.
+ */
+ virtual void rebind(const TranslationMap & trans)
+ ;
+
+ /**
+ * Return a vector of all pointers to Interfaced objects used in this
+ * object.
+ * @return a vector of pointers.
+ */
+ virtual IVector getReferences();
+ //@}
+
+protected:
+
+ /**
+ * Calculate the matrix element for \f$e^-e^-\to q \bar q\f$.
+ * @param partons The incoming and outgoing particles
+ * @param momenta The momenta of the incoming and outgoing particles
+ * @param first Whether or not to calculate the spin correlations
+ */
+ double loME(const vector<cPDPtr> & partons,
+ const vector<Lorentz5Momentum> & momenta,
+ bool first) const;
+
+ /**
+ * Member to calculate the matrix element
+ * @param fin Spinors for incoming fermion
+ * @param ain Spinors for incoming antifermion
+ * @param fout Spinors for outgoing fermion
+ * @param aout Spinors for outgong antifermion
+ * @param me Spin summed Matrix element
+ * @param cont The continuum piece of the matrix element
+ * @param BW The Z piece of the matrix element
+ */
+ ProductionMatrixElement HelicityME(vector<SpinorWaveFunction> & fin,
+ vector<SpinorBarWaveFunction> & ain,
+ vector<SpinorBarWaveFunction> & fout,
+ vector<SpinorWaveFunction> & aout,
+ double & me,
+ double & cont,
+ double & BW ) const;
+
+ /**
+ * The ratio of the matrix element for one additional jet over the
+ * leading order result. In practice
+ * \f[\frac{\hat{s}|\overline{\mathcal{M}}|^2_2|D_{\rm emit}|}{4\pi C_F\alpha_S|\overline{\mathcal{M}}|^2_3\left(|D_{\rm emit}|+|D_{\rm spect}|\right)}\f]
+ * is returned where \f$\|\overline{\mathcal{M}}|^2\f$ is
+ * the spin and colour summed/averaged matrix element.
+ * @param partons The incoming and outgoing particles
+ * @param momenta The momenta of the incoming and outgoing particles
+ * @param iemitter Whether the quark or antiquark is regardede as the emitter
+ * @param subtract Whether or not to subtract the relevant dipole term
+ */
+ double meRatio(vector<cPDPtr> partons,
+ vector<Lorentz5Momentum> momenta,
+ unsigned int iemitter,
+ bool subtract =false) const;
+
+ /**
+ * Calculate the matrix element for \f$e^-e^-\to q \bar q g\f$.
+ * @param partons The incoming and outgoing particles
+ * @param momenta The momenta of the incoming and outgoing particles
+ */
+ InvEnergy2 realME(const vector<cPDPtr> & partons,
+ const vector<Lorentz5Momentum> & momenta) const;
+
+private:
+
+ /**
+ * Apply the hard matrix element
+ */
+ vector<Lorentz5Momentum> applyHard(const ParticleVector &p);
+
+ /**
+ * Get the weight for hard emission
+ */
+ double getHard(double &, double &);
+
+ /**
+ * Set the \f$\rho\f$ parameter
+ */
+ void setRho(double);
+
+ /**
+ * Set the \f$\tilde{\kappa}\f$ parameters symmetrically
+ */
+ void setKtildeSymm();
+
+ /**
+ * Set second \f$\tilde{\kappa}\f$, given the first.
+ */
+ void setKtilde2();
+
+ /**
+ * Translate the variables from \f$x_q,x_{\bar{q}}\f$ to \f$\tilde{\kappa},z\f$
+ */
+ //@{
+ /**
+ * Calculate \f$z\f$.
+ */
+ double getZfromX(double, double);
+
+ /**
+ * Calculate \f$\tilde{\kappa}\f$.
+ */
+ double getKfromX(double, double);
+ //@}
+
+ /**
+ * Calculate \f$x_{q},x_{\bar{q}}\f$ from \f$\tilde{\kappa},z\f$.
+ * @param kt \f$\tilde{\kappa}\f$
+ * @param z \f$z\f$
+ * @param x \f$x_{q}\f$
+ * @param xbar \f$x_{\bar{q}}\f$
+ */
+ void getXXbar(double kt, double z, double & x, double & xbar);
+
+ /**
+ * Soft weight
+ */
+ //@{
+ /**
+ * Soft quark weight calculated from \f$x_{q},x_{\bar{q}}\f$
+ * @param x \f$x_{q}\f$
+ * @param xbar \f$x_{\bar{q}}\f$
+ */
+ double qWeight(double x, double xbar);
+
+ /**
+ * Soft antiquark weight calculated from \f$x_{q},x_{\bar{q}}\f$
+ * @param x \f$x_{q}\f$
+ * @param xbar \f$x_{\bar{q}}\f$
+ */
+ double qbarWeight(double x, double xbar);
+
+ /**
+ * Soft quark weight calculated from \f$\tilde{q},z\f$
+ * @param qtilde \f$\tilde{q}\f$
+ * @param z \f$z\f$
+ */
+ double qWeightX(Energy qtilde, double z);
+
+ /**
+ * Soft antiquark weight calculated from \f$\tilde{q},z\f$
+ * @param qtilde \f$\tilde{q}\f$
+ * @param z \f$z\f$
+ */
+ double qbarWeightX(Energy qtilde, double z);
+ //@}
+
+ /**
+ * ????
+ */
+ double u(double);
+
+ /**
+ * Vector and axial vector parts of the matrix element
+ */
+ //@{
+ /**
+ * Vector part of the matrix element
+ */
+ double MEV(double, double);
+
+ /**
+ * Axial vector part of the matrix element
+ */
+ double MEA(double, double);
+
+ /**
+ * The matrix element, given \f$x_1\f$, \f$x_2\f$.
+ * @param x1 \f$x_1\f$
+ * @param x2 \f$x_2\f$
+ */
+ double PS(double x1, double x2);
+ //@}
+
+protected:
+
+ /**
+ * Pointer to the fermion-antifermion Z vertex
+ */
+ AbstractFFVVertexPtr FFZVertex() const {return FFZVertex_;}
+
+ /**
+ * Pointer to the fermion-antifermion photon vertex
+ */
+ AbstractFFVVertexPtr FFPVertex() const {return FFPVertex_;}
+
+ /**
+ * Pointer to the particle data object for the Z
+ */
+ PDPtr Z0() const {return Z0_;}
+
+ /**
+ * Pointer to the particle data object for the photon
+ */
+ PDPtr gamma() const {return gamma_;}
+
+ /**
+ * Pointer to the particle data object for the gluon
+ */
+ PDPtr gluon() const {return gluon_;}
+
+private:
+
+ /**
+ * The static object used to initialize the description of this class.
+ * Indicates that this is a concrete class with persistent data.
+ */
+ static ClassDescription<MEee2gZ2qqSextet> initMEee2gZ2qqSextet;
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ MEee2gZ2qqSextet & operator=(const MEee2gZ2qqSextet &);
+
+private:
+
+ /**
+ * Pointer to the fermion-antifermion Z vertex
+ */
+ AbstractFFVVertexPtr FFZVertex_;
+
+ /**
+ * Pointer to the fermion-antifermion photon vertex
+ */
+ AbstractFFVVertexPtr FFPVertex_;
+
+ /**
+ * Pointer to the fermion-antifermion photon vertex
+ */
+ AbstractFFVVertexPtr FFGVertex_;
+
+ /**
+ * Pointer to the particle data object for the Z
+ */
+ PDPtr Z0_;
+
+ /**
+ * Pointer to the particle data object for the photon
+ */
+ PDPtr gamma_;
+
+ /**
+ * Pointer to the particle data object for the gluon
+ */
+ PDPtr gluon_;
+
+ /**
+ * The minimum PDG of the quarks to be produced
+ */
+ int minflav_;
+
+ /**
+ * The maximum PDG of the quarks to be produced
+ */
+ int maxflav_;
+
+ /**
+ * Option for the treatment of the top quark mass
+ */
+ unsigned int massopt_;
+
+ /**
+ * CM energy
+ */
+ Energy d_Q_;
+
+ /**
+ * Quark mass
+ */
+ Energy d_m_;
+
+ /**
+ * The rho parameter
+ */
+ double d_rho_;
+
+ /**
+ * The v parameter
+ */
+ double d_v_;
+
+ /**
+ * The initial kappa-tilde values for radiation from the quark
+ */
+ double d_kt1_;
+
+ /**
+ * The initial kappa-tilde values for radiation from the antiquark
+ */
+ double d_kt2_;
+
+ /**
+ * Cut-off parameter
+ */
+ static const double EPS_;
+
+ /**
+ * Pointer to the coupling
+ */
+ ShowerAlphaPtr alpha_;
+
+private:
+
+ /**
+ * Variables for the POWHEG style corrections
+ */
+ //@{
+ /**
+ * The cut off on pt, assuming massless quarks.
+ */
+ Energy pTmin_;
+
+ /**
+ * Overestimate for the prefactor
+ */
+ double preFactor_;
+
+ /**
+ * ParticleData objects for the partons
+ */
+ vector<cPDPtr> partons_;
+
+ /**
+ * Momenta of the leading-order partons
+ */
+ vector<Lorentz5Momentum> loMomenta_;
+ //@}
+
+};
+
+}
+
+#include "ThePEG/Utilities/ClassTraits.h"
+
+namespace ThePEG {
+
+/** @cond TRAITSPECIALIZATIONS */
+
+/** This template specialization informs ThePEG about the
+ * base classes of MEee2gZ2qqSextet. */
+template <>
+struct BaseClassTrait<Herwig::MEee2gZ2qqSextet,1> {
+ /** Typedef of the first base class of MEee2gZ2qqSextet. */
+ typedef Herwig::HwMEBase NthBase;
+};
+
+/** This template specialization informs ThePEG about the name of
+ * the MEee2gZ2qqSextet class and the shared object where it is defined. */
+template <>
+struct ClassTraits<Herwig::MEee2gZ2qqSextet>
+ : public ClassTraitsBase<Herwig::MEee2gZ2qqSextet> {
+ /** Return a platform-independent class name */
+ static string className() { return "Herwig::MEee2gZ2qqSextet"; }
+ /** Return the name(s) of the shared library (or libraries) be loaded to get
+ * access to the MEee2gZ2qqSextet class and any other class on which it depends
+ * (except the base class). */
+ static string library() { return "HwMELepton.so"; }
+};
+
+/** @endcond */
+
+}
+
+#endif /* HERWIG_MEee2gZ2qqSextet_H */
diff --git a/MatrixElement/Lepton/Makefile.am b/MatrixElement/Lepton/Makefile.am
--- a/MatrixElement/Lepton/Makefile.am
+++ b/MatrixElement/Lepton/Makefile.am
@@ -1,8 +1,9 @@
pkglib_LTLIBRARIES = HwMELepton.la
HwMELepton_la_SOURCES = \
MEee2gZ2qq.h MEee2gZ2qq.cc\
+MEee2gZ2qqSextet.h MEee2gZ2qqSextet.cc\
MEee2gZ2ll.h MEee2gZ2ll.cc\
MEee2ZH.h MEee2ZH.cc\
MEee2HiggsVBF.h MEee2HiggsVBF.cc \
MEee2VV.h MEee2VV.cc
HwMELepton_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 3:1:0
diff --git a/Models/ADD/ADDModel.h b/Models/ADD/ADDModel.h
--- a/Models/ADD/ADDModel.h
+++ b/Models/ADD/ADDModel.h
@@ -1,267 +1,267 @@
// -*- C++ -*-
//
// ADDModel.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_ADDModel_H
#define HERWIG_ADDModel_H
// This is the declaration of the ADDModel class.
#include "Herwig++/Models/General/BSMModel.h"
#include "ThePEG/Helicity/Vertex/AbstractFFTVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractVVTVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractSSTVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractFFVTVertex.h"
#include "ThePEG/Helicity/Vertex/AbstractVVVTVertex.h"
#include "ADDModel.fh"
namespace Herwig {
using namespace ThePEG;
using namespace ThePEG::Helicity;
/** \ingroup Models
*
* This is the class to be used instead of the Standard Model class for
- * the Randell Sundrum model.
+ * the ADD model.
*
* @see \ref ADDModelInterfaces "The interfaces"
* defined for ADDModel.
* @see StandardModel
* @see StandardModelBase
*
*/
class ADDModel: public BSMModel {
public:
/**
* The default constructor
*/
ADDModel() : delta_(2), mPlanckBar_(2.4e18*GeV),
md_(1000.*GeV), lambdaT_(1000.*GeV) {
useMe();
}
/**
* Number of extrac dimensions
*/
unsigned int delta() const {return delta_;}
/**
* The reduced Planck mass in 4d
*/
Energy MPlanckBar() const {return mPlanckBar_;}
/**
* The d-dimension Planck mass
*/
Energy MD() const {return md_;}
/**
* The cut-off for virtual gravition processes
*/
Energy LambdaT() const {return lambdaT_;}
/** @name Vertices */
//@{
/**
* Pointer to the object handling the \f$G\to f\bar{f}\f$ vertex.
*/
tAbstractFFTVertexPtr vertexFFGR() const {return FFGRVertex_;}
/**
* Pointer to the object handling the \f$G\to VV\f$ vertex.
*/
tAbstractVVTVertexPtr vertexVVGR() const {return VVGRVertex_;}
/**
* Pointer to the object handling the \f$G\to SS\f$ vertex.
*/
tAbstractSSTVertexPtr vertexSSGR() const {return SSGRVertex_;}
/**
* Pointer to the object handling the \f$G\to f\bar{f}g\f$ vertex.
*/
tAbstractFFVTVertexPtr vertexFFGGR() const {return FFGGRVertex_;}
/**
* Pointer to the object handling the \f$G\to f\bar{f}W^\pm/Z^0/\gamma\f$ vertex.
*/
tAbstractFFVTVertexPtr vertexFFWGR() const {return FFWGRVertex_;}
/**
* Pointer to the object handling the \f$G\to W^+W^-Z^0/\gamma\f$ vertex.
*/
tAbstractVVVTVertexPtr vertexWWWGR() const {return WWWGRVertex_;}
/**
* Pointer to the object handling the \f$G\to ggg\f$ vertex.
*/
tAbstractVVVTVertexPtr vertexGGGGR() const {return GGGGRVertex_;}
//@}
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);
//@}
/**
* Standard Init function used to initialize the interfaces.
*/
static void Init();
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
private:
/**
* Describe a concrete class with persistent data.
*/
static ClassDescription<ADDModel> initADDModel;
/**
* Private and non-existent assignment operator.
*/
ADDModel & operator=(const ADDModel &);
private:
/**
* Number of extrac dimensions
*/
unsigned int delta_;
/**
* The reduced Planck mass in 4d
*/
Energy mPlanckBar_;
/**
* The d-dimension Planck mass
*/
Energy md_;
/**
* Cut-off parameter for virtual gravitons
*/
Energy lambdaT_;
/**
* Pointer to the object handling the \f$G\to f\bar{f}\f$ vertex.
*/
AbstractFFTVertexPtr FFGRVertex_;
/**
* Pointer to the object handling the \f$G\to VV\f$ vertex.
*/
AbstractVVTVertexPtr VVGRVertex_;
/**
* Pointer to the object handling the \f$G\to SS\f$ vertex.
*/
AbstractSSTVertexPtr SSGRVertex_;
/**
* Pointer to the object handling the \f$G\to f\bar{f}g\f$ vertex.
*/
AbstractFFVTVertexPtr FFGGRVertex_;
/**
* Pointer to the object handling the \f$G\to f\bar{f}W/Z^0\gamma\f$ vertex.
*/
AbstractFFVTVertexPtr FFWGRVertex_;
/**
* Pointer to the object handling the \f$G\to W^+W^-Z^0\gamma\f$ vertex.
*/
AbstractVVVTVertexPtr WWWGRVertex_;
/**
* Pointer to the object handling the \f$G\to ggg\f$ vertex.
*/
AbstractVVVTVertexPtr GGGGRVertex_;
};
}
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/**
* The following template specialization informs ThePEG about the
* base class of ADDModel.
*/
template <>
struct BaseClassTrait<Herwig::ADDModel,1> {
/** Typedef of the base class of ADDModel. */
typedef Herwig::BSMModel NthBase;
};
/**
* The following template specialization informs ThePEG about the
* name of this class and the shared object where it is defined.
*/
template <>
struct ClassTraits<Herwig::ADDModel>
: public ClassTraitsBase<Herwig::ADDModel> {
/** Return the class name.*/
static string className() { return "Herwig::ADDModel"; }
/**
* Return the name of the shared library to be loaded to get
* access to this class and every other class it uses
* (except the base class).
*/
static string library() { return "HwADDModel.so"; }
};
/** @endcond */
}
#endif /* HERWIG_ADDModel_H */
diff --git a/Models/ADD/Makefile.am b/Models/ADD/Makefile.am
--- a/Models/ADD/Makefile.am
+++ b/Models/ADD/Makefile.am
@@ -1,13 +1,13 @@
if WANT_ADD
pkglib_LTLIBRARIES = HwADDModel.la
endif
HwADDModel_la_SOURCES = ADDModel.fh ADDModel.cc ADDModel.h \
ADDModelFFGRVertex.cc ADDModelFFGRVertex.h \
ADDModelFFGGRVertex.cc ADDModelFFGGRVertex.h \
ADDModelFFWGRVertex.cc ADDModelFFWGRVertex.h \
ADDModelSSGRVertex.cc ADDModelSSGRVertex.h \
ADDModelVVGRVertex.cc ADDModelVVGRVertex.h \
ADDModelGGGGRVertex.cc ADDModelGGGGRVertex.h \
ADDModelWWWGRVertex.cc ADDModelWWWGRVertex.h \
GravitonMassGenerator.h GravitonMassGenerator.cc
-HwADDModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:1:0
+HwADDModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 2:0:0
diff --git a/Models/General/BSMModel.cc b/Models/General/BSMModel.cc
--- a/Models/General/BSMModel.cc
+++ b/Models/General/BSMModel.cc
@@ -1,353 +1,348 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the BSMModel class.
//
#include "BSMModel.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Repository/Repository.h"
#include "ThePEG/Utilities/StringUtils.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/MassGenerator.h"
#include "ThePEG/PDT/WidthGenerator.h"
#include "ThePEG/PDT/DecayMode.h"
using namespace Herwig;
BSMModel::BSMModel() : decayFile_(), readDecays_(true),
topModesFromFile_(false),
tolerance_(1e-6)
{}
void BSMModel::persistentOutput(PersistentOStream & os) const {
os << decayFile_ << topModesFromFile_ << tolerance_;
}
void BSMModel::persistentInput(PersistentIStream & is, int) {
is >> decayFile_ >> topModesFromFile_ >> tolerance_;
}
-// *** Attention *** The following static variable is needed for the type
-// description system in ThePEG. Please check that the template arguments
-// are correct (the class and its base class), and that the constructor
-// arguments are correct (the class name and the name of the dynamically
-// loadable library where the class implementation can be found).
DescribeAbstractClass<BSMModel,Herwig::StandardModel>
- describeHerwigBSMModel("Herwig::BSMModel", "BSMModel.so");
+ describeHerwigBSMModel("Herwig::BSMModel", "");
void BSMModel::Init() {
static ClassDocumentation<BSMModel> documentation
("The BSMModel class provides a base class for BSM models including the"
" features to read decays in the SLHA format");
static Parameter<BSMModel,string> interfaceDecayFileName
("DecayFileName",
"Name of the file from which to read decays in the SLHA format",
&BSMModel::decayFile_, "",
false, false);
static Switch<BSMModel,bool> interfaceTopModes
("TopModes",
"Whether ro use the Herwig++ SM top decays or those from the SLHA file",
&BSMModel::topModesFromFile_, false, false, false);
static SwitchOption interfaceTopModesFile
(interfaceTopModes,
"File",
"Take the modes from the files",
true);
static SwitchOption interfaceTopModesHerwig
(interfaceTopModes,
"Herwig",
"Use the SM ones", false);
static Parameter<BSMModel,double> interfaceBRTolerance
("BRTolerance",
"Tolerance for the sum of branching ratios to be difference from one.",
&BSMModel::tolerance_, 1e-6, 1e-8, 0.01,
false, false, Interface::limited);
}
void BSMModel::doinit() {
StandardModel::doinit();
// check if need to read decays
if(decayFile()==""||!readDecays_) return;
decayRead();
}
void BSMModel::decayRead() {
// read decays
CFileLineReader cfile;
cfile.open(decayFile_);
if( !cfile ) throw SetupException()
<< "BSMModel::doinit - An error occurred in opening the "
<< "decay file \"" << decayFile_ << "\"."
<< Exception::runerror;
//Before reading the spectrum/decay files the SM higgs
//decay modes, mass and width generators need to be turned off.
PDPtr h0 = getParticleData(ParticleID::h0);
h0->widthGenerator(WidthGeneratorPtr());
h0->massGenerator(MassGenPtr());
h0->width(ZERO);
h0->stable(true);
DecaySet::const_iterator dit = h0->decayModes().begin();
DecaySet::const_iterator dend = h0->decayModes().end();
for( ; dit != dend; ++dit ) {
generator()->preinitInterface(*dit, "BranchingRatio", "set", "0.");
generator()->preinitInterface(*dit, "OnOff", "set", "Off");
}
// if taking the top modes from the file
// delete the SM stuff
if(topModesFromFile_) {
PDPtr top = getParticleData(ParticleID::t);
top->widthGenerator(WidthGeneratorPtr());
top->massGenerator(MassGenPtr());
DecaySet::const_iterator dit = top->decayModes().begin();
DecaySet::const_iterator dend = top->decayModes().end();
for( ; dit != dend; ++dit ) {
generator()->preinitInterface(*dit, "BranchingRatio", "set", "0.");
generator()->preinitInterface(*dit, "OnOff", "set", "Off");
}
}
// read first line and check if this is a Les Houches event file
cfile.readline();
bool lesHouches = cfile.find("<LesHouchesEvents");
bool reading = !lesHouches;
if(lesHouches) cfile.readline();
// function pointer for putting all characters to lower case.
int (*pf)(int) = tolower;
while (true) {
string line = cfile.getline();
// check for start of slha block in SLHA files
if(lesHouches && !reading) {
if(line.find("<slha")==0) reading = true;
if(!cfile.readline()) break;
continue;
}
// ignore comment lines
if(line[0] == '#') {
if(!cfile.readline()) break;
continue;
}
// make everything lower case
transform(line.begin(), line.end(), line.begin(), pf);
// start of a block
if(line.find("decay") == 0) {
readDecay(cfile, line);
continue;
}
else if( lesHouches && line.find("</slha") == 0 ) {
reading = false;
break;
}
if(!cfile.readline()) break;
}
}
void BSMModel::readDecay(CFileLineReader & cfile,
string decay) const{
// extract parent PDG code and width
long parent(0);
Energy width(ZERO);
istringstream iss(decay);
string dummy;
iss >> dummy >> parent >> iunit(width, GeV);
PDPtr inpart = getParticleData(parent);
if(!topModesFromFile_&&abs(parent)==ParticleID::t) {
cfile.readline();
return;
}
if(!inpart) throw SetupException()
<< "BSMModel::readDecay() - "
<< "A ParticleData object with the PDG code "
<< parent << " does not exist. "
<< Exception::runerror;
inpart->width(width);
if( width > ZERO ) inpart->cTau(hbarc/width);
inpart->widthCut(5.*width);
Energy inMass = inpart->mass();
string prefix(inpart->name() + "->");
double brsum(0.);
unsigned int nmode = 0;
while(cfile.readline()) {
string line = cfile.getline();
// skip comments
if(line[0] == '#') continue;
// reached the end
if( line[0] == 'B' || line[0] == 'b' ||
line[0] == 'D' || line[0] == 'd' ||
line[0] == '<' ) {
cfile.resetline();
break;
}
// read the mode
// get the branching ratio and no of decay products
istringstream is(line);
double brat(0.);
unsigned int nda(0),npr(0);
is >> brat >> nda;
vector<tcPDPtr> products,bosons;
Energy mout(ZERO),moutnoWZ(ZERO);
string tag = prefix;
while( true ) {
long t;
is >> t;
if( is.fail() ) break;
if( t == abs(parent) ) {
throw SetupException()
<< "An error occurred while read a decay of the "
<< inpart->PDGName() << ". One of its products has the same PDG code "
<< "as the parent particle. Please check the SLHA file.\n"
<< Exception::runerror;
}
tcPDPtr p = getParticleData(t);
if( !p ) {
throw SetupException()
<< "BSMModel::readDecay() - An unknown PDG code has been encounterd "
<< "while reading a decay mode. ID: " << t
<< Exception::runerror;
}
++npr;
tag += p->name() + ",";
Energy mass = p->mass();
mout += mass;
if(abs(p->id())==ParticleID::Wplus||p->id()==ParticleID::Z0) {
bosons.push_back(p);
}
else {
products.push_back(p);
moutnoWZ += mass;
}
}
if( npr != nda ) {
throw SetupException()
<< "BSMModel::readDecay - While reading a decay of the "
<< inpart->PDGName() << " from an SLHA file, an inconsistency "
<< "between the number of decay products and the value in "
<< "the 'NDA' column was found. Please check if the spectrum "
<< "file is correct.\n"
<< Exception::warning;
}
if( npr > 1 ) {
tag.replace(tag.size() - 1, 1, ";");
// normal option
if(mout<=inMass) {
inpart->stable(false);
brsum += brat;
createDecayMode(tag, brat);
}
// no possible off-shell gauge bosons throw it away
else if(bosons.empty() || bosons.size()>2 ||
moutnoWZ>=inMass) {
cerr << "BSMModel::readDecay() "
<< "The decay " << tag << " cannot proceed for on-shell "
<< "particles, skipping it.\n";
}
else {
Energy maxMass = inMass - moutnoWZ;
string newTag = prefix;
for(unsigned int ix=0;ix<products.size();++ix)
newTag += products[ix]->name() + ",";
if(bosons.size()==1) {
cerr << "BSMModel::readDecay() "
<< "The decay " << tag << " cannot proceed for on-shell\n"
<< "particles, replacing gauge boson with its decay products\n";
vector<pair<double,string> > modes =
createWZDecayModes(newTag,brat,bosons[0],maxMass);
for(unsigned int ix=0;ix<modes.size();++ix) {
modes[ix].second.replace(modes[ix].second.size() - 1, 1, ";");
createDecayMode(modes[ix].second,modes[ix].first);
brsum += modes[ix].first;
}
}
else if(bosons.size()==2) {
bool identical = bosons[0]->id()==bosons[1]->id();
if(maxMass>bosons[0]->mass()&&maxMass>bosons[1]->mass()) {
cerr << "BSMModel::readDecay() "
<< "The decay " << tag << " cannot proceed for on-shell\n"
<< "particles, replacing one of the gauge bosons"
<< " with its decay products\n";
unsigned int imax = identical ? 1 : 2;
if(imax==2) brat *= 0.5;
for(unsigned int ix=0;ix<imax;++ix) {
string newTag2 = newTag+bosons[ix]->name()+',';
unsigned int iother = ix==0 ? 1 : 0;
vector<pair<double,string> > modes =
createWZDecayModes(newTag2,brat,bosons[iother],maxMass);
for(unsigned int ix=0;ix<modes.size();++ix) {
modes[ix].second.replace(modes[ix].second.size() - 1, 1, ";");
createDecayMode(modes[ix].second,modes[ix].first);
brsum += modes[ix].first;
}
}
}
else {
cerr << "BSMModel::readDecay() "
<< "The decay " << tag << " cannot proceed for on-shell\n"
<< "particles, and has too many off-shell gauge bosons,"
<< " skipping it.\n";
}
}
else {
cerr << "BSMModel::readDecay() "
<< "The decay " << tag << " cannot proceed for on-shell\n"
<< "particles, and has too many outgoing gauge bosons skipping it.\n";
}
}
}
}
if( abs(brsum - 1.) > tolerance_ && nmode!=0 ) {
cerr << "Warning: The total branching ratio for " << inpart->PDGName()
<< " from the spectrum file does not sum to 1. The branching fractions"
<< " will be rescaled.\n";
cerr << setprecision(13) << abs(brsum - 1.) << "\n";
}
}
void BSMModel::createDecayMode(string tag, double brat) const {
tDMPtr dm = generator()->findDecayMode(tag);
if(!dm) {
dm = generator()->preinitCreateDecayMode(tag);
}
generator()->preinitInterface(dm, "OnOff", "set", "On");
generator()->preinitInterface(dm, "Decayer", "set","/Herwig/Decays/Mambo");
ostringstream brf;
brf << setprecision(13)<< brat;
generator()->preinitInterface(dm, "BranchingRatio","set", brf.str());
}
vector<pair<double,string> >
BSMModel::createWZDecayModes(string tag, double brat,
tcPDPtr boson, Energy maxMass) const {
vector<pair<double,string> > modes;
double sum(0.);
for(DecaySet::const_iterator dit=boson->decayModes().begin();
dit!=boson->decayModes().end();++dit) {
tcDMPtr mode = *dit;
if(!mode->on()) continue;
string extra;
Energy outMass(ZERO);
for(ParticleMSet::const_iterator pit=mode->products().begin();
pit!=mode->products().end();++pit) {
extra += (**pit).name() + ",";
outMass += (**pit).mass();
}
if(outMass<maxMass) {
sum += mode->brat();
modes.push_back(make_pair(mode->brat(),tag+extra));
}
}
for(unsigned int ix=0;ix<modes.size();++ix)
modes[ix].first *= brat/sum;
return modes;
}
diff --git a/Models/General/HardProcessConstructor.cc b/Models/General/HardProcessConstructor.cc
--- a/Models/General/HardProcessConstructor.cc
+++ b/Models/General/HardProcessConstructor.cc
@@ -1,467 +1,620 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the HardProcessConstructor class.
//
#include "HardProcessConstructor.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
void HardProcessConstructor::persistentOutput(PersistentOStream & os) const {
os << debug_ << subProcess_ << model_;
}
void HardProcessConstructor::persistentInput(PersistentIStream & is, int) {
is >> debug_ >> subProcess_ >> model_;
}
AbstractClassDescription<HardProcessConstructor>
HardProcessConstructor::initHardProcessConstructor;
// Definition of the static class description member.
void HardProcessConstructor::Init() {
static ClassDocumentation<HardProcessConstructor> documentation
("Base class for implementation of the automatic generation of hard processes");
static Switch<HardProcessConstructor,bool> interfaceDebugME
("DebugME",
"Print comparison with analytical ME",
&HardProcessConstructor::debug_, false, false, false);
static SwitchOption interfaceDebugMEYes
(interfaceDebugME,
"Yes",
"Print the debug information",
true);
static SwitchOption interfaceDebugMENo
(interfaceDebugME,
"No",
"Do not print the debug information",
false);
}
void HardProcessConstructor::doinit() {
Interfaced::doinit();
EGPtr eg = generator();
model_ = dynamic_ptr_cast<HwSMPtr>(eg->standardModel());
if(!model_)
throw InitException() << "HardProcessConstructor:: doinit() - "
<< "The model pointer is null!"
<< Exception::abortnow;
if(eg->eventHandler()) {
string subProcessName =
eg->preinitInterface(eg->eventHandler(), "SubProcessHandlers", "get","");
subProcess_ = eg->getObject<SubProcessHandler>(subProcessName);
if(!subProcess_)
throw InitException() << "HardProcessConstructor:: doinit() - "
<< "There was an error getting the SubProcessHandler "
<< "from the current event handler. "
<< Exception::abortnow;
}
else
throw
InitException() << "HardProcessConstructor:: doinit() - "
<< "The eventHandler pointer was null therefore "
<< "could not get SubProcessHandler pointer "
<< Exception::abortnow;
}
GeneralHardME::ColourStructure HardProcessConstructor::
colourFlow(const tcPDVector & extpart) const {
PDT::Colour ina = extpart[0]->iColour();
PDT::Colour inb = extpart[1]->iColour();
PDT::Colour outa = extpart[2]->iColour();
PDT::Colour outb = extpart[3]->iColour();
+
// incoming colour neutral
if(ina == PDT::Colour0 && inb == PDT::Colour0) {
if( outa == PDT::Colour0 && outb == PDT::Colour0 ) {
return GeneralHardME::Colour11to11;
}
else if( outa == PDT::Colour3 && outb == PDT::Colour3bar ) {
return GeneralHardME::Colour11to33bar;
}
else if( outa == PDT::Colour8 && outb == PDT::Colour8 ) {
return GeneralHardME::Colour11to88;
}
else
assert(false);
}
// incoming 3 3
else if(ina == PDT::Colour3 && inb == PDT::Colour3 ) {
if( outa == PDT::Colour3 && outb == PDT::Colour3 ) {
return GeneralHardME::Colour33to33;
}
+ else if( outa == PDT::Colour6 && outb == PDT::Colour0 ) {
+ return GeneralHardME::Colour33to61;
+ }
+ else if( outa == PDT::Colour0 && outb == PDT::Colour6 ) {
+ return GeneralHardME::Colour33to16;
+ }
else
assert(false);
}
// incoming 3bar 3bar
else if(ina == PDT::Colour3bar && inb == PDT::Colour3bar ) {
if( outa == PDT::Colour3bar && outb == PDT::Colour3bar ) {
return GeneralHardME::Colour3bar3barto3bar3bar;
}
+ else if( outa == PDT::Colour6bar && outb == PDT::Colour0) {
+ return GeneralHardME::Colour3bar3barto6bar1;
+ }
+ else if ( outa == PDT::Colour0 && outb == PDT::Colour6bar ) {
+ return GeneralHardME::Colour3bar3barto16bar;
+ }
else
assert(false);
}
// incoming 3 3bar
else if(ina == PDT::Colour3 && inb == PDT::Colour3bar ) {
if( outa == PDT::Colour0 && outb == PDT::Colour0 ) {
return GeneralHardME::Colour33barto11;
}
else if( outa == PDT::Colour3 && outb == PDT::Colour3bar ) {
return GeneralHardME::Colour33barto33bar;
}
else if( outa == PDT::Colour8 && outb == PDT::Colour8 ) {
return GeneralHardME::Colour33barto88;
}
else if( outa == PDT::Colour8 && outb == PDT::Colour0 ) {
return GeneralHardME::Colour33barto81;
}
else if( outa == PDT::Colour0 && outb == PDT::Colour8 ) {
return GeneralHardME::Colour33barto18;
}
+ else if( outa == PDT::Colour6 && outb == PDT::Colour6bar) {
+ return GeneralHardME::Colour33barto66bar;
+ }
+ else if( outa == PDT::Colour6bar && outb == PDT::Colour6) {
+ return GeneralHardME::Colour33barto6bar6;
+ }
else
assert(false);
}
// incoming 88
else if(ina == PDT::Colour8 && inb == PDT::Colour8 ) {
if( outa == PDT::Colour0 && outb == PDT::Colour0 ) {
return GeneralHardME::Colour88to11;
}
else if( outa == PDT::Colour3 && outb == PDT::Colour3bar ) {
return GeneralHardME::Colour88to33bar;
}
else if( outa == PDT::Colour8 && outb == PDT::Colour8 ) {
return GeneralHardME::Colour88to88;
}
else if( outa == PDT::Colour8 && outb == PDT::Colour0 ) {
return GeneralHardME::Colour88to81;
}
else if( outa == PDT::Colour0 && outb == PDT::Colour8 ) {
return GeneralHardME::Colour88to18;
}
+ else if( outa == PDT::Colour6 && outb == PDT::Colour6bar ) {
+ return GeneralHardME::Colour88to66bar;
+ }
else
assert(false);
}
// incoming 38
else if(ina == PDT::Colour3 && inb == PDT::Colour8 ) {
if(outa == PDT::Colour3 && outb == PDT::Colour0) {
return GeneralHardME::Colour38to31;
}
else if(outa == PDT::Colour0 && outb == PDT::Colour3) {
return GeneralHardME::Colour38to13;
}
else if(outa == PDT::Colour3 && outb == PDT::Colour8) {
return GeneralHardME::Colour38to38;
}
else if(outa == PDT::Colour8 && outb == PDT::Colour3) {
return GeneralHardME::Colour38to83;
}
+ else if(outa == PDT::Colour3bar && outb == PDT::Colour6){
+ return GeneralHardME::Colour38to3bar6;
+ }
+ else if(outa == PDT::Colour6 && outb == PDT::Colour3bar){
+ return GeneralHardME::Colour38to63bar;
+ }
else
assert(false);
}
// incoming 3bar8
- else if(ina == PDT::Colour3bar && inb == PDT::Colour8 ) {
+ else if(ina == PDT::Colour3bar && inb == PDT::Colour8 ) {
if(outa == PDT::Colour3bar && outb == PDT::Colour0 ) {
return GeneralHardME::Colour3bar8to3bar1;
}
else if(outa == PDT::Colour0 && outb == PDT::Colour3bar) {
return GeneralHardME::Colour3bar8to13bar;
}
else if(outa == PDT::Colour3bar && outb == PDT::Colour8 ) {
return GeneralHardME::Colour3bar8to3bar8;
}
else if(outa == PDT::Colour8 && outb == PDT::Colour3bar) {
return GeneralHardME::Colour3bar8to83bar;
}
else
assert(false);
}
// unknown colour flow
else
assert(false);
return GeneralHardME::UNDEFINED;
}
void HardProcessConstructor::fixFSOrder(HPDiagram & diag) {
tcPDPtr psa = getParticleData(diag.incoming.first);
tcPDPtr psb = getParticleData(diag.incoming.second);
tcPDPtr psc = getParticleData(diag.outgoing.first);
tcPDPtr psd = getParticleData(diag.outgoing.second);
//fix a spin order
if( psc->iSpin() < psd->iSpin() ) {
swap(diag.outgoing.first, diag.outgoing.second);
if(diag.channelType == HPDiagram::tChannel) {
diag.ordered.second = !diag.ordered.second;
}
return;
}
if( psc->iSpin() == psd->iSpin() &&
psc->id() < 0 && psd->id() > 0 ) {
swap(diag.outgoing.first, diag.outgoing.second);
if(diag.channelType == HPDiagram::tChannel) {
diag.ordered.second = !diag.ordered.second;
}
return;
}
}
void HardProcessConstructor::assignToCF(HPDiagram & diag) {
if(diag.channelType == HPDiagram::tChannel) {
if(diag.ordered.second) tChannelCF(diag);
else uChannelCF(diag);
}
else if(diag.channelType == HPDiagram::sChannel) {
sChannelCF(diag);
}
else if (diag.channelType == HPDiagram::fourPoint) {
fourPointCF(diag);
}
else
assert(false);
}
void HardProcessConstructor::tChannelCF(HPDiagram & diag) {
PDT::Colour ina = getParticleData(diag.incoming.first )->iColour();
PDT::Colour inb = getParticleData(diag.incoming.second)->iColour();
PDT::Colour outa = getParticleData(diag.outgoing.first )->iColour();
PDT::Colour outb = getParticleData(diag.outgoing.second)->iColour();
vector<CFPair> cfv(1, make_pair(0, 1.));
if(diag.intermediate->iColour() == PDT::Colour0) {
if(ina==PDT::Colour0) {
cfv[0] = make_pair(0, 1);
}
else if(ina==PDT::Colour3 || ina==PDT::Colour3bar) {
if( inb == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(inb==PDT::Colour3 || outb==PDT::Colour3bar) {
cfv[0] = make_pair(2, 1);
}
else if(inb==PDT::Colour8) {
cfv[0] = make_pair(2, 1);
}
}
else if(ina==PDT::Colour8) {
if( inb == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(inb==PDT::Colour3 || outb==PDT::Colour3bar) {
cfv[0] = make_pair(2, 1);
}
else if(inb==PDT::Colour8) {
cfv[0] = make_pair(5, 1);
}
}
}
else if(diag.intermediate->iColour() == PDT::Colour8) {
if(ina==PDT::Colour8&&outa==PDT::Colour8&&
inb==PDT::Colour8&&outb==PDT::Colour8) {
cfv.push_back(make_pair(1, -1.));
}
+ }
+ else if(diag.intermediate->iColour() == PDT::Colour3 ||
+ diag.intermediate->iColour() == PDT::Colour3bar) {
+ if(outa == PDT::Colour0 || outb == PDT::Colour0) {
+ cfv[0] = make_pair(0,1.);
+ // cfv.push_back(make_pair(1,1.));
+ }
+ else if(outa==PDT::Colour6 && outb==PDT::Colour3bar) {
+ cfv[0] = make_pair(4,1.);
+ cfv.push_back(make_pair(5,1.));
+ }
+ else if(outa==PDT::Colour6 && outb==PDT::Colour6bar) {
+ cfv[0] = make_pair(4, 1.);
+ for(unsigned int ix=5;ix<8;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else if(outa==PDT::Colour6 || outa ==PDT::Colour6bar ||
+ outb==PDT::Colour6 || outb ==PDT::Colour6bar ) {
+ assert(false);
+ // cfv[0] = make_pair(0,1.);
+ // should this start a 0 or one i.e. 4 or 5 flows
+ // for(int ix=0; ix<4;++ix)
+ // cfv.push_back(make_pair(ix,1.));
+ }
+ else {
+ cfv[0] = make_pair(0,1.);
+ }
+ }
+ else if(diag.intermediate->iColour() == PDT::Colour6 ||
+ diag.intermediate->iColour() == PDT::Colour6bar) {
+ if(ina==PDT::Colour8 && inb==PDT::Colour8) {
+ cfv[0] = make_pair(0, 1.);
+ for(unsigned int ix=1;ix<4;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ for(unsigned int ix=4;ix<8;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else if(outa==PDT::Colour3bar && outb==PDT::Colour6) {
+ cfv[0] = make_pair(0,1.);
+ for(unsigned int ix=1;ix<4;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else if(outa==PDT::Colour6 && outb==PDT::Colour3bar) {
+ cfv[0] = make_pair(4,1.);
+ cfv.push_back(make_pair(5,1.));
+ }
}
diag.colourFlow = cfv;
}
void HardProcessConstructor::uChannelCF(HPDiagram & diag) {
PDT::Colour offshell = diag.intermediate->iColour();
PDT::Colour ina = getParticleData(diag.incoming.first )->iColour();
PDT::Colour inb = getParticleData(diag.incoming.second)->iColour();
PDT::Colour outa = getParticleData(diag.outgoing.first )->iColour();
PDT::Colour outb = getParticleData(diag.outgoing.second)->iColour();
vector<CFPair> cfv(1, make_pair(1, 1.));
if(offshell == PDT::Colour8) {
if( outa != outb ) {
if(outa == PDT::Colour0 ||
outb == PDT::Colour0) {
cfv[0].first = 0;
}
else {
cfv[0].first = 0;
cfv.push_back(make_pair(1, -1.));
}
}
else if(outa==PDT::Colour8&&ina==PDT::Colour8) {
cfv[0]=make_pair(1, -1.);
cfv.push_back(make_pair(2, 1.));
}
}
else {
- if( outa == PDT::Colour0 || outb == PDT::Colour0 ) {
- cfv[0].first = 0;
+ if(offshell == PDT::Colour3 || offshell == PDT::Colour3bar) {
+ if( outa == PDT::Colour0 || outb == PDT::Colour0 ) {
+ cfv[0] = make_pair(0,1.);
+ // cfv.push_back(make_pair(1,1.));
+ }
+ else if(outa==PDT::Colour3bar && outb==PDT::Colour6) {
+ cfv[0] = make_pair(4,1.);
+ cfv.push_back(make_pair(5,1.));
+ }
+ else if(outa==PDT::Colour6 && outb==PDT::Colour3bar) {
+ cfv[0] = make_pair(0,1.);
+ for(int ix=0; ix<4;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else if(outa==PDT::Colour6bar && outb==PDT::Colour6) {
+ cfv[0] = make_pair(4,1.);
+ for(int ix=5; ix<8;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else
+ cfv[0].first = 0;
}
else if( offshell == PDT::Colour0 ) {
if(ina==PDT::Colour0) {
cfv[0] = make_pair(0, 1);
}
else if(ina==PDT::Colour3 || ina==PDT::Colour3bar) {
if( inb == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(inb==PDT::Colour3 || outb==PDT::Colour3bar) {
cfv[0] = make_pair(3, 1);
}
else if(inb==PDT::Colour8) {
cfv[0] = make_pair(2, 1);
}
}
else if(ina==PDT::Colour8) {
if( inb == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(inb==PDT::Colour3 || outb==PDT::Colour3bar) {
cfv[0] = make_pair(2, 1);
}
else if(inb==PDT::Colour8) {
cfv[0] = make_pair(4, 1);
}
}
}
+ else if(diag.intermediate->iColour() == PDT::Colour6 ||
+ diag.intermediate->iColour() == PDT::Colour6bar) {
+ if(ina==PDT::Colour8 && inb==PDT::Colour8) {
+ cfv[0] = make_pair(0, 1.);
+ for(unsigned int ix=1;ix<4;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ for(unsigned int ix=8;ix<12;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ else if(outa==PDT::Colour3bar && outa==PDT::Colour6) {
+ cfv[0] = make_pair(4, 1.);
+ cfv.push_back(make_pair(5,1.));
+ }
+ else if(outa==PDT::Colour6 && outa==PDT::Colour3bar) {
+ cfv[0] = make_pair(0, 1.);
+ for(unsigned int ix=1;ix<4;++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
+ }
}
diag.colourFlow = cfv;
}
void HardProcessConstructor::sChannelCF(HPDiagram & diag) {
tcPDPtr pa = getParticleData(diag.incoming.first);
tcPDPtr pb = getParticleData(diag.incoming.second);
PDT::Colour ina = pa->iColour();
PDT::Colour inb = pb->iColour();
PDT::Colour offshell = diag.intermediate->iColour();
tcPDPtr pc = getParticleData(diag.outgoing.first);
tcPDPtr pd = getParticleData(diag.outgoing.second);
PDT::Colour outa = pc->iColour();
PDT::Colour outb = pd->iColour();
vector<CFPair> cfv(1);
if(offshell == PDT::Colour8) {
if(ina == PDT::Colour0 || inb == PDT::Colour0 ||
outa == PDT::Colour0 || outb == PDT::Colour0) {
cfv[0] = make_pair(0, 1);
}
else {
- bool incol = ina == PDT::Colour8 && inb == PDT::Colour8;
- bool outcol = outa == PDT::Colour8 && outb == PDT::Colour8;
+ bool incol = ina == PDT::Colour8 && inb == PDT::Colour8;
+ bool outcol = outa == PDT::Colour8 && outb == PDT::Colour8;
bool intrip = ina == PDT::Colour3 && inb == PDT::Colour3bar;
bool outtrip = outa == PDT::Colour3 && outb == PDT::Colour3bar;
+ bool outsex = outa == PDT::Colour6 && outb == PDT::Colour6bar;
+ bool outsexb = outa == PDT::Colour6bar && outb == PDT::Colour6;
if(incol || outcol) {
- //Require an additional minus sign for a fermion 33bar final state
- //due to the way the vertex rules are defined.
+ // Require an additional minus sign for a fermion 33bar final state
+ // due to the way the vertex rules are defined.
int prefact(1);
if( (pc->iSpin() == PDT::Spin1Half && pd->iSpin() == PDT::Spin1Half) &&
(outa == PDT::Colour3 && outb == PDT::Colour3bar) )
prefact = -1;
- if(incol&&outcol) {
+ if(incol && outcol) {
cfv[0].first = 0;
cfv[0].second = -prefact;
cfv.push_back(make_pair(2, prefact));
}
+ else if(incol && outsex) {
+ cfv[0].first = 4;
+ cfv[0].second = -prefact;
+ for(unsigned int ix=1;ix<4;++ix)
+ cfv.push_back(make_pair(4+ix,-prefact));
+ for(unsigned int ix=0;ix<4;++ix)
+ cfv.push_back(make_pair(8+ix, prefact));
+ }
else {
cfv[0].first = 0;
cfv[0].second = -prefact;
cfv.push_back(make_pair(1, prefact));
}
}
else if( ( intrip && !outtrip ) ||
- ( !intrip && outtrip ) )
- cfv[0] = make_pair(0, 1);
+ ( !intrip && outtrip ) ) {
+ if(!outsex)
+ cfv[0] = make_pair(0, 1);
+ else {
+ cfv[0] = make_pair(0, 1.);
+ for(unsigned int ix=0;ix<3;++ix)
+ cfv.push_back(make_pair(ix+1, 1.));
+ }
+ }
+ else if((intrip && outsex) || (intrip && outsexb)) {
+ cfv[0] = make_pair(0,1.);
+ for(int ix=1; ix<4; ++ix)
+ cfv.push_back(make_pair(ix,1.));
+ }
else
cfv[0] = make_pair(1, 1);
}
}
else if(offshell == PDT::Colour0) {
if( ina == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(ina==PDT::Colour3 || ina==PDT::Colour3bar) {
if( outa == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(outa==PDT::Colour3 || outa==PDT::Colour3bar) {
cfv[0] = make_pair(3, 1);
}
else if(outa==PDT::Colour8) {
cfv[0] = make_pair(2, 1);
}
}
else if(ina==PDT::Colour8) {
if( outa == PDT::Colour0 ) {
cfv[0] = make_pair(0, 1);
}
else if(outa==PDT::Colour3 || outb==PDT::Colour3bar) {
cfv[0] = make_pair(2, 1);
}
else if(outa==PDT::Colour8) {
cfv[0] = make_pair(3, 1);
}
}
}
+ else if(offshell == PDT::Colour3 || offshell == PDT::Colour3bar) {
+ if(outa == PDT::Colour6 || outa == PDT::Colour6bar ||
+ outb == PDT::Colour6bar || outb == PDT::Colour6) {
+ cfv[0] = make_pair(6, 1.);
+ cfv.push_back(make_pair(7,1.));
+ }
+ }
+ else if( offshell == PDT::Colour6 || offshell == PDT::Colour6bar) {
+ cfv[0] = make_pair(2,0.5);
+ cfv.push_back(make_pair(3,0.5));
+ }
else {
- if(outa == PDT::Colour0 || outb == PDT::Colour0 )
+ if(outa == PDT::Colour0 || outb == PDT::Colour0)
cfv[0] = make_pair(0, 1);
else
cfv[0] = make_pair(1, 1);
- }
-
+ }
diag.colourFlow = cfv;
}
void HardProcessConstructor::fourPointCF(HPDiagram & diag) {
// count the colours
- unsigned int noct(0),ntri(0),nsng(0);
+ unsigned int noct(0),ntri(0),nsng(0),nsex(0);
for(unsigned int ix=0;ix<4;++ix) {
PDT::Colour col = getParticleData(diag.ids[ix])->iColour();
- if(col==PDT::Colour0) ++nsng;
+ if(col==PDT::Colour0) ++nsng;
else if(col==PDT::Colour3||col==PDT::Colour3bar) ++ntri;
- else if(col==PDT::Colour8) ++noct;
+ else if(col==PDT::Colour8) ++noct;
+ else if(col==PDT::Colour6||col==PDT::Colour6bar) ++nsex;
}
if(nsng==4 || (ntri==2&&nsng==2) ||
(noct==3 && nsng==1) ||
(ntri==2 && noct==1 && nsng==1) ) {
vector<CFPair> cfv(1,make_pair(0,1));
diag.colourFlow = cfv;
}
else if(noct==4) {
// flows for SSVV, VVVV is handled in me class
vector<CFPair> cfv(3);
cfv[0] = make_pair(0, 1.);
cfv[1] = make_pair(1,-2.);
cfv[2] = make_pair(2, 1.);
diag.colourFlow = cfv;
}
else if(ntri==2&&noct==2) {
vector<CFPair> cfv(2);
cfv[0] = make_pair(0, 1);
cfv[1] = make_pair(1, 1);
diag.colourFlow = cfv;
}
+ else if(nsex==2&&noct==2) {
+ vector<CFPair> cfv;
+ for(unsigned int ix=0;ix<4;++ix)
+ cfv.push_back(make_pair(ix ,2.));
+ for(unsigned int ix=0;ix<8;++ix)
+ cfv.push_back(make_pair(4+ix,1.));
+ diag.colourFlow = cfv;
+ }
else
assert(false);
}
namespace {
// Helper functor for find_if in duplicate function.
class SameDiagramAs {
public:
SameDiagramAs(const HPDiagram & diag) : a(diag) {}
bool operator()(const HPDiagram & b) const {
return a == b;
}
private:
HPDiagram a;
};
}
bool HardProcessConstructor::duplicate(const HPDiagram & diag,
const HPDVector & group) const {
//find if a duplicate diagram exists
HPDVector::const_iterator it =
find_if(group.begin(), group.end(), SameDiagramAs(diag));
return it != group.end();
}
diff --git a/Models/General/ResonantProcessConstructor.cc b/Models/General/ResonantProcessConstructor.cc
--- a/Models/General/ResonantProcessConstructor.cc
+++ b/Models/General/ResonantProcessConstructor.cc
@@ -1,367 +1,367 @@
// -*- C++ -*-
//
// ResonantProcessConstructor.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the ResonantProcessConstructor class.
//
#include "ResonantProcessConstructor.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
using namespace Herwig;
IBPtr ResonantProcessConstructor::clone() const {
return new_ptr(*this);
}
IBPtr ResonantProcessConstructor::fullclone() const {
return new_ptr(*this);
}
void ResonantProcessConstructor::persistentOutput(PersistentOStream & os) const {
os << incoming_ << intermediates_ << outgoing_
<< processOption_ << scaleFactor_;
}
void ResonantProcessConstructor::persistentInput(PersistentIStream & is, int) {
is >> incoming_ >> intermediates_ >> outgoing_
>> processOption_ >> scaleFactor_;
}
ClassDescription<ResonantProcessConstructor>
ResonantProcessConstructor::initResonantProcessConstructor;
// Definition of the static class description member.
void ResonantProcessConstructor::Init() {
static ClassDocumentation<ResonantProcessConstructor> documentation
("This class is designed solely to contruct resonant processes using"
"a provided set of intermediate particles");
static RefVector<ResonantProcessConstructor, ParticleData> interfaceOffshell
("Intermediates",
"A vector of offshell particles for resonant diagrams",
&ResonantProcessConstructor::intermediates_, -1, false, false, true,
false);
static RefVector<ResonantProcessConstructor, ParticleData> interfaceIncoming
("Incoming",
"A vector of incoming particles for resonant diagrams",
&ResonantProcessConstructor::incoming_, -1, false, false, true,
false);
static RefVector<ResonantProcessConstructor, ParticleData> interfaceOutgoing
("Outgoing",
- "A vector of outgoin particles for resonant diagrams",
+ "A vector of outgoing particles for resonant diagrams",
&ResonantProcessConstructor::outgoing_, -1, false, false, true,
false);
static Switch<ResonantProcessConstructor,unsigned int> interfaceProcesses
("Processes",
"Whether to generate inclusive or exclusive processes",
&ResonantProcessConstructor::processOption_, 0, false, false);
static SwitchOption interfaceProcessesSingleParticleInclusive
(interfaceProcesses,
"SingleParticleInclusive",
"Require at least one particle from the list of outgoing particles"
" in the hard process",
0);
static SwitchOption interfaceProcessesTwoParticleInclusive
(interfaceProcesses,
"TwoParticleInclusive",
"Require that both the particles in the hard processes are in the"
" list of outgoing particles",
1);
static SwitchOption interfaceProcessesExclusive
(interfaceProcesses,
"Exclusive",
"Require that both the particles in the hard processes are in the"
" list of outgoing particles in every hard process",
2);
static SwitchOption interfaceProcessesInclusive
(interfaceProcesses,
"Inclusive",
"Generate all modes which are allowed for the on-shell intermediate particle",
3);
static Parameter<ResonantProcessConstructor,double> interfaceScaleFactor
("ScaleFactor",
"The prefactor used in the scale calculation. The scale used is"
" sHat multiplied by this prefactor",
&ResonantProcessConstructor::scaleFactor_, 1.0, 0.0, 10.0,
false, false, Interface::limited);
}
void ResonantProcessConstructor::doinit() {
HardProcessConstructor::doinit();
if(processOption_==2&&outgoing_.size()!=2)
throw InitException()
<< "Exclusive processes require exactly"
<< " two outgoing particles but " << outgoing_.size()
<< "have been inserted in ResonantProcessConstructor::doinit()."
<< Exception::runerror;
}
namespace {
// Helper functor for find_if in duplicate function.
class SameIncomingAs {
public:
SameIncomingAs(tPDPair in) : a(in.first->id()), b(in.second->id()) {}
bool operator()(tPDPair ppair) const {
long id1(ppair.first->id()), id2(ppair.second->id());
return ( id1 == a && id2 == b ) || ( id1 == b && id2 == a );
}
private:
long a, b;
};
bool duplicateIncoming(tPDPair ppair,const vector<tPDPair> &incPairs) {
vector<tPDPair>::const_iterator it =
find_if( incPairs.begin(), incPairs.end(), SameIncomingAs(ppair) );
return it != incPairs.end();
}
}
void ResonantProcessConstructor::constructDiagrams() {
size_t ninc = incoming_.size() , ninter = intermediates_.size();
if(ninc == 0 || ninter == 0 ) return;
// find the incoming particle pairs
vector<tPDPair> incPairs;
for(PDVector::size_type i = 0; i < ninc; ++i) {
for(PDVector::size_type j = 0; j < ninc; ++j) {
tPDPair inc = make_pair(incoming_[i], incoming_[j]);
if( (inc.first->iSpin() > inc.second->iSpin()) ||
(inc.first->iSpin() == inc.second->iSpin() &&
inc.first->id() < inc.second->id()) )
swap(inc.first, inc.second);
if( !duplicateIncoming(inc,incPairs) ) {
incPairs.push_back(inc);
}
}
}
size_t nvertices = model()->numberOfVertices();
//To construct resonant diagrams loop over the incoming particles, intermediates
//and vertices to find allowed diagrams. Need to exclude the diagrams that have
//the intermediate as an external particle as well
for(vector<tcPDPair>::size_type is = 0; is < incPairs.size(); ++is) {
tPDPair ppi = incPairs[is];
for(vector<PDPtr>::size_type ik = 0; ik < ninter ; ++ik) {
long ipart = intermediates_[ik]->id();
for(size_t iv = 0; iv < nvertices; ++iv) {
VBPtr vertex = model()->vertex(iv);
if(vertex->getNpoint() > 3) continue;
long part1 = ppi.first->CC() ? -ppi.first->id() : ppi.first->id();
long part2 = ppi.second->CC() ? -ppi.second->id() : ppi.second->id();
if(vertex->allowed(part1, part2, ipart) ||
vertex->allowed(part1, ipart, part2) ||
vertex->allowed(part2, part1, ipart) ||
vertex->allowed(part2, ipart, part1) ||
vertex->allowed(ipart, part1, part2) ||
vertex->allowed(ipart, part2, part1) ) {
constructVertex2(make_pair(ppi.first->id(), ppi.second->id()), vertex,
intermediates_[ik]);
}
}
}
}
//Create matrix element for each process
const HPDVector::size_type ndiags = diagrams_.size();
for(HPDVector::size_type ix = 0; ix < ndiags; ++ix)
createMatrixElement(diagrams_[ix]);
}
void ResonantProcessConstructor::
constructVertex2(IDPair in, VertexBasePtr vertex,
PDPtr partc) {
//We have the left hand part of the diagram, just need all the possibilities
//for the RHS
size_t nvertices = model()->numberOfVertices();
if(processOption_!=3) {
for(size_t io = 0; io < outgoing_.size(); ++io) {
tcPDPtr outa = outgoing_[io];
for(size_t iv = 0; iv < nvertices; ++iv) {
VBPtr vertex2 = model()->vertex(iv);
if(vertex2->getNpoint() > 3) continue;
- tPDSet outb = search(vertex2, partc->id(), incoming, outa->id(), outgoing,
+ tPDSet outb = search(vertex2, partc->id(), incoming, outa->id(), outgoing,
outgoing);
for(tPDSet::const_iterator ita = outb.begin(); ita != outb.end(); ++ita)
makeResonantDiagram(in, partc, outa->id(),(**ita).id(),
make_pair(vertex, vertex2));
}
}
}
else {
for(size_t iv = 0; iv < nvertices; ++iv) {
VBPtr vertex2 = model()->vertex(iv);
if(vertex2->getNpoint() > 3) continue;
for(unsigned int ix = 0;ix < 3; ++ix) {
vector<long> pdlist = vertex2->search(ix, partc->id());
for(unsigned int iy=0;iy<pdlist.size();iy+=3) {
long out1 = ix==0 ? pdlist.at(iy+1) : pdlist.at(iy );
long out2 = ix==2 ? pdlist.at(iy+1) : pdlist.at(iy+2);
if(partc->mass() < getParticleData(out1)->mass() +
getParticleData(out2)->mass()) continue;
makeResonantDiagram(in, partc, out1, out2,
make_pair(vertex, vertex2));
}
}
}
}
}
void ResonantProcessConstructor::
makeResonantDiagram(IDPair in, PDPtr offshell, long outa, long outb,
VBPair vertpair) {
assert(vertpair.first && vertpair.second);
if( abs(outa) == abs(offshell->id()) ||
abs(outb) == abs(offshell->id())) return;
HPDiagram newdiag(in,make_pair(outa,outb));
newdiag.intermediate = offshell;
newdiag.vertices = vertpair;
newdiag.channelType = HPDiagram::sChannel;
fixFSOrder(newdiag);
assignToCF(newdiag);
if(duplicate(newdiag,diagrams_)) return;
// if inclusive enforce the exclusivity
if(processOption_==1) {
PDVector::const_iterator loc =
std::find(outgoing_.begin(),outgoing_.end(),
getParticleData(newdiag.outgoing. first));
if(loc==outgoing_.end()) return;
loc =
std::find(outgoing_.begin(),outgoing_.end(),
getParticleData(newdiag.outgoing.second));
if(loc==outgoing_.end()) return;
}
else if(processOption_==2) {
if(!((newdiag.outgoing. first==outgoing_[0]->id()&&
newdiag.outgoing.second==outgoing_[1]->id())||
(newdiag.outgoing. first==outgoing_[1]->id()&&
newdiag.outgoing.second==outgoing_[0]->id())))
return;
}
// add to the list
diagrams_.push_back(newdiag);
}
set<tPDPtr>
ResonantProcessConstructor::search(VBPtr vertex, long part1, direction d1,
long part2, direction d2, direction d3) {
if(d1 == incoming && getParticleData(part1)->CC()) part1 = -part1;
if(d2 == incoming && getParticleData(part2)->CC()) part2 = -part2;
vector<long> ext;
tPDSet third;
for(unsigned int ix = 0;ix < 3; ++ix) {
vector<long> pdlist = vertex->search(ix, part1);
ext.insert(ext.end(), pdlist.begin(), pdlist.end());
}
for(unsigned int ix = 0; ix < ext.size(); ix += 3) {
long id0 = ext.at(ix);
long id1 = ext.at(ix+1);
long id2 = ext.at(ix+2);
int pos;
if((id0 == part1 && id1 == part2) ||
(id0 == part2 && id1 == part1))
pos = ix + 2;
else if((id0 == part1 && id2 == part2) ||
(id0 == part2 && id2 == part1))
pos = ix + 1;
else if((id1 == part1 && id2 == part2) ||
(id1 == part2 && id2 == part1))
pos = ix;
else
pos = -1;
if(pos >= 0) {
tPDPtr p = getParticleData(ext[pos]);
if(d3 == incoming && p->CC()) p = p->CC();
third.insert(p);
}
}
return third;
}
IDPair ResonantProcessConstructor::
find(long part, const vector<PDPtr> & out) const {
vector<PDPtr>::size_type iloc(0);
bool found(false);
do {
if(out[iloc]->id() == part) found = true;
else ++iloc;
}
while(found == false && iloc < out.size());
//found offshell
IDPair outids;
if(iloc == 0)
outids = make_pair(out[1]->id(), out[2]->id());
else if(iloc == 1)
outids = make_pair(out[0]->id(), out[2]->id());
else
outids = make_pair(out[0]->id(), out[1]->id());
return outids;
}
void ResonantProcessConstructor::
createMatrixElement(const HPDiagram & diag) const {
vector<tcPDPtr> extpart(4);
extpart[0] = getParticleData(diag.incoming.first);
extpart[1] = getParticleData(diag.incoming.second);
extpart[2] = getParticleData(diag.outgoing.first);
extpart[3] = getParticleData(diag.outgoing.second);
string objectname ("/Herwig/MatrixElements/");
string classname = MEClassname(extpart, diag.intermediate, objectname);
GeneralHardMEPtr matrixElement = dynamic_ptr_cast<GeneralHardMEPtr>
(generator()->preinitCreate(classname, objectname));
if( !matrixElement ) {
throw RPConstructorError()
<< "ResonantProcessConstructor::createMatrixElement "
<< "- No matrix element object could be created for "
<< "the process "
<< extpart[0]->PDGName() << " " << extpart[0]->iSpin() << ","
<< extpart[1]->PDGName() << " " << extpart[1]->iSpin() << "->"
<< extpart[2]->PDGName() << " " << extpart[2]->iSpin() << ","
<< extpart[3]->PDGName() << " " << extpart[3]->iSpin()
<< ". Constructed class name: \"" << classname << "\"\n"
<< Exception::warning;
return;
}
matrixElement->setProcessInfo(HPDVector(1, diag),
colourFlow(extpart), debug(),0,scaleFactor_);
generator()->preinitInterface(subProcess(), "MatrixElements",
subProcess()->MEs().size(),
"insert", matrixElement->fullName());
}
string ResonantProcessConstructor::
MEClassname(const vector<tcPDPtr> & extpart, tcPDPtr inter,
string & objname) const {
string classname("Herwig::ME");
for(vector<tcPDPtr>::size_type ix = 0; ix < extpart.size(); ++ix) {
if(ix == 2) classname += "2";
if(extpart[ix]->iSpin() == PDT::Spin0) classname += "s";
else if(extpart[ix]->iSpin() == PDT::Spin1) classname += "v";
else if(extpart[ix]->iSpin() == PDT::Spin1Half) classname += "f";
else if(extpart[ix]->iSpin() == PDT::Spin2) classname += "t";
else
throw RPConstructorError()
<< "MEClassname() : Encountered an unknown spin for "
<< extpart[ix]->PDGName() << " while constructing MatrixElement "
<< "classname " << extpart[ix]->iSpin() << Exception::warning;
}
objname += "ME" + extpart[0]->PDGName() + extpart[1]->PDGName() + "2"
+ inter->PDGName() + "2"
+ extpart[2]->PDGName() + extpart[3]->PDGName();
return classname;
}
diff --git a/Models/General/TwoToTwoProcessConstructor.cc b/Models/General/TwoToTwoProcessConstructor.cc
--- a/Models/General/TwoToTwoProcessConstructor.cc
+++ b/Models/General/TwoToTwoProcessConstructor.cc
@@ -1,640 +1,645 @@
// -*- C++ -*-
//
// TwoToTwoProcessConstructor.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the TwoToTwoProcessConstructor class.
//
#include "TwoToTwoProcessConstructor.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
+#include <sstream>
+
+using std::stringstream;
using namespace Herwig;
namespace {
// Helper functor for find_if in duplicate function.
class SameIncomingAs {
public:
SameIncomingAs(tPDPair in) : a(in.first->id()), b(in.second->id()) {}
bool operator()(tPDPair ppair) const {
long id1(ppair.first->id()), id2(ppair.second->id());
return ( id1 == a && id2 == b ) || ( id1 == b && id2 == a );
}
private:
long a, b;
};
bool duplicateIncoming(tPDPair ppair, const vector<tPDPair> & incPairs ) {
vector<tPDPair>::const_iterator it =
find_if( incPairs.begin(), incPairs.end(), SameIncomingAs(ppair) );
return it != incPairs.end();
}
}
TwoToTwoProcessConstructor::TwoToTwoProcessConstructor() :
Nout_(0), nv_(0), allDiagrams_(true),
processOption_(0), scaleChoice_(0), scaleFactor_(1.)
{}
IBPtr TwoToTwoProcessConstructor::clone() const {
return new_ptr(*this);
}
IBPtr TwoToTwoProcessConstructor::fullclone() const {
return new_ptr(*this);
}
void TwoToTwoProcessConstructor::doinit() {
HardProcessConstructor::doinit();
if(processOption_==2&&outgoing_.size()!=2)
throw InitException()
<< "Exclusive processes require exactly"
<< " two outgoing particles but " << outgoing_.size()
<< "have been inserted in TwoToTwoProcessConstructor::doinit()."
<< Exception::runerror;
Nout_ = outgoing_.size();
PDVector::size_type ninc = incoming_.size();
// exit if nothing to do
if(Nout_==0||ninc==0) return;
//create vector of initial-state pairs
for(PDVector::size_type i = 0; i < ninc; ++i) {
for(PDVector::size_type j = 0; j < ninc; ++j) {
tPDPair inc = make_pair(incoming_[i], incoming_[j]);
if( (inc.first->iSpin() > inc.second->iSpin()) ||
(inc.first->iSpin() == inc.second->iSpin() &&
inc.first->id() < inc.second->id()) )
swap(inc.first, inc.second);
if( !duplicateIncoming(inc,incPairs_) ) {
incPairs_.push_back(inc);
}
}
}
// excluded vertices
excludedVertexSet_ =
set<VertexBasePtr>(excludedVertexVector_.begin(),
excludedVertexVector_.end());
}
void TwoToTwoProcessConstructor::persistentOutput(PersistentOStream & os) const {
os << vertices_ << incoming_ << outgoing_
<< allDiagrams_ << processOption_
<< scaleChoice_ << scaleFactor_ << excluded_ << excludedExternal_
<< excludedVertexVector_ << excludedVertexSet_;
}
void TwoToTwoProcessConstructor::persistentInput(PersistentIStream & is, int) {
is >> vertices_ >> incoming_ >> outgoing_
>> allDiagrams_ >> processOption_
>> scaleChoice_ >> scaleFactor_ >> excluded_ >> excludedExternal_
>> excludedVertexVector_ >> excludedVertexSet_;
}
ClassDescription<TwoToTwoProcessConstructor>
TwoToTwoProcessConstructor::initTwoToTwoProcessConstructor;
// Definition of the static class description member.
void TwoToTwoProcessConstructor::Init() {
static ClassDocumentation<TwoToTwoProcessConstructor> documentation
("TwoToTwoProcessConstructor constructs the possible diagrams for "
"a process given the external particles");
static RefVector<TwoToTwoProcessConstructor,ThePEG::ParticleData> interfaceIn
("Incoming",
"Pointers to incoming particles",
&TwoToTwoProcessConstructor::incoming_, -1, false, false, true, false);
static RefVector<TwoToTwoProcessConstructor,ThePEG::ParticleData> interfaceOut
("Outgoing",
"Pointers to incoming particles",
&TwoToTwoProcessConstructor::outgoing_, -1, false, false, true, false);
static Switch<TwoToTwoProcessConstructor,bool> interfaceIncludeAllDiagrams
("IncludeEW",
"Switch to decide which diagrams to include in ME calc.",
&TwoToTwoProcessConstructor::allDiagrams_, true, false, false);
static SwitchOption interfaceIncludeAllDiagramsOff
(interfaceIncludeAllDiagrams,
"No",
"Only include QCD diagrams",
false);
static SwitchOption interfaceIncludeAllDiagramsOn
(interfaceIncludeAllDiagrams,
"Yes",
"Include EW+QCD.",
true);
static Switch<TwoToTwoProcessConstructor,unsigned int> interfaceProcesses
("Processes",
"Whether to generate inclusive or exclusive processes",
&TwoToTwoProcessConstructor::processOption_, 0, false, false);
static SwitchOption interfaceProcessesSingleParticleInclusive
(interfaceProcesses,
"SingleParticleInclusive",
"Require at least one particle from the list of outgoing particles"
" in the hard process",
0);
static SwitchOption interfaceProcessesTwoParticleInclusive
(interfaceProcesses,
"TwoParticleInclusive",
"Require that both the particles in the hard processes are in the"
" list of outgoing particles",
1);
static SwitchOption interfaceProcessesExclusive
(interfaceProcesses,
"Exclusive",
"Require that both the particles in the hard processes are in the"
" list of outgoing particles in every hard process",
2);
static Switch<TwoToTwoProcessConstructor,unsigned int> interfaceScaleChoice
("ScaleChoice",
"&TwoToTwoProcessConstructor::scaleChoice_",
&TwoToTwoProcessConstructor::scaleChoice_, 0, false, false);
static SwitchOption interfaceScaleChoiceDefault
(interfaceScaleChoice,
"Default",
"Use if sHat if intermediates all colour neutral, otherwise the transverse mass",
0);
static SwitchOption interfaceScaleChoicesHat
(interfaceScaleChoice,
"sHat",
"Always use sHat",
1);
static SwitchOption interfaceScaleChoiceTransverseMass
(interfaceScaleChoice,
"TransverseMass",
"Always use the transverse mass",
2);
static Parameter<TwoToTwoProcessConstructor,double> interfaceScaleFactor
("ScaleFactor",
"The prefactor used in the scale calculation. The scale used is"
" that defined by scaleChoice multiplied by this prefactor",
&TwoToTwoProcessConstructor::scaleFactor_, 1.0, 0.0, 10.0,
false, false, Interface::limited);
static RefVector<TwoToTwoProcessConstructor,ThePEG::ParticleData> interfaceExcluded
("Excluded",
"Particles which are not allowed as intermediates",
&TwoToTwoProcessConstructor::excluded_, -1, false, false, true, false, false);
static RefVector<TwoToTwoProcessConstructor,ParticleData> interfaceExcludedExternal
("ExcludedExternal",
"Particles which are not allowed as outgoing particles",
&TwoToTwoProcessConstructor::excludedExternal_, -1,
false, false, true, false, false);
static RefVector<TwoToTwoProcessConstructor,VertexBase> interfaceExcludedVertices
("ExcludedVertices",
"Vertices which are not included in the 2 -> 2 scatterings",
&TwoToTwoProcessConstructor::excludedVertexVector_, -1, false, false, true, true, false);
}
namespace {
// Helper functor for find_if below.
class SameProcessAs {
public:
SameProcessAs(const HPDiagram & diag) : a(diag) {}
bool operator()(const HPDiagram & b) const {
return a.sameProcess(b);
}
private:
HPDiagram a;
};
}
void TwoToTwoProcessConstructor::constructDiagrams() {
if(incPairs_.empty() || outgoing_.empty()) return;
nv_ = model()->numberOfVertices();
//make sure vertices are initialised
for(unsigned int ix = 0; ix < nv_; ++ix ) {
VertexBasePtr vertex = model()->vertex(ix);
if(excludedVertexSet_.find(vertex) !=
excludedVertexSet_.end()) continue;
vertices_.push_back(vertex);
}
nv_ = vertices_.size();
//Create necessary diagrams
vector<tcPDPair>::size_type is;
PDVector::size_type os;
for(is = 0; is < incPairs_.size(); ++is) {
tPDPair ppi = incPairs_[is];
for(os = 0; os < Nout_; ++os) {
long fs = outgoing_[os]->id();
for(size_t iv = 0; iv < nv_; ++iv) {
tVertexBasePtr vertexA = vertices_[iv];
//This skips an effective vertex and the EW ones if
// we only want the strong diagrams
if( !allDiagrams_ && vertexA->orderInGs() == 0 )
continue;
if(vertexA->getNpoint() == 3) {
//scattering diagrams
createTChannels(ppi, fs, vertexA);
//resonance diagrams
if( vertexA->isIncoming(ppi.first) &&
vertexA->isIncoming(ppi.second) )
createSChannels(ppi, fs, vertexA);
}
else
makeFourPointDiagrams(ppi.first->id(), ppi.second->id(),
fs, vertexA);
}
}
}
//need to find all of the diagrams that relate to the same process
//first insert them into a map which uses the '<' operator
//to sort the diagrams
multiset<HPDiagram> grouped;
HPDVector::iterator dit = processes_.begin();
HPDVector::iterator dend = processes_.end();
bool abort=false;
for( ; dit != dend; ++dit) {
// check for on-shell s-channel
tPDPtr out1 = getParticleData(dit->outgoing.first );
tPDPtr out2 = getParticleData(dit->outgoing.second);
if(dit->channelType == HPDiagram::sChannel &&
dit->intermediate->width()==ZERO &&
dit->intermediate->mass() > out1->mass()+ out2->mass()) {
tPDPtr in1 = getParticleData(dit->incoming.first );
tPDPtr in2 = getParticleData(dit->incoming.second);
generator()->log() << dit->intermediate->PDGName()
<< " can be on-shell in the process "
<< in1 ->PDGName() << " " << in2->PDGName() << " -> "
<< out1->PDGName() << " " << out2->PDGName()
<< " but has zero width.\nEither set the width, enable "
<< "calculation of its decays, and hence the width,\n"
<< "or disable it as a potential intermediate using\n"
<< "insert " << fullName() << ":Excluded 0 "
<< dit->intermediate->fullName() << "\n---\n";
abort = true;
}
grouped.insert(*dit);
}
if(abort) throw Exception() << "One or more processes with zero width"
<< " resonant intermediates"
<< Exception::runerror;
assert( processes_.size() == grouped.size() );
processes_.clear();
typedef multiset<HPDiagram>::const_iterator set_iter;
set_iter it = grouped.begin(), iend = grouped.end();
while( it != iend ) {
pair<set_iter,set_iter> range = grouped.equal_range(*it);
set_iter itb = range.first;
HPDVector process;
for( ; itb != range.second; ++itb ) {
process.push_back(*itb);
}
// if inclusive enforce the exclusivity
if(processOption_==2) {
if(!((process[0].outgoing. first==outgoing_[0]->id()&&
process[0].outgoing.second==outgoing_[1]->id())||
(process[0].outgoing. first==outgoing_[1]->id()&&
process[0].outgoing.second==outgoing_[0]->id()))) {
process.clear();
it = range.second;
continue;
}
}
if(find(excludedExternal_.begin(),excludedExternal_.end(),
getParticleData(process[0].outgoing. first))!=excludedExternal_.end()) {
process.clear();
it = range.second;
continue;
}
if(find(excludedExternal_.begin(),excludedExternal_.end(),
getParticleData(process[0].outgoing.second))!=excludedExternal_.end()) {
process.clear();
it = range.second;
continue;
}
// finally if the process is allow assign the colour flows
for(unsigned int ix=0;ix<process.size();++ix) assignToCF(process[ix]);
// create the matrix element
createMatrixElement(process);
process.clear();
it = range.second;
}
}
void TwoToTwoProcessConstructor::
createSChannels(tcPDPair inpp, long fs, tVertexBasePtr vertex) {
//Have 2 incoming particle and a vertex, find the possible offshell
//particles
pair<long,long> inc = make_pair(inpp.first->id(), inpp.second->id());
tPDSet offshells = search(vertex, inpp.first->id(), incoming,
inpp.second->id(), incoming, outgoing);
tPDSet::const_iterator it;
for(it = offshells.begin(); it != offshells.end(); ++it) {
if(find(excluded_.begin(),excluded_.end(),*it)!=excluded_.end()) continue;
for(size_t iv = 0; iv < nv_; ++iv) {
tVertexBasePtr vertexB = vertices_[iv];
if( vertexB->getNpoint() != 3) continue;
if( !allDiagrams_ && vertexB->orderInGs() == 0 ) continue;
tPDSet final;
if( vertexB->isOutgoing(getParticleData(fs)) &&
vertexB->isIncoming(*it) )
final = search(vertexB, (*it)->id(), incoming, fs,
outgoing, outgoing);
//Now make diagrams
if(!final.empty())
makeDiagrams(inc, fs, final, *it, HPDiagram::sChannel,
make_pair(vertex, vertexB), make_pair(true,true));
}
}
}
void TwoToTwoProcessConstructor::
createTChannels(tPDPair inpp, long fs, tVertexBasePtr vertex) {
pair<long,long> inc = make_pair(inpp.first->id(), inpp.second->id());
//first try a with c
tPDSet offshells = search(vertex, inpp.first->id(), incoming, fs,
outgoing, outgoing);
tPDSet::const_iterator it;
for(it = offshells.begin(); it != offshells.end(); ++it) {
if(find(excluded_.begin(),excluded_.end(),*it)!=excluded_.end()) continue;
for(size_t iv = 0; iv < nv_; ++iv) {
tVertexBasePtr vertexB = vertices_[iv];
if( vertexB->getNpoint() != 3 ) continue;
if( !allDiagrams_ && vertexB->orderInGs() == 0 ) continue;
tPDSet final;
if( vertexB->isIncoming(inpp.second) )
final = search(vertexB, inc.second, incoming, (*it)->id(),
incoming, outgoing);
if( !final.empty() )
makeDiagrams(inc, fs, final, *it, HPDiagram::tChannel,
make_pair(vertex, vertexB), make_pair(true,true));
}
}
//now try b with c
offshells = search(vertex, inpp.second->id(), incoming, fs,
outgoing, incoming);
for(it = offshells.begin(); it != offshells.end(); ++it) {
if(find(excluded_.begin(),excluded_.end(),*it)!=excluded_.end()) continue;
for(size_t iv = 0; iv < nv_; ++iv) {
tVertexBasePtr vertexB = vertices_[iv];
if( vertexB->getNpoint() != 3 ) continue;
if( !allDiagrams_ && vertexB->orderInGs() == 0 ) continue;
tPDSet final;
if( vertexB->isIncoming(inpp.first) )
final = search(vertexB, inc.first, incoming, (*it)->id(),
outgoing, outgoing);
if( !final.empty() )
makeDiagrams(inc, fs, final, *it, HPDiagram::tChannel,
make_pair(vertexB, vertex), make_pair(true, false));
}
}
}
void TwoToTwoProcessConstructor::makeFourPointDiagrams(long parta, long partb,
long partc, VBPtr vert) {
if(processOption_>=1) {
PDVector::const_iterator loc = find(outgoing_.begin(),outgoing_.end(),
getParticleData(partc));
if(loc==outgoing_.end()) return;
}
tPDSet ext = search(vert, parta, incoming, partb,incoming, partc, outgoing);
if( ext.empty() ) return;
IDPair in(parta, partb);
for(tPDSet::const_iterator iter=ext.begin(); iter!=ext.end();
++iter) {
if(processOption_>=1) {
PDVector::const_iterator loc = find(outgoing_.begin(),outgoing_.end(),
*iter);
if(loc==outgoing_.end()) continue;
}
HPDiagram nhp(in,make_pair(partc, (*iter)->id()));
nhp.vertices = make_pair(vert, vert);
nhp.channelType = HPDiagram::fourPoint;
fixFSOrder(nhp);
if( !duplicate(nhp, processes_) ) processes_.push_back(nhp);
}
}
void
TwoToTwoProcessConstructor::makeDiagrams(IDPair in, long out1, const tPDSet & out2,
PDPtr inter, HPDiagram::Channel chan,
VBPair vertexpair, BPair cross) {
if(processOption_>=1) {
PDVector::const_iterator loc = find(outgoing_.begin(),outgoing_.end(),
getParticleData(out1));
if(loc==outgoing_.end()) return;
}
for(tPDSet::const_iterator it = out2.begin(); it != out2.end(); ++it) {
if(processOption_>=1) {
PDVector::const_iterator loc = find(outgoing_.begin(),outgoing_.end(),
*it);
if(loc==outgoing_.end()) continue;
}
HPDiagram nhp( in,make_pair(out1, (*it)->id()) );
nhp.intermediate = inter;
nhp.vertices = vertexpair;
nhp.channelType = chan;
nhp.ordered = cross;
fixFSOrder(nhp);
if( !duplicate(nhp, processes_) ) processes_.push_back(nhp);
}
}
set<tPDPtr>
TwoToTwoProcessConstructor::search(VBPtr vertex, long part1, direction d1,
long part2, direction d2, direction d3) {
if(vertex->getNpoint() != 3) return tPDSet();
if(d1 == incoming && getParticleData(part1)->CC()) part1 = -part1;
if(d2 == incoming && getParticleData(part2)->CC()) part2 = -part2;
vector<long> ext;
tPDSet third;
for(unsigned int ix = 0;ix < 3; ++ix) {
vector<long> pdlist = vertex->search(ix, part1);
ext.insert(ext.end(), pdlist.begin(), pdlist.end());
}
for(unsigned int ix = 0; ix < ext.size(); ix += 3) {
long id0 = ext.at(ix);
long id1 = ext.at(ix+1);
long id2 = ext.at(ix+2);
int pos;
if((id0 == part1 && id1 == part2) ||
(id0 == part2 && id1 == part1))
pos = ix + 2;
else if((id0 == part1 && id2 == part2) ||
(id0 == part2 && id2 == part1))
pos = ix + 1;
else if((id1 == part1 && id2 == part2) ||
(id1 == part2 && id2 == part1))
pos = ix;
else
pos = -1;
if(pos >= 0) {
tPDPtr p = getParticleData(ext[pos]);
if(d3 == incoming && p->CC()) p = p->CC();
third.insert(p);
}
}
return third;
}
set<tPDPtr>
-TwoToTwoProcessConstructor::search(VBPtr vertex, long part1, direction d1,
- long part2, direction d2, long part3, direction d3,
- direction d4) {
+TwoToTwoProcessConstructor::search(VBPtr vertex,
+ long part1, direction d1,
+ long part2, direction d2,
+ long part3, direction d3,
+ direction d4) {
if(vertex->getNpoint() != 4) return tPDSet();
if(d1 == incoming && getParticleData(part1)->CC()) part1 = -part1;
if(d2 == incoming && getParticleData(part2)->CC()) part2 = -part2;
if(d3 == incoming && getParticleData(part3)->CC()) part3 = -part3;
vector<long> ext;
tPDSet fourth;
for(unsigned int ix = 0;ix < 4; ++ix) {
vector<long> pdlist = vertex->search(ix, part1);
ext.insert(ext.end(), pdlist.begin(), pdlist.end());
}
for(unsigned int ix = 0;ix < ext.size(); ix += 4) {
long id0 = ext.at(ix); long id1 = ext.at(ix + 1);
long id2 = ext.at(ix + 2); long id3 = ext.at(ix + 3);
int pos;
if((id0 == part1 && id1 == part2 && id2 == part3) ||
(id0 == part1 && id1 == part3 && id2 == part2) ||
(id0 == part2 && id1 == part1 && id2 == part3) ||
(id0 == part2 && id1 == part3 && id2 == part1) ||
(id0 == part3 && id1 == part1 && id2 == part2) ||
(id0 == part3 && id1 == part2 && id2 == part1))
pos = ix + 3;
else if((id0 == part1 && id1 == part2 && id3 == part3) ||
(id0 == part1 && id1 == part3 && id3 == part2) ||
(id0 == part2 && id1 == part1 && id3 == part3) ||
(id0 == part2 && id1 == part3 && id3 == part1) ||
(id0 == part3 && id1 == part1 && id3 == part2) ||
(id0 == part3 && id1 == part2 && id3 == part1))
pos = ix + 2;
else if((id0 == part1 && id2 == part2 && id3 == part3) ||
(id0 == part1 && id2 == part3 && id3 == part2) ||
(id0 == part2 && id2 == part1 && id3 == part3) ||
(id0 == part2 && id2 == part3 && id3 == part1) ||
(id0 == part3 && id2 == part1 && id3 == part2) ||
(id0 == part3 && id2 == part2 && id3 == part1))
pos = ix + 1;
else if((id1 == part1 && id2 == part2 && id3 == part3) ||
(id1 == part1 && id2 == part3 && id3 == part2) ||
(id1 == part2 && id2 == part1 && id3 == part3) ||
(id1 == part2 && id2 == part3 && id3 == part1) ||
(id1 == part3 && id2 == part1 && id3 == part2) ||
(id1 == part3 && id2 == part2 && id3 == part1))
pos = ix;
else
pos = -1;
if(pos >= 0) {
tPDPtr p = getParticleData(ext[pos]);
if(d4 == incoming && p->CC())
p = p->CC();
fourth.insert(p);
}
}
return fourth;
}
void
TwoToTwoProcessConstructor::createMatrixElement(const HPDVector & process) const {
if ( process.empty() ) return;
// external particles
tcPDVector extpart(4);
extpart[0] = getParticleData(process[0].incoming.first);
extpart[1] = getParticleData(process[0].incoming.second);
extpart[2] = getParticleData(process[0].outgoing.first);
extpart[3] = getParticleData(process[0].outgoing.second);
// create the object
string objectname ("/Herwig/MatrixElements/");
string classname = MEClassname(extpart, objectname);
GeneralHardMEPtr matrixElement = dynamic_ptr_cast<GeneralHardMEPtr>
(generator()->preinitCreate(classname, objectname));
if( !matrixElement ) {
std::stringstream message;
message << "TwoToTwoProcessConstructor::createMatrixElement "
<< "- No matrix element object could be created for "
<< "the process "
<< extpart[0]->PDGName() << " " << extpart[0]->iSpin() << ","
<< extpart[1]->PDGName() << " " << extpart[1]->iSpin() << "->"
<< extpart[2]->PDGName() << " " << extpart[2]->iSpin() << ","
<< extpart[3]->PDGName() << " " << extpart[3]->iSpin()
<< ". Constructed class name: \"" << classname << "\"";
generator()->logWarning(TwoToTwoProcessConstructorError(message.str(),Exception::warning));
return;
}
// choice for the scale
unsigned int scale;
if(scaleChoice_==0) {
// check coloured initial and final state
bool inColour = ( extpart[0]->coloured() ||
extpart[1]->coloured());
bool outColour = ( extpart[2]->coloured() ||
extpart[3]->coloured());
if(inColour&&outColour) {
bool coloured = false;
for(unsigned int ix=0;ix<process.size();++ix) {
if(process[ix].intermediate&&
process[ix].intermediate->coloured()) {
coloured = true;
break;
}
}
scale = coloured ? 1 : 0;
}
else {
scale = 0;
}
}
else {
scale = scaleChoice_-1;
}
// set the information
matrixElement->setProcessInfo(process, colourFlow(extpart),
debug(), scale, scaleFactor_);
// insert it
generator()->preinitInterface(subProcess(), "MatrixElements",
subProcess()->MEs().size(),
"insert", matrixElement->fullName());
}
string TwoToTwoProcessConstructor::MEClassname(const vector<tcPDPtr> & extpart,
string & objname) const {
string classname("Herwig::ME");
for(vector<tcPDPtr>::size_type ix = 0; ix < extpart.size(); ++ix) {
if(ix == 2) classname += "2";
if(extpart[ix]->iSpin() == PDT::Spin0) classname += "s";
else if(extpart[ix]->iSpin() == PDT::Spin1) classname += "v";
else if(extpart[ix]->iSpin() == PDT::Spin1Half) classname += "f";
else if(extpart[ix]->iSpin() == PDT::Spin2) classname += "t";
else {
std::stringstream message;
message << "MEClassname() : Encountered an unknown spin for "
<< extpart[ix]->PDGName() << " while constructing MatrixElement "
<< "classname " << extpart[ix]->iSpin();
generator()->logWarning(TwoToTwoProcessConstructorError(message.str(),Exception::warning));
}
}
objname += "ME" + extpart[0]->PDGName() + extpart[1]->PDGName() + "2"
+ extpart[2]->PDGName() + extpart[3]->PDGName();
return classname;
}
diff --git a/Models/Leptoquarks/Makefile.am b/Models/Leptoquarks/Makefile.am
--- a/Models/Leptoquarks/Makefile.am
+++ b/Models/Leptoquarks/Makefile.am
@@ -1,10 +1,10 @@
if WANT_Leptoquark
pkglib_LTLIBRARIES = HwLeptoquarkModel.la
endif
HwLeptoquarkModel_la_SOURCES = \
LeptoquarkModel.cc LeptoquarkModel.h LeptoquarkModel.fh \
LeptoquarkModelSLQSLQGGVertex.h LeptoquarkModelSLQSLQGGVertex.cc \
LeptoquarkModelSLQFFVertex.h LeptoquarkModelSLQFFVertex.cc \
LeptoquarkModelSLQSLQGVertex.h LeptoquarkModelSLQSLQGVertex.cc
-HwLeptoquarkModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:1:0
+HwLeptoquarkModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 2:0:0
diff --git a/Models/Makefile.am b/Models/Makefile.am
--- a/Models/Makefile.am
+++ b/Models/Makefile.am
@@ -1,3 +1,4 @@
-SUBDIRS = RSModel StandardModel General Susy UED LH LHTP Zprime\
- Transplanckian AnomalousCouplings Leptoquarks\
- Feynrules ADD HiddenValley TTbAsymm
+SUBDIRS = RSModel StandardModel General Susy UED Zprime \
+ Transplanckian ADD Leptoquarks Sextet TTbAsymm \
+ LH LHTP Zprime AnomalousCouplings \
+ Feynrules HiddenValley
diff --git a/Models/RSModel/Makefile.am b/Models/RSModel/Makefile.am
--- a/Models/RSModel/Makefile.am
+++ b/Models/RSModel/Makefile.am
@@ -1,12 +1,12 @@
if WANT_RS
pkglib_LTLIBRARIES = HwRSModel.la
endif
HwRSModel_la_SOURCES = RSModel.fh RSModel.cc RSModel.h \
RSModelFFGRVertex.cc RSModelFFGRVertex.h \
RSModelFFGGRVertex.cc RSModelFFGGRVertex.h \
RSModelFFWGRVertex.cc RSModelFFWGRVertex.h \
RSModelSSGRVertex.cc RSModelSSGRVertex.h \
RSModelVVGRVertex.cc RSModelVVGRVertex.h \
RSModelWWWGRVertex.cc RSModelWWWGRVertex.h\
RSModelGGGGRVertex.cc RSModelGGGGRVertex.h
-HwRSModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:0:0
+HwRSModel_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 8:0:0
diff --git a/Models/Sextet/Makefile.am b/Models/Sextet/Makefile.am
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/Makefile.am
@@ -0,0 +1,13 @@
+if WANT_SEXTET
+pkglib_LTLIBRARIES = HwSextetModel.la
+endif
+HwSextetModel_la_SOURCES = SextetParticles.h \
+SextetModel.cc SextetModel.h SextetModel.fh \
+SextetGSSVertex.cc SextetGSSVertex.h \
+SextetGGSSVertex.cc SextetGGSSVertex.h \
+SextetGVVVertex.cc SextetGVVVertex.h \
+SextetGGVVVertex.cc SextetGGVVVertex.h \
+SextetFFSVertex.cc SextetFFSVertex.h \
+SextetFFVVertex.cc SextetFFVVertex.h
+
+HwSextetModel_la_LDFLAGS = -module -version-info 1:0:0
diff --git a/Models/Sextet/SextetFFSVertex.cc b/Models/Sextet/SextetFFSVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetFFSVertex.cc
@@ -0,0 +1,216 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetFFSVertex class.
+//
+
+#include "SextetFFSVertex.h"
+#include "SextetModel.h"
+#include "SextetParticles.h"
+#include "ThePEG/Interface/ClassDocumentation.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"
+
+using namespace Herwig;
+
+IBPtr SextetFFSVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetFFSVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+void SextetFFSVertex::persistentOutput(PersistentOStream & os) const {
+ os << g1L_ << g1R_ << g1pR_ << g1ppR_ << g3L_;
+}
+
+void SextetFFSVertex::persistentInput(PersistentIStream & is, int) {
+ is >> g1L_ >> g1R_ >> g1pR_ >> g1ppR_ >> g3L_;
+}
+
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SextetFFSVertex,Helicity::FFSVertex>
+describeSextetFFSVertex("Herwig::SextetFFSVertex", "HwSextetModel.so");
+
+void SextetFFSVertex::Init() {
+
+ static ClassDocumentation<SextetFFSVertex> documentation
+ ("The SextetFFSVertex class implements the coupling of two "
+ "fermions to a scalar sextet particle.");
+
+}
+
+void SextetFFSVertex::doinit() {
+ orderInGs (0);
+ orderInGem(1);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGSSVertex::doinit()"
+ << Exception::runerror;
+ // extract the couplings
+ g1L_ = model->g1L();
+ g1R_ = model->g1R();
+ g1pR_ = model->g1pR();
+ g1ppR_ = model->g1ppR();
+ g3L_ = model->g3L();
+ // add the enabled particles
+ if(model->ScalarSingletY43Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long iu = 2*ix + 2;
+ if(g1ppR_[ix]!=0.) {
+ addToList( iu, iu, ParticleID::ScalarDQSingletY43bar);
+ addToList( -iu, -iu, ParticleID::ScalarDQSingletY43);
+ }
+ }
+ }
+ if(model->ScalarSingletY13Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long iu = 2*ix + 2;
+ long id = 2*ix + 1;
+ if(g1L_[ix]!=0. || g1R_[ix]!=0.) {
+ addToList( id, iu, ParticleID::ScalarDQSingletY13bar);
+ addToList( -id, -iu, ParticleID::ScalarDQSingletY13);
+ }
+ }
+ }
+ if(model->ScalarSingletY23Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long id = 2*ix + 1;
+ if(g1pR_[ix]!=0. ) {
+ addToList( id, id,ParticleID::ScalarDQSingletY23bar);
+ addToList(-id,-id,ParticleID::ScalarDQSingletY23);
+ }
+ }
+ }
+ if(model->ScalarTripletY13Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long iu = 2*ix + 2;
+ long id = 2*ix + 1;
+ if(g3L_[ix]!=0. ) {
+ addToList( iu, iu, ParticleID::ScalarDQTripletPbar);
+ addToList( -iu, -iu, ParticleID::ScalarDQTripletP);
+ addToList( iu, id, ParticleID::ScalarDQTriplet0bar);
+ addToList( -iu, -id, ParticleID::ScalarDQTriplet0);
+ addToList( id, id, ParticleID::ScalarDQTripletMbar);
+ addToList( -id, -id, ParticleID::ScalarDQTripletM);
+ }
+ }
+ }
+ Helicity::FFSVertex::doinit();
+}
+
+
+void SextetFFSVertex::setCoupling(Energy2 q2,tcPDPtr part1,
+ tcPDPtr part2,tcPDPtr part3) {
+ long q1ID=(abs(part1->id())), q2ID=(abs(part2->id())),
+ sDQID=(abs(part3->id()));
+ //check scalar diquark
+ assert( sDQID == ParticleID::ScalarDQSingletY43 ||
+ sDQID == ParticleID::ScalarDQSingletY13 ||
+ sDQID == ParticleID::ScalarDQSingletY23 ||
+ sDQID == ParticleID::ScalarDQTripletP ||
+ sDQID == ParticleID::ScalarDQTriplet0 ||
+ sDQID == ParticleID::ScalarDQTripletM);
+ //check quarks
+ assert(!(q1ID>6) && !(q2ID>6));
+ bool part1Up = (q1ID==2 || q1ID==4 || q1ID==6) ? true : false;
+ bool part2Up = (q2ID==2 || q2ID==4 || q2ID==6) ? true : false;
+ Complex cRight, cLeft, prefactor(1.);
+ if(sDQID==ParticleID::ScalarDQSingletY43){
+ //should both be up type
+ assert(part1Up && part2Up);
+ if(q1ID==2)
+ cRight=Complex(g1ppR_[0]);
+ else if(q1ID==4)
+ cRight=Complex(g1ppR_[1]);
+ else
+ cRight=Complex(g1ppR_[2]);
+ cLeft=Complex(0.);
+ }
+ if(sDQID==ParticleID::ScalarDQSingletY13){
+ //should be one up one down type
+ assert((part1Up && !part2Up) || (!part1Up && part2Up));
+ long upType;
+ if(part1Up)
+ upType=q1ID;
+ else
+ upType=q2ID;
+ if(upType==2){
+ cRight=Complex(g1R_[0]);
+ cLeft=Complex(2.*g1L_[0]);
+ }
+ else if(upType==4){
+ cRight=Complex(g1R_[1]);
+ cLeft=Complex(2.*g1L_[1]);
+ }
+ else
+ cRight=Complex(g1R_[2]);{
+ cLeft=Complex(2.*g1L_[2]);
+ }
+ }
+ if(sDQID==ParticleID::ScalarDQSingletY23){
+ //should both be down type
+ assert(!part1Up && !part2Up);
+ if(q1ID==1)
+ cRight=Complex(g1pR_[0]);
+ else if(q1ID==3)
+ cRight=Complex(g1pR_[1]);
+ else
+ cRight=Complex(g1pR_[2]);
+ cLeft=Complex(0.);
+ }
+ if(sDQID==ParticleID::ScalarDQTripletP){
+ //should both be up type
+ assert(part1Up && part2Up);
+ if(q1ID==2)
+ cLeft=Complex(g3L_[0]);
+ else if(q1ID==4)
+ cLeft=Complex(g3L_[1]);
+ else
+ cLeft=Complex(g3L_[2]);
+ cRight=Complex(0.);
+ }
+ if(sDQID==ParticleID::ScalarDQTriplet0){
+ //should both one up and down type
+ assert((part1Up && !part2Up) || (!part1Up && part2Up));
+ //possibly doesn't couple
+ long upType;
+ if(part1Up)
+ upType=q1ID;
+ else
+ upType=q2ID;
+ if(upType==2)
+ cLeft=Complex(g3L_[0]);
+ else if(upType==4)
+ cLeft=Complex(g3L_[1]);
+ else
+ cLeft=Complex(g3L_[2]);
+ cRight=Complex(0.);
+ }
+ if(sDQID==ParticleID::ScalarDQTripletM){
+ //should one both be down type
+ assert(!part1Up && !part2Up);
+ if(q1ID==1)
+ cLeft=Complex(g3L_[0]);
+ else if(q1ID==3)
+ cLeft=Complex(g3L_[1]);
+ else
+ cLeft=Complex(g3L_[2]);
+ cRight=Complex(0.);
+ prefactor=Complex(-1.);
+ }
+ left(cLeft);
+ right(cRight);
+ norm(prefactor);
+}
diff --git a/Models/Sextet/SextetFFSVertex.h b/Models/Sextet/SextetFFSVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetFFSVertex.h
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetFFSVertex_H
+#define HERWIG_SextetFFSVertex_H
+//
+// This is the declaration of the SextetFFSVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Scalar/FFSVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetFFSVertex class.
+ *
+ * @see \ref SextetFFSVertexInterfaces "The interfaces"
+ * defined for SextetFFSVertex.
+ */
+ class SextetFFSVertex: public Helicity::FFSVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetFFSVertex() {}
+
+ /**
+ * Calculate the couplings.
+ * @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
+ * @param part1 The ParticleData pointer for the first particle.
+ * @param part2 The ParticleData pointer for the second particle.
+ * @param part3 The ParticleData pointer for the third particle.
+ */
+ virtual void setCoupling(Energy2 q2, tcPDPtr part1,
+ tcPDPtr part2, tcPDPtr part3);
+
+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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetFFSVertex & operator=(const SextetFFSVertex &);
+
+private:
+
+ /**
+ * The various couplings
+ */
+ //@{
+ /**
+ * The \f$SU(2)\f$ quark-doublet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ vector<double> g1L_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ vector<double> g1R_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,-2/3}\f$
+ */
+ vector<double> g1pR_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,4/3}\f$
+ */
+ vector<double> g1ppR_;
+
+ /**
+ * Coupling to \f$\Phi_{6,3,1/3}\f$
+ */
+ vector<double> g3L_;
+ //@}
+
+ };
+
+}
+
+#endif /* HERWIG_SextetFFSVertex_H */
diff --git a/Models/Sextet/SextetFFVVertex.cc b/Models/Sextet/SextetFFVVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetFFVVertex.cc
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetFFVVertex class.
+//
+
+#include "SextetFFVVertex.h"
+#include "SextetModel.h"
+#include "SextetParticles.h"
+#include "ThePEG/Interface/ClassDocumentation.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"
+
+using namespace Herwig;
+
+IBPtr SextetFFVVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetFFVVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+void SextetFFVVertex::persistentOutput(PersistentOStream & os) const {
+ os << g2_ << g2p_ ;
+}
+
+void SextetFFVVertex::persistentInput(PersistentIStream & is, int) {
+ is >> g2_ >> g2p_ ;
+}
+
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SextetFFVVertex,Helicity::FFVVertex>
+describeSextetFFVVertex("Herwig::SextetFFVVertex", "HwSextetModel.so");
+
+void SextetFFVVertex::Init() {
+
+ static ClassDocumentation<SextetFFVVertex> documentation
+ ("The SextetFFVVertex class implements the coupling of two "
+ "fermions to a scalar sextet particle.");
+
+}
+
+void SextetFFVVertex::doinit() {
+ orderInGs (0);
+ orderInGem(1);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGSSVertex::doinit()"
+ << Exception::runerror;
+ // extract the couplings
+ g2_ = model->g2();
+ g2p_= model->g2p();
+ // add the enabled particles
+ if(model->VectorDoubletY16Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long iu = 2*ix + 2;
+ long id = 2*ix + 1;
+ if(g2_[ix]!=0.) {
+ addToList( -id, -iu, ParticleID::VectorDQY16P);
+ addToList( id, iu, ParticleID::VectorDQY16Pbar);
+ addToList( -id, -id, ParticleID::VectorDQY16M);
+ addToList( id, id, ParticleID::VectorDQY16Mbar);
+ }
+ }
+ }
+ if(model->VectorDoubletY56Enabled()) {
+ for(long ix=0;ix<3;++ix) {
+ long iu = 2*ix + 2;
+ long id = 2*ix + 1;
+ if(g2p_[ix]!=0.) {
+ addToList( -iu, -iu, ParticleID::VectorDQY56P);
+ addToList( iu, iu, ParticleID::VectorDQY56Pbar);
+ addToList( -id, -iu, ParticleID::VectorDQY56M);
+ addToList( id, iu, ParticleID::VectorDQY56Mbar);
+ }
+ }
+ }
+ Helicity::FFVVertex::doinit();
+}
+
+
+void SextetFFVVertex::setCoupling(Energy2 q2,tcPDPtr part1,
+ tcPDPtr part2,tcPDPtr part3) {
+ long q1ID=(abs(part1->id())), q2ID=(abs(part2->id())),
+ vDQID=(abs(part3->id()));
+ //check scalar diquark
+ assert( vDQID == ParticleID::VectorDQY16P ||
+ vDQID == ParticleID::VectorDQY16M ||
+ vDQID == ParticleID::VectorDQY56P ||
+ vDQID == ParticleID::VectorDQY56M);
+ //check quarks
+ assert(!(q1ID>6) && !(q2ID>6));
+ bool part1Up = (q1ID==2 || q1ID==4 || q1ID==6) ? true : false;
+ bool part2Up = (q2ID==2 || q2ID==4 || q2ID==6) ? true : false;
+ Complex cRight(1.,1.), cLeft(1.,1.), prefactor(1.,0.);
+
+ if(vDQID==ParticleID::VectorDQY16P){
+ //should be one up and down type
+ assert((!part1Up && part2Up) || (part1Up && !part2Up));
+ long upType;
+ if(part1Up)
+ upType=q1ID;
+ else
+ upType=q2ID;
+ if(upType==2)
+ cRight=Complex(g2_[0]);
+ else if(upType==4)
+ cRight=Complex(g2_[1]);
+ else
+ cRight=Complex(g2_[2]);
+ cLeft=Complex(0.);
+ }
+ if(vDQID==ParticleID::VectorDQY16M) {
+ //should be both be down type
+ assert(!part1Up && !part2Up);
+ if(q1ID==1)
+ cRight=Complex(g2_[0]);
+ else if(q1ID==2)
+ cRight=Complex(g2_[1]);
+ else
+ cRight=Complex(g2_[2]);
+ cLeft=Complex(0.);
+ }
+ if(vDQID==ParticleID::VectorDQY56P) {
+ //should both be up type
+ assert(part1Up && part2Up);
+ if(q1ID==2)
+ cRight=Complex(g2p_[0]);
+ else if(q1ID==4)
+ cRight=Complex(g2p_[1]);
+ else
+ cRight=Complex(g2p_[2]);
+ cLeft=Complex(0.);
+ }
+ if(vDQID==ParticleID::VectorDQY56M){
+ //should be one up and down type
+ assert((!part1Up && part2Up) || (part1Up && !part2Up));
+ long upType;
+ if(part1Up)
+ upType=q1ID;
+ else
+ upType=q2ID;
+ if(upType==2)
+ cRight=Complex(g2p_[0]);
+ else if(upType==4)
+ cRight=Complex(g2p_[1]);
+ else
+ cRight=Complex(g2p_[2]);
+ cLeft=Complex(0.);
+ }
+ left(cLeft);
+ right(cRight);
+ norm(prefactor);
+}
+
+
+
+
+
+
diff --git a/Models/Sextet/SextetFFVVertex.h b/Models/Sextet/SextetFFVVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetFFVVertex.h
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetFFVVertex_H
+#define HERWIG_SextetFFVVertex_H
+//
+// This is the declaration of the SextetFFVVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetFFVVertex class.
+ *
+ * @see \ref SextetFFVVertexInterfaces "The interfaces"
+ * defined for SextetFFVVertex.
+ */
+ class SextetFFVVertex: public Helicity::FFVVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetFFVVertex() {}
+
+ /**
+ * Calculate the couplings.
+ * @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
+ * @param part1 The ParticleData pointer for the first particle.
+ * @param part2 The ParticleData pointer for the second particle.
+ * @param part3 The ParticleData pointer for the third particle.
+ */
+ virtual void setCoupling(Energy2 q2, tcPDPtr part1,
+ tcPDPtr part2, tcPDPtr part3);
+
+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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetFFVVertex & operator=(const SextetFFVVertex &);
+
+private:
+
+ /**
+ * The various couplings
+ */
+ //@{
+ /**
+ * The \f$SU(2)\f$ quark-doublet coupling to \f$\Phi_{6,2,-1/6}\f$
+ */
+ vector<double> g2_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,2,5/6}\f$
+ */
+ vector<double> g2p_;
+
+ //@}
+
+ };
+
+}
+
+#endif /* HERWIG_SextetFFVVertex_H */
diff --git a/Models/Sextet/SextetGGSSVertex.cc b/Models/Sextet/SextetGGSSVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGGSSVertex.cc
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetGGSSVertex class.
+//
+
+#include "SextetGGSSVertex.h"
+#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/EventRecord/Particle.h"
+#include "ThePEG/Repository/UseRandom.h"
+#include "ThePEG/Repository/EventGenerator.h"
+#include "ThePEG/Utilities/DescribeClass.h"
+#include "SextetModel.h"
+#include "SextetParticles.h"
+
+using namespace Herwig;
+
+SextetGGSSVertex::SextetGGSSVertex() : q2last_(), couplast_()
+{}
+
+IBPtr SextetGGSSVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetGGSSVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<SextetGGSSVertex,VVSSVertex>
+describeSextetGGSSVertex("Herwig::SextetGGSSVertex", "HwSextetModel.so");
+
+void SextetGGSSVertex::Init() {
+
+ static ClassDocumentation<SextetGGSSVertex> documentation
+ ("The SextetGGSSVertex class implements the coupling of two gluons to two"
+ " scalar sextets");
+
+}
+
+void SextetGGSSVertex::setCoupling(Energy2 q2, tcPDPtr, tcPDPtr, tcPDPtr,
+ tcPDPtr) {
+ if(q2 != q2last_ || couplast_ == 0.) {
+ couplast_ = sqr(strongCoupling(q2));
+ q2last_ = q2;
+ }
+ norm(couplast_);
+}
+
+void SextetGGSSVertex::doinit() {
+ orderInGs(2);
+ orderInGem(0);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGSSVertex::doinit()"
+ << Exception::runerror;
+ // add the enabled particles
+ if(model->ScalarSingletY43Enabled())
+ addToList(21,21,ParticleID::ScalarDQSingletY43,
+ ParticleID::ScalarDQSingletY43bar);
+ if(model->ScalarSingletY13Enabled())
+ addToList(21,21,ParticleID::ScalarDQSingletY13,
+ ParticleID::ScalarDQSingletY13bar);
+ if(model->ScalarSingletY23Enabled())
+ addToList(21,21,ParticleID::ScalarDQSingletY23,
+ ParticleID::ScalarDQSingletY23bar);
+ if(model->ScalarTripletY13Enabled()) {
+ addToList(21,21,ParticleID::ScalarDQTripletP,
+ ParticleID::ScalarDQTripletPbar);
+ addToList(21,21,ParticleID::ScalarDQTriplet0,
+ ParticleID::ScalarDQTriplet0bar);
+ addToList(21,21,ParticleID::ScalarDQTripletM,
+ ParticleID::ScalarDQTripletMbar);
+ }
+ VVSSVertex::doinit();
+}
diff --git a/Models/Sextet/SextetGGSSVertex.h b/Models/Sextet/SextetGGSSVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGGSSVertex.h
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetGGSSVertex_H
+#define HERWIG_SextetGGSSVertex_H
+//
+// This is the declaration of the SextetGGSSVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Scalar/VVSSVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetGGSSVertex class.
+ *
+ * @see \ref SextetGGSSVertexInterfaces "The interfaces"
+ * defined for SextetGGSSVertex.
+ */
+class SextetGGSSVertex: public Helicity::VVSSVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetGGSSVertex();
+
+ /**
+ * Calculate the couplings.
+ * @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
+ * @param part1 The ParticleData pointer for the first particle.
+ * @param part2 The ParticleData pointer for the second particle.
+ * @param part3 The ParticleData pointer for the third particle.
+ * @param part4 The ParticleData pointer for the fourth particle.
+ */
+ virtual void setCoupling(Energy2 q2,tcPDPtr part1,
+ tcPDPtr part2,tcPDPtr part3,tcPDPtr part4);
+
+public:
+
+ /**
+ * 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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetGGSSVertex & operator=(const SextetGGSSVertex &);
+
+private:
+
+ /**
+ * The energy at which the coupling was last evaluated
+ */
+ Energy2 q2last_;
+
+ /**
+ * The coupling when it was last evaluated
+ */
+ Complex couplast_;
+
+};
+
+}
+
+#endif /* HERWIG_SextetGGSSVertex_H */
diff --git a/Models/Sextet/SextetGGVVVertex.cc b/Models/Sextet/SextetGGVVVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGGVVVertex.cc
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetGGVVVertex class.
+//
+
+#include "SextetGGVVVertex.h"
+#include "SextetModel.h"
+#include "SextetParticles.h"
+#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/EventRecord/Particle.h"
+#include "ThePEG/Repository/UseRandom.h"
+#include "ThePEG/Repository/EventGenerator.h"
+#include "ThePEG/Utilities/DescribeClass.h"
+
+using namespace Herwig;
+
+IBPtr SextetGGVVVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetGGVVVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<SextetGGVVVertex,Helicity::VVVVVertex>
+describeSextetGGVVVertex("Herwig::SextetGGVVVertex", "HwSextetModel.so");
+
+void SextetGGVVVertex::Init() {
+
+ static ClassDocumentation<SextetGGVVVertex> documentation
+ ("The SextetGGVVVertex class implements the coupling of two gluons to two vector"
+ " sextet particles.");
+
+}
+
+void SextetGGVVVertex::doinit() {
+ orderInGs(2);
+ orderInGem(0);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGGVVVertex::doinit()"
+ << Exception::runerror;
+ if(model->VectorDoubletY16Enabled()) {
+ addToList(21,21,ParticleID::VectorDQY16P,
+ ParticleID::VectorDQY16Pbar);
+ addToList(21,21,ParticleID::VectorDQY16M,
+ ParticleID::VectorDQY16Mbar);
+
+ }
+ if(model->VectorDoubletY56Enabled()) {
+ addToList(21,21,ParticleID::VectorDQY56P,
+ ParticleID::VectorDQY56Pbar);
+ addToList(21,21,ParticleID::VectorDQY56M,
+ ParticleID::VectorDQY56Mbar);
+ }
+ VVVVVertex::doinit();
+}
+
+void SextetGGVVVertex::setCoupling(Energy2 q2, tcPDPtr , tcPDPtr ,
+ tcPDPtr , tcPDPtr ) {
+ if(q2 != q2Last_ || coupLast_ == 0. ) {
+ q2Last_ = q2;
+ coupLast_ = sqr(strongCoupling(q2));
+ }
+ norm(coupLast_);
+ setType(1);
+ setOrder(0,1,2,3);
+}
diff --git a/Models/Sextet/SextetGGVVVertex.h b/Models/Sextet/SextetGGVVVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGGVVVertex.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetGGVVVertex_H
+#define HERWIG_SextetGGVVVertex_H
+//
+// This is the declaration of the SextetGGVVVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Vector/VVVVVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetGGVVVertex class.
+ *
+ * @see \ref SextetGGVVVertexInterfaces "The interfaces"
+ * defined for SextetGGVVVertex.
+ */
+class SextetGGVVVertex: public Helicity::VVVVVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetGGVVVertex() {}
+
+ /** Calculate the coupling
+ *@param q2 The scale at which to evaluate the coupling
+ *@param part1 The first interacting particle
+ *@param part2 The second interacting particle
+ *@param part3 The third interacting particle
+ *@param part4 The fourth interacting particle
+ */
+ virtual void setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
+ tcPDPtr part3, tcPDPtr part4);
+
+public:
+
+ /**
+ * 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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetGGVVVertex & operator=(const SextetGGVVVertex &);
+
+private:
+
+ /**
+ * The scale at which the coupling was last evaluated
+ */
+ Energy2 q2Last_;
+
+ /**
+ * The value of the coupling when it was last evaluated
+ */
+ Complex coupLast_;
+
+};
+
+}
+
+#endif /* HERWIG_SextetGGVVVertex_H */
diff --git a/Models/Sextet/SextetGSSVertex.cc b/Models/Sextet/SextetGSSVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGSSVertex.cc
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetGSSVertex class.
+//
+
+#include "SextetGSSVertex.h"
+#include "SextetModel.h"
+#include "SextetParticles.h"
+#include "ThePEG/Interface/ClassDocumentation.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"
+
+using namespace Herwig;
+
+IBPtr SextetGSSVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetGSSVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SextetGSSVertex,Helicity::VSSVertex,false,true>
+describeSextetGSSVertex("Herwig::SextetGSSVertex", "HwSextetModel.so");
+
+void SextetGSSVertex::Init() {
+
+ static ClassDocumentation<SextetGSSVertex> documentation
+ ("The SextetGSSVertex class implements the coupling of the gluon"
+ " to scalar diquarks.");
+
+}
+
+void SextetGSSVertex::doinit() {
+ orderInGs (1);
+ orderInGem(0);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGSSVertex::doinit()"
+ << Exception::runerror;
+ // add the enabled particles
+ if(model->ScalarSingletY43Enabled())
+ addToList(21,ParticleID::ScalarDQSingletY43,
+ ParticleID::ScalarDQSingletY43bar);
+ if(model->ScalarSingletY13Enabled())
+ addToList(21,ParticleID::ScalarDQSingletY13,
+ ParticleID::ScalarDQSingletY13bar);
+ if(model->ScalarSingletY23Enabled())
+ addToList(21,ParticleID::ScalarDQSingletY23,
+ ParticleID::ScalarDQSingletY23bar);
+ if(model->ScalarTripletY13Enabled()) {
+ addToList(21,ParticleID::ScalarDQTripletP,
+ ParticleID::ScalarDQTripletPbar);
+ addToList(21,ParticleID::ScalarDQTriplet0,
+ ParticleID::ScalarDQTriplet0bar);
+ addToList(21,ParticleID::ScalarDQTripletM,
+ ParticleID::ScalarDQTripletMbar);
+ }
+ Helicity::VSSVertex::doinit();
+}
+
+void SextetGSSVertex::setCoupling(Energy2 q2, tcPDPtr part1,
+ tcPDPtr part2, tcPDPtr ) {
+ assert(part1->id()==ParticleID::g);
+ long idq = abs(part2->id());
+ assert(idq == ParticleID::ScalarDQSingletY43 ||
+ idq == ParticleID::ScalarDQSingletY13 ||
+ idq == ParticleID::ScalarDQSingletY23 ||
+ idq == ParticleID::ScalarDQTripletP ||
+ idq == ParticleID::ScalarDQTriplet0 ||
+ idq == ParticleID::ScalarDQTripletM);
+ if(q2 != q2Last_ || coupLast_ == 0.) {
+ coupLast_ = strongCoupling(q2);
+ q2Last_ = q2;
+ }
+ norm(coupLast_);
+}
diff --git a/Models/Sextet/SextetGSSVertex.h b/Models/Sextet/SextetGSSVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGSSVertex.h
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetGSSVertex_H
+#define HERWIG_SextetGSSVertex_H
+//
+// This is the declaration of the SextetGSSVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Scalar/VSSVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetGSSVertex class.
+ *
+ * @see \ref SextetGSSVertexInterfaces "The interfaces"
+ * defined for SextetGSSVertex.
+ */
+class SextetGSSVertex: public Helicity::VSSVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetGSSVertex() {}
+
+ /**
+ * Calculate the couplings.
+ * @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
+ * @param part1 The ParticleData pointer for the first particle.
+ * @param part2 The ParticleData pointer for the second particle.
+ * @param part3 The ParticleData pointer for the third particle.
+ */
+ virtual void setCoupling(Energy2 q2,tcPDPtr part1,
+ tcPDPtr part2,tcPDPtr part3);
+
+public:
+
+ /**
+ * 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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetGSSVertex & operator=(const SextetGSSVertex &);
+
+private:
+
+ /**
+ * Store the value of the coupling when last evaluated
+ */
+ Complex coupLast_;
+
+ /**
+ * Store the scale at which coupling was last evaluated
+ */
+ Energy2 q2Last_;
+
+};
+
+}
+
+#endif /* HERWIG_SextetGSSVertex_H */
diff --git a/Models/Sextet/SextetGVVVertex.cc b/Models/Sextet/SextetGVVVertex.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGVVVertex.cc
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetGVVVertex class.
+//
+
+#include "SextetModel.h"
+#include "SextetGVVVertex.h"
+#include "SextetParticles.h"
+#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/EventRecord/Particle.h"
+#include "ThePEG/Repository/UseRandom.h"
+#include "ThePEG/Repository/EventGenerator.h"
+#include "ThePEG/Utilities/DescribeClass.h"
+
+using namespace Herwig;
+
+IBPtr SextetGVVVertex::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetGVVVertex::fullclone() const {
+ return new_ptr(*this);
+}
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<SextetGVVVertex,Helicity::VVVVertex>
+describeSextetGVVVertex("Herwig::SextetGVVVertex", "HwSextetModel.so");
+
+void SextetGVVVertex::Init() {
+
+ static ClassDocumentation<SextetGVVVertex> documentation
+ ("The SextetGVVVertex class implements the coupling of the gluon to two"
+ " vector sextet particles");
+
+}
+
+void SextetGVVVertex::doinit() {
+ orderInGs(1);
+ orderInGem(0);
+ SextetModelPtr model =
+ dynamic_ptr_cast<SextetModelPtr>(generator()->standardModel());
+ if(!model) throw Exception() << "Must be using the SextetModel"
+ << " in SextetGVVVertex::doinit()"
+ << Exception::runerror;
+ if(model->VectorDoubletY16Enabled()) {
+ addToList(21,ParticleID::VectorDQY16P,
+ ParticleID::VectorDQY16Pbar);
+ addToList(21,ParticleID::VectorDQY16M,
+ ParticleID::VectorDQY16Mbar);
+
+ }
+ if(model->VectorDoubletY56Enabled()) {
+ addToList(21,ParticleID::VectorDQY56P,
+ ParticleID::VectorDQY56Pbar);
+ addToList(21,ParticleID::VectorDQY56M,
+ ParticleID::VectorDQY56Mbar);
+ }
+ VVVVertex::doinit();
+}
+
+void SextetGVVVertex::setCoupling(Energy2 q2, tcPDPtr , tcPDPtr ,
+ tcPDPtr ) {
+ if(q2 != q2Last_ || coupLast_ == 0.) {
+ q2Last_ = q2;
+ coupLast_ = strongCoupling(q2);
+ }
+ norm(coupLast_);
+}
diff --git a/Models/Sextet/SextetGVVVertex.h b/Models/Sextet/SextetGVVVertex.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetGVVVertex.h
@@ -0,0 +1,100 @@
+// -*- C++ -*-
+#ifndef THEPEG_SextetGVVVertex_H
+#define THEPEG_SextetGVVVertex_H
+//
+// This is the declaration of the SextetGVVVertex class.
+//
+
+#include "ThePEG/Helicity/Vertex/Vector/VVVVertex.h"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/**
+ * Here is the documentation of the SextetGVVVertex class.
+ *
+ * @see \ref SextetGVVVertexInterfaces "The interfaces"
+ * defined for SextetGVVVertex.
+ */
+ class SextetGVVVertex: public Helicity::VVVVertex {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetGVVVertex() {}
+
+ /** Calculate the coupling
+ *@param q2 The scale at which to evaluate the coupling
+ *@param part1 The first interacting particle
+ *@param part2 The second interacting particle
+ *@param part3 The third interacting particle
+ */
+ virtual void setCoupling(Energy2 q2,tcPDPtr part1,
+ tcPDPtr part2,tcPDPtr part3);
+
+public:
+
+ /**
+ * 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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetGVVVertex & operator=(const SextetGVVVertex &);
+
+private:
+
+ /**
+ * Store the value of the coupling when last evaluated
+ */
+ Complex coupLast_;
+
+ /**
+ * Store the scale at which coupling was last evaluated
+ */
+ Energy2 q2Last_;
+
+};
+
+}
+
+#endif /* THEPEG_SextetGVVVertex_H */
diff --git a/Models/Sextet/SextetModel.cc b/Models/Sextet/SextetModel.cc
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetModel.cc
@@ -0,0 +1,249 @@
+// -*- C++ -*-
+//
+// This is the implementation of the non-inlined, non-templated member
+// functions of the SextetModel class.
+//
+
+#include "SextetModel.h"
+#include "ThePEG/Utilities/StringUtils.h"
+#include "ThePEG/Interface/Reference.h"
+#include "ThePEG/Interface/Command.h"
+#include "ThePEG/Interface/Switch.h"
+#include "ThePEG/Interface/ParVector.h"
+#include "ThePEG/Interface/ClassDocumentation.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"
+
+using namespace Herwig;
+
+IBPtr SextetModel::clone() const {
+ return new_ptr(*this);
+}
+
+IBPtr SextetModel::fullclone() const {
+ return new_ptr(*this);
+}
+
+void SextetModel::persistentOutput(PersistentOStream & os) const {
+ os << VVVVertex_ << VVVVVertex_ << VSSVertex_ << VVSSVertex_
+ << FFVVertex_ << FFSVertex_
+ << g1L_ << g1R_ << g1pR_ << g1ppR_ << g2_ << g2p_ << g3L_
+ << enableScalarSingletY43_ << enableScalarSingletY13_
+ << enableScalarSingletY23_ << enableScalarTripletY13_
+ << enableVectorDoubletY16_ << enableVectorDoubletY56_;
+}
+
+void SextetModel::persistentInput(PersistentIStream & is, int) {
+ is >> VVVVertex_ >> VVVVVertex_ >> VSSVertex_ >> VVSSVertex_
+ >> FFVVertex_ >> FFSVertex_
+ >> g1L_ >> g1R_ >> g1pR_ >> g1ppR_ >> g2_ >> g2p_ >> g3L_
+ >> enableScalarSingletY43_ >> enableScalarSingletY13_
+ >> enableScalarSingletY23_ >> enableScalarTripletY13_
+ >> enableVectorDoubletY16_ >> enableVectorDoubletY56_;
+}
+
+
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SextetModel,StandardModel>
+ describeSextetModel("Herwig::SextetModel", "HwSextetModel.so");
+
+void SextetModel::Init() {
+
+ static ClassDocumentation<SextetModel> documentation
+ ("The SextetModel class provides the Model class for models with new scalars"
+ " or vectors in the sextet representation of SU(3)");
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractVVVVertex>
+ interfaceVertexVDQVDQG
+ ("Vertex/VDQVDQG",
+ "The coupling of the gluon to two vector diquarks",
+ &SextetModel::VVVVertex_, false, false, true, false, false);
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractVVVVVertex>
+ interfaceVertexVDQVDQGG
+ ("Vertex/VDQVDQGG",
+ "The coupling of two gluons to two vector diquarks",
+ &SextetModel::VVVVVertex_, false, false, true, false, false);
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractVSSVertex>
+ interfaceVertexSDQSDQG
+ ("Vertex/SDQSDQG",
+ "The coupling of the gluon to two scalar diquarks",
+ &SextetModel::VSSVertex_, false, false, true, false, false);
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractVVSSVertex>
+ interfaceVertexSDQSDQGG
+ ("Vertex/SDQSDQGG",
+ "The coupling of two gluons to two scalar diquarks",
+ &SextetModel::VVSSVertex_, false, false, true, false, false);
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractFFSVertex>
+ interfaceVertexFFSDQ
+ ("Vertex/FFSDQ",
+ "The coupling of two quarks to the scalar diquark",
+ &SextetModel::FFSVertex_, false, false, true, false, false);
+
+ static Reference<SextetModel,ThePEG::Helicity::AbstractFFVVertex>
+ interfaceVertexFFVDQ
+ ("Vertex/FFVDQ",
+ "The coupling of two quarks to the vector diquark",
+ &SextetModel::FFVVertex_, false, false, true, false, false);
+
+ static ParVector<SextetModel,double> interfaceg1L
+ ("g1L",
+ "The \\f$SU(2)\\f$ quark-doublet coupling to \\f$\\Phi_{6,1,1/3}\\f$.",
+ &SextetModel::g1L_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg1R
+ ("g1R",
+ "The \\f$SU(2)\\f$ singlet coupling to \\f$\\Phi_{6,1,1/3}\\f$.",
+ &SextetModel::g1R_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg1RPrime
+ ("g1RPrime",
+ "The \\f$SU(2)\\f$ singlet coupling to \\f$\\Phi_{6,1,1/3}\\f$.",
+ &SextetModel::g1pR_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg1RDoublePrime
+ ("g1RDoublePrime",
+ "The \\f$SU(2)\\f$ singlet coupling to \\f$\\Phi_{6,1,1/3}\\f$.",
+ &SextetModel::g1ppR_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg2
+ ("g2",
+ "The coupling to \\f$V^\\mu_{6,2,-1/6}\\f$.",
+ &SextetModel::g2_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg2Prime
+ ("g2Prime",
+ "The coupling to \\f$V^\\mu_{6,2,5/6}\\f$.",
+ &SextetModel::g2p_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static ParVector<SextetModel,double> interfaceg3L
+ ("g3L",
+ "Coupling to \\f$\\Phi_{6,3,1/3}\\f$.",
+ &SextetModel::g3L_, 3, 0.0, 0, 0,
+ false, false, Interface::nolimits);
+
+ static Command<SextetModel> interfaceEnableParticles
+ ("EnableParticles",
+ "Enable specfiic diquarks",
+ &SextetModel::doEnable, false);
+
+}
+
+void SextetModel::doinit() {
+ StandardModel::doinit();
+ addVertex(VVVVertex_);
+ addVertex(VVVVVertex_);
+ addVertex(VSSVertex_);
+ addVertex(VVSSVertex_);
+ addVertex(FFVVertex_);
+ addVertex(FFSVertex_);
+}
+
+string SextetModel::doEnable(string args) {
+ int spin=-1;
+ int weak=-1;
+ int Y[2]={-1000000,-1000000};
+ string orig=args;
+ while ( !args.empty() ) {
+ string arg = StringUtils::car(args);
+ args = StringUtils::cdr(args);
+ if ( arg == "Scalar" ) spin=1;
+ else if ( arg == "Vector" ) spin=3;
+ else if ( arg == "Singlet" ) weak=1;
+ else if ( arg == "Doublet" ) weak=2;
+ else if ( arg == "Triplet" ) weak=3;
+ else {
+ if(arg.find("Y=")==string::npos) continue;
+ arg = StringUtils::cdr(arg,"=");
+ vector<string> split = StringUtils::split(arg,"/");
+ if(split.size()!=2) continue;
+ istringstream is1(split[0]);
+ is1 >> Y[0];
+ istringstream is2(split[1]);
+ is2 >> Y[1];
+ }
+ }
+ // check we read a value for all three quantum numbers
+ if ( spin <0 || weak<0 || 0 || Y[0]== -1000000) {
+ return string("SextetModel:EnableParticles couldn't termine spin, weak") +
+ string(" isospin or hypercharge for ") + orig + ".";
+ }
+ // check the values of Y
+ if(!(Y[1]==3||Y[1]==6)) {
+ return string("SextetModel:EnableParticles invalid weak") +
+ string(" hypercharge for ") + orig + ".";
+ }
+ // the various allowed combinations
+ bool found = false;
+ if(spin == 1 ) {
+ found = true;
+ if ( weak == 1 && Y[0] == 4 && Y[1] == 3) {
+ enableScalarSingletY43_ = true;
+ }
+ else if( weak == 1 && Y[0] == 1 && Y[1] == 3) {
+ enableScalarSingletY13_ = true;
+ }
+ else if( weak == 1 && Y[0] == -2 && Y[1] == 3) {
+ enableScalarSingletY23_ = true;
+ }
+ else if( weak == 3 && Y[0] == 1 && Y[1] == 3) {
+ enableScalarTripletY13_ = true;
+ }
+ else
+ found = false;
+ }
+ else if(spin == 3 && weak == 2) {
+ found = true;
+ if ( Y[0] == -1 && Y[1] == 6) {
+ enableVectorDoubletY16_ = true;
+ }
+ else if( Y[0] == 5 && Y[1] == 6) {
+ enableVectorDoubletY56_ = true;
+ }
+ else
+ found = false;
+ }
+ if(!found)
+ return string("SextetModel:EnableParticles invalid combination") +
+ string(" of spin, weak isospin or hypercharge for ") + orig + ".";
+ else
+ return "";
+}
+
+//
+// Scalar Singlet Y = 4/3
+// Scalar Singlet Y = -1/3
+// Scalar Singlet Y = -2/3
+// Scalar Triplet Y = 1/3
+// Vector Doublet Y = -1/6
+// Vector Doublet Y = 5/6
+
+ /**
+ * Pointer to the object handling the coupling of two quarks
+ * to a vector sextet
+ */
+ AbstractFFVVertexPtr FFVVertex_;
+
+ /**
+ * Pointer to the object handling the coupling of two quarks
+ * to a scalar sextet
+ */
+ AbstractFFSVertexPtr FFSVertex_;
+//@}
diff --git a/Models/Sextet/SextetModel.fh b/Models/Sextet/SextetModel.fh
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetModel.fh
@@ -0,0 +1,18 @@
+// -*- C++ -*-
+//
+// This is the forward declaration of the SextetModel class.
+//
+#ifndef HERWIG_SextetModel_FH
+#define HERWIG_SextetModel_FH
+
+#include "ThePEG/Config/ThePEG.h"
+
+namespace Herwig {
+
+class SextetModel;
+
+ThePEG_DECLARE_POINTERS(Herwig::SextetModel,SextetModelPtr);
+
+}
+
+#endif
diff --git a/Models/Sextet/SextetModel.h b/Models/Sextet/SextetModel.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetModel.h
@@ -0,0 +1,308 @@
+// -*- C++ -*-
+#ifndef HERWIG_SextetModel_H
+#define HERWIG_SextetModel_H
+//
+// This is the declaration of the SextetModel class.
+//
+
+#include "Herwig++/Models/StandardModel/StandardModel.h"
+#include "ThePEG/Helicity/Vertex/AbstractVVVVertex.h"
+#include "ThePEG/Helicity/Vertex/AbstractVVVVVertex.h"
+#include "ThePEG/Helicity/Vertex/AbstractFFVVertex.h"
+#include "ThePEG/Helicity/Vertex/AbstractFFSVertex.h"
+#include "ThePEG/Helicity/Vertex/AbstractVSSVertex.h"
+#include "ThePEG/Helicity/Vertex/AbstractVVSSVertex.h"
+#include "SextetModel.fh"
+
+namespace Herwig {
+
+using namespace ThePEG;
+
+/** \ingroup Models
+ *
+ * This class is used instead of the StandardModel class for the
+ *
+ *
+ * @see \ref SextetModelInterfaces "The interfaces"
+ * defined for SextetModel.
+ */
+class SextetModel: public StandardModel {
+
+public:
+
+ /**
+ * The default constructor.
+ */
+ SextetModel() : g1L_(3,0.), g1R_(3,0.), g1pR_(3,0.), g1ppR_(3,0.),
+ g2_(3,0.), g2p_(3,0.), g3L_(3,0.),
+ enableScalarSingletY43_(false),enableScalarSingletY13_(false),
+ enableScalarSingletY23_(false),enableScalarTripletY13_(false),
+ enableVectorDoubletY16_(false),enableVectorDoubletY56_(false) {
+ useMe();
+ }
+
+ /**
+ * Access to the couplings
+ */
+ //@{
+ /**
+ * The \f$SU(2)\f$ quark-doublet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ const vector<double> & g1L() const {return g1L_;}
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ const vector<double> & g1R() const {return g1R_;}
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,-2/3}\f$
+ */
+ const vector<double> & g1pR() const {return g1pR_;}
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,4/3}\f$
+ */
+ const vector<double> & g1ppR() const {return g1ppR_;}
+
+ /**
+ * The coupling to \f$V^\mu_{6,2,-1/6}\f$
+ */
+ const vector<double> & g2() const {return g2_;}
+
+ /**
+ * The coupling to \f$V^\mu_{6,2,5/6}\f$
+ */
+ const vector<double> & g2p() const {return g2p_;}
+
+ /**
+ * Coupling to \f$\Phi_{6,3,1/3}\f$
+ */
+ const vector<double> & g3L() const {return g3L_;}
+ //@}
+
+ /**
+ * Switches to decide which particles to include
+ */
+ //@{
+ /**
+ * Scalar Singlet \f$Y = 4/3\f$
+ */
+ bool ScalarSingletY43Enabled() const {return enableScalarSingletY43_;}
+
+ /**
+ * Scalar Singlet \f$Y = -1/3\f$
+ */
+ bool ScalarSingletY13Enabled() const {return enableScalarSingletY13_;}
+
+ /**
+ * Scalar Singlet \f$Y = -2/3\f$
+ */
+ bool ScalarSingletY23Enabled() const {return enableScalarSingletY23_;}
+
+ /**
+ * Scalar Triplet \f$Y = 1/3\f$
+ */
+ bool ScalarTripletY13Enabled() const {return enableScalarTripletY13_;}
+
+ /**
+ * Vector Doublet \f$Y = -1/6\f$
+ */
+ bool VectorDoubletY16Enabled() const {return enableVectorDoubletY16_;}
+
+ /**
+ * Vector Doublet \f$Y = 5/6\f$
+ */
+ bool VectorDoubletY56Enabled() const {return enableVectorDoubletY56_;}
+ //@}
+
+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 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 after the setup phase before saving an
+ * EventGenerator to disk.
+ * @throws InitException if object could not be initialized properly.
+ */
+ virtual void doinit();
+
+ /**
+ * Member to implement the command to enable particular diquarks
+ */
+ string doEnable(string command);
+ //@}
+
+private:
+
+ /**
+ * The assignment operator is private and must never be called.
+ * In fact, it should not even be implemented.
+ */
+ SextetModel & operator=(const SextetModel &);
+
+private:
+
+ /**
+ * Pointers to the vertex objects
+ */
+ //@{
+ /**
+ * Pointer to the object handling the strong coupling of a
+ * vector sextet to one gluon
+ */
+ AbstractVVVVertexPtr VVVVertex_;
+
+ /**
+ * Pointer to the object handling the strong coupling of a
+ * vector sextet to two gluons
+ */
+ AbstractVVVVVertexPtr VVVVVertex_;
+
+ /**
+ * Pointer to the object handling the strong coupling of a
+ * scalar sextet to one gluon
+ */
+ AbstractVSSVertexPtr VSSVertex_;
+
+ /**
+ * Pointer to the object handling the strong coupling of a
+ * scalar sextet to two gluons
+ */
+ AbstractVVSSVertexPtr VVSSVertex_;
+
+ /**
+ * Pointer to the object handling the coupling of two quarks
+ * to a vector sextet
+ */
+ AbstractFFVVertexPtr FFVVertex_;
+
+ /**
+ * Pointer to the object handling the coupling of two quarks
+ * to a scalar sextet
+ */
+ AbstractFFSVertexPtr FFSVertex_;
+ //@}
+
+ /**
+ * Couplings
+ */
+ //@{
+ /**
+ * The \f$SU(2)\f$ quark-doublet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ vector<double> g1L_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,1/3}\f$
+ */
+ vector<double> g1R_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,-2/3}\f$
+ */
+ vector<double> g1pR_;
+
+ /**
+ * The \f$SU(2)\f$ singlet coupling to \f$\Phi_{6,1,4/3}\f$
+ */
+ vector<double> g1ppR_;
+
+ /**
+ * The coupling to \f$V^\mu_{6,2,-1/6}\f$
+ */
+ vector<double> g2_;
+
+ /**
+ * The coupling to \f$V^\mu_{6,2,5/6}\f$
+ */
+ vector<double> g2p_;
+
+ /**
+ * Coupling to \f$\Phi_{6,3,1/3}\f$
+ */
+ vector<double> g3L_;
+ //@}
+
+ /**
+ * Switches to decide which particles to include
+ */
+ //@{
+ /**
+ * Scalar Singlet \f$Y = 4/3\f$
+ */
+ bool enableScalarSingletY43_;
+
+ /**
+ * Scalar Singlet \f$Y = -1/3\f$
+ */
+ bool enableScalarSingletY13_;
+
+ /**
+ * Scalar Singlet \f$Y = -2/3\f$
+ */
+ bool enableScalarSingletY23_;
+
+ /**
+ * Scalar Triplet \f$Y = 1/3\f$
+ */
+ bool enableScalarTripletY13_;
+
+ /**
+ * Vector Doublet \f$Y = -1/6\f$
+ */
+ bool enableVectorDoubletY16_;
+
+ /**
+ * Vector Doublet \f$Y = 5/6\f$
+ */
+ bool enableVectorDoubletY56_;
+ //@}
+};
+
+}
+
+#endif /* HERWIG_SextetModel_H */
diff --git a/Models/Sextet/SextetParticles.h b/Models/Sextet/SextetParticles.h
new file mode 100644
--- /dev/null
+++ b/Models/Sextet/SextetParticles.h
@@ -0,0 +1,65 @@
+#ifndef HERWIG_SextetParticles_H
+#define HERWIG_SextetParticles_H
+
+#include <ThePEG/PDT/EnumParticles.h>
+
+namespace ThePEG {
+
+/**
+ * The ParticleID namespace defines the ParticleCodes enumeration.
+ */
+namespace ParticleID {
+
+/** \ingroup Utilities
+ * Enumeration to give identifiers to PDG codes for sextet particles
+ */
+enum SextetCodes {
+ ScalarDQSingletY43 = 6000221,
+ /**< \f$\Phi_{6,1,4/3}\f$*/
+ ScalarDQSingletY13 = 6000211,
+ /**< \f$\Phi_{6,1,1/3}\f$*/
+ ScalarDQSingletY23 = 6000111,
+ /**< \f$\Phi_{6,1,-2/3}\f$*/
+ ScalarDQSingletY43bar = -6000221,
+ /**< \f$\bar\Phi_{6,1,4/3}\f$*/
+ ScalarDQSingletY13bar = -6000211,
+ /**< \f$\bar\Phi_{6,1,1/3}\f$*/
+ ScalarDQSingletY23bar = -6000111,
+ /**< \f$\bar\Phi_{6,1,-2/3}\f$*/
+ ScalarDQTripletP = 6001221,
+ /**< \f$\Phi^+_{6,3,1/3}\f$*/
+ ScalarDQTriplet0 = 6001211,
+ /**< \f$\Phi^0_{6,3,1/3}\f$*/
+ ScalarDQTripletM = 6001111,
+ /**< \f$\Phi^-_{6,3,1/3}\f$*/
+ ScalarDQTripletPbar = -6001221,
+ /**< \f$\bar\Phi^+_{6,3,1/3}\f$*/
+ ScalarDQTriplet0bar = -6001211,
+ /**< \f$\bar\Phi^0_{6,3,1/3}\f$*/
+ ScalarDQTripletMbar = -6001111,
+ /**< \f$\bar\Phi^-_{6,3,1/3}\f$*/
+ VectorDQY16P = 6000123,
+ /**< \f$V^{+\frac12\mu}_{6,2,-1/6}\f$*/
+ VectorDQY16M = 6000113,
+ /**< \f$V^{-\frac12\mu}_{6,2,-1/6}\f$*/
+ VectorDQY16Pbar = -6000123,
+ /**< \f$\bar V^{+\frac12\mu}_{6,2,-1/6}\f$*/
+ VectorDQY16Mbar = -6000113,
+ /**< \f$\bar V^{-\frac12\mu}_{6,2,-1/6}\f$*/
+ VectorDQY56P = 6000223,
+ /**< \f$V^{+\frac12\mu}_{6,2,5/6}\f$*/
+ VectorDQY56M = 6000213,
+ /**< \f$V^{-\frac12\mu}_{6,2,5/6}\f$*/
+ VectorDQY56Pbar = -6000223,
+ /**< \f$\bar V^{+\frac12\mu}_{6,2,5/6}\f$*/
+ VectorDQY56Mbar = -6000213
+ /**< \f$\bar V^{-\frac12\mu}_{6,2,5/6}\f$*/
+};
+
+}
+
+}
+
+#endif
+
+
diff --git a/Models/Susy/MSSM.cc b/Models/Susy/MSSM.cc
--- a/Models/Susy/MSSM.cc
+++ b/Models/Susy/MSSM.cc
@@ -1,197 +1,203 @@
// -*- C++ -*-
//
// MSSM.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MSSM class.
//
#include "MSSM.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
void MSSM::persistentOutput(PersistentOStream & os) const {
os << theStopMix << theSbotMix << theStauMix << theAlpha
<< ounit(theAtop,GeV) << ounit(theAbottom,GeV) << ounit(theAtau,GeV)
<< theHiggsMix;
}
void MSSM::persistentInput(PersistentIStream & is, int) {
is >> theStopMix >> theSbotMix >> theStauMix >> theAlpha
>> iunit(theAtop,GeV) >> iunit(theAbottom,GeV) >> iunit(theAtau,GeV)
>> theHiggsMix;
}
-ClassDescription<MSSM> MSSM::initMSSM;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<MSSM,SusyBase>
+describeMSSM("Herwig::MSSM", "HwSusy.so");
void MSSM::Init() {
static ClassDocumentation<MSSM> documentation
("The MSSM class is the base class for the MSSM model.",
"MSSM Feynman rules were taken from \\cite{Haber:1984rc,Gunion:1984yn}.",
" %\\cite{Haber:1984rc}\n"
"\\bibitem{Haber:1984rc}\n"
" H.~E.~Haber and G.~L.~Kane,\n"
" %``The Search For Supersymmetry: Probing Physics Beyond The Standard Model,''\n"
" Phys.\\ Rept.\\ {\\bf 117}, 75 (1985).\n"
" %%CITATION = PRPLC,117,75;%%\n"
"%\\cite{Gunion:1984yn}\n"
"\\bibitem{Gunion:1984yn}\n"
" J.~F.~Gunion and H.~E.~Haber,\n"
" %``Higgs Bosons In Supersymmetric Models. 1,''\n"
" Nucl.\\ Phys.\\ B {\\bf 272}, 1 (1986)\n"
" [Erratum-ibid.\\ B {\\bf 402}, 567 (1993)].\n"
" %%CITATION = NUPHA,B272,1;%%\n"
);
}
void MSSM::createMixingMatrices() {
useMe();
map<string,pair<MatrixSize, MixingVector> >::const_iterator it;
for(it=mixings().begin();it!=mixings().end();++it) {
string name=it->first;
// create the stop, sbottom and stau mixing matrices
if(name == "stopmix" ){
createMixingMatrix(theStopMix,name,it->second.second,it->second.first);
}
else if (name == "sbotmix" ) {
createMixingMatrix(theSbotMix,name,it->second.second,it->second.first);
}
else if (name == "staumix") {
createMixingMatrix(theStauMix,name,it->second.second,it->second.first);
}
// Higgs mixing matrix in extended models
else if (name == "nmhmix") {
createMixingMatrix(theHiggsMix,name,it->second.second,it->second.first);
}
}
// neutral higgs mixing if not already set
if(!theHiggsMix) {
MixingVector hmix;
hmix.push_back(MixingElement(1,1, cos(theAlpha)));
hmix.push_back(MixingElement(1,2, sin(theAlpha)));
hmix.push_back(MixingElement(2,1,-sin(theAlpha)));
hmix.push_back(MixingElement(2,2, cos(theAlpha)));
vector<long> ids(2);
ids[0] = 25; ids[1] = 35;
theHiggsMix = new_ptr(MixingMatrix(2,2));
(*theHiggsMix).setIds(ids);
}
// base class for neutralinos and charginos
SusyBase::createMixingMatrices();
}
void MSSM::adjustMixingMatrix(long id) {
switch (id) {
case 1000006 :
case 2000006 :
if(theStopMix)
theStopMix->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The stop mixing matrix pointer is null!"
<< Exception::runerror;
break;
case 1000005 :
case 2000005 :
if(theSbotMix)
theSbotMix->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The sbottom mixing matrix pointer is null!"
<< Exception::runerror;
break;
case 1000015 :
case 2000015 :
if(theStauMix)
theStauMix->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The stau mixing matrix pointer is null!"
<< Exception::runerror;
break;
default :
SusyBase::adjustMixingMatrix(id);
break;
}
}
void MSSM::extractParameters(bool checkmodel) {
map<string,pair<MatrixSize, MixingVector> >::const_iterator it;
// trilinear couplings
for(it=mixings().begin();it!=mixings().end();++it) {
string name=it->first;
MixingVector::const_iterator vit;
if(name=="au") {
theAtop=ZERO;
for(vit=it->second.second.begin();vit!=it->second.second.end();++vit) {
if(vit->row==3&&vit->col==3) theAtop=vit->value*GeV;
}
}
else if(name=="ad") {
theAbottom=ZERO;
for(vit=it->second.second.begin();vit!=it->second.second.end();++vit) {
if(vit->row==3&&vit->col==3) theAbottom=vit->value*GeV;
}
}
else if(name=="ae") {
theAtau=ZERO;
for(vit=it->second.second.begin();vit!=it->second.second.end();++vit) {
if(vit->row==3&&vit->col==3) theAtau=vit->value*GeV;
}
}
}
// neutralino and chargino paramters in the base class
SusyBase::extractParameters(false);
// check the model
map<string,ParamMap>::const_iterator pit;
pit=parameters().find("modsel");
if(pit==parameters().end()) return;
// nmssm or mssm
ParamMap::const_iterator jt;
jt = pit->second.find(3);
int inmssm = jt!=pit->second.end() ? int(jt->second) : 0;
// RPV
jt = pit->second.find(4);
int irpv = jt!=pit->second.end() ? int(jt->second) : 0;
// CPV
jt = pit->second.find(5);
int icpv = jt!=pit->second.end() ? int(jt->second) : 0;
// flavour violation
jt = pit->second.find(6);
int ifv = jt!=pit->second.end() ? int(jt->second) : 0;
// the higgs mixing angle if not NMSSM
theAlpha=0.;
if(inmssm==0) {
map<string,ParamMap>::const_iterator pit;
pit=parameters().find("alpha");
if(pit!=parameters().end()) {
ParamMap::const_iterator it = pit->second.find(1);
if(it!=pit->second.end()) theAlpha=it->second;
}
}
if(checkmodel) {
if(inmssm!=0) throw Exception() << "R-parity, CP and flavour conserving MSSM model"
<< " used but NMSSM read in "
<< Exception::runerror;
if(irpv!=0) throw Exception() << "R-parity, CP and flavour conserving MSSM model"
<< " used but RPV read in "
<< Exception::runerror;
if(icpv!=0) throw Exception() << "R-parity, CP and flavour conserving MSSM model"
<< " used but CPV read in "
<< Exception::runerror;
if(ifv!=0) throw Exception() << "R-parity, CP and flavour conserving MSSM model"
<< " used but flavour violation read in "
<< Exception::runerror;
}
}
diff --git a/Models/Susy/MSSM.h b/Models/Susy/MSSM.h
--- a/Models/Susy/MSSM.h
+++ b/Models/Susy/MSSM.h
@@ -1,240 +1,199 @@
// -*- C++ -*-
//
// MSSM.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_MSSM_H
#define HERWIG_MSSM_H
//
// This is the declaration of the MSSM class.
//
#include "SusyBase.h"
#include "MSSM.fh"
namespace Herwig {
using namespace ThePEG;
/**
* The MSSM class provides the main model class to replace the Standard Model
* when using the Minimal Supersymmetric Standard Model.
*
* @see \ref MSSMInterfaces "The interfaces"
* defined for MSSM.
*/
class MSSM: public SusyBase {
public:
/**
* Value of Higgs mixing angle \f$\alpha\f$.
*/
double higgsMixingAngle() const {return theAlpha;}
/**
* Value of up-type trilinear couplings
*/
const complex<Energy> & topTrilinear() const {return theAtop;}
/**
* Value of down-type trilinear couplings
*/
const complex<Energy> & bottomTrilinear() const {return theAbottom;}
/**
* Value of lepton trilinear couplings
*/
const complex<Energy> & tauTrilinear() const {return theAtau;}
/**
* The stop mixing matrix
*/
const MixingMatrixPtr & stopMix() const {return theStopMix;}
/**
* The sbottom chargino mixing matrix
*/
const MixingMatrixPtr & sbottomMix() const {return theSbotMix;}
/**
* The stau mixing matrix
*/
const MixingMatrixPtr & stauMix() const {return theStauMix;}
/**
* Mixing matrix for the neutral CP-even Higgs bosons
*/
const MixingMatrixPtr & CPevenHiggsMix() const {return theHiggsMix;}
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 Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/**
* Create the mixing matrices for the model
*/
virtual void createMixingMatrices();
/**
* Extract the parameters from the input blocks
*/
virtual void extractParameters(bool checkModel=true);
/**
* Adjust row of Mixing Matrix if a negative mass occurs in LHA file
* @param id The PDG code of the particle with a negative mass
*/
virtual void adjustMixingMatrix(long id);
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<MSSM> initMSSM;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
MSSM & operator=(const MSSM &);
private:
/**
* Third generation squark and slepton mixing matrices
*/
//@{
/**
* The \f$\tilde{t}\f$ mixing matrix
*/
MixingMatrixPtr theStopMix;
/**
* The \f$\tilde{b}\f$ mixing matrix
*/
MixingMatrixPtr theSbotMix;
/**
* The \f$\tilde{\tau}\f$ mixing matrix
*/
MixingMatrixPtr theStauMix;
//@}
/**
* Trilinear couplings stored as vector of complex numbers to make use
* of routine already available to read complex matrices
*/
//@{
/**
* For the up type squarks
*/
complex<Energy> theAtop;
/**
* For the down type squarks
*/
complex<Energy> theAbottom;
/**
* For the charged sleptons
*/
complex<Energy> theAtau;
//@}
/**
* Value of higgs mixing angle.
*/
double theAlpha;
/**
* Higgs mixing matrix
*/
MixingMatrixPtr theHiggsMix;
};
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of MSSM. */
-template <>
-struct BaseClassTrait<Herwig::MSSM,1> {
- /** Typedef of the first base class of MSSM. */
- typedef Herwig::SusyBase NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the MSSM class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::MSSM>
- : public ClassTraitsBase<Herwig::MSSM> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::MSSM"; }
- /**
- * The name of a file containing the dynamic library where the class
- * MSSM is implemented. It may also include several, space-separated,
- * libraries if the class MSSM depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_MSSM_H */
diff --git a/Models/Susy/Makefile.am b/Models/Susy/Makefile.am
--- a/Models/Susy/Makefile.am
+++ b/Models/Susy/Makefile.am
@@ -1,33 +1,33 @@
SUBDIRS = NMSSM RPV MatrixElements
if WANT_MSSM
pkglib_LTLIBRARIES = HwSusy.la
endif
HwSusy_la_SOURCES = SusyBase.cc SusyBase.h SusyBase.fh \
MSSM.cc MSSM.h MSSM.fh\
MixingMatrix.h MixingMatrix.fh MixingMatrix.cc\
SSCFSVertex.cc SSCFSVertex.h \
SSGFSVertex.cc SSGFSVertex.h \
SSHSFSFVertex.cc SSHSFSFVertex.h \
SSNFSVertex.cc SSNFSVertex.h \
SSWSSVertex.cc SSWSSVertex.h \
SSGSSVertex.cc SSGSSVertex.h \
SSGGSQSQVertex.cc SSGGSQSQVertex.h \
SSGSGSGVertex.cc SSGSGSGVertex.h \
SSNNZVertex.cc SSNNZVertex.h \
SSCCZVertex.cc SSCCZVertex.h \
SSCNWVertex.cc SSCNWVertex.h \
SSFFHVertex.cc SSFFHVertex.h \
SSGOGOHVertex.cc SSGOGOHVertex.h \
SSWWHVertex.cc SSWWHVertex.h \
SSWWHHVertex.cc SSWWHHVertex.h \
SSWHHVertex.cc SSWHHVertex.h \
SSHHHVertex.cc SSHHHVertex.h \
SSHGGVertex.cc SSHGGVertex.h \
SSHPPVertex.cc SSHPPVertex.h \
SSNNPVertex.h SSNNPVertex.cc \
SSGNGVertex.h SSGNGVertex.cc \
SSNCTVertex.h SSNCTVertex.cc \
SSGVNHVertex.h SSGVNHVertex.cc\
SSGVNVVertex.h SSGVNVVertex.cc\
SSGVFSVertex.h SSGVFSVertex.cc
-HwSusy_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:1:0
+HwSusy_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 8:0:0
diff --git a/Models/Susy/MixingMatrix.cc b/Models/Susy/MixingMatrix.cc
--- a/Models/Susy/MixingMatrix.cc
+++ b/Models/Susy/MixingMatrix.cc
@@ -1,56 +1,62 @@
// -*- C++ -*-
//
// MixingMatrix.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MixingMatrix class.
//
#include "MixingMatrix.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
void MixingMatrix::persistentOutput(PersistentOStream & os) const {
os << _theMixingMatrix << _theIds << _theSize;
}
void MixingMatrix::persistentInput(PersistentIStream & is, int) {
is >> _theMixingMatrix >> _theIds >> _theSize;
}
-ClassDescription<MixingMatrix> MixingMatrix::initMixingMatrix;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<MixingMatrix,Interfaced>
+describeMixingMatrix("Herwig::MixingMatrix", "HwSusy.so");
void MixingMatrix::Init() {
static ClassDocumentation<MixingMatrix> documentation
("The MixingMatrix class implements the storage of the SUSY mixing "
"matrices.");
}
void MixingMatrix::adjustPhase(long id) {
unsigned int irow(0);
while(irow < size().first && _theIds[irow] != id)
++irow;
for(unsigned int c = 0; c < _theSize.second; ++c)
_theMixingMatrix[irow][c] *= Complex(0., 1.);
}
ostream & Herwig::operator<<(ostream & os,const MixingMatrix & mix) {
for(unsigned int ix=0;ix<mix.size().first;++ix) {
for(unsigned int iy=0;iy<mix.size().second;++iy) {
os << mix(ix,iy) << "\t";
}
os << "\n";
}
return os;
}
diff --git a/Models/Susy/MixingMatrix.h b/Models/Susy/MixingMatrix.h
--- a/Models/Susy/MixingMatrix.h
+++ b/Models/Susy/MixingMatrix.h
@@ -1,299 +1,262 @@
// -*- C++ -*-
//
// MixingMatrix.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_MixingMatrix_H
#define HERWIG_MixingMatrix_H
//
// This is the declaration of the MixingMatrix class.
//
#include "ThePEG/Interface/Interfaced.h"
#include "ThePEG/Config/Complex.h"
#include "MixingMatrix.fh"
#include "ThePEG/Utilities/Exception.h"
namespace Herwig {
using namespace ThePEG;
/*@name Some convenient typedefs. */
//@{
/**
* A complex valued nested vector.
*/
typedef vector<vector<Complex> > CMatrix;
/**
* Struct for the elements of a mixing matrix
*/
struct MixingElement{
/**
* Constructor
*/
MixingElement(unsigned int irow, unsigned int icol,Complex ivalue)
: row(irow), col(icol), value(ivalue) {}
/**
* row
*/
unsigned int row;
/**
* column
*/
unsigned int col;
/**
* value
*/
Complex value;
};
/**
* A vector of mixing elements.
*/
typedef vector<MixingElement> MixingVector;
/**
* The size of the matrix
*/
typedef pair<unsigned int, unsigned int> MatrixSize;
//@}
/**
* This class is desinged to store the mixing matrices needed for Susy
* studies. The actual matrix is stored as a nested complex vector. It
* also stores a vector of PDG codes correspoding to the mass states of
* mixing states.
*
* @see Interfaced
*/
class MixingMatrix: public Interfaced {
/** Exception class to indicate problem with mixing matrix .*/
class MixingMatrixError : public Exception {};
public:
/** @name Constructors */
//@{
/**
* Constructor that takes a mixing matrix and a vector id's as arguments
* @param mix Mixing matrix
* @param ids The ids of the mixing sparticles
*/
MixingMatrix(const CMatrix & mix,const vector<long> & ids) :
_theMixingMatrix(mix),_theIds(ids), _theSize(make_pair(mix.size(),mix[0].size()))
{}
/**
* Contructor that initializes size of matrix
*/
MixingMatrix(unsigned int row, unsigned int col) :
_theMixingMatrix(row,vector<Complex>(col,Complex(0.,0.))), _theSize(row,col)
{}
/**
* Standard Constructor.
*/
MixingMatrix() {}
//@}
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();
/** @name Get and Set functions. */
//@{
/**
* Set the mixing matrix
* @param mixing The Mixing matrix stored as nested complex vector
*/
void setMatrix(const CMatrix & mixing) {
_theMixingMatrix = mixing;
_theSize = make_pair(mixing.size(),mixing[0].size());
}
/**
*Get the mixing matrix
*/
CMatrix getMatrix() const {return _theMixingMatrix;}
/**
* Set the vector containing mixing particles codes
* @param mixingCodes vector containing PDG codes for mixing particles
*/
void setIds(const vector<long> & mixingCodes) {
if(mixingCodes.size() != _theSize.first) {
throw MixingMatrixError() << "MixingMatrix::setIds() - The number "
<< "of PDG codes does not match the size of the "
<< "matrix" << Exception::warning;
return;
}
_theIds = mixingCodes;
}
/**
* Get the vector containing mixing particles codes
*/
const vector<long> & getIds() const {return _theIds;}
//@}
/**
* Multiply row corresponding to id by \f$i\f$
* @param id PDG code of particle
*/
void adjustPhase(long id);
/**
* Access element of matrix
*/
const Complex operator()(unsigned int row, unsigned int col) const {
return _theMixingMatrix.at(row).at(col);
}
/**
* Set element of matrix
*/
Complex & operator()(unsigned int row, unsigned int col) {
return _theMixingMatrix.at(row).at(col);
}
/**
* Add a PDG code to the stored vector
*/
void addCode(long id) {
if(_theIds.size() >= _theSize.first) {
throw MixingMatrixError() << "MixingMatrix::addCode() - Trying to add a"
<< "PDG code but the vector already contains the "
<< "same number as the matrix size "
<< Exception::warning;
return;
}
_theIds.push_back(id);
}
/**
* Return the size of the mixing matrix
*/
MatrixSize size() const {return _theSize;}
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<MixingMatrix> initMixingMatrix;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
MixingMatrix & operator=(const MixingMatrix &);
/**
* The mixing matrix
*/
CMatrix _theMixingMatrix;
/**
* The PDG codes of the mixing particles
*/
vector<long> _theIds;
/**
* Size of matrix
*/
pair<unsigned int,unsigned int> _theSize;
/**
* Print the matrix to the stream
*/
friend ostream & operator<<(ostream & os,const MixingMatrix & mix);
};
/**
* Output operator for the MixingMatrix
*/
ostream & operator<<(ostream &,const MixingMatrix &);
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of MixingMatrix. */
-template <>
-struct BaseClassTrait<Herwig::MixingMatrix,1> {
- /** Typedef of the first base class of MixingMatrix. */
- typedef Interfaced NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the MixingMatrix class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::MixingMatrix>
- : public ClassTraitsBase<Herwig::MixingMatrix> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::MixingMatrix"; }
- /** Return the name of the shared library be loaded to get
- * access to the MixingMatrix class and every other class it uses
- * (except the base class). */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_MixingMatrix_H */
diff --git a/Models/Susy/NMSSM/Makefile.am b/Models/Susy/NMSSM/Makefile.am
--- a/Models/Susy/NMSSM/Makefile.am
+++ b/Models/Susy/NMSSM/Makefile.am
@@ -1,15 +1,15 @@
if WANT_NMSSM
pkglib_LTLIBRARIES = HwNMSSM.la
endif
HwNMSSM_la_SOURCES = \
NMSSM.cc NMSSM.h NMSSM.fh \
NMSSMFFHVertex.h NMSSMFFHVertex.cc \
NMSSMWWHVertex.h NMSSMWWHVertex.cc \
NMSSMWHHVertex.h NMSSMWHHVertex.cc \
NMSSMHSFSFVertex.h NMSSMHSFSFVertex.cc\
NMSSMGOGOHVertex.h NMSSMGOGOHVertex.cc \
NMSSMHHHVertex.h NMSSMHHHVertex.cc \
NMSSMGGHVertex.h NMSSMGGHVertex.cc \
NMSSMPPHVertex.h NMSSMPPHVertex.cc \
NMSSMWWHHVertex.h NMSSMWWHHVertex.cc
-HwNMSSM_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:1:0
+HwNMSSM_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 2:0:0
diff --git a/Models/Susy/SSCCZVertex.cc b/Models/Susy/SSCCZVertex.cc
--- a/Models/Susy/SSCCZVertex.cc
+++ b/Models/Susy/SSCCZVertex.cc
@@ -1,124 +1,130 @@
// -*- C++ -*-
//
// SSCCZVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSCCZVertex class.
//
#include "SSCCZVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/EnumParticles.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
SSCCZVertex::SSCCZVertex() : _sw2(0.), _cw(0.), _couplast(0.),
_q2last(), _id1last(0), _id2last(0),
_leftlast(0.), _rightlast(0.), _gblast(0) {
orderInGs(0);
orderInGem(1);
}
void SSCCZVertex::doinit() {
addToList(-1000024, 1000024, 23);
addToList(-1000024, 1000037, 23);
addToList(-1000037, 1000024, 23);
addToList(-1000037, 1000037, 23);
//photon
addToList(-1000024, 1000024, 22);
addToList(-1000037, 1000037, 22);
FFVVertex::doinit();
tSusyBasePtr theSS = dynamic_ptr_cast<SusyBasePtr>(generator()->standardModel());
if(!theSS)
throw InitException() << "SSCCZVertex::doinit - The model pointer "
<< "is null! "
<< Exception::abortnow;
_sw2 = sin2ThetaW();
_cw = sqrt(1. - _sw2);
_theU = theSS->charginoUMix();
_theV = theSS->charginoVMix();
if(!_theU || !_theV)
throw InitException() << "SSCCZVertex::doinit - "
<< "A mixing matrix pointer is null. U: "
<< _theU << " V: " << _theV
<< Exception::abortnow;
}
void SSCCZVertex::persistentOutput(PersistentOStream & os) const {
os << _sw2 << _cw << _theU << _theV;
}
void SSCCZVertex::persistentInput(PersistentIStream & is, int) {
is >> _sw2 >> _cw >> _theU >> _theV;
}
-ClassDescription<SSCCZVertex> SSCCZVertex::initSSCCZVertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SSCCZVertex,Helicity::FFVVertex>
+describeSSCCZVertex("Herwig::SSCCZVertex", "HwSusy.so");
void SSCCZVertex::Init() {
static ClassDocumentation<SSCCZVertex> documentation
("This class implements the coupling of a Z/gamma to a pair of"
" charginos. ");
}
void SSCCZVertex::setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
tcPDPtr part3) {
long ichar1(part1->id()), ichar2(part2->id()), boson(part3->id());
assert( boson == ParticleID::gamma || boson == ParticleID::Z0);
assert( abs(ichar1) == 1000024 || abs(ichar1) == 1000037);
assert( abs(ichar2) == 1000024 || abs(ichar2) == 1000037);
if(_q2last != q2||_couplast==0.) {
_q2last = q2;
_couplast = electroMagneticCoupling(q2);
}
norm(_couplast);
if(boson != _gblast || ichar1 != _id1last || ichar2 != _id2last) {
_gblast = boson;
_id1last = ichar1;
_id2last = ichar2;
if( boson == ParticleID::Z0 ) {
unsigned int ic1(0), ic2(0);
if(abs(ichar1) == 1000037) ic1 = 1;
if(abs(ichar2) == 1000037) ic2 = 1;
_leftlast = -(*_theV)(ic1, 0)*conj((*_theV)(ic2, 0)) -
0.5*(*_theV)(ic1, 1)*conj((*_theV)(ic2, 1));
_rightlast = -conj((*_theU)(ic1, 0))*(*_theU)(ic2, 0) -
0.5*conj((*_theU)(ic1, 1))*(*_theU)(ic2, 1);
if(abs(ichar1) == abs(ichar2)) {
_leftlast += _sw2;
_rightlast += _sw2;
}
_leftlast /= sqrt(_sw2)*_cw;
_rightlast /= sqrt(_sw2)*_cw;
}
else {
if(abs(ichar1) == abs(ichar2)) {
_leftlast = -1.;
_rightlast = -1.;
}
else {
_leftlast = 0.;
_rightlast = 0.;
}
}
if(ichar1>0) {
Complex temp = _leftlast;
_leftlast = -_rightlast;
_rightlast = -temp;
}
}
left(_leftlast);
right(_rightlast);
}
diff --git a/Models/Susy/SSCCZVertex.h b/Models/Susy/SSCCZVertex.h
--- a/Models/Susy/SSCCZVertex.h
+++ b/Models/Susy/SSCCZVertex.h
@@ -1,212 +1,170 @@
// -*- C++ -*-
//
// SSCCZVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSCCZVertex_H
#define HERWIG_SSCCZVertex_H
//
// This is the declaration of the SSCCZVertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h"
#include "SusyBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* This class implements the coupling of a \f$\gamma/Z^0\f$ to a pair of
* charginos. It inherits from FFVVertex and implements the setCoupling method.
*
* @see \ref SSCCZVertexInterfaces "The interfaces"
* defined for SSCCZVertex.
* @see FFVVertex
*/
class SSCCZVertex: public FFVVertex {
public:
/**
* The default constructor.
*/
SSCCZVertex();
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();
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
*/
virtual void setCoupling(Energy2 q2, tcPDPtr part1,
tcPDPtr part2, tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<SSCCZVertex> initSSCCZVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSCCZVertex & operator=(const SSCCZVertex &);
private:
/**
* Value of \f$sin^2(\theta_W)\f$
*/
double _sw2;
/**
* Value of \f$cos(\theta_W)\f$
*/
double _cw;
/**
* The U mixing matrix
*/
tMixingMatrixPtr _theU;
/**
* The V mixing matrix
*/
tMixingMatrixPtr _theV;
/**
* The value of the coupling when it was last evaluated
*/
Complex _couplast;
/**
* The scale at which the coupling was last evaluated
*/
Energy2 _q2last;
/**
* The id of the first chargino the last time the vertex was evaluated
*/
long _id1last;
/**
* The id of the second chargino the last time the vertex was evaluated
*/
long _id2last;
/**
* The value of the left coupling when it was last evaluated
*/
Complex _leftlast;
/**
* The value of the right coupling when it was last evaluated
*/
Complex _rightlast;
/**
* The ID of the gauge boson when the vertex was last evaluated
*/
long _gblast;
};
}
-
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSCCZVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSCCZVertex,1> {
- /** Typedef of the first base class of SSCCZVertex. */
- typedef ThePEG::Helicity::FFVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSCCZVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSCCZVertex>
- : public ClassTraitsBase<Herwig::SSCCZVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSCCZVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSCCZVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSCCZVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSCCZVertex_H */
diff --git a/Models/Susy/SSCNWVertex.cc b/Models/Susy/SSCNWVertex.cc
--- a/Models/Susy/SSCNWVertex.cc
+++ b/Models/Susy/SSCNWVertex.cc
@@ -1,128 +1,134 @@
// -*- C++ -*-
//
// SSCNWVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSCNWVertex class.
//
#include "SSCNWVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/EnumParticles.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
SSCNWVertex::SSCNWVertex() : _sw(0.), _couplast(0.), _q2last(ZERO),
_id1last(0), _id2last(0), _leftlast(0.),
_rightlast(0.) {
orderInGs(0);
orderInGem(1);
}
void SSCNWVertex::doinit() {
long neu[] = { 1000022, 1000023, 1000025, 1000035, 1000045 };
long cha[] = { 1000024, 1000037 };
// sign == -1 outgoing W-, sign == +1 outgoing W+
for(int sign = -1; sign < 2; sign += 2)
for(unsigned int ine = 0; ine < 5; ++ine)
for(unsigned int ic = 0; ic < 2; ++ic)
addToList(-sign*cha[ic], neu[ine], sign*24);
FFVVertex::doinit();
tSusyBasePtr theSS = dynamic_ptr_cast<SusyBasePtr>(generator()->standardModel());
if(!theSS)
throw InitException() << "SSCNWVertex::doinit() - The model pointer is null!"
<< Exception::abortnow;
_sw = sqrt(sin2ThetaW());
_theN = theSS->neutralinoMix();
_theU = theSS->charginoUMix();
_theV = theSS->charginoVMix();
if(!_theN || !_theU || ! _theV)
throw InitException() << "SSCNWVertex::doinit() - "
<< "A mixing matrix pointer is null."
<< " N: " << _theN << " U: " << _theU << " V: "
<< _theV << Exception::abortnow;
}
void SSCNWVertex::persistentOutput(PersistentOStream & os) const {
os << _sw << _theN << _theU << _theV;
}
void SSCNWVertex::persistentInput(PersistentIStream & is, int) {
is >> _sw >> _theN >> _theU >> _theV;
}
-ClassDescription<SSCNWVertex> SSCNWVertex::initSSCNWVertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SSCNWVertex,Helicity::FFVVertex>
+describeSSCNWVertex("Herwig::SSCNWVertex", "HwSusy.so");
void SSCNWVertex::Init() {
static ClassDocumentation<SSCNWVertex> documentation
("This class implements the coupling of a W boson to a "
"neutralino and a chargino");
}
void SSCNWVertex::setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
#ifndef NDEBUG
tcPDPtr part3) {
#else
tcPDPtr) {
#endif
assert(abs(part3->id()) == ParticleID::Wplus);
long neu, cha;
if(part1->charged()) {
cha = part1->id();
neu = part2->id();
}
else {
cha = part2->id();
neu = part1->id();
}
assert((abs(cha) == 1000024 || abs(cha) == 1000037) &&
(neu == 1000022 || neu == 1000023 ||
neu == 1000025 || neu == 1000035 ||
neu == 1000045) );
if(q2 != _q2last||_couplast==0.) {
_q2last = q2;
_couplast = weakCoupling(q2);
}
norm(_couplast);
if(cha != _id1last || neu != _id2last) {
_id1last = cha;
_id2last = neu;
unsigned int eigc = abs(cha) == 1000037 ? 1 : 0;
unsigned int eign(0);
if (neu == 1000023) eign = 1;
else if(neu == 1000025) eign = 2;
else if(neu == 1000035) eign = 3;
else if(neu == 1000045) eign = 4;
_leftlast = (*_theN)(eign, 1)*conj((*_theV)(eigc, 0)) -
( (*_theN)(eign, 3)*conj((*_theV)(eigc, 1))/sqrt(2));
_rightlast = conj((*_theN)(eign, 1))*(*_theU)(eigc, 0) +
( conj((*_theN)(eign, 2))*(*_theU)(eigc, 1)/sqrt(2));
}
Complex ltemp = _leftlast;
Complex rtemp = _rightlast;
// conjugate if +ve chargino
if(cha>0) {
ltemp = conj(ltemp);
rtemp = conj(rtemp);
}
if((part1->id()==cha&&cha>0)||(part2->id()==cha&&cha<0)) {
Complex temp = ltemp;
ltemp = -rtemp;
rtemp = -temp;
}
left (ltemp);
right(rtemp);
}
diff --git a/Models/Susy/SSCNWVertex.h b/Models/Susy/SSCNWVertex.h
--- a/Models/Susy/SSCNWVertex.h
+++ b/Models/Susy/SSCNWVertex.h
@@ -1,207 +1,165 @@
// -*- C++ -*-
//
// SSCNWVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSCNWVertex_H
#define HERWIG_SSCNWVertex_H
//
// This is the declaration of the SSCNWVertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h"
#include "SusyBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* This class is implements the coupling of a W boson to a chargino and a
* neutralino. It inherits from FFVVertex and implements the setCoupling method.
*
* @see \ref SSCNWVertexInterfaces "The interfaces"
* defined for SSCNWVertex.
* @see FFVVertex
*/
class SSCNWVertex: public FFVVertex {
public:
/**
* The default constructor.
*/
SSCNWVertex();
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();
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
*/
virtual void setCoupling(Energy2 q2, tcPDPtr part1,
tcPDPtr part2, tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<SSCNWVertex> initSSCNWVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSCNWVertex & operator=(const SSCNWVertex &);
private:
/**
* Store \f$sin(\theta_W)\f$
*/
double _sw;
/**
* Store the neutralino mixing matrix
*/
tMixingMatrixPtr _theN;
/**
* Store the U-type chargino mixing matrix
*/
tMixingMatrixPtr _theU;
/**
* Store the V-type chargino mixing matrix
*/
tMixingMatrixPtr _theV;
/**
* The value of the coupling when it was last evaluated
*/
Complex _couplast;
/**
* The scale at which the coupling was last evaluated
*/
Energy2 _q2last;
/**
* The id of the first chargino the last time the vertex was evaluated
*/
long _id1last;
/**
* The id of the second chargino the last time the vertex was evaluated
*/
long _id2last;
/**
* The value of the left coupling when it was last evaluated
*/
Complex _leftlast;
/**
* The value of the right coupling when it was last evaluated
*/
Complex _rightlast;
};
}
-
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSCNWVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSCNWVertex,1> {
- /** Typedef of the first base class of SSCNWVertex. */
- typedef ThePEG::Helicity::FFVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSCNWVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSCNWVertex>
- : public ClassTraitsBase<Herwig::SSCNWVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSCNWVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSCNWVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSCNWVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSCNWVertex_H */
diff --git a/Models/Susy/SSGGSQSQVertex.cc b/Models/Susy/SSGGSQSQVertex.cc
--- a/Models/Susy/SSGGSQSQVertex.cc
+++ b/Models/Susy/SSGGSQSQVertex.cc
@@ -1,58 +1,61 @@
// -*- C++ -*-
//
// SSGGSQSQVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSGGSQSQVertex class.
//
#include "SSGGSQSQVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
-SSGGSQSQVertex::SSGGSQSQVertex() : _q2last(),_couplast(0.) {
- orderInGs(2);
- orderInGem(0);
-}
-
-NoPIOClassDescription<SSGGSQSQVertex> SSGGSQSQVertex::initSSGGSQSQVertex;
-// Definition of the static class description member.
+SSGGSQSQVertex::SSGGSQSQVertex() : q2last_(),couplast_(0.)
+{}
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<SSGGSQSQVertex,Helicity::VVSSVertex>
+describeSSGGSQSQVertex("Herwig::SSGGSQSQVertex", "HwSusy.so");
void SSGGSQSQVertex::Init() {
static ClassDocumentation<SSGGSQSQVertex> documentation
("This implements the gluon-gluon-squark-squark vertex.");
}
void SSGGSQSQVertex::setCoupling(Energy2 q2, tcPDPtr, tcPDPtr, tcPDPtr,
tcPDPtr) {
- if(q2 != _q2last || _couplast == 0.) {
- _couplast = sqr(strongCoupling(q2));
- _q2last = q2;
+ if(q2 != q2last_ || couplast_ == 0.) {
+ couplast_ = sqr(strongCoupling(q2));
+ q2last_ = q2;
}
- norm(_couplast);
+ norm(couplast_);
}
void SSGGSQSQVertex::doinit() {
//L-L squarks
for(long ix=1000001;ix<1000007;++ix) {
addToList(21,21,ix,-ix);
}
//R-R squarks
for(long ix=2000001;ix<2000007;++ix) {
addToList(21,21,ix,-ix);
}
+ orderInGs(2);
+ orderInGem(0);
VVSSVertex::doinit();
}
-
-
diff --git a/Models/Susy/SSGGSQSQVertex.h b/Models/Susy/SSGGSQSQVertex.h
--- a/Models/Susy/SSGGSQSQVertex.h
+++ b/Models/Susy/SSGGSQSQVertex.h
@@ -1,155 +1,110 @@
// -*- C++ -*-
//
// SSGGSQSQVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSGGSQSQVertex_H
#define HERWIG_SSGGSQSQVertex_H
//
// This is the declaration of the SSGGSQSQVertex class.
//
#include "ThePEG/Helicity/Vertex/Scalar/VVSSVertex.h"
#include "SusyBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* This is the implementation of the 4 point gluon-gluon-squark-squark
* vertex. It inherits from VVSSVertex and implements the setCouopling
* method.
*
* @see VVSSVertex
*/
class SSGGSQSQVertex: public VVSSVertex {
public:
/**
* The default constructor.
*/
SSGGSQSQVertex();
-public:
-
- /**
- * 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();
-
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
* @param part4 The ParticleData pointer for the fourth particle.
*/
virtual void setCoupling(Energy2 q2,tcPDPtr part1,
tcPDPtr part2,tcPDPtr part3,tcPDPtr part4);
+public:
+
+ /**
+ * 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 Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static NoPIOClassDescription<SSGGSQSQVertex> initSSGGSQSQVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSGGSQSQVertex & operator=(const SSGGSQSQVertex &);
private:
/**
- * A pointer to the SusyBase object
- */
- tSusyBasePtr _theSS;
-
- /**
* The energy at which the coupling was last evaluated
*/
- Energy2 _q2last;
+ Energy2 q2last_;
/**
* The coupling when it was last evaluated
*/
- Complex _couplast;
+ Complex couplast_;
+
};
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSGGSQSQVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSGGSQSQVertex,1> {
- /** Typedef of the first base class of SSGGSQSQVertex. */
- typedef ThePEG::Helicity::VVSSVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSGGSQSQVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSGGSQSQVertex>
- : public ClassTraitsBase<Herwig::SSGGSQSQVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSGGSQSQVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSGGSQSQVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSGGSQSQVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSGGSQSQVertex_H */
diff --git a/Models/Susy/SSGSSVertex.cc b/Models/Susy/SSGSSVertex.cc
--- a/Models/Susy/SSGSSVertex.cc
+++ b/Models/Susy/SSGSSVertex.cc
@@ -1,74 +1,66 @@
// -*- C++ -*-
//
// SSGSSVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSGSSVertex class.
//
#include "SSGSSVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/EnumParticles.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
SSGSSVertex::SSGSSVertex() : _couplast(0.),_q2last(ZERO) {
orderInGs(1);
orderInGem(0);
}
void SSGSSVertex::doinit() {
for(long ix=1000001;ix<1000007;++ix) {
addToList(21,ix,-ix);
}
for(long ix=2000001;ix<2000007;++ix) {
addToList(21,ix,-ix);
}
VSSVertex::doinit();
}
-NoPIOClassDescription<SSGSSVertex> SSGSSVertex::initSSGSSVertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<SSGSSVertex,Helicity::VSSVertex>
+describeSSGSSVertex("Herwig::SSGSSVertex", "HwSusy.so");
void SSGSSVertex::Init() {
static ClassDocumentation<SSGSSVertex> documentation
- ("There is no documentation for the SSGSSVertex class");
+ ("The SSGSSVertex class implements the coupling"
+ " of the gluon to the squarks");
}
void SSGSSVertex::setCoupling(Energy2 q2, tcPDPtr part1,
tcPDPtr part2, tcPDPtr) {
- long isf(0);
- if(part1->id() == ParticleID::g) {
- isf = abs(part2->id());
+ assert(part1->id()==ParticleID::g);
+ long isf = abs(part2->id());
+ assert( (isf >= 1000001 && isf <= 1000006) ||
+ (isf >= 2000001 && isf <= 2000006) );
+ if(q2 != _q2last || _couplast == 0.) {
+ _couplast = strongCoupling(q2);
+ _q2last = q2;
}
- else if(part2->id() == ParticleID::g) {
- isf = abs(part1->id());
- }
- else {
- isf = abs(part1->id());
- }
- if((isf >= 1000001 && isf <= 1000006) ||
- (isf>=2000001 && isf <= 2000006) ) {
- if(q2 != _q2last || _couplast == 0.) {
- _couplast = strongCoupling(q2);
- _q2last = q2;
- }
- norm(_couplast);
+ norm(_couplast);
}
- else {
- throw HelicityConsistencyError()
- << "SSGSSVertex::setCoupling() - Incorrect particle(s) in vertex. "
- << part1->id() << " " << part2->id()
- << Exception::warning;
- }
-}
diff --git a/Models/Susy/SSGSSVertex.h b/Models/Susy/SSGSSVertex.h
--- a/Models/Susy/SSGSSVertex.h
+++ b/Models/Susy/SSGSSVertex.h
@@ -1,147 +1,106 @@
// -*- C++ -*-
//
// SSGSSVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSGSSVertex_H
#define HERWIG_SSGSSVertex_H
//
// This is the declaration of the SSGSSVertex class.
//
#include "ThePEG/Helicity/Vertex/Scalar/VSSVertex.h"
#include "SusyBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* The SSGSSVertex implements the coupling of a gluon to 2 sfermions.
* It inherits from VSSVertex and implements the setCoupling method.
*
* @see VSSVertex
*/
class SSGSSVertex: public VSSVertex {
public:
/**
* The default constructor.
*/
SSGSSVertex();
/**
* 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();
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
*/
virtual void setCoupling(Energy2 q2,tcPDPtr part1,
tcPDPtr part2,tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static NoPIOClassDescription<SSGSSVertex> initSSGSSVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSGSSVertex & operator=(const SSGSSVertex &);
private:
/**
* Store the value of the coupling when last evaluated
*/
Complex _couplast;
/**
* Store the scale at which coupling was last evaluated
*/
Energy2 _q2last;
};
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSGSSVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSGSSVertex,1> {
- /** Typedef of the first base class of SSGSSVertex. */
- typedef ThePEG::Helicity::VSSVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSGSSVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSGSSVertex>
- : public ClassTraitsBase<Herwig::SSGSSVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSGSSVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSGSSVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSGSSVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSGSSVertex_H */
diff --git a/Models/Susy/SSNNPVertex.cc b/Models/Susy/SSNNPVertex.cc
--- a/Models/Susy/SSNNPVertex.cc
+++ b/Models/Susy/SSNNPVertex.cc
@@ -1,351 +1,357 @@
// -*- C++ -*-
//
// SSNNPVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSNNPVertex class.
//
#include "SSNNPVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Models/Susy/MixingMatrix.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "Herwig++/Utilities/Maths.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
SSNNPVertex::SSNNPVertex() : _sw(0.), _cw(0.), _id1last(0),
_id2last(0), _q2last(ZERO), _couplast(0.),
_leftlast(ZERO), _rightlast(ZERO) {
orderInGem(3);
orderInGs(0);
}
void SSNNPVertex::doinit() {
int ineu[5] = {1000022,1000023,1000025,1000035,1000045};
for(unsigned int i = 0; i < 5; ++i) {
for(unsigned int j = 0; j < 5; ++j) {
addToList(ineu[i], ineu[j], 22);
}
}
GeneralFFVVertex::doinit();
tMSSMPtr theSS = dynamic_ptr_cast<tMSSMPtr>(generator()->standardModel());
if(!theSS)
throw InitException() << "SSNNPVertex::doinit() - "
<< "The model pointer is null."
<< Exception::abortnow;
_theN = theSS->neutralinoMix();
_theU = theSS->charginoUMix();
_theV = theSS->charginoVMix();
if(!_theN || !_theU || ! _theV)
throw InitException() << "SSNNPVertex::doinit - The neutralino "
<< "mixing matrix pointer is null."
<< Exception::abortnow;
_sw = sqrt(sin2ThetaW());
_cw = sqrt(1 - _sw*_sw);
_mw = getParticleData(ParticleID::Wplus)->mass();
double tb = theSS->tanBeta();
_sb = tb/sqrt(1 + sqr(tb));
_cb = sqrt(1 - sqr(_sb));
_stop = theSS->stopMix();
_sbot = theSS->sbottomMix();
_stau = theSS->stauMix();
}
void SSNNPVertex::persistentOutput(PersistentOStream & os) const {
os << _sw << _cw << _theN << ounit(_mw,GeV) << _sb << _cb
<< _stop << _sbot << _stau << _theU << _theV;
}
void SSNNPVertex::persistentInput(PersistentIStream & is, int) {
is >> _sw >> _cw >> _theN >> iunit(_mw,GeV) >> _sb >> _cb
>> _stop >> _sbot >> _stau >> _theU >> _theV;
}
-ClassDescription<SSNNPVertex> SSNNPVertex::initSSNNPVertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SSNNPVertex,Helicity::GeneralFFVVertex>
+describeSSNNPVertex("Herwig::SSNNPVertex", "HwSusy.so");
void SSNNPVertex::Init() {
static ClassDocumentation<SSNNPVertex> documentation
("The coupling of a Z-boson to a pair of neutralinos");
}
void SSNNPVertex::setCoupling(Energy2 q2, tcPDPtr part1,
#ifndef NDEBUG
tcPDPtr part2,tcPDPtr part3) {
#else
tcPDPtr part2,tcPDPtr) {
#endif
int o[2]={1,0};
long in1 = part1->id();
long in2 = part2->id();
Energy Mj = part1->mass();
Energy Mi = part2->mass();
// checks of the particle ids
assert(part3->id()==ParticleID::gamma);
assert(in1 == ParticleID::SUSY_chi_10 || in1 == ParticleID::SUSY_chi_20 ||
in1 == ParticleID::SUSY_chi_30 || in1 == ParticleID::SUSY_chi_40 ||
in1 == 1000045 );
assert(in2 == ParticleID::SUSY_chi_10 || in2 == ParticleID::SUSY_chi_20 ||
in2 == ParticleID::SUSY_chi_30 || in2 == ParticleID::SUSY_chi_40 ||
in2 == 1000045 );
// normal couplings are zero
setLeft (0.);
setRight(0.);
if(in1==in2) {
_leftlast = ZERO;
_rightlast = ZERO;
setLeftSigma (_leftlast );
setRightSigma(_rightlast);
return;
}
if(q2 != _q2last || _couplast==0.) {
_q2last = q2;
_couplast = sqr(weakCoupling(q2))*
electroMagneticCoupling(q2)/32./sqr(Constants::pi);
}
if(in1 != _id1last || in2 != _id2last) {
_leftlast = ZERO;
_rightlast = ZERO;
_id1last = in1;
_id2last = in2;
unsigned int neu1(in1 - 1000022), neu2(in2 - 1000022);
if(neu1 > 1) neu1 = (in1-1000005)/10;
if(neu2 > 1) neu2 = (in2-1000005)/10;
Complex n1prime[2] = { (*_theN)(neu2,0)*_cw + (*_theN)(neu2,1)*_sw ,
(*_theN)(neu1,0)*_cw + (*_theN)(neu1,1)*_sw };
Complex n2prime[2] = { (*_theN)(neu2,1)*_cw - (*_theN)(neu2,0)*_sw ,
(*_theN)(neu1,1)*_cw - (*_theN)(neu1,0)*_sw };
// sfermion/fermion loops
for(long iferm=1;iferm<16;++iferm) {
if(iferm==7) iferm=11;
if(iferm%2==0&&iferm>11) ++iferm;
tcPDPtr smf = getParticleData(iferm);
Energy mf = smf->mass();
double qf = smf->charge()/eplus;
double y = 0.5*mf/_mw;
Complex bracketl[2] = { qf*_sw*( conj(n1prime[0]) - _sw*conj(n2prime[0])/_cw ) ,
qf*_sw*( conj(n1prime[1]) - _sw*conj(n2prime[1])/_cw ) };
double lambda(0.);
//neutralino mixing element
Complex nlf[2]={0.,0.};
if( iferm % 2 == 0 ) {
y /= _sb;
lambda = -0.5 + qf*sqr(_sw);
nlf[0] = (*_theN)(neu2,3);
nlf[1] = (*_theN)(neu1,3);
}
else {
y /= _cb;
lambda = 0.5 + qf*sqr(_sw);
nlf[0] = (*_theN)(neu2,2);
nlf[1] = (*_theN)(neu1,2);
}
Complex bracketr[2] = { _sw*qf*n1prime[0] - n2prime[0]*lambda/_cw ,
_sw*qf*n1prime[1] - n2prime[1]*lambda/_cw };
for(long iy=0;iy<2;++iy) {
long isf = 1000000*(1+iy)+iferm;
Energy msf = getParticleData(isf)->mass();
if(mf+msf<Mj||mf+msf<Mi) continue;
Complex g[2][2];
Complex ma1(0.), ma2(0.);
// heavy fermions
if( iferm == 5 || iferm == 6 || iferm == 15 ) {
if( iferm == 5 ) {
ma1 = (*_sbot)(iy,0);
ma2 = (*_sbot)(iy,1);
}
else if( iferm == 6 ) {
ma1 = (*_stop)(iy,0);
ma2 = (*_stop)(iy,1);
}
else {
ma1 = (*_stau)(iy,0);
ma2 = (*_stau)(iy,1);
}
}
else if(iy==0) {
ma1 = 1.;
}
else {
ma2 = 1.;
}
for(unsigned int ix=0;ix<2;++ix) {
g[ix][0] = y*conj(nlf[ix])*ma1 - ma2*bracketl[ix];
g[ix][1] = y*nlf[ix]*ma2 + ma1*bracketr[ix];
}
swap(g[0][0],g[0][1]);
complex<InvEnergy2> I,J,K,I2;
loopIntegrals(Mi,Mj,msf,mf,I,J,K,I2);
complex<InvEnergy> coup[2];
for(unsigned int ix=0;ix<2;++ix) {
coup[ix] = Mj*(I2-K)*(g[0][ix]*g[1][o[ix]]-conj(g[0][o[ix]]*g[1][ix]))
+Mi*K*(g[0][o[ix]]*g[1][ix]-conj(g[0][ix]*g[1][o[ix]]))
+mf*I*(g[0][ix]*g[1][ix]-conj(g[0][o[ix]]*g[1][o[ix]]));
}
double fact = 4.*qf;
if(iferm<=6) fact *=3.;
_leftlast += fact*coup[0];
_rightlast += fact*coup[1];
}
}
// the chargino W contribution
for(unsigned int ic=0;ic<2;++ic) {
long id = ic==0 ?
ParticleID::SUSY_chi_1plus : ParticleID::SUSY_chi_2plus;
Energy Mk = getParticleData(id)->mass();
if(Mk+_mw<Mj||Mk+_mw<Mi) continue;
complex<InvEnergy2> I,J,K,I2;
loopIntegrals(Mi,Mj,_mw,Mk,I,J,K,I2);
Complex g[2][2];
for(unsigned int ix=0;ix<2;++ix) {
unsigned int in = ix==0 ? neu2 : neu1;
g[ix][0] =
conj((*_theN)(in, 1))*(*_theV)(ic, 0) -
conj((*_theN)(in, 3))*(*_theV)(ic, 1)/sqrt(2);
g[ix][1] =
(*_theN)(in, 1)*conj((*_theU)(ic, 0)) +
(*_theN)(in, 2)*conj((*_theU)(ic, 1))/sqrt(2);
}
complex<InvEnergy> coup[2];
for(unsigned int ix=0;ix<2;++ix) {
coup[ix] =
Mj*(I2-J-K)*(g[0][o[ix]]*g[1][o[ix]]-conj(g[0][ix]*g[1][ix]))-
Mi*(J-K)*(g[0][ix]*g[1][ix]-conj(g[0][o[ix]]*g[1][o[ix]]))+
2.*Mk*J*(g[0][o[ix]]*g[1][ix]-conj(g[0][ix]*g[1][o[ix]]));
}
_leftlast += 4.*coup[0];
_rightlast += 4.*coup[1];
}
// the chargino charged higgs contribution
Energy mh = getParticleData(ParticleID::Hplus)->mass();
for(unsigned int ic=0;ic<2;++ic) {
long id = ic==0 ?
ParticleID::SUSY_chi_1plus : ParticleID::SUSY_chi_2plus;
Energy Mk = getParticleData(id)->mass();
if(Mk+mh<Mj||Mk+mh<Mi) continue;
complex<InvEnergy2> I,J,K,I2;
loopIntegrals(Mi,Mj,mh,Mk,I,J,K,I2);
Complex g[2][2];
for(unsigned int ix=0;ix<2;++ix) {
unsigned int in = ix==0 ? neu2 : neu1;
g[ix][0] = (*_theN)(in, 3)*(*_theV)(ic,0)
+ ((*_theN)(in,1) + (*_theN)(in,0)*_sw/_cw)*
(*_theV)(ic,1)/sqrt(2);
g[ix][0] *= _cb;
g[ix][1] = conj((*_theN)(in, 2)*(*_theU)(ic,0)
- ((*_theN)(in,1) + (*_theN)(in,0)*_sw/_cw)*
(*_theU)(ic,1)/sqrt(2));
g[ix][1] *= _sb;
}
swap(g[1][0],g[1][1]);
complex<InvEnergy> coup[2];
for(unsigned int ix=0;ix<2;++ix) {
coup[ix] = Mj*(I2-K)*(g[0][ix]*g[1][o[ix]]-conj(g[0][o[ix]]*g[1][ix]))
+Mi*K*(g[0][o[ix]]*g[1][ix]-conj(g[0][ix]*g[1][o[ix]]))
+Mk*I*(g[0][ix]*g[1][ix]-conj(g[0][o[ix]]*g[1][o[ix]]));
}
_leftlast += 2.*coup[0];
_rightlast += 2.*coup[1];
}
// the chargino goldstone contribution
for(unsigned int ic=0;ic<2;++ic) {
long id = ic==0 ?
ParticleID::SUSY_chi_1plus : ParticleID::SUSY_chi_2plus;
Energy Mk = getParticleData(id)->mass();
if(Mk+_mw<Mj||Mk+_mw<Mi) continue;
complex<InvEnergy2> I,J,K,I2;
loopIntegrals(Mi,Mj,_mw,Mk,I,J,K,I2);
Complex g[2][2];
for(unsigned int ix=0;ix<2;++ix) {
unsigned int in = ix==0 ? neu2 : neu1;
g[ix][0] = (*_theN)(in, 3)*(*_theV)(ic,0)
+ ((*_theN)(in,1) + (*_theN)(in,0)*_sw/_cw)*
(*_theV)(ic,1)/sqrt(2);
g[ix][0] *= _sb;
g[ix][1] = conj((*_theN)(in, 2)*(*_theU)(ic,0)
- ((*_theN)(in,1) + (*_theN)(in,0)*_sw/_cw)*
(*_theU)(ic,1)/sqrt(2));
g[ix][1] *= _cb;
}
swap(g[1][0],g[1][1]);
complex<InvEnergy> coup[2];
for(unsigned int ix=0;ix<2;++ix) {
coup[ix] = Mj*(I2-K)*(g[0][ix]*g[1][o[ix]]-conj(g[0][o[ix]]*g[1][ix]))
+Mi*K*(g[0][o[ix]]*g[1][ix]-conj(g[0][ix]*g[1][o[ix]]))
+Mk*I*(g[0][ix]*g[1][ix]-conj(g[0][o[ix]]*g[1][o[ix]]));
}
_leftlast += 2.*coup[0];
_rightlast += 2.*coup[1];
}
}
norm(_couplast);
setLeftSigma ( _leftlast);
setRightSigma(_rightlast);
}
void SSNNPVertex::loopIntegrals(Energy Mi, Energy Mj, Energy M, Energy m,
complex<InvEnergy2> & I, complex<InvEnergy2> & J,
complex<InvEnergy2> & K, complex<InvEnergy2> & I2) {
static const Complex ii(0.,1.);
static const Energy eps(100.*MeV);
Energy2 m2(sqr(m)),M2(sqr(M)),Mi2(sqr(Mi)),Mj2(sqr(Mj));
using Math::Li2;
// general form
if(m>eps) {
Energy4 li = sqr(m2+M2-Mi2)-4.*sqr(m*M);
complex<Energy2> rli = li<ZERO ? ii*sqrt(-li) : sqrt(li);
Energy4 lj = sqr(m2+M2-Mj2)-4.*sqr(m*M);
complex<Energy2> rlj = lj<ZERO ? ii*sqrt(-lj) : sqrt(lj);
Complex arg[6]={0.5/m2*(Mj2+m2-M2+rlj) ,0.5/m2*(Mj2+m2-M2-rlj),
0.5/m2*(Mi2+m2-M2+rli) ,0.5/m2*(Mi2+m2-M2-rli),
0.5/m/M*(m2+M2-Mj2+rlj),0.5/m/M*(m2+M2-Mi2+rli)};
I = 1./(Mi2-Mj2)*(Li2(arg[0])+Li2(arg[1])-
Li2(arg[2])-Li2(arg[3]));
J = 1./(Mj2-Mi2)*(sqr(log(arg[4]))-sqr(log(arg[5])))-I;
Complex Itest[2];
for(unsigned int ix=0;ix<2;++ix) {
Complex a,b;
if(ix==0) {
a = 0.5*(M2+Mj2-m2)/Mj2;
b = 0.5*rlj/Mj2;
}
else {
a = 0.5*(M2+Mi2-m2)/Mi2;
b = 0.5*rli/Mi2;
}
Itest[ix] = -b*log(b-a)+a*log(b-a)+log(-a-b)*a
+log(-a-b)*b+log(1.+b-a)+log(1.+b-a)*b-log(1.+b-a)*a+log(1.-a-b)
-log(1.-a-b)*a-log(1.-a-b)*b-2.;
}
I2 = (Itest[0]-Itest[1]+log(Mj2/Mi2))/(Mj2-Mi2);
// I2 = (M2-m2)/Mi2/Mj2*log(m/M)
// +1./(Mj2-Mi2)*(0.5*rlj/Mj2*log((m2+M2-Mj2-rlj)/
// (m2+M2-Mj2+rlj))-
// 0.5*rli/Mi2*log((m2+M2-Mi2-rli)/
// (m2+M2-Mi2+rli)));
K = 1./(Mi2-Mj2)*(1.+Complex(m2*I+M2*J-Mj2*I2));
}
// leading term for small m
else {
I = 1./(Mj2-Mi2)*(-Li2(double(Mj2/(Mj2-M2)))+Li2(double(Mi2/(Mi2-M2)))
-2.*log(m/M)*log((M2-Mj2)/(M2-Mi2))
+0.5*sqr(log((M2-Mj2)/M2))-0.5*sqr(log((M2-Mi2)/M2)));
J = 1./(Mj2-Mi2)*(Li2(double(Mj2/(Mj2-M2)))-Li2(double(Mi2/(Mi2-M2)))
-0.5*sqr(log((M2-Mi2)/M2))+0.5*sqr(log((M2-Mj2)/M2)));
I2 = 1./(Mj2-Mi2)*log((M2-Mj2)/(M2-Mi2))
+M2/(Mj2-Mi2)/sqr(Mi*Mj)*(Mj2*log((M2-Mi2)/M2)-Mi2*log((M2-Mj2)/M2));
K = 1./(Mi2-Mj2)*(1.+Complex(M2*J)-Complex(Mj2*I2));
}
}
diff --git a/Models/Susy/SSNNPVertex.h b/Models/Susy/SSNNPVertex.h
--- a/Models/Susy/SSNNPVertex.h
+++ b/Models/Susy/SSNNPVertex.h
@@ -1,253 +1,211 @@
// -*- C++ -*-
//
// SSNNPVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSNNPVertex_H
#define HERWIG_SSNNPVertex_H
//
// This is the declaration of the SSNNPVertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/GeneralFFVVertex.h"
#include "Herwig++/Models/Susy/MSSM.h"
#include "Herwig++/Models/Susy/MixingMatrix.fh"
namespace Herwig {
using namespace ThePEG;
/**
* This class implements the coupling of a photon to a pair of neutralinos
* via loop diagrams
* It inherits from GeneralFFVertex and implements the setCoupling method.
*
* @see \ref SSNNPVertexInterfaces "The interfaces"
* defined for SSNNPVertex.
* @see FFVertex
*/
class SSNNPVertex: public GeneralFFVVertex {
public:
/**
* The default constructor.
*/
SSNNPVertex();
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();
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
*/
virtual void setCoupling(Energy2 q2, tcPDPtr part1,
tcPDPtr part2, tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/**
* Evaluate the loop integrals
*/
void loopIntegrals(Energy Mi, Energy Mj, Energy M, Energy m,
complex<InvEnergy2> & I, complex<InvEnergy2> & J,
complex<InvEnergy2> & K, complex<InvEnergy2> & I2);
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<SSNNPVertex> initSSNNPVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSNNPVertex & operator=(const SSNNPVertex &);
private:
/**
* Pointer to the stop mixing matrix
*/
tMixingMatrixPtr _stop;
/**
* Pointer to the sbottom mixing matrix
*/
tMixingMatrixPtr _sbot;
/**
* Pointer to the stau mixing matrix
*/
tMixingMatrixPtr _stau;
/**
* The value of \f$sin(\theta_W)\f$
*/
double _sw;
/**
* The value of \f$cos(\theta_W)\f$
*/
double _cw;
/**
* Mass of the W
*/
Energy _mw;
/**
* \f$\sin(\beta)\f$
*/
double _sb;
/**
* \f$\cos(\beta)\f$
*/
double _cb;
/**
* Store the neutralino mixing matrix
*/
tMixingMatrixPtr _theN;
/**
* Store the U-type chargino mixing matrix
*/
tMixingMatrixPtr _theU;
/**
* Store the V-type chargino mixing matrix
*/
tMixingMatrixPtr _theV;
/**
* Store the id of the 1st neutralino when the coupling was last evaluated
*/
long _id1last;
/**
* Store the id of the 1st neutralino when the coupling was last evaluated
*/
long _id2last;
/**
* Store the value at which the coupling when it was last evalutated
*/
Energy2 _q2last;
/**
* Store the value of the coupling when it was last evalutated
*/
Complex _couplast;
/**
* Store the value of the left-coupling when it was last evalutated
*/
complex<InvEnergy> _leftlast;
/**
* Store the value of the right-coupling when it was last evalutated
*/
complex<InvEnergy> _rightlast;
};
}
-
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSNNPVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSNNPVertex,1> {
- /** Typedef of the first base class of SSNNPVertex. */
- typedef ThePEG::Helicity::GeneralFFVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSNNPVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSNNPVertex>
- : public ClassTraitsBase<Herwig::SSNNPVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSNNPVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSNNPVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSNNPVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSNNPVertex_H */
diff --git a/Models/Susy/SSNNZVertex.cc b/Models/Susy/SSNNZVertex.cc
--- a/Models/Susy/SSNNZVertex.cc
+++ b/Models/Susy/SSNNZVertex.cc
@@ -1,122 +1,128 @@
// -*- C++ -*-
//
// SSNNZVertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SSNNZVertex class.
//
#include "SSNNZVertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "MixingMatrix.h"
#include "ThePEG/PDT/EnumParticles.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
SSNNZVertex::SSNNZVertex() : _sw(0.), _cw(0.), _id1last(0),
_id2last(0), _q2last(), _couplast(0.),
_leftlast(0.), _rightlast(0.) {
orderInGem(1);
orderInGs(0);
}
void SSNNZVertex::doinit() {
long neu[] = { 1000022, 1000023, 1000025, 1000035, 1000045 };
for(unsigned int i = 0; i < 5; ++i)
for(unsigned int j = 0; j < 5; ++j)
addToList(neu[i], neu[j], 23);
FFVVertex::doinit();
tSusyBasePtr theSS = dynamic_ptr_cast<SusyBasePtr>(generator()->standardModel());
if(!theSS)
throw InitException() << "SSNNZVertex::doinit() - "
<< "The model pointer is null."
<< Exception::abortnow;
_theN = theSS->neutralinoMix();
if(!_theN)
throw InitException() << "SSNNZVertex::doinit - The neutralino "
<< "mixing matrix pointer is null."
<< Exception::abortnow;
_sw = sqrt(sin2ThetaW());
_cw = sqrt(1 - _sw*_sw);
}
void SSNNZVertex::persistentOutput(PersistentOStream & os) const {
os << _sw << _cw << _theN;
}
void SSNNZVertex::persistentInput(PersistentIStream & is, int) {
is >> _sw >> _cw >> _theN;
_id1last = 0;
_id2last = 0;
_q2last = ZERO;
_couplast = 0.;
_leftlast = 0.;
_rightlast = 0.;
}
-ClassDescription<SSNNZVertex> SSNNZVertex::initSSNNZVertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeClass<SSNNZVertex,Helicity::FFVVertex>
+describeSSNNZVertex("Herwig::SSNNZVertex", "HwSusy.so");
void SSNNZVertex::Init() {
static ClassDocumentation<SSNNZVertex> documentation
("The coupling of a Z-boson to a pair of neutralinos");
}
void SSNNZVertex::setCoupling(Energy2 q2,tcPDPtr part1,
#ifndef NDEBUG
tcPDPtr part2,tcPDPtr part3) {
#else
tcPDPtr part2,tcPDPtr) {
#endif
assert(part3->id() == ParticleID::Z0);
long ic1 = part2->id();
long ic2 = part1->id();
assert(ic1 == ParticleID::SUSY_chi_10 || ic1 == ParticleID::SUSY_chi_20 ||
ic1 == ParticleID::SUSY_chi_30 || ic1 == ParticleID::SUSY_chi_40 ||
ic1 == 1000045);
assert(ic2 == ParticleID::SUSY_chi_10 || ic2 == ParticleID::SUSY_chi_20 ||
ic2 == ParticleID::SUSY_chi_30 || ic2 == ParticleID::SUSY_chi_40 ||
ic2 == 1000045);
if(q2 != _q2last || _couplast==0.) {
_q2last = q2;
_couplast = weakCoupling(q2)/_cw;
}
if(ic1 != _id1last || ic2 != _id2last) {
_id1last = ic1;
_id2last = ic2;
unsigned int neu1(ic1 - 1000022), neu2(ic2 - 1000022);
if(neu1 > 1) {
if(ic1 == 1000025)
neu1 = 2;
else if(ic1 == 1000035)
neu1 = 3;
else
neu1 = 4;
}
if(neu2 > 1) {
if(ic2 == 1000025)
neu2 = 2;
else if(ic2 == 1000035)
neu2 = 3;
else
neu2 = 4;
}
_leftlast = 0.5*( (*_theN)(neu1, 3)*conj((*_theN)(neu2, 3)) -
(*_theN)(neu1, 2)*conj((*_theN)(neu2, 2)) );
_rightlast = -conj(_leftlast);
}
norm(_couplast);
left(_leftlast);
right(_rightlast);
}
diff --git a/Models/Susy/SSNNZVertex.h b/Models/Susy/SSNNZVertex.h
--- a/Models/Susy/SSNNZVertex.h
+++ b/Models/Susy/SSNNZVertex.h
@@ -1,203 +1,161 @@
// -*- C++ -*-
//
// SSNNZVertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SSNNZVertex_H
#define HERWIG_SSNNZVertex_H
//
// This is the declaration of the SSNNZVertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h"
#include "SusyBase.h"
#include "MixingMatrix.fh"
namespace Herwig {
using namespace ThePEG;
/**
* This class implements the coupling of a Z-boson to a pair of neutralinos.
* It inherits from FFVertex and implements the setCoupling method.
*
* @see \ref SSNNZVertexInterfaces "The interfaces"
* defined for SSNNZVertex.
* @see FFVertex
*/
class SSNNZVertex: public FFVVertex {
public:
/**
* The default constructor.
*/
SSNNZVertex();
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();
/**
* Calculate the couplings.
* @param q2 The scale \f$q^2\f$ for the coupling at the vertex.
* @param part1 The ParticleData pointer for the first particle.
* @param part2 The ParticleData pointer for the second particle.
* @param part3 The ParticleData pointer for the third particle.
*/
virtual void setCoupling(Energy2 q2, tcPDPtr part1,
tcPDPtr part2, tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static ClassDescription<SSNNZVertex> initSSNNZVertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SSNNZVertex & operator=(const SSNNZVertex &);
private:
/**
* The value of \f$sin(\theta_W)\f$
*/
double _sw;
/**
* The value of \f$cos(\theta_W)\f$
*/
double _cw;
/**
* Store the neutralino mixing matrix
*/
tMixingMatrixPtr _theN;
/**
* Store the id of the 1st neutralino when the coupling was last evaluated
*/
long _id1last;
/**
* Store the id of the 1st neutralino when the coupling was last evaluated
*/
long _id2last;
/**
* Store the value at which the coupling when it was last evalutated
*/
Energy2 _q2last;
/**
* Store the value of the coupling when it was last evalutated
*/
Complex _couplast;
/**
* Store the value of the left-coupling when it was last evalutated
*/
Complex _leftlast;
/**
* Store the value of the right-coupling when it was last evalutated
*/
Complex _rightlast;
};
}
-
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of SSNNZVertex. */
-template <>
-struct BaseClassTrait<Herwig::SSNNZVertex,1> {
- /** Typedef of the first base class of SSNNZVertex. */
- typedef ThePEG::Helicity::FFVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the SSNNZVertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::SSNNZVertex>
- : public ClassTraitsBase<Herwig::SSNNZVertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::SSNNZVertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * SSNNZVertex is implemented. It may also include several, space-separated,
- * libraries if the class SSNNZVertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwSusy.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_SSNNZVertex_H */
diff --git a/Models/Susy/SusyBase.cc b/Models/Susy/SusyBase.cc
--- a/Models/Susy/SusyBase.cc
+++ b/Models/Susy/SusyBase.cc
@@ -1,662 +1,663 @@
// -*- C++ -*-
//
// SusyBase.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SusyBase class.
//
#include "SusyBase.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Repository/Repository.h"
#include "ThePEG/Utilities/StringUtils.h"
#include "ThePEG/Repository/CurrentGenerator.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/PDT/MassGenerator.h"
#include "ThePEG/PDT/WidthGenerator.h"
#include "ThePEG/PDT/DecayMode.h"
using namespace Herwig;
SusyBase::SusyBase() : readFile_(false), MPlanck_(2.4e18*GeV),
gravitino_(false),
tanBeta_(0), mu_(ZERO),
M1_(ZERO), M2_(ZERO), M3_(ZERO),
mH12_(ZERO),mH22_(ZERO),
meL_(ZERO),mmuL_(ZERO),mtauL_(ZERO),
meR_(ZERO),mmuR_(ZERO),mtauR_(ZERO),
mq1L_(ZERO),mq2L_(ZERO),mq3L_(ZERO),
mdR_(ZERO),muR_(ZERO),msR_(ZERO),
mcR_(ZERO),mbR_(ZERO),mtR_(ZERO),
gluinoPhase_(1.)
{}
IBPtr SusyBase::clone() const {
return new_ptr(*this);
}
IBPtr SusyBase::fullclone() const {
return new_ptr(*this);
}
void SusyBase::doinit() {
addVertex(WSFSFVertex_);
addVertex(NFSFVertex_);
addVertex(GFSFVertex_);
addVertex(HSFSFVertex_);
addVertex(CFSFVertex_);
addVertex(GSFSFVertex_);
addVertex(GGSQSQVertex_);
addVertex(GSGSGVertex_);
addVertex(NNZVertex_);
if(NNPVertex_) addVertex(NNPVertex_);
if(GNGVertex_) addVertex(GNGVertex_);
addVertex(CCZVertex_);
addVertex(CNWVertex_);
addVertex(GOGOHVertex_);
addVertex(WHHVertex_);
addVertex(NCTVertex_);
if(gravitino_) {
if(GVNHVertex_) addVertex(GVNHVertex_);
if(GVNVVertex_) addVertex(GVNVVertex_);
if(GVFSVertex_) addVertex(GVFSVertex_);
}
BSMModel::doinit();
}
void SusyBase::persistentOutput(PersistentOStream & os) const {
os << readFile_ << gravitino_
<< NMix_ << UMix_ << VMix_ << WSFSFVertex_
<< NFSFVertex_ << GFSFVertex_ << HSFSFVertex_ << CFSFVertex_
<< GSFSFVertex_ << GGSQSQVertex_ << GSGSGVertex_
<< NNZVertex_ << NNPVertex_ << CCZVertex_ << CNWVertex_
<< GOGOHVertex_ << WHHVertex_ << GNGVertex_ << NCTVertex_
<< GVNHVertex_ << GVNVVertex_ << GVFSVertex_
<< tanBeta_ << ounit(mu_,GeV)
<< ounit(M1_,GeV) << ounit(M2_,GeV) << ounit(M3_,GeV)
<< ounit(mH12_,GeV2) << ounit(mH22_,GeV2)
<< ounit(meL_,GeV) << ounit(mmuL_,GeV) << ounit(mtauL_,GeV)
<< ounit(meR_,GeV) << ounit(mmuR_,GeV) << ounit(mtauR_,GeV)
<< ounit(mq1L_,GeV) << ounit(mq2L_,GeV) << ounit(mq3L_,GeV)
<< ounit(mdR_,GeV) << ounit(muR_,GeV) << ounit(msR_,GeV)
<< ounit(mcR_,GeV) << ounit(mbR_,GeV) << ounit(mtR_,GeV)
<< gluinoPhase_ << ounit(MPlanck_,GeV);
}
void SusyBase::persistentInput(PersistentIStream & is, int) {
is >> readFile_ >> gravitino_
>> NMix_ >> UMix_ >> VMix_ >> WSFSFVertex_
>> NFSFVertex_ >> GFSFVertex_ >> HSFSFVertex_ >> CFSFVertex_
>> GSFSFVertex_ >> GGSQSQVertex_ >> GSGSGVertex_
>> NNZVertex_ >> NNPVertex_ >> CCZVertex_ >> CNWVertex_
>> GOGOHVertex_ >> WHHVertex_ >> GNGVertex_ >> NCTVertex_
>> GVNHVertex_ >> GVNVVertex_ >> GVFSVertex_
>> tanBeta_ >> iunit(mu_,GeV)
>> iunit(M1_,GeV) >> iunit(M2_,GeV) >> iunit(M3_,GeV)
>> iunit(mH12_,GeV2) >> iunit(mH22_,GeV2)
>> iunit(meL_,GeV) >> iunit(mmuL_,GeV) >> iunit(mtauL_,GeV)
>> iunit(meR_,GeV) >> iunit(mmuR_,GeV) >> iunit(mtauR_,GeV)
>> iunit(mq1L_,GeV) >> iunit(mq2L_,GeV) >> iunit(mq3L_,GeV)
>> iunit(mdR_,GeV) >> iunit(muR_,GeV) >> iunit(msR_,GeV)
>> iunit(mcR_,GeV) >> iunit(mbR_,GeV) >> iunit(mtR_,GeV)
>> gluinoPhase_ >> iunit(MPlanck_,GeV);
}
ClassDescription<SusyBase> SusyBase::initSusyBase;
// Definition of the static class description member.
void SusyBase::Init() {
static ClassDocumentation<SusyBase> documentation
("This is the base class for any SUSY model.",
"SUSY spectrum files follow the Les Houches accord"
" \\cite{Skands:2003cj,Allanach:2008qq}.",
" %\\cite{Skands:2003cj}\n"
"\\bibitem{Skands:2003cj}\n"
" P.~Skands {\\it et al.},\n"
" ``SUSY Les Houches accord: Interfacing SUSY spectrum calculators, decay\n"
" %packages, and event generators,''\n"
" JHEP {\\bf 0407}, 036 (2004)\n"
" [arXiv:hep-ph/0311123].\n"
" %%CITATION = JHEPA,0407,036;%%\n"
"%\\cite{Allanach:2008qq}\n"
"\\bibitem{Allanach:2008qq}\n"
" B.~Allanach {\\it et al.},\n"
" %``SUSY Les Houches Accord 2,''\n"
" Comput.\\ Phys.\\ Commun.\\ {\\bf 180}, 8 (2009)\n"
" [arXiv:0801.0045 [hep-ph]].\n"
" %%CITATION = CPHCB,180,8;%%\n"
);
static Reference<SusyBase,Helicity::AbstractVSSVertex> interfaceVertexWSS
("Vertex/WSFSF",
"Reference to Susy W SF SF vertex",
&SusyBase::WSFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFSVertex> interfaceVertexNFSF
("Vertex/NFSF",
"Reference to the neutralino-fermion-sfermion vertex",
&SusyBase::NFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFSVertex> interfaceVertexGFSF
("Vertex/GFSF",
"Reference to the gluino-fermion-sfermion vertex",
&SusyBase::GFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractSSSVertex> interfaceVertexHSFSF
("Vertex/HSFSF",
"Reference to the Higgs-fermion-sfermion vertex",
&SusyBase::HSFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFSVertex> interfaceVertexCFSF
("Vertex/CFSF",
"Reference to the chargino-fermion-sfermion vertex",
&SusyBase::CFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractVSSVertex> interfaceVertexGSFSF
("Vertex/GSFSF",
"Reference to the gluon-sfermion-sfermion vertex",
&SusyBase::GSFSFVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractVVSSVertex> interfaceVertexGGSS
("Vertex/GGSQSQ",
"Reference to the gluon-gluon-squark-squark vertex",
&SusyBase::GGSQSQVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexGSGSG
("Vertex/GSGSG",
"Reference to the gluon-gluino-gluino vertex",
&SusyBase::GSGSGVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexNNZ
("Vertex/NNZ",
"Reference to Z-~chi_i0-~chi_i0 vertex",
&SusyBase::NNZVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexNNP
("Vertex/NNP",
"Reference to photon-~chi_i0-~chi_i0 vertex",
&SusyBase::NNPVertex_, false, false, true, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexGNG
("Vertex/GNG",
"Reference to gluon-~chi_i0-gluino vertex",
&SusyBase::GNGVertex_, false, false, true, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexCCZ
("Vertex/CCZ",
"Reference to ~chi_i+-~chi_i-Z vertex",
&SusyBase::CCZVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFVVertex> interfaceVertexCNW
("Vertex/CNW",
"Reference to ~chi_i+-chi_i0-W vertex",
&SusyBase::CNWVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractFFSVertex> interfaceVertexGOGOH
("Vertex/GOGOH",
"Reference to the gaugino-gaugino-higgs vertex",
&SusyBase::GOGOHVertex_, false, false, true, false);
static Reference<SusyBase,Helicity::AbstractVSSVertex> interfaceVertexWHH
("Vertex/SSWHH",
"Reference to Susy WHHVertex",
&SusyBase::WHHVertex_, false, false, true, false);
static Reference<SusyBase,AbstractFFSVertex> interfaceVertexNCT
("Vertex/NCT",
"Vertex for the flavour violating coupling of the top squark "
"to the neutralino and charm quark.",
&SusyBase::NCTVertex_, false, false, true, false, false);
static Reference<SusyBase,AbstractRFSVertex> interfaceVertexGVNH
("Vertex/GVNH",
"Vertex for the interfaction of the gravitino-neutralino"
" and Higgs bosons",
&SusyBase::GVNHVertex_, false, false, true, true, false);
static Reference<SusyBase,AbstractRFVVertex> interfaceVertexGVNV
("Vertex/GVNV",
"Vertex for the interfaction of the gravitino-neutralino"
" and vector bosons",
&SusyBase::GVNVVertex_, false, false, true, true, false);
static Reference<SusyBase,AbstractRFSVertex> interfaceVertexGVFS
("Vertex/GVFS",
"Vertex for the interfaction of the gravitino-fermion"
" and sfermion",
&SusyBase::GVFSVertex_, false, false, true, true, false);
static Parameter<SusyBase,Energy> interfaceMPlanck
("MPlanck",
"The Planck mass for GMSB models",
&SusyBase::MPlanck_, GeV, 2.4e18*GeV, 1.e16*GeV, 1.e20*GeV,
false, false, Interface::limited);
}
void SusyBase::readSetup(istream & is) {
string filename = dynamic_ptr_cast<istringstream*>(&is)->str();
+ filename = StringUtils::stripws(filename);
if(readFile_)
throw SetupException()
<< "A second SLHA file " << filename << " has been opened."
<< "This is probably unintended and as it can cause crashes"
<< " and other unpredictable behaviour it is not allowed."
<< Exception::runerror;
CFileLineReader cfile;
cfile.open(filename);
if( !cfile ) throw SetupException()
<< "SusyBase::readSetup - An error occurred in opening the "
<< "spectrum file \"" << filename << "\". A SUSY model cannot be "
<< "run without this."
<< Exception::runerror;
useMe();
// read first line and check if this is a Les Houches event file
cfile.readline();
bool lesHouches = cfile.find("<LesHouchesEvents");
bool reading = !lesHouches;
if(lesHouches) cfile.readline();
//function pointer for putting all characters to lower case.
int (*pf)(int) = tolower;
do {
string line = cfile.getline();
// check for start of slha block in SLHA files
if(lesHouches && !reading) {
if(line.find("<slha")==0) reading = true;
if(!cfile.readline()) break;
continue;
}
// ignore comment lines
if(line[0] == '#') {
if(!cfile.readline()) break;
continue;
}
// make everything lower case
transform(line.begin(), line.end(), line.begin(), pf);
// start of a block
if(line.find("block") == 0) {
string name = StringUtils::car(StringUtils::cdr(line), " #");
name = StringUtils::stripws(name);
// mixing matrix
if((name.find("mix") != string::npos &&
name.find("hmix") != 0)) {
unsigned int row(0),col(0);
MixingVector vals = readMatrix(cfile,row,col);
mixings_[name] = make_pair(make_pair(row,col),vals);
}
else if(name.find("au") == 0 || name.find("ad") == 0 ||
name.find("ae") == 0 ) {
string test = StringUtils::car(line, "#");
while (test.find("=")!= string::npos) {
test = StringUtils::cdr(test, "=");
}
istringstream is(test);
double scale;
is >> scale;
unsigned int row(0),col(0);
MixingVector vals = readMatrix(cfile,row,col);
if(scale>1e10) continue;
mixings_[name] = make_pair(make_pair(row,col),vals);
}
else if( name.find("info") == string::npos) {
readBlock(cfile,name,line);
}
else {
if(!cfile.readline()) break;
}
continue;
}
else if( lesHouches && line.find("</slha") == 0 ) {
reading = false;
break;
}
if(!cfile.readline()) break;
}
while(true);
// extract the relevant parameters
extractParameters();
// create the mixing matrices we need
createMixingMatrices();
// set the masses, this has to be done after the
// mixing matrices have been created
resetRepositoryMasses();
// have now read the file
if(decayFile()=="") decayFile(filename);
readFile_=true;
}
void SusyBase::readBlock(CFileLineReader & cfile,string name,string linein) {
if(!cfile)
throw SetupException()
<< "SusyBase::readBlock() - The input stream is in a bad state"
<< Exception::runerror;
// storage or the parameters
string test = StringUtils::car(linein, "#");
ParamMap store;
bool set = true;
// special for the alpha block
if(name.find("alpha") == 0 ) {
double alpha;
cfile.readline();
string line = cfile.getline();
istringstream iss(line);
iss >> alpha;
store.insert(make_pair(1,alpha));
}
else {
// extract the scale from the block if present
if(test.find("=")!= string::npos) {
while(test.find("=")!=string::npos)
test= StringUtils::cdr(test,"=");
istringstream is(test);
double scale;
is >> scale;
// only store the lowest scale block
if(parameters_.find(name)!=parameters_.end()) {
set = scale < parameters_[name][-1];
}
else {
store.insert(make_pair(-1,scale));
}
}
while(cfile.readline()) {
string line = cfile.getline();
// skip comments
if(line[0] == '#') continue;
// reached the end
if( line[0] == 'B' || line[0] == 'b' ||
line[0] == 'D' || line[0] == 'd' ||
line[0] == '<' ) {
cfile.resetline();
break;
}
istringstream is(line);
long index;
double value;
if(name.find("rvlam")!= string::npos||
name=="rvt" || name=="rvtp" || name=="rvtpp") {
int i,j,k;
is >> i >> j >> k >> value;
index = i*100+j*10+k;
}
else {
is >> index >> value;
}
store.insert(make_pair(index, value));
}
}
if(set) parameters_[name]=store;
}
const MixingVector
SusyBase::readMatrix(CFileLineReader & cfile,
unsigned int & row, unsigned int & col) {
if(!cfile)
throw SetupException()
<< "SusyBase::readMatrix() - The input stream is in a bad state."
<< Exception::runerror;
unsigned int rowmax(0), colmax(0);
MixingVector values;
while(cfile.readline()) {
string line = cfile.getline();
// skip comments
if(line[0] == '#') continue;
// reached the end
if( line[0] == 'B' || line[0] == 'b' ||
line[0] == 'D' || line[0] == 'd' ||
line[0] == '<' ) {
cfile.resetline();
break;
}
istringstream is(line);
unsigned int index1, index2;
double real(0.), imag(0.);
is >> index1 >> index2 >> real >> imag;
values.push_back(MixingElement(index1,index2,Complex(real, imag)));
if(index1 > rowmax) rowmax = index1;
if(index2 > colmax) colmax = index2;
}
col=colmax;
row=rowmax;
return values;
}
void SusyBase::createMixingMatrix(MixingMatrixPtr & matrix,
string name, const MixingVector & values,
MatrixSize size) {
matrix = new_ptr(MixingMatrix(size.first,size.second));
for(unsigned int ix=0; ix < values.size(); ++ix)
(*matrix)(values[ix].row-1,values[ix].col-1) = values[ix].value;
if(name == "nmix") {
vector<long> ids(4);
ids[0] = 1000022; ids[1] = 1000023;
ids[2] = 1000025; ids[3] = 1000035;
matrix->setIds(ids);
}
else if(name == "nmnmix") {
vector<long> ids(5);
ids[0] = 1000022; ids[1] = 1000023;
ids[2] = 1000025; ids[3] = 1000035;
ids[4] = 1000045;
matrix->setIds(ids);
}
else if(name == "umix") {
vector<long> ids(2);
ids[0] = 1000024; ids[1] = 1000037;
matrix->setIds(ids);
}
else if(name == "vmix") {
vector<long> ids(2);
ids[0] = 1000024; ids[1] = 1000037;
matrix->setIds(ids);
}
else if(name == "stopmix") {
vector<long> ids(2);
ids[0] = 1000006; ids[1] = 2000006;
matrix->setIds(ids);
}
else if(name == "sbotmix") {
vector<long> ids(2);
ids[0] = 1000005; ids[1] = 2000005;
matrix->setIds(ids);
}
else if(name == "staumix") {
vector<long> ids(2);
ids[0] = 1000015; ids[1] = 2000015;
matrix->setIds(ids);
}
else if(name == "nmhmix") {
vector<long> ids(3);
ids[0] = 25; ids[1] = 35; ids[2] = 45;
matrix->setIds(ids);
}
else if(name == "nmamix") {
vector<long> ids(2);
ids[0] = 36; ids[1] = 46;
matrix->setIds(ids);
}
else
throw SetupException() << "Cannot find correct title for mixing matrix "
<< name << Exception::runerror;
}
void SusyBase::resetRepositoryMasses() {
map<string,ParamMap>::const_iterator fit=parameters_.find("mass");
if(fit==parameters_.end())
throw Exception() << "BLOCK MASS not found in input file"
<< " can't set masses of SUSY particles"
<< Exception::runerror;
ParamMap theMasses = fit->second;
for(ParamMap::iterator it = theMasses.begin(); it != theMasses.end();
++it) {
long id = it->first;
double mass = it->second;
//a negative mass requires an adjustment to the
//associated mixing matrix by a factor of i
if(mass < 0.0) adjustMixingMatrix(id);
PDPtr part = getParticleData(id);
if(!part) throw SetupException()
<< "SusyBase::resetRepositoryMasses() - Particle with PDG code " << id
<< " not found." << Exception::warning;
//Find interface nominal mass interface
const InterfaceBase * ifb = BaseRepository::FindInterface(part, "NominalMass");
ostringstream os;
os << abs(it->second);
ifb->exec(*part, "set", os.str());
// switch on gravitino interactions?
gravitino_ |= id== ParticleID::SUSY_Gravitino;
}
theMasses.clear();
}
void SusyBase::adjustMixingMatrix(long id) {
//get correct mixing matrix
switch(id) {
case 1000021 :
gluinoPhase_ = Complex(0.,1.);
break;
case 1000022 :
case 1000023 :
case 1000025 :
case 1000035 :
case 1000045 :
if(NMix_)
NMix_->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The neutralino mixing matrix pointer "
<< "is null!" << Exception::runerror;
break;
case 1000024 :
case 1000037 :
if(UMix_)
UMix_->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The U-Type chargino mixing matrix pointer "
<< "is null!" << Exception::runerror;
if(VMix_)
VMix_->adjustPhase(id);
else
throw SetupException() << "SusyBase::adjustMixingMatrix - "
<< "The V-Type chargino mixing matrix pointer "
<< "is null!" << Exception::runerror;
break;
default :
throw SetupException()
<< "SusyBase::adjustMixingMatrix - Trying to adjust mixing matrix "
<< "phase for a particle that does not have a mixing matrix "
<< "associated with it. " << id << " must have a negative mass in "
<< "the spectrum file, this should only occur for particles that mix."
<< Exception::runerror;
}
}
void SusyBase::createMixingMatrices() {
map<string,pair<MatrixSize, MixingVector > >::const_iterator it;
for(it=mixings_.begin();it!=mixings_.end();++it) {
string name=it->first;
// create the gaugino mixing matrices
if(name == "nmix" || name == "nmnmix" ){
createMixingMatrix(NMix_,name,it->second.second,it->second.first);
}
else if (name == "umix" ) {
createMixingMatrix(UMix_,name,it->second.second,it->second.first);
}
else if (name == "vmix") {
createMixingMatrix(VMix_,name,it->second.second,it->second.first);
}
}
}
void SusyBase::extractParameters(bool checkmodel) {
map<string,ParamMap>::const_iterator pit;
ParamMap::const_iterator it;
// try and get tan beta from extpar first
pit=parameters_.find("extpar");
// extract tan beta
tanBeta_ = -1.;
if(tanBeta_<0.) {
pit=parameters_.find("hmix");
if(pit!=parameters_.end()) {
it = pit->second.find(2);
if(it!=pit->second.end()) tanBeta_ = it->second;
}
}
if(tanBeta_<0.) {
pit=parameters_.find("extpar");
if(pit!=parameters_.end()) {
it = pit->second.find(25);
if(it!=pit->second.end()) tanBeta_ = it->second;
}
}
// otherwise from minpar
if(tanBeta_<0.) {
pit=parameters_.find("minpar");
if(pit!=parameters_.end()) {
it = pit->second.find(3);
if(it!=pit->second.end()) tanBeta_ = it->second;
}
}
if(tanBeta_<0.)
throw Exception() << "SusyBase::extractParameters() "
<< "Can't find tan beta in BLOCK MINPAR"
<< " or BLOCK EXTPAR " << Exception::runerror;
// extract parameters from hmix
pit=parameters_.find("hmix");
if(pit==parameters_.end()) {
if(generator())
generator()->logWarning(Exception("SusyBase::extractParameters() BLOCK HMIX not found setting mu to zero\n",
Exception::warning));
else
cerr << "SusyBase::extractParameters() BLOCK HMIX not found setting mu to zero\n";
mu_=ZERO;
}
else {
mu_=findValue(pit,1,"HMIX","mu")*GeV;
}
pit = parameters_.find("msoft");
if( pit == parameters_.end() )
throw Exception() << "SusyBase::extractParameters() "
<< "BLOCK MSOFT not found in "
<< "SusyBase::extractParameters()"
<< Exception::runerror;
M1_ = findValue(pit,1 ,"MSOFT","M_1" )*GeV;
M2_ = findValue(pit,2 ,"MSOFT","M_2" )*GeV;
M3_ = findValue(pit,3 ,"MSOFT","M_3" )*GeV;
mH12_ = findValue(pit,21,"MSOFT","m_H1^2")*GeV2;
mH22_ = findValue(pit,22,"MSOFT","m_H2^2")*GeV2;
meL_ = findValue(pit,31,"MSOFT","M_eL" )*GeV;
mmuL_ = findValue(pit,32,"MSOFT","M_muL" )*GeV;
mtauL_ = findValue(pit,33,"MSOFT","M_tauL")*GeV;
meR_ = findValue(pit,34,"MSOFT","M_eR" )*GeV;
mmuR_ = findValue(pit,35,"MSOFT","M_muR" )*GeV;
mtauR_ = findValue(pit,36,"MSOFT","M_tauR")*GeV;
mq1L_ = findValue(pit,41,"MSOFT","M_q1L" )*GeV;
mq2L_ = findValue(pit,42,"MSOFT","M_q2L" )*GeV;
mq3L_ = findValue(pit,43,"MSOFT","M_q3L" )*GeV;
muR_ = findValue(pit,44,"MSOFT","M_uR" )*GeV;
mcR_ = findValue(pit,45,"MSOFT","M_cR" )*GeV;
mtR_ = findValue(pit,46,"MSOFT","M_tR" )*GeV;
mdR_ = findValue(pit,47,"MSOFT","M_dR" )*GeV;
msR_ = findValue(pit,48,"MSOFT","M_sR" )*GeV;
mbR_ = findValue(pit,49,"MSOFT","M_bR" )*GeV;
if(checkmodel) {
throw Exception() << "The SusyBase class should not be used as a "
<< "Model class, use one of the models which inherit"
<< " from it" << Exception::runerror;
}
}
diff --git a/Models/Transplanckian/Makefile.am b/Models/Transplanckian/Makefile.am
--- a/Models/Transplanckian/Makefile.am
+++ b/Models/Transplanckian/Makefile.am
@@ -1,5 +1,5 @@
if WANT_TRP
pkglib_LTLIBRARIES = HwTransplanck.la
endif
HwTransplanck_la_SOURCES = METRP2to2.cc METRP2to2.h
-HwTransplanck_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0
+HwTransplanck_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:1:0
diff --git a/Models/UED/Makefile.am b/Models/UED/Makefile.am
--- a/Models/UED/Makefile.am
+++ b/Models/UED/Makefile.am
@@ -1,20 +1,20 @@
if WANT_UED
pkglib_LTLIBRARIES = HwUED.la
endif
HwUED_la_SOURCES = \
UEDBase.cc UEDBase.h UEDBase.fh \
UEDF1F1Z0Vertex.cc UEDF1F1Z0Vertex.h \
UEDF1F1G0Vertex.cc UEDF1F1G0Vertex.h \
UEDF1F0G1Vertex.cc UEDF1F0G1Vertex.h \
UEDG1G1G0Vertex.cc UEDG1G1G0Vertex.h \
UEDG0G0G1G1Vertex.cc UEDG0G0G1G1Vertex.h \
UEDF1F1P0Vertex.cc UEDF1F1P0Vertex.h \
UEDF1F1W0Vertex.cc UEDF1F1W0Vertex.h \
UEDF1F0W1Vertex.cc UEDF1F0W1Vertex.h \
UEDP0H1H1Vertex.cc UEDP0H1H1Vertex.h \
UEDZ0H1H1Vertex.cc UEDZ0H1H1Vertex.h \
UEDW0A1H1Vertex.cc UEDW0A1H1Vertex.h \
UEDZ0A1h1Vertex.cc UEDZ0A1h1Vertex.h \
UEDW0W1W1Vertex.cc UEDW0W1W1Vertex.h \
UEDF1F0H1Vertex.cc UEDF1F0H1Vertex.h
-HwUED_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 5:1:0
+HwUED_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 6:0:0
diff --git a/Models/UED/UEDG0G0G1G1Vertex.cc b/Models/UED/UEDG0G0G1G1Vertex.cc
--- a/Models/UED/UEDG0G0G1G1Vertex.cc
+++ b/Models/UED/UEDG0G0G1G1Vertex.cc
@@ -1,71 +1,77 @@
// -*- C++ -*-
//
// UEDG0G0G1G1Vertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the UEDG0G0G1G1Vertex class.
//
#include "UEDG0G0G1G1Vertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
-#include "ThePEG/Persistency/PersistentOStream.h"
-#include "ThePEG/Persistency/PersistentIStream.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/PDT/EnumParticles.h"
+#include "UEDBase.h"
using namespace Herwig;
UEDG0G0G1G1Vertex::UEDG0G0G1G1Vertex() :
theq2Last(ZERO), theCoupLast(0.) {
orderInGs(2);
orderInGem(0);
}
void UEDG0G0G1G1Vertex::doinit() {
long kk1g = 5100021, smgl = 21;
addToList(smgl, smgl, kk1g, kk1g);
VVVVVertex::doinit();
}
-NoPIOClassDescription<UEDG0G0G1G1Vertex> UEDG0G0G1G1Vertex::initUEDG0G0G1G1Vertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<UEDG0G0G1G1Vertex,Helicity::VVVVVertex>
+describeUEDG0G0G1G1Vertex("Herwig::UEDG0G0G1G1Vertex", "HwUED.so");
void UEDG0G0G1G1Vertex::Init() {
static ClassDocumentation<UEDG0G0G1G1Vertex> documentation
("This class implements the coupling of a pair of SM gluons to"
"a pair of UED level-1 KK gluons.");
}
void UEDG0G0G1G1Vertex::setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
tcPDPtr part3, tcPDPtr part4) {
int ismg(0), ikkg(0);
vector<tcPDPtr> particles(4);
particles[0] = part1; particles[1] = part2;
particles[2] = part3; particles[3] = part4;
for(vector<long>::size_type i = 0; i < 4; ++i) {
if(particles[i]->id() == ParticleID::g) ++ismg;
if(particles[i]->id() == 5100021) ++ikkg;
}
if(ismg == 2 && ikkg == 2) {
if(q2 != theq2Last || theCoupLast == 0. ) {
theq2Last = q2;
theCoupLast = sqr(strongCoupling(q2));
}
norm(theCoupLast);
- setType(1); setOrder(0,1,2,3);
+ setType(1);
+ setOrder(0,1,2,3);
}
else {
throw HelicityLogicalError() << "UEDG0G0G1G1Vertex::setCoupling - "
<< "There is an unknown particle in this vertex "
<< part1->id() << " " << part2->id() << " "
<< part3->id() << " " << part4->id()
<< Exception::warning;
norm(0.);
}
}
diff --git a/Models/UED/UEDG0G0G1G1Vertex.h b/Models/UED/UEDG0G0G1G1Vertex.h
--- a/Models/UED/UEDG0G0G1G1Vertex.h
+++ b/Models/UED/UEDG0G0G1G1Vertex.h
@@ -1,152 +1,105 @@
// -*- C++ -*-
//
// UEDG0G0G1G1Vertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_UEDG0G0G1G1Vertex_H
#define HERWIG_UEDG0G0G1G1Vertex_H
//
// This is the declaration of the UEDG0G0G1G1Vertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/VVVVVertex.h"
-#include "UEDBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* This is the implementation of the coupling of two Standard
* Model gluons to a pair of level 1 KK gluons.
*
* @see \ref UEDG0G0G1G1VertexInterfaces "The interfaces"
* defined for UEDG0G0G1G1Vertex.
*/
-class UEDG0G0G1G1Vertex: public VVVVVertex {
+class UEDG0G0G1G1Vertex: public Helicity::VVVVVertex {
public:
/**
* The default constructor.
*/
UEDG0G0G1G1Vertex();
/**
* 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();
/** Calculate the coupling
*@param q2 The scale at which to evaluate the coupling
*@param part1 The first interacting particle
*@param part2 The second interacting particle
*@param part3 The third interacting particle
*@param part4 The fourth interacting particle
*/
virtual void setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
tcPDPtr part3, tcPDPtr part4);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static NoPIOClassDescription<UEDG0G0G1G1Vertex> initUEDG0G0G1G1Vertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
UEDG0G0G1G1Vertex & operator=(const UEDG0G0G1G1Vertex &);
private:
/**
- * A pointer to the UEDBase object
- */
- tUEDBasePtr theUEDBase;
-
- /**
* The scale at which the coupling was last evaluated
*/
Energy2 theq2Last;
/**
* The value of the coupling when it was last evaluated
*/
Complex theCoupLast;
};
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of UEDG0G0G1G1Vertex. */
-template <>
-struct BaseClassTrait<Herwig::UEDG0G0G1G1Vertex,1> {
- /** Typedef of the first base class of UEDG0G0G1G1Vertex. */
- typedef ThePEG::Helicity::VVVVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the UEDG0G0G1G1Vertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::UEDG0G0G1G1Vertex>
- : public ClassTraitsBase<Herwig::UEDG0G0G1G1Vertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::UEDG0G0G1G1Vertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * UEDG0G0G1G1Vertex is implemented. It may also include several, space-separated,
- * libraries if the class UEDG0G0G1G1Vertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwUED.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_UEDG0G0G1G1Vertex_H */
diff --git a/Models/UED/UEDG1G1G0Vertex.cc b/Models/UED/UEDG1G1G0Vertex.cc
--- a/Models/UED/UEDG1G1G0Vertex.cc
+++ b/Models/UED/UEDG1G1G0Vertex.cc
@@ -1,61 +1,68 @@
// -*- C++ -*-
//
// UEDG1G1G0Vertex.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the UEDG1G1G0Vertex class.
//
#include "UEDG1G1G0Vertex.h"
#include "ThePEG/Interface/ClassDocumentation.h"
+#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/EnumParticles.h"
using namespace ThePEG::Helicity;
using namespace Herwig;
UEDG1G1G0Vertex::UEDG1G1G0Vertex()
: theq2Last(ZERO), theCoupLast(0.) {
orderInGs(1);
orderInGem(0);
}
void UEDG1G1G0Vertex::doinit() {
long kkg1 = 5100021;
addToList(kkg1, kkg1, 21);
VVVVertex::doinit();
}
-NoPIOClassDescription<UEDG1G1G0Vertex> UEDG1G1G0Vertex::initUEDG1G1G0Vertex;
-// Definition of the static class description member.
+// *** Attention *** The following static variable is needed for the type
+// description system in ThePEG. Please check that the template arguments
+// are correct (the class and its base class), and that the constructor
+// arguments are correct (the class name and the name of the dynamically
+// loadable library where the class implementation can be found).
+DescribeNoPIOClass<UEDG1G1G0Vertex,Helicity::VVVVertex>
+describeUEDG1G1G0Vertex("Herwig::UEDG1G1G0Vertex", "HwUED.so");
void UEDG1G1G0Vertex::Init() {
static ClassDocumentation<UEDG1G1G0Vertex> documentation
- ("There is no documentation for the UEDG1G1G0Vertex class");
+ ("The UEDG1G1G0Vertex class implements the coupling of the "
+ "gluon to two KK excitations of the gluon in the UED model.");
}
void UEDG1G1G0Vertex::setCoupling(Energy2 q2, tcPDPtr part1, tcPDPtr part2,
tcPDPtr part3) {
long id1(part1->id()), id2(part2->id()), id3(part3->id());
if( (id1 == ParticleID::g && id2 == 5100021 && id3 == 5100021) ||
(id2 == ParticleID::g && id1 == 5100021 && id3 == 5100021) ||
(id3 == ParticleID::g && id1 == 5100021 && id2 == 5100021) ) {
if(q2 != theq2Last || theCoupLast == 0.) {
theq2Last = q2;
theCoupLast = strongCoupling(q2);
}
norm(theCoupLast);
}
else throw HelicityLogicalError()
<< "UEDG1G1G0Vertex::setCoupling - "
<< "There is an unknown particle in this vertex "
<< id1 << " " << id2 << " " << id3 << Exception::runerror;
}
diff --git a/Models/UED/UEDG1G1G0Vertex.h b/Models/UED/UEDG1G1G0Vertex.h
--- a/Models/UED/UEDG1G1G0Vertex.h
+++ b/Models/UED/UEDG1G1G0Vertex.h
@@ -1,149 +1,108 @@
// -*- C++ -*-
//
// UEDG1G1G0Vertex.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_UEDG1G1G0Vertex_H
#define HERWIG_UEDG1G1G0Vertex_H
//
// This is the declaration of the UEDG1G1G0Vertex class.
//
#include "ThePEG/Helicity/Vertex/Vector/VVVVertex.h"
#include "UEDBase.h"
namespace Herwig {
using namespace ThePEG;
using ThePEG::Helicity::Direction;
/**
* This is the implementation of the Feynman rule for the coupling
* of Standard Model gluon to a pair of (level1) KK excited gluons.
*
* @see \ref UEDG1G1G0VertexInterfaces "The interfaces"
* defined for UEDG1G1G0Vertex.
*/
class UEDG1G1G0Vertex: public VVVVertex {
public:
/**
* The default constructor.
*/
UEDG1G1G0Vertex();
/**
* 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();
/** Calculate the coupling
*@param q2 The scale at which to evaluate the coupling
*@param part1 The first interacting particle
*@param part2 The second interacting particle
*@param part3 The third interacting particle
*/
virtual void setCoupling(Energy2 q2,tcPDPtr part1,
tcPDPtr part2,tcPDPtr part3);
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
- * The static object used to initialize the description of this class.
- * Indicates that this is a concrete class with persistent data.
- */
- static NoPIOClassDescription<UEDG1G1G0Vertex> initUEDG1G1G0Vertex;
-
- /**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
UEDG1G1G0Vertex & operator=(const UEDG1G1G0Vertex &);
private:
/**
* The scale at which the coupling was last evaluated
*/
Energy2 theq2Last;
/**
* The value of the coupling when it was last evaluated
*/
Complex theCoupLast;
};
}
-#include "ThePEG/Utilities/ClassTraits.h"
-
-namespace ThePEG {
-
-/** @cond TRAITSPECIALIZATIONS */
-
-/** This template specialization informs ThePEG about the
- * base classes of UEDG1G1G0Vertex. */
-template <>
-struct BaseClassTrait<Herwig::UEDG1G1G0Vertex,1> {
- /** Typedef of the first base class of UEDG1G1G0Vertex. */
- typedef ThePEG::Helicity::VVVVertex NthBase;
-};
-
-/** This template specialization informs ThePEG about the name of
- * the UEDG1G1G0Vertex class and the shared object where it is defined. */
-template <>
-struct ClassTraits<Herwig::UEDG1G1G0Vertex>
- : public ClassTraitsBase<Herwig::UEDG1G1G0Vertex> {
- /** Return a platform-independent class name */
- static string className() { return "Herwig::UEDG1G1G0Vertex"; }
- /**
- * The name of a file containing the dynamic library where the class
- * UEDG1G1G0Vertex is implemented. It may also include several, space-separated,
- * libraries if the class UEDG1G1G0Vertex depends on other classes (base classes
- * excepted). In this case the listed libraries will be dynamically
- * linked in the order they are specified.
- */
- static string library() { return "HwUED.so"; }
-};
-
-/** @endcond */
-
-}
-
#endif /* HERWIG_UEDG1G1G0Vertex_H */
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -1,1018 +1,1074 @@
Herwig++ News (emacs -*- outline -*- format)
-* Herwig++-2.5.2 release: 2011-mm-dd (tagged at SVN r....)
+* Herwig++-2.5.2 release: 2011-11-01 (tagged at SVN r6928)
** Optional new jet vetoing model
The jet vetoing model by Schofield and Seymour (arXiv:1103.4811) is
available via Evolver:ColourEvolutionMethod,
PartnerFinder:PartnerMethod and SplittingFunction:SplittingColourMethod.
The default behaviour is unchanged.
+** MPI tune
+ Version 3 of the MPI tunes is now the default. Please note that the
+ pT parameter is energy-dependent and needs to be modified when an
+ LHC run is not at 7 TeV.
+ The latest tunes are always available at
+ http://projects.hepforge.org/herwig/trac/wiki/MB_UE_tunes
+
+** MPI PDFs
+ MPI PDFs can now be controlled independently.
+
+** Initialization time speedup
+ A new BSMModel base class was introduced between StandardModel and
+ the BSM model classes. Together with a restructured decay mode
+ initialization, this offers significantly faster startup times for
+ BSM runs. ThreeBodyDecays can now always be switched on without a
+ large speed penalty.
+
+** Decay mode file
+ Decay mode files in the SLHA format can now be read separately in
+ any BSM model with 'set Model:DecayFileName filename'
+
+** Powheg DIS
+ Charged- and neutral-current DIS processes implementing the POWHEG
+ method are now available.
+
+** Diffraction models
+ Xi cut implemented in PomeronFlux
+
+** Ticket #352: Colour reconnection fixed in DIS
+
** Ticket #353: Improved numerical stability in chargino decays
+** Ticket #358: Infinite loop in top events with pT cut in shower
+
+** Ticket #361: Problem with duplicate 2-body modes in BSM
+
+** Tickets #362 / #363: Crashes with baryon number violating models
+ Particle decays in SUSY models with RPV now work correctly in the
+ colour 8 -> 3,3,3 case. Colour reshuffling now works for RPV
+ clusters.
+
+** Improved Fastjet detection
+ The configure step uses fastjet-config to make sure all header file
+ paths are seen.
+
+** Darwin 11 / OS X Lion
+ A configure bug was fixed which prevented 'make check' from
+ succeeding on OS X Lion.
+
+** Vertex classes
+ The specification of QED / QCD orders has been moved to the vertex
+ constructors, to allow ThePEG consistency checks. WWHH vertices in
+ MSSM and NMSSM were fixed. Some Leptoquark and UED vertices fixed.
+
+** Hadronization
+ Cleanup of obsolete code.
+
+
* Herwig++-2.5.1 release: 2011-06-24 (tagged at SVN r6609)
** Example input files at 7 TeV
All our example input files for LHC now have their beam energy set
to 7 TeV instead of 14 TeV.
** Colour reconnection on by default
The colour reconnection tunes are now the default setup. Version 2
of the tunes replaces the *-1 tunes, which had a problem with LEP
event shapes.
** Run name tags
Aded possibility to add a tag to the run name when running with the
'-t' option. One run file can thus be run with different seeds and
results stored in different output files.
** Floating point exceptions
The new command line option -D enables floating point error checking.
** General improvements to WeakCurrent decays
** Remnant decayer
Hardwired gluon mass was removed.
** WeakCurrentDecayConstructor
Instead of specifying separate Particle1...Particle5 vectors for
the decay modes, the new interface DecayModes can be filled with
decay tags in the standard syntax.
** BSM: improvements to handling of vertex and model initialisation
** Powheg Higgs
Option to use pT or mT as the scale in alphaS and for the
factorization scale in the PDFs
** Ticket #337: Tau polarization wrong in charged Higgs decay
** Ticket #339: Colour flows in GeneralThreeBody Decayers for 3bar -> 8 3bar 1
** Ticket #340: Crash for resonant zero-width particles
** Ticket #341: Varying scale for BSM processes
The scale used is now ResonantProcessConstructor:ScaleFactor or
TwoToTwoProcessConstructor:ScaleFactor multiplied by sHat.
** Ticket #346: Chargino decays
Chargino decayers now automatically switch between the mesonic
decays for mass differences less than 2 GeV and the normal partonic
decays above 2 GeV.
** Ticket #349: Stop by default on input file errors
The '--exitonerror' flag is now the default behaviour for the
Herwig++ binary. To switch back to the old behaviour,
'--noexitonerror' is required.
** Ticket #351: Four-body stop decays
** Tested with gcc-4.6
* Herwig++-2.5.0 release: 2011-02-08 (tagged at SVN r6274)
** Uses ThePEG-1.7.0
Herwig++ 2.5.0 requires ThePEG 1.7.0 to benefit from various
improvements, particularly: handling of diffractive processes;
respecting LD_LIBRARY_PATH when loading dynamic libraries,
including LHAPDF; improvements to repository commands for decay
modes. See ThePEG's NEWS file for more details.
** POWHEG improvements
*** New POWHEG processes
Simulation at NLO accuracy using the POWHEG method is now
available for hadronic diboson production (pp to WW,WZ,ZZ), Higgs
decays to heavy quarks, and e+e- to two jets or ttbar, including
full mass dependence.
*** Input file changes
The input files for setting up POWHEG process simulation have been
simplified. See the example files LHC-Powheg.in and TVT-Powheg.in
for the improved command list.
*** Structural changes
The POWHEG backend in the shower code has been restructured to
make future additions easier: PowhegEvolver has merged with
Evolver; both the matrix element corrections and real corrections
in the POWHEG scheme are implemented directly in the ME or Decayer
classes.
** New processes at leading order
*** Photon initiated processes
We have added a matrix element for dijet production in gamma
hadron collisions.
*** Bottom and charm in heavy quark ME
The option of bottom and charm quarks is now supported for heavy
quark production in MEHeavyQuark.
** Colour reconnection
The cluster hadronization model has been extended by an option to
reconnect coloured constituents between clusters with a given
probability. This new model is different from the colour
reconnection model used in FORTRAN HERWIG, and improves the
description of minimum bias and underlying event data.
** Diffractive Processes
Both single and double diffractive processes are now supported in
Herwig++. The Pomeron PDF is implemented using a fit to HERA data,
and a pion PDF can be used to model reggeon flux.
** BSM physics
*** New models
We have added new BSM models, particularly ADD-type extra
dimension models and the next-to-minimal supersymmetric standard
model (NMSSM). Effects of leptoquarks can as well be simulated.
*** Vertex additions
We have added flavour changing stop interactions (stop -
neutralino - charm) and gravitino interactions with particular
emphasis on numerical stability for very light gravitinos.
Tri-linear Higgs and Higgs-Higgs/Vector-Vector four-vertices are
available as well.
*** Input file changes
The SUSY model can now also extract the SLHA information from the
header of a Les Houches event file: replace the SLHA file name
in the example input files with the LH file name.
*** Structure
The backend structure of the HardProcessConstructor has changed,
to allow easier inclusion of new process constructors. Some 2->3
BSM scattering processes involving neutral higgs bosons are now
included. The spin handling has been improved in the background.
** Shower splitting code reorganized
The selection of spin structures has been decoupled from the choice
of colour structure. This gives more flexibility in implementing
new splittings. Selected splittings can be disabled in the input
files.
** B mixing
B mixing, and indirect CP violation in the B meson system are
included now.
** Looptools
The Looptools directory has been updated to reflect T.Hahn's
Looptools 2.6.
** Contrib changes
The ROOT interface has been removed as deprecated. The MCPWNLO code
has temporarily been removed from the Contrib directory as a major
review of this code is required. Additionally, there are various
fixes to all other codes shipped in Contrib.
** DIS improvements
The momentum reshuffling in DIS events has been improved.
** mu and nu beams
mu, nu_e and nu_mu and their antiparticles are now available as
beam particles. They are all supported in the DIS matrix
elements. mu+ mu- collisions are supported in the general
matrix element code for BSM models, but not yet in the hard-coded
matrix elements for lepton-lepton scattering.
** Structural changes
*** Inline code
Inline code has been merged into the header files, .icc files were
removed.
*** Silent build
By default, Herwig++ now builds with silent build rules. To get
the old behaviour, run 'make V=1'.
*** Debug level
The debug level on the command line will now always have priority.
*** Event counter
The event counter has been simplified.
*** Interpolator persistency
Interpolators can now be written persistently.
** Ticket #307: Momentum violation check in BasicConsistency
Added parameters AbsoluteMomentumTolerance and
RelativeMomentumTolerance
** Example POWHEG input files
The example input files for Powheg processes now set the NLO
alpha_S correctly, and are run as part of 'make check'.
** Truncated shower
A problem which lead to the truncated shower not being applied in
some cases has been fixed.
** Fixes to numerical problems
Minor problems with values close to zero were fixed in several
locations.
** Remove duplicated calculation of event shapes
An accidental duplication in the calculation of event shapes was
removed, they are now only calculated once per event. Several other
minor issues in the event shape calculations have also been fixed.
** MRST PDFs fixed
An initialization problem in the internal MRST PDFs was fixed.
** Vertex scale choice
The scale in the Vertex classes can now be zero where
possible.
** Treatment of -N flag
The Herwig++ main program now correctly treats the -N flag
as optional.
** Numerical stability improved
The numerical stability in the 'RunningMass' and
'QTildeReconstructor' classes has been improved. The
stability of the boosts in the SOPTHY code for the
simulation of QED radiation has been improved.
The accuracy of boosts in the z-direction has been improved to
fix problems with extremely high p_T partons.
** Bugfix in initial state splittings
A bug in the implementation of the PDF weight in initial-state
qbar -> qbar g splittings has been fixed.
** Bugfix in chargino neutralino vertices
A bug in the 'chi+- chi0 W-+' and charged
Higgs-sfermions vertices has been fixed.
** Remove uninitialized variables written to repository
A number of uninitialised variables which were written to the
repository have been initialised to zero to avoid problems on some
systems.
** Fix to QED radiation in hadronic collisions
The longitudinal boost of the centre-of-mass frame in hadronic
collisions is correctly accounted for now in the generation of QED
radiation.
** Fix to numerical problems in two-body decays
Numerical problems have been fixed, which appeared in the rare case
that the three-momenta of the decay products in two-body decays are
zero in the rest frame of the decay particle.
** A problem with forced splittings in the Remnant was fixed.
** ME correction for W+- decays applied properly
The matrix element correction for QCD radiation in W+- decays
which was not being applied is now correctly used.
** Top quark decays from SLHA file
The presence of top quark decay modes in SLHA files is now handled
correctly.
** Exceptional shower reconstruction kinematics
Additional protection against problems due to the shower
reconstruction leading to partons with x>1 has been added.
** Ordering of particles in BSM processes
Changes have been made to allow arbitrary ordering of the outgoing
particles in BSM processes.
** Bugfixes in tau decays
Two bugs involving tau decays have been fixed. The wrong masses
were used in the 'KPiCurrent' class for the scalar form factors
and a mistake in the selection of decay products lead to
tau- --> pi0 K- being generated instead of tau- --> eta K-.
** Avoid crashes in baryon number violating processes.
To avoid crashes, better protection has been introduced for the
case where diquarks cannot be formed from the quarks in a
baryon-number violating process. In addition, the parents of the
baryon-number violating clusters have been changed to avoid
problems with the conversion of the events to HepMC.
** QED radiation in W- decays
A bug in the 'QEDRadiationHandler' class which resulted
in no QED radiation being generated in W- decays has been fixed.
** A number of minor fixes to the SUSY models have been made.
** Partial width calculations in BSM models
A fix for the direction of the incoming particle in the calculation
of two-body partial widths in BSM models has been made.
** LoopTools improvements
The LoopTools cache is now cleared more frequently to
reduce the amount of memory used by the particle.
** Negative gluino masses are now correctly handled.
** A problem with mixing matrices which are not square has been fixed.
** Removed duplicate diagram
The 'MEee2gZ2ll' class has been fixed to only include the
photon exchange diagram once rather than twice as previously.
** Fix for duplicate particles in DecayConstructor
A problem has been fixed which occurred if the same particle was
included in the list of DecayConstructor:DecayParticles.
** Fixes for UED model vertices
A number of minor problems in the vertices for the UED model have
been fixed.
** Include missing symmetry factor
The missing identical-particle symmetry factor in
'MEPP2GammaGamma' has been included.
** Fix floating point problem in top decays
A floating point problem in the matrix element correction for top
decays has been fixed.
* Herwig++-2.4.2 release: 2009-12-11 (tagged at SVN r5022)
** Ticket #292: Tau decay numerical instability
The momentum assignment in tau decays contained numerical
instabilities which have been fixed by postponing the tau decay
until after the parton shower. A new interface setting
DecayHandler:Excluded is available to prevent decays in the shower
step. This is enabled by default for tau only.
** Ticket #290: Missing MSSM colour structure
The missing colour structure for gluino -> gluon neutralino was added.
** Ticket #294: Zero momentum in some decays
Some rare phase space points lead to zero momentum in two-body
decays. This has been fixed.
** Ticket #295: Stability of QED radiation for lepton collider processes
The numerical stability of QED radiation momenta was improved
further.
** Ticket #296: K0 oscillation vertex was wrong
The oscillation from K0 to K0_L/S now takes place at the production
vertex of K0.
** Ticket #289: Undefined variables in repository
On some system configurations, undefined variables were written to
the repository. These have been fixed.
** Fixed QED radiation for hadron processes
The longitudinal boost of the centre-of-mass frame in hadronic
collisions is correctly accounted for now.
** Numerical stability fixes
Small fixes in RunningMass and QTildeReconstructor.
** Powheg example input files
The example input files for Powheg processes now set the NLO
alpha_S correctly, and are run as part of 'make check'.
** OS X builds for Snow Leopard
Snow Leopard machines will now be recognized as a 64bit
architecture.
* Herwig++-2.4.1 release: 2009-11-19 (tagged at SVN r4932)
** Uses ThePEG-1.6.0
Herwig++ now requires ThePEG-1.6.0 to benefit from the improved
helicity code there. If you have self-written vertex classes, see
ThePEG's NEWS file for conversion instructions.
** Vertex improvements
ThePEG's new helicity code allowed major simplification of the vertex
implementations for all Standard Model and BSM physics models.
** New Transplanckian scattering model
An example configuration is in LHC-TRP.in
** BSM ModelGenerator as branching ratio calculator
The BSM ModelGenerator has a new switch to output the branching
ratios for a given SLHA file in SLHA format, which can then be used
elsewhere.
** BSM debugging: HardProcessConstructor
New interface 'Excluded' to exclude certain particles from
intermediate lines.
** Chargino-Neutralino-W vertex fixed
** Spin correlations
are now switched on by default for all perturbative decays.
** Ticket #276: Scale choice in BSM models' HardProcessConstructor
New interface 'ScaleChoice' to choose process scale between
- sHat (default for colour neutral intermediates) and
- transverse mass (default for all other processes).
** Ticket #287: Powheg process scale choice
The default choice is now the mass of the colour-singlet system.
** Ticket #278: QED radiation for BSM
Soft QED radiation is now enabled in BSM decays and all
perturbative decays by default.
** Ticket #279: Full 1-loop QED radiation for Z decays
Soft QED radiation in Z decays is now fully 1-loop by default.
** Ticket #280: Redirect all files to stdout
This is now implemented globally. The files previously ending in
-UE.out and -BSMinfo.out are now appended to the log file. They now
also obey the EventGenerator:UseStdout flag.
** Ticket #270: LaTeX output updated
After each run, a LaTeX file is produced that contains the full
list of citations. Please include the relevant ones in publications.
** Ticket #256: Mac OS X problems
An initialization problem that affected only some configurations has
been identified and fixed.
** Tests directory added
This contains many .in files, to exercise most matrix
elements.
** Minor fixes
*** Prevent rare x>1 partons in shower reconstruction.
*** SUSY-LHA parameter EXTPAR can be used to set tan beta
*** Improved Fastjet detection at configure time
* Herwig++-2.4.0 release: 2009-09-01 (tagged at SVN r4616)
** New matrix elements
We have added a built-in implementation of several new matrix elements:
PP --> WW / WZ / ZZ
PP --> W gamma / Z gamma
PP --> VBF Higgs
PP --> Higgs tt / Higgs bb
e+e- --> WW / ZZ
gamma gamma --> ff / WW
** Base code improvements
*** Ticket #257: Remnant handling
A problem with forced splittings in the Remnant was fixed.
*** Ticket #264: Soft matrix element correction
A problem with emissions form antiquarks was fixed.
** PDF sets
*** New default set
MRST LO** is the new default PDF set. LO* is also available built-in.
*** Shower PDFs can be set separately from the hard process
Use the 'ShowerHandler:PDF' interface.
** Parameter tunes
Shower, hadronization and underlying event parameters were retuned
against LEP and Tevatron data respectively.
** BSM module improvements
*** Ticket #259: read error for some UED models
Arbitrary ordering of outgoing lines in the process description is now
possible.
*** Ticket #266: branching ratio sums
The warning threshold for branching ratios not summing to 1 has
been relaxed. It is now a user interface parameter.
*** Ticket #267: Top decay modes
Top decay modes listed in SLHA files are now handled correctly.
** QED radiation
*** Ticket #241: Soft QED radiation is now enabled by default
*** Ticket #265: Radiation off W+ and W- is now handled correctly
** Interfaces
*** Ticket #243: Fastjet
Fastjet is now the only supported jet finder code. All example
analyses have been converted to use Fastjet.
*** KtJet and CLHEP interfaces have been removed.
*** New interfaces to AcerDet and PGS available in Contrib
*** MCPWnlo distributed in Contrib
*** HepMC and Rivet interfaces moved to ThePEG
** Ticket #239: Inelastic cross-section for MinBias
This information is now available in the ...-UE.out files.
** Technical changes
*** Ticket #186
Configure now looks for ThePEG in the --prefix location first.
*** Configure information
Important configuration information is listed at the end of the
'configure' run and in the file 'config.thepeg'. Please provide
this file in any bug reports.
*** New ZERO object
The ZERO object can be used to set any dimensionful quantity to
zero. This avoids explicit constructs like 0.0*GeV.
*** Exception specifiers removed
Client code changes are needed in doinit() etc., simply remove the
exception specifier after the function name.
*** Ticket #263: Tau polarizations can be forced in TauDecayer
* Herwig++-2.3.2 release: 2009-05-08 (tagged at SVN r4249)
** SUSY enhancements
*** Ticket #245: Select inclusive / exclusive production
Using the new 'HardProcessConstructor:Processes' switch options
'SingleParticleInclusive', 'TwoParticleInclusive' or 'Exclusive'
*** Improved three-body decay generation
Several problems were fixed, incl. tickets #249 #250 #251
Thanks to J.Tattersall and K.Rolbiecki for the stress-testing!
*** Looptools fix
Release 2.3.1 had broken the Looptools initialization.
*** Improved warning message texts
** Ticket #237:
Values of q2last can now be zero where possible.
** Ticket #240:
The Herwig++ main program now correctly treats the -N flag as optional.
** Ticket #246:
Extreme pT partons fixed by improving accuracy of z boosts.
** DIS
Improved parton shower momentum reshuffling.
** Minimum Bias events
The zero-momentum interacting particle used for
bookkeeping is now labelled as a pomeron.
** User Makefile
Makefile-UserModules does not enable -pedantic anymore. User's ROOT
code will not compile otherwise.
** Build system
Small fixes in the build system.
* Herwig++-2.3.1 release: 2009-03-31 (tagged at SVN r4140)
** Initial state showers
The PDF veto was wrongly applied to qbar->qbar g splittings.
** User interaction
The Makefile-UserModules now includes the Herwig version number.
The -N flag to 'Herwig++ run' is optional now, as was always intended.
** Contrib
The contrib directory is now included in the tarball. The omission
was accidental.
** Numerical accuracy
Minor problems with values close to zero were fixed in several
locations.
** LEP event shapes
An accidental duplication was removed, they are now only calculated
once per event.
** MRST PDF code
Initialization problem fixed.
** Mac OS X
The configure script was improved to detect libraries better.
** Libtool
Updated to version 2.2.6
* Herwig++-2.3.0 release: 2008-12-02 (tagged at SVN r3939)
** Major release, with many new features and bug fixes
** Extension to lepton-hadron collisions
** Inclusion of several processes accurate at next-to-leading order
in the POsitive Weight Hardest Emission Generator (POWHEG) scheme
** Inclusion of three-body decays and finite-width effects
in BSM processes
** New procedure for reconstructing kinematics of the parton shower
based on the colour structure of the hard scattering process
** New model for baryon decays including excited baryon multiplets
** Addition of a soft component to the multiple scattering model
of the underlying event and the option to choose more than one hard
scattering explicitly
** New matrix elements for DIS and e+e- processes
** New /Contrib directory added
containing external modules that will hopefully be of use to some
users but are not expected to be needed by most users and are not
supported at the same level as the main Herwig++ code
** Minor changes to improve the physics simulation:
*** IncomingPhotonEvolver added
to allow the simulation of partonic processes with incoming photons
in hadron collisions
*** KTRapidityCut added
to allow cuts on the p_T and rapidity, rather than just the p_T and
pseudorapidity used in SimpleKTCut. This is now used by default for
cuts on massive particles such as the $W^\pm$, $Z^0$ and Higgs
bosons and the top quark
*** Several changes to the decayers of B mesons
both to resolve problems with the modelling of partonic decays and
improve agreement with $\Upsilon(4s)$ data
*** Changes to allow values other than transverse mass of final-state particles as maximum transverse momentum for radiation in parton shower
either SCALUP for Les Houches events or the scale of the hard
process for internally generated hard processes
*** Changed defaults for intrinsic transverse momentum in hadron collisions
to 1.9GeV, 2.1GeV and 2.2GeV for the Tevatron and LHC at 10 TeV and
14 TeV, respectively
*** Pdfinfo object is now created in the HepMC interface
However in order to support all versions of HepMC containing this
feature the PDF set is not specified as not all versions contain
this information
*** New option of only decaying particles with lifetimes below user specified value
*** New options for the cut-off in the shower
and some obsolete parameters removed
*** Added option of switching off certain decay modes in BSM models
*** Added a Matcher for Higgs boson
to allow cuts to be placed on it
*** Diffractive particles deleted from default input files
they were not previously used
** Technical changes:
*** Some AnalysisHandler classes comparing to LEP data have been renamed
e.g. MultiplicityCount becomes LEPMultiplicityCount to avoid
confusion with those supplied in /Contrib for observables at the
Upsilon(4s) resonance
*** Reorganisation to remove the majority of the .icc files
by moving inlined functions to headers in an effort to improve
compile time
*** Restructured the decay libraries to reduce the amount of memory allocation
and de-allocation which improves run-time performance
*** The switch to turn off LoopTools has been removed
because LoopTools is now used by several core modules. As LoopTools
does not work on 64-bit platforms with g77 this build option is not
supported
*** Removed support for obsolete version of HepMC supplied with CLHEP
and improved the support for different units options with HepMC
*** EvtGen interface has been removed until it is more stable
*** Support for ROOT has been removed
it was not previously used
*** CKKW infrastructure has been removed from the release
until a concrete implementation is available
*** Default optimisation has been increased from -O2 to -O3
*** Handling of the fortran compiler has been improved
mainly due to improvements in the autotools
*** Use of FixedAllocator for Particle objects in ThePEG has been removed
as it had no performance benefits
** Bugs fixed:
*** Problems with the mother/daughter relations in the hard process
and diagram selection in W+- and Z0 production in association with a
hard jet
*** In general matrix element code for fermion-vector to fermion-scalar
where the outgoing fermion is coloured and the scalar neutral
*** In the selection of diagrams in some associated squark gaugino processes
*** h0->mu+mu- was being generated when h0->tau+tau-
*** Normalisation in the Histogram class for non unit-weight events
*** Protection against negative PDF values has been improved
these can occur when using NLO PDF sets
*** Lifetime for BSM particles is now automatically calculated
at the same time as the width
*** Hadrons containing a top quark now treated like hadrons containing BSM particles
in order to support this possibility
*** Several ambiguous uses of unsigned int
*** Several variables that may have been used undefined
*** Several memory leaks at initialisation
*** The configuration now aborts if no fortran compiler is found
as this is required to compile Looptools
*** Several minor floating point errors that did not affect results
* Herwig++-2.2.1 release: 2008-07-09 (tagged at SVN r3434)
** Ticket #181: BSM shower with a decay close to threshold
Now fixed.
** Ticket #191: Split SUSY crash
Improved error message.
** Ticket #192: using SCALUP as the pT veto in the shower
Now implemented.
** Ticket #194: production processes of ~chi_1(2)-
Fixed bug in the diagram creation.
** Removed unused particles
DiffractiveParticles.in was removed, they were never produced.
** Hadronization
Top quark clusters now possible, handled as 'exotic' clusters.
** Improved handling of decay modes
See ThePEG-1.3.0. 'defaultparticle' command is now obsolete.
** Multi-Parton interactions
Increased phase space sampling to have less than 1% uncertainty on
average multiplicity.
** New libtool version
gfortran is now used as default if it is available. Set FC=g77 to
override this.
** Fixed several memory leaks
** Memory allocation
Now using plain 'new' and 'delete'.
* Herwig++-2.2.0 release: 2008-04-18 (tagged at SVN r3195)
** Major release: now as stand-alone library
Herwig++ is now a stand-alone dlopen() plugin to ThePEG.
No compile-time linking to Herwig code is required. The Herwig++
binary is a simple executable steering ThePEG, which can
be replaced by other frontends (such as setupThePEG / runThePEG).
** New matrix elements
p p -> W + jet / Z + jet / W + higgs / Z + higgs
e+ e- -> Z + higgs
** Looptools
Updated to version 2.2.
** Ticket #141: segfault from using 'run' command
Fixed by using default allocators in Herwig++, and the
Repository::cleanup() method in ThePEG 1.2.0.
** Ticket #157: broken gsl library path on some 64bit systems
Paths with lib64 are correctly identified now.
** Ticket #159: p_t spectrum of ttbar pair
Fixed identical particle multiplier in Sudakov form factor.
** Ticket #161: glibc segfault
Rare segfault in MPI handler fixed.
** Ticket #165: rare infinite loop in four-body decay
All 4-body decays without dedicated decayers now use the Mambo algorithm.
A loop guard has been introduced to 3-body decays to avoid infinite retries.
** Ticket #166: rare infinite loop in top ME correction
These very rare events (O(1) in 10^7) close to mass threshold
now are discarded.
** Higgs width fixes
** SatPDF
Optionally, the PDF extrapolation behaviour outside a given range
can now be specified.
** gcc 4.3
Herwig++-2.2 compiles cleanly with the new gcc 4.3 series.
* Herwig++-2.1.4 release: 2008-03-03 (tagged at SVN r3024)
** Ticket #152: Vertex positions
All vertex positions of unphysical particles are set to zero until
a fix for the previous nonsensical values can be implemented.
* Herwig++-2.1.3 release: 2008-02-25 (tagged at SVN r2957)
** Ticket #129: Baryon decays
Fix for baryon decay modes.
** Ticket #131: HepMC
Check if IO_GenEvent exists
** Ticket #134: Hadronization
Smearing of hadron directions in cluster decay fixed.
** Ticket #137: HepMC
HepMC conversion allows specification of energy and length units to
be used.
** Ticket #139: Neutral kaons
Ratio K_L / K_S corrected.
** Ticket #140 / #141: Crash on shutdown
Event generation from the 'read' stage or an interface now shuts
down cleanly. Fixes a crash bug introduced in 2.1.1 which affected
external APIs to ThePEG / Herwig.
** Ticket #146: BSM models can be disabled
To save build time, some or all of the BSM models can be disabled
using the '--enable-models' configure switch.
** Reorganised .model files
The .model files now include the model-specific particles, too.
** Re-tune
Re-tuned hadronization parameters to LEP data.
** Other fixes in
QSPAC implementation in Shower; Multi-parton interaction tuning;
MRST initialization
* Herwig++-2.1.2 release: 2008-01-05 (tagged at SVN r2694)
** Ticket #127
Thanks to a patch submitted by Fred Stober, HepMCFile now can
output event files in all supported formats.
** Ticket #128
Fixed incorrect value of pi in histogram limits.
** Other fixes in
CKKW Qtilde clusterers, BSM width cut, SUSY mixing matrices.
* Herwig++-2.1.1 release: 2007-12-08 (tagged at SVN r2589)
** Bug #123
Fixed a bug with particle lifetimes which resulted in nan for some
vertex positions.
** Secondary scatters
Fixed bug which gave intrinsic pT to secondary scatters.
** gcc abs bug detection
configure now checks for and works around
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34130
** CKKW reweighting
Fixed wrong check for top quarks.
** MPIHandler
Fixed call order ambiguity.
* Herwig++-2.1.0 release: 2007-11-20 (tagged at SVN r2542)
** Major new release
Herwig++-2.1 includes significant improvements, including
multi-parton interactions, BSM physics and a new hadronic decay
model, tuned to LEP data.
For an overview of the changes, please see the release note
arXiv:0711.3137
* Herwig++-2.0.3 release: 2007-08-21 (tagged at SVN r2101)
** Bug #90
nan in top decay ME corrections fixed.
** unlisted
Colour flow fix in LightClusterDecayer
** unlisted
Updated version of MultiplicityCount analysis handler.
* Herwig++-2.0.2 release: 2007-07-06 (tagged at SVN r1716)
** Bug #80
Separation of HepMC from CLHEP is handled properly now.
** Bug #83
Workaround for OS X header problem
** unlisted
Veto on very hard emissions from Shower.
** unlisted
Detailed documentation in .in files
* Herwig++-2.0.1 release: 2006-12-05 (tagged at SVN r1195)
** Bug #54
ClusterFissioner vertex calculation fixed.
** Bug #57
Crash when showering W+jet events supplied by Les Houches interface.
** Bug #59
Fix for #57 applied to LHC events.
** Bug #60
Segfault when PDF is set to NoPDF.
** Bug #61
Missing weight factor for I=0 mesons
** Bug #62
Spinor vertex calculations broken when spinor rep is not default rep.
** Bug #63
Top decay never produces tau.
** Bug #69
TTbar and HiggsJet analysis handlers fixed.
** unlisted
Reorganization of Hadronization module gives 30% speedup.
Thanks to Vincenzo Innocente at CMS for his profiling work!
** unlisted
cleaner automake files in include/ and src/
** unlisted
Hw64 hadron selection algorithm 'abortnow' fixed.
** unlisted
Top/LeptonDalitzAnalysis removed (only worked with modified code).
** unlisted
removed f'_0 from particle list, decays were not handled
* Herwig++-2.0.0 release: 2006-09-28 (tagged at SVN r1066)
** Full simulation of hadron collisions
diff --git a/PDF/HwRemDecayer.cc b/PDF/HwRemDecayer.cc
--- a/PDF/HwRemDecayer.cc
+++ b/PDF/HwRemDecayer.cc
@@ -1,1182 +1,1189 @@
// -*- C++ -*-
//
// HwRemDecayer.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the HwRemDecayer class.
//
#include "HwRemDecayer.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Utilities/UtilityBase.h"
#include "ThePEG/Utilities/SimplePhaseSpace.h"
#include "ThePEG/Utilities/Throw.h"
#include "Herwig++/Shower/ShowerHandler.h"
using namespace Herwig;
namespace{
const bool dbg = false;
void reShuffle(Lorentz5Momentum &p1, Lorentz5Momentum &p2, Energy m1, Energy m2){
Lorentz5Momentum ptotal(p1+p2);
ptotal.rescaleMass();
if( ptotal.m() < m1+m2 ) {
if(dbg)
cerr << "Not enough energy to perform reshuffling \n";
throw HwRemDecayer::ExtraSoftScatterVeto();
}
Boost boostv = -ptotal.boostVector();
ptotal.boost(boostv);
p1.boost(boostv);
// set the masses and energies,
p1.setMass(m1);
p1.setE(0.5/ptotal.m()*(ptotal.m2()+sqr(m1)-sqr(m2)));
p1.rescaleRho();
// boost back to the lab
p1.boost(-boostv);
p2.boost(boostv);
// set the masses and energies,
p2.setMass(m2);
p2.setE(0.5/ptotal.m()*(ptotal.m2()+sqr(m2)-sqr(m1)));
p2.rescaleRho();
// boost back to the lab
p2.boost(-boostv);
}
}
void HwRemDecayer::initialize(pair<tRemPPtr, tRemPPtr> rems, tPPair beam, Step & step,
Energy forcedSplitScale) {
// the step
thestep = &step;
// valence content of the hadrons
theContent.first = getHadronContent(beam.first);
theContent.second = getHadronContent(beam.second);
// momentum extracted from the hadrons
theUsed.first = Lorentz5Momentum();
theUsed.second = Lorentz5Momentum();
theMaps.first.clear();
theMaps.second.clear();
theX.first = 0.0;
theX.second = 0.0;
theRems = rems;
_forcedSplitScale = forcedSplitScale;
// check remnants attached to the right hadrons
if( (theRems.first && parent(theRems.first ) != beam.first ) ||
(theRems.second && parent(theRems.second) != beam.second) )
throw Exception() << "Remnant order wrong in "
<< "HwRemDecayer::initialize(...)"
<< Exception::runerror;
return;
}
void HwRemDecayer::split(tPPtr parton, HadronContent & content,
tRemPPtr rem, Lorentz5Momentum & used,
PartnerMap &partners, tcPDFPtr pdf, bool first) {
theBeam = parent(rem);
theBeamData = dynamic_ptr_cast<Ptr<BeamParticleData>::const_pointer>
(theBeam->dataPtr());
double currentx = parton->momentum().rho()/theBeam->momentum().rho();
double check = rem==theRems.first ? theX.first : theX.second;
check += currentx;
if(1.0-check < 1e-3) throw ShowerHandler::ExtraScatterVeto();
bool anti;
Lorentz5Momentum lastp(parton->momentum());
int lastID(parton->id());
Energy oldQ(_forcedSplitScale);
_pdf = pdf;
//do nothing if already valence quark
if(first && content.isValenceQuark(parton)) {
//set the extracted value, because otherwise no RemID could be generated.
content.extract(lastID);
// add the particle to the colour partners
partners.push_back(make_pair(parton, tPPtr()));
//set the sign
anti = parton->hasAntiColour() && parton->id()!=ParticleID::g;
if(rem==theRems.first) theanti.first = anti;
else theanti.second = anti;
// add the x and return
if(rem==theRems.first) theX.first += currentx;
else theX.second += currentx;
return;
}
//or gluon for secondaries
else if(!first && lastID == ParticleID::g) {
partners.push_back(make_pair(parton, tPPtr()));
// add the x and return
if(rem==theRems.first) theX.first += currentx;
else theX.second += currentx;
return;
}
// if a sea quark.antiquark forced splitting to a gluon
// Create the new parton with its momentum and parent/child relationship set
PPtr newSea;
if( lastID != ParticleID::g ) {
newSea = forceSplit(rem, -lastID, oldQ, currentx, lastp, used,content);
ColinePtr cl = new_ptr(ColourLine());
if(newSea->id() > 0) cl-> addColoured(newSea);
else cl->addAntiColoured(newSea);
// if a secondard scatter finished so return
if(!first || content.isValenceQuark(ParticleID::g) ){
partners.push_back(make_pair(parton, newSea));
// add the x and return
if(rem==theRems.first) theX.first += currentx;
else theX.second += currentx;
if(first) content.extract(ParticleID::g);
return;
}
}
// otherwise evolve back to valence
// final valence splitting
PPtr newValence = forceSplit(rem, 0, oldQ, currentx , lastp, used, content);
// extract from the hadron to allow remnant to be determined
content.extract(newValence->id());
// case of a gluon going into the hard subprocess
if( lastID == ParticleID::g ) {
partners.push_back(make_pair(parton, tPPtr()));
anti = newValence->hasAntiColour();
if(rem==theRems.first) theanti.first = anti;
else theanti.second = anti;
parton->colourLine(!anti)->addColoured(newValence, anti);
// add the x and return
if(rem==theRems.first) theX.first += currentx;
else theX.second += currentx;
return;
}
//The valence quark will always be connected to the sea quark with opposite sign
tcPPtr particle;
if(lastID*newValence->id() < 0){
particle = parton;
partners.push_back(make_pair(newSea, tPPtr()));
}
else {
particle = newSea;
partners.push_back(make_pair(parton, tPPtr()));
}
anti = newValence->hasAntiColour();
if(rem==theRems.first) theanti.first = anti;
else theanti.second = anti;
if(particle->colourLine())
particle->colourLine()->addAntiColoured(newValence);
if(particle->antiColourLine())
particle->antiColourLine()->addColoured(newValence);
// add the x and return
if(rem==theRems.first) theX.first += currentx;
else theX.second += currentx;
return;
}
void HwRemDecayer::doSplit(pair<tPPtr, tPPtr> partons,
pair<tcPDFPtr, tcPDFPtr> pdfs,
bool first) {
if(theRems.first) {
ParticleVector children=theRems.first->children();
for(unsigned int ix=0;ix<children.size();++ix) {
if(children[ix]->dataPtr()==theRems.first->dataPtr())
theRems.first = dynamic_ptr_cast<RemPPtr>(children[ix]);
}
}
if(theRems.second) {
ParticleVector children=theRems.second->children();
for(unsigned int ix=0;ix<children.size();++ix) {
if(children[ix]->dataPtr()==theRems.second->dataPtr())
theRems.second = dynamic_ptr_cast<RemPPtr>(children[ix]);
}
}
// forced splitting for first parton
if(partons.first->data().coloured()) {
try {
split(partons.first, theContent.first, theRems.first,
theUsed.first, theMaps.first, pdfs.first, first);
}
catch(ShowerHandler::ExtraScatterVeto) {
theX.first -= partons.first->momentum().rho()/
parent(theRems.first)->momentum().rho();
throw ShowerHandler::ExtraScatterVeto();
}
}
// forced splitting for second parton
if(partons.second->data().coloured()) {
try {
split(partons.second, theContent.second, theRems.second,
theUsed.second, theMaps.second, pdfs.second, first);
// additional check for the remnants
// if can't do the rescale veto the emission
if(!first&&partons.first->data().coloured()&&
partons.second->data().coloured()) {
Lorentz5Momentum pnew[2]=
{theRems.first->momentum() - theUsed.first - partons.first->momentum(),
theRems.second->momentum() - theUsed.second - partons.second->momentum()};
pnew[0].setMass(getParticleData(theContent.first.RemID())->constituentMass());
pnew[0].rescaleEnergy();
pnew[1].setMass(getParticleData(theContent.second.RemID())->constituentMass());
pnew[1].rescaleEnergy();
for(unsigned int iy=0; iy<theRems.first->children().size(); ++iy)
pnew[0] += theRems.first->children()[iy]->momentum();
for(unsigned int iy=0; iy<theRems.second->children().size(); ++iy)
pnew[1] += theRems.second->children()[iy]->momentum();
Lorentz5Momentum ptotal=
theRems.first ->momentum()-partons.first ->momentum()+
theRems.second->momentum()-partons.second->momentum();
if(ptotal.m() < (pnew[0].m() + pnew[1].m()) ) {
if(partons.second->id() != ParticleID::g){
if(partons.second==theMaps.second.back().first)
theUsed.second -= theMaps.second.back().second->momentum();
else
theUsed.second -= theMaps.second.back().first->momentum();
thestep->removeParticle(theMaps.second.back().first);
thestep->removeParticle(theMaps.second.back().second);
}
theMaps.second.pop_back();
throw ShowerHandler::ExtraScatterVeto();
}
}
}
catch(ShowerHandler::ExtraScatterVeto){
if(!partons.first||!partons.second||
!theRems.first||!theRems.second)
throw ShowerHandler::ExtraScatterVeto();
//case of the first forcedSplitting worked fine
theX.first -= partons.first->momentum().rho()/
parent(theRems.first)->momentum().rho();
theX.second -= partons.second->momentum().rho()/
parent(theRems.second)->momentum().rho();
//case of the first interaction
//throw veto immediately, because event get rejected anyway.
if(first) throw ShowerHandler::ExtraScatterVeto();
//secondary interactions have to end on a gluon, if parton
//was NOT a gluon, the forced splitting particles must be removed
if(partons.first->id() != ParticleID::g) {
if(partons.first==theMaps.first.back().first)
theUsed.first -= theMaps.first.back().second->momentum();
else
theUsed.first -= theMaps.first.back().first->momentum();
thestep->removeParticle(theMaps.first.back().first);
thestep->removeParticle(theMaps.first.back().second);
}
theMaps.first.pop_back();
throw ShowerHandler::ExtraScatterVeto();
}
}
// veto if not enough energy for extraction
if( !first &&(theRems.first ->momentum().e() -
partons.first ->momentum().e() < 1.0e-3*MeV ||
theRems.second->momentum().e() -
partons.second->momentum().e() < 1.0e-3*MeV )) {
if(partons.first->id() != ParticleID::g) {
if(partons.first==theMaps.first.back().first)
theUsed.first -= theMaps.first.back().second->momentum();
else
theUsed.first -= theMaps.first.back().first->momentum();
thestep->removeParticle(theMaps.first.back().first);
thestep->removeParticle(theMaps.first.back().second);
}
theMaps.first.pop_back();
if(partons.second->id() != ParticleID::g) {
if(partons.second==theMaps.second.back().first)
theUsed.second -= theMaps.second.back().second->momentum();
else
theUsed.second -= theMaps.second.back().first->momentum();
thestep->removeParticle(theMaps.second.back().first);
thestep->removeParticle(theMaps.second.back().second);
}
theMaps.second.pop_back();
throw ShowerHandler::ExtraScatterVeto();
}
}
void HwRemDecayer::mergeColour(tPPtr pold, tPPtr pnew, bool anti) const {
ColinePtr clnew, clold;
//save the corresponding colour lines
clold = pold->colourLine(anti);
clnew = pnew->colourLine(!anti);
assert(clold);
if(clnew){//there is already a colour line (not the final diquark)
if( (clnew->coloured().size() + clnew->antiColoured().size()) > 1 ){
if( (clold->coloured().size() + clold->antiColoured().size()) > 1 ){
//join the colour lines
//I don't use the join method, because potentially only (anti)coloured
//particles belong to one colour line
if(clold!=clnew){//procs are not already connected
while ( !clnew->coloured().empty() ) {
tPPtr p = clnew->coloured()[0];
clnew->removeColoured(p);
clold->addColoured(p);
}
while ( !clnew->antiColoured().empty() ) {
tPPtr p = clnew->antiColoured()[0];
clnew->removeAntiColoured(p);
clold->addAntiColoured(p);
}
}
}else{
//if pold is the only member on it's
//colour line, remove it.
clold->removeColoured(pold, anti);
//and add it to clnew
clnew->addColoured(pold, anti);
}
} else{//pnnew is the only member on it's colour line.
clnew->removeColoured(pnew, !anti);
clold->addColoured(pnew, !anti);
}
} else {//there is no coline at all for pnew
clold->addColoured(pnew, !anti);
}
}
void HwRemDecayer::fixColours(PartnerMap partners, bool anti,
double colourDisrupt) const {
PartnerMap::iterator prev;
tPPtr pnew, pold;
assert(partners.size()>=2);
PartnerMap::iterator it=partners.begin();
while(it != partners.end()) {
//skip the first one to have a partner
if(it==partners.begin()){
it++;
continue;
}
prev = it - 1;
//determine the particles to work with
pold = prev->first;
if(prev->second){
if(pold->hasAntiColour() != anti)
pold = prev->second;
}
assert(pold);
pnew = it->first;
if(it->second) {
if(it->second->colourLine(!anti)) //look for the opposite colour
pnew = it->second;
}
assert(pnew);
// Implement the disruption of colour connections
if( it != partners.end()-1 ) {//last one is diquark-has to be connected
//has to be inside the if statement, so that the probability is
//correctly counted:
if( UseRandom::rnd() < colourDisrupt ){
if(!it->second){//check, whether we have a gluon
mergeColour(pnew, pnew, anti);
}else{
if(pnew==it->first)//be careful about the order
mergeColour(it->second, it->first, anti);
else
mergeColour(it->first, it->second, anti);
}
it = partners.erase(it);
continue;
}
}
// regular merging
mergeColour(pold, pnew, anti);
//end of loop
it++;
}
return;
}
PPtr HwRemDecayer::forceSplit(const tRemPPtr rem, long child, Energy &lastQ,
double &lastx, Lorentz5Momentum &pf,
Lorentz5Momentum &p,
HadronContent & content) const {
// beam momentum
Lorentz5Momentum beam = theBeam->momentum();
// the last scale is minimum of last value and upper limit
Energy minQ=_range*_kinCutoff*sqrt(lastx)/(1-lastx);
if(minQ>lastQ) lastQ=minQ;
// generate the new value of qtilde
// weighted towards the lower value: dP/dQ = 1/Q -> Q(R) =
// Q0 (Qmax/Q0)^R
Energy q;
double zmin,zmax,yy;
+ unsigned int ntry=0,maxtry=100;
do {
q = minQ*pow(lastQ/minQ,UseRandom::rnd());
zmin = lastx;
yy = 1.+0.5*sqr(_kinCutoff/q);
zmax = yy - sqrt(sqr(yy)-1.);
+ ++ntry;
}
- while(zmax<zmin);
+ while(zmax<zmin&&ntry<maxtry);
+ if(ntry==maxtry) {
+ throw Exception() << "Can't set scale and z for forced splitting in "
+ << "HwRemDecayer::forceSplit() "
+ << Exception::eventerror;
+ }
// now generate z as in FORTRAN HERWIG
// use y = ln(z/(1-z)) as integration variable
double ymin=log(zmin/(1.-zmin));
double ymax=log(zmax/(1.-zmax));
double dely=ymax-ymin;
unsigned int nz=_nbinmax;
dely/=nz;
yy=ymin+0.5*dely;
vector<int> ids;
if(child!=0) ids.push_back(ParticleID::g);
else {
ids=content.flav;
for(unsigned int ix=0;ix<ids.size();++ix) ids[ix] *= content.sign;
}
// probabilities of the different types of possible splitting
map<long,pair<double,vector<double> > > partonprob;
double ptotal(0.);
for(unsigned int iflav=0;iflav<ids.size();++iflav) {
// only do each parton once
if(partonprob.find(ids[iflav])!=partonprob.end()) continue;
// particle data object
tcPDPtr in = getParticleData(ids[iflav]);
double psum(0.);
vector<double> prob;
for(unsigned int iz=0;iz<nz;++iz) {
double ez=exp(yy);
double wr=1.+ez;
double zr=wr/ez;
double wz=1./wr;
double zz=wz*ez;
double az=wz*zz*_alpha->value(sqr(max(wz*q,_kinCutoff)));
// g -> q qbar
if(ids[iflav]==ParticleID::g) {
// calculate splitting function
// SP as q is always less than forcedSplitScale, the pdf scale is fixed
// pdfval = _pdf->xfx(theBeamData,in,sqr(q),lastx*zr);
double pdfval=_pdf->xfx(theBeamData,in,sqr(_forcedSplitScale),lastx*zr);
if(pdfval>0.) psum += pdfval*az*0.5*(sqr(zz)+sqr(wz));
}
// q -> q g
else {
// calculate splitting function
// SP as q is always less than forcedSplitScale, the pdf scale is fixed
// pdfval = _pdf->xfx(theBeamData,in,sqr(q),lastx*zr);
double pdfval=_pdf->xfx(theBeamData,in,sqr(_forcedSplitScale),lastx*zr);
if(pdfval>0.) psum += pdfval*az*4./3.*(1.+sqr(wz))*zr;
}
if(psum>0.) prob.push_back(psum);
yy+=dely;
}
if(psum>0.) partonprob[ids[iflav]] = make_pair(psum,prob);
ptotal+=psum;
}
// select the flavour
if(ptotal==0.) throw ShowerHandler::ExtraScatterVeto();
ptotal *= UseRandom::rnd();
map<long,pair<double,vector<double> > >::const_iterator pit;
for(pit=partonprob.begin();pit!=partonprob.end();++pit) {
if(pit->second.first>=ptotal) break;
else ptotal -= pit->second.first;
}
if(pit==partonprob.end())
throw Exception() << "Can't select parton for forced backward evolution in "
<< "HwRemDecayer::forceSplit" << Exception::eventerror;
// select z
unsigned int iz=0;
for(;iz<pit->second.second.size();++iz) {
if(pit->second.second[iz]>ptotal) break;
}
if(iz==pit->second.second.size()) --iz;
double ey=exp(ymin+dely*(float(iz+1)-UseRandom::rnd()));
double z=ey/(1.+ey);
Energy2 pt2=sqr((1.-z)*q)- z*sqr(_kinCutoff);
// create the particle
if(pit->first!=ParticleID::g) child=pit->first;
PPtr parton = getParticleData(child)->produceParticle();
Energy2 emittedm2 = sqr(parton->dataPtr()->constituentMass());
// Now boost pcm and pf to z only frame
Lorentz5Momentum p_ref = Lorentz5Momentum(ZERO, beam.vect());
Lorentz5Momentum n_ref = Lorentz5Momentum(ZERO, -beam.vect());
// generate phi and compute pt of branching
double phi = Constants::twopi*UseRandom::rnd();
Energy pt=sqrt(pt2);
Lorentz5Momentum qt = LorentzMomentum(pt*cos(phi), pt*sin(phi), ZERO, ZERO);
Axis axis(p_ref.vect().unit());
if(axis.perp2()>0.) {
LorentzRotation rot;
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
rot.setRotate(acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
qt.transform(rot);
}
// compute alpha for previous particle
Energy2 p_dot_n = p_ref*n_ref;
double lastalpha = pf*n_ref/p_dot_n;
Lorentz5Momentum qtout=qt;
Energy2 qtout2=-qt*qt;
double alphaout=(1.-z)/z*lastalpha;
double betaout=0.5*(emittedm2+qtout2)/alphaout/p_dot_n;
Lorentz5Momentum k=alphaout*p_ref+betaout*n_ref+qtout;
k.rescaleMass();
parton->set5Momentum(k);
pf+=k;
lastQ=q;
lastx/=z;
p += parton->momentum();
thestep->addDecayProduct(rem,parton,false);
return parton;
}
void HwRemDecayer::setRemMasses() const {
// get the masses of the remnants
Energy mrem[2];
Lorentz5Momentum ptotal,pnew[2];
vector<tRemPPtr> theprocessed;
theprocessed.push_back(theRems.first);
theprocessed.push_back(theRems.second);
// one remnant in e.g. DIS
if(!theprocessed[0]||!theprocessed[1]) {
tRemPPtr rem = theprocessed[0] ? theprocessed[0] : theprocessed[1];
Lorentz5Momentum deltap(rem->momentum());
// find the diquark and momentum we still need in the energy
tPPtr diquark;
vector<PPtr> progenitors;
for(unsigned int ix=0;ix<rem->children().size();++ix) {
if(!DiquarkMatcher::Check(rem->children()[ix]->data())) {
progenitors.push_back(rem->children()[ix]);
deltap -= rem->children()[ix]->momentum();
}
else
diquark = rem->children()[ix];
}
// now find the total momentum of the hadronic final-state to
// reshuffle against
// find the hadron for this remnant
tPPtr hadron=rem;
do hadron=hadron->parents()[0];
while(!hadron->parents().empty());
// find incoming parton to hard process from this hadron
tPPtr hardin =
generator()->currentEvent()->primaryCollision()->incoming().first==hadron ?
generator()->currentEvent()->primarySubProcess()->incoming().first :
generator()->currentEvent()->primarySubProcess()->incoming().second;
tPPtr parent=hardin;
vector<PPtr> tempprog;
// find the outgoing particles emitted from the backward shower
do {
assert(!parent->parents().empty());
tPPtr newparent=parent->parents()[0];
if(newparent==hadron) break;
for(unsigned int ix=0;ix<newparent->children().size();++ix) {
if(newparent->children()[ix]!=parent)
findChildren(newparent->children()[ix],tempprog);
}
parent=newparent;
}
while(parent!=hadron);
// add to list of potential particles to reshuffle against in right order
for(unsigned int ix=tempprog.size();ix>0;--ix) progenitors.push_back(tempprog[ix-1]);
// final-state particles which are colour connected
tColinePair lines = make_pair(hardin->colourLine(),hardin->antiColourLine());
vector<PPtr> others;
for(ParticleVector::const_iterator
cit = generator()->currentEvent()->primarySubProcess()->outgoing().begin();
cit!= generator()->currentEvent()->primarySubProcess()->outgoing().end();++cit) {
// colour connected
if(lines.first&&lines.first==(**cit).colourLine()) {
findChildren(*cit,progenitors);
continue;
}
// anticolour connected
if(lines.second&&lines.second==(**cit).antiColourLine()) {
findChildren(*cit,progenitors);
continue;
}
// not connected
for(unsigned int ix=0;ix<(**cit).children().size();++ix)
others.push_back((**cit).children()[ix]);
}
// work out how much of the system needed for rescaling
unsigned int iloc=0;
Lorentz5Momentum psystem,ptotal;
do {
psystem+=progenitors[iloc]->momentum();
ptotal = psystem + deltap;
ptotal.rescaleMass();
psystem.rescaleMass();
++iloc;
if(ptotal.mass() > psystem.mass() + diquark->mass() &&
psystem.mass()>1*MeV && DISRemnantOpt_<2 && ptotal.e() > 0.*GeV ) break;
}
while(iloc<progenitors.size());
if(ptotal.mass() > psystem.mass() + diquark->mass()) --iloc;
if(iloc==progenitors.size()) {
// try touching the lepton in dis as a last restort
for(unsigned int ix=0;ix<others.size();++ix) {
progenitors.push_back(others[ix]);
psystem+=progenitors[iloc]->momentum();
ptotal = psystem + deltap;
ptotal.rescaleMass();
psystem.rescaleMass();
++iloc;
}
--iloc;
if(ptotal.mass() > psystem.mass() + diquark->mass()) {
if(DISRemnantOpt_==0||DISRemnantOpt_==2)
Throw<Exception>() << "Warning had to adjust the momentum of the"
<< " non-colour connected"
<< " final-state, e.g. the scattered lepton in DIS"
<< Exception::warning;
else
throw Exception() << "Can't set remnant momentum without adjusting "
<< "the momentum of the"
<< " non-colour connected"
<< " final-state, e.g. the scattered lepton in DIS"
<< " vetoing event"
<< Exception::eventerror;
}
else {
throw Exception() << "Can't put the remnant on-shell in HwRemDecayer::setRemMasses()"
<< Exception::eventerror;
}
}
psystem.rescaleMass();
LorentzRotation R = Utilities::getBoostToCM(make_pair(psystem, deltap));
Energy pz = SimplePhaseSpace::getMagnitude(sqr(ptotal.mass()),
psystem.mass(), diquark->mass());
LorentzRotation Rs(-(R*psystem).boostVector());
Rs.boost(0.0, 0.0, pz/sqrt(sqr(pz) + sqr(psystem.mass())));
Rs = Rs*R;
// put remnant on shell
deltap.transform(R);
deltap.setMass(diquark->mass());
deltap.setE(sqrt(sqr(diquark->mass())+sqr(pz)));
deltap.rescaleRho();
R.invert();
deltap.transform(R);
Rs = R*Rs;
// apply transformation to required particles to absorb recoil
for(unsigned int ix=0;ix<=iloc;++ix) {
progenitors[ix]->deepTransform(Rs);
}
diquark->set5Momentum(deltap);
}
// two remnants
else {
for(unsigned int ix=0;ix<2;++ix) {
if(!theprocessed[ix]) continue;
pnew[ix]=Lorentz5Momentum();
for(unsigned int iy=0;iy<theprocessed[ix]->children().size();++iy) {
pnew[ix]+=theprocessed[ix]->children()[iy]->momentum();
}
mrem[ix]=sqrt(pnew[ix].m2());
}
// now find the remnant remnant cmf frame
Lorentz5Momentum prem[2]={theprocessed[0]->momentum(),
theprocessed[1]->momentum()};
ptotal=prem[0]+prem[1];
ptotal.rescaleMass();
// boost momenta to this frame
if(ptotal.m()< (pnew[0].m()+pnew[1].m()))
throw Exception() << "Not enough energy in both remnants in "
<< "HwRemDecayer::setRemMasses() "
<< Exception::eventerror;
Boost boostv(-ptotal.boostVector());
ptotal.boost(boostv);
for(unsigned int ix=0;ix<2;++ix) {
prem[ix].boost(boostv);
// set the masses and energies,
prem[ix].setMass(mrem[ix]);
prem[ix].setE(0.5/ptotal.m()*(sqr(ptotal.m())+sqr(mrem[ix])-sqr(mrem[1-ix])));
prem[ix].rescaleRho();
// boost back to the lab
prem[ix].boost(-boostv);
// set the momenta of the remnants
theprocessed[ix]->set5Momentum(prem[ix]);
}
// boost the decay products
Lorentz5Momentum ptemp;
for(unsigned int ix=0;ix<2;++ix) {
Boost btorest(-pnew[ix].boostVector());
Boost bfmrest( prem[ix].boostVector());
for(unsigned int iy=0;iy<theprocessed[ix]->children().size();++iy) {
ptemp=theprocessed[ix]->children()[iy]->momentum();
ptemp.boost(btorest);
ptemp.boost(bfmrest);
theprocessed[ix]->children()[iy]->set5Momentum(ptemp);
}
}
}
}
void HwRemDecayer::initSoftInteractions(Energy ptmin, InvEnergy2 beta){
ptmin_ = ptmin;
beta_ = beta;
}
Energy HwRemDecayer::softPt() const {
Energy2 pt2(ZERO);
double xmin(0.0), xmax(1.0), x(0);
if(beta_ == ZERO){
return UseRandom::rnd(0.0,(double)(ptmin_/GeV))*GeV;
}
if(beta_ < ZERO){
xmin = 1.0;
xmax = exp( -beta_*sqr(ptmin_) );
}else{
xmin = exp( -beta_*sqr(ptmin_) );
xmax = 1.0;
}
x = UseRandom::rnd(xmin, xmax);
pt2 = 1.0/beta_ * log(1/x);
if( pt2 < ZERO || pt2 > sqr(ptmin_) )
throw Exception() << "HwRemDecayer::softPt generation of pt "
<< "outside allowed range [0," << ptmin_/GeV << "]."
<< Exception::runerror;
return sqrt(pt2);
}
void HwRemDecayer::softKinematics(Lorentz5Momentum &r1, Lorentz5Momentum &r2,
Lorentz5Momentum &g1, Lorentz5Momentum &g2) const {
g1 = Lorentz5Momentum();
g2 = Lorentz5Momentum();
//All necessary variables for the two soft gluons
Energy pt(softPt()), pz(ZERO);
Energy2 pz2(ZERO);
double phi(UseRandom::rnd(2.*Constants::pi));
double x_g1(0.0), x_g2(0.0);
//Get the external momenta
tcPPair beam(generator()->currentEventHandler()->currentCollision()->incoming());
Lorentz5Momentum P1(beam.first->momentum()), P2(beam.second->momentum());
if(dbg){
cerr << "new event --------------------\n"
<< *(beam.first) << *(softRems_.first)
<< "-------------------\n"
<< *(beam.second) << *(softRems_.second) << endl;
}
//Get x_g1 and x_g2
//first limits
double xmin = sqr(ptmin_)/4.0/(P1+P2).m2();
double x1max = (r1.e()+abs(r1.z()))/(P1.e() + abs(P1.z()));
double x2max = (r2.e()+abs(r2.z()))/(P2.e() + abs(P2.z()));
//now generate according to 1/x
x_g1 = xmin * exp(UseRandom::rnd(log(x1max/xmin)));
x_g2 = xmin * exp(UseRandom::rnd(log(x2max/xmin)));
if(dbg)
cerr << x1max << " " << x_g1 << endl << x2max << " " << x_g2 << endl;
Lorentz5Momentum ig1, ig2, cmf;
ig1 = x_g1*P1;
ig2 = x_g2*P2;
ig1.setMass(mg_);
ig2.setMass(mg_);
ig1.rescaleEnergy();
ig2.rescaleEnergy();
cmf = ig1 + ig2;
//boost vector from cmf to lab
Boost boostv(cmf.boostVector());
//outgoing gluons in cmf
g1.setMass(mg_);
g2.setMass(mg_);
g1.setX(pt*cos(phi));
g2.setX(-pt*cos(phi));
g1.setY(pt*sin(phi));
g2.setY(-pt*sin(phi));
pz2 = cmf.m2()/4 - sqr(mg_) - sqr(pt);
if(pz2/GeV2 < 0.0){
if(dbg)
cerr << "EXCEPTION not enough energy...." << endl;
throw ExtraSoftScatterVeto();
}
if(UseRandom::rndbool())
pz = sqrt(pz2);
else
pz = -sqrt(pz2);
if(dbg)
cerr << "pz has been calculated to: " << pz/GeV << endl;
g1.setZ(pz);
g2.setZ(-pz);
g1.rescaleEnergy();
g2.rescaleEnergy();
if(dbg){
cerr << "check inv mass in cmf frame: " << (g1+g2).m()/GeV
<< " vs. lab frame: " << (ig1+ig2).m()/GeV << endl;
}
g1.boost(boostv);
g2.boost(boostv);
//recalc the remnant momenta
Lorentz5Momentum r1old(r1), r2old(r2);
r1 -= ig1;
r2 -= ig2;
try{
reShuffle(r1, r2, r1old.m(), r2old.m());
}catch(ExtraSoftScatterVeto){
r1 = r1old;
r2 = r2old;
throw ExtraSoftScatterVeto();
}
if(dbg){
cerr << "remnant 1,2 momenta: " << r1/GeV << "--" << r2/GeV << endl;
cerr << "remnant 1,2 masses: " << r1.m()/GeV << " " << r2.m()/GeV << endl;
cerr << "check momenta in the lab..." << (-r1old-r2old+r1+r2+g1+g2)/GeV << endl;
}
}
void HwRemDecayer::doSoftInteractions(unsigned int N) {
if(N == 0) return;
if(!softRems_.first || !softRems_.second)
throw Exception() << "HwRemDecayer::doSoftInteractions: no "
<< "Remnants available."
<< Exception::runerror;
if( ptmin_ == -1.*GeV )
throw Exception() << "HwRemDecayer::doSoftInteractions: init "
<< "code has not been called! call initSoftInteractions."
<< Exception::runerror;
Lorentz5Momentum g1, g2;
Lorentz5Momentum r1(softRems_.first->momentum()), r2(softRems_.second->momentum());
unsigned int tries(1), i(0);
for(i=0; i<N; i++){
//check how often this scattering has been regenerated
if(tries > maxtrySoft_) break;
if(dbg){
cerr << "new try \n" << *softRems_.first << *softRems_.second << endl;
}
try{
softKinematics(r1, r2, g1, g2);
}catch(ExtraSoftScatterVeto){
tries++;
i--;
continue;
}
PPair oldrems = softRems_;
PPair gluons = make_pair(addParticle(softRems_.first, ParticleID::g, g1),
addParticle(softRems_.second, ParticleID::g, g2));
//now reset the remnants with the new ones
softRems_.first = addParticle(softRems_.first, softRems_.first->id(), r1);
softRems_.second = addParticle(softRems_.second, softRems_.second->id(), r2);
//do the colour connections
pair<bool, bool> anti = make_pair(oldrems.first->hasAntiColour(),
oldrems.second->hasAntiColour());
ColinePtr cl1 = new_ptr(ColourLine());
ColinePtr cl2 = new_ptr(ColourLine());
if( UseRandom::rnd() < colourDisrupt_ ){//this is the member variable, i.e. SOFT colour disruption
//connect the remnants independent of the gluons
oldrems.first->colourLine(anti.first)->addColoured(softRems_.first, anti.first);
oldrems.second->colourLine(anti.second)->addColoured(softRems_.second, anti.second);
//connect the gluons to each other
cl1->addColoured(gluons.first);
cl1->addAntiColoured(gluons.second);
cl2->addColoured(gluons.second);
cl2->addAntiColoured(gluons.first);
}else{
//connect the remnants to the gluons
oldrems.first->colourLine(anti.first)->addColoured(gluons.first, anti.first);
oldrems.second->colourLine(anti.second)->addColoured(gluons.second, anti.second);
//and the remaining colour line to the final remnant
cl1->addColoured(softRems_.first, anti.first);
cl1->addColoured(gluons.first, !anti.first);
cl2->addColoured(softRems_.second, anti.second);
cl2->addColoured(gluons.second, !anti.second);
}
//reset counter
tries = 1;
}
if(dbg)
cerr << "generated " << i << "th soft scatters\n";
}
void HwRemDecayer::finalize(double colourDisrupt, unsigned int softInt){
PPair diquarks;
//Do the final Rem->Diquark or Rem->quark "decay"
if(theRems.first) {
diquarks.first = finalSplit(theRems.first, theContent.first.RemID(),
theUsed.first);
theMaps.first.push_back(make_pair(diquarks.first, tPPtr()));
}
if(theRems.second) {
diquarks.second = finalSplit(theRems.second, theContent.second.RemID(),
theUsed.second);
theMaps.second.push_back(make_pair(diquarks.second, tPPtr()));
}
setRemMasses();
if(theRems.first) {
fixColours(theMaps.first, theanti.first, colourDisrupt);
if(theContent.first.hadron->id()==ParticleID::pomeron&&
pomeronStructure_==0) fixColours(theMaps.first, !theanti.first, colourDisrupt);
}
if(theRems.second) {
fixColours(theMaps.second, theanti.second, colourDisrupt);
if(theContent.second.hadron->id()==ParticleID::pomeron&&
pomeronStructure_==0) fixColours(theMaps.second, !theanti.second, colourDisrupt);
}
if( !theRems.first || !theRems.second ) return;
//stop here if we don't have two remnants
softRems_ = diquarks;
doSoftInteractions(softInt);
}
HwRemDecayer::HadronContent
HwRemDecayer::getHadronContent(tcPPtr hadron) const {
HadronContent hc;
hc.hadron = hadron->dataPtr();
long id(hadron->id());
// baryon
if(BaryonMatcher::Check(hadron->data())) {
hc.sign = id < 0? -1: 1;
hc.flav.push_back((id = abs(id)/10)%10);
hc.flav.push_back((id /= 10)%10);
hc.flav.push_back((id /= 10)%10);
hc.extracted = -1;
}
else if(hadron->data().id()==ParticleID::gamma ||
(hadron->data().id()==ParticleID::pomeron && pomeronStructure_==1)) {
hc.sign = 1;
for(int ix=1;ix<6;++ix) {
hc.flav.push_back( ix);
hc.flav.push_back(-ix);
}
}
else if(hadron->data().id()==ParticleID::pomeron ) {
hc.sign = 1;
hc.flav.push_back(ParticleID::g);
hc.flav.push_back(ParticleID::g);
}
else if(hadron->data().id()==ParticleID::reggeon ) {
hc.sign = 1;
for(int ix=1;ix<3;++ix) {
hc.flav.push_back( ix);
hc.flav.push_back(-ix);
}
}
hc.pomeronStructure = pomeronStructure_;
return hc;
}
long HwRemDecayer::HadronContent::RemID() const{
if(extracted == -1)
throw Exception() << "Try to build a Diquark id without "
<< "having extracted something in "
<< "HwRemDecayer::RemID(...)"
<< Exception::runerror;
//the hadron was a meson or photon
if(flav.size()==2) return sign*flav[(extracted+1)%2];
long remId;
int id1(sign*flav[(extracted+1)%3]),
id2(sign*flav[(extracted+2)%3]),
sign(0), spin(0);
if (abs(id1) > abs(id2)) swap(id1, id2);
sign = (id1 < 0) ? -1 : 1; // Needed for the spin 0/1 part
remId = id2*1000+id1*100;
// Now decide if we have spin 0 diquark or spin 1 diquark
if(id1 == id2) spin = 3; // spin 1
else spin = 1; // otherwise spin 0
remId += sign*spin;
return remId;
}
tPPtr HwRemDecayer::addParticle(tcPPtr parent, long id, Lorentz5Momentum p) const {
PPtr newp = new_ptr(Particle(getParticleData(id)));
newp->set5Momentum(p);
// Add the new remnant to the step, but don't do colour connections
thestep->addDecayProduct(parent,newp,false);
return newp;
}
void HwRemDecayer::findChildren(tPPtr part,vector<PPtr> & particles) const {
if(part->children().empty()) particles.push_back(part);
else {
for(unsigned int ix=0;ix<part->children().size();++ix)
findChildren(part->children()[ix],particles);
}
}
ParticleVector HwRemDecayer::decay(const DecayMode &,
const Particle &, Step &) const {
throw Exception() << "HwRemDecayer::decay(...) "
<< "must not be called explicitely."
<< Exception::runerror;
}
void HwRemDecayer::persistentOutput(PersistentOStream & os) const {
os << ounit(_kinCutoff, GeV) << _range
<< _zbin << _ybin << _nbinmax << _alpha << DISRemnantOpt_
<< maxtrySoft_ << colourDisrupt_ << pomeronStructure_
<< ounit(mg_,GeV);
}
void HwRemDecayer::persistentInput(PersistentIStream & is, int) {
is >> iunit(_kinCutoff, GeV) >> _range
>> _zbin >> _ybin >> _nbinmax >> _alpha >> DISRemnantOpt_
>> maxtrySoft_ >> colourDisrupt_ >> pomeronStructure_
>> iunit(mg_,GeV);
}
ClassDescription<HwRemDecayer> HwRemDecayer::initHwRemDecayer;
// Definition of the static class description member.
void HwRemDecayer::Init() {
static ClassDocumentation<HwRemDecayer> documentation
("The HwRemDecayer class decays the remnant for Herwig++");
static Parameter<HwRemDecayer,double> interfaceZBinSize
("ZBinSize",
"The size of the vbins in z for the interpolation of the splitting function.",
&HwRemDecayer::_zbin, 0.05, 0.001, 0.1,
false, false, Interface::limited);
static Parameter<HwRemDecayer,int> interfaceMaxBin
("MaxBin",
"Maximum number of z bins",
&HwRemDecayer::_nbinmax, 100, 10, 1000,
false, false, Interface::limited);
static Reference<HwRemDecayer,ShowerAlpha> interfaceAlphaS
("AlphaS",
"Pointer to object to calculate the strong coupling",
&HwRemDecayer::_alpha, false, false, true, false, false);
static Parameter<HwRemDecayer,Energy> interfaceKinCutoff
("KinCutoff",
"Parameter kinCutoff used to constrain qtilde",
&HwRemDecayer::_kinCutoff, GeV, 0.75*GeV, 0.5*GeV, 10.0*GeV,
false, false, Interface::limited);
static Parameter<HwRemDecayer,double> interfaceEmissionRange
("EmissionRange",
"Factor above the minimum possible value in which the forced splitting is allowed.",
&HwRemDecayer::_range, 1.1, 1.0, 10.0,
false, false, Interface::limited);
static Switch<HwRemDecayer,unsigned int> interfaceDISRemnantOption
("DISRemnantOption",
"Options for the treatment of the remnant in DIS",
&HwRemDecayer::DISRemnantOpt_, 0, false, false);
static SwitchOption interfaceDISRemnantOptionDefault
(interfaceDISRemnantOption,
"Default",
"Use the minimum number of particles needed to take the recoil"
" and allow the lepton to be used if needed",
0);
static SwitchOption interfaceDISRemnantOptionNoLepton
(interfaceDISRemnantOption,
"NoLepton",
"Use the minimum number of particles needed to take the recoil but"
" veto events where the lepton kinematics would need to be altered",
1);
static SwitchOption interfaceDISRemnantOptionAllParticles
(interfaceDISRemnantOption,
"AllParticles",
"Use all particles in the colour connected system to take the recoil"
" and use the lepton if needed.",
2);
static SwitchOption interfaceDISRemnantOptionAllParticlesNoLepton
(interfaceDISRemnantOption,
"AllParticlesNoLepton",
"Use all the particles in the colour connected system to take the"
" recoil but don't use the lepton.",
3);
static Parameter<HwRemDecayer,unsigned int> interfaceMaxTrySoft
("MaxTrySoft",
"The maximum number of regeneration attempts for an additional soft scattering",
&HwRemDecayer::maxtrySoft_, 10, 0, 100,
false, false, Interface::limited);
static Parameter<HwRemDecayer,double> interfacecolourDisrupt
("colourDisrupt",
"Fraction of connections to additional soft subprocesses, which are colour disrupted.",
&HwRemDecayer::colourDisrupt_,
1.0, 0.0, 1.0,
false, false, Interface::limited);
static Switch<HwRemDecayer,unsigned int> interfacePomeronStructure
("PomeronStructure",
"Option for the treatment of the valance structure of the pomeron",
&HwRemDecayer::pomeronStructure_, 0, false, false);
static SwitchOption interfacePomeronStructureGluon
(interfacePomeronStructure,
"Gluon",
"Assume the pomeron is a two gluon state",
0);
static SwitchOption interfacePomeronStructureQQBar
(interfacePomeronStructure,
"QQBar",
"Assumne the pomeron is q qbar as for the photon,"
" this option is not recommended and is provide for compatiblity with POMWIG",
1);
}
bool HwRemDecayer::canHandle(tcPDPtr particle, tcPDPtr parton) const {
if(!(StandardQCDPartonMatcher::Check(*parton) ||
parton->id()==ParticleID::gamma)) return false;
return HadronMatcher::Check(*particle) || particle->id()==ParticleID::gamma
|| particle->id()==ParticleID::pomeron || particle->id()==ParticleID::reggeon;
}
diff --git a/PDF/MRST.cc b/PDF/MRST.cc
--- a/PDF/MRST.cc
+++ b/PDF/MRST.cc
@@ -1,833 +1,834 @@
// -*- C++ -*-
//
// MRST.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#include "MRST.h"
#include <ThePEG/PDT/ParticleData.h>
#include <ThePEG/PDT/EnumParticles.h>
#include <ThePEG/Persistency/PersistentOStream.h>
#include <ThePEG/Persistency/PersistentIStream.h>
#include <ThePEG/Repository/EventGenerator.h>
#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/Interface/Parameter.h>
#include <ThePEG/Interface/Switch.h>
#include <istream>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
using namespace ThePEG;
using namespace Herwig;
/**
* Minimum value of \f$x\f$
*/
const double MRST::xmin=1E-5;
/**
* Maximum value of \f$x\f$
*/
const double MRST::xmax=1.0;
/**
* Minimum value of \f$q^2\f$.
*/
const Energy2 MRST::qsqmin = 1.25 * GeV2;
/**
* Maximum value of \f$q^2\f$.
*/
const Energy2 MRST::qsqmax = 1E7 * GeV2;
/**
* Mass squared of the charm quark
*/
const Energy2 MRST::mc2 = 2.045 * GeV2;
/**
* Mass squared of the bottom quark
*/
const Energy2 MRST::mb2 = 18.5 * GeV2;
ClassDescription<MRST> MRST::initMRST;
MRST::MRST() : _inter(2), _xswitch(0.9),
data(np+1,vector<vector<double> >
(nx+1,vector<double>
(nq+1,0.0))),
fdata(np+1,vector<vector<double> >
(nx+1,vector<double>
(nq+1,0.0))) {
if ( ! initialized ) {
for ( int jj=1; jj < ntenth; ++jj ) {
lxxb[jj] = log10(xx[jj]/xx[ntenth]) + xx[ntenth];
}
lxxb[ntenth] = xx[ntenth];
for ( int n=1; n<=nx; n++ ) lxx[n] = log10(xx[n]);
for ( int n=1; n<=nq; n++ ) lqq[n] = log10(qq[n]);
initialized = true;
}
}
bool MRST::canHandleParticle(tcPDPtr particle) const {
// Return true if this PDF can handle the extraction of parton from the
// given particle ie. if the particle is a proton or neutron.
return ( abs(particle->id()) == ParticleID::pplus ||
abs(particle->id()) == ParticleID::n0 );
}
cPDVector MRST::partons(tcPDPtr p) const {
// Return the parton types which are described by these parton
// densities.
cPDVector ret;
if ( canHandleParticle(p) ) {
ret.push_back(getParticleData(ParticleID::g));
for ( int i = 1; i <= 5; ++i ) {
ret.push_back(getParticleData(i));
ret.push_back(getParticleData(-i));
}
}
return ret;
}
double MRST::xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
double x, double, Energy2) const {
return pdfValue(x, partonScale, particle, parton,Total);
}
double MRST::xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
double x, double, Energy2) const {
return pdfValue(x, partonScale, particle, parton,Valence);
}
double MRST::xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
double x, double, Energy2) const {
return pdfValue(x, partonScale, particle, parton,Sea);
}
double MRST::pdfValue(double x, Energy2 q2,
tcPDPtr particle, tcPDPtr parton, PDFType type) const {
+ assert(!isnan(x) && !isinf(x));
// reset x to min or max if outside range
if(x<xmin) x=xmin;
else if(x>xmax) x=xmax;
// reset q2 to min or max if outside range
if(q2<qsqmin) q2=qsqmin;
else if(q2>qsqmax) q2=qsqmax;
// c++ interpolation
double output(0.);
if(_inter==0||(_inter==2&&x<_xswitch)) {
// interpolation is in logx, log qsq:
double xxx=log10(x);
double qsq=log10(q2/GeV2);
// bin position
int n=locate(lxx,nx,xxx);
int m=locate(lqq,nq,qsq);
// fraction along the bin
double t=(xxx-lxx[n])/(lxx[n+1]-lxx[n]);
double u=(qsq-lqq[m])/(lqq[m+1]-lqq[m]);
bool anti = particle->id() < 0;
bool neutron = abs(particle->id()) == ParticleID::n0;
if (type==Valence) {
switch(parton->id()) {
case ParticleID::u:
output= (neutron?
(anti? 0.0: lookup(dnValence,n,m,u,t)):
(anti? 0.0: lookup(upValence,n,m,u,t)));
break;
case ParticleID::ubar:
output= (neutron?
(anti? lookup(dnValence,n,m,u,t): 0.0):
(anti? lookup(upValence,n,m,u,t): 0.0));
break;
case ParticleID::d:
output= (neutron?
(anti? 0.0: lookup(upValence,n,m,u,t)):
(anti? 0.0: lookup(dnValence,n,m,u,t)));
break;
case ParticleID::dbar:
output= (neutron?
(anti? lookup(upValence,n,m,u,t): 0.0):
(anti? lookup(dnValence,n,m,u,t): 0.0));
break;
}
}
else if(type==Sea) {
switch(parton->id()) {
case ParticleID::b:
case ParticleID::bbar:
output= lookup(bot,n,m,u,t);
break;
case ParticleID::c:
case ParticleID::cbar:
output= lookup(chm,n,m,u,t);
break;
case ParticleID::s:
case ParticleID::sbar:
output= lookup(str,n,m,u,t);
break;
case ParticleID::u:
case ParticleID::ubar:
output= (neutron? lookup(dnSea,n,m,u,t) : lookup(upSea,n,m,u,t));
break;
case ParticleID::d:
case ParticleID::dbar:
output= (neutron? lookup(upSea,n,m,u,t) : lookup(dnSea,n,m,u,t));
break;
case ParticleID::g:
output= lookup(glu,n,m,u,t);
break;
}
}
else if(type==Total) {
switch(parton->id()) {
case ParticleID::b:
case ParticleID::bbar:
output= lookup(bot,n,m,u,t);
break;
case ParticleID::c:
case ParticleID::cbar:
output= lookup(chm,n,m,u,t);
break;
case ParticleID::s:
case ParticleID::sbar:
output= lookup(str,n,m,u,t);
break;
case ParticleID::u:
output= (neutron?
(lookup(dnSea,n,m,u,t) + (anti? 0.0: lookup(dnValence,n,m,u,t))) :
(lookup(upSea,n,m,u,t) + (anti? 0.0: lookup(upValence,n,m,u,t))));
break;
case ParticleID::ubar:
output= (neutron?
(lookup(dnSea,n,m,u,t) + (anti? lookup(dnValence,n,m,u,t): 0.0)) :
(lookup(upSea,n,m,u,t) + (anti? lookup(upValence,n,m,u,t): 0.0)));
break;
case ParticleID::d:
output= (neutron?
(lookup(upSea,n,m,u,t) + (anti? 0.0: lookup(upValence,n,m,u,t))) :
(lookup(dnSea,n,m,u,t) + (anti? 0.0: lookup(dnValence,n,m,u,t))));
break;
case ParticleID::dbar:
output= (neutron?
(lookup(upSea,n,m,u,t) + (anti? lookup(upValence,n,m,u,t): 0.0)) :
(lookup(dnSea,n,m,u,t) + (anti? lookup(dnValence,n,m,u,t): 0.0)));
break;
case ParticleID::g:
output= lookup(glu,n,m,u,t);
break;
}
}
}
else {
double xxx=x;
if(x<lxxb[ntenth]) xxx = log10(x/lxxb[ntenth])+lxxb[ntenth];
int nn=0;
do ++nn;
while(xxx>lxxb[nn+1]);
double a=(xxx-lxxb[nn])/(lxxb[nn+1]-lxxb[nn]);
double qsq=q2/GeV2;
int mm=0;
do ++mm;
while(qsq>qq[mm+1]);
double b=(qsq-qq[mm])/(qq[mm+1]-qq[mm]);
double g[np+1];
for(int ii=1;ii<=np;++ii) {
g[ii]= (1.-a)*(1.-b)*fdata[ii][nn ][mm] + (1.-a)*b*fdata[ii][nn ][mm+1]
+ a*(1.-b)*fdata[ii][nn+1][mm] + a*b*fdata[ii][nn+1][mm+1];
if(nn<ntenth&&!(ii==5||ii==7)) {
double fac=(1.-b)*fdata[ii][ntenth][mm]+b*fdata[ii][ntenth][mm+1];
g[ii] = fac*pow(10.,g[ii]-fac);
}
g[ii] *= pow(1.-x,n0[ii]);
}
bool anti = particle->id() < 0;
bool neutron = abs(particle->id()) == ParticleID::n0;
if (type==Valence) {
switch(parton->id()) {
case ParticleID::u:
output= (neutron?
(anti? 0.0: g[2]):
(anti? 0.0: g[1]));
break;
case ParticleID::ubar:
output= (neutron?
(anti? g[2]: 0.0):
(anti? g[1]: 0.0));
break;
case ParticleID::d:
output= (neutron?
(anti? 0.0: g[1]):
(anti? 0.0: g[2]));
break;
case ParticleID::dbar:
output= (neutron?
(anti? g[1]: 0.0):
(anti? g[2]: 0.0));
break;
}
}
else if(type==Sea) {
switch(parton->id()) {
case ParticleID::b:
case ParticleID::bbar:
output= g[7];
break;
case ParticleID::c:
case ParticleID::cbar:
output= g[5];
break;
case ParticleID::s:
case ParticleID::sbar:
output= g[6];
break;
case ParticleID::u:
case ParticleID::ubar:
output= (neutron ? g[8] : g[4] );
break;
case ParticleID::d:
case ParticleID::dbar:
output= (neutron? g[4] : g[8] );
break;
case ParticleID::g:
output= g[3];
break;
}
}
else if(type==Total) {
switch(parton->id()) {
case ParticleID::b:
case ParticleID::bbar:
output= g[7];
break;
case ParticleID::c:
case ParticleID::cbar:
output= g[5];
break;
case ParticleID::s:
case ParticleID::sbar:
output= g[6];
break;
case ParticleID::u:
output= (neutron?
(g[8] + (anti? 0.0: g[2])) :
(g[4] + (anti? 0.0: g[1])));
break;
case ParticleID::ubar:
output= (neutron?
(g[8] + (anti? g[2]: 0.0)) :
(g[4] + (anti? g[1]: 0.0)));
break;
case ParticleID::d:
output= (neutron?
(g[4] + (anti? 0.0: g[1])) :
(g[8] + (anti? 0.0: g[2])));
break;
case ParticleID::dbar:
output= (neutron?
(g[4] + (anti? g[1]: 0.0)) :
(g[8] + (anti? g[2]: 0.0)));
break;
case ParticleID::g:
output= g[3];
break;
}
}
}
output = max(output,0.);
assert(!isnan(output));
return output;
}
void MRST::persistentOutput(PersistentOStream &out) const {
out << _file << data << fdata << _inter << _xswitch;
}
void MRST::persistentInput(PersistentIStream & in, int) {
in >> _file >> data >> fdata >> _inter >> _xswitch;
initialize(false);
}
void MRST::Init() {
static ClassDocumentation<MRST> documentation
("Implementation of the MRST PDFs",
"Implementation of the MRST LO* / LO** PDFs \\cite{Sherstnev:2007nd}.",
" %\\cite{Sherstnev:2007nd}\n"
"\\bibitem{Sherstnev:2007nd}\n"
" A.~Sherstnev and R.~S.~Thorne,\n"
" ``Parton Distributions for LO Generators,''\n"
" Eur.\\ Phys.\\ J.\\ C {\\bf 55} (2008) 553\n"
" [arXiv:0711.2473 [hep-ph]].\n"
" %%CITATION = EPHJA,C55,553;%%\n"
);
static Switch<MRST,unsigned int> interfaceInterpolation
("Interpolation",
"Whether to use cubic or linear (C++ or FORTRAN) interpolation",
&MRST::_inter, 2, false, false);
static SwitchOption interfaceInterpolationCubic
(interfaceInterpolation,
"Cubic",
"Use cubic interpolation",
0);
static SwitchOption interfaceInterpolationLinear
(interfaceInterpolation,
"Linear",
"Use Linear Interpolation",
1);;
static SwitchOption interfaceInterpolationMixed
(interfaceInterpolation,
"Mixed",
"Use cubic below xswitch and linear interpolation above",
2);
static Parameter<MRST,double> interfaceXSwitch
("XSwitch",
"Value of x to switch from cubic to linear interpolation",
&MRST::_xswitch, 0.9, 0.0, 1.0,
false, false, Interface::limited);
}
void MRST::doinitrun() {
PDFBase::doinitrun();
#ifdef MRST_TESTING
unsigned int intersave=_inter;
tPDPtr proton=getParticleData(ParticleID::pplus);
for(unsigned int itype=0;itype<8;++itype) {
tPDPtr parton;
string name;
if(itype==0) {
name="u.top";
parton=getParticleData(ParticleID::u);
}
else if(itype==1) {
name="d.top";
parton=getParticleData(ParticleID::d);
}
else if(itype==2) {
name="ubar.top";
parton=getParticleData(ParticleID::ubar);
}
else if(itype==3) {
name="dbar.top";
parton=getParticleData(ParticleID::dbar);
}
else if(itype==4) {
name="s.top";
parton=getParticleData(ParticleID::s);
}
else if(itype==5) {
name="c.top";
parton=getParticleData(ParticleID::c);
}
else if(itype==6) {
name="b.top";
parton=getParticleData(ParticleID::b);
}
else if(itype==7) {
name="g.top";
parton=getParticleData(ParticleID::g);
}
ofstream output(name.c_str());
Energy qmin=2.0*GeV,qmax=3000.0*GeV;
int nq=10;
Energy qstep=(qmax-qmin)/nq;
for(Energy q=qmin+qstep;q<=qmax;q+=qstep) {
double nx=500;
double xmin=1e-5,xmax=1.;
double xstep=(log(xmax)-log(xmin))/nx;
output << "NEW FRAME" << endl;
output << "SET FONT DUPLEX\n";
output << "SET SCALE Y LOG\n";
output << "SET LIMITS X " << xmin << " " << xmax << endl;
if(itype==0)
output << "TITLE TOP \" up distribution for q="
<< q/GeV << "\"\n";
else if(itype==1)
output << "TITLE TOP \" down distribution for q="
<< q/GeV << "\"\n";
else if(itype==2)
output << "TITLE TOP \" ubar distribution for q="
<< q/GeV << "\"\n";
else if(itype==3)
output << "TITLE TOP \" dbar distribution for q="
<< q/GeV << "\"\n";
else if(itype==4)
output << "TITLE TOP \" strange distribution for q="
<< q/GeV << "\"\n";
else if(itype==5)
output << "TITLE TOP \" charm distribution for q="
<< q/GeV << "\"\n";
else if(itype==6)
output << "TITLE TOP \" bottom distribution for q="
<< q/GeV << "\"\n";
else if(itype==7)
output << "TITLE TOP \" gluon distribution for q="
<< q/GeV << "\"\n";
_inter=0;
for(double xl=log(xmin)+xstep;xl<=log(xmax);xl+=xstep) {
double x=exp(xl);
double val=xfl(proton,parton,q*q,-xl);
if(val>1e5) val=1e5;
output << x << '\t' << val << '\n';
}
output << "JOIN RED" << endl;
_inter=1;
for(double xl=log(xmin)+xstep;xl<=log(xmax);xl+=xstep) {
double x=exp(xl);
double val=xfl(proton,parton,q*q,-xl);
if(val>1e5) val=1e5;
output << x << '\t' << val << '\n';
}
output << "JOIN BLUE" << endl;
_inter=2;
for(double xl=log(xmin)+xstep;xl<=log(xmax);xl+=xstep) {
double x=exp(xl);
double val=xfl(proton,parton,q*q,-xl);
if(val>1e5) val=1e5;
output << x << '\t' << val << '\n';
}
output << "JOIN GREEN" << endl;
}
}
_inter=intersave;
#endif
}
void MRST::readSetup(istream &is) {
_file = dynamic_cast<istringstream*>(&is)->str();
initialize();
}
void MRST::initialize(bool reread) {
useMe();
// int i,n,m,k,l,j; // counters
double dx,dq;
int wt[][16] = {{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{-3, 0, 0, 3, 0, 0, 0, 0,-2, 0, 0,-1, 0, 0, 0, 0},
{ 2, 0, 0,-2, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
{ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0},
{ 0, 0, 0, 0,-3, 0, 0, 3, 0, 0, 0, 0,-2, 0, 0,-1},
{ 0, 0, 0, 0, 2, 0, 0,-2, 0, 0, 0, 0, 1, 0, 0, 1},
{-3, 3, 0, 0,-2,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0,-3, 3, 0, 0,-2,-1, 0, 0},
{ 9,-9, 9,-9, 6, 3,-3,-6, 6,-6,-3, 3, 4, 2, 1, 2},
{-6, 6,-6, 6,-4,-2, 2, 4,-3, 3, 3,-3,-2,-1,-1,-2},
{ 2,-2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 1, 1, 0, 0},
{-6, 6,-6, 6,-3,-3, 3, 3,-4, 4, 2,-2,-2,-2,-1,-1},
{ 4,-4, 4,-4, 2, 2,-2,-2, 2,-2,-2, 2, 1, 1, 1, 1}};
// Variables used for initialising c_ij array:
double f1[np+1][nx+1][nq+1];//derivative wrt.x
double f2[np+1][nx+1][nq+1];//derivative wrt.qq
double f12[np+1][nx+1][nq+1];//cross derivative
double xxd,d1d2,cl[16],x[16],d1,d2,y[5],y1[5],y2[5],y12[5];
if(reread) {
ifstream datafile(_file.c_str());
if(!datafile) throw Exception() << "Could not open file '" << _file
<< "' in MRST::initialize()"
<< Exception::runerror;
for(int nn=1; nn<nx; nn++) {
for(int mm=1; mm<=nq; mm++) {
datafile >> data[1][nn][mm];
datafile >> data[2][nn][mm];
datafile >> data[3][nn][mm];
datafile >> data[4][nn][mm];
datafile >> data[5][nn][mm];
datafile >> data[7][nn][mm];
datafile >> data[6][nn][mm];
datafile >> data[8][nn][mm];
if(datafile.eof()) throw Exception() << "Error while reading " << _file
<< " too few data points in file"
<< "in MRST::initialize()"
<< Exception::runerror;
for(int ii=1;ii<=np;++ii) {
fdata[ii][nn][mm] = _inter==0 ? 0. :
data[ii][nn][mm]/pow(1.-xx[nn],n0[ii]);
}
}
}
for (int n=1; n<=8; ++n) {
for(int mm=1; mm<=nq; ++mm) {
data[n][nx][mm]=0.0;
}
}
double dtemp;
datafile >> dtemp;
if(!datafile.eof()) throw Exception() << "Error reading end of " << _file
<< " too many data points in file"
<< "in MRST::initialize()"
<< Exception::runerror;
datafile.close();
// calculate the FORTRAN interpolation
for(int jj=1;jj<=ntenth-1;++jj) {
for(int ii=1;ii<=np;++ii) {
if(ii==5||ii==7) continue;
for(int kk=1;kk<=nq;++kk) {
fdata[ii][jj][kk] = _inter==0 ? 0. :
log10( fdata[ii][jj][kk] / fdata[ii][ntenth][kk] ) +
fdata[ii][ntenth][kk];
}
}
}
for (int n=1; n<=np; ++n) {
for(int mm=1; mm<=nq; ++mm) {
fdata[n][nx][mm]=0.0;
}
}
}
// Now calculate the derivatives used for bicubic interpolation
for (int i=1;i<=np;i++) {
// Start by calculating the first x derivatives
// along the first x value
dx=lxx[2]-lxx[1];
for (int m=1;m<=nq;m++)
f1[i][1][m]=(data[i][2][m]-data[i][1][m])/dx;
// The along the rest (up to the last)
for (int k=2;k<nx;k++) {
for (int m=1;m<=nq;m++) {
f1[i][k][m]=polderivative(lxx[k-1],lxx[k],lxx[k+1],
data[i][k-1][m],
data[i][k][m],
data[i][k+1][m]);
}
}
// Then for the last column
dx=lxx[nx]-lxx[nx-1];
for (int m=1;m<=nq;m++)
f1[i][nx][m]=(data[i][nx][m]-data[i][nx-1][m])/dx;
if ((i!=5)&&(i!=7)) {
// then calculate the qq derivatives
// Along the first qq value
dq=lqq[2]-lqq[1];
for (int k=1;k<=nx;k++)
f2[i][k][1]=(data[i][k][2]-data[i][k][1])/dq;
// The rest up to the last qq value
for (int m=2;m<nq;m++) {
for (int k=1;k<=nx;k++)
f2[i][k][m]=polderivative(lqq[m-1],lqq[m],lqq[m+1],
data[i][k][m-1],
data[i][k][m],
data[i][k][m+1]);
}
// then for the last row
dq=lqq[nq]-lqq[nq-1];
for (int k=1;k<=nx;k++)
f2[i][k][nq]=(data[i][k][nq]-data[i][k][nq-1])/dq;
// Now, calculate the cross derivatives.
// Calculate these as x-derivatives of the y-derivatives
// ?? Could be improved by taking the average between dxdy and dydx ??
// Start by calculating the first x derivatives
// along the first x value
dx=lxx[2]-lxx[1];
for (int m=1;m<=nq;m++)
f12[i][1][m]=(f2[i][2][m]-f2[i][1][m])/dx;
// The along the rest (up to the last)
for (int k=2;k<nx;k++) {
for (int m=1;m<=nq;m++)
f12[i][k][m]=polderivative(lxx[k-1],lxx[k],lxx[k+1],
f2[i][k-1][m],f2[i][k][m],f2[i][k+1][m]);
}
// Then for the last column
dx=lxx[nx]-lxx[nx-1];
for (int m=1;m<=nq;m++)
f12[i][nx][m]=(f2[i][nx][m]-f2[i][nx-1][m])/dx;
}
if (i==5) {
// zero all elements below the charm threshold
for (int m=1;m<nqc0;m++)
for (int k=1;k<=nx;k++)
f2[i][k][m]=0.0;
// then calculate the qq derivatives
// Along the first qq value above the threshold (m=ncq0)
dq=lqq[nqc0+1]-lqq[nqc0];
for (int k=1;k<=nx;k++)
f2[i][k][nqc0]=(data[i][k][nqc0+1]-data[i][k][nqc0])/dq;
// The rest up to the last qq value
for (int m=nqc0+1;m<nq;m++) {
for (int k=1;k<=nx;k++)
f2[i][k][m]=polderivative(lqq[m-1],lqq[m],lqq[m+1],
data[i][k][m-1],
data[i][k][m],
data[i][k][m+1]);
}
// then for the last row
dq=lqq[nq]-lqq[nq-1];
for (int k=1;k<=nx;k++)
f2[i][k][nq]=(data[i][k][nq]-data[i][k][nq-1])/dq;
// Now, calculate the cross derivatives.
// Calculate these as x-derivatives of the y-derivatives
// ?? Could be improved by taking the average between dxdy and dydx ??
dx=lxx[2]-lxx[1];
for (int m=1;m<=nq;m++)
f12[i][1][m]=(f2[i][2][m]-f2[i][1][m])/dx;
// The along the rest (up to the last)
for (int k=2;k<nx;k++) {
for (int m=1;m<=nq;m++)
f12[i][k][m]=polderivative(lxx[k-1],lxx[k],lxx[k+1],
f2[i][k-1][m],f2[i][k][m],f2[i][k+1][m]);
}
// Then for the last column
dx=lxx[nx]-lxx[nx-1];
for (int m=1;m<=nq;m++)
f12[i][nx][m]=(f2[i][nx][m]-f2[i][nx-1][m])/dx;
}
if (i==7) {
// zero all elements below the bottom threshold
for (int m=1;m<nqb0;m++)
for (int k=1;k<=nx;k++)
f2[i][k][m]=0.0;
// then calculate the qq derivatives
// Along the first qq value above the threshold (m=nqb0)
dq=lqq[nqb0+1]-lqq[nqb0];
for (int k=1;k<=nx;k++)
f2[i][k][nqb0]=(data[i][k][nqb0+1]-data[i][k][nqb0])/dq;
// The rest up to the last qq value
for (int m=nqb0+1;m<nq;m++) {
for (int k=1;k<=nx;k++)
f2[i][k][m]=polderivative(lqq[m-1],lqq[m],lqq[m+1],
data[i][k][m-1],
data[i][k][m],
data[i][k][m+1]);
}
// then for the last row
dq=lqq[nq]-lqq[nq-1];
for (int k=1;k<=nx;k++)
f2[i][k][nq]=(data[i][k][nq]-data[i][k][nq-1])/dq;
// Now, calculate the cross derivatives.
// Calculate these as x-derivatives of the y-derivatives
// ?? Could be improved by taking the average between dxdy and dydx ??
dx=lxx[2]-lxx[1];
for (int m=1;m<=nq;m++)
f12[i][1][m]=(f2[i][2][m]-f2[i][1][m])/dx;
// The along the rest (up to the last)
for (int k=2;k<nx;k++) {
for (int m=1;m<=nq;m++)
f12[i][k][m]=polderivative(lxx[k-1],lxx[k],lxx[k+1],
f2[i][k-1][m],f2[i][k][m],f2[i][k+1][m]);
}
// Then for the last column
dx=lxx[nx]-lxx[nx-1];
for (int m=1;m<=nq;m++)
f12[i][nx][m]=(f2[i][nx][m]-f2[i][nx-1][m])/dx;
}
// Now calculate the coefficients c_ij
for(int n=1;n<=nx-1;n++) {
for(int m=1;m<=nq-1;m++) {
d1=lxx[n+1]-lxx[n];
d2=lqq[m+1]-lqq[m];
d1d2=d1*d2;
// Iterate around the grid and store the values of f, f_x, f_y and f_xy
y[1]=data[i][n][m];
y[2]=data[i][n+1][m];
y[3]=data[i][n+1][m+1];
y[4]=data[i][n][m+1];
y1[1]=f1[i][n][m];
y1[2]=f1[i][n+1][m];
y1[3]=f1[i][n+1][m+1];
y1[4]=f1[i][n][m+1];
y2[1]=f2[i][n][m];
y2[2]=f2[i][n+1][m];
y2[3]=f2[i][n+1][m+1];
y2[4]=f2[i][n][m+1];
y12[1]=f12[i][n][m];
y12[2]=f12[i][n+1][m];
y12[3]=f12[i][n+1][m+1];
y12[4]=f12[i][n][m+1];
for (int k=1;k<=4;k++) {
x[k-1]=y[k];
x[k+3]=y1[k]*d1;
x[k+7]=y2[k]*d2;
x[k+11]=y12[k]*d1d2;
}
for (int l=0;l<=15;l++) {
xxd=0.0;
for (int k=0;k<=15;k++) xxd+= wt[l][k]*x[k];
cl[l]=xxd;
}
int l=0;
for (int k=1;k<=4;k++)
for (int j=1;j<=4;j++) c[i][n][m][k][j]=cl[l++];
} //m
} //n
} // i
}
double MRST::xx[] =
{ 0.0, 1E-5, 2E-5, 4E-5, 6E-5, 8E-5, 1E-4, 2E-4, 4E-4, 6E-4, 8E-4,
1E-3, 2E-3, 4E-3, 6E-3, 8E-3, 1E-2, 1.4E-2, 2E-2, 3E-2, 4E-2, 6E-2, 8E-2,
.1, .125, 0.15, .175, .2, .225, 0.25, .275, .3, .325, 0.35, .375,
.4, .425, 0.45, .475, .5, .525, 0.55, .575, .6, .65, .7, .75,
.8, .9, 1. };
double MRST::lxx[] =
{ 0.0, 1E-5, 2E-5, 4E-5, 6E-5, 8E-5, 1E-4, 2E-4, 4E-4, 6E-4, 8E-4,
1E-3, 2E-3, 4E-3, 6E-3, 8E-3, 1E-2, 1.4E-2, 2E-2, 3E-2, 4E-2, 6E-2, 8E-2,
.1, .125, 0.15, .175, .2, .225, 0.25, .275, .3, .325, 0.35, .375,
.4, .425, 0.45, .475, .5, .525, 0.55, .575, .6, .65, .7, .75,
.8, .9, 1. };
double MRST::lxxb[] =
{ 0.0, 1E-5, 2E-5, 4E-5, 6E-5, 8E-5, 1E-4, 2E-4, 4E-4, 6E-4, 8E-4,
1E-3, 2E-3, 4E-3, 6E-3, 8E-3, 1E-2, 1.4E-2, 2E-2, 3E-2, 4E-2, 6E-2, 8E-2,
.1, .125, 0.15, .175, .2, .225, 0.25, .275, .3, .325, 0.35, .375,
.4, .425, 0.45, .475, .5, .525, 0.55, .575, .6, .65, .7, .75,
.8, .9, 1. };
double MRST::qq[] =
{ 0.0, 1.25, 1.5, 2., 2.5, 3.2, 4., 5., 6.4, 8., 10., 12., 18., 26., 40.,
64., 1E2, 1.6E2, 2.4E2, 4E2, 6.4E2, 1E3, 1.8E3, 3.2E3, 5.6E3,
1E4, 1.8E4, 3.2E4, 5.6E4, 1E5, 1.8E5, 3.2E5, 5.6E5, 1E6, 1.8E6,
3.2E6, 5.6E6, 1E7 };
double MRST::lqq[] =
{ 0.0, 1.25, 1.5, 2., 2.5, 3.2, 4., 5., 6.4, 8., 10., 12., 18., 26., 40.,
64., 1E2, 1.6E2, 2.4E2, 4E2, 6.4E2, 1E3, 1.8E3, 3.2E3, 5.6E3,
1E4, 1.8E4, 3.2E4, 5.6E4, 1E5, 1.8E5, 3.2E5, 5.6E5, 1E6, 1.8E6,
3.2E6, 5.6E6, 1E7 };
double MRST::n0[] =
{0,3,4,5,9,9,9,9,9};
bool MRST::initialized = false;
diff --git a/PDF/Makefile.am b/PDF/Makefile.am
--- a/PDF/Makefile.am
+++ b/PDF/Makefile.am
@@ -1,70 +1,70 @@
pkglib_LTLIBRARIES = HwMRST.la
HwMRST_la_SOURCES = \
MRST.cc MRST.h MRST.icc
## add this to produce tests of the PDFs
## HwMRST_la_CPPFLAGS=$(AM_CPPFLAGS) -DMRST_TESTING
HwMRST_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 7:0:0
EXTRA_DIST = mrst diffraction
pkglib_LTLIBRARIES += HwPomeronPDF.la
HwPomeronPDF_la_SOURCES = \
PomeronPDF.cc PomeronPDF.h
## add this to produce tests of the PDFs
## HwDIFFRACTIVEPDF_la_CPPFLAGS=$(AM_CPPFLAGS) -DDIFFRACTIVEPDF_TESTING
HwPomeronPDF_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0
pkglib_LTLIBRARIES += HwReggeonPDF.la
HwReggeonPDF_la_SOURCES = \
ReggeonPDF.cc ReggeonPDF.h
## add this to produce tests of the PDFs
## HwDIFFRACTIVEPDF_la_CPPFLAGS=$(AM_CPPFLAGS) -DDIFFRACTIVEPDF_TESTING
HwReggeonPDF_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0
pkglib_LTLIBRARIES += HwPomeronFlux.la
HwPomeronFlux_la_SOURCES = \
PomeronFlux.h PomeronFlux.cc
-HwPomeronFlux_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0
+HwPomeronFlux_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 2:0:0
## bound into HwShower.la
noinst_LTLIBRARIES = libHwRemDecayer.la
libHwRemDecayer_la_SOURCES = \
HwRemDecayer.h HwRemDecayer.cc HwRemDecayer.fh
## bound into HwShower.la
noinst_LTLIBRARIES += libHwMPIPDF.la
libHwMPIPDF_la_SOURCES = \
MPIPDF.h MPIPDF.cc MPIPDF.fh \
MinBiasPDF.h MinBiasPDF.cc MinBiasPDF.fh
pkglib_LTLIBRARIES += HwSatPDF.la
HwSatPDF_la_SOURCES = \
SatPDF.h SatPDF.cc
HwSatPDF_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 4:0:0
pkglib_LTLIBRARIES += HwIncomingPhotonEvolver.la
HwIncomingPhotonEvolver_la_SOURCES = \
IncomingPhotonEvolver.h IncomingPhotonEvolver.cc
HwIncomingPhotonEvolver_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 4:0:0
if WANT_LOCAL_PDF
install-data-local:
for i in `find $(srcdir)/mrst -name '*.dat'`; \
do \
$(install_sh_DATA) $$i $(DESTDIR)$(pkgdatadir)/PDF/$${i#$(srcdir)/}; \
done
for i in `find $(srcdir)/diffraction -name '*.data'`; \
do \
$(install_sh_DATA) $$i $(DESTDIR)$(pkgdatadir)/PDF/$${i#$(srcdir)/}; \
done
uninstall-local:
rm -rf $(DESTDIR)$(pkgdatadir)/PDF
endif
dist-hook:
rm -rf `find $(distdir)/mrst -name '.svn' -or -name '.cvsignore' -or -name 'CVS'`
rm -rf `find $(distdir)/diffraction -name '.svn' -or -name '.cvsignore' -or -name 'CVS'`
diff --git a/PDF/PomeronFlux.cc b/PDF/PomeronFlux.cc
--- a/PDF/PomeronFlux.cc
+++ b/PDF/PomeronFlux.cc
@@ -1,244 +1,263 @@
// -*- C++ -*-
//
// This is the implementation of the non-inlined, non-templated member
// functions of the PomeronFlux class.
//
#include "PomeronFlux.h"
#include "ThePEG/Utilities/Maths.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/StandardModel/StandardModelBase.h"
#include "ThePEG/Repository/EventGenerator.h"
using namespace ThePEG;
using namespace Herwig;
PomeronFlux::PomeronFlux()
: q2min_(ZERO) , q2max_(10.*GeV2),
+ xiMin_(1.0e-7) , xiMax_(1.0),
alfa0P_(1.104) , alfapP_(0.06/GeV2),
betaP_(5.5/GeV2), normP_(1./GeV2),
alfa0R_(0.5) , alfapR_(0.3/GeV2),
betaR_(1.6/GeV2), normR_(1./GeV2),
nR_(0.0013) , PDFFit_(0)
{}
bool PomeronFlux::canHandleParticle(tcPDPtr particle) const {
return ( abs(particle->id()) == ParticleID::pplus );
}
cPDVector PomeronFlux::partons(tcPDPtr) const {
cPDVector ret;
ret.push_back(getParticleData( ParticleID::pomeron));
ret.push_back(getParticleData( ParticleID::reggeon));
return ret;
}
double PomeronFlux::xfl(tcPDPtr, tcPDPtr parton, Energy2 qq,
double l, Energy2 ) const {
// extra factor of Q^2 to cancel jacobian and sort out dimensions
if(parton->id()==ParticleID::pomeron)
return normP_*qq*exp(-(betaP_ + 2.*alfapP_*l)*qq + 2.*(alfa0P_ - 1)*l);
else if(parton->id()==ParticleID::reggeon)
return nR_*normR_*qq*exp(-(betaR_ + 2.*alfapR_*l)*qq + 2.*(alfa0R_ - 1)*l);
else {
assert(false);
return 0.;
}
}
double PomeronFlux::xfvl(tcPDPtr, tcPDPtr, Energy2, double,
Energy2) const {
// valence density is zero
return 0.0;
}
ClassDescription<PomeronFlux>
PomeronFlux::initPomeronFlux;
// Definition of the static class description member.
void PomeronFlux::Init() {
static ClassDocumentation<PomeronFlux> documentation
("The PomeronFlux provides the PDF for a pomeron inside"
" an incoming proton");
static Parameter<PomeronFlux,Energy2> interfaceQ2Min
("Q2Min",
- "Minimum value of the magnitude of Q^2 for the photon",
+ "Minimum value of the magnitude of Q^2 for the pomeron/reggeon",
&PomeronFlux::q2min_, GeV2, ZERO, ZERO, 100.0*GeV2,
false, false, Interface::limited);
static Parameter<PomeronFlux,Energy2> interfaceQ2Max
("Q2Max",
- "Maximum value of the magnitude of Q^2 for the photon",
+ "Maximum value of the magnitude of Q^2 for the pomeron/reggeon",
&PomeronFlux::q2max_, GeV2, 4.0*GeV2, ZERO, 100.0*GeV2,
false, false, Interface::limited);
+ static Parameter<PomeronFlux,double> interfaceXiMin
+ ("XiMin",
+ "Minimum value of the pomeron/reggeon xi",
+ &PomeronFlux::xiMin_, 1.0e-7 , 0., 1.,
+ false, false, Interface::limited);
+
+ static Parameter<PomeronFlux,double> interfaceXiMax
+ ("XiMax",
+ "Maximum value of the pomeron/reggeon xi",
+ &PomeronFlux::xiMax_, 1., 0., 1.,
+ false, false, Interface::limited);
+
static Parameter<PomeronFlux,double> interfaceAlpha0Pomeron
("Alpha0Pomeron",
"The coefficient of the intercept of alpha pomeron",
&PomeronFlux::alfa0P_, 1.104, 0.0, 0,
true, false, Interface::lowerlim);
static Parameter<PomeronFlux,InvEnergy2> interfaceAlphaPrimePomeron
("AlphaPrimePomeron",
"The coefficient of the t dependence of alpha of pomeron",
&PomeronFlux::alfapP_, 1./GeV2, 0.06/GeV2, 0./GeV2, 1./GeV2,
false, false, Interface::limited);
static Parameter<PomeronFlux,InvEnergy2> interfaceBPomeron
("BPomeron",
"The coefficient of the t dependence of the exponential term of pomeron",
&PomeronFlux::betaP_, 1./GeV2, 5.5/GeV2, 0./GeV2, 10./GeV2,
false, false, Interface::limited);
static Parameter<PomeronFlux,double> interfaceAlpha0Reggeon
("Alpha0Reggeon",
"The coefficient of the intercept of alpha reggeon",
&PomeronFlux::alfa0R_, 0.5, 0.0, 0,
true, false, Interface::lowerlim);
static Parameter<PomeronFlux,InvEnergy2> interfaceAlphaPrimeReggeon
("AlphaPrimeReggeon",
"The coefficient of the t dependence of alpha of reggeon",
&PomeronFlux::alfapR_, 1./GeV2, 0.3/GeV2, 0./GeV2, 1./GeV2,
false, false, Interface::limited);
static Parameter<PomeronFlux,InvEnergy2> interfaceBReggeon
("BReggeon",
"The coefficient of the t dependence of the exponential term reggeon",
&PomeronFlux::betaR_, 1/GeV2, 1.6/GeV2, 0./GeV2, 10./GeV2,
false, false, Interface::limited);
static Parameter<PomeronFlux,double> interfacenR
("nR",
"Reggeon flux factor",
&PomeronFlux::nR_, 0.0017, 0.0, 0,
true, false, Interface::lowerlim);
static Switch<PomeronFlux,int> interfacePDFFit
("PDFFit",
"The pomeron/regeon flux parameters are set according"
" to choice of pomeron/regeon structure function fit. ",
&PomeronFlux::PDFFit_, 0, false, false);
static SwitchOption interfacePDFFitUser
(interfacePDFFit,
"User",
"Default (set for fit Hera 2007) or user setting.",
0);
static SwitchOption interfacePDFFitPomeron2007
(interfacePDFFit,
"Pomeron2007",
"Pomeron structure function fit is Hera 2007.",
1);
static SwitchOption interfacePDFFitPomeron2006A
(interfacePDFFit,
"Pomeron2006A",
"Pomeron structure function fit is Hera 2006 A.",
2);
static SwitchOption interfacePDFFitPomeron2006B
(interfacePDFFit,
"Pomeron2006B",
"Pomeron structure function fit is Hera 2006 B.",
3);
}
double PomeronFlux::flattenScale(tcPDPtr proton, tcPDPtr parton, const PDFCuts & c,
double l, double z, double & jacobian) const {
double x = exp(-l);
Energy2 qqmax = min(q2max_,0.25*sqr(x)*c.sMax());
Energy2 qqmin = max(q2min_, sqr(proton->mass()*x)/(1-x));
if(qqmin>=qqmax) {
jacobian = 0.;
return 0.;
}
InvEnergy2 k =ZERO;
if(parton->id()==ParticleID::pomeron)
k = betaP_ + 2.*l*alfapP_;
else if(parton->id()==ParticleID::reggeon)
k = betaR_ + 2.*l*alfapR_;
else assert(false);
double rho = exp(-k*qqmax) + z * ( exp(-k*qqmin) - exp(-k*qqmax) );
Energy2 scale = -log(rho)/k;
// jacobian factor (1/Q^2max_)(dQ^2/dz) / Q^2 (to make dimensionless)
jacobian *= (exp(-k*qqmin) - exp(-k*qqmax))/(rho*k*scale);
// return Q^2/Q^2_max
return scale/c.scaleMaxL(l);
}
-double PomeronFlux::flattenL(tcPDPtr, tcPDPtr parton, const PDFCuts & c,
+double PomeronFlux::flattenL(tcPDPtr, tcPDPtr parton, const PDFCuts&,
double z, double & jacobian) const {
+
+ const double lMax = -log(xiMin_);
+ const double lMin = -log(xiMax_);
+
+ // cout<<"lMin "<<lMin<<" lMax "<<lMax<<endl;
+
if(parton->id()==ParticleID::pomeron) {
- jacobian *= c.lMax() - c.lMin();
- return c.lMin() + z*(c.lMax() - c.lMin());
+ jacobian *= lMax - lMin;
+ return lMin + z*(lMax - lMin);
}
else if(parton->id()==ParticleID::reggeon) {
double k = 2.*(alfa0R_ - 1.);
- double rho =exp(k*c.lMin()) + z*(exp(k*c.lMax()) - exp(k*c.lMin()));
- jacobian *= (exp(k*c.lMax()) - exp(k*c.lMin()))/(rho*k);
+ double rho =exp(k*lMin) + z*(exp(k*lMax) - exp(k*lMin));
+ jacobian *= (exp(k*lMax) - exp(k*lMin))/(rho*k);
return log(rho)/k;
}
else {
assert(false);
return 0.;
}
}
Energy2 PomeronFlux::intxFx(double x, Energy2 qqmin, Energy2 qqmax,
double alfa0, InvEnergy2 alfap, InvEnergy2 beta) const {
InvEnergy2 k = beta - 2.*log(x)*alfap;
return exp(-2.*(alfa0 - 1.)*log(x))*(exp(-qqmin*k) - exp(-qqmax*k))/k;
}
void PomeronFlux::persistentOutput(PersistentOStream & os) const {
- os << ounit(q2min_,GeV2) << ounit(q2max_,GeV2) << alfa0P_
+ os << ounit(q2min_,GeV2) << ounit(q2max_,GeV2) << xiMin_ << xiMax_ << alfa0P_
<< ounit(alfapP_,1./GeV2) << ounit(betaP_,1./GeV2) << ounit(normP_,1./GeV2)
<< alfa0R_ << ounit(alfapR_,1./GeV2) << ounit(betaR_,1./GeV2)
<< ounit(normR_,1./GeV2) << nR_ << PDFFit_;
}
void PomeronFlux::persistentInput(PersistentIStream & is, int) {
- is >> iunit(q2min_,GeV2) >> iunit(q2max_,GeV2) >> alfa0P_
+ is >> iunit(q2min_,GeV2) >> iunit(q2max_,GeV2) >> xiMin_ >> xiMax_ >> alfa0P_
>> iunit(alfapP_,1./GeV2) >> iunit(betaP_,1./GeV2) >> iunit(normP_,1./GeV2)
>> alfa0R_ >> iunit(alfapR_,1./GeV2) >> iunit(betaR_,1./GeV2)
>> iunit(normR_,1./GeV2) >> nR_ >> PDFFit_;
}
void PomeronFlux::doinit() {
PDFBase::doinit();
setFluxPar();
// compute the normalisation factor
double xp = 0.003;
Energy2 tkinmin = sqr(getParticleData(ParticleID::pplus)->mass()*xp)/(1-xp);
normP_ = 1./(intxFx(xp,tkinmin , 1.*GeV2, alfa0P_, alfapP_, betaP_ ));
normR_ = 1./(intxFx(xp,tkinmin , 1.*GeV2, alfa0R_, alfapR_, betaR_ ));
}
void PomeronFlux::setFluxPar() {
switch(PDFFit_){
case 0:
break;
case 1:
alfa0P_ = 1.104;
nR_ = 0.0013;
break;
case 2:
alfa0P_ = 1.118;
nR_ = 0.0017;
break;
case 3:
alfa0P_ = 1.111;
nR_ = 0.0014;
break;
default:
throw Exception() << "Invalid fit in PomeronFlux::setFluxPar()"
<< Exception::runerror;
}
}
diff --git a/PDF/PomeronFlux.h b/PDF/PomeronFlux.h
--- a/PDF/PomeronFlux.h
+++ b/PDF/PomeronFlux.h
@@ -1,276 +1,286 @@
// -*- C++ -*-
#ifndef Herwig_PomeronFlux_H
#define Herwig_PomeronFlux_H
//
// This is the declaration of the PomeronFlux class.
//
#include "ThePEG/PDF/PDFBase.h"
namespace Herwig {
using namespace ThePEG;
/**
* Here is the documentation of the PomeronFlux class.
*
* @see \ref PomeronFluxInterfaces "The interfaces"
* defined for PomeronFlux.
*/
class PomeronFlux: public PDFBase {
public:
/**
* Default constructor
*/
PomeronFlux();
/** @name Virtual functions to be overridden by sub-classes. */
//@{
/**
* Return true if this PDF can handle the extraction of partons from
* the given \a particle.
*/
virtual bool canHandleParticle(tcPDPtr particle) const;
/**
* Return the partons which this PDF may extract from the given
* \a particle.
*/
virtual cPDVector partons(tcPDPtr particle) const;
/**
* The density. Return the pdf for the given \a parton inside the
* given \a particle for the virtuality \a partonScale and
* logarithmic momentum fraction \a l \f$(l=\log(1/x)\f$. The \a
* particle is assumed to have a virtuality \a particleScale.
*/
virtual double xfl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
double l, Energy2 particleScale = ZERO) const;
/**
* The valence density. Return the pdf for the given cvalence \a
* parton inside the given \a particle for the virtuality \a
* partonScale and logarithmic momentum fraction \a l
* \f$(l=\log(1/x)\f$. The \a particle is assumed to have a
* virtuality \a particleScale. If not overidden by a sub class this
* will return zero.
*/
virtual double xfvl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale,
double l, Energy2 particleScale = ZERO) const;
/**
* Generate scale (as a fraction of the maximum scale). If the PDF
* contains strange peaks which can be difficult to handle, this
* function may be overwritten to return an appropriate scale
* \f$Q^2/Q^2_{\max}\f$ for a \a z uniformly distributed in
* ]0,1[. Also the jacobobian of the \f$Q^2/Q^2_{\max}\rightarrow
* z\f$ variable transformation must multiply the \a jacobian
* argument. The default version will simply use the function
* \f$Q^2/Q^2_{\max} = (Q^2_{\max}/Q^2_{\min})^(z-1)\f$ or, if
* \f$Q^2_{\min}\f$ is zero, \f$Q^2/Q^2_{\max} = z\f$ (where the
* limits are set by \a cut).
*/
virtual double flattenScale(tcPDPtr particle, tcPDPtr parton,
const PDFCuts & cut, double l, double z,
double & jacobian) const;
/**
* Generate a momentum fraction. If the PDF contains strange peaks
* which can be difficult to handle, this function may be
* overwritten to return an appropriate \f$l=\log(1/x)\f$ for a \a z
* uniformly distributed in ]0,1[. Also the jacobobian of the
* \f$l\rightarrow z\f$ variable transformation must in the function
* multiply the \a jacobian argument. The default version will
* simply use the function \f$l(z) = l_{\min} +
* z*(l_{\max}-l_{\min})\f$ (where the limits are set by \a cut).
*/
virtual double flattenL(tcPDPtr particle, tcPDPtr parton, const PDFCuts &cut,
double z, double & jacobian) 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();
/**
* Set normalization constant Ap of the pomeron flux.
*/
virtual void doinit();
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is an concrete class without persistent data.
*/
static ClassDescription<PomeronFlux> initPomeronFlux;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
PomeronFlux & operator=(const PomeronFlux &);
private:
/**
* Integrated pomeron/regeon flux over qq in the range qqmin ... qqmax
* (with normalization constant Ap = 1 GeV2).
* The flux normalization constant is obtained \f$x_p*intFx_p = 1\f$,
* where x_p = 0.003.
*/
Energy2 intxFx(double x, Energy2 qqmin, Energy2 qqmax,
double alfa0, InvEnergy2 alfap, InvEnergy2 beta) const;
/**
* Helper function in doinit() which sets the parameters of the
* pomeron/regeon flux according to user setup.
*/
void setFluxPar();
private:
/**
- * Minimum \f$Q^2\f$ for the photon
+ * Minimum \f$Q^2\f$ for the pomeron/reggeon
*/
Energy2 q2min_;
/**
- * Maximum \f$Q^2\f$ for the photon
+ * Maximum \f$Q^2\f$ for the pomeron/reggeon
*/
Energy2 q2max_;
/**
+ * Cut on the minimum xi
+ */
+ double xiMin_;
+
+ /**
+ * Cut on the maximum xi
+ */
+ double xiMax_;
+
+ /**
* Pomeron intercept
*/
double alfa0P_;
/**
* Pomeron slope
*/
InvEnergy2 alfapP_;
/**
* Parameter of pomeron flux Bp
*/
InvEnergy2 betaP_;
/**
* Normalization constant of the pomeron flux
*/
InvEnergy2 normP_;
/**
* Reggeon intercept
*/
double alfa0R_;
/**
* Reggeon slope
*/
InvEnergy2 alfapR_;
/**
* Parameter of reggeon flux Bp
*/
InvEnergy2 betaR_;
/**
* Normalization constant of the reggeon flux
*/
InvEnergy2 normR_;
/**
* Factor of the pomeron flux
*/
double nR_;
/**
* Switch between pomeron/regeon structure function fits.
* The flux parameters are set according to the fit choice.
*/
int PDFFit_;
};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of PomeronFlux. */
template <>
struct BaseClassTrait<Herwig::PomeronFlux,1> {
/** Typedef of the first base class of PomeronFlux. */
typedef PDFBase NthBase;
};
/** This template specialization informs ThePEG about the name of
* the PomeronFlux class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::PomeronFlux>
: public ClassTraitsBase<Herwig::PomeronFlux> {
/** Return a platform-independent class name */
static string className() { return "Herwig::PomeronFlux"; }
/**
* The name of a file containing the dynamic library where the class
* PomeronFlux is implemented. It may also include several, space-separated,
* libraries if the class PomeronFlux depends on other classes (base classes
* excepted). In this case the listed libraries will be dynamically
* linked in the order they are specified.
*/
static string library() { return "HwPomeronFlux.so"; }
};
/** @endcond */
}
#endif /* Herwig_PomeronFlux_H */
diff --git a/PDT/SMHiggsWidthGenerator.cc b/PDT/SMHiggsWidthGenerator.cc
--- a/PDT/SMHiggsWidthGenerator.cc
+++ b/PDT/SMHiggsWidthGenerator.cc
@@ -1,396 +1,396 @@
// -*- C++ -*-
//
// SMHiggsWidthGenerator.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SMHiggsWidthGenerator class.
//
#include "SMHiggsWidthGenerator.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/StandardModel/StandardModelBase.h"
using namespace Herwig;
IBPtr SMHiggsWidthGenerator::clone() const {
return new_ptr(*this);
}
IBPtr SMHiggsWidthGenerator::fullclone() const {
return new_ptr(*this);
}
void SMHiggsWidthGenerator::persistentOutput(PersistentOStream & os) const {
os << widthopt_ << offshell_ << ounit(mw_,GeV) << ounit(mz_,GeV)
<< ounit(gamw_,GeV) << ounit(gamz_,GeV) << ounit(qmass_,GeV)
<< ounit(lmass_,GeV) << sw2_ << ca_ << cf_ << locMap_;
}
void SMHiggsWidthGenerator::persistentInput(PersistentIStream & is, int) {
is >> widthopt_ >> offshell_ >> iunit(mw_,GeV) >> iunit(mz_,GeV)
>> iunit(gamw_,GeV) >> iunit(gamz_,GeV) >> iunit(qmass_,GeV)
>> iunit(lmass_,GeV) >> sw2_ >> ca_ >> cf_ >> locMap_;
}
ClassDescription<SMHiggsWidthGenerator> SMHiggsWidthGenerator::initSMHiggsWidthGenerator;
// Definition of the static class description member.
void SMHiggsWidthGenerator::Init() {
static ClassDocumentation<SMHiggsWidthGenerator> documentation
("The SMHiggsWidthGenerator class calculates the running Higgs width as in "
"hep-ph/9505211.",
"The Higgs width was calculated as in \\cite{Seymour:1995qg}.",
"%\\cite{Seymour:1995qg}\n"
"\\bibitem{Seymour:1995qg}\n"
" M.~H.~Seymour,\n"
" %``The Higgs boson line shape and perturbative unitarity,''\n"
" Phys.\\ Lett.\\ B {\\bf 354}, 409 (1995)\n"
" [arXiv:hep-ph/9505211].\n"
" %%CITATION = PHLTA,B354,409;%%\n"
);
static Switch<SMHiggsWidthGenerator,unsigned int> interfaceWidthOption
("WidthScheme",
"Option for the treatment of the Higss Width calculation",
&SMHiggsWidthGenerator::widthopt_, 2, false, false);
static SwitchOption interfaceFixedWidth
(interfaceWidthOption,
"Fixed",
"Fixed Higgs width, taken from ThePEGParticles.in",
1);
static SwitchOption interfaceNLLWidth
(interfaceWidthOption,
"NLLcorrected",
"NLL corrected Higgs width (a-la FORTRAN HERWIG)",
2);
static SwitchOption interfaceLOWidthOption
(interfaceWidthOption,
"LO",
"LO Higgs width (formula taken from The \"Higgs Hunter's Guide\")",
3);
static Parameter<SMHiggsWidthGenerator,double> interfaceOffShell
("OffShell",
"Number of times the width the Higgs is allowed to be off-shell",
&SMHiggsWidthGenerator::offshell_, 10., 0.01, 100.0,
false, false, Interface::limited);
}
Energy SMHiggsWidthGenerator::width(const ParticleData & in, Energy m) const {
if(widthopt_==1) {
return in.width();
}
else if(widthopt_ <=3 ) {
Energy higgswidth = ZERO;
for (unsigned int i = 0; i < decayModes().size(); ++i)
higgswidth += partialWidth(i,m);
return higgswidth;
}
else
throw Exception() << "Unknown width option in SMHiggsWidthGenerator::width()"
<< Exception::runerror;
}
DecayMap SMHiggsWidthGenerator::rate(const ParticleData & p) const {
if(mw_==ZERO) return p.decaySelector();
else return branching(p.mass(),p);
}
DecayMap SMHiggsWidthGenerator::rate(const Particle & p) {
return branching(p.mass(),p.data());
}
DecayMap SMHiggsWidthGenerator::branching(Energy scale,
const ParticleData & p) const {
// if not using running width return original
if(widthopt_==1) return p.decaySelector();
// calculate the partial widths
vector<Energy> partial;
Energy total(ZERO);
for(unsigned int ix=0;ix<decayModes().size();++ix) {
partial.push_back(partialWidth(ix,scale));
total+=partial.back();
}
// produce the new decay selector
DecayMap newdm;
for(unsigned int ix=0;ix<decayModes().size();++ix) {
tDMPtr mode = decayModes()[ix];
if(mode->orderedProducts().size()!=2||!mode->on()) continue;
double br = partial[ix]/total;
// insert the mode into the new selector
newdm.insert(br,mode);
}
return newdm;
}
// Taken from HERWIG 6510.
Complex SMHiggsWidthGenerator::HwW2(double tau) const {
using Constants::pi;
if (tau > 1.0) {
return sqr(asin(1.0/sqrt(tau)));
}
else if (tau < 1.0) {
double FNsqr = sqrt(1-tau);
double FNlog = log((1+FNsqr)/(1-FNsqr));
return Complex(-0.25 * (sqr(FNlog)-pi*pi),0.5*pi*FNlog);
}
else {
return sqr(0.5*pi);
}
}
Energy SMHiggsWidthGenerator::partialWidth(int iloc,Energy Mh) const {
useMe();
using Constants::pi;
if(Mh!=qlast_) {
qlast_ = Mh;
Energy2 q2 = sqr(qlast_);
// couplings
lambdaQCD_ = generator()->standardModel()->LambdaQCD(q2);
alphaEM_ = generator()->standardModel()->alphaEM();
alphaS_ = generator()->standardModel()->alphaS(q2);
// QCD correction factors for H -> f fbar
double nflavour=0.;
for (unsigned int i =1; i <= 6; ++i)
if (2.0*qmass_[i] < Mh) nflavour+=1.;
// All calculation are being done for Monte-Carlo QCD Lambda, except Higgs width...
// not needed in C++ as should be normal lambda
// MC only in shower
//double bcoeff4=(11.*ca_-10.)/(12.*pi);
//double kfac=ca_*(67./18.-sqr(pi)/6.)-25./9.;
//lambdaQCD_ /= exp(kfac/(4.*pi*bcoeff4))/sqrt(2.);
double k1 = 5./sqr(pi);
double k0 = 3./(4.*sqr(pi));
beta0_ = (11.*ca_-2.0*nflavour)/3.;
double beta1 = (34.*sqr(ca_)-(10.*ca_+6.*cf_)*nflavour)/3.;
gam0_ = -8.;
double gam1 = -404./3.+40.*nflavour/9.;
double SClog = log(sqr(Mh/lambdaQCD_));
if(SClog<=0.)
cd_ = 1.;
else
cd_ = 1.+(k1/k0-2.*gam0_+gam0_*beta1/sqr(beta0_)*log(SClog)+
(gam0_*beta1-gam1*beta0_)/sqr(beta0_))/(beta0_*SClog);
gfermiinv_ = 8.*sw2_*sqr(mw_)/alphaEM_;
}
// output value
Energy3 output(ZERO);
// work out which mode
map<int,int>::const_iterator it = locMap_.find(iloc);
if(it==locMap_.end()) return ZERO;
int imode = it->second;
// quark modes
if(imode<=6) {
Energy mf = qmass_[imode];
double xf = sqr(mf/Mh);
if( xf >= 0.25 ) return ZERO;
if(widthopt_==2) {
if (mf > lambdaQCD_) mf *= pow(log(Mh/lambdaQCD_)/log(mf/lambdaQCD_),
gam0_/(2.0*beta0_));
output = ca_*Mh*sqr(mf)*pow(1.0-4.0*xf,1.5)*cd_;
}
else {
output = ca_*Mh*sqr(mf)*pow(1.0-4.0*xf,1.5);
}
}
// lepton modes
else if(imode<=9) {
Energy mf = lmass_[imode-7];
double xf = sqr(mf/Mh);
if (xf < 0.25) output = Mh*sqr(mf)*pow(1.0-4.0*xf,1.5);
}
// H->W*W*
else if(imode==10) {
if(widthopt_==2) {
double xw = sqr(mw_/Mh);
double yw = mw_*gamw_/sqr(Mh);
output = pow<3,1>(Mh)*HwDoubleBW(xw,yw)/2.;
}
else {
double xfw = sqr(mw_/Mh);
if(2.0*mw_ < Mh) output = pow<3,1>(Mh)*sqrt(1-4.0*xfw)*(1-xfw+0.75*sqr(xfw))/2.;
}
}
// H->Z*Z*
else if(imode==11) {
if(widthopt_==2) {
double xz = sqr(mz_/Mh);
double yz = mz_*gamz_/sqr(Mh);
output = pow<3,1>(Mh)*HwDoubleBW(xz,yz)/4.;
}
else {
double xfz = sqr(mz_/Mh);
if (2.0*mz_ < Mh) output = pow<3,1>(Mh)*sqrt(1-4.0*xfz)*(1-xfz+0.75*sqr(xfz))/4.;
}
}
// H->gamma gamma
else if(imode==12) {
double taut = sqr(2.0*qmass_[ParticleID::t]/Mh);
double tauw = sqr(2.0*mw_/Mh);
Complex ftaut = HwW2 (taut);
Complex ftauw = HwW2 (tauw);
double re = 4.0/3.0*(-2.0*taut*(1.0+(1.0-taut)*ftaut.real())) +
(2.0+3.0*tauw*(1+(2.0-tauw)*ftauw.real()));
double im = 4.0/3.0*(-2.0*taut*( (1.0-taut)*ftaut.imag())) +
( 3.0*tauw*( (2.0-tauw)*ftauw.imag()));
output = sqr(alphaEM_/pi)*pow<3,1>(Mh)*(sqr(re)+ sqr(im))/32.;
}
// H -> gg
else if(imode==13) {
double tau = sqr(2.0*qmass_[ParticleID::t]/Mh);
Complex ftau = HwW2(tau);
double re = 1+(1.0-tau)*ftau.real();
double im = (1.0-tau)*ftau.imag();
output = sqr(alphaS_/pi)*pow<3,1>(Mh)*sqr(tau)*(sqr(re)+ sqr(im))/4.;
}
return output/gfermiinv_;
}
// Taken from HERWIG 6510.
double SMHiggsWidthGenerator::HwDoubleBW(double x, double y) const {
// Calculate the Double Breit-Wigner Integral
// x=(mw/mh)**2, y=mw*gw/mh**2
double limit = 0.425;
double nbin = 25;
double itgerl = 0.0;
if (y < 0.0) return itgerl;
if (x > limit) {
// Direct Integration
double fac1 = 0.25/nbin;
for (unsigned int i = 0; i < nbin; ++i) {
double x1 = (i+0.5)*fac1;
double fac2 = (sqr(1-sqrt(x1))-x1)/nbin;
double sq = 1.0;
int j = 0;
while (j < nbin && 0.0 < sq) {
double x2 = (j+0.5)*fac2+x1;
sq = 1.0+x1*x1+x2*x2-2*(x1+x2+x1*x2);
itgerl += 2.0*(sqr(1-x1-x2)+8.0*x1*x2)*sqrt(sq)
/(sqr(x1-x)+y*y)*y/(sqr(x2-x)+y*y)*y*fac1*fac2;
++j;
}
}
}
else {
// Integration using tan theta substitution
double th1low = atan2 ((0.0-x),y);
double th1high = atan2 ((1.0-x),y);
double fac1 = (th1high-th1low)/nbin;
for (unsigned int i = 0; i < nbin; ++i) {
double th1 = (i+0.5)*fac1+th1low;
double x1 = y*tan(th1)+x;
double x2max = min(x1,sqr(1-sqrt(x1)));
double th2low = atan2 ((0-x),y);
double th2high = atan2 ((x2max-x),y);
double fac2 = (th2high-th2low)/nbin;
double sq = 1.0;
int j = 0;
while (j < nbin && 0.0 < sq) {
double th2 = (j+0.5)*fac2+th2low;
double x2 = y*tan(th2)+x;
double sq = 1.0+x1*x1+x2*x2-2*(x1+x2+x1*x2);
itgerl += 2.0*(sqr(1-x1-x2)+8*x1*x2)*sqrt(sq)*fac1*fac2;
++j;
}
}
}
itgerl *= 1/sqr(Constants::pi);
return itgerl;
}
void SMHiggsWidthGenerator::doinit() {
GenericWidthGenerator::doinit();
// extract W and Z mass and width
tPDPtr w = getParticleData(ParticleID::Wplus);
tPDPtr z = getParticleData(ParticleID::Z0);
mw_ = w->mass();
mz_ = z->mass();
gamw_ = w->width();
gamz_ = z->width();
// quark masses
for(int ix=1;ix<7;++ix) {
tcPDPtr q = getParticleData(ix);
qmass_[ix] = q->mass();
}
// lepton masses
for ( int ix=0; ix<3; ++ix ) {
tcPDPtr lepton = getParticleData(11+2*ix);
lmass_[ix] = lepton->mass();
}
// sin2 theta_w
sw2_ = generator()->standardModel()->sin2ThetaW();
// casmirs
double ncolour = generator()->standardModel()->Nc();
ca_ = ncolour;
cf_ = (sqr(ncolour)-1.0)/(2.0*ca_);
// construct the map
for(unsigned int ix=0;ix<decayModes().size();++ix) {
tDMPtr mode = decayModes()[ix];
if(mode->orderedProducts().size()!=2) continue;
// particle antiparticle
long id=abs(mode->orderedProducts()[0]->id());
if(mode->orderedProducts()[0]->id()==-mode->orderedProducts()[1]->id()) {
- // do nothing for quarks.
// leptons
if(id>=11&&id<=15&&(id-9)%2==0)
id = (id+3)/2;
// WW
else if(id==ParticleID::Wplus)
id = 10;
// unknown mode
- else continue;
+ else if(id>6)
+ continue;
}
else if(mode->orderedProducts()[0]->id()==mode->orderedProducts()[1]->id()) {
// gamma gamma
if(id==ParticleID::Z0) id = 11;
else if(id==ParticleID::gamma) id = 12;
else if(id==ParticleID::g) id = 13;
// unknown mode
else continue;
}
// unknown mode
else continue;
// set pu the map
locMap_[ix] = id;
}
// reset the width and set the limits
if(particle()->id() != ParticleID::h0)
throw Exception() << "Must be the Standard Model Higgs boson "
<< "in SMHiggsWidthGenerator::doinit()"
<< Exception::runerror;
Energy wid = width(*particle(),particle()->mass());
particle()->width (wid);
particle()->widthCut(offshell_*wid);
}
pair<Energy,Energy> SMHiggsWidthGenerator::width(Energy scale,
const ParticleData & p) const {
if(widthopt_==1) return make_pair(p.width(),p.width());
// calculate the partial widths
vector<Energy> partial;
Energy total(ZERO);
for(unsigned int ix=0;ix<decayModes().size();++ix) {
partial.push_back(partialWidth(ix,scale));
total += partial.back();
}
// sum for the on modes
Energy partialon(ZERO);
for(unsigned int ix=0;ix<decayModes().size();++ix) {
tDMPtr mode= decayModes()[ix];
if(!mode->on()||mode->orderedProducts().size()!=2) continue;
partialon += partial[ix];
}
return make_pair(partialon,total);
}
diff --git a/README b/README
--- a/README
+++ b/README
@@ -1,61 +1,61 @@
==============
-Herwig++ 2.5.1
+Herwig++ 2.5.2
==============
-This is the release of Herwig++ 2.5.1, a multi purpose event
+This is the release of Herwig++ 2.5.2, a multi purpose event
generator for high energy physics.
The Herwig++ distribution contains an adapted version of LoopTools 2.6
<http://www.feynarts.de/looptools/>.
Please contact <herwig@projects.hepforge.org> to be added to our
list of users. This will allow you to make full use of the Wiki and
bug tracker at http://projects.hepforge.org/herwig/trac/
BUILD AND INSTALL
=================
Generic installation instructions are in the file INSTALL.
Before attempting to build Herwig++, you'll need to get ThePEG
installed.
Herwig++ uses some functions from the GNU scientific library GSL. The
gsl libraries and header files must be available on your system.
Usually they can be found in a package called libgsl-dev.
------
ThePEG
------
-Download ThePEG 1.7.1 or later from
+Download ThePEG 1.7.2 or later from
http://projects.hepforge.org/herwig/versions
Do not build this package inside the Herwig++ source directory!
$ tar xjvf ThePEG-*.tar.bz2
$ cd ThePEG*
$ ./configure --prefix=/path/where/ThePEG/should/be/installed
$ make
$ make check
$ make install
Optional configure switches include --enable-unitchecks for checking
dimensional correctness of physical expressions in the code, and
--with-LHAPDF for linking against the LHAPDF library. See './configure
--help' for more details.
--------
Herwig++
--------
Download Herwig++, then
$ tar xjvf Herwig++-*.tar.bz2
$ cd Herwig++*
$ ./configure --prefix=/path/where/Herwig++/should/be/installed --with-thepeg=/path/where/ThePEG/was/installed
$ make
$ make check
$ make install
More detailed instructions can be found on the Herwig++ home page at
http://projects.hepforge.org/herwig/trac/wiki/HerwigInstallation
diff --git a/Shower/Base/Evolver.cc b/Shower/Base/Evolver.cc
--- a/Shower/Base/Evolver.cc
+++ b/Shower/Base/Evolver.cc
@@ -1,1555 +1,1556 @@
// -*- C++ -*-
//
// Evolver.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the Evolver class.
//
#include "Evolver.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Shower/Base/ShowerParticle.h"
#include "ShowerKinematics.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Handlers/EventHandler.h"
#include "ThePEG/Utilities/Throw.h"
#include "ShowerTree.h"
#include "ShowerProgenitor.h"
#include "KinematicsReconstructor.h"
#include "PartnerFinder.h"
#include "ThePEG/Handlers/StandardXComb.h"
#include "ThePEG/PDT/DecayMode.h"
#include "Herwig++/Shower/ShowerHandler.h"
using namespace Herwig;
IBPtr Evolver::clone() const {
return new_ptr(*this);
}
IBPtr Evolver::fullclone() const {
return new_ptr(*this);
}
void Evolver::persistentOutput(PersistentOStream & os) const {
os << _model << _splittingGenerator << _maxtry
<< _meCorrMode << _hardVetoMode << _hardVetoRead << _limitEmissions
<< ounit(_iptrms,GeV) << _beta << ounit(_gamma,GeV) << ounit(_iptmax,GeV)
<< _vetoes << _hardonly << _trunc_Mode << _hardEmissionMode
<< _colourEvolutionMethod;
}
void Evolver::persistentInput(PersistentIStream & is, int) {
is >> _model >> _splittingGenerator >> _maxtry
>> _meCorrMode >> _hardVetoMode >> _hardVetoRead >> _limitEmissions
>> iunit(_iptrms,GeV) >> _beta >> iunit(_gamma,GeV) >> iunit(_iptmax,GeV)
>> _vetoes >> _hardonly >> _trunc_Mode >> _hardEmissionMode
>> _colourEvolutionMethod;
}
ClassDescription<Evolver> Evolver::initEvolver;
// Definition of the static class description member.
void Evolver::Init() {
static ClassDocumentation<Evolver> documentation
("This class is responsible for carrying out the showering,",
"including the kinematics reconstruction, in a given scale range,"
"including the option of the POWHEG approach to simulated next-to-leading order"
" radiation\\cite{Nason:2004rx}.",
"%\\cite{Nason:2004rx}\n"
"\\bibitem{Nason:2004rx}\n"
" P.~Nason,\n"
" ``A new method for combining NLO QCD with shower Monte Carlo algorithms,''\n"
" JHEP {\\bf 0411} (2004) 040\n"
" [arXiv:hep-ph/0409146].\n"
" %%CITATION = JHEPA,0411,040;%%\n");
static Reference<Evolver,SplittingGenerator>
interfaceSplitGen("SplittingGenerator",
"A reference to the SplittingGenerator object",
&Herwig::Evolver::_splittingGenerator,
false, false, true, false);
static Reference<Evolver,ShowerModel> interfaceShowerModel
("ShowerModel",
"The pointer to the object which defines the shower evolution model.",
&Evolver::_model, false, false, true, false, false);
static Parameter<Evolver,unsigned int> interfaceMaxTry
("MaxTry",
"The maximum number of attempts to generate the shower from a"
" particular ShowerTree",
&Evolver::_maxtry, 100, 1, 1000,
false, false, Interface::limited);
static Switch<Evolver, unsigned int> ifaceMECorrMode
("MECorrMode",
"Choice of the ME Correction Mode",
&Evolver::_meCorrMode, 1, false, false);
static SwitchOption off
(ifaceMECorrMode,"No","MECorrections off", 0);
static SwitchOption on
(ifaceMECorrMode,"Yes","hard+soft on", 1);
static SwitchOption hard
(ifaceMECorrMode,"Hard","only hard on", 2);
static SwitchOption soft
(ifaceMECorrMode,"Soft","only soft on", 3);
static Switch<Evolver, unsigned int> ifaceHardVetoMode
("HardVetoMode",
"Choice of the Hard Veto Mode",
&Evolver::_hardVetoMode, 1, false, false);
static SwitchOption HVoff
(ifaceHardVetoMode,"No","hard vetos off", 0);
static SwitchOption HVon
(ifaceHardVetoMode,"Yes","hard vetos on", 1);
static SwitchOption HVIS
(ifaceHardVetoMode,"Initial", "only IS emissions vetoed", 2);
static SwitchOption HVFS
(ifaceHardVetoMode,"Final","only FS emissions vetoed", 3);
static Switch<Evolver, unsigned int> ifaceHardVetoRead
("HardVetoScaleSource",
"If hard veto scale is to be read",
&Evolver::_hardVetoRead, 0, false, false);
static SwitchOption HVRcalc
(ifaceHardVetoRead,"Calculate","Calculate from hard process", 0);
static SwitchOption HVRread
(ifaceHardVetoRead,"Read","Read from XComb->lastScale", 1);
static Parameter<Evolver, Energy> ifaceiptrms
("IntrinsicPtGaussian",
"RMS of intrinsic pT of Gaussian distribution:\n"
"2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS)",
&Evolver::_iptrms, GeV, ZERO, ZERO, 1000000.0*GeV,
false, false, Interface::limited);
static Parameter<Evolver, double> ifacebeta
("IntrinsicPtBeta",
"Proportion of inverse quadratic distribution in generating intrinsic pT.\n"
"(1-Beta) is the proportion of Gaussian distribution",
&Evolver::_beta, 0, 0, 1,
false, false, Interface::limited);
static Parameter<Evolver, Energy> ifacegamma
("IntrinsicPtGamma",
"Parameter for inverse quadratic:\n"
"2*Beta*Gamma/(sqr(Gamma)+sqr(intrinsicpT))",
&Evolver::_gamma,GeV, ZERO, ZERO, 100000.0*GeV,
false, false, Interface::limited);
static Parameter<Evolver, Energy> ifaceiptmax
("IntrinsicPtIptmax",
"Upper bound on intrinsic pT for inverse quadratic",
&Evolver::_iptmax,GeV, ZERO, ZERO, 100000.0*GeV,
false, false, Interface::limited);
static RefVector<Evolver,ShowerVeto> ifaceVetoes
("Vetoes",
"The vetoes to be checked during showering",
&Evolver::_vetoes, -1,
false,false,true,true,false);
static Switch<Evolver,unsigned int> interfaceLimitEmissions
("LimitEmissions",
"Limit the number and type of emissions for testing",
&Evolver::_limitEmissions, 0, false, false);
static SwitchOption interfaceLimitEmissionsNoLimit
(interfaceLimitEmissions,
"NoLimit",
"Allow an arbitrary number of emissions",
0);
static SwitchOption interfaceLimitEmissionsOneInitialStateEmission
(interfaceLimitEmissions,
"OneInitialStateEmission",
"Allow one emission in the initial state and none in the final state",
1);
static SwitchOption interfaceLimitEmissionsOneFinalStateEmission
(interfaceLimitEmissions,
"OneFinalStateEmission",
"Allow one emission in the final state and none in the initial state",
2);
static SwitchOption interfaceLimitEmissionsHardOnly
(interfaceLimitEmissions,
"HardOnly",
"Only allow radiation from the hard ME correction",
3);
static Switch<Evolver,bool> interfaceHardOnly
("HardOnly",
"Only generate the emission supplied by the hardest emission"
" generator, for testing only.",
&Evolver::_hardonly, false, false, false);
static SwitchOption interfaceHardOnlyNo
(interfaceHardOnly,
"No",
"Generate full shower",
false);
static SwitchOption interfaceHardOnlyYes
(interfaceHardOnly,
"Yes",
"Only the hardest emission",
true);
static Switch<Evolver,bool> interfaceTruncMode
("TruncatedShower", "Include the truncated shower?",
&Evolver::_trunc_Mode, 1, false, false);
static SwitchOption interfaceTruncMode0
(interfaceTruncMode,"No","Truncated Shower is OFF", 0);
static SwitchOption interfaceTruncMode1
(interfaceTruncMode,"Yes","Truncated Shower is ON", 1);
static Switch<Evolver,unsigned int> interfaceHardEmissionMode
("HardEmissionMode",
"Whether to use ME corrections or POWHEG for the hardest emission",
&Evolver::_hardEmissionMode, 0, false, false);
static SwitchOption interfaceHardEmissionModeMECorrection
(interfaceHardEmissionMode,
"MECorrection",
"Old fashioned ME correction",
0);
static SwitchOption interfaceHardEmissionModePOWHEG
(interfaceHardEmissionMode,
"POWHEG",
"Powheg style hard emission",
1);
static Switch<Evolver,int> interfaceColourEvolutionMethod
("ColourEvolutionMethod",
"Choice of method for choosing the colour factor in gluon evolution",
&Evolver::_colourEvolutionMethod, 0, false, false);
static SwitchOption interfaceColourEvolutionMethodDefault
(interfaceColourEvolutionMethod,
"Default",
"Colour factor is CA for all scales",
0);
static SwitchOption interfaceColourEvolutionMethodHalfCA
(interfaceColourEvolutionMethod,
"HalfCA",
"Only use half the normal radiation until second scale is reached",
1);
}
void Evolver::generateIntrinsicpT(vector<ShowerProgenitorPtr> particlesToShower) {
_intrinsic.clear();
if ( !ipTon() || !isISRadiationON() ) return;
// don't do anything for the moment for secondary scatters
if( !ShowerHandler::currentHandler()->firstInteraction() ) return;
// generate intrinsic pT
for(unsigned int ix=0;ix<particlesToShower.size();++ix) {
// only consider initial-state particles
if(particlesToShower[ix]->progenitor()->isFinalState()) continue;
if(!particlesToShower[ix]->progenitor()->dataPtr()->coloured()) continue;
Energy ipt;
if(UseRandom::rnd() > _beta) {
ipt=_iptrms*sqrt(-log(UseRandom::rnd()));
}
else {
ipt=_gamma*sqrt(pow(1.+sqr(_iptmax/_gamma), UseRandom::rnd())-1.);
}
pair<Energy,double> pt = make_pair(ipt,UseRandom::rnd(Constants::twopi));
_intrinsic[particlesToShower[ix]] = pt;
}
}
void Evolver::setupMaximumScales(ShowerTreePtr hard,
vector<ShowerProgenitorPtr> p) {
// find out if hard partonic subprocess.
bool isPartonic(false);
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator
cit = _currenttree->incomingLines().begin();
Lorentz5Momentum pcm;
for(; cit!=hard->incomingLines().end(); ++cit) {
pcm += cit->first->progenitor()->momentum();
isPartonic |= cit->first->progenitor()->coloured();
}
// find maximum pt from hard process, the maximum pt from all outgoing
// coloured lines (this is simpler and more general than
// 2stu/(s^2+t^2+u^2)). Maximum scale for scattering processes will
// be transverse mass.
Energy ptmax = -1.0*GeV;
// general case calculate the scale
if (!hardVetoXComb()) {
// scattering process
if(hard->isHard()) {
// coloured incoming particles
if (isPartonic) {
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator
cjt = hard->outgoingLines().begin();
for(; cjt!=hard->outgoingLines().end(); ++cjt) {
if (cjt->first->progenitor()->coloured())
ptmax = max(ptmax,cjt->first->progenitor()->momentum().mt());
}
}
if (ptmax < ZERO) ptmax = pcm.m();
}
// decay, incoming() is the decaying particle.
else {
ptmax = hard->incomingLines().begin()->first
->progenitor()->momentum().mass();
}
}
// hepeup.SCALUP is written into the lastXComb by the
// LesHouchesReader itself - use this by user's choice.
// Can be more general than this.
else {
ptmax = sqrt( ShowerHandler::currentHandler()
->lastXCombPtr()->lastScale() );
}
// set maxHardPt for all progenitors. For partonic processes this
// is now the max pt in the FS, for non-partonic processes or
// processes with no coloured FS the invariant mass of the IS
vector<ShowerProgenitorPtr>::const_iterator ckt = p.begin();
for (; ckt != p.end(); ckt++) (*ckt)->maxHardPt(ptmax);
}
void Evolver::showerHardProcess(ShowerTreePtr hard, XCPtr xcomb) {
_hardme = HwMEBasePtr();
// extract the matrix element
tStdXCombPtr lastXC = dynamic_ptr_cast<tStdXCombPtr>(xcomb);
if(lastXC) {
_hardme = dynamic_ptr_cast<HwMEBasePtr>(lastXC->matrixElement());
}
_decayme = HwDecayerBasePtr();
// set the current tree
currentTree(hard);
// zero number of emissions
_nis = _nfs = 0;
// extract particles to shower
vector<ShowerProgenitorPtr> particlesToShower=setupShower(true);
// setup the maximum scales for the shower, given by the hard process
if (hardVetoOn()) setupMaximumScales(currentTree(), particlesToShower);
// generate the intrinsic p_T once and for all
generateIntrinsicpT(particlesToShower);
// main shower loop
unsigned int ntry(0);
do {
// clear results of last attempt if needed
if(ntry!=0) {
currentTree()->clear();
setEvolutionPartners(true,ShowerInteraction::QCD);
_nis = _nfs = 0;
}
// generate the shower
// pick random starting point
unsigned int istart=UseRandom::irnd(particlesToShower.size());
unsigned int istop = particlesToShower.size();
// loop over particles with random starting point
for(unsigned int ix=istart;ix<=istop;++ix) {
if(ix==particlesToShower.size()) {
if(istart!=0) {
istop = istart-1;
ix=0;
}
else break;
}
// set the progenitor
_progenitor=particlesToShower[ix];
// initial-state
if(!_progenitor->progenitor()->isFinalState()) {
if(!isISRadiationON()) continue;
// get the PDF
setBeamParticle(_progenitor->beam());
assert(beamParticle());
// perform the shower
// set the beam particle
tPPtr beamparticle=progenitor()->original();
if(!beamparticle->parents().empty())
beamparticle=beamparticle->parents()[0];
// generate the shower
progenitor()->hasEmitted(startSpaceLikeShower(beamparticle,
ShowerInteraction::QCD));
}
// final-state
else {
if(!isFSRadiationON()) continue;
// perform shower
progenitor()->hasEmitted(startTimeLikeShower(ShowerInteraction::QCD));
}
}
}
while(!showerModel()->kinematicsReconstructor()->
reconstructHardJets(hard,intrinsicpT())&&
maximumTries()>++ntry);
_hardme=HwMEBasePtr();
_hardtree=HardTreePtr();
if(_maxtry==ntry) throw ShowerHandler::ShowerTriesVeto(ntry);
// the tree has now showered
_currenttree->hasShowered(true);
}
void Evolver::hardMatrixElementCorrection(bool hard) {
// set the initial enhancement factors for the soft correction
_initialenhance = 1.;
_finalenhance = 1.;
// if hard matrix element switched off return
if(!MECOn()) return;
// see if we can get the correction from the matrix element
// or decayer
if(hard) {
if(_hardme&&_hardme->hasMECorrection()) {
_hardme->initializeMECorrection(_currenttree,
_initialenhance,_finalenhance);
if(hardMEC())
_hardme->applyHardMatrixElementCorrection(_currenttree);
}
}
else {
if(_decayme&&_decayme->hasMECorrection()) {
_decayme->initializeMECorrection(_currenttree,
_initialenhance,_finalenhance);
if(hardMEC())
_decayme->applyHardMatrixElementCorrection(_currenttree);
}
}
}
double Evolver::getReductionFactor(tShowerParticlePtr particle) {
// octet -> octet octet reduction factor
if ( _colourEvolutionMethod == 1 ) {
// Determine which colour factor to use for octet->octet octet
// There are three possibilities.
// 1) Radiation is emitted from a hard parton, or the primary emission
// of a hard parton, at a scale above the progenitor's second
// scale, and we have half as much radiation.
// 2) Radiation is emitted from a hard parton, or the primary emission
// of a hard parton, at a scale below the progenitor's second
// scale, and we have the normal amount of radiation
// 3) Radiation is emitted from a secondary emission of a hard parton,
// and we have the normal amount of radiation
if (getParticleData(particle->id())->iColour()==PDT::Colour8) {
// Particle is an octet
if (particle->radiationLine() == 1 || particle->radiationLine() == 2) {
// Particle is connected along hard progenitor's radiation line
if (particle->evolutionScale() > particle->progenitor()->evolutionScale2() ) {
// Particle radiaties with half strength
return 0.5;
}
}
}
}
return 1.0;
}
bool Evolver::timeLikeShower(tShowerParticlePtr particle,
ShowerInteraction::Type type) {
// don't do anything if not needed
if(_limitEmissions == 1 || _limitEmissions == 3 ||
( _limitEmissions == 2 && _nfs != 0) ) return false;
// octet -> octet octet reduction factor
double reduction = getReductionFactor(particle);
// generate the emission
Branching fb;
while (true) {
fb=_splittingGenerator->chooseForwardBranching(*particle,reduction*_finalenhance,type);
// no emission return
if(!fb.kinematics) return false;
// if emission OK break
if(!timeLikeVetoed(fb,particle)) break;
// otherwise reset scale and continue - SO IS involved in veto algorithm
particle->setEvolutionScale(fb.kinematics->scale());
}
// has emitted
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics(fb.kinematics);
// Assign the splitting function to the emitting particle.
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
tcPDPtr pdata[2];
for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]);
if(particle->id()!=fb.ids[0]) {
for(unsigned int ix=0;ix<2;++ix) {
tPDPtr cc(pdata[ix]->CC());
if(cc) pdata[ix]=cc;
}
}
ShowerParticleVector theChildren;
theChildren.push_back(new_ptr(ShowerParticle(pdata[0],true)));
theChildren.push_back(new_ptr(ShowerParticle(pdata[1],true)));
// update the children
particle->showerKinematics()->updateChildren(particle, theChildren,true);
// update the history if needed
if(particle==_currenttree->getFinalStateShowerProduct(_progenitor))
_currenttree->updateFinalStateShowerProduct(_progenitor,
particle,theChildren);
_currenttree->addFinalStateBranching(particle,theChildren);
// update number of emissions
++_nfs;
if(_limitEmissions!=0) return true;
// shower the first particle
timeLikeShower(theChildren[0],type);
// shower the second particle
timeLikeShower(theChildren[1],type);
// branching has happened
return true;
}
bool
Evolver::spaceLikeShower(tShowerParticlePtr particle, PPtr beam,
ShowerInteraction::Type type) {
//using the pdf's associated with the ShowerHandler assures, that
//modified pdf's are used for the secondary interactions via
//CascadeHandler::resetPDFs(...)
tcPDFPtr pdf;
if(ShowerHandler::currentHandler()->firstPDF().particle() == _beam)
pdf = ShowerHandler::currentHandler()->firstPDF().pdf();
if(ShowerHandler::currentHandler()->secondPDF().particle() == _beam)
pdf = ShowerHandler::currentHandler()->secondPDF().pdf();
Energy freeze = ShowerHandler::currentHandler()->pdfFreezingScale();
// don't do anything if not needed
if(_limitEmissions == 2 || _limitEmissions == 3 ||
( _limitEmissions == 1 && _nis != 0 ) ) return false;
// octet -> octet octet reduction factor
double reduction = getReductionFactor(particle);
Branching bb;
// generate branching
while (true) {
bb=_splittingGenerator->chooseBackwardBranching(*particle,beam,
reduction*_initialenhance,
_beam,type,
pdf,freeze);
// return if no emission
if(!bb.kinematics) return false;
// if not vetoed break
if(!spaceLikeVetoed(bb,particle)) break;
// otherwise reset scale and continue
particle->setEvolutionScale(bb.kinematics->scale());
}
// assign the splitting function and shower kinematics
particle->setShowerKinematics(bb.kinematics);
// For the time being we are considering only 1->2 branching
// particles as in Sudakov form factor
tcPDPtr part[2]={getParticleData(bb.ids[0]),
getParticleData(bb.ids[2])};
if(particle->id()!=bb.ids[1]) {
if(part[0]->CC()) part[0]=part[0]->CC();
if(part[1]->CC()) part[1]=part[1]->CC();
}
// Now create the actual particles, make the otherChild a final state
// particle, while the newParent is not
ShowerParticlePtr newParent=new_ptr(ShowerParticle(part[0],false));
ShowerParticlePtr otherChild = new_ptr(ShowerParticle(part[1],true,true));
ShowerParticleVector theChildren;
theChildren.push_back(particle);
theChildren.push_back(otherChild);
//this updates the evolution scale
particle->showerKinematics()->updateParent(newParent, theChildren,true);
// update the history if needed
_currenttree->updateInitialStateShowerProduct(_progenitor,newParent);
_currenttree->addInitialStateBranching(particle,newParent,otherChild);
// for the reconstruction of kinematics, parent/child
// relationships are according to the branching process:
// now continue the shower
++_nis;
bool emitted = _limitEmissions==0 ?
spaceLikeShower(newParent,beam,type) : false;
// now reconstruct the momentum
if(!emitted) {
if(_intrinsic.find(_progenitor)==_intrinsic.end()) {
bb.kinematics->updateLast(newParent,ZERO,ZERO);
}
else {
pair<Energy,double> kt=_intrinsic[_progenitor];
bb.kinematics->updateLast(newParent,
kt.first*cos(kt.second),
kt.first*sin(kt.second));
}
}
particle->showerKinematics()->updateChildren(newParent, theChildren,true);
if(_limitEmissions!=0) return true;
// perform the shower of the final-state particle
timeLikeShower(otherChild,type);
// return the emitted
return true;
}
void Evolver::showerDecay(ShowerTreePtr decay) {
_decayme = HwDecayerBasePtr();
_hardme = HwMEBasePtr();
// find the decayer
// try the normal way if possible
tDMPtr dm = decay->incomingLines().begin()->first->original() ->decayMode();
if(!dm) dm = decay->incomingLines().begin()->first->copy() ->decayMode();
if(!dm) dm = decay->incomingLines().begin()->first->progenitor()->decayMode();
// otherwise make a string and look it up
if(!dm) {
string tag = decay->incomingLines().begin()->first->original()->dataPtr()->name()
+ "->";
for(map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator
it=decay->outgoingLines().begin();it!=decay->outgoingLines().end();++it) {
if(it!=decay->outgoingLines().begin()) tag += ",";
tag += it->first->original()->dataPtr()->name();
}
tag += ";";
dm = generator()->findDecayMode(tag);
}
if(dm) _decayme = dynamic_ptr_cast<HwDecayerBasePtr>(dm->decayer());
// set the ShowerTree to be showered
currentTree(decay);
decay->applyTransforms();
// extract particles to be shower, set scales and
// perform hard matrix element correction
vector<ShowerProgenitorPtr> particlesToShower=setupShower(false);
setupMaximumScales(currentTree(), particlesToShower);
// compute the minimum mass of the final-state
Energy minmass(ZERO);
for(unsigned int ix=0;ix<particlesToShower.size();++ix) {
if(particlesToShower[ix]->progenitor()->isFinalState())
minmass+=particlesToShower[ix]->progenitor()->mass();
}
// main showering loop
unsigned int ntry(0);
do {
// clear results of last attempt
if(ntry!=0) {
currentTree()->clear();
setEvolutionPartners(false,ShowerInteraction::QCD);
}
unsigned int istart=UseRandom::irnd(particlesToShower.size());
unsigned int istop = particlesToShower.size();
// loop over particles with random starting point
for(unsigned int ix=istart;ix<=istop;++ix) {
if(ix==particlesToShower.size()) {
if(istart!=0) {
istop = istart-1;
ix=0;
}
else break;
}
// extract the progenitor
progenitor(particlesToShower[ix]);
// final-state radiation
if(progenitor()->progenitor()->isFinalState()) {
if(!isFSRadiationON()) continue;
// perform shower
progenitor()->hasEmitted(startTimeLikeShower(ShowerInteraction::QCD));
}
// initial-state radiation
else {
if(!isISRadiationON()) continue;
// perform shower
// set the scales correctly. The current scale is the maximum scale for
// emission not the starting scale
Energy maxscale=progenitor()->progenitor()->evolutionScale();
Energy startScale=progenitor()->progenitor()->mass();
progenitor()->progenitor()->setEvolutionScale(startScale);
// perform the shower
progenitor()->hasEmitted(startSpaceLikeDecayShower(maxscale,minmass,
ShowerInteraction::QCD));
}
}
}
while(!showerModel()->kinematicsReconstructor()->reconstructDecayJets(decay)&&
maximumTries()>++ntry);
_decayme = HwDecayerBasePtr();
if(maximumTries()==ntry)
throw Exception() << "Failed to generate the shower after "
<< ntry << " attempts in Evolver::showerDecay()"
<< Exception::eventerror;
// tree has now showered
_currenttree->hasShowered(true);
}
bool Evolver::spaceLikeDecayShower(tShowerParticlePtr particle,
Energy maxscale,
Energy minmass,ShowerInteraction::Type type) {
// octet -> octet octet reduction factor
double reduction = getReductionFactor(particle);
Branching fb;
while (true) {
fb=_splittingGenerator->chooseDecayBranching(*particle,maxscale,minmass,
reduction*_initialenhance,type);
// return if no radiation
if(!fb.kinematics) return false;
// if not vetoed break
if(!spaceLikeDecayVetoed(fb,particle)) break;
// otherwise reset scale and continue
particle->setEvolutionScale(fb.kinematics->scale());
}
// has emitted
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics(fb.kinematics);
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
tcPDPtr pdata[2];
for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]);
if(particle->id()!=fb.ids[0]) {
for(unsigned int ix=0;ix<2;++ix) {
tPDPtr cc(pdata[ix]->CC());
if(cc) pdata[ix]=cc;
}
}
ShowerParticleVector theChildren;
theChildren.push_back(new_ptr(ShowerParticle(pdata[0],true)));
theChildren.push_back(new_ptr(ShowerParticle(pdata[1],true)));
// some code moved to updateChildren
particle->showerKinematics()->updateChildren(particle, theChildren,true);
// In the case of splittings which involves coloured particles,
// set properly the colour flow of the branching.
// update the history if needed
_currenttree->updateInitialStateShowerProduct(_progenitor,theChildren[0]);
_currenttree->addInitialStateBranching(particle,theChildren[0],theChildren[1]);
// shower the first particle
spaceLikeDecayShower(theChildren[0],maxscale,minmass,type);
// shower the second particle
timeLikeShower(theChildren[1],type);
// branching has happened
return true;
}
vector<ShowerProgenitorPtr> Evolver::setupShower(bool hard) {
// generate POWHEG hard emission if needed
if(_hardEmissionMode==1) hardestEmission(hard);
// set the initial colour partners
setEvolutionPartners(hard,ShowerInteraction::QCD);
// get the particles to be showered
map<ShowerProgenitorPtr, ShowerParticlePtr>::const_iterator cit;
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
// generate hard me if needed
if(_hardEmissionMode==0) hardMatrixElementCorrection(hard);
// get the particles to be showered
vector<ShowerProgenitorPtr> particlesToShower;
// incoming particles
for(cit=currentTree()->incomingLines().begin();
cit!=currentTree()->incomingLines().end();++cit)
particlesToShower.push_back((*cit).first);
assert((particlesToShower.size()==1&&!hard)||
(particlesToShower.size()==2&&hard));
// outgoing particles
for(cjt=currentTree()->outgoingLines().begin();
cjt!=currentTree()->outgoingLines().end();++cjt)
particlesToShower.push_back(((*cjt).first));
// remake the colour partners if needed
if(_hardEmissionMode==0 && _currenttree->hardMatrixElementCorrection()) {
setEvolutionPartners(hard,ShowerInteraction::QCD);
_currenttree->resetShowerProducts();
}
return particlesToShower;
}
void Evolver::setEvolutionPartners(bool hard,ShowerInteraction::Type ) {
map<ShowerProgenitorPtr, ShowerParticlePtr>::const_iterator cit;
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
vector<ShowerParticlePtr> particles;
// match the particles in the ShowerTree and hardTree
if(hardTree() && !hardTree()->connect(currentTree()))
throw Exception() << "Can't match trees in "
<< "Evolver::setEvolutionPartners()"
<< Exception::eventerror;
// sort out the colour partners
for(cit=currentTree()->incomingLines().begin();
cit!=currentTree()->incomingLines().end();++cit)
particles.push_back(cit->first->progenitor());
assert((particles.size()==1&&!hard)||(particles.size()==2&&hard));
// outgoing particles
for(cjt=currentTree()->outgoingLines().begin();
cjt!=currentTree()->outgoingLines().end();++cjt)
particles.push_back(cjt->first->progenitor());
if(hardTree()) {
// find the partner
for(unsigned int ix=0;ix<particles.size();++ix) {
tHardBranchingPtr partner =
hardTree()->particles()[particles[ix]]->colourPartner();
if(!partner) continue;
for(map<ShowerParticlePtr,tHardBranchingPtr>::const_iterator
it=hardTree()->particles().begin();
it!=hardTree()->particles().end();++it) {
if(it->second==partner) particles[ix]->setPartner(it->first);
}
if(!particles[ix]->partner())
throw Exception() << "Can't match partners in "
<< "Evolver::setEvolutionPartners()"
<< Exception::eventerror;
}
}
// Set the initial evolution scales
showerModel()->partnerFinder()->
setInitialEvolutionScales(particles,!hard,ShowerInteraction::QCD,!_hardtree);
}
bool Evolver::startTimeLikeShower(ShowerInteraction::Type type) {
if(hardTree()) {
map<ShowerParticlePtr,tHardBranchingPtr>::const_iterator
eit=hardTree()->particles().end(),
mit = hardTree()->particles().find(progenitor()->progenitor());
if( mit != eit && !mit->second->children().empty() ) {
return truncatedTimeLikeShower(progenitor()->progenitor(), mit->second ,type);
}
}
return hardOnly() ? false :
timeLikeShower(progenitor()->progenitor() ,type) ;
}
bool Evolver::startSpaceLikeShower(PPtr parent, ShowerInteraction::Type type) {
if(hardTree()) {
map<ShowerParticlePtr,tHardBranchingPtr>::const_iterator
eit =hardTree()->particles().end(),
mit = hardTree()->particles().find(progenitor()->progenitor());
if( mit != eit && mit->second->parent() ) {
return truncatedSpaceLikeShower( progenitor()->progenitor(),
parent, mit->second->parent(), type );
}
}
return hardOnly() ? false :
spaceLikeShower(progenitor()->progenitor(),parent,type);
}
bool Evolver::startSpaceLikeDecayShower(Energy maxscale,Energy minimumMass,
ShowerInteraction::Type type) {
if(hardTree()) {
map<ShowerParticlePtr,tHardBranchingPtr>::const_iterator
eit =hardTree()->particles().end(),
mit = hardTree()->particles().find(progenitor()->progenitor());
if( mit != eit && mit->second->parent() ) {
HardBranchingPtr branch=mit->second;
while(branch->parent()) branch=branch->parent();
return truncatedSpaceLikeDecayShower(progenitor()->progenitor(),maxscale,
minimumMass, branch ,type);
}
}
return hardOnly() ? false :
spaceLikeDecayShower(progenitor()->progenitor(),maxscale,minimumMass,type);
}
bool Evolver::timeLikeVetoed(const Branching & fb,
ShowerParticlePtr particle) {
// check whether emission was harder than largest pt of hard subprocess
if ( hardVetoFS() && fb.kinematics->pT() > _progenitor->maxHardPt() )
return true;
// soft matrix element correction veto
if( softMEC()) {
if(_hardme && _hardme->hasMECorrection()) {
if(_hardme->softMatrixElementVeto(_progenitor,particle,fb))
return true;
}
else if(_decayme && _decayme->hasMECorrection()) {
if(_decayme->softMatrixElementVeto(_progenitor,particle,fb))
return true;
}
}
// veto on maximum pt
if(fb.kinematics->pT()>_progenitor->maximumpT()) return true;
// general vetos
if (fb.kinematics && !_vetoes.empty()) {
bool vetoed=false;
for (vector<ShowerVetoPtr>::iterator v = _vetoes.begin();
v != _vetoes.end(); ++v) {
bool test = (**v).vetoTimeLike(_progenitor,particle,fb);
switch((**v).vetoType()) {
case ShowerVeto::Emission:
vetoed |= test;
break;
case ShowerVeto::Shower:
if(test) throw VetoShower();
break;
case ShowerVeto::Event:
if(test) throw Veto();
break;
}
}
if(vetoed) return true;
}
return false;
}
bool Evolver::spaceLikeVetoed(const Branching & bb,ShowerParticlePtr particle) {
// check whether emission was harder than largest pt of hard subprocess
if (hardVetoIS() && bb.kinematics->pT() > _progenitor->maxHardPt())
return true;
// apply the soft correction
if( softMEC() && _hardme && _hardme->hasMECorrection() ) {
if(_hardme->softMatrixElementVeto(_progenitor,particle,bb))
return true;
}
// the more general vetos
// check vs max pt for the shower
if(bb.kinematics->pT()>_progenitor->maximumpT()) return true;
if (!_vetoes.empty()) {
bool vetoed=false;
for (vector<ShowerVetoPtr>::iterator v = _vetoes.begin();
v != _vetoes.end(); ++v) {
bool test = (**v).vetoSpaceLike(_progenitor,particle,bb);
switch ((**v).vetoType()) {
case ShowerVeto::Emission:
vetoed |= test;
break;
case ShowerVeto::Shower:
if(test) throw VetoShower();
break;
case ShowerVeto::Event:
if(test) throw Veto();
break;
}
}
if (vetoed) return true;
}
return false;
}
bool Evolver::spaceLikeDecayVetoed( const Branching & fb,
ShowerParticlePtr particle ) {
// apply the soft correction
if( softMEC() && _decayme && _decayme->hasMECorrection() ) {
if(_decayme->softMatrixElementVeto(_progenitor,particle,fb))
return true;
}
// veto on hardest pt in the shower
if(fb.kinematics->pT()> _progenitor->maximumpT()) return true;
// general vetos
if (!_vetoes.empty()) {
bool vetoed=false;
for (vector<ShowerVetoPtr>::iterator v = _vetoes.begin();
v != _vetoes.end(); ++v) {
bool test = (**v).vetoSpaceLike(_progenitor,particle,fb);
switch((**v).vetoType()) {
case ShowerVeto::Emission:
vetoed |= test;
break;
case ShowerVeto::Shower:
if(test) throw VetoShower();
break;
case ShowerVeto::Event:
if(test) throw Veto();
break;
}
if (vetoed) return true;
}
}
return false;
}
void Evolver::hardestEmission(bool hard) {
if( ( _hardme && _hardme->hasPOWHEGCorrection()) ||
(_decayme && _decayme->hasPOWHEGCorrection())) {
if(_hardme)
_hardtree = _hardme->generateHardest( currentTree() );
else
_hardtree = _decayme->generateHardest( currentTree() );
if(!_hardtree) return;
// join up the two tree
connectTrees(currentTree(),_hardtree,hard);
}
else {
_hardtree = ShowerHandler::currentHandler()->generateCKKW(currentTree());
}
}
bool Evolver::truncatedTimeLikeShower(tShowerParticlePtr particle,
HardBranchingPtr branch,
ShowerInteraction::Type type) {
Branching fb;
unsigned int iout=0;
tcPDPtr pdata[2];
while (true) {
// no truncated shower break
if(!isTruncatedShowerON()||hardOnly()) break;
// generate emission
fb=splittingGenerator()->chooseForwardBranching(*particle,1.,type);
// no emission break
if(!fb.kinematics) break;
// check haven't evolved too far
if(fb.kinematics->scale() < branch->scale()) {
fb=Branching();
break;
}
// get the particle data objects
for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]);
if(particle->id()!=fb.ids[0]) {
for(unsigned int ix=0;ix<2;++ix) {
tPDPtr cc(pdata[ix]->CC());
if(cc) pdata[ix]=cc;
}
}
// find the truncated line
iout=0;
if(pdata[0]->id()!=pdata[1]->id()) {
if(pdata[0]->id()==particle->id()) iout=1;
else if (pdata[1]->id()==particle->id()) iout=2;
}
else if(pdata[0]->id()==particle->id()) {
if(fb.kinematics->z()>0.5) iout=1;
else iout=2;
}
// apply the vetos for the truncated shower
// no flavour changing branchings
if(iout==0) {
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z();
// only if same interaction for forced branching
// and evolution
if(type==branch->sudakov()->interactionType()) {
if(zsplit < 0.5 || // hardest line veto
fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
}
// pt veto
if(fb.kinematics->pT() > progenitor()->maximumpT()) {
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
// should do base class vetos as well
if(timeLikeVetoed(fb,particle)) {
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
break;
}
// if no branching set decay matrix and return
if(!fb.kinematics) {
// construct the kinematics for the hard emission
ShoKinPtr showerKin=
branch->sudakov()->createFinalStateBranching(branch->scale(),
branch->children()[0]->z(),
branch->phi(),
branch->children()[0]->pT());
particle->setEvolutionScale(branch->scale() );
showerKin->initialize( *particle,PPtr() );
IdList idlist(3);
idlist[0] = particle->id();
idlist[1] = branch->children()[0]->branchingParticle()->id();
idlist[2] = branch->children()[1]->branchingParticle()->id();
fb = Branching( showerKin, idlist, branch->sudakov() );
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics( fb.kinematics );
// Assign the splitting function to the emitting particle.
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
ShowerParticleVector theChildren;
theChildren.push_back(new_ptr(ShowerParticle(branch->children()[0]->
branchingParticle()->dataPtr(),true)));
theChildren.push_back(new_ptr(ShowerParticle(branch->children()[1]->
branchingParticle()->dataPtr(),true)));
particle->showerKinematics()->
updateChildren(particle, theChildren,type==branch->sudakov()->interactionType());
// update the history if needed
if(particle==currentTree()->getFinalStateShowerProduct(progenitor()))
currentTree()->updateFinalStateShowerProduct(progenitor(),
particle,theChildren);
currentTree()->addFinalStateBranching(particle,theChildren);
// shower the first particle
if( branch->children()[0]->children().empty() ) {
if( ! hardOnly() )
timeLikeShower(theChildren[0],type);
}
else {
truncatedTimeLikeShower( theChildren[0],branch->children()[0],type);
}
// shower the second particle
if( branch->children()[1]->children().empty() ) {
if( ! hardOnly() )
timeLikeShower( theChildren[1] , type);
}
else {
truncatedTimeLikeShower( theChildren[1],branch->children()[1] ,type);
}
return true;
}
// has emitted
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics(fb.kinematics);
// Assign the splitting function to the emitting particle.
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
ShowerParticleVector theChildren;
theChildren.push_back( new_ptr( ShowerParticle( pdata[0], true ) ) );
theChildren.push_back( new_ptr( ShowerParticle( pdata[1], true ) ) );
particle->showerKinematics()->
updateChildren( particle, theChildren , true);
// update the history if needed
if( particle == currentTree()->getFinalStateShowerProduct( progenitor() ) )
currentTree()->updateFinalStateShowerProduct( progenitor(),
particle, theChildren );
currentTree()->addFinalStateBranching( particle, theChildren );
// shower the first particle
if( iout == 1 ) truncatedTimeLikeShower( theChildren[0], branch , type );
else timeLikeShower( theChildren[0] , type);
// shower the second particle
if( iout == 2 ) truncatedTimeLikeShower( theChildren[1], branch , type );
else timeLikeShower( theChildren[1] , type);
// branching has happened
return true;
}
bool Evolver::truncatedSpaceLikeShower(tShowerParticlePtr particle, PPtr beam,
HardBranchingPtr branch,
ShowerInteraction::Type type) {
tcPDFPtr pdf;
if(ShowerHandler::currentHandler()->firstPDF().particle() == beamParticle())
pdf = ShowerHandler::currentHandler()->firstPDF().pdf();
if(ShowerHandler::currentHandler()->secondPDF().particle() == beamParticle())
pdf = ShowerHandler::currentHandler()->secondPDF().pdf();
Energy freeze = ShowerHandler::currentHandler()->pdfFreezingScale();
Branching bb;
// generate branching
tcPDPtr part[2];
while (true) {
if( !isTruncatedShowerON() || hardOnly() ) break;
bb = splittingGenerator()->chooseBackwardBranching( *particle,
beam, 1., beamParticle(),
type , pdf,freeze);
if( !bb.kinematics || bb.kinematics->scale() < branch->scale() ) {
bb = Branching();
break;
}
// particles as in Sudakov form factor
part[0] = getParticleData( bb.ids[0] );
part[1] = getParticleData( bb.ids[2] );
//is emitter anti-particle
if( particle->id() != bb.ids[1]) {
if( part[0]->CC() ) part[0] = part[0]->CC();
if( part[1]->CC() ) part[1] = part[1]->CC();
}
double zsplit = bb.kinematics->z();
// apply the vetos for the truncated shower
// if doesn't carry most of momentum
if(type==branch->sudakov()->interactionType() &&
zsplit < 0.5) {
particle->setEvolutionScale(bb.kinematics->scale() );
continue;
}
// others
if( part[0]->id() != particle->id() || // if particle changes type
bb.kinematics->pT() > progenitor()->maximumpT() || // pt veto
bb.kinematics->scale() < branch->scale()) { // angular ordering veto
particle->setEvolutionScale(bb.kinematics->scale() );
continue;
}
// and those from the base class
if(spaceLikeVetoed(bb,particle)) {
particle->setEvolutionScale(bb.kinematics->scale() );
continue;
}
break;
}
if( !bb.kinematics ) {
//do the hard emission
double z(0.);
HardBranchingPtr timelike;
for( unsigned int ix = 0; ix < branch->children().size(); ++ix ) {
if( branch->children()[ix]->status() ==HardBranching::Outgoing) {
timelike = branch->children()[ix];
}
if( branch->children()[ix]->status() ==HardBranching::Incoming )
z = branch->children()[ix]->z();
}
ShoKinPtr kinematics =
branch->sudakov()->createInitialStateBranching( branch->scale(), z, branch->phi(),
branch->children()[0]->pT() );
kinematics->initialize( *particle, beam );
// assign the splitting function and shower kinematics
particle->setShowerKinematics( kinematics );
// For the time being we are considering only 1->2 branching
// Now create the actual particles, make the otherChild a final state
// particle, while the newParent is not
ShowerParticlePtr newParent =
new_ptr( ShowerParticle( branch->branchingParticle()->dataPtr(), false ) );
ShowerParticlePtr otherChild =
new_ptr( ShowerParticle( timelike->branchingParticle()->dataPtr(),
true, true ) );
ShowerParticleVector theChildren;
theChildren.push_back( particle );
theChildren.push_back( otherChild );
particle->showerKinematics()->
updateParent( newParent, theChildren, type==branch->sudakov()->interactionType() );
// update the history if needed
currentTree()->updateInitialStateShowerProduct( progenitor(), newParent );
currentTree()->addInitialStateBranching( particle, newParent, otherChild );
// for the reconstruction of kinematics, parent/child
// relationships are according to the branching process:
// now continue the shower
bool emitted=false;
if(!hardOnly()) {
if( branch->parent() ) {
emitted = truncatedSpaceLikeShower( newParent, beam, branch->parent() , type);
}
else {
emitted = spaceLikeShower( newParent, beam , type);
}
}
if( !emitted ) {
if( intrinsicpT().find( progenitor() ) == intrinsicpT().end() ) {
kinematics->updateLast( newParent, ZERO, ZERO );
}
else {
pair<Energy,double> kt = intrinsicpT()[progenitor()];
kinematics->updateLast( newParent,
kt.first*cos( kt.second ),
kt.first*sin( kt.second ) );
}
}
particle->showerKinematics()->
updateChildren( newParent, theChildren,
type==branch->sudakov()->interactionType() );
if(hardOnly()) return true;
// perform the shower of the final-state particle
if( timelike->children().empty() ) {
timeLikeShower( otherChild , type);
}
else {
truncatedTimeLikeShower( otherChild, timelike , type);
}
// return the emitted
return true;
}
// assign the splitting function and shower kinematics
particle->setShowerKinematics( bb.kinematics );
// For the time being we are considering only 1->2 branching
// Now create the actual particles, make the otherChild a final state
// particle, while the newParent is not
ShowerParticlePtr newParent = new_ptr( ShowerParticle( part[0], false ) );
ShowerParticlePtr otherChild = new_ptr( ShowerParticle( part[1], true, true ) );
ShowerParticleVector theChildren;
theChildren.push_back( particle );
theChildren.push_back( otherChild );
particle->showerKinematics()->updateParent( newParent, theChildren , true);
// update the history if needed
currentTree()->updateInitialStateShowerProduct( progenitor(), newParent );
currentTree()->addInitialStateBranching( particle, newParent, otherChild );
// for the reconstruction of kinematics, parent/child
// relationships are according to the branching process:
// now continue the shower
bool emitted = truncatedSpaceLikeShower( newParent, beam, branch,type);
// now reconstruct the momentum
if( !emitted ) {
if( intrinsicpT().find( progenitor() ) == intrinsicpT().end() ) {
bb.kinematics->updateLast( newParent, ZERO, ZERO );
}
else {
pair<Energy,double> kt = intrinsicpT()[ progenitor() ];
bb.kinematics->updateLast( newParent,
kt.first*cos( kt.second ),
kt.first*sin( kt.second ) );
}
}
particle->showerKinematics()->updateChildren( newParent, theChildren , true);
// perform the shower of the final-state particle
timeLikeShower( otherChild , type);
// return the emitted
return true;
}
bool Evolver::
truncatedSpaceLikeDecayShower(tShowerParticlePtr particle, Energy maxscale,
Energy minmass, HardBranchingPtr branch,
ShowerInteraction::Type type) {
Branching fb;
unsigned int iout=0;
tcPDPtr pdata[2];
while (true) {
// no truncated shower break
if(!isTruncatedShowerON()||hardOnly()) break;
fb=splittingGenerator()->chooseDecayBranching(*particle,maxscale,minmass,1.,type);
// return if no radiation
if(!fb.kinematics) break;
// check haven't evolved too far
if(fb.kinematics->scale() < branch->scale()) {
fb=Branching();
break;
}
// get the particle data objects
for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]);
if(particle->id()!=fb.ids[0]) {
for(unsigned int ix=0;ix<2;++ix) {
tPDPtr cc(pdata[ix]->CC());
if(cc) pdata[ix]=cc;
}
}
// find the truncated line
iout=0;
if(pdata[0]->id()!=pdata[1]->id()) {
if(pdata[0]->id()==particle->id()) iout=1;
else if (pdata[1]->id()==particle->id()) iout=2;
}
else if(pdata[0]->id()==particle->id()) {
if(fb.kinematics->z()>0.5) iout=1;
else iout=2;
}
// apply the vetos for the truncated shower
// no flavour changing branchings
if(iout==0) {
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z();
if(type==branch->sudakov()->interactionType()) {
if(zsplit < 0.5 || // hardest line veto
fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
}
// pt veto
if(fb.kinematics->pT() > progenitor()->maximumpT()) {
particle->setEvolutionScale(fb.kinematics->scale());
continue;
}
// should do base class vetos as well
// if not vetoed break
if(!spaceLikeDecayVetoed(fb,particle)) break;
// otherwise reset scale and continue
particle->setEvolutionScale(fb.kinematics->scale());
}
// if no branching set decay matrix and return
if(!fb.kinematics) {
// construct the kinematics for the hard emission
ShoKinPtr showerKin=
branch->sudakov()->createDecayBranching(branch->scale(),
branch->children()[0]->z(),
branch->phi(),
branch->children()[0]->pT());
particle->setEvolutionScale(branch->scale() );
showerKin->initialize( *particle,PPtr() );
IdList idlist(3);
idlist[0] = particle->id();
idlist[1] = branch->children()[0]->branchingParticle()->id();
idlist[2] = branch->children()[1]->branchingParticle()->id();
fb = Branching( showerKin, idlist, branch->sudakov() );
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics( fb.kinematics );
// Assign the splitting function to the emitting particle.
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
ShowerParticleVector theChildren;
theChildren.push_back(new_ptr(ShowerParticle(branch->children()[0]->
branchingParticle()->dataPtr(),true)));
theChildren.push_back(new_ptr(ShowerParticle(branch->children()[1]->
branchingParticle()->dataPtr(),true)));
particle->showerKinematics()->
updateChildren(particle, theChildren,
type==branch->sudakov()->interactionType());
if(theChildren[0]->id()==particle->id()) {
// update the history if needed
currentTree()->updateInitialStateShowerProduct(progenitor(),theChildren[0]);
currentTree()->addInitialStateBranching(particle,theChildren[0],theChildren[1]);
// shower the space-like particle
if( branch->children()[0]->children().empty() ) {
if( ! hardOnly() ) spaceLikeDecayShower(theChildren[0],maxscale,minmass,type);
}
else {
truncatedSpaceLikeDecayShower( theChildren[0],maxscale,minmass,
branch->children()[0],type);
}
// shower the second particle
if( branch->children()[1]->children().empty() ) {
if( ! hardOnly() ) timeLikeShower( theChildren[1] , type);
}
else {
truncatedTimeLikeShower( theChildren[1],branch->children()[1] ,type);
}
}
else {
// update the history if needed
currentTree()->updateInitialStateShowerProduct(progenitor(),theChildren[1]);
currentTree()->addInitialStateBranching(particle,theChildren[0],theChildren[1]);
// shower the space-like particle
if( branch->children()[1]->children().empty() ) {
if( ! hardOnly() ) spaceLikeDecayShower(theChildren[1],maxscale,minmass,type);
}
else {
truncatedSpaceLikeDecayShower( theChildren[1],maxscale,minmass,
branch->children()[1],type);
}
// shower the second particle
if( branch->children()[0]->children().empty() ) {
if( ! hardOnly() ) timeLikeShower( theChildren[0] , type);
}
else {
truncatedTimeLikeShower( theChildren[0],branch->children()[0] ,type);
}
}
return true;
}
// has emitted
// Assign the shower kinematics to the emitting particle.
particle->setShowerKinematics(fb.kinematics);
// For the time being we are considering only 1->2 branching
// Create the ShowerParticle objects for the two children of
// the emitting particle; set the parent/child relationship
// if same as definition create particles, otherwise create cc
ShowerParticleVector theChildren;
theChildren.push_back(new_ptr(ShowerParticle(pdata[0],true)));
theChildren.push_back(new_ptr(ShowerParticle(pdata[1],true)));
particle->showerKinematics()->updateChildren(particle, theChildren,true);
// In the case of splittings which involves coloured particles,
// set properly the colour flow of the branching.
// update the history if needed
currentTree()->updateInitialStateShowerProduct(progenitor(),theChildren[0]);
currentTree()->addInitialStateBranching(particle,theChildren[0],theChildren[1]);
// shower the first particle
truncatedSpaceLikeDecayShower(theChildren[0],maxscale,minmass,branch,type);
// shower the second particle
timeLikeShower(theChildren[1],type);
// branching has happened
return true;
}
-void Evolver::connectTrees(ShowerTreePtr showerTree, HardTreePtr hardTree, bool hard )const {
+void Evolver::connectTrees(ShowerTreePtr showerTree,
+ HardTreePtr hardTree, bool hard ) const {
ShowerParticleVector particles;
// find the Sudakovs
for(set<HardBranchingPtr>::iterator cit=hardTree->branchings().begin();
cit!=hardTree->branchings().end();++cit) {
// Sudakovs for ISR
if((**cit).parent()&&(**cit).status()==HardBranching::Incoming) {
IdList br(3);
br[0] = (**cit).parent()->branchingParticle()->id();
br[1] = (**cit). branchingParticle()->id();
br[2] = (**cit).parent()->children()[0]==*cit ?
(**cit).parent()->children()[1]->branchingParticle()->id() :
(**cit).parent()->children()[0]->branchingParticle()->id();
BranchingList branchings = splittingGenerator()->initialStateBranchings();
if(br[1]<0&&br[0]==br[1]) {
br[0] = abs(br[0]);
br[1] = abs(br[1]);
}
else if(br[1]<0) {
br[1] = -br[1];
br[2] = -br[2];
}
long index = abs(br[1]);
SudakovPtr sudakov;
for(BranchingList::const_iterator cjt = branchings.lower_bound(index);
cjt != branchings.upper_bound(index); ++cjt ) {
IdList ids = cjt->second.second;
if(ids[0]==br[0]&&ids[1]==br[1]&&ids[2]==br[2]) {
sudakov=cjt->second.first;
break;
}
}
if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in "
<< "Evolver::connectTrees() for ISR"
<< Exception::runerror;
(**cit).parent()->sudakov(sudakov);
}
// Sudakovs for FSR
else if(!(**cit).children().empty()) {
IdList br(3);
br[0] = (**cit) .branchingParticle()->id();
br[1] = (**cit).children()[0]->branchingParticle()->id();
br[2] = (**cit).children()[1]->branchingParticle()->id();
BranchingList branchings = splittingGenerator()->finalStateBranchings();
if(br[0]<0) {
br[0] = abs(br[0]);
br[1] = abs(br[1]);
br[2] = abs(br[2]);
}
long index = br[0];
SudakovPtr sudakov;
for(BranchingList::const_iterator cjt = branchings.lower_bound(index);
cjt != branchings.upper_bound(index); ++cjt ) {
IdList ids = cjt->second.second;
if(ids[0]==br[0]&&ids[1]==br[1]&&ids[2]==br[2]) {
sudakov=cjt->second.first;
break;
}
}
if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in "
<< "Evolver::connectTrees()"
<< Exception::runerror;
(**cit).sudakov(sudakov);
}
}
// calculate the evolution scale
for(set<HardBranchingPtr>::iterator cit=hardTree->branchings().begin();
cit!=hardTree->branchings().end();++cit) {
particles.push_back((*cit)->branchingParticle());
}
showerModel()->partnerFinder()->
setInitialEvolutionScales(particles,!hard,hardTree->interaction(),true);
// inverse reconstruction
if(hard)
showerModel()->kinematicsReconstructor()->
deconstructHardJets(hardTree,ShowerHandler::currentHandler()->evolver(),
hardTree->interaction());
else
showerModel()->kinematicsReconstructor()->
deconstructDecayJets(hardTree,ShowerHandler::currentHandler()->evolver(),
hardTree->interaction());
// now reset the momenta of the showering particles
vector<ShowerProgenitorPtr> particlesToShower;
for(map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator
cit=showerTree->incomingLines().begin();
cit!=showerTree->incomingLines().end();++cit )
particlesToShower.push_back(cit->first);
// extract the showering particles
for(map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator
cit=showerTree->outgoingLines().begin();
cit!=showerTree->outgoingLines().end();++cit )
particlesToShower.push_back(cit->first);
// match them
vector<bool> matched(particlesToShower.size(),false);
for(set<HardBranchingPtr>::const_iterator cit=hardTree->branchings().begin();
cit!=hardTree->branchings().end();++cit) {
Energy2 dmin( 1e30*GeV2 );
int iloc(-1);
for(unsigned int ix=0;ix<particlesToShower.size();++ix) {
if(matched[ix]) continue;
if( (**cit).branchingParticle()->id() != particlesToShower[ix]->progenitor()->id() ) continue;
if( (**cit).branchingParticle()->isFinalState() !=
particlesToShower[ix]->progenitor()->isFinalState() ) continue;
Energy2 dtest =
sqr( particlesToShower[ix]->progenitor()->momentum().x() - (**cit).showerMomentum().x() ) +
sqr( particlesToShower[ix]->progenitor()->momentum().y() - (**cit).showerMomentum().y() ) +
sqr( particlesToShower[ix]->progenitor()->momentum().z() - (**cit).showerMomentum().z() ) +
sqr( particlesToShower[ix]->progenitor()->momentum().t() - (**cit).showerMomentum().t() );
// add mass difference for identical particles (e.g. Z0 Z0 production)
dtest += 1e10*sqr(particlesToShower[ix]->progenitor()->momentum().m()-
(**cit).showerMomentum().m());
if( dtest < dmin ) {
iloc = ix;
dmin = dtest;
}
}
if(iloc<0) throw Exception() << "Failed to match shower and hard trees in Evolver::hardestEmission"
<< Exception::eventerror;
particlesToShower[iloc]->progenitor()->set5Momentum((**cit).showerMomentum());
matched[iloc] = true;
}
// correction boosts for daughter trees
for(map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator
tit = showerTree->treelinks().begin();
tit != showerTree->treelinks().end();++tit) {
ShowerTreePtr decayTree = tit->first;
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator
cit = decayTree->incomingLines().begin();
// reset the momentum of the decay particle
Lorentz5Momentum oldMomentum = cit->first->progenitor()->momentum();
Lorentz5Momentum newMomentum = tit->second.second->momentum();
LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass());
boost.boost (-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass());
decayTree->transform(boost,true);
}
}
diff --git a/Shower/Base/PartnerFinder.cc b/Shower/Base/PartnerFinder.cc
--- a/Shower/Base/PartnerFinder.cc
+++ b/Shower/Base/PartnerFinder.cc
@@ -1,330 +1,378 @@
// -*- C++ -*-
//
// PartnerFinder.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the PartnerFinder class.
//
#include "PartnerFinder.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ShowerParticle.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Interface/Switch.h"
using namespace Herwig;
// some useful functions to avoid using #define
namespace {
-// return bool if final-state particle
-inline bool FS(const tShowerParticlePtr a) {
- return a->isFinalState();
-}
+ // return bool if final-state particle
+ inline bool FS(const tShowerParticlePtr a) {
+ return a->isFinalState();
+ }
-// return colour line pointer
-inline Ptr<ThePEG::ColourLine>::transient_pointer
-CL(const ShowerParticleVector::const_iterator & a) {
- return (*a)->colourLine();
-}
+ // return colour line pointer
+ inline Ptr<ThePEG::ColourLine>::transient_pointer
+ CL(const ShowerParticleVector::const_iterator & a, unsigned int index=0) {
+ return (*a)->colourInfo()->colourLines().empty() ? ThePEG::tColinePtr() :
+ const_ptr_cast<ThePEG::tColinePtr>((*a)->colourInfo()->colourLines()[index]);
+ }
+
+ // return colour line size
+ inline unsigned int
+ CLSIZE(const ShowerParticleVector::const_iterator & a) {
+ return (*a)->colourInfo()->colourLines().size();
+ }
-inline Ptr<ThePEG::ColourLine>::transient_pointer
-ACL(const ShowerParticleVector::const_iterator & a) {
- return (*a)->antiColourLine();
-}
+ inline Ptr<ThePEG::ColourLine>::transient_pointer
+ ACL(const ShowerParticleVector::const_iterator & a, unsigned int index=0) {
+ return (*a)->colourInfo()->antiColourLines().empty() ? ThePEG::tColinePtr() :
+ const_ptr_cast<ThePEG::tColinePtr>((*a)->colourInfo()->antiColourLines()[index]);
+ }
+ inline unsigned int
+ ACLSIZE(const ShowerParticleVector::const_iterator & a) {
+ return (*a)->colourInfo()->antiColourLines().size();
+ }
}
void PartnerFinder::persistentOutput(PersistentOStream & os) const {
os << _approach << _partnerMethod;
}
void PartnerFinder::persistentInput(PersistentIStream & is, int) {
is >> _approach >> _partnerMethod;
}
AbstractClassDescription<PartnerFinder> PartnerFinder::initPartnerFinder;
// Definition of the static class description member.
void PartnerFinder::Init() {
static ClassDocumentation<PartnerFinder> documentation
("This class is responsible for finding the partners for each interaction types ",
"and within the evolution scale range specified by the ShowerVariables ",
"then to determine the initial evolution scales for each pair of partners.");
static Parameter<PartnerFinder,int> approach
("Approximation",
"This is a test variable to consider the different approaches of "
"which colour dipoles of a hard process will shower.",
&PartnerFinder::_approach, 0, 1, 0,false,false,false);
static Switch<PartnerFinder,int> interfacePartnerMethod
("PartnerMethod",
"Choice of partner finding method for gluon evolution.",
&PartnerFinder::_partnerMethod, 0, false, false);
static SwitchOption interfacePartnerMethodRandom
(interfacePartnerMethod,
"Random",
"Choose partners of a gluon randomly.",
0);
static SwitchOption interfacePartnerMethodMaximum
(interfacePartnerMethod,
"Maximum",
"Choose partner of gluon with largest angle.",
1);
}
bool PartnerFinder::setInitialEvolutionScales(const ShowerParticleVector &particles,
- const bool isDecayCase,
+ const bool isDecayCase,
#ifndef NDEBUG
- ShowerInteraction::Type type,
+ ShowerInteraction::Type type,
#else
- ShowerInteraction::Type,
+ ShowerInteraction::Type,
#endif
- const bool setPartners) {
+ const bool setPartners) {
assert(type==ShowerInteraction::QCD);
return setInitialQCDEvolutionScales(particles,isDecayCase,setPartners);
}
bool PartnerFinder::setInitialQCDEvolutionScales(const ShowerParticleVector &particles,
- const bool isDecayCase,
- const bool setPartners) {
+ const bool isDecayCase,
+ const bool setPartners) {
// set the partners and the scales
if(setPartners) {
// Loop over particles and consider only coloured particles which don't
// have already their colour partner fixed and that don't have children
// (the latter requirement is relaxed in the case isDecayCase is true).
// Build a map which has as key one of these particles (i.e. a pointer
// to a ShowerParticle object) and as a corresponding value the vector
// of all its possible *normal* candidate colour partners, defined as follows:
// --- have colour, and no children (this is not required in the case
// isDecayCase is true);
- // --- if both are initial (incoming) state particles, or if both are
- // final (outgoing) state particles, then both must have the
+ // --- if both are initial (incoming) state particles, then the (non-null) colourLine()
+ // of one of them must match the (non-null) antiColourLine() of the other.
+ // --- if one is an initial (incoming) state particle and the other is
+ // a final (outgoing) state particle, then both must have the
// same (non-null) colourLine() or the same (non-null) antiColourLine();
- // --- if one is an initial (incoming) state particle and the other is
- // a final (outgoing) state particle, then the (non-null) colourLine()
- // of one of them must match the (non-null) antiColourLine() of the other.
// Notice that this definition exclude the special case of baryon-violating
// processes (as in R-parity Susy), which will show up as particles
// without candidate colour partners, and that we will be treated a part later
// (this means that no modifications of the following loop is needed!)
ShowerParticleVector::const_iterator cit, cjt;
// Define variables needed for angular and radiation line analysis
double angle[2] = { 0.0, 0.0 };
int radiationLine[2] = { 0, 0 };
int ait = 0;
for(cit = particles.begin(); cit != particles.end(); ++cit) {
if(!(*cit)->data().coloured()) continue;
// We now have a coloured particle
tShowerParticleVector partners;
if (_partnerMethod == 1){
// Angular analysis need to be reset for each particle
angle[0] = 0;
angle[1] = 0;
radiationLine[0] = 0;
radiationLine[1] = 0;
ait = 0;
}
for(cjt = particles.begin(); cjt != particles.end(); ++cjt) {
if(!(*cjt)->data().coloured()||cit==cjt) continue;
bool isPartner = false;
- if(FS(*cit) != FS(*cjt) &&
- ((CL(cit) && CL(cit)==CL(cjt)) || (ACL(cit) && ACL(cit)==ACL(cjt))))
- isPartner = true;
- else if((CL(cit) && CL(cit)==ACL(cjt)) || (ACL(cit) && ACL(cit)==CL(cjt)))
- isPartner = true;
- if(isPartner){
- if (_partnerMethod == 1){
+ if(FS(*cit) != FS(*cjt)){
+ //loop over all the colours of both particles
+ for(unsigned int ix=0; ix<CLSIZE(cit); ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(cjt); ++jx){
+ if((CL(cit,ix) && CL(cit,ix)==CL(cjt,jx))) {
+ isPartner = true;
+ }
+ }
+ }
+ if(!isPartner){
+ //loop over all the anti-colours of both particles
+ for(unsigned int ix=0; ix<ACLSIZE(cit); ++ix){
+ for(unsigned int jx=0; jx<ACLSIZE(cjt); ++jx){
+ if((ACL(cit,ix) && ACL(cit,ix)==ACL(cjt,jx))) {
+ isPartner = true;
+ }
+ }
+ }
+ }
+ }
+ else {
+ //loop over the colours of the first particle and the anti-colours of the other
+ for(unsigned int ix=0; ix<CLSIZE(cit); ++ix){
+ for(unsigned int jx=0; jx<ACLSIZE(cjt); ++jx){
+ if(CL(cit,ix) && CL(cit,ix)==ACL(cjt,jx)) {
+ isPartner = true;
+ }
+ }
+ }
+ if(!isPartner){
+ //loop over the anti-colours of the first particle and the colours of the other
+ for(unsigned int ix=0; ix<ACLSIZE(cit); ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(cjt); jx++){
+ if(ACL(cit,ix) && ACL(cit,ix)==CL(cjt,jx)) {
+ isPartner = true;
+ }
+ }
+ }
+ }
+ }
+ if(isPartner) {
+ if (_partnerMethod == 1 && ACLSIZE(cit)<=1&&CLSIZE(cjt)<=1) {
// Find the angle to the potential partner
angle[ait] = (*cit)->momentum().vect().angle((*cjt)->momentum().vect());
// Find out which colour line is connected to the partner
// Colour line has value 1, anti-colour line has value 2
if( CL(cit) == CL(cjt) || CL(cit) == ACL(cjt)) radiationLine[ait] = 1;
if(ACL(cit) == CL(cjt) || ACL(cit) == ACL(cjt)) radiationLine[ait] = 2;
ait++;
}
- partners.push_back(*cjt);
+ partners.push_back(*cjt);
}
}
if (partners.empty()) {
- // special for RPV
- tColinePtr col = CL(cit);
- if(FS(*cit)&&col&&col->sourceNeighbours().first) {
- tColinePair cpair = col->sourceNeighbours();
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(( FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))||
- (!FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second ))) {
- partners.push_back(*cjt);
- }
- }
- }
- else if(col&&col->sinkNeighbours().first) {
- tColinePair cpair = col->sinkNeighbours();
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(( FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second))||
- (!FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))) {
- partners.push_back(*cjt);
- }
- }
- }
- col = ACL(cit);
- if(FS(*cit)&&col&&col->sinkNeighbours().first) {
- tColinePair cpair = col->sinkNeighbours();
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(( FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second))||
- (!FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second ))) {
- partners.push_back(*cjt);
- }
- }
- }
- else if(col&&col->sourceNeighbours().first) {
- tColinePair cpair = col->sourceNeighbours();
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(( FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))||
- (!FS(*cjt) && (ACL(cjt) == cpair.first ||ACL(cjt) == cpair.second))) {
- partners.push_back(*cjt);
- }
- }
- }
- if(partners.empty()) {
- throw Exception() << "`Failed to make colour connections in "
- << "PartnerFinder::setQCDInitialEvolutionScales"
- << (**cit)
- << Exception::eventerror;
- }
+ // special for RPV
+ tColinePtr col = CL(cit);
+ if(FS(*cit)&&col&&col->sourceNeighbours().first) {
+ tColinePair cpair = col->sourceNeighbours();
+ for(cjt=particles.begin();cjt!=particles.end();++cjt) {
+ if(( FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))||
+ (!FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second ))) {
+ partners.push_back(*cjt);
+ }
+ }
+ }
+ else if(col&&col->sinkNeighbours().first) {
+ tColinePair cpair = col->sinkNeighbours();
+ for(cjt=particles.begin();cjt!=particles.end();++cjt) {
+ if(( FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second))||
+ (!FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))) {
+ partners.push_back(*cjt);
+ }
+ }
+ }
+ col = ACL(cit);
+ if(FS(*cit)&&col&&col->sinkNeighbours().first) {
+ tColinePair cpair = col->sinkNeighbours();
+ for(cjt=particles.begin();cjt!=particles.end();++cjt) {
+ if(( FS(*cjt) && (ACL(cjt) == cpair.first || ACL(cjt) == cpair.second))||
+ (!FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second ))) {
+ partners.push_back(*cjt);
+ }
+ }
+ }
+ else if(col&&col->sourceNeighbours().first) {
+ tColinePair cpair = col->sourceNeighbours();
+ for(cjt=particles.begin();cjt!=particles.end();++cjt) {
+ if(( FS(*cjt) && ( CL(cjt) == cpair.first || CL(cjt) == cpair.second))||
+ (!FS(*cjt) && (ACL(cjt) == cpair.first ||ACL(cjt) == cpair.second))) {
+ partners.push_back(*cjt);
+ }
+ }
+ }
}
+
+ if(partners.empty()) {
+ throw Exception() << "`Failed to make colour connections in "
+ << "PartnerFinder::setQCDInitialEvolutionScales"
+ << (**cit)
+ << Exception::eventerror;
+ }
// In the case of more than one candidate colour partners,
// there are now two approaches to choosing the partner. The
// first method is based on two assumptions:
// 1) the choice of which is the colour partner is done
// *randomly* between the available candidates.
// 2) the choice of which is the colour partner is done
// *independently* from each particle: in other words,
// if for a particle "i" its selected colour partner is
// the particle "j", then the colour partner of "j"
// does not have to be necessarily "i".
// The second method always chooses the furthest partner
// for hard gluons and gluinos.
// First make a random choice of partner
int position = UseRandom::irnd(partners.size());
// Set the scale from the random partner
pair<Energy,Energy> pairScales =
calculateInitialEvolutionScales(ShowerPPair(*cit,partners[position]),
isDecayCase);
pair<Energy,Energy> pairScales2;
if (_partnerMethod == 1){
// Override choice of partner
if ((*cit)->perturbative() == 1 && getParticleData((*cit)->id())->iColour()==PDT::Colour8){
// Parton is a hard octet
// Determine largest angle
if (angle[1]>0 && angle[0]<angle[1]) position=1;
else position=0;
}
// Override scale for hard octet
if (position==1){
pairScales = calculateInitialEvolutionScales(ShowerPPair(*cit,partners[1]),
- isDecayCase);
+ isDecayCase);
if (getParticleData((*cit)->id())->iColour()==PDT::Colour8){
// Set the second scale for hard octets
pairScales2 = calculateInitialEvolutionScales(ShowerPPair(*cit,partners[0]),
- isDecayCase);
+ isDecayCase);
}
}
else {
pairScales = calculateInitialEvolutionScales(ShowerPPair(*cit,partners[0]),
- isDecayCase);
+ isDecayCase);
if (getParticleData((*cit)->id())->iColour()==PDT::Colour8){
// Set the second scale for hard octets
pairScales2 = calculateInitialEvolutionScales(ShowerPPair(*cit,partners[1]),
- isDecayCase);
+ isDecayCase);
}
}
if ((*cit)->perturbative() == 1 && getParticleData((*cit)->id())->iColour()==PDT::Colour8){
- // Set radiation lines for hard octets
+ // Set radiation lines for hard octets
(*cit)->setRadiationLine(radiationLine[position]);
if( !(*cit)->progenitor() ){
// Set the hard partons to be the progenitors of the shower
(*cit)->setProgenitor(*cit);
// Set the second evolution scale of the progenitor
(*cit)->setEvolutionScale2(pairScales2.first);
- }
- }
- else if ((*cit)->perturbative() == 1 && (getParticleData((*cit)->id())->iColour()==PDT::Colour3 ||
- getParticleData((*cit)->id())->iColour()==PDT::Colour3bar)){
- // Set radiation lines for hard triplets
+ }
+ }
+ else if ((*cit)->perturbative() == 1 && (getParticleData((*cit)->id())->iColour()==PDT::Colour3 ||
+ getParticleData((*cit)->id())->iColour()==PDT::Colour3bar)){
+ // Set radiation lines for hard triplets
if( !(*cit)->progenitor() ){
// Set the hard partons to be the progenitors of the shower
(*cit)->setProgenitor(*cit);
// Set the second evolution scale of the progenitor
(*cit)->setEvolutionScale2(pairScales2.first);
// Set the radiation line
(*cit)->setRadiationLine(0);
- }
- }
- }
+ }
+ }
+ }
+
switch(_approach) {
case 0: // Totally random (unless chosen above)
(*cit)->setEvolutionScale(pairScales.first);
(*cit)->setPartner(partners[position]);
break;
case 1: // Partner is also set, if it has already been set, pick 50/50
- if(!(*cit)->partner() || UseRandom::rndbool()) {
- (*cit)->setEvolutionScale(pairScales.first);
- (*cit)->setPartner(partners[position]);
- }
- if(!partners[position]->partner() || UseRandom::rndbool()) {
- partners[position]->setEvolutionScale(pairScales.second);
- partners[position]->setPartner(*cit);
- }
- break;
+ if(!(*cit)->partner() || UseRandom::rndbool()) {
+ (*cit)->setEvolutionScale(pairScales.first);
+ (*cit)->setPartner(partners[position]);
+ }
+ if(!partners[position]->partner() || UseRandom::rndbool()) {
+ partners[position]->setEvolutionScale(pairScales.second);
+ partners[position]->setPartner(*cit);
+ }
+ break;
default:
- throw Exception() << "Invalid approach for setting colour partner in"
- << " PartnerFinder::setQCDInitialEvolutionScale()"
- << Exception::abortnow;
+ throw Exception() << "Invalid approach for setting colour partner in"
+ << " PartnerFinder::setQCDInitialEvolutionScale()"
+ << Exception::abortnow;
}
}
}
// partners all ready set only do the scales
else {
for(ShowerParticleVector::const_iterator cit = particles.begin();
- cit != particles.end(); ++cit) {
+ cit != particles.end(); ++cit) {
if(!(**cit).dataPtr()->coloured()) continue;
tShowerParticlePtr partner = (**cit).partner();
pair<Energy,Energy> pairScales =
- calculateInitialEvolutionScales(ShowerPPair(*cit,partner),
- isDecayCase);
+ calculateInitialEvolutionScales(ShowerPPair(*cit,partner),
+ isDecayCase);
(*cit)->setEvolutionScale(pairScales.first);
}
}
return true;
}
pair<Energy,Energy> PartnerFinder::
calculateInitialEvolutionScales(const ShowerPPair &particlePair,
- const bool isDecayCase) {
+ const bool isDecayCase) {
bool FS1=FS(particlePair.first),FS2= FS(particlePair.second);
if(FS1 && FS2)
return calculateFinalFinalScales(particlePair);
else if(FS1 && !FS2) {
ShowerPPair a(particlePair.second, particlePair.first);
pair<Energy,Energy> rval = calculateInitialFinalScales(a,isDecayCase);
return pair<Energy,Energy>(rval.second,rval.first);
}
else if(!FS1 &&FS2)
return calculateInitialFinalScales(particlePair,isDecayCase);
else
return calculateInitialInitialScales(particlePair);
}
diff --git a/Shower/Base/ShowerTree.cc b/Shower/Base/ShowerTree.cc
--- a/Shower/Base/ShowerTree.cc
+++ b/Shower/Base/ShowerTree.cc
@@ -1,914 +1,1111 @@
// -*- C++ -*-
//
// ShowerTree.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#include "ShowerProgenitor.h"
+#include "ThePEG/EventRecord/MultiColour.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ShowerTree.h"
#include "Herwig++/Shower/Base/ShowerParticle.h"
#include "ThePEG/PDT/DecayMode.h"
#include "ThePEG/Handlers/EventHandler.h"
#include "ThePEG/Handlers/XComb.h"
#include "KinematicsReconstructor.h"
#include <cassert>
#include "ThePEG/Repository/CurrentGenerator.h"
using namespace Herwig;
using namespace ThePEG;
set<long> ShowerTree::_decayInShower = set<long>();
namespace {
-void findBeam(tPPtr & beam, PPtr incoming) {
- while(!beam->children().empty()) {
- bool found=false;
- for(unsigned int ix=0;ix<beam->children().size();++ix) {
- if(beam->children()[ix]==incoming) {
- found = true;
- break;
+ void findBeam(tPPtr & beam, PPtr incoming) {
+ while(!beam->children().empty()) {
+ bool found=false;
+ for(unsigned int ix=0;ix<beam->children().size();++ix) {
+ if(beam->children()[ix]==incoming) {
+ found = true;
+ break;
+ }
}
+ if(found) break;
+ beam = beam->children()[0];
}
- if(found) break;
- beam = beam->children()[0];
}
}
-}
// constructor from hard process
ShowerTree::ShowerTree(const PPair incoming, const ParticleVector & out,
- ShowerDecayMap& decay)
+ ShowerDecayMap& decay)
: _hardMECorrection(false), _wasHard(true),
_parent(), _hasShowered(false) {
tPPair beam = CurrentGenerator::current().currentEvent()->incoming();
findBeam(beam.first ,incoming.first );
findBeam(beam.second,incoming.second);
_incoming = incoming;
double x1(_incoming.first ->momentum().rho()/beam.first ->momentum().rho());
double x2(_incoming.second->momentum().rho()/beam.second->momentum().rho());
// must have two incoming particles
assert(_incoming.first && _incoming.second);
// set the parent tree
_parent=ShowerTreePtr();
// temporary vectors to contain all the particles before insertion into
// the data structure
vector<PPtr> original,copy;
vector<ShowerParticlePtr> shower;
// create copies of ThePEG particles for the incoming particles
original.push_back(_incoming.first);
copy.push_back(new_ptr(Particle(*_incoming.first)));
original.push_back(_incoming.second);
copy.push_back(new_ptr(Particle(*_incoming.second)));
// and same for outgoing
map<PPtr,ShowerTreePtr> trees;
for (ParticleVector::const_iterator it = out.begin();
it != out.end(); ++it) {
// if decayed or should be decayed in shower make the tree
PPtr orig = *it;
- if(!orig->children().empty()||
+ if(!orig->children().empty() ||
(decaysInShower(orig->id())&&!orig->dataPtr()->stable())) {
ShowerTreePtr newtree=new_ptr(ShowerTree(orig,decay));
newtree->setParents();
trees.insert(make_pair(orig,newtree));
Energy width=orig->dataPtr()->generateWidth(orig->mass());
decay.insert(make_pair(width,newtree));
}
original.push_back(orig);
copy.push_back(new_ptr(Particle(*orig)));
}
// colour isolate the hard process
colourIsolate(original,copy);
// now create the Shower particles
// create ShowerParticles for the incoming particles
assert(original.size() == copy.size());
for(unsigned int ix=0;ix<original.size();++ix) {
ShowerParticlePtr temp=new_ptr(ShowerParticle(*copy[ix],1,ix>=2));
fixColour(temp);
// incoming
if(ix<2) {
temp->x(ix==0 ? x1 : x2);
_incomingLines.insert(make_pair(new_ptr(ShowerProgenitor(original[ix],
- copy[ix],temp)),
- temp));
+ copy[ix],temp)),temp));
_backward.insert(temp);
}
// outgoing
else {
_outgoingLines.insert(make_pair(new_ptr(ShowerProgenitor(original[ix],
- copy[ix],temp)),
- temp));
+ copy[ix],temp)),temp));
_forward.insert(temp);
}
}
// set up the map of daughter trees
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator mit;
for(mit=_outgoingLines.begin();mit!=_outgoingLines.end();++mit) {
map<PPtr,ShowerTreePtr>::const_iterator tit=trees.find(mit->first->original());
if(tit!=trees.end())
_treelinks.insert(make_pair(tit->second,
- make_pair(mit->first,mit->first->progenitor())));
+ make_pair(mit->first,mit->first->progenitor())));
}
}
ShowerTree::ShowerTree(PPtr in,
- ShowerDecayMap& decay)
+ ShowerDecayMap& decay)
: _hardMECorrection(false), _wasHard(false), _hasShowered(false) {
// there must be an incoming particle
assert(in);
// temporary vectors to contain all the particles before insertion into
// the data structure
vector<PPtr> original,copy;
// insert place holder for incoming particle
original.push_back(in);
copy.push_back(PPtr());
// we need to deal with the decay products if decayed
map<PPtr,ShowerTreePtr> trees;
if(!in->children().empty()) {
ParticleVector children=in->children();
for(unsigned int ix=0;ix<children.size();++ix) {
// if decayed or should be decayed in shower make the tree
PPtr orig=children[ix];
in->abandonChild(orig);
if(!orig->children().empty()||
- (decaysInShower(orig->id())&&!orig->dataPtr()->stable())) {
- ShowerTreePtr newtree=new_ptr(ShowerTree(orig,decay));
- trees.insert(make_pair(orig,newtree));
- Energy width=orig->dataPtr()->generateWidth(orig->mass());
- decay.insert(make_pair(width,newtree));
- newtree->setParents();
- newtree->_parent=this;
+ (decaysInShower(orig->id())&&!orig->dataPtr()->stable())) {
+ ShowerTreePtr newtree=new_ptr(ShowerTree(orig,decay));
+ trees.insert(make_pair(orig,newtree));
+ Energy width=orig->dataPtr()->generateWidth(orig->mass());
+ decay.insert(make_pair(width,newtree));
+ newtree->setParents();
+ newtree->_parent=this;
}
original.push_back(orig);
copy.push_back(new_ptr(Particle(*orig)));
}
}
// create the incoming particle
copy[0] = new_ptr(Particle(*in));
// isolate the colour
colourIsolate(original,copy);
// create the parent
ShowerParticlePtr sparent(new_ptr(ShowerParticle(*copy[0],2,false)));
fixColour(sparent);
_incomingLines.insert(make_pair(new_ptr(ShowerProgenitor(original[0],copy[0],sparent))
- ,sparent));
+ ,sparent));
// return if not decayed
if(original.size()==1) return;
// create the children
assert(copy.size() == original.size());
for (unsigned int ix=1;ix<original.size();++ix) {
ShowerParticlePtr stemp= new_ptr(ShowerParticle(*copy[ix],2,true));
fixColour(stemp);
_outgoingLines.insert(make_pair(new_ptr(ShowerProgenitor(original[ix],copy[ix],
- stemp)),
- stemp));
+ stemp)),
+ stemp));
_forward.insert(stemp);
}
// set up the map of daughter trees
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator mit;
for(mit=_outgoingLines.begin();mit!=_outgoingLines.end();++mit) {
map<PPtr,ShowerTreePtr>::const_iterator tit=trees.find(mit->first->original());
if(tit!=trees.end())
_treelinks.insert(make_pair(tit->second,
- make_pair(mit->first,mit->first->progenitor())));
+ make_pair(mit->first,mit->first->progenitor())));
}
}
void ShowerTree::updateFinalStateShowerProduct(ShowerProgenitorPtr progenitor,
- ShowerParticlePtr parent,
- const ShowerParticleVector & children) {
+ ShowerParticlePtr parent,
+ const ShowerParticleVector & children) {
assert(children.size()==2);
bool matches[2];
for(unsigned int ix=0;ix<2;++ix) {
matches[ix] = children[ix]->id()==progenitor->id();
}
ShowerParticlePtr newpart;
if(matches[0]&&matches[1]) {
if(parent->showerKinematics()->z()>0.5) newpart=children[0];
else newpart=children[1];
}
else if(matches[0]) newpart=children[0];
else if(matches[1]) newpart=children[1];
_outgoingLines[progenitor]=newpart;
}
void ShowerTree::updateInitialStateShowerProduct(ShowerProgenitorPtr progenitor,
- ShowerParticlePtr newParent) {
+ ShowerParticlePtr newParent) {
_incomingLines[progenitor]=newParent;
}
+void ShowerTree::isolateLine(vector<PPair>::const_iterator cit,
+ vector<PPair> & particles,
+ tcColinePtr oldline,
+ tColinePtr newline) {
+ // loop over particles
+ for(vector<PPair>::const_iterator cjt=particles.begin();
+ cjt!=particles.end();++cjt) {
+ if(cjt==cit) continue;
+ // if particle has colour line
+ if((*cjt).second->colourLine()) {
+ // if only one check if current line and reset
+ if(int((*cjt).second->colourInfo()->colourLines().size())==1) {
+ if((*cjt).second->colourLine()==oldline)
+ newline->addColoured((*cjt).first);
+ }
+ // if more than one check if each line current line and reset
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cjt).second->colourInfo());
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cjt).first ->colourInfo());
+ for(unsigned int ix=0;ix<colour1->colourLines().size();++ix) {
+ if(colour1->colourLines()[ix]==oldline)
+ colour2->colourLine(newline,int(ix)+1);
+ }
+ }
+ }
+ // if particle has anticolour line
+ if((*cjt).second->antiColourLine()) {
+ // if only one check if current line and reset
+ if(int((*cjt).second->colourInfo()->antiColourLines().size())==1) {
+ if((*cjt).second->antiColourLine()==oldline)
+ newline->addColoured((*cjt).first,true);
+ }
+ // if more than one check if each line current line and reset
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cjt).second->colourInfo());
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cjt).first ->colourInfo());
+ for(unsigned int ix=0;ix<colour1->antiColourLines().size();++ix) {
+ if(colour1->antiColourLines()[ix]==oldline)
+ colour2->antiColourLine(newline, int(ix)+1);
+ }
+ }
+ }
+ }
+}
+
void ShowerTree::colourIsolate(const vector<PPtr> & original,
- const vector<PPtr> & copy) {
+ const vector<PPtr> & copy) {
// vectors must have same size
assert(original.size()==copy.size());
// create a temporary map with all the particles to make looping easier
vector<PPair> particles;
particles.reserve(original.size());
for(unsigned int ix=0;ix<original.size();++ix)
particles.push_back(make_pair(copy[ix],original[ix]));
// reset the colour of the copies
- vector<PPair>::const_iterator cit,cjt;
- for(cit=particles.begin();cit!=particles.end();++cit)
- if((*cit).first->colourInfo()) (*cit).first->colourInfo(new_ptr(ColourBase()));
- map<tColinePtr,tColinePtr> cmap;
+ vector<PPair>::const_iterator cit;
+ for(cit=particles.begin();cit!=particles.end();++cit) {
+ if((*cit).first->colourInfo()) {
+ if((*cit).first->dataPtr()->iColour() == PDT::Colour6 ||
+ (*cit).first->dataPtr()->iColour() == PDT::Colour6bar)
+ (*cit).first->colourInfo(new_ptr(MultiColour()));
+ else
+ (*cit).first->colourInfo(new_ptr(ColourBase()));
+ }
+ }
+ map<tcColinePtr,tColinePtr> cmap;
// make the colour connections of the copies
- for(cit=particles.begin();cit!=particles.end();++cit) {
- ColinePtr c1,newline;
- // if particle has a colour line
- if((*cit).second->colourLine()&&!(*cit).first->colourLine()) {
- c1=(*cit).second->colourLine();
- newline=ColourLine::create((*cit).first);
- cmap[c1]=newline;
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(cjt==cit) continue;
- if((*cjt).second->colourLine()==c1)
- newline->addColoured((*cjt).first);
- else if((*cjt).second->antiColourLine()==c1)
- newline->addColoured((*cjt).first,true);
+ // loop over the particles
+ for(cit=particles.begin();cit!=particles.end();++cit) {
+ // if particle has at least one colour line
+ if((*cit).second->colourLine()) {
+ // one and only one line
+ if(int((*cit).second->colourInfo()->colourLines().size())==1) {
+ // if not already change
+ if(!(*cit).first->colourLine()) {
+ // make new line
+ tcColinePtr oldline=(*cit).second->colourLine();
+ ColinePtr newline=ColourLine::create((*cit).first);
+ cmap[oldline]=newline;
+ isolateLine(cit,particles,oldline,newline);
+ }
+ }
+ // more than one line
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cit).second->colourInfo());
+ vector<tcColinePtr> lines1 = colour1->colourLines();
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cit).first->colourInfo());
+ vector<tcColinePtr> lines2 = colour2->colourLines();
+ // loop over lines
+ for(unsigned int ix=0;ix<lines1.size();++ix) {
+ if( (lines2.size()>ix && !lines2[ix]) ||
+ lines2.size()<=ix) {
+ tcColinePtr oldline = lines1[ix];
+ ColinePtr newline = new_ptr(ColourLine());
+ cmap[oldline]=newline;
+ colour2->colourLine(newline, int(ix)+1);
+ isolateLine(cit,particles,oldline,newline);
+ }
+ }
}
}
// if anticolour line
- if((*cit).second->antiColourLine()&&!(*cit).first->antiColourLine()) {
- c1=(*cit).second->antiColourLine();
- newline=ColourLine::create((*cit).first,true);
- cmap[c1]=newline;
- for(cjt=particles.begin();cjt!=particles.end();++cjt) {
- if(cjt==cit) continue;
- if((*cjt).second->colourLine()==c1)
- newline->addColoured((*cjt).first);
- else if((*cjt).second->antiColourLine()==c1)
- newline->addColoured((*cjt).first,true);
+ if((*cit).second->antiColourLine()) {
+ // one and only one line
+ if(int((*cit).second->colourInfo()->antiColourLines().size())==1) {
+ // if not already change
+ if(!(*cit).first->antiColourLine()) {
+ // make new line
+ tcColinePtr oldline=(*cit).second->antiColourLine();
+ ColinePtr newline=ColourLine::create((*cit).first, true);
+ cmap[oldline]=newline;
+ isolateLine(cit,particles,oldline,newline);
+ }
}
- }
- }
+ // more than one line
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cit).second->colourInfo());
+ vector<tcColinePtr> lines1 = colour1->antiColourLines();
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>
+ ((*cit).first->colourInfo());
+ vector<tcColinePtr> lines2 = colour2->antiColourLines();
+ // loop over lines
+ for(unsigned int ix=0;ix<lines1.size();++ix) {
+ if( (lines2.size()>ix && !lines2[ix]) ||
+ lines2.size()<=ix) {
+ tcColinePtr oldline = lines1[ix];
+ ColinePtr newline = new_ptr(ColourLine());
+ cmap[oldline]=newline;
+ colour2->antiColourLine(newline, int(ix)+1);
+ isolateLine(cit,particles,oldline,newline);
+ }
+ }
+ }
+ }
+ }
+
// sort out sinks and sources
for(cit=particles.begin();cit!=particles.end();++cit) {
tColinePtr cline[2];
tColinePair cpair;
for(unsigned int ix=0;ix<4;++ix) {
cline[0] = ix<2 ? cit->second->colourLine() : cit->second->antiColourLine();
cline[1] = ix<2 ? cit->first ->colourLine() : cit->first ->antiColourLine();
if(cline[0]) {
- switch (ix) {
- case 0: case 2:
- cpair = cline[0]->sinkNeighbours();
- break;
- case 1: case 3:
- cpair = cline[0]->sourceNeighbours();
- break;
- };
+ switch (ix) {
+ case 0: case 2:
+ cpair = cline[0]->sinkNeighbours();
+ break;
+ case 1: case 3:
+ cpair = cline[0]->sourceNeighbours();
+ break;
+ };
}
else {
- cpair = make_pair(tColinePtr(),tColinePtr());
+ cpair = make_pair(tColinePtr(),tColinePtr());
}
if(cline[0]&&cpair.first) {
- map<tColinePtr,tColinePtr>::const_iterator
- mit[2] = {cmap.find(cpair.first),cmap.find(cpair.second)};
- if(mit[0]!=cmap.end()&&mit[1]!=cmap.end()) {
- if(ix==0||ix==2) {
- cline[1]->setSinkNeighbours(mit[0]->second,mit[1]->second);
- }
- else {
- cline[1]->setSourceNeighbours(mit[0]->second,mit[1]->second);
- }
- }
+ map<tcColinePtr,tColinePtr>::const_iterator
+ mit[2] = {cmap.find(cpair.first),cmap.find(cpair.second)};
+ if(mit[0]!=cmap.end()&&mit[1]!=cmap.end()) {
+ if(ix==0||ix==2) {
+ cline[1]->setSinkNeighbours(mit[0]->second,mit[1]->second);
+ }
+ else {
+ cline[1]->setSourceNeighbours(mit[0]->second,mit[1]->second);
+ }
+ }
}
}
}
}
-
+
+void ShowerTree::mapColour(PPtr original,
+ PPtr copy) {
+ // has colour line
+ if(copy->colourLine()) {
+ // one and only one
+ if(copy->colourInfo()->colourLines().size()==1) {
+ _colour.insert(make_pair(copy->colourLine(),
+ original->colourLine()));
+ }
+ // more than one
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(copy->colourInfo());
+ vector<tcColinePtr> lines1 = colour1->colourLines();
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(original->colourInfo());
+ vector<tcColinePtr> lines2 = colour2->colourLines();
+ for(unsigned int ix=0;ix<lines1.size();++ix)
+ _colour.insert(make_pair(const_ptr_cast<ColinePtr>(lines1[ix]),
+ const_ptr_cast<ColinePtr>(lines2[ix])));
+ }
+ }
+ // has anticolour line
+ if(copy->antiColourLine()) {
+ // one and only one
+ if(copy->colourInfo()->antiColourLines().size()==1) {
+ _colour.insert(make_pair(copy->antiColourLine(),
+ original->antiColourLine()));
+ }
+ // more than one
+ else {
+ Ptr<MultiColour>::pointer colour1 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(copy->colourInfo());
+ vector<tcColinePtr> lines1 = colour1->antiColourLines();
+
+ Ptr<MultiColour>::pointer colour2 =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(original->colourInfo());
+ vector<tcColinePtr> lines2 = colour2->antiColourLines();
+
+ for(unsigned int ix=0;ix<lines1.size();++ix)
+ _colour.insert(make_pair(const_ptr_cast<ColinePtr>(lines1[ix]),
+ const_ptr_cast<ColinePtr>(lines2[ix])));
+ }
+ }
+}
+
void ShowerTree::insertHard(StepPtr pstep, bool ISR, bool) {
assert(_incomingLines.size()==2);
_colour.clear();
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator cit;
// construct the map of colour lines for hard process
for(cit=_incomingLines.begin();cit!=_incomingLines.end();++cit) {
if(!cit->first->perturbative()) continue;
- if((*cit).first->copy()->colourLine())
- _colour.insert(make_pair((*cit).first->copy()->colourLine(),
- (*cit).first->original()->colourLine()));
- if((*cit).first->copy()->antiColourLine())
- _colour.insert(make_pair((*cit).first->copy()->antiColourLine(),
- (*cit).first->original()->antiColourLine()));
+ mapColour(cit->first->original(),cit->first->copy());
}
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
for(cjt=_outgoingLines.begin();cjt!=_outgoingLines.end();++cjt) {
- if(!cjt->first->perturbative()) continue;
- if((*cjt).first->copy()->colourLine())
- _colour.insert(make_pair((*cjt).first->copy()->colourLine(),
- (*cjt).first->original()->colourLine()));
- if((*cjt).first->copy()->antiColourLine())
- _colour.insert(make_pair((*cjt).first->copy()->antiColourLine(),
- (*cjt).first->original()->antiColourLine()));
+ if(!cjt->first->perturbative()) continue;
+ mapColour(cjt->first->original(),cjt->first->copy());
}
// initial-state radiation
if(ISR) {
for(cit=incomingLines().begin();cit!=incomingLines().end();++cit) {
ShowerParticlePtr init=(*cit).first->progenitor();
assert(init->getThePEGBase());
PPtr original = (*cit).first->original();
if(original->parents().empty()) continue;
PPtr hadron= original->parents()[0];
assert(!original->children().empty());
PPtr copy=cit->first->copy();
ParticleVector intermediates=original->children();
for(unsigned int ix=0;ix<intermediates.size();++ix) {
- init->abandonChild(intermediates[ix]);
- copy->abandonChild(intermediates[ix]);
+ init->abandonChild(intermediates[ix]);
+ copy->abandonChild(intermediates[ix]);
}
// if not from a matrix element correction
if(cit->first->perturbative()) {
- // break mother/daugther relations
- init->addChild(original);
- hadron->abandonChild(original);
- // if particle showers add shower
- if(cit->first->hasEmitted()) {
- addInitialStateShower(init,hadron,pstep,false);
- }
- // no showering for this particle
- else {
- updateColour(init);
- hadron->addChild(init);
- pstep->addIntermediate(init);
- }
+ // break mother/daugther relations
+ init->addChild(original);
+ hadron->abandonChild(original);
+ // if particle showers add shower
+ if(cit->first->hasEmitted()) {
+ addInitialStateShower(init,hadron,pstep,false);
+ }
+ // no showering for this particle
+ else {
+ updateColour(init);
+ hadron->addChild(init);
+ pstep->addIntermediate(init);
+ }
}
// from matrix element correction
else {
- // break mother/daugther relations
- hadron->abandonChild(original);
- copy->addChild(original);
- updateColour(copy);
- init->addChild(copy);
- pstep->addIntermediate(copy);
- // if particle showers add shower
- if(cit->first->hasEmitted()) {
- addInitialStateShower(init,hadron,pstep,false);
- }
- // no showering for this particle
- else {
- updateColour(init);
- hadron->addChild(init);
- pstep->addIntermediate(init);
- }
+ // break mother/daugther relations
+ hadron->abandonChild(original);
+ copy->addChild(original);
+ updateColour(copy);
+ init->addChild(copy);
+ pstep->addIntermediate(copy);
+ // if particle showers add shower
+ if(cit->first->hasEmitted()) {
+ addInitialStateShower(init,hadron,pstep,false);
+ }
+ // no showering for this particle
+ else {
+ updateColour(init);
+ hadron->addChild(init);
+ pstep->addIntermediate(init);
+ }
}
}
}
else {
for(cit=incomingLines().begin();cit!=incomingLines().end();++cit) {
ShowerParticlePtr init=(*cit).first->progenitor();
assert(init->getThePEGBase());
PPtr original = (*cit).first->original();
if(original->parents().empty()) continue;
PPtr hadron= original->parents()[0];
assert(!original->children().empty());
PPtr copy=cit->first->copy();
ParticleVector intermediates=original->children();
for(unsigned int ix=0;ix<intermediates.size();++ix) {
- init->abandonChild(intermediates[ix]);
- copy->abandonChild(intermediates[ix]);
+ init->abandonChild(intermediates[ix]);
+ copy->abandonChild(intermediates[ix]);
}
// break mother/daugther relations
init->addChild(original);
hadron->abandonChild(original);
// no showering for this particle
updateColour(init);
hadron->addChild(init);
pstep->addIntermediate(init);
}
}
// final-state radiation
for(cjt=outgoingLines().begin();cjt!=outgoingLines().end();++cjt) {
ShowerParticlePtr init=(*cjt).first->progenitor();
assert(init->getThePEGBase());
// if not from a matrix element correction
if(cjt->first->perturbative()) {
// register the shower particle as a
// copy of the one from the hard process
tParticleVector parents=init->parents();
for(unsigned int ix=0;ix<parents.size();++ix)
- parents[ix]->abandonChild(init);
+ parents[ix]->abandonChild(init);
(*cjt).first->original()->addChild(init);
pstep->addDecayProduct(init);
}
// from a matrix element correction
else {
if(cjt->first->original()==_incoming.first||
- cjt->first->original()==_incoming.second) {
- updateColour((*cjt).first->copy());
- (*cjt).first->original()->parents()[0]->
- addChild((*cjt).first->copy());
- pstep->addDecayProduct((*cjt).first->copy());
- (*cjt).first->copy()->addChild(init);
- pstep->addDecayProduct(init);
+ cjt->first->original()==_incoming.second) {
+ updateColour((*cjt).first->copy());
+ (*cjt).first->original()->parents()[0]->
+ addChild((*cjt).first->copy());
+ pstep->addDecayProduct((*cjt).first->copy());
+ (*cjt).first->copy()->addChild(init);
+ pstep->addDecayProduct(init);
}
else {
- updateColour((*cjt).first->copy());
- (*cjt).first->original()->addChild((*cjt).first->copy());
- pstep->addDecayProduct((*cjt).first->copy());
- (*cjt).first->copy()->addChild(init);
- pstep->addDecayProduct(init);
+ updateColour((*cjt).first->copy());
+ (*cjt).first->original()->addChild((*cjt).first->copy());
+ pstep->addDecayProduct((*cjt).first->copy());
+ (*cjt).first->copy()->addChild(init);
+ pstep->addDecayProduct(init);
}
}
updateColour(init);
// insert shower products
addFinalStateShower(init,pstep);
}
_colour.clear();
}
void ShowerTree::addFinalStateShower(PPtr p, StepPtr s) {
if(p->children().empty()) return;
ParticleVector::const_iterator child;
for(child=p->children().begin(); child != p->children().end(); ++child) {
updateColour(*child);
s->addDecayProduct(*child);
addFinalStateShower(*child,s);
}
}
void ShowerTree::updateColour(PPtr particle) {
// if attached to a colour line
if(particle->colourLine()) {
- bool reset=false;
- // if colour line from hard process reconnect
- if(_colour.find(particle->colourLine())!=_colour.end()) {
+ // one and only one
+ if(particle->colourInfo()->colourLines().size()==1) {
+ bool reset=false;
ColinePtr c1=particle->colourLine();
- c1->removeColoured(particle);
- _colour[c1]->addColoured(particle);
- reset=true;
+ if(_colour.find(c1)!=_colour.end()) {
+ c1->removeColoured(particle);
+ _colour[c1]->addColoured(particle);
+ reset=true;
+ }
+ // ensure properly connected to the line
+ if(!reset) {
+ ColinePtr c1=particle->colourLine();
+ c1->removeColoured(particle);
+ c1->addColoured(particle);
+ }
}
- // ensure properly connected to the line
- if(!reset) {
- ColinePtr c1=particle->colourLine();
- c1->removeColoured(particle);
- c1->addColoured(particle);
+ else {
+ Ptr<MultiColour>::pointer colour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(particle->colourInfo());
+ vector<tcColinePtr> lines = colour->colourLines();
+ for(unsigned int ix=0;ix<lines.size();++ix) {
+ ColinePtr c1 = const_ptr_cast<ColinePtr>(lines[ix]);
+ if(_colour.find(c1)!=_colour.end()) {
+ colour->colourLine(_colour[c1],int(ix)+1);
+ c1->removeColoured(particle);
+ }
+ }
}
}
// if attached to an anticolour line
if(particle->antiColourLine()) {
bool reset=false;
- // if anti colour line from hard process reconnect
- if(_colour.find(particle->antiColourLine())!=_colour.end()) {
+ // one and only one
+ if(particle->colourInfo()->antiColourLines().size()==1) {
+ // if anti colour line from hard process reconnect
ColinePtr c1=particle->antiColourLine();
- c1->removeColoured(particle,true);
- _colour[c1]->addColoured(particle,true);
- reset=true;
+ if(_colour.find(c1)!=_colour.end()) {
+ c1->removeColoured(particle,true);
+ _colour[c1]->addColoured(particle,true);
+ reset=true;
+ }
+ if(!reset) {
+ ColinePtr c1=particle->antiColourLine();
+ c1->removeColoured(particle,true);
+ c1->addColoured(particle,true);
+ }
}
- if(!reset) {
- ColinePtr c1=particle->antiColourLine();
- c1->removeColoured(particle,true);
- c1->addColoured(particle,true);
+ else {
+ Ptr<MultiColour>::pointer colour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(particle->colourInfo());
+ vector<tcColinePtr> lines = colour->antiColourLines();
+ for(unsigned int ix=0;ix<lines.size();++ix) {
+ ColinePtr c1 = const_ptr_cast<ColinePtr>(lines[ix]);
+ if(_colour.find(c1)!=_colour.end()) {
+ colour->antiColourLine(_colour[c1],int(ix)+1);
+ c1->removeColoured(particle,true);
+ }
+ }
}
}
}
-
+
void ShowerTree::addInitialStateShower(PPtr p, PPtr hadron,
- StepPtr s, bool addchildren) {
+ StepPtr s, bool addchildren) {
// Each parton here should only have one parent
- if(!p->parents().empty()) {
+ if(!p->parents().empty()) {
if(p->parents().size()!=1)
throw Exception() << "Particle must only have one parent in ShowerTree"
- << "::addInitialStateShower" << Exception::runerror;
+ << "::addInitialStateShower" << Exception::runerror;
addInitialStateShower(p->parents()[0],hadron,s);
}
else {
hadron->addChild(p);
s->addIntermediate(p);
}
updateColour(p);
ParticleVector::const_iterator child;
// if not adding children return
if(!addchildren) return;
// add children
for(child = p->children().begin(); child != p->children().end(); ++child) {
- // if a final-state particle update the colour
+ // if a final-state particle udate the colour
ShowerParticlePtr schild =
dynamic_ptr_cast<ShowerParticlePtr>(*child);
if(schild && schild->isFinalState()) updateColour(*child);
// if there are grandchildren of p
if(!(*child)->children().empty()) {
// Add child as intermediate
s->addIntermediate(*child);
// If child is shower particle and final-state, add children
if(schild && schild->isFinalState()) addFinalStateShower(schild,s);
}
else
s->addDecayProduct(*child);
}
}
void ShowerTree::decay(ShowerDecayMap & decay) {
// must be one incoming particle
assert(_incomingLines.size()==1);
// if already decayed return
if(!_outgoingLines.empty()) return;
// otherwise decay it
// now we need to replace the particle with a new copy after the shower
// find particle after the shower
ShowerParticlePtr newparent=_parent->_treelinks[this].second;
// now make the new progenitor
vector<PPtr> original,copy;
original.push_back(newparent);
copy.push_back(new_ptr(Particle(*newparent)));
// reisolate the colour
colourIsolate(original,copy);
// make the new progenitor
ShowerParticlePtr stemp=new_ptr(ShowerParticle(*copy[0],2,false));
fixColour(stemp);
ShowerProgenitorPtr newprog=new_ptr(ShowerProgenitor(original[0],copy[0],stemp));
_incomingLines.clear();
_incomingLines.insert(make_pair(newprog,stemp));
// now we need to decay the copy
PPtr parent=copy[0];
unsigned int ntry = 0;
while (true) {
// exit if fails
if (++ntry>=200)
throw Exception() << "Failed to perform decay in ShowerTree::decay()"
- << " after " << 200
- << " attempts for " << parent->PDGName()
- << Exception::eventerror;
+ << " after " << 200
+ << " attempts for " << parent->PDGName()
+ << Exception::eventerror;
// select decay mode
tDMPtr dm(parent->data().selectMode(*parent));
if(!dm)
throw Exception() << "Failed to select decay mode in ShowerTree::decay()"
- << "for " << newparent->PDGName()
- << Exception::eventerror;
+ << "for " << newparent->PDGName()
+ << Exception::eventerror;
if(!dm->decayer())
throw Exception() << "No Decayer for selected decay mode "
- << " in ShowerTree::decay()"
- << Exception::runerror;
+ << " in ShowerTree::decay()"
+ << Exception::runerror;
// start of try block
try {
ParticleVector children = dm->decayer()->decay(*dm, *parent);
// if no children have another go
if(children.empty()) continue;
// set up parent
parent->decayMode(dm);
// add children
for (unsigned int i = 0, N = children.size(); i < N; ++i ) {
- children[i]->setLabVertex(parent->labDecayVertex());
- parent->addChild(children[i]);
- parent->scale(ZERO);
+ children[i]->setLabVertex(parent->labDecayVertex());
+ parent->addChild(children[i]);
+ parent->scale(ZERO);
}
// if succeeded break out of loop
break;
}
catch(KinematicsReconstructionVeto) {}
}
// insert the trees from the children
ParticleVector children=parent->children();
map<PPtr,ShowerTreePtr> trees;
for(unsigned int ix=0;ix<children.size();++ix) {
PPtr orig=children[ix];
parent->abandonChild(orig);
// if particle has children or decays in shower
if(!orig->children().empty()||
(decaysInShower(orig->id())&&!orig->dataPtr()->stable())) {
ShowerTreePtr newtree=new_ptr(ShowerTree(orig,decay));
trees.insert(make_pair(orig,newtree));
Energy width=orig->dataPtr()->generateWidth(orig->mass());
decay.insert(make_pair(width,newtree));
}
// now create the shower progenitors
PPtr ncopy=new_ptr(Particle(*orig));
//copy[0]->addChild(ncopy);
ShowerParticlePtr nshow=new_ptr(ShowerParticle(*ncopy,2,true));
fixColour(nshow);
ShowerProgenitorPtr prog=new_ptr(ShowerProgenitor(children[ix],
- ncopy,nshow));
+ ncopy,nshow));
_outgoingLines.insert(make_pair(prog,nshow));
}
// set up the map of daughter trees
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator mit;
for(mit=_outgoingLines.begin();mit!=_outgoingLines.end();++mit) {
map<PPtr,ShowerTreePtr>::const_iterator tit=trees.find(mit->first->original());
if(tit!=trees.end()) {
_treelinks.insert(make_pair(tit->second,
- make_pair(mit->first,
- mit->first->progenitor())));
+ make_pair(mit->first,
+ mit->first->progenitor())));
tit->second->_parent=this;
}
}
}
void ShowerTree::insertDecay(StepPtr pstep,bool ISR, bool) {
assert(_incomingLines.size()==1);
_colour.clear();
// find final particle from previous tree
PPtr final;
if(_parent&&!_parent->_treelinks.empty())
final = _parent->_treelinks[this].second;
else
final=_incomingLines.begin()->first->original();
// construct the map of colour lines
PPtr copy=_incomingLines.begin()->first->copy();
- if(copy->colourLine())
- _colour.insert(make_pair(copy->colourLine(),final->colourLine()));
- if(copy->antiColourLine())
- _colour.insert(make_pair(copy->antiColourLine(),final->antiColourLine()));
+ mapColour(final,copy);
// initial-state radiation
if(ISR&&!_incomingLines.begin()->first->progenitor()->children().empty()) {
ShowerParticlePtr init=_incomingLines.begin()->first->progenitor();
updateColour(init);
final->addChild(init);
pstep->addDecayProduct(init);
// insert shower products
addFinalStateShower(init,pstep);
// sort out colour
final=_incomingLines.begin()->second;
_colour.clear();
- if(copy->colourLine())
- _colour.insert(make_pair(copy->colourLine(),final->colourLine()));
- if(copy->antiColourLine())
- _colour.insert(make_pair(copy->antiColourLine(),final->antiColourLine()));
+ mapColour(final,copy);
}
// get the decaying particles
// make the copy
tColinePair cline=make_pair(copy->colourLine(),copy->antiColourLine());
updateColour(copy);
// sort out sinks and sources if needed
if(cline.first) {
if(cline.first->sourceNeighbours().first) {
copy->colourLine()->setSourceNeighbours(cline.first->sourceNeighbours().first,
- cline.first->sourceNeighbours().second);
+ cline.first->sourceNeighbours().second);
}
else if (cline.first->sinkNeighbours().first) {
copy->colourLine()->setSinkNeighbours(cline.first->sinkNeighbours().first,
- cline.first->sinkNeighbours().second);
+ cline.first->sinkNeighbours().second);
}
}
if(cline.second) {
if(cline.second->sourceNeighbours().first) {
copy->antiColourLine()->setSourceNeighbours(cline.second->sourceNeighbours().first,
- cline.second->sourceNeighbours().second);
+ cline.second->sourceNeighbours().second);
}
else if (cline.second->sinkNeighbours().first) {
copy->antiColourLine()->setSinkNeighbours(cline.second->sinkNeighbours().first,
- cline.second->sinkNeighbours().second);
+ cline.second->sinkNeighbours().second);
}
}
// copy of the one from the hard process
tParticleVector dpar=copy->parents();
for(unsigned int ix=0;ix<dpar.size();++ix) dpar[ix]->abandonChild(copy);
final->addChild(copy);
pstep->addDecayProduct(copy);
// final-state radiation
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cit;
for(cit=outgoingLines().begin();cit!=outgoingLines().end();++cit) {
ShowerParticlePtr init=cit->first->progenitor();
if(!init->getThePEGBase())
throw Exception() << "Final-state particle must have a ThePEGBase"
- << " in ShowerTree::fillEventRecord()"
- << Exception::runerror;
+ << " in ShowerTree::insertDecay()"
+ << Exception::runerror;
// if not from matrix element correction
if(cit->first->perturbative()) {
// add the child
updateColour(cit->first->copy());
PPtr orig=cit->first->original();
copy->addChild(orig);
pstep->addDecayProduct(orig);
orig->addChild(cit->first->copy());
pstep->addDecayProduct(cit->first->copy());
// register the shower particle as a
// copy of the one from the hard process
tParticleVector parents=init->parents();
for(unsigned int ix=0;ix<parents.size();++ix)
- {parents[ix]->abandonChild(init);}
+ {parents[ix]->abandonChild(init);}
(*cit).first->copy()->addChild(init);
pstep->addDecayProduct(init);
updateColour(init);
}
// from a matrix element correction
else {
if(copy->children().end()==
- find(copy->children().begin(),copy->children().end(),
- cit->first->original())) {
- updateColour(cit->first->original());
- copy->addChild(cit->first->original());
- pstep->addDecayProduct(cit->first->original());
+ find(copy->children().begin(),copy->children().end(),
+ cit->first->original())) {
+ updateColour(cit->first->original());
+ copy->addChild(cit->first->original());
+ pstep->addDecayProduct(cit->first->original());
}
updateColour(cit->first->copy());
cit->first->original()->addChild(cit->first->copy());
pstep->addDecayProduct(cit->first->copy());
// register the shower particle as a
// copy of the one from the hard process
tParticleVector parents=init->parents();
for(unsigned int ix=0;ix<parents.size();++ix)
- {parents[ix]->abandonChild(init);}
+ {parents[ix]->abandonChild(init);}
(*cit).first->copy()->addChild(init);
pstep->addDecayProduct(init);
updateColour(init);
}
// insert shower products
addFinalStateShower(init,pstep);
}
_colour.clear();
}
void ShowerTree::clear() {
// reset the has showered flag
_hasShowered=false;
// clear the colour map
_colour.clear();
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cit;
map<ShowerProgenitorPtr, ShowerParticlePtr>::const_iterator cjt;
// abandon the children of the outgoing particles
for(cit=_outgoingLines.begin();cit!=_outgoingLines.end();++cit) {
ShowerParticlePtr orig=cit->first->progenitor();
orig->set5Momentum(cit->first->copy()->momentum());
ParticleVector children=orig->children();
for(unsigned int ix=0;ix<children.size();++ix) orig->abandonChild(children[ix]);
_outgoingLines[cit->first]=orig;
cit->first->hasEmitted(false);
}
// forward products
_forward.clear();
for(cit=_outgoingLines.begin();cit!=_outgoingLines.end();++cit)
_forward.insert(cit->first->progenitor());
// if a decay
if(!_wasHard) {
ShowerParticlePtr orig=_incomingLines.begin()->first->progenitor();
orig->set5Momentum(_incomingLines.begin()->first->copy()->momentum());
ParticleVector children=orig->children();
for(unsigned int ix=0;ix<children.size();++ix) orig->abandonChild(children[ix]);
}
// if a hard process
else {
for(cjt=_incomingLines.begin();cjt!=_incomingLines.end();++cjt) {
tPPtr parent = cjt->first->original()->parents().empty() ?
- tPPtr() : cjt->first->original()->parents()[0];
+ tPPtr() : cjt->first->original()->parents()[0];
ShowerParticlePtr temp=
- new_ptr(ShowerParticle(*cjt->first->copy(),
- cjt->first->progenitor()->perturbative(),
- cjt->first->progenitor()->isFinalState()));
+ new_ptr(ShowerParticle(*cjt->first->copy(),
+ cjt->first->progenitor()->perturbative(),
+ cjt->first->progenitor()->isFinalState()));
fixColour(temp);
temp->x(cjt->first->progenitor()->x());
cjt->first->hasEmitted(false);
if(!(cjt->first->progenitor()==cjt->second)&&cjt->second&&parent)
- parent->abandonChild(cjt->second);
+ parent->abandonChild(cjt->second);
cjt->first->progenitor(temp);
_incomingLines[cjt->first]=temp;
}
}
// reset the particles at the end of the shower
_backward.clear();
// if hard process backward products
if(_wasHard)
for(cjt=_incomingLines.begin();cjt!=_incomingLines.end();++cjt)
_backward.insert(cjt->first->progenitor());
clearTransforms();
}
void ShowerTree::resetShowerProducts() {
map<ShowerProgenitorPtr, ShowerParticlePtr>::const_iterator cit;
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
_backward.clear();
_forward.clear();
for(cit=_incomingLines.begin();cit!=_incomingLines.end();++cit)
_backward.insert(cit->second);
for(cjt=_outgoingLines.begin();cjt!=_outgoingLines.end();++cjt)
_forward.insert(cjt->second);
}
void ShowerTree::updateAfterShower(ShowerDecayMap & decay) {
// update the links
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator mit;
map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::iterator tit;
for(tit=_treelinks.begin();tit!=_treelinks.end();++tit) {
if(tit->second.first) {
mit=_outgoingLines.find(tit->second.first);
if(mit!=_outgoingLines.end()) tit->second.second=mit->second;
}
}
// get the particles coming from those in the hard process
set<tShowerParticlePtr> hard;
for(mit=_outgoingLines.begin();mit!=_outgoingLines.end();++mit)
hard.insert(mit->second);
// find the shower particles which should be decayed in the
// shower but didn't come from the hard process
set<tShowerParticlePtr>::const_iterator cit;
for(cit=_forward.begin();cit!=_forward.end();++cit) {
if(decaysInShower((**cit).id())&&
hard.find(*cit)==hard.end()) {
ShowerTreePtr newtree=new_ptr(ShowerTree(*cit,decay));
newtree->setParents();
newtree->_parent=this;
Energy width=(**cit).dataPtr()->generateWidth((**cit).mass());
decay.insert(make_pair(width,newtree));
_treelinks.insert(make_pair(newtree,
- make_pair(tShowerProgenitorPtr(),*cit)));
+ make_pair(tShowerProgenitorPtr(),*cit)));
}
}
}
void ShowerTree::addFinalStateBranching(ShowerParticlePtr parent,
- const ShowerParticleVector & children) {
+ const ShowerParticleVector & children) {
assert(children.size()==2);
_forward.erase(parent);
for(unsigned int ix=0; ix<children.size(); ++ix) {
_forward.insert(children[ix]);
}
}
void ShowerTree::addInitialStateBranching(ShowerParticlePtr oldParent,
- ShowerParticlePtr newParent,
- ShowerParticlePtr otherChild) {
+ ShowerParticlePtr newParent,
+ ShowerParticlePtr otherChild) {
_backward.erase(oldParent);
_backward.insert(newParent);
_forward.insert(otherChild);
}
-
void ShowerTree::setParents() {
// set the parent tree of the children
map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator tit;
for(tit=_treelinks.begin();tit!=_treelinks.end();++tit)
tit->first->_parent=this;
}
-void ShowerTree::fixColour(tShowerParticlePtr part) {
- ColinePtr line=part->colourLine();
- if(line) {
- line->removeColoured(part);
- line->addColoured(part);
- }
- line=part->antiColourLine();
- if(line) {
- line->removeAntiColoured(part);
- line->addAntiColoured(part);
- }
-}
-
vector<ShowerProgenitorPtr> ShowerTree::extractProgenitors() {
// extract the particles from the ShowerTree
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator mit;
vector<ShowerProgenitorPtr> ShowerHardJets;
for(mit=incomingLines().begin();mit!=incomingLines().end();++mit)
ShowerHardJets.push_back((*mit).first);
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator mjt;
for(mjt=outgoingLines().begin();mjt!=outgoingLines().end();++mjt)
ShowerHardJets.push_back((*mjt).first);
return ShowerHardJets;
}
void ShowerTree::transform(const LorentzRotation & boost, bool applyNow) {
if(applyNow) {
// now boost all the particles
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator cit;
// incoming
for(cit=_incomingLines.begin();cit!=_incomingLines.end();++cit) {
cit->first->progenitor()->deepTransform(boost);
cit->first->copy()->deepTransform(boost);
}
// outgoing
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
for(cjt=_outgoingLines.begin();cjt!=_outgoingLines.end();++cjt) {
cjt->first->progenitor()->deepTransform(boost);
cjt->first->copy()->deepTransform(boost);
}
}
else {
Lorentz5Momentum ptemp1 = _incomingLines.begin()->first->progenitor()->momentum();
Lorentz5Momentum ptemp2 = ptemp1;
ptemp1 *= _transforms;
ptemp1 *= boost;
_transforms.transform(boost);
ptemp2 *= _transforms;
}
// child trees
for(map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator
- tit=_treelinks.begin();tit!=_treelinks.end();++tit)
+ tit=_treelinks.begin();tit!=_treelinks.end();++tit)
tit->first->transform(boost,applyNow);
}
void ShowerTree::applyTransforms() {
// now boost all the particles
map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator cit;
// incoming
for(cit=_incomingLines.begin();cit!=_incomingLines.end();++cit) {
cit->first->progenitor()->deepTransform(_transforms);
cit->first->copy()->deepTransform(_transforms);
}
// outgoing
map<ShowerProgenitorPtr,tShowerParticlePtr>::const_iterator cjt;
for(cjt=_outgoingLines.begin();cjt!=_outgoingLines.end();++cjt) {
cjt->first->progenitor()->deepTransform(_transforms);
cjt->first->copy()->deepTransform(_transforms);
}
// child trees
for(map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator
- tit=_treelinks.begin();tit!=_treelinks.end();++tit)
+ tit=_treelinks.begin();tit!=_treelinks.end();++tit)
tit->first->applyTransforms();
_transforms = LorentzRotation();
}
void ShowerTree::clearTransforms() {
_transforms = LorentzRotation();
// child trees
for(map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator
- tit=_treelinks.begin();tit!=_treelinks.end();++tit)
+ tit=_treelinks.begin();tit!=_treelinks.end();++tit)
tit->first->clearTransforms();
}
+
+void ShowerTree::fixColour(tShowerParticlePtr part) {
+ if(!part->colourInfo()->colourLines().empty()) {
+ if(part->colourInfo()->colourLines().size()==1) {
+ ColinePtr line=part->colourLine();
+ if(line) {
+ line->removeColoured(part);
+ line->addColoured(part);
+ }
+ }
+ else {
+ Ptr<MultiColour>::pointer colour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(part->colourInfo());
+ vector<tcColinePtr> lines = colour->colourLines();
+ for(unsigned int ix=0;ix<lines.size();++ix) {
+ ColinePtr line = const_ptr_cast<ColinePtr>(lines[ix]);
+ if(line) {
+ line->removeColoured(part);
+ line->addColoured(part);
+ }
+ }
+ }
+ }
+ if(!part->colourInfo()->antiColourLines().empty()) {
+ if(part->colourInfo()->antiColourLines().size()==1) {
+ ColinePtr line=part->antiColourLine();
+ if(line) {
+ line->removeAntiColoured(part);
+ line->addAntiColoured(part);
+ }
+ }
+ else {
+ Ptr<MultiColour>::pointer colour =
+ dynamic_ptr_cast<Ptr<MultiColour>::pointer>(part->colourInfo());
+ vector<tcColinePtr> lines = colour->antiColourLines();
+ for(unsigned int ix=0;ix<lines.size();++ix) {
+ ColinePtr line = const_ptr_cast<ColinePtr>(lines[ix]);
+ if(line) {
+ line->removeAntiColoured(part);
+ line->addAntiColoured(part);
+ }
+ }
+ }
+ }
+}
+
diff --git a/Shower/Base/ShowerTree.h b/Shower/Base/ShowerTree.h
--- a/Shower/Base/ShowerTree.h
+++ b/Shower/Base/ShowerTree.h
@@ -1,411 +1,424 @@
// -*- C++ -*-
//
// ShowerTree.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_ShowerTree_H
#define HERWIG_ShowerTree_H
#include "ThePEG/Config/ThePEG.h"
#include "Herwig++/Shower/ShowerHandler.fh"
#include "Herwig++/Shower/ShowerConfig.h"
#include "Herwig++/Shower/Base/ShowerParticle.h"
#include "ShowerProgenitor.h"
#include "ThePEG/EventRecord/Step.h"
#include <cassert>
#include "ShowerTree.fh"
namespace Herwig {
/**
* Typedef for map of ShowerTrees for decays
*/
typedef multimap<Energy,ShowerTreePtr,std::greater<Energy> > ShowerDecayMap;
using namespace ThePEG;
/** \ingroup Shower
*
* The ShowerTree class stores the basic information needed for
* each hard interaction, either a scattering process or decay, which
* needs to be showered.
*
*/
class ShowerTree : public Base {
public:
/**
* Constructors and Destructors
*/
//@{
/**
* Constructor for a scattering process
* @param incoming The incoming particles
* @param out The outgoing particles
* @param decay Map into which the trees for any unstable particles are inserted
*/
ShowerTree(const PPair incoming, const ParticleVector & out,
ShowerDecayMap & decay);
/**
* Constructor for a decay
* @param in The decaying particle
* @param decay Map into which the trees for any unstable particles are inserted
*/
ShowerTree(PPtr in, ShowerDecayMap & decay);
//@}
public:
/**
* Insert the tree into the event record
* @param pstep The step into which the particles should be inserted
* @param ISR Whether or not ISR is switched on
* @param FSR Whether or not FSR is switched on
*/
void fillEventRecord(StepPtr pstep,bool ISR,bool FSR) {
if(_wasHard)
insertHard(pstep,ISR,FSR);
else
insertDecay(pstep,ISR,FSR);
}
/**
* Set the parent tree to this tree for trees which come from this one.
* This needs to be run after the constructor.
*/
void setParents();
/**
* Perform the decay for a tree starting with an unstable particle
* @param decay The map of widths and ShowerTrees for the decays so that
* any unstable decay products can be added.
*/
void decay(ShowerDecayMap & decay);
/**
* Access methods for the type of interaction
*/
//@{
/**
* Whether or not this is a scattering process
*/
bool isHard() const { return _wasHard; }
/**
* Whether or not this is a decay.
*/
bool isDecay() const { return !_wasHard; }
//@}
/**
* Flags relating to the application of the hard matrix element correction
*/
//@{
/**
* Was the hard matrix element correction applied
*/
bool hardMatrixElementCorrection() const { return _hardMECorrection; }
/**
* Set whether or not the hard matrix element correction was applied
*/
void hardMatrixElementCorrection(bool in) { _hardMECorrection=in; }
//@}
/**
* Get the incoming shower particles
*/
map<ShowerProgenitorPtr,ShowerParticlePtr> & incomingLines() {
return _incomingLines;
}
/**
* Get the outgoing shower particles
*/
map<ShowerProgenitorPtr,tShowerParticlePtr> & outgoingLines() {
return _outgoingLines;
}
/**
* Update the shower product for a final-state particle
*/
void updateFinalStateShowerProduct(ShowerProgenitorPtr progenitor,
ShowerParticlePtr parent,
const ShowerParticleVector & children);
/**
* Update the shower product for an initial-state particle
*/
void updateInitialStateShowerProduct(ShowerProgenitorPtr progenitor,
ShowerParticlePtr newParent);
/**
* Get the current final shower product for a final-state particle
*/
tShowerParticlePtr getFinalStateShowerProduct(ShowerProgenitorPtr progenitor) {
return _outgoingLines.find(progenitor)==_outgoingLines.end()
? tShowerParticlePtr() : _outgoingLines[progenitor];
}
/**
* Add a final-state branching. This method removes the parent of the branching
* from the list of particles at the end of the shower and inserts the children
* @param parent The parent for the branching
* @param children The outgoing particles in the branching
*/
void addFinalStateBranching(ShowerParticlePtr parent,
const ShowerParticleVector & children);
/**
* Add an initial-state branching. This method removes the oldParent of the
* branching and inserts the result of the backward evolution and the
* outgoing particle into the relevant lists.
* @param oldParent The particle being backward evolved
* @param newParent The initial-state particle resulting from the backward evolution
* @param otherChild The final-state particle produced in the evolution.
*/
void addInitialStateBranching(ShowerParticlePtr oldParent,
ShowerParticlePtr newParent,
ShowerParticlePtr otherChild);
/**
* Member called at the end of the shower of a tree to perform a number of
* updates.
* @param decay The map of widths and ShowerTrees for the decays so that
* any unstable decay products can be added.
*/
void updateAfterShower(ShowerDecayMap & decay);
/**
* Access and set the flag for whether this tree has been showered
*/
//@{
/**
* Access the flag
*/
bool hasShowered() const { return _hasShowered; }
/**
* Set the flag
*/
void hasShowered(bool in) { _hasShowered=in; }
//@}
/**
* Access the parent tree
*/
ShowerTreePtr parent() const { return _parent; }
/**
* Clear all the shower products so that the event can be reshowered
* if the first attempt fail
*/
void clear();
/**
* Reset the particles resulting from the shower to those which started
* the shower
*/
void resetShowerProducts();
/**
* Extract the progenitors for the reconstruction
*/
vector<ShowerProgenitorPtr> extractProgenitors();
/**
* Access to the outgoing particles
*/
const set<tShowerParticlePtr> & forwardParticles() const { return _forward; }
/**
* Map of particles in this Tree which are the initial particles in other
* trees
*/
const map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> > &
treelinks() const {return _treelinks;}
/**
* Update the link between shower particle and tree
*/
void updateLink(tShowerTreePtr tree,
pair<tShowerProgenitorPtr,tShowerParticlePtr> in) {
_treelinks[tree] = in;
}
/**
* Transform the tree
*/
void transform(const LorentzRotation & rot, bool applyNow);
/**
* Apply any postphoned transformations
*/
void applyTransforms();
/**
* Clear any postphoned transformations
*/
void clearTransforms();
/**
* Transform which needs to be applied
*/
const LorentzRotation & transform() {return _transforms;}
protected:
/**
* Functions to add the shower to the event record.
*/
//@{
/**
* Insert a hard process
* @param pstep The step into which the particles should be inserted
* @param ISR Whether or not ISR is switched on
* @param FSR Whether or not FSR is switched on
*/
void insertHard(StepPtr pstep,bool ISR,bool FSR);
/**
* Insert a decay process
* @param pstep The step into which the particles should be inserted
* @param ISR Whether or not ISR is switched on
* @param FSR Whether or not FSR is switched on
*/
void insertDecay(StepPtr pstep,bool ISR,bool FSR);
/**
* Recursively add the final-state shower from the particle to the event record.
* @param particle The final-state particle
* @param step The step
*/
void addFinalStateShower(PPtr particle, StepPtr step);
/**
* Add the initial-state shwoer from the particle to the step
* @param particle The final-state particle
* @param hadron The incoming hadron
* @param step The step
* @param addchildren Add the children of the particle
*/
void addInitialStateShower(PPtr particle, PPtr hadron,
StepPtr step, bool addchildren=true);
/**
* Update the colour information of a particle prior to insertion into the
* event record.
* @param particle The particle for which the colour is updated.
*/
void updateColour(PPtr particle);
+
+ /**
+ * Map the colours for a given particle
+ */
+ void mapColour(PPtr original, PPtr copy);
//@}
/**
* Isolate the colour of the process from the rest of the event.
* Called in the constructor
* @param original The original particles
* @param copy The colour isolated copies
*/
void colourIsolate(const vector<PPtr> & original, const vector<PPtr> & copy);
-
+
+ /**
+ * Isolate a specific colour line
+ */
+ void isolateLine(vector<PPair>::const_iterator cit,
+ vector<PPair> & particles,
+ tcColinePtr oldline,
+ tColinePtr newline);
+
/**
* After the creatation of a ShowerParticle make sure it is properly attached
* to its ColourLine
* @param part The particle
*/
void fixColour(tShowerParticlePtr part);
-
+
private:
/**
* Incoming partons for the hard process
*/
PPair _incoming;
/**
* The incoming ShowerParticles connected to the interaction
* as the index of a map with the particle the shower backward evolves
* them to as the value
*/
map<ShowerProgenitorPtr,ShowerParticlePtr> _incomingLines;
/**
* The outgoing ShowerParticles connected to the interaction
* as the index of a map with the particle the shower
* evolves them to as the value
*/
map<ShowerProgenitorPtr,tShowerParticlePtr> _outgoingLines;
/**
* The outgoing ShowerParticles at the end of the final-state shower
*/
set<tShowerParticlePtr> _forward;
/**
* The incoming ShowerParticles at the end of the initial-state shower
*/
set<tShowerParticlePtr> _backward;
/**
* Was the hard matrix element correction applied
*/
bool _hardMECorrection;
/**
* Was this a scattering process or a decay
*/
bool _wasHard;
/**
* Map of colour lines used to reset colours when inserted into the event
*/
map<ColinePtr,ColinePtr> _colour;
/**
* Map of particles in this Tree which are the initial particles in other
* trees
*/
map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> > _treelinks;
/**
* The parent tree
*/
tShowerTreePtr _parent;
/**
* Has this tree showered
*/
bool _hasShowered;
/**
* The transforms which still need to be applied
*/
LorentzRotation _transforms;
private:
/**
* Copy of decay in shower from ShowerHandler
*/
static set<long> _decayInShower;
/**
* Check if a particle decays in the shower
* @param id The PDG code for the particle
*/
static bool decaysInShower(long id) {
return ( _decayInShower.find( abs(id) ) !=
_decayInShower.end() );
}
};
}
#endif
diff --git a/Shower/Default/QTildeReconstructor.cc b/Shower/Default/QTildeReconstructor.cc
--- a/Shower/Default/QTildeReconstructor.cc
+++ b/Shower/Default/QTildeReconstructor.cc
@@ -1,2182 +1,2241 @@
// -*- C++ -*-
//
// QTildeReconstructor.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the QTildeReconstructor class.
//
#include "QTildeReconstructor.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/EventRecord/Event.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/RefVector.h"
#include "Herwig++/Shower/Base/Evolver.h"
#include "Herwig++/Shower/Base/PartnerFinder.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "Herwig++/Shower/SplittingFunctions/SplittingFunction.h"
#include <cassert>
using namespace Herwig;
namespace {
enum SystemType { UNDEFINED=-1, II, IF, F ,I };
struct ColourSingletSystem {
ColourSingletSystem() : type(UNDEFINED) {}
ColourSingletSystem(SystemType intype,ShowerProgenitorPtr inpart)
: type(intype),jets(1,inpart) {}
/**
* The type of system
*/
SystemType type;
/**
* The jets in the system
*/
vector<ShowerProgenitorPtr> jets;
};
struct ColourSingletShower {
ColourSingletShower() : type(UNDEFINED) {}
ColourSingletShower(SystemType intype,HardBranchingPtr inpart)
: type(intype),jets(1,inpart) {}
/**
* The type of system
*/
SystemType type;
/**
* The jets in the system
*/
vector<HardBranchingPtr> jets;
};
}
void QTildeReconstructor::persistentOutput(PersistentOStream & os) const {
os << _reconopt << _initialBoost << ounit(_minQ,GeV) << _noRescale
<< _noRescaleVector;
}
void QTildeReconstructor::persistentInput(PersistentIStream & is, int) {
is >> _reconopt >> _initialBoost >> iunit(_minQ,GeV) >> _noRescale
>> _noRescaleVector;
}
ClassDescription<QTildeReconstructor> QTildeReconstructor::initQTildeReconstructor;
// Definition of the static class description member.
void QTildeReconstructor::Init() {
static ClassDocumentation<QTildeReconstructor> documentation
( "This class is responsible for the kinematics reconstruction of the showering,",
" including the kinematics reshuffling necessary to compensate for the recoil"
"of the emissions." );
static Switch<QTildeReconstructor,unsigned int> interfaceReconstructionOption
("ReconstructionOption",
"Option for the kinematics reconstruction",
&QTildeReconstructor::_reconopt, 0, false, false);
static SwitchOption interfaceReconstructionOptionGeneral
(interfaceReconstructionOption,
"General",
"Use the general solution which ignores the colour structure for all processes",
0);
static SwitchOption interfaceReconstructionOptionColour
(interfaceReconstructionOption,
"Colour",
"Use the colour structure of the process to determine the reconstruction procedure.",
1);
static Parameter<QTildeReconstructor,Energy> interfaceMinimumQ2
("MinimumQ2",
"The minimum Q2 for the reconstruction of initial-final systems",
&QTildeReconstructor::_minQ, GeV, 0.001*GeV, 1e-6*GeV, 10.0*GeV,
false, false, Interface::limited);
static RefVector<QTildeReconstructor,ParticleData> interfaceNoRescale
("NoRescale",
"Particles which shouldn't be rescaled to be on shell by the shower",
&QTildeReconstructor::_noRescaleVector, -1, false, false, true, false, false);
static Switch<QTildeReconstructor,unsigned int> interfaceInitialInitialBoostOption
("InitialInitialBoostOption",
"Option for how the boost from the system before ISR to that after ISR is applied.",
&QTildeReconstructor::_initialBoost, 0, false, false);
static SwitchOption interfaceInitialInitialBoostOptionOneBoost
(interfaceInitialInitialBoostOption,
"OneBoost",
"Apply one boost from old CMS to new CMS",
0);
static SwitchOption interfaceInitialInitialBoostOptionLongTransBoost
(interfaceInitialInitialBoostOption,
"LongTransBoost",
"First apply a longitudinal and then a transverse boost",
1);
}
void QTildeReconstructor::doinit() {
KinematicsReconstructor::doinit();
_noRescale = set<cPDPtr>(_noRescaleVector.begin(),_noRescaleVector.end());
}
bool QTildeReconstructor::
reconstructTimeLikeJet(const tShowerParticlePtr particleJetParent,
unsigned int iopt) const {
assert(particleJetParent);
bool emitted=true;
// if this is not a fixed point in the reconstruction
if( !particleJetParent->isReconstructionFixedPoint() ) {
// if not a reconstruction fixpoint, dig deeper for all children:
for ( ParticleVector::const_iterator cit =
particleJetParent->children().begin();
cit != particleJetParent->children().end(); ++cit )
reconstructTimeLikeJet(dynamic_ptr_cast<ShowerParticlePtr>(*cit),iopt);
}
// it is a reconstruction fixpoint, ie kinematical data has to be available
else {
// check if the parent was part of the shower
ShowerParticlePtr jetGrandParent;
if(!particleJetParent->parents().empty())
jetGrandParent= dynamic_ptr_cast<ShowerParticlePtr>
(particleJetParent->parents()[0]);
// update if so
if (jetGrandParent) {
if (jetGrandParent->showerKinematics()) {
if(particleJetParent->id()==_progenitor->id()&&
!_progenitor->data().stable()) {
jetGrandParent->showerKinematics()->reconstructLast(particleJetParent,iopt,
_progenitor->mass());
}
else {
jetGrandParent->showerKinematics()->reconstructLast(particleJetParent,iopt);
}
}
}
// otherwise
else {
Energy dm = particleJetParent->data().constituentMass();
if (abs(dm-particleJetParent->momentum().m())>0.001*MeV
&&particleJetParent->dataPtr()->stable()
&&particleJetParent->id()!=ParticleID::gamma
&&_noRescale.find(particleJetParent->dataPtr())==_noRescale.end()) {
Lorentz5Momentum dum = particleJetParent->momentum();
if(dm>dum.e()) throw KinematicsReconstructionVeto();
dum.setMass(dm);
dum.rescaleRho();
particleJetParent->set5Momentum(dum);
}
else {
emitted=false;
}
}
}
// recursion has reached an endpoint once, ie we can reconstruct the
// kinematics from the children.
if( !(particleJetParent->isReconstructionFixedPoint()) )
particleJetParent->showerKinematics()
->reconstructParent( particleJetParent, particleJetParent->children() );
return emitted;
}
bool QTildeReconstructor::
reconstructHardJets(ShowerTreePtr hard,
const map<tShowerProgenitorPtr,
pair<Energy,double> > & intrinsic) const {
_currentTree = hard;
_intrinsic=intrinsic;
// extract the particles from the ShowerTree
vector<ShowerProgenitorPtr> ShowerHardJets=hard->extractProgenitors();
try {
// old recon method, using new member functions
if(_reconopt==0) {
reconstructGeneralSystem(ShowerHardJets);
}
// reconstruction based on coloured systems
else {
// identify the colour singlet systems
vector<ColourSingletSystem> systems;
vector<bool> done(ShowerHardJets.size(),false);
for(unsigned int ix=0;ix<ShowerHardJets.size();++ix) {
// if not treated create new system
if(done[ix]) continue;
systems.push_back(ColourSingletSystem(UNDEFINED,ShowerHardJets[ix]));
done[ix] = true;
if(!ShowerHardJets[ix]->progenitor()->coloured()) continue;
// now find the colour connected particles
vector<unsigned int> iloc(1,ix);
do {
vector<unsigned int> temp=findPartners(iloc.back(),ShowerHardJets);
iloc.pop_back();
for(unsigned int iy=0;iy<temp.size();++iy) {
if(!done[temp[iy]]) {
done[temp[iy]] = true;
iloc.push_back(temp[iy]);
systems.back().jets.push_back(ShowerHardJets[temp[iy]]);
}
}
}
while(!iloc.empty());
}
// catagorize the systems
unsigned int nnun(0),nnii(0),nnif(0),nnf(0),nni(0);
for(unsigned int ix=0;ix<systems.size();++ix) {
unsigned int ni(0),nf(0);
for(unsigned int iy=0;iy<systems[ix].jets.size();++iy) {
if(systems[ix].jets[iy]->progenitor()->isFinalState()) ++nf;
else ++ni;
}
// type
// initial-initial
if(ni==2&&nf==0) {
systems[ix].type = II;
++nnii;
}
// initial only
else if(ni==1&&nf==0) {
systems[ix].type = I;
++nni;
}
// initial-final
else if(ni==1&&nf>0) {
systems[ix].type = IF;
++nnif;
}
// final only
else if(ni==0&&nf>0) {
systems[ix].type = F;
++nnf;
}
// otherwise unknown
else {
systems[ix].type = UNDEFINED;
++nnun;
}
}
// now decide what to do
// initial-initial connection and final-state colour singlet systems
LorentzRotation toRest,fromRest;
bool applyBoost(false);
bool general(false);
// Drell-Yan type
if(nnun==0&&nnii==1&&nnif==0&&nnf>0&&nni==0) {
// reconstruct initial-initial system
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==II)
reconstructInitialInitialSystem(applyBoost,toRest,fromRest,
systems[ix].jets);
}
}
// DIS and VBF type
else if(nnun==0&&nnii==0&&((nnif==1&&nnf>0&&nni==1)||
(nnif==2&& nni==0))) {
// check these systems can be reconstructed
for(unsigned int ix=0;ix<systems.size();++ix) {
// compute q^2
if(systems[ix].type!=IF) continue;
Lorentz5Momentum q;
for(unsigned int iy=0;iy<systems[ix].jets.size();++iy) {
if(systems[ix].jets[iy]->progenitor()->isFinalState())
q += systems[ix].jets[iy]->progenitor()->momentum();
else
q -= systems[ix].jets[iy]->progenitor()->momentum();
}
q.rescaleMass();
// check above cut
if(abs(q.m())>=_minQ) continue;
if(nnif==1&&nni==1) {
throw KinematicsReconstructionVeto();
}
else {
general = true;
break;
}
}
if(!general) {
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==IF)
reconstructInitialFinalSystem(systems[ix].jets);
}
}
}
// e+e- type
else if(nnun==0&&nnii==0&&nnif==0&&nnf>0&&nni==2) {
// only FS needed
}
// general type
else {
general = true;
}
// final-state systems except for general recon
if(!general) {
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==F)
reconstructFinalStateSystem(applyBoost,toRest,fromRest,
systems[ix].jets);
}
}
else {
reconstructGeneralSystem(ShowerHardJets);
}
}
}
catch(KinematicsReconstructionVeto) {
_progenitor=tShowerParticlePtr();
_intrinsic.clear();
_currentTree = tShowerTreePtr();
return false;
}
_progenitor=tShowerParticlePtr();
_intrinsic.clear();
// ensure x<1
for(map<ShowerProgenitorPtr,ShowerParticlePtr>::const_iterator
cit=hard->incomingLines().begin();cit!=hard->incomingLines().end();++cit) {
tPPtr parent = cit->first->progenitor();
while (!parent->parents().empty()) {
parent = parent->parents()[0];
}
tPPtr hadron;
if ( cit->first->original()->parents().empty() ) {
hadron = cit->first->original();
}
else {
hadron = cit->first->original()->parents()[0];
}
if( ! (hadron->id() == parent->id() && hadron->children().size() <= 1)
&& parent->momentum().rho() > hadron->momentum().rho()) {
_currentTree = tShowerTreePtr();
return false;
}
}
_currentTree = tShowerTreePtr();
return true;
}
double
QTildeReconstructor::solveKfactor(const Energy & root_s,
const JetKinVect & jets) const {
Energy2 s = sqr(root_s);
// must be at least two jets
if ( jets.size() < 2) throw KinematicsReconstructionVeto();
// sum of jet masses must be less than roots
if(momConsEq( 0.0, root_s, jets )>ZERO) throw KinematicsReconstructionVeto();
// if two jets simple solution
if ( jets.size() == 2 ) {
static const Energy2 eps = 1.0e-4 * MeV2;
if ( sqr(jets[0].p.x()+jets[1].p.x()) < eps &&
sqr(jets[0].p.y()+jets[1].p.y()) < eps &&
sqr(jets[0].p.z()+jets[1].p.z()) < eps ) {
Energy test = (jets[0].p+jets[1].p).vect().mag();
if(test > 1.0e-4 * MeV) throw KinematicsReconstructionVeto();
Energy2 m1sq(jets[0].q.m2()),m2sq(jets[1].q.m2());
return sqrt( ( sqr(s - m1sq - m2sq) - 4.*m1sq*m2sq )
/(4.*s*jets[0].p.vect().mag2()) );
}
else throw KinematicsReconstructionVeto();
}
// i.e. jets.size() > 2, numerically
// check convergence, if it's a problem maybe use Newton iteration?
else {
double k1 = 0.,k2 = 1.,k = 0.;
if ( momConsEq( k1, root_s, jets ) < ZERO ) {
while ( momConsEq( k2, root_s, jets ) < ZERO ) {
k1 = k2;
k2 *= 2;
}
while ( fabs( (k1 - k2)/(k1 + k2) ) > 1.e-10 ) {
if( momConsEq( k2, root_s, jets ) == ZERO ) {
return k2;
} else {
k = (k1+k2)/2.;
if ( momConsEq( k, root_s, jets ) > ZERO ) {
k2 = k;
} else {
k1 = k;
}
}
}
return k1;
} else throw KinematicsReconstructionVeto();
}
throw KinematicsReconstructionVeto();
}
bool QTildeReconstructor::
reconstructSpaceLikeJet( const tShowerParticlePtr p) const {
bool emitted = true;
tShowerParticlePtr child;
tShowerParticlePtr parent;
if(!p->parents().empty())
parent = dynamic_ptr_cast<ShowerParticlePtr>(p->parents()[0]);
if(parent) {
emitted=true;
reconstructSpaceLikeJet(parent);
}
// if branching reconstruct time-like child
if(p->children().size()==2)
child = dynamic_ptr_cast<ShowerParticlePtr>(p->children()[1]);
if(p->perturbative()==0 && child) {
dynamic_ptr_cast<ShowerParticlePtr>(p->children()[0])->
showerKinematics()->reconstructParent(p,p->children());
if(!child->children().empty()) {
_progenitor=child;
reconstructTimeLikeJet(child,0);
// calculate the momentum of the particle
Lorentz5Momentum pnew=p->momentum()-child->momentum();
pnew.rescaleMass();
p->children()[0]->set5Momentum(pnew);
}
}
return emitted;
}
Boost QTildeReconstructor::
solveBoostBeta( const double k, const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldp ) {
// try something different, purely numerical first:
// a) boost to rest frame of newq, b) boost with kp/E
Energy q = newq.vect().mag();
Energy2 qs = sqr(q);
Energy2 Q2 = newq.m2();
Energy kp = k*(oldp.vect().mag());
Energy2 kps = sqr(kp);
// usually we take the minus sign, since this boost will be smaller.
// we only require |k \vec p| = |\vec q'| which leaves the sign of
// the boost open but the 'minus' solution gives a smaller boost
// parameter, i.e. the result should be closest to the previous
// result. this is to be changed if we would get many momentum
// conservation violations at the end of the shower from a hard
// process.
double betam = (q*sqrt(qs + Q2) - kp*sqrt(kps + Q2))/(kps + qs + Q2);
// move directly to 'return'
Boost beta = -betam*(k/kp)*oldp.vect();
// note that (k/kp)*oldp.vect() = oldp.vect()/oldp.vect().mag() but cheaper.
// leave this out if it's running properly!
if ( betam >= 0 ) return beta;
else return Boost(0., 0., 0.);
}
bool QTildeReconstructor::
reconstructDecayJets(ShowerTreePtr decay) const {
_currentTree = decay;
try {
// extract the particles from the ShowerTree
vector<ShowerProgenitorPtr> ShowerHardJets=decay->extractProgenitors();
bool radiated[2]={false,false};
// find the decaying particle and check if particles radiated
ShowerProgenitorPtr initial;
for(unsigned int ix=0;ix<ShowerHardJets.size();++ix) {
// only consider initial-state jets
if(ShowerHardJets[ix]->progenitor()->isFinalState()) {
radiated[1] |=ShowerHardJets[ix]->hasEmitted();
}
else {
initial=ShowerHardJets[ix];
radiated[0]|=ShowerHardJets[ix]->hasEmitted();
}
}
// find boost to the rest frame if needed
Boost boosttorest=-initial->progenitor()->momentum().boostVector();
double gammarest =
initial->progenitor()->momentum().e()/
initial->progenitor()->momentum().mass();
// check if need to boost to rest frame
bool gottaBoost = (boosttorest.mag() > 1e-12);
// if initial state radiation reconstruct the jet and set up the basis vectors
Lorentz5Momentum pjet;
Lorentz5Momentum nvect;
// find the partner
ShowerParticlePtr partner = initial->progenitor()->partner();
Lorentz5Momentum ppartner[2];
if(partner) ppartner[0]=partner->momentum();
// get the n reference vector
if(partner) {
if(initial->progenitor()->showerKinematics()) {
nvect = initial->progenitor()->showerKinematics()->getBasis()[1];
}
else {
Lorentz5Momentum ppartner=initial->progenitor()->partner()->momentum();
if(gottaBoost) ppartner.boost(boosttorest,gammarest);
nvect = Lorentz5Momentum( ZERO,0.5*initial->progenitor()->mass()*
ppartner.vect().unit());
nvect.boost(-boosttorest,gammarest);
}
}
// if ISR
if(radiated[0]) {
// reconstruct the decay jet
reconstructDecayJet(initial->progenitor());
// momentum of decaying particle after ISR
pjet=initial->progenitor()->momentum()
-decay->incomingLines().begin()->second->momentum();
pjet.rescaleMass();
}
// boost initial state jet and basis vector if needed
if(gottaBoost) {
pjet.boost(boosttorest,gammarest);
nvect.boost(boosttorest,gammarest);
ppartner[0].boost(boosttorest,gammarest);
}
// loop over the final-state particles and do the reconstruction
JetKinVect possiblepartners;
JetKinVect jetKinematics;
bool atLeastOnce = radiated[0];
LorentzRotation restboost(boosttorest,gammarest);
Energy inmass(ZERO);
for(unsigned int ix=0;ix<ShowerHardJets.size();++ix) {
// only consider final-state jets
if(!ShowerHardJets[ix]->progenitor()->isFinalState()) {
inmass=ShowerHardJets[ix]->progenitor()->mass();
continue;
}
// do the reconstruction
JetKinStruct tempJetKin;
tempJetKin.parent = ShowerHardJets[ix]->progenitor();
if(ShowerHardJets.size()==2) {
Lorentz5Momentum dum=ShowerHardJets[ix]->progenitor()->momentum();
dum.setMass(inmass);
dum.rescaleRho();
tempJetKin.parent->set5Momentum(dum);
}
tempJetKin.p = ShowerHardJets[ix]->progenitor()->momentum();
if(gottaBoost) tempJetKin.p.boost(boosttorest,gammarest);
_progenitor=tempJetKin.parent;
atLeastOnce |= reconstructTimeLikeJet(tempJetKin.parent,0);
if(gottaBoost) deepTransform(tempJetKin.parent,restboost);
tempJetKin.q = ShowerHardJets[ix]->progenitor()->momentum();
jetKinematics.push_back(tempJetKin);
}
if(partner) ppartner[1]=partner->momentum();
// calculate the rescaling parameters
double k1,k2;
Lorentz5Momentum qt;
if(!solveDecayKFactor(initial->progenitor()->mass(),nvect,pjet,
jetKinematics,partner,ppartner,k1,k2,qt)) {
_currentTree = tShowerTreePtr();
return false;
}
// apply boosts and rescalings to final-state jets
for(JetKinVect::iterator it = jetKinematics.begin();
it != jetKinematics.end(); ++it) {
LorentzRotation Trafo = LorentzRotation();
if(it->parent!=partner) {
// boost for rescaling
if(atLeastOnce) {
map<tShowerTreePtr,pair<tShowerProgenitorPtr,
tShowerParticlePtr> >::const_iterator tit;
for(tit = _currentTree->treelinks().begin();
tit != _currentTree->treelinks().end();++tit) {
if(tit->second.first && tit->second.second==it->parent)
break;
}
if(it->parent->children().empty()&&!it->parent->spinInfo() &&
tit==_currentTree->treelinks().end()) {
Lorentz5Momentum pnew(k2*it->p.vect(),
sqrt(sqr(k2*it->p.vect().mag())+it->q.mass2()),
it->q.mass());
it->parent->set5Momentum(pnew);
}
else {
Trafo = solveBoost(k2, it->q, it->p);
}
}
if(gottaBoost) Trafo.boost(-boosttorest,gammarest);
if(atLeastOnce || gottaBoost) deepTransform(it->parent,Trafo);
}
else {
Lorentz5Momentum pnew=ppartner[0];
pnew *=k1;
pnew-=qt;
pnew.setMass(ppartner[1].mass());
pnew.rescaleEnergy();
LorentzRotation Trafo=solveBoost(1.,ppartner[1],pnew);
if(gottaBoost) Trafo.boost(-boosttorest,gammarest);
deepTransform(partner,Trafo);
}
}
}
catch(KinematicsReconstructionVeto) {
_currentTree = tShowerTreePtr();
return false;
}
_currentTree = tShowerTreePtr();
return true;
}
bool QTildeReconstructor::
reconstructDecayJet( const tShowerParticlePtr p) const {
if(p->children().empty()) return false;
tShowerParticlePtr child;
// if branching reconstruct time-like child
child = dynamic_ptr_cast<ShowerParticlePtr>(p->children()[1]);
if(child) {
_progenitor=child;
reconstructTimeLikeJet(child,1);
// calculate the momentum of the particle
Lorentz5Momentum pnew=p->momentum()-child->momentum();
pnew.rescaleMass();
p->children()[0]->set5Momentum(pnew);
child=dynamic_ptr_cast<ShowerParticlePtr>(p->children()[0]);
reconstructDecayJet(child);
return true;
}
return false;
}
bool QTildeReconstructor::
solveDecayKFactor(Energy mb,
const Lorentz5Momentum & n,
const Lorentz5Momentum & pjet,
const JetKinVect & jetKinematics,
ShowerParticlePtr partner,
Lorentz5Momentum ppartner[2],
double & k1, double & k2,
Lorentz5Momentum & qt) const {
Energy2 pjn = partner ? pjet.vect()*n.vect() : ZERO;
Energy2 pcn = partner ? ppartner[0].vect()*n.vect() : 1.*MeV2;
Energy2 nmag = n.vect().mag2();
Lorentz5Momentum pn = partner ? (pjn/nmag)*n : Lorentz5Momentum();
qt=pjet-pn; qt.setE(ZERO);
Energy2 pt2=qt.vect().mag2();
Energy Ejet = pjet.e();
// magnitudes of the momenta for fast access
vector<Energy2> pmag;
Energy total(Ejet);
Lorentz5Momentum ptest;
for(unsigned int ix=0;ix<jetKinematics.size();++ix) {
pmag.push_back(jetKinematics[ix].p.vect().mag2());
total+=jetKinematics[ix].q.mass();
ptest+=jetKinematics[ix].p;
}
// return if no possible solution
if(total>mb) return false;
Energy2 pcmag=ppartner[0].vect().mag2();
// used newton-raphson to get the rescaling
static const Energy eps=1e-8*GeV;
long double d1(1.),d2(1.);
Energy roots, ea, ec, ds;
unsigned int ix=0;
do {
++ix;
d2 = d1 + pjn/pcn;
roots = Ejet;
ds = ZERO;
for(unsigned int iy=0;iy<jetKinematics.size();++iy) {
if(jetKinematics[iy].parent==partner) continue;
ea = sqrt(sqr(d2)*pmag[iy]+jetKinematics[iy].q.mass2());
roots += ea;
ds += d2/ea*pmag[iy];
}
if(partner) {
ec = sqrt(sqr(d1)*pcmag + pt2 + ppartner[1].mass2());
roots += ec;
ds += d1/ec*pcmag;
}
d1 += (mb-roots)/ds;
d2 = d1 + pjn/pcn;
}
while(abs(mb-roots)>eps && ix<100);
k1=d1;
k2=d2;
// return true if N-R succeed, otherwise false
return ix<100;
}
bool QTildeReconstructor::
deconstructDecayJets(HardTreePtr decay, cEvolverPtr,
ShowerInteraction::Type) const {
// extract the momenta of the particles
vector<Lorentz5Momentum> pin;
vector<Lorentz5Momentum> pout;
// on-shell masses of the decay products
vector<Energy> mon;
Energy mbar(-GeV);
// the hard branchings of the particles
set<HardBranchingPtr>::iterator cit;
set<HardBranchingPtr> branchings=decay->branchings();
// properties of the incoming particle
bool ISR = false;
HardBranchingPtr initial;
Lorentz5Momentum qisr;
// find the incoming particle, both before and after
// any ISR
for(cit=branchings.begin();cit!=branchings.end();++cit){
if((*cit)->status()==HardBranching::Incoming||
(*cit)->status()==HardBranching::Decay) {
// search back up isr if needed
HardBranchingPtr branch = *cit;
while(branch->parent()) branch=branch->parent();
initial=branch;
// momentum or original parent
pin.push_back(branch->branchingParticle()->momentum());
// ISR?
ISR = !branch->branchingParticle()->children().empty();
// ISR momentum
qisr = pin.back()-(**cit).branchingParticle()->momentum();
qisr.rescaleMass();
}
}
assert(pin.size()==1);
// compute boost to rest frame
Boost boostv=-pin[0].boostVector();
// partner for ISR
ShowerParticlePtr partner;
Lorentz5Momentum ppartner;
if(initial->branchingParticle()->partner()) {
partner=initial->branchingParticle()->partner();
ppartner=partner->momentum();
}
// momentum of the decay products
for(cit=branchings.begin();cit!=branchings.end();++cit) {
if((*cit)->status()!=HardBranching::Outgoing) continue;
// find the mass of the particle
// including special treatment for off-shell resonances
// to preserve off-shell mass
Energy mass;
if(!(**cit).branchingParticle()->dataPtr()->stable()) {
HardBranchingPtr branch=*cit;
while(!branch->children().empty()) {
for(unsigned int ix=0;ix<branch->children().size();++ix) {
if(branch->children()[ix]->branchingParticle()->id()==
(**cit).branchingParticle()->id()) {
branch = branch->children()[ix];
continue;
}
}
};
mass = branch->branchingParticle()->mass();
}
else {
mass = (**cit).branchingParticle()->dataPtr()->mass();
}
// if not evolution partner of decaying particle
if((*cit)->branchingParticle()!=partner) {
pout.push_back((*cit)->branchingParticle()->momentum());
mon.push_back(mass);
}
// evolution partner of decaying particle
else {
mbar = mass;
}
}
// boost all the momenta to the rest frame of the decaying particle
for(unsigned int ix=0;ix<pout.size();++ix) pout[ix].boost(boostv);
if(initial->branchingParticle()->partner()) {
ppartner.boost(boostv);
qisr.boost(boostv);
}
// compute the rescaling factors
double k1,k2;
if(!ISR) {
if(partner) {
pout.push_back(ppartner);
mon.push_back(mbar);
}
k1=k2=inverseRescalingFactor(pout,mon,pin[0].mass());
if(partner) {
pout.pop_back();
mon.pop_back();
}
}
else {
if(!inverseDecayRescalingFactor(pout,mon,pin[0].mass(),
ppartner,mbar,k1,k2)) return false;
}
// now calculate the p reference vectors
unsigned int ifinal=0;
for(cit=branchings.begin();cit!=branchings.end();++cit) {
if((**cit).status()!=HardBranching::Outgoing) continue;
// for partners other than colour partner of decaying particle
if((*cit)->branchingParticle()!=partner) {
Lorentz5Momentum pvect = (*cit)->branchingParticle()->momentum();
pvect.boost(boostv);
pvect /= k1;
pvect.setMass(mon[ifinal]);
++ifinal;
pvect.rescaleEnergy();
pvect.boost(-boostv);
(*cit)->pVector(pvect);
(*cit)->showerMomentum(pvect);
}
// for colour partner of decaying particle
else {
Lorentz5Momentum pvect = (*cit)->branchingParticle()->momentum();
pvect.boost(boostv);
Lorentz5Momentum qtotal;
for(unsigned int ix=0;ix<pout.size();++ix) qtotal+=pout[ix];
Lorentz5Momentum qperp =
qisr-(qisr.vect()*qtotal.vect())/(qtotal.vect().mag2())*qtotal;
pvect +=qperp;
pvect /=k2;
pvect.setMass(mbar);
pvect.rescaleEnergy();
pvect.boost(-boostv);
(*cit)->pVector(pvect);
(*cit)->showerMomentum(pvect);
}
}
// // find the evolution partners
// ShowerParticleVector particles;
// particles.push_back((**decay->incoming().begin()).branchingParticle());
// for(cit=branchings.begin();cit!=branchings.end();++cit) {
// if((**cit).status()==HardBranching::Outgoing)
// particles.push_back((*cit)->branchingParticle());
// }
// // partners should
// evolver->showerModel()->partnerFinder()
// ->setInitialEvolutionScales(particles,true,type,false);
// For initial-state if needed
if(initial) {
tShowerParticlePtr newPartner=initial->branchingParticle()->partner();
if(newPartner) {
tHardBranchingPtr branch;
for( set<HardBranchingPtr>::iterator clt = branchings.begin();
clt != branchings.end(); ++clt ) {
if((**clt).branchingParticle()==newPartner) {
initial->colourPartner(*clt);
branch=*clt;
break;
}
}
Lorentz5Momentum pvect = initial->branchingParticle()->momentum();
initial->pVector(pvect);
Lorentz5Momentum ptemp = branch->pVector();
ptemp.boost(boostv);
Lorentz5Momentum nvect = Lorentz5Momentum( ZERO,
0.5*initial->branchingParticle()->mass()*
ptemp.vect().unit());
nvect.boost(-boostv);
initial->nVector(nvect);
}
}
// calculate the reference vectors, then for outgoing particles
for(cit=branchings.begin();cit!=branchings.end();++cit){
if((**cit).status()!=HardBranching::Outgoing) continue;
// find the partner branchings
tShowerParticlePtr newPartner=(*cit)->branchingParticle()->partner();
if(!newPartner) continue;
tHardBranchingPtr branch;
for( set<HardBranchingPtr>::iterator clt = branchings.begin();
clt != branchings.end(); ++clt ) {
if(cit==clt) continue;
if((**clt).branchingParticle()==newPartner) {
(**cit).colourPartner(*clt);
branch=*clt;
break;
}
}
if((**decay->incoming().begin()).branchingParticle()==newPartner) {
(**cit).colourPartner(*decay->incoming().begin());
branch = *decay->incoming().begin();
}
// final-state colour partner
if(branch->status()==HardBranching::Outgoing) {
Boost boost=((*cit)->pVector()+branch->pVector()).findBoostToCM();
Lorentz5Momentum pcm = branch->pVector();
pcm.boost(boost);
Lorentz5Momentum nvect = Lorentz5Momentum(ZERO,pcm.vect());
nvect.boost( -boost);
(*cit)->nVector(nvect);
}
// initial-state colour partner
else {
Boost boost=branch->pVector().findBoostToCM();
Lorentz5Momentum pcm = (*cit)->pVector();
pcm.boost(boost);
Lorentz5Momentum nvect = Lorentz5Momentum( ZERO, -pcm.vect());
nvect.boost( -boost);
(*cit)->nVector(nvect);
}
}
// now compute the new momenta
// and calculate the shower variables
for(cit=branchings.begin();cit!=branchings.end();++cit) {
if((**cit).status()!=HardBranching::Outgoing) continue;
LorentzRotation B=LorentzRotation(-boostv);
LorentzRotation A=LorentzRotation(boostv),R;
if((*cit)->branchingParticle()==partner) {
Lorentz5Momentum qnew;
Energy2 dot=(*cit)->pVector()*(*cit)->nVector();
double beta = 0.5*((*cit)->branchingParticle()->momentum().m2()
-sqr((*cit)->pVector().mass()))/dot;
qnew=(*cit)->pVector()+beta*(*cit)->nVector();
qnew.rescaleMass();
// compute the boost
R=B*solveBoost(A*qnew,A*(*cit)->branchingParticle()->momentum())*A;
}
else {
Lorentz5Momentum qnew;
if((*cit)->branchingParticle()->partner()) {
Energy2 dot=(*cit)->pVector()*(*cit)->nVector();
double beta = 0.5*((*cit)->branchingParticle()->momentum().m2()
-sqr((*cit)->pVector().mass()))/dot;
qnew=(*cit)->pVector()+beta*(*cit)->nVector();
qnew.rescaleMass();
}
else {
qnew = (*cit)->pVector();
}
// compute the boost
R=B*solveBoost(A*qnew,A*(*cit)->branchingParticle()->momentum())*A;
}
// reconstruct the momenta
(*cit)->setMomenta(R,1.0,Lorentz5Momentum());
}
if(initial) {
initial->setMomenta(LorentzRotation(),1.0,Lorentz5Momentum());
}
return true;
}
double QTildeReconstructor::
inverseRescalingFactor(vector<Lorentz5Momentum> pout,
vector<Energy> mon, Energy roots) const {
double lambda=1.;
if(pout.size()==2) {
double mu_q1(pout[0].m()/roots), mu_q2(pout[1].m()/roots);
double mu_p1(mon[0]/roots) , mu_p2(mon[1]/roots);
lambda =
((1.+mu_q1+mu_q2)*(1.-mu_q1-mu_q2)*(mu_q1-1.-mu_q2)*(mu_q2-1.-mu_q1))/
((1.+mu_p1+mu_p2)*(1.-mu_p1-mu_p2)*(mu_p1-1.-mu_p2)*(mu_p2-1.-mu_p1));
if(lambda<0.)
throw Exception() << "Rescaling factor is imaginary in QTildeReconstructor::"
<< "inverseRescalingFactor lambda^2= " << lambda
<< Exception::eventerror;
lambda = sqrt(lambda);
}
else {
unsigned int ntry=0;
// compute magnitudes once for speed
vector<Energy2> pmag;
for(unsigned int ix=0;ix<pout.size();++ix) {
pmag.push_back(pout[ix].vect().mag2());
}
// Newton-Raphson for the rescaling
vector<Energy> root;
root.resize(pout.size());
do {
// compute new energies
Energy sum(ZERO);
for(unsigned int ix=0;ix<pout.size();++ix) {
root[ix] = sqrt(pmag[ix]/sqr(lambda)+sqr(mon[ix]));
sum+=root[ix];
}
// if accuracy reached exit
if(abs(sum/roots-1.)<1e-10) break;
// use Newton-Raphson to compute new guess for lambda
Energy numer(ZERO),denom(ZERO);
for(unsigned int ix=0;ix<pout.size();++ix) {
numer +=root[ix];
denom +=pmag[ix]/root[ix];
}
numer-=roots;
double fact = 1.+sqr(lambda)*numer/denom;
if(fact<0.) fact=0.5;
lambda *=fact;
++ntry;
}
while(ntry<100);
}
if(isnan(lambda))
throw Exception() << "Rescaling factor is nan in QTildeReconstructor::"
<< "inverseRescalingFactor "
<< Exception::eventerror;
return lambda;
}
bool QTildeReconstructor::
deconstructGeneralSystem(HardTreePtr tree,
cEvolverPtr evolver,
ShowerInteraction::Type type) const {
// extract incoming and outgoing particles
ColourSingletShower in,out;
for(set<HardBranchingPtr>::const_iterator it=tree->branchings().begin();
it!=tree->branchings().end();++it) {
if((**it).status()==HardBranching::Incoming) in .jets.push_back(*it);
else out.jets.push_back(*it);
}
// do the initial-state reconstruction
LorentzRotation toRest,fromRest;
bool applyBoost(false);
deconstructInitialInitialSystem(applyBoost,toRest,fromRest,
tree,in.jets,type);
// do the final-state reconstruction
deconstructFinalStateSystem(toRest,fromRest,tree,
out.jets,evolver,type);
// only at this point that we can be sure all the reference vectors
// are correct
for(set<HardBranchingPtr>::const_iterator it=tree->branchings().begin();
it!=tree->branchings().end();++it) {
if((**it).status()==HardBranching::Incoming) continue;
if((**it).branchingParticle()->coloured())
(**it).setMomenta(LorentzRotation(),1.,Lorentz5Momentum(),false);
}
for(set<HardBranchingPtr>::const_iterator it=tree->incoming().begin();
it!=tree->incoming().end();++it) {
(**it).setMomenta(LorentzRotation(),1.,Lorentz5Momentum(),false);
}
return true;
}
bool QTildeReconstructor::deconstructHardJets(HardTreePtr tree,
cEvolverPtr evolver,
ShowerInteraction::Type type) const {
// inverse of old recon method
if(_reconopt==0) {
return deconstructGeneralSystem(tree,evolver,type);
}
// inverse of reconstruction based on coloured systems
else {
// identify the colour singlet systems
vector<ColourSingletShower> systems;
set<HardBranchingPtr> done;
for(set<HardBranchingPtr>::const_iterator it=tree->branchings().begin();
it!=tree->branchings().end();++it) {
// if not treated create new system
if(done.find(*it)!=done.end()) continue;
done.insert(*it);
systems.push_back(ColourSingletShower(UNDEFINED,*it));
if(!(**it).branchingParticle()->coloured()) continue;
// now find the colour connected particles
findPartners(*it,done,tree->branchings(),systems.back().jets);
}
// catagorize the systems
unsigned int nnun(0),nnii(0),nnif(0),nnf(0),nni(0);
for(unsigned int ix=0;ix<systems.size();++ix) {
unsigned int ni(0),nf(0);
for(unsigned int iy=0;iy<systems[ix].jets.size();++iy) {
if(systems[ix].jets[iy]->status()==HardBranching::Outgoing) ++nf;
else ++ni;
}
// type
// initial-initial
if(ni==2&&nf==0) {
systems[ix].type = II;
++nnii;
}
// initial only
else if(ni==1&&nf==0) {
systems[ix].type = I;
++nni;
}
// initial-final
else if(ni==1&&nf>0) {
systems[ix].type = IF;
++nnif;
}
// final only
else if(ni==0&&nf>0) {
systems[ix].type = F;
++nnf;
}
// otherwise unknown
else {
systems[ix].type = UNDEFINED;
++nnun;
}
}
// now decide what to do
LorentzRotation toRest,fromRest;
bool applyBoost(false);
bool general(false);
// initial-initial connection and final-state colour singlet systems
// Drell-Yan type
if(nnun==0&&nnii==1&&nnif==0&&nnf>0&&nni==0) {
// reconstruct initial-initial system
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==II)
deconstructInitialInitialSystem(applyBoost,toRest,fromRest,tree,
systems[ix].jets,type);
}
}
// DIS and VBF type
else if(nnun==0&&nnii==0&&((nnif==1&&nnf>0&&nni==1)||
(nnif==2&& nni==0))) {
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==IF)
deconstructInitialFinalSystem(tree,systems[ix].jets,evolver,type);
}
}
// e+e- type
else if(nnun==0&&nnii==0&&nnif==0&&nnf>0&&nni==2) {
// only FS needed
// but need to boost to rest frame if QED ISR
Lorentz5Momentum ptotal;
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==I)
ptotal += systems[ix].jets[0]->branchingParticle()->momentum();
}
toRest = LorentzRotation(ptotal.findBoostToCM());
fromRest = toRest;
fromRest.invert();
}
// general type
else {
general = true;
}
// final-state systems except for general recon
if(!general) {
for(unsigned int ix=0;ix<systems.size();++ix) {
if(systems[ix].type==F)
deconstructFinalStateSystem(toRest,fromRest,tree,
systems[ix].jets,evolver,type);
- }
}
- else {
- return deconstructGeneralSystem(tree,evolver,type);
- }
+ }
+ else {
+ return deconstructGeneralSystem(tree,evolver,type);
+ }
return true;
}
}
vector<unsigned int> QTildeReconstructor::
findPartners(unsigned int iloc ,
vector<ShowerProgenitorPtr> jets) const {
vector<unsigned int> output;
for(unsigned int iy=0;iy<jets.size();++iy) {
if(!jets[iy]->progenitor()->data().coloured()||iy==iloc) continue;
bool isPartner = false;
// both in either initial or final state
if(jets[iloc]->progenitor()->isFinalState()!=jets[iy]->progenitor()->isFinalState()) {
- if(jets[iloc]->progenitor()->colourLine() &&
- jets[iloc]->progenitor()->colourLine() == jets[iy]->progenitor()->colourLine())
- isPartner = true;
- if(jets[iloc]->progenitor()->antiColourLine() &&
- jets[iloc]->progenitor()->antiColourLine() == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
+ //loop over all the colours of both
+ for(unsigned int ix=0; ix<CLSIZE(jets[iloc]); ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(jets[iy]); ++jx){
+ if(CL(jets[iloc],ix) && CL(jets[iloc],ix)==CL(jets[iy],jx))
+ isPartner = true;
+ }
+ }
+ if(!isPartner){
+ //loop over anti colours of both
+ for(unsigned int ix=0; ix<ACLSIZE(jets[iloc]); ++ix){
+ for(unsigned int jx=0; jx<ACLSIZE(jets[iy]); ++jx){
+ if(ACL(jets[iloc],ix) && ACL(jets[iloc],ix)==ACL(jets[iy],jx))
+ isPartner = true;
+ }
+ }
+ }
}
- else {
- if(jets[iloc]->progenitor()->colourLine() &&
- jets[iloc]->progenitor()->colourLine() == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
- if(jets[iloc]->progenitor()->antiColourLine() &&
- jets[iloc]->progenitor()->antiColourLine() == jets[iy]->progenitor()->colourLine())
- isPartner = true;
+ else{
+ //loop over the colours of the first and the anti-colours of the other
+ for(unsigned int ix=0; ix<CLSIZE(jets[iloc]); ++ix){
+ for(unsigned int jx=0; jx<ACLSIZE(jets[iy]); ++jx){
+ if(CL(jets[iloc],ix) && CL(jets[iloc],ix)==ACL(jets[iy],jx))
+ isPartner = true;
+ }
+ }
+ if(!isPartner){
+ //loop over the anti-colours of the first and the colours of the other
+ for(unsigned int ix=0; ix<ACLSIZE(jets[iloc]); ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(jets[iy]); jx++){
+ if(ACL(jets[iloc],ix) && ACL(jets[iloc],ix)==CL(jets[iy],jx))
+ isPartner = true;
+ }
+ }
+ }
}
// special for sources/sinks
if(jets[iloc]->progenitor()->colourLine()) {
if(jets[iloc]->progenitor()->colourLine()->sourceNeighbours().first) {
- tColinePair lines = jets[iloc]->progenitor()->colourLine()->sourceNeighbours();
- if(lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
+ tColinePair lines = jets[iloc]->progenitor()->colourLine()->sourceNeighbours();
+ if(lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine())
+ isPartner = true;
}
if(jets[iloc]->progenitor()->colourLine()->sinkNeighbours().first) {
- tColinePair lines = jets[iloc]->progenitor()->colourLine()->sinkNeighbours();
- if(lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
+ tColinePair lines = jets[iloc]->progenitor()->colourLine()->sinkNeighbours();
+ if(lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine())
+ isPartner = true;
}
}
if(jets[iloc]->progenitor()->antiColourLine()) {
if(jets[iloc]->progenitor()->antiColourLine()->sourceNeighbours().first) {
- tColinePair lines = jets[iloc]->progenitor()->antiColourLine()->sourceNeighbours();
- if(lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
+ tColinePair lines = jets[iloc]->progenitor()->antiColourLine()->sourceNeighbours();
+ if(lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine())
+ isPartner = true;
}
if(jets[iloc]->progenitor()->antiColourLine()->sinkNeighbours().first) {
- tColinePair lines = jets[iloc]->progenitor()->antiColourLine()->sinkNeighbours();
- if(lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.first == jets[iy]->progenitor()-> colourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine() ||
- lines.second == jets[iy]->progenitor()->antiColourLine())
- isPartner = true;
+ tColinePair lines = jets[iloc]->progenitor()->antiColourLine()->sinkNeighbours();
+ if(lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.first == jets[iy]->progenitor()-> colourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine() ||
+ lines.second == jets[iy]->progenitor()->antiColourLine())
+ isPartner = true;
}
}
- if(isPartner) output.push_back(iy);
+ if(isPartner)
+ output.push_back(iy);
}
return output;
}
void QTildeReconstructor::
reconstructInitialFinalSystem(vector<ShowerProgenitorPtr> jets) const {
Lorentz5Momentum pin[2],pout[2];
bool atLeastOnce(false);
for(unsigned int ix=0;ix<jets.size();++ix) {
// final-state parton
if(jets[ix]->progenitor()->isFinalState()) {
pout[0] +=jets[ix]->progenitor()->momentum();
_progenitor = jets[ix]->progenitor();
atLeastOnce |= reconstructTimeLikeJet(jets[ix]->progenitor(),0);
}
// initial-state parton
else {
pin[0] +=jets[ix]->progenitor()->momentum();
atLeastOnce |= reconstructSpaceLikeJet(jets[ix]->progenitor());
assert(!jets[ix]->original()->parents().empty());
}
}
// add intrinsic pt if needed
atLeastOnce |= addIntrinsicPt(jets);
// momenta after showering
for(unsigned int ix=0;ix<jets.size();++ix) {
if(jets[ix]->progenitor()->isFinalState())
pout[1] += jets[ix]->progenitor()->momentum();
else
pin[1] += jets[ix]->progenitor()->momentum();
}
// work out the boost to the Breit frame
Lorentz5Momentum pa = pout[0]-pin[0];
Lorentz5Momentum pb = pin[0];
Axis axis(pa.vect().unit());
LorentzRotation rot;
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
rot.setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
rot.rotateX(Constants::pi);
rot.boostZ( pa.e()/pa.vect().mag());
Lorentz5Momentum ptemp=rot*pb;
Boost trans = -1./ptemp.e()*ptemp.vect();
trans.setZ(0.);
rot.boost(trans);
pa *=rot;
// project and calculate rescaling
// reference vectors
Lorentz5Momentum n1(ZERO,ZERO,-pa.z(),-pa.z());
Lorentz5Momentum n2(ZERO,ZERO, pa.z(),-pa.z());
Energy2 n1n2 = n1*n2;
// decompose the momenta
Lorentz5Momentum qbp=rot*pin[1],qcp= rot*pout[1];
double a[2],b[2];
a[0] = n2*qbp/n1n2;
b[0] = n1*qbp/n1n2;
Lorentz5Momentum qperp = qbp-a[0]*n1-b[0]*n2;
a[1] = 0.5*(qcp.m2()-qperp.m2())/n1n2;
b[1] = 1.;
double A(0.5*a[0]),B(b[0]*a[0]-a[1]*b[1]-0.25),C(-0.5*b[0]);
if(sqr(B)-4.*A*C<0.) throw KinematicsReconstructionVeto();
double kb = 0.5*(-B+sqrt(sqr(B)-4.*A*C))/A;
double kc = (a[0]*kb-0.5)/a[1];
if(kc==0.) throw KinematicsReconstructionVeto();
Lorentz5Momentum pnew[2] = { a[0]*kb*n1+b[0]/kb*n2+qperp,
a[1]*kc*n1+b[1]/kc*n2+qperp};
LorentzRotation rotinv=rot.inverse();
LorentzRotation transb=rotinv*solveBoostZ(pnew[0],qbp)*rot;
LorentzRotation transc=rotinv*solveBoost(pnew[1],qcp)*rot;
for(unsigned int ix=0;ix<jets.size();++ix) {
if(jets[ix]->progenitor()->isFinalState())
deepTransform(jets[ix]->progenitor(),transc);
else {
tPPtr parent;
boostChain(jets[ix]->progenitor(),transb,parent);
}
}
}
bool QTildeReconstructor::addIntrinsicPt(vector<ShowerProgenitorPtr> jets) const {
bool added=false;
// add the intrinsic pt if needed
for(unsigned int ix=0;ix<jets.size();++ix) {
// only for initial-state particles which haven't radiated
if(jets[ix]->progenitor()->isFinalState()||
jets[ix]->hasEmitted()) continue;
if(_intrinsic.find(jets[ix])==_intrinsic.end()) continue;
pair<Energy,double> pt=_intrinsic[jets[ix]];
Energy etemp = jets[ix]->original()->parents()[0]->momentum().z();
Lorentz5Momentum
p_basis(ZERO, ZERO, etemp, abs(etemp)),
n_basis(ZERO, ZERO,-etemp, abs(etemp));
double alpha = jets[ix]->progenitor()->x();
double beta = 0.5*(sqr(jets[ix]->progenitor()->data().mass())+
sqr(pt.first))/alpha/(p_basis*n_basis);
Lorentz5Momentum pnew=alpha*p_basis+beta*n_basis;
pnew.setX(pt.first*cos(pt.second));
pnew.setY(pt.first*sin(pt.second));
pnew.rescaleMass();
jets[ix]->progenitor()->set5Momentum(pnew);
added = true;
}
return added;
}
LorentzRotation QTildeReconstructor::
solveBoost(const double k, const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldp ) const {
Energy q = newq.vect().mag();
Energy2 qs = sqr(q);
Energy2 Q2 = newq.mass2();
Energy kp = k*(oldp.vect().mag());
Energy2 kps = sqr(kp);
double betam = (q*newq.e() - kp*sqrt(kps + Q2))/(kps + qs + Q2);
Boost beta = -betam*(k/kp)*oldp.vect();
// note that (k/kp)*oldp.vect() = oldp.vect()/oldp.vect().mag() but cheaper.
ThreeVector<Energy2> ax = newq.vect().cross( oldp.vect() );
double delta = newq.vect().angle( oldp.vect() );
LorentzRotation R;
using Constants::pi;
if ( ax.mag2()/GeV2/MeV2 > 1e-16 ) {
R.rotate( delta, unitVector(ax) ).boost( beta );
}
else if(abs(delta-pi)/pi < 0.001) {
double phi=2.*pi*UseRandom::rnd();
Axis axis(cos(phi),sin(phi),0.);
axis.rotateUz(newq.vect().unit());
R.rotate(delta,axis).boost( beta );
}
else {
R.boost( beta );
}
return R;
}
LorentzRotation QTildeReconstructor::solveBoost(const Lorentz5Momentum & q,
const Lorentz5Momentum & p ) const {
Energy modp = p.vect().mag();
Energy modq = q.vect().mag();
double betam = (p.e()*modp-q.e()*modq)/(sqr(modq)+sqr(modp)+p.mass2());
Boost beta = -betam*q.vect().unit();
ThreeVector<Energy2> ax = p.vect().cross( q.vect() );
double delta = p.vect().angle( q.vect() );
LorentzRotation R;
using Constants::pi;
if ( ax.mag2()/GeV2/MeV2 > 1e-16 ) {
R.rotate( delta, unitVector(ax) ).boost( beta );
}
else {
R.boost( beta );
}
return R;
}
LorentzRotation QTildeReconstructor::solveBoostZ(const Lorentz5Momentum & q,
const Lorentz5Momentum & p ) const {
static const Energy2 eps2 = 1e-8*GeV2;
static const Energy eps = 1e-4 *GeV;
LorentzRotation R;
double beta;
Energy2 den = (p.t()*q.t()-p.z()*q.z());
Energy2 num = -(p.z()*q.t()-q.z()*p.t());
if(abs(den)<eps2||abs(num)<eps2) {
if(abs(p.t()-abs(p.z()))<eps&&abs(q.t()-abs(q.z()))<eps) {
double ratio = sqr(q.t()/p.t());
beta = -(1.-ratio)/(1.+ratio);
}
else {
beta=0.;
}
}
else {
beta = num/den;
}
R.boostZ(beta);
Lorentz5Momentum ptest = R*p;
if(ptest.z()/q.z() < 0. || ptest.t()/q.t() < 0. ) {
throw KinematicsReconstructionVeto();
}
return R;
}
void QTildeReconstructor::
reconstructFinalStateSystem(bool applyBoost,
const LorentzRotation & toRest,
const LorentzRotation & fromRest,
vector<ShowerProgenitorPtr> jets) const {
// special for case of individual particle
if(jets.size()==1) {
LorentzRotation trans(toRest);
trans.transform(fromRest);
deepTransform(jets[0]->progenitor(),trans);
return;
}
bool radiated(false);
// find the hard process centre-of-mass energy
Lorentz5Momentum pcm;
// check if radiated and calculate total momentum
for(unsigned int ix=0;ix<jets.size();++ix) {
radiated |=jets[ix]->hasEmitted();
pcm += jets[ix]->progenitor()->momentum();
}
// check if in CMF frame
Boost beta_cm = pcm.findBoostToCM();
bool gottaBoost = (beta_cm.mag() > 1e-12);
// collection of pointers to initial hard particle and jet momenta
// for final boosts
JetKinVect jetKinematics;
vector<ShowerProgenitorPtr>::const_iterator cit;
for(cit = jets.begin(); cit != jets.end(); cit++) {
JetKinStruct tempJetKin;
tempJetKin.parent = (*cit)->progenitor();
if(gottaBoost) {
tempJetKin.parent->boost(beta_cm);
map<tShowerTreePtr,pair<tShowerProgenitorPtr,
tShowerParticlePtr> >::const_iterator tit;
for(tit = _currentTree->treelinks().begin();
tit != _currentTree->treelinks().end();++tit) {
if(tit->second.first && tit->second.second==tempJetKin.parent)
tit->first->transform(LorentzRotation(beta_cm),false);
}
}
tempJetKin.p = (*cit)->progenitor()->momentum();
_progenitor=tempJetKin.parent;
radiated |= reconstructTimeLikeJet((*cit)->progenitor(),0);
tempJetKin.q = (*cit)->progenitor()->momentum();
jetKinematics.push_back(tempJetKin);
}
// find the rescaling factor
double k = 0.0;
if(radiated) {
k = solveKfactor(pcm.m(), jetKinematics);
}
// perform the rescaling and boosts
for(JetKinVect::iterator it = jetKinematics.begin();
it != jetKinematics.end(); ++it) {
LorentzRotation Trafo = LorentzRotation();
if(radiated) Trafo = solveBoost(k, it->q, it->p);
if(gottaBoost) Trafo.boost(-beta_cm);
if(applyBoost) {
Trafo.transform( toRest);
Trafo.transform(fromRest);
}
if(radiated || gottaBoost || applyBoost) deepTransform(it->parent,Trafo);
}
}
void QTildeReconstructor::
reconstructInitialInitialSystem(bool & applyBoost,
LorentzRotation & toRest,
LorentzRotation & fromRest,
vector<ShowerProgenitorPtr> jets) const {
bool radiated = false;
Lorentz5Momentum pcm;
// check whether particles radiated and calculate total momentum
for( unsigned int ix = 0; ix < jets.size(); ++ix ) {
radiated |= jets[ix]->hasEmitted();
pcm += jets[ix]->progenitor()->momentum();
}
// check if intrinsic pt to be added
radiated |= !_intrinsic.empty();
// if no radiation return
if(!radiated) return;
// initial state shuffling
applyBoost=false;
vector<Lorentz5Momentum> p, pq, p_in;
for(unsigned int ix=0;ix<jets.size();++ix) {
// at momentum to vector
p_in.push_back(jets[ix]->progenitor()->momentum());
// reconstruct the jet
radiated |= reconstructSpaceLikeJet(jets[ix]->progenitor());
assert(!jets[ix]->original()->parents().empty());
Energy etemp = jets[ix]->original()->parents()[0]->momentum().z();
Lorentz5Momentum ptemp = Lorentz5Momentum(ZERO, ZERO, etemp, abs(etemp));
pq.push_back(ptemp);
}
// add the intrinsic pt if needed
radiated |=addIntrinsicPt(jets);
for(unsigned int ix=0;ix<jets.size();++ix) {
p.push_back(jets[ix]->progenitor()->momentum());
}
double x1 = p_in[0].z()/pq[0].z();
double x2 = p_in[1].z()/pq[1].z();
Energy MDY = (p_in[0] + p_in[1]).m();
Energy2 S = (pq[0]+pq[1]).m2();
// if not need don't apply boosts
if(!(radiated && p.size() == 2 && pq.size() == 2)) return;
applyBoost=true;
// find alphas and betas in terms of desired basis
Energy2 p12 = pq[0]*pq[1];
double a[2] = {p[0]*pq[1]/p12,p[1]*pq[1]/p12};
double b[2] = {p[0]*pq[0]/p12,p[1]*pq[0]/p12};
Lorentz5Momentum p1p = p[0] - a[0]*pq[0] - b[0]*pq[1];
Lorentz5Momentum p2p = p[1] - a[1]*pq[0] - b[1]*pq[1];
// compute kappa
Energy2 A = a[0]*b[1]*S;
Energy2 B = Energy2(sqr(MDY)) - (a[0]*b[0]+a[1]*b[1])*S - (p1p+p2p).m2();
Energy2 C = a[1]*b[0]*S;
double rad = 1.-4.*A*C/sqr(B);
if(rad < 0.) throw KinematicsReconstructionVeto();
double kp = B/(2.*A)*(1.+sqrt(rad));
// now compute k1, k2
rad = kp*(b[0]+kp*b[1])/(kp*a[0]+a[1])*(x1/x2);
if(rad <= 0.) throw KinematicsReconstructionVeto();
double k1 = sqrt(rad);
double k2 = kp/k1;
double beta[2] =
{getBeta((a[0]+b[0]), (a[0]-b[0]), (k1*a[0]+b[0]/k1), (k1*a[0]-b[0]/k1)),
getBeta((a[1]+b[1]), (a[1]-b[1]), (a[1]/k2+k2*b[1]), (a[1]/k2-k2*b[1]))};
if (pq[0].z() > ZERO) {
beta[0] = -beta[0];
beta[1] = -beta[1];
}
// apply the boosts
Lorentz5Momentum newcmf;
for(unsigned int ix=0;ix<jets.size();++ix) {
tPPtr toBoost = jets[ix]->progenitor();
Boost betaboost(0, 0, beta[ix]);
tPPtr parent;
boostChain(toBoost, LorentzRotation(betaboost),parent);
if(parent->momentum().e()/pq[ix].e()>1.||
parent->momentum().z()/pq[ix].z()>1.) throw KinematicsReconstructionVeto();
newcmf+=toBoost->momentum();
}
if(newcmf.m()<ZERO||newcmf.e()<ZERO) throw KinematicsReconstructionVeto();
// do one boost
toRest = LorentzRotation(pcm.findBoostToCM());
if(_initialBoost==0) {
fromRest = LorentzRotation(newcmf.boostVector());
}
else if(_initialBoost==1) {
// first apply longitudinal boost
double beta = newcmf.z()/sqrt(newcmf.m2()+sqr(newcmf.z()));
fromRest=LorentzRotation(Boost(0.,0.,beta));
// then transverse one
Energy pT = sqrt(sqr(newcmf.x())+sqr(newcmf.y()));
beta = pT/newcmf.t();
fromRest.boost(Boost(beta*newcmf.x()/pT,beta*newcmf.y()/pT,0.));
}
else
assert(false);
}
void QTildeReconstructor::
deconstructInitialInitialSystem(bool & applyBoost,
LorentzRotation & toRest,
LorentzRotation & fromRest,
HardTreePtr tree,
vector<HardBranchingPtr> jets,
ShowerInteraction::Type) const {
// get the momenta of the particles
vector<Lorentz5Momentum> pin;
vector<Lorentz5Momentum> pq;
vector<HardBranchingPtr>::iterator cit;
for(cit=jets.begin();cit!=jets.end();++cit) {
pin.push_back((*cit)->branchingParticle()->momentum());
Energy etemp = (*cit)->beam()->momentum().z();
pq.push_back(Lorentz5Momentum(ZERO, ZERO,etemp, abs(etemp)));
}
bool order = (*tree->incoming().begin())->beam()->momentum().z()/pq[0].z()<0.;
assert(pin.size()==2);
// decompose the momenta
double alpha[2],beta[2];
Energy2 p12=pq[0]*pq[1];
Lorentz5Momentum pt[2];
for(unsigned int ix=0;ix<2;++ix) {
alpha[ix] = pin[ix]*pq[1]/p12;
beta [ix] = pin[ix]*pq[0]/p12;
pt[ix] = pin[ix]-alpha[ix]*pq[0]-beta[ix]*pq[1];
}
// parton level centre-of-mass
Lorentz5Momentum pcm=pin[0]+pin[1];
pcm.rescaleMass();
double rap=pcm.rapidity();
// hadron level cmf
Energy2 s = (pq[0] +pq[1] ).m2();
// calculate the x values
double x[2]={sqrt(pcm.mass2()/s*exp(2.*rap)),pcm.mass2()/s/x[0]};
if(pq[0].z()<ZERO) swap(x[0],x[1]);
double k1=alpha[0]/x[0],k2=beta[1]/x[1];
double alphanew[2]={alpha[0]/k1,alpha[1]*k2};
double betanew [2]={beta [0]*k1,beta [1]/k2};
double boost[2];
for(unsigned int ix=0;ix<2;++ix) {
boost[ix] = getBeta(alpha [ix]+beta [ix], alpha[ix] -beta [ix],
alphanew[ix]+betanew[ix], alphanew[ix]-betanew[ix]);
if (pq[0].z() > ZERO) beta[ix]*=-1.;
}
// apply the boost the the particles
// first incoming particle
if(order) swap(pq[0],pq[1]);
// now apply the boosts
Boost betaboost(0.,0.,-boost[0]);
LorentzRotation R;
R.boost(betaboost);
set<HardBranchingPtr>::const_iterator cjt=tree->incoming().begin();
(*cjt)->pVector(pq[0]);
(*cjt)->nVector(pq[1]);
(*cjt)->setMomenta(R,1.,Lorentz5Momentum());
// second incoming particle
betaboost = Boost(0.,0.,-boost[1]);
R=LorentzRotation(betaboost);
++cjt;
(*cjt)->pVector(pq[1]);
(*cjt)->nVector(pq[0]);
(*cjt)->setMomenta(R,1.,Lorentz5Momentum());
jets[0]->showerMomentum(x[0]*jets[0]->pVector());
jets[1]->showerMomentum(x[1]*jets[1]->pVector());
// and calculate the boosts
applyBoost=true;
// do one boost
if(_initialBoost==0) {
toRest = LorentzRotation(-pcm.boostVector());
}
else if(_initialBoost==1) {
// first the transverse boost
Energy pT = sqrt(sqr(pcm.x())+sqr(pcm.y()));
double beta = -pT/pcm.t();
toRest=LorentzRotation(Boost(beta*pcm.x()/pT,beta*pcm.y()/pT,0.));
// the longitudinal
beta = pcm.z()/sqrt(pcm.m2()+sqr(pcm.z()));
toRest.boost(Boost(0.,0.,-beta));
}
else
assert(false);
fromRest = LorentzRotation((jets[0]->showerMomentum()+
jets[1]->showerMomentum()).boostVector());
}
void QTildeReconstructor::
deconstructFinalStateSystem(const LorentzRotation & toRest,
const LorentzRotation & fromRest,
HardTreePtr tree, vector<HardBranchingPtr> jets,
cEvolverPtr evolver,
ShowerInteraction::Type type) const {
if(jets.size()==1) {
LorentzRotation R(toRest);
R.transform(fromRest);
// \todo What does this do? tree->showerRot( R );
jets[0]->original(R*jets[0]->branchingParticle()->momentum());
jets[0]->showerMomentum(R*jets[0]->branchingParticle()->momentum());
// find the colour partners
ShowerParticleVector particles;
vector<Lorentz5Momentum> ptemp;
set<HardBranchingPtr>::const_iterator cjt;
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
ptemp.push_back((**cjt).branchingParticle()->momentum());
(**cjt).branchingParticle()->set5Momentum((**cjt).showerMomentum());
particles.push_back((**cjt).branchingParticle());
}
evolver->showerModel()->partnerFinder()
->setInitialEvolutionScales(particles,false,type,false);
// calculate the reference vectors
unsigned int iloc(0);
set<HardBranchingPtr>::iterator clt;
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
// reset the momentum
(**cjt).branchingParticle()->set5Momentum(ptemp[iloc]);
++iloc;
// sort out the partners
tShowerParticlePtr partner =
(*cjt)->branchingParticle()->partner();
if(!partner) continue;
for(clt=tree->branchings().begin();clt!=tree->branchings().end();++clt) {
if((**clt).branchingParticle()==partner) {
(**cjt).colourPartner(*clt);
break;
}
}
tHardBranchingPtr branch;
for(clt=tree->branchings().begin();clt!=tree->branchings().end();++clt) {
if(clt==cjt) continue;
if((*clt)->branchingParticle()==partner) {
branch=*clt;
break;
}
}
}
return;
}
vector<HardBranchingPtr>::iterator cit;
vector<Lorentz5Momentum> pout;
vector<Energy> mon;
for(cit=jets.begin();cit!=jets.end();++cit) {
pout.push_back((*cit)->branchingParticle()->momentum());
// KH - 230909 - If the particle has no children then it will
// not have showered and so it should be "on-shell" so we can
// get it's mass from it's momentum. This means that the
// inverseRescalingFactor doesn't give any nans or do things
// it shouldn't if it gets e.g. two Z bosons generated with
// off-shell masses. This is for sure not the best solution.
// PR 1/1/10 modification to previous soln
if((*cit)->branchingParticle()->children().size()==0 ||
(!(*cit)->branchingParticle()->dataPtr()->coloured() &&
!(*cit)->branchingParticle()->dataPtr()->stable()) )
mon.push_back(pout.back().mass());
else
mon.push_back((*cit)->branchingParticle()->dataPtr()->mass());
}
// boost all the momenta to the rest frame of the decaying particle
Lorentz5Momentum pin;
for(unsigned int ix=0;ix<pout.size();++ix) {
pout[ix].transform(toRest);
pin += pout[ix];
}
pin.rescaleMass();
// rescaling factor
double lambda=inverseRescalingFactor(pout,mon,pin.mass());
// now calculate the p reference vectors
for(cit=jets.begin();cit!=jets.end();++cit){
Lorentz5Momentum pvect = (*cit)->branchingParticle()->momentum();
pvect.transform(toRest);
pvect /= lambda;
if((*cit)->branchingParticle()->children().size()==0 ||
(!(*cit)->branchingParticle()->dataPtr()->coloured() &&
!(*cit)->branchingParticle()->dataPtr()->stable()) )
pvect.setMass((*cit)->branchingParticle()->momentum().mass());
else
pvect.setMass((*cit)->branchingParticle()->dataPtr()->mass());
pvect.rescaleEnergy();
pvect.transform(fromRest);
(*cit)->pVector(pvect);
(*cit)->showerMomentum(pvect);
}
// find the colour partners
ShowerParticleVector particles;
vector<Lorentz5Momentum> ptemp;
set<HardBranchingPtr>::const_iterator cjt;
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
ptemp.push_back((**cjt).branchingParticle()->momentum());
(**cjt).branchingParticle()->set5Momentum((**cjt).showerMomentum());
particles.push_back((**cjt).branchingParticle());
}
evolver->showerModel()->partnerFinder()
->setInitialEvolutionScales(particles,false,type,false);
// calculate the reference vectors
unsigned int iloc(0);
set<HardBranchingPtr>::iterator clt;
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
// reset the momentum
(**cjt).branchingParticle()->set5Momentum(ptemp[iloc]);
++iloc;
}
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
// sort out the partners
tShowerParticlePtr partner =
(*cjt)->branchingParticle()->partner();
if(!partner) continue;
for(clt=tree->branchings().begin();clt!=tree->branchings().end();++clt) {
if((**clt).branchingParticle()==partner) {
(**cjt).colourPartner(*clt);
break;
}
}
tHardBranchingPtr branch;
for(clt=tree->branchings().begin();clt!=tree->branchings().end();++clt) {
if(clt==cjt) continue;
if((*clt)->branchingParticle()==partner) {
branch=*clt;
break;
}
}
// compute the reference vectors
// both incoming, should all ready be done
if((**cjt).status()==HardBranching::Incoming &&
(**clt).status()==HardBranching::Incoming) {
continue;
}
// both outgoing
else if(!(**cjt).status()==HardBranching::Incoming&&
branch->status()==HardBranching::Outgoing) {
Boost boost=((*cjt)->pVector()+branch->pVector()).findBoostToCM();
Lorentz5Momentum pcm = branch->pVector();
pcm.boost(boost);
Lorentz5Momentum nvect = Lorentz5Momentum(ZERO,pcm.vect());
nvect.boost( -boost);
(**cjt).nVector(nvect);
}
else if((**cjt).status()==HardBranching::Incoming) {
Lorentz5Momentum pa = -(**cjt).showerMomentum()+branch->showerMomentum();
Lorentz5Momentum pb = (**cjt).showerMomentum();
Axis axis(pa.vect().unit());
LorentzRotation rot;
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
rot.setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
rot.rotateX(Constants::pi);
rot.boostZ( pa.e()/pa.vect().mag());
pb*=rot;
Boost trans = -1./pb.e()*pb.vect();
trans.setZ(0.);
rot.boost(trans);
Energy scale=(**cjt).beam()->momentum().e();
Lorentz5Momentum pbasis(ZERO,(**cjt).beam()->momentum().vect().unit()*scale);
Lorentz5Momentum pcm = rot*pbasis;
rot.invert();
(**cjt).nVector(rot*Lorentz5Momentum(ZERO,-pcm.vect()));
tHardBranchingPtr branch2 = *cjt;;
while (branch2->parent()) {
branch2=branch2->parent();
branch2->nVector(rot*Lorentz5Momentum(ZERO,-pcm.vect()));
}
}
else if(branch->status()==HardBranching::Incoming) {
(**cjt).nVector(Lorentz5Momentum(ZERO,branch->showerMomentum().vect()));
}
}
// now compute the new momenta
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
if(!(*cjt)->branchingParticle()->isFinalState()) continue;
Lorentz5Momentum qnew;
if((*cjt)->branchingParticle()->partner()) {
Energy2 dot=(*cjt)->pVector()*(*cjt)->nVector();
double beta = 0.5*((*cjt)->branchingParticle()->momentum().m2()
-sqr((*cjt)->pVector().mass()))/dot;
qnew=(*cjt)->pVector()+beta*(*cjt)->nVector();
qnew.rescaleMass();
}
else {
qnew = (*cjt)->pVector();
}
// qnew is the unshuffled momentum in the rest frame of the p basis vectors,
// for the simple case Z->q qbar g this was checked against analytic formulae.
// compute the boost
LorentzRotation R=solveBoost(qnew,
toRest*(*cjt)->branchingParticle()->momentum())*toRest;
(*cjt)->setMomenta(R,1.0,Lorentz5Momentum());
}
}
Energy QTildeReconstructor::momConsEq(const double & k,
const Energy & root_s,
const JetKinVect & jets) const {
static const Energy2 eps=1e-8*GeV2;
Energy dum = ZERO;
for(JetKinVect::const_iterator it = jets.begin(); it != jets.end(); ++it) {
Energy2 dum2 = (it->q).m2() + sqr(k)*(it->p).vect().mag2();
if(dum2 < ZERO) {
if(dum2 < -eps) throw KinematicsReconstructionVeto();
dum2 = ZERO;
}
dum += sqrt(dum2);
}
return dum - root_s;
}
void QTildeReconstructor::boostChain(tPPtr p, const LorentzRotation &bv,
tPPtr & parent) const {
if(!p->parents().empty()) boostChain(p->parents()[0], bv,parent);
else parent=p;
p->transform(bv);
if(p->children().size()==2) {
if(dynamic_ptr_cast<ShowerParticlePtr>(p->children()[1]))
deepTransform(p->children()[1],bv);
}
}
void QTildeReconstructor::
reconstructGeneralSystem(vector<ShowerProgenitorPtr> & ShowerHardJets) const {
// general recon, all initial-state in one system and final-state
// in another
ColourSingletSystem in,out;
for(unsigned int ix=0;ix<ShowerHardJets.size();++ix) {
if(ShowerHardJets[ix]->progenitor()->isFinalState())
out.jets.push_back(ShowerHardJets[ix]);
else
in.jets.push_back(ShowerHardJets[ix]);
}
// reconstruct initial-initial system
LorentzRotation toRest,fromRest;
bool applyBoost(false);
reconstructInitialInitialSystem(applyBoost,toRest,fromRest,in.jets);
// reconstruct the final-state systems
reconstructFinalStateSystem(applyBoost,toRest,fromRest,out.jets);
}
bool QTildeReconstructor::
inverseDecayRescalingFactor(vector<Lorentz5Momentum> pout,
vector<Energy> mon,Energy roots,
Lorentz5Momentum ppartner, Energy mbar,
double & k1, double & k2) const {
ThreeVector<Energy> qtotal;
vector<Energy2> pmag;
for(unsigned int ix=0;ix<pout.size();++ix) {
pmag.push_back(pout[ix].vect().mag2());
qtotal+=pout[ix].vect();
}
Energy2 dot1 = qtotal*ppartner.vect();
Energy2 qmag2=qtotal.mag2();
double a = -dot1/qmag2;
static const Energy eps=1e-10*GeV;
unsigned int itry(0);
Energy numer(ZERO),denom(ZERO);
k1=1.;
do {
++itry;
numer=denom=0.*GeV;
double k12=sqr(k1);
for(unsigned int ix=0;ix<pout.size();++ix) {
Energy en = sqrt(pmag[ix]/k12+sqr(mon[ix]));
numer += en;
denom += pmag[ix]/en;
}
Energy en = sqrt(qmag2/k12+sqr(mbar));
numer += en-roots;
denom += qmag2/en;
k1 += numer/denom*k12*k1;
if(abs(k1)>1e10) return false;
}
while (abs(numer)>eps&&itry<100);
k1 = abs(k1);
k2 = a*k1;
return itry<100;
}
void QTildeReconstructor::
findPartners(HardBranchingPtr branch,set<HardBranchingPtr> & done,
- const set<HardBranchingPtr> & branchings,
- vector<HardBranchingPtr> & jets) const {
+ const set<HardBranchingPtr> & branchings,
+ vector<HardBranchingPtr> & jets) const {
tShowerParticlePtr part=branch->branchingParticle();
+ unsigned int partNumColourLines =
+ branch->branchingParticle()->colourInfo()-> colourLines().size();
+ unsigned int partNumAColourLines =
+ branch->branchingParticle()->colourInfo()->antiColourLines().size();
for(set<HardBranchingPtr>::const_iterator cit=branchings.begin();
cit!=branchings.end();++cit) {
if(done.find(*cit)!=done.end()||!(**cit).branchingParticle()->coloured())
continue;
bool isPartner = false;
// one initial and one final
if(branch->status()!=(**cit).status()) {
- if(part->colourLine() &&
- part->colourLine() == (**cit).branchingParticle()->colourLine())
- isPartner = true;
- if(part->antiColourLine() &&
- part->antiColourLine() == (**cit).branchingParticle()->antiColourLine())
- isPartner = true;
+ if(part->colourLine()) {
+ for(unsigned int ix=0; ix<partNumColourLines; ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(cit); ++jx){
+ if(part->colourInfo()->colourLines()[ix] ==
+ (**cit).branchingParticle()->colourInfo()->colourLines()[jx]){
+ isPartner = true;
+ break;
+ }
+ }
+ }
+ }
+ if(part->antiColourLine()) {
+ for(unsigned int ix=0; ix<partNumAColourLines; ++ix){
+ for(unsigned int jx=0; jx<ACLSIZE(cit); ++jx){
+ if(part->colourInfo()->antiColourLines()[ix] ==
+ (**cit).branchingParticle()->colourInfo()->antiColourLines()[jx]){
+ isPartner = true;
+ break;
+ }
+ }
+ }
+ }
}
// both in either initial or final state
else {
- if(part->colourLine() &&
- part->colourLine() == (**cit).branchingParticle()->antiColourLine())
- isPartner = true;
- if(part->antiColourLine() &&
- part->antiColourLine() == (**cit).branchingParticle()->colourLine())
- isPartner = true;
+ if(part->colourLine()) {
+ for(unsigned int ix=0; ix<partNumColourLines; ++ix) {
+ for(unsigned int jx=0; jx<ACLSIZE(cit); ++jx) {
+ if(part->colourInfo()->colourLines()[ix] ==
+ (**cit).branchingParticle()->colourInfo()->antiColourLines()[jx]){
+ isPartner = true;
+ break;
+ }
+ }
+ }
+ }
+ if(part->antiColourLine()) {
+ for(unsigned int ix=0; ix<partNumAColourLines; ++ix){
+ for(unsigned int jx=0; jx<CLSIZE(cit); ++jx){
+ if(part->colourInfo()->antiColourLines()[ix] ==
+ (**cit).branchingParticle()->colourInfo()->colourLines()[jx]){
+ isPartner = true;
+ break;
+ }
+ }
+ }
+ }
}
if(isPartner) {
jets.push_back(*cit);
done.insert(*cit);
findPartners(*cit,done,branchings,jets);
}
}
}
void QTildeReconstructor::
deconstructInitialFinalSystem(HardTreePtr tree,vector<HardBranchingPtr> jets,
cEvolverPtr evolver,
ShowerInteraction::Type type) const {
HardBranchingPtr incoming;
Lorentz5Momentum pin[2],pout[2],pbeam;
HardBranchingPtr initial;
Energy mc(ZERO);
for(unsigned int ix=0;ix<jets.size();++ix) {
// final-state parton
if(jets[ix]->status()==HardBranching::Outgoing) {
pout[0] += jets[ix]->branchingParticle()->momentum();
mc = jets[ix]->branchingParticle()->getThePEGBase() ?
jets[ix]->branchingParticle()->getThePEGBase()->mass() :
jets[ix]->branchingParticle()->dataPtr()->mass();
}
// initial-state parton
else {
pin[0] += jets[ix]->branchingParticle()->momentum();
initial = jets[ix];
pbeam = jets[ix]->beam()->momentum();
Energy scale=pbeam.t();
pbeam = Lorentz5Momentum(ZERO,pbeam.vect().unit()*scale);
incoming = jets[ix];
while(incoming->parent()) incoming = incoming->parent();
}
}
if(jets.size()>2) {
pout[0].rescaleMass();
mc = pout[0].mass();
}
// work out the boost to the Breit frame
Lorentz5Momentum pa = pout[0]-pin[0];
Axis axis(pa.vect().unit());
LorentzRotation rot;
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
if(axis.perp2()>0.) {
rot.setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
rot.rotateX(Constants::pi);
rot.boostZ( pa.e()/pa.vect().mag());
}
// transverse part
Lorentz5Momentum paxis=rot*pbeam;
Boost trans = -1./paxis.e()*paxis.vect();
trans.setZ(0.);
rot.boost(trans);
pa *= rot;
// reference vectors
Lorentz5Momentum n1(ZERO,ZERO,-pa.z(),-pa.z());
Lorentz5Momentum n2(ZERO,ZERO, pa.z(),-pa.z());
Energy2 n1n2 = n1*n2;
// decompose the momenta
Lorentz5Momentum qbp=rot*pin[0],qcp= rot*pout[0];
double a[2],b[2];
a[0] = n2*qbp/n1n2;
b[0] = n1*qbp/n1n2;
a[1] = n2*qcp/n1n2;
b[1] = n1*qcp/n1n2;
Lorentz5Momentum qperp = qbp-a[0]*n1-b[0]*n2;
// before reshuffling
Energy Q = abs(pa.z());
double c = sqr(mc/Q);
Lorentz5Momentum pb(ZERO,ZERO,0.5*Q*(1.+c),0.5*Q*(1.+c));
Lorentz5Momentum pc(ZERO,ZERO,0.5*Q*(c-1.),0.5*Q*(1.+c));
double anew[2],bnew[2];
anew[0] = pb*n2/n1n2;
bnew[0] = 0.5*(qbp.m2()-qperp.m2())/n1n2/anew[0];
bnew[1] = pc*n1/n1n2;
anew[1] = 0.5*qcp.m2()/bnew[1]/n1n2;
Lorentz5Momentum qnewb = (anew[0]*n1+bnew[0]*n2+qperp);
Lorentz5Momentum qnewc = (anew[1]*n1+bnew[1]*n2);
// initial-state boost
LorentzRotation rotinv=rot.inverse();
LorentzRotation transb=rotinv*solveBoostZ(qnewb,qbp)*rot;
// final-state boost
LorentzRotation transc=rotinv*solveBoost(qnewc,qcp)*rot;
// this will need changing for more than one outgoing particle
// set the pvectors
for(unsigned int ix=0;ix<jets.size();++ix) {
if(jets[ix]->status()==HardBranching::Incoming) {
jets[ix]->pVector(pbeam);
jets[ix]->showerMomentum(rotinv*pb);
incoming->pVector(jets[ix]->pVector());
}
else {
jets[ix]->pVector(rotinv*pc);
jets[ix]->showerMomentum(jets[ix]->pVector());
}
}
// find the colour partners
ShowerParticleVector particles;
vector<Lorentz5Momentum> ptemp;
set<HardBranchingPtr>::const_iterator cjt;
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
ptemp.push_back((**cjt).branchingParticle()->momentum());
(**cjt).branchingParticle()->set5Momentum((**cjt).showerMomentum());
particles.push_back((**cjt).branchingParticle());
}
evolver->showerModel()->partnerFinder()
->setInitialEvolutionScales(particles,false,type,false);
unsigned int iloc(0);
for(cjt=tree->branchings().begin();cjt!=tree->branchings().end();++cjt) {
// reset the momentum
(**cjt).branchingParticle()->set5Momentum(ptemp[iloc]);
++iloc;
}
for(vector<HardBranchingPtr>::const_iterator cjt=jets.begin();
cjt!=jets.end();++cjt) {
// sort out the partners
tShowerParticlePtr partner =
(*cjt)->branchingParticle()->partner();
if(!partner) continue;
tHardBranchingPtr branch;
for(set<HardBranchingPtr>::const_iterator
clt=tree->branchings().begin();clt!=tree->branchings().end();++clt) {
if((**clt).branchingParticle()==partner) {
(**cjt).colourPartner(*clt);
branch=*clt;
break;
}
}
// compute the reference vectors
// both incoming, should all ready be done
if((**cjt).status()==HardBranching::Incoming &&
branch->status()==HardBranching::Incoming) {
Energy etemp = (*cjt)->beam()->momentum().z();
Lorentz5Momentum nvect(ZERO, ZERO,-etemp, abs(etemp));
tHardBranchingPtr branch2 = *cjt;
(**cjt).nVector(nvect);
while (branch2->parent()) {
branch2=branch2->parent();
branch2->nVector(nvect);
}
}
// both outgoing
else if((**cjt).status()==HardBranching::Outgoing&&
branch->status()==HardBranching::Outgoing) {
Boost boost=((*cjt)->pVector()+branch->pVector()).findBoostToCM();
Lorentz5Momentum pcm = branch->pVector();
pcm.boost(boost);
Lorentz5Momentum nvect = Lorentz5Momentum(ZERO,pcm.vect());
nvect.boost( -boost);
(**cjt).nVector(nvect);
}
else if((**cjt).status()==HardBranching::Incoming) {
Lorentz5Momentum pa = -(**cjt).showerMomentum()+branch->showerMomentum();
Lorentz5Momentum pb = (**cjt).showerMomentum();
Axis axis(pa.vect().unit());
LorentzRotation rot;
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
if(axis.perp2()>1e-20) {
rot.setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
rot.rotateX(Constants::pi);
}
if(abs(1.-pa.e()/pa.vect().mag())>1e-6) rot.boostZ( pa.e()/pa.vect().mag());
pb*=rot;
Boost trans = -1./pb.e()*pb.vect();
trans.setZ(0.);
rot.boost(trans);
Energy scale=(**cjt).beam()->momentum().t();
Lorentz5Momentum pbasis(ZERO,(**cjt).beam()->momentum().vect().unit()*scale);
Lorentz5Momentum pcm = rot*pbasis;
rot.invert();
Lorentz5Momentum nvect = rot*Lorentz5Momentum(ZERO,-pcm.vect());
(**cjt).nVector(nvect);
tHardBranchingPtr branch2 = *cjt;
while (branch2->parent()) {
branch2=branch2->parent();
branch2->nVector(nvect);
}
}
else if(branch->status()==HardBranching::Incoming) {
Lorentz5Momentum nvect=Lorentz5Momentum(ZERO,branch->showerMomentum().vect());
(**cjt).nVector(nvect);
}
}
// now compute the new momenta
for(vector<HardBranchingPtr>::const_iterator cjt=jets.begin();
cjt!=jets.end();++cjt) {
if((**cjt).status()==HardBranching::Outgoing) {
(**cjt).setMomenta(transc,1.,Lorentz5Momentum());
}
}
incoming->setMomenta(transb,1.,Lorentz5Momentum());
}
void QTildeReconstructor::deepTransform(PPtr particle,
const LorentzRotation & r,
bool match,
PPtr original) const {
Lorentz5Momentum porig = particle->momentum();
if(!original) original = particle;
for ( int i = 0, N = particle->children().size(); i < N; ++i ) {
deepTransform(particle->children()[i],r,
particle->children()[i]->id()==original->id()&&match,original);
}
particle->transform(r);
if ( particle->next() ) deepTransform(particle->next(),r,match,original);
if(!match) return;
if(!particle->children().empty()) return;
// check if there's a daughter tree which also needs boosting
map<tShowerTreePtr,pair<tShowerProgenitorPtr,tShowerParticlePtr> >::const_iterator tit;
for(tit = _currentTree->treelinks().begin();
tit != _currentTree->treelinks().end();++tit) {
// if there is, boost it
if(tit->second.first && tit->second.second==original) {
Lorentz5Momentum pnew = tit->first->incomingLines().begin()
->first->progenitor()->momentum();
pnew *= tit->first->transform();
Lorentz5Momentum pdiff = porig-pnew;
Energy2 test = sqr(pdiff.x()) + sqr(pdiff.y()) +
sqr(pdiff.z()) + sqr(pdiff.t());
LorentzRotation rot;
if(test>1e-6*GeV2) rot = solveBoost(porig,pnew);
tit->first->transform(r*rot,false);
}
}
}
+
+
diff --git a/Shower/Default/QTildeReconstructor.h b/Shower/Default/QTildeReconstructor.h
--- a/Shower/Default/QTildeReconstructor.h
+++ b/Shower/Default/QTildeReconstructor.h
@@ -1,558 +1,603 @@
// -*- C++ -*-
//
// QTildeReconstructor.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_QTildeReconstructor_H
#define HERWIG_QTildeReconstructor_H
//
// This is the declaration of the QTildeReconstructor class.
//
+#include "ThePEG/EventRecord/ColourLine.h"
#include "Herwig++/Shower/Base/KinematicsReconstructor.h"
#include "ThePEG/Repository/UseRandom.h"
namespace Herwig {
using namespace ThePEG;
/** \ingroup Shower
* A simple struct to store the information we need on the
* showering
*/
struct JetKinStruct {
/**
* Parent particle of the jet
*/
tShowerParticlePtr parent;
/**
* Momentum of the particle before reconstruction
*/
Lorentz5Momentum p;
/**
* Momentum of the particle after reconstruction
*/
Lorentz5Momentum q;
};
/**
* typedef for a vector of JetKinStruct
*/
typedef vector<JetKinStruct> JetKinVect;
/** \ingroup Shower
*
* This class is responsible for the kinematical reconstruction
* after each showering step, and also for the necessary Lorentz boosts
* in order to preserve energy-momentum conservation in the overall collision,
* and also the invariant mass and the rapidity of the hard subprocess system.
* In the case of multi-step showering, there will be not unnecessary
* kinematical reconstructions.
*
* There is also the option of taking a set of momenta for the particles
* and inverting the reconstruction to give the evolution variables for the
* shower.
*
* Notice:
* - although we often use the term "jet" in either methods or variables names,
* or in comments, which could appear applicable only for QCD showering,
* there is indeed no "dynamics" represented in this class: only kinematics
* is involved, as the name of this class remainds. Therefore it can be used
* for any kind of showers (QCD-,QED-,EWK-,... bremsstrahlung).
*
* @see ShowerParticle
* @see ShowerKinematics
* @see \ref QTildeReconstructorInterfaces "The interfaces"
* defined for QTildeReconstructor.
*/
class QTildeReconstructor: public KinematicsReconstructor {
public:
/**
* Default constructor
*/
QTildeReconstructor() : _reconopt(0), _initialBoost(0), _minQ(MeV) {};
/**
* Methods to reconstruct the kinematics of a scattering or decay process
*/
//@{
/**
* Given in input a vector of the particles which initiated the showers
* the method does the reconstruction of such jets,
* including the appropriate boosts (kinematics reshufflings)
* needed to conserve the total energy-momentum of the collision
* and preserving the invariant mass and the rapidity of the
* hard subprocess system.
*/
virtual bool reconstructHardJets(ShowerTreePtr hard,
const map<tShowerProgenitorPtr,
pair<Energy,double> > & pt) const;
/**
* Given in input a vector of the particles which initiated the showers
* the method does the reconstruction of such jets,
* including the appropriate boosts (kinematics reshufflings)
* needed to conserve the total energy-momentum of the collision
* and preserving the invariant mass and the rapidity of the
* hard subprocess system.
*/
virtual bool reconstructDecayJets(ShowerTreePtr decay) const;
//@}
/**
* Methods to invert the reconstruction of the shower for
* a scattering or decay process and calculate
* the variables used to generate the
* shower given the particles produced.
* This is needed for the CKKW and POWHEG approaches
*/
//@{
/**
* Given the particles, with a history which we wish to interpret
* as a shower reconstruct the variables used to generate the
* shower
*/
virtual bool deconstructDecayJets(HardTreePtr, cEvolverPtr,
ShowerInteraction::Type) const;
/**
* Given the particles, with a history which we wish to interpret
* as a shower reconstruct the variables used to generate the shower
* for a hard process
*/
virtual bool deconstructHardJets(HardTreePtr, cEvolverPtr,
ShowerInteraction::Type) 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:
/**
* Methods to reconstruct the kinematics of individual jets
*/
//@{
/**
* Given the particle (ShowerParticle object) that
* originates a forward (time-like) jet, this method reconstructs the kinematics
* of the jet. That is, by starting from the final grand-children (which
* originates directly or indirectly from particleJetParent,
* and which don't have children), and moving "backwards" (in a physical
* time picture), towards the particleJetParent, the
* ShowerKinematics objects associated with the various particles,
* which have been created during the showering, are now completed.
* In particular, at the end, we get the mass of the jet, which is the
* main information we want.
* This methods returns false if there was no radiation or rescaling required
*/
virtual bool reconstructTimeLikeJet(const tShowerParticlePtr particleJetParent,
unsigned int iopt) const;
/**
* Exactly similar to the previous one, but for a space-like jet.
* Also in this case we start from the final grand-children (which
* are childless) of the particle which originates the jet, but in
* this case we proceed "forward" (in the physical time picture)
* towards the particleJetParent.
* This methods returns false if there was no radiation or rescaling required
*/
bool reconstructSpaceLikeJet(const tShowerParticlePtr particleJetParent) const;
/**
* Exactly similar to the previous one, but for a decay jet
* This methods returns false if there was no radiation or rescaling required
*/
bool reconstructDecayJet(const tShowerParticlePtr particleJetParent) const;
//@}
/**
* Methods to perform the reconstruction of various types of colour
* singlet systems
*/
//@{
/**
* Perform the reconstruction of a system with one incoming and at least one
* outgoing particle
*/
void reconstructInitialFinalSystem(vector<ShowerProgenitorPtr>) const;
/**
* Perform the reconstruction of a system with only final-state
* particles
*/
void reconstructFinalStateSystem(bool applyBoost,
const LorentzRotation & toRest,
const LorentzRotation & fromRest,
vector<ShowerProgenitorPtr>) const;
/**
* Reconstruction of a general coloured system
*/
void reconstructGeneralSystem(vector<ShowerProgenitorPtr> & ShowerHardJets) const;
/**
* Perform the reconstruction of a system with only final-state
* particles
*/
void reconstructInitialInitialSystem(bool & applyBoost,
LorentzRotation & toRest,
LorentzRotation & fromRest,
vector<ShowerProgenitorPtr>) const;
//@}
/**
* Methods to perform the inverse reconstruction of various types of
* colour singlet systems
*/
//@{
/**
* Perform the inverse reconstruction of a system with only final-state
* particles
*/
void deconstructFinalStateSystem(const LorentzRotation & toRest,
const LorentzRotation & fromRest,
HardTreePtr,
vector<HardBranchingPtr>,
cEvolverPtr,
ShowerInteraction::Type) const;
/**
* Perform the inverse reconstruction of a system with only initial-state
* particles
*/
void deconstructInitialInitialSystem(bool & applyBoost,
LorentzRotation & toRest,
LorentzRotation & fromRest,
HardTreePtr,
vector<HardBranchingPtr>,
ShowerInteraction::Type ) const;
/**
* Perform the inverse reconstruction of a system with only initial-state
* particles
*/
void deconstructInitialFinalSystem(HardTreePtr,
vector<HardBranchingPtr>,
cEvolverPtr,
ShowerInteraction::Type ) const;
bool deconstructGeneralSystem(HardTreePtr, cEvolverPtr,
ShowerInteraction::Type) const;
//@}
/**
* Various methods for the Lorentz transforms needed to do the
* rescalings
*/
//@{
/**
* Compute the boost to get from the the old momentum to the new
*/
LorentzRotation solveBoost(const double k,
const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldp) const;
/**
* Compute the boost to get from the the old momentum to the new
*/
LorentzRotation solveBoost(const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldq) const;
/**
* Compute the boost to get from the the old momentum to the new
*/
LorentzRotation solveBoostZ(const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldq) const;
/**
* Recursively boost the initial-state shower
* @param p The particle
* @param bv The boost
* @param parent The parent of the chain
*/
void boostChain(tPPtr p, const LorentzRotation & bv, tPPtr & parent) const;
/**
* Given a 5-momentum and a scale factor, the method returns the
* Lorentz boost that transforms the 3-vector vec{momentum} --->
* k*vec{momentum}. The method returns the null boost in the case no
* solution exists. This will only work in the case where the
* outgoing jet-momenta are parallel to the momenta of the particles
* leaving the hard subprocess.
*/
Boost solveBoostBeta( const double k, const Lorentz5Momentum & newq,
const Lorentz5Momentum & oldp);
/**
* Compute boost parameter along z axis to get (Ep, any perp, qp)
* from (E, same perp, q).
*/
double getBeta(const double E, const double q,
const double Ep, const double qp) const
{return (q*E-qp*Ep)/(sqr(qp)+sqr(E));}
//@}
/**
* Methods to calculate the various scaling factors
*/
//@{
/**
* Given a vector of 5-momenta of jets, where the 3-momenta are the initial
* ones before showering and the masses are reconstructed after the showering,
* this method returns the overall scaling factor for the 3-momenta of the
* vector of particles, vec{P}_i -> k * vec{P}_i, such to preserve energy-
* momentum conservation, i.e. after the rescaling the center of mass 5-momentum
* is equal to the one specified in input, cmMomentum.
* The method returns 0 if such factor cannot be found.
* @param root_s Centre-of-mass energy
* @param jets The jets
*/
double solveKfactor( const Energy & root_s, const JetKinVect & jets ) const;
/**
* Calculate the rescaling factors for the jets in a particle decay where
* there was initial-state radiation
* @param mb The mass of the decaying particle
* @param n The reference vector for the initial state radiation
* @param pjet The momentum of the initial-state jet
* @param jetKinematics The JetKinStruct objects for the jets
* @param partner The colour partner
* @param ppartner The momentum of the colour partner of the decaying particle
* before and after radiation
* @param k1 The rescaling parameter for the partner
* @param k2 The rescaling parameter for the outgoing singlet
* @param qt The transverse momentum vector
*/
bool solveDecayKFactor(Energy mb,
const Lorentz5Momentum & n,
const Lorentz5Momentum & pjet,
const JetKinVect & jetKinematics,
ShowerParticlePtr partner,
Lorentz5Momentum ppartner[2],
double & k1,
double & k2,
Lorentz5Momentum & qt) const;
/**
* Compute the momentum rescaling factor needed to invert the shower
* @param pout The momenta of the outgoing particles
* @param mon The on-shell masses
* @param roots The mass of the decaying particle
*/
double inverseRescalingFactor(vector<Lorentz5Momentum> pout,
vector<Energy> mon,Energy roots) const;
/**
* Compute the momentum rescaling factor needed to invert the shower
* @param pout The momenta of the outgoing particles
* @param mon The on-shell masses
* @param roots The mass of the decaying particle
* @param ppartner The momentum of the colour partner
* @param mbar The mass of the decaying particle
* @param k1 The first scaling factor
* @param k2 The second scaling factor
*/
bool inverseDecayRescalingFactor(vector<Lorentz5Momentum> pout,
vector<Energy> mon,Energy roots,
Lorentz5Momentum ppartner, Energy mbar,
double & k1, double & k2) const;
/**
* Check the rescaling conserves momentum
* @param k The rescaling
* @param root_s The centre-of-mass energy
* @param jets The jets
*/
Energy momConsEq(const double & k, const Energy & root_s,
const JetKinVect & jets) const;
//@}
/**
* Find the colour partners of a particle to identify the colour singlet
* systems for the reconstruction.
*/
vector<unsigned int> findPartners(unsigned int ,vector<ShowerProgenitorPtr>) const;
/**
* Find the colour partners for as branching to identify the colour singlet
* systems for the inverse reconstruction.
*/
void findPartners(HardBranchingPtr branch,set<HardBranchingPtr> & done,
const set<HardBranchingPtr> & branchings,
vector<HardBranchingPtr> & jets) const;
/**
* Add the intrinsic \f$p_T\f$ to the system if needed
*/
bool addIntrinsicPt(vector<ShowerProgenitorPtr>) const;
/**
* Apply a transform to the particle and any child, including child ShowerTree
* objects
* @param particle The particle
* @param r The Lorentz transformation
* @param match Whether or not to look at children etc
* @param original The original particle
*/
void deepTransform(PPtr particle,const LorentzRotation & r,
bool match=true,PPtr original=PPtr()) const;
protected:
/** @name Clone Methods. */
//@{
/**
* Make a simple clone of this object.
* @return a pointer to the new object.
*/
virtual IBPtr clone() const {return new_ptr(*this);}
/** 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 {return new_ptr(*this);}
//@}
protected:
/** @name Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is an concrete class without persistent data.
*/
static ClassDescription<QTildeReconstructor> initQTildeReconstructor;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
QTildeReconstructor & operator=(const QTildeReconstructor &);
private:
/**
+ * Return colour line progenitor pointer for ShowerProgenitor
+ */
+ Ptr<ThePEG::ColourLine>::transient_pointer
+ CL(ShowerProgenitorPtr a, unsigned int index=0) const {
+ return const_ptr_cast<ThePEG::tColinePtr>(a->progenitor()->colourInfo()->colourLines()[index]);
+ }
+
+ /**
+ * Return progenitor colour line size for ShowerProgenitor
+ */
+ unsigned int CLSIZE(ShowerProgenitorPtr a) const {
+ return a->progenitor()->colourInfo()->colourLines().size();
+ }
+
+ /**
+ * Return anti-colour line progenitor pointer for ShowerProgenitor
+ */
+ Ptr<ThePEG::ColourLine>::transient_pointer
+ ACL(ShowerProgenitorPtr a, unsigned int index=0) const {
+ return const_ptr_cast<ThePEG::tColinePtr>(a->progenitor()->colourInfo()->antiColourLines()[index]);
+ }
+
+ /**
+ * Return progenitor anti-colour line size for ShowerProgenitor
+ */
+ unsigned int ACLSIZE(ShowerProgenitorPtr a) const {
+ return a->progenitor()->colourInfo()->antiColourLines().size();
+ }
+
+ /**
+ * Return colour line size
+ */
+ unsigned int CLSIZE(set<HardBranchingPtr>::const_iterator & a) const {
+ return (*a)->branchingParticle()->colourInfo()->colourLines().size();
+ }
+
+ /**
+ * Return anti-colour line size
+ */
+ unsigned int ACLSIZE(set<HardBranchingPtr>::const_iterator & a) const {
+ return (*a)->branchingParticle()->colourInfo()->antiColourLines().size();
+ }
+
+ /**
* Option for handling the reconstruction
*/
unsigned int _reconopt;
/**
* Option for the boost for initial-initial reconstruction
*/
unsigned int _initialBoost;
/**
* Minimum invariant mass for initial-final dipoles to allow the
* reconstruction
*/
Energy _minQ;
/**
* The progenitor of the jet currently being reconstructed
*/
mutable tShowerParticlePtr _progenitor;
/**
* Storage of the intrinsic \f$p_T\f$
*/
mutable map<tShowerProgenitorPtr,pair<Energy,double> > _intrinsic;
/**
* Current ShowerTree
*/
mutable tShowerTreePtr _currentTree;
/**
* Particles which shouldn't have their masses rescaled as
* vector for the interface
*/
PDVector _noRescaleVector;
/**
* Particles which shouldn't have their masses rescaled as
* set for quick access
*/
set<cPDPtr> _noRescale;
};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of QTildeReconstructor. */
template <>
struct BaseClassTrait<Herwig::QTildeReconstructor,1> {
/** Typedef of the first base class of QTildeReconstructor. */
typedef Herwig::KinematicsReconstructor NthBase;
};
/** This template specialization informs ThePEG about the name of
* the QTildeReconstructor class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::QTildeReconstructor>
: public ClassTraitsBase<Herwig::QTildeReconstructor> {
/** Return a platform-independent class name */
static string className() { return "Herwig::QTildeReconstructor"; }
/**
* The name of a file containing the dynamic library where the class
* QTildeReconstructor is implemented. It may also include several, space-separated,
* libraries if the class QTildeReconstructor depends on other classes (base classes
* excepted). In this case the listed libraries will be dynamically
* linked in the order they are specified.
*/
static string library() { return "HwShower.so"; }
};
/** @endcond */
}
#endif /* HERWIG_QTildeReconstructor_H */
diff --git a/Shower/Makefile.am b/Shower/Makefile.am
--- a/Shower/Makefile.am
+++ b/Shower/Makefile.am
@@ -1,31 +1,31 @@
SUBDIRS = SplittingFunctions Default Base .
pkglib_LTLIBRARIES = HwShower.la
-HwShower_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 13:0:0
+HwShower_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 14:0:0
HwShower_la_LIBADD = Default/libHwDefaultShower.la\
$(top_builddir)/Shower/SplittingFunctions/libHwSplitting.la \
$(top_builddir)/Shower/Base/libHwShowerBase.la \
$(top_builddir)/PDF/libHwRemDecayer.la \
$(top_builddir)/PDF/libHwMPIPDF.la
HwShower_la_SOURCES = \
UEBase.h UEBase.cc UEBase.fh\
Couplings/ShowerAlphaQCD.h Couplings/ShowerAlphaQCD.cc\
ShowerHandler.h ShowerHandler.fh ShowerHandler.cc
noinst_LTLIBRARIES = libHwShower.la
libHwShower_la_SOURCES = ShowerConfig.h \
Base/Branching.h \
Base/ShowerParticle.cc Base/ShowerParticle.fh Base/ShowerParticle.h \
Base/ShowerKinematics.fh Base/ShowerKinematics.h Base/ShowerKinematics.cc \
Base/ShowerTree.h Base/ShowerTree.fh Base/ShowerTree.cc \
Base/ShowerProgenitor.fh Base/ShowerProgenitor.h \
Base/HardTree.h Base/HardTree.fh Base/HardTree.cc\
Base/SudakovFormFactor.cc Base/SudakovFormFactor.h Base/SudakovFormFactor.fh \
Base/HardBranching.h Base/HardBranching.fh Base/HardBranching.cc\
Couplings/ShowerAlpha.h Couplings/ShowerAlpha.cc Couplings/ShowerAlpha.fh\
SplittingFunctions/SplittingGenerator.cc SplittingFunctions/SplittingGenerator.h\
SplittingFunctions/SplittingGenerator.fh \
SplittingFunctions/SplittingFunction.h SplittingFunctions/SplittingFunction.fh \
SplittingFunctions/SplittingFunction.cc
diff --git a/Shower/ShowerHandler.cc b/Shower/ShowerHandler.cc
--- a/Shower/ShowerHandler.cc
+++ b/Shower/ShowerHandler.cc
@@ -1,727 +1,727 @@
// -*- C++ -*-
//
// ShowerHandler.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the ShowerHandler class.
//
#include "ShowerHandler.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/PDF/PartonExtractor.h"
#include "ThePEG/PDF/PartonBinInstance.h"
#include "Herwig++/PDT/StandardMatchers.h"
#include "ThePEG/Cuts/Cuts.h"
#include "ThePEG/Handlers/StandardXComb.h"
#include "ThePEG/Utilities/Throw.h"
#include "Herwig++/Shower/Base/Evolver.h"
#include "Herwig++/Shower/Base/ShowerParticle.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "Herwig++/Utilities/EnumParticles.h"
#include "Herwig++/PDF/MPIPDF.h"
#include "Herwig++/PDF/MinBiasPDF.h"
#include "ThePEG/Handlers/EventHandler.h"
#include "Herwig++/Shower/Base/ShowerTree.h"
#include "Herwig++/Shower/Base/HardTree.h"
#include "Herwig++/Shower/Base/KinematicsReconstructor.h"
#include "Herwig++/Shower/Base/PartnerFinder.h"
#include "Herwig++/PDF/HwRemDecayer.h"
#include <cassert>
using namespace Herwig;
ShowerHandler::~ShowerHandler() {}
ShowerHandler * ShowerHandler::currentHandler_ = 0;
void ShowerHandler::doinit() {
CascadeHandler::doinit();
// copy particles to decay before showering from input vector to the
// set used in the simulation
particlesDecayInShower_.insert(inputparticlesDecayInShower_.begin(),
inputparticlesDecayInShower_.end());
// \todo DG: Disabled here because of momentum-violation problems
// ShowerTree::_decayInShower = particlesDecayInShower_;
}
IBPtr ShowerHandler::clone() const {
return new_ptr(*this);
}
IBPtr ShowerHandler::fullclone() const {
return new_ptr(*this);
}
ShowerHandler::ShowerHandler() :
pdfFreezingScale_(2.5*GeV),
maxtry_(10),maxtryMPI_(10),maxtryDP_(10), subProcess_() {
inputparticlesDecayInShower_.push_back( 6 ); // top
inputparticlesDecayInShower_.push_back( 23 ); // Z0
inputparticlesDecayInShower_.push_back( 24 ); // W+/-
inputparticlesDecayInShower_.push_back( 25 ); // h0
}
void ShowerHandler::doinitrun(){
CascadeHandler::doinitrun();
//can't use isMPIOn here, because the EventHandler is not set at that stage
if(MPIHandler_){
MPIHandler_->initialize();
if(MPIHandler_->softInt())
remDec_->initSoftInteractions(MPIHandler_->Ptmin(), MPIHandler_->beta());
}
// \todo DG: Disabled here because of momentum-violation problems
// ShowerTree::_decayInShower = particlesDecayInShower_;
}
void ShowerHandler::dofinish(){
CascadeHandler::dofinish();
if(MPIHandler_) MPIHandler_->finalize();
}
void ShowerHandler::persistentOutput(PersistentOStream & os) const {
os << evolver_ << remDec_ << ounit(pdfFreezingScale_,GeV) << maxtry_
<< maxtryMPI_ << maxtryDP_ << inputparticlesDecayInShower_
<< particlesDecayInShower_ << MPIHandler_ << PDFA_ << PDFB_;
}
void ShowerHandler::persistentInput(PersistentIStream & is, int) {
is >> evolver_ >> remDec_ >> iunit(pdfFreezingScale_,GeV) >> maxtry_
>> maxtryMPI_ >> maxtryDP_ >> inputparticlesDecayInShower_
>> particlesDecayInShower_ >> MPIHandler_ >> PDFA_ >> PDFB_;
}
ClassDescription<ShowerHandler> ShowerHandler::initShowerHandler;
// Definition of the static class description member.
void ShowerHandler::Init() {
static ClassDocumentation<ShowerHandler> documentation
("Main driver class for the showering.",
"The Shower evolution was performed using an algorithm described in "
"\\cite{Marchesini:1983bm,Marchesini:1987cf,Gieseke:2003rz,Bahr:2008pv}.",
"%\\cite{Marchesini:1983bm}\n"
"\\bibitem{Marchesini:1983bm}\n"
" G.~Marchesini and B.~R.~Webber,\n"
" ``Simulation Of QCD Jets Including Soft Gluon Interference,''\n"
" Nucl.\\ Phys.\\ B {\\bf 238}, 1 (1984).\n"
" %%CITATION = NUPHA,B238,1;%%\n"
"%\\cite{Marchesini:1987cf}\n"
"\\bibitem{Marchesini:1987cf}\n"
" G.~Marchesini and B.~R.~Webber,\n"
" ``Monte Carlo Simulation of General Hard Processes with Coherent QCD\n"
" Radiation,''\n"
" Nucl.\\ Phys.\\ B {\\bf 310}, 461 (1988).\n"
" %%CITATION = NUPHA,B310,461;%%\n"
"%\\cite{Gieseke:2003rz}\n"
"\\bibitem{Gieseke:2003rz}\n"
" S.~Gieseke, P.~Stephens and B.~Webber,\n"
" ``New formalism for QCD parton showers,''\n"
" JHEP {\\bf 0312}, 045 (2003)\n"
" [arXiv:hep-ph/0310083].\n"
" %%CITATION = JHEPA,0312,045;%%\n"
);
static Reference<ShowerHandler,Evolver>
interfaceEvolver("Evolver",
"A reference to the Evolver object",
&Herwig::ShowerHandler::evolver_,
false, false, true, false);
static Reference<ShowerHandler,HwRemDecayer>
interfaceRemDecayer("RemDecayer",
"A reference to the Remnant Decayer object",
&Herwig::ShowerHandler::remDec_,
false, false, true, false);
static Parameter<ShowerHandler,Energy> interfacePDFFreezingScale
("PDFFreezingScale",
"The PDF freezing scale",
&ShowerHandler::pdfFreezingScale_, GeV, 2.5*GeV, 2.0*GeV, 10.0*GeV,
false, false, Interface::limited);
static Parameter<ShowerHandler,unsigned int> interfaceMaxTry
("MaxTry",
"The maximum number of attempts for the main showering loop",
&ShowerHandler::maxtry_, 10, 1, 100,
false, false, Interface::limited);
static Parameter<ShowerHandler,unsigned int> interfaceMaxTryMPI
("MaxTryMPI",
"The maximum number of regeneration attempts for an additional scattering",
&ShowerHandler::maxtryMPI_, 10, 0, 100,
false, false, Interface::limited);
static Parameter<ShowerHandler,unsigned int> interfaceMaxTryDP
("MaxTryDP",
"The maximum number of regeneration attempts for an additional hard scattering",
&ShowerHandler::maxtryDP_, 10, 0, 100,
false, false, Interface::limited);
static ParVector<ShowerHandler,long> interfaceDecayInShower
("DecayInShower",
"PDG codes of the particles to be decayed in the shower",
&ShowerHandler::inputparticlesDecayInShower_, -1, 0l, -10000000l, 10000000l,
false, false, Interface::limited);
static Reference<ShowerHandler,UEBase> interfaceMPIHandler
("MPIHandler",
"The object that administers all additional scatterings.",
&ShowerHandler::MPIHandler_, false, false, true, true);
static Reference<ShowerHandler,PDFBase> interfacePDFA
("PDFA",
"The PDF for beam particle A. Overrides the particle's own PDF setting.",
&ShowerHandler::PDFA_, false, false, true, true, false);
static Reference<ShowerHandler,PDFBase> interfacePDFB
("PDFB",
"The PDF for beam particle B. Overrides the particle's own PDF setting.",
&ShowerHandler::PDFB_, false, false, true, true, false);
}
void ShowerHandler::cascade() {
tcPDFPtr first = firstPDF().pdf();
tcPDFPtr second = secondPDF().pdf();
if ( PDFA_ ) first = PDFA_;
if ( PDFB_ ) second = PDFB_;
resetPDFs(make_pair(first,second));
// get the incoming partons
tPPair incomingPartons =
eventHandler()->currentCollision()->primarySubProcess()->incoming();
// and the parton bins
PBIPair incomingBins =
make_pair(lastExtractor()->partonBinInstance(incomingPartons.first),
lastExtractor()->partonBinInstance(incomingPartons.second));
// and the incoming hadrons
tPPair incomingHadrons =
eventHandler()->currentCollision()->incoming();
// check if incoming hadron == incoming parton
// and get the incoming hadron if exists or parton otherwise
incoming_ = make_pair(incomingBins.first ?
incomingBins.first ->particle() : incomingPartons.first,
incomingBins.second ?
incomingBins.second->particle() : incomingPartons.second);
// check the collision is of the beam particles
// and if not boost collision to the right frame
// i.e. the hadron-hadron CMF of the collision
bool btotal(false);
LorentzRotation rtotal;
if(incoming_.first != incomingHadrons.first ||
incoming_.second != incomingHadrons.second ) {
btotal = true;
boostCollision(false);
}
// set the current ShowerHandler
currentHandler_ = this;
// first shower the hard process
useMe();
try {
SubProPtr sub = eventHandler()->currentCollision()->primarySubProcess();
incomingPartons = cascade(sub,lastXCombPtr());
}
catch(ShowerTriesVeto &veto){
throw Exception() << "Failed to generate the shower after "
<< veto.tries
<< " attempts in Evolver::showerHardProcess()"
<< Exception::eventerror;
}
// if a non-hadron collision return (both incoming non-hadronic)
if( ( !incomingBins.first||
!isResolvedHadron(incomingBins.first ->particle()))&&
( !incomingBins.second||
!isResolvedHadron(incomingBins.second->particle()))) {
// boost back to lab if needed
if(btotal) boostCollision(true);
// unset the current ShowerHandler
currentHandler_ = 0;
return;
}
// get the remnants for hadronic collision
pair<tRemPPtr,tRemPPtr> remnants(getRemnants(incomingBins));
// set the starting scale of the forced splitting to the PDF freezing scale
remDec_->initialize(remnants, incoming_, *currentStep(), pdfFreezingScale());
// do the first forcedSplitting
try {
remDec_->doSplit(incomingPartons, make_pair(firstPDF() .pdf(),
secondPDF().pdf()), true);
}
catch (ExtraScatterVeto) {
throw Exception() << "Remnant extraction failed in "
<< "ShowerHandler::cascade() from primary interaction"
<< Exception::eventerror;
}
// if no MPI return
if( !isMPIOn() ) {
remDec_->finalize();
// boost back to lab if needed
if(btotal) boostCollision(true);
// unset the current ShowerHandler
currentHandler_ = 0;
return;
}
// generate the multiple scatters use modified pdf's now:
setMPIPDFs();
// additional "hard" processes
unsigned int tries(0);
// This is the loop over additional hard scatters (most of the time
// only one, but who knows...)
for(unsigned int i=1; i <= getMPIHandler()->additionalHardProcs(); i++){
//counter for regeneration
unsigned int multSecond = 0;
// generate the additional scatters
while( multSecond < getMPIHandler()->multiplicity(i) ) {
// generate the hard scatter
tStdXCombPtr lastXC = getMPIHandler()->generate(i);
SubProPtr sub = lastXC->construct();
// add to the Step
newStep()->addSubProcess(sub);
// increment the counters
tries++;
multSecond++;
if(tries == maxtryDP_)
throw Exception() << "Failed to establish the requested number "
<< "of additional hard processes. If this error "
<< "occurs often, your selection of additional "
<< "scatter is probably unphysical"
<< Exception::eventerror;
// Generate the shower. If not possible veto the event
try {
incomingPartons = cascade(sub,lastXC);
}
catch(ShowerTriesVeto &veto){
throw Exception() << "Failed to generate the shower of "
<< "a secondary hard process after "
<< veto.tries
<< " attempts in Evolver::showerHardProcess()"
<< Exception::eventerror;
}
try {
// do the forcedSplitting
remDec_->doSplit(incomingPartons, make_pair(firstPDF().pdf(),
secondPDF().pdf()), false);
}
catch(ExtraScatterVeto){
//remove all particles associated with the subprocess
newStep()->removeParticle(incomingPartons.first);
newStep()->removeParticle(incomingPartons.second);
//remove the subprocess from the list
newStep()->removeSubProcess(sub);
//regenerate the scattering
multSecond--;
continue;
}
// connect with the remnants but don't set Remnant colour,
// because that causes problems due to the multiple colour lines.
if ( !remnants.first ->extract(incomingPartons.first , false) ||
!remnants.second->extract(incomingPartons.second, false) )
throw Exception() << "Remnant extraction failed in "
<< "ShowerHandler::cascade() for additional scatter"
<< Exception::runerror;
}
}
// the underlying event processes
unsigned int ptveto(1), veto(0);
unsigned int max(getMPIHandler()->multiplicity());
for(unsigned int i=0; i<max; i++) {
// check how often this scattering has been regenerated
if(veto > maxtryMPI_) break;
//generate PSpoint
tStdXCombPtr lastXC = getMPIHandler()->generate();
SubProPtr sub = lastXC->construct();
//If Algorithm=1 additional scatters of the signal type
// with pt > ptmin have to be vetoed
//with probability 1/(m+1), where m is the number of occurances in this event
if( getMPIHandler()->Algorithm() == 1 ){
//get the pT
Energy pt = sub->outgoing().front()->momentum().perp();
if(pt > getMPIHandler()->PtForVeto() && UseRandom::rnd() < 1./(ptveto+1) ){
ptveto++;
i--;
continue;
}
}
// add to the SubProcess to the step
newStep()->addSubProcess(sub);
// Run the Shower. If not possible veto the scattering
try {
incomingPartons = cascade(sub,lastXC);
}
// discard this extra scattering, but try the next one
catch(ShowerTriesVeto) {
newStep()->removeSubProcess(sub);
//regenerate the scattering
veto++;
i--;
continue;
}
try{
//do the forcedSplitting
remDec_->doSplit(incomingPartons, make_pair(firstPDF().pdf(),
secondPDF().pdf()), false);
}
catch (ExtraScatterVeto) {
//remove all particles associated with the subprocess
newStep()->removeParticle(incomingPartons.first);
newStep()->removeParticle(incomingPartons.second);
//remove the subprocess from the list
newStep()->removeSubProcess(sub);
//regenerate the scattering
veto++;
i--;
continue;
}
//connect with the remnants but don't set Remnant colour,
//because that causes problems due to the multiple colour lines.
if ( !remnants.first ->extract(incomingPartons.first , false) ||
!remnants.second->extract(incomingPartons.second, false) )
throw Exception() << "Remnant extraction failed in "
<< "ShowerHandler::cascade() for MPI hard scattering"
<< Exception::runerror;
//reset veto counter
veto = 0;
}
// finalize the remnants
remDec_->finalize(getMPIHandler()->colourDisrupt(),
getMPIHandler()->softMultiplicity());
// boost back to lab if needed
if(btotal) boostCollision(true);
// unset the current ShowerHandler
currentHandler_ = 0;
}
void ShowerHandler::fillEventRecord() {
// create a new step
StepPtr pstep = newStep();
assert(!done_.empty());
assert(done_[0]->isHard());
// insert the steps
for(unsigned int ix=0;ix<done_.size();++ix) {
done_[ix]->fillEventRecord(pstep,
evolver_->isISRadiationON(),
evolver_->isFSRadiationON());
}
}
void ShowerHandler::findShoweringParticles() {
// clear the storage
hard_=ShowerTreePtr();
decay_.clear();
done_.clear();
// temporary storage of the particles
set<PPtr> hardParticles;
// outgoing particles from the hard process
PVector outgoing = currentSubProcess()->outgoing();
set<PPtr> outgoingset(outgoing.begin(),outgoing.end());
// loop over the tagged particles
tPVector thetagged;
if( firstInteraction() ){
thetagged = tagged();
}
else{
thetagged.insert(thetagged.end(),
outgoing.begin(),outgoing.end());
}
bool isHard=false;
for (tParticleVector::const_iterator
taggedP = thetagged.begin();
taggedP != thetagged.end(); ++taggedP) {
// if a remnant don't consider
if(eventHandler()->currentCollision()->isRemnant(*taggedP))
continue;
// find the parent and whether its a colourless s-channel resonance
bool isDecayProd=false;
tPPtr parent;
if(!(*taggedP)->parents().empty()) {
parent = (*taggedP)->parents()[0];
// check if from s channel decaying colourless particle
isDecayProd = decayProduct(parent);
}
// add to list of outgoing hard particles if needed
isHard |=(outgoingset.find(*taggedP) != outgoingset.end());
if(isDecayProd) hardParticles.insert(findParent(parent,isHard,outgoingset));
else hardParticles.insert(*taggedP);
}
// there must be something to shower
if(hardParticles.empty())
throw Exception() << "No particles to shower in "
<< "ShowerHandler::fillShoweringParticles"
<< Exception::eventerror;
if(!isHard)
throw Exception() << "Starting on decay not yet implemented in "
<< "ShowerHandler::findShoweringParticles()"
<< Exception::runerror;
// create the hard process ShowerTree
ParticleVector out(hardParticles.begin(),hardParticles.end());
hard_=new_ptr(ShowerTree(currentSubProcess()->incoming(),out, decay_));
hard_->setParents();
}
tPPair ShowerHandler::cascade(tSubProPtr sub,
XCPtr xcomb) {
// get the current step
current_ = currentStep();
// get the current subprocess
subProcess_ = sub;
// start of the try block for the whole showering process
unsigned int countFailures=0;
while (countFailures<maxtry_) {
try {
// find the particles in the hard process and the decayed particles to shower
findShoweringParticles();
// if no hard process
if(!hard_) throw Exception() << "Shower starting with a decay"
<< "is not implemented"
<< Exception::runerror;
// perform the shower for the hard process
evolver_->showerHardProcess(hard_,xcomb);
done_.push_back(hard_);
hard_->updateAfterShower(decay_);
// if no decaying particles to shower break out of the loop
if(decay_.empty()) break;
// shower the decay products
while(!decay_.empty()) {
// find particle whose production process has been showered
ShowerDecayMap::iterator dit = decay_.begin();
while(!dit->second->parent()->hasShowered() && dit!=decay_.end()) ++dit;
assert(dit!=decay_.end());
// get the particle
ShowerTreePtr decayingTree = dit->second;
// remove it from the multimap
decay_.erase(dit);
// make sure the particle has been decayed
decayingTree->decay(decay_);
// now shower the decay
evolver_->showerDecay(decayingTree);
done_.push_back(decayingTree);
decayingTree->updateAfterShower(decay_);
}
// suceeded break out of the loop
break;
}
catch (KinematicsReconstructionVeto) {
++countFailures;
}
}
// if loop exited because of too many tries, throw event away
if (countFailures >= maxtry_) {
hard_=ShowerTreePtr();
decay_.clear();
done_.clear();
throw Exception() << "Too many tries for main while loop "
<< "in ShowerHandler::cascade()."
<< Exception::eventerror;
}
//enter the particles in the event record
fillEventRecord();
// clear storage
hard_=ShowerTreePtr();
decay_.clear();
done_.clear();
// non hadronic case return
if (!isResolvedHadron(incoming_.first ) &&
!isResolvedHadron(incoming_.second) )
return incoming_;
// remake the remnants (needs to be after the colours are sorted
// out in the insertion into the event record)
if ( firstInteraction() ) return remakeRemnant(sub->incoming());
//Return the new pair of incoming partons. remakeRemnant is not
//necessary here, because the secondary interactions are not yet
//connected to the remnants.
return make_pair(findFirstParton(sub->incoming().first ),
findFirstParton(sub->incoming().second));
}
PPtr ShowerHandler::findParent(PPtr original, bool & isHard,
set<PPtr> outgoingset) const {
PPtr parent=original;
isHard |=(outgoingset.find(original) != outgoingset.end());
if(!original->parents().empty()) {
PPtr orig=original->parents()[0];
if(current_->find(orig)&&decayProduct(orig)) {
parent=findParent(orig,isHard,outgoingset);
}
}
return parent;
}
ShowerHandler::RemPair
ShowerHandler::getRemnants(PBIPair incomingBins) {
RemPair remnants;
// first beam particle
if(incomingBins.first&&!incomingBins.first->remnants().empty()) {
remnants.first =
dynamic_ptr_cast<tRemPPtr>(incomingBins.first->remnants()[0] );
if(remnants.first) {
ParticleVector children=remnants.first->children();
for(unsigned int ix=0;ix<children.size();++ix) {
if(children[ix]->dataPtr()==remnants.first->dataPtr())
remnants.first = dynamic_ptr_cast<RemPPtr>(children[ix]);
}
//remove existing colour lines from the remnants
if(remnants.first->colourLine())
remnants.first->colourLine()->removeColoured(remnants.first);
if(remnants.first->antiColourLine())
remnants.first->antiColourLine()->removeAntiColoured(remnants.first);
}
}
// seconnd beam particle
if(incomingBins.second&&!incomingBins. second->remnants().empty()) {
remnants.second =
dynamic_ptr_cast<tRemPPtr>(incomingBins.second->remnants()[0] );
if(remnants.second) {
ParticleVector children=remnants.second->children();
for(unsigned int ix=0;ix<children.size();++ix) {
if(children[ix]->dataPtr()==remnants.second->dataPtr())
remnants.second = dynamic_ptr_cast<RemPPtr>(children[ix]);
}
//remove existing colour lines from the remnants
if(remnants.second->colourLine())
remnants.second->colourLine()->removeColoured(remnants.second);
if(remnants.second->antiColourLine())
remnants.second->antiColourLine()->removeAntiColoured(remnants.second);
}
}
assert(remnants.first || remnants.second);
return remnants;
}
tPPair ShowerHandler::remakeRemnant(tPPair oldp){
// get the parton extractor
PartonExtractor & pex = *lastExtractor();
// get the new partons
tPPair newp = make_pair(findFirstParton(oldp.first ),
findFirstParton(oldp.second));
// if the same do nothing
if(newp == oldp) return oldp;
// Creates the new remnants and returns the new PartonBinInstances
PBIPair newbins = pex.newRemnants(oldp, newp, newStep());
newStep()->addIntermediate(newp.first);
newStep()->addIntermediate(newp.second);
// return the new partons
return newp;
}
PPtr ShowerHandler::findFirstParton(tPPtr seed) const{
if(seed->parents().empty()) return seed;
tPPtr parent = seed->parents()[0];
//if no parent there this is a loose end which will
//be connected to the remnant soon.
if(!parent || parent == incoming_.first ||
parent == incoming_.second ) return seed;
else return findFirstParton(parent);
}
bool ShowerHandler::decayProduct(tPPtr particle) const {
// must be time-like and not incoming
if(particle->momentum().m2()<=ZERO||
particle == currentSubProcess()->incoming().first||
particle == currentSubProcess()->incoming().second) return false;
// if only 1 outgoing and this is it
if(currentSubProcess()->outgoing().size()==1 &&
currentSubProcess()->outgoing()[0]==particle) return true;
// must not be the s-channel intermediate otherwise
if(find(currentSubProcess()->incoming().first->children().begin(),
currentSubProcess()->incoming().first->children().end(),particle)!=
currentSubProcess()->incoming().first->children().end()&&
find(currentSubProcess()->incoming().second->children().begin(),
currentSubProcess()->incoming().second->children().end(),particle)!=
currentSubProcess()->incoming().second->children().end()&&
currentSubProcess()->incoming().first ->children().size()==1&&
currentSubProcess()->incoming().second->children().size()==1)
return false;
// if non-coloured this is enough
if(!particle->dataPtr()->coloured()) return true;
// if coloured must be unstable
if(particle->dataPtr()->stable()) return false;
// must not have same particle type as a child
int id = particle->id();
for(unsigned int ix=0;ix<particle->children().size();++ix)
if(particle->children()[ix]->id()==id) return false;
// otherwise its a decaying particle
return true;
}
namespace {
void addChildren(tPPtr in,set<tPPtr> & particles) {
particles.insert(in);
for(unsigned int ix=0;ix<in->children().size();++ix)
addChildren(in->children()[ix],particles);
}
}
void ShowerHandler::boostCollision(bool boost) {
// calculate boost from lab to rest
if(!boost) {
Lorentz5Momentum ptotal=incoming_.first ->momentum()+incoming_.second->momentum();
boost_ = LorentzRotation(-ptotal.boostVector());
Axis axis((boost_*incoming_.first ->momentum()).vect().unit());
if(axis.perp2()>0.) {
double sinth(sqrt(sqr(axis.x())+sqr(axis.y())));
boost_.rotate(acos(-axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.));
}
}
// first call performs the boost and second inverse
// get the particles to be boosted
set<tPPtr> particles;
addChildren(incoming_.first,particles);
addChildren(incoming_.second,particles);
// apply the boost
for(set<tPPtr>::const_iterator cit=particles.begin();
cit!=particles.end();++cit) {
(*cit)->transform(boost_);
}
if(!boost) boost_.invert();
}
void ShowerHandler::setMPIPDFs() {
if ( !mpipdfs_.first ) {
// first have to check for MinBiasPDF
tcMinBiasPDFPtr first = dynamic_ptr_cast<tcMinBiasPDFPtr>(firstPDF().pdf());
if(first)
mpipdfs_.first = new_ptr(MPIPDF(first->originalPDF()));
else
mpipdfs_.first = new_ptr(MPIPDF(firstPDF().pdf()));
}
if ( !mpipdfs_.second ) {
tcMinBiasPDFPtr second = dynamic_ptr_cast<tcMinBiasPDFPtr>(secondPDF().pdf());
if(second)
mpipdfs_.second = new_ptr(MPIPDF(second->originalPDF()));
else
mpipdfs_.second = new_ptr(MPIPDF(secondPDF().pdf()));
}
// reset the PDFs stored in the base class
resetPDFs(mpipdfs_);
}
bool ShowerHandler::isResolvedHadron(tPPtr particle) {
if(!HadronMatcher::Check(particle->data())) return false;
for(unsigned int ix=0;ix<particle->children().size();++ix) {
- if(particle->children()[ix]->id()==ExtraParticleID::Remnant) return true;
+ if(particle->children()[ix]->id()==ParticleID::Remnant) return true;
}
return false;
}
HardTreePtr ShowerHandler::generateCKKW(ShowerTreePtr ) const {
return HardTreePtr();
}
diff --git a/Shower/SplittingFunctions/SplittingFunction.cc b/Shower/SplittingFunctions/SplittingFunction.cc
--- a/Shower/SplittingFunctions/SplittingFunction.cc
+++ b/Shower/SplittingFunctions/SplittingFunction.cc
@@ -1,506 +1,610 @@
// -*- C++ -*-
//
// SplittingFunction.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the SplittingFunction class.
//
#include "SplittingFunction.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Utilities/EnumIO.h"
#include "Herwig++/Shower/Base/ShowerParticle.h"
using namespace Herwig;
AbstractClassDescription<SplittingFunction> SplittingFunction::initSplittingFunction;
// Definition of the static class description member.
void SplittingFunction::Init() {
static ClassDocumentation<SplittingFunction> documentation
("The SplittingFunction class is the based class for 1->2 splitting functions"
" in Herwig++");
static Switch<SplittingFunction,ColourStructure> interfaceColourStructure
("ColourStructure",
"The colour structure for the splitting function",
&SplittingFunction::_colourStructure, Undefined, false, false);
static SwitchOption interfaceColourStructureTripletTripletOctet
(interfaceColourStructure,
"TripletTripletOctet",
"3 -> 3 8",
TripletTripletOctet);
static SwitchOption interfaceColourStructureOctetOctetOctet
(interfaceColourStructure,
"OctetOctetOctet",
"8 -> 8 8",
OctetOctetOctet);
static SwitchOption interfaceColourStructureOctetTripletTriplet
(interfaceColourStructure,
"OctetTripletTriplet",
"8 -> 3 3bar",
OctetTripletTriplet);
static SwitchOption interfaceColourStructureTripletOctetTriplet
(interfaceColourStructure,
"TripletOctetTriplet",
"3 -> 8 3",
- TripletOctetTriplet);
+ TripletOctetTriplet);
+ static SwitchOption interfaceColourStructureSextetSextetOctet
+ (interfaceColourStructure,
+ "SextetSextetOctet",
+ "6 -> 6 8",
+ SextetSextetOctet);
+
static Switch<SplittingFunction,ShowerInteraction::Type>
interfaceInteractionType
("InteractionType",
"Type of the interaction",
&SplittingFunction::_interactionType,
ShowerInteraction::UNDEFINED, false, false);
static SwitchOption interfaceInteractionTypeQCD
(interfaceInteractionType,
"QCD","QCD",ShowerInteraction::QCD);
static Switch<SplittingFunction,int> interfaceSplittingColourMethod
("SplittingColourMethod",
"Choice of assigning colour in 8->88 splittings.",
&SplittingFunction::_splittingColourMethod, 0, false, false);
static SwitchOption interfaceSplittingColourMethodRandom
(interfaceSplittingColourMethod,
"Random",
"Choose colour assignments randomly.",
0);
static SwitchOption interfaceSplittingColourMethodCorrectLines
(interfaceSplittingColourMethod,
"CorrectLines",
"Choose correct lines for colour.",
1);
static SwitchOption interfaceSplittingColourMethodRandomRecord
(interfaceSplittingColourMethod,
"RandomRecord",
"Choose colour assignments randomly and record the result.",
2);
}
void SplittingFunction::persistentOutput(PersistentOStream & os) const {
using namespace ShowerInteraction;
os << oenum(_interactionType) << _interactionorder
<< oenum(_colourStructure) << _colourFactor
<< _splittingColourMethod;
}
void SplittingFunction::persistentInput(PersistentIStream & is, int) {
using namespace ShowerInteraction;
is >> ienum(_interactionType) >> _interactionorder
>> ienum(_colourStructure) >> _colourFactor
>> _splittingColourMethod;
}
void SplittingFunction::colourConnection(tShowerParticlePtr parent,
- tShowerParticlePtr first,
- tShowerParticlePtr second,
- const bool back) const {
+ tShowerParticlePtr first,
+ tShowerParticlePtr second,
+ const bool back) const {
if(_colourStructure==TripletTripletOctet) {
if(!back) {
ColinePair cparent = ColinePair(parent->colourLine(),
- parent->antiColourLine());
+ parent->antiColourLine());
// ensure input consistency
assert((!cparent.first && cparent.second) ||
- ( cparent.first && !cparent.second));
+ ( cparent.first && !cparent.second));
// q -> q g
if(cparent.first) {
- ColinePtr newline=new_ptr(ColourLine());
- cparent.first->addColoured(second);
- newline->addColoured ( first);
- newline->addAntiColoured (second);
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(second);
+ newline->addColoured ( first);
+ newline->addAntiColoured (second);
}
// qbar -> qbar g
else {
- ColinePtr newline=new_ptr(ColourLine());
- cparent.second->addAntiColoured(second);
- newline->addColoured(second);
- newline->addAntiColoured(first);
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.second->addAntiColoured(second);
+ newline->addColoured(second);
+ newline->addAntiColoured(first);
}
// Set progenitor
first->setProgenitor(parent->progenitor());
second->setProgenitor(parent->progenitor());
// Random radiation choice
first->setRadiationLine(0);
second->setRadiationLine(0);
}
else {
ColinePair cfirst = ColinePair(first->colourLine(),
- first->antiColourLine());
+ first->antiColourLine());
// ensure input consistency
assert(( cfirst.first && !cfirst.second) ||
- (!cfirst.first && cfirst.second));
+ (!cfirst.first && cfirst.second));
// q -> q g
if(cfirst.first) {
- ColinePtr newline=new_ptr(ColourLine());
- cfirst.first->addAntiColoured(second);
- newline->addColoured(second);
- newline->addColoured(parent);
+ ColinePtr newline=new_ptr(ColourLine());
+ cfirst.first->addAntiColoured(second);
+ newline->addColoured(second);
+ newline->addColoured(parent);
}
// qbar -> qbar g
else {
- ColinePtr newline=new_ptr(ColourLine());
- cfirst.second->addColoured(second);
- newline->addAntiColoured(second);
- newline->addAntiColoured(parent);
+ ColinePtr newline=new_ptr(ColourLine());
+ cfirst.second->addColoured(second);
+ newline->addAntiColoured(second);
+ newline->addAntiColoured(parent);
}
// Set progenitor
parent->setProgenitor(first->progenitor());
second->setProgenitor(first->progenitor());
// Random radiation choice
parent->setRadiationLine(0);
second->setRadiationLine(0);
}
}
else if(_colourStructure==OctetOctetOctet) {
if(!back) {
ColinePair cparent = ColinePair(parent->colourLine(),
- parent->antiColourLine());
+ parent->antiColourLine());
// ensure input consistency
assert(cparent.first&&cparent.second);
// The choice of colour line is determined by the
// radiation line of the parent.
// If the radiation line is non-zero and the
// scale of the parent is above the second scale of the
// progenitor it will only radiate from the chosen radiation
// line. Otherwise the parent will radiate randomly.
// Initializing radiation lines
first->setRadiationLine(0);
second->setRadiationLine(0);
// Switch to choose random or non-random choice of lines
bool randomchoice = 0;
// Radiation line
int radiationLine = 0;
if (_splittingColourMethod == 1){
// Choose the appropriate colour lines
if ((parent->radiationLine() == 1 || parent->radiationLine() == 2) && parent->progenitor() ) {
if (parent->evolutionScale() > parent->progenitor()->evolutionScale2()){
// Parent has a radiation line, so the line which should
// radiate, and therefore the choice of which colour line
// to pass onto which child, is already determined.
randomchoice = 1;
if(parent->radiationLine() == 2) {
// The anti-colour line is radiating
ColinePtr newline=new_ptr(ColourLine());
cparent.first->addColoured(first);
cparent.second->addAntiColoured(second);
newline->addColoured(second);
newline->addAntiColoured(first);
// Set the radiation line for the children
radiationLine = parent->radiationLine();
}
else {
// The colour line is radiating
ColinePtr newline=new_ptr(ColourLine());
cparent.first->addColoured(second);
cparent.second->addAntiColoured(first);
newline->addColoured(first);
newline->addAntiColoured(second);
// Set the radiation line for the children
radiationLine = parent->radiationLine();
}
}
}
}
if (randomchoice == 0) {
// Randomly decide which of the two gluon products take the
// colour line passing for the colour of the parent gluon
// (the other will take the one passing for the anticolour of
// the parent gluon).
if(UseRandom::rndbool()) {
ColinePtr newline=new_ptr(ColourLine());
cparent.first->addColoured(first);
cparent.second->addAntiColoured(second);
newline->addColoured(second);
newline->addAntiColoured(first);
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (parent->radiationLine() == 1 || parent->radiationLine() == 2){
// Record which line radiates
radiationLine = 2;
}
}
}
else {
ColinePtr newline=new_ptr(ColourLine());
cparent.first->addColoured(second);
cparent.second->addAntiColoured(first);
newline->addColoured(first);
newline->addAntiColoured(second);
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (parent->radiationLine() == 1 || parent->radiationLine() == 2){
// Record which line radiates
radiationLine = 1;
}
}
}
}
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (parent->radiationLine() == 1 || parent->radiationLine() == 2){
// Set the radiation line for the children
first->setRadiationLine(radiationLine);
second->setRadiationLine(0);
// Set the progenitors for the children
first->setProgenitor(parent->progenitor());
second->setProgenitor(parent->progenitor());
}
}
}
else {
ColinePair cfirst = ColinePair(first->colourLine(),
- first->antiColourLine());
+ first->antiColourLine());
// ensure input consistency
assert(cfirst.first&&cfirst.second);
// The choice of colour line is determined by the
// radiation line of the parent.
// If the radiation line is non-zero and the
// scale of the parent is above the second scale of the
// progenitor it will only radiate from the chosen radiation
// line. Otherwise the parent will radiate randomly.
// Initializing radiation lines
parent->setRadiationLine(0);
second->setRadiationLine(0);
// Switch to choose random or non-random choice of lines
bool randomchoice = 0;
// Radiation line
int radiationLine = 0;
if (_splittingColourMethod == 1){
// Choose the appropriate colour lines
if ((first->radiationLine() == 1 || first->radiationLine() == 2) && first->progenitor()) {
if (first->evolutionScale() > first->progenitor()->evolutionScale2()){
// Parent has a radiation line, so the line which should
// radiate, and therefore the choice of which colour line
// to pass onto which child, is already determined.
randomchoice = 1;
if (first->radiationLine() == 2) {
// The anti-colour line is radiating
ColinePtr newline=new_ptr(ColourLine());
cfirst.first->addColoured(parent);
cfirst.second->addColoured(second);
newline->addAntiColoured(second);
newline->addAntiColoured(parent);
// Set the radiation line for the children
radiationLine = first->radiationLine();
}
else {
// The colour line is radiating
ColinePtr newline=new_ptr(ColourLine());
cfirst.first->addAntiColoured(second);
cfirst.second->addAntiColoured(parent);
newline->addColoured(parent);
newline->addColoured(second);
// Set the radiation line for the children
radiationLine = first->radiationLine();
}
}
}
}
if (randomchoice == 0) {
// Randomly decide which of the two gluon products take the
// colour line passing for the colour of the parent gluon
// (the other will take the one passing for the anticolour of
// the parent gluon).
if (UseRandom::rndbool()) {
ColinePtr newline=new_ptr(ColourLine());
cfirst.first->addColoured(parent);
cfirst.second->addColoured(second);
newline->addAntiColoured(second);
newline->addAntiColoured(parent);
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (first->radiationLine() == 1 || first->radiationLine() == 2){
// Record which line radiates
radiationLine = 2;
}
}
}
else {
ColinePtr newline=new_ptr(ColourLine());
cfirst.first->addAntiColoured(second);
cfirst.second->addAntiColoured(parent);
newline->addColoured(parent);
newline->addColoured(second);
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (first->radiationLine() == 1 || first->radiationLine() == 2){
// Record which line radiates
radiationLine = 1;
}
}
}
}
if (_splittingColourMethod == 1 || _splittingColourMethod == 2){
if (first->radiationLine() == 1 || first->radiationLine() == 2){
// Set the radiation line for the children
parent->setRadiationLine(radiationLine);
second->setRadiationLine(0);
// Set the progenitors for the children
parent->setProgenitor(first->progenitor());
second->setProgenitor(first->progenitor());
}
}
}
}
else if(_colourStructure == OctetTripletTriplet) {
if(!back) {
ColinePair cparent = ColinePair(parent->colourLine(),
- parent->antiColourLine());
+ parent->antiColourLine());
// ensure input consistency
assert(cparent.first&&cparent.second);
cparent.first ->addColoured ( first);
cparent.second->addAntiColoured(second);
// Set progenitor
first->setProgenitor(parent->progenitor());
second->setProgenitor(parent->progenitor());
// Random radiation choice
first->setRadiationLine(0);
second->setRadiationLine(0);
}
else {
ColinePair cfirst = ColinePair(first->colourLine(),
- first->antiColourLine());
+ first->antiColourLine());
// ensure input consistency
assert(( cfirst.first && !cfirst.second) ||
- (!cfirst.first && cfirst.second));
+ (!cfirst.first && cfirst.second));
// g -> q qbar
if(cfirst.first) {
ColinePtr newline=new_ptr(ColourLine());
cfirst.first->addColoured(parent);
newline->addAntiColoured(second);
newline->addAntiColoured(parent);
}
// g -> qbar q
else {
- ColinePtr newline=new_ptr(ColourLine());
- cfirst.second->addAntiColoured(parent);
- newline->addColoured(second);
- newline->addColoured(parent);
+ ColinePtr newline=new_ptr(ColourLine());
+ cfirst.second->addAntiColoured(parent);
+ newline->addColoured(second);
+ newline->addColoured(parent);
}
// Set progenitor
parent->setProgenitor(first->progenitor());
second->setProgenitor(first->progenitor());
// Random radiation choice
parent->setRadiationLine(0);
second->setRadiationLine(0);
}
}
else if(_colourStructure == TripletOctetTriplet) {
if(!back) {
ColinePair cparent = ColinePair(parent->colourLine(),
- parent->antiColourLine());
+ parent->antiColourLine());
// ensure input consistency
assert(( cparent.first && !cparent.second) ||
- (!cparent.first && cparent.second));
+ (!cparent.first && cparent.second));
// q -> g q
if(cparent.first) {
- ColinePtr newline=new_ptr(ColourLine());
- cparent.first->addColoured(first);
- newline->addColoured (second);
- newline->addAntiColoured( first);
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(first);
+ newline->addColoured (second);
+ newline->addAntiColoured( first);
}
// qbar -> g qbar
else {
ColinePtr newline=new_ptr(ColourLine());
cparent.second->addAntiColoured(first);
newline->addColoured ( first);
newline->addAntiColoured(second);
}
// Set progenitor
first->setProgenitor(parent->progenitor());
second->setProgenitor(parent->progenitor());
// Random radiation choice
first->setRadiationLine(0);
second->setRadiationLine(0);
}
else {
ColinePair cfirst = ColinePair(first->colourLine(),
- first->antiColourLine());
+ first->antiColourLine());
// ensure input consistency
assert(cfirst.first&&cfirst.second);
// q -> g q
if(parent->id()>0) {
- cfirst.first ->addColoured(parent);
- cfirst.second->addColoured(second);
+ cfirst.first ->addColoured(parent);
+ cfirst.second->addColoured(second);
}
else {
- cfirst.first ->addAntiColoured(second);
- cfirst.second->addAntiColoured(parent);
+ cfirst.first ->addAntiColoured(second);
+ cfirst.second->addAntiColoured(parent);
}
// Set progenitor
parent->setProgenitor(first->progenitor());
second->setProgenitor(first->progenitor());
// Random radiation choice
parent->setRadiationLine(0);
second->setRadiationLine(0);
}
}
+ else if(_colourStructure==SextetSextetOctet) {
+ //make sure we're not doing backward evolution
+ assert(!back);
+
+ //make sure something sensible
+ assert(parent->colourLine() || parent->antiColourLine());
+
+ //get the colour lines or anti-colour lines
+ bool isAntiColour=true;
+ ColinePair cparent;
+ if(parent->colourLine()) {
+ cparent = ColinePair(const_ptr_cast<tColinePtr>(parent->colourInfo()->colourLines()[0]),
+ const_ptr_cast<tColinePtr>(parent->colourInfo()->colourLines()[1]));
+ isAntiColour=false;
+ }
+ else {
+ cparent = ColinePair(const_ptr_cast<tColinePtr>(parent->colourInfo()->antiColourLines()[0]),
+ const_ptr_cast<tColinePtr>(parent->colourInfo()->antiColourLines()[1]));
+ }
+
+ //check for sensible input
+ // assert(cparent.first && cparent.second);
+
+ // sextet has 2 colour lines
+ if(!isAntiColour) {
+ //pick at random which of the colour topolgies to take
+ double topology = UseRandom::rnd();
+ if(topology < 0.25) {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(second);
+ cparent.second->addColoured(first);
+ newline->addColoured(first);
+ newline->addAntiColoured(second);
+ }
+ else if(topology >=0.25 && topology < 0.5) {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(first);
+ cparent.second->addColoured(second);
+ newline->addColoured(first);
+ newline->addAntiColoured(second);
+ }
+ else if(topology >= 0.5 && topology < 0.75) {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(second);
+ cparent.second->addColoured(first);
+ newline->addColoured(first);
+ newline->addAntiColoured(second);
+ }
+ else {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addColoured(first);
+ cparent.second->addColoured(second);
+ newline->addColoured(first);
+ newline->addAntiColoured(second);
+ }
+ }
+ // sextet has 2 anti-colour lines
+ else {
+ double topology = UseRandom::rnd();
+ if(topology < 0.25){
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addAntiColoured(second);
+ cparent.second->addAntiColoured(first);
+ newline->addAntiColoured(first);
+ newline->addColoured(second);
+ }
+ else if(topology >=0.25 && topology < 0.5) {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addAntiColoured(first);
+ cparent.second->addAntiColoured(second);
+ newline->addAntiColoured(first);
+ newline->addColoured(second);
+ }
+ else if(topology >= 0.5 && topology < 0.75) {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addAntiColoured(second);
+ cparent.second->addAntiColoured(first);
+ newline->addAntiColoured(first);
+ newline->addColoured(second);
+ }
+ else {
+ ColinePtr newline=new_ptr(ColourLine());
+ cparent.first->addAntiColoured(first);
+ cparent.second->addAntiColoured(second);
+ newline->addAntiColoured(first);
+ newline->addColoured(second);
+ }
+ }
+ }
else {
assert(false);
}
}
void SplittingFunction::doinit() {
Interfaced::doinit();
assert(_interactionType!=ShowerInteraction::UNDEFINED);
if(_colourFactor>0.) return;
// compute the colour factors if need
if(_colourStructure==TripletTripletOctet) {
_colourFactor = 4./3.;
}
else if(_colourStructure==OctetOctetOctet) {
_colourFactor = 3.;
}
else if(_colourStructure==OctetTripletTriplet) {
_colourFactor = 0.5;
}
else if(_colourStructure==TripletOctetTriplet) {
_colourFactor = 4./3.;
}
+ else if(_colourStructure==SextetSextetOctet) {
+ _colourFactor = 10./3.;
+ }
else {
assert(false);
}
}
bool SplittingFunction::checkColours(const IdList & ids) const {
tcPDPtr pd[3]={getParticleData(ids[0]),
- getParticleData(ids[1]),
- getParticleData(ids[2])};
+ getParticleData(ids[1]),
+ getParticleData(ids[2])};
if(_colourStructure==TripletTripletOctet) {
if(ids[0]!=ids[1]) return false;
if((pd[0]->iColour()==PDT::Colour3||pd[0]->iColour()==PDT::Colour3bar) &&
pd[2]->iColour()==PDT::Colour8) return true;
return false;
}
else if(_colourStructure==OctetOctetOctet) {
for(unsigned int ix=0;ix<3;++ix) {
if(pd[ix]->iColour()!=PDT::Colour8) return false;
}
return true;
}
else if(_colourStructure==OctetTripletTriplet) {
if(pd[0]->iColour()!=PDT::Colour8) return false;
if(pd[1]->iColour()==PDT::Colour3&&pd[2]->iColour()==PDT::Colour3bar)
return true;
if(pd[1]->iColour()==PDT::Colour3bar&&pd[2]->iColour()==PDT::Colour3)
return true;
return false;
}
else if(_colourStructure==TripletOctetTriplet) {
if(ids[0]!=ids[2]) return false;
if((pd[0]->iColour()==PDT::Colour3||pd[0]->iColour()==PDT::Colour3bar) &&
pd[1]->iColour()==PDT::Colour8) return true;
return false;
}
+ else if(_colourStructure==SextetSextetOctet) {
+ if(ids[0]!=ids[1]) return false;
+ if((pd[0]->iColour()==PDT::Colour6 || pd[0]->iColour()==PDT::Colour6bar) &&
+ pd[2]->iColour()==PDT::Colour8) return true;
+ return false;
+ }
else {
assert(false);
}
return false;
}
diff --git a/Shower/SplittingFunctions/SplittingFunction.h b/Shower/SplittingFunctions/SplittingFunction.h
--- a/Shower/SplittingFunctions/SplittingFunction.h
+++ b/Shower/SplittingFunctions/SplittingFunction.h
@@ -1,314 +1,314 @@
// -*- C++ -*-
//
// SplittingFunction.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_SplittingFunction_H
#define HERWIG_SplittingFunction_H
//
// This is the declaration of the SplittingFunction class.
//
#include "ThePEG/Interface/Interfaced.h"
#include "Herwig++/Shower/ShowerConfig.h"
#include "ThePEG/EventRecord/ColourLine.h"
#include "SplittingFunction.fh"
namespace Herwig {
using namespace ThePEG;
/** \ingroup Shower
* Enum to define the possible types of colour structure which can occur in
* the branching.
*/
enum ColourStructure {Undefined=-1,TripletTripletOctet=0,OctetOctetOctet=1,
- OctetTripletTriplet=2,TripletOctetTriplet=3};
+ OctetTripletTriplet=2,TripletOctetTriplet=3,SextetSextetOctet=4};
/** \ingroup Shower
*
* This is an abstract class which defines the common interface
* for all \f$1\to2\f$ splitting functions, for both initial-state
* and final-state radiation.
*
* The SplittingFunction class contains a number of purely virtual members
* which must be implemented in the inheriting classes. The class also stores
* the interaction type of the spltting function.
*
* The inheriting classes need to specific the splitting function
* \f$P(z,2p_j\cdot p_k)\f$, in terms of the energy fraction \f$z\f$ and
* the evolution scale. In order to allow the splitting functions to be used
* with different choices of evolution functions the scale is given by
* \f[2p_j\cdot p_k=(p_j+p_k)^2-m_{jk}^2=Q^2-(p_j+p_k)^2=z(1-z)\tilde{q}^2=
* \frac{p_T^2}{z(1-z)}-m_{jk}^2+\frac{m_j^2}{z}+\frac{m_k^2}{1-z},\f]
* where \f$Q^2\f$ is the virtuality of the branching particle,
* $p_T$ is the relative transverse momentum of the branching products and
* \f$\tilde{q}^2\f$ is the angular variable described in hep-ph/0310083.
*
* In addition an overestimate of the
* splitting function, \f$P_{\rm over}(z)\f$ which only depends upon \f$z\f$,
* the integral, inverse of the integral for this overestimate and
* ratio of the true splitting function to the overestimate must be provided
* as they are necessary for the veto alogrithm used to implement the evolution.
*
* @see \ref SplittingFunctionInterfaces "The interfaces"
* defined for SplittingFunction.
*/
class SplittingFunction: public Interfaced {
public:
/**
* The default constructor.
* @param b All splitting functions must have an interaction order
*/
SplittingFunction(unsigned int b)
: Interfaced(), _interactionType(ShowerInteraction::UNDEFINED),
_interactionorder(b),
_colourStructure(Undefined), _colourFactor(-1.),
_splittingColourMethod(0) {}
public:
/**
* Methods to return the interaction type and order for the splitting function
*/
//@{
/**
* Return the type of the interaction
*/
ShowerInteraction::Type interactionType() const {return _interactionType;}
/**
* Return the order of the splitting function in the interaction
*/
unsigned int interactionOrder() const {return _interactionorder;}
/**
* Return the colour structure
*/
ColourStructure colourStructure() const {return _colourStructure;}
/**
* Return the colour factor
*/
double colourFactor() const {return _colourFactor;}
//@}
/**
* Purely virtual method which should determine whether this splitting
* function can be used for a given set of particles.
* @param ids The PDG codes for the particles in the splitting.
*/
virtual bool accept(const IdList & ids) const = 0;
/**
* Method to check the colours are correct
*/
virtual bool checkColours(const IdList & ids) const;
/**
* Methods to return the splitting function.
*/
//@{
/**
* Purely virtual method which should return the exact value of the splitting function,
* \f$P\f$ evaluated in terms of the energy fraction, \f$z\f$, and the evolution scale
\f$\tilde{q}^2\f$.
* @param z The energy fraction.
* @param t The scale \f$t=2p_j\cdot p_k\f$.
* @param ids The PDG codes for the particles in the splitting.
* @param mass Whether or not to include the mass dependent terms
*/
virtual double P(const double z, const Energy2 t, const IdList & ids,
const bool mass) const = 0;
/**
* Purely virtual method which should return
* an overestimate of the splitting function,
* \f$P_{\rm over}\f$ such that the result \f$P_{\rm over}\geq P\f$. This function
* should be simple enough that it does not depend on the evolution scale.
* @param z The energy fraction.
* @param ids The PDG codes for the particles in the splitting.
*/
virtual double overestimateP(const double z, const IdList & ids) const = 0;
/**
* Purely virtual method which should return
* the ratio of the splitting function to the overestimate, i.e.
* \f$P(z,\tilde{q}^2)/P_{\rm over}(z)\f$.
* @param z The energy fraction.
* @param t The scale \f$t=2p_j\cdot p_k\f$.
* @param ids The PDG codes for the particles in the splitting.
* @param mass Whether or not to include the mass dependent terms
*/
virtual double ratioP(const double z, const Energy2 t, const IdList & ids,
const bool mass) const = 0;
/**
* Purely virtual method which should return the indefinite integral of the
* overestimated splitting function, \f$P_{\rm over}\f$.
* @param z The energy fraction.
* @param ids The PDG codes for the particles in the splitting.
* @param PDFfactor Which additional factor to include for the PDF
* 0 is no additional factor,
* 1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$
*
*/
virtual double integOverP(const double z, const IdList & ids,
unsigned int PDFfactor=0) const = 0;
/**
* Purely virtual method which should return the inverse of the
* indefinite integral of the
* overestimated splitting function, \f$P_{\rm over}\f$ which is used to
* generate the value of \f$z\f$.
* @param r Value of the splitting function to be inverted
* @param ids The PDG codes for the particles in the splitting.
* @param PDFfactor Which additional factor to include for the PDF
* 0 is no additional factor,
* 1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$
*/
virtual double invIntegOverP(const double r, const IdList & ids,
unsigned int PDFfactor=0) const = 0;
//@}
/**
* Purely virtual method which should make the proper colour connection
* between the emitting parent and the branching products.
* @param parent The parent for the branching
* @param first The first branching product
* @param second The second branching product
* @param back Whether this is foward or backward evolution.
*/
virtual void colourConnection(tShowerParticlePtr parent,
tShowerParticlePtr first,
tShowerParticlePtr second,
const bool back) 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 Standard Interfaced functions. */
//@{
/**
* Initialize this object after the setup phase before saving an
* EventGenerator to disk.
* @throws InitException if object could not be initialized properly.
*/
virtual void doinit();
//@}
protected:
/**
* Set the colour factor
*/
void colourFactor(double in) {_colourFactor=in;}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is an abstract class without persistent data.
*/
static AbstractClassDescription<SplittingFunction> initSplittingFunction;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
SplittingFunction & operator=(const SplittingFunction &);
private:
/**
* The interaction type for the splitting function.
*/
ShowerInteraction::Type _interactionType;
/**
* The order of the splitting function in the coupling
*/
unsigned int _interactionorder;
/**
* The colour structure
*/
ColourStructure _colourStructure;
/**
* The colour factor
*/
double _colourFactor;
/**
* The method for assigning colour
* The default, 0, will assign colour lines for octets
* randomly without keeping a record of which lines radiate.
* For option 1 only the "correct" lines will radiate until
* the lowest scale is reached.
* For option 2 there will be random radiation, but the
* line which radiates is recorded
*/
int _splittingColourMethod;
};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of SplittingFunction. */
template <>
struct BaseClassTrait<Herwig::SplittingFunction,1> {
/** Typedef of the first base class of SplittingFunction. */
typedef Interfaced NthBase;
};
/** This template specialization informs ThePEG about the name of
* the SplittingFunction class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::SplittingFunction>
: public ClassTraitsBase<Herwig::SplittingFunction> {
/** Return a platform-independent class name */
static string className() { return "Herwig::SplittingFunction"; }
};
/** @endcond */
}
#endif /* HERWIG_SplittingFunction_H */
diff --git a/Tests/Rivet/LEP-91.in b/Tests/Rivet/LEP-91.in
--- a/Tests/Rivet/LEP-91.in
+++ b/Tests/Rivet/LEP-91.in
@@ -1,54 +1,56 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LEPBase.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LEPGenerator:EventHandler:LuminosityFunction:Energy 91.2
##################################################
# select the analyses
##################################################
# Validated
##################################################
# ALEPH charged particle multiplicity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1991_S2435284
# ALEPH main LEP I QCD summary paper
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1996_S3486095
# ALEPH photon analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1996_S3196992
+# ALEPH D*
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1999_S4193598
# OPAL photon analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_1993_S2692198
# OPAL flavour specific charged multiplicities etc
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_1998_S3780481
# OPAL event shapes and multiplicities at different energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_2004_S6132243
# ALEPH jet and event shapes at many energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_2004_S5765862
# OPAL/JADE jet rates at many energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_OPAL_2000_S4300807
# DELPHI strange baryon production
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_1995_S3137023
# DELPHI tuning paper
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_1996_S3430090
# DELPHI b quark
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_2002_069_CONF_603
# PDG hadron multiplicities and ratios
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES_RATIOS
##################################################
# unvalidated
##################################################
# OPAL 4 jet angles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_2001_S4553896
# DELPHI 4 jet angles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_2003_WUD_03_11
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LEP-91 LEPGenerator
diff --git a/Tests/Rivet/LEP-Powheg-91.in b/Tests/Rivet/LEP-Powheg-91.in
--- a/Tests/Rivet/LEP-Powheg-91.in
+++ b/Tests/Rivet/LEP-Powheg-91.in
@@ -1,54 +1,56 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LEPBase-Powheg.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LEPGenerator:EventHandler:LuminosityFunction:Energy 91.2
##################################################
# select the analyses
##################################################
# Validated
##################################################
# ALEPH charged particle multiplicity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1991_S2435284
# ALEPH main LEP I QCD summary paper
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1996_S3486095
# ALEPH photon analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1996_S3196992
+# ALEPH D*
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_1999_S4193598
# OPAL photon analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_1993_S2692198
# OPAL flavour specific charged multiplicities etc
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_1998_S3780481
# OPAL event shapes and multiplicities at different energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_2004_S6132243
# ALEPH jet and event shapes at many energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALEPH_2004_S5765862
# OPAL/JADE jet rates at many energies
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_OPAL_2000_S4300807
# DELPHI strange baryon production
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_1995_S3137023
# DELPHI tuning paper
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_1996_S3430090
# DELPHI b quark
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_2002_069_CONF_603
# PDG hadron multiplicities and ratios
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES_RATIOS
##################################################
# unvalidated
##################################################
# OPAL 4 jet angles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 OPAL_2001_S4553896
# DELPHI 4 jet angles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 DELPHI_2003_WUD_03_11
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LEP-Powheg-91 LEPGenerator
diff --git a/Tests/Rivet/LHC-2360-UE.in b/Tests/Rivet/LHC-2360-UE.in
--- a/Tests/Rivet/LHC-2360-UE.in
+++ b/Tests/Rivet/LHC-2360-UE.in
@@ -1,47 +1,49 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
# override the beam energy
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 2360.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 2.62
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.24
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# min bias
insert SimpleQCD:MatrixElements[0] MEMinBias
# same as ue process
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
# min ibas cuts
set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
set /Herwig/Cuts/QCDCuts:MHatMin 0.0*GeV
set /Herwig/Cuts/QCDCuts:X1Min 0.01
set /Herwig/Cuts/QCDCuts:X2Min 0.01
##################################################
# select the analyses
##################################################
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8918562
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8625980
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8624100
# CMS charged particle multiplicity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S8884919
# CMS charged particle pT and rapidity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2010_S8547297
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-2360-UE LHCGenerator
diff --git a/Tests/Rivet/LHC-7-DiPhoton.in b/Tests/Rivet/LHC-7-DiPhoton.in
--- a/Tests/Rivet/LHC-7-DiPhoton.in
+++ b/Tests/Rivet/LHC-7-DiPhoton.in
@@ -1,30 +1,32 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# diphoton
insert SimpleQCD:MatrixElements[0] MEGammaGamma
# photon cuts
set /Herwig/Cuts/PhotonKtCut:MinKT 5.
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# ATLAS diphoton
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S9120807
+# MC diphoton
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_DIPHOTON
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-7-DiPhoton LHCGenerator
diff --git a/Tests/Rivet/LHC-7-PromptPhoton.in b/Tests/Rivet/LHC-7-PromptPhoton.in
--- a/Tests/Rivet/LHC-7-PromptPhoton.in
+++ b/Tests/Rivet/LHC-7-PromptPhoton.in
@@ -1,30 +1,32 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] MEGammaJet
# photon cuts
set /Herwig/Cuts/PhotonKtCut:MinKT 5.
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# ATLAS prompt photon
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8914702
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_PHOTONJETS
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_PHOTONJETUE
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-7-PromptPhoton LHCGenerator
diff --git a/Tests/Rivet/LHC-7-UE.in b/Tests/Rivet/LHC-7-UE.in
--- a/Tests/Rivet/LHC-7-UE.in
+++ b/Tests/Rivet/LHC-7-UE.in
@@ -1,56 +1,58 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# min bias
insert SimpleQCD:MatrixElements[0] MEMinBias
# same as ue process
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
# min ibas cuts
set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
set /Herwig/Cuts/QCDCuts:MHatMin 0.0*GeV
set /Herwig/Cuts/QCDCuts:X1Min 0.01
set /Herwig/Cuts/QCDCuts:X2Min 0.01
##################################################
# select the analyses
##################################################
# ATLAS jet shapes
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S8924791
# ATLAS jets
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8817804
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S8994773
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8894728
# ATLAS fragmentation function
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_CONF_2010_049
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8918562
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8625980
# CMS particle spectra
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S8978280
# CMS charged particle multiplicity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S8884919
# CMS charged particle pT and rapidity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2010_S8656010
# CMS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S9120041
# ATLAS track jet
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_I919017
+# LHCB phi production
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 LHCB_2011_I919315
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-7-UE LHCGenerator
diff --git a/Tests/Rivet/LHC-900-UE.in b/Tests/Rivet/LHC-900-UE.in
--- a/Tests/Rivet/LHC-900-UE.in
+++ b/Tests/Rivet/LHC-900-UE.in
@@ -1,64 +1,66 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
# override the beam energy
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# min bias
insert SimpleQCD:MatrixElements[0] MEMinBias
# same as ue process
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
# min ibas cuts
set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
set /Herwig/Cuts/QCDCuts:MHatMin 0.0*GeV
set /Herwig/Cuts/QCDCuts:X1Min 0.01
set /Herwig/Cuts/QCDCuts:X2Min 0.01
##################################################
# select the analyses
##################################################
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S8994773
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8918562
# ATLAS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8894728
# ATLAS charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8591806
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8706239
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8625980
# ALICE charged particles
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2010_S8624100
# ALICE particle spectra
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2011_S8945144
# ALICE strange particle production
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ALICE_2011_S8909580
# CMS particle spectra
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S8978280
# CMS charged particle multiplicity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S8884919
# CMS charged particle pT and rapidity
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2010_S8547297
# CMS UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2011_S9120041
# LHCB k_s0
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 LHCB_2010_S8758301
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-900-UE LHCGenerator
diff --git a/Tests/Rivet/LHC-Powheg-W-e.in b/Tests/Rivet/LHC-Powheg-W-e.in
--- a/Tests/Rivet/LHC-Powheg-W-e.in
+++ b/Tests/Rivet/LHC-Powheg-W-e.in
@@ -1,30 +1,34 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase-Powheg.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] PowhegMEqq2W2ff
set PowhegMEqq2W2ff:Process Electron
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# general analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_WJETS
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_WPOL
# ATLAS W+jets
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8919674
+# ATLAS W pT
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_I925932
+
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-Powheg-W-e LHCGenerator
diff --git a/Tests/Rivet/LHC-Powheg-W-mu.in b/Tests/Rivet/LHC-Powheg-W-mu.in
--- a/Tests/Rivet/LHC-Powheg-W-mu.in
+++ b/Tests/Rivet/LHC-Powheg-W-mu.in
@@ -1,30 +1,32 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase-Powheg.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] PowhegMEqq2W2ff
set PowhegMEqq2W2ff:Process Muon
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# ATLAS W asymetry
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S9002537
# ATLAS W+jets
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8919674
+# ATLAS W pT
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_I925932
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-Powheg-W-mu LHCGenerator
diff --git a/Tests/Rivet/LHC-W-e.in b/Tests/Rivet/LHC-W-e.in
--- a/Tests/Rivet/LHC-W-e.in
+++ b/Tests/Rivet/LHC-W-e.in
@@ -1,30 +1,33 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] MEqq2W2ff
set MEqq2W2ff:Process Electron
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# general analysis
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_WJETS
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 MC_WPOL
# ATLAS W+jets
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8919674
+# ATLAS W pT
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_I925932
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-W-e LHCGenerator
diff --git a/Tests/Rivet/LHC-W-mu.in b/Tests/Rivet/LHC-W-mu.in
--- a/Tests/Rivet/LHC-W-mu.in
+++ b/Tests/Rivet/LHC-W-mu.in
@@ -1,30 +1,33 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read LHCBase.in
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] MEqq2W2ff
set MEqq2W2ff:Process Muon
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# ATLAS W asymetry
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_S9002537
# ATLAS W+jets
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8919674
+# ATLAS W pT
+insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2011_I925932
+
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun LHC-W-mu LHCGenerator
diff --git a/Tests/Rivet/LHCBase-Powheg.in b/Tests/Rivet/LHCBase-Powheg.in
--- a/Tests/Rivet/LHCBase-Powheg.in
+++ b/Tests/Rivet/LHCBase-Powheg.in
@@ -1,45 +1,47 @@
##################################################
# Example generator based on Tevatron parameters
# usage: Herwig++ read TVT.in
#
# Since most parameters are identical to LHC,
# we use the default LHCGenerator and adapt only
# for the differences
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
##################################################
# Need to use an NLO PDF
##################################################
set /Herwig/Particles/p+:PDF /Herwig/Partons/MRST-NLO
set /Herwig/Particles/pbar-:PDF /Herwig/Partons/MRST-NLO
##################################################
# and strong coupling
##################################################
create Herwig::O2AlphaS O2AlphaS
set /Herwig/Model:QCD/RunningAlphaS O2AlphaS
##################################################
# Setup the POWHEG shower
##################################################
cd /Herwig/Shower
set Evolver:HardEmissionMode POWHEG
set Evolver:IntrinsicPtGaussian 2.2*GeV
##################################################
# Create the Herwig analysis
##################################################
cd /Herwig/Generators
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
diff --git a/Tests/Rivet/LHCBase.in b/Tests/Rivet/LHCBase.in
--- a/Tests/Rivet/LHCBase.in
+++ b/Tests/Rivet/LHCBase.in
@@ -1,21 +1,23 @@
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
set LHCGenerator:EventHandler:StatLevel Full
set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
##################################################
# Create the Herwig analysis
##################################################
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
set /Herwig/Analysis/RivetAnalysis:Debug No
set /Herwig/Decays/DecayHandler:LifeTimeOption 0
set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm
diff --git a/Tests/Rivet/StarBase.in b/Tests/Rivet/StarBase.in
--- a/Tests/Rivet/StarBase.in
+++ b/Tests/Rivet/StarBase.in
@@ -1,42 +1,44 @@
##################################################
# Example generator based on Tevatron parameters
# usage: Herwig++ read TVT.in
#
# Since most parameters are identical to LHC,
# we use the default LHCGenerator and adapt only
# for the differences
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
set LHCGenerator:EventHandler:StatLevel Full
##################################################
# Tevatron physics parameters (override defaults)
##################################################
set LHCGenerator:EventHandler:BeamB /Herwig/Particles/p+
set LHCGenerator:EventHandler:LuminosityFunction:Energy 200.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Create the Herwig analysis
##################################################
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
set /Herwig/Analysis/RivetAnalysis:Debug No
cd /Herwig/Generators
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
set /Herwig/Decays/DecayHandler:LifeTimeOption 0
set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm
set /Herwig/Cuts/QCDCuts:X2Min 0.01
diff --git a/Tests/Rivet/TVT-630-Jets-1.in b/Tests/Rivet/TVT-630-Jets-1.in
--- a/Tests/Rivet/TVT-630-Jets-1.in
+++ b/Tests/Rivet/TVT-630-Jets-1.in
@@ -1,34 +1,36 @@
###################################################
# Rivet analyses at the Z pole
##################################################
read TVTBase.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 630.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
insert SimpleQCD:MatrixElements[0] MEQCD2to2
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
set /Herwig/Cuts/JetKtCut:MinKT 20.
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# run I CDF UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_2004_S5839831
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun TVT-630-Jets-1 LHCGenerator
diff --git a/Tests/Rivet/TVT-630-Jets-2.in b/Tests/Rivet/TVT-630-Jets-2.in
--- a/Tests/Rivet/TVT-630-Jets-2.in
+++ b/Tests/Rivet/TVT-630-Jets-2.in
@@ -1,34 +1,36 @@
###################################################
# Rivet analyses at the Z pole
##################################################
read TVTBase.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 630.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
insert SimpleQCD:MatrixElements[0] MEQCD2to2
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
set /Herwig/Cuts/JetKtCut:MinKT 40.
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# run I CDF UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_2004_S5839831
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun TVT-630-Jets-2 LHCGenerator
diff --git a/Tests/Rivet/TVT-630-Jets-3.in b/Tests/Rivet/TVT-630-Jets-3.in
--- a/Tests/Rivet/TVT-630-Jets-3.in
+++ b/Tests/Rivet/TVT-630-Jets-3.in
@@ -1,34 +1,36 @@
####################################################
# Rivet analyses at the Z pole
##################################################
read TVTBase.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 630.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
insert SimpleQCD:MatrixElements[0] MEQCD2to2
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
set /Herwig/Cuts/JetKtCut:MinKT 75.
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
##################################################
# select the analyses
##################################################
# run I CDF UE
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_2004_S5839831
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun TVT-630-Jets-3 LHCGenerator
diff --git a/Tests/Rivet/TVT-630-UE.in b/Tests/Rivet/TVT-630-UE.in
--- a/Tests/Rivet/TVT-630-UE.in
+++ b/Tests/Rivet/TVT-630-UE.in
@@ -1,39 +1,41 @@
##################################################
# Rivet analyses at the Z pole
##################################################
read TVT-UEBase.in
##################################################
# LEP physics parameters (override defaults)
##################################################
cd /Herwig/Generators
set LHCGenerator:EventHandler:LuminosityFunction:Energy 630.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
##################################################
# Use the q qbar matrix element
##################################################
cd /Herwig/MatrixElements
# min bias
insert SimpleQCD:MatrixElements[0] MEMinBias
# No QED radiation
erase /Herwig/EventHandlers/LHCHandler:PostSubProcessHandlers 0
# min ibas cuts
set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
set /Herwig/Cuts/QCDCuts:MHatMin 0.0*GeV
set /Herwig/Cuts/QCDCuts:X1Min 0.01
set /Herwig/Cuts/QCDCuts:X2Min 0.01
##################################################
# select the analyses
##################################################
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_1988_S1865951
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_1990_S2089246
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_2002_S4796047
insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CDF_2004_S5839831
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
cd /Herwig/Generators
saverun TVT-630-UE LHCGenerator
diff --git a/Tests/Rivet/TVTBase-Powheg.in b/Tests/Rivet/TVTBase-Powheg.in
--- a/Tests/Rivet/TVTBase-Powheg.in
+++ b/Tests/Rivet/TVTBase-Powheg.in
@@ -1,48 +1,50 @@
##################################################
# Example generator based on Tevatron parameters
# usage: Herwig++ read TVT.in
#
# Since most parameters are identical to LHC,
# we use the default LHCGenerator and adapt only
# for the differences
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
##################################################
# Tevatron physics parameters (override defaults)
##################################################
set LHCGenerator:EventHandler:BeamB /Herwig/Particles/pbar-
+set /Herwig/UnderlyingEvent/KtCut:MinKT 2.55
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.1
##################################################
# Need to use an NLO PDF
##################################################
set /Herwig/Particles/p+:PDF /Herwig/Partons/MRST-NLO
set /Herwig/Particles/pbar-:PDF /Herwig/Partons/MRST-NLO
##################################################
# and strong coupling
##################################################
create Herwig::O2AlphaS O2AlphaS
set /Herwig/Model:QCD/RunningAlphaS O2AlphaS
##################################################
# Setup the POWHEG shower
##################################################
cd /Herwig/Shower
set Evolver:IntrinsicPtGaussian 1.9*GeV
set Evolver:HardEmissionMode POWHEG
##################################################
# Create the Herwig analysis
##################################################
cd /Herwig/Generators
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
diff --git a/Tests/Rivet/TVTBase.in b/Tests/Rivet/TVTBase.in
--- a/Tests/Rivet/TVTBase.in
+++ b/Tests/Rivet/TVTBase.in
@@ -1,30 +1,32 @@
##################################################
# Example generator based on Tevatron parameters
# usage: Herwig++ read TVT.in
#
# Since most parameters are identical to LHC,
# we use the default LHCGenerator and adapt only
# for the differences
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
set LHCGenerator:EventHandler:StatLevel Full
##################################################
# Tevatron physics parameters (override defaults)
##################################################
set LHCGenerator:EventHandler:BeamB /Herwig/Particles/pbar-
+set /Herwig/UnderlyingEvent/KtCut:MinKT 2.55
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.1
##################################################
# Create the Herwig analysis
##################################################
create ThePEG::RivetAnalysis /Herwig/Analysis/RivetAnalysis RivetAnalysis.so
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis
set /Herwig/Analysis/RivetAnalysis:Debug No
diff --git a/Tests/python/merge-LHC-EW b/Tests/python/merge-LHC-EW
--- a/Tests/python/merge-LHC-EW
+++ b/Tests/python/merge-LHC-EW
@@ -1,114 +1,119 @@
#! /usr/bin/env python
import lighthisto
import logging
import sys
import os, copy, re
"""%prog
Script for merging aida files
"""
import sys
if sys.version_info[:3] < (2,4,0):
print "rivet scripts require Python version >= 2.4.0... exiting"
sys.exit(1)
## Try to load faster but non-standard cElementTree module
try:
import xml.etree.cElementTree as ET
except ImportError:
try:
import cElementTree as ET
except ImportError:
try:
import xml.etree.ElementTree as ET
except:
sys.stderr.write("Can't load the ElementTree XML parser: please install it!\n")
sys.exit(1)
if __name__ == "__main__":
import logging
from optparse import OptionParser, OptionGroup
parser = OptionParser(usage="%prog aidafile aidafile2 [...]")
parser.add_option("-o", "--out", dest="OUTFILE", default="-")
parser.add_option("--append", dest="APPEND_OUTPUT", action="store_true", default=False)
verbgroup = OptionGroup(parser, "Verbosity control")
verbgroup.add_option("-v", "--verbose", action="store_const", const=logging.DEBUG, dest="LOGLEVEL",
default=logging.INFO, help="print debug (very verbose) messages")
verbgroup.add_option("-q", "--quiet", action="store_const", const=logging.WARNING, dest="LOGLEVEL",
default=logging.INFO, help="be very quiet")
parser.add_option_group(verbgroup)
(opts, args) = parser.parse_args()
logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
## Prefix used in dat file headers
headerprefix = "# "
## Check args
if len(args) < 1:
logging.error("Must specify at least one AIDA histogram file")
sys.exit(1)
## Get histos
outhistos={}
for file in args:
if not os.access(file, os.R_OK):
logging.error("%s can not be read" % file)
break
try:
tree = ET.parse(file)
except:
logging.error("%s can not be parsed as XML" % file)
break
tree = ET.parse(file)
## Get histos from this AIDA file
for dps in tree.findall("dataPointSet"):
h = lighthisto.Histo.fromDPS(dps)
if(h.fullPath().find("ATLAS_2010_S8919674")>0) :
if((h.fullPath().find("d01")>0 or h.fullPath().find("d05")>0 or
h.fullPath().find("d07")>0) and file.find("-e")>0) :
outhistos[h.fullPath()] = h
elif((h.fullPath().find("d02")>0 or h.fullPath().find("d06")>0 or
h.fullPath().find("d08")>0) and file.find("-mu")>0) :
outhistos[h.fullPath()] = h
elif (h.fullPath().find("ATLAS_2011_S9131140")>0) :
if(h.fullPath().find("d01")>0 and file.find("-e")>0) :
outhistos[h.fullPath()] = h
elif(h.fullPath().find("d02")>0 and file.find("-mu")>0) :
outhistos[h.fullPath()] = h
+ elif (h.fullPath().find("ATLAS_2011_I925932")>0) :
+ if(h.fullPath().find("d01")>0 and file.find("-e")>0) :
+ outhistos[h.fullPath()] = h
+ elif(h.fullPath().find("d02")>0 and file.find("-mu")>0) :
+ outhistos[h.fullPath()] = h
else :
outhistos[h.fullPath()] = h
## Choose output file
out = None
if opts.OUTFILE == "-":
out = sys.stdout
else:
if opts.APPEND_OUTPUT:
out = open(opts.OUTFILE, "a")
else:
out = open(opts.OUTFILE, "w")
# Choose output file
out = None
if opts.OUTFILE == "-":
out = sys.stdout
else:
if opts.APPEND_OUTPUT:
out = open(opts.OUTFILE, "a")
else:
out = open(opts.OUTFILE, "w")
## Write out merged histos
out.write('<?xml version="1.0" encoding="ISO-8859-1" ?>\n')
out.write('<!DOCTYPE aida SYSTEM "http://aida.freehep.org/schemas/3.3/aida.dtd">\n')
out.write('<aida version="3.3">\n')
out.write(' <implementation version="1.1" package="FreeHEP"/>\n')
for hpath, h in sorted(outhistos.iteritems()):
logging.debug("hpath = %s" % hpath)
out.write(h.asAIDA() + "\n\n")
out.write('</aida>\n')
sys.exit(0)
diff --git a/UnderlyingEvent/MPIHandler.cc b/UnderlyingEvent/MPIHandler.cc
--- a/UnderlyingEvent/MPIHandler.cc
+++ b/UnderlyingEvent/MPIHandler.cc
@@ -1,712 +1,720 @@
// -*- C++ -*-
//
// MPIHandler.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MPIHandler class.
//
#include "MPIHandler.h"
#include "ThePEG/Handlers/StandardXComb.h"
#include "ThePEG/Handlers/SubProcessHandler.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/RefVector.h"
#include "ThePEG/Interface/ParVector.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/MatrixElement/MEBase.h"
#include "ThePEG/Handlers/CascadeHandler.h"
#include "ThePEG/Cuts/Cuts.h"
#include "ThePEG/Cuts/SimpleKTCut.h"
#include "gsl/gsl_sf_bessel.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
bool MPIHandler::beamOK() const {
return (HadronMatcher::Check(*eventHandler()->incoming().first) &&
HadronMatcher::Check(*eventHandler()->incoming().second) );
}
tStdXCombPtr MPIHandler::generate(unsigned int sel) {
//generate a certain process
if(sel+1 > processHandlers().size())
throw Exception() << "MPIHandler::generate called with argument out of range"
<< Exception::runerror;
return processHandlers()[sel]->generate();
}
IBPtr MPIHandler::clone() const {
return new_ptr(*this);
}
IBPtr MPIHandler::fullclone() const {
return new_ptr(*this);
}
void MPIHandler::finalize() {
if( beamOK() ){
statistics();
}
}
void MPIHandler::initialize() {
useMe();
theHandler = generator()->currentEventHandler();
//stop if the EventHandler is not present:
assert(theHandler);
//check if MPI is wanted
if( !beamOK() ){
throw Exception() << "You have requested multiple parton-parton scattering,\n"
<< "but the model is not forseen for the beam setup you chose.\n"
<< "You should therefore disable that by setting XXXGenerator:EventHandler:"
<< "CascadeHandler:MPIHandler to NULL"
<< Exception::runerror;
}
numSubProcs_ = subProcesses().size();
if( numSubProcs_ != cuts().size() )
throw Exception() << "MPIHandler::each SubProcess needs a Cuts Object"
<< "ReferenceVectors are not equal in size"
<< Exception::runerror;
if( additionalMultiplicities_.size()+1 != numSubProcs_ )
throw Exception() << "MPIHandler: each additional SubProcess needs "
<< "a multiplicity assigned. This can be done in with "
<< "insert MPIHandler:additionalMultiplicities 0 1"
<< Exception::runerror;
//identicalToUE_ = 0 hard process is identical to ue, -1 no one
if( identicalToUE_ > (int)numSubProcs_ || identicalToUE_ < -1 )
throw Exception() << "MPIHandler:identicalToUE has disallowed value"
<< Exception::runerror;
tcPDPtr gluon=getParticleData(ParticleID::g);
//determine ptmin
Ptmin_ = cuts()[0]->minKT(gluon);
if(identicalToUE_ == -1){
algorithm_ = 2;
}else{
if(identicalToUE_ == 0){
//Need to work a bit, in case of LesHouches events for QCD2to2
if( dynamic_ptr_cast<Ptr<StandardEventHandler>::pointer>(eventHandler()) ){
PtOfQCDProc_ = dynamic_ptr_cast
<Ptr<StandardEventHandler>::pointer>(eventHandler())->cuts()->minKT(gluon);
}else{
if(PtOfQCDProc_ == -1.0*GeV)
throw Exception() << "MPIHandler: You need to specify the pt cutoff "
<< "used to in the LesHouches file for QCD2to2 events"
<< Exception::runerror;
}
}else{
PtOfQCDProc_ = cuts()[identicalToUE_]->minKT(gluon);
}
if(PtOfQCDProc_ > 2*Ptmin_)
algorithm_ = 1;
else
algorithm_ = 0;
if(PtOfQCDProc_ == ZERO)//pure MinBias mode
algorithm_ = -1;
}
//Init all subprocesses
for(unsigned int i=0; i<numSubProcs_; i++){
theProcessHandlers.push_back(new_ptr(ProcessHandler()));
processHandlers().back()->initialize(subProcesses()[i],
cuts()[i], eventHandler());
processHandlers().back()->initrun();
}
//now calculate the individual Probabilities
XSVector UEXSecs;
UEXSecs.push_back(processHandlers()[0]->integratedXSec());
//save the hard cross section
hardXSec_ = UEXSecs.front();
//determine sigma_soft and beta
if(softInt_){//check that soft ints are requested
GSLBisection rootFinder;
if(twoComp_){
//two component model
/*
GSLMultiRoot eqSolver;
slopeAndTotalXSec eq(this);
pair<CrossSection, Energy2> res = eqSolver.value(eq, 10*millibarn, 0.6*GeV2);
softXSec_ = res.first;
softMu2_ = res.second;
*/
slopeBisection fs(this);
try{
softMu2_ = rootFinder.value(fs, 0.3*GeV2, 1.*GeV2);
softXSec_ = fs.softXSec();
}catch(GSLBisection::IntervalError){
- throw Exception() << "MPIHandler parameter choice is unable to reproduce "
- << "the total cross section. Please check arXiv:0806.2949 "
- << "for the allowed parameter space."
+ throw Exception() <<
+ "\n**********************************************************\n"
+ "* Inconsistent MPI parameter choice for this beam energy *\n"
+ "**********************************************************\n"
+ "MPIHandler parameter choice is unable to reproduce\n"
+ "the total cross section. Please check arXiv:0806.2949\n"
+ "for the allowed parameter space."
<< Exception::runerror;
}
}else{
//single component model
TotalXSecBisection fn(this);
try{
softXSec_ = rootFinder.value(fn, 0*millibarn, 5000*millibarn);
}catch(GSLBisection::IntervalError){
- throw Exception() << "MPIHandler parameter choice is unable to reproduce "
- << "the total cross section. Please check arXiv:0806.2949 "
- << "for the allowed parameter space."
- << Exception::runerror;
+ throw Exception() <<
+ "\n**********************************************************\n"
+ "* Inconsistent MPI parameter choice for this beam energy *\n"
+ "**********************************************************\n"
+ "MPIHandler parameter choice is unable to reproduce\n"
+ "the total cross section. Please check arXiv:0806.2949\n"
+ "for the allowed parameter space."
+ << Exception::runerror;
}
}
//now get the differential cross section at ptmin
ProHdlPtr qcd = new_ptr(ProcessHandler());
Energy eps = 0.1*GeV;
Energy ptminPlus = Ptmin_ + eps;
Ptr<SimpleKTCut>::pointer ktCut = new_ptr(SimpleKTCut(ptminPlus));
ktCut->init();
ktCut->initrun();
CutsPtr qcdCut = new_ptr(Cuts(2*ptminPlus));
qcdCut->add(dynamic_ptr_cast<tOneCutPtr>(ktCut));
qcdCut->init();
qcdCut->initrun();
qcd->initialize(subProcesses()[0], qcdCut, eventHandler());
qcd->initrun();
// ds/dp_T^2 = 1/2/p_T ds/dp_T
DiffXSec hardPlus = (hardXSec_-qcd->integratedXSec())/(2*Ptmin_*eps);
betaBisection fn2(softXSec_, hardPlus, Ptmin_);
try{
beta_ = rootFinder.value(fn2, -10/GeV2, 2/GeV2);
}catch(GSLBisection::IntervalError){
throw Exception() << "MPIHandler: slope of soft pt spectrum couldn't be "
<< "determined."
<< Exception::runerror;
}
}
Probs(UEXSecs);
//MultDistribution("probs.test");
UEXSecs.clear();
}
void MPIHandler::MultDistribution(string filename) const {
ofstream file;
double p(0.0), pold(0.0);
file.open(filename.c_str());
//theMultiplicities
Selector<MPair>::const_iterator it = theMultiplicities.begin();
while(it != theMultiplicities.end()){
p = it->first;
file << it->second.first << " " << it->second.second
<< " " << p-pold << '\n';
it++;
pold = p;
}
file << "sum of all probabilities: " << theMultiplicities.sum()
<< endl;
file.close();
}
void MPIHandler::statistics() const {
ostream & file = generator()->misc();
string line = "======================================="
"=======================================\n";
for(unsigned int i=0; i<cuts().size(); i++){
Stat tot;
if(i == 0)
file << "Statistics for the UE process: \n";
else
file << "Statistics for additional hard Process " << i << ": \n";
processHandlers()[i]->statistics(file, tot);
file << "\n";
}
if(softInt_){
file << line
<< "Eikonalized and soft cross sections:\n\n"
<< "Model parameters: "
<< "ptmin: " << Ptmin_/GeV << " GeV"
<< ", mu2: " << invRadius_/sqr(1.*GeV) << " GeV2\n"
<< " "
<< "DL mode: " << DLmode_
<< ", CMenergy: " << generator()->maximumCMEnergy()/GeV
<< " GeV" << '\n'
<< "hard inclusive cross section (mb): "
<< hardXSec_/millibarn << '\n'
<< "soft inclusive cross section (mb): "
<< softXSec_/millibarn << '\n'
<< "total cross section (mb): "
<< totalXSecExp()/millibarn << '\n'
<< "inelastic cross section (mb): "
<< inelXSec_/millibarn << '\n'
<< "soft inv radius (GeV2): "
<< softMu2_/GeV2 << '\n'
<< "slope of soft pt spectrum (1/GeV2): "
<< beta_*sqr(1.*GeV) << '\n'
<< "Average hard multiplicity: "
<< avgNhard_ << '\n'
<< "Average soft multiplicity: "
<< avgNsoft_ << '\n' << line << endl;
}else{
file << line
<< "Eikonalized and soft cross sections:\n\n"
<< "Model parameters: "
<< "ptmin: " << Ptmin_/GeV << " GeV"
<< ", mu2: " << invRadius_/sqr(1.*GeV) << " GeV2\n"
<< " "
<< ", CMenergy: " << generator()->maximumCMEnergy()/GeV
<< " GeV" << '\n'
<< "hard inclusive cross section (mb): "
<< hardXSec_/millibarn << '\n'
<< "Average hard multiplicity: "
<< avgNhard_ << '\n' << line << endl;
}
}
unsigned int MPIHandler::multiplicity(unsigned int sel){
if(sel==0){//draw from the pretabulated distribution
MPair m = theMultiplicities.select(UseRandom::rnd());
softMult_ = m.second;
return m.first;
} else{ //fixed multiplicities for the additional hard scatters
if(additionalMultiplicities_.size() < sel)
throw Exception() << "MPIHandler::multiplicity: process index "
<< "is out of range"
<< Exception::runerror;
return additionalMultiplicities_[sel-1];
}
}
void MPIHandler::Probs(XSVector UEXSecs) {
GSLIntegrator integrator;
unsigned int iH(1), iS(0);
double P(0.0);
double P0(0.0);//the probability for i hard and zero soft scatters
Length bmax(500.0*sqrt(millibarn));
//only one UE process will be drawn from a probability distribution,
//so check that.
assert(UEXSecs.size() == 1);
for ( XSVector::const_iterator it = UEXSecs.begin();
it != UEXSecs.end(); ++it ) {
iH = 0;
//get the inel xsec
Eikonalization inelint(this, -1, *it, softXSec_, softMu2_);
inelXSec_ = integrator.value(inelint, ZERO, bmax);
avgNhard_ = 0.0;
avgNsoft_ = 0.0;
bmax = 10.0*sqrt(millibarn);
do{//loop over hard ints
if(Algorithm()>-1 && iH==0){
iH++;
continue;
}
iS = 0;
do{//loop over soft ints
if( ( Algorithm() == -1 && iS==0 && iH==0 ) ){
iS++;
continue;
}
Eikonalization integrand(this, iH*100+iS, *it, softXSec_, softMu2_);
if(Algorithm() > 0){
P = integrator.value(integrand, ZERO, bmax) / *it;
}else{
P = integrator.value(integrand, ZERO, bmax) / inelXSec_;
}
//store the probability
if(Algorithm()>-1){
theMultiplicities.insert(P, make_pair(iH-1, iS));
avgNhard_ += P*(iH-1);
}else{
theMultiplicities.insert(P, make_pair(iH, iS));
avgNhard_ += P*(iH);
}
avgNsoft_ += P*iS;
if(iS==0)
P0 = P;
iS++;
} while ( (iS < maxScatters_) && (iS < 5 || P > 1.e-15 ) && softInt_ );
iH++;
} while ( (iH < maxScatters_) && (iH < 5 || P0 > 1.e-15) );
}
}
// calculate the integrand
Length Eikonalization::operator() (Length b) const {
unsigned int Nhard(0), Nsoft(0);
//fac is just: d^2b=fac*db despite that large number
Length fac(Constants::twopi*b);
double chiTot(( theHandler->OverlapFunction(b)*hardXSec_ +
theHandler->OverlapFunction(b, softMu2_)*softXSec_ ) / 2.0);
//total cross section wanted
if(theoption == -2) return 2 * fac * ( 1 - exp(-chiTot) );
//inelastic cross section
if(theoption == -1) return fac * ( 1 - exp(- 2.0 * chiTot) );
if(theoption >= 0){
//encode multiplicities as: N_hard*100 + N_soft
Nhard = theoption/100;
Nsoft = theoption%100;
if(theHandler->Algorithm() > 0){
//P_n*sigma_hard: n-1 extra scatters + 1 hard scatterer != hardXSec_
return fac * Nhard * theHandler->poisson(b, hardXSec_, Nhard) *
theHandler->poisson(b, softXSec_, Nsoft, softMu2_);
}else{
//P_n*sigma_inel: n extra scatters
return fac * theHandler->poisson(b, hardXSec_, Nhard) *
theHandler->poisson(b, softXSec_, Nsoft, softMu2_);
}
}else{
throw Exception() << "Parameter theoption in Struct Eikonalization in "
<< "MPIHandler.cc has not allowed value"
<< Exception::runerror;
return 0.0*meter;
}
}
InvEnergy2 slopeBisection::operator() (Energy2 softMu2) const {
GSLBisection root;
//single component model
TotalXSecBisection fn(handler_, softMu2);
try{
softXSec_ = root.value(fn, 0*millibarn, 5000*millibarn);
}catch(GSLBisection::IntervalError){
throw Exception() << "MPIHandler 2-Component model didn't work out."
<< Exception::runerror;
}
return handler_->slopeDiff(softXSec_, softMu2);
}
LengthDiff slopeInt::operator() (Length b) const {
//fac is just: d^2b=fac*db
Length fac(Constants::twopi*b);
double chiTot(( handler_->OverlapFunction(b)*hardXSec_ +
handler_->OverlapFunction(b, softMu2_)*softXSec_ ) / 2.0);
InvEnergy2 b2 = sqr(b/hbarc);
//B*sigma_tot
return fac * b2 * ( 1 - exp(-chiTot) );
}
double MPIHandler::factorial (unsigned int n) const {
double f[] = {1.,1.,2.,6.,24.,120.,720.,5040.,40320.,362880.,3.6288e6,
3.99168e7,4.790016e8,6.2270208e9,8.71782912e10,1.307674368e12,
2.0922789888e13,3.55687428096e14,6.402373705728e15,1.21645100408832e17,
2.43290200817664e18,5.10909421717094e19,1.12400072777761e21,
2.5852016738885e22,6.20448401733239e23,1.5511210043331e25,
4.03291461126606e26,1.08888694504184e28,3.04888344611714e29,
8.8417619937397e30,2.65252859812191e32,8.22283865417792e33,
2.63130836933694e35,8.68331761881189e36,2.95232799039604e38,
1.03331479663861e40,3.71993326789901e41,1.37637530912263e43,
5.23022617466601e44,2.03978820811974e46,8.15915283247898e47,
3.34525266131638e49,1.40500611775288e51,6.04152630633738e52,
2.65827157478845e54,1.1962222086548e56,5.50262215981209e57,
2.58623241511168e59,1.24139155925361e61,6.08281864034268e62,
3.04140932017134e64,1.55111875328738e66,8.06581751709439e67,
4.27488328406003e69,2.30843697339241e71,1.26964033536583e73,
7.10998587804863e74,4.05269195048772e76,2.35056133128288e78,
1.3868311854569e80,8.32098711274139e81,5.07580213877225e83,
3.14699732603879e85,1.98260831540444e87,1.26886932185884e89,
8.24765059208247e90,5.44344939077443e92,3.64711109181887e94,
2.48003554243683e96,1.71122452428141e98,1.19785716699699e100,
8.50478588567862e101,6.12344583768861e103,4.47011546151268e105,
3.30788544151939e107,2.48091408113954e109,1.88549470166605e111,
1.45183092028286e113,1.13242811782063e115,8.94618213078298e116,
7.15694570462638e118,5.79712602074737e120,4.75364333701284e122,
3.94552396972066e124,3.31424013456535e126,2.81710411438055e128,
2.42270953836727e130,2.10775729837953e132,1.85482642257398e134,
1.65079551609085e136,1.48571596448176e138,1.3520015276784e140,
1.24384140546413e142,1.15677250708164e144,1.08736615665674e146,
1.03299784882391e148,9.9167793487095e149,9.61927596824821e151,
9.42689044888325e153,9.33262154439442e155,9.33262154439442e157};
if(n > maxScatters_)
throw Exception() << "MPIHandler::factorial called with too large argument"
<< Exception::runerror;
else
return f[n];
}
InvArea MPIHandler::OverlapFunction(Length b, Energy2 mu2) const {
if(mu2 == ZERO)
mu2 = invRadius_;
InvLength mu = sqrt(mu2)/hbarc;
return (sqr(mu)/96/Constants::pi)*pow(mu*b, 3)*(gsl_sf_bessel_Kn(3, mu*b));
}
double MPIHandler::poisson(Length b, CrossSection sigma, unsigned int N, Energy2 mu2) const {
if(sigma > 0*millibarn){
return pow(OverlapFunction(b, mu2)*sigma, (double)N)/factorial(N)
*exp(-OverlapFunction(b, mu2)*sigma);
}else{
return (N==0) ? 1.0 : 0.0;
}
}
CrossSection MPIHandler::totalXSecDiff(CrossSection softXSec,
Energy2 softMu2) const {
GSLIntegrator integrator;
Eikonalization integrand(this, -2, hardXSec_, softXSec, softMu2);
Length bmax = 500.0*sqrt(millibarn);
CrossSection tot = integrator.value(integrand, ZERO, bmax);
return (tot-totalXSecExp());
}
InvEnergy2 MPIHandler::slopeDiff(CrossSection softXSec,
Energy2 softMu2) const {
GSLIntegrator integrator;
Eikonalization integrand(this, -2, hardXSec_, softXSec, softMu2);
Length bmax = 500.0*sqrt(millibarn);
CrossSection tot = integrator.value(integrand, ZERO, bmax);
slopeInt integrand2(this, hardXSec_, softXSec, softMu2);
return integrator.value(integrand2, ZERO, bmax)/tot - slopeExp();
}
CrossSection MPIHandler::totalXSecExp() const {
if(totalXSecExp_ != 0*millibarn)
return totalXSecExp_;
double pom_old = 0.0808;
CrossSection coef_old = 21.7*millibarn;
double pom_new_hard = 0.452;
CrossSection coef_new_hard = 0.0139*millibarn;
double pom_new_soft = 0.0667;
CrossSection coef_new_soft = 24.22*millibarn;
Energy energy(generator()->maximumCMEnergy());
switch(DLmode_){
case 1://old DL extrapolation
return coef_old * pow(energy/GeV, 2*pom_old);
break;
case 2://old DL extrapolation fixed to CDF
return 81.8*millibarn * pow(energy/1800.0/GeV, 2*pom_old);
break;
case 3://new DL extrapolation
return coef_new_hard * pow(energy/GeV, 2*pom_new_hard) +
coef_new_soft * pow(energy/GeV, 2*pom_new_soft);
break;
default:
throw Exception() << "MPIHandler::totalXSecExp non-existing mode selected"
<< Exception::runerror;
}
}
InvEnergy2 MPIHandler::slopeExp() const{
//Currently return the slope as calculated in the pomeron fit by
//Donnachie & Landshoff
Energy energy(generator()->maximumCMEnergy());
//slope at
Energy e_0 = 1800*GeV;
InvEnergy2 b_0 = 17/GeV2;
return b_0 + log(energy/e_0)/GeV2;
}
void MPIHandler::persistentOutput(PersistentOStream & os) const {
os << theMultiplicities << theHandler
<< theSubProcesses << theCuts << theProcessHandlers
<< additionalMultiplicities_ << identicalToUE_
<< ounit(PtOfQCDProc_, GeV) << ounit(Ptmin_, GeV)
<< ounit(hardXSec_, millibarn) << ounit(softXSec_, millibarn)
<< ounit(beta_, 1/GeV2)
<< algorithm_ << ounit(invRadius_, GeV2)
<< numSubProcs_ << colourDisrupt_ << softInt_ << twoComp_
<< DLmode_ << ounit(totalXSecExp_, millibarn);
}
void MPIHandler::persistentInput(PersistentIStream & is, int) {
is >> theMultiplicities >> theHandler
>> theSubProcesses >> theCuts >> theProcessHandlers
>> additionalMultiplicities_ >> identicalToUE_
>> iunit(PtOfQCDProc_, GeV) >> iunit(Ptmin_, GeV)
>> iunit(hardXSec_, millibarn) >> iunit(softXSec_, millibarn)
>> iunit(beta_, 1/GeV2)
>> algorithm_ >> iunit(invRadius_, GeV2)
>> numSubProcs_ >> colourDisrupt_ >> softInt_ >> twoComp_
>> DLmode_ >> iunit(totalXSecExp_, millibarn);
}
ClassDescription<MPIHandler> MPIHandler::initMPIHandler;
// Definition of the static class description member.
void MPIHandler::Init() {
static ClassDocumentation<MPIHandler> documentation
("The MPIHandler class is the main administrator of the multiple interaction model",
"The underlying event was simulated with an eikonal model for multiple partonic interactions."
"Details can be found in Ref.~\\cite{Bahr:2008dy,Bahr:2009ek}.",
"%\\cite{Bahr:2008dy}\n"
"\\bibitem{Bahr:2008dy}\n"
" M.~Bahr, S.~Gieseke and M.~H.~Seymour,\n"
" ``Simulation of multiple partonic interactions in Herwig++,''\n"
" JHEP {\\bf 0807}, 076 (2008)\n"
" [arXiv:0803.3633 [hep-ph]].\n"
" %%CITATION = JHEPA,0807,076;%%\n"
"\\bibitem{Bahr:2009ek}\n"
" M.~Bahr, J.~M.~Butterworth, S.~Gieseke and M.~H.~Seymour,\n"
" ``Soft interactions in Herwig++,''\n"
" arXiv:0905.4671 [hep-ph].\n"
" %%CITATION = ARXIV:0905.4671;%%\n"
);
static RefVector<MPIHandler,SubProcessHandler> interfaceSubhandlers
("SubProcessHandlers",
"The list of sub-process handlers used in this EventHandler. ",
&MPIHandler::theSubProcesses, -1, false, false, true, false, false);
static RefVector<MPIHandler,Cuts> interfaceCuts
("Cuts",
"List of cuts used for the corresponding list of subprocesses. These cuts "
"should not be overidden in individual sub-process handlers.",
&MPIHandler::theCuts, -1, false, false, true, false, false);
static Parameter<MPIHandler,Energy2> interfaceInvRadius
("InvRadius",
"The inverse hadron radius squared used in the overlap function",
&MPIHandler::invRadius_, GeV2, 2.0*GeV2, 0.2*GeV2, 4.0*GeV2,
true, false, Interface::limited);
static ParVector<MPIHandler,int> interfaceadditionalMultiplicities
("additionalMultiplicities",
"specify the multiplicities of secondary hard processes (multiple parton scattering)",
&MPIHandler::additionalMultiplicities_,
-1, 0, 0, 3,
false, false, true);
static Parameter<MPIHandler,int> interfaceIdenticalToUE
("IdenticalToUE",
"Specify which of the hard processes is identical to the UE one (QCD dijets)",
&MPIHandler::identicalToUE_, -1, 0, 0,
false, false, Interface::nolimits);
static Parameter<MPIHandler,Energy> interfacePtOfQCDProc
("PtOfQCDProc",
"Specify the value of the pt cutoff for the process that is identical to the UE one",
&MPIHandler::PtOfQCDProc_, GeV, -1.0*GeV, ZERO, ZERO,
false, false, Interface::nolimits);
static Parameter<MPIHandler,double> interfacecolourDisrupt
("colourDisrupt",
"Fraction of connections to additional subprocesses, which are colour disrupted.",
&MPIHandler::colourDisrupt_,
0.0, 0.0, 1.0,
false, false, Interface::limited);
static Switch<MPIHandler,bool> interfacesoftInt
("softInt",
"Switch to enable soft interactions",
&MPIHandler::softInt_, true, false, false);
static SwitchOption interfacesoftIntYes
(interfacesoftInt,
"Yes",
"enable the two component model",
true);
static SwitchOption interfacesoftIntNo
(interfacesoftInt,
"No",
"disable the model",
false);
static Switch<MPIHandler,bool> interfacetwoComp
("twoComp",
"switch to enable the model with a different radius for soft interactions",
&MPIHandler::twoComp_, true, false, false);
static SwitchOption interfacetwoCompYes
(interfacetwoComp,
"Yes",
"enable the two component model",
true);
static SwitchOption interfacetwoCompNo
(interfacetwoComp,
"No",
"disable the model",
false);
static Parameter<MPIHandler,CrossSection> interfaceMeasuredTotalXSec
("MeasuredTotalXSec",
"Value for the total cross section (assuming rho=0). If non-zero, this "
"overwrites the Donnachie-Landshoff parametrizations.",
&MPIHandler::totalXSecExp_, millibarn, 0.0*millibarn, 0.0*millibarn, 0*millibarn,
false, false, Interface::lowerlim);
static Switch<MPIHandler,unsigned int> interfaceDLmode
("DLmode",
"Choice of Donnachie-Landshoff parametrization for the total cross section.",
&MPIHandler::DLmode_, 2, false, false);
static SwitchOption interfaceDLmodeStandard
(interfaceDLmode,
"Standard",
"Standard parametrization with s**0.08",
1);
static SwitchOption interfaceDLmodeCDF
(interfaceDLmode,
"CDF",
"Standard parametrization but normalization fixed to CDF's measured value",
2);
static SwitchOption interfaceDLmodeNew
(interfaceDLmode,
"New",
"Parametrization taking hard and soft pomeron contributions into account",
3);
}
diff --git a/UnderlyingEvent/UA5Handler.cc b/UnderlyingEvent/UA5Handler.cc
--- a/UnderlyingEvent/UA5Handler.cc
+++ b/UnderlyingEvent/UA5Handler.cc
@@ -1,688 +1,688 @@
// -*- C++ -*-
//
// UA5Handler.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#include <ThePEG/Repository/UseRandom.h>
#include "UA5Handler.h"
#include <ThePEG/Interface/Reference.h>
#include <ThePEG/Interface/Parameter.h>
#include <ThePEG/Interface/Switch.h>
#include <ThePEG/PDT/DecayMode.h>
#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/Handlers/DecayHandler.h>
#include <ThePEG/Handlers/EventHandler.h>
#include "Herwig++/Hadronization/Cluster.h"
#include "Herwig++/Hadronization/ClusterFissioner.h"
#include "Herwig++/Hadronization/ClusterDecayer.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Utilities/Throw.h"
#include <cassert>
using namespace std;
using namespace ThePEG;
using namespace Herwig;
// Default constructor
UA5Handler::UA5Handler()
: _n1(9.11), _n2(0.115), _n3(-9.5), _k1(0.029), _k2(-0.104),
_m1(0.4*GeV), _m2(2./GeV), _p1(5.2/GeV), _p2(3.0/GeV), _p3(5.2/GeV),
_probSoft(1.0), _enhanceCM(1.), _maxtries(300), _needWarning(true)
{}
// Saving things into run file
void UA5Handler::persistentOutput(PersistentOStream &os) const {
os << clusterFissioner << clusterDecayer
<< _n1 << _n2 << _n3 << _k1 << _k2
<< ounit(_m1,GeV) << ounit(_m2,InvGeV)
<< ounit(_p1,InvGeV) << ounit(_p2,InvGeV) << ounit(_p3,InvGeV)
<< _probSoft << _enhanceCM << _maxtries << _needWarning;
}
// Reading them back in, in the same order
void UA5Handler::persistentInput(PersistentIStream &is, int) {
is >> clusterFissioner >> clusterDecayer
>> _n1 >> _n2 >> _n3 >> _k1 >> _k2
>> iunit(_m1,GeV) >> iunit(_m2,InvGeV)
>> iunit(_p1,InvGeV) >> iunit(_p2,InvGeV) >> iunit(_p3,InvGeV)
>> _probSoft >> _enhanceCM >> _maxtries >> _needWarning;
}
// We must define this static member for ThePEG
ClassDescription<UA5Handler> UA5Handler::initUA5Handler;
void UA5Handler::Init() {
static ClassDocumentation<UA5Handler> documentation
("This is the simple UA5 model for the underlying event.",
"The underlying event was simulated using the model of "
"the UA5 collaboration, \\cite{Alner:1986is}.",
"%\\cite{Alner:1986is}\n"
"\\bibitem{Alner:1986is}\n"
" G.~J.~Alner {\\it et al.} [UA5 Collaboration],\n"
" ``The UA5 High-Energy anti-p p Simulation Program,''\n"
" Nucl.\\ Phys.\\ B {\\bf 291}, 445 (1987).\n"
" %%CITATION = NUPHA,B291,445;%%\n"
);
static Reference<UA5Handler,ClusterFissioner>
interfaceClusterFissioner("ClusterFissioner",
"A reference to the ClusterFissioner object",
&Herwig::UA5Handler::clusterFissioner,
false,false,true,false);
static Reference<UA5Handler,ClusterDecayer>
interfaceClusterDecayer("ClusterDecayer",
"A reference to the ClusterDecayer object",
&Herwig::UA5Handler::clusterDecayer,
false,false,true,false);
static Parameter<UA5Handler,double> interfaceN1
("N1",
"The parameter n_1 in the mean charged multiplicity",
&UA5Handler::_n1, 9.110, 0.0, 100.0,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceN2
("N2",
"The parameter n_2 in the mean charged multiplicity",
&UA5Handler::_n2, 0.115, 0.0, 1.0,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceN3
("N3",
"The parameter n_3 in the mean charged multiplicity",
&UA5Handler::_n3, -9.500, -100.0, 100.0,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceK1
("K1",
"The parameter k_1 used to generate the multiplicity distribution",
&UA5Handler::_k1, 0.029, 0.0, 1.0,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceK2
("K2",
"The parameter k_2 used to generate the multiplicity distribution",
&UA5Handler::_k2, -0.104, -1.0, 1.0,
false, false, Interface::limited);
static Parameter<UA5Handler,Energy> interfaceM1
("M1",
"The parameter m_1 used to generate the cluster mass distribution.",
&UA5Handler::_m1, GeV, 0.4*GeV, ZERO, 10.0*GeV,
false, false, Interface::limited);
static Parameter<UA5Handler,InvEnergy> interfaceM2
("M2",
"The parameter m_2 used to generate the cluster mass distribution.",
&UA5Handler::_m2, 1./GeV, 2.0/GeV, 0.1/GeV, 10.0/GeV,
false, false, Interface::limited);
static Parameter<UA5Handler,InvEnergy> interfaceP1
("P1",
"Slope used to generate the pt of the u,d soft clusters",
&UA5Handler::_p1, 1./GeV, 5.2/GeV, 0.1/GeV, 10.0/GeV,
false, false, Interface::limited);
static Parameter<UA5Handler,InvEnergy> interfaceP2
("P2",
"Slope used to generate the pt of the s,c soft clusters",
&UA5Handler::_p2, 1./GeV, 3.0/GeV, 0.1/GeV, 10.0/GeV,
false, false, Interface::limited);
static Parameter<UA5Handler,InvEnergy> interfaceP3
("P3",
"Slope used to generate the pt of the qq soft clusters",
&UA5Handler::_p3, 1./GeV, 5.2/GeV, 0.1/GeV, 10.0/GeV,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceProbSoft
("ProbSoft",
"The probability of having a soft underlying event.",
&UA5Handler::_probSoft, 1.0, 0.0, 1.0,
false, false, Interface::limited);
static Parameter<UA5Handler,double> interfaceEnhanceCM
("EnhanceCM",
"Enhancement of the CM energy in the mult distribution",
&UA5Handler::_enhanceCM, 1.0, 0.0, 10.0,
false, false, Interface::limited);
static Parameter<UA5Handler,unsigned int> interfaceMaximumTries
("MaximumTries",
"The maximum number of attempts to generate the clusters",
&UA5Handler::_maxtries, 300, 100, 1000,
false, false, Interface::limited);
static Switch<UA5Handler,bool> interfaceWarning
("Warning",
"Whether to issue a warning if UA5 and MPI are on at the same time.",
&UA5Handler::_needWarning, true, false, false);
static SwitchOption interfaceWarningYes
(interfaceWarning,
"Yes",
"Warn if UA5 and MPI are on at the same time.",
true);
static SwitchOption interfaceWarningNo
(interfaceWarning,
"No",
"Print no warnings.",
false);
}
void UA5Handler::insertParticle(PPtr particle,StepPtr step,bool all) const
{
if(all) step->addDecayProduct(particle);
for(unsigned int ix=0; ix < particle->children().size(); ++ix) {
insertParticle(particle->children()[ix],step,true);
}
}
// This is all just administrative functions for ThePEG structure
IBPtr UA5Handler::clone() const { return new_ptr(*this); }
IBPtr UA5Handler::fullclone() const { return new_ptr(*this); }
// Generates the multiplicity of the charged particles for the energy E
unsigned int UA5Handler::multiplicity(Energy E) const {
double alogs = 2.*log(E/GeV);
double rk = _k1*alogs+_k2;
if(rk > 1000.) rk = 1000.;
double ek = 1./rk;
double mean = meanMultiplicity(E);
if(mean < 1.) mean = 1.;
vector<double> dist;
dist.reserve(500);
double sum = 0.0;
for(int i = 0; i<500; ++i) {
int N = (i+1)*2;
double negBin = negativeBinomial(N,mean,ek);
if(negBin < 1e-7*sum) break;
sum += negBin;
dist.push_back(sum);
}
unsigned int imax = dist.size();
if (imax==1)
dist[0]=1.;
else if (imax==500)
throw Exception() << "Multiplicity too large in UA5Handler::multiplicity()"
<< Exception::eventerror;
else {
for(unsigned int i = 0; i<imax; ++i)
dist[i] /= sum;
}
double rn = rnd();
unsigned int i=0;
for(; i<imax; ++i)
if(rn < dist[i]) break;
return 2*(i+1);
}
LorentzRotation UA5Handler::rotate(const LorentzMomentum &p) const {
LorentzRotation R;
static const double ptcut = 1e-20;
Energy2 pt2 = sqr(p.x())+sqr(p.y());
Energy2 pp2 = sqr(p.z())+pt2;
double phi, theta;
if(pt2 <= pp2*ptcut) {
if(p.z() > ZERO) theta = 0.;
else theta = Constants::pi;
phi = 0.;
} else {
Energy pp = sqrt(pp2);
Energy pt = sqrt(pt2);
double ct = p.z()/pp;
double cf = p.x()/pt;
phi = -acos(cf);
theta = acos(ct);
}
// Rotate first around the z axis to put p in the x-z plane
// Then rotate around the Y axis to put p on the z axis
R.rotateZ(phi).rotateY(theta);
return R;
}
void UA5Handler::performDecay(PPtr parent,int & totalcharge,int & numbercharge) const
{
// for an already decayed particle apply to children
if(!parent->children().empty())
{
for(unsigned int ix=0;ix<parent->children().size();++ix)
performDecay(parent->children()[ix],totalcharge,numbercharge);
}
// for a stable particle just add the charge
else if(parent->data().stable())
{
int charge = parent->data().iCharge()/3;
totalcharge += charge ;
numbercharge +=abs(charge);
}
// otherwise decay the particle
else
{
unsigned int ntry = 0,maxtry=100;
while (1)
{
// veto if too many tries
if(++ntry>=maxtry)
throw Exception() << "Too many attempts to decay " << parent->PDGName()
<< "in UA5Handler::performDecay(), probably needs a "
<< "partonic decay of a heavy hadron which isn't"
<< " implemented yet " << Exception::eventerror;
// select the decay mode
tDMPtr dm(parent->data().selectMode(*parent));
// throw event away if no decay mode
if ( !dm ) throw Exception() << "No decay mode for " << parent->PDGName()
<< "in UA5Handler::performDecay()"
<< Exception::eventerror;
// throw event away if no decayer
if( !dm->decayer() )
throw Exception() << "No decayer mode for " << parent->PDGName()
<< "in UA5Handler::performDecay()"
<< Exception::eventerror;
try
{
ParticleVector children = dm->decayer()->decay(*dm, *parent);
// decay generates decay products
if ( !children.empty() )
{
// special for partonic decays
// see if colour particles produced
for(unsigned int ix=0;ix<children.size();++ix)
{if(children[ix]->coloured()){throw Veto();}}
// set up parent
parent->decayMode(dm);
// add children
for ( int i = 0, N = children.size(); i < N; ++i )
{
children[i]->setLabVertex(parent->labDecayVertex());
parent->addChild(children[i]);
}
parent->scale(ZERO);
// loop over the children and decay
for ( int i = 0, N = children.size(); i < N; ++i )
{performDecay(children[i],totalcharge,numbercharge);}
return;
}
}
catch (Veto) {}
}
}
}
void UA5Handler::decayCluster(ClusterPtr cluster,bool single) const
{
PPair products = clusterDecayer->decayIntoTwoHadrons(cluster);
if(products.first == PPtr() || products.second == PPtr())
{
if(!single)
throw Exception() << "Can't decay cluster in UA5Handler::decayCluster()"
<< Exception::eventerror;
// decay the cluster to one hadron
Lorentz5Momentum mom = cluster->momentum();
LorentzPoint vert = cluster->vertex();
tcPDPtr ptrQ = cluster->particle(0)->dataPtr();
tPPtr newPtr = cluster->particle(1);
products=clusterFissioner->produceHadron(ptrQ,newPtr,
mom, vert);
// put the cluster and the hadron on mass-shell
Energy mass=products.first->nominalMass();
Lorentz5Momentum newp(ZERO,ZERO,ZERO,mass,mass);
cluster->set5Momentum(newp);
products.first->set5Momentum(newp);
cluster->addChild(products.first);
}
else
{
cluster->addChild(products.first);
cluster->addChild(products.second);
}
}
// This is the routine that is called to start the algorithm.
void UA5Handler::handle(EventHandler &ch, const tPVector &tagged,
const Hint &) {
// Warn if the event has multiple scatters.
// If so, UA5 often has been left on by accident.
if (_needWarning
&& ch.currentEvent()->primaryCollision()->subProcesses().size() > 1) {
static const string message = "\n\n"
"warning:\n"
" The use of UA5Handler for events with multiple hard subprocesses\n"
" is probably not intended as it applies two different models\n"
" of the underlying event at the same time.\n"
" UA5Handler can be disabled in the input files with\n"
" 'set stdCluHadHandler:UnderlyingEventHandler NULL'\n";
// here we should really ask the event handler
// for the name of the hadronization handler.
cerr << message
<< "\n This message can be disabled with\n 'set "
<< fullName() << ":Warning No'\n\n";
Throw<Exception>() << message << Exception::warning;
_needWarning = false;
}
// create a new step for the products
StepPtr newstep = newStep();
// Constants that should not need changing.
static const Length vclx = 4e-12*mm;
static const Length vcly = 4e-12*mm;
static const Length vclz = 4e-12*mm;
static const Length vclt = 4e-12*mm;
// Find the first two clusters
// Lets find the clusters, set the partons inside to be on shell and no momentum
tClusterPtr clu[2];
tPVector::const_iterator it;
unsigned int i = 0;
for(it = tagged.begin(); it!=tagged.end(); ++it) {
- if((*it)->id() != ExtraParticleID::Cluster) continue;
+ if((*it)->id() != ParticleID::Cluster) continue;
clu[i] = dynamic_ptr_cast<ClusterPtr>(*it);
++i;
if(i>2) throw Exception() << "Must have at most two beam clusters in "
<< "UA5Handler::handle "
<< Exception::eventerror;
}
if(i == 0) return;
if(i!=2) throw Exception() << "Must have two and only two beam clusters in "
<< "UA5Handler::handle "
<< Exception::eventerror;
// if not generating the soft underlying event
// just hadronize and decay the two clusters
if(rnd()>_probSoft)
{
for(int i =0; i<2; i++) {
ClusterPtr cluster = clu[i];
decayCluster(cluster,false);
int totalcharge(0),numbercharge(0);
for(unsigned int ix=0;ix<cluster->children().size();++ix)
{performDecay(cluster->children()[ix],totalcharge,numbercharge);}
insertParticle(cluster,newstep,false);
}
// don't to the rest
return;
}
useMe();
// and their cm
Lorentz5Momentum cm = clu[0]->momentum() + clu[1]->momentum();
Energy theCM = cm.mass();
// softCM = sqrt(S) with optional enhancement for multiplicity only
// (name of variable not very reasonable any more...)
Lorentz5Momentum pcm=
ch.currentEvent()->incoming().first ->momentum()+
ch.currentEvent()->incoming().second->momentum();
Energy softCM = _enhanceCM*pcm.m();
long id1(0),id2(0),id3= rndbool() ? ParticleID::u : ParticleID::d;
// storage for the multiplicity
int nppbar = 0;
// Loop until we find a match to the charge multiplicity
unsigned int ntry = 0;
vector<ClusterPtr> clusters;
bool multiplicityReached = false;
while(!multiplicityReached && ntry < _maxtries) {
PPtr part1, part2;
// reset multiplicity every 50 tries
if(ntry % 50 == 0) nppbar = multiplicity(softCM);
++ntry;
unsigned int numberCluster = 0;
int theMult = nppbar;
Energy sumMasses = ZERO;
// delete the particles from the previous attempt if needed
if(ntry > 1) clusters.clear();
int numCharge = 0;
bool newCluster = true;
while(newCluster) {
ClusterPtr cluster;
// Choose new constituents
if(numberCluster < 2) {
part1 = clu[numberCluster]->particle(0);
part2 = clu[numberCluster]->particle(1);
id1 = part1->id();
id2 = part2->id();
cluster = new_ptr(Cluster(part1,part2));
} else {
id1 = -id2;
if(numberCluster == 2) id1 = id3;
id2 = rndbool() ? ParticleID::ubar : ParticleID::dbar;
part1 = getParticle(id1);
part2 = getParticle(id2);
cluster = new_ptr(Cluster(part1,part2));
}
// Mass = Random number from dN/d(x**2)=exp(-b*x) with mean 1/M2
Energy newMass =
getParticleData(id1)->constituentMass() +
getParticleData(id2)->constituentMass()
+ _m1 - log(rnd()*rnd())/_m2;
// set momentum of the cluster
Lorentz5Momentum cp(ZERO,ZERO,ZERO,newMass,newMass);
cluster->set5Momentum(cp);
// Now the gaussian distribution of the x,y,z components,
// and a time component given by
// sqrt(vx^2+vy^2+vz^2) - vclt*log(r)
Length vx = gaussDistribution(0.*mm,vclx);
Length vy = gaussDistribution(0.*mm,vcly);
Length vz = gaussDistribution(0.*mm,vclz);
LorentzPoint vert(vx,vy,vz, sqrt(sqr(vx)+sqr(vy)+sqr(vz)) - vclt*log(rnd()));
cluster->setVertex(vert);
// Now need to measure displacement relative to soft cm (TODO:)
// Fortran code sets the vertex of the primary incoming particle to 0
// then during boosting it adds the value of the vertex of particle 3 (???)
// to all the particles
// for now I will not implement this. Perhaps Mike can decide if this is
// needed, as he added this code to the fortran code on 07/03/05.
// Add the cluster to the list
clusters.push_back(cluster);
// Now we decay the clusters into hadrons
decayCluster(cluster,true);
// sum of the cluster masses
sumMasses += cluster->mass();
// Now decay the hadrons into stable particles
int totalcharge(0),numbercharge(0);
for(unsigned int ix=0;ix<cluster->children().size();++ix)
{performDecay(cluster->children()[ix],totalcharge,numbercharge);}
numCharge+=numbercharge;
if(numberCluster == 0) theMult = nppbar+abs(totalcharge);
if(numberCluster == 1) theMult += abs(totalcharge);
if(numberCluster == 1 && theMult < 0) theMult += 2;
numberCluster++;
// Now check which loop to do next
if(numCharge < theMult) continue;
else if(numCharge > theMult) { newCluster = false; }
else { newCluster = false; multiplicityReached = true; }
}
// Now check the physical mass/energy boundary
if(multiplicityReached && (sumMasses > theCM || clusters.size()<2))
{ multiplicityReached = false; }
}
// Catch case of too many attempts
if(ntry == _maxtries) {
// Just hadronize and decay the two clusters
for(int i =0; i<2; i++) {
ClusterPtr cluster = clu[i];
decayCluster(cluster,false);
int totalcharge(0),numbercharge(0);
for(unsigned int ix=0;ix<cluster->children().size();++ix)
{performDecay(cluster->children()[ix],totalcharge,numbercharge);}
insertParticle(cluster,newstep,false);
}
// don't to the rest
return;
}
// Now generate momentum of the clusters
generateMomentum(clu[0],clu[1],clusters, theCM, cm);
// insert the particles into the event record
for(unsigned int ix=0;ix<clusters.size();++ix) {
clu[0]->addChild(clusters[ix]);
clu[1]->addChild(clusters[ix]);
newstep->addDecayProduct(clusters[ix]);
}
for(unsigned int ix=0;ix<clusters.size();++ix) {
insertParticle(clusters[ix],newstep,false);
}
}
// Generate the momentum. This is based on the procedure of
// Jadach from Computer Physics Communications 9 (1975) 297-304
void UA5Handler::generateMomentum(tClusterPtr clu1, tClusterPtr clu2,
const ClusterVector &clusters,
Energy CME, const Lorentz5Momentum & cm)
const {
// begin with the cylindrical phase space generation described in the paper of Jadach
generateCylindricalPS(clusters, CME);
// boost momentum of incoming cluster along z axis to cluster cmf frame
if(clu2->momentum().z()>ZERO) swap(clu1,clu2);
LorentzMomentum bmp = clu1->momentum();
bmp = bmp.boost(cm.findBoostToCM());
// Rotation to put bmp on the z axis
LorentzRotation R = rotate(bmp);
// We need to use the inverse
R = R.inverse();
Boost boostv=cm.boostVector();
for(unsigned int i = 0; i<clusters.size(); i++) {
// So we now take each cluster and transform it according to the
// rotation defined above
Lorentz5Momentum origP = clusters[i]->momentum();
clusters[i]->transform(R);
// Then we transform back to the lab frame (away from cm frame)
Lorentz5Momentum oldP = clusters[i]->momentum();
Lorentz5Momentum newP=oldP;
try {
newP.boost(boostv);
clusters[i]->deepBoost(newP.boostVector());
clusters[i]->set5Momentum(newP);
} catch(exception &e) {
cerr << "Caught an problem boosting. " << e.what() << endl;
cerr << "Must decide how to handle this..." << endl;
cerr << "Old p = " << oldP/GeV << endl << "New p = " << newP/GeV << endl;
cerr << "This is from cluster " << *clusters[i] << " and has z component > energy" << endl;
cerr << "Cluster 0 is = " << *clusters[0] << endl;
cerr << "Original momentum = " << origP/GeV << endl;
cerr << "The cm vector is = " << cm/GeV << endl;
cerr << "Mass error of original momentum is " << origP.massError() << endl;
throw Veto();
}
}
}
void UA5Handler::generateCylindricalPS(const ClusterVector &clusters, Energy CME) const {
assert(clusters.size()>=2);
double alog = log(CME*CME/GeV2);
unsigned int ncl = clusters.size();
// calculate the slope parameters for the different clusters
// outside loop to save time
vector<InvEnergy> slope(ncl);
vector<Lorentz5Momentum> mom(ncl);
for(unsigned int ix=0;ix<ncl;++ix)
{
// Decide between three options
// If the q-qbar pair used to create the hadrons from the cluster is u or d, option1
// If the q-qbar pair is a c or s, option 2
// if the q-qbar pair is a diquark, option 3
// if their was no q-qbar pair (for cluster->hadron) then option 1
long id1=clusters[ix]->particle(0)->id();
long hadId = clusters[ix]->children()[0]->id();
long ids[3]={(abs(hadId)/10)%10,(abs(hadId)/100)%10,(abs(hadId)/1000)%10};
if(ids[2] != 0 && hadId < 0) { ids[2] = -ids[2]; ids[1] = -ids[1]; ids[0] = -ids[0]; }
else if(ids[2] == 0 && hadId < 0) ids[1] = -ids[1];
else if(ids[2]) ids[0] = -ids[0];
if(ids[2] == 0) {
long newId = 0;
if(ids[1] == id1) newId = abs(ids[0]);
else if(ids[0] == id1) newId = abs(ids[1]);
if(newId == ParticleID::s || id1 == ParticleID::c) slope[ix] = _p2;
else slope[ix] = _p1;
} else if(clusters[ix]->children().size() == 1) slope[ix] = _p1;
else slope[ix] = _p3;
mom[ix]=clusters[ix]->momentum();
}
// generate the momenta
double eps = 1e-10/double(ncl);
vector<double> xi(ncl);
unsigned int its(0);
Energy sum1(ZERO);
double yy(0.);
while(its < _maxtries) {
++its;
Energy sumx = ZERO;
Energy sumy = ZERO;
for(unsigned int i = 0; i<ncl; ++i) {
// Generate the pt given the parameter slope
Energy pt = randExt(clusters[i]->mass(), slope[i]);
Energy2 ptp = pt*pt - sqr(mom[i].mass());
if(ptp <= ZERO) pt = - sqrt(-ptp);
else pt = sqrt(ptp);
// randomize azimuth
Energy px,py;
randAzm(pt,px,py);
// set transverse momentum
mom[i].setX(px);
mom[i].setY(py);
sumx += px;
sumy += py;
}
sumx /= ncl;
sumy /= ncl;
// find the sum of the transverse mass
Energy sumtm=ZERO;
for(unsigned int ix = 0; ix<ncl; ++ix) {
mom[ix].setX(mom[ix].x()-sumx);
mom[ix].setY(mom[ix].y()-sumy);
Energy2 pt2 = mom[ix].perp2();
// Use the z component of the clusters momentum for temporary storage
mom[ix].setZ(sqrt(pt2+mom[ix].mass2()));
sumtm += mom[ix].z();
}
// if transverse mass greater the CMS try again
if(sumtm > CME) continue;
for(unsigned int i = 0; i<ncl; i++) xi[i] = randUng(0.6,1.0);
// sort into ascending order
sort(xi.begin(), xi.end());
double ximin = xi[0];
double ximax = xi.back()-ximin;
xi[0] = 0.;
for(unsigned int i = ncl-2; i>=1; i--) xi[i+1] = (xi[i]-ximin)/ximax;
xi[1] = 1.;
yy= log(CME*CME/(mom[0].z()*mom[1].z()));
bool suceeded=false;
Energy sum2,sum3,sum4;
for(unsigned int j = 0; j<10; j++) {
sum1 = sum2 = sum3 = sum4 = ZERO;
for(unsigned int i = 0; i<ncl; i++) {
Energy tm = mom[i].z();
double ex = exp(yy*xi[i]);
sum1 += tm*ex;
sum2 += tm/ex;
sum3 += (tm*ex)*xi[i];
sum4 += (tm/ex)*xi[i];
}
double fy = alog-log(sum1*sum2/GeV2);
double dd = (sum3*sum2 - sum1*sum4)/(sum1*sum2);
double dyy = fy/dd;
if(abs(dyy/yy) < eps) {
yy += dyy;
suceeded=true;
break;
}
yy += dyy;
}
if(suceeded) break;
if(its > 100) eps *= 10.;
}
if(its==_maxtries)
throw Exception() << "Can't generate soft underlying event in "
<< "UA5Handler::generateCylindricalPS"
<< Exception::eventerror;
double zz = log(CME/sum1);
for(unsigned int i = 0; i<ncl; i++) {
Energy tm = mom[i].z();
double E1 = exp(zz + yy*xi[i]);
mom[i].setZ(0.5*tm*(1./E1-E1));
mom[i].setE( 0.5*tm*(1./E1+E1));
clusters[i]->set5Momentum(mom[i]);
}
}
diff --git a/Utilities/EnumParticles.h b/Utilities/EnumParticles.h
--- a/Utilities/EnumParticles.h
+++ b/Utilities/EnumParticles.h
@@ -1,29 +1,29 @@
#ifndef HERWIG_EnumParticles_H
#define HERWIG_EnumParticles_H
#include <ThePEG/PDT/EnumParticles.h>
-namespace Herwig {
+namespace ThePEG {
/**
* The ParticleID namespace defines the ParticleCodes enumeration.
*/
-namespace ExtraParticleID {
+namespace ParticleID {
/** \ingroup Utilities
* Enumeration to give identifiers to PDG codes for special Herwig++ particles
*/
-enum ParticleCodes {
+enum HerwigCodes {
Cluster = 81,
/**< Herwig++ Cluster for Hadronization*/
Remnant = 82
/**< Herwig++ beam Remnant */
};
}
}
#endif
diff --git a/Utilities/Histogram.cc b/Utilities/Histogram.cc
--- a/Utilities/Histogram.cc
+++ b/Utilities/Histogram.cc
@@ -1,449 +1,512 @@
// -*- C++ -*-
//
// Histogram.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the Histogram class.
//
#include "Histogram.h"
#include "HerwigStrategy.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Repository/CurrentGenerator.h"
#include "ThePEG/Handlers/EventHandler.h"
using namespace Herwig;
IBPtr Histogram::clone() const {
return new_ptr(*this);
}
IBPtr Histogram::fullclone() const {
return new_ptr(*this);
}
NoPIOClassDescription<Histogram> Histogram::initHistogram;
// Definition of the static class description member.
void Histogram::Init() {
static ClassDocumentation<Histogram> documentation
("The Histogram class implements a simple histogram include data"
" points for comparision with experimental results.");
}
+void Histogram::rivetOutput(ostream & out,
+ string histogramname,
+ string analysisname,
+ string title,
+ string xlabel,
+ string ylabel,
+ bool rawcount,
+ double multiplicator) const {
+
+ // total number of histogram entries
+ double numPoints = static_cast<double>(_total);
+ if (numPoints == 0) numPoints += 1.0;
+
+
+ // collect y values and errors
+ vector<double> yvalues;
+ vector<double> yerrors;
+ const unsigned int lastBinIndex = _bins.size() - 2;
+ for (size_t ix = 1; ix <= lastBinIndex; ++ix) {
+ const double delta = _bins[ix+1].limit - _bins[ix].limit;
+ double factor = rawcount ? _prefactor * multiplicator
+ : _prefactor * multiplicator / (numPoints * delta);
+ const double value = factor * _bins[ix].contents;
+ const double error = factor * sqrt(_bins[ix].contentsSq);
+ yvalues.push_back(value);
+ yerrors.push_back(error);
+ }
+
+ // file header
+ out << "## " << numPoints << " entries, mean +- sigma = "
+ << _globalStats.mean() << " +- "
+ << _globalStats.stdDev() << "\n";
+ out << "## xlo xhi y yerr\n" ;
+ out << "##\n";
+ out << "# BEGIN HISTOGRAM /" << analysisname << "/" << histogramname << "\n";
+ out << "AidaPath=/" << analysisname << "/" << histogramname << "\n";
+ if ( title != string() ) out << "Title=" << title << "\n";
+ if ( xlabel != string() ) out << "XLabel=" << xlabel << "\n";
+ if ( ylabel != string() ) out << "YLabel=" << ylabel << "\n";
+
+ // histogram data
+ for (size_t i = 0; i < yvalues.size(); ++i) {
+ out << _bins[i+1].limit << "\t"
+ << _bins[i+2].limit << "\t"
+ << yvalues[i] << "\t"
+ << yerrors[i] << "\n";
+ }
+
+ // footer
+ out << "# END HISTOGRAM\n";
+ out << "\n";
+
+}
+
+
void Histogram::topdrawOutput(ostream & out,
unsigned int flags,
string colour,
string title, string titlecase,
string left, string leftcase,
string bottom, string bottomcase
) const {
using namespace HistogramOptions;
bool frame = ( flags & Frame ) == Frame;
bool errorbars = ( flags & Errorbars ) == Errorbars;
bool xlog = ( flags & Xlog ) == Xlog;
bool ylog = ( flags & Ylog ) == Ylog;
bool smooth = ( flags & Smooth ) == Smooth;
bool rawcount = ( flags & Rawcount ) == Rawcount;
// output the title info if needed
if(frame) {
out << "NEW FRAME\n";
if(_havedata) out << "SET WINDOW X 1.6 8 Y 3.5 9\n";
else out << "SET WINDOW X 1.6 8 Y 1.6 9\n";
out << "SET FONT DUPLEX\n";
out << "TITLE TOP \"" << title << "\"\n";
out << "CASE \"" << titlecase << "\"\n";
out << "TITLE LEFT \"" << left << "\"\n";
out << "CASE \"" << leftcase << "\"\n";
out << (errorbars ? "SET ORDER X Y DX DY \n" : "SET ORDER X Y DX\n");
if (HerwigStrategy::version != "") {
out << "TITLE RIGHT \"" << HerwigStrategy::version << "\"\n";
out << "CASE \"\"\n";
}
if(_havedata) out << "SET AXIS BOTTOM OFF\n";
else {
out << "TITLE BOTTOM \"" << bottom << "\"\n";
out << "CASE \"" << bottomcase << "\"\n";
}
}
// scales
if(xlog && frame) out << "SET SCALE X LOG " << endl;
if(ylog && frame) out << "SET SCALE Y LOG " << endl;
// set the x limits
const unsigned int lastDataBinIndx = _bins.size()-2;
if (frame) {
out << "SET LIMITS X " << _bins[1].limit << " "
<< _bins[lastDataBinIndx+1].limit << endl;
}
// work out the y points
vector<double> yout;
double ymax=-9.8765e34,ymin=9.8765e34;
double numPoints = _total;
if (numPoints == 0) numPoints += 1.;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double factor = rawcount ? _prefactor : 0.5 * _prefactor / (numPoints * delta);
double value = factor*_bins[ix].contents;
yout.push_back(value);
ymax=max(ymax, max(value, _bins[ix].data+_bins[ix].dataerror) );
if(yout.back()>0.) ymin=min(ymin,value);
if(_bins[ix].data>0) ymin=min(ymin,_bins[ix].data);
}
if (ymin > 1e34) ymin = 1e-34;
if (ymax < 1e-33) ymax = 1e-33;
if (ymax < 10*ymin) ymin = 0.1*ymax;
// make the y range slightly larger
double fac=pow(ymax/ymin,0.1);
ymax *= fac;
ymin /= fac;
if (ylog && frame) {
out << "SET LIMITS Y " << ymin << " " << ymax << endl;
}
// the histogram from the event generator
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double factor = rawcount ? _prefactor : 0.5 * _prefactor / (numPoints * delta);
out << _bins[ix].limit+delta << '\t' << yout[ix-1] << '\t' << delta;
if (errorbars) {
out << '\t' << factor*sqrt(_bins[ix].contentsSq);
}
out << '\n';
}
// N.B. in td smoothing only works for histograms with uniform binning.
if(!smooth) {
out << "HIST " << colour << endl;
} else {
out << "SMOOTH Y LEVEL 2 " << endl;
out << "JOIN " << colour << endl;
}
if (_havedata) {
// the real experimental data
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
out << _bins[ix].limit+delta << '\t' << _bins[ix].data << '\t' << delta;
if (errorbars) out << '\t' << _bins[ix].dataerror;
out << '\n';
}
out << "PLOT " << endl;
out << "SET WINDOW X 1.6 8 Y 2.5 3.5\n";
out << "SET LIMITS X " << _bins[1].limit << " "
<< _bins[lastDataBinIndx+1].limit << "\n";
double ymax=0.;
out << _bins[1].limit << "\t" << _bins[1].dataerror/_bins[1].data << "\n";
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
if(_bins[ix].data!=0.) {
if(_bins[ix].dataerror/_bins[ix].data>ymax)
ymax=_bins[ix].dataerror/_bins[ix].data;
out << _bins[ix].limit+delta << '\t'
<< _bins[ix].dataerror/_bins[ix].data << '\n';
}
else {
out << _bins[ix].limit+delta << '\t'
<< 1. << '\n';
}
}
if(_bins[lastDataBinIndx].data!=0.) {
out << _bins[lastDataBinIndx+1].limit << "\t"
<< _bins[lastDataBinIndx].dataerror/_bins[lastDataBinIndx].data << "\n";
out << _bins[lastDataBinIndx+1].limit << "\t"
<<-_bins[lastDataBinIndx].dataerror/_bins[lastDataBinIndx].data << "\n";
}
else {
out << _bins[lastDataBinIndx+1].limit << "\t" << 1. << "\n";
out << _bins[lastDataBinIndx+1].limit << "\t" << -1. << "\n";
}
for(unsigned int ix=lastDataBinIndx;ix>=1;--ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
if(_bins[ix].data!=0.) {
out << _bins[ix].limit+delta << '\t'
<< -_bins[ix].dataerror/_bins[ix].data << '\n';
}
else {
out << _bins[ix].limit+delta << '\t'
<< -1. << '\n';
}
}
if(_bins[1].data!=0.) {
out << _bins[1].limit << "\t" << -_bins[1].dataerror/_bins[1].data << "\n";
}
else {
out << _bins[1].limit << "\t" << -1. << "\n";
}
out << "set scale y lin\n";
out << "set limits y " << -ymax << " " << ymax << "\n";
out << "set fill full\n";
out << "join yellow fill yellow\n";
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
if(_bins[ix].data!=0.) {
out << _bins[ix].limit+delta << "\t"
<< (yout[ix-1]-_bins[ix].data)/_bins[ix].data << "\n";
}
else if(_bins[ix].dataerror!=0.) {
out << _bins[ix].limit+delta << "\t"
<< (yout[ix-1]-_bins[ix].data)/_bins[ix].dataerror << "\n";
}
else {
out << _bins[ix].limit+delta << "\t" << 0. << "\n";
}
}
out << "join\n";
out << "SET WINDOW X 1.6 8 Y 1.6 2.5\n";
out << "SET LIMITS X " << _bins[1].limit << " "
<< _bins[lastDataBinIndx+1].limit << "\n";
out << "SET AXIS BOTTOM ON\n";
out << "TITLE BOTTOM \"" << bottom << "\"\n";
out << "CASE \"" << bottomcase << "\"\n";
ymax =0.;
double ymin=0.;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double error = sqrt(sqr(0.5*sqrt(_bins[ix].contentsSq)/(delta*numPoints))+
sqr(_bins[ix].dataerror));
double point=(yout[ix-1]-_bins[ix].data)/error;
if(point<ymin) ymin=point;
if(point>ymax) ymax=point;
out << _bins[ix].limit+delta << '\t'
<< point << '\n';
}
out << "set limits y " << ymin << " " << ymax << "\n";
out << "JOIN" << endl;
}
}
double Histogram::dataNorm() const {
double norm(0.0);
if (_havedata) {
const unsigned int lastDataBinIndx = _bins.size()-2;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = _bins[ix+1].limit-_bins[ix].limit;
double value = _bins[ix].data;
norm += delta*value;
}
} else {
norm = -1.0;
}
return norm;
}
unsigned int Histogram::visibleEntries() const {
unsigned int numPoints(0);
const unsigned int lastDataBinIndx = _bins.size()-2;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
numPoints += static_cast<unsigned int>( _bins[ix].contents );
}
return numPoints;
}
void Histogram::simpleOutput(ostream & out, bool errorbars,
bool normdata) {
// simple ascii output (eg for gnuplot)
// work out the y points
vector<double> yout;
unsigned int numPoints = visibleEntries();
if (numPoints == 0) ++numPoints;
double datanorm(1.0);
double chisq(0.0), minfrac(0.05);
unsigned int ndof(0);
if (_havedata) {
if (normdata) datanorm = dataNorm();
normaliseToData();
chiSquared(chisq, ndof, minfrac);
}
prefactor(1.0);
const unsigned int lastDataBinIndx = _bins.size()-2;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double value = 0.5*_prefactor*_bins[ix].contents / (delta*numPoints);
yout.push_back(value);
}
out << "# " << numPoints << " entries, mean +- sigma = "
<< _globalStats.mean() << " +- "
<< _globalStats.stdDev() << "\n";
if (_havedata) {
out << "# chi^2/dof = " << chisq << "/" << ndof << " = "
<< chisq/double(ndof) << " (min err = " << minfrac << ")\n";
if (datanorm) {
out << "# data normalised by factor " << datanorm << "\n";
}
}
out << "# xlo xhi ynorm "
<< (errorbars ? "ynorm_err " : "")
<< (_havedata ? "data " : "")
<< (_havedata && errorbars ? "dataerr " : "")
<< "y_entr\n";
// the histogram from the event generator
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
out << _bins[ix].limit << " "
<< _bins[ix+1].limit << " "
<< yout[ix-1];
if (errorbars) {
out << " " << 0.5*sqrt(_bins[ix].contentsSq)/(delta*numPoints);
}
if (_havedata) {
out << " " << _bins[ix].data/datanorm;
if (errorbars)
out << " " << _bins[ix].dataerror/datanorm;
}
out << " " << _bins[ix].contents << '\n';
}
}
vector<double> Histogram::dumpBins() const {
vector<double> bincontents(_bins.size());
for (size_t i=0; i < _bins.size(); ++i)
bincontents[i] = _bins[i].contents;
return bincontents;
}
Histogram Histogram::ratioWith(const Histogram & h2) const {
const size_t numBins = _bins.size();
assert( numBins > 2 && numBins == h2._bins.size());
Histogram ratio(*this);
for (size_t i=0; i < numBins; ++i) {
assert(_bins[i].limit == h2._bins[i].limit);
if (h2._bins[i].contents > 0.0)
ratio._bins[i].contents /= h2._bins[i].contents;
else
ratio._bins[i].contents = 0.0;
}
return ratio;
}
void Histogram::normaliseToData() {
double numer(0.),denom(0.);
double numPoints = _total;
for(unsigned int ix=1;ix<_bins.size()-1;++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double value = 0.5*_bins[ix].contents / (delta*numPoints);
if(_bins[ix].dataerror>0.) {
double var = sqr(_bins[ix].dataerror);
numer += _bins[ix].data * value/var;
denom += sqr(value)/var;
}
}
_prefactor = numer/denom;
}
void Histogram::chiSquared(double & chisq,
unsigned int & ndegrees, double minfrac) const {
chisq =0.;
ndegrees=0;
double numPoints = _total;
for(unsigned int ix=1;ix<_bins.size()-1;++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
double value = 0.5*_prefactor*_bins[ix].contents / (delta*numPoints);
double error = _bins[ix].dataerror;
if(error>0.) {
if(abs(error/_bins[ix].data) < minfrac) error = minfrac*_bins[ix].data;
double var=sqr(error)
+ _bins[ix].contentsSq * sqr(0.5*_prefactor / (delta*numPoints));
chisq += sqr(_bins[ix].data - value) / var;
++ndegrees;
}
}
}
void Histogram::normaliseToCrossSection() {
double numPoints = _total;
if (numPoints == 0) numPoints += 1.;
_prefactor=CurrentGenerator::current().eventHandler()->histogramScale()*
numPoints/nanobarn;
}
void Histogram::topdrawOutputAverage(ostream & out,
bool frame,
bool errorbars,
bool xlog, bool ylog,
string colour,
string title, string titlecase,
string left, string leftcase,
string bottom, string bottomcase) const {
// output the title info if needed
if(frame) {
out << "NEW FRAME\n";
out << "SET FONT DUPLEX\n";
out << "TITLE TOP \"" << title << "\"\n";
out << "CASE \"" << titlecase << "\"\n";
out << "TITLE LEFT \"" << left << "\"\n";
out << "CASE \"" << leftcase << "\"\n";
out << "TITLE BOTTOM \"" << bottom << "\"\n";
out << "CASE \"" << bottomcase << "\"\n";
if (errorbars) out << "SET ORDER X Y DX DY \n";
else out << "SET ORDER X Y DX\n";
}
// scales
if(xlog && frame) out << "SET SCALE X LOG " << endl;
if(ylog && frame) out << "SET SCALE Y LOG " << endl;
// set the x limits
const unsigned int lastDataBinIndx = _bins.size()-2;
if (xlog && frame) {
out << "SET LIMITS X " << _bins[1].limit << " "
<< _bins[lastDataBinIndx+1].limit << endl;
}
// work out the y points
vector<double> yout;
double ymax=-9.8765e34,ymin=9.8765e34;
unsigned int numPoints = _globalStats.numberOfPoints();
if (numPoints == 0) ++numPoints;
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double value = _prefactor*_bins[ix].contents / _bins[ix].points;
yout.push_back(value);
ymax=max(ymax, max(value, _bins[ix].data+_bins[ix].dataerror) );
if(yout.back()>0.) ymin=min(ymin,value);
if(_bins[ix].data>0) ymin=min(ymin,_bins[ix].data);
}
if (ymin > 1e34) ymin = 1e-34;
if (ymax < 1e-33) ymax = 1e-33;
if (ymax < 10*ymin) ymin = 0.1*ymax;
if (ylog && frame) {
out << "SET LIMITS Y " << ymin << " " << ymax << endl;
}
// the histogram from the event generator
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix) {
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
out << _bins[ix].limit+delta << '\t' << yout[ix-1] << '\t' << delta;
if (errorbars) {
out << '\t' << 0.5*sqrt(_bins[ix].contentsSq)/(delta*numPoints);
}
out << '\n';
}
out << "HIST " << colour << endl;
if (_havedata) {
// the real experimental data
for(unsigned int ix=1; ix<=lastDataBinIndx; ++ix)
{
double delta = 0.5*(_bins[ix+1].limit-_bins[ix].limit);
out << _bins[ix].limit+delta << '\t' << _bins[ix].data << '\t' << delta;
if (errorbars) {
out << '\t' << _bins[ix].dataerror;
}
out << '\n';
}
out << "PLOT " << endl;
}
}
+
+vector<double> Histogram::LogBins(double xmin, unsigned nbins, double base) {
+ vector<double> limits;
+ for (unsigned e = 0; e <= nbins; e++)
+ limits.push_back(xmin * pow(base, (int)e));
+ return limits;
+}
+
diff --git a/Utilities/Histogram.h b/Utilities/Histogram.h
--- a/Utilities/Histogram.h
+++ b/Utilities/Histogram.h
@@ -1,391 +1,434 @@
// -*- C++ -*-
//
// Histogram.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_Histogram_H
#define HERWIG_Histogram_H
//
// This is the declaration of the Histogram class.
//
#include "Histogram.fh"
#include "ThePEG/Interface/Interfaced.h"
#include "Statistic.h"
#include <string>
namespace Herwig {
using namespace ThePEG;
/**
* Options for histogram output.
* They can be combined using the '|' operator, e.g. 'Frame | Ylog'
*/
namespace HistogramOptions {
const unsigned int None = 0; /**< No options */
const unsigned int Frame = 1; /**< Plot on new frame */
const unsigned int Errorbars = 1 << 1; /**< Plot error bars */
const unsigned int Xlog = 1 << 2; /**< log scale for x-axis */
const unsigned int Ylog = 1 << 3; /**< log scale for y-axis */
const unsigned int Smooth = 1 << 4; /**< smooth the line */
const unsigned int Rawcount = 1 << 5; /**< don't normalize to unit area */
}
/**
* The Histogram class is a simple histogram for the Analysis handlers.
*
* @see \ref HistogramInterfaces "The interfaces"
* defined for Histogram.
*/
class Histogram: public Interfaced {
public:
/** @name Standard constructors and destructors. */
//@{
/**
* The default constructor.
* @param lower The lower limit of the histogram
* @param upper The upper limit of the histogram
* @param nbin Number of bins
*/
Histogram(double lower=0., double upper=0., unsigned int nbin=0)
: _globalStats(), _havedata(false), _bins(nbin+2),_prefactor(1.),_total(0.) {
if (upper<lower) swap(upper,lower);
_bins[0].limit=-1.e100;
double limit(lower);
double width((upper-lower)/nbin);
for(unsigned int ix=1; ix <= nbin; ++ix) {
_bins[ix].limit=limit;
limit += width;
}
_bins.back().limit=limit;
}
/**
* Constructor for variable width bins
* @param limits The lower limits for the bins followed by the upper limit of the last bin
*/
Histogram(vector<double> limits)
: _globalStats(), _havedata(false), _bins(limits.size()+1), _prefactor(1.),_total(0.) {
_bins[0].limit=-1.e100;
for (size_t i=1; i<=limits.size(); ++i)
_bins[i].limit=limits[i-1];
}
/**
* Constructor with data included
* @param limits The lower limits for the bins followed by the upper limit of the last bin
* @param data The data
* @param dataerror The errors on the data
*/
Histogram(vector<double> limits, vector<double> data, vector<double> dataerror)
: _globalStats(), _havedata(true), _bins(limits.size()+1), _prefactor(1.),_total(0.) {
_bins[0].limit=-1.e100;
for (size_t i=1; i<=limits.size(); ++i)
_bins[i].limit=limits[i-1];
// no data goes into _bins[0] or _bins.back()!
for (size_t i=1; i<=min(limits.size()-1,data.size()); ++i)
_bins[i].data=data[i-1];
for (size_t i=1; i<=min(limits.size()-1,dataerror.size()); ++i)
_bins[i].dataerror=dataerror[i-1];
}
//@}
public:
/**
* Operator to add a point to the histogrma with unit weight
*/
void operator += (double input) {
addWeighted(input,1.0);
}
/**
* Function to add a weighted point to the histogram
*/
void addWeighted(double input, double weight) {
if(isnan(input)) return;
unsigned int ibin;
for(ibin=1; ibin<_bins.size(); ++ibin) {
if(input<_bins[ibin].limit)
break;
}
_bins[ibin-1].contents += weight;
_bins[ibin-1].contentsSq += sqr(weight);
_globalStats += weight * input;
_total += weight;
}
/**
* Number of bins (not counting the overflow)
*/
unsigned int numberOfBins() const {
return _bins.size()-2;
}
/**
* Get the prefactor
*/
double prefactor() const {
return _prefactor;
}
/**
* Set the prefactor
*/
void prefactor(double in ) {
_prefactor=in;
}
/**
* Access to the statistics on the total entry of the histogram
*/
const Statistic & globalStatistics() const {
return _globalStats;
}
/**
* Normalise the distributions to the data
*/
void normaliseToData();
/**
* Normalise the distributions to the total cross section
*/
void normaliseToCrossSection();
/**
* Return the chi squared
* @param chisq The chi squared
* @param ndegrees The number of points
* @param minfrac The minimum fractional error on the data point
*/
void chiSquared(double & chisq,
unsigned int & ndegrees, double minfrac=0.) const;
/**
+ * @brief Output as file ready for usage with flat2aida and other Rivet tools
+ * @param out The output stream
+ * @param histogramname The histogram name identifying the histogram. Required
+ * for comparisons (e.g. with rivet-mkhtml or with
+ * compare-histos)
+ * @param analysisname The analysis name
+ * @param title The title for the top of the plot in LaTeX format
+ * @param xlabel The x label in LaTeX format
+ * @param ylabel The y label in LaTeX format
+ * @param rawcount Don't normalise to unit area.
+ * @param multiplicator Factor the histogram is multiplied with.
+ * N.B. Experimental data is not output.
+ */
+ void rivetOutput(ostream & out,
+ string histogramname = string("default"),
+ string analysisname = string("default"),
+ string title = string(),
+ string xlabel = string(),
+ string ylabel = string(),
+ bool rawcount = false,
+ double multiplicator = 1.0) const;
+
+ /**
* Output as a topdrawer file. The histogram is normalised to unit area
* @param out The output stream
* @param flags A bitmask of flags from HistogramOptions, e.g. Frame|Ylog
* @param colour The colour for the line
* @param title The title for the top of the plot
* @param titlecase topdraw format for the title
* @param left Left axis lable
* @param leftcase topdraw format for left axis label
* @param bottom Bottom axis lable
* @param bottomcase Bottom axis lable ofr topdraw
* N.B. in td smoothing only works for histograms with uniform binning.
*/
void topdrawOutput(ostream & out,
unsigned int flags = 0,
string colour = string("BLACK"),
string title = string(),
string titlecase = string(),
string left = string(),
string leftcase = string(),
string bottom = string(),
string bottomcase = string()
) const;
/**
* Output as a topdrawer file. A bin by bin average is taken.
* @param out The output stream
* @param frame output on a new graph
* @param errorbars output data points with error bars
* @param xlog log scale on x axis
* @param ylog log scale on y axis
* @param colour The colour for the line
* @param title The title for the top of the plot
* @param titlecase topdraw format for the title
* @param left Left axis lable
* @param leftcase topdraw format for left axis label
* @param bottom Bottom axis lable
* @param bottomcase Bottom axis lable ofr topdraw
*/
void topdrawOutputAverage(ostream & out,
bool frame,
bool errorbars,
bool xlog, bool ylog,
string colour=string("BLACK"),
string title=string(),
string titlecase =string(),
string left=string(),
string leftcase =string(),
string bottom=string(),
string bottomcase =string()) const;
/**
* get the number of visible entries (all entries without those in the
* under- and overflow bins) in the histogram. This assumes integer
* entries, ie it gives wrong results for weighted histograms.
*/
unsigned int visibleEntries() const;
/**
* Compute the normalisation of the data.
*/
double dataNorm() const;
/**
* Output into a simple ascii file, easily readable by gnuplot.
*/
void simpleOutput(ostream & out, bool errorbars, bool normdata=false);
/**
* Dump bin data into a vector
*/
vector<double> dumpBins() const;
/**
* Returns a new histogram containing bin-by-bin ratios of two histograms
*/
Histogram ratioWith(const Histogram & h2) const;
+ /**
+ * @brief Returns limits for bins with exponentially increasing widths.
+ * For usage with the variable-bin-width Histogram constructor.
+ * @param xmin Lower limit of the first bin, needs to be > 0
+ * @param nbins Number of bins
+ * @param base The base, needs to be > 1
+ */
+ static
+ vector<double> LogBins(double xmin, unsigned nbins, double base = 10.0);
+
+
public:
/**
* 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 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;
//@}
private:
/**
* The static object used to initialize the description of this class.
* Indicates that this is a concrete class with persistent data.
*/
static NoPIOClassDescription<Histogram> initHistogram;
/**
* The assignment operator is private and must never be called.
* In fact, it should not even be implemented.
*/
Histogram & operator=(const Histogram &);
private:
/**
* Global statistics of all data that went into the histogram.
*/
Statistic _globalStats;
/**
* Set to true if there is experimental data available
*/
bool _havedata;
/**
* One bin of the histogram. limit is the _lower_ bound of the bin.
*/
struct Bin {
/**
* Default constructor
*/
Bin() : contents(0.0), contentsSq(0.0),
limit(0.0), data(0.0), dataerror(0.0), points(0) {}
/**
* Contents of the bin
*/
double contents;
/**
* Contents squared for the error
*/
double contentsSq;
/**
* The limit for the bin
*/
double limit;
/**
* The experimental value for the bin
*/
double data;
/**
* The error on the experimental value for the bin
*/
double dataerror;
/**
* The number of points in the bin
*/
long points;
};
/**
* The histogram bins. _bins[0] is the underflow, _bins.back() the overflow
*/
vector<Bin> _bins;
/**
* Prefactors to multiply the output by
*/
double _prefactor;
/**
* Total entry
*/
double _total;
+
+
+public:
+
+ /**
+ * The vector of bins
+ */
+ vector<Bin> bins() const { return _bins; }
+
};
}
#include "ThePEG/Utilities/ClassTraits.h"
namespace ThePEG {
/** @cond TRAITSPECIALIZATIONS */
/** This template specialization informs ThePEG about the
* base classes of Histogram. */
template <>
struct BaseClassTrait<Herwig::Histogram,1> {
/** Typedef of the first base class of Histogram. */
typedef Herwig::Statistic NthBase;
};
/** This template specialization informs ThePEG about the name of
* the Histogram class and the shared object where it is defined. */
template <>
struct ClassTraits<Herwig::Histogram>
: public ClassTraitsBase<Herwig::Histogram> {
/** Return a platform-independent class name */
static string className() { return "Herwig::Histogram"; }
};
/** @endcond */
}
#endif /* HERWIG_Histogram_H */
diff --git a/Utilities/Maths.h b/Utilities/Maths.h
--- a/Utilities/Maths.h
+++ b/Utilities/Maths.h
@@ -1,55 +1,69 @@
// -*- C++ -*-
//
// Maths.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_Math_H
#define HERWIG_Math_H
#include <cmath>
+#include <vector>
#include "ThePEG/Config/Complex.h"
#include "ThePEG/Utilities/Maths.h"
namespace Herwig {
using ThePEG::Complex;
using std::complex;
/** The Math namespace includes the declaration of some useful
* mathematical functions. */
namespace Math {
/**
* The dilog function taken from FORTRAN Herwig
*/
Complex Li2(Complex);
/**
* The real part of the dilog function taken from FORTRAN Herwig
*/
long double ReLi2(long double);
/**
* Fold angles into the range (0,2 Pi)
*/
inline double angleZeroTo2Pi(double angle) {
double ret = fmod(angle, 2 * M_PI);
if (ret < 0) ret += 2 * M_PI;
return ret;
}
/**
* Fold angles into the range (-Pi,Pi)
*/
inline double angleMinusPiToPi(double angle) {
double ret = angleZeroTo2Pi(angle);
if (ret > M_PI) ret -= 2 * M_PI;
return ret;
}
+
+ /**
+ * Calculates the (lower) median of a vector of T objects. T has to be
+ * comparable, i.e. T::operator< must be defined.
+ */
+ template <typename T>
+ inline T median(std::vector<T> v) {
+ if (v.empty()) return T();
+ sort ( v.begin(), v.end() );
+ const size_t N = v.size();
+ return (N % 2) ? v.at((N+1)/2 - 1) : v.at(N/2 - 1);
+ }
+
}
}
#endif /* HERWIG_Math_H */
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1,171 +1,172 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT([Herwig++],[SVN],[herwig@projects.hepforge.org],[Herwig++])
AC_CONFIG_SRCDIR([Utilities/HerwigStrategy.cc])
AC_CONFIG_AUX_DIR([Config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([Config/config.h])
dnl AC_PRESERVE_HELP_ORDER
AC_CANONICAL_HOST
case "${host}" in
*-darwin[[0156]].*)
AC_MSG_ERROR([Herwig++ requires OS X 10.3 or later])
;;
*-darwin7.*)
if test "x$MACOSX_DEPLOYMENT_TARGET" != "x10.3"; then
AC_MSG_ERROR(
[Please add 'MACOSX_DEPLOYMENT_TARGET=10.3' to the configure line.])
fi
;;
esac
dnl === disable debug symbols by default =====
if test "x$CXXFLAGS" = "x"; then
CXXFLAGS=-O3
fi
if test "x$CFLAGS" = "x"; then
CFLAGS=-O3
fi
dnl Looptools manual requires optimization off
if test "x$FCFLAGS" = "x"; then
FCFLAGS=-O0
fi
dnl ==========================================
AC_LANG([C++])
AM_INIT_AUTOMAKE([1.9 gnu dist-bzip2 -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl Checks for programs.
AC_PROG_CXX([g++])
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
dnl modified search order
AC_PROG_FC([gfortran g95 g77])
dnl xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 xlf f77 frt pgf77 cf77 fort77 fl32 af77])
AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([if the Fortran compiler ($FC) works])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([],[ print *[,]"Hello"]),
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([A Fortran compiler is required to build Herwig++.])
]
)
AC_LANG_POP([Fortran])
LT_PREREQ([2.2])
LT_INIT([disable-static dlopen pic-only])
dnl ####################################
dnl ####################################
dnl for Doc/fixinterfaces.pl
AC_PATH_PROG(PERL, perl)
HERWIG_CHECK_GSL
HERWIG_CHECK_THEPEG
HERWIG_COMPILERFLAGS
HERWIG_LOOPTOOLS
HERWIG_PDF_PATH
FASTJET_CHECK_FASTJET
HERWIG_VERSIONSTRING
HERWIG_CHECK_ABS_BUG
HERWIG_ENABLE_MODELS
SHARED_FLAG=-shared
AM_CONDITIONAL(NEED_APPLE_FIXES,
[test "xx${host/darwin/foundit}xx" != "xx${host}xx"])
if test "xx${host/darwin/foundit}xx" != "xx${host}xx"; then
APPLE_DSO_FLAGS=-Wl,-undefined,dynamic_lookup
SHARED_FLAG=-bundle
fi
AC_SUBST([APPLE_DSO_FLAGS])
AC_SUBST([SHARED_FLAG])
AC_CONFIG_FILES([UnderlyingEvent/Makefile
Models/Makefile
Models/StandardModel/Makefile
Models/RSModel/Makefile
Models/General/Makefile
Models/Susy/Makefile
Models/Susy/NMSSM/Makefile
Models/Susy/RPV/Makefile
Models/Susy/MatrixElements/Makefile
Models/UED/Makefile
Models/LH/Makefile
Models/LHTP/Makefile
Models/HiddenValley/Makefile
Models/Transplanckian/Makefile
Models/Leptoquarks/Makefile
- Models/AnomalousCouplings/Makefile
Models/Zprime/Makefile
Models/TTbAsymm/Makefile
+ Models/AnomalousCouplings/Makefile
Models/Feynrules/Makefile
Models/Feynrules/Makefile-FR
Models/ADD/Makefile
+ Models/Sextet/Makefile
Decay/Makefile
Decay/FormFactors/Makefile
Decay/Tau/Makefile
Decay/Baryon/Makefile
Decay/VectorMeson/Makefile
Decay/Perturbative/Makefile
Decay/ScalarMeson/Makefile
Decay/TensorMeson/Makefile
Decay/WeakCurrents/Makefile
Decay/Partonic/Makefile
Decay/General/Makefile
Decay/Radiation/Makefile
Doc/refman.conf
Doc/refman.h
PDT/Makefile
PDF/Makefile
MatrixElement/Makefile
MatrixElement/General/Makefile
MatrixElement/Lepton/Makefile
MatrixElement/Hadron/Makefile
MatrixElement/DIS/Makefile
MatrixElement/Powheg/Makefile
MatrixElement/Gamma/Makefile
Shower/SplittingFunctions/Makefile
Shower/Default/Makefile
Shower/Base/Makefile
Shower/Makefile
Utilities/Makefile
Hadronization/Makefile
lib/Makefile
include/Makefile
src/Makefile
src/defaults/Makefile
src/herwig-config
Doc/Makefile
Doc/HerwigDefaults.in
Looptools/Makefile
Analysis/Makefile
src/Makefile-UserModules
src/defaults/Analysis.in
Contrib/Makefile
Contrib/make_makefiles.sh
Tests/Makefile
Makefile])
AC_CONFIG_FILES([Doc/fixinterfaces.pl],[chmod +x Doc/fixinterfaces.pl])
HERWIG_OVERVIEW
AC_CONFIG_COMMANDS([summary],[cat config.herwig])
AC_OUTPUT
diff --git a/lib/Makefile.am b/lib/Makefile.am
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,32 +1,32 @@
pkglib_LTLIBRARIES = Herwig.la
Herwig_la_SOURCES =
Herwig_la_LIBTOOLFLAGS = --tag=CXX
-Herwig_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 9:0:0
+Herwig_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 10:0:0
Herwig_la_LDFLAGS += $(THEPEGLDFLAGS) $(FCLIBS)
Herwig_la_LIBADD = \
$(top_builddir)/Hadronization/libHwHadronization.la \
$(top_builddir)/Models/StandardModel/libHwStandardModel.la \
$(top_builddir)/Decay/libHwDecay.la \
$(top_builddir)/Decay/FormFactors/libHwFormFactor.la \
$(top_builddir)/Decay/Radiation/libHwDecRad.la \
$(top_builddir)/Utilities/libHwUtils.la \
$(top_builddir)/Models/General/libHwModelGenerator.la \
$(top_builddir)/Decay/General/libHwGeneralDecay.la \
$(top_builddir)/MatrixElement/General/libHwGeneralME.la \
$(top_builddir)/MatrixElement/libHwME.la \
$(top_builddir)/Decay/WeakCurrents/libHwWeakCurrent.la \
$(top_builddir)/Looptools/libHwLooptools.la \
$(top_builddir)/Shower/libHwShower.la \
$(THEPEGLIB) -ldl
all-local: done-all-links
done-all-links: Herwig.la
if test ! -L Herwig++ ; then $(LN_S) -f . Herwig++ ; fi
find $(top_builddir) \( -name '*.so.*' -or -name '*.so' \) \
-not -name 'lib*' -not -path '$(top_builddir)/lib/*' -exec $(LN_S) -f \{\} \;
$(LN_S) -f .libs/Herwig*so* .
echo "stamp" > done-all-links
clean-local:
rm -f *.so *.so.* done-all-links
diff --git a/m4/fastjet.m4 b/m4/fastjet.m4
--- a/m4/fastjet.m4
+++ b/m4/fastjet.m4
@@ -1,80 +1,95 @@
dnl CHECK FASTJET BEGIN
dnl
dnl This script can be used in configure scripts to check for the
dnl usability of the FastJet librarty.
dnl
dnl By defaults, it searches the FastJet library in standard system
dnl locations but an alternative path can be specified using the
dnl --with-fastjet=... configure option
dnl
dnl If FastJet is found and functional, the variables FASTJET_CXXFLAGS
dnl and FASTJET_LIBS are set
dnl
dnl modified for Herwig++ 2011-10-04 D.Grellscheid
dnl
AC_DEFUN([FASTJET_CHECK_FASTJET],
[
dnl ckeck if a directory is specified for FastJet
AC_ARG_WITH(fastjet,
[AC_HELP_STRING([--with-fastjet=dir],
[Assume the given directory for FastJet])])
dnl search for the fastjet-config script
if test "$with_fastjet" = ""; then
AC_PATH_PROG(fjconfig, fastjet-config, no)
else
AC_PATH_PROG(fjconfig, fastjet-config, no, ${with_fastjet}/bin)
fi
LOAD_FASTJET=""
CREATE_FASTJET="#create"
if test "${fjconfig}" = "no"; then
AC_MSG_CHECKING(FastJet)
AC_MSG_RESULT(no);
$2
else
dnl now see if FastJet is functional
save_CXXFLAGS="$CXXFLAGS"
save_LIBS="$LIBS"
CXXFLAGS="${CXXFLAGS} `${fjconfig} --cxxflags`"
LIBS="${LIBS} `${fjconfig} --libs --plugins`"
AC_MSG_CHECKING([if FastJet is functional])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
#include <fastjet/ClusterSequence.hh>
]], [[
fastjet::PseudoJet pj=fastjet::PtYPhiM(10.0,0.5,1.0,0.0);
]]), [fjok='yes'], [fjok='no'])
AC_MSG_RESULT([$fjok])
AC_LANG_POP()
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
AC_MSG_CHECKING(FastJet)
if test "${fjok}" = "yes"; then
FASTJET_CXXFLAGS="`${fjconfig} --cxxflags`"
FASTJET_LIBS="`${fjconfig} --libs --plugins`"
LOAD_FASTJET="library HwLEPJetAnalysis.so"
CREATE_FASTJET="create"
AC_MSG_RESULT(yes)
$1
else
AC_MSG_RESULT(no)
$2
fi
+
+ fjcheckver=`${fjconfig} --version | sed s/'\.'//g`
+ fjprefix=`${fjconfig} --prefix`
+ if test "${host_cpu}" == "x86_64" -a $fjcheckver -le 301 -a -e `${fjconfig} --prefix`/lib64 ; then
+ AC_MSG_WARN([
+ ***************************************************************************
+ FastJet <= 3.0.1 has been recognized. The FastJet libraries
+ are located in
+ $fjprefix/lib64 which is not properly
+ communicated by fastjet-config. Consider to configure FastJet with
+ --libdir=$fjprefix/lib
+ ***************************************************************************
+ ])
+ fi
+
fi
AC_SUBST(FASTJETINCLUDE,[$FASTJET_CXXFLAGS])
AC_SUBST(CREATE_FASTJET)
AC_SUBST(LOAD_FASTJET)
AC_SUBST(FASTJETLIBS,[${FASTJET_LIBS/-Wl,-rpath,/-R}])
AM_CONDITIONAL(WANT_LIBFASTJET,[test "x$CREATE_FASTJET" = "xcreate"])
])
dnl CHECK FASTJET END
diff --git a/m4/herwig.m4 b/m4/herwig.m4
--- a/m4/herwig.m4
+++ b/m4/herwig.m4
@@ -1,399 +1,423 @@
# 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"
+if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then
+ THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG"
+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)
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])
if test -x "$THEPEGPATH/lib/ThePEG/HepMCAnalysis.so" ; then
CREATE_HEPMC="create"
AC_MSG_RESULT([found])
else
CREATE_HEPMC="# create"
AC_MSG_RESULT([not found])
fi
AC_SUBST([CREATE_HEPMC])
])
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 ##### 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"
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"
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"
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_DEFUN([HERWIG_VERSIONSTRING],
[
if test -d $srcdir/.svn; then
AC_CHECK_PROG(have_svnversion,[svnversion],[yes],[no])
fi
AM_CONDITIONAL(USE_SVNVERSION,[test "x$have_svnversion" = "xyes"])
])
dnl ##### COMPILERFLAGS #####
AC_DEFUN([HERWIG_COMPILERFLAGS],
[
AC_REQUIRE([HERWIG_CHECK_THEPEG])
AM_CPPFLAGS="-I\$(top_builddir)/include $THEPEGINCLUDE \$(GSLINCLUDE)"
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
AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
else
debugflags="-g"
fi
dnl -Wfloat-equal -fvisibility-inlines-hidden -Wctor-dtor-privacy -Weffc++
if test -n "$GCC"; then
warnflags="-ansi -pedantic -Wall -W"
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
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CFLAGS, ["$warnflags $debugflags"])
AC_SUBST(AM_CXXFLAGS,["$warnflags $debugflags"])
AC_SUBST(AM_FCFLAGS, ["$debugflags"])
AC_SUBST(AM_LDFLAGS)
])
AC_DEFUN([HERWIG_ENABLE_MODELS],
[
AC_MSG_CHECKING([for BSM models to include])
LOAD_RS=""
LOAD_SUSY=""
LOAD_NMSSM=""
LOAD_TRP=""
LOAD_UED=""
LOAD_ADD=""
+LOAD_SEXTET=""
+LOAD_TTBA=""
+LOAD_ZPRIME=""
AC_ARG_ENABLE(models,
- AC_HELP_STRING([--enable-models=LIST],[Comma-separated list of BSM models to enable. Options are (mssm nmssm ued rs add lh lhtp rpv trp anomalous leptoquarks) or --disable-models to turn them all off.]),
+ AC_HELP_STRING([--enable-models=LIST],[Comma-separated list of BSM models to enable. Options are (mssm nmssm ued rs trp add leptoquarks sextet lh lhtp rpv leptoquarks) or --disable-models to turn them all off.]),
[],
[enable_models=all]
)
if test "x$enable_models" = "xyes" -o "x$enable_models" = "xall"; then
all=yes
fi
AC_MSG_RESULT([$enable_models])
if test ! "$all"; then
oldIFS="$IFS"
IFS=","
for i in $enable_models; do
declare $i=yes
done
IFS="$oldIFS"
fi
if test "$nmssm" -o "$all"; then
LOAD_NMSSM="library HwNMSSM.so"
mssm=yes
fi
AC_SUBST(LOAD_NMSSM)
if test "$rpv"; then
mssm=yes
fi
if test "$rs" -o "$all" ; then
LOAD_RS="library HwRSModel.so"
fi
AC_SUBST(LOAD_RS)
if test "$mssm" -o "$all"; then
LOAD_SUSY="library HwSusy.so"
fi
AC_SUBST(LOAD_SUSY)
if test "$trp" -o "$all"; then
LOAD_TRP="library HwTransplanck.so"
fi
AC_SUBST(LOAD_TRP)
if test "$ued" -o "$all"; then
LOAD_UED="library HwUED.so"
fi
AC_SUBST(LOAD_UED)
if test "$add" -o "$all"; then
LOAD_ADD="library HwADDModel.so"
fi
AC_SUBST(LOAD_ADD)
if test "$leptoquarks" -o "$all"; then
LOAD_LEPTOQUARKS="library HwLeptoquarkModel.so"
fi
AC_SUBST(LOAD_LEPTOQUARKS)
+if test "$sextet" -o "$all"; then
+ LOAD_SEXTET="library HwSextetModel.so"
+fi
+AC_SUBST(LOAD_SEXTET)
+
+if test "$ttba" -o "$all"; then
+ LOAD_TTBA="library HwTTbAModel.so"
+fi
+AC_SUBST(LOAD_TTBA)
+
+if test "$zprime" -o "$all"; then
+ LOAD_SEXTET="library HwZprimeModel.so"
+fi
+AC_SUBST(LOAD_ZPRIME)
+
AM_CONDITIONAL(WANT_MSSM,[test "$mssm" -o "$all"])
AM_CONDITIONAL(WANT_NMSSM,[test "$nmssm" -o "$all"])
AM_CONDITIONAL(WANT_RPV,[test "$rpv" -o "$all"])
AM_CONDITIONAL(WANT_UED,[test "$ued" -o "$all"])
AM_CONDITIONAL(WANT_RS,[test "$rs" -o "$all"])
AM_CONDITIONAL(WANT_LH,[test "$lh" -o "$all"])
AM_CONDITIONAL(WANT_LHTP,[test "$lhtp" -o "$all"])
AM_CONDITIONAL(WANT_Anomalous,[test "$anomalous" -o "$all"])
AM_CONDITIONAL(WANT_Leptoquark,[test "$leptoquarks" -o "$all"])
AM_CONDITIONAL(WANT_TRP,[test "$trp" -o "$all"])
AM_CONDITIONAL(WANT_ADD,[test "$add" -o "$all"])
+AM_CONDITIONAL(WANT_SEXTET,[test "$sextet" -o "$all"])
+AM_CONDITIONAL(WANT_TTBA,[test "$ttba" -o "$all"])
+AM_CONDITIONAL(WANT_ZPRIME,[test "$zprime" -o "$all"])
])
AC_DEFUN([HERWIG_OVERVIEW],
[
FCSTRING=`$FC --version | head -1`
CXXSTRING=`$CXX --version | head -1`
CCSTRING=`$CC --version | head -1`
cat << _HW_EOF_ > config.herwig
*****************************************************
*** $PACKAGE_STRING configuration summary
*** Please include this information in bug reports!
***--------------------------------------------------
*** Prefix: $prefix
***
*** BSM models: $enable_models
*** Herwig debug mode: $enable_debug
***
*** GSL: $with_gsl
***
*** ThePEG: $with_thepeg
*** ThePEG headers: $with_thepeg_headers
***
*** Fastjet: ${fjconfig}
***
*** Host: $host
*** CXX: $CXXSTRING
*** FC: $FCSTRING
*** CC: $CCSTRING
*****************************************************
_HW_EOF_
])
diff --git a/m4/libtool.m4 b/m4/libtool.m4
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1,7831 +1,7360 @@
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# 2006, 2007, 2008 Free Software Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
m4_define([_LT_COPYING], [dnl
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-# Inc.
+# 2006, 2007, 2008 Free Software Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
#
# GNU Libtool is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
# obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
])
-# serial 57 LT_INIT
+# serial 56 LT_INIT
# LT_PREREQ(VERSION)
# ------------------
# Complain and exit if this libtool version is less that VERSION.
m4_defun([LT_PREREQ],
[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
[m4_default([$3],
[m4_fatal([Libtool version $1 or higher is required],
63)])],
[$2])])
# _LT_CHECK_BUILDDIR
# ------------------
# Complain if the absolute build directory name contains unusual characters
m4_defun([_LT_CHECK_BUILDDIR],
[case `pwd` in
*\ * | *\ *)
AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
esac
])
# LT_INIT([OPTIONS])
# ------------------
AC_DEFUN([LT_INIT],
[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
AC_BEFORE([$0], [LT_LANG])dnl
AC_BEFORE([$0], [LT_OUTPUT])dnl
AC_BEFORE([$0], [LTDL_INIT])dnl
m4_require([_LT_CHECK_BUILDDIR])dnl
dnl Autoconf doesn't catch unexpanded LT_ macros by default:
m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
dnl unless we require an AC_DEFUNed macro:
AC_REQUIRE([LTOPTIONS_VERSION])dnl
AC_REQUIRE([LTSUGAR_VERSION])dnl
AC_REQUIRE([LTVERSION_VERSION])dnl
AC_REQUIRE([LTOBSOLETE_VERSION])dnl
m4_require([_LT_PROG_LTMAIN])dnl
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
dnl Parse OPTIONS
_LT_SET_OPTIONS([$0], [$1])
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ltmain"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
_LT_SETUP
# Only expand once:
m4_define([LT_INIT])
])# LT_INIT
# Old names:
AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
# _LT_CC_BASENAME(CC)
# -------------------
# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
m4_defun([_LT_CC_BASENAME],
[for cc_temp in $1""; do
case $cc_temp in
compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
\-*) ;;
*) break;;
esac
done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
])
# _LT_FILEUTILS_DEFAULTS
# ----------------------
# It is okay to use these file commands and assume they have been set
# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
m4_defun([_LT_FILEUTILS_DEFAULTS],
[: ${CP="cp -f"}
: ${MV="mv -f"}
: ${RM="rm -f"}
])# _LT_FILEUTILS_DEFAULTS
# _LT_SETUP
# ---------
m4_defun([_LT_SETUP],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
_LT_DECL([], [host_alias], [0], [The host system])dnl
_LT_DECL([], [host], [0])dnl
_LT_DECL([], [host_os], [0])dnl
dnl
_LT_DECL([], [build_alias], [0], [The build system])dnl
_LT_DECL([], [build], [0])dnl
_LT_DECL([], [build_os], [0])dnl
dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
test -z "$LN_S" && LN_S="ln -s"
_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
dnl
AC_REQUIRE([LT_CMD_MAX_LEN])dnl
_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
m4_require([_LT_CMD_RELOAD])dnl
m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
m4_require([_LT_CMD_OLD_ARCHIVE])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
_LT_CONFIG_LIBTOOL_INIT([
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes INIT.
if test -n "\${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
])
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
_LT_CHECK_OBJDIR
m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
case $host_os in
aix3*)
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
;;
esac
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
# Global variables:
ofile=libtool
can_build_shared=yes
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
with_gnu_ld="$lt_cv_prog_gnu_ld"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
# Set sane defaults for various variables
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
test -z "$LD" && LD=ld
test -z "$ac_objext" && ac_objext=o
_LT_CC_BASENAME([$compiler])
# Only perform the check for file, if the check method requires it
test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
_LT_PATH_MAGIC
fi
;;
esac
# Use C for the default configuration in the libtool script
LT_SUPPORTED_TAG([CC])
_LT_LANG_C_CONFIG
_LT_LANG_DEFAULT_CONFIG
_LT_CONFIG_COMMANDS
])# _LT_SETUP
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
# _LT_PROG_LTMAIN
# ---------------
# Note that this code is called both from `configure', and `config.status'
# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
# `config.status' has no value for ac_aux_dir unless we are using Automake,
# so we pass a copy along to make sure it has a sensible value anyway.
m4_defun([_LT_PROG_LTMAIN],
[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
ltmain="$ac_aux_dir/ltmain.sh"
])# _LT_PROG_LTMAIN
## ------------------------------------- ##
## Accumulate code for creating libtool. ##
## ------------------------------------- ##
# So that we can recreate a full libtool script including additional
# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
# in macros and then make a single call at the end using the `libtool'
# label.
# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
# ----------------------------------------
# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL_INIT],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_INIT],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_INIT])
# _LT_CONFIG_LIBTOOL([COMMANDS])
# ------------------------------
# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
m4_define([_LT_CONFIG_LIBTOOL],
[m4_ifval([$1],
[m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
[$1
])])])
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
# -----------------------------------------------------
m4_defun([_LT_CONFIG_SAVE_COMMANDS],
[_LT_CONFIG_LIBTOOL([$1])
_LT_CONFIG_LIBTOOL_INIT([$2])
])
# _LT_FORMAT_COMMENT([COMMENT])
# -----------------------------
# Add leading comment marks to the start of each line, and a trailing
# full-stop to the whole comment if one is not present already.
m4_define([_LT_FORMAT_COMMENT],
[m4_ifval([$1], [
m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
[['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
)])
## ------------------------ ##
## FIXME: Eliminate VARNAME ##
## ------------------------ ##
# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
# -------------------------------------------------------------------
# CONFIGNAME is the name given to the value in the libtool script.
# VARNAME is the (base) name used in the configure script.
# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
# VARNAME. Any other value will be used directly.
m4_define([_LT_DECL],
[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
[lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
[m4_ifval([$1], [$1], [$2])])
lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
m4_ifval([$4],
[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
lt_dict_add_subkey([lt_decl_dict], [$2],
[tagged?], [m4_ifval([$5], [yes], [no])])])
])
# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
# --------------------------------------------------------
m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_tag_varnames],
[_lt_decl_filter([tagged?], [yes], $@)])
# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
# ---------------------------------------------------------
m4_define([_lt_decl_filter],
[m4_case([$#],
[0], [m4_fatal([$0: too few arguments: $#])],
[1], [m4_fatal([$0: too few arguments: $#: $1])],
[2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
[3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
[lt_dict_filter([lt_decl_dict], $@)])[]dnl
])
# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
# --------------------------------------------------
m4_define([lt_decl_quote_varnames],
[_lt_decl_filter([value], [1], $@)])
# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_dquote_varnames],
[_lt_decl_filter([value], [2], $@)])
# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
# ---------------------------------------------------
m4_define([lt_decl_varnames_tagged],
[m4_assert([$# <= 2])dnl
_$0(m4_quote(m4_default([$1], [[, ]])),
m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
m4_define([_lt_decl_varnames_tagged],
[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
# ------------------------------------------------
m4_define([lt_decl_all_varnames],
[_$0(m4_quote(m4_default([$1], [[, ]])),
m4_if([$2], [],
m4_quote(lt_decl_varnames),
m4_quote(m4_shift($@))))[]dnl
])
m4_define([_lt_decl_all_varnames],
[lt_join($@, lt_decl_varnames_tagged([$1],
lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
])
# _LT_CONFIG_STATUS_DECLARE([VARNAME])
# ------------------------------------
# Quote a variable value, and forward it to `config.status' so that its
# declaration there will have the same value as in `configure'. VARNAME
# must have a single quote delimited value for this to work.
m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
# _LT_CONFIG_STATUS_DECLARATIONS
# ------------------------------
# We delimit libtool config variables with single quotes, so when
# we write them to config.status, we have to be sure to quote all
# embedded single quotes properly. In configure, this macro expands
# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
#
-# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+# <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
[m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAGS
# ----------------
# Output comment and list of tags supported by the script
m4_defun([_LT_LIBTOOL_TAGS],
[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
available_tags="_LT_TAGS"dnl
])
# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
# -----------------------------------
# Extract the dictionary values for VARNAME (optionally with TAG) and
# expand to a commented shell variable setting:
#
# # Some comment about what VAR is for.
# visible_name=$lt_internal_name
m4_define([_LT_LIBTOOL_DECLARE],
[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
[description])))[]dnl
m4_pushdef([_libtool_name],
m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
[0], [_libtool_name=[$]$1],
[1], [_libtool_name=$lt_[]$1],
[2], [_libtool_name=$lt_[]$1],
[_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
])
# _LT_LIBTOOL_CONFIG_VARS
# -----------------------
# Produce commented declarations of non-tagged libtool config variables
# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
# section) are produced by _LT_LIBTOOL_TAG_VARS.
m4_defun([_LT_LIBTOOL_CONFIG_VARS],
[m4_foreach([_lt_var],
m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
# _LT_LIBTOOL_TAG_VARS(TAG)
# -------------------------
m4_define([_LT_LIBTOOL_TAG_VARS],
[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
[m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
# _LT_TAGVAR(VARNAME, [TAGNAME])
# ------------------------------
m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
# _LT_CONFIG_COMMANDS
# -------------------
# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
# variables for single and double quote escaping we saved from calls
# to _LT_DECL, we can put quote escaped variables declarations
# into `config.status', and then the shell code to quote escape them in
# for loops in `config.status'. Finally, any additional code accumulated
# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
m4_defun([_LT_CONFIG_COMMANDS],
[AC_PROVIDE_IFELSE([LT_OUTPUT],
dnl If the libtool generation code has been placed in $CONFIG_LT,
dnl instead of duplicating it all over again into config.status,
dnl then we will have config.status run $CONFIG_LT later, so it
dnl needs to know what name is stored there:
[AC_CONFIG_COMMANDS([libtool],
[$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
dnl If the libtool generation code is destined for config.status,
dnl expand the accumulated commands and init code now:
[AC_CONFIG_COMMANDS([libtool],
[_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
])#_LT_CONFIG_COMMANDS
# Initialize.
m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
[
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
sed_quote_subst='$sed_quote_subst'
double_quote_subst='$double_quote_subst'
delay_variable_subst='$delay_variable_subst'
_LT_CONFIG_STATUS_DECLARATIONS
LTCC='$LTCC'
LTCFLAGS='$LTCFLAGS'
compiler='$compiler_DEFAULT'
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
# Quote evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_quote_varnames); do
- case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
*[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
# Double-quote double-evaled strings.
for var in lt_decl_all_varnames([[ \
]], lt_decl_dquote_varnames); do
- case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
*[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
;;
*)
eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
;;
esac
done
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+ lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+ ;;
+esac
+
_LT_OUTPUT_LIBTOOL_INIT
])
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable. If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins. After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script. The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
# LT_OUTPUT
# ---------
# This macro allows early generation of the libtool script (before
# AC_OUTPUT is called), incase it is used in configure for compilation
# tests.
AC_DEFUN([LT_OUTPUT],
[: ${CONFIG_LT=./config.lt}
AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
cat >>"$CONFIG_LT" <<\_LTEOF
-lt_cl_silent=false
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
exec AS_MESSAGE_LOG_FD>>config.log
{
echo
AS_BOX([Running $as_me.])
} >&AS_MESSAGE_LOG_FD
lt_cl_help="\
\`$as_me' creates a local libtool stub from the current configuration,
for use in further configure time tests before the real libtool is
generated.
Usage: $[0] [[OPTIONS]]
-h, --help print this help, then exit
-V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
configured by $[0], generated by m4_PACKAGE_STRING.
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
This config.lt script is free software; the Free Software Foundation
gives unlimited permision to copy, distribute and modify it."
while test $[#] != 0
do
case $[1] in
--version | --v* | -V )
echo "$lt_cl_version"; exit 0 ;;
--help | --h* | -h )
echo "$lt_cl_help"; exit 0 ;;
--debug | --d* | -d )
debug=: ;;
--quiet | --q* | --silent | --s* | -q )
lt_cl_silent=: ;;
-*) AC_MSG_ERROR([unrecognized option: $[1]
Try \`$[0] --help' for more information.]) ;;
*) AC_MSG_ERROR([unrecognized argument: $[1]
Try \`$[0] --help' for more information.]) ;;
esac
shift
done
if $lt_cl_silent; then
exec AS_MESSAGE_FD>/dev/null
fi
_LTEOF
cat >>"$CONFIG_LT" <<_LTEOF
_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
_LTEOF
cat >>"$CONFIG_LT" <<\_LTEOF
AC_MSG_NOTICE([creating $ofile])
_LT_OUTPUT_LIBTOOL_COMMANDS
AS_EXIT(0)
_LTEOF
chmod +x "$CONFIG_LT"
# configure is writing to config.log, but config.lt does its own redirection,
# appending to config.log, which fails on DOS, as config.log is still kept
# open by configure. Here we exec the FD to /dev/null, effectively closing
# config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
- lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
+if test "$no_create" != yes; then
+ lt_cl_success=:
+ test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+ exec AS_MESSAGE_LOG_FD>/dev/null
+ $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+ exec AS_MESSAGE_LOG_FD>>config.log
+ $lt_cl_success || AS_EXIT(1)
+fi
])# LT_OUTPUT
# _LT_CONFIG(TAG)
# ---------------
# If TAG is the built-in tag, create an initial libtool script with a
# default configuration from the untagged config vars. Otherwise add code
# to config.status for appending the configuration named by TAG from the
# matching tagged config vars.
m4_defun([_LT_CONFIG],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_CONFIG_SAVE_COMMANDS([
m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
m4_if(_LT_TAG, [C], [
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes.
if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
$RM "$cfgfile"
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
_LT_COPYING
_LT_LIBTOOL_TAGS
# ### BEGIN LIBTOOL CONFIG
_LT_LIBTOOL_CONFIG_VARS
_LT_LIBTOOL_TAG_VARS
# ### END LIBTOOL CONFIG
_LT_EOF
case $host_os in
aix3*)
cat <<\_LT_EOF >> "$cfgfile"
# AIX sometimes has problems with the GCC collect2 program. For some
# reason, if we set the COLLECT_NAMES environment variable, the problems
# vanish in a puff of smoke.
if test "X${COLLECT_NAMES+set}" != Xset; then
COLLECT_NAMES=
export COLLECT_NAMES
fi
_LT_EOF
;;
esac
_LT_PROG_LTMAIN
# We use sed instead of cat because bash on DJGPP gets confused if
# if finds mixed CR/LF and LF-only lines. Since sed operates in
# text mode, it properly converts lines to CR/LF. This bash problem
# is reportedly fixed, but why not run on old versions too?
- sed '$q' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- _LT_PROG_REPLACE_SHELLFNS
-
- mv -f "$cfgfile" "$ofile" ||
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_XSI_SHELLFNS
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
(rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
chmod +x "$ofile"
],
[cat <<_LT_EOF >> "$ofile"
dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
dnl in a comment (ie after a #).
# ### BEGIN LIBTOOL TAG CONFIG: $1
_LT_LIBTOOL_TAG_VARS(_LT_TAG)
# ### END LIBTOOL TAG CONFIG: $1
_LT_EOF
])dnl /m4_if
],
[m4_if([$1], [], [
PACKAGE='$PACKAGE'
VERSION='$VERSION'
TIMESTAMP='$TIMESTAMP'
RM='$RM'
ofile='$ofile'], [])
])dnl /_LT_CONFIG_SAVE_COMMANDS
])# _LT_CONFIG
# LT_SUPPORTED_TAG(TAG)
# ---------------------
# Trace this macro to discover what tags are supported by the libtool
# --tag option, using:
# autoconf --trace 'LT_SUPPORTED_TAG:$1'
AC_DEFUN([LT_SUPPORTED_TAG], [])
# C support is built-in for now
m4_define([_LT_LANG_C_enabled], [])
m4_define([_LT_TAGS], [])
# LT_LANG(LANG)
# -------------
# Enable libtool support for the given language if not already enabled.
AC_DEFUN([LT_LANG],
[AC_BEFORE([$0], [LT_OUTPUT])dnl
m4_case([$1],
[C], [_LT_LANG(C)],
[C++], [_LT_LANG(CXX)],
[Java], [_LT_LANG(GCJ)],
[Fortran 77], [_LT_LANG(F77)],
[Fortran], [_LT_LANG(FC)],
[Windows Resource], [_LT_LANG(RC)],
[m4_ifdef([_LT_LANG_]$1[_CONFIG],
[_LT_LANG($1)],
[m4_fatal([$0: unsupported language: "$1"])])])dnl
])# LT_LANG
# _LT_LANG(LANGNAME)
# ------------------
m4_defun([_LT_LANG],
[m4_ifdef([_LT_LANG_]$1[_enabled], [],
[LT_SUPPORTED_TAG([$1])dnl
m4_append([_LT_TAGS], [$1 ])dnl
m4_define([_LT_LANG_]$1[_enabled], [])dnl
_LT_LANG_$1_CONFIG($1)])dnl
])# _LT_LANG
# _LT_LANG_DEFAULT_CONFIG
# -----------------------
m4_defun([_LT_LANG_DEFAULT_CONFIG],
[AC_PROVIDE_IFELSE([AC_PROG_CXX],
[LT_LANG(CXX)],
[m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
AC_PROVIDE_IFELSE([AC_PROG_F77],
[LT_LANG(F77)],
[m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
AC_PROVIDE_IFELSE([AC_PROG_FC],
[LT_LANG(FC)],
[m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
dnl pulling things in needlessly.
AC_PROVIDE_IFELSE([AC_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
[LT_LANG(GCJ)],
[AC_PROVIDE_IFELSE([LT_PROG_GCJ],
[LT_LANG(GCJ)],
[m4_ifdef([AC_PROG_GCJ],
[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([A][M_PROG_GCJ],
[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
m4_ifdef([LT_PROG_GCJ],
[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
AC_PROVIDE_IFELSE([LT_PROG_RC],
[LT_LANG(RC)],
[m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
])# _LT_LANG_DEFAULT_CONFIG
# Obsolete macros:
AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
dnl AC_DEFUN([AC_LIBTOOL_F77], [])
dnl AC_DEFUN([AC_LIBTOOL_FC], [])
dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
# _LT_TAG_COMPILER
# ----------------
m4_defun([_LT_TAG_COMPILER],
[AC_REQUIRE([AC_PROG_CC])dnl
_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
# If no C compiler flags were specified, use CFLAGS.
LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
])# _LT_TAG_COMPILER
# _LT_COMPILER_BOILERPLATE
# ------------------------
# Check for compiler boilerplate output or warnings with
# the simple compiler test code.
m4_defun([_LT_COMPILER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" >conftest.$ac_ext
eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_compiler_boilerplate=`cat conftest.err`
$RM conftest*
])# _LT_COMPILER_BOILERPLATE
# _LT_LINKER_BOILERPLATE
# ----------------------
# Check for linker boilerplate output or warnings with
# the simple link test code.
m4_defun([_LT_LINKER_BOILERPLATE],
[m4_require([_LT_DECL_SED])dnl
ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
$RM -r conftest*
])# _LT_LINKER_BOILERPLATE
# _LT_REQUIRED_DARWIN_CHECKS
# -------------------------
m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
case $host_os in
rhapsody* | darwin*)
AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
AC_CHECK_TOOL([LIPO], [lipo], [:])
AC_CHECK_TOOL([OTOOL], [otool], [:])
AC_CHECK_TOOL([OTOOL64], [otool64], [:])
_LT_DECL([], [DSYMUTIL], [1],
[Tool to manipulate archived DWARF debug symbol files on Mac OS X])
_LT_DECL([], [NMEDIT], [1],
[Tool to change global to local symbols on Mac OS X])
_LT_DECL([], [LIPO], [1],
[Tool to manipulate fat objects and archives on Mac OS X])
_LT_DECL([], [OTOOL], [1],
[ldd/readelf like tool for Mach-O binaries on Mac OS X])
_LT_DECL([], [OTOOL64], [1],
[ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
[lt_cv_apple_cc_single_mod=no
if test -z "${LT_MULTI_MODULE}"; then
# By default we will add the -single_module flag. You can override
# by either setting the environment variable LT_MULTI_MODULE
# non-empty at configure time, or by adding -multi_module to the
# link flags.
rm -rf libconftest.dylib*
echo "int foo(void){return 1;}" > conftest.c
echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-dynamiclib -Wl,-single_module conftest.c 2>conftest.err
_lt_result=$?
if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
lt_cv_apple_cc_single_mod=yes
else
cat conftest.err >&AS_MESSAGE_LOG_FD
fi
rm -rf libconftest.dylib*
rm -f conftest.*
fi])
AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[lt_cv_ld_exported_symbols_list=yes],
[lt_cv_ld_exported_symbols_list=no])
LDFLAGS="$save_LDFLAGS"
])
- AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
- [lt_cv_ld_force_load=no
- cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
- $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
- echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
- $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
- echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
- $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
- cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
- $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
- _lt_result=$?
- if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
- lt_cv_ld_force_load=yes
- else
- cat conftest.err >&AS_MESSAGE_LOG_FD
- fi
- rm -f conftest.err libconftest.a conftest conftest.c
- rm -rf conftest.dSYM
- ])
case $host_os in
rhapsody* | darwin1.[[012]])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
10.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
if test "$lt_cv_apple_cc_single_mod" = "yes"; then
_lt_dar_single_mod='$single_module'
fi
if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
_lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
else
_lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
fi
- if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ if test "$DSYMUTIL" != ":"; then
_lt_dsymutil='~$DSYMUTIL $lib || :'
else
_lt_dsymutil=
fi
;;
esac
])
# _LT_DARWIN_LINKER_FEATURES
# --------------------------
# Checks for linker and compiler features on darwin
m4_defun([_LT_DARWIN_LINKER_FEATURES],
[
m4_require([_LT_REQUIRED_DARWIN_CHECKS])
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- if test "$lt_cv_ld_force_load" = "yes"; then
- _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
- else
- _LT_TAGVAR(whole_archive_flag_spec, $1)=''
- fi
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
case $cc_basename in
ifort*) _lt_dar_can_shared=yes ;;
*) _lt_dar_can_shared=$GCC ;;
esac
if test "$_lt_dar_can_shared" = "yes"; then
- output_verbose_link_cmd=func_echo_all
+ output_verbose_link_cmd=echo
_LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
_LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
_LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
m4_if([$1], [CXX],
[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
_LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
_LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
fi
],[])
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
])
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
# Links a minimal program and checks the executable
# for the system default hardcoded library path. In most cases,
# this is /usr/lib:/lib, but when the MPI compilers are used
# the location of the communication and MPI libs are included too.
# If we don't find anything, use the default library path according
# to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
m4_defun([_LT_SYS_MODULE_PATH_AIX],
[m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
- aix_libpath=$lt_cv_aix_libpath
-else
- AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
- lt_aix_libpath_sed='[
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }]'
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- # Check for a 64-bit object if we didn't find anything.
- if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi],[])
- if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
- fi
- ])
- aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
])# _LT_SYS_MODULE_PATH_AIX
# _LT_SHELL_INIT(ARG)
# -------------------
m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
# _LT_PROG_ECHO_BACKSLASH
# -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
- test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='printf %s\n'
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
else
- # Use this function as a fallback that always works.
- func_fallback_echo ()
- {
- eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
- }
- ECHO='func_fallback_echo'
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
fi
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
- $ECHO "$*"
-}
-
-case "$ECHO" in
- printf*) AC_MSG_RESULT([printf]) ;;
- print*) AC_MSG_RESULT([print -r]) ;;
- *) AC_MSG_RESULT([cat]) ;;
-esac
-
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
- test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
- ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
- ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
- ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
- PATH=/empty FPATH=/empty; export PATH FPATH
- test "X`printf %s $ECHO`" = "X$ECHO" \
- || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
-
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+[$]*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+_LT_DECL([], [ECHO], [1],
+ [An echo program that does not interpret backslashes])
])# _LT_PROG_ECHO_BACKSLASH
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[ --with-sysroot[=DIR] Search for dependent libraries within DIR
- (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted. We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
- if test "$GCC" = yes; then
- lt_sysroot=`$CC --print-sysroot 2>/dev/null`
- fi
- ;; #(
- /*)
- lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
- ;; #(
- no|'')
- ;; #(
- *)
- AC_MSG_RESULT([${with_sysroot}])
- AC_MSG_ERROR([The sysroot must be an absolute path.])
- ;;
-esac
-
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
-
# _LT_ENABLE_LOCK
# ---------------
m4_defun([_LT_ENABLE_LOCK],
[AC_ARG_ENABLE([libtool-lock],
[AS_HELP_STRING([--disable-libtool-lock],
[avoid locking (might break parallel builds)])])
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case $host in
ia64-*-hpux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
*ELF-32*)
HPUX_IA64_MODE="32"
;;
*ELF-64*)
HPUX_IA64_MODE="64"
;;
esac
fi
rm -rf conftest*
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
if test "$lt_cv_prog_gnu_ld" = yes; then
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -melf32bsmip"
;;
*N32*)
LD="${LD-ld} -melf32bmipn32"
;;
*64-bit*)
LD="${LD-ld} -melf64bmip"
;;
esac
else
case `/usr/bin/file conftest.$ac_objext` in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
fi
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*32-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
LD="${LD-ld} -m elf_s390"
;;
sparc64-*linux*)
LD="${LD-ld} -m elf32_sparc"
;;
esac
;;
*64-bit*)
case $host in
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
ppc*-*linux*|powerpc*-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
LD="${LD-ld} -m elf64_s390"
;;
sparc*-*linux*)
LD="${LD-ld} -m elf64_sparc"
;;
esac
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_LANG_PUSH(C)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
AC_LANG_POP])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
sparc*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
yes*) LD="${LD-ld} -m elf64_sparc" ;;
*)
if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
LD="${LD-ld} -64"
fi
;;
esac
;;
esac
fi
rm -rf conftest*
;;
esac
need_locks="$enable_libtool_lock"
])# _LT_ENABLE_LOCK
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
- [lt_cv_ar_at_file=no
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
- [echo conftest.$ac_objext > conftest.lst
- lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
- AC_TRY_EVAL([lt_ar_try])
- if test "$ac_status" -eq 0; then
- # Ensure the archiver fails upon bogus file names.
- rm -f conftest.$ac_objext libconftest.a
- AC_TRY_EVAL([lt_ar_try])
- if test "$ac_status" -ne 0; then
- lt_cv_ar_at_file=@
- fi
- fi
- rm -f conftest.* libconftest.a
- ])
- ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
- archiver_list_spec=
-else
- archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
- [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
# _LT_CMD_OLD_ARCHIVE
# -------------------
m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
AC_CHECK_TOOL(STRIP, strip, :)
test -z "$STRIP" && STRIP=:
_LT_DECL([], [STRIP], [1], [A symbol stripping program])
AC_CHECK_TOOL(RANLIB, ranlib, :)
test -z "$RANLIB" && RANLIB=:
_LT_DECL([], [RANLIB], [1],
[Commands used to install an old-style archive])
# Determine commands to create old-style static archives.
old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
old_postinstall_cmds='chmod 644 $oldlib'
old_postuninstall_cmds=
if test -n "$RANLIB"; then
case $host_os in
openbsd*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
;;
*)
old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
;;
esac
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
fi
-
-case $host_os in
- darwin*)
- lock_old_archive_extraction=yes ;;
- *)
- lock_old_archive_extraction=no ;;
-esac
_LT_DECL([], [old_postinstall_cmds], [2])
_LT_DECL([], [old_postuninstall_cmds], [2])
_LT_TAGDECL([], [old_archive_cmds], [2],
[Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
- [Whether to use a lock for old archive extraction])
])# _LT_CMD_OLD_ARCHIVE
# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------------------
# Check whether the given compiler option works
AC_DEFUN([_LT_COMPILER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$3"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
# The option is referenced via a variable to avoid confusing sed.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
- $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
fi
$RM conftest*
])
if test x"[$]$2" = xyes; then
m4_if([$5], , :, [$5])
else
m4_if([$6], , :, [$6])
fi
])# _LT_COMPILER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------
# Check whether the given linker option works
AC_DEFUN([_LT_LINKER_OPTION],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $3"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
# The linker can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&AS_MESSAGE_LOG_FD
- $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
else
$2=yes
fi
fi
$RM -r conftest*
LDFLAGS="$save_LDFLAGS"
])
if test x"[$]$2" = xyes; then
m4_if([$4], , :, [$4])
else
m4_if([$5], , :, [$5])
fi
])# _LT_LINKER_OPTION
# Old name:
AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
# LT_CMD_MAX_LEN
#---------------
AC_DEFUN([LT_CMD_MAX_LEN],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
# find the maximum length of command line arguments
AC_MSG_CHECKING([the maximum length of command line arguments])
AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
i=0
teststring="ABCD"
case $build_os in
msdosdjgpp*)
# On DJGPP, this test can blow up pretty badly due to problems in libc
# (any single argument exceeding 2000 bytes causes a buffer overrun
# during glob expansion). Even if it were fixed, the result of this
# check would be larger than it should be.
lt_cv_sys_max_cmd_len=12288; # 12K is about right
;;
gnu*)
# Under GNU Hurd, this test is not required because there is
# no limit to the length of command line arguments.
# Libtool will interpret -1 as no limit whatsoever
lt_cv_sys_max_cmd_len=-1;
;;
cygwin* | mingw* | cegcc*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
# you end up with a "frozen" computer, even though with patience
# the test eventually succeeds (with a max line length of 256k).
# Instead, let's just punt: use the minimum linelength reported by
# all of the supported platforms: 8192 (on NT/2K/XP).
lt_cv_sys_max_cmd_len=8192;
;;
- mint*)
- # On MiNT this can take a long time and run out of memory.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
lt_cv_sys_max_cmd_len=8192;
;;
netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
# This has been around since 386BSD, at least. Likely further.
if test -x /sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
elif test -x /usr/sbin/sysctl; then
lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
else
lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
fi
# And add a safety zone
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
;;
interix*)
# We know the value 262144 and hardcode it with a safety zone (like BSD)
lt_cv_sys_max_cmd_len=196608
;;
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
# nice to cause kernel panics so lets avoid the loop below.
# First set a reasonable default.
lt_cv_sys_max_cmd_len=16384
#
if test -x /sbin/sysconfig; then
case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
*1*) lt_cv_sys_max_cmd_len=-1 ;;
esac
fi
;;
sco3.2v5*)
lt_cv_sys_max_cmd_len=102400
;;
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
;;
*)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
# Make teststring a little bigger before we do anything with it.
# a 1K string should be a reasonable start.
for i in 1 2 3 4 5 6 7 8 ; do
teststring=$teststring$teststring
done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
- while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
- = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
# Only check the string length outside the loop.
lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
teststring=
# Add a significant safety factor because C++ compilers can tack on
# massive amounts of additional arguments before passing them to the
# linker. It appears as though 1/2 is a usable value.
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
esac
])
if test -n $lt_cv_sys_max_cmd_len ; then
AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
else
AC_MSG_RESULT(none)
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
_LT_DECL([], [max_cmd_len], [0],
[What is the maximum length of a command?])
])# LT_CMD_MAX_LEN
# Old name:
AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
# _LT_HEADER_DLFCN
# ----------------
m4_defun([_LT_HEADER_DLFCN],
[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
])# _LT_HEADER_DLFCN
# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
# ----------------------------------------------------------------
m4_defun([_LT_TRY_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test "$cross_compiling" = yes; then :
[$4]
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
+[#line __oline__ "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#include <stdio.h>
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_DLGLOBAL DL_GLOBAL
# else
# define LT_DLGLOBAL 0
# endif
#endif
/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
# ifdef RTLD_LAZY
# define LT_DLLAZY_OR_NOW RTLD_LAZY
# else
# ifdef DL_LAZY
# define LT_DLLAZY_OR_NOW DL_LAZY
# else
# ifdef RTLD_NOW
# define LT_DLLAZY_OR_NOW RTLD_NOW
# else
# ifdef DL_NOW
# define LT_DLLAZY_OR_NOW DL_NOW
# else
# define LT_DLLAZY_OR_NOW 0
# endif
# endif
# endif
# endif
#endif
-/* When -fvisbility=hidden is used, assume the code has been annotated
- correspondingly for the symbols needed. */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown;
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
- else
- {
- if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
- else puts (dlerror ());
- }
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
/* dlclose (self); */
}
else
puts (dlerror ());
return status;
}]
_LT_EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
lt_status=$?
case x$lt_status in
x$lt_dlno_uscore) $1 ;;
x$lt_dlneed_uscore) $2 ;;
x$lt_dlunknown|x*) $3 ;;
esac
else :
# compilation failed
$3
fi
fi
rm -fr conftest*
])# _LT_TRY_DLOPEN_SELF
# LT_SYS_DLOPEN_SELF
# ------------------
AC_DEFUN([LT_SYS_DLOPEN_SELF],
[m4_require([_LT_HEADER_DLFCN])dnl
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
else
lt_cv_dlopen=no
lt_cv_dlopen_libs=
case $host_os in
beos*)
lt_cv_dlopen="load_add_on"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
;;
mingw* | pw32* | cegcc*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
;;
darwin*)
# if libdl is installed we need to link against it
AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
lt_cv_dlopen="dyld"
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
;;
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
[AC_CHECK_LIB([dld], [shl_load],
[lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
[AC_CHECK_FUNC([dlopen],
[lt_cv_dlopen="dlopen"],
[AC_CHECK_LIB([dl], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
[AC_CHECK_LIB([svld], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
[AC_CHECK_LIB([dld], [dld_link],
[lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
])
])
])
])
])
;;
esac
if test "x$lt_cv_dlopen" != xno; then
enable_dlopen=yes
else
enable_dlopen=no
fi
case $lt_cv_dlopen in
dlopen)
save_CPPFLAGS="$CPPFLAGS"
test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
save_LDFLAGS="$LDFLAGS"
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
AC_CACHE_CHECK([whether a program can dlopen itself],
lt_cv_dlopen_self, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
])
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
lt_cv_dlopen_self_static, [dnl
_LT_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
])
fi
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
;;
esac
case $lt_cv_dlopen_self in
yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
*) enable_dlopen_self=unknown ;;
esac
case $lt_cv_dlopen_self_static in
yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
*) enable_dlopen_self_static=unknown ;;
esac
fi
_LT_DECL([dlopen_support], [enable_dlopen], [0],
[Whether dlopen is supported])
_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
[Whether dlopen of programs is supported])
_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
[Whether dlopen of statically linked programs is supported])
])# LT_SYS_DLOPEN_SELF
# Old name:
AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
# _LT_COMPILER_C_O([TAGNAME])
# ---------------------------
# Check to see if options -c and -o are simultaneously supported by compiler.
# This macro does not hard code the compiler like AC_PROG_CC_C_O.
m4_defun([_LT_COMPILER_C_O],
[m4_require([_LT_DECL_SED])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
[_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
$RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-o out/conftest2.$ac_objext"
# Insert the option either (1) after the last *FLAGS variable, or
# (2) before a word containing "conftest.", or (3) at the end.
# Note that $ac_compile itself does not contain backslashes and begins
# with a dollar sign (not a hyphen), so the echo should work correctly.
lt_compile=`echo "$ac_compile" | $SED \
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
- $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
fi
fi
chmod u+w . 2>&AS_MESSAGE_LOG_FD
$RM conftest*
# SGI C++ compiler will create directory out/ii_files/ for
# template instantiation
test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
$RM out/* && rmdir out
cd ..
$RM -r conftest
$RM conftest*
])
_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
[Does compiler simultaneously support -c and -o options?])
])# _LT_COMPILER_C_O
# _LT_COMPILER_FILE_LOCKS([TAGNAME])
# ----------------------------------
# Check to see if we can do hard links to lock some files if needed
m4_defun([_LT_COMPILER_FILE_LOCKS],
[m4_require([_LT_ENABLE_LOCK])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
_LT_COMPILER_C_O([$1])
hard_links="nottested"
if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
AC_MSG_CHECKING([if we can lock with hard links])
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
AC_MSG_RESULT([$hard_links])
if test "$hard_links" = no; then
AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
need_locks=warn
fi
else
need_locks=no
fi
_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
])# _LT_COMPILER_FILE_LOCKS
# _LT_CHECK_OBJDIR
# ----------------
m4_defun([_LT_CHECK_OBJDIR],
[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
[rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
lt_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
lt_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null])
objdir=$lt_cv_objdir
_LT_DECL([], [objdir], [0],
[The name of the directory that contains temporary libtool files])dnl
m4_pattern_allow([LT_OBJDIR])dnl
AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
[Define to the sub-directory in which libtool stores uninstalled libraries.])
])# _LT_CHECK_OBJDIR
# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
# --------------------------------------
# Check hardcoding attributes.
m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
_LT_TAGVAR(hardcode_action, $1)=
if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
test -n "$_LT_TAGVAR(runpath_var, $1)" ||
test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
# We can hardcode non-existent directories.
if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
# If the only mechanism to avoid hardcoding is shlibpath_var, we
# have to relink, otherwise we might link with an installed library
# when we should be linking with a yet-to-be-installed one
## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
# Linking always hardcodes the temporary library directory.
_LT_TAGVAR(hardcode_action, $1)=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
_LT_TAGVAR(hardcode_action, $1)=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
_LT_TAGVAR(hardcode_action, $1)=unsupported
fi
AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
test "$enable_shared" = no; then
# Fast installation is not necessary
enable_fast_install=needless
fi
_LT_TAGDECL([], [hardcode_action], [0],
[How to hardcode a shared library path into an executable])
])# _LT_LINKER_HARDCODE_LIBPATH
# _LT_CMD_STRIPLIB
# ----------------
m4_defun([_LT_CMD_STRIPLIB],
[m4_require([_LT_DECL_EGREP])
striplib=
old_striplib=
AC_MSG_CHECKING([whether stripping libraries is possible])
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
AC_MSG_RESULT([yes])
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
darwin*)
if test -n "$STRIP" ; then
striplib="$STRIP -x"
old_striplib="$STRIP -S"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
;;
*)
AC_MSG_RESULT([no])
;;
esac
fi
_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
_LT_DECL([], [striplib], [1])
])# _LT_CMD_STRIPLIB
# _LT_SYS_DYNAMIC_LINKER([TAG])
# -----------------------------
# PORTME Fill in your ld.so characteristics
m4_defun([_LT_SYS_DYNAMIC_LINKER],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_OBJDUMP])dnl
m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
m4_if([$1],
[], [
if test "$GCC" = yes; then
case $host_os in
darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
*) lt_awk_arg="/^libraries:/" ;;
esac
- case $host_os in
- mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
- *) lt_sed_strip_eq="s,=/,/,g" ;;
- esac
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
- case $lt_search_path_spec in
- *\;*)
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
- ;;
- *)
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
- ;;
- esac
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
lt_tmp_lt_search_path_spec=
lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
for lt_sys_path in $lt_search_path_spec; do
if test -d "$lt_sys_path/$lt_multi_os_dir"; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
else
test -d "$lt_sys_path" && \
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
- lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
for (lt_i = NF; lt_i > 0; lt_i--) {
if ($lt_i != "" && $lt_i != ".") {
if ($lt_i == "..") {
lt_count++;
} else {
if (lt_count == 0) {
lt_foo="/" $lt_i lt_foo;
} else {
lt_count--;
}
}
}
}
if (lt_foo != "") { lt_freq[[lt_foo]]++; }
if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
}'`
- # AWK program above erroneously prepends '/' to C:/dos/paths
- # for these hosts.
- case $host_os in
- mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
- $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
- esac
- sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi])
library_names_spec=
libname_spec='lib$name'
soname_spec=
shrext_cmds=".so"
postinstall_cmds=
postuninstall_cmds=
finish_cmds=
finish_eval=
shlibpath_var=
shlibpath_overrides_runpath=unknown
version_type=none
dynamic_linker="$host_os ld.so"
sys_lib_dlsearch_path_spec="/lib /usr/lib"
need_lib_prefix=unknown
hardcode_into_libs=no
# when you set need_version to no, make sure it does not cause -set_version
# flags to be left without arguments
need_version=unknown
case $host_os in
aix3*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
# AIX 3 has no versioning support, so we append a major version to the name.
soname_spec='${libname}${release}${shared_ext}$major'
;;
aix[[4-9]]*)
version_type=linux
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
if test "$host_cpu" = ia64; then
# AIX 5 supports IA64
library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
else
# With GCC up to 2.95.x, collect2 would create an import file
# for dependence libraries. The import file would start with
# the line `#! .'. This would cause the generated library to
# depend on `.', always an invalid library. This was fixed in
# development snapshots of GCC prior to 3.0.
case $host_os in
aix4 | aix4.[[01]] | aix4.[[01]].*)
if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
echo ' yes '
echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
:
else
can_build_shared=no
fi
;;
esac
# AIX (on Power*) has no versioning support, so currently we can not hardcode correct
# soname into executable. Probably we can add versioning support to
# collect2, so additional links can be useful in future.
if test "$aix_use_runtimelinking" = yes; then
# If using run time linking (on AIX 4.2 or later) use lib<name>.so
# instead of lib<name>.a to let people know that these are not
# typical AIX shared libraries.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
else
# We preserve .a as extension for shared libraries through AIX4.2
# and later when we are not doing run time linking.
library_names_spec='${libname}${release}.a $libname.a'
soname_spec='${libname}${release}${shared_ext}$major'
fi
shlibpath_var=LIBPATH
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# Since July 2007 AmigaOS4 officially supports .so libraries.
# When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
;;
m68k)
library_names_spec='$libname.ixlibrary $libname.a'
# Create ${libname}_ixlibrary.a entries in /sys/libs.
- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
;;
esac
;;
beos*)
library_names_spec='${libname}${shared_ext}'
dynamic_linker="$host_os ld.so"
shlibpath_var=LIBRARY_PATH
;;
bsdi[[45]]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
# the default ld.so.conf also contains /usr/contrib/lib and
# /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
# libtool to hard-code these into programs
;;
cygwin* | mingw* | pw32* | cegcc*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
- case $GCC,$cc_basename in
- yes,*)
- # gcc
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
library_names_spec='$libname.dll.a'
# DLL is installed to $(libdir)/../bin by postinstall_cmds
postinstall_cmds='base_file=`basename \${file}`~
dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
dldir=$destdir/`dirname \$dlpath`~
test -d \$dldir || mkdir -p \$dldir~
$install_prog $dir/$dlname \$dldir/$dlname~
chmod a+x \$dldir/$dlname~
if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
$RM \$dlpath'
shlibpath_overrides_runpath=yes
case $host_os in
cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib'
soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-m4_if([$1], [],[
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
mingw* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
;;
esac
- dynamic_linker='Win32 ld.exe'
;;
- *,cl*)
- # Native MSVC
- libname_spec='$name'
- soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
- library_names_spec='${libname}.dll.lib'
-
- case $build_os in
- mingw*)
- sys_lib_search_path_spec=
- lt_save_ifs=$IFS
- IFS=';'
- for lt_path in $LIB
- do
- IFS=$lt_save_ifs
- # Let DOS variable expansion print the short 8.3 style file name.
- lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
- sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
- done
- IFS=$lt_save_ifs
- # Convert to MSYS style.
- sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
- ;;
- cygwin*)
- # Convert to unix form, then to dos form, then back to unix form
- # but this time dos style (no spaces!) so that the unix form looks
- # like /cygdrive/c/PROGRA~1:/cygdr...
- sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
- sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
- sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- ;;
- *)
- sys_lib_search_path_spec="$LIB"
- if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
- # It is most probably a Windows format PATH.
- sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
- else
- sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- # FIXME: find the short name or the path components, as spaces are
- # common. (e.g. "Program Files" -> "PROGRA~1")
- ;;
- esac
-
- # DLL is installed to $(libdir)/../bin by postinstall_cmds
- postinstall_cmds='base_file=`basename \${file}`~
- dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
- dldir=$destdir/`dirname \$dlpath`~
- test -d \$dldir || mkdir -p \$dldir~
- $install_prog $dir/$dlname \$dldir/$dlname'
- postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
- dlpath=$dir/\$dldll~
- $RM \$dlpath'
- shlibpath_overrides_runpath=yes
- dynamic_linker='Win32 link.exe'
- ;;
-
*)
- # Assume MSVC wrapper
library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
- dynamic_linker='Win32 ld.exe'
;;
esac
+ dynamic_linker='Win32 ld.exe'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
darwin* | rhapsody*)
dynamic_linker="$host_os dyld"
version_type=darwin
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
freebsd1*)
dynamic_linker=no
;;
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
if test -x /usr/bin/objformat; then
objformat=`/usr/bin/objformat`
else
case $host_os in
freebsd[[123]]*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
version_type=freebsd-$objformat
case $version_type in
freebsd-elf*)
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
need_version=no
need_lib_prefix=no
;;
freebsd-*)
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
need_version=yes
;;
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
freebsd2*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
*) # from 4.6 on, and DragonFly
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
esac
;;
gnu*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
hardcode_into_libs=yes
;;
-haiku*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- dynamic_linker="$host_os runtime_loader"
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
- hardcode_into_libs=yes
- ;;
-
hpux9* | hpux10* | hpux11*)
# Give a soname corresponding to the major version so that dld.sl refuses to
# link against other versions.
version_type=sunos
need_lib_prefix=no
need_version=no
case $host_cpu in
ia64*)
shrext_cmds='.so'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.so"
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
if test "X$HPUX_IA64_MODE" = X32; then
sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
else
sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
fi
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
hppa*64*)
shrext_cmds='.sl'
hardcode_into_libs=yes
dynamic_linker="$host_os dld.sl"
shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
;;
*)
shrext_cmds='.sl'
dynamic_linker="$host_os dld.sl"
shlibpath_var=SHLIB_PATH
shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
- # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
postinstall_cmds='chmod 555 $lib'
- # or fails outright, so override atomically:
- install_override_mode=555
;;
interix[[3-9]]*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
irix5* | irix6* | nonstopux*)
case $host_os in
nonstopux*) version_type=nonstopux ;;
*)
if test "$lt_cv_prog_gnu_ld" = yes; then
version_type=linux
else
version_type=irix
fi ;;
esac
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
case $host_os in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in # libtool.m4 will add one of these switches to LD
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
libsuff= shlibsuff= libmagic=32-bit;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
libsuff=32 shlibsuff=N32 libmagic=N32;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
libsuff=64 shlibsuff=64 libmagic=64-bit;;
*) libsuff= shlibsuff= libmagic=never-match;;
esac
;;
esac
shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
shlibpath_overrides_runpath=no
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
hardcode_into_libs=yes
;;
# No shared lib support for Linux oldld, aout, or coff.
linux*oldld* | linux*aout* | linux*coff*)
dynamic_linker=no
;;
# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
-
# Some binutils ld are patched to set DT_RUNPATH
- AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
- [lt_cv_shlibpath_overrides_runpath=no
- save_LDFLAGS=$LDFLAGS
- save_libdir=$libdir
- eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
- LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
- [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
- [lt_cv_shlibpath_overrides_runpath=yes])])
- LDFLAGS=$save_LDFLAGS
- libdir=$save_libdir
- ])
- shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
hardcode_into_libs=yes
+ # Add ABI-specific directories to the system library path.
+ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
# GNU dynamic linker. Since this was broken with cross compilers,
# most powerpc-linux boxes support dynamic linking these days and
# people can always --disable-shared, the test was removed, and we
# assume the GNU/Linux dynamic linker is in use.
dynamic_linker='GNU/Linux ld.so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
dynamic_linker='NetBSD (a.out) ld.so'
else
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
dynamic_linker='NetBSD ld.elf_so'
fi
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
newsos6)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
;;
*nto* | *qnx*)
version_type=qnx
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='ldqnx.so'
;;
openbsd*)
version_type=sunos
sys_lib_dlsearch_path_spec="/usr/lib"
need_lib_prefix=no
# Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
case $host_os in
openbsd3.3 | openbsd3.3.*) need_version=yes ;;
*) need_version=no ;;
esac
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
case $host_os in
openbsd2.[[89]] | openbsd2.[[89]].*)
shlibpath_overrides_runpath=no
;;
*)
shlibpath_overrides_runpath=yes
;;
esac
else
shlibpath_overrides_runpath=yes
fi
;;
os2*)
libname_spec='$name'
shrext_cmds=".dll"
need_lib_prefix=no
library_names_spec='$libname${shared_ext} $libname.a'
dynamic_linker='OS/2 ld.exe'
shlibpath_var=LIBPATH
;;
osf3* | osf4* | osf5*)
version_type=osf
need_lib_prefix=no
need_version=no
soname_spec='${libname}${release}${shared_ext}$major'
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;;
rdos*)
dynamic_linker=no
;;
solaris*)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
# ldd complains unless libraries are executable
postinstall_cmds='chmod +x $lib'
;;
sunos4*)
version_type=sunos
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
if test "$with_gnu_ld" = yes; then
need_lib_prefix=no
fi
need_version=yes
;;
sysv4 | sysv4.3*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
case $host_vendor in
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
runpath_var=LD_RUN_PATH
;;
siemens)
need_lib_prefix=no
;;
motorola)
need_lib_prefix=no
need_version=no
shlibpath_overrides_runpath=no
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
;;
esac
;;
sysv4*MP*)
if test -d /usr/nec ;then
version_type=linux
library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
soname_spec='$libname${shared_ext}.$major'
shlibpath_var=LD_LIBRARY_PATH
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
version_type=freebsd-elf
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
if test "$with_gnu_ld" = yes; then
sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
;;
esac
fi
sys_lib_dlsearch_path_spec='/usr/lib'
;;
tpf*)
# TPF is a cross-target only. Preferred cross-host = GNU/Linux.
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
;;
uts4*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
;;
*)
dynamic_linker=no
;;
esac
AC_MSG_RESULT([$dynamic_linker])
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
if test "$GCC" = yes; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
fi
_LT_DECL([], [variables_saved_for_relink], [1],
[Variables whose values should be saved in libtool wrapper scripts and
restored at link time])
_LT_DECL([], [need_lib_prefix], [0],
[Do we need the "lib" prefix for modules?])
_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
_LT_DECL([], [version_type], [0], [Library versioning type])
_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
_LT_DECL([], [shlibpath_overrides_runpath], [0],
[Is shlibpath searched before the hard-coded library search path?])
_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
_LT_DECL([], [library_names_spec], [1],
[[List of archive names. First name is the real one, the rest are links.
The last name is the one that the linker finds with -lNAME]])
_LT_DECL([], [soname_spec], [1],
[[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
- [Permission mode override for installation of shared libraries])
_LT_DECL([], [postinstall_cmds], [2],
[Command to use after installation of a shared archive])
_LT_DECL([], [postuninstall_cmds], [2],
[Command to use after uninstallation of a shared archive])
_LT_DECL([], [finish_cmds], [2],
[Commands used to finish a libtool library installation in a directory])
_LT_DECL([], [finish_eval], [1],
[[As "finish_cmds", except a single script fragment to be evaled but
not shown]])
_LT_DECL([], [hardcode_into_libs], [0],
[Whether we should hardcode library paths into libraries])
_LT_DECL([], [sys_lib_search_path_spec], [2],
[Compile-time system search path for libraries])
_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
[Run-time system search path for libraries])
])# _LT_SYS_DYNAMIC_LINKER
# _LT_PATH_TOOL_PREFIX(TOOL)
# --------------------------
# find a file program which can recognize shared library
AC_DEFUN([_LT_PATH_TOOL_PREFIX],
[m4_require([_LT_DECL_EGREP])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
[case $MAGIC_CMD in
[[\\/*] | ?:[\\/]*])
lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
;;
*)
lt_save_MAGIC_CMD="$MAGIC_CMD"
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
dnl $ac_dummy forces splitting on constant user-supplied paths.
dnl POSIX.2 word splitting is done only on the output of word expansions,
dnl not every word. This closes a longstanding sh security hole.
ac_dummy="m4_if([$2], , $PATH, [$2])"
for ac_dir in $ac_dummy; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$1; then
lt_cv_path_MAGIC_CMD="$ac_dir/$1"
if test -n "$file_magic_test_file"; then
case $deplibs_check_method in
"file_magic "*)
file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
$EGREP "$file_magic_regex" > /dev/null; then
:
else
cat <<_LT_EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
*** The result is that libtool may fail to recognize shared libraries
*** as such. This will affect the creation of libtool libraries that
*** depend on shared libraries, but programs linked with such libtool
*** libraries will work regardless of this problem. Nevertheless, you
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
_LT_EOF
fi ;;
esac
fi
break
fi
done
IFS="$lt_save_ifs"
MAGIC_CMD="$lt_save_MAGIC_CMD"
;;
esac])
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
AC_MSG_RESULT($MAGIC_CMD)
else
AC_MSG_RESULT(no)
fi
_LT_DECL([], [MAGIC_CMD], [0],
[Used to examine libraries when file_magic_cmd begins with "file"])dnl
])# _LT_PATH_TOOL_PREFIX
# Old name:
AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
# _LT_PATH_MAGIC
# --------------
# find a file program which can recognize a shared library
m4_defun([_LT_PATH_MAGIC],
[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
_LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
else
MAGIC_CMD=:
fi
fi
])# _LT_PATH_MAGIC
# LT_PATH_LD
# ----------
# find the pathname to the GNU or non-GNU linker
AC_DEFUN([LT_PATH_LD],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
AC_ARG_WITH([gnu-ld],
[AS_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
[test "$withval" = no || with_gnu_ld=yes],
[with_gnu_ld=no])dnl
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by $CC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
# Canonicalize the pathname of ld
ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(lt_cv_path_LD,
[if test -z "$LD"; then
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
lt_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break
;;
*)
test "$with_gnu_ld" != yes && break
;;
esac
fi
done
IFS="$lt_save_ifs"
else
lt_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$lt_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
_LT_PATH_LD_GNU
AC_SUBST([LD])
_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
])# LT_PATH_LD
# Old names:
AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_PROG_LD], [])
dnl AC_DEFUN([AC_PROG_LD], [])
# _LT_PATH_LD_GNU
#- --------------
m4_defun([_LT_PATH_LD_GNU],
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
lt_cv_prog_gnu_ld=yes
;;
*)
lt_cv_prog_gnu_ld=no
;;
esac])
with_gnu_ld=$lt_cv_prog_gnu_ld
])# _LT_PATH_LD_GNU
# _LT_CMD_RELOAD
# --------------
# find reload flag for linker
# -- PORTME Some linkers may need a different reload flag.
m4_defun([_LT_CMD_RELOAD],
[AC_CACHE_CHECK([for $LD option to reload object files],
lt_cv_ld_reload_flag,
[lt_cv_ld_reload_flag='-r'])
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
*) reload_flag=" $reload_flag" ;;
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
- if test "$GCC" != yes; then
- reload_cmds=false
- fi
- ;;
darwin*)
if test "$GCC" = yes; then
reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
else
reload_cmds='$LD$reload_flag -o $output$reload_objs'
fi
;;
esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
])# _LT_CMD_RELOAD
# _LT_CHECK_MAGIC_METHOD
# ----------------------
# how to check for library dependencies
# -- PORTME fill in with the dynamic library characteristics
m4_defun([_LT_CHECK_MAGIC_METHOD],
[m4_require([_LT_DECL_EGREP])
m4_require([_LT_DECL_OBJDUMP])
AC_CACHE_CHECK([how to recognize dependent libraries],
lt_cv_deplibs_check_method,
[lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
lt_cv_deplibs_check_method='unknown'
# Need to set the preceding variable on all platforms that support
# interlibrary dependencies.
# 'none' -- dependencies not supported.
# `unknown' -- same as none, but documents that we really don't know.
# 'pass_all' -- all dependencies passed with no checks.
# 'test_compile' -- check by making test program.
# 'file_magic [[regex]]' -- check by looking for files in library path
# which responds to the $file_magic_cmd with a given extended regex.
# If you have `file' or equivalent on your system and you're not sure
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
aix[[4-9]]*)
lt_cv_deplibs_check_method=pass_all
;;
beos*)
lt_cv_deplibs_check_method=pass_all
;;
bsdi[[45]]*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
;;
cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
;;
mingw* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
- # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
- if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ if ( file / ) >/dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
- # Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
-cegcc*)
+cegcc)
# use the weaker test based on 'objdump'. See mingw*.
lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
;;
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
esac
else
lt_cv_deplibs_check_method=pass_all
fi
;;
gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-haiku*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
case $host_cpu in
ia64*)
lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
- [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
;;
interix[[3-9]]*)
# PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
;;
irix5* | irix6* | nonstopux*)
case $LD in
*-32|*"-32 ") libmagic=32-bit;;
*-n32|*"-n32 ") libmagic=N32;;
*-64|*"-64 ") libmagic=64-bit;;
*) libmagic=never-match;;
esac
lt_cv_deplibs_check_method=pass_all
;;
# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
fi
;;
newos6*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
*nto* | *qnx*)
lt_cv_deplibs_check_method=pass_all
;;
openbsd*)
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
fi
;;
osf3* | osf4* | osf5*)
lt_cv_deplibs_check_method=pass_all
;;
rdos*)
lt_cv_deplibs_check_method=pass_all
;;
solaris*)
lt_cv_deplibs_check_method=pass_all
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
;;
ncr)
lt_cv_deplibs_check_method=pass_all
;;
sequent)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
;;
sni)
lt_cv_file_magic_cmd='/bin/file'
lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
lt_cv_file_magic_test_file=/lib/libc.so
;;
siemens)
lt_cv_deplibs_check_method=pass_all
;;
pc)
lt_cv_deplibs_check_method=pass_all
;;
esac
;;
tpf*)
lt_cv_deplibs_check_method=pass_all
;;
esac
])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
- case $host_os in
- mingw* | pw32*)
- if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
- want_nocaseglob=yes
- else
- file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
- fi
- ;;
- esac
-fi
-
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
_LT_DECL([], [deplibs_check_method], [1],
[Method to check whether dependent libraries are shared objects])
_LT_DECL([], [file_magic_cmd], [1],
- [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
- [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
- [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+ [Command to use when deplibs_check_method == "file_magic"])
])# _LT_CHECK_MAGIC_METHOD
# LT_PATH_NM
# ----------
# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
lt_cv_path_NM="$NM"
else
lt_nm_to_check="${ac_tool_prefix}nm"
if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
lt_nm_to_check="$lt_nm_to_check nm"
fi
for lt_tmp_nm in $lt_nm_to_check; do
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
tmp_nm="$ac_dir/$lt_tmp_nm"
if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
# Tru64's nm complains that /dev/null is an invalid object file
case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
*/dev/null* | *'Invalid file or object type'*)
lt_cv_path_NM="$tmp_nm -B"
break
;;
*)
case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
*/dev/null*)
lt_cv_path_NM="$tmp_nm -p"
break
;;
*)
lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
;;
esac
;;
esac
fi
done
IFS="$lt_save_ifs"
done
: ${lt_cv_path_NM=no}
fi])
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
# Didn't find any BSD compatible name lister, look for dumpbin.
- if test -n "$DUMPBIN"; then :
- # Let the user override the test.
- else
- AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
- case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
- *COFF*)
- DUMPBIN="$DUMPBIN -symbols"
- ;;
- *)
- DUMPBIN=:
- ;;
- esac
- fi
+ AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
AC_SUBST([DUMPBIN])
if test "$DUMPBIN" != ":"; then
NM="$DUMPBIN"
fi
fi
test -z "$NM" && NM=nm
AC_SUBST([NM])
_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
[lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&AS_MESSAGE_LOG_FD
- (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&AS_MESSAGE_LOG_FD
- (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
cat conftest.out >&AS_MESSAGE_LOG_FD
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*])
])# LT_PATH_NM
# Old names:
AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_PROG_NM], [])
dnl AC_DEFUN([AC_PROG_NM], [])
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-# -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
- # two different shell functions defined in ltmain.sh
- # decide which to use based on capabilities of $DLLTOOL
- case `$DLLTOOL --help 2>&1` in
- *--identify-strict*)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
- ;;
- *)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
- ;;
- esac
- ;;
-*)
- # fallback: assume linklib IS sharedlib
- lt_cv_sharedlib_from_linklib_cmd="$ECHO"
- ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
- [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
- [lt_cv_path_mainfest_tool=no
- echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
- $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
- cat conftest.err >&AS_MESSAGE_LOG_FD
- if $GREP 'Manifest Tool' conftest.out > /dev/null; then
- lt_cv_path_mainfest_tool=yes
- fi
- rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
- MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
# LT_LIB_M
# --------
# check for math library
AC_DEFUN([LT_LIB_M],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
# These system don't have libm, or don't need it
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, cos, LIBM="-lm")
;;
esac
AC_SUBST([LIBM])
])# LT_LIB_M
# Old name:
AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_CHECK_LIBM], [])
# _LT_COMPILER_NO_RTTI([TAGNAME])
# -------------------------------
m4_defun([_LT_COMPILER_NO_RTTI],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
if test "$GCC" = yes; then
- case $cc_basename in
- nvcc*)
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
- *)
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
- esac
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
_LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
lt_cv_prog_compiler_rtti_exceptions,
[-fno-rtti -fno-exceptions], [],
[_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
fi
_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
[Compiler flag to turn off builtin functions])
])# _LT_COMPILER_NO_RTTI
# _LT_CMD_GLOBAL_SYMBOLS
# ----------------------
m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([LT_PATH_NM])dnl
AC_REQUIRE([LT_PATH_LD])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_TAG_COMPILER])dnl
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output from $compiler object])
AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
[
# These are sane defaults that work on at least a few old systems.
# [They come from Ultrix. What could be older than Ultrix?!! ;)]
# Character class describing NM global symbol codes.
symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
# Define system-specific variables.
case $host_os in
aix*)
symcode='[[BCDT]]'
;;
cygwin* | mingw* | pw32* | cegcc*)
symcode='[[ABCDGISTW]]'
;;
hpux*)
if test "$host_cpu" = ia64; then
symcode='[[ABCDEGRST]]'
fi
;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
;;
osf*)
symcode='[[BCDEGQRST]]'
;;
solaris*)
symcode='[[BDRT]]'
;;
sco3.2v5*)
symcode='[[DT]]'
;;
sysv4.2uw2*)
symcode='[[DT]]'
;;
sysv5* | sco5v6* | unixware* | OpenUNIX*)
symcode='[[ABDT]]'
;;
sysv4)
symcode='[[DFNSTU]]'
;;
esac
# If we're using GNU nm, then use its standard symbol codes.
case `$NM -V 2>&1` in
*GNU* | *'with BFD'*)
symcode='[[ABCDGIRSTW]]' ;;
esac
# Transform an extracted symbol line into a proper C declaration.
# Some systems (esp. on ia64) link data and code symbols differently,
# so use this general approach.
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
# Try without a prefix underscore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
if test "$lt_cv_nm_interface" = "MS dumpbin"; then
# Fake it for dumpbin and say T for any non-static function
# and D for any global variable.
# Also find C++ and __fastcall symbols from MSVC++,
# which start with @ or ?.
lt_cv_sys_global_symbol_pipe="$AWK ['"\
" {last_section=section; section=\$ 3};"\
" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
" \$ 0!~/External *\|/{next};"\
" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
" {if(hide[section]) next};"\
" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
" s[1]~/^[@?]/{print s[1], s[1]; next};"\
" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
" ' prfx=^$ac_symprfx]"
else
lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
fi
- lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
cat > conftest.$ac_ext <<_LT_EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
void nm_test_func(void);
void nm_test_func(void){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
- if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
else
rm -f "$nlist"T
fi
# Make sure that we snagged all the symbols we need.
if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
- relocations are performed -- see ld's documentation on pseudo-relocs. */
-# define LT@&t@_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data. */
-# define LT@&t@_DLSYM_CONST
-#else
-# define LT@&t@_DLSYM_CONST const
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
_LT_EOF
# Now generate the symbol file.
eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
cat <<_LT_EOF >> conftest.$ac_ext
/* The mapping between symbol names and symbols. */
-LT@&t@_DLSYM_CONST struct {
+const struct {
const char *name;
void *address;
}
lt__PROGRAM__LTX_preloaded_symbols[[]] =
{
{ "@PROGRAM@", (void *) 0 },
_LT_EOF
$SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
cat <<\_LT_EOF >> conftest.$ac_ext
{0, (void *) 0}
};
/* This works around a problem in FreeBSD linker */
#ifdef FREEBSD_WORKAROUND
static const void *lt_preloaded_setup() {
return lt__PROGRAM__LTX_preloaded_symbols;
}
#endif
#ifdef __cplusplus
}
#endif
_LT_EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
- lt_globsym_save_LIBS=$LIBS
- lt_globsym_save_CFLAGS=$CFLAGS
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
pipe_works=yes
fi
- LIBS=$lt_globsym_save_LIBS
- CFLAGS=$lt_globsym_save_CFLAGS
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
else
echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
fi
else
echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
fi
else
echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.$ac_ext >&5
fi
rm -rf conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
break
else
lt_cv_sys_global_symbol_pipe=
fi
done
])
if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(ok)
fi
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
- nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
- nm_file_list_spec='@'
-fi
-
_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
[Take the output of nm and produce a listing of raw symbols and C names])
_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
[Transform the output of nm in a proper C declaration])
_LT_DECL([global_symbol_to_c_name_address],
[lt_cv_sys_global_symbol_to_c_name_address], [1],
[Transform the output of nm in a C name address pair])
_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
[lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
[Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
- [Specify filename containing input files for $NM])
]) # _LT_CMD_GLOBAL_SYMBOLS
# _LT_COMPILER_PIC([TAGNAME])
# ---------------------------
m4_defun([_LT_COMPILER_PIC],
[m4_require([_LT_TAG_COMPILER])dnl
_LT_TAGVAR(lt_prog_compiler_wl, $1)=
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)=
+AC_MSG_CHECKING([for $compiler option to produce PIC])
m4_if([$1], [CXX], [
# C++ specific cases for pic, static, wl, etc.
if test "$GXX" = yes; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | os2* | pw32* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
*djgpp*)
# DJGPP does not support shared libraries at all
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- _LT_TAGVAR(lt_prog_compiler_static, $1)=
- ;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
else
case $host_os in
aix[[4-9]]*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
chorus*)
case $cc_basename in
cxch68*)
# Green Hills C++ Compiler
# _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
- mingw* | cygwin* | os2* | pw32* | cegcc*)
- # This hack is so that the source file can tell whether it is being
- # built for inclusion in a dll (and should export symbols for example).
- m4_if([$1], [GCJ], [],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
- ;;
dgux*)
case $cc_basename in
ec++*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
ghcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
freebsd* | dragonfly*)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
if test "$host_cpu" != ia64; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
fi
;;
aCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
;;
*)
;;
esac
;;
interix*)
# This is c89, which is MS Visual C++ (no shared libs)
# Anyone wants to do a port?
;;
irix5* | irix6* | nonstopux*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
# CC pic flag -KPIC is the default.
;;
*)
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
case $cc_basename in
KCC*)
# KAI C++ Compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
ecpc* )
# old Intel C++ for x86_64 which still supported -KPIC.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
icpc* )
# Intel C++, used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
cxx*)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
- # IBM XL 8.0, 9.0 on PPC and BlueGene
+ xlc* | xlC*)
+ # IBM XL 8.0 on PPC
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
esac
;;
esac
;;
lynxos*)
;;
m88k*)
;;
mvs*)
case $cc_basename in
cxx*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
;;
*)
;;
esac
;;
netbsd*)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
;;
RCC*)
# Rational C++ 2.4.1
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
cxx*)
# Digital/Compaq C++
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
;;
esac
;;
psos*)
;;
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
;;
*)
;;
esac
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
lcc*)
# Lucid
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
case $cc_basename in
CC*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
*)
;;
esac
;;
vxworks*)
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
],
[
if test "$GCC" = yes; then
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
m68k)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
# (--disable-auto-import) libraries
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- _LT_TAGVAR(lt_prog_compiler_static, $1)=
- ;;
-
hpux*)
# PIC is the default for 64-bit PA HP-UX, but not for 32-bit
# PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
# sets the default TLS model and affects inlining.
case $host_cpu in
hppa*64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
;;
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
enable_shared=no
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
-
- case $cc_basename in
- nvcc*) # Cuda Compiler Driver 2.2
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
- ;;
- esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
aix*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
# This hack is so that the source file can tell whether it is being
# built for inclusion in a dll (and should export symbols for example).
m4_if([$1], [GCJ], [],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
;;
hpux9* | hpux10* | hpux11*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
# Is there a better lt_prog_compiler_static that works with the bundled CC?
_LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
;;
irix5* | irix6* | nonstopux*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC (with -KPIC) is the default.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
case $cc_basename in
# old Intel for x86_64 which still supported -KPIC.
ecc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# Lahey Fortran 8.1.
lf95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
;;
- nagfor*)
- # NAG Fortran compiler
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ pgcc* | pgf77* | pgf90* | pgf95*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
ccc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- xl* | bgxl* | bgf* | mpixl*)
- # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
- *Sun\ F* | *Sun*Fortran*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
- ;;
*Sun\ C*)
# Sun C 5.9
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
esac
;;
esac
;;
newsos6)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*nto* | *qnx*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
# it will coredump.
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
;;
osf3* | osf4* | osf5*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All OSF/1 code is PIC.
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
rdos*)
_LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
solaris*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
case $cc_basename in
- f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ f77* | f90* | f95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
esac
;;
sunos4*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
unicos*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
uts4*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*)
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
])
case $host_os in
# For platforms which do not support PIC, -DPIC is meaningless:
*djgpp*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)=
;;
*)
_LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
;;
esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
- [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
- [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
#
# Check to make sure the PIC flag actually works.
#
if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
_LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
[_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
[$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
[case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
"" | " "*) ;;
*) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
esac],
[_LT_TAGVAR(lt_prog_compiler_pic, $1)=
_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
fi
_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
[Additional compiler flags for building library objects])
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
- [How to pass a linker flag through the compiler])
#
# Check to make sure the static flag actually works.
#
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
_LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
$lt_tmp_static_flag,
[],
[_LT_TAGVAR(lt_prog_compiler_static, $1)=])
_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
[Compiler flag to prevent dynamic linking])
])# _LT_COMPILER_PIC
# _LT_LINKER_SHLIBS([TAGNAME])
# ----------------------------
# See if the linker supports building shared libraries.
m4_defun([_LT_LINKER_SHLIBS],
[AC_REQUIRE([LT_PATH_LD])dnl
AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_EGREP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
m4_require([_LT_TAG_COMPILER])dnl
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
m4_if([$1], [CXX], [
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
case $host_os in
aix[[4-9]]*)
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
- # Also, AIX nm treats weak defined symbols like other global defined
- # symbols, whereas GNU nm marks them as "W".
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
;;
pw32*)
_LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
- ;;
+ ;;
cygwin* | mingw* | cegcc*)
- case $cc_basename in
- cl*) ;;
- *)
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
- ;;
- esac
- ;;
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
+ ;;
esac
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
], [
runpath_var=
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_cmds, $1)=
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(old_archive_from_new_cmds, $1)=
_LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
_LT_TAGVAR(thread_safe_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
_LT_TAGVAR(include_expsyms, $1)=
# exclude_expsyms can be an extended regexp of symbols to exclude
# it will be wrapped by ` (' and `)$', so one must not match beginning or
# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
# as well as any symbol that contains `d'.
_LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
# platforms (ab)use it in PIC code, but their linkers get confused if
# the symbol is explicitly referenced. Since portable code cannot
# rely on this symbol name, it's probably fine to never include it in
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
case $host_os in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
-
- # On some targets, GNU ld is compatible enough with the native linker
- # that we're better off using the native interface for both.
- lt_use_gnu_ld_interface=no
if test "$with_gnu_ld" = yes; then
- case $host_os in
- aix*)
- # The AIX port of GNU ld has always aspired to compatibility
- # with the native linker. However, as the warning in the GNU ld
- # block says, versions before 2.19.5* couldn't really create working
- # shared libraries, regardless of the interface used.
- case `$LD -v 2>&1` in
- *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
- *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
- *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
- *)
- lt_use_gnu_ld_interface=yes
- ;;
- esac
- ;;
- *)
- lt_use_gnu_ld_interface=yes
- ;;
- esac
- fi
-
- if test "$lt_use_gnu_ld_interface" = yes; then
# If archive_cmds runs LD, not CC, wlarc should be empty
wlarc='${wl}'
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# ancient GNU ld didn't support --whole-archive et. al.
if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
case `$LD -v 2>&1` in
- *GNU\ gold*) supports_anon_versioning=yes ;;
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
*) supports_anon_versioning=yes ;;
esac
# See if GNU ld supports shared libraries.
case $host_os in
aix[[3-9]]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
*** to be unable to reliably create shared libraries on AIX.
*** Therefore, libtool is disabling shared libraries support. If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
_LT_EOF
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
cat $export_symbols >> $output_objdir/$soname.def;
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
- haiku*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ gnu* | linux* | tpf* | k*bsd*-gnu)
tmp_diet=no
if test "$host_os" = linux-dietlibc; then
case $cc_basename in
diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
esac
fi
if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
&& test "$tmp_diet" = no
then
- tmp_addflag=' $pic_flag'
+ tmp_addflag=
tmp_sharedflag='-shared'
case $cc_basename,$host_cpu in
pgcc*) # Portland Group C compiler
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
- pgf77* | pgf90* | pgf95* | pgfortran*)
- # Portland Group f77 and f90 compilers
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
tmp_addflag=' -i_dynamic' ;;
efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
tmp_addflag=' -i_dynamic -nofor_main' ;;
ifc* | ifort*) # Intel Fortran compiler
tmp_addflag=' -nofor_main' ;;
lf95*) # Lahey Fortran 8.1
_LT_TAGVAR(whole_archive_flag_spec, $1)=
tmp_sharedflag='--shared' ;;
- xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
- nvcc*) # Cuda Compiler Driver 2.2
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
- _LT_TAGVAR(compiler_needs_object, $1)=yes
- ;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
fi
case $cc_basename in
- xlf* | bgf* | bgxlf* | mpixlf*)
+ xlf*)
# IBM XL Fortran 10.1 on PPC cannot create shared libs itself
_LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
- _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
- $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
fi
;;
esac
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
fi
;;
solaris*)
if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.9.1 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
_LT_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
*** reliably create shared libraries on SCO systems. Therefore, libtool
*** is disabling shared libraries support. We urge you to upgrade GNU
*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
*** your PATH or compiler configuration so that the native linker is
*** used, and then restart.
_LT_EOF
;;
*)
# For security reasons, it is highly recommended that you always
# use absolute paths for naming shared libraries, and exclude the
# DT_RUNPATH tag from executables and libraries. But doing so
# requires that you compile everything twice, which is a pain.
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
sunos4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
runpath_var=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=yes
_LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
_LT_TAGVAR(hardcode_direct, $1)=unsupported
fi
;;
aix[[4-9]]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=""
else
# If we're using GNU nm, then we don't want the "-C" option.
# -C means demangle to AIX nm, but means don't demangle with GNU nm
- # Also, AIX nm treats weak defined symbols like other global
- # defined symbols, whereas GNU nm marks them as "W".
if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
else
_LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
fi
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
if test "$GCC" = yes; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
;;
esac
shared_flag='-shared'
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
else
# not using gcc
if test "$host_cpu" = ia64; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an
# empty executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- if test "$with_gnu_ld" = yes; then
- # We only use this code for GNU lds that support --whole-archive.
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- fi
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
# This is similar to how AIX traditionally builds its shared libraries.
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
amigaos*)
case $host_cpu in
powerpc)
# see comment about AmigaOS4 .so support
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)=''
;;
m68k)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
;;
bsdi[[45]]*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
- case $cc_basename in
- cl*)
- # Native MSVC
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='@'
- # Tell ltmain to make .lib files, not .a files.
- libext=lib
- # Tell ltmain to make .dll files, not .so files.
- shrext_cmds=".dll"
- # FIXME: Setting linknames here is a bad hack.
- _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
- sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
- else
- sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
- fi~
- $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
- linknames='
- # The linker will not automatically build a static lib if we build a DLL.
- # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
- # Don't use ranlib
- _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
- _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
- lt_tool_outputfile="@TOOL_OUTPUT@"~
- case $lt_outputfile in
- *.exe|*.EXE) ;;
- *)
- lt_outputfile="$lt_outputfile.exe"
- lt_tool_outputfile="$lt_tool_outputfile.exe"
- ;;
- esac~
- if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
- $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
- $RM "$lt_outputfile.manifest";
- fi'
- ;;
- *)
- # Assume MSVC wrapper
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Tell ltmain to make .lib files, not .a files.
- libext=lib
- # Tell ltmain to make .dll files, not .so files.
- shrext_cmds=".dll"
- # FIXME: Setting linknames here is a bad hack.
- _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
- # The linker will automatically build a .lib file if we build a DLL.
- _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
- # FIXME: Should let the user specify the lib program.
- _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- ;;
- esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
dgux*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
freebsd1*)
_LT_TAGVAR(ld_shlibs, $1)=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
# support. Future versions do this automatically, but an explicit c++rt0.o
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
freebsd2*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
hpux9*)
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
hpux10*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
fi
;;
hpux11*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
- m4_if($1, [], [
- # Older versions of the 11.00 compiler do not understand -b yet
- # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
- _LT_LINKER_OPTION([if $CC understands -b],
- _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
- [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
- [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
- [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
fi
if test "$with_gnu_ld" = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
_LT_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
# Try to use the -exported_symbol ld option, if it does not
# work, assume that -exports_file does not work either and
# implicitly export all symbols.
- # This should be the same for all languages, so no per-tag cache variable.
- AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
- [lt_cv_irix_exported_symbol],
- [save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE(
- [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
- [C++], [[int foo (void) { return 0; }]],
- [Fortran 77], [[
- subroutine foo
- end]],
- [Fortran], [[
- subroutine foo
- end]])])],
- [lt_cv_irix_exported_symbol=yes],
- [lt_cv_irix_exported_symbol=no])
- LDFLAGS="$save_LDFLAGS"])
- if test "$lt_cv_irix_exported_symbol" = yes; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
- fi
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(int foo(void) {},
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ )
+ LDFLAGS="$save_LDFLAGS"
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
newsos6)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*nto* | *qnx*)
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
else
case $host_os in
openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
;;
esac
fi
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
os2*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
_LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
else
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
- $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
# Both c and cxx compiler support -rpath directly
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
fi
_LT_TAGVAR(archive_cmds_need_lc, $1)='no'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
;;
solaris*)
_LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
if test "$GCC" = yes; then
wlarc='${wl}'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
else
case `$CC -V 2>&1` in
*"Compilers 5.0"*)
wlarc=''
_LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
;;
*)
wlarc='${wl}'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
;;
esac
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
# Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
fi
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
sunos4*)
if test "x$host_vendor" = xsequent; then
# Use $CC to link under sequent, because it throws in some extra .o
# files that make .init and .fini sections work.
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4)
case $host_vendor in
sni)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
;;
siemens)
## LD is ld it makes a PLAMLIB
## CC just makes a GrossModule.
_LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
_LT_TAGVAR(hardcode_direct, $1)=no
;;
motorola)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
;;
esac
runpath_var='LD_RUN_PATH'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4.3*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
;;
sysv4*MP*)
if test -d /usr/nec; then
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
_LT_TAGVAR(ld_shlibs, $1)=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We can NOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
if test x$host_vendor = xsni; then
case $host in
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
;;
esac
fi
fi
])
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
_LT_DECL([], [extract_expsyms_cmds], [2],
[The commands to extract the exported symbol list from a shared archive])
#
# Do we need to explicitly link libc?
#
case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
x|xyes)
# Assume -lc should be added
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
if test "$enable_shared" = yes && test "$GCC" = yes; then
case $_LT_TAGVAR(archive_cmds, $1) in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
'$CC '*)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- AC_CACHE_CHECK([whether -lc should be explicitly linked in],
- [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
- [$RM conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
- if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
- soname=conftest
- lib=conftest
- libobjs=conftest.$ac_objext
- deplibs=
- wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
- pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
- compiler_flags=-v
- linker_flags=-v
- verstring=
- output_objdir=.
- libname=conftest
- lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
- _LT_TAGVAR(allow_undefined_flag, $1)=
- if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
- then
- lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
- else
- lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
- fi
- _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
- else
- cat conftest.err 1>&5
- fi
- $RM conftest*
- ])
- _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
;;
esac
fi
;;
esac
_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
[Whether or not to add -lc for building shared libraries])
_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
[enable_shared_with_static_runtimes], [0],
[Whether or not to disallow shared libs when runtime libs are static])
_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
[Compiler flag to allow reflexive dlopens])
_LT_TAGDECL([], [whole_archive_flag_spec], [1],
[Compiler flag to generate shared objects directly from archives])
_LT_TAGDECL([], [compiler_needs_object], [1],
[Whether the compiler copes with passing no objects directly])
_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
[Create an old-style archive from a shared archive])
_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
[Create a temporary old-style archive to link instead of a shared archive])
_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
_LT_TAGDECL([], [archive_expsym_cmds], [2])
_LT_TAGDECL([], [module_cmds], [2],
[Commands used to build a loadable module if different from building
a shared archive.])
_LT_TAGDECL([], [module_expsym_cmds], [2])
_LT_TAGDECL([], [with_gnu_ld], [1],
[Whether we are building with GNU ld or not])
_LT_TAGDECL([], [allow_undefined_flag], [1],
[Flag that allows shared libraries with undefined symbols to be built])
_LT_TAGDECL([], [no_undefined_flag], [1],
[Flag that enforces no undefined symbols])
_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
[Flag to hardcode $libdir into a binary during linking.
This must work even if $libdir does not exist])
_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
[[If ld is used when linking, flag to hardcode $libdir into a binary
during linking. This must work even if $libdir does not exist]])
_LT_TAGDECL([], [hardcode_libdir_separator], [1],
[Whether we need a single "-rpath" flag with a separated argument])
_LT_TAGDECL([], [hardcode_direct], [0],
[Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
DIR into the resulting binary])
_LT_TAGDECL([], [hardcode_direct_absolute], [0],
[Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
DIR into the resulting binary and the resulting library dependency is
"absolute", i.e impossible to change by setting ${shlibpath_var} if the
library is relocated])
_LT_TAGDECL([], [hardcode_minus_L], [0],
[Set to "yes" if using the -LDIR flag during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
[Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
into the resulting binary])
_LT_TAGDECL([], [hardcode_automatic], [0],
[Set to "yes" if building a shared library automatically hardcodes DIR
into the library and all subsequent libraries and executables linked
against it])
_LT_TAGDECL([], [inherit_rpath], [0],
[Set to yes if linker adds runtime paths of dependent libraries
to runtime path list])
_LT_TAGDECL([], [link_all_deplibs], [0],
[Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+ [Fix the shell variable $srcfile for the compiler])
_LT_TAGDECL([], [always_export_symbols], [0],
[Set to "yes" if exported symbols are required])
_LT_TAGDECL([], [export_symbols_cmds], [2],
[The commands to list exported symbols])
_LT_TAGDECL([], [exclude_expsyms], [1],
[Symbols that should not be listed in the preloaded symbols])
_LT_TAGDECL([], [include_expsyms], [1],
[Symbols that must always be exported])
_LT_TAGDECL([], [prelink_cmds], [2],
[Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
- [Commands necessary for finishing linking programs])
_LT_TAGDECL([], [file_list_spec], [1],
[Specify filename containing input files])
dnl FIXME: Not yet implemented
dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
dnl [Compiler flag to generate thread safe objects])
])# _LT_LINKER_SHLIBS
# _LT_LANG_C_CONFIG([TAG])
# ------------------------
# Ensure that the configuration variables for a C compiler are suitably
# defined. These variables are subsequently used by _LT_CONFIG to write
# the compiler configuration to `libtool'.
m4_defun([_LT_LANG_C_CONFIG],
[m4_require([_LT_DECL_EGREP])dnl
lt_save_CC="$CC"
AC_LANG_PUSH(C)
# Source file extension for C test sources.
ac_ext=c
# Object file extension for compiled C test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(){return(0);}'
_LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other
# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
compiler_DEFAULT=$CC
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
LT_SYS_DLOPEN_SELF
_LT_CMD_STRIPLIB
# Report which library types will actually be built
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_CONFIG($1)
fi
AC_LANG_POP
CC="$lt_save_CC"
])# _LT_LANG_C_CONFIG
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined. These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
(test "X$CXX" != "Xg++"))) ; then
AC_PROG_CXXCPP
else
_lt_caught_CXX_error=yes
fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
AC_LANG_PUSH(C++)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(compiler_needs_object, $1)=no
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for C++ test sources.
ac_ext=cpp
# Object file extension for compiled C++ test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the CXX compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_caught_CXX_error" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC=$CC
- lt_save_CFLAGS=$CFLAGS
lt_save_LD=$LD
lt_save_GCC=$GCC
GCC=$GXX
lt_save_with_gnu_ld=$with_gnu_ld
lt_save_path_LD=$lt_cv_path_LD
if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
else
$as_unset lt_cv_prog_gnu_ld
fi
if test -n "${lt_cv_path_LDCXX+set}"; then
lt_cv_path_LD=$lt_cv_path_LDCXX
else
$as_unset lt_cv_path_LD
fi
test -z "${LDCXX+set}" || LD=$LDCXX
CC=${CXX-"c++"}
- CFLAGS=$CXXFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
# We don't want -fno-exception when compiling C++ code, so set the
# no_builtin_flag separately
if test "$GXX" = yes; then
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
else
_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
fi
if test "$GXX" = yes; then
# Set up default GNU C++ configuration
LT_PATH_LD
# Check if GNU C++ uses GNU ld as the underlying linker, since the
# archiving commands below assume that GNU ld is being used.
if test "$with_gnu_ld" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# If archive_cmds runs LD, not CC, wlarc should be empty
# XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
# investigate it a little bit more. (MM)
wlarc='${wl}'
# ancient GNU ld didn't support --whole-archive et. al.
if eval "`$CC -print-prog-name=ld` --help 2>&1" |
$GREP 'no-whole-archive' > /dev/null; then
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
else
_LT_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
with_gnu_ld=no
wlarc=
# A generic and very simple default shared library creation
# command for GNU C++ for the case where it uses the native
# linker, instead of GNU ld. If possible, this setting should
# overridden to take advantage of the native linker features on
# the platform it is being used on.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
else
GXX=no
with_gnu_ld=no
wlarc=
fi
# PORTME: fill in a description of your system's C++ link characteristics
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
_LT_TAGVAR(ld_shlibs, $1)=yes
case $host_os in
aix3*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aix[[4-9]]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
exp_sym_flag='-Bexport'
no_entry_flag=""
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
for ld_flag in $LDFLAGS; do
case $ld_flag in
*-brtl*)
aix_use_runtimelinking=yes
break
;;
esac
done
;;
esac
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
fi
# When large executables or shared objects are built, AIX ld can
# have problems creating the table of contents. If linking a library
# or program results in "error TOC overflow" add -mminimal-toc to
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
_LT_TAGVAR(archive_cmds, $1)=''
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
if test "$GXX" = yes; then
case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" &&
strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
_LT_TAGVAR(hardcode_direct, $1)=unsupported
# It fails to find uninstalled libraries when the uninstalled
# path is not listed in the libpath. Setting hardcode_minus_L
# to unsupported forces relinking
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=
fi
esac
shared_flag='-shared'
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
else
# not using gcc
if test "$host_cpu" = ia64; then
# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
# chokes on -Wl,-G. The following line is correct:
shared_flag='-G'
else
if test "$aix_use_runtimelinking" = yes; then
shared_flag='${wl}-G'
else
shared_flag='${wl}-bM:SRE'
fi
fi
fi
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
# It seems that -bexpall does not export symbols beginning with
# underscore (_), so it is better to generate a list of symbols to
# export.
_LT_TAGVAR(always_export_symbols, $1)=yes
if test "$aix_use_runtimelinking" = yes; then
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
# Determine the default libpath from the value encoded in an empty
# executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
else
if test "$host_cpu" = ia64; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
_LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
else
# Determine the default libpath from the value encoded in an
# empty executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_SYS_MODULE_PATH_AIX
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
# Warning - without using the other run time loading flags,
# -berok will link without error, but may produce a broken library.
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- if test "$with_gnu_ld" = yes; then
- # We only use this code for GNU lds that support --whole-archive.
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- fi
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
# This is similar to how AIX traditionally builds its shared
# libraries.
_LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
fi
fi
;;
beos*)
if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
chorus*)
case $cc_basename in
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
cygwin* | mingw* | pw32* | cegcc*)
- case $GXX,$cc_basename in
- ,cl* | no,cl*)
- # Native MSVC
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='@'
- # Tell ltmain to make .lib files, not .a files.
- libext=lib
- # Tell ltmain to make .dll files, not .so files.
- shrext_cmds=".dll"
- # FIXME: Setting linknames here is a bad hack.
- _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
- $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
- else
- $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
- fi~
- $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
- linknames='
- # The linker will not automatically build a static lib if we build a DLL.
- # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- # Don't use ranlib
- _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
- _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
- lt_tool_outputfile="@TOOL_OUTPUT@"~
- case $lt_outputfile in
- *.exe|*.EXE) ;;
- *)
- lt_outputfile="$lt_outputfile.exe"
- lt_tool_outputfile="$lt_tool_outputfile.exe"
- ;;
- esac~
- func_to_tool_file "$lt_outputfile"~
- if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
- $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
- $RM "$lt_outputfile.manifest";
- fi'
- ;;
- *)
- # g++
- # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
- # as there is no search path for DLLs.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=no
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- # If the export-symbols file already is a .def file (1st line
- # is EXPORTS), use it as is; otherwise, prepend...
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
- cp $export_symbols $output_objdir/$soname.def;
- else
- echo EXPORTS > $output_objdir/$soname.def;
- cat $export_symbols >> $output_objdir/$soname.def;
- fi~
- $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
darwin* | rhapsody*)
_LT_DARWIN_LINKER_FEATURES($1)
;;
dgux*)
case $cc_basename in
ec++*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
ghcx*)
# Green Hills C++ Compiler
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
freebsd[[12]]*)
# C++ shared libraries reported to be fairly broken before
# switch to ELF
_LT_TAGVAR(ld_shlibs, $1)=no
;;
freebsd-elf*)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
;;
freebsd* | dragonfly*)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
gnu*)
;;
- haiku*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
hpux9*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
;;
*)
if test "$GXX" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
hpux10*|hpux11*)
if test $with_gnu_ld = no; then
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
;;
*)
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
esac
fi
case $host_cpu in
hppa*64*|ia64*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
# but as the default
# location of the library.
;;
esac
case $cc_basename in
CC*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
aCC*)
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
;;
*)
if test "$GXX" = yes; then
if test $with_gnu_ld = no; then
case $host_cpu in
hppa*64*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
esac
fi
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
# Instead, shared libraries are loaded at an image base (0x10000000 by
# default) and relocated if they conflict, which is a slow very memory
# consuming and fragmenting process. To avoid this, we pick a random,
# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
# time. Moving up from 0x10000000 also allows more sbrk(2) space.
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
irix5* | irix6*)
case $cc_basename in
CC*)
# SGI C++
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
# Archives containing C++ object files must be created using
# "CC -ar", where "CC" is the IRIX C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
;;
*)
if test "$GXX" = yes; then
if test "$with_gnu_ld" = no; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
fi
fi
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
_LT_TAGVAR(inherit_rpath, $1)=yes
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
# Archives containing C++ object files must be created using
# "CC -Bstatic", where "CC" is the KAI C++ compiler.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
;;
icpc* | ecpc* )
# Intel C++
with_gnu_ld=yes
# version 8.0 and above of icpc choke on multiply defined symbols
# if we add $predep_objects and $postdep_objects, however 7.1 and
# earlier do not add the objects themselves.
case `$CC -V 2>&1` in
*"Version 7."*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
;;
*) # Version 8.0 or newer
tmp_idyn=
case $host_cpu in
ia64*) tmp_idyn=' -i_dynamic';;
esac
_LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
pgCC* | pgcpp*)
# Portland Group C++ compiler
case `$CC -V` in
- *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
_LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
- compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
_LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
$RANLIB $oldlib'
_LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
rm -rf $tpldir~
$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
;;
- *) # Version 6 and above use weak symbols
+ *) # Version 6 will use weak symbols
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
;;
cxx*)
# Compaq C++
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
runpath_var=LD_RUN_PATH
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
;;
- xl* | mpixl* | bgxl*)
+ xl*)
# IBM XL 8.0 on PPC, with GNU ld
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
if test "x$supports_anon_versioning" = xyes; then
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
echo "local: *; };" >> $output_objdir/$libname.ver~
$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
fi
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
_LT_TAGVAR(compiler_needs_object, $1)=yes
# Not sure whether something based on
# $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
# would be better.
- output_verbose_link_cmd='func_echo_all'
+ output_verbose_link_cmd='echo'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
esac
;;
esac
;;
lynxos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
m88k*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
mvs*)
case $cc_basename in
cxx*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
wlarc=
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
fi
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
*nto* | *qnx*)
_LT_TAGVAR(ld_shlibs, $1)=yes
;;
openbsd2*)
# C++ shared libraries are fairly broken
_LT_TAGVAR(ld_shlibs, $1)=no
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
_LT_TAGVAR(hardcode_direct, $1)=yes
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
_LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
fi
- output_verbose_link_cmd=func_echo_all
+ output_verbose_link_cmd=echo
else
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
# Kuck and Associates, Inc. (KAI) C++ Compiler
# KCC will only create a shared library if the output file
# ends with ".so" (or ".sl" for HP-UX), so rename the library
# to its proper name (with version) after linking.
_LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Archives containing C++ object files must be created using
# the KAI C++ compiler.
case $host in
osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
esac
;;
RCC*)
# Rational C++ 2.4.1
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
cxx*)
case $host in
osf3*)
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
;;
*)
_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
echo "-hidden">> $lib.exp~
- $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
;;
esac
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
#
# There doesn't appear to be a way to prevent this compiler from
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
;;
*)
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
case $host in
osf3*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
;;
*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
;;
esac
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=:
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
else
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
psos*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
sunos4*)
case $cc_basename in
CC*)
# Sun C++ 4.x
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
lcc*)
# Lucid
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# Sun C++ 4.2, 5.x and Centerline C++
_LT_TAGVAR(archive_cmds_need_lc,$1)=yes
_LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
_LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'.
# Supported since Solaris 2.6 (maybe 2.5.1?)
_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
;;
esac
_LT_TAGVAR(link_all_deplibs, $1)=yes
- output_verbose_link_cmd='func_echo_all'
+ output_verbose_link_cmd='echo'
# Archives containing C++ object files must be created using
# "CC -xar", where "CC" is the Sun C++ compiler. This is
# necessary to make sure instantiated templates are included
# in the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
;;
gcx*)
# Green Hills C++ Compiler
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
# The C++ compiler must be used to create the archive.
_LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
;;
*)
# GNU C++ compiler with Solaris linker
if test "$GXX" = yes && test "$with_gnu_ld" = no; then
_LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
if $CC --version | $GREP -v '^2\.7' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
else
# g++ 2.7 appears to require `-G' NOT `-shared' on this
# platform.
_LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
- output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
_LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
;;
esac
fi
;;
esac
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
sysv5* | sco3.2v5* | sco5v6*)
# Note: We can NOT use -z defs as we might desire, because we do not
# link with -lc, and that would cause any symbols used from libc to
# always be unresolved, which means just about no library would
# ever link correctly. If we're not using GNU ld we use -z text
# though, which does catch some bad symbols but isn't as heavy-handed
# as -z defs.
_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
_LT_TAGVAR(link_all_deplibs, $1)=yes
_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
case $cc_basename in
CC*)
_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
- '"$_LT_TAGVAR(old_archive_cmds, $1)"
- _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
- '"$_LT_TAGVAR(reload_cmds, $1)"
;;
*)
_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
;;
vxworks*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
*)
# FIXME: insert proper C++ library support
_LT_TAGVAR(ld_shlibs, $1)=no
;;
esac
AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
_LT_TAGVAR(GCC, $1)="$GXX"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
CC=$lt_save_CC
- CFLAGS=$lt_save_CFLAGS
LDCXX=$LD
LD=$lt_save_LD
GCC=$lt_save_GCC
with_gnu_ld=$lt_save_with_gnu_ld
lt_cv_path_LDCXX=$lt_cv_path_LD
lt_cv_path_LD=$lt_save_path_LD
lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
fi # test "$_lt_caught_CXX_error" != yes
AC_LANG_POP
])# _LT_LANG_CXX_CONFIG
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
- case ${2} in
- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
- esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
# ---------------------------------
# Figure out "hidden" library dependencies from verbose
# compiler output when linking a shared library.
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
# Dependencies to place before and after the object being linked:
_LT_TAGVAR(predep_objects, $1)=
_LT_TAGVAR(postdep_objects, $1)=
_LT_TAGVAR(predeps, $1)=
_LT_TAGVAR(postdeps, $1)=
_LT_TAGVAR(compiler_lib_search_path, $1)=
dnl we can't use the lt_simple_compile_test_code here,
dnl because it contains code intended for an executable,
dnl not a library. It's possible we should let each
dnl tag define a new lt_????_link_test_code variable,
dnl but it's only used here...
m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
int a;
void foo (void) { a = 0; }
_LT_EOF
], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
class Foo
{
public:
Foo (void) { a = 0; }
private:
int a;
};
_LT_EOF
], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer*4 a
a=0
return
end
_LT_EOF
], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
subroutine foo
implicit none
integer a
a=0
return
end
_LT_EOF
], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
public class foo {
private int a;
public void bar (void) {
a = 0;
}
};
_LT_EOF
])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-esac
-
dnl Parse the compiler output and extract the necessary
dnl objects, libraries and library flags.
if AC_TRY_EVAL(ac_compile); then
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
# Sentinel used to keep track of whether or not we are before
# the conftest object file.
pre_test_object_deps_done=no
for p in `eval "$output_verbose_link_cmd"`; do
- case ${prev}${p} in
+ case $p in
-L* | -R* | -l*)
# Some compilers place space between "-{L,R}" and the path.
# Remove the space.
if test $p = "-L" ||
test $p = "-R"; then
prev=$p
continue
+ else
+ prev=
fi
- # Expand the sysroot to ease extracting the directories later.
- if test -z "$prev"; then
- case $p in
- -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
- -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
- -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
- esac
- fi
- case $p in
- =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
- esac
if test "$pre_test_object_deps_done" = no; then
- case ${prev} in
- -L | -R)
+ case $p in
+ -L* | -R*)
# Internal compiler library paths should come after those
# provided the user. The postdeps already come after the
# user supplied libs so there is no need to process them.
if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
_LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
else
_LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
fi
;;
# The "-l" case would never come before the object being
# linked, so don't bother handling this case.
esac
else
if test -z "$_LT_TAGVAR(postdeps, $1)"; then
_LT_TAGVAR(postdeps, $1)="${prev}${p}"
else
_LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
fi
fi
- prev=
;;
- *.lto.$objext) ;; # Ignore GCC LTO objects
*.$objext)
# This assumes that the test object file only shows up
# once in the compiler output.
if test "$p" = "conftest.$objext"; then
pre_test_object_deps_done=yes
continue
fi
if test "$pre_test_object_deps_done" = no; then
if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
_LT_TAGVAR(predep_objects, $1)="$p"
else
_LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
fi
else
if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
_LT_TAGVAR(postdep_objects, $1)="$p"
else
_LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
fi
fi
;;
*) ;; # Ignore the rest.
esac
done
# Clean up.
rm -f a.out a.exe
else
echo "libtool.m4: error: problem compiling $1 test program"
fi
$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
# PORTME: override above test on systems where it is broken
m4_if([$1], [CXX],
[case $host_os in
interix[[3-9]]*)
# Interix 3.5 installs completely hosed .la files for C++, so rather than
# hack all around it, let's just trust "g++" to DTRT.
_LT_TAGVAR(predep_objects,$1)=
_LT_TAGVAR(postdep_objects,$1)=
_LT_TAGVAR(postdeps,$1)=
;;
linux*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
# -library=stlport4 depends on it.
case " $CXX $CXXFLAGS " in
*" -library=stlport4 "*)
solaris_use_stlport4=yes
;;
esac
if test "$solaris_use_stlport4" != yes; then
_LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
fi
;;
esac
;;
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
# -library=stlport4 depends on it.
case " $CXX $CXXFLAGS " in
*" -library=stlport4 "*)
solaris_use_stlport4=yes
;;
esac
# Adding this requires a known-good setup of shared libraries for
# Sun compiler versions before 5.6, else PIC objects from an old
# archive will be linked into the output, leading to subtle bugs.
if test "$solaris_use_stlport4" != yes; then
_LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
fi
;;
esac
;;
esac
])
case " $_LT_TAGVAR(postdeps, $1) " in
*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
esac
_LT_TAGVAR(compiler_lib_search_dirs, $1)=
if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
_LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
fi
_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
[The directories searched by this compiler when creating a shared library])
_LT_TAGDECL([], [predep_objects], [1],
[Dependencies to place before and after the objects being linked to
create a shared library])
_LT_TAGDECL([], [postdep_objects], [1])
_LT_TAGDECL([], [predeps], [1])
_LT_TAGDECL([], [postdeps], [1])
_LT_TAGDECL([], [compiler_lib_search_path], [1],
[The library search path used internally by the compiler when linking
a shared library])
])# _LT_SYS_HIDDEN_LIBDEPS
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
# _LT_LANG_F77_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for a Fortran 77 compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
- _lt_disable_F77=yes
-fi
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for f77 test sources.
ac_ext=f
# Object file extension for compiled f77 test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the F77 compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_disable_F77" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
lt_save_GCC=$GCC
- lt_save_CFLAGS=$CFLAGS
CC=${F77-"f77"}
- CFLAGS=$FFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
GCC=$G77
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)="$G77"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
CC="$lt_save_CC"
- CFLAGS="$lt_save_CFLAGS"
fi # test "$_lt_disable_F77" != yes
AC_LANG_POP
])# _LT_LANG_F77_CONFIG
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
# _LT_LANG_FC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for a Fortran compiler are
# suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
- _lt_disable_FC=yes
-fi
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(allow_undefined_flag, $1)=
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(archive_expsym_cmds, $1)=
_LT_TAGVAR(export_dynamic_flag_spec, $1)=
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_direct_absolute, $1)=no
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
_LT_TAGVAR(hardcode_libdir_separator, $1)=
_LT_TAGVAR(hardcode_minus_L, $1)=no
_LT_TAGVAR(hardcode_automatic, $1)=no
_LT_TAGVAR(inherit_rpath, $1)=no
_LT_TAGVAR(module_cmds, $1)=
_LT_TAGVAR(module_expsym_cmds, $1)=
_LT_TAGVAR(link_all_deplibs, $1)=unknown
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
_LT_TAGVAR(no_undefined_flag, $1)=
_LT_TAGVAR(whole_archive_flag_spec, $1)=
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
# Source file extension for fc test sources.
ac_ext=${ac_fc_srcext-f}
# Object file extension for compiled fc test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# No sense in running all these tests if we already determined that
# the FC compiler isn't working. Some variables (like enable_shared)
# are currently assumed to apply to all compilers on this platform,
# and will be corrupted by setting them based on a non-working compiler.
if test "$_lt_disable_FC" != yes; then
# Code to be used in simple compile tests
lt_simple_compile_test_code="\
subroutine t
return
end
"
# Code to be used in simple link tests
lt_simple_link_test_code="\
program t
end
"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
lt_save_GCC=$GCC
- lt_save_CFLAGS=$CFLAGS
CC=${FC-"f95"}
- CFLAGS=$FCFLAGS
compiler=$CC
GCC=$ac_cv_fc_compiler_gnu
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
if test -n "$compiler"; then
AC_MSG_CHECKING([if libtool supports shared libraries])
AC_MSG_RESULT([$can_build_shared])
AC_MSG_CHECKING([whether to build shared libraries])
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
# are all built from PIC.
case $host_os in
aix3*)
test "$enable_shared" = yes && enable_static=no
if test -n "$RANLIB"; then
archive_cmds="$archive_cmds~\$RANLIB \$lib"
postinstall_cmds='$RANLIB $lib'
fi
;;
aix[[4-9]]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
AC_MSG_RESULT([$enable_shared])
AC_MSG_CHECKING([whether to build static libraries])
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
AC_MSG_RESULT([$enable_static])
_LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
_LT_TAGVAR(LD, $1)="$LD"
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
_LT_SYS_HIDDEN_LIBDEPS($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_SYS_DYNAMIC_LINKER($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi # test -n "$compiler"
GCC=$lt_save_GCC
- CC=$lt_save_CC
- CFLAGS=$lt_save_CFLAGS
+ CC="$lt_save_CC"
fi # test "$_lt_disable_FC" != yes
AC_LANG_POP
])# _LT_LANG_FC_CONFIG
# _LT_LANG_GCJ_CONFIG([TAG])
# --------------------------
# Ensure that the configuration variables for the GNU Java Compiler compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_GCJ_CONFIG],
[AC_REQUIRE([LT_PROG_GCJ])dnl
AC_LANG_SAVE
# Source file extension for Java test sources.
ac_ext=java
# Object file extension for compiled Java test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code="class foo {}"
# Code to be used in simple link tests
lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
+lt_save_CC="$CC"
lt_save_GCC=$GCC
GCC=yes
CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_TAGVAR(LD, $1)="$LD"
_LT_CC_BASENAME([$compiler])
# GCJ did not exist at the time GCC didn't implicitly link libc in.
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
_LT_COMPILER_NO_RTTI($1)
_LT_COMPILER_PIC($1)
_LT_COMPILER_C_O($1)
_LT_COMPILER_FILE_LOCKS($1)
_LT_LINKER_SHLIBS($1)
_LT_LINKER_HARDCODE_LIBPATH($1)
_LT_CONFIG($1)
fi
AC_LANG_RESTORE
GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
+CC="$lt_save_CC"
])# _LT_LANG_GCJ_CONFIG
# _LT_LANG_RC_CONFIG([TAG])
# -------------------------
# Ensure that the configuration variables for the Windows resource compiler
# are suitably defined. These variables are subsequently used by _LT_CONFIG
# to write the compiler configuration to `libtool'.
m4_defun([_LT_LANG_RC_CONFIG],
[AC_REQUIRE([LT_PROG_RC])dnl
AC_LANG_SAVE
# Source file extension for RC test sources.
ac_ext=rc
# Object file extension for compiled RC test sources.
objext=o
_LT_TAGVAR(objext, $1)=$objext
# Code to be used in simple compile tests
lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
# Code to be used in simple link tests
lt_simple_link_test_code="$lt_simple_compile_test_code"
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_TAG_COMPILER
# save warnings/boilerplate of simple test code
_LT_COMPILER_BOILERPLATE
_LT_LINKER_BOILERPLATE
# Allow CC to be a program name with arguments.
lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
lt_save_GCC=$GCC
GCC=
CC=${RC-"windres"}
-CFLAGS=
compiler=$CC
_LT_TAGVAR(compiler, $1)=$CC
_LT_CC_BASENAME([$compiler])
_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
if test -n "$compiler"; then
:
_LT_CONFIG($1)
fi
GCC=$lt_save_GCC
AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
+CC="$lt_save_CC"
])# _LT_LANG_RC_CONFIG
# LT_PROG_GCJ
# -----------
AC_DEFUN([LT_PROG_GCJ],
[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
[m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
[AC_CHECK_TOOL(GCJ, gcj,)
test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
AC_SUBST(GCJFLAGS)])])[]dnl
])
# Old name:
AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
# LT_PROG_RC
# ----------
AC_DEFUN([LT_PROG_RC],
[AC_CHECK_TOOL(RC, windres,)
])
# Old name:
AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_RC], [])
# _LT_DECL_EGREP
# --------------
# If we don't have a new enough Autoconf to choose the best grep
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_EGREP],
[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_REQUIRE([AC_PROG_FGREP])dnl
test -z "$GREP" && GREP=grep
_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
_LT_DECL([], [EGREP], [1], [An ERE matcher])
_LT_DECL([], [FGREP], [1], [A literal string matcher])
dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
AC_SUBST([GREP])
])
# _LT_DECL_OBJDUMP
# --------------
# If we don't have a new enough Autoconf to choose the best objdump
# available, choose the one first in the user's PATH.
m4_defun([_LT_DECL_OBJDUMP],
[AC_CHECK_TOOL(OBJDUMP, objdump, false)
test -z "$OBJDUMP" && OBJDUMP=objdump
_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
AC_SUBST([OBJDUMP])
])
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
# _LT_DECL_SED
# ------------
# Check for a fully-functional sed program, that truncates
# as few characters as possible. Prefer GNU sed if found.
m4_defun([_LT_DECL_SED],
[AC_PROG_SED
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
[Sed that helps us avoid accidentally triggering echo(1) options like -n])
])# _LT_DECL_SED
m4_ifndef([AC_PROG_SED], [
############################################################
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_SED. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
############################################################
m4_defun([AC_PROG_SED],
[AC_MSG_CHECKING([for a sed that does not truncate output])
AC_CACHE_VAL(lt_cv_path_SED,
[# Loop through the user's path and test for sed and gsed.
# Then use that list of sed's as ones to test for truncation.
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
fi
done
done
done
IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
test ! -f $lt_ac_sed && continue
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
# Check for GNU sed and select it if it is found.
if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
lt_cv_path_SED=$lt_ac_sed
break
fi
while true; do
cat conftest.in conftest.in >conftest.tmp
mv conftest.tmp conftest.in
cp conftest.in conftest.nl
echo >>conftest.nl
$lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
cmp -s conftest.out conftest.nl || break
# 10000 chars as input seems more than enough
test $lt_ac_count -gt 10 && break
lt_ac_count=`expr $lt_ac_count + 1`
if test $lt_ac_count -gt $lt_ac_max; then
lt_ac_max=$lt_ac_count
lt_cv_path_SED=$lt_ac_sed
fi
done
done
])
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])#AC_PROG_SED
])#m4_ifndef
# Old name:
AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([LT_AC_PROG_SED], [])
# _LT_CHECK_SHELL_FEATURES
# ------------------------
# Find out whether the shell is Bourne or XSI compatible,
# or has some other useful features.
m4_defun([_LT_CHECK_SHELL_FEATURES],
[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
# Try some XSI features
xsi_shell=no
( _lt_dummy="a/b/c"
- test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
- = c,a/b,b/c, \
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
&& eval 'test $(( 1 + 1 )) -eq 2 \
&& test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
&& xsi_shell=yes
AC_MSG_RESULT([$xsi_shell])
_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
AC_MSG_CHECKING([whether the shell understands "+="])
lt_shell_append=no
( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
>/dev/null 2>&1 \
&& lt_shell_append=yes
AC_MSG_RESULT([$lt_shell_append])
_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
lt_unset=unset
else
lt_unset=false
fi
_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
# test EBCDIC or ASCII
case `echo X|tr X '\101'` in
A) # ASCII based system
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
lt_SP2NL='tr \040 \012'
lt_NL2SP='tr \015\012 \040\040'
;;
*) # EBCDIC based system
lt_SP2NL='tr \100 \n'
lt_NL2SP='tr \r\n \100\100'
;;
esac
_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
])# _LT_CHECK_SHELL_FEATURES
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $[*] ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$[@]"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]+=\$[2]"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]=\$$[1]\$[2]"
+}
+
+_LT_EOF
+ ;;
+ esac
])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
- _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac])
-
- _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
- func_basename_result="${1##*/}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
- func_basename_result="${1##*/}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
- # positional parameters, so assign one to ordinary parameter first.
- func_stripname_result=${3}
- func_stripname_result=${func_stripname_result#"${1}"}
- func_stripname_result=${func_stripname_result%"${2}"}])
-
- _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
- func_split_long_opt_name=${1%%=*}
- func_split_long_opt_arg=${1#*=}])
-
- _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
- func_split_short_opt_arg=${1#??}
- func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
- _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
- case ${1} in
- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
- *) func_lo2o_result=${1} ;;
- esac])
-
- _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
-
- _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
-
- _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
- _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
- func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
- eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
- # Save a `func_append' function call where possible by direct use of '+='
- sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-else
- # Save a `func_append' function call even when '+=' is not available
- sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
- AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
- ;;
- esac
- ;;
- *-*-cygwin* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
- ;;
- esac
- ;;
- * ) # unhandled hosts (and "normal" native builds)
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
- [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
- ;;
- esac
- ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
- [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -1,369 +1,368 @@
# Helper functions for option handling. -*- Autoconf -*-
#
-# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 7 ltoptions.m4
+# serial 6 ltoptions.m4
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
# ------------------------------------------
m4_define([_LT_MANGLE_OPTION],
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
# ---------------------------------------
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
# saved as a flag.
m4_define([_LT_SET_OPTION],
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
_LT_MANGLE_DEFUN([$1], [$2]),
[m4_warning([Unknown $1 option `$2'])])[]dnl
])
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
# ------------------------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
m4_define([_LT_IF_OPTION],
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
# -------------------------------------------------------
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
# are set.
m4_define([_LT_UNLESS_OPTIONS],
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
[m4_define([$0_found])])])[]dnl
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
])[]dnl
])
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
# ----------------------------------------
# OPTION-LIST is a space-separated list of Libtool options associated
# with MACRO-NAME. If any OPTION has a matching handler declared with
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
# the unknown option and exit.
m4_defun([_LT_SET_OPTIONS],
[# Set options
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
[_LT_SET_OPTION([$1], _LT_Option)])
m4_if([$1],[LT_INIT],[
dnl
dnl Simply set some default values (i.e off) if boolean options were not
dnl specified:
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
])
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
])
dnl
dnl If no reference was made to various pairs of opposing options, then
dnl we run the default mode handler for the pair. For example, if neither
dnl `shared' nor `disable-shared' was passed, we enable building of shared
dnl archives by default:
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
[_LT_ENABLE_FAST_INSTALL])
])
])# _LT_SET_OPTIONS
## --------------------------------- ##
## Macros to handle LT_INIT options. ##
## --------------------------------- ##
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
# -----------------------------------------
m4_define([_LT_MANGLE_DEFUN],
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
# -----------------------------------------------
m4_define([LT_OPTION_DEFINE],
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
])# LT_OPTION_DEFINE
# dlopen
# ------
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
])
AU_DEFUN([AC_LIBTOOL_DLOPEN],
[_LT_SET_OPTION([LT_INIT], [dlopen])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
# win32-dll
# ---------
# Declare package support for building win32 dll's.
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
[enable_win32_dll=yes
case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
esac
test -z "$AS" && AS=as
-_LT_DECL([], [AS], [1], [Assembler program])dnl
+_LT_DECL([], [AS], [0], [Assembler program])dnl
test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
])# win32-dll
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
_LT_SET_OPTION([LT_INIT], [win32-dll])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `win32-dll' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
# _LT_ENABLE_SHARED([DEFAULT])
# ----------------------------
# implement the --enable-shared flag, and supports the `shared' and
# `disable-shared' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_SHARED],
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
_LT_DECL([build_libtool_libs], [enable_shared], [0],
[Whether or not to build shared libraries])
])# _LT_ENABLE_SHARED
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
# Old names:
AC_DEFUN([AC_ENABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
])
AC_DEFUN([AC_DISABLE_SHARED],
[_LT_SET_OPTION([LT_INIT], [disable-shared])
])
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
# _LT_ENABLE_STATIC([DEFAULT])
# ----------------------------
# implement the --enable-static flag, and support the `static' and
# `disable-static' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_STATIC],
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
_LT_DECL([build_old_libs], [enable_static], [0],
[Whether or not to build static libraries])
])# _LT_ENABLE_STATIC
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
# Old names:
AC_DEFUN([AC_ENABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
])
AC_DEFUN([AC_DISABLE_STATIC],
[_LT_SET_OPTION([LT_INIT], [disable-static])
])
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
# ----------------------------------
# implement the --enable-fast-install flag, and support the `fast-install'
# and `disable-fast-install' LT_INIT options.
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
m4_define([_LT_ENABLE_FAST_INSTALL],
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
for pkg in $enableval; do
IFS="$lt_save_ifs"
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$lt_save_ifs"
;;
esac],
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
_LT_DECL([fast_install], [enable_fast_install], [0],
[Whether or not to optimize for fast installation])dnl
])# _LT_ENABLE_FAST_INSTALL
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
# Old names:
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `fast-install' option into LT_INIT's first parameter.])
])
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
the `disable-fast-install' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
# _LT_WITH_PIC([MODE])
# --------------------
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
# LT_INIT options.
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
m4_define([_LT_WITH_PIC],
[AC_ARG_WITH([pic],
[AS_HELP_STRING([--with-pic],
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
[pic_mode="$withval"],
[pic_mode=default])
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
])# _LT_WITH_PIC
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
# Old name:
AU_DEFUN([AC_LIBTOOL_PICMODE],
[_LT_SET_OPTION([LT_INIT], [pic-only])
AC_DIAGNOSE([obsolete],
[$0: Remove this warning and the call to _LT_SET_OPTION when you
put the `pic-only' option into LT_INIT's first parameter.])
])
dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
## ----------------- ##
## LTDL_INIT Options ##
## ----------------- ##
m4_define([_LTDL_MODE], [])
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
[m4_define([_LTDL_MODE], [nonrecursive])])
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
[m4_define([_LTDL_MODE], [recursive])])
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
[m4_define([_LTDL_MODE], [subproject])])
m4_define([_LTDL_TYPE], [])
LT_OPTION_DEFINE([LTDL_INIT], [installable],
[m4_define([_LTDL_TYPE], [installable])])
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
[m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
@@ -1,23 +1,23 @@
# ltversion.m4 -- version numbers -*- Autoconf -*-
#
# Copyright (C) 2004 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# @configure_input@
+# Generated from ltversion.in.
-# serial 3293 ltversion.m4
+# serial 3017 ltversion.m4
# This file is part of GNU Libtool
-m4_define([LT_PACKAGE_VERSION], [2.4])
-m4_define([LT_PACKAGE_REVISION], [1.3293])
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4'
-macro_revision='1.3293'
+[macro_version='2.2.6b'
+macro_revision='1.3017'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
--- a/m4/lt~obsolete.m4
+++ b/m4/lt~obsolete.m4
@@ -1,98 +1,92 @@
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
-# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
-# serial 5 lt~obsolete.m4
+# serial 4 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/src/LEP-sextet.in b/src/LEP-sextet.in
new file mode 100644
--- /dev/null
+++ b/src/LEP-sextet.in
@@ -0,0 +1,43 @@
+##################################################
+# Example generator based on LEP parameters
+# usage: Herwig++ read LEP.in
+##################################################
+
+set /Herwig/Particles/t:Colour Sextet
+
+cd /Herwig/MatrixElements
+
+create Herwig::MEee2gZ2qqSextet MEee2gZ2qqSextet
+set MEee2gZ2qqSextet:MinimumFlavour 1
+set MEee2gZ2qqSextet:MaximumFlavour 5
+set MEee2gZ2qqSextet:Coupling /Herwig/Shower/AlphaQCD
+
+insert SimpleEE:MatrixElements 0 MEee2gZ2qqSextet
+set MEee2gZ2qqSextet:MinimumFlavour 6
+set MEee2gZ2qqSextet:MaximumFlavour 6
+
+##################################################
+# Technical parameters for this run
+##################################################
+cd /Herwig/Generators
+set LEPGenerator:NumberOfEvents 100000000
+set LEPGenerator:RandomNumberGenerator:Seed 31122001
+set LEPGenerator:PrintEvent 10
+set LEPGenerator:MaxErrors 10000
+
+##################################################
+# LEP physics parameters (override defaults)
+##################################################
+set LEPGenerator:EventHandler:LuminosityFunction:Energy 500.
+set LEPGenerator:EventHandler:CascadeHandler:MPIHandler NULL
+
+cd /Herwig/Generators
+
+#set LEPGenerator:EventHandler:CascadeHandler NULL
+set LEPGenerator:EventHandler:DecayHandler NULL
+set LEPGenerator:EventHandler:HadronizationHandler NULL
+
+###################################################
+# Save run for later usage with 'Herwig++ run'
+##################################################
+saverun LEP-sextet LEPGenerator
diff --git a/src/LHC-Sextet.in b/src/LHC-Sextet.in
new file mode 100644
--- /dev/null
+++ b/src/LHC-Sextet.in
@@ -0,0 +1,108 @@
+##################################################
+# Example generator for the Sextet model
+# in hadron collisions.
+# The best way to use this is to make your own
+# copy of this file and edit that as you require.
+#
+# The first section loads the model file which
+# does not contain anything that users need to touch.
+#
+# The second section contains the user settings.
+###################################################
+
+read Sextet.model
+cd /Herwig/NewPhysics
+
+##################################################
+#
+# This section contains the user defined settings
+#
+##################################################
+# Example hard process: Incoming proton, gravition + jet
+#insert HPConstructor:Incoming 0 /Herwig/Particles/g
+#insert HPConstructor:Incoming 0 /Herwig/Particles/u
+#insert HPConstructor:Incoming 0 /Herwig/Particles/ubar
+#insert HPConstructor:Incoming 0 /Herwig/Particles/d
+#insert HPConstructor:Incoming 0 /Herwig/Particles/dbar
+#insert HPConstructor:Incoming 0 /Herwig/Particles/s
+#insert HPConstructor:Incoming 0 /Herwig/Particles/sbar
+#insert HPConstructor:Incoming 0 /Herwig/Particles/c
+#insert HPConstructor:Incoming 0 /Herwig/Particles/cbar
+
+#### Scalar DQ Singlet Y=4/3
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_1''
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Scalar Singlet Y=4/3
+#### Scalar DQ Singlet Y=1/3
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_1
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Scalar Singlet Y=1/3
+#### Scalar DQ Singlet Y=-2/3
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_1'
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Scalar Singlet Y=-2/3
+#### Scalar DQ Triplet Y=1/3
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_3+
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_30
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQPhi_3-
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Scalar Triplet Y=1/3
+#### Vector DQ Doublet Y=-1/6
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQV_1+
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQV_1-
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Vector Doublet Y=-1/6
+#### Vector DQ Doublet Y=-5/6
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQV_2+
+insert HPConstructor:Outgoing 0 /Herwig/Particles/DQV_2-
+do /Herwig/NewPhysics/Sextet/Model:EnableParticles Vector Doublet Y=5/6
+
+#set HPConstructor:DebugME Yes
+
+# Example hard process: Incoming proton,resonant sextet
+insert ResConstructor:Incoming 0 /Herwig/Particles/u
+insert ResConstructor:Outgoing 0 /Herwig/Particles/d
+insert ResConstructor:Intermediates 0 /Herwig/Particles/DQPhi_1''
+#insert ResConstructor:Intermediates 0 /Herwig/Particles/DQV_2+
+insert ResConstructor:Outgoing 0 /Herwig/Particles/u
+insert ResConstructor:Outgoing 0 /Herwig/Particles/d
+
+#couplings
+#1st generation
+set Sextet/Model:g1L 0 1.0
+set Sextet/Model:g1R 0 1.0
+set Sextet/Model:g1RDoublePrime 0 1.0
+set Sextet/Model:g1RPrime 0 1.0
+set Sextet/Model:g2 0 1.0
+set Sextet/Model:g2Prime 0 1.0
+set Sextet/Model:g3L 0 1.0
+#2nd generation
+set Sextet/Model:g1L 1 1.0
+set Sextet/Model:g1R 1 1.0
+set Sextet/Model:g1RDoublePrime 1 1.0
+set Sextet/Model:g1RPrime 1 1.0
+set Sextet/Model:g2 1 1.0
+set Sextet/Model:g2Prime 1 1.0
+set Sextet/Model:g3L 1 1.0
+#3rd generation
+set Sextet/Model:g1L 2 1.0
+set Sextet/Model:g1R 2 1.0
+set Sextet/Model:g1RDoublePrime 2 1.0
+set Sextet/Model:g1RPrime 2 1.0
+set Sextet/Model:g2 2 1.0
+set Sextet/Model:g2Prime 2 1.0
+set Sextet/Model:g3L 2 1.0
+
+# Intrinsic pT tune extrapolated to LHC energy
+set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.2*GeV
+
+# Other parameters for run
+cd /Herwig/Generators
+set LHCGenerator:NumberOfEvents 10000000
+set LHCGenerator:RandomNumberGenerator:Seed 31122001
+set LHCGenerator:PrintEvent 1000
+set LHCGenerator:MaxErrors 10000
+set LHCGenerator:EventHandler:CascadeHandler NULL
+#set LHCGenerator:EventHandler:CascadeHandler:MPIHandler NULL
+set LHCGenerator:EventHandler:DecayHandler NULL
+set LHCGenerator:EventHandler:HadronizationHandler NULL
+set /Herwig/Analysis/Basics:CheckQuark 0
+
+#set /Herwig/Particles/DQPhi_1'':NominalMass 1000.*GeV
+
+saverun LHC-Sextet LHCGenerator
\ No newline at end of file
diff --git a/src/LHC-TTBA.in b/src/LHC-TTBA.in
--- a/src/LHC-TTBA.in
+++ b/src/LHC-TTBA.in
@@ -1,142 +1,142 @@
- ##################################################
+##################################################
# Example generator for the Leptoquark model
# in hadron collisions
# The best way to use this is to make your own
# copy of this file and edit that as you require.
#
# The first section loads the model file which
# does not contain anything that users need to touch.
#
# The second section contains the user settings.
###################################################
read TTBA.model
#Set up semi-leptonic (e or mu) top/hadronic topbar
set /Herwig/Particles/t:Synchronized Not_synchronized
set /Herwig/Particles/tbar:Synchronized Not_synchronized
set /Herwig/Particles/t/t->b,bbar,c;:OnOff Off
set /Herwig/Particles/t/t->b,c,dbar;:OnOff Off
set /Herwig/Particles/t/t->b,c,sbar;:OnOff Off
set /Herwig/Particles/t/t->b,sbar,u;:OnOff Off
set /Herwig/Particles/t/t->b,u,dbar;:OnOff Off
set /Herwig/Particles/t/t->nu_e,e+,b;:OnOff On
set /Herwig/Particles/t/t->nu_mu,mu+,b;:OnOff On
set /Herwig/Particles/t/t->nu_tau,tau+,b;:OnOff Off
set /Herwig/Particles/tbar/tbar->b,bbar,cbar;:OnOff On
set /Herwig/Particles/tbar/tbar->bbar,cbar,d;:OnOff On
set /Herwig/Particles/tbar/tbar->bbar,cbar,s;:OnOff On
set /Herwig/Particles/tbar/tbar->bbar,s,ubar;:OnOff On
set /Herwig/Particles/tbar/tbar->bbar,ubar,d;:OnOff On
set /Herwig/Particles/tbar/tbar->nu_ebar,e-,bbar;:OnOff Off
set /Herwig/Particles/tbar/tbar->nu_mubar,mu-,bbar;:OnOff Off
set /Herwig/Particles/tbar/tbar->nu_taubar,tau-,bbar;:OnOff Off
cd /Herwig/Generators
##################################################
# LHC physics parameters (override defaults here)
##################################################
# Intrinsic pT tune extrapolated to LHC energy
set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.2*GeV
##################################################
# Energy-dependent MPI parameters
##################################################
################################################################################
# NOTE: Set the correct parameters for the collision energy of your choice
# here.
################################################################################
#######################
## sqrt(s) = 900 GeV ##
#######################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
########################
## sqrt(s) = 2760 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 2760.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.62
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.24
########################
## sqrt(s) = 7000 GeV ##
########################
set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
#########################
## sqrt(s) = 14000 GeV ##
#########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 14000.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.53
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 7.06
##################################################
#
# This section contains the user defined settings
#
##################################################
# Example hard process: Incoming proton, outgoing leptoquarks
cd /Herwig/NewPhysics
set HPConstructor:Processes Exclusive
insert HPConstructor:Incoming 0 /Herwig/Particles/u
insert HPConstructor:Incoming 1 /Herwig/Particles/ubar
insert HPConstructor:Incoming 2 /Herwig/Particles/d
insert HPConstructor:Incoming 3 /Herwig/Particles/dbar
insert HPConstructor:Incoming 4 /Herwig/Particles/s
insert HPConstructor:Incoming 5 /Herwig/Particles/sbar
insert HPConstructor:Incoming 6 /Herwig/Particles/c
insert HPConstructor:Incoming 7 /Herwig/Particles/cbar
insert HPConstructor:Incoming 8 /Herwig/Particles/b
insert HPConstructor:Incoming 9 /Herwig/Particles/bbar
insert HPConstructor:Incoming 10 /Herwig/Particles/g
# Comment out the following line if Axigluon model is selected
insert /Herwig/NewPhysics/HPConstructor:Excluded 0 /Herwig/Particles/Ag
insert HPConstructor:Outgoing 0 /Herwig/Particles/t
insert HPConstructor:Outgoing 1 /Herwig/Particles/tbar
#This is available for comparison to the LO Hw++ result
#cd /Herwig/MatrixElements
#insert SimpleQCD:MatrixElements[0] MEHeavyQuark
cd /Herwig/Shower
set SplittingGenerator:ISR Yes
set SplittingGenerator:FSR Yes
cd /Herwig/EventHandlers
#set LHCHandler:CascadeHandler NULL
#set LHCHandler:HadronizationHandler NULL
#set LHCHandler:DecayHandler NULL
# Other parameters for run
cd /Herwig/Generators
# Uncomment to turn off MPI
#set LHCGenerator:EventHandler:CascadeHandler:MPIHandler NULL
set LHCGenerator:DebugLevel 1
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 100
set LHCGenerator:MaxErrors 10000
#HepMC analysis
#insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
#set /Herwig/Analysis/HepMCFile:PrintEvent 10000
#set /Herwig/Analysis/HepMCFile:Format GenEvent
#set /Herwig/Analysis/HepMCFile:Units GeV_mm
saverun LHC-TTBA LHCGenerator
diff --git a/src/LHC-UE-EE-3-CTEQ6L1.in b/src/LHC-UE-EE-3-CTEQ6L1.in
--- a/src/LHC-UE-EE-3-CTEQ6L1.in
+++ b/src/LHC-UE-EE-3-CTEQ6L1.in
@@ -1,146 +1,152 @@
################################################################################
# This file contains tunes to UE data from CDF and ATLAS at 900 GeV,
# 1.8 TeV and 7.0 TeV. Moreover, we provide a suggestion for 2.76 TeV
# and 14 TeV runs, which extrapolates between other tunes.
#
# NOTE: You have to uncomment some lines in this file, depending on your
# center-of-mass energy! Please read the instructions below carefully.
#
# More information and instructions can be obtained from this Herwig++
# wiki page: http://projects.hepforge.org/herwig/trac/wiki/MB_UE_tunes
################################################################################
cd /Herwig
create Herwig::O2AlphaS O2AlphaS
set Model:QCD/RunningAlphaS O2AlphaS
################################################################################
# NOTE: ThePEG has to be linked against LHAPDF at compile time to be able to
# use the CTEQ6L1 pdfs.
################################################################################
cd /Herwig/Partons
create ThePEG::LHAPDF myPDFset ThePEGLHAPDF.so
set myPDFset:PDFName cteq6ll.LHpdf
set myPDFset:RemnantHandler HadronRemnants
set /Herwig/Particles/p+:PDF myPDFset
set /Herwig/Particles/pbar-:PDF myPDFset
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 1000000
set LHCGenerator:DebugLevel 0
set LHCGenerator:DumpPeriod -1
set LHCGenerator:DebugEvent 0
##################################################
# Energy-dependent MPI parameters
##################################################
################################################################################
# NOTE: Set the correct parameters for the collision energy of your choice
# here. This line will cause an error, which is intentional. Remove this line
# and uncomment the section corresponding to the chosen center-of-mass energy.
################################################################################
set LHCGenerator:EventHandler:LuminosityFunction:Energy -1
#######################
## sqrt(s) = 900 GeV ##
#######################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.55
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.1
#set /Herwig/Shower/Evolver:IntrinsicPtGaussian 1.81*GeV
## NOTE: This tune of the intrinsic pT is an extrapolation to 900 GeV.
########################
## sqrt(s) = 1800 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 1800.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.26
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 4.52
########################
## sqrt(s) = 2760 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 2760.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.33
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 4.66
-
########################
## sqrt(s) = 7000 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.752
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.504
#set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.34*GeV
## NOTE: This tune of the intrinsic pT is an extrapolation to 7 TeV.
+########################
+## sqrt(s) = 8000 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 8000.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.85
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.7
+
#########################
## sqrt(s) = 14000 GeV ##
#########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 14000.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.53
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 7.06
##################################################
# Energy-independent MPI parameters
##################################################
# Colour reconnection settings
set /Herwig/Hadronization/ColourReconnector:ColourReconnection Yes
set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.61
# Colour Disrupt settings
set /Herwig/Partons/RemnantDecayer:colourDisrupt 0.75
# inverse hadron radius
set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.35
##################################################
# Matrix Elements for hadron-hadron collisions
##################################################
cd /Herwig/MatrixElements/
insert SimpleQCD:MatrixElements[0] MEMinBias
# Need this cut only for min bias
cd /Herwig/Cuts
set JetKtCut:MinKT 0.0*GeV
set QCDCuts:MHatMin 0.0*GeV
set QCDCuts:X1Min 0.01
set QCDCuts:X2Min 0.01
# MPI model settings
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
set /Herwig/UnderlyingEvent/MPIHandler:softInt Yes
set /Herwig/UnderlyingEvent/MPIHandler:twoComp Yes
set /Herwig/UnderlyingEvent/MPIHandler:DLmode 2
cd /Herwig/Generators
#insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
#set /Herwig/Analysis/HepMCFile:PrintEvent 1000000
#set /Herwig/Analysis/HepMCFile:Format GenEvent
#set /Herwig/Analysis/HepMCFile:Units GeV_mm
#set /Herwig/Analysis/HepMCFile:Filename events.fifo
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
saverun LHC-UE-EE-3-CTEQ6L1 LHCGenerator
diff --git a/src/LHC-UE-EE-3.in b/src/LHC-UE-EE-3.in
--- a/src/LHC-UE-EE-3.in
+++ b/src/LHC-UE-EE-3.in
@@ -1,132 +1,138 @@
################################################################################
# This file contains tunes to UE data from CDF and ATLAS at 900 GeV,
# 1.8 TeV and 7.0 TeV. Moreover, we provide a suggestion for 2.76 TeV
# and 14 TeV runs, which extrapolates between other tunes.
#
# NOTE: You have to uncomment some lines in this file, depending on your
# center-of-mass energy! Please read the instructions below carefully.
#
# More information and instructions can be obtained from this Herwig++
# wiki page: http://projects.hepforge.org/herwig/trac/wiki/MB_UE_tunes
################################################################################
cd /Herwig
create Herwig::O2AlphaS O2AlphaS
set Model:QCD/RunningAlphaS O2AlphaS
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 1000000
set LHCGenerator:DebugLevel 0
set LHCGenerator:DumpPeriod -1
set LHCGenerator:DebugEvent 0
##################################################
# Energy-dependent MPI parameters
##################################################
################################################################################
# NOTE: Set the correct parameters for the collision energy of your choice
# here. This line will cause an error, which is intentional. Remove this line
# and uncomment the section corresponding to the chosen center-of-mass energy.
################################################################################
set LHCGenerator:EventHandler:LuminosityFunction:Energy -1
#######################
## sqrt(s) = 900 GeV ##
#######################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
########################
## sqrt(s) = 1800 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 1800.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.55
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.1
########################
## sqrt(s) = 2760 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 2760.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.62
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.24
-
########################
## sqrt(s) = 7000 GeV ##
########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
#set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.37*GeV
## NOTE: This tune of the intrinsic pT is an extrapolation to 7 TeV.
+########################
+## sqrt(s) = 8000 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 8000.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.21
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.42
+
#########################
## sqrt(s) = 14000 GeV ##
#########################
#set LHCGenerator:EventHandler:LuminosityFunction:Energy 14000.0
#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.53
#set /Herwig/UnderlyingEvent/UECuts:MHatMin 7.06
##################################################
# Energy-independent MPI parameters
##################################################
# Colour reconnection settings
set /Herwig/Hadronization/ColourReconnector:ColourReconnection Yes
set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.54
# Colour Disrupt settings
set /Herwig/Partons/RemnantDecayer:colourDisrupt 0.80
# inverse hadron radius
set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.11
##################################################
# Matrix Elements for hadron-hadron collisions
##################################################
cd /Herwig/MatrixElements/
insert SimpleQCD:MatrixElements[0] MEMinBias
# Need this cut only for min bias
cd /Herwig/Cuts
set JetKtCut:MinKT 0.0*GeV
set QCDCuts:MHatMin 0.0*GeV
set QCDCuts:X1Min 0.01
set QCDCuts:X2Min 0.01
# MPI model settings
set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0
set /Herwig/UnderlyingEvent/MPIHandler:softInt Yes
set /Herwig/UnderlyingEvent/MPIHandler:twoComp Yes
set /Herwig/UnderlyingEvent/MPIHandler:DLmode 2
cd /Herwig/Generators
#insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
#set /Herwig/Analysis/HepMCFile:PrintEvent 1000000
#set /Herwig/Analysis/HepMCFile:Format GenEvent
#set /Herwig/Analysis/HepMCFile:Units GeV_mm
#set /Herwig/Analysis/HepMCFile:Filename events.fifo
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
saverun LHC-UE-EE-3 LHCGenerator
diff --git a/src/LHC.in b/src/LHC.in
--- a/src/LHC.in
+++ b/src/LHC.in
@@ -1,141 +1,179 @@
##################################################
# Example generator based on LHC parameters
# usage: Herwig++ read LHC.in
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 10000
##################################################
# LHC physics parameters (override defaults here)
##################################################
-set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
# Intrinsic pT tune extrapolated to LHC energy
set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.2*GeV
##################################################
+# Energy-dependent MPI parameters
+##################################################
+
+################################################################################
+# NOTE: Set the correct parameters for the collision energy of your choice
+# here.
+################################################################################
+
+#######################
+## sqrt(s) = 900 GeV ##
+#######################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
+
+########################
+## sqrt(s) = 2760 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 2760.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.62
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.24
+
+########################
+## sqrt(s) = 7000 GeV ##
+########################
+set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
+
+#########################
+## sqrt(s) = 14000 GeV ##
+#########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 14000.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.53
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 7.06
+
+
+
+##################################################
# Matrix Elements for hadron-hadron collisions
# (by default only gamma/Z switched on)
##################################################
cd /Herwig/MatrixElements/
#
# Electroweak boson W/Z processes
#
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] MEqq2gZ2ff
#
# Drell-Yan W
# insert SimpleQCD:MatrixElements[0] MEqq2W2ff
#
# W+jet
# insert SimpleQCD:MatrixElements[0] MEWJet
#
# Z+jet
# insert SimpleQCD:MatrixElements[0] MEZJet
#
# WW/WZ/ZZ
# insert SimpleQCD:MatrixElements[0] MEPP2VV
#
# Wgamma/Zgamma
# insert SimpleQCD:MatrixElements[0] MEPP2VGamma
#
# QCD and gamma processes
#
# QCD 2-2 scattering
# insert SimpleQCD:MatrixElements[0] MEQCD2to2
#
# top-antitop production
# insert SimpleQCD:MatrixElements[0] MEHeavyQuark
#
# gamma+jet
# insert SimpleQCD:MatrixElements[0] MEGammaJet
#
# gamma-gamma
# insert SimpleQCD:MatrixElements[0] MEGammaGamma
#
# Higgs Processes
#
#
# gg/qqbar -> Higgs (recommend including q qbar->Hg as not in ME correction)
# insert SimpleQCD:MatrixElements[0] MEHiggs
# insert SimpleQCD:MatrixElements[0] MEHiggsJet
# set MEHiggsJet:Process qqbar
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# higgs+jet
# insert SimpleQCD:MatrixElements[0] MEHiggsJet
#
# higgs + W (N.B. if considering all W decay modes useful to set )
# (jet pT cut to zero so no cut on W decay products )
# insert SimpleQCD:MatrixElements[0] MEPP2WH
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# higgs + Z (N.B. if considering all Z decay modes useful to set )
# (jet pT cut to zero so no cut on Z decay products )
# insert SimpleQCD:MatrixElements[0] MEPP2ZH
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# VBF Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2HiggsVBF
#
# t tbar Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2ttbarH
#
# b bbar Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2bbbarH
cd /Herwig/Generators
##################################################
# Useful analysis handlers for hadron-hadron physics
##################################################
# analysis of W/Z events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/DrellYan
# analysis of top-antitop events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/TTbar
# analysis of gamma+jet events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaJet
# analysis of gamma-gamma events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaGamma
# analysis of higgs-jet events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HiggsJet
##################################################
# Useful analysis handlers for HepMC related output
##################################################
# Schematic overview of an event (requires --with-hepmc to be set at configure time
# and the graphviz program 'dot' to produce a plot)
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot
# A HepMC dump file (requires --with-hepmc to be set at configure time)
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
# set /Herwig/Analysis/HepMCFile:PrintEvent 100
# set /Herwig/Analysis/HepMCFile:Format GenEvent
# set /Herwig/Analysis/HepMCFile:Units GeV_mm
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
saverun LHC LHCGenerator
##################################################
# uncomment this section for an example batch run
# of two repeats with different parameters
#
# Note that a separate call of 'Herwig run'
# is not required in this case
##################################################
# set LHCGenerator:NumberOfEvents 10
# run LHC-full LHCGenerator
#
# set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
# run LHC-initial LHCGenerator
diff --git a/src/Makefile.am b/src/Makefile.am
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,139 +1,182 @@
SUBDIRS = defaults
AUTOMAKE_OPTIONS = -Wno-portability
defaultsdir = ${pkgdatadir}/defaults
bin_PROGRAMS = Herwig++
Herwig___SOURCES = Herwig++.cc herwigopts.c herwigopts.h
BUILT_SOURCES = herwigopts.c herwigopts.h
Herwig___LDFLAGS = $(AM_LDFLAGS) -export-dynamic $(THEPEGLDFLAGS)
Herwig___LDADD = $(THEPEGLIB) -ldl
Herwig___CPPFLAGS = $(AM_CPPFLAGS) \
-DHERWIG_PKGDATADIR="\"$(pkgdatadir)\"" \
-DHERWIG_PKGLIBDIR="\"$(pkglibdir)\"" \
-DTHEPEG_PKGLIBDIR="\"$(THEPEGPATH)/lib/ThePEG\""
bin_SCRIPTS = herwig-config
-HELPERFILES = CMSSM40.1.1.slha RPV-LLE.slha RPV-LQD.slha RPV-UDD.slha\
- NMSSM.spc MUED.model MSSM.model NMSSM.model\
- RS.model ADD.model Leptoquark.model LH.model
+HELPERFILES = CMSSM40.1.1.slha RPV3.1.slha NMSSM.spc \
+ADD.model \
+Leptoquark.model \
+MSSM.model \
+MUED.model \
+NMSSM.model \
+RS.model \
+Sextet.model \
+TTBA.model \
+Zprime.model \
+RPV-LLE.slha \
+RPV-LQD.slha \
+RPV-UDD.slha \
+LH.model
-INPUTFILES = ILC.in LEP.in LHC.in TVT.in LHC-MSSM.in LHC-RPV.in \
- LHC-MUED.in LHC-NMSSM.in LHC-RS.in LHC-ADD.in LHC-LH.in\
- ILC-MSSM.in ILC-MUED.in ILC-RS.in DIS.in LHC-Powheg.in \
- TVT-Powheg.in GammaGamma.in LHC-TRP.in LHC-Anomalous.in \
- LHC-diffractive.in LHC-GammaGamma.in LHC-LQ.in \
- LHC-MU900-2.in LHC-UE7-2.in LHC-UE-EE-2.in \
- LHC-UE-EE-3-CTEQ6L1.in LHC-UE-EE-3.in
+INPUTFILES = \
+DIS.in \
+GammaGamma.in \
+ILC.in \
+ILC-MSSM.in \
+ILC-MUED.in \
+ILC-RS.in \
+LEP.in \
+LHC-ADD.in \
+LHC-diffractive.in \
+LHC-GammaGamma.in \
+LHC.in \
+LHC-LQ.in \
+LHC-MSSM.in \
+LHC-MU900-2.in \
+LHC-MUED.in \
+LHC-NMSSM.in \
+LHC-Powheg.in \
+LHC-RPV.in \
+LHC-RS.in \
+LHC-Sextet.in \
+LHC-TRP.in \
+LHC-TTBA.in \
+LHC-UE7-2.in \
+LHC-UE-EE-2.in \
+LHC-UE-EE-3-CTEQ6L1.in \
+LHC-UE-EE-3.in \
+LHC-ZP.in \
+TVT.in \
+TVT-Powheg.in \
+TVT-TTBA.in \
+LHC-LH.in \
+LHC-Anomalous.in
dist_pkgdata_DATA = $(INPUTFILES) $(HELPERFILES)
pkgdata_DATA = Makefile-UserModules
CLEANFILES = HerwigDefaults.rpo \
*.run *.log *.out *.tex \
multi.test *.output probs.test chisq.value \
LHC-RS-BR.spc LHC-MSSM-BR.spc LHC-RPV-BR.spc
## checking targets ##
HerwigDefaults.rpo: Herwig++ $(srcdir)/defaults/*.in defaults/PDF.in defaults/Analysis.in $(top_builddir)/lib/*.so
./Herwig++ init -L$(top_builddir)/lib -i defaults/HerwigDefaults.in -D
check_BSM_Full=
check_BSM=
if WANT_MSSM
check_BSM += check-LHC-RPV
check_BSM_Full += check-LHC-RPV check-LHC-MSSM
endif
if WANT_NMSSM
check_BSM_Full += check-LHC-NMSSM
endif
if WANT_UED
check_BSM += check-LHC-MUED
check_BSM_Full += check-LHC-MUED
endif
if WANT_RS
check_BSM += check-LHC-RS
check_BSM_Full += check-LHC-RS
endif
if WANT_LH
check_BSM_Full += check-LHC-LH
endif
if WANT_LHTP
check_BSM_Full += check-LHC-LHTP
endif
if WANT_TRP
check_BSM_Full += check-LHC-TRP
endif
if WANT_ADD
check_BSM_Full += check-LHC-ADD
endif
+if WANT_TTBA
+check_BSM_Full += check-LHC-TTBA
+endif
+if WANT_ZPRIME
+check_BSM_Full += check-LHC-ZP
+endif
-check-local: check-LHC check-LEP check-DIS check-ILC check-GammaGamma $(check_BSM) check-LHC-Powheg
+check-local: check-LHC check-LEP check-DIS check-ILC check-GammaGamma $(check_BSM) check-LHC-Powheg
check-Powheg: check-LHC-Powheg check-TVT-Powheg
check-BSM: $(check_BSM_Full)
link-helper-files:
@for i in $(HELPERFILES); do \
if test -f $(srcdir)/$$i -a ! -e $$i; then \
$(LN_S) -f $(srcdir)/$$i; fi; done
check-%: $(srcdir)/%.in HerwigDefaults.rpo link-helper-files
./Herwig++ read $< -D
./Herwig++ run $(notdir $(subst .in,.run,$<)) -N500 -d1 -D
## valgrind targets ##
VALGRIND=valgrind --leak-check=full --num-callers=25 --freelist-vol=100000000 --leak-resolution=med --trace-children=yes
valgrind: valgrind-init valgrind-read valgrind-run
valgrind-init:
$(VALGRIND) ./Herwig++ init -d1 -D -L$(top_builddir)/lib -i defaults/HerwigDefaults.in \
&> /tmp/valgrind-init.log
valgrind-read:
$(VALGRIND) ./Herwig++ read -d1 -D LHC.in &> /tmp/valgrind-read.log
valgrind-run:
$(VALGRIND) ./Herwig++ run -d1 -D -N5 LHC.run &> /tmp/valgrind-run.log
SETUPTHEPEG=$(THEPEGPATH)/bin/setupThePEG
THEPEGREPO=$(THEPEGPATH)/lib/ThePEG/ThePEGDefaults.rpo
install-data-hook:
@echo Creating repository
@./Herwig++ init -L$(DESTDIR)$(pkglibdir) -i $(DESTDIR)$(defaultsdir)/HerwigDefaults.in -r $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo
uninstall-hook:
rm -f $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo
register: register-with-thepeg-repo
register-with-thepeg-repo:
@if test -x "$(SETUPTHEPEG)" -a -w "$(THEPEGREPO)"; \
then echo Registering with ThePEG; \
"$(SETUPTHEPEG)" --init \
$(DESTDIR)$(defaultsdir)/HerwigDefaults.in \
-r "$(THEPEGREPO)" -o "$(THEPEGREPO)" \
-l$(DESTDIR)$(pkglibdir) ; \
fi
unregister : unregister-from-thepeg-repo
unregister-from-thepeg-repo:
@if test -x "$(SETUPTHEPEG)" -a -w "$(THEPEGREPO)"; \
then echo Unregistering with ThePEG; \
"$(SETUPTHEPEG)" --init defaults/HerwigCleanup.in \
-r "$(THEPEGREPO)" -o "$(THEPEGREPO)" \
-l$(DESTDIR)$(pkglibdir) ; \
fi
EXTRA_DIST = herwigopts.ggo
GENGETOPT = gengetopt
%opts.h %opts.c : %opts.ggo
$(GENGETOPT) < $<
diff --git a/src/RPV3.1.slha b/src/RPV3.1.slha
new file mode 100644
--- /dev/null
+++ b/src/RPV3.1.slha
@@ -0,0 +1,531 @@
+# ISAJET SUSY parameters in SUSY Les Houches Accord 2 format
+# Created by ISALHA 2.0 Last revision: C. Balazs 21 Apr 2009
+Block SPINFO # Program information
+ 1 ISASUGRA from ISAJET # Spectrum Calculator
+ 2 7.81 26-APR-2011 16:50:35 # Version number
+Block MODSEL # Model selection
+ 1 1 # Minimal supergravity (mSUGRA) model
+Block SMINPUTS # Standard Model inputs
+ 1 1.27841293E+02 # alpha_em^(-1)
+ 2 1.16570000E-05 # G_Fermi
+ 3 1.17200002E-01 # alpha_s(M_Z)
+ 4 9.11699982E+01 # m_{Z}(pole)
+ 5 4.19999981E+00 # m_{b}(m_{b})
+ 6 1.73199997E+02 # m_{top}(pole)
+ 7 1.77699995E+00 # m_{tau}(pole)
+Block MINPAR # SUSY breaking input parameters
+ 1 1.25000000E+02 # m_0
+ 2 5.00000000E+02 # m_{1/2}
+ 3 1.00000000E+01 # tan(beta)
+ 4 1.00000000E+00 # sign(mu)
+ 5 0.00000000E+00 # A_0
+Block EXTPAR # Non-universal SUSY breaking parameters
+ 0 1.73293684E+16 # Input scale
+Block MASS # Scalar and gaugino mass spectrum
+# PDG code mass particle
+ 24 8.04229965E+01 # W^+
+ 25 1.14529778E+02 # h^0
+ 35 7.16610962E+02 # H^0
+ 36 7.11739441E+02 # A^0
+ 37 7.20844055E+02 # H^+
+ 1000001 1.06214185E+03 # dnl
+ 1000002 1.05892517E+03 # upl
+ 1000003 1.06214185E+03 # stl
+ 1000004 1.05892615E+03 # chl
+ 1000005 9.77616211E+02 # b1
+ 1000006 8.03143250E+02 # t1
+ 1000011 3.62920380E+02 # el-
+ 1000012 3.51372070E+02 # nuel
+ 1000013 3.62920410E+02 # mul-
+ 1000014 3.51372070E+02 # numl
+ 1000015 2.22224518E+02 # tau1
+ 1000016 3.47436615E+02 # nutl
+ 1000021 1.15231189E+03 # glss
+ 1000022 2.04949677E+02 # z1ss
+ 1000023 3.86143707E+02 # z2ss
+ 1000024 3.86816162E+02 # w1ss
+ 1000025 -6.27991333E+02 # z3ss
+ 1000035 6.43010193E+02 # z4ss
+ 1000037 6.42467407E+02 # w2ss
+ 2000001 1.01799512E+03 # dnr
+ 2000002 1.02183514E+03 # upr
+ 2000003 1.01799518E+03 # str
+ 2000004 1.02183618E+03 # chr
+ 2000005 1.01353174E+03 # b2
+ 2000006 1.02112970E+03 # t2
+ 2000011 2.26291672E+02 # er-
+ 2000013 2.26291718E+02 # mur-
+ 2000015 3.61810516E+02 # tau2
+Block ALPHA # Effective Higgs mixing parameter
+ -1.03237279E-01 # alpha
+Block STOPMIX # stop mixing matrix
+ 1 1 4.10014242E-01 # O_{11}
+ 1 2 9.12079096E-01 # O_{12}
+ 2 1 -9.12079096E-01 # O_{21}
+ 2 2 4.10014242E-01 # O_{22}
+Block SBOTMIX # sbottom mixing matrix
+ 1 1 9.63158786E-01 # O_{11}
+ 1 2 2.68933296E-01 # O_{12}
+ 2 1 -2.68933296E-01 # O_{21}
+ 2 2 9.63158786E-01 # O_{22}
+Block STAUMIX # stau mixing matrix
+ 1 1 1.39273554E-01 # O_{11}
+ 1 2 9.90253925E-01 # O_{12}
+ 2 1 -9.90253925E-01 # O_{21}
+ 2 2 1.39273554E-01 # O_{22}
+Block NMIX # neutralino mixing matrix
+ 1 1 9.95991528E-01 #
+ 1 2 -1.66598335E-02 #
+ 1 3 8.13337192E-02 #
+ 1 4 -3.32864523E-02 #
+ 2 1 -3.71091887E-02 #
+ 2 2 -9.69584048E-01 #
+ 2 3 2.00293168E-01 #
+ 2 4 -1.35692954E-01 #
+ 3 1 3.30185927E-02 #
+ 3 2 -4.75754663E-02 #
+ 3 3 -7.03835666E-01 #
+ 3 4 -7.07998335E-01 #
+ 4 1 -7.43867978E-02 #
+ 4 2 2.39512175E-01 #
+ 4 3 6.76670194E-01 #
+ 4 4 -6.92255676E-01 #
+Block UMIX # chargino U mixing matrix
+ 1 1 -9.58370566E-01 # U_{11}
+ 1 2 2.85527259E-01 # U_{12}
+ 2 1 -2.85527259E-01 # U_{21}
+ 2 2 -9.58370566E-01 # U_{22}
+Block VMIX # chargino V mixing matrix
+ 1 1 -9.80898976E-01 # V_{11}
+ 1 2 1.94517970E-01 # V_{12}
+ 2 1 -1.94517970E-01 # V_{21}
+ 2 2 -9.80898976E-01 # V_{22}
+Block GAUGE Q= 8.66610535E+02 #
+ 1 3.57502967E-01 # g`
+ 2 6.52456701E-01 # g_2
+ 3 1.22047222E+00 # g_3
+Block YU Q= 8.66610535E+02 #
+ 3 3 8.63739312E-01 # y_t
+Block YD Q= 8.66610535E+02 #
+ 3 3 1.32061005E-01 # y_b
+Block YE Q= 8.66610535E+02 #
+ 3 3 1.02258258E-01 # y_tau
+Block HMIX Q= 8.66610535E+02 # Higgs mixing parameters
+ 1 6.23225952E+02 # mu(Q)
+ 2 1.00000000E+01 # tan(beta)(M_GUT)
+ 3 2.50762512E+02 # Higgs vev at Q
+ 4 5.06573031E+05 # m_A^2(Q)
+Block MSOFT Q= 8.66610535E+02 # DRbar SUSY breaking parameters
+ 1 2.09825760E+02 # M_1(Q)
+ 2 3.89350372E+02 # M_2(Q)
+ 3 1.10003870E+03 # M_3(Q)
+ 21 1.09866984E+05 # M^2_Hd
+ 22 -3.78524906E+05 # M^2_Hu
+ 31 3.56637512E+02 # MeL(Q)
+ 32 3.56637512E+02 # MmuL(Q)
+ 33 3.52836609E+02 # MtauL(Q)
+ 34 2.22725647E+02 # MeR(Q)
+ 35 2.22725647E+02 # MmuR(Q)
+ 36 2.18548676E+02 # MtauR(Q)
+ 41 1.00690503E+03 # MqL1(Q)
+ 42 1.00690503E+03 # MqL2(Q)
+ 43 9.34674500E+02 # MqL3(Q)
+ 44 9.70481750E+02 # MuR(Q)
+ 45 9.70481750E+02 # McR(Q)
+ 46 8.03503052E+02 # MtR(Q)
+ 47 9.65828430E+02 # MdR(Q)
+ 48 9.65828430E+02 # MsR(Q)
+ 49 9.66277161E+02 # MbR(Q)
+Block AU Q= 8.66610535E+02 #
+ 1 1 -8.76324646E+02 # A_u
+ 2 2 -8.76324646E+02 # A_c
+ 3 3 -8.76324646E+02 # A_t
+Block AD Q= 8.66610535E+02 #
+ 1 1 -1.29659106E+03 # A_d
+ 2 2 -1.29659106E+03 # A_s
+ 3 3 -1.29659106E+03 # A_b
+Block AE Q= 8.66610535E+02 #
+ 1 1 -2.97269653E+02 # A_e
+ 2 2 -2.97269653E+02 # A_mu
+ 3 3 -2.97269653E+02 # A_tau
+# ISAJET decay tables in SUSY Les Houches accord format
+# Created by ISALHD. Last revision: C. Balazs, 2005 May 25
+Block DCINFO # Program information
+ 1 ISASUGRA from ISAJET # Spectrum Calculator
+ 2 7.81 26-APR-2011 16:50:35 # Version number
+# PDG Width
+DECAY 6 1.16585374E+00 # TP decays
+# BR NDA ID1 ID2 ID3 ID4
+ 3.33333343E-01 3 2 -1 5 # TP --> UP DB BT
+ 3.33333343E-01 3 4 -3 5 # TP --> CH SB BT
+ 1.11111119E-01 3 -11 12 5 # TP --> E+ NUE BT
+ 1.11111119E-01 3 -13 14 5 # TP --> MU+ NUM BT
+ 1.11111119E-01 3 -15 16 5 # TP --> TAU+ NUT BT
+# PDG Width
+DECAY 1000021 1.44547825E+01 # GLSS decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.10274914E-03 3 1000024 5 -6 # GLSS --> W1SS+ BT TB
+ 1.10274914E-03 3 -1000024 6 -5 # GLSS --> W1SS- TP BB
+ 2.98244588E-04 3 1000037 5 -6 # GLSS --> W2SS+ BT TB
+ 2.98244588E-04 3 -1000037 6 -5 # GLSS --> W2SS- TP BB
+ 1.59128278E-04 3 1000022 6 -6 # GLSS --> Z1SS TP TB
+ 9.30276234E-04 3 1000023 6 -6 # GLSS --> Z2SS TP TB
+ 3.98273660E-05 2 1000025 21 # GLSS --> Z3SS GL
+ 4.24300000E-04 3 1000025 6 -6 # GLSS --> Z3SS TP TB
+ 3.02960252E-05 2 1000035 21 # GLSS --> Z4SS GL
+ 1.43193593E-03 3 1000035 6 -6 # GLSS --> Z4SS TP TB
+ 2.18796469E-02 2 -1000002 2 # GLSS --> UBL UP
+ 2.18796469E-02 2 1000002 -2 # GLSS --> UPL UB
+ 2.04577185E-02 2 -1000001 1 # GLSS --> DBL DN
+ 2.04577185E-02 2 1000001 -1 # GLSS --> DNL DB
+ 4.12898697E-02 2 -2000002 2 # GLSS --> UBR UP
+ 4.12898697E-02 2 2000002 -2 # GLSS --> UPR UB
+ 4.36015874E-02 2 -2000001 1 # GLSS --> DBR DN
+ 4.36015874E-02 2 2000001 -1 # GLSS --> DNR DB
+ 2.04576738E-02 2 -1000003 3 # GLSS --> SBL ST
+ 2.04576738E-02 2 1000003 -3 # GLSS --> STL SB
+ 4.36015092E-02 2 -2000003 3 # GLSS --> SBR ST
+ 4.36015092E-02 2 2000003 -3 # GLSS --> STR SB
+ 2.18771119E-02 2 -1000004 4 # GLSS --> CBL CH
+ 2.18771119E-02 2 1000004 -4 # GLSS --> CHL CB
+ 4.12872992E-02 2 -2000004 4 # GLSS --> CBR CH
+ 4.12872992E-02 2 2000004 -4 # GLSS --> CHR CB
+ 6.98747337E-02 2 -1000005 5 # GLSS --> BB1 BT
+ 6.98747337E-02 2 1000005 -5 # GLSS --> BT1 BB
+ 4.72499467E-02 2 -2000005 5 # GLSS --> BB2 BT
+ 4.72499467E-02 2 2000005 -5 # GLSS --> BT2 BB
+ 1.25514030E-01 2 -1000006 6 # GLSS --> TB1 TP
+ 1.25514030E-01 2 1000006 -6 # GLSS --> TP1 TB
+# PDG Width
+DECAY 1000002 9.97746372E+00 # UPL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.13797113E-02 2 1000022 2 # UPL --> Z1SS UP
+ 3.20155859E-01 2 1000023 2 # UPL --> Z2SS UP
+ 3.23779590E-04 2 1000025 2 # UPL --> Z3SS UP
+ 9.08369105E-03 2 1000035 2 # UPL --> Z4SS UP
+ 6.45558178E-01 2 1000024 1 # UPL --> W1SS+ DN
+ 1.34988446E-02 2 1000037 1 # UPL --> W2SS+ DN
+# PDG Width
+DECAY 1000001 9.87782669E+00 # DNL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.66364126E-02 2 1000022 1 # DNL --> Z1SS DN
+ 3.15981388E-01 2 1000023 1 # DNL --> Z2SS DN
+ 5.50624332E-04 2 1000025 1 # DNL --> Z3SS DN
+ 1.16400020E-02 2 1000035 1 # DNL --> Z4SS DN
+ 6.25515699E-01 2 -1000024 2 # DNL --> W1SS- UP
+ 2.96758413E-02 2 -1000037 2 # DNL --> W2SS- UP
+# PDG Width
+DECAY 1000003 9.87779808E+00 # STL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.66364629E-02 2 1000022 3 # STL --> Z1SS ST
+ 3.15982342E-01 2 1000023 3 # STL --> Z2SS ST
+ 5.50625962E-04 2 1000025 3 # STL --> Z3SS ST
+ 1.16400374E-02 2 1000035 3 # STL --> Z4SS ST
+ 6.25514865E-01 2 -1000024 4 # STL --> W1SS- CH
+ 2.96756905E-02 2 -1000037 4 # STL --> W2SS- CH
+# PDG Width
+DECAY 1000004 9.97746372E+00 # CHL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.13796843E-02 2 1000022 4 # CHL --> Z1SS CH
+ 3.20154935E-01 2 1000023 4 # CHL --> Z2SS CH
+ 3.23778047E-04 2 1000025 4 # CHL --> Z3SS CH
+ 9.08364356E-03 2 1000035 4 # CHL --> Z4SS CH
+ 6.45559132E-01 2 1000024 3 # CHL --> W1SS+ ST
+ 1.34988865E-02 2 1000037 3 # CHL --> W2SS+ ST
+# PDG Width
+DECAY 1000005 1.37134495E+01 # BT1 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.47616947E-02 2 1000022 5 # BT1 --> Z1SS BT
+ 1.90578952E-01 2 1000023 5 # BT1 --> Z2SS BT
+ 3.93444533E-03 2 1000025 5 # BT1 --> Z3SS BT
+ 6.83019077E-03 2 1000035 5 # BT1 --> Z4SS BT
+ 3.36093158E-01 2 -1000024 6 # BT1 --> W1SS- TP
+ 2.82277346E-01 2 -1000037 6 # BT1 --> W2SS- TP
+ 1.65524170E-01 2 -24 1000006 # BT1 --> W- TP1
+# PDG Width
+DECAY 1000006 4.75481319E+00 # TP1 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.67034739E-01 2 1000022 6 # TP1 --> Z1SS TP
+ 1.32801414E-01 2 1000023 6 # TP1 --> Z2SS TP
+ 4.34729606E-02 2 1000025 6 # TP1 --> Z3SS TP
+ 3.37525249E-01 2 1000024 5 # TP1 --> W1SS+ BT
+ 2.19165653E-01 2 1000037 5 # TP1 --> W2SS+ BT
+# PDG Width
+DECAY 2000002 2.11876249E+00 # UPR decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.96235609E-01 2 1000022 2 # UPR --> Z1SS UP
+ 1.10316265E-03 2 1000023 2 # UPR --> Z2SS UP
+ 4.60291893E-04 2 1000025 2 # UPR --> Z3SS UP
+ 2.20094039E-03 2 1000035 2 # UPR --> Z4SS UP
+# PDG Width
+DECAY 2000001 5.27351677E-01 # DNR decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.96261895E-01 2 1000022 1 # DNR --> Z1SS DN
+ 1.10111281E-03 2 1000023 1 # DNR --> Z2SS DN
+ 4.56379494E-04 2 1000025 1 # DNR --> Z3SS DN
+ 2.18062149E-03 2 1000035 1 # DNR --> Z4SS DN
+# PDG Width
+DECAY 2000003 5.27352154E-01 # STR decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.96261895E-01 2 1000022 3 # STR --> Z1SS ST
+ 1.10111281E-03 2 1000023 3 # STR --> Z2SS ST
+ 4.56379523E-04 2 1000025 3 # STR --> Z3SS ST
+ 2.18062173E-03 2 1000035 3 # STR --> Z4SS ST
+# PDG Width
+DECAY 2000004 2.11875629E+00 # CHR decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.96235609E-01 2 1000022 4 # CHR --> Z1SS CH
+ 1.10316218E-03 2 1000023 4 # CHR --> Z2SS CH
+ 4.60290554E-04 2 1000025 4 # CHR --> Z3SS CH
+ 2.20093317E-03 2 1000035 4 # CHR --> Z4SS CH
+# PDG Width
+DECAY 2000005 2.02696466E+00 # BT2 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.32486323E-01 2 1000022 5 # BT2 --> Z1SS BT
+ 6.42916933E-02 2 1000023 5 # BT2 --> Z2SS BT
+ 3.94492708E-02 2 1000025 5 # BT2 --> Z3SS BT
+ 5.52978516E-02 2 1000035 5 # BT2 --> Z4SS BT
+ 1.15164913E-01 2 -1000024 6 # BT2 --> W1SS- TP
+ 3.28609914E-01 2 -1000037 6 # BT2 --> W2SS- TP
+ 1.64700001E-01 2 -24 1000006 # BT2 --> W- TP1
+# PDG Width
+DECAY 2000006 1.61679039E+01 # TP2 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.44648740E-01 2 1000024 5 # TP2 --> W1SS+ BT
+ 1.02776937E-01 2 1000037 5 # TP2 --> W2SS+ BT
+ 1.25763550E-01 2 23 1000006 # TP2 --> Z0 TP1
+ 7.62688369E-02 2 25 1000006 # TP2 --> HL0 TP1
+ 1.92975532E-02 2 1000022 6 # TP2 --> Z1SS TP
+ 1.11606777E-01 2 1000023 6 # TP2 --> Z2SS TP
+ 1.08069107E-01 2 1000025 6 # TP2 --> Z3SS TP
+ 2.11568445E-01 2 1000035 6 # TP2 --> Z4SS TP
+# PDG Width
+DECAY 1000011 1.99630737E-01 # EL- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.99999940E-01 2 1000022 11 # EL- --> Z1SS E-
+# PDG Width
+DECAY 1000013 1.99630693E-01 # MUL- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.99999940E-01 2 1000022 13 # MUL- --> Z1SS MU-
+# PDG Width
+DECAY 1000015 2.48380993E-02 # TAU1- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.00000000E+00 2 1000022 15 # TAU1- --> Z1SS TAU-
+# PDG Width
+DECAY 1000012 2.04863504E-01 # NUEL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.99984741E-01 2 1000022 12 # NUEL --> Z1SS NUE
+ 1.53049623E-05 3 -1000015 11 16 # NUEL --> TAU1+ E- NUT
+# PDG Width
+DECAY 1000014 2.04863504E-01 # NUML decays
+# BR NDA ID1 ID2 ID3 ID4
+ 9.99984741E-01 2 1000022 14 # NUML --> Z1SS NUM
+ 1.53050914E-05 3 -1000015 13 16 # NUML --> TAU1+ MU- NUT
+# PDG Width
+DECAY 1000016 2.45554298E-01 # NUTL decays
+# BR NDA ID1 ID2 ID3 ID4
+ 8.05662930E-01 2 1000022 16 # NUTL --> Z1SS NUT
+ 1.94337070E-01 2 24 1000015 # NUTL --> W+ TAU1-
+# PDG Width
+DECAY 2000011 3.68820541E-02 # ER- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.00000000E+00 2 1000022 11 # ER- --> Z1SS E-
+# PDG Width
+DECAY 2000013 3.68817002E-02 # MUR- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 1.00000000E+00 2 1000022 13 # MUR- --> Z1SS MU-
+# PDG Width
+DECAY 2000015 2.76352704E-01 # TAU2- decays
+# BR NDA ID1 ID2 ID3 ID4
+ 7.51779079E-01 2 1000022 15 # TAU2- --> Z1SS TAU-
+ 1.08617224E-01 2 23 1000015 # TAU2- --> Z0 TAU1-
+ 1.39603689E-01 2 25 1000015 # TAU2- --> HL0 TAU1-
+# PDG Width
+DECAY 1000022 5.54989811E-14 # Z1SS decays
+# BR NDA ID1 ID2 ID3 ID4
+ 5.00000000E-01 3 2 3 5 # Z1SS --> UP ST BT
+ 5.00000000E-01 3 -2 -3 -5 # Z1SS --> UB SB BB
+# PDG Width
+DECAY 1000023 2.51008749E-01 # Z2SS decays
+# BR NDA ID1 ID2 ID3 ID4
+ 4.87829931E-03 2 1000022 23 # Z2SS --> Z1SS Z0
+ 6.44727945E-02 2 1000022 25 # Z2SS --> Z1SS HL0
+ 4.31903675E-02 2 1000011 -11 # Z2SS --> EL- E+
+ 4.31903675E-02 2 -1000011 11 # Z2SS --> EL+ E-
+ 4.31898609E-02 2 1000013 -13 # Z2SS --> MUL- MU+
+ 4.31898609E-02 2 -1000013 13 # Z2SS --> MUL+ MU-
+ 2.32248823E-03 2 2000011 -11 # Z2SS --> ER- E+
+ 2.32248823E-03 2 -2000011 11 # Z2SS --> ER+ E-
+ 2.32248707E-03 2 2000013 -13 # Z2SS --> MUR- MU+
+ 2.32248707E-03 2 -2000013 13 # Z2SS --> MUR+ MU-
+ 4.98090498E-02 2 1000015 -15 # Z2SS --> TAU1- TAU+
+ 4.98090498E-02 2 -1000015 15 # Z2SS --> TAU1+ TAU-
+ 4.61306013E-02 2 2000015 -15 # Z2SS --> TAU2- TAU+
+ 4.61306013E-02 2 -2000015 15 # Z2SS --> TAU2+ TAU-
+ 8.62868205E-02 2 1000012 -12 # Z2SS --> NUEL ANUE
+ 8.62868205E-02 2 -1000012 12 # Z2SS --> ANUEL NUE
+ 8.62868205E-02 2 1000014 -14 # Z2SS --> NUML ANUM
+ 8.62868205E-02 2 -1000014 14 # Z2SS --> ANUML NUM
+ 1.05785951E-01 2 1000016 -16 # Z2SS --> NUTL ANUT
+ 1.05785951E-01 2 -1000016 16 # Z2SS --> ANUTL NUT
+# PDG Width
+DECAY 1000025 3.43108368E+00 # Z3SS decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.89258450E-01 2 1000024 -24 # Z3SS --> W1SS+ W-
+ 2.89258450E-01 2 -1000024 24 # Z3SS --> W1SS- W+
+ 1.05065115E-01 2 1000022 23 # Z3SS --> Z1SS Z0
+ 2.58670330E-01 2 1000023 23 # Z3SS --> Z2SS Z0
+ 1.77925695E-02 2 1000022 25 # Z3SS --> Z1SS HL0
+ 8.97036120E-03 2 1000023 25 # Z3SS --> Z2SS HL0
+ 1.47978906E-04 2 1000011 -11 # Z3SS --> EL- E+
+ 1.47978906E-04 2 -1000011 11 # Z3SS --> EL+ E-
+ 1.47978863E-04 2 1000013 -13 # Z3SS --> MUL- MU+
+ 1.47978863E-04 2 -1000013 13 # Z3SS --> MUL+ MU-
+ 3.84239160E-04 2 2000011 -11 # Z3SS --> ER- E+
+ 3.84239160E-04 2 -2000011 11 # Z3SS --> ER+ E-
+ 3.84239102E-04 2 2000013 -13 # Z3SS --> MUR- MU+
+ 3.84239102E-04 2 -2000013 13 # Z3SS --> MUR+ MU-
+ 7.02257408E-03 2 1000015 -15 # Z3SS --> TAU1- TAU+
+ 7.02257408E-03 2 -1000015 15 # Z3SS --> TAU1+ TAU-
+ 5.03372960E-03 2 2000015 -15 # Z3SS --> TAU2- TAU+
+ 5.03372960E-03 2 -2000015 15 # Z3SS --> TAU2+ TAU-
+ 7.85201555E-04 2 1000012 -12 # Z3SS --> NUEL ANUE
+ 7.85201555E-04 2 -1000012 12 # Z3SS --> ANUEL NUE
+ 7.85201555E-04 2 1000014 -14 # Z3SS --> NUML ANUM
+ 7.85201555E-04 2 -1000014 14 # Z3SS --> ANUML NUM
+ 8.01224262E-04 2 1000016 -16 # Z3SS --> NUTL ANUT
+ 8.01224262E-04 2 -1000016 16 # Z3SS --> ANUTL NUT
+# PDG Width
+DECAY 1000035 4.13572025E+00 # Z4SS decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.67477065E-01 2 1000024 -24 # Z4SS --> W1SS+ W-
+ 2.67477065E-01 2 -1000024 24 # Z4SS --> W1SS- W+
+ 1.64306201E-02 2 1000022 23 # Z4SS --> Z1SS Z0
+ 1.10877547E-02 2 1000023 23 # Z4SS --> Z2SS Z0
+ 8.31157640E-02 2 1000022 25 # Z4SS --> Z1SS HL0
+ 2.15254530E-01 2 1000023 25 # Z4SS --> Z2SS HL0
+ 5.99500211E-03 2 1000011 -11 # Z4SS --> EL- E+
+ 5.99500211E-03 2 -1000011 11 # Z4SS --> EL+ E-
+ 5.99500071E-03 2 1000013 -13 # Z4SS --> MUL- MU+
+ 5.99500071E-03 2 -1000013 13 # Z4SS --> MUL+ MU-
+ 1.67951779E-03 2 2000011 -11 # Z4SS --> ER- E+
+ 1.67951779E-03 2 -2000011 11 # Z4SS --> ER+ E-
+ 1.67951745E-03 2 2000013 -13 # Z4SS --> MUR- MU+
+ 1.67951745E-03 2 -2000013 13 # Z4SS --> MUR+ MU-
+ 4.77972487E-03 2 1000015 -15 # Z4SS --> TAU1- TAU+
+ 4.77972487E-03 2 -1000015 15 # Z4SS --> TAU1+ TAU-
+ 1.12385545E-02 2 2000015 -15 # Z4SS --> TAU2- TAU+
+ 1.12385545E-02 2 -2000015 15 # Z4SS --> TAU2+ TAU-
+ 1.26567027E-02 2 1000012 -12 # Z4SS --> NUEL ANUE
+ 1.26567027E-02 2 -1000012 12 # Z4SS --> ANUEL NUE
+ 1.26567027E-02 2 1000014 -14 # Z4SS --> NUML ANUM
+ 1.26567027E-02 2 -1000014 14 # Z4SS --> ANUML NUM
+ 1.28978929E-02 2 1000016 -16 # Z4SS --> NUTL ANUT
+ 1.28978929E-02 2 -1000016 16 # Z4SS --> ANUTL NUT
+# PDG Width
+DECAY 1000024 2.59394675E-01 # W1SS+ decays
+# BR NDA ID1 ID2 ID3 ID4
+ 6.12202771E-02 2 1000022 24 # W1SS+ --> Z1SS W+
+ 1.84675083E-01 2 1000012 -11 # W1SS+ --> NUEL E+
+ 1.84674352E-01 2 1000014 -13 # W1SS+ --> NUML MU+
+ 2.26818800E-01 2 1000016 -15 # W1SS+ --> NUTL TAU+
+ 8.26541111E-02 2 -1000011 12 # W1SS+ --> EL+ NUE
+ 8.26539099E-02 2 -1000013 14 # W1SS+ --> MUL+ NUM
+ 8.99942294E-02 2 -1000015 16 # W1SS+ --> TAU1+ NUT
+ 8.73092562E-02 2 -2000015 16 # W1SS+ --> TAU2+ NUT
+# PDG Width
+DECAY 1000037 4.02688837E+00 # W2SS+ decays
+# BR NDA ID1 ID2 ID3 ID4
+ 8.86483863E-02 2 1000022 24 # W2SS+ --> Z1SS W+
+ 2.81457037E-01 2 1000023 24 # W2SS+ --> Z2SS W+
+ 1.24828229E-02 2 1000012 -11 # W2SS+ --> NUEL E+
+ 1.24828238E-02 2 1000014 -13 # W2SS+ --> NUML MU+
+ 2.04729903E-02 2 1000016 -15 # W2SS+ --> NUTL TAU+
+ 2.53841411E-02 2 -1000011 12 # W2SS+ --> EL+ NUE
+ 2.53841374E-02 2 -1000013 14 # W2SS+ --> MUL+ NUM
+ 6.54205261E-03 2 -1000015 16 # W2SS+ --> TAU1+ NUT
+ 2.89599225E-02 2 -2000015 16 # W2SS+ --> TAU2+ NUT
+ 2.61435837E-01 2 1000024 23 # W2SS+ --> W1SS+ Z0
+ 2.36749917E-01 2 1000024 25 # W2SS+ --> W1SS+ HL0
+# PDG Width
+DECAY 25 4.26856382E-03 # HL0 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 2.06499302E-04 2 13 -13 # HL0 --> MU- MU+
+ 5.90594597E-02 2 15 -15 # HL0 --> TAU- TAU+
+ 2.48042517E-03 2 3 -3 # HL0 --> ST SB
+ 8.13605964E-01 2 5 -5 # HL0 --> BT BB
+ 3.44697051E-02 2 4 -4 # HL0 --> CH CB
+ 1.70449133E-03 2 22 22 # HL0 --> GM GM
+ 3.69445458E-02 2 21 21 # HL0 --> GL GL
+ 2.67047482E-03 3 24 11 -12 # HL0 --> W+ E- ANUE
+ 2.67047482E-03 3 24 13 -14 # HL0 --> W+ MU- ANUM
+ 2.67047482E-03 3 24 15 -16 # HL0 --> W+ TAU- ANUT
+ 8.01142491E-03 3 24 -2 1 # HL0 --> W+ UB DN
+ 8.01142491E-03 3 24 -4 3 # HL0 --> W+ CB ST
+ 2.67047482E-03 3 -24 -11 12 # HL0 --> W- E+ NUE
+ 2.67047482E-03 3 -24 -13 14 # HL0 --> W- MU+ NUM
+ 2.67047482E-03 3 -24 -15 16 # HL0 --> W- TAU+ NUT
+ 8.01142491E-03 3 -24 2 -1 # HL0 --> W- UP DB
+ 8.01142491E-03 3 -24 4 -3 # HL0 --> W- CH SB
+ 2.36650856E-04 3 23 12 -12 # HL0 --> Z0 NUE ANUE
+ 2.36650856E-04 3 23 14 -14 # HL0 --> Z0 NUM ANUM
+ 2.36650856E-04 3 23 16 -16 # HL0 --> Z0 NUT ANUT
+ 1.19103999E-04 3 23 11 -11 # HL0 --> Z0 E- E+
+ 1.19103999E-04 3 23 13 -13 # HL0 --> Z0 MU- MU+
+ 1.19103999E-04 3 23 15 -15 # HL0 --> Z0 TAU- TAU+
+ 4.08040214E-04 3 23 2 -2 # HL0 --> Z0 UP UB
+ 4.08040214E-04 3 23 4 -4 # HL0 --> Z0 CH CB
+ 5.25656273E-04 3 23 1 -1 # HL0 --> Z0 DN DB
+ 5.25656273E-04 3 23 3 -3 # HL0 --> Z0 ST SB
+ 5.25656273E-04 3 23 5 -5 # HL0 --> Z0 BT BB
+# PDG Width
+DECAY 35 1.42017710E+00 # HH0 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 3.61791084E-04 2 13 -13 # HH0 --> MU- MU+
+ 1.03618696E-01 2 15 -15 # HH0 --> TAU- TAU+
+ 1.05274339E-05 2 1 -1 # HH0 --> DN DB
+ 4.25361609E-03 2 3 -3 # HH0 --> ST SB
+ 6.59700513E-01 2 5 -5 # HH0 --> BT BB
+ 2.04839349E-01 2 6 -6 # HH0 --> TP TB
+ 1.93596643E-04 2 21 21 # HH0 --> GL GL
+ 9.95672075E-04 2 24 -24 # HH0 --> W+ W-
+ 5.00190770E-04 2 23 23 # HH0 --> Z0 Z0
+ 4.47695563E-03 2 1000022 1000022 # HH0 --> Z1SS Z1SS
+ 1.17691308E-02 2 1000022 1000023 # HH0 --> Z1SS Z2SS
+ 1.72622059E-03 2 25 25 # HH0 --> HL0 HL0
+ 1.53723013E-04 2 2000011 -2000011 # HH0 --> ER- ER+
+ 1.53636938E-04 2 2000013 -2000013 # HH0 --> MUR- MUR+
+ 8.74147343E-04 2 1000015 -1000015 # HH0 --> TAU1- TAU1+
+ 2.89326371E-03 2 1000015 -2000015 # HH0 --> TAU1- TAU2+
+ 2.89326371E-03 2 2000015 -1000015 # HH0 --> TAU2- TAU1+
+ 1.80288946E-04 2 1000012 -1000012 # HH0 --> NUEL ANUEL
+ 1.80288946E-04 2 1000014 -1000014 # HH0 --> NUML ANUML
+ 2.25102340E-04 2 1000016 -1000016 # HH0 --> NUTL ANUTL
+# PDG Width
+DECAY 36 1.50675058E+00 # HA0 decays
+# BR NDA ID1 ID2 ID3 ID4
+ 3.38935293E-04 2 13 -13 # HA0 --> MU- MU+
+ 9.70750600E-02 2 15 -15 # HA0 --> TAU- TAU+
+ 3.98513954E-03 2 3 -3 # HA0 --> ST SB
+ 6.18119061E-01 2 5 -5 # HA0 --> BT BB
+ 2.26040706E-01 2 6 -6 # HA0 --> TP TB
+ 2.25110300E-04 2 21 21 # HA0 --> GL GL
+ 7.34108919E-03 2 1000022 1000022 # HA0 --> Z1SS Z1SS
+ 4.00663726E-02 2 1000022 1000023 # HA0 --> Z1SS Z2SS
+ 8.80061591E-04 2 25 23 # HA0 --> HL0 Z0
+ 2.96422420E-03 2 1000015 -2000015 # HA0 --> TAU1- TAU2+
+ 2.96422420E-03 2 2000015 -1000015 # HA0 --> TAU2- TAU1+
+# PDG Width
+DECAY 37 1.30719161E+00 # H+ decays
+# BR NDA ID1 ID2 ID3 ID4
+ 3.95668816E-04 2 14 -13 # H+ --> NUM MU+
+ 1.13324240E-01 2 16 -15 # H+ --> NUT TAU+
+ 1.05525833E-05 2 2 -1 # H+ --> UP DB
+ 4.26855963E-03 2 4 -3 # H+ --> CH SB
+ 8.14710736E-01 2 6 -5 # H+ --> TP BB
+ 5.81404492E-02 2 1000024 1000022 # H+ --> W1SS+ Z1SS
+ 1.05597661E-03 2 25 24 # H+ --> HL0 W+
+ 1.52381879E-04 2 -1000011 1000012 # H+ --> EL+ NUEL
+ 1.52355366E-04 2 -1000013 1000014 # H+ --> MUL+ NUML
+ 7.73605797E-03 2 -1000015 1000016 # H+ --> TAU1+ NUTL
+ 5.30152211E-05 2 -2000015 1000016 # H+ --> TAU2+ NUTL
diff --git a/src/Sextet.model b/src/Sextet.model
new file mode 100644
--- /dev/null
+++ b/src/Sextet.model
@@ -0,0 +1,198 @@
+##################################################
+# Common setup for Sextet models
+#
+# See LHC-Sextet.in for example usage
+#
+# This file does not contain anything that
+# users need to touch. User settings are in
+# LHC-Sextet.in
+###################################################x
+library HwSextetModel.so
+###################################################
+#
+# Particle Data objects for the diquarks
+#
+###################################################
+cd /Herwig/Particles
+# Scalar DQ Singlet Y=4/3
+create /ThePEG/ParticleData DQPhi_1''
+setup DQPhi_1'' 6000221 DQPhi_1'' 500.0 0.0 0.0 0.0 4 6 1 0
+create /ThePEG/ParticleData DQPhi_1''bar
+setup DQPhi_1''bar -6000221 DQPhi_1''bar 500.0 0.0 0.0 0.0 -4 -6 1 0
+makeanti DQPhi_1''bar DQPhi_1''
+# Scalar DQ Singlet Y=1/3
+create /ThePEG/ParticleData DQPhi_1
+setup DQPhi_1 6000211 DQPhi_1 500.0 0.0 0.0 0.0 1 6 1 0
+create /ThePEG/ParticleData DQPhi_1bar
+setup DQPhi_1bar -6000211 DQPhi_1bar 500.0 0.0 0.0 0.0 -1 -6 1 0
+makeanti DQPhi_1bar DQPhi_1
+# Scalar DQ Singlet Y=-2/3
+create /ThePEG/ParticleData DQPhi_1'
+setup DQPhi_1' 6000111 DQPhi_1' 500.0 0.0 0.0 0.0 -2 6 1 0
+create /ThePEG/ParticleData DQPhi_1'bar
+setup DQPhi_1'bar -6000111 DQPhi_1'bar 500.0 0.0 0.0 0.0 2 -6 1 0
+makeanti DQPhi_1'bar DQPhi_1'
+# Scalar DQ Triplet t_3=1 Y=1/3
+create /ThePEG/ParticleData DQPhi_3+
+setup DQPhi_3+ 6001221 DQPhi_3+ 500.0 0.0 0.0 0.0 4 6 1 0
+create /ThePEG/ParticleData DQPhi_3+bar
+setup DQPhi_3+bar -6001221 DQPhi_3+bar 500.0 0.0 0.0 0.0 -4 -6 1 0
+makeanti DQPhi_3+bar DQPhi_3+
+# Scalar DQ Triplet t_3=0 Y=1/3
+create /ThePEG/ParticleData DQPhi_30
+setup DQPhi_30 6001211 DQPhi_30 500.0 0.0 0.0 0.0 1 6 1 0
+create /ThePEG/ParticleData DQPhi_30bar
+setup DQPhi_30bar -6001211 DQPhi_30bar 500.0 0.0 0.0 0.0 -1 -6 1 0
+makeanti DQPhi_30bar DQPhi_30
+# Scalar DQ Triplet t_3=-1 Y=1/3
+create /ThePEG/ParticleData DQPhi_3-
+setup DQPhi_3- 6001111 DQPhi_3- 500.0 0.0 0.0 0.0 -2 6 1 0
+create /ThePEG/ParticleData DQPhi_3-bar
+setup DQPhi_3-bar -6001111 DQPhi_3-bar 500.0 0.0 0.0 0.0 2 -6 1 0
+makeanti DQPhi_3-bar DQPhi_3-
+# Vector DQ Doublet t_3=1/2 Y=-1/6
+create /ThePEG/ParticleData DQV_1+
+setup DQV_1+ 6000123 DQV_1+ 500.0 0.0 0.0 0.0 1 6 3 0
+create /ThePEG/ParticleData DQV_1+bar
+setup DQV_1+bar -6000123 DQV_1+bar 500.0 0.0 0.0 0.0 -1 -6 3 0
+makeanti DQV_1+bar DQV_1+
+# Vector DQ Doublet t_3=-1/2 Y=-1/6
+create /ThePEG/ParticleData DQV_1-
+setup DQV_1- 6000113 DQV_1- 500.0 0.0 0.0 0.0 -2 6 3 0
+create /ThePEG/ParticleData DQV_1-bar
+setup DQV_1-bar -6000113 DQV_1-bar 500.0 0.0 0.0 0.0 2 -6 3 0
+makeanti DQV_1-bar DQV_1-
+# Vector DQ Doublet t_3=1/2 Y=-5/6
+create /ThePEG/ParticleData DQV_2+
+setup DQV_2+ 6000223 DQV_2+ 500.0 0.0 0.0 0.0 4 6 3 0
+create /ThePEG/ParticleData DQV_2+bar
+setup DQV_2+bar -6000223 DQV_2+bar 500.0 0.0 0.0 0.0 -4 -6 3 0
+makeanti DQV_2+bar DQV_2+
+# Vector DQ Doublet t_3=-1/2 Y=-5/6
+create /ThePEG/ParticleData DQV_2-
+setup DQV_2- 6000213 DQV_2- 500.0 0.0 0.0 0.0 1 6 3 0
+create /ThePEG/ParticleData DQV_2-bar
+setup DQV_2-bar -6000213 DQV_2-bar 500.0 0.0 0.0 0.0 -1 -6 3 0
+makeanti DQV_2-bar DQV_2-
+###################################################
+#
+# Main directory and model object
+#
+###################################################
+mkdir /Herwig/NewPhysics/Sextet
+cd /Herwig/NewPhysics/Sextet
+create Herwig::SextetModel Model
+# SM couplings
+set Model:QCD/RunningAlphaS /Herwig/AlphaS
+set Model:EW/RunningAlphaEM /Herwig/AlphaEM
+set Model:EW/CKM /Herwig/CKM
+set Model:RunningMass /Herwig/RunningMass
+###################################################
+#
+# Vertices
+#
+###################################################
+# create Sextet model vertices
+mkdir /Herwig/Vertices/Sextet
+cd /Herwig/Vertices/Sextet
+library HwSextetModel.so
+create Herwig::SextetGSSVertex Sextet_GSSVertex
+create Herwig::SextetGGSSVertex Sextet_GGSSVertex
+create Herwig::SextetGVVVertex Sextet_GVVVertex
+create Herwig::SextetGGVVVertex Sextet_GGVVVertex
+create Herwig::SextetFFSVertex Sextet_FFSVertex
+create Herwig::SextetFFVVertex Sextet_FFVVertex
+cd /Herwig/NewPhysics/Sextet
+# SM vertices
+set Model:Vertex/FFZ /Herwig/Vertices/FFZVertex
+set Model:Vertex/FFW /Herwig/Vertices/FFWVertex
+set Model:Vertex/FFH /Herwig/Vertices/FFHVertex
+set Model:Vertex/FFG /Herwig/Vertices/FFGVertex
+set Model:Vertex/FFP /Herwig/Vertices/FFPVertex
+set Model:Vertex/GGG /Herwig/Vertices/GGGVertex
+set Model:Vertex/GGGG /Herwig/Vertices/GGGGVertex
+set Model:Vertex/WWH /Herwig/Vertices/WWHVertex
+set Model:Vertex/WWW /Herwig/Vertices/WWWVertex
+set Model:Vertex/WWWW /Herwig/Vertices/WWWWVertex
+set Model:Vertex/HGG /Herwig/Vertices/HGGVertex
+set Model:Vertex/HPP /Herwig/Vertices/HPPVertex
+# Sextet model vertices
+set Model:Vertex/SDQSDQG /Herwig/Vertices/Sextet/Sextet_GSSVertex
+set Model:Vertex/SDQSDQGG /Herwig/Vertices/Sextet/Sextet_GGSSVertex
+set Model:Vertex/VDQVDQG /Herwig/Vertices/Sextet/Sextet_GVVVertex
+set Model:Vertex/VDQVDQGG /Herwig/Vertices/Sextet/Sextet_GGVVVertex
+set Model:Vertex/FFSDQ /Herwig/Vertices/Sextet/Sextet_FFSVertex
+set Model:Vertex/FFVDQ /Herwig/Vertices/Sextet/Sextet_FFVVertex
+###################################################
+#
+# Shower stuff for coloured diquarks
+#
+###################################################
+cd /Herwig/Shower
+
+create Herwig::ZeroZeroOneSplitFn SDiquarktoSDiquarkSplitFn
+set SDiquarktoSDiquarkSplitFn:InteractionType QCD
+set SDiquarktoSDiquarkSplitFn:ColourStructure SextetSextetOctet
+
+create Herwig::OneOneOneSplitFn VDiquarktoVDiquarkSplitFn
+set VDiquarktoVDiquarkSplitFn:InteractionType QCD
+set VDiquarktoVDiquarkSplitFn:ColourStructure SextetSextetOctet
+
+cp SudakovCommon SDiquarktoSDiquarkSudakov
+set SDiquarktoSDiquarkSudakov:SplittingFunction SDiquarktoSDiquarkSplitFn
+
+cp SudakovCommon VDiquarktoVDiquarkSudakov
+set VDiquarktoVDiquarkSudakov:SplittingFunction VDiquarktoVDiquarkSplitFn
+
+do SplittingGenerator:AddFinalSplitting DQPhi_1''->DQPhi_1'',g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQPhi_1->DQPhi_1,g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQPhi_1'->DQPhi_1',g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQPhi_3+->DQPhi_3+,g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQPhi_30->DQPhi_30,g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQPhi_3-->DQPhi_3-,g; SDiquarktoSDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQV_1+->DQV_1+,g; VDiquarktoVDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQV_1-->DQV_1-,g; VDiquarktoVDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQV_2+->DQV_2+,g; VDiquarktoVDiquarkSudakov
+do SplittingGenerator:AddFinalSplitting DQV_2-->DQV_2-,g; VDiquarktoVDiquarkSudakov
+
+###################################################
+#
+# Set up spin correlation Decayers
+#
+###################################################
+cd /Herwig/NewPhysics
+
+set TwoBodyDC:CreateDecayModes Yes
+set ThreeBodyDC:CreateDecayModes No
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_1''
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_1
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_1'
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_3+
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_30
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQPhi_3-
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQV_1+
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQV_1-
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQV_2+
+insert NewModel:DecayParticles 0 /Herwig/Particles/DQV_2-
+###################################################
+#
+# Exclude some things from the HP
+#
+###################################################
+
+insert HPConstructor:ExcludedExternal 0 /Herwig/Particles/g
+
+###################################################
+# Set up the model framework
+###################################################
+
+set Sextet/Model:ModelGenerator NewModel
+
+###################################################
+#
+# Choose Sextet over SM
+#
+###################################################
+cd /Herwig/Generators
+set LEPGenerator:StandardModelParameters /Herwig/NewPhysics/Sextet/Model
+set LHCGenerator:StandardModelParameters /Herwig/NewPhysics/Sextet/Model
diff --git a/src/TVT.in b/src/TVT.in
--- a/src/TVT.in
+++ b/src/TVT.in
@@ -1,142 +1,212 @@
##################################################
# Example generator based on Tevatron parameters
# usage: Herwig++ read TVT.in
#
# Since most parameters are identical to LHC,
# we use the default LHCGenerator and adapt only
# for the differences
##################################################
##################################################
# Technical parameters for this run
##################################################
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 10000000
set LHCGenerator:RandomNumberGenerator:Seed 31122001
set LHCGenerator:PrintEvent 10
set LHCGenerator:MaxErrors 100000
##################################################
# Tevatron physics parameters (override defaults)
##################################################
-set LHCGenerator:EventHandler:LuminosityFunction:Energy 2000.0
set LHCGenerator:EventHandler:BeamB /Herwig/Particles/pbar-
##################################################
+# Energy-dependent MPI parameters
+##################################################
+
+################################################################################
+# NOTE: Set the correct parameters for the collision energy of your choice
+# here.
+################################################################################
+
+#######################
+## sqrt(s) = 900 GeV ##
+#######################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
+
+########################
+## sqrt(s) = 1800 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 1800.0 - 1960.0
+set LHCGenerator:EventHandler:LuminosityFunction:Energy 1960.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 2.55
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.1
+
+##################################################
# Matrix Elements for hadron-hadron collisions
# (by default only gamma/Z switched on)
##################################################
cd /Herwig/MatrixElements
#
# Electroweak boson W/Z processes
#
# Drell-Yan Z/gamma
insert SimpleQCD:MatrixElements[0] MEqq2gZ2ff
#
# Drell-Yan W
# insert SimpleQCD:MatrixElements[0] MEqq2W2ff
#
# W+jet
# insert SimpleQCD:MatrixElements[0] MEWJet
#
# Z+jet
# insert SimpleQCD:MatrixElements[0] MEZJet
#
# WW/WZ/ZZ
# insert SimpleQCD:MatrixElements[0] MEPP2VV
#
# Wgamma/Zgamma
# insert SimpleQCD:MatrixElements[0] MEPP2VGamma
#
# QCD and gamma processes
#
# QCD 2-2 scattering
# insert SimpleQCD:MatrixElements[0] MEQCD2to2
#
# top-antitop production
# insert SimpleQCD:MatrixElements[0] MEHeavyQuark
#
# gamma+jet
# insert SimpleQCD:MatrixElements[0] MEGammaJet
#
# gamma-gamma
# insert SimpleQCD:MatrixElements[0] MEGammaGamma
#
# Higgs Processes
#
#
# gg/qqbar -> Higgs (recommend including q qbar->Hg as not in ME correction)
# insert SimpleQCD:MatrixElements[0] MEHiggs
# insert SimpleQCD:MatrixElements[0] MEHiggsJet
# set MEHiggsJet:Process qqbar
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# higgs+jet
# insert SimpleQCD:MatrixElements[0] MEHiggsJet
#
# higgs + W (N.B. if considering all W decay modes useful to set )
# (jet pT cut to zero so no cut on W decay products )
# insert SimpleQCD:MatrixElements[0] MEPP2WH
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# higgs + Z (N.B. if considering all Z decay modes useful to set )
# (jet pT cut to zero so no cut on Z decay products )
# insert SimpleQCD:MatrixElements[0] MEPP2ZH
# set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV
#
# VBF Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2HiggsVBF
#
# t tbar Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2ttbarH
#
# b bbar Higgs
# insert SimpleQCD:MatrixElements[0] MEPP2bbbarH
+##################################################
+# Energy-dependent MPI parameters
+##################################################
+
+################################################################################
+# NOTE: Set the correct parameters for the collision energy of your choice
+# here. This line will cause an error, which is intentional. Remove this line
+# and uncomment the section corresponding to the chosen center-of-mass energy.
+################################################################################
+
+#######################
+## sqrt(s) = 900 GeV ##
+#######################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 900.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 1.86
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 3.72
+
+########################
+## sqrt(s) = 1800 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 1800.0 - 2000.0
+set /Herwig/UnderlyingEvent/KtCut:MinKT 2.55
+set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.1
+
+########################
+## sqrt(s) = 2760 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 2760.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.62
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.24
+
+########################
+## sqrt(s) = 7000 GeV ##
+########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 7000.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.06
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 6.12
+#set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.37*GeV
+## NOTE: This tune of the intrinsic pT is an extrapolation to 7 TeV.
+
+#########################
+## sqrt(s) = 14000 GeV ##
+#########################
+#set LHCGenerator:EventHandler:LuminosityFunction:Energy 14000.0
+#set /Herwig/UnderlyingEvent/KtCut:MinKT 3.53
+#set /Herwig/UnderlyingEvent/UECuts:MHatMin 7.06
+
cd /Herwig/Generators
##################################################
# Useful analysis handlers for hadron-hadron physics
##################################################
# analysis of W/Z events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/DrellYan
# analysis of top-antitop events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/TTbar
# analysis of gamma+jet events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaJet
# analysis of gamma-gamma events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaGamma
# analysis of higgs-jet events
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HiggsJet
##################################################
# Useful analysis handlers for HepMC related output
##################################################
# Schematic overview of an event (requires --with-hepmc to be set at configure time
# and the graphviz program 'dot' to produce a plot)
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot
# A HepMC dump file (requires --with-hepmc to be set at configure time)
# insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
# set /Herwig/Analysis/HepMCFile:PrintEvent 100
# set /Herwig/Analysis/HepMCFile:Format GenEvent
# set /Herwig/Analysis/HepMCFile:Units GeV_mm
##################################################
# Save run for later usage with 'Herwig++ run'
##################################################
saverun TVT LHCGenerator
##################################################
# uncomment this section for an example batch run
# of two repeats with different parameters
#
# Note that a separate call of 'Herwig run'
# is not required
##################################################
# set LHCGenerator:NumberOfEvents 10
-# run TVT-2000 LHCGenerator
+# run TVT-1960 LHCGenerator
#
# set LHCGenerator:EventHandler:LuminosityFunction:Energy 1800.0
# run TVT-1800 LHCGenerator
diff --git a/src/defaults/Hadronization.in b/src/defaults/Hadronization.in
--- a/src/defaults/Hadronization.in
+++ b/src/defaults/Hadronization.in
@@ -1,96 +1,101 @@
############################################################
# Setup of default hadronization
#
# There are no user servicable parts inside.
#
# Anything that follows below should only be touched if you
# know what you're doing.
#############################################################
cd /Herwig/Particles
create ThePEG::ParticleData Cluster
setup Cluster 81 Cluster 0.00990 0.0 0.0 0.0 0 0 0 0
create ThePEG::ParticleData Remnant
setup Remnant 82 Remnant 0.00990 0.0 0.0 0.0 0 0 0 0
mkdir /Herwig/Hadronization
cd /Herwig/Hadronization
create Herwig::ClusterHadronizationHandler ClusterHadHandler
create Herwig::PartonSplitter PartonSplitter
create Herwig::ClusterFinder ClusterFinder
create Herwig::ColourReconnector ColourReconnector
create Herwig::ClusterFissioner ClusterFissioner
create Herwig::LightClusterDecayer LightClusterDecayer
create Herwig::ClusterDecayer ClusterDecayer
create Herwig::HwppSelector HadronSelector
newdef ClusterHadHandler:PartonSplitter PartonSplitter
newdef ClusterHadHandler:ClusterFinder ClusterFinder
newdef ClusterHadHandler:ColourReconnector ColourReconnector
newdef ClusterHadHandler:ClusterFissioner ClusterFissioner
newdef ClusterHadHandler:LightClusterDecayer LightClusterDecayer
newdef ClusterHadHandler:ClusterDecayer ClusterDecayer
newdef ClusterHadHandler:MinVirtuality2 0.1*GeV2
newdef ClusterHadHandler:MaxDisplacement 1.0e-10*millimeter
newdef ClusterHadHandler:UnderlyingEventHandler NULL
##################################################
# The UA5 soft underlying event model
# (disabled by default)
##################################################
create Herwig::UA5Handler UA5 HwUA5.so
newdef UA5:ClusterFissioner ClusterFissioner
newdef UA5:ClusterDecayer ClusterDecayer
#set ClusterHadHandler:UnderlyingEventHandler UA5
##################################################
newdef ClusterFissioner:HadronSelector HadronSelector
newdef LightClusterDecayer:HadronSelector HadronSelector
newdef ClusterDecayer:HadronSelector HadronSelector
newdef ColourReconnector:ColourReconnection Yes
-newdef ColourReconnector:ReconnectionProbability 0.55
+newdef ColourReconnector:ReconnectionProbability 0.54
+newdef ColourReconnector:Algorithm Plain
+newdef ColourReconnector:InitialTemperature 0.01
+newdef ColourReconnector:AnnealingFactor 0.21
+newdef ColourReconnector:AnnealingSteps 10
+newdef ColourReconnector:TriesPerStepFactor 0.66
# Clustering parameters for light quarks
newdef ClusterFissioner:ClMaxLight 3.25*GeV
newdef ClusterFissioner:ClPowLight 1.28
newdef ClusterFissioner:PSplitLight 1.14
newdef ClusterDecayer:ClDirLight 1
newdef ClusterDecayer:ClSmrLight 0.78
# Clustering parameters for b-quarks
newdef ClusterFissioner:ClMaxBottom 3.2*GeV
newdef ClusterFissioner:ClPowBottom 1.24
newdef ClusterFissioner:PSplitBottom 0.75
newdef ClusterDecayer:ClDirBottom 1
newdef ClusterDecayer:ClSmrBottom 0.00
newdef LightClusterDecayer:SingleHadronLimitBottom 0.12
# Clustering parameters for c-quarks
newdef ClusterFissioner:ClMaxCharm 2.95*GeV
newdef ClusterFissioner:ClPowCharm 1.52
newdef ClusterFissioner:PSplitCharm 1.11
newdef ClusterDecayer:ClDirCharm 1
newdef ClusterDecayer:ClSmrCharm 0.26
newdef LightClusterDecayer:SingleHadronLimitCharm 0.0
# Clustering parameters for exotic quarks
# (e.g. hadronizing Susy particles)
newdef ClusterFissioner:ClMaxExotic 2.7*GeV
newdef ClusterFissioner:ClPowExotic 1.46
newdef ClusterFissioner:PSplitExotic 1.00
newdef ClusterDecayer:ClDirExotic 1
newdef ClusterDecayer:ClSmrExotic 0.78
newdef LightClusterDecayer:SingleHadronLimitExotic 0.1
#
newdef HadronSelector:PwtDquark 1.0
newdef HadronSelector:PwtUquark 1.0
newdef HadronSelector:PwtSquark 0.68
newdef HadronSelector:PwtCquark 1.0
newdef HadronSelector:PwtBquark 1.0
newdef HadronSelector:PwtDIquark 0.49
newdef HadronSelector:SngWt 0.74
newdef HadronSelector:DecWt 0.62
newdef HadronSelector:Mode 1
diff --git a/src/defaults/Model.in b/src/defaults/Model.in
--- a/src/defaults/Model.in
+++ b/src/defaults/Model.in
@@ -1,36 +1,36 @@
################################################
# Set up the physics model.
#
# The Standard Model is used by default.
################################################
cd /Herwig
# Main SM object
create Herwig::StandardModel Model
## Couplings
# the strong coupling
-create ThePEG::O1AlphaS AlphaS O1AlphaS.so
+create Herwig::O2AlphaS AlphaS O2AlphaS.so
newdef Model:QCD/RunningAlphaS AlphaS
# the electromagetic coupling
create ThePEG::SimpleAlphaEM AlphaEM SimpleAlphaEM.so
newdef Model:EW/RunningAlphaEM AlphaEM
# the CKM matrix
create Herwig::StandardCKM CKM
newdef Model:EW/CKM CKM
# the running mass
create Herwig::RunningMass RunningMass
newdef RunningMass:MaxFlav 6
newdef RunningMass:QCDOrder 2
newdef Model:RunningMass RunningMass
#####################################
# Set up the standard model vertices
#####################################
mkdir /Herwig/Vertices
cd /Herwig/Vertices
read StandardModelVertices.in
diff --git a/src/defaults/Partons.in b/src/defaults/Partons.in
--- a/src/defaults/Partons.in
+++ b/src/defaults/Partons.in
@@ -1,28 +1,28 @@
mkdir /Herwig/Partons
cd /Herwig/Partons
create ThePEG::NoRemnants NoRemnants
create ThePEG::NoPDF NoPDF
newdef NoPDF:RemnantHandler NoRemnants
create ThePEG::UnResolvedRemnant LeptonRemnants UnResolvedRemnant.so
create Herwig::HwRemDecayer RemnantDecayer HwShower.so
newdef RemnantDecayer:PomeronStructure Gluon
-newdef RemnantDecayer:colourDisrupt 0.15
+newdef RemnantDecayer:colourDisrupt 0.80
create ThePEG::SoftRemnantHandler HadronRemnants
newdef HadronRemnants:RemnantDecayer RemnantDecayer
read PDF.in
# Make particle extractors
create ThePEG::PartonExtractor EEExtractor
newdef EEExtractor:NoPDF NoPDF
cp EEExtractor QCDExtractor
newdef QCDExtractor:FlatSHatY 1
cp EEExtractor DISExtractor
newdef DISExtractor:FlatSHatY 1
diff --git a/src/defaults/UnderlyingEvent.in b/src/defaults/UnderlyingEvent.in
--- a/src/defaults/UnderlyingEvent.in
+++ b/src/defaults/UnderlyingEvent.in
@@ -1,59 +1,59 @@
################################################
# Set up the handler for the underlying event.
################################################
mkdir /Herwig/UnderlyingEvent
cd /Herwig/UnderlyingEvent
######## cuts #################################################
library SimpleKTCut.so
# cut on pt. Without a specific matcher object, it works on all
# particles
create ThePEG::SimpleKTCut KtCut
-newdef KtCut:MinKT 4.02
+newdef KtCut:MinKT 3.06
# create the cuts object for the Underlying Event
create ThePEG::Cuts UECuts
# This should always be 2*MinKT!!
-newdef UECuts:MHatMin 8.04
+newdef UECuts:MHatMin 6.12
insert UECuts:OneCuts 0 KtCut
######## subprocess ###########################################
create ThePEG::SubProcessHandler FastQCD
create Herwig::MEQCD2to2Fast MEQCD2to2Fast HwMEHadronFast.so
insert FastQCD:MatrixElements 0 MEQCD2to2Fast
cp /Herwig/Partons/QCDExtractor /Herwig/Partons/MPIExtractor
newdef FastQCD:PartonExtractor /Herwig/Partons/MPIExtractor
######## MPI Handler ##########################################
library HwMPI.so
create Herwig::MPIHandler MPIHandler
# set the subprocesses and corresponding cuts
insert MPIHandler:SubProcessHandlers 0 FastQCD
insert MPIHandler:Cuts 0 UECuts
# The inverse hadron radius
-newdef MPIHandler:InvRadius 1.1
+newdef MPIHandler:InvRadius 1.11
# Set the details of the soft model
# Flag to decide whether additional soft interactions (i.e. pt < ptmin)
# should be simulated at all
newdef MPIHandler:softInt Yes
# Flag to decide whether to use the 2 component model. In this model,
# the hadron radius (or better: mean parton-parton separation) can be
# different for hard and soft scatters. The radius for the soft scatters
# is computed during the run startup so that the elastic t-slope, B_el,
# coincides with current measurements (for CMenergy < 1.8 TeV) or
# Donnachie-Landshoff pomeron fit (CMenergy > 1.8 TeV). If this model is
# disabled one has to take care that this observable is correctly
# described by adjusting InvRadius properly.
newdef MPIHandler:twoComp Yes
-newdef MPIHandler:DLmode 3
+newdef MPIHandler:DLmode 2

File Metadata

Mime Type
text/x-diff
Expires
Wed, May 14, 10:04 AM (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
07/a9/5b5be687c15b584534643bd46c24
Default Alt Text
(2 MB)

Event Timeline