diff --git a/AUTHORS b/AUTHORS --- a/AUTHORS +++ b/AUTHORS @@ -1,56 +1,56 @@ ================================================================================ Herwig 7.1.4 ================================================================================ Please contact for any queries. -------------------------------------------------------------------------------- Herwig is actively developed by: -------------------------------------------------------------------------------- Johannes Bellm Stefan Gieseke -David Grellscheid Patrick Kirchgaeßer Graeme Nail Andreas Papaefstathiou Simon Plätzer -Radek Podskubka -Michael Rauch Christian Reuschle Peter Richardson Mike Seymour Andrzej Siödmok Stephen Webster -------------------------------------------------------------------------------- Former authors are: -------------------------------------------------------------------------------- Ken Arnold Manuel Bähr Luca d'Errico Martyn Gigg +David Grellscheid Nadine Fischer Keith Hamilton Marco A. Harrendorf Seyi Latunde-Dada Frashër Loshaj +Radek Podskubka Daniel Rauch +Michael Rauch Alberto Ribon Christian Röhr Pavel Růžička Peter Schichtel Alex Schofield Thomas Schuh Alexander Sherstnev Philip Stephens Martin Stoll Louise Suter Jon Tully Bryan Webber Alix Wilcock David Winn Benedikt Zimmermann diff --git a/Contrib/AcerDetInterface/AcerDet.cc b/Contrib/AcerDetInterface/AcerDet.cc deleted file mode 100644 --- a/Contrib/AcerDetInterface/AcerDet.cc +++ /dev/null @@ -1,153 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the AcerDet class. -// - -#include "AcerDet.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/Config/HepMCHelper.h" - -using namespace Herwig; - -// maximum number of leptons in the common block -const int acdleptt_maxlept = 12; -// maximum number of photons in the common block -const int acdphot_maxphot = 12; -// maximum number of jets in the common block -const int acdjets_maxjet = 20; - -extern "C" { - // main AcerDet driving routine - void acerdet_(int*); - // convert from HEPEVT to internal format - void acdherwig6_(); - // open the files for input/output - void acerdet_files_(); - // common block for reconstructed leptons - extern struct { - int nlept; - int kflept[acdleptt_maxlept]; - float pxlept[acdleptt_maxlept]; - float pylept[acdleptt_maxlept]; - float pzlept[acdleptt_maxlept]; - float eelept[acdleptt_maxlept]; - } acdleptt_; - // common block for reconstructed photons - extern struct { - int nphot; - int kfphot[acdphot_maxphot]; - float pxphot[acdphot_maxphot]; - float pyphot[acdphot_maxphot]; - float pzphot[acdphot_maxphot]; - float eephot[acdphot_maxphot]; - } acdphot_; - // common block for reconstructed jets - extern struct { - int njets; - int kfjets[acdjets_maxjet]; - float pxjets[acdjets_maxjet]; - float pyjets[acdjets_maxjet]; - float pzjets[acdjets_maxjet]; - float eejets[acdjets_maxjet]; - } acdjets_; - // common block for reconstructed etmiss - extern struct { - float pxmiss; - float pymiss; - float pxnues; - float pynues; - float pxcalo; - float pycalo; - } acdmiss_; -} - -void AcerDet::analyze(tEventPtr event, long ieve, int loop, int state) { - // check energy unit - if(HepMC::Units::default_momentum_unit()!=HepMC::Units::GEV) - throw Exception() << "Must be using GeV in HepMC if using AcerDet" - << " in AcerDet::analyze()" - << Exception::runerror; - // clear storage - _nphoton=0; - _photonMomentum.clear(); - _nlepton=0; - _leptonMomentum.clear(); - _leptonID; - _njet=0; - _jetMomentum.clear(); - _jetID; - // convert the event to HepMC - HepMC::GenEvent * hepmc = HepMCConverter::convert(*event); - // convert the event from HepMC to HEPEVT - HepMC::HEPEVT_Wrapper::set_max_number_entries(4000); - _converter->write_event(hepmc); - // convert the event to AcerDet internal format - acdherwig6_(); - int imode=0; - acerdet_(&imode); - // number of photons and momenta - _nphoton = acdphot_.nphot; - for(int ix=0;ix<_nphoton;++ix) { - _photonMomentum.push_back(LorentzMomentum(acdphot_.pxphot[ix]*GeV, - acdphot_.pyphot[ix]*GeV, - acdphot_.pzphot[ix]*GeV, - acdphot_.eephot[ix]*GeV)); - } - // number of leptons, momenta and PDG codes - _nlepton = acdleptt_.nlept; - for(int ix=0;ix<_nlepton;++ix) { - _leptonMomentum.push_back(LorentzMomentum(acdleptt_.pxlept[ix]*GeV, - acdleptt_.pylept[ix]*GeV, - acdleptt_.pzlept[ix]*GeV, - acdleptt_.eelept[ix]*GeV)); - _leptonID.push_back(acdleptt_.kflept[ix]); - } - // number of jets, momenta and PDG codes - _njet = acdjets_.njets; - for(int ix=0;ix<_njet;++ix) { - _jetMomentum.push_back(LorentzMomentum(acdjets_.pxjets[ix]*GeV, - acdjets_.pyjets[ix]*GeV, - acdjets_.pzjets[ix]*GeV, - acdjets_.eejets[ix]*GeV)); - _jetID.push_back(acdjets_.kfjets[ix]); - } - // missing ET - _etcalo = make_pair(acdmiss_.pxcalo*GeV,acdmiss_.pycalo*GeV); - _etneutrino = make_pair(acdmiss_.pxnues*GeV,acdmiss_.pynues*GeV); - _etstable = make_pair(acdmiss_.pxmiss*GeV,acdmiss_.pymiss*GeV); - delete hepmc; -} - -NoPIOClassDescription AcerDet::initAcerDet; -// Definition of the static class description member. - -void AcerDet::Init() { - - static ClassDocumentation documentation - ("The AcerDet class provides an interface to the AcerDet fast" - " dectector simulation."); - -} - -void AcerDet::dofinish() { - AnalysisHandler::dofinish(); - // delete the converter from HepMC to HEPEVT - delete _converter; - int imode=1; - acerdet_(&imode); -} - -void AcerDet::doinitrun() { - AnalysisHandler::doinitrun(); - // create the converter from HepMC to HEPEVT - _converter = new HepMC::IO_HEPEVT(); - // initialise AcerDet - int mode=-1; - generator()->log() << "testing in init run \n"; - acerdet_files_(); - generator()->log() << "testing read files\n"; - acerdet_(&mode); -} diff --git a/Contrib/AcerDetInterface/AcerDet.h b/Contrib/AcerDetInterface/AcerDet.h deleted file mode 100644 --- a/Contrib/AcerDetInterface/AcerDet.h +++ /dev/null @@ -1,278 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_AcerDet_H -#define HERWIG_AcerDet_H -// -// This is the declaration of the AcerDet class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "HepMC/GenEvent.h" -#include "HepMC/IO_HEPEVT.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The AcerDet class is designed to interface Herwig with the - * AcerDet fast detector simulation - * - * @see \ref AcerDetInterfaces "The interfaces" - * defined for AcerDet. - */ -class AcerDet: public AnalysisHandler { - -public: - - /** - * The default constructor. - */ - inline AcerDet() {} - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -public: - - /** - * Members to analyse the information from AcerDet - */ - //@{ - /** - * Number of photons - */ - inline unsigned int numberOfPhotons() const {return _nphoton;} - - /** - * Momenta of the photons - */ - inline const vector & photonMomentum() const {return _photonMomentum;} - - /** - * Number of leptons - */ - inline unsigned int numberOfLeptons() const {return _nlepton;} - - /** - * Momenta of the leptons - */ - inline const vector & leptonMomentum() const {return _leptonMomentum;} - - /** - * PDG codes for the leptons - */ - inline const vector & leptonID() const {return _leptonID;} - - /** - * Number of jets - */ - inline unsigned int numberOfJets() const {return _njet;} - - /** - * Momenta of the jets - */ - inline const vector & jetMomentum() const {return _jetMomentum;} - - /** - * PDG codes for the jets (0 for light 5 for bottom) - * probably not very relible - */ - inline const vector & jetID() const {return _jetID;} - - /** - * The missing \f$E_T\f$ from the calorimeter - * @return \f$p_x\f$, \f$p_y\f$ - */ - inline const pair & missingETCalorimeter() const {_etcalo;} - - /** - * The missing \f$E_T\f$ from the neutrinos - * @return \f$p_x\f$, \f$p_y\f$ - */ - inline const pair & missingETNeutrino() const {_etneutrino;} - - /** - * The missing \f$E_T\f$ from the user identified stable neutral particles - * @return \f$p_x\f$, \f$p_y\f$ - */ - inline const pair & missingETStable() const {_etstable;} - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static NoPIOClassDescription initAcerDet; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - AcerDet & operator=(const AcerDet &) = delete; - -private: - - /** - * Converter from HepMC to HEPEVT - */ - HepMC::IO_HEPEVT * _converter; - - /** - * Number of photons - */ - unsigned int _nphoton; - - /** - * Momenta of the photons - */ - vector _photonMomentum; - - /** - * Number of leptons - */ - unsigned int _nlepton; - - /** - * Momenta of the leptons - */ - vector _leptonMomentum; - - /** - * PDG codes for the leptons - */ - vector _leptonID; - - /** - * Number of jets - */ - unsigned int _njet; - - /** - * Momenta of the jets - */ - vector _jetMomentum; - - /** - * PDG codes for the jets - */ - vector _jetID; - - /** - * The missing \f$E_T\f$ from the calorimeter - */ - pair _etcalo; - - /** - * The missing \f$E_T\f$ from the neutrinos - */ - pair _etneutrino; - - /** - * The missing \f$E_T\f$ from the user identified stable neutral particles - */ - pair _etstable; -}; - -} - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of AcerDet. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of AcerDet. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the AcerDet class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "Herwig::AcerDet"; } - /** - * The name of a file containing the dynamic library where the class - * AcerDet is implemented. It may also include several, space-separated, - * libraries if the class AcerDet 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 "HwAcerDet.so"; } -}; - -/** @endcond */ - -} - -#endif /* HERWIG_AcerDet_H */ diff --git a/Contrib/AcerDetInterface/AcerDet_files.f b/Contrib/AcerDetInterface/AcerDet_files.f deleted file mode 100755 --- a/Contrib/AcerDetInterface/AcerDet_files.f +++ /dev/null @@ -1,18 +0,0 @@ - subroutine acerdet_files - implicit none - integer nwpawc - real hmemor - PARAMETER (NWPAWC = 5 000 000) - COMMON /PAWC/ HMEMOR(NWPAWC) - INCLUDE "acdnout.inc" -C--unit numbers for the inpt and output files - NINP = 16 - NOUT = 11 -C--open the files - OPEN(NINP ,file='acerdet.dat',status='old') - OPEN(NOUT ,file='acerdet.out') -C--hbook - CALL HLIMIT(NWPAWC) -C------initialize histo output - CALL HOUTPU(NOUT) - end diff --git a/Contrib/AcerDetInterface/LHC.in b/Contrib/AcerDetInterface/LHC.in deleted file mode 100644 --- a/Contrib/AcerDetInterface/LHC.in +++ /dev/null @@ -1,41 +0,0 @@ -# -*- ThePEG-repository -*- -################################################## -# Example generator based on LHC parameters -# usage: Herwig read LHC.in -################################################## -read snippets/PPCollider.in -################################################## -# Technical parameters for this run -################################################## -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 10000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:PrintEvent 10 -set EventGenerator:MaxErrors 10000 - -################################################## -# LHC physics parameters (override defaults here) -################################################## -set EventGenerator:EventHandler:LuminosityFunction:Energy 14000.0 - -# Intrinsic pT tune extrapolated to LHC energy -set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 2.2*GeV - -################################################## -# Matrix Elements for hadron-hadron collisions -# (by default only gamma/Z switched on) -################################################## -cd /Herwig/MatrixElements/ - -insert SubProcess:MatrixElements[0] MEqq2gZ2ff -set MEqq2gZ2ff:Process Electron -cd /Herwig/Generators - -library HwAcerDet.so -create Herwig::ZAnalysis /Herwig/Analysis/ZAnalysis ZAnalysis.so -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/ZAnalysis - -################################################## -# Save run for later usage with 'Herwig run' -################################################## -saverun LHC EventGenerator diff --git a/Contrib/AcerDetInterface/Makefile.in b/Contrib/AcerDetInterface/Makefile.in deleted file mode 100644 --- a/Contrib/AcerDetInterface/Makefile.in +++ /dev/null @@ -1,50 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE = -GSLINCLUDE = -HERWIGINCLUDE = -FC = -FCLIBS = -LDFLAGS = -SHARED_FLAG = -HEPMCLIBS = -L/scratch/richardn/montecarlo/utilities/lib -ACERDETPATH = /scratch/richardn/montecarlo/detector/AcerDET-1.0 -ACERDETINCLUDE = -I$(ACERDETPATH)/acerdet_inc -ACERDETLIB = -L$(ACERDETPATH)/acerdet_lib -lacerdet -CERNPATH = /scratch/richardn/montecarlo/detector/lib -CERNLIB = -L$(CERNPATH) -lpacklib -lmathlib -lkernlib -lnsl -lcrypt -ldl -INCLUDE = $(THEPEGINCLUDE) $(GSLINCLUDE) $(HERWIGINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : HwAcerDet.so ZAnalysis.so - -HwAcerDet.so : AcerDet.cc AcerDet.h AcerDet_files.o - $(CXX) -fPIC $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - AcerDet_files.o AcerDet.cc -o HwAcerDet.so \ - $(ACERDETLIB) $(CERNLIB) $(HEPMCLIBS) -lHepMC -lHepMCfio $(FCLIBS) - -ZAnalysis.so : ZAnalysis.cc ZAnalysis.h - $(CXX) -fPIC $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - ZAnalysis.cc -o ZAnalysis.so \ - $(ACERDETLIB) $(CERNLIB) $(HEPMCLIBS) -lHepMC -lHepMCfio $(FCLIBS) - -AcerDet_files.o: AcerDet_files.f - $(FC) -fPIC $(ACERDETINCLUDE) -c -fno-second-underscore AcerDet_files.f - -clean: - rm -f *.o *.so \ No newline at end of file diff --git a/Contrib/AcerDetInterface/ZAnalysis.cc b/Contrib/AcerDetInterface/ZAnalysis.cc deleted file mode 100644 --- a/Contrib/AcerDetInterface/ZAnalysis.cc +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the ZAnalysis class. -// - -#include "ZAnalysis.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" - -using namespace Herwig; - -ZAnalysis::ZAnalysis() : ZmassHadron_(82.,102.,100), ZmassDetector_(82.,102.,100) -{} - -void ZAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AcerDet::analyze(event, ieve, loop, state); - // detector level - // require 2 leptons - if(numberOfLeptons()!=2) return; - // require opposite sign - if(leptonID()[0]!=-leptonID()[1]) return; - Lorentz5Momentum pz = leptonMomentum()[0]+leptonMomentum()[1]; - double mz = pz.m()/GeV; - ZmassDetector_ += mz; - // hadron level - 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; - pz = LorentzMomentum(); - 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=(*iter)->momentum(); - double mz = pz.mass()/GeV; - ZmassHadron_ += mz; - } - } - } -} - -IBPtr ZAnalysis::clone() const { - return new_ptr(*this); -} - -IBPtr ZAnalysis::fullclone() const { - return new_ptr(*this); -} - - -// If needed, insert default implementations of virtual function defined -// in the InterfacedBase class here (using ThePEG-interfaced-impl in Emacs). - - -NoPIOClassDescription ZAnalysis::initZAnalysis; -// Definition of the static class description member. - -void ZAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the ZAnalysis class"); - -} - -void ZAnalysis::dofinish() { - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - string title; - using namespace HistogramOptions; - ZmassHadron_ .topdrawOutput(outfile,Frame,"BLACK","Z mass"); - ZmassDetector_.topdrawOutput(outfile,None,"RED"); - outfile.close(); - AcerDet::dofinish(); -} diff --git a/Contrib/AcerDetInterface/ZAnalysis.h b/Contrib/AcerDetInterface/ZAnalysis.h deleted file mode 100644 --- a/Contrib/AcerDetInterface/ZAnalysis.h +++ /dev/null @@ -1,157 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_ZAnalysis_H -#define HERWIG_ZAnalysis_H -// -// This is the declaration of the ZAnalysis class. -// - -#include "AcerDet.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The ZAnalysis class is a simple example of using the interface - * to AcerDet to look at the Z mass at the hadron and detector levels - * - * @see \ref ZAnalysisInterfaces "The interfaces" - * defined for ZAnalysis. - */ -class ZAnalysis: public AcerDet { - -public: - - /** - * The default constructor. - */ - ZAnalysis(); - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is an concrete class without persistent data. - */ - static NoPIOClassDescription initZAnalysis; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - ZAnalysis & operator=(const ZAnalysis &) = delete; - -private: - - /** - * Z mass at the hadron level - */ - Histogram ZmassHadron_; - - /** - * Z mass at the detector level - */ - Histogram ZmassDetector_; - -}; - -} - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of ZAnalysis. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of ZAnalysis. */ - typedef Herwig::AcerDet NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the ZAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "Herwig::ZAnalysis"; } - /** - * The name of a file containing the dynamic library where the class - * ZAnalysis is implemented. It may also include several, space-separated, - * libraries if the class ZAnalysis 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 "HwAcerDet.so ZAnalysis.so"; } -}; - -/** @endcond */ - -} - -#endif /* HERWIG_ZAnalysis_H */ diff --git a/Contrib/AcerDetInterface/acerdet.dat b/Contrib/AcerDetInterface/acerdet.dat deleted file mode 100755 --- a/Contrib/AcerDetInterface/acerdet.dat +++ /dev/null @@ -1,59 +0,0 @@ -C------ flags and switches --------------- - 10000 --- LPAR(1) ....id for histograms - 1 --- LPAR(2) ....smearing on=1, off=0 - 1 --- LPAR(3) ....B-field on=1, off=0 - 66 --- LPAR(4) ....code for SUSY LSP particle - 1 --- LPAR(5) ....b- and c-jets labeling on=1, off=0 - 1 --- LPAR(6) ....tau-jets labeling on=1, off=0 - 1 --- LPAR(7) ....jet calibration on=1, off=0 -C------ parameters for ACDCEL --------------- - 5.000 --- YPAR(1) ....rapidity coverage - 0.500 --- YPAR(2) ....min p_T for B-field - 0.000 --- YPAR(3) ....min E_T for cell - 3.200 --- YPAR(4) ....eta transition in cells granularity - 0.100 --- YPAR(5) ....granularity in eta (within YPAR(17)), 2x outside - 0.100 --- YPAR(6) ....granularity in phi (within YPAR(17)), 2x outside -C------ parameters for ACDCLU --------------- - 5.000 --- YPAR(10) ....minimum E_T for cluster - 0.400 --- YPAR(11) ....cone R for clustering - 5.000 --- YPAR(12) ....rapidity coverage - 1.500 --- YPAR(13) ....min E_T for cluster initiator -C------ parameters for ACDMUO --------------- - 6.000 --- YPAR(20) ....minimum muon-momenta to be detected - 2.500 --- YPAR(21) ....maximum muon eta to be detected - 0.400 --- YPAR(27) ....min R_lj for muon-isolation - 0.200 --- YPAR(28) ....R_cone for energy deposition - 10.000 --- YPAR(29) ....max energy deposition for isol -C------ parameters for ACDPHO --------------- - 5.000 --- YPAR(30) ....minimum photon-momenta to be isol - 2.500 --- YPAR(31) ....maximum photon eta to be isol - 0.150 --- YPAR(35) ....min R_lj for photon-jet - 0.400 --- YPAR(37) ....min R_lj for photon-isolation - 0.200 --- YPAR(38) ....R_cone for energy deposition - 10.000 --- YPAR(39) ....max energy deposition for isol -C------ parameters for ACDELE --------------- - 5.000 --- YPAR(40) ....minimum electron-momenta to be isol - 2.500 --- YPAR(41) ....maximum electron eta to be isol - 0.150 --- YPAR(45) ....min R_lj for electron-jet - 0.400 --- YPAR(47) ....min R_lj for electron-isolation - 0.200 --- YPAR(48) ....R_cone for energy deposition - 10.000 --- YPAR(49) ....max energy deposition for isol -C------ parameters for ACDJET --------------- - 10.000 --- YPAR(51) ....jets energy_min threshold - 5.000 --- YPAR(52) ....rapidity coverage for jets -C------ parameters for ACDBJE --------------- - 5.000 --- YPAR(61) ....minimum b-quark pT (after FSR) momenta for b-jet label - 2.500 --- YPAR(62) ....maximum b-quark eta for b-jet label - 0.200 --- YPAR(63) ....max R_bj for b-jet label -C------ parameters for ACDCJE --------------- - 5.000 --- YPAR(71) ....minimum c-quark pT (after FSR) momenta for c-jet label - 2.500 --- YPAR(72) ....maximum c-quark eta for c-jet label - 0.200 --- YPAR(73) ....max R_cj for c-jet label -C------ parameters for ACDTAU --------------- - 10.000 --- YPAR(90) ....minimum tau-had pT for tau-jet label - 2.500 --- YPAR(91) ....maximum tau-eta for tau-jet label - 0.300 --- YPAR(92) ....max R_tauj for tau-jet - 0.900 --- YPAR(93) ....max R_tauj for tau-jet -C------ parameters for ACDMIS --------------- - 0.000 --- YPAR(80) ....min E_T for energy in cell to count unused cell -C------ end of data files --------------- diff --git a/Contrib/AlpGen/AlpGenHandler.cc b/Contrib/AlpGen/AlpGenHandler.cc deleted file mode 100644 --- a/Contrib/AlpGen/AlpGenHandler.cc +++ /dev/null @@ -1,1392 +0,0 @@ -#include "AlpGenHandler.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Repository/UseRandom.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "Herwig/Shower/QTilde/Base/PartnerFinder.h" -#include "Herwig/PDF/HwRemDecayer.h" -#include -#include "ThePEG/Utilities/Throw.h" -#include "Herwig/Shower/QTilde/Kinematics/KinematicsReconstructor.h" -#include "fastjet/PseudoJet.hh" -#include "fastjet/ClusterSequence.hh" -#include "gsl/gsl_rng.h" -#include "gsl/gsl_randist.h" - - -using namespace Herwig; - -bool recordEntry(PPtr i,PPtr j) { - return (i->number()number()); -} -bool pTsortFunction(PPtr i,PPtr j) { - return (i->momentum().perp2()>j->momentum().perp2()); -} -bool ETsortFunction(pair i,pair j) { - return (i.first>j.first); -} -bool isMomLessThanEpsilon(Lorentz5Momentum p,Energy epsilon) { - return (abs(p.x())> alphaS_ - >> ncy_ >> ncphi_ >> ihvy_ >> nph_ >> nh_ - >> iunit(etclusmean_,GeV) >> rclus_ >> etaclmax_ >> rclusfactor_ - >> ihrd_ >> njets_ >> drjmin_ >> highestMultiplicity_ - >> ycmax_ >> ycmin_ >> jetAlgorithm_ >> vetoIsTurnedOff_ - >> inputIsNLO_ >> highestNLOMultiplicity_ >> etclusfixed_ - >> cphcal_ >> sphcal_ >> cthcal_ >> sthcal_ >> iunit(epsetclus_,GeV); -} - -ClassDescription AlpGenHandler::initAlpGenHandler; -// Definition of the static class description member. - -void AlpGenHandler::Init() { - - static ClassDocumentation documentation - ("The AlpGenHandler class performs MEPS merging " - "using the MLM procedure."); - - static Reference interfaceShowerAlpha - ("ShowerAlpha", - "The object calculating the strong coupling constant", - &AlpGenHandler::alphaS_, false, false, true, false, false); - - static Parameter interfaceNoCellsInRapidity - ("NoCellsInRapidity", - "The number of cells spanning the rapidity interval of " - "the calorimeter", - &AlpGenHandler::ncy_, 100, 1, 10000, - false, false, Interface::limited); - - static Parameter interfaceNoCellsInPhi - ("NoCellsInPhi", - "The number of cells spanning the phi interval of " - "the calorimeter", - &AlpGenHandler::ncphi_, 60, 1, 10000, - false, false, Interface::limited); - - static Parameter interfaceihvy - ("ihvy", - "heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t)", - &AlpGenHandler::ihvy_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfacenph - ("nph", - "Number of photons in the AlpGen process", - &AlpGenHandler::nph_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfacenh - ("nh", - "Number of higgses in the AlpGen process", - &AlpGenHandler::nph_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfaceETClus - ("ETClus", - "The ET threshold defining a jet in the merging procedure", - &AlpGenHandler::etclusmean_, GeV, 20*GeV, 0*GeV, 14000*GeV, - false, false, Interface::limited); - - static Parameter interfaceRClus - ("RClus", - "The cone size used to define a jet in the merging procedure", - &AlpGenHandler::rclus_, 0.4, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfaceEtaClusMax - ("EtaClusMax", - "The maximum |eta| used to define a jet in the merging procedure", - &AlpGenHandler::etaclmax_, 5.0, 0.0, 15.0, - false, false, Interface::limited); - - static Parameter interfaceRClusFactor - ("RClusFactor", - "The prefactor for RClus used to define the jet-parton matching " - "distance", - &AlpGenHandler::rclusfactor_, 1.5, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfaceihrd - ("ihrd", - "The AlpGen hard process code", - &AlpGenHandler::ihrd_, -999, 0, 10000, - false, false, Interface::limited); - - static Parameter interfacenjets - ("njets", - "The number of light jets in the AlpGen process (i.e. the " - "extra ones)", - &AlpGenHandler::njets_, -999, 0, 10000, - false, false, Interface::limited); - - static Parameter interfacedrjmin - ("drjmin", - "Mimimum parton-parton R-sep used for generation.", - &AlpGenHandler::drjmin_, 0.7, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfacehighestMultiplicity - ("highestMultiplicity", - "If true it indicates that this is the highest multiplicity input " - "ME-level configuration to be processed.", - &AlpGenHandler::highestMultiplicity_, 0, 0, 1, - false, false, Interface::limited); - - static Parameter interfacehighestNLOMultiplicity - ("highestNLOMultiplicity", - "If true it indicates that this is the highest NLO multiplicity input " - "ME-level configuration to be processed.", - &AlpGenHandler::highestNLOMultiplicity_, 0, 0, 1, - false, false, Interface::limited); - - static Parameter interfaceETClusFixed - ("ETClusFixed", - "If false, indicates that the jet merging scale, etclus_ is allowed to vary" - "according to epsetclus_", - &AlpGenHandler::etclusfixed_, 1, 0, 1, - false, false, Interface::limited); - - static Parameter interfaceEpsilonETClus - ("EpsilonETClus", - "The ET threshold defining a jet in the merging procedure", - &AlpGenHandler::epsetclus_, GeV, 2.5*GeV, 0*GeV, 100.0*GeV, - false, false, Interface::limited); - - static Switch interfaceJetAlgorithm - ("JetAlgorithm", - "Determines the jet algorithm for finding jets in parton-jet " - "matching in the MLM procedure.", - &AlpGenHandler::jetAlgorithm_, 2, false, false); - static SwitchOption AntiKt - (interfaceJetAlgorithm, - "AntiKt", - "The anti-kt jet algorithm.", - -1); - static SwitchOption CambridgeAachen - (interfaceJetAlgorithm, - "CambridgeAachen", - "The Cambridge-Aachen jet algorithm.", - 0); - static SwitchOption Kt - (interfaceJetAlgorithm, - "Kt", - "The Kt jet algorithm.", - 1); - static SwitchOption GetJet - (interfaceJetAlgorithm, - "GetJet", - "Calorimeter-based GetJet algorithm (default).", - 2); - - static Switch interfaceVetoIsTurnedOff - ("VetoIsTurnedOff", - "Allows the vetoing mechanism to be switched off.", - &AlpGenHandler::vetoIsTurnedOff_, false, false, false); - static SwitchOption VetoingIsOn - (interfaceVetoIsTurnedOff, - "VetoingIsOn", - "The MLM merging veto mechanism is switched ON.", - false); - static SwitchOption VetoingIsOff - (interfaceVetoIsTurnedOff, - "VetoingIsOff", - "The MLM merging veto mechanism is switched OFF.", - true); - - static Switch interfaceInputIsNLO - ("InputIsNLO", - "Signals whether the input LH file is tree-level accurate " - "or contains NLO (Powheg) events.", - &AlpGenHandler::inputIsNLO_, false, false, false); - static SwitchOption InputIsNotNLO - (interfaceInputIsNLO, - "InputIsNotNLO", - "The input LH events have tree-level accuracy.", - false); - static SwitchOption InputIsNLO - (interfaceInputIsNLO, - "InputIsNLO", - "The input LH events have NLO accuracy.", - true); - -} - -void AlpGenHandler::dofinish() { - ShowerHandler::dofinish(); -} - -void AlpGenHandler::doinit() { - - //print error if HardProcID is not set in input file - if(ihrd_ == -999) { cout << "Error: AlpGenHandler:ihrd not set!" << endl; exit(1); } - ShowerHandler::doinit(); - - // Compute calorimeter edges in rapidity for GetJet algorithm. - ycmax_=etaclmax_+rclus_; - ycmin_=-ycmax_; - - // Initialise calorimeter. - calini_m(); -} - -// Throws a veto according to MLM strategy ... when we finish writing it. -bool AlpGenHandler::showerHardProcessVeto() const { - if(vetoIsTurnedOff_) return false; - // Skip veto for processes in which merging is not implemented: - if(ihrd_==7||ihrd_==8||ihrd_==13) { - ostringstream wstring; - wstring << "AlpGenHandler::showerHardProcessVeto() - warning." - << "MLM merging not implemented for AlpGen " - << "processes 4Q (ihrd=7), QQh (ihrd=8), " - << "(single) top (ihrd=13) \n"; - generator()->logWarning( Exception(wstring.str(), - Exception::warning) ); - return false; - } - - // Fill preshowerISPs_ pair and preshowerFSPs_ particle pointer vector. - getPreshowerParticles(); - - // Fill showeredISHs_, showeredISPs and showeredRems pairs, as well as - // showeredFSPs_ particle pointer vector. - getShoweredParticles(); - - // Turn on some screen output debugging: 0 = none ---> 5 = very verbose. - doSanityChecks(0); - - // Dimensions of each calorimter cell in y and phi. - dely_ = (ycmax_-ycmin_)/double(ncy_); - delphi_ = 2*M_PI/double(ncphi_); - - // Fill partonsToMatch_ with only those pre-shower partons intended to - // used in jet-parton matching and fill particlesToCluster_ using only - // those final state particles (post-shower) which are supposed to go - // in the jet clustering used to do merging. - partonsToMatch_ = preshowerFSPs_; - particlesToCluster_ = showeredFSPs_ ; // <--- TO DO: add remnants in here ??? - - // Filter out all but the 'extra' light-parton progenitors and their - // associated final state particles. - caldel_m(); - - double prob(1); - //if etclusfixed_ then set the etclus_ to the fixed chosen value - if(etclusfixed_) { - etclus_ = etclusmean_; - } else { - //else, if we wish to vary etclus_, we use the probability distribution - //choose a probability between 0 and 1 - prob = rnd(); - etclus_ = etclusran_(prob); - } - - if(jetAlgorithm_==2) { - // If using GetJet fill the calorimeter cells now from particlesToCluster_ - calsim_m(); - // Make jets from the calorimeter blobs. - getjet_m(rclus_,etclus_,etaclmax_); - } else { - // Cluster particlesToCluster_ into jets with FastJet. - getFastJets(rclus_,etclus_,etaclmax_); - } - - // If there are less jets than partons then parton-jet matching is - // bound to fail: reject the event already. Also, if the input is - // an NLO event file it will 99.5% of the time contain a number of - // light partons in the F.S. equal to that in the real emission - // process in the NLO calculation, moreover, it has already - // effectively merged njets_-1 and njets jet events. So in that - // case we do not reject events on the grounds they have jet - // multiplicity less than partonsToMatch_.size() but rather less - // jets than partonsToMatch.size()-1; such events are better - // described by the lower-by-one-unit (partonsToMatch_.size()-1) - // of multiplicity NLO event file, or the lower-by-two-units - // (partonsToMatch_.size()-2) of multiplicity LO event file. - - // If it is not jet production apply rejection criterion as above. - if(ihrd_!=9) { - if(!inputIsNLO_) { - if(pjet_.size() < partonsToMatch_.size()) return true; - } else { - if(pjet_.size() < partonsToMatch_.size()-1) return true; - } - // Otherwise, in the case of jet production allow the lowest - // contributing multiplicity process (just at NLO), namely, - // dijet production, to give rise to 1-jet and even 0-jet - // events, since these can contribute to, for example, the - // inclusive jet cross section i.e. in this case the rejection - // is only applied in the case of the next-to-lowest multiplicity - // processes (>2 parton events at LO and >3 parton events at NLO). - } else { - if(!inputIsNLO_) { - // KH - March 5th - // Removed the following line giving special treatment - // also to the LO events, to maintain consistency with - // the fortran algorithm, at least for now. So now jet - // production at LO is being treated the same as all - // other processes. - // if(partonsToMatch_.size()==2 && pjet_.size()<2) return false; - if(pjet_.size() < partonsToMatch_.size()) return true; - } else { - if(partonsToMatch_.size()<=3 && pjet_.size()<2) return false; - if(pjet_.size() < partonsToMatch_.size()-1) return true; - } - } - - // Sort partonsToMatch_ from high to low pT. - sort(partonsToMatch_.begin(),partonsToMatch_.end(),pTsortFunction); - - // Match light progenitors to jets. - vector jetToPartonMap(pjet_.size(),-999); - Energy etmin(777e100*GeV); - - // If the input is NLO events then don't do any jet-parton matching! - if(!inputIsNLO_) { - - // For each parton, starting with the hardest one ... - for(unsigned int ixx=0; ixx=0) { - jetToPartonMap[jetIndexForDRmin]=ixx; - if(ixx==0||etjet_[jetIndexForDRmin]partonsToMatch_.size() - && !inputIsNLO_) return true; - if(inputIsNLO_) { - if(!highestNLOMultiplicity_) { - if(pjet_.size()>partonsToMatch_.size()-1) return true; - } else { - if(!highestMultiplicity_&&pjet_.size()>partonsToMatch_.size()) - return true; - } - } - - // Veto events where matched jets are softer than non-matched ones, - // in the inclusive (highestMultiplicity_ = true) mode, unless we - // are dealing with NLO input events. - if(highestMultiplicity_ && !inputIsNLO_ ) { - for(unsigned int ixx=0; ixxid())==4||abs(partonsToMatch_[jxx]->id())==5)) continue; - if(partonJetDeltaR(partonsToMatch_[jxx],pjet_[ixx])etmin) return true; - } - } - - } - - // Otherwise we accept the event ... - return false; - -} - -/* Function that returns the R distance - between a particle and a jet. */ -double AlpGenHandler::partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom) const { - LorentzMomentum partonmom(partonptr->momentum()); - // Calculate DY, DPhi and then DR - double DY(partonmom.eta()-jetmom.eta()); - double DPhi(partonmom.phi()-jetmom.phi()); - if(DPhi>M_PI) DPhi=2*M_PI-DPhi; - double DR(sqrt(sqr(DY)+sqr(DPhi))); - return DR; -} - - -// Initialize calorimeter for calsim_m and getjet_m. Note that -// because initialization is separte calsim_m can be called more -// than once to simulate pileup of several events. -void AlpGenHandler::calini_m() const { - - // Making sure arrays are clear before filling; - cphcal_.clear(); sphcal_.clear(); - cthcal_.clear(); sthcal_.clear(); - - // Fill array holding phi values of calorimeter cell centres. - double deltaPhi(2*M_PI/ncphi_); - for(unsigned int iphi=1; iphi<=ncphi_; iphi++) { - double phi(deltaPhi*(iphi-0.5)); // Goes phi~=0 to phi~=2*pi (iphi=0--->ncphi). - cphcal_.push_back(cos(phi)); // ==> goes from +1 ---> +1 (iphi=0--->ncphi). - sphcal_.push_back(sin(phi)); // ==> goes 0 -> 1 -> 0 -> -1 -> 0 (iphi=0--->ncphi). - } - - // Fill array holding theta values of calorimeter cell centres in Y. - double deltaY((ycmax_-ycmin_)/double(ncy_)); - for(unsigned int iy=1; iy<=ncy_; iy++) { - double Y(deltaY*(iy-0.5)+ycmin_); - double th(2*atan(exp(-Y))); // Goes bwds th~=pi to fwds th~=0 (iy=0--->ncy). - cthcal_.push_back(cos(th)); // ==> goes from -1 ---> +1 (iy=0--->ncy). - sthcal_.push_back(sin(th)); // ==> goes from 0 ---> +1 ---> 0 (iy=0--->ncy). - } - return; -} - -// Get FastJets -void AlpGenHandler::getFastJets(double rjet, Energy ejcut, double etajcut) const { - - vector particlesToCluster; - for(unsigned int ipar=0; iparmomentum().eta()); - if(y>=ycmin_&&y<=ycmax_) { - int absId(abs(particlesToCluster_[ipar]->id())); - // If it's not a lepton / top / photon it may go in the jet finder. - if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { - // input particles into fastjet pseudojet - fastjet::PseudoJet p(particlesToCluster_[ipar]->momentum().x()/GeV, - particlesToCluster_[ipar]->momentum().y()/GeV, - particlesToCluster_[ipar]->momentum().z()/GeV, - particlesToCluster_[ipar]->momentum().e()/GeV); - p.set_user_index(ipar); - particlesToCluster.push_back(p); - } - } - } - - fastjet::RecombinationScheme recombinationScheme = fastjet::E_scheme; - fastjet::Strategy strategy = fastjet::Best; - double R(rjet); - fastjet::JetDefinition theJetDefinition; - switch (jetAlgorithm_) { - case -1: theJetDefinition=fastjet::JetDefinition(fastjet::antikt_algorithm, - R, - recombinationScheme, - strategy); break; - case 0: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - case 1: theJetDefinition=fastjet::JetDefinition(fastjet::kt_algorithm, - R, - recombinationScheme, - strategy); break; - default: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - } - fastjet::ClusterSequence fastjetEvent(particlesToCluster,theJetDefinition); - vector inclusiveJets = fastjetEvent.inclusive_jets(); - inclusiveJets = fastjet::sorted_by_pt(inclusiveJets); - - // Fill the array of jet momenta for the rest of the veto procedure. - pjet_.clear(); - pjet_.resize(inclusiveJets.size()); - etjet_.clear(); - etjet_.resize(inclusiveJets.size()); - for(unsigned int ffj=0; ffjetajcut) { - pjet_.erase(pjet_.begin()+fj); - etjet_.erase(etjet_.begin()+fj); - fj--; - } - - // Sort jets from high to low ET. - vector > etjet_pjet; - for(unsigned int ixx=0; ixxmomentum().eta()); - if(y>=ycmin_&&y<=ycmax_) { - int absId(abs(particlesToCluster_[ipar]->id())); - // If it's not a lepton / top / photon it goes in the calorimeter. - if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { - double phi(atan2(particlesToCluster_[ipar]->momentum().y()/GeV, - particlesToCluster_[ipar]->momentum().x()/GeV)); - if(phi<0) phi+=2*M_PI; - unsigned int iy(int((y-ycmin_)/dely_)); - unsigned int iphi(int(phi/delphi_)); - et_[iy][iphi]+=particlesToCluster_[ipar]->momentum().e()*sthcal_[iy]; - } - } - } - return; -} - -// Find highest remaining cell > etstop and sum surrounding cells -// with -- delta(y)^2+delta(phi)^2 < Rjet^2 , ET>eccut. Keep sets -// with ET>ejcut and abs(eta)=etstop) { - - // Find the cell with the highest ET from - // those not already assigned to a jet. - etmax=0*GeV; - int iymx(0), iphimx(0); - for(unsigned int iphi=0; iphietmax&&jetIdx_[iy][iphi]<0) { - etmax = et_[iy][iphi]; - iymx = iy; - iphimx = iphi; - } - - // If the remaining cell with the highest ET has ET < etstop, stop. - if(etmax(ncy_*ncphi_)) { - cout << "AlpGenHandler::getjet_m() - Fatal error." << endl; - cout << "We found " << ipass << " calo cells with the highest ET so" - << "far\nbut the calorimeter only has " << ncy_*ncphi_ << " " - << "cells in it!" << endl; - exit(10); - } - - // Add a jet vector (may get deleted if jet fails ET / eta cuts). - etjet_.push_back(0*GeV); - pjet_.push_back(Lorentz5Momentum(0.*GeV,0.*GeV,0.*GeV,0.*GeV,0.*GeV)); - - // Loop over all calo cells in range iphimx +/- nphi1 (inclusive) - // wrapping round in azimuth if required. - for(unsigned int iphi1=0; iphi1<=2*nphi1; iphi1++) { - int iphix(iphimx-nphi1+iphi1); - if(iphix<0) iphix += ncphi_; - if(iphix>=int(ncphi_)) iphix -= ncphi_; - // Loop over all calo cells in range iymx +/- ny1 (inclusive). - for(unsigned int iy1=0; iy1<=2*ny1; iy1++) { - int iyx(iymx-ny1+iy1); - // If the cell is outside the calorimeter OR if it was already - // associated to a jet then skip to the next loop. - if(iyx>=0&&iyx=eccut) { - Energy ECell(et_[iyx][iphix]/sthcal_[iyx]); - pjet_.back()+=LorentzMomentum(ECell*sthcal_[iyx]*cphcal_[iphix], // px - ECell*sthcal_[iyx]*sphcal_[iphix], // py - ECell*cthcal_[iyx],ECell); // pz, E. - // N.B. This is the same reln as in ThePEG between phi and x,y. - etjet_.back()+=et_[iyx][iphix]; - jetIdx_[iyx][iphix] = pjet_.size()-1; // Identify cell with this jet. - } - } - } - } - - // Compute the current jet's mass. - pjet_.back().rescaleMass(); - - // Throw the jet away if it's ET is less than ejcut. - if(etjet_.back()etajcut) { - pjet_.pop_back(); - etjet_.pop_back(); - } - - } - - // Sort jets from high to low ET. - vector > etjet_pjet; - for(unsigned int ixx=0; ixxchildren()); - for (unsigned int ixx=0; ixxchildren().size()==0) - tmpList_.push_back(theChildren[ixx]); - else - getDescendents(theChildren[ixx]); - return; -} -void AlpGenHandler::caldel_m() const { - - - preshowerFSPsToDelete_.clear(); - showeredFSPsToDelete_.clear(); - - for(unsigned int ixx=0; ixxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==ihvy_&&ixx<2) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24|| - abs(preshowerFSPs_[ixx]->id())==22|| - abs(preshowerFSPs_[ixx]->id())==25) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==6|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - } - if(abs(preshowerFSPs_[ixx]->parents()[0]->id())==6) { - getDescendents(preshowerFSPs_[ixx]->parents()[0]); - for(unsigned int jxx=0; jxxid())==ihvy_&&ixx<2) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==4&&ixx<1)|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==25) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+1)))|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+2)))|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==6|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx<2)) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparticlesToCluster_.size()) { - throw Exception() - << "AlpGenHandler::caldel_m() - ERROR!\n" - << "No. of ME level partons to be matched to jets = " - << partonsToMatch_.size() << "\n" - << "No. of showered particles to build jets from = " - << particlesToCluster_.size() << "\n" - << "There should be at least as many partons to\n" - << "cluster as there are partons to match to.\n" - << Exception::eventerror; - } - - - // Acid test. - unsigned int tmpUnsignedInt(njets_); - if(!inputIsNLO_&&partonsToMatch_.size()!=tmpUnsignedInt) { - for(unsigned int ixx=0; ixxid())>=6&& - abs(partonsToMatch_[ixx]->id())!=21) - throw Exception() - << "AlpGenHandler::caldel_m() - ERROR!\n" - << "Found a parton to match to which is not a quark or gluon!" - << *partonsToMatch_[ixx] << "\n" - << Exception::eventerror; - } - throw Exception() - << "AlpGenHandler::caldel_m() - ERROR!\n" - << "No. of ME level partons to be matched to jets = " - << partonsToMatch_.size() << "\n" - << "No. of light jets (njets) in AlpGen process = " - << njets_ << "\n" - << "These should be equal." << "\n" - << Exception::eventerror; - } - - return; -} - -// This looks for all descendents of a top up to but not including -// the W and b children. -void AlpGenHandler::getTopRadiation(PPtr theParticle) const { - ParticleVector theChildren(theParticle->children()); - for (unsigned int ixx=0; ixxchildren().size()==0) - tmpList_.push_back(theChildren[ixx]); - else if(abs(theChildren[ixx]->id())==5||abs(theChildren[ixx]->id())==24) - return; - else - getTopRadiation(theChildren[ixx]); - return; -} -void AlpGenHandler::caldel_hvq() const { - - // Fill partonsToMatch_ with only those pre-shower partons intended to - // be used in heavy-quark-jet matching and fill particlesToCluster_ using - // only those final state particles (post-shower) which are supposed - // in the heavy-quark-jet clustering used to do merging. To begin with - // these are made from the corresponding sets of particles that were - // omitted from the initial jet-parton matching run. - partonsToMatch_ = preshowerFSPsToDelete_; - particlesToCluster_.resize(showeredFSPsToDelete_.size()); - for(unsigned int ixx=0; ixxid())<4||abs(partonsToMatch_[ixx]->id())>6) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxid())==5&& - partonsToMatch_[ixx]->parents().size()>0&& - abs(partonsToMatch_[ixx]->parents()[0]->id())==6) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxparents().size()>0&& - (abs(partonsToMatch_[ixx]->parents()[0]->id())==23|| - abs(partonsToMatch_[ixx]->parents()[0]->id())==24|| - abs(partonsToMatch_[ixx]->parents()[0]->id())==25)) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxsubProcess()->intermediates()); - for(unsigned int ixx=0; ixxid())==6) { - partonsToMatch_.push_back(intermediates[ixx]); - tmpList_.clear(); - getTopRadiation(partonsToMatch_.back()); - for(unsigned int jxx=0; jxxid())>=4&&abs(partonsToMatch_[ixx]->id())<=6) { - theProgenitor = partonsToMatch_[ixx]; - // Follow the heavy quark line down to where it stops branching. - while(theProgenitor->children().size()>0) { - theLastProgenitor = theProgenitor; - for(unsigned int jxx=0; jxxchildren().size(); jxx++) { - if(theProgenitor->children()[jxx]->id()==theProgenitor->id()) - theProgenitor=theProgenitor->children()[jxx]; - } - // If the progenitor had children but none of them had - // the same particle id as it, then it must have undergone - // a decay rather than a branching, i.e. it is the end of - // the evolution line, so, - if(theProgenitor==theLastProgenitor) break; - } - evolvedHeavyQuarks.push_back(theProgenitor); - } - } - // Now delete the evolved heavy quark from the particlesToCluster. - for(unsigned int ixx=0; ixxsubProcess()->incoming(); - - // LH file final-state partICLEs: - preshowerFSPs_ = lastXCombPtr()->subProcess()->outgoing(); - - return; -} - -void AlpGenHandler::getShoweredParticles() const { - // Post-shower initial-state hadrons: - showeredISHs_ = eventHandler()->currentEvent()->incoming(); - - // Post-shower initial-state partons: - for(unsigned int ixx=0; ixx<(showeredISHs_.first)->children().size(); ixx++) - if(((showeredISHs_.first)->children()[ixx]->id())<6|| - ((showeredISHs_.first)->children()[ixx]->id())==21) - showeredISPs_.first=(showeredISHs_.first)->children()[ixx]; - for(unsigned int ixx=0; ixx<(showeredISHs_.second)->children().size(); ixx++) - if(((showeredISHs_.second)->children()[ixx]->id())<6|| - ((showeredISHs_.second)->children()[ixx]->id())==21) - showeredISPs_.second=(showeredISHs_.second)->children()[ixx]; - - // Post-shower final-state partICLEs plus remnants (to be removed later): - showeredFSPs_ = eventHandler()->currentEvent()->getFinalState(); - - // Post-shower final-state remnants: - for(unsigned int ixx=0; ixxPDGName()=="Rem:p+"|| - showeredFSPs_[ixx]->PDGName()=="Rem:pbar-") { - if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== - showeredISHs_.first) - showeredRems_.first=showeredFSPs_[ixx]; - else if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== - showeredISHs_.second) - showeredRems_.second=showeredFSPs_[ixx]; - } - } - - // Now delete found remnants from the showeredFSPs vector for consistency. - for(unsigned int ixx=0; ixxPDGName()=="Rem:p+") - showeredFSPs_.erase(showeredFSPs_.begin()+ixx); - for(unsigned int ixx=0; ixxPDGName()=="Rem:pbar-") - showeredFSPs_.erase(showeredFSPs_.begin()+ixx); - sort(showeredFSPs_.begin(),showeredFSPs_.end(),recordEntry); - - return; -} - -void AlpGenHandler::doSanityChecks(int debugLevel) const { - - // When checking momentum conservation in the form - // p_in - p_out, any momentum component bigger / less - // than + / - epsilon will result in the p_in - p_out - // vector being flagged as "non-null", triggering a - // warning that momentum conservation is violated. - Energy epsilon(0.5*GeV); - if(debugLevel>=5) epsilon=1e-9*GeV; - - // Print out what was found for the incoming and outgoing - // partons in the lastXCombPtr regardless. - if(debugLevel>=5) { - cout << "\n\n\n\n"; - cout << "****************************************************" << endl; - cout << " The following are the hard subprocess momenta from " << "\n" - << " lastXCombPtr and should be basically identical to " << "\n" - << " the input LH file momenta." << "\n\n"; - cout << " Incoming particles:" << "\n" - << *(preshowerISPs_.first) << "\n" - << *(preshowerISPs_.second) << endl; - cout << " Outgoing particles:" << endl; - for(unsigned int ixx=0; ixx=5) { - cout << "\n\n"; - cout << "****************************************************" << endl; - cout << " The following are the particles left at the end of" << "\n" - << " the showering step." << "\n\n"; - cout << " Incoming hadrons:" << "\n" - << *(showeredISHs_.first) << "\n" - << *(showeredISHs_.second) << endl; - cout << " Incoming partons:" << "\n" - << *(showeredISPs_.first) << "\n" - << *(showeredISPs_.second) << endl; - cout << " Outgoing partons:" << endl; - for(unsigned int ixx=0; ixx=4) { - Lorentz5Momentum tmpMom; - tmpMom += showeredISPs_.first->momentum(); - tmpMom += showeredISPs_.second->momentum(); - for(unsigned int ixx=0; ixxmomentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "Total parton mom.in - total parton mom.out = " - << tmpMom/GeV << endl; - tmpMom = showeredISHs_.first->momentum() - - showeredRems_.first->momentum() -showeredISPs_.first->momentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "First p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; - tmpMom = showeredISHs_.second->momentum() - - showeredRems_.second->momentum()-showeredISPs_.second->momentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "Second p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; - } - - // Check if what we found to be the remnant is consistent with - // what we identified as the parent incoming hadron i.e. p+ - // goes with Rem:p+ and pbar- goes with Rem:pbar-. - if(debugLevel>=0) { - string tmpString; - tmpString=showeredRems_.first->PDGName(); - tmpString=tmpString.substr(tmpString.find_first_of(":")+1, - string::npos); - if(showeredISHs_.first->PDGName()!=tmpString) { - cout << "AlpGenHandler::showerHardProcessVeto" << "\n" - << "Fatal error in pairing of remnant and parent hadron." << "\n" - << "Remnant = " << *(showeredRems_.first) << "\n" - << "Parent hadron = " << *(showeredISHs_.first) - << endl; - cout << showeredISHs_.first->PDGName() << endl; - cout << tmpString << endl; - } - tmpString=showeredRems_.second->PDGName(); - tmpString=tmpString.substr(tmpString.find_first_of(":")+1, - string::npos); - if(showeredISHs_.second->PDGName()!=tmpString) { - cout << "AlpGenHandler::showerHardProcessVeto" << "\n" - << "Fatal error in pairing of remnant and parent hadron." << "\n" - << "Remnant = " << *(showeredRems_.second) << "\n" - << "Parent hadron = " << *(showeredISHs_.second) - << endl; - cout << showeredISHs_.second->PDGName() << endl; - cout << tmpString << endl; - } - } - return; -} - -void AlpGenHandler::printMomVec(vector momVec) { - cout << "\n\n"; - - // Label columns. - printf("%5s %9s %9s %9s %9s %9s %9s %9s %9s %9s\n", - "jet #", - "px","py","pz","E", - "eta","phi","pt","et","mass"); - - // Print out the details for each jet - for (unsigned int ixx=0; ixx ETSTOP and sum surrounding cells with -- - * DELTA(Y)**2+DELTA(PHI)**2 < RJET**2 , ET>ECCUT. - * Keep sets with ET>EJCUT and ABS(ETA)currentEvent()->... - * filling the particle pairs showeredISHs_, showeredISPs_, - * showeredRems_ and the particle pointer vector showeredFSPs_. - */ - void getShoweredParticles() const; - - /** - * Allows printing of debug output and sanity checks like - * total momentum consrvation to be carried out. - * debugLevel = -1, 0, ...5 - * = no debugging, minimal debugging, ... verbose. - */ - void doSanityChecks(int debugLevel) const; - - /** - * Given a pointer to a particle this finds all its final state - * descendents. - */ - void getDescendents(PPtr theParticle) const; - - /** - * Accumulates all descendents of tops down to the b and W - * but not including them. - */ - void getTopRadiation(PPtr theParticle) const; - - /** - * Sorts a given vector of particles by descending pT or ETJET - */ - - ParticleVector pTsort(ParticleVector unsortedVec); - pair< vector, vector > ETsort(vector unsortedetjet, vector unsortedVec); - - /* - * A function that prints a vector of Lorentz5Momenta in a fancy way - */ - void printMomVec(vector momVec); - - - /* - * A probability function for varying etclus_ about the mean value - */ - Energy etclusran_(double petc) const; - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription initAlpGenHandler; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - AlpGenHandler & operator=(const AlpGenHandler &) = delete; - -private: - - /** - * Initial-state incoming partons prior to showering - * (i.e. from lastXCombPtr). - */ - mutable PPair preshowerISPs_; - - /** - * Final-state outgoing partICLEs prior to showering - * (i.e. from lastXCombPtr). - */ - mutable ParticleVector preshowerFSPs_; - - /** - * Final-state outgoing partICLEs prior to showering _to_be_removed_ - * from preShowerFSPs_ prior to the light-parton-light-jet matching - * step. This same list is the starting point for determining - * partonsToMatch_ for the case of merging in heavy quark production. - */ - mutable ParticleVector preshowerFSPsToDelete_; - - /** - * Initial-state incoming hadrons after shower of hard process - * (eventHandler()->currentEvent()->incoming()). - */ - mutable PPair showeredISHs_; - - /** - * Initial-state incoming partons after shower of hard process - * (look for partonic children of showeredISHs_). - */ - mutable PPair showeredISPs_; - - /** - * Final-state outgoing partICLEs after shower of hard process - * (eventHandler()->currentEvent()->getFinalState()). - */ - mutable tPVector showeredFSPs_; - - /** - * Final-state outgoing partICLEs after shower of hard process - * _to_be_removed_ from showeredFSPs_ prior to the - * light-parton-light-jet matching step. This same list is the - * starting point for determining particlesToCluster_ for the - * case of merging in heavy quark production. - */ - mutable ParticleVector showeredFSPsToDelete_; - - /** - * ONLY the final-state partons from preshowerFSPs_ that are - * supposed to enter the jet-parton matching. - */ - mutable ParticleVector partonsToMatch_; - - /* - * The shower progenitors - */ - - mutable PPtr theProgenitor; - mutable PPtr theLastProgenitor; - - /** - * ONLY the final-state particles from showeredFSPs_ (and maybe - * also showeredRems_) that are supposed to go for jet clustering. - */ - mutable tPVector particlesToCluster_; - - /** - * Final-state remnants after shower of hard process - * (look for remnants initially in showeredFSPs_). - */ - mutable PPair showeredRems_; - - /** - * Pointer to the object calculating the strong coupling - */ - ShowerAlphaPtr alphaS_; - - /** - * Information extracted from the XComb object - */ - //@{ - /** - * The fixed factorization scale used in the MEs. - */ - Energy pdfScale_; - - /** - * Centre of mass energy - */ - Energy2 sHat_; - - /** - * Constant alphaS used to generate LH events - if not already - * using CKKW scale (ickkw = 1 in AlpGen for example). - */ - double alphaSME_; - //@} - - /* - * Number of rapidity segments of the calorimeter. - */ - unsigned int ncy_; - - /* - * Number of phi segments of the calorimeter. - */ - unsigned int ncphi_; - - /* - * Heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t). - */ - int ihvy_; - - /* - * Number of photons in the AlpGen process. - */ - int nph_; - - /* - * Number of higgses in the AlpGen process. - */ - int nh_; - - /* - * Jet ET cut to apply in jet clustering (in merging). - */ - mutable Energy etclus_; - - /* - * Mean Jet ET cut to apply in jet clustering (in merging). - */ - Energy etclusmean_; - - /* - * maximum deviation from mean Jet ET cut to apply in jet clustering (in merging). - */ - Energy epsetclus_; - - - - /* - * Cone size used in jet clustering (in merging). - */ - double rclus_; - - /* - * Max |eta| for jets in clustering (in merging). - */ - double etaclmax_; - - /* - * Default 1.5 factor used to decide if a jet matches a parton - * in merging: if DR(parton,jet) ncphi). - * ==> Cosine goes from +1 ---> +1 (index = 0 ---> ncphi). - */ - mutable vector cphcal_; - - /* - * Sine of phi values of calorimeter cell centres. - * Goes phi~=0 to phi~=2*pi (index = 0 ---> ncphi). - * ==> Sine goes 0 -> 1 -> 0 -> -1 -> 0 (index = 0 ---> ncphi). - */ - mutable vector sphcal_; - - /* - * Cosine of theta values of calorimeter cell centres in Y. - * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). - * ==> Cosine goes from -1 ---> +1 (index = 0 ---> ncy). - */ - mutable vector cthcal_; - - /* - * Sine of theta values of calorimeter cell centres in Y. - * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). - * ==> Sine goes from 0 ---> +1 ---> 0 (index = 0 ---> ncy). - */ - mutable vector sthcal_; - - /* - * Transverse energy deposit in a given calorimeter cell. - * First array index corresponds to rapidity index of cell, - * second array index corresponds to phi cell index. - */ - mutable vector > et_; - - /* - * For a given calorimeter cell this holds the index of the jet - * that the cell was clustered into. - */ - mutable vector > jetIdx_; - - /* - * Vector holding the Lorentz 5 momenta of each jet. - */ - mutable vector pjet_; - - /* - * Vector holding the list of FS particles resulting from - * the particle input to getDescendents. - */ - mutable ParticleVector tmpList_; - - /* - * Variables for the C++ translation of the calini_m(), calsim_m(), - * getjet_m(...) and caldel_m() functions - */ - mutable vector etjet_; - mutable double dely_, delphi_; - -}; - -} - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of AlpGenHandler. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of AlpGenHandler. */ - typedef Herwig::QTildeShowerHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the AlpGenHandler class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "Herwig::AlpGenHandler"; } - /** - * The name of a file containing the dynamic library where the class - * AlpGenHandler is implemented. It may also include several, space-separated, - * libraries if the class AlpGenHandler 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 "AlpGenHandler.so"; } -}; - -/** @endcond */ - -} - -#endif /* HERWIG_AlpGenHandler_H */ diff --git a/Contrib/AlpGen/AlpGenToLH.cc b/Contrib/AlpGen/AlpGenToLH.cc deleted file mode 100644 --- a/Contrib/AlpGen/AlpGenToLH.cc +++ /dev/null @@ -1,1548 +0,0 @@ -//A few standard headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -double sqr(double x); - -inline int nInt(double x) { - int theCeiling=int(ceil(x)); - int theFloor=int(floor(x)); - if((theCeiling-theFloor!=1&&theCeiling!=theFloor) - ||theCeiling-x>1.0||x-theFloor>1.0||xtheCeiling) { - cout << "nInt:\n" - << "Fatal double to integer conversion error.\n" - << "input double = " << x << "\n" - << "integer ceiling = " << theCeiling << "\n" - << "integer floor = " << theFloor << "\n" - << "Quitting ..."; - exit(1); - } - return (theCeiling-x) < (x-theFloor) ? theCeiling : theFloor; -} - -int ndnsToLHAPDF(int ndns); - -string ndnsToLHAPDF_str(int ndns); - - -double parstrToparval(string varName, - vector * parstrPtr, - vector * parvalPtr); - -void doIndividualHardProcessAssignments(int ihrd , double * nup, - vector * idup , vector * istup, - vector * mothup1, vector * mothup2, - vector * icolup1, vector * icolup2, - vector > * pup, - vector masses , int itopprc); - -//*****************************// -//*****************************// -//*****************************// -// // -// ATTENTION!!!! // -// ATTENTION!!!! // -// ATTENTION!!!! // -// // -// Remember to uncomment all // -// of the currently commented // -// commands outputting to // -// the HW++ input file for // -// the variables not yet // -// declared and interfaced // -// in the AlpGenHandler!! // -// These should only be the // -// ones commented out by _4_ // -// consecutive forward slashes // -// '////' in the function // -// writeHWPPinFile(...) // -// // -// These are only commented // -// as the AlpGenHandler isn't // -// ready for them yet! // -// // -//*****************************// -//*****************************// -//*****************************// - -void writeHWPPinFile(string prefix, int ihrd, int unwev, - int lhapdf, string lhapdfstr, int idbmup0, int idbmup1, int idwtup, - double aqcdup, int nloop, - vector * massesPtr, - vector * parvalPtr, - vector * parstrPtr); - -string trim(string theString); - -int main(int argc, char *argv[]) { - - bool usePowhegBoxConventions(true); // Control - int debugging(3); // To validate - - cout << "\n"; - cout << "------------------------------------------------------------------\n"; - cout << " AlpGenToLH: Convert Alpgen Les Houches to Herwig Les Houches \n"; - cout << " v2.0-beta \n"; - cout << "------------------------------------------------------------------\n"; - cout << "\n"; - char* prefix; - - - if(argv[1]) { prefix = argv[1]; } else { - cout << "Use: ./AlpGenToLH [input string] [number of events (optional)]\n"; exit(1); - cout << "Note: As of version 2, the .stat and _unw.par files are " - << "required to read the generation parameters.\n"; - } - int maxevents(0); int eventcount(0); - if(argc>2) { maxevents=(atoi(argv[2])); } - - string lheFilename = string(prefix) + string(".lhe"); - string unwFilename = string(prefix) + string(".unw"); - string unwparFilename = string(prefix) + string("_unw.par"); - string statFilename = string(prefix) + string(".stat"); - - cout << "Opening input files ...\n"; - cout << "-----------------------\n"; - cout << "Unweighted events in " << unwFilename << ".\n" - << "Generation settings in " - << unwparFilename << " and " << statFilename << ".\n\n"; - - ifstream unwStream; - ifstream unwparStream; - ifstream statStream; - ofstream lheStream; - unwStream.open(unwFilename.c_str()); - unwparStream.open(unwparFilename.c_str()); - statStream.open(statFilename.c_str()); - lheStream.open(lheFilename.c_str()); - if(!unwStream) { - cerr << "error: Failed to open input file " << unwFilename << "\n"; - exit(1); - } - if(!unwparStream) { - cerr << "error: Failed to open input file " << unwparFilename << "\n"; - exit(1); - } - if(!statStream) { - cerr << "error: Failed to open input file " << statFilename << "\n"; - exit(1); - } - - // ******************************************************************** // - // Dump the AlpGen *_unw.par file into the LH header (it's not so big). // - // ******************************************************************** // - - string tmpString; - lheStream << "\n"; - lheStream << "\n"; - unwparStream.close(); - - // ***************************************** // - // Read in all relevant info from *_unw.par. // - // ***************************************** // - - int ihrd; // AlpGen convention hard process code. - double mc,mb,mt,mw,mz,mh; // C, B, Top, W, Z & Higgs mass from *_unw.par - double avgwgt,errwgt; // Average weight and its error. - int unwev; // Number of unweighted events. - double totlum; // Effective luminosity. - vector parval(200,-999.0); // AlpGen parameters. - vector parstr(200,"----"); // AlpGen parameter (variable) names. - vector alpgenParticleMasses; - - unwparStream.open(unwparFilename.c_str()); - while(unwparStream) { - getline(unwparStream,tmpString); - if(tmpString.find("hard process code") != string::npos) { - tmpString=tmpString.substr(0,tmpString.find("!")); - tmpString=trim(tmpString); - ihrd=atoi(tmpString.c_str()); - } - if(tmpString.find("mc,mb,mt,mw,mz,mh") != string::npos) { - tmpString=trim(tmpString.substr(0,tmpString.find("!"))); - mc=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mc); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - mb=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mb); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - mt=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mt); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - mw=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mw); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - mz=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mz); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - mh=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - alpgenParticleMasses.push_back(mh); - } - if(tmpString.find("Crosssection +- error (pb)") != string::npos) { - tmpString=trim(tmpString.substr(0,tmpString.find("!"))); - avgwgt=atof(trim(tmpString.substr(0,tmpString.find(" "))).c_str()); - errwgt=atof(trim(tmpString.substr(tmpString.find(" "))).c_str()); - } - if(tmpString.find("unwtd events, lum (pb-1)") != string::npos) { - tmpString=trim(tmpString.substr(0,tmpString.find("!"))); - unwev=atoi(trim(tmpString.substr(0,tmpString.find(" "))).c_str()); - totlum=atof(trim(tmpString.substr(tmpString.find(" "))).c_str()); - } - } - if(maxevents > unwev) { - cout << "-------------------------------\n"; - cout << "requested " << maxevents << " > " << unwev << " (contained in file), will use all events.\n"; maxevents = 0; } - - if(debugging>=4) { - cout << "\nDebugging initial reading of *_unw.par:\n"; - cout << "ihrd = " << ihrd << "\n"; - cout << "mc,mb,mt,mw,mz,mh = " - << mc << " " << mb << " " - << mt << " " << mw << " " - << mz << " " << mh << "\n"; - cout << "Cross section +/- error = " - << avgwgt << " +/- " << errwgt << "\n"; - cout << "Number of unweighted events = " << unwev << "\n"; - cout << "Effective luminosity = " << totlum << "\n"; - } - unwparStream.close(); - - unwparStream.open(unwparFilename.c_str()); - int index; - while(unwparStream) { - getline(unwparStream,tmpString); - if(tmpString.find("!")==string::npos|| - tmpString.find("hard process code")!=string::npos|| - tmpString.find("mc,mb,mt,mw,mz,mh")!=string::npos|| - tmpString.find("Crosssection +- error (pb)")!=string::npos|| - tmpString.find("unwtd events, lum (pb-1)")!=string::npos) continue; - tmpString=trim(tmpString); - if(debugging>=4) cout << "\nDebugging reading paramters in *_unw.par:\n"; - if(debugging>=4) cout << "File says: " << tmpString << "\n"; - index = atoi((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - parval[index]=atof((tmpString.substr(0,tmpString.find_first_of(" "))).c_str()); - tmpString=trim(tmpString.substr(tmpString.find_first_of("!")+1)); - parstr[index]=tmpString; - if(debugging>=4) cout << "We say: " - << index << " " - << parval[index] << " " - << parstr[index] << "\n\n\n\n\n"; - } - unwparStream.close(); - - // Variables defined in parval array read from *_unw.par: - - // PDG codes for the beam particles. - int idbmup[2]={0,0}; - if(parstrToparval("ih1",&parstr,&parval)==1) idbmup[0] = 2212; - else if(parstrToparval("ih1",&parstr,&parval)==-1) idbmup[0] = -2212; - else idbmup[0] = 2212; - if(parstrToparval("ih2",&parstr,&parval)==1) idbmup[1] = 2212; - else if(parstrToparval("ih2",&parstr,&parval)==-1) idbmup[1] = -2212; - else idbmup[1] = 2212; - - // Energies of the beam particles --- implementation implicitly assumes - // these are equal! - double ebmup[2]={0,0}; - ebmup[0]=parstrToparval("ebeam",&parstr,&parval); - ebmup[1]=ebmup[0]; - - // LH accord pdf info variables for block: - int pdfgup[2]; - pdfgup[0]=-1; // Simply set to 1 as in POWHEG-BOX. - pdfgup[1]=-1; - int pdfsup[2]; - // LHAPDF index: (note in POWHEG-BOX it is set to just -1). - pdfsup[0]=ndnsToLHAPDF(int(parstrToparval("ndns",&parstr,&parval))); - pdfsup[1]=pdfsup[0]; - string lhastring = ndnsToLHAPDF_str(int(parstrToparval("ndns",&parstr,&parval))); - // LH accord flag defining weight scheme: - // N.B. AlpGen alpsho.f UPINIT uses idwtup = 3 (this is likely better from the - // point of view of combining events of diff multiplicity together in real life - // i.e. in ATLAS - so we should probably use it!). - int idwtup( 3); // As in POWHEG-BOX withnegweights 0 mode: unit wgts +1 only. - // int idwtup(-4); // As in POWHEG-BOX withnegweights 1 mode: +/- |xsecup| wgts only. - // Number of processes in the file (assume all one process as - // with alpsho.f UPINIT). - int nprup(1); - // Cross section, it's error, the maximum weight in the file. - double xsecup,xerrup,xmaxup; - xsecup = avgwgt; - xerrup = errwgt; - xmaxup = xsecup; - // Process id code (to be augmented by jet multiplicity - see just below). - int lprup(ihrd*100); - - // We augment the process code (for the LH file only) by the number of - // (light) jets, just in case we end up connecting many different files - // to the shower MC in parallel (otherwise it likely won't distinguish - // between X+0,1,2,3,...,n jet processes). - int njets(int(parstrToparval("njets",&parstr,&parval))); - lprup+=njets; - - // Write out some bits of info to the screen. - cout << "No. of jets: " << njets << "\n"; - cout << "Total xsec in pb (all processes): " << scientific - << xsecup << " +/- " << xerrup << "\n\n"; - - // NOW write out block: - lheStream << "\n"; - lheStream << setw(9) << idbmup[0]; - lheStream << setw(9) << idbmup[1]; - lheStream << scientific << setprecision(5) << setw(13) << ebmup[0]; - lheStream << scientific << setprecision(5) << setw(13) << ebmup[1]; - lheStream << setw(7) << pdfgup[0]; - lheStream << setw(7) << pdfgup[1]; - if(usePowhegBoxConventions) { - lheStream << setw(7) << -1; - lheStream << setw(7) << -1; - } else { - lheStream << setw(7) << pdfsup[0]; - lheStream << setw(7) << pdfsup[1]; - } - lheStream << setw(7) << idwtup; - lheStream << setw(7) << nprup << "\n"; - - lheStream << scientific << setprecision(5) << setw(13) << xsecup; - lheStream << scientific << setprecision(5) << setw(13) << xerrup; - if(usePowhegBoxConventions) - lheStream << scientific << setprecision(5) << setw(13) << 1.0; - else // else put in more info (xmaxup=xsecup). - lheStream << scientific << setprecision(5) << setw(13) << xmaxup; - lheStream << setw(7) << lprup << "\n"; - - lheStream << "\n"; - - // ************************************************* // - // All done with the init section of the LH file! // - // ************************************************* // - - // ***************************************************************** // - // To write the HW++ .in file we have everything we could possibly // - // want except maybe the QCD coupling and no. of loops for running. // - // These are the only numbers we get / use from *.stat now. // - // ***************************************************************** // - - double aqedup(-999),aqedStat(-999); - double aqcdup(-999),aqcdStat(-999); - int nloop(-999); - - // Fish around for the QCD and QED alphas in .stat. - while(statStream) { - getline(statStream,tmpString); - if(tmpString.find("as(MZ)") != string::npos) { - aqcdup=atof(trim(tmpString.substr(tmpString.find_last_of("=")+1, - tmpString.length())).c_str()); - tmpString=trim(tmpString.substr(tmpString.find_first_of("nloop="))); - tmpString=trim(tmpString.substr(tmpString.find_first_of(" "))); - tmpString=trim(tmpString.substr(0,tmpString.find_first_of("]"))); - nloop=atoi(tmpString.c_str()); - } - if(tmpString.find("aem(mZ)") != string::npos) { - tmpString=tmpString.substr(tmpString.find("aem(mZ)=")); - tmpString=tmpString.substr(tmpString.find_first_of(" ")); - tmpString=trim(tmpString); - aqedup=atof(tmpString.c_str()); - aqedup=1/aqedup; - } - } - statStream.close(); - aqedStat=aqedup; - aqcdStat=aqcdup; - - // Write out a couple more bits of info to the screen. - cout << "aqcdup [as(MZ)] from stat file: " << aqcdup << "\n"; - cout << "nloop for as from stat file : " << nloop << "\n"; - cout << "aqedup [inverse] from stat file: " << 1/aqedup << "\n"; - cout << "\n"; - - writeHWPPinFile(prefix,ihrd,unwev,pdfsup[0],lhastring, idbmup[0], idbmup[1], idwtup, - aqcdup,nloop, - &alpgenParticleMasses, - &parval,&parstr); - - // *********************************************************** // - // All done writing the HW++ .in file! // - // *********************************************************** // - - // *********************************************************** // - // Start reading AlpGen events and writing them as LH events: // - // *********************************************************** // - - int nupMax(20); - - // First line of an event contains: - double nup(0),idprup(0),xwgtup(0),scalup(0); - - // Subsequent lines for particle content contain: - vector idup,istup; - vector mothup1,mothup2; // WARNING: not implemented ... YET! - vector icolup1,icolup2; - vector vtimup,spinup; // WARNING: not implemented (but safe). - vector > pup; - pup.resize(5); - for (int ixx = 0; ixx <= 4; ++ixx) - pup[ixx].resize(nupMax); - - // Initialise pup matrix (not really necessary): - for(unsigned int jup=0; jup < nupMax; jup++) - for(unsigned int ixx=0; ixx<5; ixx++) pup[ixx][jup]=0; - - // Control reading AlpGen file: - int iup(0); - int counter(0); - bool readInWholeEvent(false),beginNewEvent(true); - double stringdoub; - - // Needed as input to doIndividualHardProcessAssignments only: - int itopprc(nInt(parstrToparval("itopprc",&parstr,&parval))); - - while(unwStream && (eventcount < maxevents || maxevents==0)) { // So long as we haven't hit the EOF do ... - - if(beginNewEvent) { - // Rest / set control variables: - beginNewEvent=false; - readInWholeEvent=false; - counter=0; - iup=0; - // Reset variables for first line of LH event: - nup=0; idprup=0; xwgtup=0; scalup=0; aqedup=0; aqcdup=0; - // Reset variables for all individual particles in LH event: - idup.clear() ; istup.clear(); - mothup1.clear(); mothup2.clear(); - icolup1.clear(); icolup2.clear(); - vtimup.clear() ; spinup.clear(); - for(unsigned int jup=0; jup < nupMax; jup++) - for(unsigned int ixx=0; ixx<5; ixx++) pup[ixx][jup]=0; - } - - // Read in next thing starting from last position in - // the file (int/real) as a double - unwStream >> stringdoub; - - // counter counts the number of numbers read-in for a given - // event. On starting to read a new event counter will be 0. - counter++; - - switch (counter) { - case 1: if(int(stringdoub)!=0) { -// if(int(stringdoub)%100==0) -// cout << "Processed " << fixed << setprecision(0) -// << stringdoub/unwev*100 -// << " % of events ..." << "\r" << flush; - } - break; - case 2: idprup = stringdoub; break; - case 3: nup = stringdoub; break; - case 4: xwgtup = stringdoub; break; - case 5: scalup = stringdoub; break; - // N.B. There are no aqedup / aqcdup variables from AlpGen. - - // Initial state particle +z direction: - case 6: idup.push_back(stringdoub) ; - istup.push_back(-1); break; - case 7: icolup1.push_back(stringdoub); - mothup1.push_back(0); break; // ATTENTION: not given by AlpGen - case 8: icolup2.push_back(stringdoub); - mothup2.push_back(0); break; // ATTENTION: not given by AlpGen - case 9: pup[2][iup]=stringdoub ; - pup[3][iup]=fabs(stringdoub) ; iup++ ; break; - - // Initial state particle -z direction: - case 10: idup.push_back(stringdoub) ; - istup.push_back(-1); break; - case 11: icolup1.push_back(stringdoub); - mothup1.push_back(0); break; // ATTENTION: not given by AlpGen - case 12: icolup2.push_back(stringdoub); - mothup2.push_back(0); break; // ATTENTION: not given by AlpGen - case 13: pup[2][iup]=stringdoub; - pup[3][iup]=fabs(stringdoub) ; iup++ ; break; - } - - if(debugging<5) idprup=lprup; - - if(counter<14) continue; - - // Final state particles: - if(counter==0+7*iup) idup.push_back(stringdoub); - // istup gets assigned later on to just -1/+1 (I.S. / F.S.). - if(counter==1+7*iup) { icolup1.push_back(stringdoub); - mothup1.push_back(1.); } // ATTENTION: not given by AlpGen - if(counter==2+7*iup) { icolup2.push_back(stringdoub); - mothup2.push_back(2.); } // ATTENTION: not given by AlpGen - if(counter==3+7*iup) pup[0][iup] = stringdoub; - if(counter==4+7*iup) pup[1][iup] = stringdoub; - if(counter==5+7*iup) pup[2][iup] = stringdoub; - if(counter==6+7*iup) pup[4][iup] = stringdoub; - if(counter==6+7*iup) istup.push_back(1.); - if(counter==6+7*iup) iup+=1; - if(counter==7*nup-1) readInWholeEvent = true; - - for(int jup = 0; jup < nup; jup++) { - pup[3][jup] = sqrt( sqr(pup[4][jup]) + sqr(pup[0][jup]) - + sqr(pup[1][jup]) + sqr(pup[2][jup]) ); - vtimup.push_back(0.); // ATTENTION: not implemented - so taking - spinup.push_back(9.); // POWHEG-BOX default values (should be v.safe). - } - - // ***************************************************************** // - // Now consider assignments specific to individual hard processes: // - // ***************************************************************** // - - if(readInWholeEvent) - doIndividualHardProcessAssignments(ihrd, &nup, &idup, &istup, - &mothup1 , &mothup2, - &icolup1 , &icolup2, - &pup , - alpgenParticleMasses, itopprc); - - if(readInWholeEvent) { - lheStream << "\n"; - if(debugging>=5) { - lheStream << nup << "\t" << idprup << "\t" << xwgtup << "\t" - << scalup << "\t" << "0.007297352" << "\t" << "0.118\n"; - } else { - // Bit about signing of xwgtup here is redundant as - // AlpGen only gives +ve weight events ... - double signOfXwgtup = xwgtup >= 0 ? 1 : -1; - xwgtup = idwtup==3 ? 1 : xsecup*signOfXwgtup; - // N.B. There are no aqedup / aqcdup variables from AlpGen - // events only the stat file has related information. - aqedup=aqedStat; - aqcdup=aqcdStat; - if(usePowhegBoxConventions) aqedup=-1; - lheStream << setw(7) << int(nup); - lheStream << setw(7) << int(idprup); - lheStream << scientific << setprecision(5) << setw(13) << xwgtup; - lheStream << scientific << setprecision(5) << setw(13) << scalup; - lheStream << scientific << setprecision(5) << setw(13) << aqedup; - lheStream << scientific << setprecision(5) << setw(13) << aqcdup; - lheStream << "\n"; - } - for(int jup = 0; jup < nup; jup++) { - if(debugging>=5) { - lheStream << idup[jup] << "\t" << istup[jup] << "\t" - << mothup1[jup] << "\t" << mothup2[jup] << "\t" - << icolup1[jup] << "\t" << icolup2[jup] << "\t"; - lheStream << pup[0][jup] << "\t" << pup[1][jup] << "\t" - << pup[2][jup] << "\t" << pup[3][jup] << "\t" - << pup[4][jup] << "\t"; - lheStream << "0" << "\t" << "1\n"; - } else { - if(icolup1[jup]!=0) icolup1[jup]+=500; - if(icolup2[jup]!=0) icolup2[jup]+=500; - lheStream << setw(8) << int(idup[jup]); - lheStream << setw(6) << int(istup[jup]) - << setw(6) << int(mothup1[jup]) - << setw(6) << int(mothup2[jup]) - << setw(6) << int(icolup1[jup]) - << setw(6) << int(icolup2[jup]); - lheStream << scientific << setprecision(9) << setw(17) << pup[0][jup]; - lheStream << scientific << setprecision(9) << setw(17) << pup[1][jup]; - lheStream << scientific << setprecision(9) << setw(17) << pup[2][jup]; - lheStream << scientific << setprecision(9) << setw(17) << pup[3][jup]; - lheStream << scientific << setprecision(9) << setw(17) << pup[4][jup]; - lheStream << scientific << setprecision(5) << setw(13) << vtimup[jup]; - lheStream << scientific << setprecision(3) << setw(11) << vtimup[jup]; - lheStream << "\n"; - } - } - lheStream << "\n"; - eventcount++; - cout << "Processed " << eventcount << " events ..." << "\r" << flush; - beginNewEvent=true; - } - } - - cout << "\n\n"; - - if( maxevents!=0 ) { - cout << "All done (" << maxevents << " out of " << unwev << " events).\n"; - } else { - cout << "All done (" << eventcount << " events).\n"; - } - - cout << "\n\n" - << "Wrote a LH event file " << lheFilename - << " and a HW++ MLM merging input file " - << prefix+string(".in") << ".\n\n"; - return 0; - -} - - -inline double sqr(double x) { return x*x; } - -int ndnsToLHAPDF(int ndns) { - // The information in this function is based on - // subroutine PRNTSF from alplib/alppdf.f, LHAPDF's - // PDFsets.index and, finally, the .stat output that - // results when the relevant ndns value is entered - // in the input file. - string Set("no PDF set found"); - double Lambda_4(0),Lambda_5_2loop(0); - string Scheme("no PDF scheme"); - int LHAPDFindex(-999); - string tmpString(""); - - if(ndns==1) { - Set = "CTEQ4M" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = 19150; - } else if(ndns==2) { - Set = "CTEQ4L" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = 19170; - } else if(ndns==3) { - Set = "CTEQ4HJ" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==4) { - Set = "CTEQ5M" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 19050; - } else if(ndns==5) { - Set = "CTEQ5L" ; Lambda_4 = 0.192 ; Lambda_5_2loop = 0.144 ; Scheme = "MS" ; - LHAPDFindex = 19070; - } else if(ndns==6) { - Set = "CTEQ5HJ" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==7) { - Set = "CTEQ6M" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex= 10050; - } else if(ndns==8) { - Set = "CTEQ6L" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10041; - } else if(ndns==9) { - Set = "CTEQ6L1" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = 10042; - } else if(ndns>=10&&ndns<=50) { - Set = "CTEQ6xx" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10150+(ndns-10); - } else if(ndns==101) { - Set = "MRST99" ; Lambda_4 = 0.321 ; Lambda_5_2loop = 0.220 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==102) { - Set = "MRST01" ; Lambda_4 = 0.342 ; Lambda_5_2loop = 0.239 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==103) { - Set = "MRST01" ; Lambda_4 = 0.310 ; Lambda_5_2loop = 0.214 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==104) { - Set = "MRST01" ; Lambda_4 = 0.378 ; Lambda_5_2loop = 0.267 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==105) { - Set = "MRST01J" ; Lambda_4 = 0.378 ; Lambda_5_2loop = 0.267 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==106) { - Set = "MRST02LO" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==201) { - Set = "MSTW2008lo" ; Lambda_4 = 0.322 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21000; - } else if(ndns==202) { - Set = "MSTW2008nlo" ; Lambda_4 = 0.365 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21100; - } else if(ndns>=203&&ndns<=242) { - Set = "MSTW2008lo68cl"; Lambda_4 = 0.322 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21000+(ndns-202); - } else if(ndns==243) { - Set = "MRST LO*" ; Lambda_4 = 0.365 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 20650; - } else if(ndns==244) { - Set = "MRST LO**" ; Lambda_4 = 0.280 ; Lambda_5_2loop = 0.190 ; Scheme = "MS" ; - LHAPDFindex = 20651; - } else if(ndns==301 ) { - Set = "CTQ6.6" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10550; - } else if(ndns>=302&&ndns<=345) { - Set = "CTQ66" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10550+(ndns-301); - } else if(ndns==346) { - Set = "CT09MC1" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = 10771; - } else if(ndns==347) { - Set = "CT09MC2" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10772; - } - - /*cout << "-------------------------------\n"; - cout << "ndnsToLHAPDF found: \n"; - cout << "PDF set = " << Set << "\n"; - cout << "ndns index = " << ndns << "\n"; - cout << "LHAPDF index = " << LHAPDFindex << "\n"; - cout << "-------------------------------\n\n";*/ - return LHAPDFindex; - -} - - -string ndnsToLHAPDF_str(int ndns) { - // The information in this function is based on - // subroutine PRNTSF from alplib/alppdf.f, LHAPDF's - // PDFsets.index and, finally, the .stat output that - // results when the relevant ndns value is entered - // in the input file. - string Set("no PDF set found"); - double Lambda_4(0),Lambda_5_2loop(0); - string Scheme("no PDF scheme"); - int LHAPDFindex(-999); - string tmpString(""); - string lhastring(""); - - if(ndns==1) { - Set = "CTEQ4M" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = 19150; - lhastring = "cteq6"; - } else if(ndns==2) { - Set = "CTEQ4L" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = 19170; - lhastring = "cteq6l1"; - } else if(ndns==3) { - Set = "CTEQ4HJ" ; Lambda_4 = 0.298 ; Lambda_5_2loop = 0.202 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "cteq6l1"; - } else if(ndns==4) { - Set = "CTEQ5M" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 19050; - lhastring = "cteq6l1"; - } else if(ndns==5) { - Set = "CTEQ5L" ; Lambda_4 = 0.192 ; Lambda_5_2loop = 0.144 ; Scheme = "MS" ; - LHAPDFindex = 19070; - lhastring = "cteq6l1"; - - } else if(ndns==6) { - Set = "CTEQ5HJ" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "cteq6l1"; - } else if(ndns==7) { - Set = "CTEQ6M" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex= 10050; - lhastring = "cteq6"; - } else if(ndns==8) { - Set = "CTEQ6L" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10041; - lhastring = "cteq6l1"; - } else if(ndns==9) { - Set = "CTEQ6L1" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = 10042; - lhastring = "cteq6l1"; - } else if(ndns>=10&&ndns<=50) { - Set = "CTEQ6xx" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10150+(ndns-10); - lhastring = "cteq6l1"; - } else if(ndns==101) { - Set = "MRST99" ; Lambda_4 = 0.321 ; Lambda_5_2loop = 0.220 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "mrst99"; - } else if(ndns==102) { - Set = "MRST01" ; Lambda_4 = 0.342 ; Lambda_5_2loop = 0.239 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "mrst01"; - } else if(ndns==103) { - Set = "MRST01" ; Lambda_4 = 0.310 ; Lambda_5_2loop = 0.214 ; Scheme = "MS" ; - LHAPDFindex = -99999; - } else if(ndns==104) { - Set = "MRST01" ; Lambda_4 = 0.378 ; Lambda_5_2loop = 0.267 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "mrst01"; - } else if(ndns==105) { - Set = "MRST01J" ; Lambda_4 = 0.378 ; Lambda_5_2loop = 0.267 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "mrst01j"; - } else if(ndns==106) { - Set = "MRST02LO" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = -99999; - lhastring = "mrst02lo"; - } else if(ndns==201) { - Set = "MSTW2008lo" ; Lambda_4 = 0.322 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21000; - } else if(ndns==202) { - Set = "MSTW2008nlo" ; Lambda_4 = 0.365 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21100; - lhastring = "mstw2008nlo"; - } else if(ndns>=203&&ndns<=242) { - Set = "MSTW2008lo68cl"; Lambda_4 = 0.322 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 21000+(ndns-202); - lhastring = "mstw2008lo68cl"; - } else if(ndns==243) { - Set = "MRST LO*" ; Lambda_4 = 0.365 ; Lambda_5_2loop = 0.255 ; Scheme = "MS" ; - LHAPDFindex = 20650; - lhastring = "MRST2007lomod"; - } else if(ndns==244) { - Set = "MRST LO**" ; Lambda_4 = 0.280 ; Lambda_5_2loop = 0.190 ; Scheme = "MS" ; - LHAPDFindex = 20651; - lhastring = "MRSTMCal"; - - } else if(ndns==301 ) { - Set = "CTQ6.6" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10550; - lhastring = "cteq66"; - } else if(ndns>=302&&ndns<=345) { - Set = "CTQ66" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10550+(ndns-301); - lhastring = "cteq66"; - } else if(ndns==346) { - Set = "CT09MC1" ; Lambda_4 = 0.215 ; Lambda_5_2loop = 0.167 ; Scheme = "MS" ; - LHAPDFindex = 10771; - lhastring = "CT09MC1"; - } else if(ndns==347) { - Set = "CT09MC2" ; Lambda_4 = 0.326 ; Lambda_5_2loop = 0.226 ; Scheme = "MS" ; - LHAPDFindex = 10772; - lhastring = "CT09MC2"; - } - - cout << "-------------------------------\n"; - cout << "ndnsToLHAPDF found: \n"; - cout << "PDF set = " << Set << "\n"; - cout << "ndns index = " << ndns << "\n"; - cout << "LHAPDF index = " << LHAPDFindex << "\n"; - cout << "WARNING: YOU MAY HAVE TO ENTER THE PDF NAME MANUALLY IN THE INPUT FILES!" << endl; - cout << "-------------------------------\n\n"; - return lhastring; - -} - - -double parstrToparval(string varName, - vector * parstrPtr, - vector * parvalPtr) { - for(unsigned int index=0; indexsize(); index++) - if(varName==parstrPtr->at(index)) - return parvalPtr->at(index); - - return -999.0; -} - -string trim(string theString) { - int endStr = theString.find_last_not_of(" "); - int beginStr = theString.find_first_not_of(" "); - if(beginStr==0&&endStr==theString.length()-1) return theString; // No lead / trail spaces. - theString = theString.substr(beginStr,endStr-beginStr+1); - return theString; -} - -void writeHWPPinFile(string prefix, int ihrd, int unwev, - int lhapdf, string lhapdfstr, int idbmup0, int idbmup1, int idwtup, - double aqcdup, int nloop, - vector * massesPtr, - vector * parvalPtr, - vector * parstrPtr) { - ofstream hwpp; - hwpp.open(string(prefix+".in").c_str()); - - hwpp << "#############################################################\n"; - hwpp << "# Create an event generator taking the default EventGenerator #\n"; - hwpp << "# as the starting point ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Generators\n"; - hwpp << "# Copy the default EventGenerator with its settings to a new \n"; - hwpp << "# which will be the basis of the one we use for showering: \n"; - hwpp << "cp EventGenerator theGenerator\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Create a LH event handler (set up & assigned below) ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/EventHandlers\n"; - hwpp << "library LesHouches.so\n"; - hwpp << "create ThePEG::LesHouchesEventHandler theLesHouchesHandler\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Create a LH reader (set up & assigned below) ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/EventHandlers\n"; - hwpp << "library LesHouches.so\n"; - hwpp << "create ThePEG::LesHouchesFileReader theLHReader\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Create an AlpGenHandler (set up & assigned below) ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Shower\n"; - hwpp << "library AlpGenHandler.so\n"; - hwpp << "create Herwig::AlpGenHandler AlpGenHandler\n"; - hwpp << "set /Herwig/Shower/AlpGenHandler:ShowerModel /Herwig/Shower/ShowerModel\n"; - hwpp << "set /Herwig/Shower/AlpGenHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Create an LHAPDF (set up & assigned below) ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Partons\n"; - hwpp << "create ThePEG::LHAPDF thePDFset ThePEGLHAPDF.so\n"; - hwpp << "\n"; - hwpp << "############################################################\n"; - hwpp << "# Create a cuts object ... #\n"; - hwpp << "############################################################\n"; - hwpp << "cd /Herwig/EventHandlers\n"; - hwpp << "create ThePEG::Cuts /Herwig/Cuts/NoCuts\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Setup the LH event handler ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/EventHandlers\n"; - hwpp << "insert theLesHouchesHandler:LesHouchesReaders 0 theLHReader\n"; - if(idwtup==3) { - hwpp << "set theLesHouchesHandler:WeightOption UnitWeight\n"; - } else if(idwtup==-3) { - hwpp << "set theLesHouchesHandler:WeightOption NegUnitWeight\n"; - } else if(idwtup==4) { - hwpp << "set theLesHouchesHandler:WeightOption VarWeight\n"; - } else { - hwpp << "set theLesHouchesHandler:WeightOption VarNegWeight\n"; - } - // hwpp << "set theLesHouchesHandler:PartonExtractor " - // << "/Herwig/Partons/QCDExtractor\n"; - hwpp << "set theLesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor\n"; - - hwpp << "set theLesHouchesHandler:CascadeHandler " - << "/Herwig/Shower/AlpGenHandler\n"; - hwpp << "set theLesHouchesHandler:HadronizationHandler " - << "/Herwig/Hadronization/ClusterHadHandler\n"; - hwpp << "set theLesHouchesHandler:DecayHandler " - << "/Herwig/Decays/DecayHandler\n"; - hwpp << "\n"; - /* hwpp << "#############################################################\n"; - hwpp << "# Set up the Evolver to veto hard emissions > scalup ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Shower\n"; - hwpp << "# MaxTry 100 sets the maximum number of times to try \n"; - hwpp << "# showering a given shower tree to 100. \n"; - hwpp << "# HardVetoMode Yes to veto emissions with pT greater than pT_max.\n"; - hwpp << "# HardVetoScaleSource Read means pT_max comes from hepeup.SCALUP.\n"; - hwpp << "# This is what you need to set _along_with_ HardVetoMode Yes in \n"; - hwpp << "# the case of Powheg external events _AND_ mc@nlo (we know this \n"; - hwpp << "# from looking at the *MCinput file that mc@nlo generates). \n"; - hwpp << "# MeCorrMode No turns off ME corrs. IntrinsicPtGaussian 2.2*GeV \n"; - hwpp << "# is the RMS of intrinsic pT of Gaussian distribution: \n"; - hwpp << "# 2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS) \n"; - // hwpp << "set Evolver:MaxTry 100\n"; - // hwpp << "set Evolver:HardVetoMode Yes\n"; - // hwpp << "set Evolver:HardVetoScaleSource Read\n"; - // hwpp << "set Evolver:HardVetoReadOption PrimaryCollision\n"; - // hwpp << "set Evolver:MECorrMode No\n"; - hwpp << "# Intrinsic pT etc should be set as part of a tune i.e. it \n"; - hwpp << "# should either be left alone (default) or set by reading in \n"; - hwpp << "# one of the tunes before theGenerator is created by copying \n"; - hwpp << "# EventGenerator (second line of this file). The following \n"; - hwpp << "# settings were extracted from LHC-UE-EE-3-CTEQ6L1.in - In \n"; - hwpp << "# light of some bad experience with MPI we prefer to set \n"; - hwpp << "# these here manually rather than read try to read that .in. \n"; - if(idbmup0 == 2212 && idbmup1 == -2212) { - hwpp << "#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.26 \n"; - hwpp << "#set /Herwig/UnderlyingEvent/UECuts:MHatMin 4.52 \n"; - hwpp << "#set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 1.9*GeV \n"; - } else { - hwpp << "#set /Herwig/UnderlyingEvent/KtCut:MinKT 2.752 \n"; - hwpp << "#set /Herwig/UnderlyingEvent/UECuts:MHatMin 5.504 \n"; - hwpp << "#set /Herwig/Shower/Evolver:IntrinsicPtGaussian 2.34*GeV \n"; - } - hwpp << "# Colour reconnection (re)settings \n"; - hwpp << "#set /Herwig/Hadronization/ColourReconnector:ColourReconnection Yes \n"; - hwpp << "#set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.61\n"; - hwpp << "# Colour Disrupt settings \n"; - hwpp << "#set /Herwig/Partons/RemnantDecayer:colourDisrupt 0.75 \n"; - hwpp << "# Inverse hadron radius \n"; - hwpp << "#set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.35 \n"; - hwpp << "#set /Herwig/UnderlyingEvent/MPIHandler:softInt Yes \n"; - hwpp << "#set /Herwig/UnderlyingEvent/MPIHandler:twoComp Yes \n"; - hwpp << "#set /Herwig/UnderlyingEvent/MPIHandler:DLmode 2 \n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Set up kinematics reconstructor (relevant only to mc@nlo) #\n"; - hwpp << "#############################################################\n"; - hwpp << "# Options for QTildeReconstructor - not needed for Powheg but\n"; - hwpp << "# critical for mc@nlo. If using Powheg you may either leave \n"; - hwpp << "# the next two settings as they are or comment them out as \n"; - hwpp << "# you wish, for mc@nlo though you must leave them as they \n"; - hwpp << "# are! ReconstructionOption General was the old default, it \n"; - hwpp << "# ignores the colour structure for all processes - mc@nlo \n"; - hwpp << "# will give you garbage unless you set this! \n"; - hwpp << "# ReconstructionOption Colour is the new default - use the \n"; - hwpp << "# colour structure of the process to determine the \n"; - hwpp << "# reconstruction procedure. InitialInitialBoostOption \n"; - hwpp << "# determines how the boost from the system before ISR to that\n"; - hwpp << "# after ISR is applied. mc@nlo requires the old kinematics \n"; - hwpp << "# reconstruction method: \n"; - hwpp << "# InitialInitialBoostOption LongTransBoost - first apply a \n"; - hwpp << "# longitudinal and then a transverse boost. Whereas the \n"; - hwpp << "# default method now is InitialInitialBoostOption OneBoost - \n"; - hwpp << "# apply one boost from old CMS to new CMS. Both options \n"; - hwpp << "# should work with Powheg but probably it's best to use the \n"; - hwpp << "# defaults in that case by simply commenting this setting. \n"; - hwpp << "#set KinematicsReconstructor:ReconstructionOption General \n"; - hwpp << "#set KinematicsReconstructor:InitialInitialBoostOption LongTransBoost\n"; - hwpp << "\n";*/ - hwpp << "#############################################################\n"; - hwpp << "# Set up the AlpGenHandler ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Shower\n"; - hwpp << "set AlpGenHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler\n"; - hwpp << "set AlpGenHandler:RemDecayer /Herwig/Partons/RemnantDecayer\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:MaxTry 100\n"; - hwpp << "set /Herwig/Shower/PartnerFinder:PartnerMethod Random\n"; - hwpp << "set /Herwig/Shower/PartnerFinder:ScaleChoice Partner\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:Interactions QCD\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:SpinCorrelations No\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:SoftCorrelations No\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:ReconstructionOption CutOff\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:Interactions QCD\n"; - - // hwpp << "set AlpGenHandler:Evolver Evolver\n"; - // hwpp << "set AlphaQCD:AlphaMZ " << aqcdup << "\n"; - // hwpp << "set AlphaQCD:NumberOfLoops " << nloop << "\n"; - hwpp << "set AlpGenHandler:ShowerAlpha AlphaQCD\n"; - hwpp << "# Calorimeter granularity settings used by GetJet algorithm\n"; - hwpp << "set AlpGenHandler:NoCellsInRapidity 100\n"; - hwpp << "set AlpGenHandler:NoCellsInPhi 60\n"; - // AlpGen hard process code. - hwpp << "# AlpGen hard process code.\n"; - hwpp << "set AlpGenHandler:ihrd " << ihrd << "\n"; - // Number of (light) jets. - int njets(int(parstrToparval("njets",parstrPtr,parvalPtr))); - hwpp << "# No. of light jets in AlpGen process (the \"extra\" ones).\n"; - hwpp << "set AlpGenHandler:njets " << njets << "\n"; - // Mimimum jet pT use for generation. - double ptjmin(parstrToparval("ptjmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:ptjmin " << ptjmin << "*GeV\n"; - // Mimimum parton-parton R-sep used for generation. - double drjmin(parstrToparval("drjmin",parstrPtr,parvalPtr)); - hwpp << "# Mimimum parton-parton R-sep used for generation.\n"; - hwpp << "set AlpGenHandler:drjmin " << drjmin << "\n"; - // Max |eta| for partons in generation. - double etajmax(parstrToparval("etajmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:etajmax " << etajmax << "\n"; - // Also probably want these variables fed to AlpGenHandler too --- - // they get set in the alpsho.f AHspar routine (note the list below - // does not include some variables from AHspar because they are already - // included in the above eg the PDFs are already handled so I removed - // ndns and also ptjmin drjmin are written out for the AlpGenHandler above). - int ickkw(int(parstrToparval("ickkw",parstrPtr,parvalPtr))); - //// hwpp << "set AlpGenHandler:ickkw " << ickkw << "\n"; - int ihvy(int(parstrToparval("ihvy",parstrPtr,parvalPtr))); - hwpp << "# heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t):\n"; - hwpp << "set AlpGenHandler:ihvy " << ihvy << "\n"; - int ihvy2(int(parstrToparval("ihvy2",parstrPtr,parvalPtr))); - //// hwpp << "set AlpGenHandler:ihvy2 " << ihvy2 << "\n"; - int itopprc(nInt(parstrToparval("itopprc",parstrPtr,parvalPtr))); - //// hwpp << "set AlpGenHandler:itopprc " << itopprc << "\n"; - int nw(int(parstrToparval("nw",parstrPtr,parvalPtr))); - if(ihrd==13) { - nw=1; // N.B. nw is reassigned in this way - if(itopprc>=3) nw=2; // by UPEVNT (after UPINIT). - } - //// hwpp << "set AlpGenHandler:nw " << nw << "\n"; - int nz(int(parstrToparval("nz",parstrPtr,parvalPtr))); - //// hwpp << "set AlpGenHandler:nz " << nz << "\n"; - int nh(int(parstrToparval("nh",parstrPtr,parvalPtr))); - hwpp << "# Number of Higgses in the AlpGen process:\n"; - hwpp << "set AlpGenHandler:nh " << nh << "\n"; - int nph(int(parstrToparval("nph",parstrPtr,parvalPtr))); - hwpp << "# Number of photons in the AlpGen process:\n"; - hwpp << "set AlpGenHandler:nph " << nph << "\n"; - double ptbmin(parstrToparval("ptbmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:ptbmin " << ptbmin << "\n"; - double ptcmin(parstrToparval("ptcmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:ptcmin " << ptcmin << "\n"; - double ptlmin(parstrToparval("ptlmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:ptlmin " << ptlmin << "\n"; - double metmin(parstrToparval("metmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:metmin " << metmin << "\n"; - double ptphmin(parstrToparval("ptphmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:ptphmin " << ptphmin << "\n"; - double etabmax(parstrToparval("etabmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:etabmax " << etabmax << "\n"; - double etacmax(parstrToparval("etacmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:etacmax " << etacmax << "\n"; - double etalmax(parstrToparval("etalmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:etalmax " << etalmax << "\n"; - double etaphmax(parstrToparval("etaphmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:etaphmax " << etaphmax << "\n"; - double drbmin(parstrToparval("drbmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drbmin " << drbmin << "\n"; - double drcmin(parstrToparval("drcmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drcmin " << drcmin << "\n"; - double drlmin(parstrToparval("drlmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drlmin " << drlmin << "\n"; - double drphjmin(parstrToparval("drphjmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drphjmin " << drphjmin << "\n"; - double drphlmin(parstrToparval("drphlmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drphlmin " << drphlmin << "\n"; - double drphmin(parstrToparval("drphmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:drphmin " << drphmin << "\n"; - double mllmin(parstrToparval("mllmin",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:mllmin " << mllmin << "\n"; - double mllmax(parstrToparval("mllmax",parstrPtr,parvalPtr)); - //// hwpp << "set AlpGenHandler:mllmax " << mllmax << "\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Set up the LH reader ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/EventHandlers\n"; - hwpp << "set theLHReader:WeightWarnings false\n"; - hwpp << "# Input event file name:\n"; - hwpp << "set theLHReader:FileName " << prefix << ".lhe\n"; - hwpp << "set theLHReader:MomentumTreatment RescaleEnergy\n"; - hwpp << "# set theLHReader:IgnoreIDPRUP Yes\n"; - hwpp << "set theLHReader:Cuts /Herwig/Cuts/NoCuts\n"; - hwpp << "#set theLHReader:OverSampling ForbidOverSampling\n"; - hwpp << "\n"; - hwpp << "#############################################################\n"; - hwpp << "# Set up the LHAPDF ... #\n"; - hwpp << "#############################################################\n"; - hwpp << "cd /Herwig/Partons\n"; - hwpp << "# Don't try and find PDF index out from the LH file ...\n"; - hwpp << "set /Herwig/EventHandlers/theLHReader:InitPDFs false\n"; - hwpp << "# Instead set them explicitly here:\n"; - // hwpp << "set thePDFset:PDFNumber " << lhapdf << "\n"; - hwpp << "set thePDFset:PDFName " << lhapdfstr << "\n"; - - hwpp << "set thePDFset:RemnantHandler HadronRemnants\n"; - hwpp << "set /Herwig/EventHandlers/theLHReader:PDFA thePDFset\n"; - hwpp << "set /Herwig/EventHandlers/theLHReader:PDFB thePDFset\n"; - hwpp << "set /Herwig/Particles/p+:PDF thePDFset\n"; - hwpp << "set /Herwig/Particles/pbar-:PDF thePDFset\n"; - hwpp << "# The PDF for beam particles A/B - overrides particle's own " - << "PDF above\n"; - hwpp << "set /Herwig/Shower/AlpGenHandler:PDFA thePDFset\n"; - hwpp << "set /Herwig/Shower/AlpGenHandler:PDFB thePDFset\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:PDFA thePDFset\n"; - hwpp << "set /Herwig/Shower/ShowerHandler:PDFB thePDFset\n"; - hwpp << "\n"; - hwpp << "####################################################\n"; - hwpp << "# Set up the generator ... #\n"; - hwpp << "####################################################\n"; - hwpp << "cd /Herwig/Generators\n"; - hwpp << "set theGenerator:EventHandler " - << "/Herwig/EventHandlers/theLesHouchesHandler\n"; - hwpp << "set theGenerator:NumberOfEvents " << unwev << "\n"; - hwpp << "set theGenerator:RandomNumberGenerator:Seed 31122001\n"; - hwpp << "set theGenerator:PrintEvent 10\n"; - hwpp << "set theGenerator:MaxErrors 10000\n"; - hwpp << "\n"; - hwpp << "###################################################################\n"; - hwpp << "# ReDefine particle data like it is in the AlpGen parameter file. #\n"; - hwpp << "###################################################################\n"; - hwpp << "\ncd /Herwig/Particles/ \n"; - // 'if' statements needed here to protect against mcat(0)>1.0) { - hwpp << "set c:NominalMass " << massesPtr->at(0) << "*GeV\n"; - hwpp << "set cbar:NominalMass " << massesPtr->at(0) << "*GeV\n"; - } - // Ditto. - if(massesPtr->at(0)>4.0) { - hwpp << "set b:NominalMass " << massesPtr->at(1) << "*GeV\n"; - hwpp << "set bbar:NominalMass " << massesPtr->at(1) << "*GeV\n"; - } - hwpp << "set t:NominalMass " << massesPtr->at(2) << "*GeV\n"; - hwpp << "set tbar:NominalMass " << massesPtr->at(2) << "*GeV\n"; - hwpp << "set W+:NominalMass " << massesPtr->at(3) << "*GeV\n"; - hwpp << "set W-:NominalMass " << massesPtr->at(3) << "*GeV\n"; - hwpp << "set Z0:NominalMass " << massesPtr->at(4) << "*GeV\n"; - hwpp << "set h0:NominalMass " << massesPtr->at(5) << "*GeV\n"; - hwpp << "\n\n\n\n\n"; - hwpp << "######################################################### \n"; - hwpp << "######################################################### \n"; - hwpp << "## # \n"; - hwpp << "## --- USER SERVICEABLE PART BELOW HERE ONLY ! --- # \n"; - hwpp << "## # \n"; - hwpp << "######################################################### \n"; - hwpp << "######################################################### \n"; - hwpp << "\n\n\n\n\n"; - hwpp << "######################################################### \n"; - hwpp << "# Option to off shower / hadronization / decays / MPI. # \n"; - hwpp << "######################################################### \n"; - hwpp << "cd /Herwig/EventHandlers \n"; - hwpp << "# set theLesHouchesHandler:CascadeHandler NULL \n"; - hwpp << "#set theLesHouchesHandler:HadronizationHandler NULL \n"; - hwpp << "#set theLesHouchesHandler:DecayHandler NULL \n"; - hwpp << "# The handler for multiple parton interactions \n"; - hwpp << "#set /Herwig/Shower/AlpGenHandler:MPIHandler NULL \n"; - hwpp << "\n\n"; - hwpp << "######################################################### \n"; - hwpp << "# Recommended key MLM merging parameters below - change # \n"; - hwpp << "# for systematic error studies and / or at your peril. # \n"; - hwpp << "######################################################### \n"; - hwpp << "cd /Herwig/Shower\n"; - hwpp << "# Is this the highest multiplicity ME in merging? \n"; - hwpp << "# 0 = no, 1 = yes . \n"; - hwpp << "set AlpGenHandler:highestMultiplicity 0 \n"; - hwpp << "# Jet ET cut to apply in jet clustering in merging.\n"; - double etclus(max(ptjmin+5,1.2*ptjmin)); - hwpp << "set AlpGenHandler:ETClus " << etclus << "*GeV\n"; - hwpp << "# Cone size used in clustering in merging.\n"; - double rclus(drjmin); - hwpp << "set AlpGenHandler:RClus " << rclus << "\n"; - hwpp << "# Max |eta| for jets in clustering in merging.\n"; - double etaclmax(etajmax); - hwpp << "set AlpGenHandler:EtaClusMax " << etaclmax << "\n"; - hwpp << "# Default 1.5 factor used to decide if a jet matches a parton\n"; - hwpp << "# in merging: if DR(parton,jet) * idup , vector * istup, - vector * mothup1, vector * mothup2, - vector * icolup1, vector * icolup2, - vector > * pup, - vector masses , int itopprc) { - - int iwch(0); - - // W/Z/gamma b bbar + jets ( wcjet*, ihrd=10 / wphjet*, ihrd=14 / wphqq*, - // ihrd=15 ), or W/Z + jets ( wjet*, ihrd=3 / zjet*, ihrd=4 ): - // In this case we add to the list of particles the single intermediate - // boson (at the end of the list) appropriately, and assign the relevant - // parent-daughter and colour flow indices. - if (ihrd<=4||ihrd==10||ihrd==14||ihrd==15) { - iwch=0; // <--- used to determine type: W/Z/gamma - for(int iup=int(*nup)-2; iup 11 + (-12) => -(1)+0 = -1 => W- - // positron+nu -> -11+ 12 => -(-1)+0 = -1 => W+ - // u dbar -> 2 -1 => 0 -(-1) = 1 => W+ - // c dbar -> 4 -1 => W+ - // etc. - } - // Now we start adding the intermediate boson entry: - int iup=nInt(*nup); - if(iwch>0) (*idup).push_back( 24); - else if(iwch<0) (*idup).push_back(-24); - else (*idup).push_back( 23); - (*istup).push_back(2); - (*mothup1).push_back(1); - (*mothup2).push_back(2); - (*pup).push_back(vector(5)); - double tmp = (*pup)[3][iup-2]+(*pup)[3][iup-1]; // Vector boson energy. - (*pup)[3][iup] = tmp; - tmp = sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][iup] = (*pup)[ixx][iup-2]+(*pup)[ixx][iup-1]; - tmp = tmp-sqr((*pup)[ixx][iup]); // Vector boson mass^2 when loop ends. - } - (*pup)[4][iup] = sqrt(tmp); // Set vector boson mass. - (*icolup1).push_back(0); // Set 1st colour line for vector boson. - (*icolup2).push_back(0); // Set 2nd colour line for vector boson. - (*nup) = (*nup)+1; // Increment number of particles to be read in the event. - } - // nW + mZ + kH + jets ( vbjet* / ihrd=5 ): - else if(ihrd==5) { - unsigned int ivstart(0),ivend(0); - // Identify the range of the Z and W bosons in the event (AlpGen conventions). - // Note the Z's and W's are the only things that decay - Higgs's and photons - // do not. - vector bosonIndex; - for(unsigned int ixx=0; ixx<(*nup); ixx++) - if(abs((*idup)[ixx])==24||(*idup)[ixx]==23) { - (*istup)[ixx]=2; // Set the W/Z boson status to intermediate. - bosonIndex.push_back(ixx+1); // W/Z boson index in LH event record (1->nup). - } - unsigned int bosonCounter(nInt(*nup)-2*bosonIndex.size()); - for(unsigned int ixx=0; ixx(5)); - } - for(unsigned int iw=1; iw<=2; iw++) { - int iwdec(nInt(*nup)-5+2*iw); // First of decay products for this W (iw). - int iwup(nInt(*nup)+iw); // Where the reco. W will go in evt.record (LH index). - int ibup(iwup+2); // Where the reco. b will go in evt.record (under the Ws). - int iwch(0); - for(unsigned int iup=iwdec; iup<=iwdec+1; iup++) { - (*mothup1)[iup-1]=iwup; - (*mothup2)[iup-1]=0; - iwch=iwch-int((*idup)[iup-1])%2; // iwch = charge of W boson. - // electron+nubar -> 11 + (-12) = -1 => W- - // d + ubar -> 1 + (-2) = -1 => W- - // positron+nu -> -11+ 12 = 1 => W+ - // u + dbar -> 2 + (-1) = 1 => W+ - } - // Make space for the b and W: - // Fill in b and W LH record entries: - if(iwch>0) { - (*idup)[iwup-1]=24; - (*idup)[ibup-1]=5; - (*mothup1)[iwup-1]=it; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=it; - (*mothup2)[ibup-1]=0; - } else if (iwch<0) { - (*idup)[iwup-1]=-24; - (*idup)[ibup-1]=-5; - (*mothup1)[iwup-1]=itb; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=itb; - (*mothup2)[ibup-1]=0; - } - (*istup)[iwup-1]=2; // The W is an intermediate and the - (*istup)[ibup-1]=1; // b is a final-state particle. - // Now reconstruct W boson momentum - double tmp=(*pup)[3][iwdec-1]+(*pup)[3][iwdec]; - (*pup)[3][iwup-1]=tmp; // W energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][iwup-1] = (*pup)[ixx][iwdec-1] // W's 3-mom. - + (*pup)[ixx][iwdec]; - tmp=tmp-sqr((*pup)[ixx][iwup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][iwup-1]=sqrt(tmp); // W mass. - // Reconstruct b momentum - int itmp(nInt((*mothup1)[iwup-1])); - tmp=(*pup)[3][itmp-1]-(*pup)[3][iwup-1]; - (*pup)[3][ibup-1]=tmp; // b energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][ibup-1] = (*pup)[ixx][nInt((*mothup1)[iwup-1])-1] // b's 3mom. - - (*pup)[ixx][iwup-1]; - tmp=tmp-sqr((*pup)[ixx][ibup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][ibup-1]=sqrt(tmp); // b mass. - (*icolup1)[iwup-1]=0; // W has no colour - (*icolup2)[iwup-1]=0; // lines. - (*icolup1)[ibup-1]=(*icolup1)[nInt((*mothup1)[iwup-1])-1]; // b shares top - (*icolup2)[ibup-1]=(*icolup2)[nInt((*mothup1)[iwup-1])-1]; // colour line. - } - (*nup)+=4; - } - // H t tbar + jets ( QQh*, ihrd=8 ): - else if (ihrd==8&&abs((*idup)[3])==6) { - // Redefine the tops as intermediates in the event record. - (*istup)[3]=2; - (*istup)[4]=2; - unsigned int it(4),itb(5); // Index of t & tbar in evt.record (LH index). - if((*idup)[3]!=6) swap(it,itb); - // Reconstruct intermediate W's from the decay products. - for(unsigned int ixx=0; ixx<4;ixx++) { - (*idup).push_back(0); - (*istup).push_back(0); - (*mothup1).push_back(0); - (*mothup2).push_back(0); - (*icolup1).push_back(0); - (*icolup2).push_back(0); - (*pup).push_back(vector(5)); - } - for(unsigned int iw=1; iw<=2; iw++) { - int iwdec(nInt(*nup)-5+2*iw); // First of decay products for this W (iw). - int iwup(nInt(*nup)+iw); // Where the reco. W will go in evt.record (LH index). - int ibup(iwup+2); // Where the reco. b will go in evt.record (under the Ws). - int iwch(0); - for(unsigned int iup=iwdec; iup<=iwdec+1; iup++) { - (*mothup1)[iup-1]=iwup; - (*mothup2)[iup-1]=0; - iwch=iwch-int((*idup)[iup-1])%2; // iwch = charge of W boson. - // electron+nubar -> 11 + (-12) = -1 => W- - // d + ubar -> 1 + (-2) = -1 => W- - // positron+nu -> -11+ 12 = 1 => W+ - // u + dbar -> 2 + (-1) = 1 => W+ - } - if(iwch>0) { - (*idup)[iwup-1]=24; - (*idup)[ibup-1]=5; - (*mothup1)[iwup-1]=it; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=it; - (*mothup2)[ibup-1]=0; - } else if (iwch<0) { - (*idup)[iwup-1]=-24; - (*idup)[ibup-1]=-5; - (*mothup1)[iwup-1]=itb; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=itb; - (*mothup2)[ibup-1]=0; - } - (*istup)[iwup-1]=2; // The W is an intermediate and the - (*istup)[ibup-1]=1; // b is a final-state particle. - // Now reconstruct W boson momentum - double tmp=(*pup)[3][iwdec-1]+(*pup)[3][iwdec]; - (*pup)[3][iwup-1]=tmp; // W energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][iwup-1] = (*pup)[ixx][iwdec-1] // W's 3-mom. - + (*pup)[ixx][iwdec]; - tmp=tmp-sqr((*pup)[ixx][iwup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][iwup-1]=sqrt(tmp); // W mass. - // Reconstruct b momentum - tmp=(*pup)[3][nInt((*mothup1)[iwup-1])-1]-(*pup)[3][iwup-1]; - (*pup)[3][ibup-1]=tmp; // b energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][ibup-1] = (*pup)[ixx][nInt((*mothup1)[iwup-1])-1] // b's 3mom. - - (*pup)[ixx][iwup-1]; - tmp=tmp-sqr((*pup)[ixx][ibup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][ibup-1]=sqrt(tmp); // b mass. - (*icolup1)[iwup-1]=0; // W has no colour - (*icolup2)[iwup-1]=0; // lines. - (*icolup1)[ibup-1]=(*icolup1)[nInt((*mothup1)[iwup-1])-1]; // b shares top - (*icolup2)[ibup-1]=(*icolup2)[nInt((*mothup1)[iwup-1])-1]; // colour line. - } - (*nup)+=4; - } - // Single top production ( top*, ihrd=13): - else if (ihrd==13) { - int nw=1; - if(itopprc>=3) nw=2; - // Assign a mass to the incoming bottom quark, if there is one, - // rescaling the energy to accommodate the mass. - for(unsigned int ixx=1; ixx<=2; ixx++) { - if(abs((*idup)[ixx-1])==5) { - (*pup)[4][ixx-1]=masses[1]; - (*pup)[3][ixx-1]=sqrt(sqr((*pup)[2][ixx-1])+sqr((*pup)[4][ixx-1])); - } - } - // Set the top status to that of an intermediate. - (*istup)[2]=2; - // Get the index of the t / tbar in the evt. record (LH convention: 1->nup). - unsigned int it=0; - unsigned itb=0; - if((*idup)[2]==6) it=3; - else if((*idup)[2]==-6) itb=3; - else { - cout << "doIndividualHardProcessAssignments:\n" - << "wrong assumption about top position.\n" - << "Quitting ..."; - exit(1); - } - // Reconstruct intermediate W's from the decay products. - // iwdec is the index of the first W decay product - unsigned int iwdec(nInt(*nup)-1); // LH conventions: 1->nup. - if(nw==2) iwdec=nInt(*nup)-3; - // The W and b will go at the end of the record. - unsigned int iwup(nInt(*nup)+1); - unsigned int ibup(nInt(*nup)+2); - int iwch(0); - for(unsigned int iup=iwdec; iup<=iwdec+1; iup++) { - (*mothup1)[iup-1]=iwup; - (*mothup2)[iup-1]=0; - iwch=iwch-int((*idup)[iup-1])%2; // iwch = charge of W boson. - // electron+nubar -> 11 + (-12) = -1 => W- - // d + ubar -> 1 + (-2) = -1 => W- - // positron+nu -> -11+ 12 = 1 => W+ - // u + dbar -> 2 + (-1) = 1 => W+ - } - for(unsigned int ixx=0; ixx<2;ixx++) { - (*idup).push_back(0); - (*istup).push_back(0); - (*mothup1).push_back(0); - (*mothup2).push_back(0); - (*icolup1).push_back(0); - (*icolup2).push_back(0); - (*pup).push_back(vector(5)); - } - if(iwch>0) { - (*idup)[iwup-1]=24; - (*idup)[ibup-1]=5; - (*mothup1)[iwup-1]=it; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=it; - (*mothup2)[ibup-1]=0; - } else if (iwch<0) { - (*idup)[iwup-1]=-24; - (*idup)[ibup-1]=-5; - (*mothup1)[iwup-1]=itb; - (*mothup2)[iwup-1]=0; - (*mothup1)[ibup-1]=itb; - (*mothup2)[ibup-1]=0; - } - (*istup)[iwup-1]=2; - (*istup)[ibup-1]=1; - // Now reconstruct W boson momentum - double tmp=(*pup)[3][iwdec-1]+(*pup)[3][iwdec]; - (*pup)[3][iwup-1]=tmp; // W energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][iwup-1] = (*pup)[ixx][iwdec-1] // W's 3-mom. - + (*pup)[ixx][iwdec]; - tmp=tmp-sqr((*pup)[ixx][iwup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][iwup-1]=sqrt(tmp); // W mass. - // Reconstruct b momentum - tmp=(*pup)[3][nInt((*mothup1)[iwup-1])-1]-(*pup)[3][iwup-1]; - (*pup)[3][ibup-1]=tmp; // b energy. - tmp=sqr(tmp); - for(unsigned int ixx=0; ixx<=2; ixx++) { - (*pup)[ixx][ibup-1] = (*pup)[ixx][nInt((*mothup1)[iwup-1])-1] // b's 3mom. - - (*pup)[ixx][iwup-1]; - tmp=tmp-sqr((*pup)[ixx][ibup-1]); // Equals m^2 at the end of the loop. - } - (*pup)[4][ibup-1]=sqrt(tmp); // b mass. - (*icolup1)[iwup-1]=0; - (*icolup2)[iwup-1]=0; - (*icolup1)[ibup-1]=(*icolup1)[nInt((*mothup1)[iwup-1])-1]; - (*icolup2)[ibup-1]=(*icolup2)[nInt((*mothup1)[iwup-1])-1]; - (*nup)=(*nup)+2; - if(nw==2) { - // W DECAY - // iwdec is the index of the first W decay product. - iwdec=nInt(*nup)-3; - // iwup is the index of the W in the event record (LH conventions: 1->nup). - iwup=nInt(*nup)-6; - iwch=0; - int iwch(0); - for(unsigned int iup=iwdec; iup<=iwdec+1; iup++) { - (*mothup1)[iup-1]=iwup; - (*mothup2)[iup-1]=0; - iwch=iwch-int((*idup)[iup-1])%2; // iwch = charge of W boson. - // electron+nubar -> 11 + (-12) = -1 => W- - // d + ubar -> 1 + (-2) = -1 => W- - // positron+nu -> -11+ 12 = 1 => W+ - // u + dbar -> 2 + (-1) = 1 => W+ - } - (*istup)[iwup-1]=2; - (*icolup1)[iwup-1]=0; - (*icolup2)[iwup-1]=0; - } - } - - return; -} diff --git a/Contrib/AlpGen/BasicLesHouchesFileReader.cc b/Contrib/AlpGen/BasicLesHouchesFileReader.cc deleted file mode 100644 --- a/Contrib/AlpGen/BasicLesHouchesFileReader.cc +++ /dev/null @@ -1,466 +0,0 @@ -// -*- C++ -*- -// -// BasicLesHouchesFileReader.cc is a part of Herwig - A multi-purpose -// Monte Carlo event generator. -// Copyright (C) 2002-2017 The Herwig Collaboration -// -// Herwig is licenced under version 3 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 BasicLesHouchesFileReader class. -// -#include "BasicLesHouchesFileReader.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Utilities/Throw.h" -#include "ThePEG/PDT/DecayMode.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDF/PartonExtractor.h" -#include "ThePEG/PDF/NoPDF.h" -#include "ThePEG/Cuts/Cuts.h" -#include "ThePEG/EventRecord/TmpTransform.h" -#include "ThePEG/Utilities/UtilityBase.h" - -using namespace Herwig; - -BasicLesHouchesFileReader:: -BasicLesHouchesFileReader(const BasicLesHouchesFileReader & x) - : LesHouchesReader(x), neve(x.neve), ieve(0), - LHFVersion(x.LHFVersion), outsideBlock(x.outsideBlock), - headerBlock(x.headerBlock), initComments(x.initComments), - initAttributes(x.initAttributes), eventComments(x.eventComments), - eventAttributes(x.eventAttributes), - theFileName(x.theFileName),overSampling_(x.overSampling_) {} - -BasicLesHouchesFileReader::~BasicLesHouchesFileReader() {} - -IBPtr BasicLesHouchesFileReader::clone() const { - return new_ptr(*this); -} - -IBPtr BasicLesHouchesFileReader::fullclone() const { - return new_ptr(*this); -} - -bool BasicLesHouchesFileReader::preInitialize() const { - return true; -} - -void BasicLesHouchesFileReader::doinit() { - LesHouchesReader::doinit(); -} - -void BasicLesHouchesFileReader::initialize(LesHouchesEventHandler & eh) { - LesHouchesReader::initialize(eh); - if ( LHFVersion.empty() ) - Throw() - << "The file associated with '" << name() << "' does not contain a " - << "proper formatted Les Houches event file. The events may not be " - << "properly sampled." << Exception::warning; -} - - -long BasicLesHouchesFileReader::scan() { - - open(); - - // Shall we write the events to a cache file for fast reading? If so - // we write to a temporary file if the caches events should be - // randomized. - if ( cacheFileName().length() ) openWriteCacheFile(); - - // Keep track of the number of events scanned. - long neve = 0; - long cuteve = 0; - bool negw = false; - - // If the open() has not already gotten information about subprocesses - // and cross sections we have to scan through the events. - if ( !heprup.NPRUP || cacheFile() || abs(heprup.IDWTUP) != 1 ) { // why scan if IDWTUP != 1? - - HoldFlag<> isScanning(scanning); - - double oldsum = 0.0; - vector lprup; - vector newmax; - vector oldeve; - vector neweve; - for ( int i = 0; ( maxScan() < 0 || i < maxScan() ) && readEvent(); ++i ) { - if ( !checkPartonBin() ) Throw() - << "Found event in LesHouchesReader '" << name() - << "' which cannot be handeled by the assigned PartonExtractor '" - << partonExtractor()->name() << "'." << Exception::runerror; - vector::iterator idit = - find(lprup.begin(), lprup.end(), hepeup.IDPRUP); - int id = lprup.size(); - if ( idit == lprup.end() ) { - lprup.push_back(hepeup.IDPRUP); - newmax.push_back(0.0); - neweve.push_back(0); - oldeve.push_back(0); - } else { - id = idit - lprup.begin(); - } - ++neve; - ++oldeve[id]; - oldsum += hepeup.XWGTUP; - if ( cacheFile() ) { - if ( eventWeight() == 0.0 ) { - ++cuteve; - continue; - } - cacheEvent(); - } - ++neweve[id]; - newmax[id] = max(newmax[id], abs(eventWeight())); - if ( eventWeight() < 0.0 ) negw = true; - } - - xSecWeights.resize(oldeve.size(), 1.0); - for ( int i = 0, N = oldeve.size(); i < N; ++i ) - if ( oldeve[i] ) xSecWeights[i] = double(neweve[i])/double(oldeve[i]); - - if ( maxScan() < 0 || neve > NEvents() ) NEvents(neve - cuteve); - - if ( lprup.size() == heprup.LPRUP.size() ) { - for ( int id = 0, N = lprup.size(); id < N; ++id ) { - vector::iterator idit = - find(heprup.LPRUP.begin(), heprup.LPRUP.end(), hepeup.IDPRUP); - if ( idit == heprup.LPRUP.end() ) { - Throw() - << "When scanning events, the LesHouschesReader '" << name() - << "' found undeclared processes." << Exception::warning; - heprup.NPRUP = 0; - break; - } - int idh = idit - heprup.LPRUP.begin(); - heprup.XMAXUP[idh] = newmax[id]; - } - } - if ( heprup.NPRUP == 0 ) { - // No heprup block was supplied or something went wrong. - heprup.NPRUP = lprup.size(); - heprup.LPRUP.resize(lprup.size()); - heprup.XMAXUP.resize(lprup.size()); - for ( int id = 0, N = lprup.size(); id < N; ++id ) { - heprup.LPRUP[id] = lprup[id]; - heprup.XMAXUP[id] = newmax[id]; - } - } else if ( abs(heprup.IDWTUP) != 1 ) { - // Try to fix things if abs(heprup.IDWTUP) != 1. - double sumxsec = 0.0; - for ( int id = 0; id < heprup.NPRUP; ++id ) sumxsec += heprup.XSECUP[id]; - weightScale = picobarn*neve*sumxsec/oldsum; - } - } - - if ( cacheFile() ) closeCacheFile(); - - if ( negw ) heprup.IDWTUP = min(-abs(heprup.IDWTUP), -1); - - return neve; - -} - -void BasicLesHouchesFileReader::open() { - if ( filename().empty() ) - throw LesHouchesFileError() - << "No Les Houches file name. " - << "Use 'set " << name() << ":FileName'." - << Exception::runerror; - cfile.open(filename()); - if ( !cfile ) - throw LesHouchesFileError() - << "The BasicLesHouchesFileReader '" << name() << "' could not open the " - << "event file called '" << theFileName << "'." - << Exception::runerror; - - cfile.readline(); - if ( !cfile.find(" attributes = - StringUtils::xmlAttributes("LesHouchesEvents", cfile.getline()); - LHFVersion = attributes["version"]; - if ( LHFVersion.empty() ) return; - - bool readingHeader = false; - bool readingInit = false; - headerBlock = ""; - - // Loop over all lines until we hit the tag. - while ( cfile.readline() && !cfile.find("") ) { - if ( cfile.find("> heprup.IDBMUP.first >> heprup.IDBMUP.second - >> heprup.EBMUP.first >> heprup.EBMUP.second - >> heprup.PDFGUP.first >> heprup.PDFGUP.second - >> heprup.PDFSUP.first >> heprup.PDFSUP.second - >> heprup.IDWTUP >> heprup.NPRUP ) ) { - heprup.NPRUP = -42; - LHFVersion = ""; - return; - } - heprup.resize(); - - for ( int i = 0; i < heprup.NPRUP; ++i ) { - cfile.readline(); - if ( !( cfile >> heprup.XSECUP[i] >> heprup.XERRUP[i] - >> heprup.XMAXUP[i] >> heprup.LPRUP[i] ) ) { - heprup.NPRUP = -42; - LHFVersion = ""; - return; - } - } - } - else if ( cfile.find("momentum().plus()/ - beams().first->momentum().plus(); - - if ( reweightPDF && - inPDF.first && outPDF.first && inPDF.first != outPDF.first ) { - if ( hepeup.XPDWUP.first <= 0.0 ) - hepeup.XPDWUP.first = - inPDF.first->xfx(inData.first, incoming().first->dataPtr(), - sqr(hepeup.SCALUP*GeV), x1); - double xf = outPDF.first->xfx(inData.first, incoming().first->dataPtr(), - sqr(hepeup.SCALUP*GeV), x1); - lastweight *= xf/hepeup.XPDWUP.first; - hepeup.XPDWUP.first = xf; - } - - double x2 = incoming().second->momentum().minus()/ - beams().second->momentum().minus(); - - if ( reweightPDF && - inPDF.second && outPDF.second && inPDF.second != outPDF.second ) { - if ( hepeup.XPDWUP.second <= 0.0 ) - hepeup.XPDWUP.second = - inPDF.second->xfx(inData.second, incoming().second->dataPtr(), - sqr(hepeup.SCALUP*GeV), x2); - double xf = - outPDF.second->xfx(inData.second, incoming().second->dataPtr(), - sqr(hepeup.SCALUP*GeV), x2); - lastweight *= xf/hepeup.XPDWUP.second; - hepeup.XPDWUP.second = xf; - } - - if ( cutEarly() ) { - if ( !cuts().initSubProcess((incoming().first->momentum() + - incoming().second->momentum()).m2(), - 0.5*log(x1/x2)) ) lastweight = 0.0; - tSubProPtr sub = getSubProcess(); - TmpTransform tmp(sub, Utilities::getBoostToCM(sub->incoming())); - if ( !cuts().passCuts(*sub) ) lastweight = 0.0; - } - - return true; -} - -double BasicLesHouchesFileReader::getEvent() { - if ( cacheFile() ) { - if (overSampling_) { - if ( !uncacheEvent() ) reopen(); - } else { - if ( !uncacheEvent() || stats.attempts()==NEvents() ) - throw LesHouchesReopenWarning() - << "More events requested than available in LesHouchesReader " - << name() << Exception::runerror; - } - } else { - if (overSampling_) { - if ( !readEvent() ) reopen(); - } else { - if ( !readEvent() || stats.attempts()==NEvents() ) - throw LesHouchesReopenWarning() - << "More events requested than available in LesHouchesReader " - << name() << Exception::runerror; - } - } - ++position; - - double max = maxWeights[hepeup.IDPRUP]*maxFactor; - return max != 0.0? eventWeight()/max: 0.0; - -} - -void BasicLesHouchesFileReader::skip(long n) { - HoldFlag<> skipflag(skipping); - if(overSampling_) while ( n-- ) getEvent(); -} - -bool BasicLesHouchesFileReader::doReadEvent() { - if ( !cfile ) return false; - if ( LHFVersion.empty() ) return false; - if ( heprup.NPRUP < 0 ) return false; - eventComments = ""; - outsideBlock = ""; - hepeup.NUP = 0; - hepeup.XPDWUP.first = hepeup.XPDWUP.second = 0.0; - - // Keep reading lines until we hit the next event or the end of - // the event block. Save any inbetween lines. Exit if we didn't - // find an event. - while ( cfile.readline() && !cfile.find("> hepeup.NUP >> hepeup.IDPRUP >> hepeup.XWGTUP - >> hepeup.SCALUP >> hepeup.AQEDUP >> hepeup.AQCDUP ) ) - return false; - hepeup.resize(); - // Read all particle lines. - for ( int i = 0; i < hepeup.NUP; ++i ) { - if ( !cfile.readline() ) return false; - if ( !( cfile >> hepeup.IDUP[i] >> hepeup.ISTUP[i] - >> hepeup.MOTHUP[i].first >> hepeup.MOTHUP[i].second - >> hepeup.ICOLUP[i].first >> hepeup.ICOLUP[i].second - >> hepeup.PUP[i][0] >> hepeup.PUP[i][1] >> hepeup.PUP[i][2] - >> hepeup.PUP[i][3] >> hepeup.PUP[i][4] - >> hepeup.VTIMUP[i] >> hepeup.SPINUP[i] ) ) - return false; - if(std::isnan(hepeup.PUP[i][0])||std::isnan(hepeup.PUP[i][1])|| - std::isnan(hepeup.PUP[i][2])||std::isnan(hepeup.PUP[i][3])|| - std::isnan(hepeup.PUP[i][4])) - throw Exception() - << "nan's as momenta in Les Houches file " - << Exception::eventerror; - } - - // Now read any additional comments. - while ( cfile.readline() && !cfile.find("") ) - eventComments += cfile.getline() + "\n"; - - if ( !cfile ) return false; - return true; - -} - -void BasicLesHouchesFileReader::close() { - cfile.close(); -} - -void BasicLesHouchesFileReader::persistentOutput(PersistentOStream & os) const { - os << neve << LHFVersion << outsideBlock << headerBlock << initComments - << initAttributes << eventComments << eventAttributes << theFileName - << overSampling_; -} - -void BasicLesHouchesFileReader::persistentInput(PersistentIStream & is, int) { - is >> neve >> LHFVersion >> outsideBlock >> headerBlock >> initComments - >> initAttributes >> eventComments >> eventAttributes >> theFileName - >> overSampling_; - ieve = 0; -} - -ClassDescription -BasicLesHouchesFileReader::initBasicLesHouchesFileReader; -// Definition of the static class description member. - -void BasicLesHouchesFileReader::Init() { - - static ClassDocumentation documentation - ("Herwig::BasicLesHouchesFileReader is an base class to be used for objects " - "which reads event files from matrix element generators. This class is " - "able to read plain event files conforming to the Les Houches Event File " - "accord."); - - static Parameter interfaceFileName - ("FileName", - "The name of a file containing events conforming to the Les Houches " - "protocol to be read into ThePEG. A file name ending in " - ".gz will be read from a pipe which uses " - "zcat. If a file name ends in | the " - "preceeding string is interpreted as a command, the output of which " - "will be read through a pipe.", - &BasicLesHouchesFileReader::theFileName, "", false, false); - - static Switch interfaceOverSampling - ("OverSampling", - "Allow / Forbid reading of LH events more than once by the " - "LH reader, allowing / protecting against statistical problems.", - &BasicLesHouchesFileReader::overSampling_, true, false, false); - static SwitchOption AllowOverSampling - (interfaceOverSampling, - "AllowOverSampling", - "The reader will read events in the file more than once if more " - "events are needed to generate the requested number than that in " - "the LH file.", - true); - static SwitchOption ForbidOverSampling - (interfaceOverSampling, - "ForbidOverSampling", - "The reader will NOT read events in the file more than once if more " - "events are needed to generate the requested number than that in " - "the LH file - instead it will stop when all have been read.", - false); - - interfaceFileName.fileType(); - interfaceFileName.rank(11); - -} - diff --git a/Contrib/AlpGen/BasicLesHouchesFileReader.fh b/Contrib/AlpGen/BasicLesHouchesFileReader.fh deleted file mode 100644 --- a/Contrib/AlpGen/BasicLesHouchesFileReader.fh +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -// -// This is the forward declaration of the BasicLesHouchesFileReader class. -// -#ifndef HERWIG_BasicLesHouchesFileReader_FH -#define HERWIG_BasicLesHouchesFileReader_FH - -#include "ThePEG/Config/Pointers.h" - -namespace Herwig { - -class BasicLesHouchesFileReader; - -} - -namespace ThePEG { - -ThePEG_DECLARE_POINTERS(Herwig::BasicLesHouchesFileReader,BasicLesHouchesFileReaderPtr); - -} - -#endif diff --git a/Contrib/AlpGen/BasicLesHouchesFileReader.h b/Contrib/AlpGen/BasicLesHouchesFileReader.h deleted file mode 100644 --- a/Contrib/AlpGen/BasicLesHouchesFileReader.h +++ /dev/null @@ -1,333 +0,0 @@ -// -*- C++ -*- -// -// BasicLesHouchesFileReader.h is a part of Herwig - A multi-purpose -// Monte Carlo event generator. -// Copyright (C) 2002-2017 The Herwig Collaboration -// -// Herwig is licenced under version 3 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 BasicLesHouchesFileReader class. -// -#ifndef HERWIG_BasicLesHouchesFileReader_H -#define HERWIG_BasicLesHouchesFileReader_H -// This is the declaration of the BasicLesHouchesFileReader class. - -#include "ThePEG/LesHouches/LesHouchesReader.h" -#include "BasicLesHouchesFileReader.fh" -#include "ThePEG/PDT/Decayer.h" -#include "ThePEG/Utilities/CFileLineReader.h" -#include - -namespace Herwig { - -using namespace ThePEG; - -/** - * BasicLesHouchesFileReader derives from the LesHouchesReader base class - * to be used for objects which read event files from matrix element - * generators. It extends LesHouchesReader by defining a file handle to be - * read from, which is opened and closed by the open() and close() - * functions. Note that the file handle is a standard C filehandle and - * not a C++ stream. This is because there is no standard way in C++ - * to connect a pipe to a stream for reading eg. gzipped files. This - * class is able to read plain event files conforming to the Les - * Houches Event File accord. - * - * @see \ref BasicLesHouchesFileReaderInterfaces "The interfaces" - * defined for BasicLesHouchesFileReader. - * @see LesHouchesReader - * @see BasicLesHouchesFileReader - */ -class BasicLesHouchesFileReader: public LesHouchesReader { - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * Default constructor. - */ - BasicLesHouchesFileReader() : neve(0), ieve(0) {} - - /** - * Copy-constructor. Note that a file which is opened in the object - * copied from will have to be reopened in this. - */ - BasicLesHouchesFileReader(const BasicLesHouchesFileReader &); - - /** - * Destructor. - */ - virtual ~BasicLesHouchesFileReader(); - //@} - -public: - - /** @name Virtual functions specified by the LesHouchesReader base class. */ - //@{ - /** - * Initialize. This function is called by the LesHouchesEventHandler - * to which this object is assigned. - */ - virtual void initialize(LesHouchesEventHandler & eh); - - /** - * Calls readEvent() or uncacheEvent() to read information into the - * LesHouches common block variables. This function is called by the - * LesHouchesEventHandler if this reader has been selectod to - * produce an event. - * - * @return the weight asociated with this event. If negative weights - * are allowed it should be between -1 and 1, otherwise between 0 - * and 1. If outside these limits the previously estimated maximum - * is violated. Note that the estimated maximum then should be - * updated from the outside. - */ - virtual double getEvent(); - - /** - * Calls doReadEvent() and performs pre-defined reweightings. A - * sub-class overrides this function it must make sure that the - * corresponding reweightings are done. - */ - virtual bool readEvent(); - - /** - * Skip \a n events. Used by LesHouchesEventHandler to make sure - * that a file is scanned an even number of times in case the events - * are not ramdomly distributed in the file. - */ - virtual void skip(long n); - - /** - * Scan the file or stream to obtain information about cross section - * weights and particles etc. This function should fill the - * variables corresponding to the /HEPRUP/ common block. The - * function returns the number of events scanned. - */ - virtual long scan(); - - /** - * Open a file with events. Derived classes should overwrite it and - * first calling it before reading in the run information into the - * corresponding protected variables. - */ - virtual void open(); - - /** - * Close the file from which events have been read. - */ - virtual void close(); - - /** - * Read the next event from the file or stream into the - * corresponding protected variables. Return false if there is no - * more events or if this was not a LHF event file. - */ - virtual bool doReadEvent(); - //@} - - /** - * Return the name of the file from where to read events. - */ - string filename() const { return theFileName; } - -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; - //@} - - /** @name Standard (and non-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(); - - /** - * Return true if this object needs to be initialized before all - * other objects because it needs to extract PDFs from the event file. - */ - virtual bool preInitialize() const; - //@ - -protected: - - /** - * The wrapper around the C FILE stream from which to read - */ - CFileLineReader cfile; - -protected: - - /** - * The number of events in this file. - */ - long neve; - - /** - * The current event number. - */ - long ieve; - - /** - * If the file is a standard Les Houches formatted file (LHF) this - * is its version number. If empty, this is not a Les Houches - * formatted file - */ - string LHFVersion; - - /** - * If LHF. All lines (since the last open() or readEvent()) outside - * the header, init and event tags. - */ - string outsideBlock; - - /** - * If LHF. All lines from the header block. - */ - string headerBlock; - - /** - * If LHF. Additional comments found in the init block. - */ - string initComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the init - * tag. - */ - map initAttributes; - - /** - * If LHF. Additional comments found with the last read event. - */ - string eventComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the last - * event tag. - */ - map eventAttributes; - -private: - - /** - * The name of the file from where to read events. - */ - string theFileName; - - /** - * Determines whether events in the LH file are or are not read - * more than once in order to generate the requested number of - * events. - */ - bool overSampling_; - -private: - - /** - * Describe an abstract base class with persistent data. - */ - static ClassDescription initBasicLesHouchesFileReader; - - /** - * Private and non-existent assignment operator. - */ - BasicLesHouchesFileReader & operator=(const BasicLesHouchesFileReader &) = delete; - -public: - - /** @cond EXCEPTIONCLASSES */ - /** Exception class used by BasicLesHouchesFileReader if reading the file - * fails. */ - class LesHouchesFileError: public Exception {}; - /** @endcond */ - -}; - -} - - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** - * This template specialization informs ThePEG about the - * base class of BasicLesHouchesFileReader. - */ -template <> -struct BaseClassTrait { - /** Typedef of the base class of BasicLesHouchesFileReader. */ - typedef LesHouchesReader NthBase; -}; - -/** - * This template specialization informs ThePEG about the name of the - * BasicLesHouchesFileReader class and the shared object where it is - * defined. - */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** - * Return the class name. - */ - static string className() { return "Herwig::BasicLesHouchesFileReader"; } - /** - * Return the name of the shared library to be loaded to get access - * to the BasicLesHouchesFileReader class and every other class it uses - * (except the base class). - */ - static string library() { return "BasicLesHouchesFileReader.so"; } - -}; - -/** @endcond */ - -} - -#endif /* HERWIG_BasicLesHouchesFileReader_H */ diff --git a/Contrib/AlpGen/Makefile.in b/Contrib/AlpGen/Makefile.in deleted file mode 100644 --- a/Contrib/AlpGen/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -*- Makefile -*- (for emacs) -# -# This Makefile is intended for compiling Herwig++ plugins -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# -# Location of include files -THEPEGINCLUDE = -HERWIGINCLUDE = -GSLINCLUDE = -FASTJETINCLUDE = -# Messy hack, not guaranteed to work: -FASTJETLIB = `echo $(FASTJETINCLUDE) | sed "s/-I//" | sed "s/ //"`/../lib/ -LDFLAGS = -L$(FASTJETLIB) -lfastjet -SHARED_FLAG = -INCLUDE = $(THEPEGINCLUDE) $(HERWIGINCLUDE) $(GSLINCLUDE) $(FASTJETINCLUDE) -# C++ flags -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : AlpGenHandler.so AlpGenToLH.exe - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -BasicLesHouchesFileReader.so : BasicLesHouchesFileReader.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - -Wl,-undefined -Wl,dynamic_lookup \ - BasicLesHouchesFileReader.o -o BasicLesHouchesFileReader.so - -AlpGenHandler.so : AlpGenHandler.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - -Wl,-undefined -Wl,dynamic_lookup \ - AlpGenHandler.o -o AlpGenHandler.so - -AlpGenToLH.exe : AlpGenToLH.o - $(CXX) AlpGenToLH.o -o AlpGenToLH.exe - -MLMHistogram.so : Validation/MLMHistogram.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - -Wl,-undefined -Wl,dynamic_lookup \ - Validation/MLMHistogram.o -o MLMHistogram.so - -MLMAnalysis.so : Validation/MLMAnalysis.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - -Wl,-undefined -Wl,dynamic_lookup \ - MLMHistogram.so Validation/MLMAnalysis.o -o MLMAnalysis.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) \ - BasicLesHouchesFileReader.so AlpGenHandler.so AlpGenToLH.exe MLMAnalysis.so MLMHistogram.so \ No newline at end of file diff --git a/Contrib/AnomalousHVV/AnomalousWWHVertex.cc b/Contrib/AnomalousHVV/AnomalousWWHVertex.cc deleted file mode 100644 --- a/Contrib/AnomalousHVV/AnomalousWWHVertex.cc +++ /dev/null @@ -1,133 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the AnomalousWWHVertex class. -// - -#include "AnomalousWWHVertex.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "Herwig/Models/StandardModel/StandardModel.h" - -using namespace Herwig; -using namespace ThePEG::Helicity; - -AnomalousWWHVertex::AnomalousWWHVertex() - : interactionType_(0), Lambda_(1000.*GeV), - couplast_(0.), q2last_(ZERO), mw_(ZERO), zfact_(0.) { - // particles - addToList(24,-24,25); - addToList(23,23,25); - // calculate the kinematic invariants needed - kinematics(true); -} - -IBPtr AnomalousWWHVertex::clone() const { - return new_ptr(*this); -} - -IBPtr AnomalousWWHVertex::fullclone() const { - return new_ptr(*this); -} - -void AnomalousWWHVertex::doinit() { - // parameters - mw_ = getParticleData(ThePEG::ParticleID::Wplus)->mass(); - zfact_ = 1./(1.-generator()->standardModel()->sin2ThetaW()); - // order in the couplings - orderInGem(1); - orderInGs(0); - // base class - GeneralVVSVertex::doinit(); -} - -void AnomalousWWHVertex::persistentOutput(PersistentOStream & os) const { - os << interactionType_ << ounit(mw_,GeV) << zfact_ << ounit(Lambda_,GeV); -} - -void AnomalousWWHVertex::persistentInput(PersistentIStream & is, int) { - is >> interactionType_ >> iunit(mw_,GeV) >> zfact_ >> iunit(Lambda_,GeV); -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigAnomalousWWHVertex("Herwig::AnomalousWWHVertex", "AnomalousHVV.so"); - -void AnomalousWWHVertex::Init() { - - static ClassDocumentation documentation - ("The AnomalousWWHVertex class implemenets the Higgs coupling to two electroweak" - " vector bosons including the option of anomalous couplings."); - - static Switch interfaceInteractionType - ("InteractionType", - "The type of interaction", - &AnomalousWWHVertex::interactionType_, 0, false, false); - static SwitchOption interfaceInteractionTypeSM - (interfaceInteractionType, - "SM", - "Use the standard model form", - 0); - static SwitchOption interfaceInteractionTypeCPOdd - (interfaceInteractionType, - "CPOdd", - "Use a CP odd form", - 1); - static SwitchOption interfaceInteractionTypeCPEven - (interfaceInteractionType, - "CPEven", - "Use a CP even form", - 2); - - static Parameter interfaceLambda - ("Lambda", - "The scale of new physics", - &AnomalousWWHVertex::Lambda_, GeV, 1000.0*GeV, ZERO, 1000000.0*GeV, - false, false, Interface::limited); - -} - -void AnomalousWWHVertex::setCoupling(Energy2 q2,tcPDPtr a,tcPDPtr, tcPDPtr) { - int ibos=abs(a->id()); - a00(0.); - a11(0.); - a12(0.); - a21(0.); - a22(0.); - aEp(0.); - switch(interactionType_) { - case 0: - // first the overall normalisation - if(q2!=q2last_) { - couplast_ = weakCoupling(q2) * UnitRemoval::InvE * mw_; - q2last_ = q2; - } - if(ibos==24) norm(couplast_ ); - else if(ibos==23) norm(couplast_ * zfact_ ); - else - throw HelicityConsistencyError() << "AnomalousWWHVertex::setCoupling " - << "Invalid particles in WWH Vertex" - << Exception::runerror; - a00(double(UnitRemoval::E2/invariant(1,2))); - break; - case 1: - norm(double(UnitRemoval::E/Lambda_)); - aEp(1.); - break; - case 2: - norm(double(UnitRemoval::E/Lambda_)); - a00( 1.); - a21(-1.); - break; - default: - throw HelicityConsistencyError() << "AnomalousWWHVertex::setCoupling " - << "Unknown type of interaction" - << Exception::runerror; - } -} diff --git a/Contrib/AnomalousHVV/AnomalousWWHVertex.h b/Contrib/AnomalousHVV/AnomalousWWHVertex.h deleted file mode 100644 --- a/Contrib/AnomalousHVV/AnomalousWWHVertex.h +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_AnomalousWWHVertex_H -#define HERWIG_AnomalousWWHVertex_H -// -// This is the declaration of the AnomalousWWHVertex class. -// - -#include "ThePEG/Helicity/Vertex/Scalar/GeneralVVSVertex.h" - -namespace Herwig { -using namespace ThePEG; - -/** - * The AnomalousWWHVertex class implements the option of an anomalous - * coupling in the \f$h^0W^+W^+\f$ and \f$h^0Z^0Z^0\f$ vertices. - * - * The options of using either the exact Standard Model, a CP-odd - * \f[\frac1{\Lambda}J_1^\mu J_2^\nu\epsilon^{\mu\nu\alpha\beta}q_{1\alpha}q_{2\beta},\f] - * or CP-even - * \f[\frac1{\Lambda}J_1^\mu J_2^\nu - * \left[g_{\mu\nu}q_1 \cdot q_2-q_{1\nu}q_{2\mu}\right],\f] - * form, where \f$\Lambda\f$ is the scale of the new operator. - * - * @see \ref AnomalousWWHVertexInterfaces "The interfaces" - * defined for AnomalousWWHVertex. - */ -class AnomalousWWHVertex: public Helicity::GeneralVVSVertex { - -public: - - /** - * The default constructor. - */ - AnomalousWWHVertex(); - - /** - * Calculate coupling. - * @param q2 Scale at which to evaluate couplings - * @param part1 ParticleDataPointer to first particle - * @param part2 ParticleDataPointer to second particle - * @param part3 ParticleDataPointer to 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 and - * 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. - */ - AnomalousWWHVertex & operator=(const AnomalousWWHVertex &) = delete; - - /** - * Switch for the type of interaction - */ - unsigned int interactionType_; - - /** - * The scale \f$\Lambda\f$ - */ - Energy Lambda_; - - /** - * Storage of the couplings. - */ - //@{ - /** - * The last value of the electroweak coupling calculated. - */ - Complex couplast_; - - /** - * The scale \f$q^2\f$ at which the coupling was last evaluated. - */ - Energy2 q2last_; - - /** - * The mass of the \f$W\f$ boson. - */ - Energy mw_; - - /** - * The factor for the \f$Z\f$ vertex. - */ - double zfact_; - //@} -}; - -} - -#endif /* HERWIG_AnomalousWWHVertex_H */ diff --git a/Contrib/AnomalousHVV/LHC.in b/Contrib/AnomalousHVV/LHC.in deleted file mode 100644 --- a/Contrib/AnomalousHVV/LHC.in +++ /dev/null @@ -1,57 +0,0 @@ -# -*- ThePEG-repository -*- -################################################## -# Example generator based on LHC parameters -# usage: Herwig read LHC.in -################################################## -read PPCollider.in -################################################## -# Technical parameters for this run -################################################## -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 10000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:PrintEvent 10 -set EventGenerator:MaxErrors 10000 -set EventGenerator:EventHandler:CascadeHandler NULL -set EventGenerator:EventHandler:DecayHandler NULL -set EventGenerator:EventHandler:HadronizationHandler NULL -set /Herwig/Particles/h0:Stable 1 -set /Herwig/Cuts/JetKtCut:MinKT 20.0*GeV -set /Herwig/Cuts/JetKtCut:MinEta -4.5 -set /Herwig/Cuts/JetKtCut:MaxEta 4.5 - -################################################## -# LHC physics parameters (override defaults here) -################################################## -set EventGenerator:EventHandler:LuminosityFunction:Energy 14000.0 - - -################################################## -# Matrix Elements for hadron-hadron collisions -# (by default only gamma/Z switched on) -################################################## -cd /Herwig/MatrixElements/ -set MEPP2HiggsVBF:Process 1 -set MEPP2HiggsVBF:MaxFlavour 2 -insert SubProcess:MatrixElements[0] MEPP2HiggsVBF - - -create Herwig::AnomalousWWHVertex /Herwig/Vertices/AnonWWHVertex AnomalousHVV.so -set /Herwig/Vertices/AnonWWHVertex:InteractionType SM -set /Herwig/Model:Vertex/WWH /Herwig/Vertices/AnonWWHVertex - - -cd /Herwig/Generators - -################################################## -# Useful analysis handlers for hadron-hadron physics -################################################## -# analysis of W/Z events -set /Herwig/Analysis/Basics:CheckQuark 0 -create Herwig::SimpleVBFAnalysis /Herwig/Analysis/VBF AnomalousWWHVertex.so -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/VBF - -################################################## -# Save run for later usage with 'Herwig run' -################################################## -saverun LHC EventGenerator diff --git a/Contrib/AnomalousHVV/Makefile.in b/Contrib/AnomalousHVV/Makefile.in deleted file mode 100644 --- a/Contrib/AnomalousHVV/Makefile.in +++ /dev/null @@ -1,35 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE = -HERWIGINCLUDE = -GSLINCLUDE = -LDFLAGS = -SHARED_FLAG = -INCLUDE = $(THEPEGINCLUDE) $(HERWIGINCLUDE) $(GSLINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : AnomalousHVV.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -AnomalousHVV.so : AnomalousWWHVertex.o SimpleVBFAnalysis.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - AnomalousWWHVertex.o SimpleVBFAnalysis.o -o AnomalousHVV.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) RadiativeZPrime.so \ No newline at end of file diff --git a/Contrib/AnomalousHVV/SimpleVBFAnalysis.cc b/Contrib/AnomalousHVV/SimpleVBFAnalysis.cc deleted file mode 100644 --- a/Contrib/AnomalousHVV/SimpleVBFAnalysis.cc +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the SimpleVBFAnalysis class. -// - -#include "SimpleVBFAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Particle.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void SimpleVBFAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector part = event->getFinalState(); - tPVector jets; - for(tPVector::const_iterator iter = part.begin(), end = part.end(); - iter!=end;++iter) { - if((**iter).id()==ParticleID::h0) continue; - if((**iter).momentum().perp()<20.*GeV) continue; - if(abs((**iter).momentum().eta())>4.5) continue; - jets.push_back(*iter); - } - if(jets.size()!=2) return; - double eta[2]={jets[0]->momentum().eta(), - jets[1]->momentum().eta()}; - if(eta[0]*eta[1]>0.) return; - if(abs(eta[0]-eta[1])<4.2) return; - double deltaPhi = jets[0]->momentum().phi()-jets[1]->momentum().phi(); - if(deltaPhi<-Constants::pi) deltaPhi+=Constants::twopi; - if(deltaPhi> Constants::pi) deltaPhi-=Constants::twopi; - *_deltaPhi += abs(deltaPhi); -} - -IBPtr SimpleVBFAnalysis::clone() const { - return new_ptr(*this); -} - -IBPtr SimpleVBFAnalysis::fullclone() const { - return new_ptr(*this); -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigSimpleVBFAnalysis("Herwig::SimpleVBFAnalysis", "AnomalousHVV.so"); - -void SimpleVBFAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the SimpleVBFAnalysis class"); - -} - -void SimpleVBFAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - using namespace HistogramOptions; - _deltaPhi->topdrawOutput(outfile,Frame,"BLACK","Delta Phi"); - outfile.close(); -} - -void SimpleVBFAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _deltaPhi = new_ptr(Histogram(0,Constants::pi,200)); -} diff --git a/Contrib/AnomalousHVV/SimpleVBFAnalysis.h b/Contrib/AnomalousHVV/SimpleVBFAnalysis.h deleted file mode 100644 --- a/Contrib/AnomalousHVV/SimpleVBFAnalysis.h +++ /dev/null @@ -1,126 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_SimpleVBFAnalysis_H -#define HERWIG_SimpleVBFAnalysis_H -// -// This is the declaration of the SimpleVBFAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the SimpleVBFAnalysis class. - * - * @see \ref SimpleVBFAnalysisInterfaces "The interfaces" - * defined for SimpleVBFAnalysis. - */ -class SimpleVBFAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - SimpleVBFAnalysis & operator=(const SimpleVBFAnalysis &) = delete; - -private: - - /** - * Histogram for \f$\Delta\phi\f$ - */ - HistogramPtr _deltaPhi; - -}; - -} - -#endif /* HERWIG_SimpleVBFAnalysis_H */ diff --git a/Contrib/DecayAnalysis/BabarBDecayAnalysis.cc b/Contrib/DecayAnalysis/BabarBDecayAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/BabarBDecayAnalysis.cc +++ /dev/null @@ -1,153 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the BabarBDecayAnalysis class. -// - -#include "BabarBDecayAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/ClassDocumentation.h" - -using namespace Herwig; - -IBPtr BabarBDecayAnalysis::clone() const { - return new_ptr(*this); -} - -IBPtr BabarBDecayAnalysis::fullclone() const { - return new_ptr(*this); -} - -void BabarBDecayAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - set particles; - StepVector steps = event->primaryCollision()->steps(); - if (steps.size() > 2) { - for ( StepVector::const_iterator it = steps.begin()+2; - it != steps.end(); ++it ) { - (**it).select(inserter(particles), ThePEG::AllSelector()); - } - } - for(set::const_iterator it=particles.begin(); - it!=particles.end();++it) { - long id = (**it).id(); - if(!(abs(id)==ParticleID::B0||abs(id)==ParticleID::Bplus)) continue; - map count; - vector charmed; - findCharm(*it,charmed); - for(unsigned int ix=0;ix 0 ? charmed[ix]->id() : -charmed[ix]->id(); - if(abs(id)==ParticleID::B0) { - if (_b0data.find(idc) != _b0data.end()) ++count[idc]; - } - else { - if (_bplusdata.find(idc) != _bplusdata.end()) ++count[idc]; - } - } - if(abs(id)==ParticleID::B0) { - // store info - for(map::iterator it = _b0data.begin(); - it != _b0data.end(); ++it) { - long currentcount - = count.find(it->first) == count.end() ? 0 : count[it->first]; - it->second.count += currentcount; - } - } - else { - // store info - for(map::iterator it = _bplusdata.begin(); - it != _bplusdata.end(); ++it) { - long currentcount - = count.find(it->first) == count.end() ? 0 : count[it->first]; - it->second.count += currentcount; - } - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigBabarBDecayAnalysis("Herwig::BabarBDecayAnalysis", "HwDecayAnalysis.so"); - -void BabarBDecayAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the BabarBDecayAnalysis class"); - -} - -void BabarBDecayAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string filename = generator()->filename() + ".Bdecaymult"; - string dec="B0->"; - ofstream outfile(filename.c_str()); - outfile << - "\nParticle multiplicities (compared to Upsilon(4s) data):\n" - " ID Name simMult obsMult obsErr Sigma\n"; - for (map::const_iterator it = _b0data.begin(); - it != _bplusdata.end(); - ++it) { - if(it==_b0data.end()) { - it=_bplusdata.begin(); - dec="B+->"; - } - MultiplicityInfo multiplicity = it->second; - string name = dec+generator()->getParticleData(it->first)->PDGName(); - ios::fmtflags oldFlags = outfile.flags(); - outfile << std::scientific << std::showpoint - << std::setprecision(3) - << setw(7) << it->first << ' ' - << setw(17) << 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.close(); - - -} - -void BabarBDecayAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - // B0 multiplicities - _b0data[ 421 ] = MultiplicityInfo( 0.081,0.015, other); - _b0data[-421 ] = MultiplicityInfo( 0.474,0.028, other); - _b0data[ 411 ] = MultiplicityInfo( 0.023,0.013, other); - _b0data[-411 ] = MultiplicityInfo( 0.369,0.033, other); - _b0data[ 431 ] = MultiplicityInfo( 0.079,0.014, other); - _b0data[-431 ] = MultiplicityInfo( 0.103,0.021, other); - _b0data[ 4122] = MultiplicityInfo( 0.016,0.011, other); - _b0data[-4122] = MultiplicityInfo( 0.050,0.021, other); - // B+ multiplicities - _bplusdata[ 421 ] = MultiplicityInfo( 0.086,0.007, other); - _bplusdata[-421 ] = MultiplicityInfo( 0.790,0.040, other); - _bplusdata[ 411 ] = MultiplicityInfo( 0.025,0.005, other); - _bplusdata[-411 ] = MultiplicityInfo( 0.099,0.012, other); - _bplusdata[ 431 ] = MultiplicityInfo( 0.079,0.014, other); - _bplusdata[-431 ] = MultiplicityInfo( 0.011,0.004, other); - _bplusdata[ 4122] = MultiplicityInfo( 0.021,0.009, other); - _bplusdata[-4122] = MultiplicityInfo( 0.028,0.011, other); -} - -void BabarBDecayAnalysis::findCharm(tcPPtr parent,vector & charmed) { - if(parent->children().empty()) return; - for(unsigned int ix=0;ixchildren().size();++ix) { - long id = abs(parent->children()[ix]->id()); - if(id==ParticleID::Dplus || id==ParticleID::D0 || - id==ParticleID::D_splus || id==ParticleID::Lambda_cplus) { - charmed.push_back(parent->children()[ix]); - } - findCharm(parent->children()[ix],charmed); - } -} diff --git a/Contrib/DecayAnalysis/BabarBDecayAnalysis.h b/Contrib/DecayAnalysis/BabarBDecayAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/BabarBDecayAnalysis.h +++ /dev/null @@ -1,116 +0,0 @@ -// -*- C++ -*- -#ifndef THEPEG_BabarBDecayAnalysis_H -#define THEPEG_BabarBDecayAnalysis_H -// -// This is the declaration of the BabarBDecayAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Analysis/MultiplicityInfo.h" - -namespace Herwig { -using namespace ThePEG; - -/** - * Here is the documentation of the BabarBDecayAnalysis class. - * - * @see \ref BabarBDecayAnalysisInterfaces "The interfaces" - * defined for BabarBDecayAnalysis. - */ -class BabarBDecayAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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: - - /** - * Member to find the charmed children of a B meson - */ - void findCharm(tcPPtr,vector & charmed); - -protected: - - /** @name Clone Methods. */ - //@{ - /** - * Make a simple clone of this object. - * @return a pointer to the new object. - */ - virtual IBPtr clone() const; - - /** Make a clone of this object, possibly modifying the cloned object - * to make it sane. - * @return a pointer to the new object. - */ - virtual IBPtr fullclone() const; - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - BabarBDecayAnalysis & operator=(const BabarBDecayAnalysis &) = delete; - -private: - - /** - * Map of PDG codes to multiplicity info - */ - map _b0data,_bplusdata; - -}; - -} - -#endif /* THEPEG_BabarBDecayAnalysis_H */ diff --git a/Contrib/DecayAnalysis/BeamCorrelationAnalysis.cc b/Contrib/DecayAnalysis/BeamCorrelationAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/BeamCorrelationAnalysis.cc +++ /dev/null @@ -1,76 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the BeamCorrelationAnalysis class. -// - -#include "BeamCorrelationAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void BeamCorrelationAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - PPair beam=event->primaryCollision()->primarySubProcess()->incoming(); - ParticleVector incoming=event->primaryCollision()->primarySubProcess()->outgoing(); - if(incoming.size()!=1) return; - ParticleVector outgoing=incoming[0]->children(); - if(outgoing.size()!=2) return; - int id0=incoming[0]->id(); - int id1=abs(outgoing[0]->id()); - int iloc(-1); - for(unsigned int ix=0;ix<_incoming.size();++ix) { - if(id0==_incoming[ix]&&id1==_outgoing[ix]) { - iloc=ix; - break; - } - } - if(iloc<0) { - iloc=_incoming.size(); - _incoming.push_back(id0); - _outgoing.push_back(id1); - _angle.push_back(new_ptr(Histogram(Histogram(0.,Constants::pi,200)))); - } - tPPtr in = beam.first->id()>0 ? beam.first : beam.second; - tPPtr out; - for(unsigned int ix=0;ixid()>0) out=outgoing[ix]; - } - if(!in||!out) return; - _angle[iloc]->addWeighted(in->momentum().angle(out->momentum()), - event->weight()); -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigBeamCorrelationAnalysis("Herwig::BeamCorrelationAnalysis", "HwDecayAnalysis.so"); - -void BeamCorrelationAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the BeamCorrelationAnalysis class"); - -} - -inline void BeamCorrelationAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + - string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - for(unsigned int ix=0;ix<_incoming.size();++ix) { - string title= "Angle for " + getParticleData(_incoming[ix])->PDGName() + - " -> " + getParticleData(_outgoing[ix])->PDGName() + - getParticleData(-_outgoing[ix])->PDGName(); - using namespace HistogramOptions; - _angle[ix]->topdrawOutput(output,Frame|Errorbars, - "RED",title,"", - "1/SdS/dQ", - " G G G", - "Q", - "G"); - } -} diff --git a/Contrib/DecayAnalysis/BeamCorrelationAnalysis.h b/Contrib/DecayAnalysis/BeamCorrelationAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/BeamCorrelationAnalysis.h +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_BeamCorrelationAnalysis_H -#define HERWIG_BeamCorrelationAnalysis_H -// -// This is the declaration of the BeamCorrelationAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The documentation of the BeamCorrelationAnalysis class - * is designed to plot the angle in the lab frame of an outgoing particle - * w.r.t to an incoming particle to test the spin correlations. - * - * @see \ref BeamCorrelationAnalysisInterfaces "The interfaces" - * defined for BeamCorrelationAnalysis. - */ -class BeamCorrelationAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - BeamCorrelationAnalysis & operator=(const BeamCorrelationAnalysis &) = delete; - -private: - - /** - * PDG code of the outgoing particle - */ - vector _outgoing; - - /** - * PDG code of the incoming particle - */ - vector _incoming; - - /** - * Histograms - */ - vector _angle; - -}; - -} - -#endif /* HERWIG_BeamCorrelationAnalysis_H */ diff --git a/Contrib/DecayAnalysis/BranchingRatioAnalysis.cc b/Contrib/DecayAnalysis/BranchingRatioAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/BranchingRatioAnalysis.cc +++ /dev/null @@ -1,128 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the BranchingRatioAnalysis class. -// - -#include "BranchingRatioAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void BranchingRatioAnalysis::analyze(tEventPtr event, long , int , int ) { - // find all vector particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).id()==_particle->id()) particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -void BranchingRatioAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void BranchingRatioAnalysis::analyze(tPPtr part) { - tDMPtr mode=part->decayMode(); - if(!mode) return; - if(_points.find(mode)==_points.end()) { - _points[mode]=vector(101,0.); - } - if(part->mass()>=part->dataPtr()->massMin()&& - part->mass()<=part->dataPtr()->massMax()) { - int ibin = - int((part->mass() -part->dataPtr()->massMin())/ - (part->dataPtr()->massMax()-part->dataPtr()->massMin())*100.); - if(ibin>=0&&ibin<100) { - _points[mode][ibin]+=1.; - _total[ibin]+=1.; - _points[mode][100]+=1.; - _total[100]+=1.; - } - } -} - -void BranchingRatioAnalysis::persistentOutput(PersistentOStream & os) const { - os << _particle; -} - -void BranchingRatioAnalysis::persistentInput(PersistentIStream & is, int) { - is >> _particle; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigBranchingRatioAnalysis("Herwig::BranchingRatioAnalysis", "HwDecayAnalysis.so"); - -void BranchingRatioAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the BranchingRatioAnalysis class"); - - static Reference interfaceParticle - ("Particle", - "The particle for which the analysis is being perform", - &BranchingRatioAnalysis::_particle, false, false, true, false, false); - -} - -void BranchingRatioAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + - string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - map >::const_iterator it; - Energy step = (_particle->massMax()-_particle->massMin())/100.; - for(it=_points.begin();it!=_points.end();++it) { - output << "NEW FRAME\n"; - output << "SET FONT DUPLEX\n"; - output << "TITLE TOP \"BR for " << it->first->tag() - << "Total = " << it->second[100]/_total[100] << "\"\n"; - output << "SET LIMITS X " - << _particle->massMin()/GeV << " " - << _particle->massMax()/GeV << "\n"; - Energy mass = _particle->massMin()-0.5*step; - for(unsigned int ix=0;ixsecond.size()-1;++ix) { - mass+=step; - if(_total[ix]>0.) { - output << mass/GeV << "\t" << it->second[ix]/_total[ix] << "\n"; - } - else { - output << mass/GeV << "\t 0. \n"; - } - } - output << "HIST\n"; - output << "NEW FRAME\n"; - output << "SET FONT DUPLEX\n"; - output << "TITLE TOP \"Mass distribution for " - << it->first->tag() << "\"\n"; - mass = _particle->massMin()-0.5*step; - for(unsigned int ix=0;ixsecond.size()-1;++ix) { - mass+=step; - if(_total[ix]>0.) { - output << mass/GeV << "\t" - << it->second[ix]/it->second[100]*GeV/step - << "\n"; - } - else { - output << mass/GeV << "\t 0. \n"; - } - } - output << "HIST\n"; - } -} diff --git a/Contrib/DecayAnalysis/BranchingRatioAnalysis.h b/Contrib/DecayAnalysis/BranchingRatioAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/BranchingRatioAnalysis.h +++ /dev/null @@ -1,151 +0,0 @@ -// -*- C++ -*- -#ifndef THEPEG_BranchingRatioAnalysis_H -#define THEPEG_BranchingRatioAnalysis_H -// -// This is the declaration of the BranchingRatioAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "ThePEG/PDT/ParticleData.h" -#include "ThePEG/PDT/DecayMode.h" - -namespace Herwig { -using namespace ThePEG; - -/** - * Here is the documentation of the BranchingRatioAnalysis class. - * - * @see \ref BranchingRatioAnalysisInterfaces "The interfaces" - * defined for BranchingRatioAnalysis. - */ -class BranchingRatioAnalysis: public AnalysisHandler { - -public: - - /** - * Constructor - */ - inline BranchingRatioAnalysis() : _total(101,0.) {}; - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - BranchingRatioAnalysis & operator=(const BranchingRatioAnalysis &) = delete; - -private: - - /** - * The particle for whihc we are performing the analysis - */ - PDPtr _particle; - - /** - * The various decay modes - */ - map > _points; - - /** - * Total entry - */ - vector _total; - -}; - -} - -#endif /* THEPEG_BranchingRatioAnalysis_H */ diff --git a/Contrib/DecayAnalysis/BtoSGammaAnalysis.cc b/Contrib/DecayAnalysis/BtoSGammaAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/BtoSGammaAnalysis.cc +++ /dev/null @@ -1,131 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the BtoSGammaAnalysis class. -// - -#include "BtoSGammaAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void BtoSGammaAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all three body B decays - tPVector particles; - for(unsigned int ix=1, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all()); - ThePEG::ParticleSet::iterator iter(part.begin()),end(part.end()); - for( ;iter!=end;++iter) { - if((abs((**iter).id())==ParticleID::Bplus||abs((**iter).id())==ParticleID::B0)) - particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -void BtoSGammaAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void BtoSGammaAnalysis::analyze(tPPtr part) { - Lorentz5Momentum phad; - Lorentz5Momentum pgamma; - unsigned int ngamma(0); - for(unsigned int ix=0;ixchildren().size();++ix) { - if(part->children()[ix]->id()==ParticleID::gamma) { - ++ngamma; - pgamma+=part->children()[ix]->momentum(); - } - else { - phad+=part->children()[ix]->momentum(); - } - } - if(ngamma!=1) return; - int id(part->id()); - unsigned int imode; - if(id==ParticleID::B0) imode=0; - else if(id==ParticleID::Bbar0) imode=1; - else if(id==ParticleID::Bplus) imode=2; - else if(id==ParticleID::Bminus) imode=3; - else return; - // calculate the hadronic mass - phad.rescaleMass(); - *_hadmass[imode] += phad.mass()/MeV; - pgamma.boost(-part->momentum().boostVector()); - *_spectrum[imode]+=pgamma.e()/MeV; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigBtoSGammaAnalysis("Herwig::BtoSGammaAnalysis", "HwDecayAnalysis.so"); - -void BtoSGammaAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the BtoSGammaAnalysis class"); - -} - -void BtoSGammaAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() - + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - // output the histograms - string title,temp[2],tcase; - for(unsigned int ix=0;ix<4;++ix) { - if(ix==0) { - title="B203"; - tcase=" X X"; - } - else if(ix==1) { - title="B0O203"; - tcase=" UDX X"; - } - else if(ix==2) { - title="B2+3"; - tcase=" X X"; - } - else if(ix==3) { - title="B2-3"; - tcase=" X X"; - } - temp[0] = "Hadronic Mass for " + title; - temp[1] = " " + tcase; - using namespace HistogramOptions; - _hadmass[ix]->topdrawOutput(output,Frame|Errorbars, - "RED", - temp[0],temp[1], - "1/SdS/dm/GeV2-13", - " G G X X", - "m/GeV", - " "); - temp[0]= "Photon spectrum for " + title; - temp[1]= " " + tcase; - _spectrum[ix]->topdrawOutput(output,Frame|Errorbars, - "RED", - temp[0],temp[1], - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1/GeV", - " XGX "); - } -} - -void BtoSGammaAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<4;++ix) { - _hadmass.push_back(new_ptr(Histogram(850.,4500.,100))); - _spectrum.push_back(new_ptr(Histogram(0.,2800.,100))); - } -} diff --git a/Contrib/DecayAnalysis/BtoSGammaAnalysis.h b/Contrib/DecayAnalysis/BtoSGammaAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/BtoSGammaAnalysis.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_BtoSGammaAnalysis_H -#define HERWIG_BtoSGammaAnalysis_H -// -// This is the declaration of the BtoSGammaAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the BtoSGammaAnalysis class. - * - * @see \ref BtoSGammaAnalysisInterfaces "The interfaces" - * defined for BtoSGammaAnalysis. - */ -class BtoSGammaAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - BtoSGammaAnalysis & operator=(const BtoSGammaAnalysis &) = delete; - -private: - - /** - * Histograms for the hadronic mass - */ - vector _hadmass; - - /** - * Histograms for the spectrum - */ - vector _spectrum; -}; - -} - -#endif /* HERWIG_BtoSGammaAnalysis_H */ diff --git a/Contrib/DecayAnalysis/DDalitzAnalysis.cc b/Contrib/DecayAnalysis/DDalitzAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/DDalitzAnalysis.cc +++ /dev/null @@ -1,491 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the DDalitzAnalysis class. -// - -#include "DDalitzAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - - -void DDalitzAnalysis:: -findChildren(tPPtr part,ParticleVector & prod) { - if(part->children().empty()) { - prod.push_back(part); - } - else { - for(unsigned ix=0;ixchildren().size();++ix) { - findChildren(part->children()[ix],prod); - } - } -} - -void DDalitzAnalysis::analyze(tEventPtr event, long , int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all D0/Dbar0 and D+/- - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if(abs((**iter).id())==ParticleID::D0|| - abs((**iter).id())==ParticleID::Dplus|| - abs((**iter).id())==ParticleID::D_splus) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -LorentzRotation DDalitzAnalysis::transform(tEventPtr ) const { - return LorentzRotation(); - // Return the Rotation to the frame in which you want to perform the analysis. -} - -void DDalitzAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void DDalitzAnalysis::analyze(tPPtr part) { - // find the stable decay products - ParticleVector products; - findChildren(part,products); - vector ppim,ppip,pk0,pkp,pkm,ppi0; - if(products.size()!=3) return; - for(unsigned int ix=0;ixid(); - if(id0==ParticleID::piplus) ppip.push_back(products[ix]->momentum()); - else if(id0==ParticleID::piminus) ppim.push_back(products[ix]->momentum()); - else if(id0==ParticleID::pi0) ppi0.push_back(products[ix]->momentum()); - else if(abs(id0)==ParticleID::K0) pk0 .push_back(products[ix]->momentum()); - else if(id0==ParticleID::K_L0) pk0 .push_back(products[ix]->momentum()); - else if(id0==ParticleID::K_S0) pk0 .push_back(products[ix]->momentum()); - else if(id0==ParticleID::Kplus) pkp.push_back(products[ix]->momentum()); - else if(id0==ParticleID::Kminus) pkm.push_back(products[ix]->momentum()); - } - Energy2 mplus,mminus,mpipi,mneut; - if(ppim.size()==1&&ppip.size()==1&&pk0.size()==1) { - if(part->id()==ParticleID::D0) { - mminus = (ppim.back()+pk0.back() ).m2(); - mplus = (ppip.back()+pk0.back() ).m2(); - mpipi = (ppip.back()+ppim.back()).m2(); - } - else { - mminus = (ppip.back()+pk0.back()).m2(); - mplus = (ppim.back()+pk0.back()).m2(); - mpipi = (ppip.back()+ppim.back()).m2(); - } - *_m2plus1 +=mplus/GeV2; - *_m2minus1 +=mminus/GeV2; - *_m2pipi1 +=mpipi/GeV2; - if(_points1.size()<200000) { - _points1.push_back(make_pair(mplus,mminus)); - } - } - else if ((ppim.size()==1&&pkp.size()==1&&ppi0.size()==1)|| - (ppip.size()==1&&pkm.size()==1&&ppi0.size()==1)) { - if(part->id()==ParticleID::D0) { - mneut =(pkm .back()+ppip.back()).m2(); - mminus=(pkm .back()+ppi0.back()).m2(); - mpipi =(ppip.back()+ppi0.back()).m2(); - } - else { - mneut =(pkp .back()+ppim.back()).m2(); - mminus=(pkp .back()+ppi0.back()).m2(); - mpipi =(ppim.back()+ppi0.back()).m2(); - } - *_m2neutral2 +=mneut/GeV2; - *_m2minus2 +=mminus/GeV2; - *_m2pipi2 +=mpipi/GeV2; - if(_points2.size()<200000) { - _points2.push_back(make_pair(mminus,mneut)); - } - } - else if ((ppip.size()==2&&pkm.size()==1)|| - (ppim.size()==2&&pkp.size()==1)) { - if(part->id()==ParticleID::Dplus) { - mplus = (pkm[0] +ppip[0]).m2(); - mminus = (pkm[0] +ppip[1]).m2(); - mpipi = (ppip[0]+ppip[1]).m2(); - } - else { - mplus = (pkp[0] +ppim[0]).m2(); - mminus = (pkp[0] +ppim[1]).m2(); - mpipi = (ppim[0]+ppim[1]).m2(); - } - if(mplusid()==ParticleID::Dplus) { - mminus = (pk0[0]+ppip[0]).m2(); - mplus = (pk0[0]+ppi0[0]).m2(); - mpipi = (ppip[0]+ppi0[0]).m2(); - } - else { - mminus = (pk0[0]+ppim[0]).m2(); - mplus = (pk0[0]+ppi0[0]).m2(); - mpipi = (ppim[0]+ppi0[0]).m2(); - } - *_m2Kpip4 += mminus/GeV2; - *_m2pipi4 += mpipi /GeV2; - *_m2Kpi04 += mplus /GeV2; - if(_points4.size()<200000) { - _points4.push_back(make_pair(mplus,mpipi)); - } - } - else if ((ppim.size()==1&&pkp.size()==1&&ppip.size()==1)|| - (ppim.size()==1&&pkm.size()==1&&ppip.size()==1)) { - unsigned int itype(0); - if(part->id()==ParticleID::Dplus) { - itype=1; - mplus = (pkp [0]+ppip[0]).m2(); - mminus = (pkp [0]+ppim[0]).m2(); - mpipi = (ppip[0]+ppim[0]).m2(); - } - else if(part->id()==ParticleID::Dminus) { - itype=1; - mplus = (pkm [0]+ppim[0]).m2(); - mminus = (pkm [0]+ppip[0]).m2(); - mpipi = (ppip[0]+ppim[0]).m2(); - } - else if(part->id()==ParticleID::D_splus) { - itype=2; - mplus = (pkp [0]+ppip[0]).m2(); - mminus = (pkp [0]+ppim[0]).m2(); - mpipi = (ppip[0]+ppim[0]).m2(); - } - else if(part->id()==ParticleID::D_sminus) { - itype=2; - mplus = (pkm [0]+ppim[0]).m2(); - mminus = (pkm [0]+ppip[0]).m2(); - mpipi = (ppip[0]+ppim[0]).m2(); - } - else return; - if(itype==1) { - *_mkppim5 +=mminus/GeV2; - *_mkppip5 +=mplus /GeV2; - *_mpippim5+=mpipi /GeV2; - _points5.push_back(make_pair(mminus,mpipi)); - } - else { - *_mkppim6 +=mminus/GeV2; - *_mkppip6 +=mplus /GeV2; - *_mpippim6+=mpipi /GeV2; - _points6.push_back(make_pair(mminus,mpipi)); - } - } - - -} - -void DDalitzAnalysis::persistentOutput(PersistentOStream & ) const { -} - -void DDalitzAnalysis::persistentInput(PersistentIStream & , int) { -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigDDalitzAnalysis("Herwig::DDalitzAnalysis", "HwDecayAnalysis.so"); - -void DDalitzAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the DDalitzAnalysis class"); - -} - -void DDalitzAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _m2plus1->topdrawOutput(output,Frame|Errorbars,"RED", - "m0+1223 for D203RK203P2+3P2-3", - " X XX X X XW X XGX XGX X", - "1/GdG/m0+1223/GeV2-23", - " F F X XX X X X", - "m0+1223/GeV223", - " X XX X X X"); - _m2minus1->topdrawOutput(output,Frame|Errorbars,"RED", - "m0-1223 for D203RK203P2+3P2-3", - " X XX X X XW X XGX XGX X", - "1/GdG/m0-1223/GeV2-23", - " F F X XX X X X", - "m0-1223/GeV223", - " X XX X X X"); - _m2pipi1->topdrawOutput(output,Frame|Errorbars,"RED", - "m0PP1223 for D203RK203P2+3P2-3", - " XGGXX X X XW X XGX XGX X", - "1/GdG/m0PP1223/GeV2-23", - " F F XGGXX X X X", - "m0PP1223/GeV223", - " XGGXX X X X"); - _m2minus2->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2-3P2031223 for D203RK2-3P2+3P203", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K2-3P2031223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2-3P2031223/GeV223", - " X X XGX XXX X X X"); - _m2neutral2->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2-3P2+31223 for D203RK2-3P2+3P203", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K2-3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2-3P2+31223/GeV223", - " X X XGX XXX X X X"); - _m2pipi2->topdrawOutput(output,Frame|Errorbars,"RED", - "m0PP1223 for D203RK2-3P2+3P203", - " XGGXX X X XW X XGX XGX X", - "1/GdG/m0PP1223/GeV2-23", - " F F XGGXX X X X", - "m0PP1223/GeV223", - " XGGXX X X X"); - _mKpilow3->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2-3P2+31223 for D2+3RK2-3P2+3P2+3 low", - " X X XGX XXX X X XW X XGX XGX X ", - "1/GdG/m0K2-3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2-3P2+31223/GeV223", - " X X XGX XXX X X X"); - _mKpihigh3->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2-3P2+31223 for D2+3RK2-3P2+3P2+3 high", - " X X XGX XXX X X XW X XGX XGX X ", - "1/GdG/m0K2-3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2-3P2+31223/GeV223", - " X X XGX XXX X X X"); - _mKpiall3->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2-3P2+31223 for D2+3RK2-3P2+3P2+3 all", - " X X XGX XXX X X XW X XGX XGX X ", - "1/GdG/m0K2-3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2-3P2+31223/GeV223", - " X X XGX XXX X X X"); - _mpipi3->topdrawOutput(output,Frame|Errorbars,"RED", - "m0P2+3P2+31223 for D2+3RK2-3P2+3P2+3 all", - " XGX XGX XXX X X XW X XGX XGX X ", - "1/GdG/m0P2+3P2+31223/GeV2-23", - " F F XGX XGX XXX X X X", - "m0P2+3P2+31223/GeV223", - " XGX XGX XXX X X X"); - _m2Kpip4->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K203P2+31223 for D2+3RK203P2+3P203", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K203P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K203P2+31223/GeV223", - " X X XGX XXX X X X"); - _m2pipi4->topdrawOutput(output,Frame|Errorbars,"RED", - "m0P203P2+31223 for D2+3RK203P2+3P203", - " XGX XGX XXX X X XW X XGX XGX X", - "1/GdG/m0P203P2+31223/GeV2-23", - " F F XGX XGX XXX X X X", - "m0P203P2+31223/GeV223", - " XGX XGX XXX X X X"); - _m2Kpi04->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K203P2-31223 for D2+3RK203P2+3P203", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K203P2-31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K203P2-31223/GeV223", - " X X XGX XXX X X X"); - _mkppim5->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2+3P2-31223 for D2+3RK2+3P2-3P2+3", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K2+3P2-31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2+3P2-31223/GeV223", - " X X XGX XXX X X X"); - _mkppip5->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2+3P2+31223 for D2+3RK2+3P2-3P2+3", - " X X XGX XXX X X XW X XGX XGX X", - "1/GdG/m0K2+3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2+3P2+31223/GeV223", - " X X XGX XXX X X X"); - _mpippim5->topdrawOutput(output,Frame|Errorbars,"RED", - "m0P2+3P2-31223 for D2+3RK2+3P2-3P2+3", - " XGX XGX XXX X X XW X XGX XGX X", - "1/GdG/m0P2+3P2-31223/GeV2-23", - " F F XGX XGX XXX X X X", - "m0P2+3P2-31223/GeV223", - " XGX XGX XXX X X X"); - _mkppim6->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2+3P2-31223 for D0s12+3RK2+3P2-3P2+3", - " X X XGX XXX X X XX XW X XGX XGX X", - "1/GdG/m0K2+3P2-31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2+3P2-31223/GeV223", - " X X XGX XXX X X X"); - _mkppip6->topdrawOutput(output,Frame|Errorbars,"RED", - "m0K2+3P2+31223 for D0s12+3RK2+3P2-3P2+3", - " X X XGX XXX X X XX XW X XGX XGX X", - "1/GdG/m0K2+3P2+31223/GeV2-23", - " F F X X XGX XXX X X X", - "m0K2+3P2+31223/GeV223", - " X X XGX XXX X X X"); - _mpippim6->topdrawOutput(output,Frame|Errorbars,"RED", - "m0P2+3P2-31223 for D0s12+3RK2+3P2-3P2+3", - " XGX XGX XXX X X XX XW X XGX XGX X", - "1/GdG/m0P2+3P2-31223/GeV2-23", - " F F XGX XGX XXX X X X", - "m0P2+3P2-31223/GeV223", - " XGX XGX XXX X X X"); - if(!_points1.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3 y 0 3\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D203RK203P2+3P2-3\"\n"; - output << "case \" X XW X XGX XGX X\"\n"; - output << "title left \"m0-1223/GeV223\"\n"; - output << "case \" X XX X X X\"\n"; - output << "title bottom \"m0+1223/GeV223\"\n"; - output << "case \" X XX X X X\"\n"; - for(unsigned int ix=0;ix<_points1.size();++ix) { - output << _points1[ix].first /GeV2 << " " - << _points1[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } - if(!_points2.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3 y 0 3\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D203RK2-3P2+3P203\"\n"; - output << "case \" X XW X XGX XGX X\"\n"; - output << "title left \"m0-1223/GeV223\"\n"; - output << "case \" X XX X X X\"\n"; - output << "title bottom \"m0+1223/GeV223\"\n"; - output << "case \" X XX X X X\"\n"; - for(unsigned int ix=0;ix<_points2.size();++ix) { - output << _points2[ix].first /GeV2 << " " - << _points2[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } - if(!_points3.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3 y 0 3\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D2+3RK2-3P2+3P2+3\"\n"; - output << "case \" X XW X XGX XGX X\"\n"; - output << "title left \"m0K2-3P2+31223\"\n"; - output << "case \" X X XGX XXX X\"\n"; - output << "title bottom \"m0P2+3P2+31223\"\n"; - output << "case \" XGX XGX XXX X\"\n"; - for(unsigned int ix=0;ix<_points3.size();++ix) { - output << _points3[ix].first /GeV2 << " " - << _points3[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } - if(!_points4.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3 y 0 3\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D2+3RK203P2+3P203\"\n"; - output << "case \" X XW X XGX XGX X\"\n"; - output << "title left \"m0P2+3P2031223\"\n"; - output << "case \" XGX XGX XXX X\"\n"; - output << "title bottom \"m0K203P2031223\"\n"; - output << "case \" X X XGX XXX X\"\n"; - for(unsigned int ix=0;ix<_points4.size();++ix) { - output << _points4[ix].first /GeV2 << " " - << _points4[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } - if(!_points5.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3 y 0 3\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D2+3RK2+3P2-3P2+3\"\n"; - output << "case \" X XW X XGX XGX X\"\n"; - output << "title left \"m0P2+3P2-31223\"\n"; - output << "case \" XGX XGX XXX X\"\n"; - output << "title bottom \"m0K2+3P2-31223\"\n"; - output << "case \" X X XGX XXX X\"\n"; - for(unsigned int ix=0;ix<_points5.size();++ix) { - output << _points5[ix].first /GeV2 << " " - << _points5[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } - if(!_points6.empty()) { - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x 0 3.5 y 0 2.5\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for D0s12+3RK2+3P2-3P2+3\"\n"; - output << "case \" X XX XW X XGX XGX X\"\n"; - output << "title left \"m0P2+3P2-31223\"\n"; - output << "case \" XGX XGX XXX X\"\n"; - output << "title bottom \"m0K2+3P2-31223\"\n"; - output << "case \" X X XGX XXX X\"\n"; - for(unsigned int ix=0;ix<_points6.size();++ix) { - output << _points6[ix].first /GeV2 << " " - << _points6[ix].second/GeV2 << "\n"; - if(ix%50000==0) output << "plot\n"; - } - output << "plot\n"; - } -} - -void DDalitzAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _m2plus1 = new_ptr(Histogram(0.,3.,200)); - _m2minus1 = new_ptr(Histogram(0.,3.,200)); - _m2pipi1 = new_ptr(Histogram(0.,2.,200)); - _m2minus2 = new_ptr(Histogram(0.,3.,200)); - _m2neutral2 = new_ptr(Histogram(0.,3.,200)); - _m2pipi2 = new_ptr(Histogram(0.,2.,200)); - _mKpilow3 = new_ptr(Histogram(0.,3.,200)); - _mKpihigh3 = new_ptr(Histogram(0.,3.,200)); - _mKpiall3 = new_ptr(Histogram(0.,3.,200)); - _mpipi3 = new_ptr(Histogram(0.,2.,200)); - _m2Kpip4 = new_ptr(Histogram(0.,3.,200)); - _m2pipi4 = new_ptr(Histogram(0.,2.,200)); - _m2Kpi04 = new_ptr(Histogram(0.,3.,200)); - _mkppim5 = new_ptr(Histogram(0.,3.,200)); - _mkppip5 = new_ptr(Histogram(0.,3.,200)); - _mpippim5 = new_ptr(Histogram(0.,3.,200)); - _mkppim6 = new_ptr(Histogram(0.,3.5,200)); - _mkppip6 = new_ptr(Histogram(0.,3.5,200)); - _mpippim6 = new_ptr(Histogram(0.,3.,200)); -} diff --git a/Contrib/DecayAnalysis/DDalitzAnalysis.h b/Contrib/DecayAnalysis/DDalitzAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/DDalitzAnalysis.h +++ /dev/null @@ -1,303 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_DDalitzAnalysis_H -#define HERWIG_DDalitzAnalysis_H -// -// This is the declaration of the DDalitzAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" -#include "ThePEG/EventRecord/Particle.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the DDalitzAnalysis class. - * - * @see \ref DDalitzAnalysisInterfaces "The interfaces" - * defined for DDalitzAnalysis. - */ -class DDalitzAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Transform the event to the desired Lorentz frame and return the - * corresponding LorentzRotation. - * @param event a pointer to the Event to be transformed. - * @return the LorentzRotation used in the transformation. - */ - virtual LorentzRotation transform(tEventPtr event) const; - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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: - - /** - * Find the stable decay products - */ - void findChildren(tPPtr,ParticleVector &); - -protected: - - /** @name Clone Methods. */ - //@{ - /** - * Make a simple clone of this object. - * @return a pointer to the new object. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - DDalitzAnalysis & operator=(const DDalitzAnalysis &) = delete; - -private: - - /** - * Histograms for \f$D^0\to \bar{K}^0\pi^+\pi^-\f$ - */ - //@{ - /** - * \f$m^2_+\f$ - */ - HistogramPtr _m2plus1; - - /** - * \f$m^2_+\f$ - */ - HistogramPtr _m2minus1; - - /** - * \f$m^2_{\pi\pi}\f$ - */ - HistogramPtr _m2pipi1; - - /** - * Vectors for the Dalitz plot - */ - vector > _points1; - //@} - - /** - * Histograms for \f$D^0\to K^-\pi^+\pi^0\f$ - */ - //@{ - /** - * Histogram for the \f$K^-\pi^+\f$ mass - */ - HistogramPtr _m2minus2; - - /** - * Histogram for the \f$\pi^+\pi^0\f$ mass - */ - HistogramPtr _m2pipi2; - - /** - * Histogram for the \f$K^-\pi^0\f$ mass - */ - HistogramPtr _m2neutral2; - - /** - * Vectors for the Dalitz plot - */ - vector > _points2; - //@} - - /** - * Histograms for \f$D^+\to K^-\pi^+\pi^+\f$ - */ - //@{ - /** - * Histogram for \f$K^-\pi^+\f$ low - */ - HistogramPtr _mKpilow3; - - /** - * Histogram for \f$K^-\pi^+\f$ high - */ - HistogramPtr _mKpihigh3; - - /** - * Histogram for \f$K^-\pi^+\f$ all - */ - HistogramPtr _mKpiall3; - - /** - * Histogram for \f$\pi^+\pi^-\f$ - */ - HistogramPtr _mpipi3; - - /** - * Vectors for the Dalitz plot - */ - vector > _points3; - //@} - - /** - * Histograms for \f$D^+\to\bar{K}^0\pi^+\pi^0\f$ - */ - //@{ - /** - * Histogram for the \f$\bar{K}^0\pi^+\f$ mass - */ - HistogramPtr _m2Kpip4; - - /** - * Histogram for the \f$\pi^+\pi^0\f$ mass - */ - HistogramPtr _m2pipi4; - - /** - * Histogram for the \f$\bar{K}^0\pi^0\f$ mass - */ - HistogramPtr _m2Kpi04; - - /** - * Vectors for the Dalitz plot - */ - vector > _points4; - //@} - - /** - * Histograms for \f$D^+\to K^+\pi^-\pi^+\f$ - */ - //@{ - /** - * Histogram for \f$K^+\pi^-\f$ - */ - HistogramPtr _mkppim5; - - /** - * Histogram for \f$K^+\pi^+\f$ - */ - HistogramPtr _mkppip5; - - /** - * Histogram for \f$\pi^+\pi^-\f$ - */ - HistogramPtr _mpippim5; - - /** - * Vectors for the Dalitz plot - */ - vector > _points5; - //@} - - /** - * Histograms for \f$D_s^+\to K^+\pi^-\pi^+\f$ - */ - //@{ - /** - * Histogram for \f$K^+\pi^-\f$ - */ - HistogramPtr _mkppim6; - - /** - * Histogram for \f$K^+\pi^+\f$ - */ - HistogramPtr _mkppip6; - - /** - * Histogram for \f$\pi^+\pi^-\f$ - */ - HistogramPtr _mpippim6; - - /** - * Vectors for the Dalitz plot - */ - vector > _points6; - //@} -}; - -} - -#endif /* HERWIG_DDalitzAnalysis_H */ diff --git a/Contrib/DecayAnalysis/EtaDecayAnalysis.cc b/Contrib/DecayAnalysis/EtaDecayAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/EtaDecayAnalysis.cc +++ /dev/null @@ -1,368 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the EtaDecayAnalysis class. -// - -#include "EtaDecayAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; -void EtaDecayAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - // find all eta and eta' particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) - {if((**iter).id()==ParticleID::eta||(**iter).id()==ParticleID::etaprime) - {particles.push_back(*iter);}} - } - // analyse them - analyze(particles); -} - -void EtaDecayAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void EtaDecayAnalysis::analyze(tPPtr part) { - // ensure 2 or 3 decay products - if(part->children().size()!=3&&part->children().size()!=2) return; - int imeson; - if(part->id()==ParticleID::eta) imeson=0; - else if(part->id()==ParticleID::etaprime) imeson=1; - else return; - // pi0 gamma gamma analysis - if(part->children().size()==3&& - part->children()[0]->id()==ParticleID::pi0&& - part->children()[1]->id()==ParticleID::gamma&& - part->children()[2]->id()==ParticleID::gamma) { - Lorentz5Momentum ptemp= - part->children()[1]->momentum()+part->children()[2]->momentum(); - ptemp.rescaleMass(); - *_mgammagamma[imeson] +=ptemp.mass()/MeV; - ptemp=part->children()[0]->momentum()+part->children()[1]->momentum(); - ptemp.rescaleMass(); - *_mpi0gamma[imeson] +=ptemp.mass()/MeV; - ptemp=part->children()[0]->momentum()+part->children()[2]->momentum(); - ptemp.rescaleMass(); - *_mpi0gamma[imeson] +=ptemp.mass()/MeV; - } - // pi+pi-gamma analysis - else if((part->children().size()==3&& - part->children()[0]->id()==ParticleID::piplus&& - part->children()[1]->id()==ParticleID::piminus&& - part->children()[2]->id()==ParticleID::gamma)|| - (part->children().size()==2&& - part->children()[0]->id()==ParticleID::rho0&& - part->children()[1]->id()==ParticleID::gamma)) { - Lorentz5Momentum pout[3]; - if(part->children().size()==2) { - pout[0]=part->children()[0]->children()[0]->momentum(); - pout[1]=part->children()[0]->children()[1]->momentum(); - pout[2]=part->children()[1]->momentum(); - } - else { - pout[0]=part->children()[0]->momentum(); - pout[1]=part->children()[1]->momentum(); - pout[2]=part->children()[2]->momentum(); - } - Lorentz5Momentum ptemp=pout[0]+pout[1]; - ptemp.rescaleMass(); - *_mpippim[imeson]+=ptemp.mass()/MeV; - Energy egamma = - 0.5*(part->mass()*part->mass()-ptemp.mass()*ptemp.mass())/part->mass(); - *_photonenergy[imeson]+=egamma/MeV; - ptemp=pout[imeson]+pout[2];ptemp.rescaleMass(); - *_mpipgamma[imeson]+=ptemp.mass()/MeV; - ptemp=pout[1]+pout[2];ptemp.rescaleMass(); - *_mpimgamma[imeson]+=ptemp.mass()/MeV; - } - else { - vector ppim,ppip,ppi0,peta; - for(unsigned int ix=0;ixchildren().size();++ix) { - long id = part->children()[ix]->id(); - if(id==ParticleID::piplus) - ppip .push_back(part->children()[ix]->momentum()); - else if(id==ParticleID::piminus) - ppim .push_back(part->children()[ix]->momentum()); - else if(id==ParticleID::pi0) - ppi0 .push_back(part->children()[ix]->momentum()); - else if(id==ParticleID::eta) - peta .push_back(part->children()[ix]->momentum()); - } - if(ppi0.size()==3) { - *_dpi0pi0[imeson]+=(ppi0[0]+ppi0[1]).m()/MeV; - *_dpi0pi0[imeson]+=(ppi0[0]+ppi0[2]).m()/MeV; - *_dpi0pi0[imeson]+=(ppi0[1]+ppi0[2]).m()/MeV; - } - else if(ppip.size()==1&&ppim.size()==1&&ppi0.size()==1) { - *_dpi0pip[imeson]+=(ppi0[0]+ppip[0]).m()/MeV; - *_dpi0pim[imeson]+=(ppi0[0]+ppim[0]).m()/MeV; - *_dpippim[imeson]+=(ppip[0]+ppim[0]).m()/MeV; - } - else if(ppi0.size()==2&&peta.size()==1) { - *_dpi0pi0[2]+=(ppi0[0]+ppi0[1]).m()/MeV; - *_dpi0eta[0]+=(ppi0[0]+peta[0]).m()/MeV; - *_dpi0eta[0]+=(ppi0[1]+peta[0]).m()/MeV; - } - else if(ppip.size()==1&&ppim.size()==1&&peta.size()==1) { - *_dpippim[2]+=(ppip[0]+ppim[0]).m()/MeV; - *_dpipeta[0]+=(ppip[0]+peta[0]).m()/MeV; - *_dpimeta[0]+=(ppim[0]+peta[0]).m()/MeV; - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigEtaDecayAnalysis("Herwig::EtaDecayAnalysis", "HwDecayAnalysis.so"); - -void EtaDecayAnalysis::Init() { - - static ClassDocumentation documentation - ("The EtaDecayAnalysis class performs the analysis of the decays of eta and eta\'" - " mesons"); - -} - -void EtaDecayAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _mgammagamma[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "GG mass in HRP203GG", - "GG GWGX XGG", - "1/GdG/dm0GG1/MeV2-13", - " F F XGGX X X", - "m0GG1/MeV", - " XGGX "); - _mpi0gamma[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203G mass in HRP203GG", - "GX XG GWGX XGG", - "1/GdG/dm0P203G1/MeV2-13", - " F F XGX XGX X X", - "m0P203G1/MeV", - " XGX XGX "); - _mgammagamma[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "GG mass in H'RP203GG", - "GG G WGX XGG", - "1/GdG/dm0GG1/MeV2-13", - " F F XGGX X X", - "m0GG1/MeV", - " XGGX "); - _mpi0gamma[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203G mass in H'RP203GG", - "GX XG G WGX XGG", - "1/GdG/dm0P203G1/MeV2-13", - " F F XGX XGX X X", - "m0P203G1/MeV", - " XGX XGX "); - _mpipgamma[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2+3G mass in HRP2+3P2-3G", - "GX XG GWGX XGX XG", - "1/GdG/dm0P2+3G1/MeV2-13", - " F F XGX XGX X X", - "m0P2+3G1/MeV", - " XGX XGX "); - _mpimgamma[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3G mass in HRP2+3P2-3G", - "GX XG GWGX XGX XG", - "1/GdG/dm0P2-3G1/MeV2-13", - " F F XGX XGX X X", - "m0P2-3G1/MeV", - " XGX XGX "); - _photonenergy[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "G Energy in HRP2+3P2-3G", - "G GWGX XGX XG", - "1/GdG/dE0G1/MeV2-13", - " F F XGX X X", - "E0G1/MeV", - " XGX "); - _mpippim[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3P2+3 mass in HRP2+3P2-3G", - "GX XGX X GWGX XGX XG", - "1/GdG/dm0P2-3P2+31/MeV2-13", - " F F 0GX XGX X1 X X", - "m0P2-3P2+31/MeV", - " XGX XGX XX "); - _mpipgamma[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2+3G mass in H'RP2+3P2-3G", - "GX XG G WGX XGX XG", - "1/GdG/dm0P2+3G1/MeV2-13", - " F F XGX XGX X X", - "m0P2+3G1/MeV", - " XGX XGX "); - _mpimgamma[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3G mass in H'RP2+3P2-3G", - "GX XG G WGX XGX XG", - "1/GdG/dm0P2-3G1/MeV2-13", - " F F XGX XGX X X", - "m0P2-3G1/MeV", - " XGX XGX "); - _photonenergy[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "G Energy in H'RP2+3P2-3G", - "G G WGX XGX XG", - "1/GdG/dE0G1/MeV2-13", - " F F XGX X X", - "E0G1/MeV", - " XGX "); - _mpippim[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3P2+3 mass in H'RP2+3P2-3G", - "GX XGX X G WGX XGX XG", - "1/GdG/dm0P2-3P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2-3P2+31/MeV", - " XGX XGX XX "); - _dpi0pi0[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P203 mass in HRP203P203P203", - "GX XGX X GWGX XGX XGX X", - "1/GdG/dm0P203P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2031/MeV", - " XGX XGX XX "); - _dpi0pi0[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P203 mass in H'RP203P203P203", - "GX XGX X G WGX XGX XGX X", - "1/GdG/dm0P203P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2031/MeV", - " XGX XGX XX "); - _dpippim[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3P2+3 mass in HRP2+3P2-3P203", - "GX XGX X GWGX XGX XGX X", - "1/GdG/dm0P2-3P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2-3P2+31/MeV", - " XGX XGX XX "); - _dpi0pip[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P2+3 mass in HRP2+3P2-3P203", - "GX XGX X GWGX XGX XGX X", - "1/GdG/dm0P203P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2+31/MeV", - " XGX XGX XX "); - _dpi0pim[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P2-3 mass in HRP2+3P2-3P203", - "GX XGX X GWGX XGX XGX X", - "1/GdG/dm0P203P2-31/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2-31/MeV", - " XGX XGX XX "); - _dpi0pim[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P2-3 mass in H'RP2+3P2-3P203", - "GX XGX X G WGX XGX XGX X", - "1/GdG/dm0P203P2-31/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2-31/MeV", - " XGX XGX XX "); - _dpi0pip[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P2+3 mass in H'RP2+3P2-3P203", - "GX XGX X G WGX XGX XGX X", - "1/GdG/dm0P203P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2+31/MeV", - " XGX XGX XX "); - _dpippim[1]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3P2+3 mass in H'RP2+3P2-3P203", - "GX XGX X G WGX XGX XGX X", - "1/GdG/dm0P2-3P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2-3P2+31/MeV", - " XGX XGX XX "); - _dpippim[2]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P2-3P2+3 mass in H'RP2+3P2-3H", - "GX XGX X G WGX XGX XG", - "1/GdG/dm0P2-3P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2-3P2+31/MeV", - " XGX XGX XX "); - _dpipeta[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "HP2+3 mass in H'RP2+3P2-3H", - "GGX X G WGX XGX XG", - "1/GdG/dm0HP2+31/MeV2-13", - " F F XGGX XX X X", - "m0HP2+31/MeV", - " XGGX XX "); - _dpimeta[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "HP2-3 mass in H'RP2+3P2-3H", - "GGX X G WGX XGX XG", - "1/GdG/dm0HP2-31/MeV2-13", - " F F XGGX XX X X", - "m0HP2-31/MeV", - " XGGX XX "); - _dpi0pi0[2]->topdrawOutput(output,Frame|Errorbars, - "RED", - "P203P203 mass in H'RP203P203H", - "GX XGX X G WGX XGX XG", - "1/GdG/dm0P203P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2031/MeV", - " XGX XGX XX "); - _dpi0eta[0]->topdrawOutput(output,Frame|Errorbars, - "RED", - "HP203 mass in H'RP203P203H", - "GGX X G WGX XGX XG", - "1/GdG/dm0HP2031/MeV2-13", - " F F XGGX XX X X", - "m0HP2031/MeV", - " XGGX XX "); -} - -void EtaDecayAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - double meta[2]={547.45, 957.78}; - for(unsigned int ix=0;ix<2;++ix) { - _mgammagamma .push_back(new_ptr(Histogram(0.,meta[ix],200))); - _mpi0gamma .push_back(new_ptr(Histogram(0.,meta[ix],200))); - _mpipgamma .push_back(new_ptr(Histogram(0.,meta[ix],200))); - _mpimgamma .push_back(new_ptr(Histogram(0.,meta[ix],200))); - _photonenergy.push_back(new_ptr(Histogram(0.,meta[ix],200))); - _mpippim .push_back(new_ptr(Histogram(0.,meta[ix],200))); - - _dpippim .push_back(new_ptr(Histogram(200.,meta[ix],200))); - _dpi0pi0 .push_back(new_ptr(Histogram(200.,meta[ix],200))); - _dpi0pip .push_back(new_ptr(Histogram(200.,meta[ix],200))); - _dpi0pim .push_back(new_ptr(Histogram(200.,meta[ix],200))); - } - _dpi0pi0.push_back(new_ptr(Histogram(200.,500.,200))); - _dpippim.push_back(new_ptr(Histogram(200.,500.,200))); - _dpipeta.push_back(new_ptr(Histogram(500.,meta[1],200))); - _dpimeta.push_back(new_ptr(Histogram(500.,meta[1],200))); - _dpi0eta.push_back(new_ptr(Histogram(500.,meta[1],200))); -} diff --git a/Contrib/DecayAnalysis/EtaDecayAnalysis.h b/Contrib/DecayAnalysis/EtaDecayAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/EtaDecayAnalysis.h +++ /dev/null @@ -1,200 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_EtaDecayAnalysis_H -#define HERWIG_EtaDecayAnalysis_H -// -// This is the declaration of the EtaDecayAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The EtaDecayAnalysis class performs the analysis of the decays of - * the \f$\eta\f$ and \f$\eta'\f$ mesons. - * - * @see \ref EtaDecayAnalysisInterfaces "The interfaces" - * defined for EtaDecayAnalysis. - */ -class EtaDecayAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - EtaDecayAnalysis & operator=(const EtaDecayAnalysis &) = delete; - -private: - - /** - * Histograms for the decay \f$\eta\to\pi^0\gamma\gamma\f$ - */ - //@{ - /** - * Histogram for the mass of \f$\gamma\gamma\f$ - */ - vector _mgammagamma; - - /** - * Histogrma for the mass of \f$\pi^0\gamma\f$ - */ - vector _mpi0gamma; - //@} - - /** - * Histograms for the decay \f$\eta\to\pi^+\pi^-\gamma\f$ - */ - //@{ - /** - * Histogram for the mass of \f$\pi^+\gamma\f$ - */ - vector _mpipgamma; - - /** - * Histogram for the mass of \f$\pi^-\gamma\f$ - */ - vector _mpimgamma; - - /** - * Histogram for the mass of \f$\pi^+\pi^-\f$ - */ - vector _mpippim; - - /** - * Histogram for the photon energy - */ - vector _photonenergy; - //@} - - /** - * Histograms for the decay \f$\eta\pi\pi\pi\f$ and \f$\eta'\to\eta\pi\pi\f$. - */ - //@{ - /** - * Histogram for the mass of \f$\pi^+\pi^-\f$ - */ - vector _dpippim; - - /** - * Histogram for the mass of \f$\pi^0\pi^0\f$ - */ - vector _dpi0pi0; - - /** - * Histogram for the mass of \f$\pi^0\pi^+\f$ - */ - vector _dpi0pip; - - /** - * Histogram for the mass of \f$\pi^0\pi^-\f$ - */ - vector _dpi0pim; - - /** - * Histogram for the mass of \f$\pi^+\eta\f$ - */ - vector _dpipeta; - - /** - * Histogram for the mass of \f$\pi^-\eta\f$ - */ - vector _dpimeta; - - /** - * Histogram for the mass of \f$\pi^0\eta\f$ - */ - vector _dpi0eta; - - //@} -}; - -} - -#endif /* HERWIG_EtaDecayAnalysis_H */ diff --git a/Contrib/DecayAnalysis/Makefile.in b/Contrib/DecayAnalysis/Makefile.in deleted file mode 100644 --- a/Contrib/DecayAnalysis/Makefile.in +++ /dev/null @@ -1,52 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE= -HERWIGINCLUDE= -GSLINCLUDE= -LDFLAGS = -SHARED_FLAG = -INCLUDE = $(THEPEGINCLUDE) $(HERWIGINCLUDE) $(GSLINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : HwDecayAnalysis.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -HwDecayAnalysis.so: a1DecayAnalysis.o PScalarVectorFermionsAnalysis.o\ - BabarBDecayAnalysis.o SemiLeptonicDecayAnalysis.o\ - BeamCorrelationAnalysis.o SemiLeptonicDPiAnalysis.o\ - BranchingRatioAnalysis.o Upsilon4SMultiplicityCount.o\ - BtoSGammaAnalysis.o Upsilon4SSpectrumAnalysis.o\ - DDalitzAnalysis.o VectorPScalarFermionsAnalysis.o\ - EtaDecayAnalysis.o VffGammaAnalysis.o VPPGammaAnalysis.o\ - OmegaPhi3PionAnalysis.o OniumToOniumPiPiAnalysis.o\ - ZPhotonsAnalysis.o Pi4ElectronAnalysis.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) \ - a1DecayAnalysis.o PScalarVectorFermionsAnalysis.o\ - BabarBDecayAnalysis.o SemiLeptonicDecayAnalysis.o\ - BeamCorrelationAnalysis.o SemiLeptonicDPiAnalysis.o\ - BranchingRatioAnalysis.o Upsilon4SMultiplicityCount.o\ - BtoSGammaAnalysis.o Upsilon4SSpectrumAnalysis.o\ - DDalitzAnalysis.o VectorPScalarFermionsAnalysis.o\ - EtaDecayAnalysis.o VffGammaAnalysis.o VPPGammaAnalysis.o\ - OmegaPhi3PionAnalysis.o OniumToOniumPiPiAnalysis.o\ - ZPhotonsAnalysis.o Pi4ElectronAnalysis.o $(SHARED_FLAG) $(LDFLAGS) -o HwDecayAnalysis.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) HwDecayAnalysis.so diff --git a/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.cc b/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.cc +++ /dev/null @@ -1,240 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the OmegaPhi3PionAnalysis class. -// - -#include "OmegaPhi3PionAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void OmegaPhi3PionAnalysis::analyze(tEventPtr event,long , int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all omega and phi particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).id()==ParticleID::omega||(**iter).id()==ParticleID::phi) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void OmegaPhi3PionAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void OmegaPhi3PionAnalysis::analyze(tPPtr part) { - Lorentz5Momentum pip,pim,pi0; unsigned int imode; - bool allowed(false); - // reorder the particles - ParticleVector children=part->children(); - if(children.size()==2) { - // vector first - if(abs(children[1]->id())%10==3) swap(children[0],children[1]); - if((children[0]->id()==113||abs(children[0]->id())==213)&& - (children[1]->id()==111||abs(children[1]->id())==211)) { - allowed=true; - vector temp; - temp.push_back(children[1]); - temp.push_back(children[0]->children()[0]); - temp.push_back(children[0]->children()[1]); - for(unsigned int ix=0;ix<3;++ix) { - if(temp[ix]->id()== 111) pi0=temp[ix]->momentum(); - if(temp[ix]->id()== 211) pip=temp[ix]->momentum(); - if(temp[ix]->id()==-211) pim=temp[ix]->momentum(); - } - } - } - else if(children.size()==3) { - // neutral pion first - if(children[1]->id()==111) swap(children[0],children[1]); - if(children[2]->id()==111) swap(children[0],children[2]); - // postive pion second - if(children[2]->id()==211) swap(children[1],children[2]); - if(children[0]->id()== 111&&children[1]->id()==211&& - children[2]->id()==-211) { - allowed=true; - pi0=children[0]->momentum(); - pip=children[1]->momentum(); - pim=children[2]->momentum(); - } - } - if(!allowed) return; - if(part->id()==ParticleID::omega) imode=0; - else if(part->id()==ParticleID::phi) imode=1; - else return; - Boost boostv(-part->momentum().boostVector()); - pi0.boost(boostv); - pip.boost(boostv); - pim.boost(boostv); - Lorentz5Momentum ptemp; - ptemp = pi0+pip;ptemp.rescaleMass(); - *_mplus[imode]+=ptemp.mass()/MeV; - ptemp = pi0+pim;ptemp.rescaleMass(); - *_mminus[imode]+=ptemp.mass()/MeV; - ptemp = pip+pim;ptemp.rescaleMass(); - *_m0[imode]+=ptemp.mass()/MeV; - Energy x = pip.e()-pim.e(); - Energy y = pi0.e()-pi0.m(); - *_xhist[imode]+=x/MeV; - *_yhist[imode]+=y/MeV; - if(_xvalue[imode].size()<_nmax) { - _xvalue[imode].push_back(x); - _yvalue[imode].push_back(y); - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigOmegaPhi3PionAnalysis("Herwig::OmegaPhi3PionAnalysis", "HwDecayAnalysis.so"); - -void OmegaPhi3PionAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the OmegaPhi3PionAnalysis class"); - - static Parameter interfaceNMax - ("MaxPoints", - "Maximum number of points for the Dalitz plots", - &OmegaPhi3PionAnalysis::_nmax, 50000, 100, 1000000, - false, false, Interface::limited); - -} - -void OmegaPhi3PionAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + - string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _xhist[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "x distribution in WRP2+3P2-3P203", - " GWGX XGX XGX X", - "1/SdS/dx/GeV2-13", - " G G X X", - "x/MeV", - " "); - _yhist[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "y distribution in WRP2+3P2-3P203", - " GWGX XGX XGX X", - "1/SdS/dy/GeV2-13", - " G G X X", - "y/MeV", - " "); - _mplus[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R2+3 mass in WRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2+31/GeV2-13", - " G G XGX XX X X", - "m0R2+31/MeV", - " XGX XX "); - _mminus[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R2-3 mass in WRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2-31/GeV2-13", - " G G XGX XX X X", - "m0R2-31/MeV", - " XGX XX "); - _m0[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R203 mass in WRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2031/GeV2-13", - " G G XGX XX X X", - "m0R2031/MeV", - " XGX XX "); - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x -250 250 y 0 250\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for W\"\n"; - output << "case \" G\"\n"; - for(unsigned int ix=0;ix<_xvalue[0].size();++ix) { - output << ounit(_xvalue[0][ix],MeV) << " " << ounit(_yvalue[0][ix],MeV) << "\n"; - } - output << "plot\n"; - _xhist[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "x distribution in FRP2+3P2-3P203", - " GWGX XGX XGX X", - "1/SdS/dx/GeV2-13", - " G G X X", - "x/MeV", - " "); - _yhist[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "y distribution in FRP2+3P2-3P203", - " GWGX XGX XGX X", - "1/SdS/dy/GeV2-13", - " G G X X", - "y/MeV", - " "); - _mplus[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R2+3 mass in FRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2+31/GeV2-13", - " G G XGX XX X X", - "m0R2+31/MeV", - " XGX XX "); - _mminus[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R2-3 mass in FRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2-31/GeV2-13", - " G G XGX XX X X", - "m0R2-31/MeV", - " XGX XX "); - _m0[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "R203 mass in FRP2+3P2-3P203", - "GX X GWGX XGX XGX X", - "1/SdS/dm0R2031/GeV2-13", - " G G XGX XX X X", - "m0R2031/MeV", - " XGX XX "); - output << "new frame\n"; - output << "set font duplex\n"; - output << "set limits x -400 400 y 0 400\n"; - output << "set order x y \n"; - output << "title top \"Dalitz plot for F\"\n"; - output << "case \" G\"\n"; - for(unsigned int ix=0;ix<_xvalue[1].size();++ix) { - output << _xvalue[1][ix]/MeV << " " << _yvalue[1][ix]/MeV << "\n"; - } - output << "plot\n"; -} - -void OmegaPhi3PionAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<2;++ix) { - _xhist .push_back(new_ptr(Histogram(-400.,400. ,200))); - _yhist .push_back(new_ptr(Histogram(0. ,400. ,200))); - _mplus .push_back(new_ptr(Histogram(0. ,1000.,200))); - _mminus .push_back(new_ptr(Histogram(0. ,1000.,200))); - _m0 .push_back(new_ptr(Histogram(0. ,1000.,200))); - } - _xvalue.resize(2); - _yvalue.resize(2); -} diff --git a/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.h b/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/OmegaPhi3PionAnalysis.h +++ /dev/null @@ -1,171 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_OmegaPhi3PionAnalysis_H -#define HERWIG_OmegaPhi3PionAnalysis_H -// -// This is the declaration of the OmegaPhi3PionAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the OmegaPhi3PionAnalysis class. - * - * @see \ref OmegaPhi3PionAnalysisInterfaces "The interfaces" - * defined for OmegaPhi3PionAnalysis. - */ -class OmegaPhi3PionAnalysis: public AnalysisHandler { - -public: - - /** - * Default Constructor - */ - inline OmegaPhi3PionAnalysis() : _nmax(50000) {} - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - OmegaPhi3PionAnalysis & operator=(const OmegaPhi3PionAnalysis &) = delete; - -private: - - /** - * Histogram for the \f$x\f$-values - */ - vector _xhist; - - /** - * Histogram for the \f$y\f$-values - */ - vector _yhist; - - /** - * Histograms for the masses - */ - //@{ - /** - * The mass of the \f$\rho^+\f$ - */ - vector _mplus; - - /** - * The mass of the \f$\rho^-\f$ - */ - vector _mminus; - - /** - * The mass of the \f$\rho^0\f$ - */ - vector _m0; - //@} - /** - * Vectors to store the \f$x\f$ and\f$y\f$ values for - */ - //@{ - /** - * The \f$x\f$ value - */ - vector > _xvalue; - - /** - * The \f$y\f$ value - */ - vector > _yvalue; - //@} - - /** - * Maximum number of points for the Dalitz plots - */ - unsigned int _nmax; -}; - -} - -#endif /* HERWIG_OmegaPhi3PionAnalysis_H */ diff --git a/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.cc b/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.cc +++ /dev/null @@ -1,134 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the OniumToOniumPiPiAnalysis class. -// - -#include "OniumToOniumPiPiAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void OniumToOniumPiPiAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - // Rotate to CMS, extract final state particles and call analyze(particles). - AnalysisHandler::analyze(event, ieve, loop, state); - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if(((**iter).id()%1000==443||(**iter).id()%1000==553)&& - (**iter).children().size()==3) particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -void OniumToOniumPiPiAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void OniumToOniumPiPiAnalysis::analyze(tPPtr part) { - tPPtr out; - Lorentz5Momentum q,pip; - unsigned int npi0(0),npip(0),npim(0); - for(unsigned int ix=0;ixchildren().size();++ix) { - if(part->children()[ix]->id()==ParticleID::piplus) { - ++npip; - pip=part->children()[ix]->momentum(); - q+=part->children()[ix]->momentum(); - } - else if(part->children()[ix]->id()==ParticleID::piminus) { - ++npim; - q+=part->children()[ix]->momentum(); - } - else if(part->children()[ix]->id()==ParticleID::pi0) { - ++npi0; - q+=part->children()[ix]->momentum(); - pip=part->children()[ix]->momentum(); - } - else { - out = part->children()[ix]; - } - } - // require pi+pi- or pi0pi0 - if(!(npi0==2||(npim==1&&npim==1))) return; - // require incoming and outgoing onium - if(part->id()%1000!=out->id()%1000) return; - unsigned int ix=0; bool found(false); - while(!found&&ix<_incoming.size()) { - if(_incoming[ix]==part->id()&&_outgoing[ix]==out->id()) found=true; - else ++ix; - } - if(!found) { - Energy twompi=2.*getParticleData(ParticleID::piplus)->mass(); - Energy upp = part->nominalMass()+part->dataPtr()->widthUpCut()- - out ->nominalMass()+out->dataPtr()->widthLoCut(); - ix=_incoming.size(); - _incoming.push_back(part->id()); - _outgoing.push_back(out ->id()); - _mpipi.push_back(make_pair(new_ptr(Histogram(twompi/GeV,upp/GeV,200)), - new_ptr(Histogram(twompi/GeV,upp/GeV,200)))); - _hel .push_back(make_pair(new_ptr(Histogram(-1.,1.,200)), - new_ptr(Histogram( 0.,1.,200)))); - } - // calculate the mass - q.rescaleMass(); - Energy mq=q.mass(); - // calculate the helicity angle - Boost boost = -q.boostVector(); - Lorentz5Momentum qp=out->momentum(); - Lorentz5Momentum ppi=pip; - qp.boost(boost); - q.boost(boost); - ppi.boost(boost); - double cX=-ppi.vect().unit()*qp.vect().unit(); - if(npi0==2) { - *_mpipi[ix].second+=mq/GeV; - *_hel[ix].second+=abs(cX); - } - else { - *_mpipi[ix].first+=mq/GeV; - *_hel[ix].first+=cX; - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigOniumToOniumPiPiAnalysis("Herwig::OniumToOniumPiPiAnalysis", "HwDecayAnalysis.so"); - -void OniumToOniumPiPiAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the OniumToOniumPiPiAnalysis class"); - -} - -void OniumToOniumPiPiAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - for(unsigned int ix=0;ix<_incoming.size();++ix) { - string title= - getParticleData(_incoming[ix])->PDGName() + " -> " + - getParticleData(_outgoing[ix])->PDGName(); - string temp = "Mass distrubtion for pi+pi- in " + title; - using namespace HistogramOptions; - _mpipi[ix].first->topdrawOutput(output,Frame,"BLACK",temp); - temp = "Mass distrubtion for pi0pi0 in " + title; - _mpipi[ix].second->topdrawOutput(output,Frame,"BLACK",temp); - temp = "Helicity angle for pi+pi- in " + title; - _hel[ix].first->topdrawOutput(output,Frame,"BLACK",temp); - temp = "Helicity angle for pi0pi0 in " + title; - _hel[ix].second->topdrawOutput(output,Frame,"BLACK",temp); - } -} diff --git a/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.h b/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/OniumToOniumPiPiAnalysis.h +++ /dev/null @@ -1,135 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_OniumToOniumPiPiAnalysis_H -#define HERWIG_OniumToOniumPiPiAnalysis_H -// -// This is the declaration of the OniumToOniumPiPiAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** \ingroup Analysis - * - * The OniumToOniumPiPiAnalysis class performs the analysis of the decays - * of bottom and charmonium resonances to lighter resonances and \f$\pi\pi\f$. - * - * @see \ref OniumToOniumPiPiAnalysisInterfaces "The interfaces" - * defined for OniumToOniumPiPiAnalysis. - */ -class OniumToOniumPiPiAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - OniumToOniumPiPiAnalysis & operator=(const OniumToOniumPiPiAnalysis &) = delete; - -private: - - /** - * Incoming onium states - */ - vector _incoming; - - /** - * Outgoing onium states - */ - vector _outgoing; - - /** - * Histograms for the \f$\pi^+\pi^-\f$ masses - */ - vector > _mpipi; - - /** - * Histmgrams for the helicity angles - */ - vector > _hel; - -}; - -} - -#endif /* HERWIG_OniumToOniumPiPiAnalysis_H */ diff --git a/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.cc b/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.cc +++ /dev/null @@ -1,145 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the PScalarVectorFermionsAnalysis class. -// - -#include "PScalarVectorFermionsAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include -#include -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void PScalarVectorFermionsAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all scalar particles with three children and first - // decay product is a vector - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).dataPtr()->iSpin()==PDT::Spin0&&(**iter).children().size()==3) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void PScalarVectorFermionsAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void PScalarVectorFermionsAnalysis::analyze(tPPtr part) { - ParticleVector children=part->children(); - // ensure photon first - if(children[1]->id()==ParticleID::gamma) swap(children[0],children[1]); - if(children[2]->id()==ParticleID::gamma) swap(children[0],children[2]); - // and lepton next - if(children[1]->id()<0) swap(children[1],children[2]); - long id[3]={children[0]->id(),children[1]->id(), - children[2]->id()}; - // id's of the fermions - if(id[0]!=ParticleID::gamma) return; - if(abs(id[1])!=abs(id[2])) return; - if(abs(id[1])!=11&&abs(id[1])!=13) return; - // check if we already have this decay - unsigned int ix=0; bool found(false); - while(!found&&ix<_incoming.size()) { - if(_incoming[ix]==part->id()&&_outgoingV[ix]==id[0]&&_outgoingf[ix]==abs(id[1])) - found=true; - else ++ix; - } - // create a new graph if needed - if(!found) { - ix=_incoming.size(); - _incoming.push_back(part->id()); - _outgoingV.push_back(id[0]); - _outgoingf.push_back(abs(id[1])); - _mffa.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - _mffb.push_back(new_ptr(Histogram(0.0,20,200))); - _mVf.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - _mVfbar.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - } - // add the results to the histogram - Lorentz5Momentum ptemp; - ptemp=children[1]->momentum()+children[2]->momentum(); - ptemp.rescaleMass(); - *_mffa[ix]+=ptemp.mass()/MeV; - *_mffb[ix]+=ptemp.mass()/MeV; - ptemp=children[0]->momentum()+children[1]->momentum(); - ptemp.rescaleMass(); - *_mVf[ix]+=ptemp.mass()/MeV; - ptemp=children[0]->momentum()+children[2]->momentum(); - ptemp.rescaleMass(); - *_mVfbar[ix]+=ptemp.mass()/MeV; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigPScalarVectorFermionsAnalysis("Herwig::PScalarVectorFermionsAnalysis", "HwDecayAnalysis.so"); - -void PScalarVectorFermionsAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the PScalarVectorFermionsAnalysis class"); - -} - -void PScalarVectorFermionsAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - string title,temp; - for(unsigned int ix=0;ix<_incoming.size();++ix) { - title= getParticleData(_incoming[ix])->PDGName() + - " -> " + getParticleData(_outgoingV[ix])->PDGName()+ " " + - getParticleData(_outgoingf[ix])->PDGName() + " " + - getParticleData(-_outgoingf[ix])->PDGName(); - temp = "Mass for f fbar in " +title; - using namespace HistogramOptions; - _mffa[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - _mffb[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - temp = "Mass for vector fermion mass in " +title; - _mVf[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0Vl2-31/GeV2-13", - " G G X X XX X X", - "m0Vl2-31", - " X X XX"); - temp = "Mass for vector fbar mass in " +title; - _mVfbar[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0Vl2+31/GeV2-13", - " G G X X XX X X", - "m0Vl2+31", - " X X XX"); - } -} - diff --git a/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.h b/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/PScalarVectorFermionsAnalysis.h +++ /dev/null @@ -1,146 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_PScalarVectorFermionsAnalysis_H -#define HERWIG_PScalarVectorFermionsAnalysis_H -// -// This is the declaration of the PScalarVectorFermionsAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the PScalarVectorFermionsAnalysis class. - * - * @see \ref PScalarVectorFermionsAnalysisInterfaces "The interfaces" - * defined for PScalarVectorFermionsAnalysis. - */ -class PScalarVectorFermionsAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - inline virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - PScalarVectorFermionsAnalysis & operator=(const PScalarVectorFermionsAnalysis &) = delete; - -private: - - /** - * PDG codes for the incoming particles - */ - vector _incoming; - - /** - * PDG codes for the outgoing vector meson - */ - vector _outgoingV; - - /** - * PDG code for the outgoing fermions - */ - vector _outgoingf; - - /** - * Histograms for the mass of the fermion-antifermion pair - */ - vector _mffa; - - /** - * Histograms for the mass of the fermion-antifermion pair - */ - vector _mffb; - - /** - * Histograms for the masses of the vector and the fermion - */ - vector _mVf; - - /** - * Histograms for the masses of the vector and the antifermion - */ - vector _mVfbar; -}; - -} - -#endif /* HERWIG_PScalarVectorFermionsAnalysis_H */ diff --git a/Contrib/DecayAnalysis/Pi4ElectronAnalysis.cc b/Contrib/DecayAnalysis/Pi4ElectronAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/Pi4ElectronAnalysis.cc +++ /dev/null @@ -1,102 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the Pi4ElectronAnalysis class. -// - -#include "Pi4ElectronAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/EventRecord/Event.h" -#include -#include -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void Pi4ElectronAnalysis::analyze(tEventPtr event, long , int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all the decaying neutral pions - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).id()==ParticleID::pi0) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void Pi4ElectronAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void Pi4ElectronAnalysis::analyze(tPPtr part) { - // check the number of children of the particle - if(part->children().size()!=4) return; - Lorentz5Momentum pe[2],pp[2]; - unsigned int ne(0),np(0); - int id; - // find the particles - unsigned int ix,iy; - for(ix=0;ixchildren().size();++ix) { - id=part->children()[ix]->id(); - if(id==ParticleID::eplus){pe[ne]=part->children()[ix]->momentum();++ne;} - else if(id==ParticleID::eminus){pp[np]=part->children()[ix]->momentum();++np;} - } - if(ne!=2||np!=2){return;} - // find the invariant masses - Lorentz5Momentum ptemp; - for(ix=0;ix<2;++ix) { - for(iy=0;iy<2;++iy) { - ptemp=pe[ix]+pp[iy]; - ptemp.rescaleMass(); - for(unsigned int iz=0;iz<_mffbar.size();++iz) { - *_mffbar[iz]+=ptemp.mass()/MeV; - } - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigPi4ElectronAnalysis("Herwig::Pi4ElectronAnalysis", "HwDecayAnalysis.so"); - -void Pi4ElectronAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the Pi4ElectronAnalysis class"); - -} - -void Pi4ElectronAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - for(unsigned int ix=0;ix<_mffbar.size();++ix) { - _mffbar[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Mass of the e2+3e2-3 pair in P203Re2+3e2-3e2+3e2-3", - " X X X X GX XW X X X X X X X X", - "1/SdS/dm0e2+3e2-31/GeV2-13", - " G G X X X X XX X X", - "m0e2+3e2-31", - " X X X X XX"); - } -} - -void Pi4ElectronAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _mffbar.push_back(new_ptr(Histogram(0.0,140.0,1000))); - _mffbar.push_back(new_ptr(Histogram(0.0, 20.0,100 ))); -} diff --git a/Contrib/DecayAnalysis/Pi4ElectronAnalysis.h b/Contrib/DecayAnalysis/Pi4ElectronAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/Pi4ElectronAnalysis.h +++ /dev/null @@ -1,123 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_Pi4ElectronAnalysis_H -#define HERWIG_Pi4ElectronAnalysis_H -// -// This is the declaration of the Pi4ElectronAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the Pi4ElectronAnalysis class. - * - * @see \ref Pi4ElectronAnalysisInterfaces "The interfaces" - * defined for Pi4ElectronAnalysis. - */ -class Pi4ElectronAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - inline virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - inline virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - Pi4ElectronAnalysis & operator=(const Pi4ElectronAnalysis &) = delete; - -private: - - /** - * Histogram for the mass distribution - */ - vector _mffbar; - -}; - -} - -#endif /* HERWIG_Pi4ElectronAnalysis_H */ diff --git a/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.cc b/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.cc +++ /dev/null @@ -1,163 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the SemiLeptonicDPiAnalysis class. -// - -#include "SemiLeptonicDPiAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; -using namespace ThePEG; - -void SemiLeptonicDPiAnalysis::findChildren(tPPtr part,ParticleVector & prod) { - if(part->children().empty()) { - prod.push_back(part); - } - else { - for(unsigned ix=0;ixchildren().size();++ix) { - findChildren(part->children()[ix],prod); - } - } -} - - -void SemiLeptonicDPiAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - tPVector particles; - // find B mesons - for(unsigned int ix=0; ixprimaryCollision()->steps().size();++ix) { - ThePEG::ParticleSet part=event->primaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).children().empty()) continue; - int id=abs((**iter).id()); - if(id==ParticleID::B0||id==ParticleID::Bplus) particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -LorentzRotation SemiLeptonicDPiAnalysis::transform(tEventPtr) const { - return LorentzRotation(); - // Return the Rotation to the frame in which you want to perform the analysis. -} - -void SemiLeptonicDPiAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void SemiLeptonicDPiAnalysis::analyze(tPPtr part) { - // find the stable decay products - ParticleVector products; - findChildren(part,products); - // check them - if(products.size()!=4) return; - // find the particles - int ipi=-1,idm=-1,il=-1,inu=-1,id; - for(unsigned int ix=0;ixid()); - if(id==ParticleID::piplus||id==ParticleID::pi0) ipi=ix; - else if(id==ParticleID::eminus||id==ParticleID::muminus|| - id==ParticleID::tauminus) il=ix; - else if(id==ParticleID::nu_e||id==ParticleID::nu_mu|| - id==ParticleID::nu_tau) inu=ix; - else if(id==ParticleID::Dplus||id==ParticleID::D0|| - id==ParticleID::Dstarplus||id==ParticleID::Dstar0) idm=ix; - } - // check we have everything - if(ipi<0||idm<0||il<0||inu<0) return; - tPPtr lep[2]={products[il],products[inu]}; - unsigned int lid=(abs(lep[0]->id())-9)/2; - unsigned int ix=0; - bool found(false); - while(!found&&ix<_incoming.size()) { - if(_incoming[ix]==part->id()&& - _outgoingD[ix]==products[idm]->id()&& - _outgoingP[ix]==products[ipi]->id()&& - lid==_outgoingL[ix]) { - found=true; - break; - } - else { - ++ix; - } - } - if(!found) { - ix=_incoming.size(); - _incoming.push_back(part->id()); - _outgoingD.push_back(products[idm]->id()); - _outgoingP.push_back(products[ipi]->id()); - _outgoingL.push_back(lid); - _energy.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut() - -products[idm]->nominalMass() - +products[idm]->dataPtr()->widthLoCut())/GeV,200))); - _scale.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut() - -products[ipi]->nominalMass() - +products[ipi]->dataPtr()->widthLoCut())/GeV,200))); - _mDpi.push_back(new_ptr(Histogram(4.0,25.,200))); - } - // add the results to the histogram - Lorentz5Momentum ptemp; - ptemp = lep[0]->momentum()+lep[1]->momentum(); - ptemp.rescaleMass(); - *_scale[ix]+=ptemp.mass()/GeV; - ptemp = products[idm]->momentum()+lep[1]->momentum(); - ptemp.rescaleMass(); - Energy ee = 1./2./part->mass()* - (part->mass()*part->mass()-ptemp.mass()*ptemp.mass()+lep[1]->mass()*lep[1]->mass()); - *_energy[ix]+=ee/GeV; - double mdpi=(products[idm]->momentum()+ - products[ipi]->momentum()).m2()/GeV2; - *_mDpi[ix]+=mdpi; -} - -void SemiLeptonicDPiAnalysis::persistentOutput(PersistentOStream &) const {} - -void SemiLeptonicDPiAnalysis::persistentInput(PersistentIStream &, int) {} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigSemiLeptonicDPiAnalysis("Herwig::SemiLeptonicDPiAnalysis", "HwDecayAnalysis.so"); - -void SemiLeptonicDPiAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the SemiLeptonicDPiAnalysis class"); - -} - -void SemiLeptonicDPiAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - string title,temp; - for(unsigned int ix=0;ix<_incoming.size();++ix) { - title= getParticleData(_incoming[ix])->PDGName() + - " -> " - + getParticleData(_outgoingD[ix])->PDGName()+ " " - + getParticleData(_outgoingP[ix])->PDGName()+ " " + - getParticleData(9+2*_outgoingL[ix])->PDGName() + " " + - getParticleData(10+2*_outgoingL[ix])->PDGName(); - temp = "Mass for l nu in " +title; - using namespace HistogramOptions; - _scale[ix]->topdrawOutput(outfile,Frame,"BLACK",temp); - temp = "Lepton energy for in " +title; - _energy[ix]->topdrawOutput(outfile,Frame,"BLACK",temp); - temp = "D(*) pi mass in " +title; - _mDpi[ix]->topdrawOutput(outfile,Frame,"BLACK",temp); - } -} - diff --git a/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.h b/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/SemiLeptonicDPiAnalysis.h +++ /dev/null @@ -1,180 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_SemiLeptonicDPiAnalysis_H -#define HERWIG_SemiLeptonicDPiAnalysis_H -// -// This is the declaration of the SemiLeptonicDPiAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" -#include "ThePEG/EventRecord/Event.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the SemiLeptonicDPiAnalysis class. - * - * @see \ref SemiLeptonicDPiAnalysisInterfaces "The interfaces" - * defined for SemiLeptonicDPiAnalysis. - */ -class SemiLeptonicDPiAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Transform the event to the desired Lorentz frame and return the - * corresponding LorentzRotation. - * @param event a pointer to the Event to be transformed. - * @return the LorentzRotation used in the transformation. - */ - virtual LorentzRotation transform(tEventPtr event) const; - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -protected: - - /** - * Find the stable decay products - */ - void findChildren(tPPtr,ParticleVector &); - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - SemiLeptonicDPiAnalysis & operator=(const SemiLeptonicDPiAnalysis &) = delete; - -private: - - /** - * The PDG code of the incoming particle - */ - vector _incoming; - - /** - * The PDG code of the outgoing D meson - */ - vector _outgoingD; - - /** - * The PDG code of the outgoing pion - */ - vector _outgoingP; - - /** - * The PDG code of the outgoing lepton - */ - vector _outgoingL; - - /** - * The energy of the leptons - */ - vector _energy; - - /** - * The mass of the lepton-neutrino pair - */ - vector _scale; - - /** - * the mass of the D pi system - */ - vector _mDpi; - -}; - -} - -#endif /* HERWIG_SemiLeptonicDPiAnalysis_H */ diff --git a/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.cc b/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.cc +++ /dev/null @@ -1,135 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the SemiLeptonicDecayAnalysis class. -// - -#include "SemiLeptonicDecayAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void SemiLeptonicDecayAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - // Rotate to CMS, extract final state particles and call analyze(particles). - AnalysisHandler::analyze(event, ieve, loop, state); - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).dataPtr()->iSpin()==PDT::Spin0&& - (**iter).children().size()>=2&&(**iter).children().size()<=3) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void SemiLeptonicDecayAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void SemiLeptonicDecayAnalysis::analyze(tPPtr part) { - // check the number of children of the particle - // check this is a decay - tPPtr lep[2]; - if(part->children().size()==2&& - abs(part->children()[1]->id())==24&&part->children()[1]->children().size()==2) { - lep[0]=part->children()[1]->children()[0]; - lep[1]=part->children()[1]->children()[1]; - } - else if(part->children().size()==3&& - abs(part->children()[1]->id())>=11&&abs(part->children()[1]->id())<=16&& - abs(part->children()[2]->id())>=11&&abs(part->children()[2]->id())<=16) { - lep[0]=part->children()[1]; - lep[1]=part->children()[2]; - } - else { - return; - } - // find the ids of the lepton and the neutrino - int id1(abs(lep[0]->id())),id2(abs(lep[1]->id())); - unsigned int ilep(0),inu(0),loce(1),locn(1); - if(id1%2==0&&id1>11&&id1<17){inu=(id1-10)/2;locn=0;} - else if(id2%2==0&&id2>11&&id2<17){inu=(id2-10)/2;locn=1;} - if(id1%2==1&&id1>10&&id1<16){ilep=(id1-9)/2;loce=0;} - else if(id2%2==1&&id2>10&&id2<16){ilep=(id2-9)/2;loce=1;} - if(ilep==0||inu==0){return;} - unsigned int ix=0; bool found(false); - while(!found&&ix<_incoming.size()) { - if(_incoming[ix]==part->id()&&_outgoing[ix]==part->children()[0]->id()&& - ilep==_outgoingL[ix]){found=true;} - else{++ix;} - } - if(!found) { - ix=_incoming.size(); - _incoming.push_back(part->id()); - _outgoing.push_back(part->children()[0]->id()); - _outgoingL.push_back(ilep); - _energy.push_back(new_ptr(Histogram(0.0, - (part->mass()-part->children()[0]->mass())/MeV, - 200))); - _scale.push_back(new_ptr(Histogram(0.0, - (part->mass()-part->children()[0]->mass())/MeV, - 200))); - } - // add the results to the histogram - Lorentz5Momentum ptemp; - ptemp = lep[0]->momentum()+lep[1]->momentum(); - ptemp.rescaleMass(); - *_scale[ix] += ptemp.mass()/MeV; - ptemp = part->children()[0]->momentum()+lep[locn]->momentum(); - ptemp.rescaleMass(); - Energy ee = 1./2./part->mass()* - ( part->mass()*part->mass()-ptemp.mass()*ptemp.mass() - +lep[loce]->mass()*lep[loce]->mass()); - *_energy[ix] += ee/MeV; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigSemiLeptonicDecayAnalysis("Herwig::SemiLeptonicDecayAnalysis", "HwDecayAnalysis.so"); - -void SemiLeptonicDecayAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the SemiLeptonicDecayAnalysis class"); - -} - -void SemiLeptonicDecayAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - string title,temp; - for(unsigned int ix=0;ix<_incoming.size();++ix) { - title= getParticleData(_incoming[ix])->PDGName() + - " -> " + getParticleData(_outgoing[ix])->PDGName()+ " " + - getParticleData(9+2*_outgoingL[ix])->PDGName() + " " + - getParticleData(10+2*_outgoingL[ix])->PDGName(); - temp = "Mass for l nu in " +title; - using namespace HistogramOptions; - _scale[ix]->topdrawOutput(output,Frame|Errorbars, - "RED",temp,"", - "1/GdG/dm0lN1/MeV2-13", - " F F X GX X X", - "m0lN1/MeV", - " X GX "); - temp = "Lepton energy for in " +title; - _energy[ix]->topdrawOutput(output,Frame|Errorbars, - "RED",temp,"", - "1/GdG/dE0l1/MeV2-13", - " F F X X X X", - "E0l1/MeV", - " X X "); - } -} - diff --git a/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.h b/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/SemiLeptonicDecayAnalysis.h +++ /dev/null @@ -1,142 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_SemiLeptonicDecayAnalysis_H -#define HERWIG_SemiLeptonicDecayAnalysis_H -// -// This is the declaration of the SemiLeptonicDecayAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the SemiLeptonicDecayAnalysis class. - * - * @see \ref SemiLeptonicDecayAnalysisInterfaces "The interfaces" - * defined for SemiLeptonicDecayAnalysis. - */ -class SemiLeptonicDecayAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - SemiLeptonicDecayAnalysis & operator=(const SemiLeptonicDecayAnalysis &) = delete; - -private: - - /** - * PDG codes of the decaying mesons - */ - vector _incoming; - - /** - * PDG codes of the decay products - */ - vector _outgoing; - - /** - * Identidies of the leptons - */ - vector _outgoingL; - - /** - * Histograms - */ - //@{ - /** - * The lepton energy - */ - vector _energy; - - /** - * The \f$q\f$ value - */ - vector _scale; - //@} -}; - -} - -#endif /* HERWIG_SemiLeptonicDecayAnalysis_H */ diff --git a/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.cc b/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.cc +++ /dev/null @@ -1,140 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the Upsilon4SMultiplicityCount class. -// - -#include "Upsilon4SMultiplicityCount.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -inline IBPtr Upsilon4SMultiplicityCount::clone() const { - return new_ptr(*this); -} - -inline IBPtr Upsilon4SMultiplicityCount::fullclone() const { - return new_ptr(*this); -} - -void Upsilon4SMultiplicityCount::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - set particles; - StepVector steps = event->primaryCollision()->steps(); - if (steps.size() > 2) { - for ( StepVector::const_iterator it = steps.begin()+2; - it != steps.end(); ++it ) { - (**it).select(inserter(particles), ThePEG::AllSelector()); - } - } - if(particles.empty()) return; - map eventcount; - // get most multiplicities - for(set::const_iterator it = particles.begin(); - it != particles.end(); ++it) { - long ID = abs((*it)->id()); - // sort out neutral kaons - if(ID==ParticleID::K0) continue; - if(ID==ParticleID::K_L0||ID==ParticleID::K_S0) ID=ParticleID::K0; - // otherwise add to count - if (_data.find(ID) != _data.end()) ++eventcount[ID]; - } - // final-state charged particles - particles.clear(); - event->selectFinalState(inserter(particles)); - for(set::const_iterator it = particles.begin(); - it != particles.end(); ++it) { - if((*it)->dataPtr()->charged()) ++eventcount[0]; - } - // store info - for(map::iterator it = _data.begin(); - it != _data.end(); ++it) { - long currentcount - = eventcount.find(it->first) == eventcount.end() ? 0 - : eventcount[it->first]; - it->second.count += currentcount; - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigUpsilon4SMultiplicityCount("Herwig::Upsilon4SMultiplicityCount", "HwDecayAnalysis.so"); - -void Upsilon4SMultiplicityCount::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the Upsilon4SMultiplicityCount class"); - -} - -void Upsilon4SMultiplicityCount::dofinish() { - AnalysisHandler::dofinish(); - string filename = generator()->filename() + ".mult"; - ofstream outfile(filename.c_str());outfile << - "\nParticle multiplicities (compared to Upsilon(4s) data):\n" - " ID Name simMult obsMult obsErr Sigma\n"; - for (map::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.close(); -} - -void Upsilon4SMultiplicityCount::doinitrun() { - AnalysisHandler::doinitrun(); - // all charged - _data[0] = MultiplicityInfo(10.71,0.18, lightMeson); - // kaons - _data[321] = MultiplicityInfo( 2.*0.789 , 2.*0.025 , strangeMeson); - _data[311] = MultiplicityInfo( 2.*0.64 , 2.*0.04 , strangeMeson); - _data[323] = MultiplicityInfo( 2.*0.18 , 2.*0.06 , strangeMeson); - _data[313] = MultiplicityInfo( 2.*0.146 , 2.*0.026 , strangeMeson); - // light mesons - _data[211] = MultiplicityInfo( 2.*3.58 , 2.*0.07 , lightMeson); - _data[111] = MultiplicityInfo( 2.*2.35 , 2.*0.11 , lightMeson); - _data[221] = MultiplicityInfo( 2.*0.176 , 2.*0.016 , lightMeson); - _data[113] = MultiplicityInfo( 2.*0.21 , 2.*0.05 , lightMeson); - _data[333] = MultiplicityInfo( 2.*0.0342 , 2.*0.0013 , lightMeson); - // baryons - _data[2212] = MultiplicityInfo( 2.*0.08 , 2.*0.004 , lightBaryon); - _data[3122] = MultiplicityInfo( 2.*0.04 , 2.*0.005 , lightBaryon); - _data[3312] = MultiplicityInfo( 2.*0.0027 , 2.*0.006 , lightBaryon); - _data[4122] = MultiplicityInfo( 2.*0.045 , 2.*0.012 , other); - _data[4112] = MultiplicityInfo( 4.*0.0046 , 4.*0.0024 , other); - _data[4222] = MultiplicityInfo( 4.*0.0042 , 4.*0.0024 , other); - // charmonium - _data[443] = MultiplicityInfo( 2.*0.01094, 2.*0.00032, other); - _data[100443] = MultiplicityInfo( 2.*0.00307, 2.*0.00021, other); - _data[20443] = MultiplicityInfo( 2.*0.00386, 2.*0.00027, other); - _data[445] = MultiplicityInfo( 2.*0.0013 , 2.*0.0004 , other); - // D+, D0, D_s+ - _data[411] = MultiplicityInfo( 2.*0.228, 2.*0.014, other); - _data[421] = MultiplicityInfo( 2.*0.637, 2.*0.03 , other); - _data[431] = MultiplicityInfo( 2.*0.083, 2.*0.008, other); - _data[413] = MultiplicityInfo( 2.*0.225, 2.*0.015, other); - _data[423] = MultiplicityInfo( 2.*0.260, 2.*0.027, other); - _data[433] = MultiplicityInfo( 2.*0.063, 2.*0.006, other); -} diff --git a/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.h b/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/Upsilon4SMultiplicityCount.h +++ /dev/null @@ -1,110 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_Upsilon4SMultiplicityCount_H -#define HERWIG_Upsilon4SMultiplicityCount_H -// -// This is the declaration of the Upsilon4SMultiplicityCount class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Analysis/MultiplicityInfo.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the Upsilon4SMultiplicityCount class. - * - * @see \ref Upsilon4SMultiplicityCountInterfaces "The interfaces" - * defined for Upsilon4SMultiplicityCount. - */ -class Upsilon4SMultiplicityCount: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - Upsilon4SMultiplicityCount & operator=(const Upsilon4SMultiplicityCount &) = delete; - -private: - - /** - * Map of PDG codes to multiplicity info - */ - map _data; - -}; - -} - -#endif /* HERWIG_Upsilon4SMultiplicityCount_H */ diff --git a/Contrib/DecayAnalysis/Upsilon4SSpectrumAnalysis.cc b/Contrib/DecayAnalysis/Upsilon4SSpectrumAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/Upsilon4SSpectrumAnalysis.cc +++ /dev/null @@ -1,389 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the Upsilon4SSpectrumAnalysis class. -// - -#include "Upsilon4SSpectrumAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/ClassDocumentation.h" - -using namespace Herwig; - -IBPtr Upsilon4SSpectrumAnalysis::clone() const { - return new_ptr(*this); -} - -IBPtr Upsilon4SSpectrumAnalysis::fullclone() const { - return new_ptr(*this); -} - -void Upsilon4SSpectrumAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - set particles; - event->select(inserter(particles),ThePEG::AllSelector()); - set finalState; - event->selectFinalState(inserter(finalState)); - for(set::const_iterator it=finalState.begin();it!=finalState.end();++it) { - double p = (**it).momentum().vect().mag()/GeV; - switch (abs((**it).id())) { - case ParticleID::piplus: - if(abs((**it).parents()[0]->id())!=ParticleID::Lambda0&& - abs((**it).parents()[0]->id())!=ParticleID::K_S0) - if(p>=0.075&&p<=2.8) *_spectrumpipNo += p; - if(p>=0.075&&p<=2.8) *_spectrumpipAll += p; - break; - case ParticleID::Kplus: - if(p>=0.175&&p<=2.8) *_spectrumKpA +=p; - if(p>=0.2 &&p<=2.8) *_spectrumKpB +=p; - break; - case ParticleID::pplus: - if(abs((**it).parents()[0]->id())!=ParticleID::Lambda0) - if(p>=0.3&&p<=2.2) *_spectrumprotonNo += p; - if(p>=0.3&&p<=2.2) *_spectrumprotonAll += p; - case ParticleID::K_L0: - if(p>=0.2&&p<=2.7) *_spectrumK0 += p; - } - } - for(set::const_iterator it=particles.begin();it!=particles.end();++it) { - if(!(**it).children().empty()&&(**it).children()[0]->id()==(**it).id()) - continue; - double p = (**it).momentum().vect().mag()/GeV; - switch (abs((**it).id())) { - case ParticleID::pi0: - if(p<=3.) *_spectrumpi0 += p; -// case ParticleID::K_S0: -// if(p>=0.2&&p<=2.7) *_spectrumK0 += p; - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigUpsilon4SSpectrumAnalysis("Herwig::Upsilon4SSpectrumAnalysis", "HwDecayAnalysis.so"); - -void Upsilon4SSpectrumAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the Upsilon4SSpectrumAnalysis class"); - -} - -void Upsilon4SSpectrumAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + - string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - // output chi sq to log file for analysis - double chisq=0.,minfrac=0.05; - unsigned int ndegrees; - _spectrumpipNo->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS pi+ distribution " - << "excluding K_S0 and Lambda decay products\n"; - _spectrumpipAll->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS pi+ distribution " - << "including K_S0 and Lambda decay products\n"; - _spectrumpi0->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for Belle pi0 distribution\n"; - _spectrumKpA->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS K+ distribution\n"; - _spectrumKpB->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS K+ decay in flight" - << "distribution\n"; - _spectrumprotonNo->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS proton distribution " - << "excluding Lambda decay products\n"; - _spectrumprotonAll->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS proton distribution " - << "including Lambda decay products\n"; - _spectrumK0->chiSquared(chisq,ndegrees,minfrac); - generator()->log() << "Chi Square = " << chisq << " for " << ndegrees - << " degrees of freedom for ARGUS K0 distribution\n"; - // output the histograms - using namespace HistogramOptions; - _spectrumpipNo->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3 excluding K2030S1 and L decay products (ARGUS)", - "GXMX X XX X F ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumpipAll->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3 including K2030S1 and L decay products (ARGUS)", - "GX X X XX X F ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumpi0->topdrawOutput(output,Frame|Errorbars,"RED", - "P203 (Belle)", - "GX X ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumKpA->topdrawOutput(output,Frame|Errorbars,"RED", - "K2+3 (ARGUS)", - " XMX", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumKpB->topdrawOutput(output,Frame|Errorbars,"RED", - "K2+3 decay in flight (ARGUS)", - " XMX", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumprotonNo->topdrawOutput(output,Frame|Errorbars,"RED", - "proton excluding L decay products (ARGUS)", - " F ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumprotonAll->topdrawOutput(output,Frame|Errorbars,"RED", - "proton including L decay products (ARGUS)", - " F ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); - _spectrumK0->topdrawOutput(output,Frame|Errorbars,"RED", - "K203 (ARGUS)", - " X X ", - "1/SdS/dp/GeV2-13"," G G X X", - "p/GeV"," "); -} - -void Upsilon4SSpectrumAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - // ARGUS pi+ spectrum excluding K^0_S and Lambda decays - double x1[]={0.075,0.100,0.125,0.150,0.175,0.200,0.225,0.250,0.275,0.300, - 0.325,0.350,0.375,0.400,0.425,0.450,0.475,0.500,0.525,0.550, - 0.575,0.600,0.625,0.650,0.675,0.700,0.725,0.750,0.775,0.800, - 0.900,1.000,1.100,1.200,1.300,1.400,1.500,1.600,1.700,1.800, - 1.900,2.000,2.100,2.200,2.300,2.400,2.500,2.600,2.700,2.800}; - double y1[]={ 8.104, 9.439, 9.967,11.238,11.217,12.208,12.153,12.148,12.194,11.811, - 11.650,11.010,10.085,10.160, 9.378, 8.957, 8.198, 7.801, 6.806, 6.175, - 6.222, 5.380, 5.309, 5.096, 4.193, 3.882, 3.939, 3.785, 3.370, 2.732, - 1.861, 1.160, 0.811, 0.622, 0.433, 0.454, 0.208, 0.141, 0.175, 0.102, - 0.090, 0.123, 0.066, 0.140, 0.010, 0.021, 0.026,-0.015,-0.011}; - double st1[]={0.255,0.273,0.283,0.310,0.335,0.351,0.365,0.369,0.367,0.363, - 0.358,0.351,0.344,0.335,0.325,0.317,0.307,0.301,0.293,0.284, - 0.273,0.267,0.258,0.251,0.247,0.238,0.232,0.224,0.222,0.112, - 0.105,0.105,0.110,0.115,0.110,0.096,0.080,0.071,0.064,0.059, - 0.053,0.049,0.044,0.038,0.035,0.031,0.027,0.025,0.024}; - double sy1[]={0.332,0.239,0.385,0.376,0.307,0.337,0.292,0.293,0.366,0.248, - 0.325,0.286,0.232,0.188,0.182,0.231,0.145,0.262,0.103,0.056, - 0.151,0.073,0.091,0.105,0.129,0.215,0.134,0.148,0.116,0.098, - 0.072,0.089,0.089,0.136,0.064,0.075,0.072,0.058,0.043,0.028, - 0.029,0.029,0.033,0.017,0.027,0.034,0.014,0.025,0.016}; - double total=0.0; - for(unsigned int ix=0;ix<49;++ix) { - total+=y1[ix]*(x1[ix+1]-x1[ix]); - st1[ix] = sqrt(sqr(st1[ix])+sqr(sy1[ix])); - } - vector bins,data,error; - bins = vector( x1, x1+50); - data = vector( y1, y1+49); - error = vector(st1,st1+49); - for(unsigned int ix=0;ix( x1, x1+50); - data = vector( y2, y2+49); - error = vector(st2,st2+49); - for(unsigned int ix=0;ix( x3, x3+46); - data = vector( y3, y3+45); - error = vector(st3,st3+45); - for(unsigned int ix=0;ix( x4, x4+27); - data = vector( y4, y4+26); - error = vector(st4,st4+26); - for(unsigned int ix=0;ix( x5, x5+20); - data = vector( y5, y5+19); - error = vector(st5,st5+19); - for(unsigned int ix=0;ix( x5, x5+20); - data = vector( y6, y6+19); - error = vector(st6,st6+19); - for(unsigned int ix=0;ix( x7, x7+21); - data = vector( y7, y7+20); - error = vector(st7,st7+20); - for(unsigned int ix=0;ix( x8, x8+31); - data = vector( y8, y8+30); - error = vector(st8,st8+30); - for(unsigned int ix=0;ix 0 || state != 0 || !event ) return; - transform(event); - // find all decaying particles - tPVector particles; - int id; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - id=abs((**iter).id()); - if((**iter).children().size()>=2&& - find(_id.begin(),_id.end(),id)!=_id.end()) - particles.push_back(*iter); - } - } -} - -void VPPGammaAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void VPPGammaAnalysis::analyze(tPPtr part) { - int imode(-1); - long id [3]={part->id(),part->children()[0]->id(),part->children()[1]->id()}; - long idb[3]; - if(part->dataPtr()->CC()) idb[0]=part->dataPtr()->CC()->id(); - else idb[0]=id[0]; - for(unsigned int ix=0;ix<2;++ix) { - if(part->children()[ix]->dataPtr()->CC()) - idb[ix+1]=part->children()[ix]->dataPtr()->CC()->id(); - else - idb[ix+1]=id[ix+1]; - } - for(unsigned int ix=0;ix<_id.size();++ix) { - if(id[0]==_id[ix]) { - if((_outgoing1[ix]==id[1]&&_outgoing2[ix]==id[2])|| - (_outgoing1[ix]==id[2]&&_outgoing2[ix]==id[1])) { - imode=ix; - } - } - else if(idb[0]==_id[ix]) { - if((_outgoing1[ix]==idb[1]&&_outgoing2[ix]==idb[2])|| - (_outgoing1[ix]==idb[2]&&_outgoing2[ix]==idb[1])) { - imode=ix; - } - } - if(imode>0) break; - } - Lorentz5Momentum pphoton; - unsigned int mult=0; - Energy emax=ZERO; - int imax=-1; - Lorentz5Momentum pferm(part->children()[0]->momentum()+ - part->children()[1]->momentum()); - pferm.boost(-part->momentum().boostVector()); - pferm.rescaleMass(); - *_masstotal[imode] += pferm.mass()/MeV; - if(part->children().size()==2) { - *_etotal[ imode]+=0.; - *_esingle[imode]+=0.; - *_eall[ imode]+=0.; - *_nphoton[imode]+=0.; - return; - } - Lorentz5Momentum ptemp; - for(unsigned int ix=2;ixchildren().size();++ix) { - if(part->children()[ix]->id()!=ParticleID::gamma){return;} - pphoton+=part->children()[ix]->momentum(); - ptemp=part->children()[ix]->momentum(); - ptemp.boost(-part->momentum().boostVector()); - *_eall[imode]+=ptemp.e()/MeV; - if(part->children()[ix]->momentum().e()>emax) { - emax=part->children()[ix]->momentum().e(); - imax=ix; - } - ++mult; - } - pphoton.boost(-part->momentum().boostVector()); - pphoton.rescaleMass(); - *_etotal[imode]+=pphoton.e()/MeV; - ptemp=part->children()[imax]->momentum(); - ptemp.boost(-part->momentum().boostVector()); - *_esingle[imode]+=ptemp.e()/MeV; - *_nphoton[imode]+=mult; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigVPPGammaAnalysis("Herwig::VPPGammaAnalysis", "HwDecayAnalysis.so"); - -void VPPGammaAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the VPPGammaAnalysis class"); - - static ParVector interfaceIncoming - ("Incoming", - "The PDG code of the incoming particle", - &VPPGammaAnalysis::_id, -1, long(0), 0, 0, - false, false, Interface::nolimits); - - static ParVector interfaceOutgoing1 - ("Outgoing1", - "The PDG code of the first outgoing particle", - &VPPGammaAnalysis::_outgoing1, -1, long(0), 0, 0, - false, false, Interface::nolimits); - - static ParVector interfaceOutgoing2 - ("Outgoing2", - "The PDG code of the second outgoing particle", - &VPPGammaAnalysis::_outgoing2, -1, long(0), 0, 0, - false, false, Interface::nolimits); - -} - -void VPPGammaAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - string titlea,titleb; - for(unsigned int ix=0;ix<_id.size();++ix) { - titlea = " for decay " + getParticleData(_id[ix])->PDGName() + " -> " - + getParticleData(_outgoing1[ix])->PDGName() + " " - + getParticleData(_outgoing2[ix])->PDGName(); - // number of photons - titleb = "Photon multiplicity " +titlea; - using namespace HistogramOptions; - _nphoton[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb,"" - "1/SdS/dN0G1", - " G G XGX", - "N0G1", - " XGX"); - // fermion masses - titleb = "Mass of the charged decay products "+titlea; - _masstotal[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb,"" - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - // total photon energy - _masstotal[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - titleb="Single photon energy for all events"+titlea; - _esingle[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - // all photon - titleb="All photon energy for all events"+titlea; - _eall[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - } -} - -void VPPGammaAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<_id.size();++ix) { - double mass = getParticleData(_id[ix])->mass()/MeV; - for(unsigned iy=0;iy<3;++iy) { - _masstotal.push_back(new_ptr(Histogram(0.,mass,1000))); - _etotal.push_back(new_ptr(Histogram(0.,mass,1000))); - _eall.push_back(new_ptr(Histogram(0.,mass,1000))); - _esingle.push_back(new_ptr(Histogram(0.,mass,1000))); - _nphoton.push_back(new_ptr(Histogram(-0.5,20.5,21))); - } - } -} diff --git a/Contrib/DecayAnalysis/VPPGammaAnalysis.h b/Contrib/DecayAnalysis/VPPGammaAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/VPPGammaAnalysis.h +++ /dev/null @@ -1,173 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_VPPGammaAnalysis_H -#define HERWIG_VPPGammaAnalysis_H -// -// This is the declaration of the VPPGammaAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" -#include "ThePEG/PDT/EnumParticles.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the VPPGammaAnalysis class. - * - * @see \ref VPPGammaAnalysisInterfaces "The interfaces" - * defined for VPPGammaAnalysis. - */ -class VPPGammaAnalysis: public AnalysisHandler { - -public: - - /** - * The default constructor. - */ - VPPGammaAnalysis(); - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - VPPGammaAnalysis & operator=(const VPPGammaAnalysis &) = delete; - -private: - - /** - * id's of the vector mesons to consider - */ - vector _id; - - /** - * id's of the outgoing decay products - */ - //@{ - /** - * First outgoing particle - */ - vector _outgoing1; - - /** - * Second outgoing particle - */ - vector _outgoing2; - //@} - - /** - * histogram for the mass - */ - vector _masstotal; - - /** - * Histograms for the energies - */ - /** - * Total photon energy - */ - vector _etotal; - - /** - * Energy of all the photons - */ - vector _eall; - - /** - * Single photon energy - */ - vector _esingle; - //@} - - /** - * histograms for the multiplicities - */ - vector _nphoton; - -}; - -} - -#endif /* HERWIG_VPPGammaAnalysis_H */ diff --git a/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.cc b/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.cc +++ /dev/null @@ -1,141 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the VectorPScalarFermionsAnalysis class. -// - -#include "VectorPScalarFermionsAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void VectorPScalarFermionsAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all vector particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).dataPtr()->iSpin()==PDT::Spin1&&(**iter).id()!=ParticleID::gamma&& - (**iter).children().size()==3) { - if((**iter).children()[0]->dataPtr()->iSpin()==PDT::Spin0) - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void VectorPScalarFermionsAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void VectorPScalarFermionsAnalysis::analyze(tPPtr part) { - long id[3]={part->children()[0]->id(),part->children()[1]->id(), - part->children()[2]->id()}; - // id's of the fermions - if(abs(id[1])!=abs(id[2])){return;} - if(abs(id[1])!=11&&abs(id[1])!=13){return;} - // check if we already have this decay - unsigned int ix=0; bool found(false); - while(!found&&ix<_incoming.size()) { - if(_incoming[ix]==part->id()&&_outgoingP[ix]==id[0]&&_outgoingf[ix]==abs(id[1])) { - found=true; - } - else { - ++ix; - } - } // create a new graph if needed - if(!found) { - ix=_incoming.size(); - _incoming.push_back(part->id()); - _outgoingP.push_back(id[0]); - _outgoingf.push_back(abs(id[1])); - _mffa.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - _mffb.push_back(new_ptr(Histogram(0.0,20,200))); - _mPf.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - _mPfbar.push_back(new_ptr(Histogram(0.0, - (part->nominalMass()+part->dataPtr()->widthUpCut())/MeV, - 200))); - } - // add the results to the histogram - Lorentz5Momentum ptemp; - ptemp=part->children()[1]->momentum()+part->children()[2]->momentum(); - ptemp.rescaleMass(); - *_mffa[ix]+=ptemp.mass()/MeV; - *_mffb[ix]+=ptemp.mass()/MeV; - ptemp=part->children()[0]->momentum()+part->children()[1]->momentum(); - ptemp.rescaleMass(); - *_mPf[ix]+=ptemp.mass()/MeV; - ptemp=part->children()[0]->momentum()+part->children()[2]->momentum(); - ptemp.rescaleMass(); - *_mPfbar[ix]+=ptemp.mass()/MeV; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigVectorPScalarFermionsAnalysis("Herwig::VectorPScalarFermionsAnalysis", "HwDecayAnalysis.so"); - -void VectorPScalarFermionsAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the VectorPScalarFermionsAnalysis class"); - -} - - -void VectorPScalarFermionsAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - string title,temp; - for(unsigned int ix=0;ix<_incoming.size();++ix) { - title= getParticleData(_incoming[ix])->PDGName() + - " -> " + getParticleData(_outgoingP[ix])->PDGName()+ " " + - getParticleData(_outgoingf[ix])->PDGName() + " " + - getParticleData(-_outgoingf[ix])->PDGName(); - temp = "Mass for f fbar in " +title; - using namespace HistogramOptions; - _mffa[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - _mffb[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - temp = "Mass for vector fermion mass in " +title; - _mPf[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0Pl2-31/GeV2-13", - " G G X X XX X X", - "m0Pl2-31", - " X X XX"); - temp = "Mass for vector fbar mass in " +title; - _mPfbar[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",temp,"", - "1/SdS/dm0Pl2+31/GeV2-13", - " G G X X XX X X", - "m0Pl2+31", - " X X XX"); - } -} diff --git a/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.h b/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/VectorPScalarFermionsAnalysis.h +++ /dev/null @@ -1,147 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_VectorPScalarFermionsAnalysis_H -#define HERWIG_VectorPScalarFermionsAnalysis_H -// -// This is the declaration of the VectorPScalarFermionsAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the VectorPScalarFermionsAnalysis class. - * - * @see \ref VectorPScalarFermionsAnalysisInterfaces "The interfaces" - * defined for VectorPScalarFermionsAnalysis. - */ -class VectorPScalarFermionsAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - VectorPScalarFermionsAnalysis & operator=(const VectorPScalarFermionsAnalysis &) = delete; - -private: - - /** - * PDG codes of the incoming particles - */ - vector _incoming; - - /** - * PDG codes of the outgoing pseudoscalar mesons - */ - vector _outgoingP; - - /** - * PDG codes of the outgoing fermion - */ - vector _outgoingf; - - /** - * Histograms for the mass of the fermion-antifermion pair - */ - vector _mffa; - - /** - * Histograms for the mass of the fermion-antifermion pair - */ - vector _mffb; - - /** - * Histograms for the masses of the pseudoscalar and the fermion - */ - vector _mPf; - - /** - * Histograms for the masses of the pseudoscalar and the antifermion - */ - vector _mPfbar; - -}; - -} - -#endif /* HERWIG_VectorPScalarFermionsAnalysis_H */ diff --git a/Contrib/DecayAnalysis/VffGammaAnalysis.cc b/Contrib/DecayAnalysis/VffGammaAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/VffGammaAnalysis.cc +++ /dev/null @@ -1,196 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the VffGammaAnalysis class. -// - -#include "VffGammaAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/ParVector.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -VffGammaAnalysis::VffGammaAnalysis() { - // c cbar mesons - _id.push_back(443);_id.push_back(100443);_id.push_back(30443); - // b bbar mesons - _id.push_back(553);_id.push_back(100553); - _id.push_back(200553);_id.push_back(300553); -} - -void VffGammaAnalysis::analyze(tEventPtr event, long , - int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all particles - tPVector particles; - unsigned int idtemp[2]; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).children().size()>=2) { - idtemp[0]=abs((**iter).children()[0]->id()); - idtemp[1]=abs((**iter).children()[1]->id()); - if(idtemp[0]>10&&idtemp[0]<17&&idtemp[0]%2==1&& - idtemp[1]>10&&idtemp[1]<17&&idtemp[1]%2==1) { - for(unsigned int iy=0;iy<_id.size();++iy) { - if((**iter).id()==_id[iy]){particles.push_back(*iter); - } - } - } - } - } - } - // analyse them - analyze(particles); -} - -void VffGammaAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void VffGammaAnalysis::analyze(tPPtr part) { - // find the decaying particle - int imode(-1),id(part->id()); - unsigned int ix(0); - do { - if(id==_id[ix]){imode=ix;} - ++ix; - } - while(imode<0&&ix<_id.size()); - if(imode<0) return; - // find the type of lepton - imode = 3*imode+(abs(part->children()[0]->id())-11)/2; - Lorentz5Momentum pphoton; - unsigned int mult(0); - Energy emax(ZERO); - int imax=-1; - Lorentz5Momentum pferm(part->children()[0]->momentum()+ - part->children()[1]->momentum()); - pferm.boost(-part->momentum().boostVector()); - pferm.rescaleMass(); - *_masstotal[imode] += pferm.mass()/MeV; - if(part->children().size()==2) { - *_etotal[ imode]+=0.; - *_esingle[imode]+=0.; - *_eall[ imode]+=0.; - *_nphoton[imode]+=0.; - return; - } - Lorentz5Momentum ptemp; - for(unsigned int ix=2;ixchildren().size();++ix) { - if(part->children()[ix]->id()!=ParticleID::gamma){return;} - pphoton+=part->children()[ix]->momentum(); - ptemp=part->children()[ix]->momentum(); - ptemp.boost(-part->momentum().boostVector()); - *_eall[imode]+=ptemp.e()/MeV; - if(part->children()[ix]->momentum().e()>emax) { - emax=part->children()[ix]->momentum().e(); - imax=ix; - } - ++mult; - } - pphoton.boost(-part->momentum().boostVector()); - pphoton.rescaleMass(); - *_etotal[imode]+=pphoton.e()/MeV; - ptemp=part->children()[imax]->momentum(); - ptemp.boost(-part->momentum().boostVector()); - *_esingle[imode]+=ptemp.e()/MeV; - *_nphoton[imode]+=mult; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigVffGammaAnalysis("Herwig::VffGammaAnalysis", "HwDecayAnalysis.so"); - -void VffGammaAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the VffGammaAnalysis class"); - - static ParVector interfaceId - ("Id", - "PDG codes of the particles to be analysed", - &VffGammaAnalysis::_id, -1, long(0), 0, 0, - false, false, Interface::nolimits); - -} - -inline void VffGammaAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - string titlea,titleb,titlec; - for(unsigned int ix=0;ix<_id.size();++ix) { - titlea = " for decay " + getParticleData(_id[ix])->PDGName() + " -> "; - for(unsigned int iy=0;iy<3;++iy) { - if(iy==0){titleb = titlea + "e+ e-";} - else if(iy==1){titleb = titlea + "mu+ mu-";} - else if(iy==2){titleb = titlea + "tau+ tau-";} - // number of photons - titlec = "Photon multiplicity " +titleb; - using namespace HistogramOptions; - _nphoton[3*ix+iy]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlec,"" - "1/SdS/dN0G1", - " G G XGX", - "N0G1", - " XGX"); - // fermion masses - titlec = "Mass of the charged decay products "+titleb; - _masstotal[3*ix+iy]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlec,"" - "1/SdS/dm0l2+3l2-31/GeV2-13", - " G G X X X X XX X X", - "m0l2+3l2-31", - " X X X X XX"); - // total photon energy - _masstotal[3*ix+iy]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlec,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - titlec="Single photon energy for all events"+titleb; - _esingle[3*ix+iy]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlec,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - // all photon - titlec="All photon energy for all events"+titleb; - _eall[3*ix+iy]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlec,"" - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1", - " XGX"); - } - } -} - -inline void VffGammaAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<_id.size();++ix) { - double mass = getParticleData(_id[ix])->mass()/MeV; - for(unsigned iy=0;iy<3;++iy) { - _masstotal.push_back(new_ptr(Histogram(0.,mass,1000))); - _etotal.push_back(new_ptr(Histogram(0.,mass,1000))); - _eall.push_back(new_ptr(Histogram(0.,mass,1000))); - _esingle.push_back(new_ptr(Histogram(0.,mass,1000))); - _nphoton.push_back(new_ptr(Histogram(-0.5,20.5,21))); - } - } -} diff --git a/Contrib/DecayAnalysis/VffGammaAnalysis.h b/Contrib/DecayAnalysis/VffGammaAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/VffGammaAnalysis.h +++ /dev/null @@ -1,157 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_VffGammaAnalysis_H -#define HERWIG_VffGammaAnalysis_H -// -// This is the declaration of the VffGammaAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the VffGammaAnalysis class. - * - * @see \ref VffGammaAnalysisInterfaces "The interfaces" - * defined for VffGammaAnalysis. - */ -class VffGammaAnalysis: public AnalysisHandler { - -public: - - /** - * The default constructor. - */ - VffGammaAnalysis(); - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - VffGammaAnalysis & operator=(const VffGammaAnalysis &) = delete; - -private: - - /** - * id's of the vector mesons to consider - */ - vector _id; - - /** - * histogram for the mass - */ - vector _masstotal; - - /** - * Histograms for the energies - */ - /** - * Total photon energy - */ - vector _etotal; - - /** - * Energy of all the photons - */ - vector _eall; - - /** - * Single photon energy - */ - vector _esingle; - //@} - - /** - * Histogram for the multiplicities - */ - vector _nphoton; -}; - -} - -#endif /* HERWIG_VffGammaAnalysis_H */ diff --git a/Contrib/DecayAnalysis/ZPhotonsAnalysis.cc b/Contrib/DecayAnalysis/ZPhotonsAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/ZPhotonsAnalysis.cc +++ /dev/null @@ -1,216 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the ZPhotonsAnalysis class. -// - -#include "ZPhotonsAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Repository/CurrentGenerator.h" - -using namespace Herwig; - -void ZPhotonsAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - tPVector particles; - // Rotate to CMS, extract final state particles and call analyze(particles). - for(unsigned int ix=1, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all()); - ThePEG::ParticleSet::iterator iter(part.begin()),end(part.end()); - for( ;iter!=end;++iter) { - if((**iter).id()==ParticleID::Z0&&(**iter).children().size()>=2) { - particles.push_back(*iter); - } - } - } - // analyse them - analyze(particles); -} - -void ZPhotonsAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void ZPhotonsAnalysis::analyze(tPPtr part) { - // check we have the right decay - if(abs(part->children()[0]->id())!=_iferm) return; - if(abs(part->children()[1]->id())!=_iferm) return; - // pphoton is the total momentum of all photons, mult is the multiplicity, - // ix/emax is the index/energy of the most energetic photon emitted: - Lorentz5Momentum pphoton; - unsigned int mult=0; - Energy emax=ZERO; - int imax=-1; - // loop over the non-fermionic children i.e. the photons: - for(unsigned int ix=2;ixchildren().size();++ix) { - if(part->children()[ix]->id()!=ParticleID::gamma) return; - pphoton+=part->children()[ix]->momentum(); - *_etotal[4]+=part->children()[ix]->momentum().e()/MeV; - if(part->children()[ix]->momentum().e()>emax) { - emax=part->children()[ix]->momentum().e(); - imax=ix; - } - Lorentz5Momentum pf(part->children()[0]->momentum()); - Lorentz5Momentum pfb(part->children()[1]->momentum()); - if(part->children()[0]->id()<0&&part->children()[1]>0) swap(pf,pfb); - pf.boost(-part->momentum().boostVector()); - pfb.boost(-part->momentum().boostVector()); - // bin the cosine of the angle between each photon and the fermion - Lorentz5Momentum pphot(part->children()[ix]->momentum()); - pphot.boost(-part->momentum().boostVector()); - *_cphoton+=pf.vect().cosTheta(pphot.vect()); - ++mult; - } - // boost the combined fermion momentum and the total photon momentum - // to the Z/gamma rest framefermion rest frame: - Lorentz5Momentum pferm(part->children()[0]->momentum()+ - part->children()[1]->momentum()); - pferm.boost(-part->momentum().boostVector()); - pphoton.boost(-part->momentum().boostVector()); - pferm.rescaleMass(); - pphoton.rescaleMass(); - // bin the photon multiplicity of this decay: - *_nphoton+=mult; - for(unsigned int ix=0;ix<3;++ix) { - // bin the invariant mass of the fermions and the total photon energy - // in histograms of varying ranges (ix): - *_masstotal[ix]+=pferm.mass()/MeV; - if(mult>0) *_etotal[ix]+=pphoton.e()/MeV; - } - // bin the energy of the most energetic photon: - if(imax>0) *_etotal[3]+=part->children()[imax]->momentum().e()/MeV; - if(mult<20) { - // bin the difermion invariant mass and the total photon energy - // according to multiplicity: - *_mphoton[mult]+=pferm.mass()/MeV; - *_ephoton[mult]+=pphoton.e()/MeV; - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigZPhotonsAnalysis("Herwig::ZPhotonsAnalysis", "HwDecayAnalysis.so"); - -void ZPhotonsAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the ZPhotonsAnalysis class"); - - static Parameter interfaceFermion - ("Fermion", - "Id code of fermion", - &ZPhotonsAnalysis::_iferm, 11, 11, 15, - false, false, Interface::limited); - -} - -inline void ZPhotonsAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _nphoton->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Photon Multiplicity", - " ", - "1/SdS/dN0G1", - " G G XGX", - "N0G1", - " XGX"); - for(unsigned int ix=0;ix<3;++ix) { - _masstotal[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Fermion mass for all events", - " ", - "1/SdS/d/GeV2-13", - " G G X X", - "m0l2+3l2-31/GeV", - " X X X X XX "); - _etotal[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Photon Energy for all events", - " ", - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1/GeV", - " XGX "); - } - _etotal[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Photon Energy for all events", - " ", - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1/GeV", - " XGX "); - _etotal[4]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "Photon Energy for all events", - " ", - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1/GeV", - " XGX "); - - _cphoton->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED","Photon cosine wrt fermion","", - "1/SdS/dc0G1", - " G G XGX", - "c0G1", - " XGX "); - for(unsigned int ix=0;ix<20;++ix) { - ostringstream titlea; - titlea << "Fermion mass for " << ix << " photons " << flush; - _mphoton[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titlea.str(),"", - "1/SdS/d/GeV2-13", - " G G X X", - "m0l2+3l2-31/GeV", - " X X X X XX "); - ostringstream titleb; - titleb << "photon energy for " << ix << " photons " << flush; - _ephoton[ix]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED",titleb.str(),"", - "1/SdS/dE0G1/GeV2-13", - " G G XGX X X", - "E0G1/GeV", - " XGX ");; - } -} - -inline void ZPhotonsAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _masstotal.push_back(new_ptr(Histogram(0.,92000.,400))); - _etotal .push_back(new_ptr(Histogram(0.,92000.,400))); - _masstotal.push_back(new_ptr(Histogram(0.,80000.,200))); - _etotal .push_back(new_ptr(Histogram(0.,10000.,200))); - _masstotal.push_back(new_ptr(Histogram(80000.,92000.,200))); - _etotal .push_back(new_ptr(Histogram(10000.,92000.,200))); - for(unsigned int ix=0;ix<20;++ix) { - _mphoton.push_back(new_ptr(Histogram(0.,92000.,400))); - _ephoton.push_back(new_ptr(Histogram(0.,92000.,400))); - } - _cphoton=new_ptr(Histogram(-1.,1.,100)); - _etotal.push_back(new_ptr(Histogram(0.,92000.,400))); - _etotal.push_back(new_ptr(Histogram(0.,92000.,400))); - _nphoton=new_ptr(Histogram(-0.5,100.5,101)); -} - -void ZPhotonsAnalysis::persistentOutput(PersistentOStream & os) const { - os <<_iferm; -} - -void ZPhotonsAnalysis::persistentInput(PersistentIStream & is, int) { - is >> _iferm; -} diff --git a/Contrib/DecayAnalysis/ZPhotonsAnalysis.h b/Contrib/DecayAnalysis/ZPhotonsAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/ZPhotonsAnalysis.h +++ /dev/null @@ -1,173 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_ZPhotonsAnalysis_H -#define HERWIG_ZPhotonsAnalysis_H -// -// This is the declaration of the ZPhotonsAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the ZPhotonsAnalysis class. - * - * @see \ref ZPhotonsAnalysisInterfaces "The interfaces" - * defined for ZPhotonsAnalysis. - */ -class ZPhotonsAnalysis: public AnalysisHandler { - -public: - - /** - * Default constructor - */ - ZPhotonsAnalysis() : _iferm(11) {} - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - ZPhotonsAnalysis & operator=(const ZPhotonsAnalysis &) = delete; - -private: - - /** - * id of the fermions to look at - */ - int _iferm; - - /** - * histogram for the mass - */ - vector _masstotal; - - /** - * histogram for the energy - */ - vector _etotal; - - /** - * histogram for the mass - */ - vector _mphoton; - - /** - * histograms for the energies of different photons - */ - vector _ephoton; - - /** - * histograms for the cos thetas of different photons - */ - HistogramPtr _cphoton; - - /** - * histogram for the photon multiplicity - */ - HistogramPtr _nphoton; -}; - -} - -#endif /* HERWIG_ZPhotonsAnalysis_H */ diff --git a/Contrib/DecayAnalysis/a1DecayAnalysis.cc b/Contrib/DecayAnalysis/a1DecayAnalysis.cc deleted file mode 100644 --- a/Contrib/DecayAnalysis/a1DecayAnalysis.cc +++ /dev/null @@ -1,177 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the a1DecayAnalysis class. -// - -#include "a1DecayAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void a1DecayAnalysis::analyze(tEventPtr event, long, int loop, int state) { - if ( loop > 0 || state != 0 || !event ) return; - transform(event); - // find all omega and phi particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - int id=abs((**iter).id()); - if(id==ParticleID::a_10||id==ParticleID::a_1plus) - particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -void a1DecayAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -void a1DecayAnalysis::analyze(tPPtr part) { - // find the pions - ParticleVector pions; - findPions(part,pions); - if(pions.size()!=3) return; - vector pip,pim,pi0; - long idp = part->id()>0 ? 211 : -211; - for(unsigned int ix=0;ixid()==idp) pip.push_back(pions[ix]->momentum()); - else if(pions[ix]->id()==111) pi0.push_back(pions[ix]->momentum()); - else if(pions[ix]->id()==-idp) pim.push_back(pions[ix]->momentum()); - } - // a_1+ -> pi+pi+pi- - if(pip.size()==2&&pim.size()==1) { - *_hist3A += (pip[0]+pip[1]).m()/MeV; - *_hist3B += (pip[0]+pim[0]).m()/MeV; - *_hist3B += (pip[1]+pim[0]).m()/MeV; - } - // a_1+ -> pi0pi0pi+ - else if(pip.size()==1&&pi0.size()==2) { - *_hist1A +=(pi0[0]+pi0[1]).m()/MeV; - *_hist1B +=(pip[0]+pi0[0]).m()/MeV; - *_hist1B +=(pip[0]+pi0[1]).m()/MeV; - } - // a_10 -> pi0pi0pi0 - else if(pi0.size()==3) { - *_hist0 +=(pi0[0]+pi0[1]).m()/MeV; - *_hist0 +=(pi0[0]+pi0[2]).m()/MeV; - *_hist0 +=(pi0[1]+pi0[2]).m()/MeV; - } - // a_10 -> pi+pi-pi0 - else if(pi0.size()==1&&pip.size()==1&&pim.size()==1) { - *_hist2A +=(pim[0]+pip[0]).m()/MeV; - *_hist2B +=(pip[0]+pi0[0]).m()/MeV; - *_hist2C +=(pim[0]+pi0[0]).m()/MeV; - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwiga1DecayAnalysis("Herwig::a1DecayAnalysis", "HwDecayAnalysis.so"); - -void a1DecayAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the a1DecayAnalysis class"); - -} - -void a1DecayAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + - string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _hist0->topdrawOutput(output,Frame|Errorbars,"RED", - "P203P203 mass in A011203RP203P203P203", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P203P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2031/MeV", - " XGX XGX XX "); - _hist1A->topdrawOutput(output,Frame|Errorbars,"RED", - "P203P203 mass in A0112+3RP203P203P2+3", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P203P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2031/MeV", - " XGX XGX XX "); - _hist1B->topdrawOutput(output,Frame|Errorbars,"RED", - "P203P2+3 mass in A0112+3RP203P203P2+3", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P203P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P203P2+31/MeV", - " XGX XGX XX "); - _hist2A->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3P2-3 mass in A011203RP2+3P2-3P203", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P2+3P2-31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2+3P2-31/MeV", - " XGX XGX XX "); - _hist2B->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3P203 mass in A011203RP2+3P2-3P203", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P2+3P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P2+3P2031/MeV", - " XGX XGX XX "); - _hist2C->topdrawOutput(output,Frame|Errorbars,"RED", - "P2-3P203 mass in A011203RP2+3P2-3P203", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P2-3P2031/MeV2-13", - " F F XGX XGX XX X X", - "m0P2-3P2031/MeV", - " XGX XGX XX "); - _hist3A->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3P2+3 mass in A0112+3RP2+3P2+3P2-3", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P2+3P2+31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2+3P2+31/MeV", - " XGX XGX XX "); - _hist3B->topdrawOutput(output,Frame|Errorbars,"RED", - "P2+3P2-3 mass in A0112+3RP2+3P2+3P2-3", - "GX XGX X X XX XWGX XGX XGX X", - "1/GdG/dm0P2+3P2-31/MeV2-13", - " F F XGX XGX XX X X", - "m0P2+3P2-31/MeV", - " XGX XGX XX "); -} - -void a1DecayAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _hist0 = new_ptr(Histogram(0.,1500.,200)); - _hist1A = new_ptr(Histogram(0.,1500.,200)); - _hist1B = new_ptr(Histogram(0.,1500.,200)); - _hist2A = new_ptr(Histogram(0.,1500.,200)); - _hist2B = new_ptr(Histogram(0.,1500.,200)); - _hist2C = new_ptr(Histogram(0.,1500.,200)); - _hist3A = new_ptr(Histogram(0.,1500.,200)); - _hist3B = new_ptr(Histogram(0.,1500.,200)); -} - -void a1DecayAnalysis::findPions(tPPtr part,ParticleVector & pions) { - if(abs(part->id())==ParticleID::piplus||part->id()==ParticleID::pi0) { - pions.push_back(part); - return; - } - else if(!part->children().empty()) { - for(unsigned int ix=0;ixchildren().size();++ix) { - findPions(part->children()[ix],pions); - } - } -} diff --git a/Contrib/DecayAnalysis/a1DecayAnalysis.h b/Contrib/DecayAnalysis/a1DecayAnalysis.h deleted file mode 100644 --- a/Contrib/DecayAnalysis/a1DecayAnalysis.h +++ /dev/null @@ -1,179 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_a1DecayAnalysis_H -#define HERWIG_a1DecayAnalysis_H -// -// This is the declaration of the a1DecayAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the a1DecayAnalysis class. - * - * @see \ref a1DecayAnalysisInterfaces "The interfaces" - * defined for a1DecayAnalysis. - */ -class a1DecayAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * find the pions produced in the decay - */ - void findPions(tPPtr part,ParticleVector & pions); - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - a1DecayAnalysis & operator=(const a1DecayAnalysis &) = delete; - -private: - - /** - * Histograms for \f$a_1^0\to\pi^0\pi^0\pi^0\f$ - */ - HistogramPtr _hist0; - - /** - * Histograms for \f$a_1^+\to\pi^0\pi^0\pi^+\f$ - */ - //@{ - /** - * Mass of the \f$\pi^0\pi^0\f$ pair - */ - HistogramPtr _hist1A; - - /** - * Mass of the \f$\pi^0\pi^+\f$ pair - */ - HistogramPtr _hist1B; - //@} - - /** - * Histograms for \f$a_1^0\to\pi^+\pi^-\pi^0\f$ - */ - //@{ - /** - * Mass of the \f$\pi^+\pi^-\f$ pair - */ - HistogramPtr _hist2A; - - /** - * Mass of the \f$\pi^+\pi^0\f$ pair - */ - HistogramPtr _hist2B; - - /** - * Mass of the \f$\pi^-\pi^0\f$ pair - */ - HistogramPtr _hist2C; - //@} - - /** - * Histograms for \f$a_1^+\to\pi^+\pi^+\pi^-\f$ - */ - //@{ - /** - * Mass of the \f$\pi^+\pi^+\f$ pair - */ - HistogramPtr _hist3A; - - /** - * Mass of the \f$\pi^+\pi^-\f$ pair - */ - HistogramPtr _hist3B; - //@} -}; - -} - -#endif /* HERWIG_a1DecayAnalysis_H */ diff --git a/Contrib/FxFx/FxFxAnalysis.cc b/Contrib/FxFx/FxFxAnalysis.cc deleted file mode 100644 --- a/Contrib/FxFx/FxFxAnalysis.cc +++ /dev/null @@ -1,389 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the FxFxAnalysis class. -// - -#include "FxFxAnalysis.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/ParVector.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/Vectors/HepMCConverter.h" -#include "ThePEG/Config/HepMCHelper.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/EventRecord/SubProcess.h" -#include "ThePEG/EventRecord/SubProcessGroup.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/Repository/CurrentGenerator.h" -#include "HepMC/GenEvent.h" -#include "Rivet/AnalysisHandler.hh" -#include "Rivet/Tools/Logging.hh" -#include "HepMC/IO_AsciiParticles.h" -#include "HepMC/IO_GenEvent.h" -#include "ThePEG/Utilities/XSecStat.h" - -using namespace ThePEG; - -FxFxAnalysis::FxFxAnalysis() - : _remnantId(82), _format(1),_unitchoice(), - _geneventPrecision(16), debug(false), _rivet(), _nevent(0), useoptweights(false), normoptweights(false) {} - -HepMC::GenEvent * FxFxAnalysis::makeEvent(tEventPtr event, tSubProPtr sub, long no, - Energy eUnit, Length lUnit, - CrossSection xsec, CrossSection xsecErr) const { - //convert the event from the Herwig format to the HepMC format and write it to the common block - HepMC::GenEvent * ev = HepMCConverter::convert(*event, false,eUnit, lUnit); - - //reset the event - HepMCTraits::resetEvent(ev, no, event->weight()*sub->groupWeight(), event->optionalWeights()); - - //set the cross section - HepMCTraits::setCrossSection(*ev,xsec/picobarn, - xsecErr/picobarn); - return ev; -} - -HepMC::GenEvent * FxFxAnalysis::makeEventW(tEventPtr event, tSubProPtr sub, long no, - Energy eUnit, Length lUnit, - CrossSection xsec, CrossSection xsecErr, double evoptweight, double centralweight) const { - - //convert the event from the Herwig format to the HepMC format and write it to the common block - HepMC::GenEvent * ev = HepMCConverter::convert(*event, false,eUnit, lUnit); - - if(normoptweights) { evoptweight /= centralweight; } - - //reset the event - HepMCTraits::resetEvent(ev, no, evoptweight, event->optionalWeights()); - //set the cross section - HepMCTraits::setCrossSection(*ev,xsec/picobarn, - xsecErr/picobarn); - return ev; -} - -void FxFxAnalysis::analyze(ThePEG::tEventPtr event, long ieve, int loop, int state) { - Energy eUnit; - Length lUnit; - switch (_unitchoice) { - default: eUnit = GeV; lUnit = millimeter; break; - case 1: eUnit = MeV; lUnit = millimeter; break; - case 2: eUnit = GeV; lUnit = centimeter; break; - case 3: eUnit = MeV; lUnit = centimeter; break; - } - - tcFxFxEventHandlerPtr eh = dynamic_ptr_cast(event->primaryCollision()->handler()); - assert(eh); - - CrossSection xsec = eh->integratedXSec(); - CrossSection xsecErr = eh->integratedXSecErr(); - - optxsec = eh->optintegratedXSecMap(); - - - int ii = 0; - if(useoptweights) { - for (map::const_iterator it= optxsec.begin(); it!=optxsec.end(); ++it){ - OptXS[ii] = it->second/picobarn; - ii++; - } - } - - tSubProPtr sub = event->primarySubProcess(); - Ptr::tptr grp = - dynamic_ptr_cast::tptr>(sub); - - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - // convert to hepmc - HepMC::GenEvent * hepmc = - makeEvent(event,sub,_nevent,eUnit,lUnit,xsec,xsecErr); - - //count weights here - std::vector strs; - if(_numweights == -999) { - _numweights = 0; - for (map::const_iterator it= event->optionalWeights().begin(); it!=event->optionalWeights().end(); ++it){ - string first_piece = it->first; - string word; - istringstream iss(first_piece, istringstream::in); - while( iss >> word ) strs.push_back(word); - if(strs[0] != "np") { _numweights++; } - strs.clear(); - } - } - double CentralWeight = 1.; - if(useoptweights) { - //find the weights - _i = 0;//counter - OptWeights.clear(); - for (map::const_iterator it= event->optionalWeights().begin(); it!=event->optionalWeights().end(); ++it){ - // std::cout << it->first << " => " << it->second << '\n'; - string first_piece = it->first; - string word; - istringstream iss(first_piece, istringstream::in); - while( iss >> word ) { - strs.push_back(word); - } - std::pair OptWeightsTemp; - /* if(strs[0] == "PDF") { - OptWeightsTemp.first = atoi(strs[2].c_str()); - OptWeightsTemp.second= it->second; - OptWeights.push_back(OptWeightsTemp); - _i++; - } - if(strs[0] == "SC") { - OptWeightsTemp.first = atoi(strs[3].c_str()); - OptWeightsTemp.second = it->second; - // cout << "OptWeightsTemp.first = " << OptWeightsTemp.first << " OptWeightsTemp.second = " << OptWeightsTemp.second << endl; - if(OptWeightsTemp.first == 1001) { cout << "OptWeightsTemp.second = " << OptWeightsTemp.second << endl; CentralWeight = OptWeightsTemp.second; } - OptWeights.push_back(OptWeightsTemp); - _i++; - }*/ - if(strs[0] != "np") { - OptWeightsTemp.first = atoi((it->first).c_str()); - OptWeightsTemp.second= it->second; - if(OptWeightsTemp.first == 1001) { /*cout << "OptWeightsTemp.second = " << OptWeightsTemp.second << endl;*/ CentralWeight = OptWeightsTemp.second; } - OptWeights.push_back(OptWeightsTemp); - _i++; - } - strs.clear(); - } - } - - /* multiple hepmcs for scale/pdf variations - */ - vector hepmcMULTI;// = new HepMC::GenEvent[_numweights]; - HepMC::GenEvent * hepmcMULTIi; - if(useoptweights) { - for(int rr = 0; rr < _numweights; rr++) { - double xsrr = optxsec[std::to_string(OptWeights[rr].first)]/picobarn; - /* cout << "xsec = " << xsec/picobarn << endl; - cout << "OptWeights[rr].second = " << OptWeights[rr].second << endl; - cout << "xsrr = " << xsrr << endl;*/ - hepmcMULTIi = makeEventW(event,sub,_nevent,eUnit,lUnit,xsrr*picobarn,xsecErr,OptWeights[rr].second, CentralWeight); - hepmcMULTI.push_back(hepmcMULTIi); - } - } - - CurrentGenerator::Redirect stdout(cout); - - if ( _rivet ) _rivet->analyze(*hepmc); - - if(useoptweights) { - for(int rr = 0; rr < _numweights; rr++) { - if ( _rivetMULTI[rr] ) _rivetMULTI[rr]->analyze(*hepmcMULTI[rr]); - } - } - // delete hepmc events - delete hepmc; - if(useoptweights) { - for(int rr = 0; rr < _numweights; rr++) { - delete hepmcMULTI[rr]; - } - } - - if ( grp ) { - for ( SubProcessVector::const_iterator s = grp->dependent().begin(); - s != grp->dependent().end(); ++s ) { - - hepmc = makeEvent(event,*s,_nevent,eUnit,lUnit,xsec,xsecErr); - - if ( _rivet ) _rivet->analyze(*hepmc); - // delete hepmc event - delete hepmc; - - - } - - } - - ++_nevent; -} - - -ThePEG::IBPtr FxFxAnalysis::clone() const { - return new_ptr(*this); -} - -ThePEG::IBPtr FxFxAnalysis::fullclone() const { - return new_ptr(*this); -} - -void FxFxAnalysis::persistentOutput(ThePEG::PersistentOStream & os) const { - os << _analyses << filename << debug << useoptweights << normoptweights; -} - -void FxFxAnalysis::persistentInput(ThePEG::PersistentIStream & is, int) { - is >> _analyses >> filename >> debug >> useoptweights >> normoptweights; -} - -ThePEG::ClassDescription FxFxAnalysis::initFxFxAnalysis; -// Definition of the static class description member. - -void FxFxAnalysis::Init() { - static ThePEG::ClassDocumentation documentation - ("The FxFxAnalysis class is a simple class to allow analyses" - " from the Rivet library to be called from ThePEG"); - - static ThePEG::ParVector interfaceAnalyses - ("Analyses", - "The names of the Rivet analyses to use", - &FxFxAnalysis::_analyses, -1, "", "","" "", - false, false, ThePEG::Interface::nolimits); - - static Parameter interfaceRemnantId - ("RemnantId", - "Set the PDG id to be used for remnants.", - &FxFxAnalysis::_remnantId, 82, 0, 0, - false, false, Interface::nolimits); - - static Parameter interfaceFilename - ("Filename", - "The name of the file where the YODA histograms are put. If empty, " - "the run name will be used instead. '.yoda' will in any case be " - "appended to the file name.", - &FxFxAnalysis::filename, "", true, false); - - - static Switch interfaceDebug - ("Debug", - "Enable debug information from Rivet", - &FxFxAnalysis::debug, false, true, false); - static SwitchOption interfaceDebugNo - (interfaceDebug, - "No", - "Disable debug information.", - false); - static SwitchOption interfaceDebugYes - (interfaceDebug, - "Yes", - "Enable debug information from Rivet.", - true); - - - static Switch interfaceUseOptWeights - ("UseOptWeights", - "Enable debug information from Rivet", - &FxFxAnalysis::useoptweights, false, true, false); - static SwitchOption interfaceUseOptWeightsNo - (interfaceUseOptWeights, - "No", - "Disable optional weights", - false); - static SwitchOption interfaceUseOptWeightsYes - (interfaceUseOptWeights, - "Yes", - "Enable debug information from Rivet.", - true); - - static Switch interfaceNormOptWeights - ("NormOptWeights", - "Enable debug information from Rivet", - &FxFxAnalysis::normoptweights, false, true, false); - static SwitchOption interfaceNormOptWeightsNo - (interfaceNormOptWeights, - "No", - "Do not normalize optional weights", - false); - static SwitchOption interfacedNormOptWeightsYes - (interfaceNormOptWeights, - "Yes", - "Normalize optional weights.", - true); - - - - - interfaceAnalyses.rank(10); - -} - -void FxFxAnalysis::dofinish() { - AnalysisHandler::dofinish(); - if( _nevent > 0 && _rivet ) { - CurrentGenerator::Redirect stdout(cout); - _rivet->setCrossSection(generator()->integratedXSec()/picobarn); - _rivet->finalize(); - - string fname = filename; - fname = generator()->runName() + ".yoda"; - _rivet->writeData(fname); - } - - delete _rivet; - _rivet = 0; - - if(useoptweights) { - for(int rr = 0; rr < _numweights; rr++) { - cout << (OptWeights[rr].first) << ", cross section = " << OptXS[rr] << endl; - if( _nevent > 0 && _rivetMULTI[rr] ) { - double xsrr = optxsec[std::to_string(OptWeights[rr].first)]/picobarn; - // _rivetMULTI[rr]->setCrossSection(OptXS[rr]); - _rivetMULTI[rr]->setCrossSection(xsrr); - _rivetMULTI[rr]->finalize(); - - string fname = filename; - fname = generator()->runName() + "_" + std::to_string(OptWeights[rr].first) + ".yoda"; - - _rivetMULTI[rr]->writeData(fname); - } - delete _rivetMULTI[rr]; - _rivetMULTI[rr] = 0; - } - } -} - -void FxFxAnalysis::doinit() { - _numweights = -999; - - for(int rr = 0; rr < 120; rr++) { - OptXS.push_back(0.); - } - AnalysisHandler::doinit(); - if(_analyses.empty()) - throw ThePEG::Exception() << "Must have at least one analysis loaded in " - << "FxFxAnalysis::doinitrun()" - << ThePEG::Exception::runerror; - - // check that analysis list is available - _rivet = new Rivet::AnalysisHandler; //(fname); - _rivet->addAnalyses(_analyses); - if ( _rivet->analysisNames().size() != _analyses.size() ) { - throw ThePEG::Exception() - << "Rivet could not find all requested analyses.\n" - << "Use 'rivet --list-analyses' to check availability.\n" - << ThePEG::Exception::runerror; - } - - delete _rivet; - _rivet = 0; -} - -void FxFxAnalysis::doinitrun() { - _numweights = -999; - AnalysisHandler::doinitrun(); - // create FxFx analysis handler - if(useoptweights) { cout << "Warning: Using optional weights launches multiple rivet analyses. This may slow down your run substantially!" << endl; } - CurrentGenerator::Redirect stdout(cout); - _rivet = new Rivet::AnalysisHandler; //(fname); - _rivet->addAnalyses(_analyses); - if(useoptweights) { - for(int rr = 0; rr < 110; rr++) { - OptXS.push_back(0.); - _rivetMULTI[rr] = new Rivet::AnalysisHandler; //(fname); - _rivetMULTI[rr]->addAnalyses(_analyses); - } - } - - // check that analysis list is still available - if ( _rivet->analysisNames().size() != _analyses.size() ) { - throw ThePEG::Exception() - << "Rivet could not find all requested analyses.\n" - << "Use 'rivet --list-analyses' to check availability.\n" - << ThePEG::Exception::runerror; - } - if ( debug ) - Rivet::Log::setLevel("Rivet",Rivet::Log::DEBUG); -} diff --git a/Contrib/FxFx/FxFxAnalysis.h b/Contrib/FxFx/FxFxAnalysis.h deleted file mode 100644 --- a/Contrib/FxFx/FxFxAnalysis.h +++ /dev/null @@ -1,262 +0,0 @@ -// -*- C++ -*- -#ifndef THEPEG_FxFxAnalysis_H -#define THEPEG_FxFxAnalysis_H -// -// This is the declaration of the FxFxAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Rivet/AnalysisHandler.hh" -#include "FxFxReader.h" -#include "FxFxEventHandler.h" - -namespace ThePEG { - -/** - * Here is the documentation of the FxFxAnalysis class. - * - * @see \ref FxFxAnalysisInterfaces "The interfaces" - * defined for FxFxAnalysis. - */ -class FxFxAnalysis: public ThePEG::AnalysisHandler { - -public: - - /** - * The default constructor. - */ - FxFxAnalysis(); - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(ThePEG::tEventPtr event, long ieve, int loop, int state); - - /** - * Produca a HepMC event for the given subprocess - */ - HepMC::GenEvent * makeEvent(tEventPtr event, tSubProPtr sub, long no, - Energy eUnit, Length lUnit, - CrossSection xsec, CrossSection xsecErr) const; - - /** - * Produca a HepMC event for the given subprocess - */ - HepMC::GenEvent * makeEventW(tEventPtr event, tSubProPtr sub, long no, - Energy eUnit, Length lUnit, - CrossSection xsec, CrossSection xsecErr, double evoptweight, double centralweight) const; - - int _i; - - int _numweights; - - //@} - -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(ThePEG::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(ThePEG::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 ThePEG::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 ThePEG::IBPtr fullclone() const; - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the read phase. - */ - virtual void doinit(); - - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ThePEG::ClassDescription initFxFxAnalysis; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - FxFxAnalysis & operator=(const FxFxAnalysis &) = delete; - -private: - /** - * The PDG ID to be used for remnants - */ - long _remnantId; - - /** - * The HepMC format - */ - int _format; - - /** - * Selector for the choice of units - */ - int _unitchoice; - - /** - * Choice of output precision in GenEvent format - */ - unsigned int _geneventPrecision; - - /** - * The Analyses to use - */ - vector _analyses; - - /** - * The base name of the output file. - */ - string filename; - - /** - * Enable debugging information from FxFx - */ - bool debug; - - /** - * Enable use of optional weights in analysis - */ - bool useoptweights = false; - - /** - * normalize optional weights to the central weight - */ - - bool normoptweights = false; - - /** - * The FxFxAnalysisHandler - */ - Rivet::AnalysisHandler * _rivet; - - /** - * The FxFxAnalysisHandlers for multiple weights - */ - Rivet::AnalysisHandler * _rivetMULTI[120]; - - - /** - * holders of weights and cross section - */ - - std::vector< std::pair > OptWeights; - std::vector OptXS; - map optxsec; - - - /** - * Event count - */ - unsigned long _nevent; -}; - -} - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of FxFxAnalysis. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of FxFxAnalysis. */ - typedef AnalysisHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the FxFxAnalysis class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "ThePEG::FxFxAnalysis"; } - /** - * The name of a file containing the dynamic library where the class - * FxFxAnalysis is implemented. It may also include several, space-separated, - * libraries if the class FxFxAnalysis 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 "FxFxAnalysis.so"; } -}; - -/** @endcond */ - -} - -#endif /* THEPEG_FxFxAnalysis_H */ diff --git a/Contrib/FxFx/FxFxEventHandler.cc b/Contrib/FxFx/FxFxEventHandler.cc deleted file mode 100644 --- a/Contrib/FxFx/FxFxEventHandler.cc +++ /dev/null @@ -1,652 +0,0 @@ -// -*- C++ -*- -// -// Based on: -// FxFxEventHandler.cc is a part of ThePEG - Toolkit for HEP Event Generation -// Copyright (C) 1999-2011 Leif Lonnblad -// -// ThePEG is licenced under version 3 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 FxFxEventHandler class. -// - -#include "FxFxEventHandler.h" -#include "FxFxReader.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/RefVector.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Repository/Repository.h" -#include "ThePEG/Handlers/LuminosityFunction.h" -#include "ThePEG/Handlers/XComb.h" -#include "ThePEG/Handlers/CascadeHandler.h" -#include "ThePEG/Cuts/Cuts.h" -#include "ThePEG/PDF/PartonExtractor.h" -#include "ThePEG/Utilities/LoopGuard.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/EventRecord/Collision.h" -#include "ThePEG/EventRecord/Step.h" -#include "ThePEG/EventRecord/SubProcess.h" -#include "ThePEG/Utilities/EnumIO.h" -#include "ThePEG/Utilities/Maths.h" -#include "ThePEG/Repository/UseRandom.h" -#include "ThePEG/Utilities/Throw.h" -#include "ThePEG/Utilities/Debug.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" - -using namespace ThePEG; - -FxFxEventHandler::~FxFxEventHandler() {} - -IBPtr FxFxEventHandler::clone() const { - return new_ptr(*this); -} - -IBPtr FxFxEventHandler::fullclone() const { - return new_ptr(*this); -} - -void FxFxEventHandler::doinit() { - EventHandler::doinit(); - - for ( int i = 0, N = readers().size(); i < N; ++i ) { - readers()[i]->init(); - //FxFxReader & reader = *readers()[i]; - //reader.initialize(*this); - //weightnames = reader.optWeightsNamesFunc(); - } - /* - XSecStat* initxsecs = new XSecStat[weightnames.size()]; - - for(int ww = 0; ww < weightnames.size(); ww++){ - initxsecs[ww].reset(); - optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - CrossSection initxs = 0.*picobarn; - optxs.insert(std::make_pair(weightnames[ww], initxs)); - }*/ - ntries = 0; - -} - -void FxFxEventHandler::initialize() { - - if ( lumiFnPtr() ) Repository::clog() - << "The LuminosityFunction '" << lumiFnPtr()->name() - << "' assigned to the FxFxEventHandler '" << name() - << "' will not be active in this run. Instead the incoming " - << "particles will be determined by the used FxFxReader objects.\n" - << Exception::warning; - - if ( readers().empty() ) - throw FxFxInitError() - << "No readers were defined for the FxFxEventHandler '" - << name() << "'" << Exception::warning; - - // Go through all the readers and collect information about cross - // sections and processes. - typedef map ProcessMap; - ProcessMap processes; - PDPair incoming; - Energy MaxEA = ZERO; - Energy MaxEB = ZERO; - for ( int i = 0, N = readers().size(); i < N; ++i ) { - FxFxReader & reader = *readers()[i]; - reader.initialize(*this); - weightnames = reader.optWeightsNamesFunc(); - // Check that the incoming particles are consistent between the - // readers. - if ( !incoming.first ) { - incoming.first = getParticleData(reader.heprup.IDBMUP.first); - if ( !incoming.first ) - Throw() - << "Unknown beam PID " << reader.heprup.IDBMUP.first - << ". Have you created a matching BeamParticle object?" - << Exception::runerror; - } - if ( !incoming.second ) { - incoming.second = getParticleData(reader.heprup.IDBMUP.second); - if ( !incoming.second ) - Throw() - << "Unknown beam PID " << reader.heprup.IDBMUP.first - << ". Have you created a matching BeamParticle object?" - << Exception::runerror; - } - if ( incoming.first->id() != reader.heprup.IDBMUP.first || - incoming.second->id() != reader.heprup.IDBMUP.second ) - Repository::clog() - << "The different FxFxReader objects in the " - << "FxFxEventHandler '" << name() << "' have different " - << "types of colliding particles." << Exception::warning; - MaxEA = max(MaxEA, reader.heprup.EBMUP.first*GeV); - MaxEB = max(MaxEB, reader.heprup.EBMUP.second*GeV); - - // Check that the weighting of the events in the different readers - // is consistent with the ones requested for this event - // handler. Also collect the sum of the maximum weights. - if ( reader.negativeWeights() && weightOption() > 0 ) - throw FxFxInitError() - << "The reader '" << reader.name() - << "' contains negatively weighted events, " - << "which is not allowed for the FxFxEventHandler '" - << name() << "'." << Exception::warning; - - // Check that we do not have the same process numbers in different - // readers. - for ( int ip = 0; ip < reader.heprup.NPRUP; ++ip ) { - if ( reader.heprup.LPRUP[ip] ) { - ProcessMap::iterator pit = processes.find(reader.heprup.LPRUP[ip]); - if ( pit == processes.end() ) - processes[reader.heprup.LPRUP[ip]] = readers()[i]; - else if ( warnPNum ) { - Throw() - << "In the FxFxEventHandler '" - << name() << "', both the '" << pit->second->name() << "' and '" - << reader.name() << "' contains sub-process number " << pit->first - << ". This process may be double-counted in this run." - << Exception::warning; - } - } - } - selector().insert(reader.stats.maxXSec(), i); - } - stats.maxXSec(selector().sum()); - histStats.maxXSec(selector().sum()); - for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ - (it->second).maxXSec(selector().sum()); - } - // Check that we have any cross section at all. - if ( stats.maxXSec() <= ZERO ) - throw FxFxInitError() - << "The sum of the cross sections of the readers in the " - << "FxFxEventHandler '" << name() - << "' was zero." << Exception::warning; - - // We now create a LuminosityFunction object to inform others about - // the energy of the beam. - theIncoming = incoming; - lumiFn(new_ptr(LuminosityFunction(MaxEA, MaxEB))); - -} - -void FxFxEventHandler::doinitrun() { - EventHandler::doinitrun(); - stats.reset(); - histStats.reset(); - - for ( int i = 0, N = readers().size(); i < N; ++i ) { - readers()[i]->init(); - FxFxReader & reader = *readers()[i]; - reader.initialize(*this); - weightnames = reader.optWeightsNamesFunc(); - } - - // XSecStat initxsecs; - XSecStat* initxsecs = new XSecStat[weightnames.size()]; - for(int ww = 0; ww < weightnames.size(); ww++){ - initxsecs[ww].reset(); - - // optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - // opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - CrossSection initxs = 0.*picobarn; - //optxs.insert(std::make_pair(weightnames[ww], initxs)); - optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); - optxs.insert(std::make_pair(weightnames[ww], initxs)); - } - ntries = 0; - -} - -EventPtr FxFxEventHandler::generateEvent() { - - LoopGuard - loopGuard(*this, maxLoop()); - - while ( true ) { - loopGuard(); - - currentReader(readers()[selector().select(UseRandom::current())]); - - skipEvents(); - currentReader()->reset(); - - double weight = currentReader()->getEvent(); - if ( weightOption() == unitweight && weight < 0.0 ) weight = 0.0; - - if ( weightOption() == unitweight || weightOption() == unitnegweight ) { - CrossSection newmax = selector().reweight(weight); - if ( newmax > CrossSection() ) - increaseMaxXSec(newmax); - } - - select(weight/currentReader()->preweight); - histStats.select(weight); - - if ( !weighted() ) { - if ( weightOption() == unitweight || weightOption() == unitnegweight ) { - if ( !rndbool(abs(weight)) ) continue; - weight = Math::sign(1.0, weight); - } - else if ( weight == 0.0 ) continue; - } else if ( weight == 0.0 ) continue; - - accept(); - - // Divide by the bias introduced by the preweights in the reader. - - - weight /= currentReader()->preweight; - - - // fact for weight normalization - double fact = theNormWeight ? double(selector().sum()/picobarn) : 1.; - - try { - - theLastXComb = currentReader()->getXComb(); - - currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), - generator()->currentEventNumber(), weight*fact))); - currentEvent()->optionalWeights() = currentReader()->optionalEventWeights(); - // normalize the optional weights - for(map::iterator it = currentEvent()->optionalWeights().begin(); - it!=currentEvent()->optionalWeights().end();++it) { - if(it->first!="ecom"&& it->second!=-999 && it->second!=-111 && it->second!=-222 && it->second!=-333) { it->second *= fact; } - } - - - //print optional weights here - // cout << "event weight = " << weight << " fact = " << fact << endl; - /*for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ - std::cout << it->first << " => " << it->second << '\n'; - } - cout << endl;*/ - - //print npLO and npNLO - // cout << currentReader()->optionalEventnpLO() << "\t" << currentReader()->optionalEventnpNLO() << endl; - - performCollision(); - - if ( !currentCollision() ) throw Veto(); - - return currentEvent(); - } - catch (Veto) { - reject(weight); - } - catch (Stop) { - } - catch (Exception &) { - reject(weight); - throw; - } - } -} - -void FxFxEventHandler::skipEvents() { - - if ( weightOption() == 2 || weightOption() == -2 ) return; //does it make sense to skip events if we are using varying weights? - - // Don't do this for readers which seem to generate events on the fly. - if ( currentReader()->active() || currentReader()->NEvents() <= 0 ) return; - - // Estimate the fration of the total events available from - // currentReader() which will be requested. - double frac = currentReader()->stats.maxXSec()/stats.maxXSec(); - if ( stats.accepted() > 0 ) - frac *= double(stats.attempts())/double(stats.accepted()); - else - frac *= double(stats.attempts() + 1); - double xscan = generator()->N()*frac/currentReader()->NEvents(); - - // Estimate the number of times we need to go through the events for - // the currentReader(), and how many events on average we need to - // skip for each attempted event to go through the file an integer - // number of times. - double nscan = ceil(xscan); - double meanskip = nscan/xscan - 1.0; - // Skip an average numer of steps with a Poissonian distribution. - currentReader()-> - skip(UseRandom::rndPoisson(meanskip)%currentReader()->NEvents()); -} - -void FxFxEventHandler::select(double weight) { - stats.select(weight); - currentReader()->select(weight); - vector w; - for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ - w.push_back(it->second); - } - int ii = 0; - for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ - (it->second).select(w[ii]); - ii++; - } - ii = 0; - for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ - (it->second).select(w[ii]); - ii++; - } - -} - -tCollPtr FxFxEventHandler::performCollision() { - lastExtractor()->select(lastXCombPtr()); - if ( CKKWHandler() ) CKKWHandler()->setXComb(lastXCombPtr()); - currentCollision(new_ptr(Collision(lastParticles(), currentEvent(), this))); - if ( currentEvent() ) currentEvent()->addCollision(currentCollision()); - currentStep(new_ptr(Step(currentCollision(), this))); - currentCollision()->addStep(currentStep()); - currentStep()->addSubProcess(currentReader()->getSubProcess()); - lastExtractor()->constructRemnants(lastXCombPtr()->partonBinInstances(), - subProcess(), currentStep()); - - if ( !currentReader()->cuts().passCuts(*currentCollision()) ) throw Veto(); - - initGroups(); - if ( ThePEG_DEBUG_ITEM(1) ) { - if ( currentEvent() ) - generator()->logfile() << *currentEvent(); - else - generator()->logfile() << *currentCollision(); - } - return continueCollision(); -} - -EventPtr FxFxEventHandler::continueEvent() { - try { - continueCollision(); - } - catch (Veto) { - const double fact = - theNormWeight ? - double(selector().sum()/picobarn) : 1.; - reject(currentEvent()->weight()/fact); - } - catch (Stop) { - } - catch (Exception &) { - const double fact = - theNormWeight ? - double(selector().sum()/picobarn) : 1.; - reject(currentEvent()->weight()/fact); - throw; - } - return currentEvent(); -} - -void FxFxEventHandler::dofinish() { - EventHandler::dofinish(); - if ( selector().compensating() ) generator()->log() - << "Warning: The run was ended while the FxFxEventHandler '" - << name() << "' was still trying to compensate for weights larger than 1. " - << "The cross section estimates may therefore be statistically " - << "inaccurate." << endl; -} - -void FxFxEventHandler::statistics(ostream & os) const { - if ( statLevel() == 0 ) return; - - string line = "=======================================" - "=======================================\n"; - - if ( stats.accepted() <= 0 ) { - os << line << "No events generated by event handler '" << name() << "'." - << endl; - return; - } - - os << line << "Statistics for Les Houches event handler \'" << name() << "\':\n" - << " " - << "generated number of Cross-section\n" - << " " - << " events attempts (nb)\n"; - - os << line << "Total:" << setw(42) << stats.accepted() << setw(13) - << stats.attempts() << setw(17) - << ouniterr(stats.xSec(), stats.xSecErr(), nanobarn) << endl - << line; - - if ( statLevel() == 1 ) return; - - if ( statLevel() == 2 ) { - - os << "Per Les Houches Reader breakdown:\n"; - - for ( int i = 0, N = readers().size(); i < N; ++i ) { - FxFxReader & reader = *readers()[i]; - string n = reader.name(); - n.resize(37, ' '); - os << n << setw(11) << reader.stats.accepted() << setw(13) - << reader.stats.attempts() << setw(17) - << ouniterr(reader.stats.xSec(), reader.stats.xSecErr(), nanobarn) - << endl; - } - os << line; - } else { - - os << "Per Les Houches Reader (and process #) breakdown:\n"; - - for ( int i = 0, N = readers().size(); i < N; ++i ) { - FxFxReader & reader = *readers()[i]; - string n = reader.name() + " (all)"; - n.resize(37, ' '); - os << n << setw(11) << reader.stats.accepted() << setw(13) - << reader.stats.attempts() << setw(17) - << ouniterr(reader.stats.xSec(), reader.stats.xSecErr(), nanobarn) - << endl; - CrossSection xsectot = reader.stats.xSec(); - if ( xsectot != ZERO ) xsectot /= reader.stats.sumWeights(); - typedef FxFxReader::StatMap::const_iterator const_iterator; - for ( const_iterator i = reader.statmap.begin(); - i != reader.statmap.end(); ++i ) { - ostringstream ss; - ss << reader.name() << " (" << i->first << ")"; - string n = ss.str(); - n.resize(37, ' '); - os << n << setw(11) << i->second.accepted() << setw(13) - << i->second.attempts() << setw(17) - << ouniterr(i->second.sumWeights()*xsectot, - sqrt(i->second.sumWeights2())*xsectot, nanobarn) << endl; - } - os << line; - } - } - - string warn = "Warning: Result may be statistically incorrect since\n" - " the following FxFxReaders were oversampled:\n"; - for ( int i = 0, N = readers().size(); i < N; ++i ) { - FxFxReader & reader = *readers()[i]; - if ( reader.NEvents() > 0 && reader.stats.attempts() > reader.NEvents() ) { - os << warn; - warn = ""; - os << "'" << reader.name() << "' (by a factor " - << double(reader.stats.attempts())/double(reader.NEvents()) - << ")" << endl; - } - } -} - - -void FxFxEventHandler::increaseMaxXSec(CrossSection maxxsec) { - stats.maxXSec(selector().sum()); - histStats.maxXSec(selector().sum()); - currentReader()->increaseMaxXSec(maxxsec); -} - -void FxFxEventHandler::accept() { - ntries++; - stats.accept(); - histStats.accept(); - currentReader()->accept(); - for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ - (it->second).accept(); - } - for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ - (it->second).accept(); - } -} - -void FxFxEventHandler::reject(double w) { - ntries++; - stats.reject(w); - histStats.reject(w); - currentReader()->reject(w); - vector wv; - for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ - wv.push_back(it->second); - } - int ii = 0; - for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ - (it->second).reject(wv[ii]); - ii++; - } - ii = 0; - for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ - (it->second).reject(wv[ii]); - ii++; - } -} - - - -map FxFxEventHandler::optintegratedXSecMap() const { - map result; - for (map::const_iterator it= optstats.begin(); it!=optstats.end(); ++it){ - result[it->first] = (it->second.sumWeights()/it->second.attempts()) * picobarn; - } - - return result; -} - - -CrossSection FxFxEventHandler::histogramScale() const { - return histStats.xSec()/histStats.sumWeights(); -} - -CrossSection FxFxEventHandler::integratedXSec() const { - return histStats.xSec(); -} - -CrossSection FxFxEventHandler::integratedXSecErr() const { - return histStats.xSecErr(); -} - -int FxFxEventHandler::ntriesinternal() const { - return stats.attempts(); -} - -void FxFxEventHandler::persistentOutput(PersistentOStream & os) const { - os << stats << histStats << theReaders << theSelector - << oenum(theWeightOption) << theUnitTolerance << theCurrentReader << warnPNum - << theNormWeight; - -} - -void FxFxEventHandler::persistentInput(PersistentIStream & is, int) { - is >> stats >> histStats >> theReaders >> theSelector - >> ienum(theWeightOption) >> theUnitTolerance >> theCurrentReader >> warnPNum - >> theNormWeight; -} - -ClassDescription -FxFxEventHandler::initFxFxEventHandler; -// Definition of the static class description member. - -void FxFxEventHandler::setUnitTolerance(double x) { - theUnitTolerance = x; - selector().tolerance(unitTolerance()); -} - -void FxFxEventHandler::Init() { - - static ClassDocumentation documentation - ("This is the main class administrating the selection of hard " - "subprocesses from a set of ThePEG::FxFxReader objects."); - - - static RefVector - interfaceFxFxReaders - ("FxFxReaders", - "Objects capable of reading events from an event file or an " - "external matrix element generator.", - &FxFxEventHandler::theReaders, -1, false, false, true, false, false); - - static Switch interfaceWeightOption - ("WeightOption", - "The different ways to weight events in the Les Houches event handler. " - "Whether weighted or not and whether or not negative weights are allowed.", - &FxFxEventHandler::theWeightOption, unitweight, true, false); - static SwitchOption interfaceWeightOptionUnitWeight - (interfaceWeightOption, - "UnitWeight", - "All events have unit weight.", - unitweight); - static SwitchOption interfaceWeightOptionNegUnitWeight - (interfaceWeightOption, - "NegUnitWeight", - "All events have weight +1 or maybe -1.", - unitnegweight); - static SwitchOption interfaceWeightOptionVarWeight - (interfaceWeightOption, - "VarWeight", - "Events may have varying but positive weights.", - varweight); - static SwitchOption interfaceWeightOptionVarNegWeight - (interfaceWeightOption, - "VarNegWeight", - "Events may have varying weights, both positive and negative.", - varnegweight); - - static Switch interfaceWarnPNum - ("WarnPNum", - "Warn if the same process number is used in more than one " - "FxFxReader.", - &FxFxEventHandler::warnPNum, true, true, false); - static SwitchOption interfaceWarnPNumWarning - (interfaceWarnPNum, - "Warning", - "Give a warning message.", - true); - static SwitchOption interfaceWarnPNumNoWarning - (interfaceWarnPNum, - "NoWarning", - "Don't give a warning message.", - false); - - static Parameter interfaceUnitTolerance - ("UnitTolerance", - "If the WeightOption is set to unit weight, do not start compensating unless the a weight is found to be this much larger than unity.", - &FxFxEventHandler::theUnitTolerance, 1.0e-6, 0.0, 0, - true, false, Interface::lowerlim, - &FxFxEventHandler::setUnitTolerance, - (double(FxFxEventHandler::*)()const)(0), - (double(FxFxEventHandler::*)()const)(0), - (double(FxFxEventHandler::*)()const)(0), - (double(FxFxEventHandler::*)()const)(0)); - - static Switch interfaceWeightNormalization - ("WeightNormalization", - "How to normalize the output weights", - &FxFxEventHandler::theNormWeight, 0, false, false); - static SwitchOption interfaceWeightNormalizationUnit - (interfaceWeightNormalization, - "Normalized", - "Standard normalization, i.e. +/- for unweighted events", - 0); - static SwitchOption interfaceWeightNormalizationCrossSection - (interfaceWeightNormalization, - "CrossSection", - "Normalize the weights to the max cross section in pb", - 1); - - - interfaceFxFxReaders.rank(10); - interfaceWeightOption.rank(9); - -} - diff --git a/Contrib/FxFx/FxFxEventHandler.h b/Contrib/FxFx/FxFxEventHandler.h deleted file mode 100644 --- a/Contrib/FxFx/FxFxEventHandler.h +++ /dev/null @@ -1,448 +0,0 @@ -// -*- C++ -*- -// -// FxFxEventHandler.h is a part of ThePEG - Toolkit for HEP Event Generation -// Copyright (C) 1999-2011 Leif Lonnblad -// -// ThePEG is licenced under version 3 of the GPL, see COPYING for details. -// Please respect the MCnet academic guidelines, see GUIDELINES for details. -// -#ifndef THEPEG_FxFxEventHandler_H -#define THEPEG_FxFxEventHandler_H -// -// This is the declaration of the FxFxEventHandler class. -// - -#include "ThePEG/Handlers/EventHandler.h" -#include "FxFxEventHandler.fh" -#include "FxFxReader.fh" -#include "FxFxAnalysis.h" -#include "ThePEG/Utilities/CompSelector.h" -#include "ThePEG/Utilities/XSecStat.h" - -namespace ThePEG { - -/** - * The FxFxEventHandler inherits from the general EventHandler - * class and administers the reading of events generated by external - * matrix element generator programs according to the Les Houches - * accord. - * - * The class has a list of FxFxReaders which - * typically are connected to files with event data produced by - * external matrix element generator programs. When an event is - * requested by FxFxEventHandler, one of the readers are chosen, - * an event is read in and then passed to the different - * StepHandler defined in the underlying - * EventHandler class. - * - * @see \ref FxFxEventHandlerInterfaces "The interfaces" - * defined for FxFxEventHandler. - */ -class FxFxEventHandler: public EventHandler { - -public: - - /** - * A vector of FxFxReader objects. - */ - typedef vector ReaderVector; - - /** - * A selector of readers. - */ - typedef CompSelector ReaderSelector; - - /** - * Enumerate the weighting options. - */ - enum WeightOpt { - unitweight = 1, /**< All events have unit weight. */ - unitnegweight = -1, /**< All events have wight +/- 1. */ - varweight = 2, /**< Varying positive weights. */ - varnegweight = -2 /**< Varying positive or negative weights. */ - }; - - friend class FxFxHandler; - - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * The default constructor. - */ - FxFxEventHandler() - : theWeightOption(unitweight), theUnitTolerance(1.0e-6), warnPNum(true), theNormWeight(0) - { - selector().tolerance(unitTolerance()); - } - - /** - * The destructor. - */ - virtual ~FxFxEventHandler(); - //@} - -public: - - /** @name Initialization and finalization functions. */ - //@{ - /** - * Initialize this event handler and all related objects needed to - * generate events. - */ - virtual void initialize(); - - /** - * Write out accumulated statistics about intergrated cross sections - * and stuff. - */ - virtual void statistics(ostream &) const; - - /** - * Histogram scale. A histogram bin which has been filled with the - * weights associated with the Event objects should be scaled by - * this factor to give the correct cross section. - */ - virtual CrossSection histogramScale() const; - - /** - * The estimated total integrated cross section of the processes - * generated in this run. - * @return 0 if no integrated cross section could be estimated. - */ - virtual CrossSection integratedXSec() const; - - virtual int ntriesinternal() const; - - /** - * The estimated error in the total integrated cross section of the - * processes generated in this run. - * @return 0 if no integrated cross section error could be estimated. - */ - virtual CrossSection integratedXSecErr() const; - - virtual map optintegratedXSecMap() const; - - //@} - - /** @name Functions used for the actual generation */ - //@{ - /** - * Generate an event. - */ - virtual EventPtr generateEvent(); - - /** - * Create the Event and Collision objects. Used by the - * generateEvent() function. - */ - virtual tCollPtr performCollision(); - - /** - * Continue generating an event if the generation has been stopped - * before finishing. - */ - virtual EventPtr continueEvent(); - //@} - - /** @name Functions to manipulate statistics. */ - //@{ - /** - * An event has been selected. Signal that an event has been - * selected with the given \a weight. If unit weights are requested, - * the event will be accepted with that weight. This also takes care - * of the statistics collection of the selected reader object. - */ - void select(double weight); - - /** - * Accept the current event, taking care of the statistics - * collection of the corresponding reader objects. - */ - void accept(); - - /** - * Reject the current event, taking care of the statistics - * collection of the corresponding reader objects. - */ - void reject(double weight); - - /** - * Increase the overestimated cross section for the selected reader. - */ - void increaseMaxXSec(CrossSection maxxsec); - - /** - * Skip some events. To ensure a reader file is scanned an even - * number of times, skip a number of events for the selected reader. - */ - void skipEvents(); - - //@} - - /** @name Simple access functions. */ - //@{ - /** - * The way weights are to be treated. - */ - WeightOpt weightOption() const { return theWeightOption; } - - /** - * If the weight option is set to unit weight, do not start - * compensating unless the weight is this much larger than unity. - */ - double unitTolerance() const { return theUnitTolerance; } - - /** - * Access the list of readers. - */ - const ReaderVector & readers() const { return theReaders; } - - /** - * The selector to choose readers according to their overestimated - * cross section. - */ - const ReaderSelector & selector() const { return theSelector; } - - /** - * The currently selected reader object. - */ - tFxFxReaderPtr currentReader() const { return theCurrentReader; } - - - /** - * Set the currently selected reader object. - */ - void currentReader(tFxFxReaderPtr x) { theCurrentReader = x; } - - //@} - -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(); - - /** - * The currently selected reader object. - */ - tFxFxReaderPtr theCurrentReader; - - - -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(); - - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -protected: - - /** - * Access the list of readers. - */ - ReaderVector & readers() { return theReaders; } - - /** - * The selector to choose readers according to their overestimated - * cross section. - */ - ReaderSelector & selector() { return theSelector; } - - /** - * Helper function for the interface; - */ - void setUnitTolerance(double); - - /** - * Collect statistics for this event handler. - */ - XSecStat stats; - - map optstats; - - map optxs; - - int ntries; - - map OptStatsFunc() { return optstats; } - - map OptXsFunc() { return optxs; } - - - /** - * Collect statistics for this event handler. To be used for - * histogram scaling. - */ - XSecStat histStats; - - map opthistStats; - - - /* - * The weight identifiers for the events - */ - - vector weightnames; - -private: - - /** - * The list of readers. - */ - ReaderVector theReaders; - - /** - * The selector to choose readers according to their overestimated - * cross section. - */ - ReaderSelector theSelector; - - /** - * The way weights are to be treated. - */ - WeightOpt theWeightOption; - - /** - * If the weight option is set to unit weight, do not start - * compensating unless the weight is this much larger than unity. - */ - double theUnitTolerance; - - - /** - * Warn if the same process number is used in more than one - * FxFxReader. - */ - bool warnPNum; - - /** - * How to normalize the weights - */ - unsigned int theNormWeight; - - -public: - - /** @cond EXCEPTIONCLASSES */ - /** - * Exception class used if no readers were assigned. - */ - class FxFxInitError: public InitException {}; - - /** - * Exception class used if the same process number is used by more - * than ne reader. - */ - class FxFxPNumException: public InitException {}; - /** @endcond */ - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription initFxFxEventHandler; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - FxFxEventHandler & operator=(const FxFxEventHandler &) = delete; - -}; - -} - -// CLASSDOC OFF - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of FxFxEventHandler. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of FxFxEventHandler. */ - typedef EventHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the FxFxEventHandler class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "Herwig::FxFxEventHandler"; } - /** Return the name of the shared library be loaded to get access to - * the FxFxEventHandler class and every other class it uses - * (except the base class). */ - static string library() { return "FxFx.so"; } -}; - -/** @endcond */ - -} - -#endif /* THEPEG_FxFxEventHandler_H */ diff --git a/Contrib/FxFx/FxFxFileReader.h b/Contrib/FxFx/FxFxFileReader.h deleted file mode 100644 --- a/Contrib/FxFx/FxFxFileReader.h +++ /dev/null @@ -1,333 +0,0 @@ -// -*- C++ -*- -// -// FxFxFileReader.h is a part of ThePEG - Toolkit for HEP Event Generation -// Copyright (C) 1999-2011 Leif Lonnblad -// -// ThePEG is licenced under version 3 of the GPL, see COPYING for details. -// Please respect the MCnet academic guidelines, see GUIDELINES for details. -// -#ifndef THEPEG_FxFxFileReader_H -#define THEPEG_FxFxFileReader_H -// This is the declaration of the FxFxFileReader class. - -#include "FxFxReader.h" -#include "FxFxFileReader.fh" -#include "ThePEG/PDT/Decayer.h" -#include "ThePEG/Utilities/CFileLineReader.h" -#include - -namespace ThePEG { - - -/** - * FxFxFileReader is an base class to be used for objects which - * reads event files from matrix element generators. It inherits from - * FxFxReader and extends it by defining a file handle to be - * read from, which is opened and closed by the open() and close() - * functions. Note that the file handle is a standard C filehandle and - * not a C++ stream. This is because there is no standard way in C++ - * to connect a pipe to a stream for reading eg. gzipped files. This - * class is able to read plain event files conforming to the Les - * Houches Event File accord. - * - * @see \ref FxFxFileReaderInterfaces "The interfaces" - * defined for FxFxFileReader. - * @see Event - * @see FxFxReader - */ -class FxFxFileReader: public FxFxReader { - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * Default constructor. - */ - FxFxFileReader() : neve(0), ieve(0), theQNumbers(false), theIncludeFxFxTags(true), - theIncludeCentral(false) {} - - /** - * Copy-constructor. Note that a file which is opened in the object - * copied from will have to be reopened in this. - */ - FxFxFileReader(const FxFxFileReader &); - - /** - * Destructor. - */ - virtual ~FxFxFileReader(); - //@} - -public: - - /** @name Virtual functions specified by the FxFxReader base class. */ - //@{ - /** - * Initialize. This function is called by the FxFxEventHandler - * to which this object is assigned. - */ - virtual void initialize(FxFxEventHandler & eh); - - /** - * Open a file with events. Derived classes should overwrite it and - * first calling it before reading in the run information into the - * corresponding protected variables. - */ - virtual void open(); - - /** - * Close the file from which events have been read. - */ - virtual void close(); - - - /** - * Read the next event from the file or stream into the - * corresponding protected variables. Return false if there is no - * more events or if this was not a LHF event file. - */ - virtual bool doReadEvent(); - //@} - - /** - * Return the name of the file from where to read events. - */ - string filename() const { return theFileName; } - - /* vector optionalWeightsNames; - - virtual vector optWeightNamesFunc();*/ - - - virtual vector optWeightsNamesFunc(); - - - /** - * Erases all occurences of a substring from a string - */ - - void erase_substr(std::string& subject, const std::string& search); - - -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; - //@} - - /** @name Standard (and non-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(); - - /** - * Return true if this object needs to be initialized before all - * other objects because it needs to extract PDFs from the event file. - */ - virtual bool preInitialize() const; - //@ - -protected: - - /** - * The wrapper around the C FILE stream from which to read - */ - CFileLineReader cfile; - -protected: - - /** - * The number of events in this file. - */ - long neve; - - /** - * The current event number. - */ - long ieve; - - /** - * If the file is a standard Les Houches formatted file (LHF) this - * is its version number. If empty, this is not a Les Houches - * formatted file - */ - string LHFVersion; - - /** - * If LHF. All lines (since the last open() or readEvent()) outside - * the header, init and event tags. - */ - string outsideBlock; - - /** - * If LHF. All lines from the header block. - */ - string headerBlock; - - /** - * If LHF. Additional comments found in the init block. - */ - string initComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the init - * tag. - */ - map initAttributes; - - /** - * If LHF. Additional comments found with the last read event. - */ - string eventComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the last - * event tag. - */ - map eventAttributes; - -private: - - /** - * The name of the file from where to read events. - */ - string theFileName; - - /** - * Whether or not to search for QNUMBERS stuff - */ - bool theQNumbers; - - /** - * Include/Read FxFx tags - */ - bool theIncludeFxFxTags; - - /** - * Include central weight (for backup use) - */ - bool theIncludeCentral; - - /** - * Decayer for any decay modes read from the file - */ - DecayerPtr theDecayer; - - /** - * Further information on the weights - */ - map scalemap; - - /** - * Temporary holder for optional weights - */ - - map optionalWeightsTemp; - - -private: - - /** - * Describe an abstract base class with persistent data. - */ - static ClassDescription initFxFxFileReader; - - /** - * Private and non-existent assignment operator. - */ - FxFxFileReader & operator=(const FxFxFileReader &) = delete; - -public: - - /** @cond EXCEPTIONCLASSES */ - /** Exception class used by FxFxFileReader if reading the file - * fails. */ - class FxFxFileError: public Exception {}; - /** @endcond */ - -}; - -} - - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** - * This template specialization informs ThePEG about the - * base class of FxFxFileReader. - */ -template <> -struct BaseClassTrait: public ClassTraitsType { - /** Typedef of the base class of FxFxFileReader. */ - typedef FxFxReader NthBase; -}; - -/** - * This template specialization informs ThePEG about the name of the - * FxFxFileReader class and the shared object where it is - * defined. - */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** - * Return the class name. - */ - static string className() { return "Herwig::FxFxFileReader"; } - /** - * Return the name of the shared library to be loaded to get access - * to the FxFxFileReader class and every other class it uses - * (except the base class). - */ - static string library() { return "FxFx.so"; } - -}; - -/** @endcond */ - -} - -#endif /* THEPEG_FxFxFileReader_H */ diff --git a/Contrib/FxFx/FxFxHandler.cc b/Contrib/FxFx/FxFxHandler.cc deleted file mode 100644 --- a/Contrib/FxFx/FxFxHandler.cc +++ /dev/null @@ -1,1656 +0,0 @@ -#include "FxFxHandler.h" -#include "FxFxReader.h" -#include "FxFxReader.fh" -#include "FxFxEventHandler.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Repository/UseRandom.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "Herwig/Shower/QTilde/Base/PartnerFinder.h" -#include "Herwig/PDF/HwRemDecayer.h" -#include -#include "ThePEG/Utilities/Throw.h" -#include "Herwig/Shower/QTilde/Kinematics/KinematicsReconstructor.h" -#include "fastjet/PseudoJet.hh" -#include "fastjet/ClusterSequence.hh" -#include "gsl/gsl_rng.h" -#include "gsl/gsl_randist.h" -#include - - -using namespace Herwig; -using namespace ThePEG; - -bool recordEntry(PPtr i,PPtr j) { - return (i->number()number()); -} -bool pTsortFunction(PPtr i,PPtr j) { - return (i->momentum().perp2()>j->momentum().perp2()); -} -bool ETsortFunction(pair i,pair j) { - return (i.first>j.first); -} -bool isMomLessThanEpsilon(Lorentz5Momentum p,Energy epsilon) { - return (abs(p.x())> alphaS_ - >> ncy_ >> ncphi_ >> ihvy_ >> nph_ >> nh_ - >> iunit(etclusmean_,GeV) >> rclus_ >> etaclmax_ >> rclusfactor_ - >> ihrd_ >> njets_ >> drjmin_ >> highestMultiplicity_ - >> ycmax_ >> ycmin_ >> jetAlgorithm_ >> vetoIsTurnedOff_ >> vetoSoftThanMatched_ >> etclusfixed_ - >> cphcal_ >> sphcal_ >> cthcal_ >> sthcal_ >> iunit(epsetclus_,GeV) >> vetoHeavyQ_ >> mergemode_ >> hpdetect_ >> vetoHeavyFlavour_; -} - -ClassDescription FxFxHandler::initFxFxHandler; -// Definition of the static class description member. - -void FxFxHandler::Init() { - - static ClassDocumentation documentation - ("The FxFxHandler class performs MEPS merging " - "using the MLM procedure."); - - static Reference interfaceShowerAlpha - ("ShowerAlpha", - "The object calculating the strong coupling constant", - &FxFxHandler::alphaS_, false, false, true, false, false); - - static Parameter interfaceihvy - ("ihvy", - "heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t)", - &FxFxHandler::ihvy_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfacenph - ("nph", - "Number of photons in the AlpGen process", - &FxFxHandler::nph_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfacenh - ("nh", - "Number of higgses in the AlpGen process", - &FxFxHandler::nph_, -999, -999, 7, - false, false, Interface::limited); - - static Parameter interfaceETClus - ("ETClus", - "The ET threshold defining a jet in the merging procedure", - &FxFxHandler::etclusmean_, GeV, 20*GeV, 0*GeV, 14000*GeV, - false, false, Interface::limited); - - static Parameter interfaceRClus - ("RClus", - "The cone size used to define a jet in the merging procedure", - &FxFxHandler::rclus_, 0.4, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfaceEtaClusMax - ("EtaClusMax", - "The maximum |eta| used to define a jet in the merging procedure", - &FxFxHandler::etaclmax_, 5.0, 0.0, 15.0, - false, false, Interface::limited); - - static Parameter interfaceRClusFactor - ("RClusFactor", - "The prefactor for RClus used to define the jet-parton matching " - "distance", - &FxFxHandler::rclusfactor_, 1.5, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfaceihrd - ("ihrd", - "The hard process code", - &FxFxHandler::ihrd_, -999, 0, 10000, - false, false, Interface::limited); - - static Parameter interfacenjetsmax - ("njetsmax", - "The number of light jets in the maximum-multiplicity process", - &FxFxHandler::njets_, -999, 0, 10000, - false, false, Interface::limited); - - static Parameter interfacedrjmin - ("drjmin", - "Mimimum parton-parton R-sep used for generation.", - &FxFxHandler::drjmin_, 0.7, 0.0, 4.0, - false, false, Interface::limited); - - static Parameter interfacehighestMultiplicity - ("highestMultiplicity", - "If true it indicates that this is the highest multiplicity input " - "ME-level configuration to be processed.", - &FxFxHandler::highestMultiplicity_, 0, 0, 1, - false, false, Interface::limited); - - static Parameter interfaceETClusFixed - ("ETClusFixed", - "If false, indicates that the jet merging scale, etclus_ is allowed to vary" - "according to epsetclus_", - &FxFxHandler::etclusfixed_, 1, 0, 1, - false, false, Interface::limited); - - static Parameter interfaceEpsilonETClus - ("EpsilonETClus", - "The ET threshold defining a jet in the merging procedure", - &FxFxHandler::epsetclus_, GeV, 2.5*GeV, 0*GeV, 100.0*GeV, - false, false, Interface::limited); - - static Switch interfaceJetAlgorithm - ("JetAlgorithm", - "Determines the jet algorithm for finding jets in parton-jet " - "matching in the MLM procedure.", - &FxFxHandler::jetAlgorithm_, 1, false, false); - static SwitchOption AntiKt - (interfaceJetAlgorithm, - "AntiKt", - "The anti-kt jet algorithm.", - -1); - static SwitchOption CambridgeAachen - (interfaceJetAlgorithm, - "CambridgeAachen", - "The Cambridge-Aachen jet algorithm.", - 0); - static SwitchOption Kt - (interfaceJetAlgorithm, - "Kt", - "The Kt jet algorithm.", - 1); - - static Switch interfaceMergeMode - ("MergeMode", - "The choice of merging mode", - &FxFxHandler::mergemode_, 0, false, false); - static SwitchOption FxFx - (interfaceMergeMode, - "FxFx", - "FxFx merging.", - 0); - static SwitchOption Tree - (interfaceMergeMode, - "Tree", - "Tree-level merging.", - 1); - static SwitchOption TreeMG - (interfaceMergeMode, - "TreeMG5", - "Tree-level merging using the MadGraph pt clustering information.", - 2); - - - static Switch interfaceHardProcessDetection - ("HardProcessDetection", - "The choice of merging mode", - &FxFxHandler::hpdetect_, true, false, false); - static SwitchOption Automatic - (interfaceHardProcessDetection, - "Automatic", - "Automatically determine which particles to include in the merging.", - true); - static SwitchOption Manual - (interfaceHardProcessDetection, - "Manual", - "Use the ihrd code to determine which particles to include in the merging.", - false); - - static Switch interfaceVetoIsTurnedOff - ("VetoIsTurnedOff", - "Allows the vetoing mechanism to be switched off.", - &FxFxHandler::vetoIsTurnedOff_, false, false, false); - static SwitchOption VetoingIsOn - (interfaceVetoIsTurnedOff, - "VetoingIsOn", - "The MLM merging veto mechanism is switched ON.", - false); - static SwitchOption VetoingIsOff - (interfaceVetoIsTurnedOff, - "VetoingIsOff", - "The MLM merging veto mechanism is switched OFF.", - true); - - - static Switch interfaceVetoHeavyFlavour - ("VetoHeavyFlavour", - "Allows the heavy flavour vetoing mechanism to be switched off.", - &FxFxHandler::vetoHeavyFlavour_, false, false, false); - static SwitchOption HeavyFVetoingIsOn - (interfaceVetoHeavyFlavour, - "Yes", - "The MLM merging veto mechanism for heavy flavour is switched ON.", - true); - static SwitchOption HeavyFVetoingIsOff - (interfaceVetoHeavyFlavour, - "No", - "The MLM merging veto mechanism for heavy flavour is switched OFF.", - false); - - static Switch interfaceHeavyQVeto - ("HeavyQVeto", - "Allows the vetoing mechanism on the heavy quark products to be switched off.", - &FxFxHandler::vetoHeavyQ_, false, false, false); - static SwitchOption HQVetoingIsOn - (interfaceHeavyQVeto, - "Yes", - "The MLM merging veto on Heavy quark decay produts mechanism is switched ON.", - true); - static SwitchOption HQVetoingIsOff - (interfaceHeavyQVeto, - "No", - "The MLM merging veto on Heavy quark decay products mechanism is switched OFF.", - false); - - static Switch interfaceVetoSoftThanMatched - ("VetoSoftThanMatched", - "Allows the vetoing mechanism to be switched off.", - &FxFxHandler::vetoSoftThanMatched_, false, false, false); - static SwitchOption VetoSoftIsOn - (interfaceVetoSoftThanMatched, - "VetoSoftIsOn", - "The vetoing of highest-mult. events with jets softer than matched ones is ON", - true); - static SwitchOption VetoSoftIsOff - (interfaceVetoSoftThanMatched, - "VetoSoftIsOff", - "The vetoing of highest-mult. events with jets softer than matched ones is OFF.", - false); - - -} - -void FxFxHandler::dofinish() { - QTildeShowerHandler::dofinish(); -} - -void FxFxHandler::doinit() { - - //print error if HardProcID is not set in input file - if(ihrd_ == -999 && !hpdetect_) { cout << "Error: FxFxHandler:ihrd not set and FxFx:HardProcessDetection set to Manual!" << endl; exit(1); } - QTildeShowerHandler::doinit(); - - // Compute calorimeter edges in rapidity for GetJet algorithm. - ycmax_=etaclmax_+rclus_; - ycmin_=-ycmax_; -} - -// Throws a veto according to MLM strategy ... when we finish writing it. -bool FxFxHandler::showerHardProcessVeto() const { - int debug_mode = 0; - if(vetoIsTurnedOff_) { - // cout << "Vetoing is turned OFF." << endl; - return false; - } - - //if(debug_mode) { cout << "debug_mode = " << 5 << endl; } - - // Skip veto for processes in which merging is not implemented: - if(ihrd_==7||ihrd_==8||ihrd_==13) { - ostringstream wstring; - wstring << "FxFxHandler::showerHardProcessVeto() - warning." - << "MLM merging not implemented " - << "processes 4Q (ihrd=7), QQh (ihrd=8), " - << "(single) top (ihrd=13) \n"; - generator()->logWarning( Exception(wstring.str(), - Exception::warning) ); - return false; - } - - // Fill preshowerISPs_ pair and preshowerFSPs_ particle pointer vector. - getPreshowerParticles(); - - // Fill showeredISHs_, showeredISPs and showeredRems pairs, as well as - // showeredFSPs_ particle pointer vector. - getShoweredParticles(); - - // Turn on some screen output debugging: 0 = none ---> 5 = very verbose. - doSanityChecks(debug_mode); - - - // Dimensions of each calorimter cell in y and phi. - dely_ = (ycmax_-ycmin_)/double(ncy_); - delphi_ = 2*M_PI/double(ncphi_); - - // Fill partonsToMatch_ with only those pre-shower partons intended to - // used in jet-parton matching and fill particlesToCluster_ using only - // those final state particles (post-shower) which are supposed to go - // in the jet clustering used to do merging. - partonsToMatch_ = preshowerFSPs_; - particlesToCluster_ = showeredFSPs_ ; - - // Filter out all but the 'extra' light-parton progenitors and their - // associated final state particles. - if(mergemode_ == 0 || mergemode_ == 1) { caldel_m(); } - else if(mergemode_ == 2) { caldel_mg(); } - - double prob(1); - //if etclusfixed_ then set the etclus_ to the fixed chosen value - if(etclusfixed_) { - etclus_ = etclusmean_; - } else { - //else, if we wish to vary etclus_, we use the probability distribution - //choose a probability between 0 and 1 - prob = rnd(); - etclus_ = etclusran_(prob); - } - - // Cluster particlesToCluster_ into jets with FastJet. - getFastJets(rclus_,etclus_,etaclmax_); - - if(mergemode_ == 0) { - - // Get npLO_ and npNLO_ for FxFx matching - getnpFxFx(); - - // print the npXLO_ values obtained - // cout << "HANDLER:\t\t\t\t" << npLO_ << "\t\t" << npNLO_ << endl; - - //FxFx modifications start here. - - // Sort partonsToMatch_ from high to low pT. - sort(partonsToMatch_.begin(),partonsToMatch_.end(),pTsortFunction); - - // Count the number of jets. - int njets_found(pjet_.size()); - - // If the number of jets found is not equal to the number of partons in the Born - // (i.e., the number of partons in the S-event, or one less than the number of partons in an H-event), - // the jets cannot be matched and the event has to be rejected. The number of partons in the Born is written in the event file with a name “npNLO” - // if there are no jets to match and no jets have been found, do not veto. - if(njets_found == 0 && npNLO_ == 0) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", accepting" << endl;*/ return false; } - - //if the number of jets is smaller than npNLO -> reject the event. - if(njets_found < npNLO_) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", rejecting" << endl;*/ return true; } - // For the maximum-multiplicity sample, the number of jets obtained does not have to be exactly equal to npNLO, it may also be larger; - if(njets_found > npNLO_ && npNLO_ != njets_) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", rejecting" << endl;*/ return true; } - - // Create the matrix-element jets. - // Cluster also the partons at the hard-matrix element level into jets with the same algorithm as above, - // but without the requirement of a minimal pT on the jets (or set it very small). - // By construction, for S-events you should find exactly npNLO jets, while for the H-events it is either npNLO or npNLO+1. - // Cluster partonsToMatch_ into jets with FastJet. - getFastJetsToMatch(rclus_,0*GeV,etaclmax_); - - int me_njets_found(pjetME_.size()); - - // cout << "number of ME jets found = " << me_njets_found << "partons to match: " << partonsToMatch_.size() << endl; - - // Match light progenitors to jets. - vector jetToPartonMap(pjetME_.size(),-999); - Energy etmin(777e100*GeV); - - // Match the jets. - // Try to match the “npNLO” hardest jets created post-shower with any of the jets pre-shower. Two jets are matched if the distance between them is smaller than 1.5*DeltaR. - // If not all the npNLO hardest shower jets are matched the event has to be rejected. - // Note that if the current event does not belong to the maximum multiplicity sample, this means that all the shower jets need to be matched, because the requirement above already rejects - // events that do not have npNLO shower jets. - // For those events, at the level of the matrix elements there can either be npNLO or npNLO+1 matrix-element jets, depending on S- or H-events and the kinematics of those partons. - // Still only the shower jets need to be matched, so an event should not be rejected if a matrix-element jet cannot be matched. - // For each parton, starting with the hardest one ... - for(unsigned int ixx=0; ixx=0) { - jetToPartonMap[jetIndexForDRmin]=ixx; - if(ixx==0||etjet_[jetIndexForDRmin]id())==4||abs(partonsToMatch_[jxx]->id())==5)) continue; - if(partonJetDeltaR(partonsToMatch_[jxx],pjet_[ixx])id())==4||abs(partonsToMatch_[jxx]->id())==5)) continue; - if(partonJetDeltaR(partonsToMatch_[jxx],pjet_[ixx])etmin) return true; - } - } - } - - } - - - // Otherwise we accept the event ... - return false; - -} - -/* Function that returns the R distance - between a particle and a jet. */ -double FxFxHandler::partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom) const { - LorentzMomentum partonmom(partonptr->momentum()); - // Calculate DY, DPhi and then DR - double DY(partonmom.eta()-jetmom.eta()); - double DPhi(partonmom.phi()-jetmom.phi()); - if(DPhi>M_PI) DPhi=2*M_PI-DPhi; - double DR(sqrt(sqr(DY)+sqr(DPhi))); - return DR; -} - -double FxFxHandler::partonJetDeltaR(LorentzMomentum jetmom1, LorentzMomentum jetmom2) const { - // Calculate DY, DPhi and then DR - double DY(jetmom1.eta()-jetmom2.eta()); - double DPhi(jetmom1.phi()-jetmom2.phi()); - if(DPhi>M_PI) DPhi=2*M_PI-DPhi; - double DR(sqrt(sqr(DY)+sqr(DPhi))); - return DR; -} - -// Get FastJets -void FxFxHandler::getFastJets(double rjet, Energy ejcut, double etajcut) const { - - vector particlesToCluster; - for(unsigned int ipar=0; iparmomentum().eta()); - if(y>=ycmin_&&y<=ycmax_) { - int absId(abs(particlesToCluster_[ipar]->id())); - // If it's not a lepton / top / photon it may go in the jet finder. - if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { - // input particles into fastjet pseudojet - fastjet::PseudoJet p(particlesToCluster_[ipar]->momentum().x()/GeV, - particlesToCluster_[ipar]->momentum().y()/GeV, - particlesToCluster_[ipar]->momentum().z()/GeV, - particlesToCluster_[ipar]->momentum().e()/GeV); - p.set_user_index(ipar); - particlesToCluster.push_back(p); - } - } - } - - fastjet::RecombinationScheme recombinationScheme = fastjet::E_scheme; - fastjet::Strategy strategy = fastjet::Best; - double R(rjet); - fastjet::JetDefinition theJetDefinition; - switch (jetAlgorithm_) { - case -1: theJetDefinition=fastjet::JetDefinition(fastjet::antikt_algorithm, - R, - recombinationScheme, - strategy); break; - case 0: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - case 1: theJetDefinition=fastjet::JetDefinition(fastjet::kt_algorithm, - R, - recombinationScheme, - strategy); break; - default: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - } - fastjet::ClusterSequence fastjetEvent(particlesToCluster,theJetDefinition); - vector inclusiveJets = fastjetEvent.inclusive_jets(); - inclusiveJets = fastjet::sorted_by_pt(inclusiveJets); - - // Fill the array of jet momenta for the rest of the veto procedure. - pjet_.clear(); - pjet_.resize(inclusiveJets.size()); - etjet_.clear(); - etjet_.resize(inclusiveJets.size()); - for(unsigned int ffj=0; ffjetajcut) { - pjet_.erase(pjet_.begin()+fj); - etjet_.erase(etjet_.begin()+fj); - fj--; - } - - // Sort jets from high to low ET. - vector > etjet_pjet; - for(unsigned int ixx=0; ixx particlesToCluster; - for(unsigned int ipar=0; iparmomentum().eta()); - if(y>=ycmin_&&y<=ycmax_) { - int absId(abs(partonsToMatch_[ipar]->id())); - // If it's not a lepton / top / photon it may go in the jet finder. - if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { - // input particles into fastjet pseudojet - fastjet::PseudoJet p(partonsToMatch_[ipar]->momentum().x()/GeV, - partonsToMatch_[ipar]->momentum().y()/GeV, - partonsToMatch_[ipar]->momentum().z()/GeV, - partonsToMatch_[ipar]->momentum().e()/GeV); - p.set_user_index(ipar); - particlesToCluster.push_back(p); - } - } - } - - fastjet::RecombinationScheme recombinationScheme = fastjet::E_scheme; - fastjet::Strategy strategy = fastjet::Best; - double R(rjet); - fastjet::JetDefinition theJetDefinition; - switch (jetAlgorithm_) { - case -1: theJetDefinition=fastjet::JetDefinition(fastjet::antikt_algorithm, - R, - recombinationScheme, - strategy); break; - case 0: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - case 1: theJetDefinition=fastjet::JetDefinition(fastjet::kt_algorithm, - R, - recombinationScheme, - strategy); break; - default: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, - R, - recombinationScheme, - strategy); break; - } - fastjet::ClusterSequence fastjetEvent(particlesToCluster,theJetDefinition); - vector inclusiveJets = fastjetEvent.inclusive_jets(); - inclusiveJets = fastjet::sorted_by_pt(inclusiveJets); - - // Fill the array of jet momenta for the rest of the veto procedure. - pjetME_.clear(); - pjetME_.resize(inclusiveJets.size()); - for(unsigned int ffj=0; ffjchildren()); - for (unsigned int ixx=0; ixxchildren().size()==0) - tmpList_.push_back(theChildren[ixx]); - else - getDescendents(theChildren[ixx]); - return; -} - -void FxFxHandler::caldel_m() const { - - preshowerFSPsToDelete_.clear(); - showeredFSPsToDelete_.clear(); - - hvqfound = false; - - if(hpdetect_ && mergemode_!=2) { - for(unsigned int ixx=0; ixxparents()[0]->id())==6) { - hvqfound = true; - // cout << "preshowerFSPs_[ixx]->id() = " << preshowerFSPs_[ixx]->id() << " " << preshowerFSPs_[ixx]->momentum().perp2() << endl; - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]->parents()[0]); - for(unsigned int jxx=0; jxxid() = " << tmpList_[jxx]->id() << " " << tmpList_[jxx]->momentum().perp2() << endl; - showeredFSPsToDelete_.push_back(tmpList_[jxx]); - } - continue; - } - - /* Exclude the v.bosons and any children they may - have produced from the jet parton matching. */ - if( (abs(preshowerFSPs_[ixx]->parents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24|| - abs(preshowerFSPs_[ixx]->id())==22|| - abs(preshowerFSPs_[ixx]->id())==25|| (abs(preshowerFSPs_[ixx]->id()) < 17 && abs(preshowerFSPs_[ixx]->id()) > 10)) && (abs(preshowerFSPs_[ixx]->parents()[0]->id())!=6)) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==5&&ixx<2) { - hvqfound = true; - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==ihvy_&&ixx<2) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==23|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24|| - abs(preshowerFSPs_[ixx]->id())==22|| - abs(preshowerFSPs_[ixx]->id())==25) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxparents()[0]->id())==6|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - // cout << "preshowerFSPs_[ixx]->id() = " << preshowerFSPs_[ixx]->id() << " " << preshowerFSPs_[ixx]->momentum().perp2() << endl; - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - } - if(abs(preshowerFSPs_[ixx]->parents()[0]->id())==6) { - getDescendents(preshowerFSPs_[ixx]->parents()[0]); - for(unsigned int jxx=0; jxxid() = " << tmpList_[jxx]->id() << " " << tmpList_[jxx]->momentum().perp2() << endl; - showeredFSPsToDelete_.push_back(tmpList_[jxx]); - } - } - if(ixx==preshowerFSPs_.size()-1&&preshowerFSPsToDelete_.size()!=6) { - throw Exception() - << "FxFxHandler::caldel_m() - ERROR!\n" - << "2Q process should have 6 particles to omit from" - << "jet-parton matching for ihvy=" << ihvy_ << "." << Exception::eventerror; - } - } else { - if(abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx<2) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==4&&ixx<1)|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==25) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+1)))|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+2)))|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==6|| - abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid())==22|| - (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx<2)) { - preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); - getDescendents(preshowerFSPs_[ixx]); - for(unsigned int jxx=0; jxxid() << " with parent " << preshowerFSPsToDelete_[ixx]->parents()[0]->id() << endl; // " energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; - partonsToMatch_.erase(partonsToMatch_.begin()+jxx); - break; - } - } - } - //cout << "partonsToMatch_.size() (AFTER) = " << partonsToMatch_.size() << endl; - //cout << "deleting showeredFSPs" << endl; - for(unsigned int ixx=0; ixxid() << " with parent " << showeredFSPsToDelete_[ixx]->parents()[0]->id() << endl; //" energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; - particlesToCluster_.erase(particlesToCluster_.begin()+jxx); - break; - } - } - } - - // Sanity check! - if(partonsToMatch_.size()>particlesToCluster_.size()) { - throw Exception() - << "FxFxHandler::caldel_m() - ERROR!\n" - << "No. of ME level partons to be matched to jets = " - << partonsToMatch_.size() << "\n" - << "No. of showered particles to build jets from = " - << particlesToCluster_.size() << "\n" - << "There should be at least as many partons to\n" - << "cluster as there are partons to match to.\n" - << Exception::eventerror; - } - // cout << "partonsToMatch_.size() (AFTER2) = " << partonsToMatch_.size() << endl; - - - // Acid test. - /* unsigned int tmpUnsignedInt(njets_); - if(!inputIsNLO_&&partonsToMatch_.size()!=tmpUnsignedInt) { - for(unsigned int ixx=0; ixxid())>=6&& - abs(partonsToMatch_[ixx]->id())!=21) - throw Exception() - << "FxFxHandler::caldel_m() - ERROR!\n" - << "Found a parton to match to which is not a quark or gluon!" - << *partonsToMatch_[ixx] << "\n" - << Exception::eventerror; - } - throw Exception() - << "FxFxHandler::caldel_m() - ERROR!\n" - << "No. of ME level partons to be matched to jets = " - << partonsToMatch_.size() << "\n" - << "No. of light jets (njets) in AlpGen process = " - << njets_ << "\n" - << "These should be equal." << "\n" - << Exception::eventerror; - } */ - //cout << "partonsToMatch_.size() (AFTER3) = " << partonsToMatch_.size() << endl; - - return; -} - -// This looks for all descendents of a top up to but not including -// the W and b children. -void FxFxHandler::getTopRadiation(PPtr theParticle) const { - ParticleVector theChildren(theParticle->children()); - for (unsigned int ixx=0; ixxchildren().size()==0) - tmpList_.push_back(theChildren[ixx]); - else if(abs(theChildren[ixx]->id())==5||abs(theChildren[ixx]->id())==24) - return; - else - getTopRadiation(theChildren[ixx]); - return; -} - -void FxFxHandler::caldel_mg() const { - - preshowerFSPsToDelete_.clear(); - showeredFSPsToDelete_.clear(); - /* - * Get the MadGraph clustering information - * from the Les Houches event tags - */ - ptclust_.clear(); - getptclust(); - - //for(unsigned int izz = 0; izzid() << endl; - partonsToMatch_.erase(partonsToMatch_.begin()+jxx); - break; - } - } - } - - for(unsigned int ixx=0; ixxid() << " with parent " << showeredFSPsToDelete_[ixx]->parents()[0]->id() << endl; //" energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; - particlesToCluster_.erase(particlesToCluster_.begin()+jxx); - break; - } - } - } - - // Sanity check! - if(partonsToMatch_.size()>particlesToCluster_.size()) { - throw Exception() - << "FxFxHandler::caldel_m() - ERROR!\n" - << "No. of ME level partons to be matched to jets = " - << partonsToMatch_.size() << "\n" - << "No. of showered particles to build jets from = " - << particlesToCluster_.size() << "\n" - << "There should be at least as many partons to\n" - << "cluster as there are partons to match to.\n" - << Exception::eventerror; - } - - - -} - - -void FxFxHandler::caldel_hvq() const { - - // Fill partonsToMatch_ with only those pre-shower partons intended to - // be used in heavy-quark-jet matching and fill particlesToCluster_ using - // only those final state particles (post-shower) which are supposed - // in the heavy-quark-jet clustering used to do merging. To begin with - // these are made from the corresponding sets of particles that were - // omitted from the initial jet-parton matching run. - partonsToMatch_ = preshowerFSPsToDelete_; - particlesToCluster_.resize(showeredFSPsToDelete_.size()); - for(unsigned int ixx=0; ixxid())<4||abs(partonsToMatch_[ixx]->id())>6) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxid())==5&& - partonsToMatch_[ixx]->parents().size()>0&& - abs(partonsToMatch_[ixx]->parents()[0]->id())==6) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxparents().size()>0&& - (abs(partonsToMatch_[ixx]->parents()[0]->id())==23|| - abs(partonsToMatch_[ixx]->parents()[0]->id())==24|| - abs(partonsToMatch_[ixx]->parents()[0]->id())==25)) { - preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); - tmpList_.clear(); - getDescendents(partonsToMatch_[ixx]); - for(unsigned int jxx=0; jxxsubProcess()->intermediates()); - for(unsigned int ixx=0; ixxid())==6) { - partonsToMatch_.push_back(intermediates[ixx]); - tmpList_.clear(); - getTopRadiation(partonsToMatch_.back()); - for(unsigned int jxx=0; jxxid())>=4&&abs(partonsToMatch_[ixx]->id())<=6) { - theProgenitor = partonsToMatch_[ixx]; - // Follow the heavy quark line down to where it stops branching. - while(theProgenitor->children().size()>0) { - theLastProgenitor = theProgenitor; - for(unsigned int jxx=0; jxxchildren().size(); jxx++) { - if(theProgenitor->children()[jxx]->id()==theProgenitor->id()) - theProgenitor=theProgenitor->children()[jxx]; - } - // If the progenitor had children but none of them had - // the same particle id as it, then it must have undergone - // a decay rather than a branching, i.e. it is the end of - // the evolution line, so, - if(theProgenitor==theLastProgenitor) break; - } - evolvedHeavyQuarks.push_back(theProgenitor); - } - } - // Now delete the evolved heavy quark from the particlesToCluster. - for(unsigned int ixx=0; ixx optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); - // loop over the optional weights and find np values - for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ - // split the line - boost::split( SplitVec, it->first, boost::is_any_of(" ") ); - // if np is found, store the information - if(SplitVec[0] == "np") { - npLO_ = atof(SplitVec[1].c_str()); - npNLO_ = atof(SplitVec[2].c_str()); - } - } - return; -} - -// get hadron COM energy -void FxFxHandler::getECOM() const { - split_vector_type SplitVec; - // pull the optional weights from the current event - map optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); - // loop over the optional weights and find np values - for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ - // split the line - boost::split( SplitVec, it->first, boost::is_any_of(" ") ); - // if np is found, store the information - if(SplitVec[0] == "ecom") { - ECOM_ = it->second; - } - } - return; -} - - -// get pt_clust information -void FxFxHandler::getptclust() const { - split_vector_type SplitVec; - // pull the optional weights from the current event - map optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); - // loop over the optional weights and find np values - string str_eq = "="; - string str_quote = "\""; - int countptc_(0); - for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ - // split the line - double wgtid = it->second; - //cout << "wgtdid = " << wgtid << endl; - if(wgtid == -333) { - // cout << "it->first for -333 = " << it->first << endl; - boost::split( SplitVec, it->first, boost::is_any_of(" ") ); - // if np is found, store the information - double ptclust(0.); - string stringtohandle(""); - for(unsigned int i_ = 0; i_ < SplitVec.size(); ++i_) { - if(SplitVec[i_].find("pt_clust_") != std::string::npos) { - //cout << "pt_clust_ found in " << SplitVec[i_] << endl; - countptc_++; - // cout << "SplitVec[i_] = " << SplitVec[i_] << endl; - stringtohandle = SplitVec[i_]; - stringtohandle.erase(0,10); - erase_substr(stringtohandle,str_eq); - erase_substr(stringtohandle,str_quote); - // cout << "stringtohandle = " << stringtohandle << endl; - ptclust = atof(stringtohandle.c_str()); - ptclust_.push_back(ptclust); - } - } - } - } - return; -} - -void FxFxHandler::getPreshowerParticles() const { - // LH file initial-state partons: - preshowerISPs_ = lastXCombPtr()->subProcess()->incoming(); - // LH file final-state partICLEs: - preshowerFSPs_ = lastXCombPtr()->subProcess()->outgoing(); - return; -} - -void FxFxHandler::getShoweredParticles() const { - // Post-shower initial-state hadrons: - showeredISHs_ = eventHandler()->currentEvent()->incoming(); - - // Post-shower initial-state partons: - for(unsigned int ixx=0; ixx<(showeredISHs_.first)->children().size(); ixx++) - if(((showeredISHs_.first)->children()[ixx]->id())<6|| - ((showeredISHs_.first)->children()[ixx]->id())==21) - showeredISPs_.first=(showeredISHs_.first)->children()[ixx]; - for(unsigned int ixx=0; ixx<(showeredISHs_.second)->children().size(); ixx++) - if(((showeredISHs_.second)->children()[ixx]->id())<6|| - ((showeredISHs_.second)->children()[ixx]->id())==21) - showeredISPs_.second=(showeredISHs_.second)->children()[ixx]; - - // Post-shower final-state partICLEs plus remnants (to be removed later): - showeredFSPs_ = eventHandler()->currentEvent()->getFinalState(); - - // Post-shower final-state remnants: - for(unsigned int ixx=0; ixxPDGName()=="Rem:p+"|| - showeredFSPs_[ixx]->PDGName()=="Rem:pbar-") { - if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== - showeredISHs_.first) - showeredRems_.first=showeredFSPs_[ixx]; - else if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== - showeredISHs_.second) - showeredRems_.second=showeredFSPs_[ixx]; - } - } - - // Now delete found remnants from the showeredFSPs vector for consistency. - for(unsigned int ixx=0; ixxPDGName()=="Rem:p+") - showeredFSPs_.erase(showeredFSPs_.begin()+ixx); - for(unsigned int ixx=0; ixxPDGName()=="Rem:pbar-") - showeredFSPs_.erase(showeredFSPs_.begin()+ixx); - sort(showeredFSPs_.begin(),showeredFSPs_.end(),recordEntry); - - return; -} - -void FxFxHandler::doSanityChecks(int debugLevel) const { - - // When checking momentum conservation in the form - // p_in - p_out, any momentum component bigger / less - // than + / - epsilon will result in the p_in - p_out - // vector being flagged as "non-null", triggering a - // warning that momentum conservation is violated. - Energy epsilon(0.5*GeV); - if(debugLevel>=5) epsilon=1e-9*GeV; - - // Print out what was found for the incoming and outgoing - // partons in the lastXCombPtr regardless. - if(debugLevel>=5) { - cout << "\n\n\n\n"; - cout << "****************************************************" << endl; - cout << " The following are the hard subprocess momenta from " << "\n" - << " lastXCombPtr and should be basically identical to " << "\n" - << " the input LH file momenta." << "\n\n"; - cout << " Incoming particles:" << "\n" - << *(preshowerISPs_.first) << "\n" - << *(preshowerISPs_.second) << endl; - cout << " Outgoing particles:" << endl; - for(unsigned int ixx=0; ixx=5) { - cout << "\n\n"; - cout << "****************************************************" << endl; - cout << " The following are the particles left at the end of" << "\n" - << " the showering step." << "\n\n"; - cout << " Incoming hadrons:" << "\n" - << *(showeredISHs_.first) << "\n" - << *(showeredISHs_.second) << endl; - cout << " Incoming partons:" << "\n" - << *(showeredISPs_.first) << "\n" - << *(showeredISPs_.second) << endl; - cout << " Outgoing partons:" << endl; - for(unsigned int ixx=0; ixx=4) { - Lorentz5Momentum tmpMom; - tmpMom += showeredISPs_.first->momentum(); - tmpMom += showeredISPs_.second->momentum(); - for(unsigned int ixx=0; ixxmomentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "Total parton mom.in - total parton mom.out = " - << tmpMom/GeV << endl; - tmpMom = showeredISHs_.first->momentum() - - showeredRems_.first->momentum() -showeredISPs_.first->momentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "First p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; - tmpMom = showeredISHs_.second->momentum() - - showeredRems_.second->momentum()-showeredISPs_.second->momentum(); - if(!isMomLessThanEpsilon(tmpMom,epsilon)) - cout << "Second p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; - } - - // Check if what we found to be the remnant is consistent with - // what we identified as the parent incoming hadron i.e. p+ - // goes with Rem:p+ and pbar- goes with Rem:pbar-. - if(debugLevel>=0) { - string tmpString; - tmpString=showeredRems_.first->PDGName(); - tmpString=tmpString.substr(tmpString.find_first_of(":")+1, - string::npos); - if(showeredISHs_.first->PDGName()!=tmpString) { - cout << "FxFxHandler::showerHardProcessVeto" << "\n" - << "Fatal error in pairing of remnant and parent hadron." << "\n" - << "Remnant = " << *(showeredRems_.first) << "\n" - << "Parent hadron = " << *(showeredISHs_.first) - << endl; - cout << showeredISHs_.first->PDGName() << endl; - cout << tmpString << endl; - } - tmpString=showeredRems_.second->PDGName(); - tmpString=tmpString.substr(tmpString.find_first_of(":")+1, - string::npos); - if(showeredISHs_.second->PDGName()!=tmpString) { - cout << "FxFxHandler::showerHardProcessVeto" << "\n" - << "Fatal error in pairing of remnant and parent hadron." << "\n" - << "Remnant = " << *(showeredRems_.second) << "\n" - << "Parent hadron = " << *(showeredISHs_.second) - << endl; - cout << showeredISHs_.second->PDGName() << endl; - cout << tmpString << endl; - } - } - return; -} - -void FxFxHandler::printMomVec(vector momVec) { - cout << "\n\n"; - - // Label columns. - printf("%5s %9s %9s %9s %9s %9s %9s %9s %9s %9s\n", - "jet #", - "px","py","pz","E", - "eta","phi","pt","et","mass"); - - // Print out the details for each jet - for (unsigned int ixx=0; ixx split_vector_type; - -/** - * Here is the documentation of the FxFxHandler class. - * - * @see \ref FxFxHandlerInterfaces "The interfaces" - * defined for FxFxHandler. - */ -class FxFxHandler: public QTildeShowerHandler { - - /** - * FxFxHandler should have access to our private parts. - */ - friend class FxFxEventHandler; - - friend class FxFxReader; - - -public: - - /** - * The default constructor. - */ - FxFxHandler(); - -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. */ - //@{ - /** - * Finalize the object - */ - virtual void dofinish(); - - /** - * 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(); - //@} - -public: - /** - * Hook to allow vetoing of event after showering hard sub-process - * as in e.g. MLM merging. - */ - virtual bool showerHardProcessVeto() const; - - /** - * information for FxFx merging - */ - mutable int npLO_; - mutable int npNLO_; - - /** - * information for tree-level merging - */ - mutable vector ptclust_; - -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: - - /* - * whether a heavy quark has been found in the merging - */ - mutable bool hvqfound = false; - - /* - * Run MLM jet-parton matching on the 'extra' jets. - */ - bool lightJetPartonVeto(); - - /* - * Function that calculates deltaR between a parton and a jet - */ - double partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom) const; - - - /* - * Function that calculates deltaR between two jets - */ - double partonJetDeltaR(LorentzMomentum jetmom1, LorentzMomentum jetmom2) const; - - /** - * Find jets using the FastJet package on particlesToCluster_. - */ - void getFastJets(double rjet, Energy ejcut, double etajcut) const; - - /** - * Find jets using the FastJet package on particlesToCluster_. - */ - void getFastJetsToMatch(double rjet, Energy ejcut, double etajcut) const; - - /** - * Deletes particles from partonsToMatch_ and particlesToCluster_ - * vectors so that these contain only the partons to match to the - * jets and the particles used to build jets respectively. By and - * large the candidates for deletion are: vector bosons and their - * decay products, Higgs bosons, photons as well as _primary_, i.e. - * present in the lowest multiplicity process, heavy quarks and - * any related decay products. - */ - void caldel_m() const; - - /** - * Deletes particles from partonsToMatch_ and particlesToCluster_ - * vectors so that these contain only the partons to match to the - * jets and the particles used to build jets respectively. The candidates - * are chosen according to the information passed from madgraph. - */ - void caldel_mg() const; - - /** - * c++ translation of subroutine of same name from alpsho.f. - * Label all particles with status between ISTLO and ISTHI - * (until a particle with status ISTOP is found) as final-state, - * call calsim_m and then put labels back to normal. This - * version keeps only all IST=1 particles rejected by caldel as - * daughters of vetoed heavy-quark mothers: jets complementary - * to those reconstructed by caldel. - */ - void caldel_hvq() const; - - /** - * get the MG5_aMC information required for FxFx merging - */ - void getnpFxFx() const; - - /** - * get the MG5_aMC information required for FxFx merging - */ - void getECOM() const; - - - /** - * get the MG5_aMC information required for tree-level merging - */ - void getptclust() const; - - /** - * Erases all occurences of a substring from a string - */ - - void erase_substr(std::string& subject, const std::string& search) const; - - - /** - * Get the particles from lastXCombPtr filling the pair - * preshowerISPs_ and particle pointer vector preshowerFSPs_. - */ - void getPreshowerParticles() const; - - /** - * Get the particles from eventHandler()->currentEvent()->... - * filling the particle pairs showeredISHs_, showeredISPs_, - * showeredRems_ and the particle pointer vector showeredFSPs_. - */ - void getShoweredParticles() const; - - /** - * Allows printing of debug output and sanity checks like - * total momentum consrvation to be carried out. - * debugLevel = -1, 0, ...5 - * = no debugging, minimal debugging, ... verbose. - */ - void doSanityChecks(int debugLevel) const; - - /** - * Given a pointer to a particle this finds all its final state - * descendents. - */ - void getDescendents(PPtr theParticle) const; - - /** - * Accumulates all descendents of tops down to the b and W - * but not including them. - */ - void getTopRadiation(PPtr theParticle) const; - - /** - * Sorts a given vector of particles by descending pT or ETJET - */ - - ParticleVector pTsort(ParticleVector unsortedVec); - pair< vector, vector > ETsort(vector unsortedetjet, vector unsortedVec); - - /* - * A function that prints a vector of Lorentz5Momenta in a fancy way - */ - void printMomVec(vector momVec); - - - /* - * A probability function for varying etclus_ about the mean value - */ - Energy etclusran_(double petc) const; - -private: - - /** - * The static object used to initialize the description of this class. - * Indicates that this is a concrete class with persistent data. - */ - static ClassDescription initFxFxHandler; - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - FxFxHandler & operator=(const FxFxHandler &) = delete; - -private: - - - /** - * Initial-state incoming partons prior to showering - * (i.e. from lastXCombPtr). - */ - mutable PPair preshowerISPs_; - - /** - * Final-state outgoing partICLEs prior to showering - * (i.e. from lastXCombPtr). - */ - mutable ParticleVector preshowerFSPs_; - - /** - * Final-state outgoing partICLEs prior to showering _to_be_removed_ - * from preShowerFSPs_ prior to the light-parton-light-jet matching - * step. This same list is the starting point for determining - * partonsToMatch_ for the case of merging in heavy quark production. - */ - mutable ParticleVector preshowerFSPsToDelete_; - - /** - * Initial-state incoming hadrons after shower of hard process - * (eventHandler()->currentEvent()->incoming()). - */ - mutable PPair showeredISHs_; - - /** - * Initial-state incoming partons after shower of hard process - * (look for partonic children of showeredISHs_). - */ - mutable PPair showeredISPs_; - - /** - * Final-state outgoing partICLEs after shower of hard process - * (eventHandler()->currentEvent()->getFinalState()). - */ - mutable tPVector showeredFSPs_; - - /** - * Final-state outgoing partICLEs after shower of hard process - * _to_be_removed_ from showeredFSPs_ prior to the - * light-parton-light-jet matching step. This same list is the - * starting point for determining particlesToCluster_ for the - * case of merging in heavy quark production. - */ - mutable ParticleVector showeredFSPsToDelete_; - - /** - * ONLY the final-state partons from preshowerFSPs_ that are - * supposed to enter the jet-parton matching. - */ - mutable ParticleVector partonsToMatch_; - - /* - * The shower progenitors - */ - - mutable PPtr theProgenitor; - mutable PPtr theLastProgenitor; - - /** - * ONLY the final-state particles from showeredFSPs_ (and maybe - * also showeredRems_) that are supposed to go for jet clustering. - */ - mutable tPVector particlesToCluster_; - - /** - * Final-state remnants after shower of hard process - * (look for remnants initially in showeredFSPs_). - */ - mutable PPair showeredRems_; - - /** - * the COM of the incoming hadrons - */ - - mutable double ECOM_; - - /** - * Pointer to the object calculating the strong coupling - */ - ShowerAlphaPtr alphaS_; - - /** - * Information extracted from the XComb object - */ - //@{ - /** - * The fixed factorization scale used in the MEs. - */ - Energy pdfScale_; - - /** - * Centre of mass energy - */ - Energy2 sHat_; - - /** - * Constant alphaS used to generate LH events - if not already - * using CKKW scale (ickkw = 1 in AlpGen for example). - */ - double alphaSME_; - //@} - - /* - * Number of rapidity segments of the calorimeter. - */ - unsigned int ncy_; - - /* - * Number of phi segments of the calorimeter. - */ - unsigned int ncphi_; - - /* - * Heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t). - */ - int ihvy_; - - /* - * Number of photons in the AlpGen process. - */ - int nph_; - - /* - * Number of higgses in the AlpGen process. - */ - int nh_; - - /* - * Jet ET cut to apply in jet clustering (in merging). - */ - mutable Energy etclus_; - - /* - * Mean Jet ET cut to apply in jet clustering (in merging). - */ - Energy etclusmean_; - - /* - * maximum deviation from mean Jet ET cut to apply in jet clustering (in merging). - */ - Energy epsetclus_; - - - - /* - * Cone size used in jet clustering (in merging). - */ - double rclus_; - - /* - * Max |eta| for jets in clustering (in merging). - */ - double etaclmax_; - - /* - * Default 1.5 factor used to decide if a jet matches a parton - * in merging: if DR(parton,jet) ncphi). - * ==> Cosine goes from +1 ---> +1 (index = 0 ---> ncphi). - */ - vector cphcal_; - - /* - * Sine of phi values of calorimeter cell centres. - * Goes phi~=0 to phi~=2*pi (index = 0 ---> ncphi). - * ==> Sine goes 0 -> 1 -> 0 -> -1 -> 0 (index = 0 ---> ncphi). - */ - vector sphcal_; - - /* - * Cosine of theta values of calorimeter cell centres in Y. - * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). - * ==> Cosine goes from -1 ---> +1 (index = 0 ---> ncy). - */ - vector cthcal_; - - /* - * Sine of theta values of calorimeter cell centres in Y. - * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). - * ==> Sine goes from 0 ---> +1 ---> 0 (index = 0 ---> ncy). - */ - vector sthcal_; - - /* - * Transverse energy deposit in a given calorimeter cell. - * First array index corresponds to rapidity index of cell, - * second array index corresponds to phi cell index. - */ - vector > et_; - - /* - * For a given calorimeter cell this holds the index of the jet - * that the cell was clustered into. - */ - vector > jetIdx_; - - /* - * Vector holding the Lorentz 5 momenta of each jet. - */ - mutable vector pjet_; - - /* - * Vector holding the Lorentz 5 momenta of each jet from ME partons - */ - mutable vector pjetME_; - - - /* - * Vector holding the list of FS particles resulting from - * the particle input to getDescendents. - */ - mutable ParticleVector tmpList_; - - /* - * Variables for the C++ translation of the calini_m(), calsim_m(), - * getjet_m(...) and caldel_m() functions - */ - mutable vector etjet_; - vector etjetME_; - mutable double dely_, delphi_; - -}; - -} - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** This template specialization informs ThePEG about the - * base classes of FxFxHandler. */ -template <> -struct BaseClassTrait { - /** Typedef of the first base class of FxFxHandler. */ - typedef Herwig::QTildeShowerHandler NthBase; -}; - -/** This template specialization informs ThePEG about the name of - * the FxFxHandler class and the shared object where it is defined. */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** Return a platform-independent class name */ - static string className() { return "Herwig::FxFxHandler"; } - /** - * The name of a file containing the dynamic library where the class - * FxFxHandler is implemented. It may also include several, space-separated, - * libraries if the class FxFxHandler 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 "FxFxHandler.so"; } -}; - -/** @endcond */ - -} - -#endif /* HERWIG_FxFxHandler_H */ diff --git a/Contrib/FxFx/FxFxLHReader.cc b/Contrib/FxFx/FxFxLHReader.cc deleted file mode 100644 --- a/Contrib/FxFx/FxFxLHReader.cc +++ /dev/null @@ -1,466 +0,0 @@ -// -*- C++ -*- -// -// FxFxLHReader.cc is a part of Herwig - A multi-purpose -// Monte Carlo event generator. -// Copyright (C) 2002-2017 The Herwig Collaboration -// -// Herwig is licenced under version 3 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 FxFxLHReader class. -// -#include "FxFxLHReader.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Utilities/Throw.h" -#include "ThePEG/PDT/DecayMode.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDF/PartonExtractor.h" -#include "ThePEG/PDF/NoPDF.h" -#include "ThePEG/Cuts/Cuts.h" -#include "ThePEG/EventRecord/TmpTransform.h" -#include "ThePEG/Utilities/UtilityBase.h" - -using namespace Herwig; - -FxFxLHReader:: -FxFxLHReader(const FxFxLHReader & x) - : LesHouchesReader(x), neve(x.neve), ieve(0), - LHFVersion(x.LHFVersion), outsideBlock(x.outsideBlock), - headerBlock(x.headerBlock), initComments(x.initComments), - initAttributes(x.initAttributes), eventComments(x.eventComments), - eventAttributes(x.eventAttributes), - theFileName(x.theFileName),overSampling_(x.overSampling_) {} - -FxFxLHReader::~FxFxLHReader() {} - -IBPtr FxFxLHReader::clone() const { - return new_ptr(*this); -} - -IBPtr FxFxLHReader::fullclone() const { - return new_ptr(*this); -} - -bool FxFxLHReader::preInitialize() const { - return true; -} - -void FxFxLHReader::doinit() { - LesHouchesReader::doinit(); -} - -void FxFxLHReader::initialize(LesHouchesEventHandler & eh) { - LesHouchesReader::initialize(eh); - if ( LHFVersion.empty() ) - Throw() - << "The file associated with '" << name() << "' does not contain a " - << "proper formatted Les Houches event file. The events may not be " - << "properly sampled." << Exception::warning; -} - - -long FxFxLHReader::scan() { - - open(); - - // Shall we write the events to a cache file for fast reading? If so - // we write to a temporary file if the caches events should be - // randomized. - if ( cacheFileName().length() ) openWriteCacheFile(); - - // Keep track of the number of events scanned. - long neve = 0; - long cuteve = 0; - bool negw = false; - - // If the open() has not already gotten information about subprocesses - // and cross sections we have to scan through the events. - if ( !heprup.NPRUP || cacheFile() || abs(heprup.IDWTUP) != 1 ) { // why scan if IDWTUP != 1? - - HoldFlag<> isScanning(scanning); - - double oldsum = 0.0; - vector lprup; - vector newmax; - vector oldeve; - vector neweve; - for ( int i = 0; ( maxScan() < 0 || i < maxScan() ) && readEvent(); ++i ) { - if ( !checkPartonBin() ) Throw() - << "Found event in LesHouchesReader '" << name() - << "' which cannot be handeled by the assigned PartonExtractor '" - << partonExtractor()->name() << "'." << Exception::runerror; - vector::iterator idit = - find(lprup.begin(), lprup.end(), hepeup.IDPRUP); - int id = lprup.size(); - if ( idit == lprup.end() ) { - lprup.push_back(hepeup.IDPRUP); - newmax.push_back(0.0); - neweve.push_back(0); - oldeve.push_back(0); - } else { - id = idit - lprup.begin(); - } - ++neve; - ++oldeve[id]; - oldsum += hepeup.XWGTUP; - if ( cacheFile() ) { - if ( eventWeight() == 0.0 ) { - ++cuteve; - continue; - } - cacheEvent(); - } - ++neweve[id]; - newmax[id] = max(newmax[id], abs(eventWeight())); - if ( eventWeight() < 0.0 ) negw = true; - } - - xSecWeights.resize(oldeve.size(), 1.0); - for ( int i = 0, N = oldeve.size(); i < N; ++i ) - if ( oldeve[i] ) xSecWeights[i] = double(neweve[i])/double(oldeve[i]); - - if ( maxScan() < 0 || neve > NEvents() ) NEvents(neve - cuteve); - - if ( lprup.size() == heprup.LPRUP.size() ) { - for ( int id = 0, N = lprup.size(); id < N; ++id ) { - vector::iterator idit = - find(heprup.LPRUP.begin(), heprup.LPRUP.end(), hepeup.IDPRUP); - if ( idit == heprup.LPRUP.end() ) { - Throw() - << "When scanning events, the LesHouschesReader '" << name() - << "' found undeclared processes." << Exception::warning; - heprup.NPRUP = 0; - break; - } - int idh = idit - heprup.LPRUP.begin(); - heprup.XMAXUP[idh] = newmax[id]; - } - } - if ( heprup.NPRUP == 0 ) { - // No heprup block was supplied or something went wrong. - heprup.NPRUP = lprup.size(); - heprup.LPRUP.resize(lprup.size()); - heprup.XMAXUP.resize(lprup.size()); - for ( int id = 0, N = lprup.size(); id < N; ++id ) { - heprup.LPRUP[id] = lprup[id]; - heprup.XMAXUP[id] = newmax[id]; - } - } else if ( abs(heprup.IDWTUP) != 1 ) { - // Try to fix things if abs(heprup.IDWTUP) != 1. - double sumxsec = 0.0; - for ( int id = 0; id < heprup.NPRUP; ++id ) sumxsec += heprup.XSECUP[id]; - weightScale = picobarn*neve*sumxsec/oldsum; - } - } - - if ( cacheFile() ) closeCacheFile(); - - if ( negw ) heprup.IDWTUP = min(-abs(heprup.IDWTUP), -1); - - return neve; - -} - -void FxFxLHReader::open() { - if ( filename().empty() ) - throw LesHouchesFileError() - << "No Les Houches file name. " - << "Use 'set " << name() << ":FileName'." - << Exception::runerror; - cfile.open(filename()); - if ( !cfile ) - throw LesHouchesFileError() - << "The FxFxLHReader '" << name() << "' could not open the " - << "event file called '" << theFileName << "'." - << Exception::runerror; - - cfile.readline(); - if ( !cfile.find(" attributes = - StringUtils::xmlAttributes("LesHouchesEvents", cfile.getline()); - LHFVersion = attributes["version"]; - if ( LHFVersion.empty() ) return; - - bool readingHeader = false; - bool readingInit = false; - headerBlock = ""; - - // Loop over all lines until we hit the tag. - while ( cfile.readline() && !cfile.find("") ) { - if ( cfile.find("> heprup.IDBMUP.first >> heprup.IDBMUP.second - >> heprup.EBMUP.first >> heprup.EBMUP.second - >> heprup.PDFGUP.first >> heprup.PDFGUP.second - >> heprup.PDFSUP.first >> heprup.PDFSUP.second - >> heprup.IDWTUP >> heprup.NPRUP ) ) { - heprup.NPRUP = -42; - LHFVersion = ""; - return; - } - heprup.resize(); - - for ( int i = 0; i < heprup.NPRUP; ++i ) { - cfile.readline(); - if ( !( cfile >> heprup.XSECUP[i] >> heprup.XERRUP[i] - >> heprup.XMAXUP[i] >> heprup.LPRUP[i] ) ) { - heprup.NPRUP = -42; - LHFVersion = ""; - return; - } - } - } - else if ( cfile.find("momentum().plus()/ - beams().first->momentum().plus(); - - if ( reweightPDF && - inPDF.first && outPDF.first && inPDF.first != outPDF.first ) { - if ( hepeup.XPDWUP.first <= 0.0 ) - hepeup.XPDWUP.first = - inPDF.first->xfx(inData.first, incoming().first->dataPtr(), - sqr(hepeup.SCALUP*GeV), x1); - double xf = outPDF.first->xfx(inData.first, incoming().first->dataPtr(), - sqr(hepeup.SCALUP*GeV), x1); - lastweight *= xf/hepeup.XPDWUP.first; - hepeup.XPDWUP.first = xf; - } - - double x2 = incoming().second->momentum().minus()/ - beams().second->momentum().minus(); - - if ( reweightPDF && - inPDF.second && outPDF.second && inPDF.second != outPDF.second ) { - if ( hepeup.XPDWUP.second <= 0.0 ) - hepeup.XPDWUP.second = - inPDF.second->xfx(inData.second, incoming().second->dataPtr(), - sqr(hepeup.SCALUP*GeV), x2); - double xf = - outPDF.second->xfx(inData.second, incoming().second->dataPtr(), - sqr(hepeup.SCALUP*GeV), x2); - lastweight *= xf/hepeup.XPDWUP.second; - hepeup.XPDWUP.second = xf; - } - - if ( cutEarly() ) { - if ( !cuts().initSubProcess((incoming().first->momentum() + - incoming().second->momentum()).m2(), - 0.5*log(x1/x2)) ) lastweight = 0.0; - tSubProPtr sub = getSubProcess(); - TmpTransform tmp(sub, Utilities::getBoostToCM(sub->incoming())); - if ( !cuts().passCuts(*sub) ) lastweight = 0.0; - } - - return true; -} - -double FxFxLHReader::getEvent() { - if ( cacheFile() ) { - if (overSampling_) { - if ( !uncacheEvent() ) reopen(); - } else { - if ( !uncacheEvent() || stats.attempts()==NEvents() ) - throw LesHouchesReopenWarning() - << "More events requested than available in LesHouchesReader " - << name() << Exception::runerror; - } - } else { - if (overSampling_) { - if ( !readEvent() ) reopen(); - } else { - if ( !readEvent() || stats.attempts()==NEvents() ) - throw LesHouchesReopenWarning() - << "More events requested than available in LesHouchesReader " - << name() << Exception::runerror; - } - } - ++position; - - double max = maxWeights[hepeup.IDPRUP]*maxFactor; - return max != 0.0? eventWeight()/max: 0.0; - -} - -void FxFxLHReader::skip(long n) { - HoldFlag<> skipflag(skipping); - if(overSampling_) while ( n-- ) getEvent(); -} - -bool FxFxLHReader::doReadEvent() { - if ( !cfile ) return false; - if ( LHFVersion.empty() ) return false; - if ( heprup.NPRUP < 0 ) return false; - eventComments = ""; - outsideBlock = ""; - hepeup.NUP = 0; - hepeup.XPDWUP.first = hepeup.XPDWUP.second = 0.0; - - // Keep reading lines until we hit the next event or the end of - // the event block. Save any inbetween lines. Exit if we didn't - // find an event. - while ( cfile.readline() && !cfile.find("> hepeup.NUP >> hepeup.IDPRUP >> hepeup.XWGTUP - >> hepeup.SCALUP >> hepeup.AQEDUP >> hepeup.AQCDUP ) ) - return false; - hepeup.resize(); - // Read all particle lines. - for ( int i = 0; i < hepeup.NUP; ++i ) { - if ( !cfile.readline() ) return false; - if ( !( cfile >> hepeup.IDUP[i] >> hepeup.ISTUP[i] - >> hepeup.MOTHUP[i].first >> hepeup.MOTHUP[i].second - >> hepeup.ICOLUP[i].first >> hepeup.ICOLUP[i].second - >> hepeup.PUP[i][0] >> hepeup.PUP[i][1] >> hepeup.PUP[i][2] - >> hepeup.PUP[i][3] >> hepeup.PUP[i][4] - >> hepeup.VTIMUP[i] >> hepeup.SPINUP[i] ) ) - return false; - if(std::isnan(hepeup.PUP[i][0])||std::isnan(hepeup.PUP[i][1])|| - std::isnan(hepeup.PUP[i][2])||std::isnan(hepeup.PUP[i][3])|| - std::isnan(hepeup.PUP[i][4])) - throw Exception() - << "nan's as momenta in Les Houches file " - << Exception::eventerror; - } - - // Now read any additional comments. - while ( cfile.readline() && !cfile.find("") ) - eventComments += cfile.getline() + "\n"; - - if ( !cfile ) return false; - return true; - -} - -void FxFxLHReader::close() { - cfile.close(); -} - -void FxFxLHReader::persistentOutput(PersistentOStream & os) const { - os << neve << LHFVersion << outsideBlock << headerBlock << initComments - << initAttributes << eventComments << eventAttributes << theFileName - << overSampling_; -} - -void FxFxLHReader::persistentInput(PersistentIStream & is, int) { - is >> neve >> LHFVersion >> outsideBlock >> headerBlock >> initComments - >> initAttributes >> eventComments >> eventAttributes >> theFileName - >> overSampling_; - ieve = 0; -} - -ClassDescription -FxFxLHReader::initFxFxLHReader; -// Definition of the static class description member. - -void FxFxLHReader::Init() { - - static ClassDocumentation documentation - ("Herwig::FxFxLHReader is an base class to be used for objects " - "which reads event files from matrix element generators. This class is " - "able to read plain event files conforming to the Les Houches Event File " - "accord."); - - static Parameter interfaceFileName - ("FileName", - "The name of a file containing events conforming to the Les Houches " - "protocol to be read into ThePEG. A file name ending in " - ".gz will be read from a pipe which uses " - "zcat. If a file name ends in | the " - "preceeding string is interpreted as a command, the output of which " - "will be read through a pipe.", - &FxFxLHReader::theFileName, "", false, false); - - static Switch interfaceOverSampling - ("OverSampling", - "Allow / Forbid reading of LH events more than once by the " - "LH reader, allowing / protecting against statistical problems.", - &FxFxLHReader::overSampling_, true, false, false); - static SwitchOption AllowOverSampling - (interfaceOverSampling, - "AllowOverSampling", - "The reader will read events in the file more than once if more " - "events are needed to generate the requested number than that in " - "the LH file.", - true); - static SwitchOption ForbidOverSampling - (interfaceOverSampling, - "ForbidOverSampling", - "The reader will NOT read events in the file more than once if more " - "events are needed to generate the requested number than that in " - "the LH file - instead it will stop when all have been read.", - false); - - interfaceFileName.fileType(); - interfaceFileName.rank(11); - -} - diff --git a/Contrib/FxFx/FxFxLHReader.fh b/Contrib/FxFx/FxFxLHReader.fh deleted file mode 100644 --- a/Contrib/FxFx/FxFxLHReader.fh +++ /dev/null @@ -1,22 +0,0 @@ -// -*- C++ -*- -// -// This is the forward declaration of the FxFxLHReader class. -// -#ifndef HERWIG_FxFxLHReader_FH -#define HERWIG_FxFxLHReader_FH - -#include "ThePEG/Config/Pointers.h" - -namespace Herwig { - -class FxFxLHReader; - -} - -namespace ThePEG { - -ThePEG_DECLARE_POINTERS(Herwig::FxFxLHReader,FxFxLHReaderPtr); - -} - -#endif diff --git a/Contrib/FxFx/FxFxLHReader.h b/Contrib/FxFx/FxFxLHReader.h deleted file mode 100644 --- a/Contrib/FxFx/FxFxLHReader.h +++ /dev/null @@ -1,333 +0,0 @@ -// -*- C++ -*- -// -// FxFxLHReader.h is a part of Herwig - A multi-purpose -// Monte Carlo event generator. -// Copyright (C) 2002-2017 The Herwig Collaboration -// -// Herwig is licenced under version 3 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 FxFxLHReader class. -// -#ifndef HERWIG_FxFxLHReader_H -#define HERWIG_FxFxLHReader_H -// This is the declaration of the FxFxLHReader class. - -#include "ThePEG/LesHouches/LesHouchesReader.h" -#include "FxFxLHReader.fh" -#include "ThePEG/PDT/Decayer.h" -#include "ThePEG/Utilities/CFileLineReader.h" -#include - -namespace Herwig { - -using namespace ThePEG; - -/** - * FxFxLHReader derives from the LesHouchesReader base class - * to be used for objects which read event files from matrix element - * generators. It extends LesHouchesReader by defining a file handle to be - * read from, which is opened and closed by the open() and close() - * functions. Note that the file handle is a standard C filehandle and - * not a C++ stream. This is because there is no standard way in C++ - * to connect a pipe to a stream for reading eg. gzipped files. This - * class is able to read plain event files conforming to the Les - * Houches Event File accord. - * - * @see \ref FxFxLHReaderInterfaces "The interfaces" - * defined for FxFxLHReader. - * @see LesHouchesReader - * @see FxFxLHReader - */ -class FxFxLHReader: public LesHouchesReader { - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * Default constructor. - */ - FxFxLHReader() : neve(0), ieve(0) {} - - /** - * Copy-constructor. Note that a file which is opened in the object - * copied from will have to be reopened in this. - */ - FxFxLHReader(const FxFxLHReader &); - - /** - * Destructor. - */ - virtual ~FxFxLHReader(); - //@} - -public: - - /** @name Virtual functions specified by the LesHouchesReader base class. */ - //@{ - /** - * Initialize. This function is called by the LesHouchesEventHandler - * to which this object is assigned. - */ - virtual void initialize(LesHouchesEventHandler & eh); - - /** - * Calls readEvent() or uncacheEvent() to read information into the - * LesHouches common block variables. This function is called by the - * LesHouchesEventHandler if this reader has been selectod to - * produce an event. - * - * @return the weight asociated with this event. If negative weights - * are allowed it should be between -1 and 1, otherwise between 0 - * and 1. If outside these limits the previously estimated maximum - * is violated. Note that the estimated maximum then should be - * updated from the outside. - */ - virtual double getEvent(); - - /** - * Calls doReadEvent() and performs pre-defined reweightings. A - * sub-class overrides this function it must make sure that the - * corresponding reweightings are done. - */ - virtual bool readEvent(); - - /** - * Skip \a n events. Used by LesHouchesEventHandler to make sure - * that a file is scanned an even number of times in case the events - * are not ramdomly distributed in the file. - */ - virtual void skip(long n); - - /** - * Scan the file or stream to obtain information about cross section - * weights and particles etc. This function should fill the - * variables corresponding to the /HEPRUP/ common block. The - * function returns the number of events scanned. - */ - virtual long scan(); - - /** - * Open a file with events. Derived classes should overwrite it and - * first calling it before reading in the run information into the - * corresponding protected variables. - */ - virtual void open(); - - /** - * Close the file from which events have been read. - */ - virtual void close(); - - /** - * Read the next event from the file or stream into the - * corresponding protected variables. Return false if there is no - * more events or if this was not a LHF event file. - */ - virtual bool doReadEvent(); - //@} - - /** - * Return the name of the file from where to read events. - */ - string filename() const { return theFileName; } - -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; - //@} - - /** @name Standard (and non-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(); - - /** - * Return true if this object needs to be initialized before all - * other objects because it needs to extract PDFs from the event file. - */ - virtual bool preInitialize() const; - //@ - -protected: - - /** - * The wrapper around the C FILE stream from which to read - */ - CFileLineReader cfile; - -protected: - - /** - * The number of events in this file. - */ - long neve; - - /** - * The current event number. - */ - long ieve; - - /** - * If the file is a standard Les Houches formatted file (LHF) this - * is its version number. If empty, this is not a Les Houches - * formatted file - */ - string LHFVersion; - - /** - * If LHF. All lines (since the last open() or readEvent()) outside - * the header, init and event tags. - */ - string outsideBlock; - - /** - * If LHF. All lines from the header block. - */ - string headerBlock; - - /** - * If LHF. Additional comments found in the init block. - */ - string initComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the init - * tag. - */ - map initAttributes; - - /** - * If LHF. Additional comments found with the last read event. - */ - string eventComments; - - /** - * If LHF. Map of attributes (name-value pairs) found in the last - * event tag. - */ - map eventAttributes; - -private: - - /** - * The name of the file from where to read events. - */ - string theFileName; - - /** - * Determines whether events in the LH file are or are not read - * more than once in order to generate the requested number of - * events. - */ - bool overSampling_; - -private: - - /** - * Describe an abstract base class with persistent data. - */ - static ClassDescription initFxFxLHReader; - - /** - * Private and non-existent assignment operator. - */ - FxFxLHReader & operator=(const FxFxLHReader &) = delete; - -public: - - /** @cond EXCEPTIONCLASSES */ - /** Exception class used by FxFxLHReader if reading the file - * fails. */ - class LesHouchesFileError: public Exception {}; - /** @endcond */ - -}; - -} - - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** - * This template specialization informs ThePEG about the - * base class of FxFxLHReader. - */ -template <> -struct BaseClassTrait { - /** Typedef of the base class of FxFxLHReader. */ - typedef LesHouchesReader NthBase; -}; - -/** - * This template specialization informs ThePEG about the name of the - * FxFxLHReader class and the shared object where it is - * defined. - */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** - * Return the class name. - */ - static string className() { return "Herwig::FxFxLHReader"; } - /** - * Return the name of the shared library to be loaded to get access - * to the FxFxLHReader class and every other class it uses - * (except the base class). - */ - static string library() { return "FxFxLHReader.so"; } - -}; - -/** @endcond */ - -} - -#endif /* HERWIG_FxFxLHReader_H */ diff --git a/Contrib/FxFx/FxFxReader.h b/Contrib/FxFx/FxFxReader.h deleted file mode 100644 --- a/Contrib/FxFx/FxFxReader.h +++ /dev/null @@ -1,1006 +0,0 @@ -// -*- C++ -*- -// -// FxFxReader.h is a part of ThePEG - Toolkit for HEP Event Generation -// Copyright (C) 1999-2011 Leif Lonnblad -// -// ThePEG is licenced under version 3 of the GPL, see COPYING for details. -// Please respect the MCnet academic guidelines, see GUIDELINES for details. -// -#ifndef THEPEG_FxFxReader_H -#define THEPEG_FxFxReader_H -// This is the declaration of the FxFxReader class. - -#include "FxFx.h" -#include "ThePEG/Handlers/HandlerBase.h" -#include "ThePEG/Utilities/ObjectIndexer.h" -#include "ThePEG/Utilities/Exception.h" -#include "ThePEG/Utilities/XSecStat.h" -#include "ThePEG/PDF/PartonBinInstance.h" -#include "ThePEG/PDF/PartonBin.fh" -#include "ThePEG/MatrixElement/ReweightBase.h" -#include "FxFxEventHandler.fh" -#include "FxFxReader.fh" -#include "ThePEG/Utilities/CFile.h" -#include -#include - -namespace ThePEG { - -/** - * FxFxReader is an abstract base class to be used for objects - * which reads event files or streams from matrix element - * generators. Derived classes must at least implement the open() and - * doReadEvent() methods to read in information about the whole run into - * the HEPRUP variable and next event into the HEPEUP variable - * respectively. Also the close() function to close the file or stream - * read must be implemented. Although these functions are named as if - * we are reading from event files, they could just as well implement - * the actual generation of events. - * - * After filling the HEPRUP and HEPEUP variables, which are protected - * and easily accesible from the sub-class, this base class will then - * be responsible for transforming this data to the ThePEG Event - * record in the getEvent() method. FxFxReaders can - * only be used inside FxFxEventHandler objects. - * - * In the initialization the virtual open() and scan() functions are - * called. Here the derived class must provide the information about - * the processes in the variables corresponding to the HEPRUP common - * block. Note that the IDWTUP is required to be +/- 1, and sub - * classes are required to change the information accordingly to - * ensure the correct corss section sampling. Note also that the - * controlling FxFxEventHandler may choose to generate weighted - * events even if IDWTUP is 1. - * - * Note that the information given per process in e.g. the XSECUP and - * XMAXUP vectors is not used by the FxFxEventHandler and by - * default the FxFxReader is not assumed to be able to actively - * choose between the sub-processes. Instead, the - * FxFxEventHandler can handle several FxFxReader objects - * and choose between them. However, a sub-class of FxFxReader - * may set the flag isActive, in which case it is assumed to be able - * to select between its sub-processes itself. - * - * The FxFxReader may be assigned a number ReweightBase objects - * which either completely reweights the events produced (in the - * reweights vector), or only biases the selection without influencing - * the cross section (in the preweights vector). Note that it is the - * responsibility of a sub-class to call the reweight() function and - * multiply the weight according to its return value (typically done - * in the readEvent() function). - * - * @see \ref FxFxReaderInterfaces "The interfaces" - * defined for FxFxReader. - * @see Event - * @see FxFxEventHandler - */ -class FxFxReader: public HandlerBase, public LastXCombInfo<> { - - /** - * FxFxEventHandler should have access to our private parts. - */ - friend class FxFxEventHandler; - - /** - * Map for accumulating statistics of cross sections per process - * number. - */ - typedef map StatMap; - - /** - * Map of XComb objects describing the incoming partons indexed by - * the corresponding PartonBin pair. - */ - typedef map XCombMap; - - /** - * A vector of pointers to ReweightBase objects. - */ - typedef vector ReweightVector; - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * Default constructor. If the optional argument is true, the reader - * is assumed to be able to produce events on demand for a given - * process. - */ - FxFxReader(bool active = false); - - /** - * Copy-constructor. - */ - FxFxReader(const FxFxReader &); - - /** - * Destructor. - */ - virtual ~FxFxReader(); - //@} - -public: - - /** @name Main virtual fuctions to be overridden in - * sub-classes. They are named as if we are reading from event - * files, but could equally well implement the actual generation of - * events. */ - //@{ - /** - * Open a file or stream with events and read in the run information - * into the heprup variable. - */ - virtual void open() = 0; - - /** - * Read the next event from the file or stream into the - * corresponding protected variables. Return false if there is no - * more events. - */ - virtual bool doReadEvent() = 0; - - /** - * Close the file or stream from which events have been read. - */ - virtual void close() = 0; - - /** - * return the weight names - */ - // virtual vector optWeightsNamesFunc(); - virtual vector optWeightsNamesFunc() = 0; - //virtual vector optWeightNamesFunc() = 0; - vector optionalWeightsNames; - - /** - * The ID (e.g. 100x, 2001) for the weight - */ - - // vector optionalWeightsNames; - - - //@} - - /** @name Other important function which may be overridden in - * sub-classes which wants to bypass the basic HEPRUP or HEPEUP - * variables or otherwise facilitate the conversion to ThePEG - * objects. */ - //@{ - /** - * Initialize. This function is called by the FxFxEventHandler - * to which this object is assigned. - */ - virtual void initialize(FxFxEventHandler & eh); - - /** - * Calls readEvent() or uncacheEvent() to read information into the - * FxFx common block variables. This function is called by the - * FxFxEventHandler if this reader has been selectod to - * produce an event. - * - * @return the weight asociated with this event. If negative weights - * are allowed it should be between -1 and 1, otherwise between 0 - * and 1. If outside these limits the previously estimated maximum - * is violated. Note that the estimated maximum then should be - * updated from the outside. - */ - virtual double getEvent(); - - /** - * Calls doReadEvent() and performs pre-defined reweightings. A - * sub-class overrides this function it must make sure that the - * corresponding reweightings are done. - */ - virtual bool readEvent(); - - /** - * Skip \a n events. Used by FxFxEventHandler to make sure - * that a file is scanned an even number of times in case the events - * are not ramdomly distributed in the file. - */ - virtual void skip(long n); - - /** - * Get an XComb object. Converts the information in the Les Houches - * common block variables to an XComb object describing the sub - * process. This is the way information is conveyed from the reader - * to the controlling FxFxEventHandler. - */ - tXCombPtr getXComb(); - - /** - * Get a SubProcess object corresponding to the information in the - * Les Houches common block variables. - */ - tSubProPtr getSubProcess(); - - /** - * Scan the file or stream to obtain information about cross section - * weights and particles etc. This function should fill the - * variables corresponding to the /HEPRUP/ common block. The - * function returns the number of events scanned. - */ - virtual long scan(); - - /** - * Take the information corresponding to the HEPRUP common block and - * initialize the statistics for this reader. - */ - virtual void initStat(); - - /** - * Reweights the current event using the reweights and preweights - * vectors. It is the responsibility of the sub-class to call this - * function after the HEPEUP information has been retrieved. - */ - double reweight(); - - /** - * Converts the information in the Les Houches common block - * variables into a Particle objects. - */ - virtual void fillEvent(); - - /** - * Removes the particles created in the last generated event, - * preparing to produce a new one. - */ - void reset(); - - /** - * Possibility for subclasses to recover from non-conformant - * settings of XMAXUP when an event file has been scanned with \a - * neve events. Should set weightScale so that the average XMAXUP - * times weightScale gives the cross section for a process. (This is - * needed for MadEvent). - */ - virtual void setWeightScale(long neve); - - //@} - - /** @name Access information about the current event. */ - //@{ - - /** - * Return the size of this event in bytes. To be used for the cache - * file. \a npart is the number of particles. If \a npart is 0, the - * number is taken from NUP. - */ - static size_t eventSize(int N) { - return (N + 1)*sizeof(int) + // IDPRUP, ISTUP - (7*N + 4)*sizeof(double) + // XWGTUP, SCALUP, AQEDUP, AQCDUP, PUP, - // VTIMUP, SPINUP - N*sizeof(long) + // IDUP - 2*N*sizeof(pair) + // MOTHUP, ICOLUP - sizeof(pair) + // XPDWUP. - 2*sizeof(double); // lastweight and preweight - } - - /** - * The current event weight given by XWGTUP times possible - * reweighting. Note that this is not necessarily the same as what - * is returned by getEvent(), which is scaled with the maximum - * weight. - */ - double eventWeight() const { return hepeup.XWGTUP*lastweight; } - - /** - * Return the optional named weights associated to the current event. - */ - const map& optionalEventWeights() const { return optionalWeights; } - - /** - * Return the optional npLO and npNLO - */ - const int& optionalEventnpLO() const { return optionalnpLO; } - const int& optionalEventnpNLO() const { return optionalnpNLO; } - - /** - * The pair of PartonBinInstance objects describing the current - * incoming partons in the event. - */ - const PBIPair & partonBinInstances() const { return thePartonBinInstances; } - /** - * Return the instances of the beam particles for the current event. - */ - const PPair & beams() const { return theBeams; } - /** - * Return the instances of the incoming particles to the sub process - * for the current event. - */ - const PPair & incoming() const { return theIncoming; } - /** - * Return the instances of the outgoing particles from the sub process - * for the current event. - */ - const PVector & outgoing() const { return theOutgoing; } - /** - * Return the instances of the intermediate particles in the sub - * process for the current event. - */ - const PVector & intermediates() const { return theIntermediates; } - /** - * If this reader is to be used (possibly together with others) for - * CKKW reweighting and veto, this should give the multiplicity of - * outgoing particles in the highest multiplicity matrix element in - * the group. - */ - int maxMultCKKW() const { return theMaxMultCKKW; } - /** - * If this reader is to be used (possibly together with others) for - * CKKW reweighting and veto, this should give the multiplicity of - * outgoing particles in the lowest multiplicity matrix element in - * the group. - */ - int minMultCKKW() const { return theMinMultCKKW; } //@} - - /** @name Other inlined access functions. */ - //@{ - /** - * The number of events found in this reader. If less than zero the - * number of events are unlimited. - */ - long NEvents() const { return theNEvents; } - - /** - * The number of events produced so far. Is reset to zero if an - * event file is reopened. - */ - long currentPosition() const { return position; } - - /** - * The maximum number of events to scan to collect information about - * processes and cross sections. If less than 0, all events will be - * scanned. - */ - long maxScan() const { return theMaxScan; } - - /** - * Return true if this reader is active. - */ - bool active() const { return isActive; } - - /** - * True if negative weights may be produced. - */ - bool negativeWeights() const { return heprup.IDWTUP < 0; } - - /** - * The collected cross section statistics for this reader. - */ - const XSecStat & xSecStats() const { return stats; } - - /** - * Collected statistics about the individual processes. - */ - const StatMap & processStats() const { return statmap; } - - /** - * Select the current event. It will later be rejected with a - * probability given by \a weight. - */ - void select(double weight) { - stats.select(weight); - statmap[hepeup.IDPRUP].select(weight); - } - - /** - * Accept the current event assuming it was previously selcted. - */ - void accept() { - stats.accept(); - statmap[hepeup.IDPRUP].accept(); - } - - /** - * Reject the current event assuming it was previously accepted. - */ - void reject(double w) { - stats.reject(w); - statmap[hepeup.IDPRUP].reject(w); - } - - /** - * Increase the overestimated cross section for this reader. - */ - virtual void increaseMaxXSec(CrossSection maxxsec); - - /** - * The PartonExtractor object used to construct remnants. - */ - tPExtrPtr partonExtractor() const { return thePartonExtractor; } - - /** - * Return a possibly null pointer to a CascadeHandler to be used for - * CKKW-reweighting. - */ - tCascHdlPtr CKKWHandler() const { return theCKKW; } - - /** - * The pairs of PartonBin objects describing the partons which can - * be extracted by the PartonExtractor object. - */ - const PartonPairVec & partonBins() const { return thePartonBins; } - - /** - * The map of XComb objects indexed by the corresponding PartonBin - * pair. - */ - const XCombMap & xCombs() const { return theXCombs; } - - /** - * The Cuts object to be used for this reader. - */ - const Cuts & cuts() const { return *theCuts; } - - //@} - -protected: - - /** @name Functions for manipulating cache files. */ - //@{ - - /** - * Name of file used to cache the events form the reader in a - * fast-readable form. If empty, no cache file will be generated. - */ - string cacheFileName() const { return theCacheFileName; } - - /** - * Determines whether to apply cuts to events converting them to - * ThePEG format. - */ - bool cutEarly() const { return doCutEarly; } - - /** - * File stream for the cache. - */ - CFile cacheFile() const { return theCacheFile;} - - /** - * Open the cache file for reading. - */ - void openReadCacheFile(); - - /** - * Open the cache file for writing. - */ - void openWriteCacheFile(); - - /** - * Close the cache file; - */ - void closeCacheFile(); - - /** - * Write the current event to the cache file. - */ - void cacheEvent() const; - - /** - * Read an event from the cache file. Return false if something went wrong. - */ - bool uncacheEvent(); - - /** - * Reopen a reader. If we have reached the end of an event file, - * reopen it and issue a warning if we have used up a large fraction - * of it. - */ - void reopen(); - - /** - * Helper function to write a variable to a memory location - */ - template - static char * mwrite(char * pos, const T & t, size_t n = 1) { - std::memcpy(pos, &t, n*sizeof(T)); - return pos + n*sizeof(T); - } - - /** - * Helper function to read a variable from a memory location - */ - template - static const char * mread(const char * pos, T & t, size_t n = 1) { - std::memcpy(&t, pos, n*sizeof(T)); - return pos + n*sizeof(T); - } - - //@} - - /** @name Auxilliary virtual methods which may be verridden by sub-classes. */ - //@{ - /** - * Check the existence of a pair of PartonBin objects corresponding - * to the current event. - * - * @return false if no pair of suitable PartonBin objects was found. - */ - virtual bool checkPartonBin(); - - /** - * Create instances of all particles in the event and store them - * in particleIndex. - */ - virtual void createParticles(); - - /** - * Using the already created particles create a pair of - * PartonBinInstance objects corresponding to the incoming - * partons. Return the corresponding PartonBin objects. - */ - virtual tcPBPair createPartonBinInstances(); - - /** - * Create instances of the incoming beams in the event and store - * them in particleIndex. If no beam particles are included in the - * event they are created from the run info. - */ - virtual void createBeams(); - - /** - * Go through the mother indices and connect up the Particles. - */ - virtual void connectMothers(); - //@} - -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 Set functions for some variables not in the Les Houches accord. */ - //@{ - /** - * The number of events in this reader. If less than zero the number - * of events is unlimited. - */ - void NEvents(long x) { theNEvents = x; } - - /** - * The map of XComb objects indexed by the corresponding PartonBin - * pair. - */ - XCombMap & xCombs() { return theXCombs; } - //@} - - /** @name Standard (and non-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(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish() { - close(); - HandlerBase::dofinish(); - } - - /** - * Return true if this object needs to be initialized before all - * other objects because it needs to extract PDFs from the event file. - */ - virtual bool preInitialize() const; - - /** - * Called from doinit() to extract PDFs from the event file and add - * the corresponding objects to the current EventGenerator. - */ - virtual void initPDFs(); - //@} - -protected: - - /** - * The HEPRUP common block. - */ - HEPRUP heprup; - - /** - * The HEPEUP common block. - */ - HEPEUP hepeup; - - /** - * The ParticleData objects corresponding to the incoming particles. - */ - tcPDPair inData; - - /** - * The PDFBase objects which has been used for the beam particle - * when generating the events being read. Specified in the interface - * or derived from PDFGUP and PDFSUP. - */ - pair inPDF; - - /** - * The PDFBase object to be used in the subsequent generation. - */ - pair outPDF; - - /** - * The PartonExtractor object used to construct remnants. - */ - PExtrPtr thePartonExtractor; - - /** - * A pointer to a CascadeHandler to be used for CKKW-reweighting. - */ - tCascHdlPtr theCKKW; - - /** - * The pairs of PartonBin objects describing the partons which can - * be extracted by the PartonExtractor object. - */ - PartonPairVec thePartonBins; - - /** - * The map of XComb objects indexed by the corresponding PartonBin - * pair. - */ - XCombMap theXCombs; - - /** - * The Cuts object to be used for this reader. - */ - CutsPtr theCuts; - - /** - * The number of events in this reader. If less than zero the number - * of events is unlimited. - */ - long theNEvents; - - /** - * The number of events produced by this reader so far. Is reset - * every time an event file is reopened. - */ - long position; - - /** - * The number of times this reader has been reopened. - */ - int reopened; - - /** - * The maximum number of events to scan to collect information about - * processes and cross sections. If less than 0, all events will be - * scanned. - */ - long theMaxScan; - - /** - * Flag to tell whether we are in the process of scanning. - */ - bool scanning; - - /** - * True if this is an active reader. - */ - bool isActive; - - /** - * Name of file used to cache the events form the reader in a - * fast-readable form. If empty, no cache file will be generated. - */ - string theCacheFileName; - - /** - * Determines whether to apply cuts to events before converting them - * to ThePEG format. - */ - bool doCutEarly; - - /** - * Collect statistics for this reader. - */ - XSecStat stats; - - /** - * Collect statistics for each individual process. - */ - StatMap statmap; - - /** - * The pair of PartonBinInstance objects describing the current - * incoming partons in the event. - */ - PBIPair thePartonBinInstances; - - /** - * Association between ColourLines and colour indices in the current - * translation. - */ - ObjectIndexer colourIndex; - - /** - * Association between Particles and indices in the current - * translation. - */ - ObjectIndexer particleIndex; - - /** - * The instances of the beam particles for the current event. - */ - PPair theBeams; - - /** - * The instances of the incoming particles to the sub process for - * the current event. - */ - PPair theIncoming; - - /** - * The instances of the outgoing particles from the sub process for - * the current event. - */ - PVector theOutgoing; - - /** - * The instances of the intermediate particles in the sub process for - * the current event. - */ - PVector theIntermediates; - - /** - * File stream for the cache. - */ - CFile theCacheFile; - - /** - * The reweight objects modifying the weights of this reader. - */ - ReweightVector reweights; - - /** - * The preweight objects modifying the weights of this reader. - */ - ReweightVector preweights; - - /** - * The factor with which this reader was last pre-weighted. - */ - double preweight; - - /** - * Should the event be reweighted by PDFs used by the PartonExtractor? - */ - bool reweightPDF; - - /** - * Should PDFBase objects be constructed from the information in the - * event file in the initialization? - */ - bool doInitPDFs; - - /** - * If this reader is to be used (possibly together with others) for - * CKKW reweighting and veto, this should give the multiplicity of - * outgoing particles in the highest multiplicity matrix element in - * the group. - */ - int theMaxMultCKKW; - - /** - * If this reader is to be used (possibly together with others) for - * CKKW reweighting and veto, this should give the multiplicity of - * outgoing particles in the lowest multiplicity matrix element in - * the group. - */ - int theMinMultCKKW; - - /** - * The weight multiplying the last read event due to PDF - * reweighting, CKKW reweighting or assigned reweight and preweight - * objects. - */ - double lastweight; - - /** - * The optional weights associated to the last read events. - */ - map optionalWeights; - - /** - * npLO for FxFx merging - */ - int optionalnpLO; - - /** - * npNLO for FxFx merging - */ - int optionalnpNLO; - - /** - * If the maximum cross section of this reader has been increased - * with increaseMaxXSec(), this is the total factor with which it - * has been increased. - */ - double maxFactor; - - /** - * The (reweighted) XWGTUP value should be scaled with this cross - * section when compared to the overestimated cross section. - */ - CrossSection weightScale; - - /** - * Individual scales for different sub-processes if reweighted. - */ - vector xSecWeights; - - /** - * Individual maximum weights for individual (possibly reweighted) - * processes. - */ - map maxWeights; - - /** - * Is set to true when getEvent() is called from skip(int). - */ - bool skipping; - - /** - * Option for the treatment of the momenta supplied - */ - unsigned int theMomentumTreatment; - - /** - * Set to true if warnings about possible weight incompatibilities - * should be issued. - */ - bool useWeightWarnings; - - /** - * Option to allow reopening of the file - */ - bool theReOpenAllowed; - - /** - * Use the spin information - */ - bool theIncludeSpin; - -private: - - /** Access function for the interface. */ - void setBeamA(long id); - /** Access function for the interface. */ - long getBeamA() const; - /** Access function for the interface. */ - void setBeamB(long id); - /** Access function for the interface. */ - long getBeamB() const; - /** Access function for the interface. */ - void setEBeamA(Energy e); - /** Access function for the interface. */ - Energy getEBeamA() const; - /** Access function for the interface. */ - void setEBeamB(Energy e); - /** Access function for the interface. */ - Energy getEBeamB() const; - /** Access function for the interface. */ - void setPDFA(PDFPtr); - /** Access function for the interface. */ - PDFPtr getPDFA() const; - /** Access function for the interface. */ - void setPDFB(PDFPtr); - /** Access function for the interface. */ - PDFPtr getPDFB() const; - -private: - - /** - * Describe an abstract base class with persistent data. - */ - static AbstractClassDescription initFxFxReader; - - /** - * Private and non-existent assignment operator. - */ - FxFxReader & operator=(const FxFxReader &) = delete; - -public: - - /** @cond EXCEPTIONCLASSES */ - /** Exception class used by FxFxReader in case inconsistencies - * are encountered. */ - class FxFxInconsistencyError: public Exception {}; - - /** Exception class used by FxFxReader in case more events - than available are requested. */ - class FxFxReopenWarning: public Exception {}; - - /** Exception class used by FxFxReader in case reopening an - event file fails. */ - class FxFxReopenError: public Exception {}; - - /** Exception class used by FxFxReader in case there is - information missing in the initialization phase. */ - class FxFxInitError: public InitException {}; - /** @endcond */ - -}; - -/// Stream output for HEPEUP -ostream & operator<<(ostream & os, const HEPEUP & h); - -} - - -#include "ThePEG/Utilities/ClassTraits.h" - -namespace ThePEG { - -/** @cond TRAITSPECIALIZATIONS */ - -/** - * This template specialization informs ThePEG about the - * base class of FxFxReader. - */ -template <> -struct BaseClassTrait: public ClassTraitsType { - /** Typedef of the base class of FxFxReader. */ - typedef HandlerBase NthBase; -}; - -/** - * This template specialization informs ThePEG about the name of the - * FxFxReader class and the shared object where it is - * defined. - */ -template <> -struct ClassTraits - : public ClassTraitsBase { - /** - * Return the class name. - */ - static string className() { return "Herwig::FxFxReader"; } - /** - * Return the name of the shared library to be loaded to get access - * to the FxFxReader class and every other class it uses - * (except the base class). - */ - static string library() { return "FxFx.so"; } - -}; - -/** @endcond */ - -} - -#endif /* THEPEG_FxFxReader_H */ diff --git a/Contrib/FxFx/HW7-Zjets-FxFx-FxFx.in b/Contrib/FxFx/HW7-Zjets-FxFx-FxFx.in deleted file mode 100644 --- a/Contrib/FxFx/HW7-Zjets-FxFx-FxFx.in +++ /dev/null @@ -1,194 +0,0 @@ - -############################################################# -# Create an event generator taking the default EventGenerator # -# as the starting point ... # -############################################################# -cd /Herwig/Generators -# Copy the default EventGenerator with its settings to a new -# which will be the basis of the one we use for showering: -cp EventGenerator theGenerator - -############################################################# -# Create a LH event handler (set up & assigned below) ... # -############################################################# -cd /Herwig/EventHandlers -library FxFx.so -create Herwig::FxFxEventHandler theLesHouchesHandler - -############################################################# -# Create a LH reader (set up & assigned below) ... # -############################################################# -cd /Herwig/EventHandlers -library FxFx.so -create Herwig::FxFxFileReader theLHReader - -############################################################# -# Create an FxFxHandler (set up & assigned below) ... # -############################################################# -cd /Herwig/Shower -library FxFxHandler.so -create Herwig::FxFxHandler FxFxHandler -set /Herwig/Shower/FxFxHandler:ShowerModel /Herwig/Shower/ShowerModel -set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator - -############################################################# -# Create an LHAPDF (set up & assigned below) ... # -############################################################# -cd /Herwig/Partons -create ThePEG::LHAPDF thePDFset ThePEGLHAPDF.so - -############################################################ -# Create a cuts object ... # -############################################################ -cd /Herwig/EventHandlers -create ThePEG::Cuts /Herwig/Cuts/NoCuts - -############################################################# -# Setup the LH event handler ... #\ -############################################################# -cd /Herwig/EventHandlers -insert theLesHouchesHandler:FxFxReaders[0] theLHReader -set theLesHouchesHandler:WeightOption VarNegWeight -set theLesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor -set theLesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler -set theLesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler -set theLesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler - -############################################################ - -################################################## -# Shower parameters -################################################## -# normally, you want -# the scale supplied in the event files (SCALUP) -# to be used as a pT veto scale in the parton shower -set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes -set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes -# Shower parameters -# treatment of wide angle radiation -set /Herwig/Shower/PartnerFinder:PartnerMethod Random -set /Herwig/Shower/PartnerFinder:ScaleChoice Partner -# fix issue before 7.0.5 (not needed after this) -#set /Herwig/Shower/GtoQQbarSplitFn:AngularOrdered Yes -#set /Herwig/Shower/GammatoQQbarSplitFn:AngularOrdered Yes -# with MC@NLO these parameters are required for consistency of the subtraction terms -# suggested parameters -set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost -set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General -set /Herwig/Shower/KinematicsReconstructor:FinalStateReconOption Default -set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity -set /Herwig/Shower/ShowerHandler:SpinCorrelations No - -############################################################ - -############################################################# -# Set up the LH reader ... # -############################################################# -cd /Herwig/EventHandlers -set theLHReader:WeightWarnings false -# Input event file name: -# 100 k -set theLHReader:FileName events.lhe.gz -set theLHReader:MomentumTreatment RescaleEnergy -set theLHReader:Cuts /Herwig/Cuts/NoCuts - -#################################################### -# Set up the generator ... # -#################################################### -cd /Herwig/Generators -set theGenerator:EventHandler /Herwig/EventHandlers/theLesHouchesHandler -set theGenerator:NumberOfEvents 100000000 -set theGenerator:RandomNumberGenerator:Seed 31122001 -set theGenerator:PrintEvent 1 -set theGenerator:MaxErrors 10000 - -######################################################### -# Option to off shower / hadronization / decays / MPI. # -######################################################### -cd /Herwig/EventHandlers -# set theLesHouchesHandler:CascadeHandler NULL -#set theLesHouchesHandler:HadronizationHandler NULL -# remove the quark check in case hadronization is turned off -# set /Herwig/Analysis/Basics:CheckQuark false -#set theLesHouchesHandler:DecayHandler NULL -# The handler for multiple parton interactions -#set /Herwig/Shower/FxFxHandler:MPIHandler NULL - -############################################################# -# Set up the FxFxHandler ... # -############################################################# -cd /Herwig/Shower -set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler -set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer -set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD -# set the heavy quark decay product vetoing process on/off -set FxFxHandler:HeavyQVeto Yes -# Automatic detection of the hard process (experimental) -set FxFxHandler:HardProcessDetection Automatic -# No. of light jets in maximum-multiplicity FxFx process -set FxFxHandler:njetsmax 1 # Make sure this is set correctly! -# Mimimum parton-parton R-sep used for generation. -set FxFxHandler:drjmin 0 - -######################################################### -# Recommended key merging parameters below # -######################################################### -cd /Herwig/Shower -# turn the Vetoing On or Off completely -set FxFxHandler:VetoIsTurnedOff VetoingIsOn -# merging mode: in this case FxFx: -set FxFxHandler:MergeMode FxFx -# merging scale -set FxFxHandler:ETClus 25*GeV -# jet radius used in clustering in merging. -set FxFxHandler:RClus 1.0 -# Max |eta| for jets in clustering in merging. -set FxFxHandler:EtaClusMax 10 -# Default 1.5 factor used to decide if a jet matches a parton -# in merging: if DR(parton,jet) out(1,meMomenta()[2]); - tcPDVector tout(1,mePartonData()[2]); - // return true if passes the cuts - return lastCuts().passCuts(tout, out, mePartonData()[0], mePartonData()[1]); -} - -double MEee2Z::me2() const { - double aver=0.; - // the arrays for the wavefunction to be passed to the matrix element - vector fin; - vector ain; - vector vin; - SpinorWaveFunction fwave(meMomenta()[0],mePartonData()[0],incoming); - SpinorBarWaveFunction awave(meMomenta()[1],mePartonData()[1],incoming); - for(unsigned int ihel=0;ihel<2;++ihel) { - fwave.reset(ihel);fin.push_back(fwave); - awave.reset(ihel);ain.push_back(awave); - } - VectorWaveFunction vwave(meMomenta()[2],mePartonData()[2],outgoing); - for(unsigned int ihel=0;ihel<3;++ihel) { - vwave.reset(ihel); vin.push_back(vwave); - } - ProductionMatrixElement temp=HelicityME(fin,ain,vin,aver); - // add the Breit-Wigner factors - Energy width=mePartonData()[2]->width(); - Energy mass =mePartonData()[2]->mass(); - InvEnergy2 fact = width*mass/(sqr(sHat()-mass*mass)+sqr(mass*width)); - return aver*fact*sHat(); -} - -CrossSection MEee2Z::dSigHatDR() const { - return (me2()*jacobian()/sHat())*sqr(hbarc); -} - -unsigned int MEee2Z::orderInAlphaS() const { - return 0; -} - -unsigned int MEee2Z::orderInAlphaEW() const { - return 1; -} - -Selector -MEee2Z::diagrams(const DiagramVector &) const { - Selector sel; - sel.insert(1.0, 0); - return sel; -} - -Selector -MEee2Z::colourGeometries(tcDiagPtr) const { - static const ColourLines neutral ( " " ); - Selector sel; - sel.insert(1.,&neutral); - return sel; -} - - -void MEee2Z::persistentOutput(PersistentOStream & os) const { - os << _theFFZVertex; -} - -void MEee2Z::persistentInput(PersistentIStream & is, int) { - is >> _theFFZVertex; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigMEee2Z("Herwig::MEee2Z", "LeptonME.so"); - -void MEee2Z::Init() { - - static ClassDocumentation documentation - ("The MEee2Z class implements the e+e- -> Z as a 1->2 process for testing" - " of spin correlations etc.."); - -} - -void MEee2Z::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]); - if(hard[0]->id()id()) swap(hard[0],hard[1]); - vector fin; - vector ain; - vector vin; - SpinorWaveFunction( fin,hard[0],incoming,false,true); - SpinorBarWaveFunction(ain,hard[1],incoming,false,true); - VectorWaveFunction (vin,hard[2],outgoing,true,false,true); - double dummy; - ProductionMatrixElement prodme=HelicityME(fin,ain,vin,dummy); - // construct the vertex - HardVertexPtr hardvertex=new_ptr(HardVertex()); - // set the matrix element for the vertex - hardvertex->ME(prodme); - // set the pointers to and from the vertex - for(unsigned int ix=0;ix<3;++ix) { - (hard[ix]->spinInfo())-> - productionVertex(hardvertex); - } -} - -// the helicity amplitude matrix element -ProductionMatrixElement MEee2Z::HelicityME(vector fin, - vector ain, - vector vout, - double & aver) const -{ - ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin1); - Complex product; - // sum over helicities to get the matrix element - unsigned int inhel1,inhel2,outhel1; - double me(0.); - LorentzPolarizationVector vec; - Complex ii(0.,1.); - for(inhel1=0;inhel1<2;++inhel1) { - for(inhel2=0;inhel2<2;++inhel2) { - for(outhel1=0;outhel1<3;++outhel1) { - product=_theFFZVertex->evaluate(sHat(),fin[inhel1],ain[inhel2], - vout[outhel1]); - output(inhel1,inhel2,outhel1)=product; - me+=real(product*conj(product)); - } - } - } - aver=me/4.; - return output; -} - -void MEee2Z::doinit() { - MEBase::doinit(); - tcHwSMPtr hwsm=ThePEG::dynamic_ptr_cast(standardModel()); - // do the initialisation - if(hwsm) - { _theFFZVertex = hwsm->vertexFFZ();} - else - {throw InitException();} -} diff --git a/Contrib/LeptonME/MEee2Z.h b/Contrib/LeptonME/MEee2Z.h deleted file mode 100644 --- a/Contrib/LeptonME/MEee2Z.h +++ /dev/null @@ -1,208 +0,0 @@ -// -*- C++ -*- -// -// MEee2Z.h is a part of Herwig - A multi-purpose Monte Carlo event generator -// Copyright (C) 2002-2017 The Herwig Collaboration -// -// Herwig is licenced under version 3 of the GPL, see COPYING for details. -// Please respect the MCnet academic guidelines, see GUIDELINES for details. -// -#ifndef HERWIG_MEee2Z_H -#define HERWIG_MEee2Z_H -// -// This is the declaration of the MEee2Z class. -// - -#include "ThePEG/MatrixElement/ME2to2Base.h" -#include "ThePEG/MatrixElement/MEBase.h" -#include "Herwig/Models/RSModel/RSModel.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Utilities/Rebinder.h" -#include "Herwig/MatrixElement/ProductionMatrixElement.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" - -namespace Herwig { -using namespace ThePEG; -using Helicity::SpinorWaveFunction; -using Helicity::SpinorBarWaveFunction; -using Helicity::VectorWaveFunction; - -/** - * The MEee2Z class implements the matrix element for \f$e^+e^-\to Z\f$ for - * the testing of spin correlations - */ -class MEee2Z: public MEBase { - -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; - - /** - * 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 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 - colourGeometries(tcDiagPtr diag) const; - - /** - * Construct the vertex of spin correlations. - */ - virtual void constructVertex(tSubProPtr); - /** - * The number of internal degreed of freedom used in the matrix - * element. - */ - virtual int nDim() const; - - /** - * Generate internal degrees of freedom given 'nDim()' uniform - * random numbers in the interval ]0,1[. To help the phase space - * generator, the 'dSigHatDR()' should be a smooth function of these - * numbers, although this is not strictly necessary. Return - * false if the chosen points failed the kinematical cuts. - */ - virtual bool generateKinematics(const double * r); - - /** - * Return the matrix element for the kinematical configuation - * previously provided by the last call to setKinematics(). Uses - * me(). - */ - virtual CrossSection dSigHatDR() 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 Clone Methods. */ - //@{ - /** - * Make a simple clone of this object. - * @return a pointer to the new object. - */ - inline 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. - */ - inline 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 matrix element - * @param fin The spinors for the incoming fermion - * @param ain The spinors for the incoming antifermion - * @param vout The polarization vectors for the outgoing Z - * @param me The spin averaged matrix element - */ - ProductionMatrixElement HelicityME(vector fin, - vector ain, - vector vout,double& me) const; - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - MEee2Z & operator=(const MEee2Z &) = delete; - -private: - - /** - * Pointer to the Z vertex - */ - AbstractFFVVertexPtr _theFFZVertex; - -}; - -} - - -#endif /* HERWIG_MEee2Z_H */ diff --git a/Contrib/LeptonME/Makefile.in b/Contrib/LeptonME/Makefile.in deleted file mode 100644 --- a/Contrib/LeptonME/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE= -HERWIGINCLUDE= -GSLINCLUDE= -LDFLAGS = -SHARED_FLAG = -INCLUDE = $(THEPEGINCLUDE) $(HERWIGINCLUDE) $(GSLINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : LeptonME.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -LeptonME.so: MEee2Z.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) \ - MEee2Z.o $(SHARED_FLAG) $(LDFLAGS) -o LeptonME.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) LeptonME.so diff --git a/Contrib/PGSInterface/LHC.in b/Contrib/PGSInterface/LHC.in deleted file mode 100644 --- a/Contrib/PGSInterface/LHC.in +++ /dev/null @@ -1,42 +0,0 @@ -# -*- ThePEG-repository -*- -################################################## -# Example generator based on LHC parameters -# usage: Herwig read LHC.in -################################################## -read snippets/PPCollider.in -################################################## -# Technical parameters for this run -################################################## -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 10000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:PrintEvent 10 -set EventGenerator:MaxErrors 10000 - -################################################## -# LHC physics parameters (override defaults here) -################################################## -set EventGenerator:EventHandler:LuminosityFunction:Energy 14000.0 - -# Intrinsic pT tune extrapolated to LHC energy -set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 2.2*GeV - -################################################## -# Matrix Elements for hadron-hadron collisions -# (by default only gamma/Z switched on) -################################################## -cd /Herwig/MatrixElements/ - -insert SubProcess:MatrixElements[0] MEqq2gZ2ff -set MEqq2gZ2ff:Process Electron -cd /Herwig/Generators - -library HwPGSInterface.so -create Herwig::ZAnalysis /Herwig/Analysis/ZAnalysis ZAnalysis.so -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/ZAnalysis - - -################################################## -# Save run for later usage with 'Herwig run' -################################################## -saverun LHC EventGenerator diff --git a/Contrib/PGSInterface/Makefile.in b/Contrib/PGSInterface/Makefile.in deleted file mode 100644 --- a/Contrib/PGSInterface/Makefile.in +++ /dev/null @@ -1,47 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files (etc) -THEPEGINCLUDE = -GSLINCLUDE = -HERWIGINCLUDE = -FC = -FCLIBS = -LDFLAGS = -SHARED_FLAG = -HEPMCLIBS = -L/scratch/richardn/montecarlo/utilities/lib -PGSPATH = /scratch/richardn/montecarlo/detector/PGS/ -PGSLIB = -L$(PGSPATH)/lib -lpgslib -lstdhep -lFmcfio -lpythia -ltauola -lherwig -INCLUDE = $(THEPEGINCLUDE) $(GSLINCLUDE) $(HERWIGINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : HwPGSInterface.so ZAnalysis.so - -HwPGSInterface.so : PGSInterface.cc PGSInterface.h PGSInterface.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - PGSInterface.o PGSInterface.cc -o HwPGSInterface.so \ - $(PGSLIB) $(HEPMCLIBS) -lHepMC -lHepMCfio $(FCLIBS) - -ZAnalysis.so : ZAnalysis.cc ZAnalysis.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) \ - ZAnalysis.cc -o ZAnalysis.so \ - $(PGSLIB) $(HEPMCLIBS) -lHepMC -lHepMCfio $(FCLIBS) - -PGSInterface.o: PGSInterface.f - $(FC) -c -fPIC -fno-second-underscore PGSInterface.f - -clean: - rm -f *.o *.so diff --git a/Contrib/PGSInterface/PGSInterface.cc b/Contrib/PGSInterface/PGSInterface.cc deleted file mode 100644 --- a/Contrib/PGSInterface/PGSInterface.cc +++ /dev/null @@ -1,265 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the PGSInterface class. -// - -#include "PGSInterface.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Config/HepMCHelper.h" -#include "HepMC/HEPEVT_Wrapper.h" - -using namespace Herwig; - -extern "C" { - // initialize PGS - void pgs_initialize_(); - // call PGS trigger code - void pgs_trigger_(); - // call PGS reconstruction code - void pgs_recon_(); - // common block for PGS input parameters - extern struct { - int numarg; // number of arguments supplied to program - char pgs_args[10][40]; // list of arguments (char*80) - int nevpgs; // number of events to generate/read - int target_lum; // target luminosity (in pb-1) - int nprpgs; // number of events to print out - int pgs_iseed,pgs_jseed; // seeds for pgs_ranmar - int pgs_log_unit; // log file unit number - char optpgs[6]; // type of run: 'PYTHIA', 'ISAJET', 'FILE', - char evtlum[6]; // number of events ('events') or luminosity ('pb-1') - char pgs_input_file[80]; // input file - char pgs_output_file[80]; // output file - char pgs_log_file[80]; // log file - char pgs_param_file[80]; // detector parameter file - char pgs_isajet_decay[80];// ISAJET decay table file name - char pgs_isajet_cards[80];// ISAJET card file name - char pgs_pythia_cards[80];// PYTHIA card file name - int pgs_herwig_proc; // HERWIG process to generate - char pgs_herwig_susy[80]; // HERWIG SUSY data file - char pgs_alpgen_stem[80]; // ALPGEN unweighted events file stem - } pgsevt_; - // common block for PGS reconstructed objects - const int pgsrec_nojmx = 500; - extern struct { - int numobj,dumobj; // number of reconstructed objects - int indobj[pgsrec_nojmx]; // index to HEPEVT particle (where relevant) - int typobj[pgsrec_nojmx]; // reconstructed type - double pobj[pgsrec_nojmx][4]; // four vector of reconstructed object - double qobj[pgsrec_nojmx]; // charge of reconstructed object - double vecobj[pgsrec_nojmx][10]; // interesting object quantities - int unique[pgsrec_nojmx]; // true for object if it is uniquely identified - // and passes cuts in pgs_object_cuts - } pgsrec_; - - const int pgsnetamax=600; - const int pgsnphimax=600; - extern struct { - double ecal[pgsnetamax][pgsnphimax]; // electromagnetic energy in each tower - double hcal[pgsnetamax][pgsnphimax]; // hadronic energy in each tower - double met_cal; // calorimeter missing ET - double phi_met_cal; // calorimeter missing ET phi - double met_cor; // missing ET corrected for muons - double phi_met_cor; // corrected missing ET phi - } pgscal_; - -} - -void PGSInterface::persistentOutput(PersistentOStream & os) const { - os << _pgs_param_file; -} - -void PGSInterface::persistentInput(PersistentIStream & is, int) { - is >> _pgs_param_file; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigPGSInterface("Herwig::PGSInterface", "HwPGSInterface.so"); - -void PGSInterface::Init() { - - static ClassDocumentation documentation - ("The PGSInterface class is designed to allow the PGS detector" - " simulation to be used as an analysis handler in Herwig"); - -} - -void PGSInterface::dofinish() { - AnalysisHandler::dofinish(); - // delete the converter from HepMC to HEPEVT - delete _converter; -} - -void PGSInterface::doinitrun() { - AnalysisHandler::doinitrun(); - // create the converter from HepMC to HEPEVT - _converter = new HepMC::IO_HEPEVT(); - // convert variables and pass to PGS - // name of detector parameters file - const char *temp; - temp = _pgs_param_file.c_str(); - for(unsigned int ix=0;ix<80;++ix) { - if(temp[ix]=='\0') break; - pgsevt_.pgs_param_file[ix]=temp[ix]; - } - // initialize PGS - pgs_initialize_(); -} - -void PGSInterface::analyze(tEventPtr event, long ieve, int loop, int state) { - // check energy unit - if(HepMC::Units::default_momentum_unit()!=HepMC::Units::GEV) - throw Exception() << "Must be using GeV in HepMC if using PGS" - << " in PGSInterface::analyze()" - << Exception::runerror; - // convert the event to HepMC - HepMC::GenEvent * hepmc = HepMCConverter::convert(*event); - HepMC::HEPEVT_Wrapper::set_max_number_entries(4000); - // convert to HEPEVT - _converter->write_event(hepmc); - // call PGS trigger code - pgs_trigger_(); - // call PGS reconstruction code - pgs_recon_(); - // convert the unique reconstructed objects - _objects.clear(); - for(int ix=0;ix0.001&&pgsrec_.vecobj[ix][7]>0.001) - _objects.back().btagging = Both; - else if(pgsrec_.vecobj[ix][6]>0.001) - _objects.back().btagging = Loose; - else if(pgsrec_.vecobj[ix][7]>0.001) - _objects.back().btagging = Tight; - else - _objects.back().btagging = None; - // cluster width - _objects.back().clusterWidth = pgsrec_.vecobj[ix][4]*GeV; - } - // heavy charged - else { - _objects.back().PDGcode = 0; - } - } - // missing ET - _calorimeterMET = make_pair(pgscal_.met_cal*GeV,pgscal_.phi_met_cal); - _muonMET = make_pair(pgscal_.met_cor*GeV,pgscal_.phi_met_cor); - // delete the HepMC event - delete hepmc; -} diff --git a/Contrib/PGSInterface/PGSInterface.f b/Contrib/PGSInterface/PGSInterface.f deleted file mode 100644 --- a/Contrib/PGSInterface/PGSInterface.f +++ /dev/null @@ -1,15 +0,0 @@ -c dummy routines to make linker happy - subroutine pgs_user_herwig(process) - print *,'pgs_user_herwig called' - stop - end - - subroutine pgs_user_pythia - print *,'pgs_user_pythia called' - stop - end - - subroutine pgs_user_event - print *,'pgs_user_event called' - stop - end diff --git a/Contrib/PGSInterface/PGSInterface.h b/Contrib/PGSInterface/PGSInterface.h deleted file mode 100644 --- a/Contrib/PGSInterface/PGSInterface.h +++ /dev/null @@ -1,301 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_PGSInterface_H -#define HERWIG_PGSInterface_H -// -// This is the declaration of the PGSInterface class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "ThePEG/Vectors/Lorentz5Vector.h" -#include "HepMC/GenEvent.h" -#include "HepMC/IO_HEPEVT.h" - -namespace Herwig { -using namespace ThePEG; - -/** - * Enumeration for the different types of reconstructed objects - */ -enum ObjectType { - Photon=0, /**< Photons */ - Electron, /**< Electrons */ - Muon, /**< Muons */ - Tau, /**< Taus */ - Jet, /**< Jets */ - HeavyCharged /**< Heavy Charged Objects */ -}; - -/** - * Enumeration for the type of b-tag - */ -enum bTag { - None=0, /**< No b-tag */ - Loose, /**< Loose b-tag */ - Tight, /**< Tight b-tag */ - Both , /**< Both loose and tight b-tag */ -}; - -/** - * Struct to store the properties of the reconstructed objects - */ -struct ReconstructedObject { - - /** - * Type of object - */ - ObjectType type; - - /** - * Momentum of the object - */ - Lorentz5Momentum momentum; - - /** - * Charge of the particle - */ - double charge; - - /** - * Electromagnetic energy - */ - Energy emenergy; - - /** - * Hadronic energy - */ - Energy hadenergy; - - /** - * Track energy - */ - Energy trackenergy; - - /** - * Number of tracks - */ - int numtracks; - - /** - * PDG Code for the particle - */ - int PDGcode; - - /** - * Whether it is a loose or tight b-tag - */ - bTag btagging; - - /** - * Transverse energy - */ - Energy ET; - - /** - * Transverse energy in the isolation cone - */ - Energy isolationET; - - /** - * Transverse momentum in the isolation cone - */ - Energy isolationpT; - - /** - * Ratio of hadronic to electromagentic energy - */ - double hadronicem; - - /** - * Ratio of electromagnetic energy to track momentum - */ - double ep; - - /** - * track isolation energy - */ - Energy trkisoEnergy; - - /** - * Number of pi0 in cone for tau - */ - int npi0; - - /** - * Sum of pt of pi0 not in cone for tau - */ - Energy taupTpi0; - - /** - * Sum of pt of tracks not in cone for tau - */ - Energy taupTtracks; - - /** - * pT of highest track in tau decays - */ - Energy ptHightestTrack; - - /** - * Cluster width - */ - Energy clusterWidth; -}; - -/** - * Here is the documentation of the PGSInterface class. - * - * @see \ref PGSInterfaceInterfaces "The interfaces" - * defined for PGSInterface. - */ -class PGSInterface: public AnalysisHandler { - -public: - - /** - * The default constructor. - */ - inline PGSInterface() : _pgs_param_file("lhc.par") - {} - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - - /** - * Public access to the reconstructed objects - */ - inline vector reconstructedObjects() const { - return _objects; - } - - /** - * Missing transverse energy in calorimeter and azimuthal angle - */ - inline pair missingETCalorimeter() const { - return _calorimeterMET; - } - /** - * Missing transverse energy after muon correction and azimuthal angle - */ - inline pair missingETCorrected() const { - return _muonMET; - } - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - PGSInterface & operator=(const PGSInterface &) = delete; - -private: - - /** - * Converter from HepMC to HEPEVT - */ - HepMC::IO_HEPEVT * _converter; - - /** - * file name for the PGS parameters - */ - string _pgs_param_file; - - /** - * The reconstructed objects after PGS - */ - vector _objects; - - /** - * missing ET measured in calorimeter - */ - pair _calorimeterMET; - - /** - * missing ET aftrer muon correction - */ - pair _muonMET; -}; - -} - -#endif /* HERWIG_PGSInterface_H */ diff --git a/Contrib/PGSInterface/ZAnalysis.cc b/Contrib/PGSInterface/ZAnalysis.cc deleted file mode 100644 --- a/Contrib/PGSInterface/ZAnalysis.cc +++ /dev/null @@ -1,101 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the ZAnalysis class. -// - -#include "ZAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" - -using namespace Herwig; - -ZAnalysis::ZAnalysis() : ZmassHadron_(82.,102.,100), ZmassDetector_(82.,102.,100) -{} - -void ZAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - PGSInterface::analyze(event, ieve, loop, state); - // detector level - // require two opposite sign same flavour leptons - unsigned int neminus(0),neplus(0),nmuminus(0),nmuplus(0); - Lorentz5Momentum pz; - for(unsigned int ix=0;ixprimaryCollision()->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; - pz = LorentzMomentum(); - 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=(*iter)->momentum(); - double mz = pz.mass()/GeV; - ZmassHadron_ += mz; - } - } - } -} - -IBPtr ZAnalysis::clone() const { - return new_ptr(*this); -} - -IBPtr ZAnalysis::fullclone() const { - return new_ptr(*this); -} - - -// If needed, insert default implementations of virtual function defined -// in the InterfacedBase class here (using ThePEG-interfaced-impl in Emacs). - - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigZAnalysis("Herwig::ZAnalysis", "HwPGSInterface.so ZAnalysis.so"); - -void ZAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the ZAnalysis class"); - -} - -void ZAnalysis::dofinish() { - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - string title; - using namespace HistogramOptions; - ZmassHadron_ .topdrawOutput(outfile,Frame,"BLACK","Z mass"); - ZmassDetector_.topdrawOutput(outfile,HistogramOptions::None,"RED"); - outfile.close(); - PGSInterface::dofinish(); -} diff --git a/Contrib/PGSInterface/ZAnalysis.h b/Contrib/PGSInterface/ZAnalysis.h deleted file mode 100644 --- a/Contrib/PGSInterface/ZAnalysis.h +++ /dev/null @@ -1,116 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_ZAnalysis_H -#define HERWIG_ZAnalysis_H -// -// This is the declaration of the ZAnalysis class. -// - -#include "PGSInterface.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The ZAnalysis class is a simple example of using the interface - * to PGS to look at the Z mass at the hadron and detector levels - * - * @see \ref ZAnalysisInterfaces "The interfaces" - * defined for ZAnalysis. - */ -class ZAnalysis: public PGSInterface { - -public: - - /** - * The default constructor. - */ - ZAnalysis(); - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. */ - //@{ - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - ZAnalysis & operator=(const ZAnalysis &) = delete; - -private: - - /** - * Z mass at the hadron level - */ - Histogram ZmassHadron_; - - /** - * Z mass at the detector level - */ - Histogram ZmassDetector_; - -}; - -} - -#endif /* HERWIG_ZAnalysis_H */ diff --git a/Contrib/PGSInterface/lhc.par b/Contrib/PGSInterface/lhc.par deleted file mode 100644 --- a/Contrib/PGSInterface/lhc.par +++ /dev/null @@ -1,23 +0,0 @@ -LHC ! parameter set name -320 ! eta cells in calorimeter -200 ! phi cells in calorimeter -0.0314159 ! eta width of calorimeter cells |eta| < 5 -0.0314159 ! phi width of calorimeter cells -0.0044 ! electromagnetic calorimeter resolution const -0.024 ! electromagnetic calorimeter resolution * sqrt(E) -0.8 ! hadronic calolrimeter resolution * sqrt(E) -0.2 ! MET resolution -0.01 ! calorimeter cell edge crack fraction -cone ! jet finding algorithm (cone or ktjet) -5.0 ! calorimeter trigger cluster finding seed threshold (GeV) -1.0 ! calorimeter trigger cluster finding shoulder threshold (GeV) -0.5 ! calorimeter kt cluster finder cone size (delta R) -2.0 ! outer radius of tracker (m) -4.0 ! magnetic field (T) -0.000013 ! sagitta resolution (m) -0.98 ! track finding efficiency -1.00 ! minimum track pt (GeV/c) -3.0 ! tracking eta coverage -3.0 ! e/gamma eta coverage -2.4 ! muon eta coverage -2.0 ! tau eta coverage diff --git a/Contrib/PGSInterface/mass_width_2004.mc b/Contrib/PGSInterface/mass_width_2004.mc deleted file mode 100644 --- a/Contrib/PGSInterface/mass_width_2004.mc +++ /dev/null @@ -1,360 +0,0 @@ -* -* MASSES, WIDTHS, AND MC ID NUMBERS FROM 2004 EDITION OF RPP -* -* The following values were generated on 22-Jun-2004 by the Berkeley Particle -* Data Group from the Review of Particle Properties database and are intended -* for use in Monte Carlo programs. -* -* For questions regarding distribution or content of this file, contact -* the Particle Data Group at pdg@lbl.gov. -* -* To process the images in this file: -* 1) ignore documentation lines that begin with an asterisk -* 2) in a FORTRAN program, process data lines with -* FORMAT (BN, A1, 4I8, 1X, E15.0, 2(1X, E8.0), 1X, A21) -* 3) column 1 contains either "M" or "W" indicating mass or width -* 2 - 9 \ Monte Carlo particle numbers as described in the "Review of -* 10 - 17 | Particle Properties". Charge states appear, as appropriate, -* 18 - 25 | from left-to-right in the order -, 0, +, ++. -* 26 - 33 / -* 34 blank -* 35 - 49 central value of the mass or width (double precision) -* 50 blank -* 51 - 58 positive error -* 59 blank -* 60 - 67 negative error -* 68 blank -* 69 - 89 particle name left-justified in the field and -* charge states right-justified in the field. -* This field is for ease of visual examination of the file and -* should not be taken as a standardized presentation of -* particle names. -* -* Particle ID(s) Value (GeV) Errors (GeV) Name Charges -M 22 0.E+00 +0.0E+00 -0.0E+00 gamma 0 -W 22 0.E+00 +0.0E+00 -0.0E+00 gamma 0 -M 24 8.042E+01 +4.0E-02 -4.0E-02 W + -W 24 2.12E+00 +4.0E-02 -4.0E-02 W + -M 23 9.11876E+01 +2.1E-03 -2.1E-03 Z 0 -W 23 2.4952E+00 +2.3E-03 -2.3E-03 Z 0 -W 11 0.E+00 +0.0E+00 -0.0E+00 e - -M 11 5.1099892E-04 +4.0E-11 -4.0E-11 e - -M 13 1.05658369E-01 +9.0E-09 -9.0E-09 mu - -W 13 2.99591E-19 +5.0E-24 -5.0E-24 mu - -M 15 1.77699E+00 +2.9E-04 -2.6E-04 tau - -W 15 2.265E-12 +9.0E-15 -9.0E-15 tau - -M 12 0.E+00 +0.0E+00 -0.0E+00 nu(e) 0 -W 12 0.E+00 +0.0E+00 -0.0E+00 nu(e) 0 -M 14 0.E+00 +0.0E+00 -0.0E+00 nu(mu) 0 -W 14 0.E+00 +0.0E+00 -0.0E+00 nu(mu) 0 -M 16 0.E+00 +0.0E+00 -0.0E+00 nu(tau) 0 -W 16 0.E+00 +0.0E+00 -0.0E+00 nu(tau) 0 -M 6 1.74E+02 +5.0E+00 -5.0E+00 t 2/3 -M 211 1.3957018E-01 +3.5E-07 -3.5E-07 pi + -W 211 2.5284E-17 +5.0E-21 -5.0E-21 pi + -M 111 1.349766E-01 +6.0E-07 -6.0E-07 pi 0 -W 111 7.8E-09 +6.0E-10 -5.0E-10 pi 0 -M 221 5.4775E-01 +1.2E-04 -1.2E-04 eta 0 -W 221 1.29E-06 +7.0E-08 -7.0E-08 eta 0 -M 113 213 7.758E-01 +5.0E-04 -5.0E-04 rho(770) 0,+ -W 113 213 1.503E-01 +1.6E-03 -1.6E-03 rho(770) 0,+ -M 223 7.8259E-01 +1.1E-04 -1.1E-04 omega(782) 0 -W 223 8.49E-03 +8.0E-05 -8.0E-05 omega(782) 0 -M 331 9.5778E-01 +1.4E-04 -1.4E-04 eta'(958) 0 -W 331 2.02E-04 +1.6E-05 -1.6E-05 eta'(958) 0 -M 9010221 9.80E-01 +1.0E-02 -1.0E-02 f(0)(980) 0 -M 9000111 9000211 9.847E-01 +1.2E-03 -1.2E-03 a(0)(980) 0,+ -M 333 1.019456E+00 +2.0E-05 -2.0E-05 phi(1020) 0 -W 333 4.26E-03 +5.0E-05 -5.0E-05 phi(1020) 0 -M 10223 1.170E+00 +2.0E-02 -2.0E-02 h(1)(1170) 0 -W 10223 3.6E-01 +4.0E-02 -4.0E-02 h(1)(1170) 0 -M 10113 10213 1.2295E+00 +3.2E-03 -3.2E-03 b(1)(1235) 0,+ -W 10113 10213 1.42E-01 +9.0E-03 -9.0E-03 b(1)(1235) 0,+ -M 20113 20213 1.23E+00 +4.0E-02 -4.0E-02 a(1)(1260) 0,+ -M 225 1.2754E+00 +1.2E-03 -1.2E-03 f(2)(1270) 0 -W 225 1.851E-01 +3.5E-03 -2.6E-03 f(2)(1270) 0 -M 20223 1.2818E+00 +6.0E-04 -6.0E-04 f(1)(1285) 0 -W 20223 2.41E-02 +1.1E-03 -1.1E-03 f(1)(1285) 0 -M 100221 1.294E+00 +4.0E-03 -4.0E-03 eta(1295) 0 -W 100221 5.5E-02 +5.0E-03 -5.0E-03 eta(1295) 0 -M 100111 100211 1.30E+00 +1.0E-01 -1.0E-01 pi(1300) 0,+ -M 115 215 1.3183E+00 +6.0E-04 -6.0E-04 a(2)(1320) 0,+ -W 115 215 1.07E-01 +5.0E-03 -5.0E-03 a(2)(1320) 0,+ -M 9000113 9000213 1.376E+00 +1.7E-02 -1.7E-02 pi(1)(1400) 0,+ -W 9000113 9000213 3.0E-01 +4.0E-02 -4.0E-02 pi(1)(1400) 0,+ -M 9020221 1.4103E+00 +2.6E-03 -2.6E-03 eta(1405) 0 -W 9020221 5.1E-02 +4.0E-03 -4.0E-03 eta(1405) 0 -M 20333 1.4263E+00 +9.0E-04 -9.0E-04 f(1)(1420) 0 -W 20333 5.49E-02 +2.6E-03 -2.6E-03 f(1)(1420) 0 -M 10111 10211 1.474E+00 +1.9E-02 -1.9E-02 a(0)(1450) 0,+ -W 10111 10211 2.65E-01 +1.3E-02 -1.3E-02 a(0)(1450) 0,+ -M 100113 100213 1.465E+00 +2.5E-02 -2.5E-02 rho(1450) 0,+ -W 100113 100213 4.0E-01 +6.0E-02 -6.0E-02 rho(1450) 0,+ -M 100331 1.476E+00 +4.0E-03 -4.0E-03 eta(1475) 0 -W 100331 8.7E-02 +9.0E-03 -9.0E-03 eta(1475) 0 -M 9030221 1.507E+00 +5.0E-03 -5.0E-03 f(0)(1500) 0 -W 9030221 1.09E-01 +7.0E-03 -7.0E-03 f(0)(1500) 0 -M 335 1.525E+00 +5.0E-03 -5.0E-03 f(2)'(1525) 0 -W 335 7.3E-02 +6.0E-03 -5.0E-03 f(2)'(1525) 0 -M 9010113 9010213 1.596E+00 +2.5E-02 -1.4E-02 pi(1)(1600) 0,+ -W 9010113 9010213 3.12E-01 +6.4E-02 -2.4E-02 pi(1)(1600) 0,+ -M 10225 1.617E+00 +5.0E-03 -5.0E-03 eta(2)(1645) 0 -W 10225 1.81E-01 +1.1E-02 -1.1E-02 eta(2)(1645) 0 -M 30223 1.670E+00 +3.0E-02 -3.0E-02 omega(1650) 0 -W 30223 3.15E-01 +3.5E-02 -3.5E-02 omega(1650) 0 -M 227 1.667E+00 +4.0E-03 -4.0E-03 omega(3)(1670) 0 -W 227 1.68E-01 +1.0E-02 -1.0E-02 omega(3)(1670) 0 -M 10115 10215 1.6724E+00 +3.2E-03 -3.2E-03 pi(2)(1670) 0,+ -W 10115 10215 2.59E-01 +9.0E-03 -9.0E-03 pi(2)(1670) 0,+ -M 100333 1.680E+00 +2.0E-02 -2.0E-02 phi(1680) 0 -W 100333 1.5E-01 +5.0E-02 -5.0E-02 phi(1680) 0 -M 117 217 1.6888E+00 +2.1E-03 -2.1E-03 rho(3)(1690) 0,+ -W 117 217 1.61E-01 +1.0E-02 -1.0E-02 rho(3)(1690) 0,+ -M 30113 30213 1.720E+00 +2.0E-02 -2.0E-02 rho(1700) 0,+ -W 30113 30213 2.5E-01 +1.0E-01 -1.0E-01 rho(1700) 0,+ -M 10331 1.714E+00 +5.0E-03 -5.0E-03 f(0)(1710) 0 -W 10331 1.40E-01 +1.0E-02 -1.0E-02 f(0)(1710) 0 -M 9010111 9010211 1.812E+00 +1.4E-02 -1.4E-02 pi(1800) 0,+ -W 9010111 9010211 2.07E-01 +1.3E-02 -1.3E-02 pi(1800) 0,+ -M 337 1.854E+00 +7.0E-03 -7.0E-03 phi(3)(1850) 0 -W 337 8.7E-02 +2.8E-02 -2.3E-02 phi(3)(1850) 0 -M 9050225 1.945E+00 +1.3E-02 -1.3E-02 f(2)(1950) 0 -W 9050225 4.75E-01 +1.9E-02 -1.9E-02 f(2)(1950) 0 -M 9060225 2.01E+00 +6.0E-02 -8.0E-02 f(2)(2010) 0 -W 9060225 2.0E-01 +6.0E-02 -6.0E-02 f(2)(2010) 0 -M 119 219 2.010E+00 +1.2E-02 -1.2E-02 a(4)(2040) 0,+ -W 119 219 3.5E-01 +4.0E-02 -4.0E-02 a(4)(2040) 0,+ -M 229 2.034E+00 +1.1E-02 -1.1E-02 f(4)(2050) 0 -W 229 2.22E-01 +1.9E-02 -1.9E-02 f(4)(2050) 0 -M 9080225 2.297E+00 +2.8E-02 -2.8E-02 f(2)(2300) 0 -W 9080225 1.5E-01 +4.0E-02 -4.0E-02 f(2)(2300) 0 -M 9090225 2.34E+00 +6.0E-02 -6.0E-02 f(2)(2340) 0 -W 9090225 3.2E-01 +8.0E-02 -7.0E-02 f(2)(2340) 0 -M 321 4.93677E-01 +1.6E-05 -1.6E-05 K + -W 321 5.315E-17 +1.0E-19 -1.0E-19 K + -M 311 4.97648E-01 +2.2E-05 -2.2E-05 K 0 -M 310 4.97648E-01 +2.2E-05 -2.2E-05 K(S) 0 -M 130 4.97648E-01 +2.2E-05 -2.2E-05 K(L) 0 -W 310 7.352E-15 +5.0E-18 -5.0E-18 K(S) 0 -W 130 1.272E-17 +1.0E-19 -1.0E-19 K(L) 0 -M 323 8.9166E-01 +2.6E-04 -2.6E-04 K*(892) + -M 313 8.9610E-01 +2.7E-04 -2.7E-04 K*(892) 0 -W 323 5.08E-02 +9.0E-04 -9.0E-04 K*(892) + -W 313 5.07E-02 +6.0E-04 -6.0E-04 K*(892) 0 -M 10313 10323 1.272E+00 +7.0E-03 -7.0E-03 K(1)(1270) 0,+ -W 10313 10323 9.0E-02 +2.0E-02 -2.0E-02 K(1)(1270) 0,+ -M 20313 20323 1.402E+00 +7.0E-03 -7.0E-03 K(1)(1400) 0,+ -W 20313 20323 1.74E-01 +1.3E-02 -1.3E-02 K(1)(1400) 0,+ -M 100313 100323 1.414E+00 +1.5E-02 -1.5E-02 K*(1410) 0,+ -W 100313 100323 2.32E-01 +2.1E-02 -2.1E-02 K*(1410) 0,+ -M 10311 10321 1.412E+00 +6.0E-03 -6.0E-03 K(0)*(1430) 0,+ -W 10311 10321 2.94E-01 +2.3E-02 -2.3E-02 K(0)*(1430) 0,+ -M 325 1.4256E+00 +1.5E-03 -1.5E-03 K(2)*(1430) + -M 315 1.4324E+00 +1.3E-03 -1.3E-03 K(2)*(1430) 0 -W 325 9.85E-02 +2.7E-03 -2.7E-03 K(2)*(1430) + -W 315 1.09E-01 +5.0E-03 -5.0E-03 K(2)*(1430) 0 -M 30313 30323 1.717E+00 +2.7E-02 -2.7E-02 K*(1680) 0,+ -W 30313 30323 3.2E-01 +1.1E-01 -1.1E-01 K*(1680) 0,+ -M 10315 10325 1.773E+00 +8.0E-03 -8.0E-03 K(2)(1770) 0,+ -W 10315 10325 1.86E-01 +1.4E-02 -1.4E-02 K(2)(1770) 0,+ -M 317 327 1.776E+00 +7.0E-03 -7.0E-03 K(3)*(1780) 0,+ -W 317 327 1.59E-01 +2.1E-02 -2.1E-02 K(3)*(1780) 0,+ -M 20315 20325 1.816E+00 +1.3E-02 -1.3E-02 K(2)(1820) 0,+ -W 20315 20325 2.76E-01 +3.5E-02 -3.5E-02 K(2)(1820) 0,+ -M 319 329 2.045E+00 +9.0E-03 -9.0E-03 K(4)*(2045) 0,+ -W 319 329 1.98E-01 +3.0E-02 -3.0E-02 K(4)*(2045) 0,+ -M 411 1.8694E+00 +5.0E-04 -5.0E-04 D + -W 411 6.33E-13 +4.0E-15 -4.0E-15 D + -M 421 1.8646E+00 +5.0E-04 -5.0E-04 D 0 -W 421 1.604E-12 +6.0E-15 -6.0E-15 D 0 -M 423 2.0067E+00 +5.0E-04 -5.0E-04 D*(2007) 0 -M 413 2.0100E+00 +5.0E-04 -5.0E-04 D*(2010) + -W 413 9.6E-05 +2.2E-05 -2.2E-05 D*(2010) + -M 10423 2.4222E+00 +1.8E-03 -1.8E-03 D(1)(2420) 0 -W 10423 1.89E-02 +4.6E-03 -3.5E-03 D(1)(2420) 0 -M 425 2.4589E+00 +2.0E-03 -2.0E-03 D(2)*(2460) 0 -W 425 2.3E-02 +5.0E-03 -5.0E-03 D(2)*(2460) 0 -M 415 2.459E+00 +4.0E-03 -4.0E-03 D(2)*(2460) + -W 415 2.5E-02 +8.0E-03 -7.0E-03 D(2)*(2460) + -M 431 1.9683E+00 +5.0E-04 -5.0E-04 D(s) + -W 431 1.342E-12 +2.6E-14 -2.6E-14 D(s) + -M 433 2.1121E+00 +7.0E-04 -7.0E-04 D(s)* + -M 10431 2.3174E+00 +9.0E-04 -9.0E-04 D(sJ)(2317) + -M 20433 2.4593E+00 +1.3E-03 -1.3E-03 D(sJ)(2460) + -M 10433 2.5353E+00 +6.0E-04 -6.0E-04 D(s1)(2536) + -M 435 2.5724E+00 +1.5E-03 -1.5E-03 D(s2)(2573) + -W 435 1.5E-02 +5.0E-03 -4.0E-03 D(s2)(2573) + -M 521 5.2790E+00 +5.0E-04 -5.0E-04 B + -W 521 3.94E-13 +4.0E-15 -4.0E-15 B + -M 511 5.2794E+00 +5.0E-04 -5.0E-04 B 0 -W 511 4.29E-13 +4.0E-15 -4.0E-15 B 0 -M 513 523 5.3250E+00 +6.0E-04 -6.0E-04 B* 0,+ -M 531 5.3696E+00 +2.4E-03 -2.4E-03 B(s) 0 -W 531 4.51E-13 +1.8E-14 -1.8E-14 B(s) 0 -M 541 6.4E+00 +4.0E-01 -4.0E-01 B(c) + -W 541 1.4E-12 +8.0E-13 -4.0E-13 B(c) + -M 441 2.9796E+00 +1.2E-03 -1.2E-03 eta(c)(1S) 0 -W 441 1.73E-02 +2.7E-03 -2.5E-03 eta(c)(1S) 0 -M 443 3.096916E+00 +1.1E-05 -1.1E-05 J/psi(1S) 0 -W 443 9.10E-05 +3.2E-06 -3.2E-06 J/psi(1S) 0 -M 10441 3.41519E+00 +3.4E-04 -3.4E-04 chi(c0)(1P) 0 -W 10441 1.01E-02 +8.0E-04 -8.0E-04 chi(c0)(1P) 0 -M 20443 3.51059E+00 +1.0E-04 -1.0E-04 chi(c1)(1P) 0 -W 20443 9.1E-04 +1.3E-04 -1.3E-04 chi(c1)(1P) 0 -M 445 3.55626E+00 +1.1E-04 -1.1E-04 chi(c2)(1P) 0 -W 445 2.11E-03 +1.6E-04 -1.6E-04 chi(c2)(1P) 0 -M 100443 3.686093E+00 +3.4E-05 -3.4E-05 psi(2S) 0 -W 100443 2.81E-04 +1.7E-05 -1.7E-05 psi(2S) 0 -M 30443 3.7700E+00 +2.4E-03 -2.4E-03 psi(3770) 0 -W 30443 2.36E-02 +2.7E-03 -2.7E-03 psi(3770) 0 -M 9000443 4.040E+00 +1.0E-02 -1.0E-02 psi(4040) 0 -W 9000443 5.2E-02 +1.0E-02 -1.0E-02 psi(4040) 0 -M 9010443 4.159E+00 +2.0E-02 -2.0E-02 psi(4160) 0 -W 9010443 7.8E-02 +2.0E-02 -2.0E-02 psi(4160) 0 -M 9020443 4.415E+00 +6.0E-03 -6.0E-03 psi(4415) 0 -W 9020443 4.3E-02 +1.5E-02 -1.5E-02 psi(4415) 0 -M 553 9.46030E+00 +2.6E-04 -2.6E-04 Upsilon(1S) 0 -W 553 5.30E-05 +1.5E-06 -1.5E-06 Upsilon(1S) 0 -M 10551 9.8599E+00 +1.0E-03 -1.0E-03 chi(b0)(1P) 0 -M 20553 9.8927E+00 +6.0E-04 -6.0E-04 chi(b1)(1P) 0 -M 555 9.9126E+00 +5.0E-04 -5.0E-04 chi(b2)(1P) 0 -M 100553 1.002326E+01 +3.1E-04 -3.1E-04 Upsilon(2S) 0 -W 100553 4.3E-05 +6.0E-06 -6.0E-06 Upsilon(2S) 0 -M 110551 1.02321E+01 +6.0E-04 -6.0E-04 chi(b0)(2P) 0 -M 120553 1.02552E+01 +5.0E-04 -5.0E-04 chi(b1)(2P) 0 -M 100555 1.02685E+01 +4.0E-04 -4.0E-04 chi(b2)(2P) 0 -M 200553 1.03552E+01 +5.0E-04 -5.0E-04 Upsilon(3S) 0 -W 200553 2.63E-05 +3.4E-06 -3.4E-06 Upsilon(3S) 0 -M 300553 1.05800E+01 +3.5E-03 -3.5E-03 Upsilon(4S) 0 -W 300553 2.0E-02 +4.0E-03 -4.0E-03 Upsilon(4S) 0 -M 9000553 1.0865E+01 +8.0E-03 -8.0E-03 Upsilon(10860) 0 -W 9000553 1.10E-01 +1.3E-02 -1.3E-02 Upsilon(10860) 0 -M 9010553 1.1019E+01 +8.0E-03 -8.0E-03 Upsilon(11020) 0 -W 9010553 7.9E-02 +1.6E-02 -1.6E-02 Upsilon(11020) 0 -W 2212 0.E+00 +0.0E+00 -0.0E+00 p + -M 2212 9.3827203E-01 +8.0E-08 -8.0E-08 p + -M 2112 9.3956536E-01 +8.0E-08 -8.0E-08 n 0 -W 2112 7.431E-28 +7.0E-31 -7.0E-31 n 0 -M 12112 12212 1.440E+00 +3.0E-02 -1.0E-02 N(1440) 0,+ -W 12112 12212 3.5E-01 +1.0E-01 -1.0E-01 N(1440) 0,+ -M 1214 2124 1.520E+00 +1.0E-02 -5.0E-03 N(1520) 0,+ -W 1214 2124 1.20E-01 +1.5E-02 -1.0E-02 N(1520) 0,+ -M 22112 22212 1.535E+00 +2.0E-02 -1.5E-02 N(1535) 0,+ -W 22112 22212 1.5E-01 +5.0E-02 -5.0E-02 N(1535) 0,+ -M 32112 32212 1.650E+00 +3.0E-02 -1.0E-02 N(1650) 0,+ -W 32112 32212 1.50E-01 +4.0E-02 -5.0E-03 N(1650) 0,+ -M 2116 2216 1.675E+00 +1.0E-02 -5.0E-03 N(1675) 0,+ -W 2116 2216 1.50E-01 +3.0E-02 -1.0E-02 N(1675) 0,+ -M 12116 12216 1.680E+00 +1.0E-02 -5.0E-03 N(1680) 0,+ -W 12116 12216 1.30E-01 +1.0E-02 -1.0E-02 N(1680) 0,+ -M 21214 22124 1.70E+00 +5.0E-02 -5.0E-02 N(1700) 0,+ -W 21214 22124 1.0E-01 +5.0E-02 -5.0E-02 N(1700) 0,+ -M 42112 42212 1.710E+00 +3.0E-02 -3.0E-02 N(1710) 0,+ -W 42112 42212 1.0E-01 +1.5E-01 -5.0E-02 N(1710) 0,+ -M 31214 32124 1.720E+00 +3.0E-02 -7.0E-02 N(1720) 0,+ -W 31214 32124 1.5E-01 +5.0E-02 -5.0E-02 N(1720) 0,+ -M 1218 2128 2.190E+00 +1.0E-02 -9.0E-02 N(2190) 0,+ -W 1218 2128 4.5E-01 +1.0E-01 -1.0E-01 N(2190) 0,+ -M 1114 2114 2214 2224 1.2320E+00 +2.0E-03 -2.0E-03 Delta(1232) -,0,+,++ -W 1114 2114 2214 2224 1.20E-01 +5.0E-03 -5.0E-03 Delta(1232) -,0,+,++ -M 31114 32114 32214 32224 1.60E+00 +1.0E-01 -5.0E-02 Delta(1600) -,0,+,++ -W 31114 32114 32214 32224 3.5E-01 +1.0E-01 -1.0E-01 Delta(1600) -,0,+,++ -M 1112 1212 2122 2222 1.620E+00 +6.0E-02 -5.0E-03 Delta(1620) -,0,+,++ -W 1112 1212 2122 2222 1.50E-01 +3.0E-02 -3.0E-02 Delta(1620) -,0,+,++ -M 11114 12114 12214 12224 1.700E+00 +7.0E-02 -3.0E-02 Delta(1700) -,0,+,++ -W 11114 12114 12214 12224 3.0E-01 +1.0E-01 -1.0E-01 Delta(1700) -,0,+,++ -M 1116 1216 2126 2226 1.905E+00 +1.5E-02 -3.5E-02 Delta(1905) -,0,+,++ -W 1116 1216 2126 2226 3.5E-01 +9.0E-02 -7.0E-02 Delta(1905) -,0,+,++ -M 21112 21212 22122 22222 1.910E+00 +1.0E-02 -4.0E-02 Delta(1910) -,0,+,++ -W 21112 21212 22122 22222 2.50E-01 +2.0E-02 -6.0E-02 Delta(1910) -,0,+,++ -M 21114 22114 22214 22224 1.920E+00 +5.0E-02 -2.0E-02 Delta(1920) -,0,+,++ -W 21114 22114 22214 22224 2.0E-01 +1.0E-01 -5.0E-02 Delta(1920) -,0,+,++ -M 11116 11216 12126 12226 1.930E+00 +4.0E-02 -1.0E-02 Delta(1930) -,0,+,++ -W 11116 11216 12126 12226 3.5E-01 +1.0E-01 -1.0E-01 Delta(1930) -,0,+,++ -M 1118 2118 2218 2228 1.950E+00 +1.0E-02 -1.0E-02 Delta(1950) -,0,+,++ -W 1118 2118 2218 2228 3.00E-01 +5.0E-02 -1.0E-02 Delta(1950) -,0,+,++ -M 9221132 1.5392E+00 +1.6E-03 -1.6E-03 Theta(1540) + -W 9221132 9.0E-04 +3.0E-04 -3.0E-04 Theta(1540) + -M 3122 1.115683E+00 +6.0E-06 -6.0E-06 Lambda 0 -W 3122 2.501E-15 +1.9E-17 -1.9E-17 Lambda 0 -M 13122 1.407E+00 +4.0E-03 -4.0E-03 Lambda(1405) 0 -W 13122 5.00E-02 +2.0E-03 -2.0E-03 Lambda(1405) 0 -M 3124 1.5195E+00 +1.0E-03 -1.0E-03 Lambda(1520) 0 -W 3124 1.56E-02 +1.0E-03 -1.0E-03 Lambda(1520) 0 -M 23122 1.60E+00 +1.0E-01 -4.0E-02 Lambda(1600) 0 -W 23122 1.5E-01 +1.0E-01 -1.0E-01 Lambda(1600) 0 -M 33122 1.670E+00 +1.0E-02 -1.0E-02 Lambda(1670) 0 -W 33122 3.5E-02 +1.5E-02 -1.0E-02 Lambda(1670) 0 -M 13124 1.690E+00 +5.0E-03 -5.0E-03 Lambda(1690) 0 -W 13124 6.0E-02 +1.0E-02 -1.0E-02 Lambda(1690) 0 -M 43122 1.80E+00 +5.0E-02 -8.0E-02 Lambda(1800) 0 -W 43122 3.0E-01 +1.0E-01 -1.0E-01 Lambda(1800) 0 -M 53122 1.81E+00 +4.0E-02 -6.0E-02 Lambda(1810) 0 -W 53122 1.5E-01 +1.0E-01 -1.0E-01 Lambda(1810) 0 -M 3126 1.820E+00 +5.0E-03 -5.0E-03 Lambda(1820) 0 -W 3126 8.0E-02 +1.0E-02 -1.0E-02 Lambda(1820) 0 -M 13126 1.830E+00 +0.0E+00 -2.0E-02 Lambda(1830) 0 -W 13126 9.5E-02 +1.5E-02 -3.5E-02 Lambda(1830) 0 -M 23124 1.890E+00 +2.0E-02 -4.0E-02 Lambda(1890) 0 -W 23124 1.0E-01 +1.0E-01 -4.0E-02 Lambda(1890) 0 -M 3128 2.100E+00 +1.0E-02 -1.0E-02 Lambda(2100) 0 -W 3128 2.0E-01 +5.0E-02 -1.0E-01 Lambda(2100) 0 -M 23126 2.110E+00 +3.0E-02 -2.0E-02 Lambda(2110) 0 -W 23126 2.0E-01 +5.0E-02 -5.0E-02 Lambda(2110) 0 -M 3222 1.18937E+00 +7.0E-05 -7.0E-05 Sigma + -W 3222 8.209E-15 +2.7E-17 -2.7E-17 Sigma + -M 3212 1.192642E+00 +2.4E-05 -2.4E-05 Sigma 0 -W 3212 8.9E-06 +9.0E-07 -8.0E-07 Sigma 0 -M 3112 1.197449E+00 +3.0E-05 -3.0E-05 Sigma - -W 3112 4.450E-15 +3.2E-17 -3.2E-17 Sigma - -M 3224 1.3828E+00 +4.0E-04 -4.0E-04 Sigma(1385) + -M 3214 1.3837E+00 +1.0E-03 -1.0E-03 Sigma(1385) 0 -M 3114 1.3872E+00 +5.0E-04 -5.0E-04 Sigma(1385) - -W 3224 3.58E-02 +8.0E-04 -8.0E-04 Sigma(1385) + -W 3214 3.6E-02 +5.0E-03 -5.0E-03 Sigma(1385) 0 -W 3114 3.94E-02 +2.1E-03 -2.1E-03 Sigma(1385) - -M 13112 13212 13222 1.660E+00 +3.0E-02 -3.0E-02 Sigma(1660) -,0,+ -W 13112 13212 13222 1.0E-01 +1.0E-01 -6.0E-02 Sigma(1660) -,0,+ -M 13114 13214 13224 1.670E+00 +1.5E-02 -5.0E-03 Sigma(1670) -,0,+ -W 13114 13214 13224 6.0E-02 +2.0E-02 -2.0E-02 Sigma(1670) -,0,+ -M 23112 23212 23222 1.750E+00 +5.0E-02 -2.0E-02 Sigma(1750) -,0,+ -W 23112 23212 23222 9.0E-02 +7.0E-02 -3.0E-02 Sigma(1750) -,0,+ -M 3116 3216 3226 1.775E+00 +5.0E-03 -5.0E-03 Sigma(1775) -,0,+ -W 3116 3216 3226 1.20E-01 +1.5E-02 -1.5E-02 Sigma(1775) -,0,+ -M 13116 13216 13226 1.915E+00 +2.0E-02 -1.5E-02 Sigma(1915) -,0,+ -W 13116 13216 13226 1.2E-01 +4.0E-02 -4.0E-02 Sigma(1915) -,0,+ -M 23114 23214 23224 1.940E+00 +1.0E-02 -4.0E-02 Sigma(1940) -,0,+ -W 23114 23214 23224 2.2E-01 +8.0E-02 -7.0E-02 Sigma(1940) -,0,+ -M 3118 3218 3228 2.030E+00 +1.0E-02 -5.0E-03 Sigma(2030) -,0,+ -W 3118 3218 3228 1.80E-01 +2.0E-02 -3.0E-02 Sigma(2030) -,0,+ -M 3322 1.31483E+00 +2.0E-04 -2.0E-04 Xi 0 -W 3322 2.27E-15 +7.0E-17 -7.0E-17 Xi 0 -M 3312 1.32131E+00 +1.3E-04 -1.3E-04 Xi - -W 3312 4.02E-15 +4.0E-17 -4.0E-17 Xi - -M 3324 1.53180E+00 +3.2E-04 -3.2E-04 Xi(1530) 0 -M 3314 1.5350E+00 +6.0E-04 -6.0E-04 Xi(1530) - -W 3324 9.1E-03 +5.0E-04 -5.0E-04 Xi(1530) 0 -W 3314 9.9E-03 +1.7E-03 -1.9E-03 Xi(1530) - -M 13314 13324 1.823E+00 +5.0E-03 -5.0E-03 Xi(1820) -,0 -W 13314 13324 2.4E-02 +1.5E-02 -1.0E-02 Xi(1820) -,0 -M 3334 1.67245E+00 +2.9E-04 -2.9E-04 Omega - -W 3334 8.02E-15 +1.1E-16 -1.1E-16 Omega - -M 4122 2.2849E+00 +6.0E-04 -6.0E-04 Lambda(c) + -W 4122 3.30E-12 +9.0E-14 -9.0E-14 Lambda(c) + -M 14122 2.5939E+00 +8.0E-04 -8.0E-04 Lambda(c)(2593) + -W 14122 3.6E-03 +2.0E-03 -1.3E-03 Lambda(c)(2593) + -M 4222 2.4525E+00 +6.0E-04 -6.0E-04 Sigma(c)(2455) ++ -M 4212 2.4513E+00 +7.0E-04 -7.0E-04 Sigma(c)(2455) + -M 4112 2.4522E+00 +6.0E-04 -6.0E-04 Sigma(c)(2455) 0 -W 4222 2.23E-03 +3.0E-04 -3.0E-04 Sigma(c)(2455) ++ -W 4112 2.2E-03 +4.0E-04 -4.0E-04 Sigma(c)(2455) 0 -M 4232 2.4663E+00 +1.4E-03 -1.4E-03 Xi(c) + -W 4232 1.49E-12 +9.0E-14 -9.0E-14 Xi(c) + -M 4132 2.4718E+00 +1.4E-03 -1.4E-03 Xi(c) 0 -W 4132 5.9E-12 +6.0E-13 -6.0E-13 Xi(c) 0 -M 4322 2.5741E+00 +3.3E-03 -3.3E-03 Xi(c)' + -M 4312 2.5788E+00 +3.2E-03 -3.2E-03 Xi(c)' 0 -M 4332 2.6975E+00 +2.6E-03 -2.6E-03 Omega(c) 0 -W 4332 9.6E-12 +2.1E-12 -1.4E-12 Omega(c) 0 -M 5122 5.624E+00 +9.0E-03 -9.0E-03 Lambda(b) 0 -W 5122 5.36E-13 +3.7E-14 -3.3E-14 Lambda(b) 0 diff --git a/Contrib/RadiativeZPrime/AnomalousVVVVertex.cc b/Contrib/RadiativeZPrime/AnomalousVVVVertex.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/AnomalousVVVVertex.cc +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the AnomalousVVVVertex class. -// - -#include "AnomalousVVVVertex.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Helicity/epsilon.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" - -using namespace RadiativeZPrime; - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeAbstractNoPIOClass -describeHerwigAnomalousVVVVertex("RadiativeZPrime::AnomalousVVVVertex", "RadiativeZPrime.so"); - -void AnomalousVVVVertex::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the AnomalousVVVVertex class"); - -} - -// evaluate the vertex -Complex AnomalousVVVVertex::evaluate(Energy2 q2, const VectorWaveFunction & vec1, - const VectorWaveFunction & vec2, - const VectorWaveFunction & vec3) { - // calculate the coupling - setCoupling(q2,vec1.particle(),vec2.particle(),vec3.particle()); - LorentzPolarizationVector eps = epsilon(vec1.wave(),vec2.wave(),vec3.wave()); - if(vec1.particle()->id()==ParticleID::gamma) - return norm()*Complex(0.,1.)*(eps*vec1.momentum())*UnitRemoval::InvE; - else if(vec2.particle()->id()==ParticleID::gamma) - return norm()*Complex(0.,1.)*(eps*vec2.momentum())*UnitRemoval::InvE; - else - return norm()*Complex(0.,1.)*(eps*vec3.momentum())*UnitRemoval::InvE; -} - -// off-shell vector -VectorWaveFunction AnomalousVVVVertex::evaluate(Energy2, int, tcPDPtr, - const VectorWaveFunction & , - const VectorWaveFunction &, - complex, - complex) { - throw Exception() << "AnomalousVVVVertex::evaluate() only implemented " - << "for the evaluation of the vertex, not for the " - << "evaluation of the off-shell vector wavefunction" - << Exception::runerror; -} diff --git a/Contrib/RadiativeZPrime/AnomalousVVVVertex.h b/Contrib/RadiativeZPrime/AnomalousVVVVertex.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/AnomalousVVVVertex.h +++ /dev/null @@ -1,107 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_AnomalousVVVVertex_H -#define RADIATIVEZPRIME_AnomalousVVVVertex_H -// -// This is the declaration of the AnomalousVVVVertex class. -// - -#include "ThePEG/Helicity/Vertex/AbstractVVVVertex.h" - -namespace RadiativeZPrime { - -using namespace ThePEG; -using namespace ThePEG::Helicity; - -/** - * The AnomalousVVVVertex class implements the anomalous Vector-Vector-Vector vertex. - * - * Only the member which evaluates the matrix element is implemented. The vertex - * is defined to be - * \[ i\epsilon_{\mu\nu\alpha\beta} - * \varepsilon^\mu_1 \varepsilon^\nu_2 \varepsilon^\alpha_2 p_1^\beta\] - * - * - * @see \ref AnomalousVVVVertexInterfaces "The interfaces" - * defined for AnomalousVVVVertex. - */ -class AnomalousVVVVertex: public AbstractVVVVertex { - -public: - - /** - * Members to calculate the helicity amplitude expressions for vertices - * and off-shell particles. - */ - //@{ - /** - * Evaluate the vertex. - * @param q2 The scale \f$q^2\f$ for the coupling at the vertex. - * @param vec1 The wavefunction for the first vector. - * @param vec2 The wavefunction for the second vector. - * @param vec3 The wavefunction for the third vector. - */ - virtual Complex evaluate(Energy2 q2, const VectorWaveFunction & vec1, - const VectorWaveFunction & vec2, - const VectorWaveFunction & vec3); - - /** - * Evaluate the off-shell vector coming from the vertex. - * @param q2 The scale \f$q^2\f$ for the coupling at the vertex. - * @param iopt Option of the shape of the Breit-Wigner for the off-shell vector. - * @param out The ParticleData pointer for the off-shell vector. - * @param vec2 The wavefunction for the second vector. - * @param vec3 The wavefunction for the third vector. - * @param mass The mass of the off-shell particle if not taken from the ParticleData - * object - * @param width The width of the off-shell particle if not taken from the ParticleData - * object - */ - virtual VectorWaveFunction evaluate(Energy2 q2,int iopt, tcPDPtr out, - const VectorWaveFunction & vec2, - const VectorWaveFunction & vec3, - complex mass=-GeV, - complex width=-GeV); - //@} - - /** - * Calculate the couplings. This method is virtual and must be implemented in - * classes inheriting from this. - * @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)=0; - - /** - * Dummy setCouplings for a four point interaction - * This method is virtual and must be implemented in - * classes inheriting from this. - */ - virtual void setCoupling(Energy2,tcPDPtr,tcPDPtr,tcPDPtr,tcPDPtr) { - assert(false); - } - -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(); - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - AnomalousVVVVertex & operator=(const AnomalousVVVVertex &) = delete; - -}; - -} - -#endif /* RADIATIVEZPRIME_AnomalousVVVVertex_H */ diff --git a/Contrib/RadiativeZPrime/FFZPrimeVertex.cc b/Contrib/RadiativeZPrime/FFZPrimeVertex.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/FFZPrimeVertex.cc +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the FFZPrimeVertex class. -// - -#include "FFZPrimeVertex.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "RadiativeZPrimeModel.h" - -using namespace RadiativeZPrime; - -void FFZPrimeVertex::persistentOutput(PersistentOStream & os) const { - os << _gl << _gr; -} - -void FFZPrimeVertex::persistentInput(PersistentIStream & is, int) { - is >> _gl >> _gr; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigFFZPrimeVertex("RadiativeZPrime::FFZPrimeVertex", "RadiativeZPrime.so"); - -void FFZPrimeVertex::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the FFZPrimeVertex class"); - -} - -void FFZPrimeVertex::setCoupling(Energy2 q2,tcPDPtr a,tcPDPtr,tcPDPtr) { - norm(1.); - // the left and right couplings - int iferm=abs(a->id()); - if((iferm>=1 && iferm<=6)||(iferm>=11 &&iferm<=16)) { - left(_gl[iferm]); - right(_gr[iferm]); - } - else - throw HelicityConsistencyError() << "FFZPrimeVertex::setCoupling " - << "Unknown particle in Z vertex" - << Exception::runerror; -} - -FFZPrimeVertex::FFZPrimeVertex() : _gl(17,0.0), _gr(17,0.0) { - // PDG codes for the particles - // the quarks - for(long ix=1;ix<7;++ix) { - addToList(-ix,ix,32); - } - // the leptons - for(long ix=11;ix<17;++ix) { - addToList(-ix,ix,32); - } -} - -void FFZPrimeVertex::doinit() { - tcSMPtr sm = generator()->standardModel(); - tcRadiativeZPrimeModelPtr model = - dynamic_ptr_cast(generator()->standardModel()); - double fact = 0.25*model->gZprime(); - for(int ix=1;ix<4;++ix) { - _gl[2*ix-1] = fact*(model->zPrimevd() + model->zPrimead() ); - _gl[2*ix ] = fact*(model->zPrimevu() + model->zPrimeau() ); - _gl[2*ix+9 ] = fact*(model->zPrimeve() + model->zPrimeae() ); - _gl[2*ix+10] = fact*(model->zPrimevnu() + model->zPrimeanu()); - _gr[2*ix-1] = fact*(model->zPrimevd() - model->zPrimead() ); - _gr[2*ix ] = fact*(model->zPrimevu() - model->zPrimeau() ); - _gr[2*ix+9 ] = fact*(model->zPrimeve() - model->zPrimeae() ); - _gr[2*ix+10] = fact*(model->zPrimevnu() - model->zPrimeanu()); - } - orderInGem(1); - orderInGs(0); - FFVVertex::doinit(); -} diff --git a/Contrib/RadiativeZPrime/FFZPrimeVertex.h b/Contrib/RadiativeZPrime/FFZPrimeVertex.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/FFZPrimeVertex.h +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_FFZPrimeVertex_H -#define RADIATIVEZPRIME_FFZPrimeVertex_H -// -// This is the declaration of the FFZPrimeVertex class. -// - -#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h" - -namespace RadiativeZPrime { - -using namespace ThePEG; - -/** - * Here is the documentation of the FFZPrimeVertex class. - * - * @see \ref FFZPrimeVertexInterfaces "The interfaces" - * defined for FFZPrimeVertex. - */ -class FFZPrimeVertex: public Helicity::FFVVertex { - -public: - - /** - * The default constructor. - */ - inline FFZPrimeVertex(); - - /** - * 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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** - * Initialize this object after the setup phase before saving and - * 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. - */ - FFZPrimeVertex & operator=(const FFZPrimeVertex &) = delete; - - - /** - * Storage of the couplings. - */ - //@{ - /** - * The left couplings of the Standard Model fermions. - */ - vector _gl; - - /** - * The right couplings of the Standard Model fermions. - */ - vector _gr; - //@} -}; - -} - -#endif /* RADIATIVEZPRIME_FFZPrimeVertex_H */ diff --git a/Contrib/RadiativeZPrime/GammaZPrimeZVertex.cc b/Contrib/RadiativeZPrime/GammaZPrimeZVertex.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/GammaZPrimeZVertex.cc +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the GammaZPrimeZVertex class. -// - -#include "GammaZPrimeZVertex.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "RadiativeZPrimeModel.h" - -using namespace RadiativeZPrime; - -void GammaZPrimeZVertex::persistentOutput(PersistentOStream & os) const { - os << _coup; -} - -void GammaZPrimeZVertex::persistentInput(PersistentIStream & is, int) { - is >> _coup; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigGammaZPrimeZVertex("RadiativeZPrime::GammaZPrimeZVertex", "RadiativeZPrime.so"); - -void GammaZPrimeZVertex::Init() { - - static ClassDocumentation documentation - ("The GammaZPrimeZVertex class implements the anomalous Z Z' gamma" - " vertex in the radiativeZPrimeModel"); - -} - -void GammaZPrimeZVertex::setCoupling(Energy2, tcPDPtr ,tcPDPtr,tcPDPtr) { - norm(_coup); -} - -GammaZPrimeZVertex::GammaZPrimeZVertex() { - // PDG codes for the particles - addToList(22,32,23); -} - -void GammaZPrimeZVertex::doinit() { - tcSMPtr sm = generator()->standardModel(); - tcRadiativeZPrimeModelPtr model = - dynamic_ptr_cast(generator()->standardModel()); - // calculate the coupling - double F=0.5*(2./3.+1./3.); - Energy2 scale = sqr(getParticleData(32)->mass()); - double sw = sqrt(model->sin2ThetaW()); - double cw = sqrt(1.-model->sin2ThetaW()); - _coup = 1./16/sqr(Constants::pi)*4.*Constants::pi*model->alphaEM(scale)/sw/cw* - model->gZprime()*F; - orderInGem(3); - orderInGs(0); - AbstractVVVVertex::doinit(); -} diff --git a/Contrib/RadiativeZPrime/GammaZPrimeZVertex.h b/Contrib/RadiativeZPrime/GammaZPrimeZVertex.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/GammaZPrimeZVertex.h +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_GammaZPrimeZVertex_H -#define RADIATIVEZPRIME_GammaZPrimeZVertex_H -// -// This is the declaration of the GammaZPrimeZVertex class. -// - -#include "AnomalousVVVVertex.h" - -namespace RadiativeZPrime { - -using namespace ThePEG; - -/** - * Here is the documentation of the GammaZPrimeZVertex class. - * - * @see \ref GammaZPrimeZVertexInterfaces "The interfaces" - * defined for GammaZPrimeZVertex. - */ -class GammaZPrimeZVertex: public AnomalousVVVVertex { - -public: - - /** - * The default constructor. - */ - GammaZPrimeZVertex(); - - /** - * Calculate the couplings. This method is virtual and must be implemented in - * classes inheriting from this. - * @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. - */ - inline 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. - */ - inline 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 assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - GammaZPrimeZVertex & operator=(const GammaZPrimeZVertex &) = delete; - -private: - - /** - * Storage of the coupling - */ - double _coup; - -}; - -} - -#endif /* RADIATIVEZPRIME_GammaZPrimeZVertex_H */ diff --git a/Contrib/RadiativeZPrime/LHC-RadiativeZPrime.in b/Contrib/RadiativeZPrime/LHC-RadiativeZPrime.in deleted file mode 100644 --- a/Contrib/RadiativeZPrime/LHC-RadiativeZPrime.in +++ /dev/null @@ -1,123 +0,0 @@ -################################################## -# Example generator for the Raditative Z' 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 snippets/PPCollider.in -read RadiativeZPrime.model - -# -# Other parameters for run -# main run parameters -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 10000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:PrintEvent 10 -set EventGenerator:MaxErrors 10000 -# these switch off the shower and hadronization -#set EventGenerator:EventHandler:CascadeHandler NULL -#set EventGenerator:EventHandler:HadronizationHandler NULL - -# Intrinsic pT tune extrapolated to LHC energy -set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 5.7*GeV - -# -# Cuts on jets and photons -# -set /Herwig/Cuts/JetKtCut:MinKT 0.*GeV -set /Herwig/Cuts/PhotonKtCut:MinKT 0.*GeV -set /Herwig/Cuts/PhotonKtCut:MinEta -10 -set /Herwig/Cuts/PhotonKtCut:MaxEta 10 - -# -# switch off Z decay modes if needed -# -#set /Herwig/Particles/Z0/Z0->b,bbar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->c,cbar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->d,dbar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->e-,e+;:OnOff Off -#set /Herwig/Particles/Z0/Z0->mu-,mu+;:OnOff Off -#set /Herwig/Particles/Z0/Z0->nu_e,nu_ebar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->nu_mu,nu_mubar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->nu_tau,nu_taubar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->s,sbar;:OnOff Off -#set /Herwig/Particles/Z0/Z0->tau-,tau+;:OnOff Off -#set /Herwig/Particles/Z0/Z0->u,ubar;:OnOff Off -# switch off spin correlations in 2-2 process if needed -#set /Herwig/Particles/Z0/Z0->e-,e+;:Decayer /Herwig/Decays/DecayME0 - - -################################################## -# -# This section contains the user defined settings -# -################################################## -cd /Herwig/NewPhysics - -# calculate decays for Z' -insert NewModel:DecayParticles 0 /Herwig/Particles/Z'0 - -# set coupling -set RadiativeZPrime/Model:gZPrime 1. - -# use this to get the normal Herwig automatic process generation -# incoming particles -insert ResConstructor:Incoming 0 /Herwig/Particles/d -insert ResConstructor:Incoming 1 /Herwig/Particles/dbar -insert ResConstructor:Incoming 2 /Herwig/Particles/u -insert ResConstructor:Incoming 3 /Herwig/Particles/ubar -insert ResConstructor:Incoming 4 /Herwig/Particles/s -insert ResConstructor:Incoming 5 /Herwig/Particles/sbar -insert ResConstructor:Incoming 6 /Herwig/Particles/c -insert ResConstructor:Incoming 7 /Herwig/Particles/cbar -insert ResConstructor:Incoming 8 /Herwig/Particles/b -insert ResConstructor:Incoming 9 /Herwig/Particles/bbar -# resonance -insert ResConstructor:Intermediates 0 /Herwig/Particles/Z'0 -# resonance decay products -insert ResConstructor:Outgoing 0 /Herwig/Particles/e+ -insert ResConstructor:Outgoing 0 /Herwig/Particles/gamma -# -# of use hand-coded matrix elements -# -cd /Herwig/MatrixElements -# -# q qbar -> Z' -> f f'bar -# -#create RadiativeZPrime::MEqq2ZPrime2ff MEqq2ZPrime2ff RadiativeZPrime.so -#set MEqq2ZPrime2ff:Process Electron -#set MEqq2ZPrime2ff:GammaZ ZPrime -#insert SubProcess:MatrixElements[0] MEqq2ZPrime2ff -# -# q qbar -> Z' > Z gamma (2 -> 2 process) -# -#create RadiativeZPrime::MEqq2ZPrime2ZGamma MEqq2ZPrime2ZGamma -#insert SubProcess:MatrixElements[0] MEqq2ZPrime2ZGamma -# -# q qbar -> Z' -> Z gamma -> f f bar gamma (2 -> 3 process ) -# -#create RadiativeZPrime::MEqq2ZPrime2ZGamma2ffGamma MEqq2ZPrime2ZGamma2ffGamma -#insert SubProcess:MatrixElements[0] MEqq2ZPrime2ZGamma2ffGamma - -# -# Analysis options -# -cd /Herwig/Generators -# don't warn if final-state quarks, needed if shower switched off -set /Herwig/Analysis/Basics:CheckQuark 0 -# -# Simple analysis of Z' events -# -create RadiativeZPrime::SimpleZPrimeAnalysis /Herwig/Analysis/SimpleZPrime -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/SimpleZPrime - -# -# save the run -# -saverun LHC-RadiativeZPrime EventGenerator diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.cc b/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.cc +++ /dev/null @@ -1,194 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the MEqq2ZPrime2ZGamma class. -// - -#include "MEqq2ZPrime2ZGamma.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" -#include "ThePEG/Handlers/StandardXComb.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/MatrixElement/Tree2toNDiagram.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "Herwig/MatrixElement/HardVertex.h" -#include "RadiativeZPrimeModel.h" -#include "ThePEG/Helicity/Vertex/Vector/FFVVertex.h" -#include "AnomalousVVVVertex.h" - -using namespace RadiativeZPrime; - -MEqq2ZPrime2ZGamma::MEqq2ZPrime2ZGamma() : _maxflavour(5) { - vector mopt(2,1); - mopt[0]=2; - massOption(mopt); - rescalingOption(2); -} - -void MEqq2ZPrime2ZGamma::doinit() { - HwMEBase::doinit(); - _zPrime = getParticleData(32); - tcSMPtr sm = generator()->standardModel(); - tcRadiativeZPrimeModelPtr model = - dynamic_ptr_cast(generator()->standardModel()); - if(!model) throw Exception() << "Must be using the RadiativeZPrimeModel in " - << "MEqq2ZPrime2ZGamma::doinit()" << Exception::abortnow; - _theFFZPrimeVertex = model->vertexFFZPrime(); - _theGammaZPrimeZVertex = model->vertexGammaZPrimeZ(); -} - -void MEqq2ZPrime2ZGamma::getDiagrams() const { - tcPDPtr Z0 = getParticleData(ParticleID::Z0); - tcPDPtr gamma = getParticleData(ParticleID::gamma); - for(unsigned int i = 1; i <= _maxflavour; ++i) { - tcPDPtr q = getParticleData(long(i)); - tcPDPtr qb = q->CC(); - add(new_ptr((Tree2toNDiagram(2), q, qb, 1, _zPrime, 3, Z0, 3, gamma, -1))); - } -} - -Energy2 MEqq2ZPrime2ZGamma::scale() const { - return sHat(); -} - -double MEqq2ZPrime2ZGamma::me2() const { - vector fin; - vector ain; - vector gammaout,Zout; - SpinorWaveFunction q(meMomenta()[0],mePartonData()[0],incoming); - SpinorBarWaveFunction qbar(meMomenta()[1],mePartonData()[1],incoming); - VectorWaveFunction Zwave(meMomenta()[2],mePartonData()[2],outgoing); - VectorWaveFunction Gwave(meMomenta()[3],mePartonData()[3],outgoing); - for(unsigned int ix=0;ix<3;++ix) { - if(ix!=1) { - Gwave.reset(ix); - gammaout.push_back(Gwave); - } - if(ix!=2) { - q.reset(ix) ; fin.push_back(q); - qbar.reset(ix); ain.push_back(qbar); - } - Zwave.reset(ix); - Zout.push_back(Zwave); - } - return qqME(fin,ain,Zout,gammaout,false); -} - -unsigned int MEqq2ZPrime2ZGamma::orderInAlphaS() const { - return 0; -} - -unsigned int MEqq2ZPrime2ZGamma::orderInAlphaEW() const { - return 4; -} - -Selector -MEqq2ZPrime2ZGamma::diagrams(const DiagramVector & diags) const { - Selector sel; - for ( DiagramIndex i = 0; i < diags.size(); ++i ) sel.insert(1., i); - return sel; -} - -Selector -MEqq2ZPrime2ZGamma::colourGeometries(tcDiagPtr diag) const { - static const ColourLines c1("1 -2"); - Selector sel; - sel.insert(1.0, &c1); - return sel; -} - - -void MEqq2ZPrime2ZGamma::persistentOutput(PersistentOStream & os) const { - os << _theFFZPrimeVertex << _theGammaZPrimeZVertex << _zPrime << _maxflavour; -} - -void MEqq2ZPrime2ZGamma::persistentInput(PersistentIStream & is, int) { - is >> _theFFZPrimeVertex >> _theGammaZPrimeZVertex >> _zPrime >> _maxflavour; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigMEqq2ZPrime2ZGamma("RadiativeZPrime::MEqq2ZPrime2ZGamma", "RadiativeZPrime.so"); - -void MEqq2ZPrime2ZGamma::Init() { - - static ClassDocumentation documentation - ("The MEqq2ZPrime2ZGamma class implements the matrix element for q qbar -> Z gamma" - " via a resonant Z' in the RadiativeZPrime Model"); - - static Parameter interfaceMaxFlavour - ("MaxFlavour", - "The heaviest incoming quark flavour this matrix element is allowed to handle", - &MEqq2ZPrime2ZGamma::_maxflavour, 5, 1, 6, - false, false, Interface::limited); - -} - -double MEqq2ZPrime2ZGamma::qqME(vector & fin , - vector & ain , - vector & Zout, - vector & gammaout, - bool calc) const { - // scale - Energy2 mb2(scale()); - // matrix element to be stored - ProductionMatrixElement menew(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin1,PDT::Spin1); - // declare the variables we need - unsigned int ihel1,ihel2,ohel1,ohel2; - VectorWaveFunction inter; - double me(0.); - Complex diag; - // sum over helicities to get the matrix element - for(ihel1=0;ihel1<2;++ihel1) { - for(ihel2=0;ihel2<2;++ihel2) { - // intermediate for Z' - inter=_theFFZPrimeVertex->evaluate(mb2,1,_zPrime,fin[ihel1],ain[ihel2]); - for(ohel1=0;ohel1<3;++ohel1) { - for(ohel2=0;ohel2<2;++ohel2) { - diag = _theGammaZPrimeZVertex->evaluate(mb2,gammaout[ohel2],inter,Zout[ohel1]); - me += norm(diag); - if(calc) menew(ihel1,ihel2,ohel1,2*ohel2) = diag; - } - } - } - } - if(calc) _me.reset(menew); - // spin and colour factor - return me/12.; -} - -void MEqq2ZPrime2ZGamma::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]); - // order of particles - unsigned int order[4]={0,1,2,3}; - if(hard[0]->id()<0) swap(order[0],order[1]); - if(hard[2]->id()==ParticleID::gamma) swap(order[2],order[3]); - vector fin; - vector ain; - vector gammaout,Zout; - SpinorWaveFunction( fin ,hard[order[0]],incoming,false,true); - SpinorBarWaveFunction(ain ,hard[order[1]],incoming,false,true); - VectorWaveFunction(Zout ,hard[order[2]],outgoing,true,false,true); - VectorWaveFunction(gammaout,hard[order[3]],outgoing,true,true ,true); - gammaout[1]=gammaout[2]; - qqME(fin,ain,Zout,gammaout,true); - // construct the vertex - HardVertexPtr hardvertex=new_ptr(HardVertex()); - // set the matrix element for the vertex - hardvertex->ME(_me); - // set the pointers and to and from the vertex - for(unsigned int ix=0;ix<4;++ix) - hard[order[ix]]->spinInfo()->productionVertex(hardvertex); -} diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.h b/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma.h +++ /dev/null @@ -1,217 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_MEqq2ZPrime2ZGammma_H -#define RADIATIVEZPRIME_MEqq2ZPrime2ZGamma_H -// -// This is the declaration of the MEqq2ZPrime2ZGamma class. -// - -#include "Herwig/MatrixElement/HwMEBase.h" -#include "Herwig/MatrixElement/ProductionMatrixElement.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/Vertex/AbstractFFVVertex.fh" -#include "ThePEG/Helicity/Vertex/AbstractVVVVertex.fh" - -namespace RadiativeZPrime { - -using namespace ThePEG; -using namespace Herwig; - -/** - * The MEqq2ZPrime2ZGamma class implements the matrix element for - * \f$q\bar{q}\to Z'\to Z\gamma\f$. - * - * @see \ref MEqq2ZPrime2ZGammaInterfaces "The interfaces" - * defined for MEqq2ZPrime2ZGamma. - */ -class MEqq2ZPrime2ZGamma: public HwMEBase { - -public: - - /** - * The default constructor. - */ - MEqq2ZPrime2ZGamma(); - - /** @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 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 - 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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const { return new_ptr(*this);} - //@} - -protected: - - /** - * Matrix element for \f$q\bar{q}\to \gamma/Z \to f\bar{f}\f$. - * @param fin Spinors for incoming quark - * @param ain Spinors for incoming antiquark - * @param Zout Polarization vectors for outgoing Z - * @param gammaout Polarization vectors for the the outgoing photon - * @param me Whether or not to calculate the matrix element for spin correlations - */ - double qqME(vector & fin , - vector & ain , - vector & Zout, - vector & gammaout, - bool me) 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. - */ - MEqq2ZPrime2ZGamma & operator=(const MEqq2ZPrime2ZGamma &) = delete; - -private: - - /** - * Pointer to the vertices for the helicity calculations - */ - //@{ - /** - * Pointer to the \f$Z'\f$ vertex - */ - AbstractFFVVertexPtr _theFFZPrimeVertex; - - /** - * Pointer to the \f$\gamma Z' Z vertex\f$ - */ - AbstractVVVVertexPtr _theGammaZPrimeZVertex; - //@} - - /** - * Pointer to the \f$Z'\f$ ParticleData object - */ - tcPDPtr _zPrime; - - /** - * Switches to control the particles in the hard process - */ - //@{ - /** - * Allowed flavours for the incoming quarks - */ - unsigned int _maxflavour; - //@} - - /** - * Matrix element for spin correlations - */ - ProductionMatrixElement _me; - -}; - -} - -#endif /* RADIATIVEZPRIME_MEqq2ZPrime2ZGamma_H */ diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.cc b/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.cc +++ /dev/null @@ -1,366 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the MEqq2ZPrime2ZGamma2ffGamma class. -// - -#include "MEqq2ZPrime2ZGamma2ffGamma.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" -#include "ThePEG/Handlers/StandardXComb.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/MatrixElement/Tree2toNDiagram.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "Herwig/MatrixElement/HardVertex.h" -#include "RadiativeZPrimeModel.h" -#include "ThePEG/Cuts/Cuts.h" -#include "ThePEG/Utilities/SimplePhaseSpace.h" -#include "ThePEG/PDT/DecayMode.h" - -using namespace RadiativeZPrime; - -void MEqq2ZPrime2ZGamma2ffGamma::doinit() { - MEBase::doinit(); - _z0 = getParticleData(ParticleID::Z0); - _zPrime = getParticleData(32); - tcSMPtr sm = generator()->standardModel(); - tcRadiativeZPrimeModelPtr model = - dynamic_ptr_cast(generator()->standardModel()); - if(!model) throw Exception() << "Must be using the RadiativeZPrimeModel in " - << "MEqq2ZPrime2ZGamma::doinit()" << Exception::abortnow; - _theFFZPrimeVertex = model->vertexFFZPrime(); - _theGammaZPrimeZVertex = model->vertexGammaZPrimeZ(); - _theFFZVertex = model->vertexFFZ(); -} - -void MEqq2ZPrime2ZGamma2ffGamma::getDiagrams() const { - // find possible Z decays - typedef Selector DecaySelector; - DecaySelector Zdec = _z0->decaySelector(); - vector Zdecays; - for(DecaySelector::const_iterator cit=Zdec.begin();cit!=Zdec.end();++cit) { - if(cit->second->orderedProducts().size()!=2) continue; - if(cit->second->orderedProducts()[0]->id()>0) - Zdecays.push_back(make_pair(cit->second->orderedProducts()[0], - cit->second->orderedProducts()[1])); - else - Zdecays.push_back(make_pair(cit->second->orderedProducts()[1], - cit->second->orderedProducts()[0])); - } - tcPDPtr gamma = getParticleData(ParticleID::gamma); - for(unsigned int i = 1; i <= _maxflavour; ++i) { - tcPDPtr q = getParticleData(long(i)); - tcPDPtr qb = q->CC(); - for(unsigned int iz=0;izmassMin())); - maxMass2 = min(maxMass2,sqr(_z0->massMax())); - // also impose the limits from the ParticleData object - if(maxMass2mass()),Gamma(_z0->width()); - Energy2 M2(sqr(M)),MG(M*Gamma); - double rhomin = atan2((minMass2-M2),MG); - double rhomax = atan2((maxMass2-M2),MG); - _mz2=M2+MG*tan(rhomin+r[1]*(rhomax-rhomin)); - Energy mz=sqrt(_mz2); - InvEnergy2 emjac = MG/(rhomax-rhomin)/(sqr(_mz2-M2)+sqr(MG)); - // jacobian - jacobian(jacobian()/sHat()/emjac); - // set the masses of the outgoing particles to 2-2 scattering - meMomenta()[2].setMass(ZERO); - Lorentz5Momentum pz(mz); - // generate the polar angle of the hard scattering - double ctmin(-1.0), ctmax(1.0); - Energy q(ZERO); - try { - q = SimplePhaseSpace::getMagnitude(sHat(), meMomenta()[2].mass(),mz); - } - catch ( ImpossibleKinematics ) { - return false; - } - Energy2 pq = sqrt(sHat())*q; - if ( ptmin > ZERO ) { - double ctm = 1.0 - sqr(ptmin/q); - if ( ctm <= 0.0 ) return false; - ctmin = max(ctmin, -sqrt(ctm)); - ctmax = min(ctmax, sqrt(ctm)); - } - if ( ctmin >= ctmax ) return false; - double cth = getCosTheta(ctmin, ctmax, r[0]); - Energy pt = q*sqrt(1.0-sqr(cth)); - double phi = 2.0*Constants::pi*r[2]; - meMomenta()[2].setVect(Momentum3( pt*sin(phi), pt*cos(phi), q*cth)); - pz.setVect( Momentum3(-pt*sin(phi),-pt*cos(phi),-q*cth)); - meMomenta()[2].rescaleEnergy(); - pz.rescaleEnergy(); - // generate the momenta of the Z decay products - meMomenta()[3].setMass(mePartonData()[3]->mass()); - meMomenta()[4].setMass(mePartonData()[4]->mass()); - Energy q2 = ZERO; - try { - q2 = SimplePhaseSpace::getMagnitude(_mz2, meMomenta()[3].mass(), - meMomenta()[4].mass()); - } catch ( ImpossibleKinematics ) { - return false; - } - double cth2 =-1.+2.*r[3]; - double phi2=Constants::twopi*r[4]; - Energy pt2 =q2*sqrt(1.-sqr(cth2)); - Lorentz5Momentum pl[2]={Lorentz5Momentum( pt2*cos(phi2), pt2*sin(phi2), q2*cth2,ZERO, - meMomenta()[3].mass()), - Lorentz5Momentum(-pt2*cos(phi2),-pt2*sin(phi2),-q2*cth2,ZERO, - meMomenta()[4].mass())}; - pl[0].rescaleEnergy(); - pl[1].rescaleEnergy(); - Boost boostv(pz.boostVector()); - pl[0].boost(boostv); - pl[1].boost(boostv); - meMomenta()[3] = pl[0]; - meMomenta()[4] = pl[1]; - // check passes all the cuts - vector out(3); - tcPDVector tout(3); - for(unsigned int ix=0;ix<3;++ix) { - out[ ix] = meMomenta()[ix+2]; - tout[ix] = mePartonData()[ix+2]; - } - if ( !lastCuts().passCuts(tout, out, mePartonData()[0], mePartonData()[1]) ) - return false; - // jacobian - jacobian((pq/sHat())*Constants::pi*jacobian()/8./sqr(Constants::pi)*q2/mz); - return true; -} - -double MEqq2ZPrime2ZGamma2ffGamma::me2() const { - InvEnergy2 output(ZERO); - // construct spinors for the leptons - vector lm; - vector lp; - SpinorBarWaveFunction lmout(meMomenta()[3],mePartonData()[3],outgoing); - SpinorWaveFunction lpout(meMomenta()[4],mePartonData()[4],outgoing); - for(unsigned int ix=0;ix<2;++ix) { - lmout.reset(ix);lm.push_back(lmout); - lpout.reset(ix);lp.push_back(lpout); - } - vector fin; - vector ain; - vector gout; - SpinorWaveFunction qin (meMomenta()[0],mePartonData()[0],incoming); - SpinorBarWaveFunction qbin(meMomenta()[1],mePartonData()[1],incoming); - VectorWaveFunction glout(meMomenta()[2],mePartonData()[2],outgoing); - for(unsigned int ix=0;ix<2;++ix) { - qin.reset(ix) ; fin.push_back(qin); - qbin.reset(ix) ; ain.push_back(qbin); - glout.reset(2*ix); gout.push_back(glout); - } - output=qqbarME(fin,ain,gout,lm,lp); - return output*sHat(); -} - -CrossSection MEqq2ZPrime2ZGamma2ffGamma::dSigHatDR() const { - return me2()*jacobian()/(16.0*sqr(Constants::pi)*sHat())*sqr(hbarc); -} - -unsigned int MEqq2ZPrime2ZGamma2ffGamma::orderInAlphaS() const { - return 0; -} - -unsigned int MEqq2ZPrime2ZGamma2ffGamma::orderInAlphaEW() const { - return 4; -} - -Selector -MEqq2ZPrime2ZGamma2ffGamma::diagrams(const DiagramVector & diags) const { - Selector sel; - for ( DiagramIndex i = 0; i < diags.size(); ++i ) sel.insert(1., i); - return sel; -} - -Selector -MEqq2ZPrime2ZGamma2ffGamma::colourGeometries(tcDiagPtr diag) const { - static const ColourLines c1=ColourLines("1 -2"); - static const ColourLines c2=ColourLines("1 -2, 6 -7"); - Selector sel; - if(mePartonData()[3]->coloured()) sel.insert(1.0,&c2); - else sel.insert(1.0,&c1); - return sel; -} - -void MEqq2ZPrime2ZGamma2ffGamma::persistentOutput(PersistentOStream & os) const { - os << _theFFZVertex << _theFFZPrimeVertex << _theGammaZPrimeZVertex - << _z0 << _zPrime << _maxflavour; -} - -void MEqq2ZPrime2ZGamma2ffGamma::persistentInput(PersistentIStream & is, int) { - is >> _theFFZVertex >> _theFFZPrimeVertex >> _theGammaZPrimeZVertex - >> _z0 >> _zPrime >> _maxflavour; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigMEqq2ZPrime2ZGamma2ffGamma("RadiativeZPrime::MEqq2ZPrime2ZGamma2ffGamma", "RadiativeZPrime.so"); - -void MEqq2ZPrime2ZGamma2ffGamma::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the MEqq2ZPrime2ZGamma2ffGamma class"); - - static Parameter interfaceMaxFlavour - ("MaxFlavour", - "The heaviest incoming quark flavour this matrix element is allowed to handle", - &MEqq2ZPrime2ZGamma2ffGamma::_maxflavour, 5, 1, 6, - false, false, Interface::limited); - -} - -double MEqq2ZPrime2ZGamma2ffGamma:: -getCosTheta(double ctmin, double ctmax, const double r) { - double cth = 0.0; - double zmin = 0.5*(1.0 - ctmax); - double zmax = 0.5*(1.0 - ctmin); - if ( zmin <= 0.0 || zmax >= 1.0 ) { - jacobian((ctmax - ctmin)*jacobian()); - cth = ctmin + r*(ctmax-ctmin); - } else { - double A1 = (2.0*zmax - 1.0)/(zmax*(1.0-zmax)); - double A0 = (2.0*zmin - 1.0)/(zmin*(1.0-zmin)); - double A = r*(A1 - A0) + A0; - double z = A < 2.0? 2.0/(sqrt(sqr(A) + 4.0) + 2 - A): - 0.5*(A - 2.0 + sqrt(sqr(A) + 4.0))/A; - cth = 1.0 - 2.0*z; - jacobian((2.0*(A1 - A0)*sqr(z)*sqr(1.0 - z)/(sqr(z) + sqr(1.0 - z)))*jacobian()); - } - return cth; -} - -InvEnergy2 MEqq2ZPrime2ZGamma2ffGamma::qqbarME(vector & fin, - vector & ain, - vector & gout, - vector & lm, - vector & lp, - bool calc) const { - // scale - Energy2 mb2(scale()); - // if calculation spin corrections construct the me - if(calc) _me.reset(ProductionMatrixElement(PDT::Spin1Half,PDT::Spin1Half, - PDT::Spin1,PDT::Spin1Half, - PDT::Spin1Half)); - // some integers - unsigned int ihel1,ihel2,ohel1,ohel2,ohel3; - // compute the leptonic Z currents for speed - VectorWaveFunction bcurr[2][2]; - for(ohel2=0;ohel2<2;++ohel2) { - for(ohel3=0;ohel3<2;++ohel3) { - bcurr[ohel2][ohel3]= - _theFFZVertex->evaluate(_mz2,1,_z0,lp[ohel3],lm[ohel2]); - } - } - - // compute the matrix elements - double me=0.; - Complex diag; - VectorWaveFunction inter; - for(ihel1=0;ihel1<2;++ihel1) { - for(ihel2=0;ihel2<2;++ihel2) { - // intermediate for Z' - inter=_theFFZPrimeVertex->evaluate(mb2,1,_zPrime,fin[ihel1],ain[ihel2]); - for(ohel1=0;ohel1<2;++ohel1) { - for(ohel2=0;ohel2<2;++ohel2) { - for(ohel3=0;ohel3<2;++ohel3) { - diag = _theGammaZPrimeZVertex->evaluate(mb2,gout[ohel1],inter, - bcurr[ohel2][ohel3]); - me += norm(diag); - if(calc) _me(ihel1,ihel2,2*ohel1,ohel2,ohel3) = diag; - } - } - } - } - } - // results - // initial state spin and colour average - double colspin = 1./3./4.; - // and for Z decay products - if(mePartonData()[3]->coloured()) colspin *= 3.; - me *= colspin; - return me*UnitRemoval::InvE2; -} - -void MEqq2ZPrime2ZGamma2ffGamma::constructVertex(tSubProPtr sub) { -// // extract the particles in the hard process -// ParticleVector hard(5); -// // incoming -// hard[0]=sub->incoming().first; -// hard[1]=sub->incoming().second; -// if(hard[0]->id()<0) swap(hard[0],hard[1]); -// // outgoing -// for(unsigned int ix=0;ix<3;++ix) { -// unsigned int iloc; -// PPtr mother=sub->outgoing()[ix]->parents()[0]; -// if(mother&&(mother->id()==ParticleID::gamma||mother->id()==ParticleID::Z0)) { -// if(sub->outgoing()[ix]->id()>0) iloc=3; -// else iloc=4; -// } -// else iloc=2; -// hard[iloc]=sub->outgoing()[ix]; -// } -// // wavefunctions for the Z decay products -// vector lm; -// vector lp; -// SpinorBarWaveFunction(lm,hard[3],outgoing,true,true); -// SpinorWaveFunction (lp,hard[4],outgoing,true,true); -// vector fin; -// vector ain; -// vector gout; -// SpinorWaveFunction (fin ,hard[0],incoming,false,true); -// SpinorBarWaveFunction(ain ,hard[1],incoming,false,true); -// VectorWaveFunction (gout,hard[2],outgoing,true ,true,true); -// gout[1]=gout[2]; -// qqbarME(fin,ain,gout,lm,lp,true); -// // construct the vertex -// HardVertexPtr hardvertex=new_ptr(HardVertex()); -// // set the matrix element for the vertex -// hardvertex->ME(_me); -// // set the pointers and to and from the vertex -// for(unsigned int ix=0;ix<5;++ix) -// (hard[ix]->spinInfo())->productionVertex(hardvertex); -} diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.h b/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ZGamma2ffGamma.h +++ /dev/null @@ -1,270 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_MEqq2ZPrime2ZGamma2ffGamma_H -#define RADIATIVEZPRIME_MEqq2ZPrime2ZGamma2ffGamma_H -// -// This is the declaration of the MEqq2ZPrime2ZGamma2ffGamma class. -// - -#include "ThePEG/MatrixElement/MEBase.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "Herwig/MatrixElement/ProductionMatrixElement.h" -#include "ThePEG/Helicity/Vertex/AbstractFFVVertex.fh" -#include "ThePEG/Helicity/Vertex/AbstractVVVVertex.fh" - -namespace RadiativeZPrime { - -using namespace ThePEG; -using namespace Herwig; - -/** - * The MEqq2ZPrime2ZGamma2ffGamma class simulates \f$q\bar{q}\to Z'\to Z\gamma\f$ - * including the decay of the Z boson. - * - * @see \ref MEqq2ZPrime2ZGamma2ffGammaInterfaces "The interfaces" - * defined for MEqq2ZPrime2ZGamma2ffGamma. - */ -class MEqq2ZPrime2ZGamma2ffGamma: public MEBase { - -public: - - /** @name Standard constructors and destructors. */ - //@{ - /** - * The default constructor. - */ - inline MEqq2ZPrime2ZGamma2ffGamma() :_maxflavour(5) {} - - /** @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; - - /** - * The number of internal degrees of freedom used in the matrix - * element. - */ - virtual int nDim() const; - - /** - * Generate internal degrees of freedom given nDim() uniform - * random numbers in the interval \f$ ]0,1[ \f$. To help the phase space - * generator, the dSigHatDR should be a smooth function of these - * numbers, although this is not strictly necessary. - * @param r a pointer to the first of nDim() consecutive random numbers. - * @return true if the generation succeeded, otherwise false. - */ - virtual bool generateKinematics(const double * r); - - /** - * Return the matrix element squared differential in the variables - * given by the last call to generateKinematics(). - */ - virtual CrossSection dSigHatDR() 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 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 - 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: - - /** - * Used internally by generateKinematics, after calculating the - * limits on cos(theta). - */ - double getCosTheta(double cthmin, double cthmax, const double r); - - /** - * Matrix elements for the different subprocesses - */ - //@{ - /** - * Matrix element for \f$q\bar{q}\to Z/\gamma g\f$. - * @param fin Spinors for incoming quark - * @param ain Spinors for incoming antiquark - * @param gout Polarization vectors for the outgoing photon - * @param lm Spinors for outgoing lepton - * @param lp Spinors for outgoing antilepton - * @param me Whether or not to calculate the matrix element for spin correlations - **/ - InvEnergy2 qqbarME(vector & fin, - vector & ain, - vector & gout, - vector & lm, vector & lp, - bool me=false) const; - -protected: - - /** @name Clone Methods. */ - //@{ - /** - * Make a simple clone of this object. - * @return a pointer to the new object. - */ - inline 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. - */ - inline 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 assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - MEqq2ZPrime2ZGamma2ffGamma & operator=(const MEqq2ZPrime2ZGamma2ffGamma &) = delete; - -private: - - /** - * Vertices for the helicity amplitude calculation - */ - //@{ - /** - * Pointer to the Z vertex - */ - AbstractFFVVertexPtr _theFFZVertex; - /** - * Pointer to the \f$Z'\f$ vertex - */ - AbstractFFVVertexPtr _theFFZPrimeVertex; - - /** - * Pointer to the \f$\gamma Z' Z vertex\f$ - */ - AbstractVVVVertexPtr _theGammaZPrimeZVertex; - //@} - - /** - * @name Pointers to the \f$Z^0\f$ and \f$Z'\f$ ParticleData objects - */ - //@{ - /** - * Pointer to the Z ParticleData object - */ - tcPDPtr _z0; - - /** - * Pointer to the \f$Z'\f$ ParticleData object - */ - tcPDPtr _zPrime; - //@} - - /** - * Switches to control the particles in the hard process - */ - //@{ - /** - * Allowed flavours for the incoming quarks - */ - unsigned int _maxflavour; - //@} - - /** - * Matrix element for spin correlations - */ - ProductionMatrixElement _me; - - /** - * Storage of the off-shell Z mass to avoid the need to recalculate - */ - Energy2 _mz2; - -}; - -} - -#endif /* RADIATIVEZPRIME_MEqq2ZPrime2ZGamma2ffGamma_H */ diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.cc b/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.cc +++ /dev/null @@ -1,366 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the MEqq2ZPrime2ff class. -// - -#include "MEqq2ZPrime2ff.h" -#include "ThePEG/Utilities/DescribeClass.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/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" -#include "ThePEG/Handlers/StandardXComb.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/MatrixElement/Tree2toNDiagram.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "Herwig/MatrixElement/HardVertex.h" -#include "RadiativeZPrimeModel.h" - -using namespace RadiativeZPrime; - -MEqq2ZPrime2ff::MEqq2ZPrime2ff() : _maxflavour(5), _gammaZ(0), _process(0) { - massOption(vector(2,1)); -} - -void MEqq2ZPrime2ff::doinit() { - HwMEBase::doinit(); - _zPrime = getParticleData(32); - _z0 = getParticleData(ThePEG::ParticleID::Z0); - _gamma = getParticleData(ThePEG::ParticleID::gamma); - tcSMPtr sm = generator()->standardModel(); - tcRadiativeZPrimeModelPtr model = - dynamic_ptr_cast(generator()->standardModel()); - if(!model) throw Exception() << "Must be using the RadiativeZPrimeModel in " - << "MEqq2ZPrime2ff::doinit()" << Exception::abortnow; - _theFFZVertex = model->vertexFFZ(); - _theFFPVertex = model->vertexFFP(); - _theFFZPrimeVertex = model->vertexFFZPrime(); -} - -void MEqq2ZPrime2ff::getDiagrams() const { - // which intermediates to include - bool gamma = _gammaZ==0 || _gammaZ==1; - bool Z0 = _gammaZ==0 || _gammaZ==2; - bool Zprime = _gammaZ==0 || _gammaZ==3; - // loop over the processes we need - for(unsigned int ix=1;ix<17;++ix) { - // increment counter to switch between quarks and leptons - if(ix==7) ix+=4; - // is it a valid quark process - bool quark = ix<=6 && (_process==0 || _process==1 || _process-10==ix); - // is it a valid lepton process - bool lepton= ix>=11 && ix<=16 - && (_process==0 - || _process==2 - || (_process==3 && ix%2==1) - || (_process==4 && ix%2==0) - || (ix%2==0 && (ix-10)/2==_process-7) - || (ix%2==1 && (ix-9)/2 ==_process-4) - ); - // if not a valid process continue - if(!(quark||lepton)) continue; - tcPDPtr lm = getParticleData(long(ix)); - tcPDPtr lp = lm->CC(); - for(unsigned int i = 1; i <= _maxflavour; ++i) { - tcPDPtr q = getParticleData(long(i)); - tcPDPtr qb = q->CC(); - if(Z0) add(new_ptr((Tree2toNDiagram(2), q, qb, 1, _z0 , 3, lm, 3, lp, -1))); - if(gamma) add(new_ptr((Tree2toNDiagram(2), q, qb, 1, _gamma , 3, lm, 3, lp, -2))); - if(Zprime) add(new_ptr((Tree2toNDiagram(2), q, qb, 1, _zPrime, 3, lm, 3, lp, -3))); - } - } -} - -Energy2 MEqq2ZPrime2ff::scale() const { - return sHat(); -} - -double MEqq2ZPrime2ff::me2() const { - vector fin,aout; - vector ain,fout; - SpinorWaveFunction q(meMomenta()[0],mePartonData()[0],incoming); - SpinorBarWaveFunction qbar(meMomenta()[1],mePartonData()[1],incoming); - SpinorBarWaveFunction f(meMomenta()[2],mePartonData()[2],outgoing); - SpinorWaveFunction fbar(meMomenta()[3],mePartonData()[3],outgoing); - for(unsigned int ix=0;ix<2;++ix) { - q.reset(ix) ; fin.push_back(q); - qbar.reset(ix); ain.push_back(qbar); - f.reset(ix) ;fout.push_back(f); - fbar.reset(ix);aout.push_back(fbar); - } - return qqME(fin,ain,fout,aout,false); -} - -unsigned int MEqq2ZPrime2ff::orderInAlphaS() const { - return 0; -} - -unsigned int MEqq2ZPrime2ff::orderInAlphaEW() const { - return 2; -} - -Selector -MEqq2ZPrime2ff::diagrams(const DiagramVector & diags) const { - Selector sel; - for ( DiagramIndex i = 0; i < diags.size(); ++i ) { - if ( diags[i]->id() == -1 ) sel.insert(meInfo()[0], i); - else if ( diags[i]->id() == -2 ) sel.insert(meInfo()[1], i); - else if ( diags[i]->id() == -3 ) sel.insert(meInfo()[2], i); - } - return sel; -} - -Selector -MEqq2ZPrime2ff::colourGeometries(tcDiagPtr diag) const { - static const ColourLines c1("1 -2"); - static const ColourLines c2("1 -2,4 -5"); - Selector sel; - if(abs(mePartonData()[2]->id())<=6) sel.insert(1.0, &c2); - else sel.insert(1.0, &c1); - return sel; -} - - -void MEqq2ZPrime2ff::persistentOutput(PersistentOStream & os) const { - os << _theFFZPrimeVertex << _theFFZVertex << _theFFPVertex << _zPrime << _z0 - << _gamma << _maxflavour << _gammaZ << _process; -} - -void MEqq2ZPrime2ff::persistentInput(PersistentIStream & is, int) { - is >> _theFFZPrimeVertex >> _theFFZVertex >> _theFFPVertex >> _zPrime >> _z0 - >> _gamma >> _maxflavour >> _gammaZ >> _process; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigMEqq2ZPrime2ff("RadiativeZPrime::MEqq2ZPrime2ff", "RadiativeZPrime.so"); - -void MEqq2ZPrime2ff::Init() { - - static ClassDocumentation documentation - ("The MEqq2ZPrime2ff class provides the matrix elements for " - "q qbar -> f fbar in the RadiativeZPrimeModel including the option" - " of interference with the photon and Z"); - - static Parameter interfaceMaxFlavour - ("MaxFlavour", - "The heaviest incoming quark flavour this matrix element is allowed to handle", - &MEqq2ZPrime2ff::_maxflavour, 5, 1, 6, - false, false, Interface::limited); - - static Switch interfaceGammaZ - ("GammaZ", - "Which terms to include", - &MEqq2ZPrime2ff::_gammaZ, 3, false, false); - static SwitchOption interfaceGammaZAll - (interfaceGammaZ, - "All", - "Include both gamma, Z and Z' terms", - 0); - static SwitchOption interfaceGammaZGamma - (interfaceGammaZ, - "Gamma", - "Only include the photon", - 1); - static SwitchOption interfaceGammaZZ - (interfaceGammaZ, - "Z", - "Only include the Z", - 2); - static SwitchOption interfaceGammaZZPrime - (interfaceGammaZ, - "ZPrime", - "Only include the Z'", - 3); - - static Switch interfaceProcess - ("Process", - "Which process to included", - &MEqq2ZPrime2ff::_process, 0, false, false); - static SwitchOption interfaceProcessAll - (interfaceProcess, - "All", - "Include all SM fermions as outgoing particles", - 0); - static SwitchOption interfaceProcessQuarks - (interfaceProcess, - "Quarks", - "All include the quarks as outgoing particles", - 1); - static SwitchOption interfaceProcessLeptons - (interfaceProcess, - "Leptons", - "Only include the leptons as outgoing particles", - 2); - static SwitchOption interfaceProcessChargedLeptons - (interfaceProcess, - "ChargedLeptons", - "Only include the charged leptons as outgoing particles", - 3); - static SwitchOption interfaceProcessNeutrinos - (interfaceProcess, - "Neutrinos", - "Only include the neutrinos as outgoing particles", - 4); - static SwitchOption interfaceProcessElectron - (interfaceProcess, - "Electron", - "Only include e+e- as outgoing particles", - 5); - static SwitchOption interfaceProcessMuon - (interfaceProcess, - "Muon", - "Only include mu+mu- as outgoing particles", - 6); - static SwitchOption interfaceProcessTau - (interfaceProcess, - "Tau", - "Only include tau+tau- as outgoing particles", - 7); - static SwitchOption interfaceProcessNu_e - (interfaceProcess, - "Nu_e", - "Only include nu_e ne_ebar as outgoing particles", - 8); - static SwitchOption interfaceProcessnu_mu - (interfaceProcess, - "Nu_mu", - "Only include nu_mu nu_mubar as outgoing particles", - 9); - static SwitchOption interfaceProcessnu_tau - (interfaceProcess, - "Nu_tau", - "Only include nu_tau nu_taubar as outgoing particles", - 10); - static SwitchOption interfaceProcessDown - (interfaceProcess, - "Down", - "Only include d dbar as outgoing particles", - 11); - static SwitchOption interfaceProcessUp - (interfaceProcess, - "Up", - "Only include u ubar as outgoing particles", - 12); - static SwitchOption interfaceProcessStrange - (interfaceProcess, - "Strange", - "Only include s sbar as outgoing particles", - 13); - static SwitchOption interfaceProcessCharm - (interfaceProcess, - "Charm", - "Only include c cbar as outgoing particles", - 14); - static SwitchOption interfaceProcessBottom - (interfaceProcess, - "Bottom", - "Only include b bbar as outgoing particles", - 15); - static SwitchOption interfaceProcessTop - (interfaceProcess, - "Top", - "Only include t tbar as outgoing particles", - 16); - -} - -double MEqq2ZPrime2ff::qqME(vector & fin , - vector & ain , - vector & fout, - vector & aout, - bool calc) const { - // scale - Energy2 mb2(scale()); - // matrix element to be stored - ProductionMatrixElement menew(PDT::Spin1Half,PDT::Spin1Half, - PDT::Spin1Half,PDT::Spin1Half); - // which intermediates to include - bool gamma = _gammaZ==0 || _gammaZ==1; - bool Z0 = _gammaZ==0 || _gammaZ==2; - bool Zprime = _gammaZ==0 || _gammaZ==3; - // declare the variables we need - unsigned int ihel1,ihel2,ohel1,ohel2; - VectorWaveFunction inter[3]; - double me[4]={0.,0.,0.,0.}; - Complex diag[3]; - // sum over helicities to get the matrix element - for(ihel1=0;ihel1<2;++ihel1) { - for(ihel2=0;ihel2<2;++ihel2) { - // intermediate for Z - if(Z0) inter[0]=_theFFZVertex -> - evaluate(mb2,1,_z0 ,fin[ihel1],ain[ihel2]); - // intermediate for photon - if(gamma) inter[1]=_theFFPVertex -> - evaluate(mb2,1,_gamma ,fin[ihel1],ain[ihel2]); - // intermediate for Z' - if(Zprime) inter[2]=_theFFZPrimeVertex-> - evaluate(mb2,1,_zPrime,fin[ihel1],ain[ihel2]); - for(ohel1=0;ohel1<2;++ohel1) { - for(ohel2=0;ohel2<2;++ohel2) { - // first the Z exchange diagram - diag[0] = Z0 ? - _theFFZVertex->evaluate(mb2,aout[ohel2],fout[ohel1],inter[0]) : 0.; - // first the photon exchange diagram - diag[1] = gamma ? - _theFFPVertex->evaluate(mb2,aout[ohel2],fout[ohel1],inter[1]) : 0.; - // then the Z' diagram - diag[2] = Zprime ? - _theFFZPrimeVertex->evaluate(mb2,aout[ohel2],fout[ohel1],inter[2]) : 0.; - // add up squares of individual terms - for(unsigned int ix=0;ix<3;++ix) me[ix+1] = norm(diag[ix]); - // the full thing including interference - diag[0]+=diag[1]+diag[2]; - me[0] += norm(diag[0]); - if(calc) menew(ihel1,ihel2,ohel1,ohel2) = diag[0]; - } - } - } - } - // spin and colour factor - double colspin=1./12.; - if(abs(fout[0].id())<=6) colspin*=3.; - // results - // factor 12 from 4 helicity and 3 colour - for(int ix=0;ix<3;++ix) me[ix]*=colspin; - DVector save; - save.push_back(me[1]); - save.push_back(me[2]); - save.push_back(me[3]); - meInfo(save); - if(calc) _me.reset(menew); - return me[0]; -} - -void MEqq2ZPrime2ff::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]); - // order of particles - unsigned int order[4]={0,1,2,3}; - if(hard[0]->id()<0) swap(order[0],order[1]); - if(hard[2]->id()<0) swap(order[2],order[3]); - vector fin,aout; - vector ain,fout; - SpinorWaveFunction( fin ,hard[order[0]],incoming,false,true); - SpinorBarWaveFunction(ain ,hard[order[1]],incoming,false,true); - SpinorBarWaveFunction(fout,hard[order[2]],outgoing,true ,true); - SpinorWaveFunction( aout,hard[order[3]],outgoing,true ,true); - qqME(fin,ain,fout,aout,true); - // construct the vertex - HardVertexPtr hardvertex=new_ptr(HardVertex()); - // set the matrix element for the vertex - hardvertex->ME(_me); - // set the pointers and to and from the vertex - for(unsigned int ix=0;ix<4;++ix) - hard[order[ix]]->spinInfo()->productionVertex(hardvertex); -} diff --git a/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.h b/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/MEqq2ZPrime2ff.h +++ /dev/null @@ -1,243 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_MEqq2ZPrime2ff_H -#define RADIATIVEZPRIME_MEqq2ZPrime2ff_H -// -// This is the declaration of the MEqq2ZPrime2ff class. -// - -#include "Herwig/MatrixElement/HwMEBase.h" -#include "Herwig/MatrixElement/ProductionMatrixElement.h" -#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" -#include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" -#include "ThePEG/Helicity/Vertex/AbstractFFVVertex.fh" - -namespace RadiativeZPrime { - -using namespace ThePEG; -using namespace Herwig; - -/** - * The MEqq2ZPrime2ff class implements the matrix element for - * \f$q\bar{q}\to Z'\to f \bar{f}\f$ - * - * @see \ref MEqq2ZPrime2ffInterfaces "The interfaces" - * defined for MEqq2ZPrime2ff. - */ -class MEqq2ZPrime2ff: public HwMEBase { - -public: - - /** - * The default constructor. - */ - MEqq2ZPrime2ff(); - - /** @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 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 - 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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** - * Matrix element for \f$q\bar{q}\to \gamma/Z \to f\bar{f}\f$. - * @param fin Spinors for incoming quark - * @param ain Spinors for incoming antiquark - * @param fout Spinors for incoming quark - * @param aout Spinors for incoming antiquark - * @param me Whether or not to calculate the matrix element for spin correlations - */ - double qqME(vector & fin , - vector & ain , - vector & fout, - vector & aout, - bool me) 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. - */ - MEqq2ZPrime2ff & operator=(const MEqq2ZPrime2ff &) = delete; - -private: - - /** - * Pointer to the vertices for the helicity calculations - */ - //@{ - /** - * Pointer to the \f$Z'\f$ vertex - */ - AbstractFFVVertexPtr _theFFZPrimeVertex; - - /** - * Pointer to the Z vertex - */ - AbstractFFVVertexPtr _theFFZVertex; - - /** - * Pointer to the photon vertex - */ - AbstractFFVVertexPtr _theFFPVertex; - //@} - - /** - * Pointers to the intermediate resonances - */ - //@{ - /** - * Pointer to the \f$Z'\f$ ParticleData object - */ - tcPDPtr _zPrime; - - /** - * Pointer to the Z ParticleData object - */ - tcPDPtr _z0; - - /** - * Pointer to the photon ParticleData object - */ - tcPDPtr _gamma; - //@} - - /** - * Switches to control the particles in the hard process - */ - //@{ - /** - * Allowed flavours for the incoming quarks - */ - unsigned int _maxflavour; - - /** - * Whether to include both \f$Z^0\f$ and \f$\gamma\f$ or only one - */ - unsigned int _gammaZ; - - /** - * Which processes to include - */ - unsigned int _process; - //@} - - /** - * Matrix element for spin correlations - */ - ProductionMatrixElement _me; -}; - -} - -#endif /* RADIATIVEZPRIME_MEqq2ZPrime2ff_H */ diff --git a/Contrib/RadiativeZPrime/Makefile.in b/Contrib/RadiativeZPrime/Makefile.in deleted file mode 100644 --- a/Contrib/RadiativeZPrime/Makefile.in +++ /dev/null @@ -1,40 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE = -GSLINCLUDE = -HERWIGINCLUDE = -LDFLAGS = -SHARED_FLAG = -INCLUDE = $(THEPEGINCLUDE) $(GSLINCLUDE) $(HERWIGINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = - -ALLCCFILES=$(shell echo *.cc) - -default : RadiativeZPrime.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -RadiativeZPrime.so : AnomalousVVVVertex.o RadiativeZPrimeModel.o FFZPrimeVertex.o\ - GammaZPrimeZVertex.o MEqq2ZPrime2ff.o MEqq2ZPrime2ZGamma.o\ - MEqq2ZPrime2ZGamma2ffGamma.o SimpleZPrimeAnalysis.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) $(SHARED_FLAG) $(LDFLAGS) AnomalousVVVVertex.o \ - RadiativeZPrimeModel.o FFZPrimeVertex.o GammaZPrimeZVertex.o \ - MEqq2ZPrime2ZGamma2ffGamma.o MEqq2ZPrime2ZGamma.o MEqq2ZPrime2ff.o \ - SimpleZPrimeAnalysis.o -o RadiativeZPrime.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) RadiativeZPrime.so diff --git a/Contrib/RadiativeZPrime/RadiativeZPrime.model b/Contrib/RadiativeZPrime/RadiativeZPrime.model deleted file mode 100644 --- a/Contrib/RadiativeZPrime/RadiativeZPrime.model +++ /dev/null @@ -1,72 +0,0 @@ -################################################## -# Common setup for Randall-Sundrum models -# -# This file does not contain anything that -# users need to touch. User settings are in -# LHC-RadiativeZPrime.in -# -################################################### -# -# Particle Data object for the Zprime -# -################################################### -cd /Herwig/Particles -create /ThePEG/ParticleData Z'0 -setup Z'0 32 Z'0 500.0 0.0 0.0 0.0 0 0 3 0 -defaultparticle Z'0 -################################################### -# -# Main directory and model object -# -################################################### -mkdir /Herwig/NewPhysics/RadiativeZPrime -cd /Herwig/NewPhysics/RadiativeZPrime -create RadiativeZPrime::RadiativeZPrimeModel Model RadiativeZPrime.so -# SM couplings -set Model:QCD/RunningAlphaS /Herwig/Couplings/NLOAlphaS -set Model:EW/RunningAlphaEM /Herwig/Couplings/AlphaEM -set Model:EW/CKM /Herwig/CKM -set Model:RunningMass /Herwig/RunningMass -################################################### -# -# Vertices -# -################################################### -# create vertices -mkdir /Herwig/Vertices/RadiativeZPrime -cd /Herwig/Vertices/RadiativeZPrime -create RadiativeZPrime::GammaZPrimeZVertex RZ_GammaZPrimeZVertex -create RadiativeZPrime::FFZPrimeVertex RZ_FFZPrimeVertex -cd /Herwig/NewPhysics/RadiativeZPrime -# 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 -# Z' vertices -set Model:Vertex/FFZPrime /Herwig/Vertices/RadiativeZPrime/RZ_FFZPrimeVertex -set Model:Vertex/GammaZPrimeZ /Herwig/Vertices/RadiativeZPrime/RZ_GammaZPrimeZVertex -################################################### -# -# Setting to ensure spin correlations -# and generation of processes and decays -# -################################################### -cd /Herwig/NewPhysics -# Set up the model framework -set RadiativeZPrime/Model:ModelGenerator NewModel -################################################### -# -# Choose RadiativeZPrimeModel over SM -# -################################################### -cd /Herwig/Generators -set EventGenerator:StandardModelParameters /Herwig/NewPhysics/RadiativeZPrime/Model diff --git a/Contrib/RadiativeZPrime/RadiativeZPrimeModel.cc b/Contrib/RadiativeZPrime/RadiativeZPrimeModel.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/RadiativeZPrimeModel.cc +++ /dev/null @@ -1,132 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the RadiativeZPrimeModel class. -// - -#include "RadiativeZPrimeModel.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/Reference.h" -#include "ThePEG/Interface/Parameter.h" -#include "ThePEG/Interface/Switch.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" - -using namespace RadiativeZPrime; - -void RadiativeZPrimeModel::persistentOutput(PersistentOStream & os) const { - os << _gZprime << _useZcouplings - << _vnu << _ve << _vu << _vd - << _anu << _ae << _au << _ad - << _ffZPrimeVertex << _gammaZPrimeZVertex; -} - -void RadiativeZPrimeModel::persistentInput(PersistentIStream & is, int) { - is >> _gZprime >> _useZcouplings - >> _vnu >> _ve >> _vu >> _vd - >> _anu >> _ae >> _au >> _ad - >> _ffZPrimeVertex >> _gammaZPrimeZVertex; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeClass -describeHerwigRadiativeZPrimeModel("RadiativeZPrime::RadiativeZPrimeModel", "RadiativeZPrime.so"); - -void RadiativeZPrimeModel::Init() { - - static ClassDocumentation documentation - ("The RadiativeZPrimeModel class"); - - static Switch interfaceUseZCouplings - ("UseZCouplings", - "Set the fermion couplings to the Z prime to be the same as for the Z", - &RadiativeZPrimeModel::_useZcouplings, true, false, false); - static SwitchOption interfaceUseZCouplingsYes - (interfaceUseZCouplings, - "Yes", - "Set Z' couplings to Z couplings", - true); - static SwitchOption interfaceUseZCouplingsNo - (interfaceUseZCouplings, - "No", - "Z' couplings are inputted", - false); - - static Parameter interfacegZPrime - ("gZPrime", - "The coupling of the Z'", - &RadiativeZPrimeModel::_gZprime, 1.0, 0.0, 10.0, - false, false, Interface::limited); - - static Parameter interfaceZPrimeVnu - ("Zprimev_nu", - "The vector coupling between a neutrino and a Z'. ", - &RadiativeZPrimeModel::_vnu, 1.0, 0, 0, - false, false, Interface::nolimits); - - static Parameter interfaceZPrimeVe - ("Zprimev_e", - "The vector coupling between a charged lepton and a Z'. ", - &RadiativeZPrimeModel::_ve, -0.072, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeVu - ("Zprimev_u", - "The vector coupling between an up-type quark and a Z'. ", - &RadiativeZPrimeModel::_vu, 0.3813, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeVd - ("Zprimev_d", - "The vector coupling between a down-type quark and a Z'. ", - &RadiativeZPrimeModel::_vd, -0.6907, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeAnu - ("Zprimea_nu", - "The axial coupling between a neutrino and a Z'. ", - &RadiativeZPrimeModel::_anu, 1.0, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeAe - ("Zprimea_e", - "The axial coupling between a charged lepton and a Z'. ", - &RadiativeZPrimeModel::_ae, -1.0, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeAu - ("Zprimea_u", - "The axial coupling between an up-type quark and a Z'. ", - &RadiativeZPrimeModel::_au, 1.0, 0.0, 0.0, false, false, false); - - static Parameter interfaceZPrimeAd - ("Zprimea_d", - "The axial coupling between a down-type quark and a Z'. ", - &RadiativeZPrimeModel::_ad, -1.0, 0.0, 0.0, false, false, false); - - static Reference - interfaceVertexFFZ - ("Vertex/FFZPrime", - "Reference to the Standard Model FFZ Vertex", - &RadiativeZPrimeModel::_ffZPrimeVertex, false, false, true, false); - - static Reference - interfaceVertexGammaZPrimeZ - ("Vertex/GammaZPrimeZ", - "Reference to the gamma-Z'-Z vertex", - &RadiativeZPrimeModel::_gammaZPrimeZVertex, false, false, true, false, false); - -} - -void RadiativeZPrimeModel::doinit() { - if(_useZcouplings) { - _vnu = vnu(); - _ve = ve() ; - _vu = vu() ; - _vd = vd() ; - _anu = anu(); - _ae = ae() ; - _au = au() ; - _ad = ad() ; - } - StandardModel::doinit(); - addVertex(_ffZPrimeVertex); - addVertex(_gammaZPrimeZVertex); -} diff --git a/Contrib/RadiativeZPrime/RadiativeZPrimeModel.h b/Contrib/RadiativeZPrime/RadiativeZPrimeModel.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/RadiativeZPrimeModel.h +++ /dev/null @@ -1,226 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_RadiativeZPrimeModel_H -#define RADIATIVEZPRIME_RadiativeZPrimeModel_H -// -// This is the declaration of the RadiativeZPrimeModel class. -// - -#include "Herwig/Models/StandardModel/StandardModel.h" - -namespace RadiativeZPrime { - -using namespace ThePEG; - -/** - * The RadiativeZPrimeModel class is the main class for the radiative - * \f$Z'\f$ model of hep-ph/0501154. - * - * @see \ref RadiativeZPrimeModelInterfaces "The interfaces" - * defined for RadiativeZPrimeModel. - */ -class RadiativeZPrimeModel: public Herwig::StandardModel { - -public: - - /** - * The default constructor. - */ - inline RadiativeZPrimeModel() : - _gZprime(1.), _useZcouplings(true), - _vnu(1.0), _ve(-0.072), _vu(0.3813), _vd(-0.6907), - _anu(1.0), _ae(-1.0), _au(1.0), _ad(-1.0) {} - - /** - * The coupling of the \f$Z'\f$ - */ - inline double gZprime() const {return _gZprime;} - - /** - * The vector neutrino-\f$Z^0\f$ coupling. - */ - inline double zPrimevnu() const {return _vnu;} - - /** - * The vector charged lepton-\f$Z^0\f$ coupling. - */ - inline double zPrimeve() const {return _ve;} - - /** - * The vector up-type-\f$Z^0\f$ coupling. - */ - inline double zPrimevu() const {return _vu;} - - /** - * The vector down-type-\f$Z^0\f$ coupling. - */ - inline double zPrimevd() const {return _vd;} - - /** - * The axial neutrino-\f$Z^0\f$ coupling. - */ - inline double zPrimeanu() const {return _anu;} - - /** - * The axial charged lepton-\f$Z^0\f$ coupling. - */ - inline double zPrimeae() const {return _ae;} - - /** - * The axial up-type-\f$Z^0\f$ coupling. - */ - inline double zPrimeau() const {return _au;} - - /** - * The axial down-type-\f$Z^0\f$ coupling. - */ - inline double zPrimead() const {return _ad;} - - /** - * The \f$f\bar{f}Z'\f$ vertex - */ - inline AbstractFFVVertexPtr vertexFFZPrime() const {return _ffZPrimeVertex;} - - /** - * The \f$\gamma Z'Z\f$ vertex - */ - inline AbstractVVVVertexPtr vertexGammaZPrimeZ() const {return _gammaZPrimeZVertex;} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - RadiativeZPrimeModel & operator=(const RadiativeZPrimeModel &) = delete; - - -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 free coupling \f$g_{Z'}\f$ - */ - double _gZprime; - - /** - * Switch to control the setting of the \f$Z'\f$ couplings to fermions - */ - bool _useZcouplings; - - /** - * Vector coupling between a fundamental fermion and \f$Z'\f$. - */ - double _vnu; - - /** - * Vector coupling between a fundamental fermion and \f$Z'\f$. - */ - double _ve; - - /** - * Vector coupling between a fundamental fermion and \f$Z'\f$. - */ - double _vu; - - /** - * Vector coupling between a fundamental fermion and \f$Z'\f$. - */ - double _vd; - - /** - * Axial coupling between a fundamental fermions and \f$Z'\f$. - */ - double _anu; - - /** - * Axial coupling between a fundamental fermions and \f$Z'\f$. - */ - double _ae; - - /** - * Axial coupling between a fundamental fermions and \f$Z'\f$. - */ - double _au; - - /** - * Axial coupling between a fundamental fermions and \f$Z'\f$. - */ - double _ad; - - /** - * The \f$f\bar{f}\f$ vertex - */ - AbstractFFVVertexPtr _ffZPrimeVertex; - - /** - * The \f$\gamma Z'Z\f$ vertex - */ - AbstractVVVVertexPtr _gammaZPrimeZVertex; - -}; - -} - -namespace ThePEG { - -ThePEG_DECLARE_POINTERS(RadiativeZPrime::RadiativeZPrimeModel, - RadiativeZPrimeModelPtr); - -} - - -#endif /* RADIATIVEZPRIME_RadiativeZPrimeModel_H */ diff --git a/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.cc b/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.cc deleted file mode 100644 --- a/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.cc +++ /dev/null @@ -1,101 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the SimpleZPrimeAnalysis class. -// - -#include "SimpleZPrimeAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/Interface/ClassDocumentation.h" - -using namespace RadiativeZPrime; -using Herwig::Histogram; - -void SimpleZPrimeAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector particles=event->getFinalState(); - PPtr ep,em,gamma; - for(unsigned int ix=0;ixid()==ParticleID::eminus) em = particles[ix]; - else if(particles[ix]->id()==ParticleID::eplus) ep = particles[ix]; - if(particles[ix]->id()==ParticleID::gamma) gamma = particles[ix]; - } - if(!ep||!em||!gamma) return; - Lorentz5Momentum pz=ep->momentum()+em->momentum(); - *_ptZ += pz.perp()/GeV; - *_rapZ += pz.rapidity(); - *_phiZ += pz.phi()+Constants::pi; - *_ptgamma += gamma->momentum().perp()/GeV; - *_rapgamma += gamma->momentum().rapidity(); - *_phigamma += gamma->momentum().phi()+Constants::pi; - *_ptep += ep->momentum().perp()/GeV; - *_rapep += ep->momentum().rapidity(); - *_phiep += ep->momentum().phi()+Constants::pi; - *_ptem += em->momentum().perp()/GeV; - *_rapem += em->momentum().rapidity(); - *_phiem += em->momentum().phi()+Constants::pi; - *_masspair += (pz+gamma->momentum()).m()/GeV; - *_massZ += pz.m()/GeV; - *_massgammaep += (ep->momentum()+gamma->momentum()).m()/GeV; - *_massgammaem += (em->momentum()+gamma->momentum()).m()/GeV; -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigSimpleZPrimeAnalysis("RadiativeZPrime::SimpleZPrimeAnalysis", "RadiativeZPrime.so"); - -void SimpleZPrimeAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the SimpleZPrimeAnalysis class"); - -} - -void SimpleZPrimeAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - using namespace Herwig::HistogramOptions; - _ptZ ->topdrawOutput(outfile,Frame,"BLACK","Z pt"); - _rapZ ->topdrawOutput(outfile,Frame,"BLACK","Z rapidity"); - _phiZ ->topdrawOutput(outfile,Frame,"BLACK","Z azimuth"); - _ptgamma ->topdrawOutput(outfile,Frame,"BLACK","Photon pt"); - _rapgamma ->topdrawOutput(outfile,Frame,"BLACK","Photon rapidity"); - _phigamma ->topdrawOutput(outfile,Frame,"BLACK","Photon azimuth"); - _ptep ->topdrawOutput(outfile,Frame,"BLACK","e+ pt"); - _rapep ->topdrawOutput(outfile,Frame,"BLACK","e+ rapidity"); - _phiep ->topdrawOutput(outfile,Frame,"BLACK","e+ azimuth"); - _ptem ->topdrawOutput(outfile,Frame,"BLACK","e- pt"); - _rapem ->topdrawOutput(outfile,Frame,"BLACK","e- rapidity"); - _phiem ->topdrawOutput(outfile,Frame,"BLACK","e- azimuth"); - _masspair ->topdrawOutput(outfile,Frame,"BLACK","Mass of Z+gamma"); - _massZ ->topdrawOutput(outfile,Frame,"BLACK","Mass of Z"); - _massgammaep ->topdrawOutput(outfile,Frame,"BLACK","Mass of e+gamma"); - _massgammaem ->topdrawOutput(outfile,Frame,"BLACK","Mass of e-gamma"); -} - -void SimpleZPrimeAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _ptZ = new_ptr(Histogram( 0.,1000.,100)); - _rapZ = new_ptr(Histogram(-10., 10.,100)); - _phiZ = new_ptr(Histogram(0.,Constants::twopi,100)); - _ptgamma = new_ptr(Histogram( 0.,1000.,100)); - _rapgamma = new_ptr(Histogram(-10., 10.,100)); - _phigamma = new_ptr(Histogram(0.,Constants::twopi,100)); - _ptep = new_ptr(Histogram( 0.,1000.,100)); - _rapep = new_ptr(Histogram(-10., 10.,100)); - _phiep = new_ptr(Histogram(0.,Constants::twopi,100)); - _ptem = new_ptr(Histogram( 0.,1000.,100)); - _rapem = new_ptr(Histogram(-10., 10.,100)); - _phiem = new_ptr(Histogram(0.,Constants::twopi,100)); - _masspair = new_ptr(Histogram(0.,1000.,100)); - _massZ = new_ptr(Histogram(70.,100.,100)); - _massgammaep = new_ptr(Histogram(0.,1000.,100)); - _massgammaem = new_ptr(Histogram(0.,1000.,100)); -} - diff --git a/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.h b/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.h deleted file mode 100644 --- a/Contrib/RadiativeZPrime/SimpleZPrimeAnalysis.h +++ /dev/null @@ -1,186 +0,0 @@ -// -*- C++ -*- -#ifndef RADIATIVEZPRIME_SimpleZPrimeAnalysis_H -#define RADIATIVEZPRIME_SimpleZPrimeAnalysis_H -// -// This is the declaration of the SimpleZPrimeAnalysis class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace RadiativeZPrime { - -using namespace ThePEG; -using Herwig::HistogramPtr; - -/** - * Here is the documentation of the SimpleZPrimeAnalysis class. - * - * @see \ref SimpleZPrimeAnalysisInterfaces "The interfaces" - * defined for SimpleZPrimeAnalysis. - */ -class SimpleZPrimeAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - SimpleZPrimeAnalysis & operator=(const SimpleZPrimeAnalysis &) = delete; - -private: - - /** - * Histogram for the Z \f$p_T\f$ - */ - HistogramPtr _ptZ; - - /** - * Histogram for the Z rapidity - */ - HistogramPtr _rapZ; - - /** - * Histogram for the Z azimuth - */ - HistogramPtr _phiZ; - - /** - * Histogram for the photon \f$p_T\f$ - */ - HistogramPtr _ptgamma; - - /** - * Histogram for the photon rapidity - */ - HistogramPtr _rapgamma; - - /** - * Histogram for the photon azimuth - */ - HistogramPtr _phigamma; - - /** - * Histogram for the \f$e^+\f$ \f$p_T\f$ - */ - HistogramPtr _ptep; - - /** - * Histogram for the \f$e^+\f$ rapidity - */ - HistogramPtr _rapep; - - /** - * Histogram for the \f$e^+\f$ azimuth - */ - HistogramPtr _phiep; - - /** - * Histogram for the \f$e^-\f$ \f$p_T\f$ - */ - HistogramPtr _ptem; - - /** - * Histogram for the \f$e^-\f$ rapidity - */ - HistogramPtr _rapem; - - /** - * Histogram for the \f$e^-\f$ azimuth - */ - HistogramPtr _phiem; - - /** - * Histogram for the mass of the photon and Z - */ - HistogramPtr _masspair; - - /** - * Histgram for the mass of the Z - */ - HistogramPtr _massZ; - - /** - * Histogram for the mass of the photon and \f$e^+\f$ - */ - HistogramPtr _massgammaep; - - /** - * Histogram for the mass of the photon and \f$e^-\f$ - */ - HistogramPtr _massgammaem; - -}; - -} - -#endif /* RADIATIVEZPRIME_SimpleZPrimeAnalysis_H */ diff --git a/Contrib/TauAnalysis/Makefile.in b/Contrib/TauAnalysis/Makefile.in deleted file mode 100644 --- a/Contrib/TauAnalysis/Makefile.in +++ /dev/null @@ -1,40 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE = -GSLINCLUDE = -HERWIGINCLUDE = -INCLUDE = $(THEPEGINCLUDE) $(GSLINCLUDE) $(HERWIGINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = -LDFLAGS = -SHARED_FLAG = - -ALLCCFILES=$(shell echo *.cc) - -default : HwTauAnalysis.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -HwTauAnalysis.so: Tau5Pion.o TauTo2MesonAnalysis.o TauTo4MesonAnalysis.o \ - TauCorrelationAnalysis.o TauTo3MesonAnalysis.o \ - TauToLeptonsAnalysis.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) \ - Tau5Pion.o TauTo2MesonAnalysis.o TauTo4MesonAnalysis.o \ - TauCorrelationAnalysis.o TauTo3MesonAnalysis.o \ - TauToLeptonsAnalysis.o $(SHARED_FLAG) $(LDFLAGS) -o HwTauAnalysis.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) HwTauAnalysis.so diff --git a/Contrib/TauAnalysis/Tau5Pion.cc b/Contrib/TauAnalysis/Tau5Pion.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/Tau5Pion.cc +++ /dev/null @@ -1,426 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the Tau5Pion class. -// - -#include "Tau5Pion.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/ClassDocumentation.h" - - -using namespace Herwig; - -void Tau5Pion::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector hadrons=event->getFinalState(); - map taus; - for(unsigned int ix=0;ixparents().empty()) mother=mother->parents()[0]; - else mother=tPPtr(); - } - while(mother&&abs(mother->id())!=ParticleID::tauminus); - if(mother&&abs(mother->id())==ParticleID::tauminus) { - if(taus.find(mother)==taus.end()) { - taus.insert(make_pair(mother,ParticleVector())); - } - taus[mother].push_back(hadrons[ix]); - } - } - map::const_iterator tit; - for(tit=taus.begin();tit!=taus.end();++tit) { - if(tit->second.size()!=6) continue; - ParticleVector decay=tit->second; - int tsign=tit->first->id()/abs(tit->first->id()); - vector ppi0,ppip,ppim,pkp,pkm,pk0,pk0bar,peta,pgamma; - Lorentz5Momentum ptotal; - for(unsigned int ix=0;ixid()*tsign; - if(abs(id)!=ParticleID::nu_tau) ptotal+=decay[ix]->momentum(); - if( id ==ParticleID::piplus) ppip .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::piminus) ppim .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::pi0) ppi0 .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kplus) pkp .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kminus) pkm .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::K0) pk0 .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kbar0) pk0bar.push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::eta) peta .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::gamma) pgamma.push_back(decay[ix]->momentum()); - } - if(ppi0.size()==2&&ppim.size()==2&&ppip.size()==1) { - *_pipi1[0]+=(ppim[0]+ppim[1]).m()/GeV; - *_pipi1[1]+=(ppim[0]+ppip[0]).m()/GeV; - *_pipi1[2]+=(ppim[0]+ppi0[0]).m()/GeV; - *_pipi1[2]+=(ppim[0]+ppi0[1]).m()/GeV; - *_pipi1[1]+=(ppim[1]+ppip[0]).m()/GeV; - *_pipi1[2]+=(ppim[1]+ppi0[0]).m()/GeV; - *_pipi1[2]+=(ppim[1]+ppi0[1]).m()/GeV; - *_pipi1[3]+=(ppip[0]+ppi0[0]).m()/GeV; - *_pipi1[3]+=(ppip[0]+ppi0[1]).m()/GeV; - *_pipi1[4]+=(ppi0[0]+ppi0[1]).m()/GeV; - *_pipipi1[0]+=(ppim[0]+ppim[1]-ptotal).m()/GeV; - *_pipipi1[1]+=(ppim[0]+ppip[0]-ptotal).m()/GeV; - *_pipipi1[2]+=(ppim[0]+ppi0[0]-ptotal).m()/GeV; - *_pipipi1[2]+=(ppim[0]+ppi0[1]-ptotal).m()/GeV; - *_pipipi1[1]+=(ppim[1]+ppip[0]-ptotal).m()/GeV; - *_pipipi1[2]+=(ppim[1]+ppi0[0]-ptotal).m()/GeV; - *_pipipi1[2]+=(ppim[1]+ppi0[1]-ptotal).m()/GeV; - *_pipipi1[3]+=(ppip[0]+ppi0[0]-ptotal).m()/GeV; - *_pipipi1[3]+=(ppip[0]+ppi0[1]-ptotal).m()/GeV; - *_pipipi1[4]+=(ppi0[0]+ppi0[1]-ptotal).m()/GeV; - *_pipipipi1[0]+=(ptotal-ppim[0]).m()/GeV; - *_pipipipi1[0]+=(ptotal-ppim[1]).m()/GeV; - *_pipipipi1[1]+=(ptotal-ppip[0]).m()/GeV; - *_pipipipi1[2]+=(ptotal-ppi0[0]).m()/GeV; - *_pipipipi1[2]+=(ptotal-ppi0[1]).m()/GeV; - *_q1+=ptotal.m()/GeV; - } - else if(ppi0.size()==4&&ppim.size()==1) { - *_pipi2[0]+=(ppim[0]+ppi0[0]).m()/GeV; - *_pipi2[0]+=(ppim[0]+ppi0[1]).m()/GeV; - *_pipi2[0]+=(ppim[0]+ppi0[2]).m()/GeV; - *_pipi2[0]+=(ppim[0]+ppi0[3]).m()/GeV; - *_pipi2[1]+=(ppi0[0]+ppi0[1]).m()/GeV; - *_pipi2[1]+=(ppi0[0]+ppi0[2]).m()/GeV; - *_pipi2[1]+=(ppi0[0]+ppi0[3]).m()/GeV; - *_pipi2[1]+=(ppi0[1]+ppi0[2]).m()/GeV; - *_pipi2[1]+=(ppi0[1]+ppi0[3]).m()/GeV; - *_pipi2[1]+=(ppi0[2]+ppi0[3]).m()/GeV; - *_pipipi2[0]+=(ppim[0]+ppi0[0]-ptotal).m()/GeV; - *_pipipi2[0]+=(ppim[0]+ppi0[1]-ptotal).m()/GeV; - *_pipipi2[0]+=(ppim[0]+ppi0[2]-ptotal).m()/GeV; - *_pipipi2[0]+=(ppim[0]+ppi0[3]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[0]+ppi0[1]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[0]+ppi0[2]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[0]+ppi0[3]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[1]+ppi0[2]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[1]+ppi0[3]-ptotal).m()/GeV; - *_pipipi2[1]+=(ppi0[2]+ppi0[3]-ptotal).m()/GeV; - *_pipipipi2[0]+=(ptotal-ppim[0]).m()/GeV; - *_pipipipi2[1]+=(ptotal-ppi0[0]).m()/GeV; - *_pipipipi2[1]+=(ptotal-ppi0[1]).m()/GeV; - *_pipipipi2[1]+=(ptotal-ppi0[2]).m()/GeV; - *_pipipipi2[1]+=(ptotal-ppi0[3]).m()/GeV; - *_q2+=ptotal.m()/GeV; - } - else if(ppim.size()==3&&ppip.size()==2) { - *_pipi3[0]+=(ppip[0]+ppip[1]).m()/GeV; - *_pipi3[1]+=(ppim[0]+ppip[0]).m()/GeV; - *_pipi3[1]+=(ppim[0]+ppip[1]).m()/GeV; - *_pipi3[1]+=(ppim[1]+ppip[0]).m()/GeV; - *_pipi3[1]+=(ppim[1]+ppip[1]).m()/GeV; - *_pipi3[1]+=(ppim[2]+ppip[0]).m()/GeV; - *_pipi3[1]+=(ppim[2]+ppip[1]).m()/GeV; - *_pipi3[2]+=(ppim[0]+ppim[1]).m()/GeV; - *_pipi3[2]+=(ppim[0]+ppim[2]).m()/GeV; - *_pipi3[2]+=(ppim[1]+ppim[2]).m()/GeV; - *_pipipi3[0]+=(ppip[0]+ppip[1]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[0]+ppip[0]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[0]+ppip[1]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[1]+ppip[0]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[1]+ppip[1]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[2]+ppip[0]-ptotal).m()/GeV; - *_pipipi3[1]+=(ppim[2]+ppip[1]-ptotal).m()/GeV; - *_pipipi3[2]+=(ppim[0]+ppim[1]-ptotal).m()/GeV; - *_pipipi3[2]+=(ppim[0]+ppim[2]-ptotal).m()/GeV; - *_pipipi3[2]+=(ppim[1]+ppim[2]-ptotal).m()/GeV; - *_pipipipi3[0]+=(ptotal-ppim[0]).m()/GeV; - *_pipipipi3[0]+=(ptotal-ppim[1]).m()/GeV; - *_pipipipi3[0]+=(ptotal-ppim[2]).m()/GeV; - *_pipipipi3[1]+=(ptotal-ppip[0]).m()/GeV; - *_pipipipi3[1]+=(ptotal-ppip[1]).m()/GeV; - *_q3+=ptotal.m()/GeV; - } - } -} - - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTau5Pion("Herwig::Tau5Pion", "HwTauAnalysis.so"); - -void Tau5Pion::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the Tau5Pion class"); - -} - -void Tau5Pion::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _pipi1[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2-31/GeV", - " XGX XGX XX "); - _pipi1[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2+3 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P2+31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2+31/GeV", - " XGX XGX XX "); - _pipi1[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _pipi1[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2+3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2031/GeV", - " XGX XGX XX "); - _pipi1[4]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P203P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2031/GeV", - " XGX XGX XX "); - _pipipi1[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P203P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2+3P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2+3P203P2031/GeV", - " XGX XGX XGX XX "); - _pipipi1[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P203P2031/GeV", - " XGX XGX XGX XX "); - _pipipi1[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2+3P2-3P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2+3P2-3P2031/GeV", - " XGX XGX XGX XX "); - _pipipi1[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P2-3P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P2-3P2031/GeV", - " XGX XGX XGX XX "); - _pipipi1[4]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3P2-3 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2+3P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2+3P2-3P2-31/GeV", - " XGX XGX XGX XX "); - _pipipipi1[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2+32P203 mass in T2-3RN0T12P2-3P2+32P203", - "GX XGX X GX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm0P2-3P2+32P2031/GeV2-13", - " G G XGX XGX X GX XX X X", - "m0P2-3P2+32P2031/GeV", - " XGX XGX X GX XX "); - _pipipipi1[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "2P2-32P203 mass in T2-3RN0T12P2-3P2+32P203", - " GX X GX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm02P2-32P2031/GeV2-13", - " G G X GX X GX XX X X", - "m02P2-32P2031/GeV", - " X GX X GX XX "); - _pipipipi1[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "2P2-3P2+3P203 mass in T2-3RN0T12P2-3P2+32P203", - " GX XGX XGX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm02P2-3P2+3P2031/GeV2-13", - " G G X GX XGX XGX XX X X", - "m02P2-3P2+3P2031/GeV", - " X GX XGX XGX XX "); - _q1->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "2P2-3P2+32P203 mass in T2-3RN0T12P2-3P2+32P203", - " GX XGX X GX X GX XWGXGX GX XGX X GX X", - "1/SdS/dm02P2-3P2+32P2031/GeV2-13", - " G G X GX XGX X GX XX X X", - "m02P2-3P2+32P2031/GeV", - " X GX XGX X GX XX "); - _pipi2[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T1P2-34P203", - "GX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _pipi2[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203 mass in T2-3RN0T1P2-34P203", - "GX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P203P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2031/GeV", - " XGX XGX XX "); - _pipipi2[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203P203 mass in T2-3RN0T1P2-34P203", - "GX XGX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P203P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P203P203P2031/GeV", - " XGX XGX XGX XX "); - _pipipi2[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203P203 mass in T2-3RN0T1P2-34P203", - "GX XGX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P2-3P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P203P2031/GeV", - " XGX XGX XGX XX "); - _pipipipi2[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203P203P203 mass in T2-3RN0T1P2-34P203", - "GX XGX XGX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P203P203P203P2031/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P203P203P203P2031/GeV", - " XGX XGX XGX XGX XX "); - _pipipipi2[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203P203P203 mass in T2-3RN0T1P2-34P203", - "GX XGX XGX XGX X GX XWGXGXGX X GX X", - "1/SdS/dm0P2-3P203P203P2031/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P2-3P203P203P2031/GeV", - " XGX XGX XGX XGX XX "); - _q2->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - " mass in T2-3RN0T1P2-34P203", - " GX XWGXGXGX X GX X", - "1/SdS/dm0P2-34P2031/GeV2-13", - " G G XGX X GX XX X X", - "m0P2-34P2031/GeV", - " XGX X GX XX "); - - - - _pipi3[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2+3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2+3P2+31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2+31/GeV", - " XGX XGX XX "); - _pipi3[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2+3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2-31/GeV", - " XGX XGX XX "); - _pipi3[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2-31/GeV", - " XGX XGX XX "); - _pipipi3[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3P2-3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P2-3P2-31/GeV", - " XGX XGX XGX XX "); - _pipipi3[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3P2+3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2-3P2+31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P2-3P2+31/GeV", - " XGX XGX XGX XX "); - _pipipi3[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2+3P2+3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2+3P2+31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P2+3P2+31/GeV", - " XGX XGX XGX XX "); - _pipipipi3[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3P2+3P2+3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX XGX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2-3P2+3P2+31/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P2-3P2-3P2+3P2+31/GeV", - " XGX XGX XGX XGX XX "); - _pipipipi3[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3P2-3P2+3 mass in T2-3RN0T13P2-32P2+3", - "GX XGX XGX XGX X GX XWGXGX GX X GX X", - "1/SdS/dm0P2-3P2-3P2-3P2+31/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P2-3P2-3P2-3P2+31/GeV", - " XGX XGX XGX XGX XX "); - _q3->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - " mass in T2-3RN0T13P2-32P2+3", - " GX XWGXGX GX X GX X", - "1/SdS/dm03P2-32P2+1/GeV2-13", - " G G X GX X GX X X X", - "m03P2-32P2+1/GeV", - " X GX X GX X "); - -} - -void Tau5Pion::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<5;++ix) { - _pipi1 .push_back(new_ptr(Histogram(0.,1.8,200))); - _pipipi1.push_back(new_ptr(Histogram(0.,1.8,200))); - } - for(unsigned int ix=0;ix<3;++ix) { - _pipipipi1.push_back(new_ptr(Histogram(0.,1.8,200))); - _pipi3.push_back(new_ptr(Histogram(0.,1.8,200))); - _pipipi3.push_back(new_ptr(Histogram(0.,1.8,200))); - } - for(unsigned int ix=0;ix<2;++ix) { - _pipi2.push_back(new_ptr(Histogram(0.,1.8,200))); - _pipipi2.push_back(new_ptr(Histogram(0.,1.8,200))); - _pipipipi2.push_back(new_ptr(Histogram(0.,1.8,200))); - _pipipipi3.push_back(new_ptr(Histogram(0.,1.8,200))); - } - _q1=new_ptr(Histogram(0.,1.8,200)); - _q2=new_ptr(Histogram(0.,1.8,200)); - _q3=new_ptr(Histogram(0.,1.8,200)); -} diff --git a/Contrib/TauAnalysis/Tau5Pion.h b/Contrib/TauAnalysis/Tau5Pion.h deleted file mode 100644 --- a/Contrib/TauAnalysis/Tau5Pion.h +++ /dev/null @@ -1,187 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_Tau5Pion_H -#define HERWIG_Tau5Pion_H -// -// This is the declaration of the Tau5Pion class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the Tau5Pion class. - * - * @see \ref Tau5PionInterfaces "The interfaces" - * defined for Tau5Pion. - */ -class Tau5Pion: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - using AnalysisHandler::analyze; - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - Tau5Pion & operator=(const Tau5Pion &) = delete; - -private: - - /** - * Histograms for the \f$\pi\pi\f$ masses - */ - //@{ - /** - * Histograms for the \f$2\pi^02\pi^-\pi^+\f$ decay - */ - vector _pipi1; - - /** - * Histograms for the \f$4\pi^02\pi^-\f$ decay - */ - vector _pipi2; - - /** - * Histograms for the \f$3\pi^-2\pi^+\f$ decay - */ - vector _pipi3; - //@} - - /** - * Histograms for the \f$\pi\pi\pi\f$ masses - */ - //@{ - /** - * Histograms for the \f$2\pi^02\pi^-\pi^+\f$ decay - */ - vector _pipipi1; - - /** - * Histograms for the \f$4\pi^02\pi^-\f$ decay - */ - vector _pipipi2; - - /** - * Histograms for the \f$3\pi^-2\pi^+\f$ decay - */ - vector _pipipi3; - //@} - - /** - * Histograms for the \f$\pi\pi\pi\pi\f$ masses - */ - //@{ - /** - * Histograms for the \f$2\pi^02\pi^-\pi^+\f$ decay - */ - vector _pipipipi1; - - /** - * Histograms for the \f$4\pi^02\pi^-\f$ decay - */ - vector _pipipipi2; - - /** - * Histograms for the \f$3\pi^-2\pi^+\f$ decay - */ - vector _pipipipi3; - //@} - - /** - * Histograms for the total hadronic mass - */ - //@{ - /** - * Histograms for the \f$2\pi^02\pi^-\pi^+\f$ decay - */ - HistogramPtr _q1; - - /** - * Histograms for the \f$4\pi^02\pi^-\f$ decay - */ - HistogramPtr _q2; - - /** - * Histograms for the \f$3\pi^-2\pi^+\f$ decay - */ - HistogramPtr _q3; - //@} -}; - -} - -#endif /* HERWIG_Tau5Pion_H */ diff --git a/Contrib/TauAnalysis/TauCorrelationAnalysis.cc b/Contrib/TauAnalysis/TauCorrelationAnalysis.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/TauCorrelationAnalysis.cc +++ /dev/null @@ -1,246 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the TauCorrelationAnalysis class. -// - -#include "TauCorrelationAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/EventRecord/Event.h" -#include - -using namespace Herwig; - - -void TauCorrelationAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _phi->topdrawOutput(output,Frame|Errorbars, - "RED", - "F2*3 in h203RT2+3T2-3 with TRPN0T1", - "GX X X XWGX XGX X GWGGXGX", - "1/GdG/dF2*3", - " F F GX X", - "F2*3", - "GX X"); - _delta->topdrawOutput(output,Frame|Errorbars, - "RED", - "D2*3 in h203RT2+3T2-3 with TRPN0T1", - "GX X X XWGX XGX X GWGGXGX", - "1/GdG/dD2*3", - " F F GX X", - "D2*3", - "GX X"); - _rhoangle1->topdrawOutput(output,Frame|Errorbars, - "RED", - "F2*3 in h203RT2+3T2-3 with TRRN0T1 and y011y021>0", - "GX X X XWGX XGX X GWGGXGX X X X X ", - "1/GdG/dF2*3", - " F F GX X", - "F2*3", - "GX X"); - _rhoangle2->topdrawOutput(output,Frame|Errorbars, - "RED", - "F2*3 in h203RT2+3T2-3 with TRRN0T1 and y011y021<0", - "GX X X XWGX XGX X GWGGXGX X X X X ", - "1/GdG/dF2*3", - " F F GX X", - "F2*3", - "GX X"); -} - -void TauCorrelationAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - using Constants::pi; - _phi = new_ptr(Histogram(0.,pi,100)); - _delta = new_ptr(Histogram(3.,pi,100)); - _rhoangle1 = new_ptr(Histogram(0.,pi,100)); - _rhoangle2 = new_ptr(Histogram(0.,pi,100)); -} - -void TauCorrelationAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // find all higgs bosons particles - tPVector particles; - for(unsigned int ix=0, nstep=event->primaryCollision()->steps().size(); - ixprimaryCollision()->step(ix)->all(); - ThePEG::ParticleSet::iterator iter=part.begin(); - ThePEG::ParticleSet::iterator end=part.end(); - for( ;iter!=end;++iter) { - if((**iter).id()==ParticleID::h0) particles.push_back(*iter); - } - } - // analyse them - analyze(particles); -} - -void TauCorrelationAnalysis::analyze(const tPVector & particles) { - AnalysisHandler::analyze(particles); - // Calls analyze() for each particle. -} - -namespace { - -tPPtr findTau(tPPtr parent) { - for(unsigned int ix=0;ixchildren().size();++ix) { - if(parent->children()[ix]->id()==parent->id()) - return findTau(parent->children()[ix]); - } - return parent; -} - -} - -void TauCorrelationAnalysis::analyze(tPPtr part) { - // check the number of children of the particle - if(part->children().size()!=2) return; - // and they are tau's - if(abs(part->children()[0]->id())!=ParticleID::tauminus|| - abs(part->children()[1]->id())!=ParticleID::tauminus) return; - ParticleVector children; - for(unsigned int ix=0;ixchildren().size();++ix) - children.push_back(findTau(part->children()[ix])); - // and number of children - if(!((children[0]->children().size()==2|| - children[0]->children().size()==3)&& - (children[1]->children().size()==2|| - children[1]->children().size()==3))) return; - // call rho and pi specific analysis - analyzePi(part,children); - analyzeRho(part,children); -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTauCorrelationAnalysis("Herwig::TauCorrelationAnalysis", "HwTauAnalysis.so"); - -void TauCorrelationAnalysis::Init() { - - static ClassDocumentation documentation - ("The TauCorrelationAnalysis class performs the analysis of correlation effects" - " in the decays of tau's produced in Higgs decay"); - -} - -void TauCorrelationAnalysis::analyzePi(tPPtr part, - ParticleVector children) { - if(children[0]->children().size()!=2|| - children[1]->children().size()!=2) return; - // now examine the decay products - tPPtr taup,taum,pim,pip,nu,nub; - for(unsigned int ix=0;ix<2;++ix) { - if(children[ix]->id()==ParticleID::tauminus) { - taum=children[ix]; - for(unsigned int ix=0;ix<2;++ix) { - if(taum->children()[ix]->id()==ParticleID::piminus) { - pim=taum->children()[ix]; - } - else if(taum->children()[ix]->id()==ParticleID::nu_tau) { - nu=taum->children()[ix]; - } - } - } - else { - taup=children[ix]; - for(unsigned int ix=0;ix<2;++ix) { - if(taup->children()[ix]->id()==ParticleID::piplus) { - pip=taup->children()[ix]; - } - else if(taup->children()[ix]->id()==ParticleID::nu_taubar) { - nub=taup->children()[ix]; - } - } - } - } - if(!taup||!taum||!pim||!pip||!nu||!nub){return;} - Boost bv(-part->momentum().boostVector()); - Lorentz5Momentum ptaup(taup->momentum());ptaup.boost(bv); - Lorentz5Momentum ptaum(taum->momentum());ptaum.boost(bv); - Lorentz5Momentum ppim( pim->momentum() );ppim.boost(bv); - Lorentz5Momentum ppip( pip->momentum() );ppip.boost(bv); - Lorentz5Momentum pnu( nu->momentum() );pnu.boost(bv); - Lorentz5Momentum pnub( nub->momentum() );pnub.boost(bv); - ThreeVector norm1(ppip.vect().cross(pnub.vect())); - ThreeVector norm2(ppim.vect().cross(pnu.vect())); - double phi=norm1.angle(norm2); - *_phi +=phi; - *_delta +=ppip.vect().angle(ppim.vect()); -} - -void TauCorrelationAnalysis::analyzeRho(tPPtr part, - ParticleVector children) { - // now examine the decay products - tPPtr taup,taum,pim,pip,nu,nub,pi0a,pi0b,rhop,rhom; - int idtemp; - for(unsigned int ix=0;ix<2;++ix) { - if(children[ix]->id()==ParticleID::tauminus) { - taum=children[ix]; - for(unsigned int iz=0;izchildren().size();++iz) { - idtemp=taum->children()[iz]->id(); - if(idtemp==-213||idtemp==-100213||idtemp==-30213) { - tPPtr rhom=taum->children()[iz]; - if(rhom->children().size()!=2) return; - for(unsigned int iy=0;iy<2;++iy) { - int idb=rhom->children()[iy]->id(); - if(idb==ParticleID::piminus) pim=rhom->children()[iy]; - else if(idb==ParticleID::pi0) pi0a=rhom->children()[iy]; - } - } - else if(idtemp==ParticleID::nu_tau) { - nu=taum->children()[iz]; - } - else if(idtemp==ParticleID::piminus) pim =taum->children()[iz]; - else if(idtemp==ParticleID::pi0) pi0a=taum->children()[iz]; - } - } - else { - taup=children[ix]; - for(unsigned int iz=0;izchildren().size();++iz) { - idtemp=taup->children()[iz]->id(); - if(idtemp==213||idtemp==100213||idtemp==30213) { - tPPtr rhop=taup->children()[iz]; - if(rhop->children().size()!=2) return; - for(unsigned int iy=0;iy<2;++iy) { - int idb=rhop->children()[iy]->id(); - if(idb==ParticleID::piplus) pip=rhop->children()[iy]; - else if(idb==ParticleID::pi0) pi0b=rhop->children()[iy]; - } - } - else if(idtemp==ParticleID::nu_taubar) { - nub=taup->children()[iz]; - } - else if(idtemp==ParticleID::piplus) pip = taup->children()[iz]; - else if(idtemp==ParticleID::pi0) pi0b = taup->children()[iz]; - } - } - } - if(!taup||!taum||!pim||!pip||!pi0a||!pi0b||!nu||!nub) return; - LorentzMomentum prest(pim ->momentum()+pip ->momentum()+ - pi0a->momentum()+pi0b->momentum()); - Boost bv(-prest.boostVector()); - Lorentz5Momentum ppim( pim->momentum() );ppim.boost(bv); - Lorentz5Momentum ppip( pip->momentum() );ppip.boost(bv); - Lorentz5Momentum ppi0a( pi0a->momentum() );ppi0a.boost(bv); - Lorentz5Momentum ppi0b( pi0b->momentum() );ppi0b.boost(bv); - ThreeVector norm1(ppip.vect().cross(ppi0b.vect())); - ThreeVector norm2(ppim.vect().cross(ppi0a.vect())); - double phi=norm1.angle(norm2); - - Lorentz5Momentum ptaup(taup->momentum()); - Lorentz5Momentum ptaum(taum->momentum()); - bv = -ptaum.boostVector(); - ppim =pim->momentum();ppim.boost(bv); - ppi0a=pi0a->momentum();ppi0a.boost(bv); - bv = -ptaup.boostVector(); - ppip =pip->momentum();ppip.boost(bv); - ppi0b=pi0b->momentum();ppi0b.boost(bv); - double y1=(ppip.e()-ppi0b.e())/(ppip.e()+ppi0b.e()); - double y2=(ppim.e()-ppi0a.e())/(ppim.e()+ppi0a.e()); - if(y1*y2>0) *_rhoangle1+=phi; - else *_rhoangle2+=phi; -} diff --git a/Contrib/TauAnalysis/TauCorrelationAnalysis.h b/Contrib/TauAnalysis/TauCorrelationAnalysis.h deleted file mode 100644 --- a/Contrib/TauAnalysis/TauCorrelationAnalysis.h +++ /dev/null @@ -1,169 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_TauCorrelationAnalysis_H -#define HERWIG_TauCorrelationAnalysis_H -// -// This is the declaration of the TauCorrelationAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The documentation of the TauCorrelationAnalysis class is designed to - * perform some analysis of the distributions of tau decay products in - * Higgs decays. - * - * The analysis of the pion decays is based on hep-ph/0202007 and the - * rho decays is based on hep-ph/0204292. - * - * @see \ref TauCorrelationAnalysisInterfaces "The interfaces" - * defined for TauCorrelationAnalysis. - */ -class TauCorrelationAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - /** - * Analyze the given vector of particles. The default version calls - * analyze(tPPtr) for each of the particles. - * @param particles the vector of pointers to particles to be analyzed - */ - virtual void analyze(const tPVector & particles); - - /** - * Analyze the given particle. - * @param particle pointer to the particle to be analyzed. - */ - virtual void analyze(tPPtr particle); - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -protected: - - /** - * Methods to perform the analysis - */ - //@{ - /** - * Analyze the given particle for correlations with pi. - * @param particle pointer to the particle to be analyzed. - */ - void analyzePi(tPPtr particle, ParticleVector children); - /** - * Analyze the given particle for correlations with rho. - * @param particle pointer to the particle to be analyzed. - */ - void analyzeRho(tPPtr particle, ParticleVector children); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - TauCorrelationAnalysis & operator=(const TauCorrelationAnalysis &) = delete; - -private: - - /** - * Histogram of the \f$\phi\f$ angle in - * \f$H\to\tau^+\tau^-\to\pi^+\bar{\nu}_tau\pi^-\nu_tau\f$ - */ - HistogramPtr _phi; - - /** - * Histogram of the \f$\delta\f$ angle in - * \f$H\to\tau^+\tau^-\to\pi^+\bar{\nu}_tau\pi^-\nu_tau\f$ - */ - HistogramPtr _delta; - - /** - * Histogram of the \f$\phi\f$ angle in - * \f$H\to\tau^+\tau^-\to\rho^+\bar{\nu}_tau\rho^-\nu_tau\f$ - */ - //@{ - /** - * First angle - */ - HistogramPtr _rhoangle1; - - /** - * Second angle - */ - HistogramPtr _rhoangle2; - //@} -}; - -} - -#endif /* HERWIG_TauCorrelationAnalysis_H */ diff --git a/Contrib/TauAnalysis/TauTo2MesonAnalysis.cc b/Contrib/TauAnalysis/TauTo2MesonAnalysis.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo2MesonAnalysis.cc +++ /dev/null @@ -1,310 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the TauTo2MesonAnalysis class. -// - -#include "TauTo2MesonAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/Persistency/PersistentOStream.h" -#include "ThePEG/Persistency/PersistentIStream.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/StandardModel/StandardModelBase.h" -#include "ThePEG/PDT/EnumParticles.h" - -using namespace Herwig; - -inline void TauTo2MesonAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - // BELLE data for the pipi distribution - double valsBELLE[]={0.076,0.100,0.150,0.200,0.250,0.300,0.350,0.400,0.450,0.500, - 0.550,0.600,0.650,0.700,0.750,0.800,0.850,0.900,0.950,1.000, - 1.050,1.100,1.150,1.200,1.250,1.300,1.350,1.400,1.450,1.500, - 1.550,1.600,1.650,1.700,1.750,1.800,1.850,1.900,1.950,2.000, - 2.050,2.100,2.150,2.200,2.250,2.300,2.350,2.400,2.450,2.500, - 2.550,2.600,2.650,2.700,2.750,2.800,2.850,2.900,2.950,3.000, - 3.050,3.100,3.150}; - double dvalBELLE[]={ 10.3, 64.5, 123.2, 191.2, 284.3, - 443.5, 690.8,1113.9,1781.8,2716.5, - 3260.2,2765.4,1879.6,1222.8, 816.7, - 590.1, 424.4, 324.9, 259.1, 202.0, - 175.7, 147.9, 122.6, 110.6, 97.3, - 82.1, 74.0, 63.2, 55.7, 49.3, - 43.2,331.93,298.43,263.91,198.85, - 176.86,145.50,110.07, 81.40, 64.57, - 43.10, 27.46, 20.27, 14.58, 8.89, - 3.77, 0.31, -0.69, 0.07, 1.52, - 2.62, 3.64, 4.17, 3.85, 3.16, - 3.44, 1.96, 1.86, 1.55, 0.89, - 0.32, 0.04}; - double errorstatBELLE[]={ 5.0 , 3.0 , 3.0 , 3.4 , 4.3 , 5.9 , 8.6 ,13.3 ,20.8 ,31.1 , - 37.2 ,31.7 ,21.9 ,14.6 ,10.1 , 7.7 , 5.9 , 4.9 , 4.2 , 3.6 , - 3.3 , 3.0 , 2.7 , 2.5 , 2.3 , 2.1 , 1.9 , 1.7 , 1.5 , 1.4 , - 1.3 ,11.43, 9.26, 8.89, 8.09, 6.14, 5.35, 4.61, 3.76, 3.45, - 2.76, 2.53, 2.17, 2.03, 1.82, 1.58, 1.42, 1.34, 1.26, 1.05, - 0.97, 1.01, 2.95, 1.12, 1.32, 0.99, 0.60, 0.61, 0.43, 0.42, - 0.11, 0.01}; - double errorsystBELLE[]={ 4.1 , 4.6 , 3.8 , 3.8 , 3.6 , 3.8 , 3.8 , 4.0 , 4.6 , 4.1 , - 3.8 , 3.1 , 2.3 , 1.8 , 1.3 , 1.1 , 1.0 , 0.8 , 0.9 , 0.6 , - 0.8 , 0.5 , 0.7 , 0.4 , 0.5 , 0.4 , 0.4 , 0.4 , 0.3 , 0.4 , - 0.3 , 2.33, 2.12, 2.54, 3.16, 2.85, 2.74, 2.11, 1.76, 1.78, - 1.87, 1.93, 2.11, 2.17, 2.21, 1.98, 1.45, 1.18, 1.27, 1.41, - 1.55, 1.81, 1.89, 1.66, 1.30, 1.37, 0.76, 0.71, 0.57, 0.32, - 0.12, 0.01}; - double evalBELLE[62]; - for(unsigned int ix=0;ix<62;++ix) { - evalBELLE[ix]=sqrt(sqr(errorstatBELLE[ix])+sqr(errorsystBELLE[ix])); - if(ix<31) { - dvalBELLE[ix]*=1e-3; - evalBELLE[ix]*=1e-3; - } - else { - dvalBELLE[ix]*=1e-4; - evalBELLE[ix]*=1e-4; - } - } - vector bins(valsBELLE ,valsBELLE +63); - vector data = vector(dvalBELLE ,dvalBELLE +62); - vector error = vector(evalBELLE ,evalBELLE +62); - _m2pipiBELLE= new_ptr(Histogram(bins,data,error)); - double valsCLEO[]={0.275,0.300,0.325,0.350,0.375,0.400,0.425,0.450,0.475,0.500, - 0.525,0.550,0.575,0.600,0.625,0.650,0.675,0.700,0.725,0.750, - 0.775,0.800,0.825,0.850,0.875,0.900,0.925,0.950,0.975,1.000, - 1.050,1.100,1.150,1.200,1.250,1.300,1.350,1.400,1.450,1.500, - 1.550,1.600,1.650,1.700}; - double dvalCLEO[]={ 1.5 , 8.0 , 6.0 , 8.5 , 15.6 , - 16.2 , 24.9 , 41.4 , 50.6 , 60.9 , - 79.8 , 107.4 , 144.3 , 204.5 , 269.1 , - 385.8 , 571.5 , 826.8 ,1078.4 , 1228.1 , - 1114.7 , 878.1 , 629.3 , 446.7 , 326.2 , - 262.1 , 207.3 , 158.8 , 129.6 , 202.8 , - 151.0 , 111.0 , 87.0 , 63.9 , 42.7 , - 29.2 , 18.1 , 6.98, 2.91, 0.71, - 0.59, 0.68, 0.28}; - double evalCLEO[]={ 1.4 , 2.5 , 2.6 , 2.3 , 2.6 , 2.9 , 3.1 , 3.4 , 3.7 , 4.0 , - 4.4 , 4.7 , 5.2 , 5.9 , 6.5 , 7.5 , 8.7 ,10.1 ,11.3 ,11.8 , - 11.0 , 9.6 , 7.9 , 6.6 , 5.5 , 4.9 , 4.3 , 3.7 , 3.4 , 4.8 , - 4.1 , 3.4 , 3.0 , 2.5 , 2.0 , 1.7 , 1.3 , 0.84, 0.59, 0.32, - 0.25, 0.26, 0.21}; - for(unsigned int ix=0;ix<43;++ix) { - if(ix<29) { - dvalCLEO[ix]*=1e-4/0.025; - evalCLEO[ix]*=1e-4/0.025; - } - else { - dvalCLEO[ix]*=1e-4/0.05; - evalCLEO[ix]*=1e-4/0.05; - } - } - bins = vector(valsCLEO ,valsCLEO +44); - data = vector(dvalCLEO ,dvalCLEO +43); - error = vector(evalCLEO ,evalCLEO +43); - _mpipiCLEO= new_ptr(Histogram(bins,data,error)); - _m2KpiA=new_ptr(Histogram(0.,3.15,200)); - _mKpiA =new_ptr(Histogram(0.,1.8,200)); - _m2KpiB=new_ptr(Histogram(0.,3.15,200)); - _mKpiB =new_ptr(Histogram(0.,1.8,200)); - _m2KpiC=new_ptr(Histogram(0.,3.15,200)); - _m2KpiD=new_ptr(Histogram(0.,3.15,200)); - _m2Keta=new_ptr(Histogram(0.,3.15,200)); - _mKeta =new_ptr(Histogram(0.,1.8,200)); - _m2KK =new_ptr(Histogram(0.,3.15,200)); - _mKK =new_ptr(Histogram(0.,1.8,200)); -} - -void TauTo2MesonAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - tPVector hadrons=event->getFinalState(); - map taus; - for(unsigned int ix=0;ixparents().empty()) mother=mother->parents()[0]; - else mother=tPPtr(); - } - while(mother&&abs(mother->id())!=ParticleID::tauminus); - if(mother&&abs(mother->id())==ParticleID::tauminus) { - if(taus.find(mother)==taus.end()) { - taus.insert(make_pair(mother,ParticleVector())); - } - taus[mother].push_back(hadrons[ix]); - } - } - map::const_iterator tit; - for(tit=taus.begin();tit!=taus.end();++tit) { - if(tit->second.size()!=3) continue; - ParticleVector decay=tit->second; - using Constants::pi; - unsigned int npi0(0),npip(0),nkp(0),nk0(0),neta(0); - Lorentz5Momentum pdecay; - for(unsigned int ix=0;ixid()); - if(id!=ParticleID::nu_tau) pdecay+=decay[ix]->momentum(); - if(id==ParticleID::pi0) ++npi0; - else if(id==ParticleID::piplus) ++npip; - else if(id==ParticleID::Kplus) ++nkp; - else if(id==ParticleID::K0) ++nk0; - else if(id==ParticleID::eta) ++neta; - } - double mass2 = pdecay.m2()/GeV2; - double mass = sqrt(mass2); - if(npi0==1&&npip==1) { - *_m2pipiBELLE+=mass2; - *_mpipiCLEO+=mass; - } - else if(nkp==1&&npi0==1) { - *_m2KpiA+=mass2; - *_mKpiA+=mass; - double mtau=getParticleData(ParticleID::tauminus)->mass()/GeV; - double m1=getParticleData(ParticleID::Kplus)->mass()/GeV; - double m2=getParticleData(ParticleID::pi0)->mass()/GeV; - double q=0.5*sqrt((sqr(mass2-sqr(m1)-sqr(m2))-4*sqr(m1*m2))/mass2); - double fact = sqr(mtau*mtau-mass2)*q/mass2/mass/mtau* - (2.*mass2+sqr(mtau))/3./sqr(mtau) - *generator()->standardModel()->CKM(0,1)/pow(2.,8)/pow(pi,3)*sqr(1.16637e-5/GeV2) - /(2.26501e-11*MeV)*GeV2*GeV2*GeV; - _m2KpiC->addWeighted(mass2,1./fact); - } - else if(nk0==1&&npip==1) { - *_m2KpiB+=mass2; - *_mKpiB+=mass; - double mtau=getParticleData(ParticleID::tauminus)->mass()/GeV; - double m1=getParticleData(ParticleID::K0)->mass()/GeV; - double m2=getParticleData(ParticleID::piplus)->mass()/GeV; - double q=0.5*sqrt((sqr(mass2-sqr(m1)-sqr(m2))-4*sqr(m1*m2))/mass2); - double fact = sqr(mtau*mtau-mass2)*q/mass2/mass/mtau* - (2.*mass2+sqr(mtau))/3./sqr(mtau) - *generator()->standardModel()->CKM(0,1)/pow(2.,8)/pow(pi,3)*sqr(1.16637e-5/GeV2) - /(2.26501e-11*MeV)*GeV2*GeV2*GeV; - _m2KpiD->addWeighted(mass2,1./fact); - } - else if(neta==1&&nkp==1) { - *_m2Keta+=mass2; - *_mKeta+=mass; - } - else if(nkp==1&&nk0==1) { - *_m2KK +=mass2; - *_mKK +=mass; - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTauTo2MesonAnalysis("Herwig::TauTo2MesonAnalysis", "HwTauAnalysis.so"); - -void TauTo2MesonAnalysis::Init() { - - static ClassDocumentation documentation - ("The TauTo2MesonAnalysis class plots the mass distributions of tau decays to" - "two mesons."); - -} - -void TauTo2MesonAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _m2pipiBELLE->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P203 mass", - "GX XGX X ", - "1/SdS/dm2230P2+3P2031/GeV2-23", - " G G X XXGX XGX XX X X", - "m2230P2+3P2031/GeV223", - " X XXGX XGX XX X X"); - _mpipiCLEO->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P203 mass", - "GX XGX X ", - "1/SdS/dm0P2+3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2031/GeV", - " XGX XGX XX "); - _m2KpiA->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3P203 mass", - " X XGX X ", - "1/SdS/dm2230K2+3P2031/GeV2-23", - " G G X XX X XGX XX X X", - "m2230K2+3P2031/GeV223", - " X XX X XGX XX X X"); - _mKpiA->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3P203 mass", - " X XGX X ", - "1/SdS/dm0K2+3P2031/GeV2-13", - " G G X X XGX XX X X", - "m0K2+3P2031/GeV", - " X X XGX XX "); - _m2KpiC->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3P203 mass", - " X XGX X ", - "1/SdS/dm2230K2+3P2031/GeV2-23", - " G G X XX X XGX XX X X", - "m2230K2+3P2031/GeV223", - " X XX X XGX XX X X"); - _m2KpiB->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3K203 mass", - "GX X X X ", - "1/SdS/dm2230P2+3K2031/GeV2-23", - " G G X XXGX X X XX X X", - "m2230P2+3K2031/GeV223", - " X XXGX X X XX X X"); - _mKpiB->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3K203 mass", - "GX X X X ", - "1/SdS/dm0P2+3K2031/GeV2-13", - " G G XGX X X XX X X", - "m0P2+3K2031/GeV", - " XGX X X XX "); - _m2KpiD->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3K203 mass", - "GX X X X ", - "1/SdS/dm2230P2+3K2031/GeV2-23", - " G G X XXGX X X XX X X", - "m2230P2+3K2031/GeV223", - " X XXGX X X XX X X"); - _m2Keta->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3H mass", - " X XG ", - "1/SdS/dm2230K2+3H1/GeV2-23", - " G G X XX X XGX X X", - "m2230K2+3H1/GeV223", - " X XX X XGX X X"); - _mKeta->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3H mass", - " X XG ", - "1/SdS/dm0K2+3H1/GeV2-13", - " G G X X XGX X X", - "m0K2+3H1/GeV", - " X X XGX "); - _m2KK->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3K203 mass", - " X X X X ", - "1/SdS/dm2230K2+3K2031/GeV2-23", - " G G X XX X X X XX X X", - "m2230K2+3K2031/GeV223", - " X XX X X X XX X X"); - _mKK->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2+3K203 mass", - " X X X X ", - "1/SdS/dm0K2+3K2031/GeV2-13", - " G G X X X X XX X X", - "m0K2+3K2031/GeV", - " X X X X XX "); -} - - diff --git a/Contrib/TauAnalysis/TauTo2MesonAnalysis.h b/Contrib/TauAnalysis/TauTo2MesonAnalysis.h deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo2MesonAnalysis.h +++ /dev/null @@ -1,144 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_TauTo2MesonAnalysis_H -#define HERWIG_TauTo2MesonAnalysis_H -// -// This is the declaration of the TauTo2MesonAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The TauTo2MesonAnalysis class is designed to perform the analysis of the - * mass distribution of the hadronic decay products of the \f$\tau\f$ in the decays - * \f$\tau^\pm\to\nu_\tau\{\pi^\pm\pi^0,K^\pm\pi^0,K^0\pi^\pm,K^\pm\eta,K^\pm K^0\}\f$. - * In order to work the \f$\pi^0\f$, \f$K^0\f$, \f$K^\pm\f$ and \f$\eta\f$ should be - * set stable. - * - * The mass spectrum of the \f$pi^\pm\pi^0\f$ final state is compared to CLEO and - * BELLE data. - * - * @see \ref TauTo2MesonAnalysisInterfaces "The interfaces" - * defined for TauTo2MesonAnalysis. - */ -class TauTo2MesonAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - using AnalysisHandler::analyze; - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - TauTo2MesonAnalysis & operator=(const TauTo2MesonAnalysis &) = delete; - -private: - - /** - * Histograms for the mass plots - */ - //@{ - /** - * Mass of the pions in \f$\tau\pm\to\nu_\tau\pi^0\pi^\pm\f$ compared to BELLE - * and CLEO data. - */ - HistogramPtr _m2pipiBELLE,_mpipiCLEO; - - /** - * Mass of the Kaons and pions in \f$\tau\to K\pi\f$ - */ - HistogramPtr _m2KpiA,_m2KpiB,_mKpiA,_mKpiB,_m2KpiC,_m2KpiD; - - /** - * Mass of the \f$K\eta\f$ - */ - HistogramPtr _m2Keta,_mKeta; - - /** - * Mass of the \f$KK\f$ - */ - HistogramPtr _m2KK,_mKK; - //@} - -}; - -} - -#endif /* HERWIG_TauTo2MesonAnalysis_H */ diff --git a/Contrib/TauAnalysis/TauTo3MesonAnalysis.cc b/Contrib/TauAnalysis/TauTo3MesonAnalysis.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo3MesonAnalysis.cc +++ /dev/null @@ -1,555 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the TauTo3MesonAnalysis class. -// - -#include "TauTo3MesonAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "Herwig/Utilities/Histogram.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Interface/ClassDocumentation.h" - -using namespace Herwig; - -void TauTo3MesonAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<4;++ix) { - _m3pippimpim .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3pi0pi0pim .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3kmpimkp .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3k0pimk0 .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3kmpi0k0 .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3pi0pi0km .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3kmpimpip .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3pimk0pi0 .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3pimpi0eta .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3pimpi0gamma .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3kspimks .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3klpimkl .push_back(new_ptr(Histogram(0.,1.8,200))); - _m3kspimkl .push_back(new_ptr(Histogram(0.,1.8,200))); - } -} - -void TauTo3MesonAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - - _m3pippimpim[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3P2-3 mass in T2-3RN0T1P2+3P2-3P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P2+3P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2+3P2-3P2-31/GeV", - " XGX XGX XGX XX "); - _m3pippimpim[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3 mass in T2-3RN0T1P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P2-3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2-31/GeV", - " XGX XGX XX "); - _m3pippimpim[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3 mass in T2-3RN0T1P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P2+3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2-31/GeV", - " XGX XGX XX "); - _m3pi0pi0pim[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203P203 mass in T2-3RN0T1P2-3P203P203", - "GX XGX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P2-3P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2-3P203P2031/GeV", - " XGX XGX XGX XX "); - _m3pi0pi0pim[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203 mass in T2-3RN0T1P2-3P203P203", - "GX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P203P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2031/GeV", - " XGX XGX XX "); - _m3pi0pi0pim[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T1P2-3P203P203", - "GX XGX X GX XWGXGXGX XGX XGX X", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _m3kmpimkp[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P2-3K2+3 mass in T2-3RN0T1K2-3P2-3K2+3", - " X XGX X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3P2-3K2+31/GeV2-13", - " G G X X XGX X X XX X X", - "m0K2-3P2-3K2+31/GeV", - " X X XGX X X XX "); - _m3kmpimkp[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P2-3 mass in T2-3RN0T1K2-3P2-3K2+3", - " X XGX X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3P2-31/GeV2-13", - " G G X X XGX XX X X", - "m0K2-3P2-31/GeV", - " X X XGX XX "); - _m3kmpimkp[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3K2+3 mass in T2-3RN0T1K2-3P2-3K2+3", - " X X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3K2+31/GeV2-13", - " G G X X X X XX X X", - "m0K2-3K2+31/GeV", - " X X X X XX "); - _m3kmpimkp[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3K2+3 mass in T2-3RN0T1K2-3P2-3K2+3", - "GX X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0P2-3K2+31/GeV2-13", - " G G XGX X X XX X X", - "m0P2-3K2+31/GeV", - " XGX X X XX "); - _m3k0pimk0[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K203P2-3K0O203 mass in T2-3RN0T1K203P2-3K0O203", - " X XGX X UDX X GX XWGXGX X XGX X UDX X", - "1/SdS/dm0K203P2-3K0O2031/GeV2-13", - " G G X X XGX X UDX XX X X", - "m0K203P2-3K0O2031/GeV", - " X X XGX X UDX XX "); - _m3k0pimk0[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K203P2-3 mass in T2-3RN0T1K203P2-3K0O2033", - " X XGX X GX XWGXGX X XGX X UDX XX", - "1/SdS/dm0K203P2-31/GeV2-13", - " G G X X XGX XX X X", - "m0K203P2-31/GeV", - " X X XGX XX "); - _m3k0pimk0[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K203K0O203 mass in T2-3RN0T1K203P2-3K0O203", - " X X UDX X GX XWGXGX X XGX X UDX X", - "1/SdS/dm0K203K0O2031/GeV2-13", - " G G X X X UDX XX X X", - "m0K203K0O2031/GeV", - " X X X UDX XX "); - _m3k0pimk0[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3K0O203 mass in T2-3RN0T1K203P2-3K0O203", - "GX X UDX X GX XWGXGX X XGX X UDX X", - "1/SdS/dm0P2-3K0O2031/GeV2-13", - " G G XGX X UDX XX X X", - "m0P2-3K0O2031/GeV", - " XGX X UDX XX "); - _m3kmpi0k0[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P203K203 mass in T2-3RN0T1K2-3P203K203", - " X XGX X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3P203K2031/GeV2-13", - " G G X X XGX X X XX X X", - "m0K2-3P203K2031/GeV", - " X X XGX X X XX "); - _m3kmpi0k0[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P203 mass in T2-3RN0T1K2-3P203K203", - " X XGX X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3P2031/GeV2-13", - " G G X X XGX XX X X", - "m0K2-3P2031/GeV", - " X X XGX XX "); - _m3kmpi0k0[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3K203 mass in T2-3RN0T1K2-3P203K203", - " X X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0K2-3K2031/GeV2-13", - " G G X X X X XX X X", - "m0K2-3K2031/GeV", - " X X X X XX "); - _m3kmpi0k0[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203K203 mass in T2-3RN0T1K2-3P203K203", - "GX X X X GX XWGXGX X XGX X X X", - "1/SdS/dm0P203K2031/GeV2-13", - " G G XGX X X XX X X", - "m0P203K2031/GeV", - " XGX X X XX "); - _m3pi0pi0km[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203K2-3 mass in T2-3RN0T1P203P203K2-3", - "GX XGX X X X GX XWGXGXGX XGX X X X", - "1/SdS/dm0P203P203K2-31/GeV2-13", - " G G XGX XGX X X XX X X", - "m0P203P203K2-31/GeV", - " XGX XGX X X XX "); - _m3pi0pi0km[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203 mass in T2-3RN0T1P203P203K2-3", - "GX XGX X GX XWGXGXGX XGX X X X", - "1/SdS/dm0P203P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2031/GeV", - " XGX XGX XX "); - _m3pi0pi0km[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203K2-3 mass in T2-3RN0T1P203P203K2-3", - "GX X X X GX XWGXGXGX XGX X X X", - "1/SdS/dm0P203K2-31/GeV2-13", - " G G XGX X X XX X X", - "m0P203K2-31/GeV", - " XGX X X XX "); - _m3kmpimpip[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P2-3P2+3 mass in T2-3RN0T1K2-3P2-3P2+3", - " X XGX XGX X GX XWGXGX X XGX XGX X", - "1/SdS/dm0K2-3P2-3P2+31/GeV2-13", - " G G X X XGX XGX XX X X", - "m0K2-3P2-3P2+31/GeV", - " X X XGX XGX XX "); - _m3kmpimpip[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P2-3 mass in T2-3RN0T1K2-3P2-3P2+3", - " X XGX X GX XWGXGX X XGX XGX X", - "1/SdS/dm0K2-3P2-31/GeV2-13", - " G G X X XGX XX X X", - "m0K2-3P2-31/GeV", - " X X XGX XX "); - _m3kmpimpip[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2-3P2+3 mass in T2-3RN0T1K2-3P2-3P2+3", - " X XGX X GX XWGXGX X XGX XGX X", - "1/SdS/dm0P2-3P2+31/GeV2-13", - " G G XGX XGX XX X X", - "m0K2-3P2+31/GeV", - " X X XGX XX "); - _m3kmpimpip[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2+3 mass in T2-3RN0T1K2-3P2-3P2+3", - "GX XGX X GX XWGXGX X XGX XGX X", - "1/SdS/dm0P2-3P2+31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2+31/GeV", - " XGX XGX XX "); - _m3pimk0pi0[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203K0O203 mass in T2-3RN0T1P2-3P203K0O203", - "GX XGX X UDX X GX XWGXGXGX XGX X UDX X", - "1/SdS/dm0P2-3P203K0O2031/GeV2-13", - " G G XGX XGX X UDX XX X X", - "m0P2-3P203K0O2031/GeV", - " XGX XGX X UDX XX "); - _m3pimk0pi0[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3K0O203 mass in T2-3RN0T1P2-3P203K0O203", - "GX X UDX X GX XWGXGXGX XGX X UDX X", - "1/SdS/dm0P2-3K0O2031/GeV2-13", - " G G XGX X UDX XX X X", - "m0P2-3K0O2031/GeV", - " XGX X UDX XX "); - _m3pimk0pi0[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T1P2-3P203K0O203", - "GX XGX X GX XWGXGXGX XGX X UDX X", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _m3pimk0pi0[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203K0O203 mass in T2-3RN0T1P2-3P203K0O203", - "GX X UDX X GX XWGXGXGX XGX X UDX X", - "1/SdS/dm0P203K0O2031/GeV2-13", - " G G XGX X UDX XX X X", - "m0P203K0O2031/GeV", - " XGX X UDX XX "); - _m3pimpi0eta[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203H mass in T2-3RN0T1P2-3P203H", - "GX XGX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3P203H1/GeV2-13", - " G G XGX XGX XGX X X", - "m0P2-3P203H1/GeV", - " XGX XGX XGX "); - _m3pimpi0eta[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T1P2-3P203H", - "GX XGX X GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _m3pimpi0eta[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3H mass in T2-3RN0T1P2-3P203H", - "GX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3H1/GeV2-13", - " G G XGX XGX X X", - "m0P2-3H1/GeV", - " XGX XGX "); - _m3pimpi0eta[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203H mass in T2-3RN0T1P2-3P203H", - "GX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P203H1/GeV2-13", - " G G XGX XGX X X", - "m0P203H1/GeV", - " XGX XGX "); - _m3pimpi0gamma[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203G mass in T2-3RN0T1P2-3P203G", - "GX XGX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3P203G1/GeV2-13", - " G G XGX XGX XGX X X", - "m0P2-3P203G1/GeV", - " XGX XGX XGX "); - _m3pimpi0gamma[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P203 mass in T2-3RN0T1P2-3P203G", - "GX XGX X GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2031/GeV", - " XGX XGX XX "); - _m3pimpi0gamma[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3G mass in T2-3RN0T1P2-3P203G", - "GX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P2-3G1/GeV2-13", - " G G XGX XGX X X", - "m0P2-3G1/GeV", - " XGX XGX "); - _m3pimpi0gamma[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203G mass in T2-3RN0T1P2-3P203G", - "GX XG GX XWGXGXGX XGX XG", - "1/SdS/dm0P203G1/GeV2-13", - " G G XGX XGX X X", - "m0P203G1/GeV", - " XGX XGX "); - _m3kspimks[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1P2-3K2030S1 mass in T2-3RN0T1K2030S1P2-3K2030S1", - " X XX XGX X X XX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030S1P2-3K2030S11/GeV2-13", - " G G X X XX XGX X X XX XX X X", - "m0K2030S1P2-3K2030S11/GeV", - " X X XX XGX X X XX XX "); - _m3kspimks[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1P2-3 mass in T2-3RN0T1K2030S1P2-3K2030S1", - " X XX XGX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030S1P2-31/GeV2-13", - " G G X X XX XGX XX X X", - "m0K2030S1P2-31/GeV", - " X X XX XGX XX "); - _m3kspimks[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1K2030S1 mass in T2-3RN0T1K2030S1P2-3K2030S1", - " X XX X X XX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030S1K2030S11/GeV2-13", - " G G X X XX X X XX XX X X", - "m0K2030S1K2030S11/GeV", - " X X XX X X XX XX "); - _m3klpimkl[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030L1P2-3K2030L1 mass in T2-3RN0T1K2030L1P2-3K2030L1", - " X XX XGX X X XX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030L1P2-3K2030L11/GeV2-13", - " G G X X XX XGX X X XX XX X X", - "m0K2030L1P2-3K2030L11/GeV", - " X X XX XGX X X XX XX "); - _m3klpimkl[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030L1P2-3 mass in T2-3RN0T1K2030L1P2-3K2030L1", - " X XX XGX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030L1P2-31/GeV2-13", - " G G X X XX XGX XX X X", - "m0K2030L1P2-31/GeV", - " X X XX XGX XX "); - _m3klpimkl[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030L1K2030L1 mass in T2-3RN0T1K2030L1P2-3K2030L1", - " X XX X X XX X GX XWGXGX X XX XGX X X XX X", - "1/SdS/dm0K2030L1K2030L11/GeV2-13", - " G G X X XX X X XX XX X X", - "m0K2030L1K2030L11/GeV", - " X X XX X X XX XX "); - _m3kspimkl[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1P2-3K0L1 mass in T2-3RN0T1K2030S1P2-3K0L1", - " X XX XGX X X X GX XWGXGX X XX XGX X X X", - "1/SdS/dm0K2030S1P2-3K0L11/GeV2-13", - " G G X X XX XGX X X XX X X", - "m0K2030S1P2-3K0L11/GeV", - " X X XX XGX X X XX "); - _m3kspimkl[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1P2-3 mass in T2-3RN0T1K2030S1P2-3K0L1", - " X XX XGX X GX XWGXGX X XX XGX X X X", - "1/SdS/dm0K2030S1P2-31/GeV2-13", - " G G X X XX XGX XX X X", - "m0K2030S1P2-31/GeV", - " X X XX XGX XX "); - _m3kspimkl[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "K2030S1K0L1 mass in T2-3RN0T1K2030S1K0L1", - " X XX X X X GX XWGXGX X XX X X X", - "1/SdS/dm0K2030S1K0L11/GeV2-13", - " G G X X XX X X XX X X", - "m0K2030S1K0L11/GeV", - " X X XX X X XX "); - _m3kspimkl[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "1P2-3K0L1 mass in T2-3RN0T1K2030S1P2-3K0L1", - "XGX X X X GX XWGXGX X XX XGX X X X", - "1/SdS/dm0P2-3K0L11/GeV2-13", - " G G XGX X X XX X X", - "m0P2-3K0L11/GeV", - " XGX X X XX "); -} - - - -void TauTo3MesonAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector hadrons=event->getFinalState(); - map taus; - for(unsigned int ix=0;ixparents().empty()) mother=mother->parents()[0]; - else mother=tPPtr(); - } - while(mother&&abs(mother->id())!=ParticleID::tauminus); - if(mother&&abs(mother->id())==ParticleID::tauminus) { - if(taus.find(mother)==taus.end()) { - taus.insert(make_pair(mother,ParticleVector())); - } - taus[mother].push_back(hadrons[ix]); - } - } - map::const_iterator tit; - for(tit=taus.begin();tit!=taus.end();++tit) { - if(tit->second.size()!=4) continue; - ParticleVector decay=tit->second; - int tsign=tit->first->id()/abs(tit->first->id()); - vector ppi0,ppip,ppim,pkp,pkm,pk0,pk0bar,peta,pgamma,pkl,pks; - Lorentz5Momentum ptotal; - for(unsigned int ix=0;ixid()*tsign; - if(abs(id)!=ParticleID::nu_tau) ptotal+=decay[ix]->momentum(); - if(id==ParticleID::piplus) ppip .push_back(decay[ix]->momentum()); - else if(id==ParticleID::piminus) ppim .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::pi0) ppi0 .push_back(decay[ix]->momentum()); - else if(id==ParticleID::Kplus) pkp .push_back(decay[ix]->momentum()); - else if(id==ParticleID::Kminus) pkm .push_back(decay[ix]->momentum()); - else if(id==ParticleID::K0) pk0 .push_back(decay[ix]->momentum()); - else if(id==ParticleID::Kbar0) pk0bar.push_back(decay[ix]->momentum()); - else if(id==ParticleID::eta) peta .push_back(decay[ix]->momentum()); - else if(id==ParticleID::gamma) pgamma.push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::K_S0) pks .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::K_L0) pkl .push_back(decay[ix]->momentum()); - } - if(ppim.size()==2&&ppip.size()==1) { - *_m3pippimpim[0] += ptotal.m()/GeV; - *_m3pippimpim[1] += (ppim[0]+ppim[1]).m()/GeV; - *_m3pippimpim[2] += (ppim[0]+ppip[0]).m()/GeV; - *_m3pippimpim[2] += (ppim[1]+ppip[0]).m()/GeV; - } - else if(ppim.size()==1&&ppi0.size()==2) { - *_m3pi0pi0pim[0] += ptotal.m()/GeV; - *_m3pi0pi0pim[1] += (ppi0[0]+ppi0[1]).m()/GeV; - *_m3pi0pi0pim[2] += (ppi0[0]+ppim[0]).m()/GeV; - *_m3pi0pi0pim[2] += (ppi0[1]+ppim[0]).m()/GeV; - } - else if(pkm.size()==1&&pkp.size()==1&&ppim.size()==1) { - *_m3kmpimkp[0] += ptotal.m()/GeV; - *_m3kmpimkp[1] += (pkm[0]+ppim[0]).m()/GeV; - *_m3kmpimkp[2] += (pkm[0]+ pkp[0]).m()/GeV; - *_m3kmpimkp[3] += (pkp[0]+ppim[0]).m()/GeV; - } - else if(pk0.size()==1&&pk0bar.size()==1&&ppim.size()==1) { - *_m3k0pimk0[0] += ptotal.m()/GeV; - *_m3k0pimk0[1] += (pk0[0] +ppim[0] ).m()/GeV; - *_m3k0pimk0[2] += (pk0[0] +pk0bar[0]).m()/GeV; - *_m3k0pimk0[3] += (pk0bar[0]+ppim[0] ).m()/GeV; - } - else if(pk0.size()==1&&pkm.size()==1&&ppi0.size()==1) { - *_m3kmpi0k0[0] += ptotal.m()/GeV; - *_m3kmpi0k0[1] += (pkm[0]+ppi0[0]).m()/GeV; - *_m3kmpi0k0[2] += (pkm[0]+pk0[0] ).m()/GeV; - *_m3kmpi0k0[3] += (pk0[0]+ppi0[0]).m()/GeV; - } - else if(ppi0.size()==2&&pkm.size()==1) { - *_m3pi0pi0km[0] += ptotal.m()/GeV; - *_m3pi0pi0km[1] += (ppi0[0]+ppi0[1]).m()/GeV; - *_m3pi0pi0km[2] += (ppi0[0]+pkm[0] ).m()/GeV; - *_m3pi0pi0km[3] += (ppi0[1]+pkm[0] ).m()/GeV; - } - else if(pkm.size()==1&&ppim.size()==1&&ppip.size()==1) { - *_m3kmpimpip[0] += ptotal.m()/GeV; - *_m3kmpimpip[1] += (pkm[0]+ppim[0]).m()/GeV; - *_m3kmpimpip[2] += (pkm[0]+ppip[0] ).m()/GeV; - *_m3kmpimpip[3] += (ppip[0]+ppim[0] ).m()/GeV; - } - else if(ppim.size()==1&&pk0bar.size()==1&&ppi0.size()==1) { - *_m3pimk0pi0[0] += ptotal.m()/GeV; - *_m3pimk0pi0[1] += (ppim[0]+pk0bar[0]).m()/GeV; - *_m3pimk0pi0[2] += (ppim[0]+ppi0[0] ).m()/GeV; - *_m3pimk0pi0[3] += (pk0bar[0]+ppi0[0]).m()/GeV; - } - else if(ppim.size()==1&&ppi0.size()==1&&peta.size()==1) { - *_m3pimpi0eta[0] += ptotal.m()/GeV; - *_m3pimpi0eta[1] += (ppim[0]+ppi0[0]).m()/GeV; - *_m3pimpi0eta[2] += (ppim[0]+peta[0]).m()/GeV; - *_m3pimpi0eta[3] += (ppi0[0]+peta[0]).m()/GeV; - } - else if(ppim.size()==1&&ppi0.size()==1&&pgamma.size()==1) { - *_m3pimpi0gamma[0] += ptotal.m()/GeV; - *_m3pimpi0gamma[1] += (ppim[0]+ppi0[0]).m()/GeV; - *_m3pimpi0gamma[2] += (ppim[0]+pgamma[0]).m()/GeV; - *_m3pimpi0gamma[3] += (ppi0[0]+pgamma[0]).m()/GeV; - } - else if(pks.size()==2&&ppim.size()==1) { - *_m3kspimks[0] += ptotal.m()/GeV; - *_m3kspimks[1] += (ppim[0]+pks[0]).m()/GeV; - *_m3kspimks[1] += (ppim[0]+pks[1]).m()/GeV; - *_m3kspimks[2] += (pks [0]+pks[1]).m()/GeV; - } - else if(pkl.size()==2&&ppim.size()==1) { - *_m3klpimkl[0] += ptotal.m()/GeV; - *_m3klpimkl[1] += (ppim[0]+pkl[0]).m()/GeV; - *_m3klpimkl[1] += (ppim[0]+pkl[1]).m()/GeV; - *_m3klpimkl[2] += (pkl [0]+pkl[1]).m()/GeV; - } - else if(pks.size()==1&&pkl.size()==1&&ppim.size()==1) { - *_m3kspimkl[0] += ptotal.m()/GeV; - *_m3kspimkl[1] += (ppim[0]+pks[0]).m()/GeV; - *_m3kspimkl[2] += (pks[0] +pkl[0]).m()/GeV; - *_m3kspimkl[3] += (ppim[0]+pkl[0]).m()/GeV; - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTauTo3MesonAnalysis("Herwig::TauTo3MesonAnalysis", "HwTauAnalysis.so"); - -void TauTo3MesonAnalysis::Init() { - - static ClassDocumentation documentation - ("The TauTo2MesonAnalysis class plots the mass distributions of tau decays to" - "three mesons."); - -} - diff --git a/Contrib/TauAnalysis/TauTo3MesonAnalysis.h b/Contrib/TauAnalysis/TauTo3MesonAnalysis.h deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo3MesonAnalysis.h +++ /dev/null @@ -1,187 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_TauTo3MesonAnalysis_H -#define HERWIG_TauTo3MesonAnalysis_H -// -// This is the declaration of the TauTo3MesonAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * The TauTo3MesonAnalysis class is designed to perform the analysis of the - * mass distribution of the hadronic decay products of the \f$\tau\f$ in the decays - * - \f$\tau^-\to\nu_tau \pi^+\pi^-\pi^- \f$ - * - \f$\tau^-\to\nu_tau \pi^0\pi^0\pi^- \f$ - * - \f$\tau^-\to\nu_tau K^-K^+\pi^- \f$ - * - \f$\tau^-\to\nu_tau K^0\bar{K}^0\pi^-\f$ - * - \f$\tau^-\to\nu_tau K^-K^0\pi^0 \f$ - * - \f$\tau^-\to\nu_tau \pi^0-\pi^0K^- \f$ - * - \f$\tau^-\to\nu_tau K^-\pi^-\pi^+ \f$ - * - \f$\tau^-\to\nu_tau \pi^-K^0\pi^0 \f$ - * - \f$\tau^-\to\nu_tau \pi^-\pi^0\eta \f$ - * - \f$\tau^-\to\nu_tau \pi^-\pi^0\gamma \f$ - * - * @see \ref TauTo3MesonAnalysisInterfaces "The interfaces" - * defined for TauTo3MesonAnalysis. - */ -class TauTo3MesonAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - using AnalysisHandler::analyze; - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - TauTo3MesonAnalysis & operator=(const TauTo3MesonAnalysis &) = delete; - -private: - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^+\pi^-\pi^- \f$ - */ - vector _m3pippimpim; - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^0\pi^0\pi^- \f$ - */ - vector _m3pi0pi0pim; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^-K^+\pi^- \f$ - */ - vector _m3kmpimkp; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^0\bar{K}^0\pi^-\f$ - */ - vector _m3k0pimk0; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^-K^0\pi^0 \f$ - */ - vector _m3kmpi0k0; - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^0\pi^0K^- \f$ - */ - vector _m3pi0pi0km; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^-\pi^-\pi^+ \f$ - */ - vector _m3kmpimpip; - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^-K^0\pi^0 \f$ - */ - vector _m3pimk0pi0; - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^-\pi^0\eta \f$ - */ - vector _m3pimpi0eta; - - /** - * Histograms for \f$\tau^-\to\nu_tau \pi^-\pi^0\gamma \f$ - */ - vector _m3pimpi0gamma; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^0_SK^0_S\pi^-\f$ - */ - vector _m3kspimks; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^0_LK^0_L\pi^-\f$ - */ - vector _m3klpimkl; - - /** - * Histograms for \f$\tau^-\to\nu_tau K^0_SK^0_L\pi^-\f$ - */ - vector _m3kspimkl; - - -}; - -} - -#endif /* HERWIG_TauTo3MesonAnalysis_H */ diff --git a/Contrib/TauAnalysis/TauTo4MesonAnalysis.cc b/Contrib/TauAnalysis/TauTo4MesonAnalysis.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo4MesonAnalysis.cc +++ /dev/null @@ -1,216 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the TauTo4MesonAnalysis class. -// - -#include "TauTo4MesonAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void TauTo4MesonAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector hadrons=event->getFinalState(); - map taus; - for(unsigned int ix=0;ixparents().empty()) mother=mother->parents()[0]; - else mother=tPPtr(); - } - while(mother&&abs(mother->id())!=ParticleID::tauminus); - if(mother&&abs(mother->id())==ParticleID::tauminus) { - if(taus.find(mother)==taus.end()) { - taus.insert(make_pair(mother,ParticleVector())); - } - taus[mother].push_back(hadrons[ix]); - } - } - map::const_iterator tit; - for(tit=taus.begin();tit!=taus.end();++tit) { - if(tit->second.size()!=5) continue; - ParticleVector decay=tit->second; - int tsign=tit->first->id()/abs(tit->first->id()); - vector ppi0,ppip,ppim,pkp,pkm,pk0,pk0bar,peta,pgamma; - Lorentz5Momentum ptotal; - for(unsigned int ix=0;ixid()*tsign; - if(abs(id)!=ParticleID::nu_tau) ptotal+=decay[ix]->momentum(); - if( id ==ParticleID::piplus) ppip .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::piminus) ppim .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::pi0) ppi0 .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kplus) pkp .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kminus) pkm .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::K0) pk0 .push_back(decay[ix]->momentum()); - else if( id ==ParticleID::Kbar0) pk0bar.push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::eta) peta .push_back(decay[ix]->momentum()); - else if(abs(id)==ParticleID::gamma) pgamma.push_back(decay[ix]->momentum()); - } - if(ppi0.size()==3&&ppim.size()==1) { - *_mpipi[0] += (ppi0[0]+ppim[0]).m()/GeV; - *_mpipi[0] += (ppi0[1]+ppim[0]).m()/GeV; - *_mpipi[0] += (ppi0[2]+ppim[0]).m()/GeV; - *_mpipi[1] += (ppi0[0]+ppi0[1]).m()/GeV; - *_mpipi[1] += (ppi0[0]+ppi0[2]).m()/GeV; - *_mpipi[1] += (ppi0[1]+ppi0[2]).m()/GeV; - *_mpipipi[0] += (ppi0[0]+ppi0[1]+ppi0[2]).m()/GeV; - *_mpipipi[1] += (ppi0[0]+ppi0[1]+ppim[0]).m()/GeV; - *_mpipipi[1] += (ppi0[0]+ppi0[2]+ppim[0]).m()/GeV; - *_mpipipi[1] += (ppi0[1]+ppi0[2]+ppim[0]).m()/GeV; - *_mpipipipi[0] += (ppi0[0]+ppi0[1]+ppi0[2]+ppim[0]).m()/GeV; - } - else if(ppi0.size()==1&&ppip.size()==1&&ppim.size()==2) { - *_mpipi[2] +=(ppi0[0]+ppip[0]).m()/GeV; - *_mpipi[3] +=(ppi0[0]+ppim[0]).m()/GeV; - *_mpipi[3] +=(ppi0[0]+ppim[1]).m()/GeV; - *_mpipi[4] +=(ppip[0]+ppim[0]).m()/GeV; - *_mpipi[4] +=(ppip[0]+ppim[1]).m()/GeV; - *_mpipi[5] +=(ppim[0]+ppim[1]).m()/GeV; - *_mpipipi[2] += (ppi0[0]+ppip[0]+ppim[0]).m()/GeV; - *_mpipipi[2] += (ppi0[0]+ppip[0]+ppim[1]).m()/GeV; - *_mpipipi[3] += (ppip[0]+ppim[0]+ppim[1]).m()/GeV; - *_mpipipi[4] += (ppi0[0]+ppim[0]+ppim[1]).m()/GeV; - *_mpipipipi[1] += (ppi0[0]+ppip[0]+ppim[0]+ppim[1]).m()/GeV; - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTauTo4MesonAnalysis("Herwig::TauTo4MesonAnalysis", "HwTauAnalysis.so"); - -void TauTo4MesonAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the TauTo4MesonAnalysis class"); - -} - -inline void TauTo4MesonAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _mpipi[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2-3 mass in T2-3RN0T1P203P203P203P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2-31/GeV", - " XGX XGX XX "); - _mpipi[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203 mass in T2-3RN0T1P203P203P203P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2031/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2031/GeV", - " XGX XGX XX "); - _mpipipi[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203P203 mass in T2-3RN0T1P203P203P203P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P203P2031/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P203P203P2031/GeV", - " XGX XGX XGX XX "); - _mpipipi[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203P2-3 mass in T2-3RN0T1P203P203P203P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P203P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P203P203P2-31/GeV", - " XGX XGX XGX XX "); - _mpipipipi[0]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P203P203P2-3 mass in T2-3RN0T1P203P203P203P2-3", - "GX XGX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P203P203P2-31/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P203P203P203P2-31/GeV", - " XGX XGX XGX XGX XX "); - _mpipi[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2+3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2+31/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2+31/GeV", - " XGX XGX XX "); - _mpipi[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P203P2-31/GeV", - " XGX XGX XX "); - _mpipi[4]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P2+3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2+3P2-31/GeV", - " XGX XGX XX "); - _mpipi[5]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2-3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P2-3P2-31/GeV2-13", - " G G XGX XGX XX X X", - "m0P2-3P2-31/GeV", - " XGX XGX XX "); - _mpipipi[2]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2+3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2+3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P203P2+3P2-31/GeV", - " XGX XGX XGX XX "); - _mpipipi[3]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P2+3P2-3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P2+3P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P2+3P2-3P2-31/GeV", - " XGX XGX XGX XX "); - _mpipipi[4]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2-3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XX X X", - "m0P203P2-3P2-31/GeV", - " XGX XGX XGX XX "); - _mpipipipi[1]->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "P203P2+3P2-3P2-3 mass in T2-3RN0T1P203P2+3P2-3P2-3", - "GX XGX XGX XGX X GX XWGXGXGX XGX XGX XGX X", - "1/SdS/dm0P203P2+3P2-3P2-31/GeV2-13", - " G G XGX XGX XGX XGX XX X X", - "m0P203P2+3P2-3P2-31/GeV", - " XGX XGX XGX XGX XX "); -} - -inline void TauTo4MesonAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - for(unsigned int ix=0;ix<5;++ix) { - _mpipi .push_back(new_ptr(Histogram(0.,1.8,200))); - _mpipipi.push_back(new_ptr(Histogram(0.,1.8,200))); - } - _mpipi .push_back(new_ptr(Histogram(0.,1.8,200))); - for(unsigned int ix=0;ix<2;++ix) { - _mpipipipi.push_back(new_ptr(Histogram(0.,1.8,200))); - } -} diff --git a/Contrib/TauAnalysis/TauTo4MesonAnalysis.h b/Contrib/TauAnalysis/TauTo4MesonAnalysis.h deleted file mode 100644 --- a/Contrib/TauAnalysis/TauTo4MesonAnalysis.h +++ /dev/null @@ -1,122 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_TauTo4MesonAnalysis_H -#define HERWIG_TauTo4MesonAnalysis_H -// -// This is the declaration of the TauTo4MesonAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the TauTo4MesonAnalysis class. - * - * @see \ref TauTo4MesonAnalysisInterfaces "The interfaces" - * defined for TauTo4MesonAnalysis. - */ -class TauTo4MesonAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - using AnalysisHandler::analyze; - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - TauTo4MesonAnalysis & operator=(const TauTo4MesonAnalysis &) = delete; - -private: - - /** - * Histograms for the \f$\pi\pi\f$ mass distributions - */ - vector _mpipi; - - /** - * Histograms for the \f$\pi\pi\pi\f$ mass distributions - */ - vector _mpipipi; - - /** - * Histograms for the \f$\pi\pi\pi\pi\f$ mass distributions - */ - vector _mpipipipi; -}; - -} - -#endif /* HERWIG_TauTo4MesonAnalysis_H */ diff --git a/Contrib/TauAnalysis/TauToLeptonsAnalysis.cc b/Contrib/TauAnalysis/TauToLeptonsAnalysis.cc deleted file mode 100644 --- a/Contrib/TauAnalysis/TauToLeptonsAnalysis.cc +++ /dev/null @@ -1,100 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the TauToLeptonsAnalysis class. -// - -#include "TauToLeptonsAnalysis.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/EventRecord/Event.h" -#include "ThePEG/PDT/EnumParticles.h" - - -using namespace Herwig; - -void TauToLeptonsAnalysis::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - tPVector hadrons=event->getFinalState(); - map taus; - for(unsigned int ix=0;ixparents().empty()) mother=mother->parents()[0]; - else mother=tPPtr(); - } - while(mother&&abs(mother->id())!=ParticleID::tauminus); - if(mother&&abs(mother->id())==ParticleID::tauminus) { - if(taus.find(mother)==taus.end()) { - taus.insert(make_pair(mother,ParticleVector())); - } - taus[mother].push_back(hadrons[ix]); - } - } - map::const_iterator tit; - for(tit=taus.begin();tit!=taus.end();++tit) { - if(tit->second.size()!=3) continue; - vector pdecay; - int type(0); - ParticleVector decay=tit->second; - for(unsigned int ix=0;ixid()); - if(id>=11&&id<=14) { - pdecay.push_back(decay[ix]->momentum()); - if(id==11) type=1; - else if(id==13) type=2; - } - } - if(pdecay.size()==2&&type!=0) { - Lorentz5Momentum pw=pdecay[0]+pdecay[1]; - pw.rescaleMass(); - if(type==1) { - *_emode+=pw.mass()/GeV; - } - else if(type==2) { - *_mmode+=pw.mass()/GeV; - } - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigTauToLeptonsAnalysis("Herwig::TauToLeptonsAnalysis", "HwTauAnalysis.so"); - -void TauToLeptonsAnalysis::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the TauToLeptonsAnalysis class"); - -} - -void TauToLeptonsAnalysis::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream output(fname.c_str()); - using namespace HistogramOptions; - _emode->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "e2-3N0O0e1 mass for T2-3RN0T1e2-3N0O0e1", - " X XGUDX X GX XWGXGX X XGUDX X", - "1/SdS/dm0e2-3N0O0e11/GeV2-13", - " G G X X XGUDX XX X X", - "m0e2-3N0O0e11/GeV", - " X X XGUDX XX "); - _mmode->topdrawOutput(output,Frame|Errorbars|Ylog, - "RED", - "M2-3N0O0M1 mass for T2-3RN0T1M2-3N0O0M1", - "GX XGUDXGX GX XWGXGXGX XGUDXGX", - "1/SdS/dm0M2-3N0O0M11/GeV2-13", - " G G XGX XGUDXGXX X X", - "m0M2-3N0O0M11/GeV", - " XGX XGUDXGXX "); -} - -void TauToLeptonsAnalysis::doinitrun() { - AnalysisHandler::doinitrun(); - _emode=new_ptr(Histogram(0.,1.8,200)); - _mmode=new_ptr(Histogram(0.,1.8,200)); -} diff --git a/Contrib/TauAnalysis/TauToLeptonsAnalysis.h b/Contrib/TauAnalysis/TauToLeptonsAnalysis.h deleted file mode 100644 --- a/Contrib/TauAnalysis/TauToLeptonsAnalysis.h +++ /dev/null @@ -1,117 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_TauToLeptonsAnalysis_H -#define HERWIG_TauToLeptonsAnalysis_H -// -// This is the declaration of the TauToLeptonsAnalysis class. -// - -#include "ThePEG/Repository/CurrentGenerator.h" -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the TauToLeptonsAnalysis class. - * - * @see \ref TauToLeptonsAnalysisInterfaces "The interfaces" - * defined for TauToLeptonsAnalysis. - */ -class TauToLeptonsAnalysis: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - - using AnalysisHandler::analyze; - //@} - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - TauToLeptonsAnalysis & operator=(const TauToLeptonsAnalysis &) = delete; - -private: - - /** - * Histogram for the electron final state - */ - HistogramPtr _emode; - - /** - * Histogram for the muon final state - */ - HistogramPtr _mmode; -}; - -} - -#endif /* HERWIG_TauToLeptonsAnalysis_H */ diff --git a/Contrib/VBFTest/ILC.in b/Contrib/VBFTest/ILC.in deleted file mode 100644 --- a/Contrib/VBFTest/ILC.in +++ /dev/null @@ -1,110 +0,0 @@ -# -*- ThePEG-repository -*- -################################################## -# Example generator based on ILC parameters -# usage: Herwig read ILC.in -# -# Since most parameters are identical to Event, -# we use the default EventGenerator and adapt only -# for the differences -################################################## -read snippets/EECollider.in -################################################### -# Change settings for the ee->Z->qq matrix element -# to produce only top quarks -# -# 'set' lines like this can be omitted if the -# default value is already okay. -# -# Any repository setting can be modified here -################################################### -cd /Herwig -create Herwig::O2AlphaS AlphaS2 -set Model:QCD/RunningAlphaS AlphaS2 -set Model:EW/CKM:theta_12 0.22274457 -set Model:EW/CKM:theta_13 0. -set Model:EW/CKM:theta_23 0. -set Model:EW/CKM:delta 0. -set Model:EW/Sin2ThetaW .2319 -create Herwig::AlphaEM AlphaEM2 -set Model:EW/RunningAlphaEM AlphaEM2 -cd /Herwig/MatrixElements -insert SubProcess:MatrixElements[0] MEee2HiggsVBF - -set MEee2HiggsVBF:Process ZZ -set MEee2HiggsVBF:ShapeScheme OnShell - -set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF -set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Particles/Z0:NominalMass 91.188 -set /Herwig/Particles/W+:NominalMass 80.42 -set /Herwig/Particles/W-:NominalMass 80.42 -set /Herwig/Masses/HiggsMass:BreitWignerShape 0 -#set /Herwig/Generators/EventGenerator:EventHandler:BeamB /Herwig/Particles/e- - - - -################################################## -# Technical parameters for this run -################################################## -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 100000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:DebugLevel 1 -set EventGenerator:PrintEvent 100 -set EventGenerator:MaxErrors 10000 -set EventGenerator:EventHandler:HadronizationHandler NULL -set EventGenerator:EventHandler:CascadeHandler NULL -set EventGenerator:EventHandler:DecayHandler NULL -set /Herwig/Analysis/Basics:CheckQuark 0 -################################################## -# ILC physics parameters (override defaults) -################################################## -set EventGenerator:EventHandler:LuminosityFunction:Energy 500.0 - -################################################## -# 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 EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot -# A HepMC dump file (requires --with-hepmc to be set at configure time) -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile -# set /Herwig/Analysis/HepMCFile:PrintEvent 100 -# set /Herwig/Analysis/HepMCFile:Format GenEvent -# set /Herwig/Analysis/HepMCFile:Units GeV_mm - -create Herwig::QuickVBF /Herwig/Analysis/QuickVBF VBFAnalysis.so -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/QuickVBF - -################################################## -# Save run for later usage with 'Herwig run' -################################################## -#saverun ILC EventGenerator - -################################################## -# 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 -################################################## -saverun ILC1 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun ILC2 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 1000 -saverun ILC3 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun ILC4 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 500 -set /Herwig/MatrixElements/MEee2HiggsVBF:Process WW -saverun ILC5 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun ILC6 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 1000 -saverun ILC7 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun ILC8 EventGenerator diff --git a/Contrib/VBFTest/LHC.in b/Contrib/VBFTest/LHC.in deleted file mode 100644 --- a/Contrib/VBFTest/LHC.in +++ /dev/null @@ -1,126 +0,0 @@ -# -*- ThePEG-repository -*- -################################################## -# Example generator based on LHC parameters -# usage: Herwig read LHC.in -################################################## -read PPCollider.in -cd /Herwig -create Herwig::O2AlphaS AlphaS2 -set Model:QCD/RunningAlphaS AlphaS2 -set Model:EW/CKM:theta_12 0.000001 -set Model:EW/CKM:theta_13 0. -set Model:EW/CKM:theta_23 0. -set Model:EW/CKM:delta 0. -set Model:EW/Sin2ThetaW .2319 -create Herwig::AlphaEM AlphaEM2 -set Model:EW/RunningAlphaEM AlphaEM2 - -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Particles/Z0:NominalMass 91.188 -set /Herwig/Particles/W+:NominalMass 80.42 -set /Herwig/Particles/W-:NominalMass 80.42 -set /Herwig/Masses/HiggsMass:BreitWignerShape 0 - -################################################## -# Technical parameters for this run -################################################## -cd /Herwig/Generators -set EventGenerator:NumberOfEvents 10000000 -set EventGenerator:RandomNumberGenerator:Seed 31122001 -set EventGenerator:DebugLevel 1 -set EventGenerator:PrintEvent 10 -set EventGenerator:MaxErrors 10000 -set EventGenerator:EventHandler:CascadeHandler NULL -set EventGenerator:EventHandler:DecayHandler NULL -set EventGenerator:EventHandler:HadronizationHandler NULL -set EventGenerator:EventHandler:StatLevel Full - -################################################## -# LHC physics parameters (override defaults here) -################################################## -set EventGenerator:EventHandler:LuminosityFunction:Energy 2000.0 -set EventGenerator:EventHandler:BeamB /Herwig/Particles/pbar- - -# Intrinsic pT tune extrapolated to LHC energy -set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 5.7*GeV - -################################################## -# Matrix Elements for hadron-hadron collisions -# (by default only gamma/Z switched on) -################################################## -cd /Herwig/MatrixElements/ -set MEPP2HiggsVBF:MaxFlavour 5 -set MEPP2HiggsVBF:ShapeScheme OnShell -set MEPP2HiggsVBF:Process ZZ - -insert SubProcess:MatrixElements[0] MEPP2HiggsVBF -set /Herwig/Cuts/JetKtCut:MinKT 0.*GeV - -set /Herwig/ACDCSampler:Ntry 100000 - -cd /Herwig/Generators - -################################################## -# Useful analysis handlers for hadron-hadron physics -################################################## -# analysis of W/Z events -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/DrellYan -# analysis of top-antitop events -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/TTbar -# analysis of gamma+jet events -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaJet -# analysis of gamma-gamma events -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/GammaGamma -# analysis of higgs-jet events -# insert EventGenerator: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 EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot -# A HepMC dump file (requires --with-hepmc to be set at configure time) -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile -# set /Herwig/Analysis/HepMCFile:PrintEvent 100 -# set /Herwig/Analysis/HepMCFile:Format GenEvent -# set /Herwig/Analysis/HepMCFile:Units GeV_mm -set /Herwig/Analysis/Basics:CheckQuark 0 - -create Herwig::QuickVBFHadron /Herwig/Analysis/QuickVBFHadron VBFAnalysis.so -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/QuickVBFHadron - -################################################## -# Save run for later usage with 'Herwig run' -################################################## -#saverun LHC EventGenerator - -################################################## -# 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 -################################################## -saverun LHC1 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun LHC2 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 14000 -set /Herwig/Generators/EventGenerator:EventHandler:BeamB /Herwig/Particles/p+ -saverun LHC3 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun LHC4 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 2000 -set /Herwig/Generators/EventGenerator:EventHandler:BeamB /Herwig/Particles/pbar- -set /Herwig/MatrixElements/MEPP2HiggsVBF:Process WW -saverun LHC5 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun LHC6 EventGenerator -set /Herwig/Particles/h0:NominalMass 115 -set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 14000 -set /Herwig/Generators/EventGenerator:EventHandler:BeamB /Herwig/Particles/p+ -saverun LHC7 EventGenerator -set /Herwig/Particles/h0:NominalMass 300 -saverun LHC8 EventGenerator diff --git a/Contrib/VBFTest/Makefile.in b/Contrib/VBFTest/Makefile.in deleted file mode 100644 --- a/Contrib/VBFTest/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# -*- Makefile -*- (for emacs) - -# -# This Makefile is intended for compiling Herwig++ plugins -# You can find plugins here: INSERT URL -# -# This Makefile received very little testing, -# any bug reports are very welcome! -# - -# location of include files -THEPEGINCLUDE = -GSLINCLUDE = -HERWIGINCLUDE = -INCLUDE = $(THEPEGINCLUDE) $(GSLINCLUDE) $(HERWIGINCLUDE) -# -# C++ flags -# -CXX = -CXXFLAGS = -LDFLAGS = -SHARED_FLAG = - -ALLCCFILES=$(shell echo *.cc) - -default : VBFAnalysis.so - -%.o : %.cc %.h - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) -c -shared $< -o $@ - -VBFAnalysis.so: QuickVBF.o - $(CXX) -fPIC $(CPPFLAGS) $(INCLUDE) $(CXXFLAGS) \ - QuickVBF.o $(SHARED_FLAG) $(LDFLAGS) -o VBFAnalysis.so - -clean: - rm -f $(ALLCCFILES:.cc=.o) VBFAnalysis.so diff --git a/Contrib/VBFTest/QuickVBF.cc b/Contrib/VBFTest/QuickVBF.cc deleted file mode 100644 --- a/Contrib/VBFTest/QuickVBF.cc +++ /dev/null @@ -1,137 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the QuickVBF class. -// - -#include "QuickVBF.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Particle.h" -#include "ThePEG/EventRecord/Event.h" - -using namespace Herwig; - -void QuickVBF::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - 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; - Lorentz5Momentum pz; - for(;sit!=send;++sit) { - ParticleSet part; - (**sit).selectFinalState(inserter(part)); - ParticleSet::const_iterator iter = part.begin(), end = part.end(); - for( ;iter!=end;++iter) { - if((**iter).id()==ParticleID::h0) { - *_mH += (**iter).momentum().m()/GeV; - *_cosH += (**iter).momentum().cosTheta(); - *_phiH += (**iter).momentum().phi()+Constants::pi; - *_eH += (**iter).momentum().t()/GeV; - } - else if((**iter).id()==ParticleID::nu_e) { - *_cosnu += (**iter).momentum().cosTheta(); - *_phinu += (**iter).momentum().phi()+Constants::pi; - *_enu += (**iter).momentum().t()/GeV; - } - else if((**iter).id()==ParticleID::nu_ebar) { - *_cosnub += (**iter).momentum().cosTheta(); - *_phinub += (**iter).momentum().phi()+Constants::pi; - *_enub += (**iter).momentum().t()/GeV; - } - else if((**iter).id()==ParticleID::eminus) { - *_cosem += (**iter).momentum().cosTheta(); - *_phiem += (**iter).momentum().phi()+Constants::pi; - *_eem += (**iter).momentum().t()/GeV; - } - else if((**iter).id()==ParticleID::eplus) { - *_cosep += (**iter).momentum().cosTheta(); - *_phiep += (**iter).momentum().phi()+Constants::pi; - *_eep += (**iter).momentum().t()/GeV; - } - } - } -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigQuickVBF("Herwig::QuickVBF", "VBFAnalysis.so"); - -void QuickVBF::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the QuickVBF class"); - -} - -void QuickVBF::doinitrun() { - AnalysisHandler::doinitrun(); - if(getParticleData(ParticleID::h0)->mass()>200.*GeV) - _mH = new_ptr(Histogram(200., 400.,200)); - else - _mH = new_ptr(Histogram(114., 116.0,200)); - _cosH = new_ptr(Histogram( -1.0, 1.0,200)); - _phiH = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _eH = new_ptr(Histogram( 0.0,1000.,1000)); - _cosnu = new_ptr(Histogram( -1.0, 1.0,200)); - _phinu = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _enu = new_ptr(Histogram( 0.0,1000.,1000)); - _cosnub = new_ptr(Histogram( -1.0, 1.0,200)); - _phinub = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _enub = new_ptr(Histogram( 0.0,1000.,1000)); - _cosem = new_ptr(Histogram( -1.0, 1.0,200)); - _phiem = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _eem = new_ptr(Histogram( 0.0,1000.,1000)); - _cosep = new_ptr(Histogram( -1.0, 1.0,200)); - _phiep = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _eep = new_ptr(Histogram( 0.0,1000.,1000)); -} - -void QuickVBF::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - using namespace HistogramOptions; - string title,species; - title = "mass of H"; - _mH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "theta of H"; - _cosH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "Energy of H"; - _eH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "azimuth of H"; - _phiH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "theta of nu"; - _cosnu->topdrawOutput(outfile,Frame,"BLACK",title); - title = "Energy of nu"; - _enu->topdrawOutput(outfile,Frame,"BLACK",title); - title = "azimuth of nu"; - _phinu->topdrawOutput(outfile,Frame,"BLACK",title); - title = "theta of nub"; - _cosnub->topdrawOutput(outfile,Frame,"BLACK",title); - title = "Energy of nub"; - _enub->topdrawOutput(outfile,Frame,"BLACK",title); - title = "azimuth of nub"; - _phinub->topdrawOutput(outfile,Frame,"BLACK",title); - title = "theta of em"; - _cosem->topdrawOutput(outfile,Frame,"BLACK",title); - title = "Energy of em"; - _eem->topdrawOutput(outfile,Frame,"BLACK",title); - title = "azimuth of em"; - _phiem->topdrawOutput(outfile,Frame,"BLACK",title); - title = "theta of ep "; - _cosep ->topdrawOutput(outfile,Frame,"BLACK",title); - title = "Energy of ep "; - _eep ->topdrawOutput(outfile,Frame,"BLACK",title); - title = "azimuth of ep "; - _phiep ->topdrawOutput(outfile,Frame,"BLACK",title); -} diff --git a/Contrib/VBFTest/QuickVBF.h b/Contrib/VBFTest/QuickVBF.h deleted file mode 100644 --- a/Contrib/VBFTest/QuickVBF.h +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_QuickVBF_H -#define HERWIG_QuickVBF_H -// -// This is the declaration of the QuickVBF class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the QuickVBF class. - * - * @see \ref QuickVBFInterfaces "The interfaces" - * defined for QuickVBF. - */ -class QuickVBF: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - -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. - */ - inline 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. - */ - inline virtual IBPtr fullclone() const {return new_ptr(*this);} - //@} - - -protected: - - /** @name Standard Interfaced functions. */ - //@{ - /** - * Initialize this object. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - QuickVBF & operator=(const QuickVBF &) = delete; - -private: - - HistogramPtr _mH ,_cosH ,_eH ,_phiH ; - HistogramPtr _cosnu ,_enu ,_phinu ; - HistogramPtr _cosnub,_enub,_phinub; - HistogramPtr _cosem ,_eem ,_phiem ; - HistogramPtr _cosep ,_eep ,_phiep ; - -}; - -} - -#endif /* HERWIG_QuickVBF_H */ diff --git a/Contrib/VBFTest/QuickVBFHadron.cc b/Contrib/VBFTest/QuickVBFHadron.cc deleted file mode 100644 --- a/Contrib/VBFTest/QuickVBFHadron.cc +++ /dev/null @@ -1,244 +0,0 @@ -// -*- C++ -*- -// -// This is the implementation of the non-inlined, non-templated member -// functions of the QuickVBFHadron class. -// - -#include "QuickVBFHadron.h" -#include "ThePEG/Utilities/DescribeClass.h" -#include "ThePEG/Interface/ClassDocumentation.h" -#include "ThePEG/PDT/EnumParticles.h" -#include "ThePEG/Repository/EventGenerator.h" -#include "ThePEG/EventRecord/Particle.h" -#include "ThePEG/EventRecord/Event.h" - -#include "ThePEG/EventRecord/Collision.h" -#include "ThePEG/EventRecord/Step.h" -#include "ThePEG/EventRecord/SubProcess.h" -#include "ThePEG/Handlers/XComb.h" -#include "ThePEG/Handlers/EventHandler.h" -#include "ThePEG/PDF/PartonExtractor.h" -#include "ThePEG/PDF/PDF.h" - -using namespace Herwig; - -void QuickVBFHadron::analyze(tEventPtr event, long ieve, int loop, int state) { - AnalysisHandler::analyze(event, ieve, loop, state); - // Rotate to CMS, extract final state particles and call analyze(particles). - tPVector part = event->getFinalState(); - Lorentz5Momentum pjj; - Energy2 mHsq(ZERO); - for(tPVector::const_iterator iter = part.begin(), end = part.end(); - iter!=end;++iter) { - if((**iter).id()==ParticleID::h0) { - *_mH += (**iter).momentum().m()/GeV; - mHsq=(**iter).momentum().m2(); - *_yH += (**iter).momentum().rapidity(); - *_phiH += (**iter).momentum().phi()+Constants::pi; - *_pTH[0] += (**iter).momentum().perp()/GeV; - *_pTH[1] += (**iter).momentum().perp()/GeV; - } - else if((**iter).id()!=82) { - *_yjet += (**iter).momentum().rapidity(); - *_phijet += (**iter).momentum().phi()+Constants::pi; - *_pTjet[0] += (**iter).momentum().perp()/GeV; - *_pTjet[1] += (**iter).momentum().perp()/GeV; - pjj+=(**iter).momentum(); - } - } - *_mjj += pjj.m()/GeV; - - if (!_doOnce) { - // Find the pdf information - tSubProPtr sub = event->primarySubProcess(); - // get the event handler - tcEHPtr eh = dynamic_ptr_cast(event->handler()); - // get the pdfs - pair pdfs; - pdfs.first = eh->pdf(sub->incoming().first ); - pdfs.second = eh->pdf(sub->incoming().second); - // Make a semi-analytical prediction of the convolution over pdfs - const double num=1e7; - double allsum[14][14]; - double allsqr[14][14]; - for (int j=0; j<=13 ; ++j) { - for (int k=0; k<=13 ; ++k) { - allsum[j][k]=0; - allsqr[j][k]=0; - } - } - double zzsum=0; - double zzsqr=0; - double wwsum=0; - double wwsqr=0; - Energy2 scale=mHsq; - Energy2 s=event->primaryCollision()->m2(); - cerr << "Starting semi-analytical calculation. Higgs mass/GeV=" << - sqrt(mHsq)/GeV << ", sqrt(s)/GeV=" << sqrt(s)/GeV << "\n"; - double tmin=mHsq/s; - double tlmin=log(tmin); - for (int i=0 ; i=1&&j<=5) idj=j; - if (j>=7&&j<=11)idj=6-j; - if (idj!=0) { - for (int k=1; k<=13; ++k) { - int idk=0; - if (k>=1&&k<=5) idk=k; - if (k>=7&&k<=11)idk=6-k; - if (idk!=0 && allsum[j][k]>0) { - cerr << getParticleData(idj)->PDGName() << " " << - getParticleData(idk)->PDGName() << "\t" << - allsum[j][k]/num << "+-" << sqrt(allsqr[j][k]-sqr(allsum[j][k])/num)/num << "\n"; - } - } - } - } - _doOnce=true; - } - /* - // ids of the partons going into the primary sub process - tSubProPtr sub = event->primarySubProcess(); - int id1 = sub->incoming().first ->id(); - int id2 = sub->incoming().second->id(); - // get the event handler - tcEHPtr eh = dynamic_ptr_cast(event->handler()); - // get the values of x - double x1 = eh->lastX1(); - double x2 = eh->lastX2(); - // get the pdfs - pair pdfs; - pdfs.first = eh->pdf(sub->incoming().first ); - pdfs.second = eh->pdf(sub->incoming().second); - // get the scale - Energy2 scale = eh->lastScale(); - // get the values of the pdfs - double pdf1 = pdfs.first .xfx(sub->incoming().first ->dataPtr(),scale,x1); - double pdf2 = pdfs.second.xfx(sub->incoming().second->dataPtr(),scale,x2); - // print them to cerr - if (x1<3e-4 || x2<3e-4) { - cerr << "The x values are:" << x1 << " " << x2 << "\n"; - cerr << "The scale is:" << sqrt(scale)/GeV << " GeV \n"; - cerr << "The parton ids are:" << id1 << " " << id2 << "\n"; - cerr << "The pdfs are:" << pdf1 << " " << pdf2 << "\n\n"; - } - for (int i=0;i<=100;++i) { - x1 = pow(10.0,4*(double(i)/100-1)); - pdf1 = pdfs.first .xfx(sub->incoming().first ->dataPtr(),scale,x1); - cerr << x1 << " " << pdf1 << "\n"; - } - */ -} - -bool QuickVBFHadron::_doOnce = false; - -IBPtr QuickVBFHadron::clone() const { - return new_ptr(*this); -} - -IBPtr QuickVBFHadron::fullclone() const { - return new_ptr(*this); -} - -// The following static variable is needed for the type -// description system in ThePEG. -DescribeNoPIOClass -describeHerwigQuickVBFHadron("Herwig::QuickVBFHadron", "VBFAnalysis.so"); - -void QuickVBFHadron::Init() { - - static ClassDocumentation documentation - ("There is no documentation for the QuickVBFHadron class"); - -} - -void QuickVBFHadron::dofinish() { - AnalysisHandler::dofinish(); - string fname = generator()->filename() + string("-") + name() + string(".top"); - ofstream outfile(fname.c_str()); - using namespace HistogramOptions; - string title,species; - title = "mass of H"; - _mH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "rapidity of H"; - _yH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "pT of H"; - _pTH[0]->topdrawOutput(outfile,Frame|Ylog,"BLACK",title); - _pTH[1]->topdrawOutput(outfile,Frame|Ylog,"BLACK",title); - title = "azimuth of H"; - _phiH->topdrawOutput(outfile,Frame,"BLACK",title); - title = "rapidity of jet"; - _yjet->topdrawOutput(outfile,Frame,"BLACK",title); - title = "pT of jet"; - _pTjet[0]->topdrawOutput(outfile,Frame|Ylog,"BLACK",title); - _pTjet[1]->topdrawOutput(outfile,Frame|Ylog,"BLACK",title); - title = "azimuth of jet"; - _phijet->topdrawOutput(outfile,Frame,"BLACK",title); - title = "mjj"; - _mjj->topdrawOutput(outfile,Frame,"BLACK",title); -} - -void QuickVBFHadron::doinitrun() { - AnalysisHandler::doinitrun(); - if(getParticleData(ParticleID::h0)->mass()>200.*GeV) - _mH = new_ptr(Histogram(200., 400.,200)); - else - _mH = new_ptr(Histogram(114., 116.0,200)); - _yH = new_ptr(Histogram( -10.0, 10.0,200)); - _phiH = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _pTH[0] = new_ptr(Histogram( 0.0,1000.,1000)); - _pTH[1] = new_ptr(Histogram( 0.0,1000.,100)); - _yjet = new_ptr(Histogram( -10.0, 10.0,200)); - _phijet = new_ptr(Histogram( 0.0,2.0*Constants::pi,200)); - _pTjet[0] = new_ptr(Histogram( 0.0,1000.,1000)); - _pTjet[1] = new_ptr(Histogram( 0.0,1000.,100)); - _mjj = new_ptr(Histogram(0.0,200.,100)); -} diff --git a/Contrib/VBFTest/QuickVBFHadron.h b/Contrib/VBFTest/QuickVBFHadron.h deleted file mode 100644 --- a/Contrib/VBFTest/QuickVBFHadron.h +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- -#ifndef HERWIG_QuickVBFHadron_H -#define HERWIG_QuickVBFHadron_H -// -// This is the declaration of the QuickVBFHadron class. -// - -#include "ThePEG/Handlers/AnalysisHandler.h" -#include "Herwig/Utilities/Histogram.h" - -namespace Herwig { - -using namespace ThePEG; - -/** - * Here is the documentation of the QuickVBFHadron class. - * - * @see \ref QuickVBFHadronInterfaces "The interfaces" - * defined for QuickVBFHadron. - */ -class QuickVBFHadron: public AnalysisHandler { - -public: - - /** @name Virtual functions required by the AnalysisHandler class. */ - //@{ - /** - * Analyze a given Event. Note that a fully generated event - * may be presented several times, if it has been manipulated in - * between. The default version of this function will call transform - * to make a lorentz transformation of the whole event, then extract - * all final state particles and call analyze(tPVector) of this - * analysis object and those of all associated analysis objects. The - * default version will not, however, do anything on events which - * have not been fully generated, or have been manipulated in any - * way. - * @param event pointer to the Event to be analyzed. - * @param ieve the event number. - * @param loop the number of times this event has been presented. - * If negative the event is now fully generated. - * @param state a number different from zero if the event has been - * manipulated in some way since it was last presented. - */ - virtual void analyze(tEventPtr event, long ieve, int loop, int state); - //@} - -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. Called in the run phase just before - * a run begins. - */ - virtual void doinitrun(); - - /** - * Finalize this object. Called in the run phase just after a - * run has ended. Used eg. to write out statistics. - */ - virtual void dofinish(); - //@} - -private: - - /** - * The assignment operator is private and must never be called. - * In fact, it should not even be implemented. - */ - QuickVBFHadron & operator=(const QuickVBFHadron &) = delete; - -private: - - HistogramPtr _mH ,_yH ,_pTH[2] ,_phiH ; - HistogramPtr _yjet,_pTjet[2],_phijet; - HistogramPtr _mjj; - - static bool _doOnce; - -}; - -} - -#endif /* HERWIG_QuickVBFHadron_H */ diff --git a/Hadronization/ColourReconnector.cc b/Hadronization/ColourReconnector.cc --- a/Hadronization/ColourReconnector.cc +++ b/Hadronization/ColourReconnector.cc @@ -1,822 +1,822 @@ // -*- C++ -*- // // ColourReconnector.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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 #include #include #include #include #include #include #include "Herwig/Utilities/Maths.h" using namespace Herwig; using CluVecIt = ColourReconnector::CluVecIt; using Constants::pi; using Constants::twopi; DescribeClass describeColourReconnector("Herwig::ColourReconnector",""); IBPtr ColourReconnector::clone() const { return new_ptr(*this); } IBPtr ColourReconnector::fullclone() const { return new_ptr(*this); } void ColourReconnector::rearrange(ClusterVector & clusters) { if (_clreco == 0) return; // 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; case 2: _doRecoBaryonic(clusters); break; } } 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[i]->momentum() + aq[i]->momentum() ).m2(); return sum; } bool ColourReconnector::_containsColour8(const ClusterVector & cv, const vector & P) const { assert (P.size() == cv.size()); for (size_t i = 0; i < cv.size(); i++) { tcPPtr p = cv[i]->colParticle(); tcPPtr q = cv[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[i]->colParticle() ); aq.push_back( cv[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 typical; for (int i = 0; i < 10; i++) { const pair 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 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[i], aq[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( newcv.begin(), newcv.end(), p_irnd ); // iterate over all clusters for (CluVecIt cit = newcv.begin(); cit != newcv.end(); cit++) { // 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 CluVecIt candidate = _findRecoPartner(cit, newcv); // skip this cluster if no possible reshuffling partner can be found if (candidate == cit) continue; // accept the reconnection with probability _preco. if (UseRandom::rnd() < _preco) { pair reconnected = _reconnect(*cit, *candidate); // Replace the clusters in the ClusterVector. The order of the // colour-triplet partons in the cluster vector is retained here. // replace *cit by reconnected.first *cit = reconnected.first; // replace candidate by reconnected.second *candidate = reconnected.second; } } swap(cv,newcv); return; } namespace { inline bool hasDiquark(CluVecIt cit) { for(int i = 0; i<(*cit)->numComponents(); i++) { if (DiquarkMatcher::Check(*((*cit)->particle(i)->dataPtr()))) return true; } return false; } } // Implementation of the baryonic reconnection algorithm void ColourReconnector::_doRecoBaryonic(ClusterVector & cv) const { ClusterVector newcv = cv; ClusterVector deleted; deleted.reserve(cv.size()); // try to avoid systematic errors by randomising the reconnection order long (*p_irnd)(long) = UseRandom::irnd; random_shuffle( newcv.begin(), newcv.end(), p_irnd ); // iterate over all clusters for (CluVecIt cit = newcv.begin(); cit != newcv.end(); ++cit) { //avoid clusters already containing diuarks if (hasDiquark(cit)) continue; //skip the cluster to be deleted later 3->2 cluster if (find(deleted.begin(), deleted.end(), *cit) != deleted.end()) continue; // Skip all found baryonic clusters, this biases the algorithm but implementing // something like re-reconnection is ongoing work if ((*cit)->numComponents()==3) continue; // Find a candidate suitable for reconnection CluVecIt baryonic1, baryonic2; bool isBaryonicCandidate = false; CluVecIt candidate = _findPartnerBaryonic(cit, newcv, isBaryonicCandidate, deleted, baryonic1, baryonic2); // skip this cluster if no possible reconnection partner can be found if ( !isBaryonicCandidate && candidate==cit ) continue; if ( isBaryonicCandidate && UseRandom::rnd() < _precoBaryonic ) { deleted.push_back(*baryonic2); // Function that does the reconnection from 3 -> 2 clusters ClusterPtr b1, b2; _makeBaryonicClusters(*cit,*baryonic1,*baryonic2, b1, b2); *cit = b1; *baryonic1 = b2; // Baryonic2 is easily skipped in the next loop } // Normal 2->2 Colour reconnection if ( !isBaryonicCandidate && UseRandom::rnd() < _preco ) { auto reconnected = _reconnectBaryonic(*cit, *candidate); *cit = reconnected.first; *candidate = reconnected.second; } } // create a new vector of clusters except for the ones which are "deleted" during // baryonic reconnection ClusterVector clustervector; for ( const auto & cluster : newcv ) if ( find(deleted.begin(), deleted.end(), cluster) == deleted.end() ) clustervector.push_back(cluster); swap(cv,clustervector); } namespace { double calculateRapidityRF(const Lorentz5Momentum & q1, const Lorentz5Momentum & p2) { //calculate rapidity wrt the direction of q1 //angle between the particles in the RF of cluster of q1 // calculate the z component of p2 w.r.t the direction of q1 const Energy pz = p2.vect() * q1.vect().unit(); if ( pz == ZERO ) return 0.; // Transverse momentum of p2 w.r.t the direction of q1 const Energy pt = sqrt(p2.vect().mag2() - sqr(pz)); // Transverse mass pf p2 w.r.t to the direction of q1 const Energy mtrans = sqrt(p2.mass()*p2.mass() + (pt*pt)); // Correct formula const double y2 = log((p2.t() + abs(pz))/mtrans); return ( pz < ZERO ) ? -y2 : y2; } } CluVecIt ColourReconnector::_findPartnerBaryonic( CluVecIt cl, ClusterVector & cv, bool & baryonicCand, const ClusterVector& deleted, CluVecIt &baryonic1, CluVecIt &baryonic2 ) const { using Constants::pi; using Constants::twopi; // Returns a candidate for possible reconnection CluVecIt candidate = cl; bool bcand = false; double maxrap = 0.0; double minrap = 0.0; double maxrapNormal = 0.0; double minrapNormal = 0.0; double maxsumnormal = 0.0; double maxsum = 0.0; double secondsum = 0.0; // boost into RF of cl Lorentz5Momentum cl1 = (*cl)->momentum(); const Boost boostv(-cl1.boostVector()); cl1.boost(boostv); // boost constituents of cl into RF of cl Lorentz5Momentum p1col = (*cl)->colParticle()->momentum(); Lorentz5Momentum p1anticol = (*cl)->antiColParticle()->momentum(); p1col.boost(boostv); p1anticol.boost(boostv); for (CluVecIt cit=cv.begin(); cit != cv.end(); ++cit) { //avoid looping over clusters containing diquarks if ( hasDiquark(cit) ) continue; if ( (*cit)->numComponents()==3 ) continue; if ( cit==cl ) continue; //skip the cluster to be deleted later 3->2 cluster if ( find(deleted.begin(), deleted.end(), *cit) != deleted.end() ) continue; if ( (*cl)->isBeamCluster() && (*cit)->isBeamCluster() ) continue; // stop it putting far apart clusters together if ( ( (**cl).vertex()-(**cit).vertex() ).m() >_maxDistance ) continue; const bool Colour8 = _isColour8( (*cl)->colParticle(), (*cit)->antiColParticle() ) || _isColour8( (*cit)->colParticle(), (*cl)->antiColParticle() ) ; if ( Colour8 ) continue; // boost constituents of cit into RF of cl Lorentz5Momentum p2col = (*cit)->colParticle()->momentum(); Lorentz5Momentum p2anticol = (*cit)->antiColParticle()->momentum(); p2col.boost(boostv); p2anticol.boost(boostv); // calculate the rapidity of the other constituents of the clusters // w.r.t axis of p1anticol.vect.unit const double rapq = calculateRapidityRF(p1anticol,p2col); const double rapqbar = calculateRapidityRF(p1anticol,p2anticol); // configuration for normal CR if ( rapq > 0.0 && rapqbar < 0.0 && rapq > maxrap && rapqbar < minrap ) { maxrap = rapq; minrap = rapqbar; //sum of rapidities of quarks const double normalsum = abs(rapq) + abs(rapqbar); if ( normalsum > maxsumnormal ) { maxsumnormal = normalsum; maxrapNormal = rapq; minrapNormal = rapqbar; bcand = false; candidate = cit; } } if ( rapq < 0.0 && rapqbar >0.0 && rapqbar > maxrapNormal && rapq < minrapNormal ) { maxrap = rapqbar; minrap = rapq; const double sumrap = abs(rapqbar) + abs(rapq); // first candidate gets here. If second baryonic candidate has higher Ysum than the first // one, the second candidate becomes the first one and the first the second. if (sumrap > maxsum) { if(maxsum != 0){ baryonic2 = baryonic1; baryonic1 = cit; bcand = true; } else { baryonic1 = cit; } maxsum = sumrap; } else { if (sumrap > secondsum && sumrap != maxsum) { secondsum = sumrap; bcand = true; baryonic2 = cit; } } } } if(bcand == true){ baryonicCand = true; } return candidate; } CluVecIt ColourReconnector::_findRecoPartner(CluVecIt cl, ClusterVector & cv) const { CluVecIt candidate = cl; Energy minMass = 1*TeV; for (CluVecIt cit=cv.begin(); cit != cv.end(); ++cit) { // don't even look at original cluster if(cit==cl) continue; // don't allow colour octet clusters if ( _isColour8( (*cl)->colParticle(), (*cit)->antiColParticle() ) || _isColour8( (*cit)->colParticle(), (*cl)->antiColParticle() ) ) { continue; } // stop it putting beam remnants together if((*cl)->isBeamCluster() && (*cit)->isBeamCluster()) continue; // stop it putting far apart clusters together if(((**cl).vertex()-(**cit).vertex()).m()>_maxDistance) 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; } // forms two baryonic clusters from three clusters void ColourReconnector::_makeBaryonicClusters( ClusterPtr &c1, ClusterPtr &c2, ClusterPtr &c3, ClusterPtr &newcluster1, ClusterPtr &newcluster2) const{ //make sure they all have 2 components assert(c1->numComponents()==2); assert(c2->numComponents()==2); assert(c3->numComponents()==2); //abandon children c1->colParticle()->abandonChild(c1); c1->antiColParticle()->abandonChild(c1); c2->colParticle()->abandonChild(c2); c2->antiColParticle()->abandonChild(c2); c3->colParticle()->abandonChild(c3); c3->antiColParticle()->abandonChild(c3); newcluster1 = new_ptr(Cluster(c1->colParticle(),c2->colParticle(), c3->colParticle())); c1->colParticle()->addChild(newcluster1); c2->colParticle()->addChild(newcluster1); c3->colParticle()->addChild(newcluster1); newcluster1->setVertex(LorentzPoint()); newcluster2 = new_ptr(Cluster(c1->antiColParticle(), c2->antiColParticle(), c3->antiColParticle())); c1->antiColParticle()->addChild(newcluster2); c2->antiColParticle()->addChild(newcluster2); c3->antiColParticle()->addChild(newcluster2); newcluster2->setVertex(LorentzPoint()); } pair ColourReconnector::_reconnect(ClusterPtr &c1, ClusterPtr &c2) const { // choose the other possibility to form two clusters from the given // constituents assert(c1->numComponents()==2); assert(c2->numComponents()==2); int c1_col(-1),c1_anti(-1),c2_col(-1),c2_anti(-1); for(unsigned int ix=0;ix<2;++ix) { if (c1->particle(ix)->hasColour(false)) c1_col = ix; else if(c1->particle(ix)->hasColour(true )) c1_anti = ix; if (c2->particle(ix)->hasColour(false)) c2_col = ix; else if(c2->particle(ix)->hasColour(true )) c2_anti = ix; } assert(c1_col>=0&&c2_col>=0&&c1_anti>=0&&c2_anti>=0); ClusterPtr newCluster1 = new_ptr( Cluster( c1->colParticle(), c2->antiColParticle() ) ); newCluster1->setVertex(0.5*( c1->colParticle()->vertex() + c2->antiColParticle()->vertex() )); if(c1->isBeamRemnant(c1_col )) newCluster1->setBeamRemnant(0,true); if(c2->isBeamRemnant(c2_anti)) newCluster1->setBeamRemnant(1,true); ClusterPtr newCluster2 = new_ptr( Cluster( c2->colParticle(), c1->antiColParticle() ) ); newCluster2->setVertex(0.5*( c2->colParticle()->vertex() + c1->antiColParticle()->vertex() )); if(c2->isBeamRemnant(c2_col )) newCluster2->setBeamRemnant(0,true); if(c1->isBeamRemnant(c1_anti)) newCluster2->setBeamRemnant(1,true); return pair (newCluster1, newCluster2); } pair ColourReconnector::_reconnectBaryonic(ClusterPtr &c1, ClusterPtr &c2) const { // choose the other possibility to form two clusters from the given // constituents assert(c1->numComponents()==2); assert(c2->numComponents()==2); int c1_col(-1),c1_anti(-1),c2_col(-1),c2_anti(-1); for(unsigned int ix=0;ix<2;++ix) { if (c1->particle(ix)->hasColour(false)) c1_col = ix; else if(c1->particle(ix)->hasColour(true )) c1_anti = ix; if (c2->particle(ix)->hasColour(false)) c2_col = ix; else if(c2->particle(ix)->hasColour(true )) c2_anti = ix; } assert(c1_col>=0&&c2_col>=0&&c1_anti>=0&&c2_anti>=0); c1->colParticle()->abandonChild(c1); c2->antiColParticle()->abandonChild(c2); ClusterPtr newCluster1 = new_ptr( Cluster( c1->colParticle(), c2->antiColParticle() ) ); c1->colParticle()->addChild(newCluster1); c2->antiColParticle()->addChild(newCluster1); newCluster1->setVertex(0.5*( c1->colParticle()->vertex() + c2->antiColParticle()->vertex() )); if(c1->isBeamRemnant(c1_col )) newCluster1->setBeamRemnant(0,true); if(c2->isBeamRemnant(c2_anti)) newCluster1->setBeamRemnant(1,true); c1->antiColParticle()->abandonChild(c1); c2->colParticle()->abandonChild(c2); ClusterPtr newCluster2 = new_ptr( Cluster( c2->colParticle(), c1->antiColParticle() ) ); c1->antiColParticle()->addChild(newCluster2); c2->colParticle()->addChild(newCluster2); newCluster2->setVertex(0.5*( c2->colParticle()->vertex() + c1->antiColParticle()->vertex() )); if(c2->isBeamRemnant(c2_col )) newCluster2->setBeamRemnant(0,true); if(c1->isBeamRemnant(c1_anti)) newCluster2->setBeamRemnant(1,true); return pair (newCluster1, newCluster2); } pair 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[i], aq[j] ) || _isColour8( q[j], aq[i] ) ; tries++; } while (octet && tries < maxtries); if (octet) i = j = -1; return make_pair(i,j); } bool ColourReconnector::_isColour8(tcPPtr p, tcPPtr q) const { bool octet = false; // make sure we have a triplet and an anti-triplet if ( ( p->hasColour() && q->hasAntiColour() ) || ( p->hasAntiColour() && q->hasColour() ) ) { // true if p and q are originated from a colour octet if ( !p->parents().empty() && !q->parents().empty() ) { octet = ( p->parents()[0] == q->parents()[0] ) && ( p->parents()[0]->data().iColour() == PDT::Colour8 ); } // (Final) option: check if same colour8 parent // or already found an octet. if(_octetOption==0||octet) return octet; // (All) option handling more octets // by browsing particle history/colour lines. tColinePtr cline,aline; // Get colourlines form final states. if(p->hasColour() && q->hasAntiColour()) { cline = p-> colourLine(); aline = q->antiColourLine(); } else { cline = q-> colourLine(); aline = p->antiColourLine(); } // Follow the colourline of p. if ( !p->parents().empty() ) { tPPtr parent = p->parents()[0]; while (parent) { if(parent->data().iColour() == PDT::Colour8) { // Coulour8 particles should have a colour // and an anticolour line. Currently the // remnant has none of those. Since the children // of the remnant are not allowed to emit currently, // the colour octet remnant is handled by the return // statement above. The assert also catches other // colour octets without clines. If the children of // a remnant should be allowed to emit, the remnant // should get appropriate colour lines and // colour states. // See Ticket: #407 // assert(parent->colourLine()&&parent->antiColourLine()); octet = (parent-> colourLine()==cline && parent->antiColourLine()==aline); } if(octet||parent->parents().empty()) break; parent = parent->parents()[0]; } } } return octet; } void ColourReconnector::persistentOutput(PersistentOStream & os) const { os << _clreco << _preco << _precoBaryonic << _algorithm << _initTemp << _annealingFactor << _annealingSteps << _triesPerStepFactor << ounit(_maxDistance,femtometer) << _octetOption; } void ColourReconnector::persistentInput(PersistentIStream & is, int) { is >> _clreco >> _preco >> _precoBaryonic >> _algorithm >> _initTemp >> _annealingFactor >> _annealingSteps >> _triesPerStepFactor >> iunit(_maxDistance,femtometer) >> _octetOption; } void ColourReconnector::Init() { static ClassDocumentation documentation ("This class is responsible of the colour reconnection."); static Switch interfaceColourReconnection ("ColourReconnection", "Colour reconnections", &ColourReconnector::_clreco, 0, true, false); static SwitchOption interfaceColourReconnectionNo (interfaceColourReconnection, "No", "Colour reconnections off", 0); static SwitchOption interfaceColourReconnectionYes (interfaceColourReconnection, "Yes", "Colour reconnections on", 1); static Parameter 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 interfaceMtrpAnnealingSteps ("AnnealingSteps", "Number of temperature steps in the statistical annealing algorithm", &ColourReconnector::_annealingSteps, 50, 1, 10000, false, false, Interface::limited); static Parameter 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 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 interfaceRecoProb ("ReconnectionProbability", "Probability that a found reconnection possibility is actually accepted", &ColourReconnector::_preco, 0.5, 0.0, 1.0, false, false, Interface::limited); static Parameter interfaceRecoProbBaryonic ("ReconnectionProbabilityBaryonic", "Probability that a found reconnection possibility is actually accepted", &ColourReconnector::_precoBaryonic, 0.5, 0.0, 1.0, false, false, Interface::limited); static Switch 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); static SwitchOption interfaceAlgorithmBaryonic (interfaceAlgorithm, - "BaryonicReco", + "Baryonic", "Baryonic cluster reconnection", 2); static Parameter interfaceMaxDistance ("MaxDistance", "Maximum distance between the clusters at which to consider rearrangement" " to avoid colour reconneections of displaced vertices", &ColourReconnector::_maxDistance, femtometer, 1000.*femtometer, 0.0*femtometer, 1e100*femtometer, false, false, Interface::limited); static Switch interfaceOctetTreatment ("OctetTreatment", "Which octets are not allowed to be reconnected", &ColourReconnector::_octetOption, 0, false, false); static SwitchOption interfaceOctetTreatmentFinal (interfaceOctetTreatment, "Final", "Only prevent for the final (usuaslly non-perturbative) g -> q qbar splitting", 0); static SwitchOption interfaceOctetTreatmentAll (interfaceOctetTreatment, "All", "Prevent for all octets", 1); } diff --git a/Contrib/FxFx/FxFx.h b/MatrixElement/FxFx/FxFx.h rename from Contrib/FxFx/FxFx.h rename to MatrixElement/FxFx/FxFx.h diff --git a/MatrixElement/FxFx/FxFxEventHandler.cc b/MatrixElement/FxFx/FxFxEventHandler.cc new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/FxFxEventHandler.cc @@ -0,0 +1,652 @@ +// -*- C++ -*- +// +// Based on: +// FxFxEventHandler.cc is a part of ThePEG - Toolkit for HEP Event Generation +// Copyright (C) 1999-2011 Leif Lonnblad +// +// ThePEG is licenced under version 3 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 FxFxEventHandler class. +// + +#include "FxFxEventHandler.h" +#include "FxFxReader.h" +#include "ThePEG/Interface/ClassDocumentation.h" +#include "ThePEG/Interface/RefVector.h" +#include "ThePEG/Interface/Switch.h" +#include "ThePEG/Interface/Parameter.h" +#include "ThePEG/Repository/Repository.h" +#include "ThePEG/Handlers/LuminosityFunction.h" +#include "ThePEG/Handlers/XComb.h" +#include "ThePEG/Handlers/CascadeHandler.h" +#include "ThePEG/Cuts/Cuts.h" +#include "ThePEG/PDF/PartonExtractor.h" +#include "ThePEG/Utilities/LoopGuard.h" +#include "ThePEG/EventRecord/Event.h" +#include "ThePEG/EventRecord/Collision.h" +#include "ThePEG/EventRecord/Step.h" +#include "ThePEG/EventRecord/SubProcess.h" +#include "ThePEG/Utilities/EnumIO.h" +#include "ThePEG/Utilities/Maths.h" +#include "ThePEG/Repository/UseRandom.h" +#include "ThePEG/Utilities/Throw.h" +#include "ThePEG/Utilities/Debug.h" +#include "ThePEG/Persistency/PersistentOStream.h" +#include "ThePEG/Persistency/PersistentIStream.h" + +using namespace ThePEG; + +FxFxEventHandler::~FxFxEventHandler() {} + +IBPtr FxFxEventHandler::clone() const { + return new_ptr(*this); +} + +IBPtr FxFxEventHandler::fullclone() const { + return new_ptr(*this); +} + +void FxFxEventHandler::doinit() { + EventHandler::doinit(); + + for ( int i = 0, N = readers().size(); i < N; ++i ) { + readers()[i]->init(); + //FxFxReader & reader = *readers()[i]; + //reader.initialize(*this); + //weightnames = reader.optWeightsNamesFunc(); + } + /* + XSecStat* initxsecs = new XSecStat[weightnames.size()]; + + for(int ww = 0; ww < weightnames.size(); ww++){ + initxsecs[ww].reset(); + optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + CrossSection initxs = 0.*picobarn; + optxs.insert(std::make_pair(weightnames[ww], initxs)); + }*/ + ntries = 0; + +} + +void FxFxEventHandler::initialize() { + + if ( lumiFnPtr() ) Repository::clog() + << "The LuminosityFunction '" << lumiFnPtr()->name() + << "' assigned to the FxFxEventHandler '" << name() + << "' will not be active in this run. Instead the incoming " + << "particles will be determined by the used FxFxReader objects.\n" + << Exception::warning; + + if ( readers().empty() ) + throw FxFxInitError() + << "No readers were defined for the FxFxEventHandler '" + << name() << "'" << Exception::warning; + + // Go through all the readers and collect information about cross + // sections and processes. + typedef map ProcessMap; + ProcessMap processes; + PDPair incoming; + Energy MaxEA = ZERO; + Energy MaxEB = ZERO; + for ( int i = 0, N = readers().size(); i < N; ++i ) { + FxFxReader & reader = *readers()[i]; + reader.initialize(*this); + weightnames = reader.optWeightsNamesFunc(); + // Check that the incoming particles are consistent between the + // readers. + if ( !incoming.first ) { + incoming.first = getParticleData(reader.heprup.IDBMUP.first); + if ( !incoming.first ) + Throw() + << "Unknown beam PID " << reader.heprup.IDBMUP.first + << ". Have you created a matching BeamParticle object?" + << Exception::runerror; + } + if ( !incoming.second ) { + incoming.second = getParticleData(reader.heprup.IDBMUP.second); + if ( !incoming.second ) + Throw() + << "Unknown beam PID " << reader.heprup.IDBMUP.first + << ". Have you created a matching BeamParticle object?" + << Exception::runerror; + } + if ( incoming.first->id() != reader.heprup.IDBMUP.first || + incoming.second->id() != reader.heprup.IDBMUP.second ) + Repository::clog() + << "The different FxFxReader objects in the " + << "FxFxEventHandler '" << name() << "' have different " + << "types of colliding particles." << Exception::warning; + MaxEA = max(MaxEA, reader.heprup.EBMUP.first*GeV); + MaxEB = max(MaxEB, reader.heprup.EBMUP.second*GeV); + + // Check that the weighting of the events in the different readers + // is consistent with the ones requested for this event + // handler. Also collect the sum of the maximum weights. + if ( reader.negativeWeights() && weightOption() > 0 ) + throw FxFxInitError() + << "The reader '" << reader.name() + << "' contains negatively weighted events, " + << "which is not allowed for the FxFxEventHandler '" + << name() << "'." << Exception::warning; + + // Check that we do not have the same process numbers in different + // readers. + for ( int ip = 0; ip < reader.heprup.NPRUP; ++ip ) { + if ( reader.heprup.LPRUP[ip] ) { + ProcessMap::iterator pit = processes.find(reader.heprup.LPRUP[ip]); + if ( pit == processes.end() ) + processes[reader.heprup.LPRUP[ip]] = readers()[i]; + else if ( warnPNum ) { + Throw() + << "In the FxFxEventHandler '" + << name() << "', both the '" << pit->second->name() << "' and '" + << reader.name() << "' contains sub-process number " << pit->first + << ". This process may be double-counted in this run." + << Exception::warning; + } + } + } + selector().insert(reader.stats.maxXSec(), i); + } + stats.maxXSec(selector().sum()); + histStats.maxXSec(selector().sum()); + for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ + (it->second).maxXSec(selector().sum()); + } + // Check that we have any cross section at all. + if ( stats.maxXSec() <= ZERO ) + throw FxFxInitError() + << "The sum of the cross sections of the readers in the " + << "FxFxEventHandler '" << name() + << "' was zero." << Exception::warning; + + // We now create a LuminosityFunction object to inform others about + // the energy of the beam. + theIncoming = incoming; + lumiFn(new_ptr(LuminosityFunction(MaxEA, MaxEB))); + +} + +void FxFxEventHandler::doinitrun() { + EventHandler::doinitrun(); + stats.reset(); + histStats.reset(); + + for ( int i = 0, N = readers().size(); i < N; ++i ) { + readers()[i]->init(); + FxFxReader & reader = *readers()[i]; + reader.initialize(*this); + weightnames = reader.optWeightsNamesFunc(); + } + + // XSecStat initxsecs; + XSecStat* initxsecs = new XSecStat[weightnames.size()]; + for(size_t ww = 0; ww < weightnames.size(); ww++){ + initxsecs[ww].reset(); + + // optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + // opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + CrossSection initxs = 0.*picobarn; + //optxs.insert(std::make_pair(weightnames[ww], initxs)); + optstats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + opthistStats.insert(std::make_pair(weightnames[ww], initxsecs[ww])); + optxs.insert(std::make_pair(weightnames[ww], initxs)); + } + ntries = 0; + +} + +EventPtr FxFxEventHandler::generateEvent() { + + LoopGuard + loopGuard(*this, maxLoop()); + + while ( true ) { + loopGuard(); + + currentReader(readers()[selector().select(UseRandom::current())]); + + skipEvents(); + currentReader()->reset(); + + double weight = currentReader()->getEvent(); + if ( weightOption() == unitweight && weight < 0.0 ) weight = 0.0; + + if ( weightOption() == unitweight || weightOption() == unitnegweight ) { + CrossSection newmax = selector().reweight(weight); + if ( newmax > CrossSection() ) + increaseMaxXSec(newmax); + } + + select(weight/currentReader()->preweight); + histStats.select(weight); + + if ( !weighted() ) { + if ( weightOption() == unitweight || weightOption() == unitnegweight ) { + if ( !rndbool(abs(weight)) ) continue; + weight = Math::sign(1.0, weight); + } + else if ( weight == 0.0 ) continue; + } else if ( weight == 0.0 ) continue; + + accept(); + + // Divide by the bias introduced by the preweights in the reader. + + + weight /= currentReader()->preweight; + + + // fact for weight normalization + double fact = theNormWeight ? double(selector().sum()/picobarn) : 1.; + + try { + + theLastXComb = currentReader()->getXComb(); + + currentEvent(new_ptr(Event(lastParticles(), this, generator()->runName(), + generator()->currentEventNumber(), weight*fact))); + currentEvent()->optionalWeights() = currentReader()->optionalEventWeights(); + // normalize the optional weights + for(map::iterator it = currentEvent()->optionalWeights().begin(); + it!=currentEvent()->optionalWeights().end();++it) { + if(it->first!="ecom"&& it->second!=-999 && it->second!=-111 && it->second!=-222 && it->second!=-333) { it->second *= fact; } + } + + + //print optional weights here + // cout << "event weight = " << weight << " fact = " << fact << endl; + /*for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ + std::cout << it->first << " => " << it->second << '\n'; + } + cout << endl;*/ + + //print npLO and npNLO + // cout << currentReader()->optionalEventnpLO() << "\t" << currentReader()->optionalEventnpNLO() << endl; + + performCollision(); + + if ( !currentCollision() ) throw Veto(); + + return currentEvent(); + } + catch (Veto) { + reject(weight); + } + catch (Stop) { + } + catch (Exception &) { + reject(weight); + throw; + } + } +} + +void FxFxEventHandler::skipEvents() { + + if ( weightOption() == 2 || weightOption() == -2 ) return; //does it make sense to skip events if we are using varying weights? + + // Don't do this for readers which seem to generate events on the fly. + if ( currentReader()->active() || currentReader()->NEvents() <= 0 ) return; + + // Estimate the fration of the total events available from + // currentReader() which will be requested. + double frac = currentReader()->stats.maxXSec()/stats.maxXSec(); + if ( stats.accepted() > 0 ) + frac *= double(stats.attempts())/double(stats.accepted()); + else + frac *= double(stats.attempts() + 1); + double xscan = generator()->N()*frac/currentReader()->NEvents(); + + // Estimate the number of times we need to go through the events for + // the currentReader(), and how many events on average we need to + // skip for each attempted event to go through the file an integer + // number of times. + double nscan = ceil(xscan); + double meanskip = nscan/xscan - 1.0; + // Skip an average numer of steps with a Poissonian distribution. + currentReader()-> + skip(UseRandom::rndPoisson(meanskip)%currentReader()->NEvents()); +} + +void FxFxEventHandler::select(double weight) { + stats.select(weight); + currentReader()->select(weight); + vector w; + for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ + w.push_back(it->second); + } + int ii = 0; + for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ + (it->second).select(w[ii]); + ii++; + } + ii = 0; + for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ + (it->second).select(w[ii]); + ii++; + } + +} + +tCollPtr FxFxEventHandler::performCollision() { + lastExtractor()->select(lastXCombPtr()); + if ( CKKWHandler() ) CKKWHandler()->setXComb(lastXCombPtr()); + currentCollision(new_ptr(Collision(lastParticles(), currentEvent(), this))); + if ( currentEvent() ) currentEvent()->addCollision(currentCollision()); + currentStep(new_ptr(Step(currentCollision(), this))); + currentCollision()->addStep(currentStep()); + currentStep()->addSubProcess(currentReader()->getSubProcess()); + lastExtractor()->constructRemnants(lastXCombPtr()->partonBinInstances(), + subProcess(), currentStep()); + + if ( !currentReader()->cuts().passCuts(*currentCollision()) ) throw Veto(); + + initGroups(); + if ( ThePEG_DEBUG_ITEM(1) ) { + if ( currentEvent() ) + generator()->logfile() << *currentEvent(); + else + generator()->logfile() << *currentCollision(); + } + return continueCollision(); +} + +EventPtr FxFxEventHandler::continueEvent() { + try { + continueCollision(); + } + catch (Veto) { + const double fact = + theNormWeight ? + double(selector().sum()/picobarn) : 1.; + reject(currentEvent()->weight()/fact); + } + catch (Stop) { + } + catch (Exception &) { + const double fact = + theNormWeight ? + double(selector().sum()/picobarn) : 1.; + reject(currentEvent()->weight()/fact); + throw; + } + return currentEvent(); +} + +void FxFxEventHandler::dofinish() { + EventHandler::dofinish(); + if ( selector().compensating() ) generator()->log() + << "Warning: The run was ended while the FxFxEventHandler '" + << name() << "' was still trying to compensate for weights larger than 1. " + << "The cross section estimates may therefore be statistically " + << "inaccurate." << endl; +} + +void FxFxEventHandler::statistics(ostream & os) const { + if ( statLevel() == 0 ) return; + + string line = "=======================================" + "=======================================\n"; + + if ( stats.accepted() <= 0 ) { + os << line << "No events generated by event handler '" << name() << "'." + << endl; + return; + } + + os << line << "Statistics for Les Houches event handler \'" << name() << "\':\n" + << " " + << "generated number of Cross-section\n" + << " " + << " events attempts (nb)\n"; + + os << line << "Total:" << setw(42) << stats.accepted() << setw(13) + << stats.attempts() << setw(17) + << ouniterr(stats.xSec(), stats.xSecErr(), nanobarn) << endl + << line; + + if ( statLevel() == 1 ) return; + + if ( statLevel() == 2 ) { + + os << "Per Les Houches Reader breakdown:\n"; + + for ( int i = 0, N = readers().size(); i < N; ++i ) { + FxFxReader & reader = *readers()[i]; + string n = reader.name(); + n.resize(37, ' '); + os << n << setw(11) << reader.stats.accepted() << setw(13) + << reader.stats.attempts() << setw(17) + << ouniterr(reader.stats.xSec(), reader.stats.xSecErr(), nanobarn) + << endl; + } + os << line; + } else { + + os << "Per Les Houches Reader (and process #) breakdown:\n"; + + for ( int i = 0, N = readers().size(); i < N; ++i ) { + FxFxReader & reader = *readers()[i]; + string n = reader.name() + " (all)"; + n.resize(37, ' '); + os << n << setw(11) << reader.stats.accepted() << setw(13) + << reader.stats.attempts() << setw(17) + << ouniterr(reader.stats.xSec(), reader.stats.xSecErr(), nanobarn) + << endl; + CrossSection xsectot = reader.stats.xSec(); + if ( xsectot != ZERO ) xsectot /= reader.stats.sumWeights(); + typedef FxFxReader::StatMap::const_iterator const_iterator; + for ( const_iterator i = reader.statmap.begin(); + i != reader.statmap.end(); ++i ) { + ostringstream ss; + ss << reader.name() << " (" << i->first << ")"; + string n = ss.str(); + n.resize(37, ' '); + os << n << setw(11) << i->second.accepted() << setw(13) + << i->second.attempts() << setw(17) + << ouniterr(i->second.sumWeights()*xsectot, + sqrt(i->second.sumWeights2())*xsectot, nanobarn) << endl; + } + os << line; + } + } + + string warn = "Warning: Result may be statistically incorrect since\n" + " the following FxFxReaders were oversampled:\n"; + for ( int i = 0, N = readers().size(); i < N; ++i ) { + FxFxReader & reader = *readers()[i]; + if ( reader.NEvents() > 0 && reader.stats.attempts() > reader.NEvents() ) { + os << warn; + warn = ""; + os << "'" << reader.name() << "' (by a factor " + << double(reader.stats.attempts())/double(reader.NEvents()) + << ")" << endl; + } + } +} + + +void FxFxEventHandler::increaseMaxXSec(CrossSection maxxsec) { + stats.maxXSec(selector().sum()); + histStats.maxXSec(selector().sum()); + currentReader()->increaseMaxXSec(maxxsec); +} + +void FxFxEventHandler::accept() { + ntries++; + stats.accept(); + histStats.accept(); + currentReader()->accept(); + for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ + (it->second).accept(); + } + for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ + (it->second).accept(); + } +} + +void FxFxEventHandler::reject(double w) { + ntries++; + stats.reject(w); + histStats.reject(w); + currentReader()->reject(w); + vector wv; + for (map::const_iterator it= currentReader()->optionalEventWeights().begin(); it!=currentReader()->optionalEventWeights().end(); ++it){ + wv.push_back(it->second); + } + int ii = 0; + for (map::iterator it= opthistStats.begin(); it!=opthistStats.end(); ++it){ + (it->second).reject(wv[ii]); + ii++; + } + ii = 0; + for (map::iterator it= optstats.begin(); it!=optstats.end(); ++it){ + (it->second).reject(wv[ii]); + ii++; + } +} + + + +map FxFxEventHandler::optintegratedXSecMap() const { + map result; + for (map::const_iterator it= optstats.begin(); it!=optstats.end(); ++it){ + result[it->first] = (it->second.sumWeights()/it->second.attempts()) * picobarn; + } + + return result; +} + + +CrossSection FxFxEventHandler::histogramScale() const { + return histStats.xSec()/histStats.sumWeights(); +} + +CrossSection FxFxEventHandler::integratedXSec() const { + return histStats.xSec(); +} + +CrossSection FxFxEventHandler::integratedXSecErr() const { + return histStats.xSecErr(); +} + +int FxFxEventHandler::ntriesinternal() const { + return stats.attempts(); +} + +void FxFxEventHandler::persistentOutput(PersistentOStream & os) const { + os << stats << histStats << theReaders << theSelector + << oenum(theWeightOption) << theUnitTolerance << theCurrentReader << warnPNum + << theNormWeight; + +} + +void FxFxEventHandler::persistentInput(PersistentIStream & is, int) { + is >> stats >> histStats >> theReaders >> theSelector + >> ienum(theWeightOption) >> theUnitTolerance >> theCurrentReader >> warnPNum + >> theNormWeight; +} + +ClassDescription +FxFxEventHandler::initFxFxEventHandler; +// Definition of the static class description member. + +void FxFxEventHandler::setUnitTolerance(double x) { + theUnitTolerance = x; + selector().tolerance(unitTolerance()); +} + +void FxFxEventHandler::Init() { + + static ClassDocumentation documentation + ("This is the main class administrating the selection of hard " + "subprocesses from a set of ThePEG::FxFxReader objects."); + + + static RefVector + interfaceFxFxReaders + ("FxFxReaders", + "Objects capable of reading events from an event file or an " + "external matrix element generator.", + &FxFxEventHandler::theReaders, -1, false, false, true, false, false); + + static Switch interfaceWeightOption + ("WeightOption", + "The different ways to weight events in the Les Houches event handler. " + "Whether weighted or not and whether or not negative weights are allowed.", + &FxFxEventHandler::theWeightOption, unitweight, true, false); + static SwitchOption interfaceWeightOptionUnitWeight + (interfaceWeightOption, + "UnitWeight", + "All events have unit weight.", + unitweight); + static SwitchOption interfaceWeightOptionNegUnitWeight + (interfaceWeightOption, + "NegUnitWeight", + "All events have weight +1 or maybe -1.", + unitnegweight); + static SwitchOption interfaceWeightOptionVarWeight + (interfaceWeightOption, + "VarWeight", + "Events may have varying but positive weights.", + varweight); + static SwitchOption interfaceWeightOptionVarNegWeight + (interfaceWeightOption, + "VarNegWeight", + "Events may have varying weights, both positive and negative.", + varnegweight); + + static Switch interfaceWarnPNum + ("WarnPNum", + "Warn if the same process number is used in more than one " + "FxFxReader.", + &FxFxEventHandler::warnPNum, true, true, false); + static SwitchOption interfaceWarnPNumWarning + (interfaceWarnPNum, + "Warning", + "Give a warning message.", + true); + static SwitchOption interfaceWarnPNumNoWarning + (interfaceWarnPNum, + "NoWarning", + "Don't give a warning message.", + false); + + static Parameter interfaceUnitTolerance + ("UnitTolerance", + "If the WeightOption is set to unit weight, do not start compensating unless the a weight is found to be this much larger than unity.", + &FxFxEventHandler::theUnitTolerance, 1.0e-6, 0.0, 0, + true, false, Interface::lowerlim, + &FxFxEventHandler::setUnitTolerance, + (double(FxFxEventHandler::*)()const)(0), + (double(FxFxEventHandler::*)()const)(0), + (double(FxFxEventHandler::*)()const)(0), + (double(FxFxEventHandler::*)()const)(0)); + + static Switch interfaceWeightNormalization + ("WeightNormalization", + "How to normalize the output weights", + &FxFxEventHandler::theNormWeight, 0, false, false); + static SwitchOption interfaceWeightNormalizationUnit + (interfaceWeightNormalization, + "Normalized", + "Standard normalization, i.e. +/- for unweighted events", + 0); + static SwitchOption interfaceWeightNormalizationCrossSection + (interfaceWeightNormalization, + "CrossSection", + "Normalize the weights to the max cross section in pb", + 1); + + + interfaceFxFxReaders.rank(10); + interfaceWeightOption.rank(9); + +} + diff --git a/Contrib/FxFx/FxFxEventHandler.fh b/MatrixElement/FxFx/FxFxEventHandler.fh rename from Contrib/FxFx/FxFxEventHandler.fh rename to MatrixElement/FxFx/FxFxEventHandler.fh diff --git a/MatrixElement/FxFx/FxFxEventHandler.h b/MatrixElement/FxFx/FxFxEventHandler.h new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/FxFxEventHandler.h @@ -0,0 +1,447 @@ +// -*- C++ -*- +// +// FxFxEventHandler.h is a part of ThePEG - Toolkit for HEP Event Generation +// Copyright (C) 1999-2011 Leif Lonnblad +// +// ThePEG is licenced under version 3 of the GPL, see COPYING for details. +// Please respect the MCnet academic guidelines, see GUIDELINES for details. +// +#ifndef THEPEG_FxFxEventHandler_H +#define THEPEG_FxFxEventHandler_H +// +// This is the declaration of the FxFxEventHandler class. +// + +#include "ThePEG/Handlers/EventHandler.h" +#include "FxFxEventHandler.fh" +#include "FxFxReader.fh" +#include "ThePEG/Utilities/CompSelector.h" +#include "ThePEG/Utilities/XSecStat.h" + +namespace ThePEG { + +/** + * The FxFxEventHandler inherits from the general EventHandler + * class and administers the reading of events generated by external + * matrix element generator programs according to the Les Houches + * accord. + * + * The class has a list of FxFxReaders which + * typically are connected to files with event data produced by + * external matrix element generator programs. When an event is + * requested by FxFxEventHandler, one of the readers are chosen, + * an event is read in and then passed to the different + * StepHandler defined in the underlying + * EventHandler class. + * + * @see \ref FxFxEventHandlerInterfaces "The interfaces" + * defined for FxFxEventHandler. + */ +class FxFxEventHandler: public EventHandler { + +public: + + /** + * A vector of FxFxReader objects. + */ + typedef vector ReaderVector; + + /** + * A selector of readers. + */ + typedef CompSelector ReaderSelector; + + /** + * Enumerate the weighting options. + */ + enum WeightOpt { + unitweight = 1, /**< All events have unit weight. */ + unitnegweight = -1, /**< All events have wight +/- 1. */ + varweight = 2, /**< Varying positive weights. */ + varnegweight = -2 /**< Varying positive or negative weights. */ + }; + + friend class FxFxHandler; + + +public: + + /** @name Standard constructors and destructors. */ + //@{ + /** + * The default constructor. + */ + FxFxEventHandler() + : theWeightOption(unitweight), theUnitTolerance(1.0e-6), warnPNum(true), theNormWeight(0) + { + selector().tolerance(unitTolerance()); + } + + /** + * The destructor. + */ + virtual ~FxFxEventHandler(); + //@} + +public: + + /** @name Initialization and finalization functions. */ + //@{ + /** + * Initialize this event handler and all related objects needed to + * generate events. + */ + virtual void initialize(); + + /** + * Write out accumulated statistics about intergrated cross sections + * and stuff. + */ + virtual void statistics(ostream &) const; + + /** + * Histogram scale. A histogram bin which has been filled with the + * weights associated with the Event objects should be scaled by + * this factor to give the correct cross section. + */ + virtual CrossSection histogramScale() const; + + /** + * The estimated total integrated cross section of the processes + * generated in this run. + * @return 0 if no integrated cross section could be estimated. + */ + virtual CrossSection integratedXSec() const; + + virtual int ntriesinternal() const; + + /** + * The estimated error in the total integrated cross section of the + * processes generated in this run. + * @return 0 if no integrated cross section error could be estimated. + */ + virtual CrossSection integratedXSecErr() const; + + virtual map optintegratedXSecMap() const; + + //@} + + /** @name Functions used for the actual generation */ + //@{ + /** + * Generate an event. + */ + virtual EventPtr generateEvent(); + + /** + * Create the Event and Collision objects. Used by the + * generateEvent() function. + */ + virtual tCollPtr performCollision(); + + /** + * Continue generating an event if the generation has been stopped + * before finishing. + */ + virtual EventPtr continueEvent(); + //@} + + /** @name Functions to manipulate statistics. */ + //@{ + /** + * An event has been selected. Signal that an event has been + * selected with the given \a weight. If unit weights are requested, + * the event will be accepted with that weight. This also takes care + * of the statistics collection of the selected reader object. + */ + void select(double weight); + + /** + * Accept the current event, taking care of the statistics + * collection of the corresponding reader objects. + */ + void accept(); + + /** + * Reject the current event, taking care of the statistics + * collection of the corresponding reader objects. + */ + void reject(double weight); + + /** + * Increase the overestimated cross section for the selected reader. + */ + void increaseMaxXSec(CrossSection maxxsec); + + /** + * Skip some events. To ensure a reader file is scanned an even + * number of times, skip a number of events for the selected reader. + */ + void skipEvents(); + + //@} + + /** @name Simple access functions. */ + //@{ + /** + * The way weights are to be treated. + */ + WeightOpt weightOption() const { return theWeightOption; } + + /** + * If the weight option is set to unit weight, do not start + * compensating unless the weight is this much larger than unity. + */ + double unitTolerance() const { return theUnitTolerance; } + + /** + * Access the list of readers. + */ + const ReaderVector & readers() const { return theReaders; } + + /** + * The selector to choose readers according to their overestimated + * cross section. + */ + const ReaderSelector & selector() const { return theSelector; } + + /** + * The currently selected reader object. + */ + tFxFxReaderPtr currentReader() const { return theCurrentReader; } + + + /** + * Set the currently selected reader object. + */ + void currentReader(tFxFxReaderPtr x) { theCurrentReader = x; } + + //@} + +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(); + + /** + * The currently selected reader object. + */ + tFxFxReaderPtr theCurrentReader; + + + +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(); + + /** + * Initialize this object. Called in the run phase just before + * a run begins. + */ + virtual void doinitrun(); + + /** + * Finalize this object. Called in the run phase just after a + * run has ended. Used eg. to write out statistics. + */ + virtual void dofinish(); + //@} + +protected: + + /** + * Access the list of readers. + */ + ReaderVector & readers() { return theReaders; } + + /** + * The selector to choose readers according to their overestimated + * cross section. + */ + ReaderSelector & selector() { return theSelector; } + + /** + * Helper function for the interface; + */ + void setUnitTolerance(double); + + /** + * Collect statistics for this event handler. + */ + XSecStat stats; + + map optstats; + + map optxs; + + int ntries; + + map OptStatsFunc() { return optstats; } + + map OptXsFunc() { return optxs; } + + + /** + * Collect statistics for this event handler. To be used for + * histogram scaling. + */ + XSecStat histStats; + + map opthistStats; + + + /* + * The weight identifiers for the events + */ + + vector weightnames; + +private: + + /** + * The list of readers. + */ + ReaderVector theReaders; + + /** + * The selector to choose readers according to their overestimated + * cross section. + */ + ReaderSelector theSelector; + + /** + * The way weights are to be treated. + */ + WeightOpt theWeightOption; + + /** + * If the weight option is set to unit weight, do not start + * compensating unless the weight is this much larger than unity. + */ + double theUnitTolerance; + + + /** + * Warn if the same process number is used in more than one + * FxFxReader. + */ + bool warnPNum; + + /** + * How to normalize the weights + */ + unsigned int theNormWeight; + + +public: + + /** @cond EXCEPTIONCLASSES */ + /** + * Exception class used if no readers were assigned. + */ + class FxFxInitError: public InitException {}; + + /** + * Exception class used if the same process number is used by more + * than ne reader. + */ + class FxFxPNumException: public InitException {}; + /** @endcond */ + +private: + + /** + * The static object used to initialize the description of this class. + * Indicates that this is a concrete class with persistent data. + */ + static ClassDescription initFxFxEventHandler; + + /** + * The assignment operator is private and must never be called. + * In fact, it should not even be implemented. + */ + FxFxEventHandler & operator=(const FxFxEventHandler &) = delete; + +}; + +} + +// CLASSDOC OFF + +#include "ThePEG/Utilities/ClassTraits.h" + +namespace ThePEG { + +/** @cond TRAITSPECIALIZATIONS */ + +/** This template specialization informs ThePEG about the + * base classes of FxFxEventHandler. */ +template <> +struct BaseClassTrait { + /** Typedef of the first base class of FxFxEventHandler. */ + typedef EventHandler NthBase; +}; + +/** This template specialization informs ThePEG about the name of + * the FxFxEventHandler class and the shared object where it is defined. */ +template <> +struct ClassTraits + : public ClassTraitsBase { + /** Return a platform-independent class name */ + static string className() { return "Herwig::FxFxEventHandler"; } + /** Return the name of the shared library be loaded to get access to + * the FxFxEventHandler class and every other class it uses + * (except the base class). */ + static string library() { return "HwFxFx.so"; } +}; + +/** @endcond */ + +} + +#endif /* THEPEG_FxFxEventHandler_H */ diff --git a/Contrib/FxFx/FxFxFileReader.cc b/MatrixElement/FxFx/FxFxFileReader.cc rename from Contrib/FxFx/FxFxFileReader.cc rename to MatrixElement/FxFx/FxFxFileReader.cc diff --git a/Contrib/FxFx/FxFxFileReader.fh b/MatrixElement/FxFx/FxFxFileReader.fh rename from Contrib/FxFx/FxFxFileReader.fh rename to MatrixElement/FxFx/FxFxFileReader.fh diff --git a/MatrixElement/FxFx/FxFxFileReader.h b/MatrixElement/FxFx/FxFxFileReader.h new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/FxFxFileReader.h @@ -0,0 +1,333 @@ +// -*- C++ -*- +// +// FxFxFileReader.h is a part of ThePEG - Toolkit for HEP Event Generation +// Copyright (C) 1999-2011 Leif Lonnblad +// +// ThePEG is licenced under version 3 of the GPL, see COPYING for details. +// Please respect the MCnet academic guidelines, see GUIDELINES for details. +// +#ifndef THEPEG_FxFxFileReader_H +#define THEPEG_FxFxFileReader_H +// This is the declaration of the FxFxFileReader class. + +#include "FxFxReader.h" +#include "FxFxFileReader.fh" +#include "ThePEG/PDT/Decayer.h" +#include "ThePEG/Utilities/CFileLineReader.h" +#include + +namespace ThePEG { + + +/** + * FxFxFileReader is an base class to be used for objects which + * reads event files from matrix element generators. It inherits from + * FxFxReader and extends it by defining a file handle to be + * read from, which is opened and closed by the open() and close() + * functions. Note that the file handle is a standard C filehandle and + * not a C++ stream. This is because there is no standard way in C++ + * to connect a pipe to a stream for reading eg. gzipped files. This + * class is able to read plain event files conforming to the Les + * Houches Event File accord. + * + * @see \ref FxFxFileReaderInterfaces "The interfaces" + * defined for FxFxFileReader. + * @see Event + * @see FxFxReader + */ +class FxFxFileReader: public FxFxReader { + +public: + + /** @name Standard constructors and destructors. */ + //@{ + /** + * Default constructor. + */ + FxFxFileReader() : neve(0), ieve(0), theQNumbers(false), theIncludeFxFxTags(true), + theIncludeCentral(false) {} + + /** + * Copy-constructor. Note that a file which is opened in the object + * copied from will have to be reopened in this. + */ + FxFxFileReader(const FxFxFileReader &); + + /** + * Destructor. + */ + virtual ~FxFxFileReader(); + //@} + +public: + + /** @name Virtual functions specified by the FxFxReader base class. */ + //@{ + /** + * Initialize. This function is called by the FxFxEventHandler + * to which this object is assigned. + */ + virtual void initialize(FxFxEventHandler & eh); + + /** + * Open a file with events. Derived classes should overwrite it and + * first calling it before reading in the run information into the + * corresponding protected variables. + */ + virtual void open(); + + /** + * Close the file from which events have been read. + */ + virtual void close(); + + + /** + * Read the next event from the file or stream into the + * corresponding protected variables. Return false if there is no + * more events or if this was not a LHF event file. + */ + virtual bool doReadEvent(); + //@} + + /** + * Return the name of the file from where to read events. + */ + string filename() const { return theFileName; } + + /* vector optionalWeightsNames; + + virtual vector optWeightNamesFunc();*/ + + + virtual vector optWeightsNamesFunc(); + + + /** + * Erases all occurences of a substring from a string + */ + + void erase_substr(std::string& subject, const std::string& search); + + +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; + //@} + + /** @name Standard (and non-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(); + + /** + * Return true if this object needs to be initialized before all + * other objects because it needs to extract PDFs from the event file. + */ + virtual bool preInitialize() const; + //@ + +protected: + + /** + * The wrapper around the C FILE stream from which to read + */ + CFileLineReader cfile; + +protected: + + /** + * The number of events in this file. + */ + long neve; + + /** + * The current event number. + */ + long ieve; + + /** + * If the file is a standard Les Houches formatted file (LHF) this + * is its version number. If empty, this is not a Les Houches + * formatted file + */ + string LHFVersion; + + /** + * If LHF. All lines (since the last open() or readEvent()) outside + * the header, init and event tags. + */ + string outsideBlock; + + /** + * If LHF. All lines from the header block. + */ + string headerBlock; + + /** + * If LHF. Additional comments found in the init block. + */ + string initComments; + + /** + * If LHF. Map of attributes (name-value pairs) found in the init + * tag. + */ + map initAttributes; + + /** + * If LHF. Additional comments found with the last read event. + */ + string eventComments; + + /** + * If LHF. Map of attributes (name-value pairs) found in the last + * event tag. + */ + map eventAttributes; + +private: + + /** + * The name of the file from where to read events. + */ + string theFileName; + + /** + * Whether or not to search for QNUMBERS stuff + */ + bool theQNumbers; + + /** + * Include/Read FxFx tags + */ + bool theIncludeFxFxTags; + + /** + * Include central weight (for backup use) + */ + bool theIncludeCentral; + + /** + * Decayer for any decay modes read from the file + */ + DecayerPtr theDecayer; + + /** + * Further information on the weights + */ + map scalemap; + + /** + * Temporary holder for optional weights + */ + + map optionalWeightsTemp; + + +private: + + /** + * Describe an abstract base class with persistent data. + */ + static ClassDescription initFxFxFileReader; + + /** + * Private and non-existent assignment operator. + */ + FxFxFileReader & operator=(const FxFxFileReader &) = delete; + +public: + + /** @cond EXCEPTIONCLASSES */ + /** Exception class used by FxFxFileReader if reading the file + * fails. */ + class FxFxFileError: public Exception {}; + /** @endcond */ + +}; + +} + + +#include "ThePEG/Utilities/ClassTraits.h" + +namespace ThePEG { + +/** @cond TRAITSPECIALIZATIONS */ + +/** + * This template specialization informs ThePEG about the + * base class of FxFxFileReader. + */ +template <> +struct BaseClassTrait: public ClassTraitsType { + /** Typedef of the base class of FxFxFileReader. */ + typedef FxFxReader NthBase; +}; + +/** + * This template specialization informs ThePEG about the name of the + * FxFxFileReader class and the shared object where it is + * defined. + */ +template <> +struct ClassTraits + : public ClassTraitsBase { + /** + * Return the class name. + */ + static string className() { return "Herwig::FxFxFileReader"; } + /** + * Return the name of the shared library to be loaded to get access + * to the FxFxFileReader class and every other class it uses + * (except the base class). + */ + static string library() { return "HwFxFx.so"; } + +}; + +/** @endcond */ + +} + +#endif /* THEPEG_FxFxFileReader_H */ diff --git a/MatrixElement/FxFx/FxFxHandler.cc b/MatrixElement/FxFx/FxFxHandler.cc new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/FxFxHandler.cc @@ -0,0 +1,1655 @@ +#include "FxFxHandler.h" +#include "FxFxReader.h" +#include "FxFxReader.fh" +#include "FxFxEventHandler.h" +#include "ThePEG/Interface/ClassDocumentation.h" +#include "ThePEG/Interface/Switch.h" +#include "ThePEG/Interface/Reference.h" +#include "ThePEG/Repository/UseRandom.h" +#include "ThePEG/Interface/Parameter.h" +#include "ThePEG/Persistency/PersistentOStream.h" +#include "ThePEG/Persistency/PersistentIStream.h" +#include "Herwig/Shower/QTilde/Base/PartnerFinder.h" +#include "Herwig/PDF/HwRemDecayer.h" +#include +#include "ThePEG/Utilities/Throw.h" +#include "Herwig/Shower/QTilde/Kinematics/KinematicsReconstructor.h" +#include "fastjet/PseudoJet.hh" +#include "fastjet/ClusterSequence.hh" +#include "gsl/gsl_rng.h" +#include "gsl/gsl_randist.h" +#include + + +using namespace Herwig; +using namespace ThePEG; + +bool recordEntry(PPtr i,PPtr j) { + return (i->number()number()); +} +bool pTsortFunction(PPtr i,PPtr j) { + return (i->momentum().perp2()>j->momentum().perp2()); +} +bool ETsortFunction(pair i,pair j) { + return (i.first>j.first); +} +bool isMomLessThanEpsilon(Lorentz5Momentum p,Energy epsilon) { + return (abs(p.x())> alphaS_ + >> ncy_ >> ncphi_ >> ihvy_ >> nph_ >> nh_ + >> iunit(etclusmean_,GeV) >> rclus_ >> etaclmax_ >> rclusfactor_ + >> ihrd_ >> njets_ >> drjmin_ >> highestMultiplicity_ + >> ycmax_ >> ycmin_ >> jetAlgorithm_ >> vetoIsTurnedOff_ >> vetoSoftThanMatched_ >> etclusfixed_ + >> cphcal_ >> sphcal_ >> cthcal_ >> sthcal_ >> iunit(epsetclus_,GeV) >> vetoHeavyQ_ >> mergemode_ >> hpdetect_ >> vetoHeavyFlavour_; +} + +ClassDescription FxFxHandler::initFxFxHandler; +// Definition of the static class description member. + +void FxFxHandler::Init() { + + static ClassDocumentation documentation + ("The FxFxHandler class performs MEPS merging " + "using the MLM procedure."); + + static Reference interfaceShowerAlpha + ("ShowerAlpha", + "The object calculating the strong coupling constant", + &FxFxHandler::alphaS_, false, false, true, false, false); + + static Parameter interfaceihvy + ("ihvy", + "heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t)", + &FxFxHandler::ihvy_, -999, -999, 7, + false, false, Interface::limited); + + static Parameter interfacenph + ("nph", + "Number of photons in the AlpGen process", + &FxFxHandler::nph_, -999, -999, 7, + false, false, Interface::limited); + + static Parameter interfacenh + ("nh", + "Number of higgses in the AlpGen process", + &FxFxHandler::nph_, -999, -999, 7, + false, false, Interface::limited); + + static Parameter interfaceETClus + ("ETClus", + "The ET threshold defining a jet in the merging procedure", + &FxFxHandler::etclusmean_, GeV, 20*GeV, 0*GeV, 14000*GeV, + false, false, Interface::limited); + + static Parameter interfaceRClus + ("RClus", + "The cone size used to define a jet in the merging procedure", + &FxFxHandler::rclus_, 0.4, 0.0, 4.0, + false, false, Interface::limited); + + static Parameter interfaceEtaClusMax + ("EtaClusMax", + "The maximum |eta| used to define a jet in the merging procedure", + &FxFxHandler::etaclmax_, 5.0, 0.0, 15.0, + false, false, Interface::limited); + + static Parameter interfaceRClusFactor + ("RClusFactor", + "The prefactor for RClus used to define the jet-parton matching " + "distance", + &FxFxHandler::rclusfactor_, 1.5, 0.0, 4.0, + false, false, Interface::limited); + + static Parameter interfaceihrd + ("ihrd", + "The hard process code", + &FxFxHandler::ihrd_, -999, 0, 10000, + false, false, Interface::limited); + + static Parameter interfacenjetsmax + ("njetsmax", + "The number of light jets in the maximum-multiplicity process", + &FxFxHandler::njets_, -999, 0, 10000, + false, false, Interface::limited); + + static Parameter interfacedrjmin + ("drjmin", + "Mimimum parton-parton R-sep used for generation.", + &FxFxHandler::drjmin_, 0.7, 0.0, 4.0, + false, false, Interface::limited); + + static Parameter interfacehighestMultiplicity + ("highestMultiplicity", + "If true it indicates that this is the highest multiplicity input " + "ME-level configuration to be processed.", + &FxFxHandler::highestMultiplicity_, 0, 0, 1, + false, false, Interface::limited); + + static Parameter interfaceETClusFixed + ("ETClusFixed", + "If false, indicates that the jet merging scale, etclus_ is allowed to vary" + "according to epsetclus_", + &FxFxHandler::etclusfixed_, 1, 0, 1, + false, false, Interface::limited); + + static Parameter interfaceEpsilonETClus + ("EpsilonETClus", + "The ET threshold defining a jet in the merging procedure", + &FxFxHandler::epsetclus_, GeV, 2.5*GeV, 0*GeV, 100.0*GeV, + false, false, Interface::limited); + + static Switch interfaceJetAlgorithm + ("JetAlgorithm", + "Determines the jet algorithm for finding jets in parton-jet " + "matching in the MLM procedure.", + &FxFxHandler::jetAlgorithm_, 1, false, false); + static SwitchOption AntiKt + (interfaceJetAlgorithm, + "AntiKt", + "The anti-kt jet algorithm.", + -1); + static SwitchOption CambridgeAachen + (interfaceJetAlgorithm, + "CambridgeAachen", + "The Cambridge-Aachen jet algorithm.", + 0); + static SwitchOption Kt + (interfaceJetAlgorithm, + "Kt", + "The Kt jet algorithm.", + 1); + + static Switch interfaceMergeMode + ("MergeMode", + "The choice of merging mode", + &FxFxHandler::mergemode_, 0, false, false); + static SwitchOption FxFx + (interfaceMergeMode, + "FxFx", + "FxFx merging.", + 0); + static SwitchOption Tree + (interfaceMergeMode, + "Tree", + "Tree-level merging.", + 1); + static SwitchOption TreeMG + (interfaceMergeMode, + "TreeMG5", + "Tree-level merging using the MadGraph pt clustering information.", + 2); + + + static Switch interfaceHardProcessDetection + ("HardProcessDetection", + "The choice of merging mode", + &FxFxHandler::hpdetect_, true, false, false); + static SwitchOption Automatic + (interfaceHardProcessDetection, + "Automatic", + "Automatically determine which particles to include in the merging.", + true); + static SwitchOption Manual + (interfaceHardProcessDetection, + "Manual", + "Use the ihrd code to determine which particles to include in the merging.", + false); + + static Switch interfaceVetoIsTurnedOff + ("VetoIsTurnedOff", + "Allows the vetoing mechanism to be switched off.", + &FxFxHandler::vetoIsTurnedOff_, false, false, false); + static SwitchOption VetoingIsOn + (interfaceVetoIsTurnedOff, + "VetoingIsOn", + "The MLM merging veto mechanism is switched ON.", + false); + static SwitchOption VetoingIsOff + (interfaceVetoIsTurnedOff, + "VetoingIsOff", + "The MLM merging veto mechanism is switched OFF.", + true); + + + static Switch interfaceVetoHeavyFlavour + ("VetoHeavyFlavour", + "Allows the heavy flavour vetoing mechanism to be switched off.", + &FxFxHandler::vetoHeavyFlavour_, false, false, false); + static SwitchOption HeavyFVetoingIsOn + (interfaceVetoHeavyFlavour, + "Yes", + "The MLM merging veto mechanism for heavy flavour is switched ON.", + true); + static SwitchOption HeavyFVetoingIsOff + (interfaceVetoHeavyFlavour, + "No", + "The MLM merging veto mechanism for heavy flavour is switched OFF.", + false); + + static Switch interfaceHeavyQVeto + ("HeavyQVeto", + "Allows the vetoing mechanism on the heavy quark products to be switched off.", + &FxFxHandler::vetoHeavyQ_, false, false, false); + static SwitchOption HQVetoingIsOn + (interfaceHeavyQVeto, + "Yes", + "The MLM merging veto on Heavy quark decay produts mechanism is switched ON.", + true); + static SwitchOption HQVetoingIsOff + (interfaceHeavyQVeto, + "No", + "The MLM merging veto on Heavy quark decay products mechanism is switched OFF.", + false); + + static Switch interfaceVetoSoftThanMatched + ("VetoSoftThanMatched", + "Allows the vetoing mechanism to be switched off.", + &FxFxHandler::vetoSoftThanMatched_, false, false, false); + static SwitchOption VetoSoftIsOn + (interfaceVetoSoftThanMatched, + "VetoSoftIsOn", + "The vetoing of highest-mult. events with jets softer than matched ones is ON", + true); + static SwitchOption VetoSoftIsOff + (interfaceVetoSoftThanMatched, + "VetoSoftIsOff", + "The vetoing of highest-mult. events with jets softer than matched ones is OFF.", + false); + + +} + +void FxFxHandler::dofinish() { + QTildeShowerHandler::dofinish(); +} + +void FxFxHandler::doinit() { + + //print error if HardProcID is not set in input file + if(ihrd_ == -999 && !hpdetect_) { cout << "Error: FxFxHandler:ihrd not set and FxFx:HardProcessDetection set to Manual!" << endl; exit(1); } + QTildeShowerHandler::doinit(); + + // Compute calorimeter edges in rapidity for GetJet algorithm. + ycmax_=etaclmax_+rclus_; + ycmin_=-ycmax_; +} + +// Throws a veto according to MLM strategy ... when we finish writing it. +bool FxFxHandler::showerHardProcessVeto() const { + int debug_mode = 0; + if(vetoIsTurnedOff_) { + // cout << "Vetoing is turned OFF." << endl; + return false; + } + + //if(debug_mode) { cout << "debug_mode = " << 5 << endl; } + + // Skip veto for processes in which merging is not implemented: + if(ihrd_==7||ihrd_==8||ihrd_==13) { + ostringstream wstring; + wstring << "FxFxHandler::showerHardProcessVeto() - warning." + << "MLM merging not implemented " + << "processes 4Q (ihrd=7), QQh (ihrd=8), " + << "(single) top (ihrd=13) \n"; + generator()->logWarning( Exception(wstring.str(), + Exception::warning) ); + return false; + } + + // Fill preshowerISPs_ pair and preshowerFSPs_ particle pointer vector. + getPreshowerParticles(); + + // Fill showeredISHs_, showeredISPs and showeredRems pairs, as well as + // showeredFSPs_ particle pointer vector. + getShoweredParticles(); + + // Turn on some screen output debugging: 0 = none ---> 5 = very verbose. + doSanityChecks(debug_mode); + + + // Dimensions of each calorimter cell in y and phi. + dely_ = (ycmax_-ycmin_)/double(ncy_); + delphi_ = 2*M_PI/double(ncphi_); + + // Fill partonsToMatch_ with only those pre-shower partons intended to + // used in jet-parton matching and fill particlesToCluster_ using only + // those final state particles (post-shower) which are supposed to go + // in the jet clustering used to do merging. + partonsToMatch_ = preshowerFSPs_; + particlesToCluster_ = showeredFSPs_ ; + + // Filter out all but the 'extra' light-parton progenitors and their + // associated final state particles. + if(mergemode_ == 0 || mergemode_ == 1) { caldel_m(); } + else if(mergemode_ == 2) { caldel_mg(); } + + double prob(1); + //if etclusfixed_ then set the etclus_ to the fixed chosen value + if(etclusfixed_) { + etclus_ = etclusmean_; + } else { + //else, if we wish to vary etclus_, we use the probability distribution + //choose a probability between 0 and 1 + prob = rnd(); + etclus_ = etclusran_(prob); + } + + // Cluster particlesToCluster_ into jets with FastJet. + getFastJets(rclus_,etclus_,etaclmax_); + + if(mergemode_ == 0) { + + // Get npLO_ and npNLO_ for FxFx matching + getnpFxFx(); + + // print the npXLO_ values obtained + // cout << "HANDLER:\t\t\t\t" << npLO_ << "\t\t" << npNLO_ << endl; + + //FxFx modifications start here. + + // Sort partonsToMatch_ from high to low pT. + sort(partonsToMatch_.begin(),partonsToMatch_.end(),pTsortFunction); + + // Count the number of jets. + int njets_found(pjet_.size()); + + // If the number of jets found is not equal to the number of partons in the Born + // (i.e., the number of partons in the S-event, or one less than the number of partons in an H-event), + // the jets cannot be matched and the event has to be rejected. The number of partons in the Born is written in the event file with a name “npNLO” + // if there are no jets to match and no jets have been found, do not veto. + if(njets_found == 0 && npNLO_ == 0) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", accepting" << endl;*/ return false; } + + //if the number of jets is smaller than npNLO -> reject the event. + if(njets_found < npNLO_) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", rejecting" << endl;*/ return true; } + // For the maximum-multiplicity sample, the number of jets obtained does not have to be exactly equal to npNLO, it may also be larger; + if(njets_found > npNLO_ && npNLO_ != njets_) { /*cout << "njets_found = " << njets_found << " and npNLO = " << npNLO_ << ", rejecting" << endl;*/ return true; } + + // Create the matrix-element jets. + // Cluster also the partons at the hard-matrix element level into jets with the same algorithm as above, + // but without the requirement of a minimal pT on the jets (or set it very small). + // By construction, for S-events you should find exactly npNLO jets, while for the H-events it is either npNLO or npNLO+1. + // Cluster partonsToMatch_ into jets with FastJet. + getFastJetsToMatch(rclus_); + + //int me_njets_found(pjetME_.size()); + + // cout << "number of ME jets found = " << me_njets_found << "partons to match: " << partonsToMatch_.size() << endl; + + // Match light progenitors to jets. + vector jetToPartonMap(pjetME_.size(),-999); + Energy etmin(777e100*GeV); + + // Match the jets. + // Try to match the “npNLO” hardest jets created post-shower with any of the jets pre-shower. Two jets are matched if the distance between them is smaller than 1.5*DeltaR. + // If not all the npNLO hardest shower jets are matched the event has to be rejected. + // Note that if the current event does not belong to the maximum multiplicity sample, this means that all the shower jets need to be matched, because the requirement above already rejects + // events that do not have npNLO shower jets. + // For those events, at the level of the matrix elements there can either be npNLO or npNLO+1 matrix-element jets, depending on S- or H-events and the kinematics of those partons. + // Still only the shower jets need to be matched, so an event should not be rejected if a matrix-element jet cannot be matched. + // For each parton, starting with the hardest one ... + for(int ixx=0; ixx=0) { + jetToPartonMap[jetIndexForDRmin]=ixx; + if(ixx==0||etjet_[jetIndexForDRmin]id())==4||abs(partonsToMatch_[jxx]->id())==5)) continue; + if(partonJetDeltaR(partonsToMatch_[jxx],pjet_[ixx])id())==4||abs(partonsToMatch_[jxx]->id())==5)) continue; + if(partonJetDeltaR(partonsToMatch_[jxx],pjet_[ixx])etmin) return true; + } + } + } + + } + + + // Otherwise we accept the event ... + return false; + +} + +/* Function that returns the R distance + between a particle and a jet. */ +double FxFxHandler::partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom) const { + LorentzMomentum partonmom(partonptr->momentum()); + // Calculate DY, DPhi and then DR + double DY(partonmom.eta()-jetmom.eta()); + double DPhi(partonmom.phi()-jetmom.phi()); + if(DPhi>M_PI) DPhi=2*M_PI-DPhi; + double DR(sqrt(sqr(DY)+sqr(DPhi))); + return DR; +} + +double FxFxHandler::partonJetDeltaR(LorentzMomentum jetmom1, LorentzMomentum jetmom2) const { + // Calculate DY, DPhi and then DR + double DY(jetmom1.eta()-jetmom2.eta()); + double DPhi(jetmom1.phi()-jetmom2.phi()); + if(DPhi>M_PI) DPhi=2*M_PI-DPhi; + double DR(sqrt(sqr(DY)+sqr(DPhi))); + return DR; +} + +// Get FastJets +void FxFxHandler::getFastJets(double rjet, Energy ejcut, double etajcut) const { + + vector particlesToCluster; + for(unsigned int ipar=0; iparmomentum().eta()); + if(y>=ycmin_&&y<=ycmax_) { + int absId(abs(particlesToCluster_[ipar]->id())); + // If it's not a lepton / top / photon it may go in the jet finder. + if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { + // input particles into fastjet pseudojet + fastjet::PseudoJet p(particlesToCluster_[ipar]->momentum().x()/GeV, + particlesToCluster_[ipar]->momentum().y()/GeV, + particlesToCluster_[ipar]->momentum().z()/GeV, + particlesToCluster_[ipar]->momentum().e()/GeV); + p.set_user_index(ipar); + particlesToCluster.push_back(p); + } + } + } + + fastjet::RecombinationScheme recombinationScheme = fastjet::E_scheme; + fastjet::Strategy strategy = fastjet::Best; + double R(rjet); + fastjet::JetDefinition theJetDefinition; + switch (jetAlgorithm_) { + case -1: theJetDefinition=fastjet::JetDefinition(fastjet::antikt_algorithm, + R, + recombinationScheme, + strategy); break; + case 0: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, + R, + recombinationScheme, + strategy); break; + case 1: theJetDefinition=fastjet::JetDefinition(fastjet::kt_algorithm, + R, + recombinationScheme, + strategy); break; + default: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, + R, + recombinationScheme, + strategy); break; + } + fastjet::ClusterSequence fastjetEvent(particlesToCluster,theJetDefinition); + vector inclusiveJets = fastjetEvent.inclusive_jets(); + inclusiveJets = fastjet::sorted_by_pt(inclusiveJets); + + // Fill the array of jet momenta for the rest of the veto procedure. + pjet_.clear(); + pjet_.resize(inclusiveJets.size()); + etjet_.clear(); + etjet_.resize(inclusiveJets.size()); + for(unsigned int ffj=0; ffjetajcut) { + pjet_.erase(pjet_.begin()+fj); + etjet_.erase(etjet_.begin()+fj); + fj--; + } + + // Sort jets from high to low ET. + vector > etjet_pjet; + for(unsigned int ixx=0; ixx particlesToCluster; + for(unsigned int ipar=0; iparmomentum().eta()); + if(y>=ycmin_&&y<=ycmax_) { + int absId(abs(partonsToMatch_[ipar]->id())); + // If it's not a lepton / top / photon it may go in the jet finder. + if(!(absId>=11&&absId<=16) && absId!=6 && absId!=22) { + // input particles into fastjet pseudojet + fastjet::PseudoJet p(partonsToMatch_[ipar]->momentum().x()/GeV, + partonsToMatch_[ipar]->momentum().y()/GeV, + partonsToMatch_[ipar]->momentum().z()/GeV, + partonsToMatch_[ipar]->momentum().e()/GeV); + p.set_user_index(ipar); + particlesToCluster.push_back(p); + } + } + } + + fastjet::RecombinationScheme recombinationScheme = fastjet::E_scheme; + fastjet::Strategy strategy = fastjet::Best; + double R(rjet); + fastjet::JetDefinition theJetDefinition; + switch (jetAlgorithm_) { + case -1: theJetDefinition=fastjet::JetDefinition(fastjet::antikt_algorithm, + R, + recombinationScheme, + strategy); break; + case 0: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, + R, + recombinationScheme, + strategy); break; + case 1: theJetDefinition=fastjet::JetDefinition(fastjet::kt_algorithm, + R, + recombinationScheme, + strategy); break; + default: theJetDefinition=fastjet::JetDefinition(fastjet::cambridge_algorithm, + R, + recombinationScheme, + strategy); break; + } + fastjet::ClusterSequence fastjetEvent(particlesToCluster,theJetDefinition); + vector inclusiveJets = fastjetEvent.inclusive_jets(); + inclusiveJets = fastjet::sorted_by_pt(inclusiveJets); + + // Fill the array of jet momenta for the rest of the veto procedure. + pjetME_.clear(); + pjetME_.resize(inclusiveJets.size()); + for(unsigned int ffj=0; ffjchildren()); + for (unsigned int ixx=0; ixxchildren().size()==0) + tmpList_.push_back(theChildren[ixx]); + else + getDescendents(theChildren[ixx]); + return; +} + +void FxFxHandler::caldel_m() const { + + preshowerFSPsToDelete_.clear(); + showeredFSPsToDelete_.clear(); + + hvqfound = false; + + if(hpdetect_ && mergemode_!=2) { + for(unsigned int ixx=0; ixxparents()[0]->id())==6) { + hvqfound = true; + // cout << "preshowerFSPs_[ixx]->id() = " << preshowerFSPs_[ixx]->id() << " " << preshowerFSPs_[ixx]->momentum().perp2() << endl; + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]->parents()[0]); + for(unsigned int jxx=0; jxxid() = " << tmpList_[jxx]->id() << " " << tmpList_[jxx]->momentum().perp2() << endl; + showeredFSPsToDelete_.push_back(tmpList_[jxx]); + } + continue; + } + + /* Exclude the v.bosons and any children they may + have produced from the jet parton matching. */ + if( (abs(preshowerFSPs_[ixx]->parents()[0]->id())==23|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24|| + abs(preshowerFSPs_[ixx]->id())==22|| + abs(preshowerFSPs_[ixx]->id())==25|| (abs(preshowerFSPs_[ixx]->id()) < 17 && abs(preshowerFSPs_[ixx]->id()) > 10)) && (abs(preshowerFSPs_[ixx]->parents()[0]->id())!=6)) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==5&&ixx<2) { + hvqfound = true; + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxparents()[0]->id())==23|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==ihvy_&&ixx<2) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxparents()[0]->id())==23|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxparents()[0]->id())==23|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24|| + abs(preshowerFSPs_[ixx]->id())==22|| + abs(preshowerFSPs_[ixx]->id())==25) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxparents()[0]->id())==6|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + // cout << "preshowerFSPs_[ixx]->id() = " << preshowerFSPs_[ixx]->id() << " " << preshowerFSPs_[ixx]->momentum().perp2() << endl; + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + } + if(abs(preshowerFSPs_[ixx]->parents()[0]->id())==6) { + getDescendents(preshowerFSPs_[ixx]->parents()[0]); + for(unsigned int jxx=0; jxxid() = " << tmpList_[jxx]->id() << " " << tmpList_[jxx]->momentum().perp2() << endl; + showeredFSPsToDelete_.push_back(tmpList_[jxx]); + } + } + if(ixx==preshowerFSPs_.size()-1&&preshowerFSPsToDelete_.size()!=6) { + throw Exception() + << "FxFxHandler::caldel_m() - ERROR!\n" + << "2Q process should have 6 particles to omit from" + << "jet-parton matching for ihvy=" << ihvy_ << "." << Exception::eventerror; + } + } else { + if(abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx<2) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==4&&ixx<1)|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==22) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==25) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==22|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==22|| + (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+1)))|| + (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx==(preshowerFSPs_.size()-(2+nph_+2)))|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==22|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==6|| + abs(preshowerFSPs_[ixx]->parents()[0]->id())==24) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid())==22|| + (abs(preshowerFSPs_[ixx]->id())==ihvy_&&ixx<2)) { + preshowerFSPsToDelete_.push_back(preshowerFSPs_[ixx]); + getDescendents(preshowerFSPs_[ixx]); + for(unsigned int jxx=0; jxxid() << " with parent " << preshowerFSPsToDelete_[ixx]->parents()[0]->id() << endl; // " energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; + partonsToMatch_.erase(partonsToMatch_.begin()+jxx); + break; + } + } + } + //cout << "partonsToMatch_.size() (AFTER) = " << partonsToMatch_.size() << endl; + //cout << "deleting showeredFSPs" << endl; + for(unsigned int ixx=0; ixxid() << " with parent " << showeredFSPsToDelete_[ixx]->parents()[0]->id() << endl; //" energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; + particlesToCluster_.erase(particlesToCluster_.begin()+jxx); + break; + } + } + } + + // Sanity check! + if(partonsToMatch_.size()>particlesToCluster_.size()) { + throw Exception() + << "FxFxHandler::caldel_m() - ERROR!\n" + << "No. of ME level partons to be matched to jets = " + << partonsToMatch_.size() << "\n" + << "No. of showered particles to build jets from = " + << particlesToCluster_.size() << "\n" + << "There should be at least as many partons to\n" + << "cluster as there are partons to match to.\n" + << Exception::eventerror; + } + // cout << "partonsToMatch_.size() (AFTER2) = " << partonsToMatch_.size() << endl; + + + // Acid test. + /* unsigned int tmpUnsignedInt(njets_); + if(!inputIsNLO_&&partonsToMatch_.size()!=tmpUnsignedInt) { + for(unsigned int ixx=0; ixxid())>=6&& + abs(partonsToMatch_[ixx]->id())!=21) + throw Exception() + << "FxFxHandler::caldel_m() - ERROR!\n" + << "Found a parton to match to which is not a quark or gluon!" + << *partonsToMatch_[ixx] << "\n" + << Exception::eventerror; + } + throw Exception() + << "FxFxHandler::caldel_m() - ERROR!\n" + << "No. of ME level partons to be matched to jets = " + << partonsToMatch_.size() << "\n" + << "No. of light jets (njets) in AlpGen process = " + << njets_ << "\n" + << "These should be equal." << "\n" + << Exception::eventerror; + } */ + //cout << "partonsToMatch_.size() (AFTER3) = " << partonsToMatch_.size() << endl; + + return; +} + +// This looks for all descendents of a top up to but not including +// the W and b children. +void FxFxHandler::getTopRadiation(PPtr theParticle) const { + ParticleVector theChildren(theParticle->children()); + for (unsigned int ixx=0; ixxchildren().size()==0) + tmpList_.push_back(theChildren[ixx]); + else if(abs(theChildren[ixx]->id())==5||abs(theChildren[ixx]->id())==24) + return; + else + getTopRadiation(theChildren[ixx]); + return; +} + +void FxFxHandler::caldel_mg() const { + + preshowerFSPsToDelete_.clear(); + showeredFSPsToDelete_.clear(); + /* + * Get the MadGraph clustering information + * from the Les Houches event tags + */ + ptclust_.clear(); + getptclust(); + + //for(unsigned int izz = 0; izzid() << endl; + partonsToMatch_.erase(partonsToMatch_.begin()+jxx); + break; + } + } + } + + for(unsigned int ixx=0; ixxid() << " with parent " << showeredFSPsToDelete_[ixx]->parents()[0]->id() << endl; //" energy = " << preshowerFSPsToDelete_[ixx]->momentum().e()*GeV << endl; + particlesToCluster_.erase(particlesToCluster_.begin()+jxx); + break; + } + } + } + + // Sanity check! + if(partonsToMatch_.size()>particlesToCluster_.size()) { + throw Exception() + << "FxFxHandler::caldel_m() - ERROR!\n" + << "No. of ME level partons to be matched to jets = " + << partonsToMatch_.size() << "\n" + << "No. of showered particles to build jets from = " + << particlesToCluster_.size() << "\n" + << "There should be at least as many partons to\n" + << "cluster as there are partons to match to.\n" + << Exception::eventerror; + } + + + +} + + +void FxFxHandler::caldel_hvq() const { + + // Fill partonsToMatch_ with only those pre-shower partons intended to + // be used in heavy-quark-jet matching and fill particlesToCluster_ using + // only those final state particles (post-shower) which are supposed + // in the heavy-quark-jet clustering used to do merging. To begin with + // these are made from the corresponding sets of particles that were + // omitted from the initial jet-parton matching run. + partonsToMatch_ = preshowerFSPsToDelete_; + particlesToCluster_.resize(showeredFSPsToDelete_.size()); + for(unsigned int ixx=0; ixxid())<4||abs(partonsToMatch_[ixx]->id())>6) { + preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); + tmpList_.clear(); + getDescendents(partonsToMatch_[ixx]); + for(unsigned int jxx=0; jxxid())==5&& + partonsToMatch_[ixx]->parents().size()>0&& + abs(partonsToMatch_[ixx]->parents()[0]->id())==6) { + preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); + tmpList_.clear(); + getDescendents(partonsToMatch_[ixx]); + for(unsigned int jxx=0; jxxparents().size()>0&& + (abs(partonsToMatch_[ixx]->parents()[0]->id())==23|| + abs(partonsToMatch_[ixx]->parents()[0]->id())==24|| + abs(partonsToMatch_[ixx]->parents()[0]->id())==25)) { + preshowerFSPsToDelete_.push_back(partonsToMatch_[ixx]); + tmpList_.clear(); + getDescendents(partonsToMatch_[ixx]); + for(unsigned int jxx=0; jxxsubProcess()->intermediates()); + for(unsigned int ixx=0; ixxid())==6) { + partonsToMatch_.push_back(intermediates[ixx]); + tmpList_.clear(); + getTopRadiation(partonsToMatch_.back()); + for(unsigned int jxx=0; jxxid())>=4&&abs(partonsToMatch_[ixx]->id())<=6) { + theProgenitor = partonsToMatch_[ixx]; + // Follow the heavy quark line down to where it stops branching. + while(theProgenitor->children().size()>0) { + theLastProgenitor = theProgenitor; + for(unsigned int jxx=0; jxxchildren().size(); jxx++) { + if(theProgenitor->children()[jxx]->id()==theProgenitor->id()) + theProgenitor=theProgenitor->children()[jxx]; + } + // If the progenitor had children but none of them had + // the same particle id as it, then it must have undergone + // a decay rather than a branching, i.e. it is the end of + // the evolution line, so, + if(theProgenitor==theLastProgenitor) break; + } + evolvedHeavyQuarks.push_back(theProgenitor); + } + } + // Now delete the evolved heavy quark from the particlesToCluster. + for(unsigned int ixx=0; ixx optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); + // loop over the optional weights and find np values + for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ + // split the line + boost::split( SplitVec, it->first, boost::is_any_of(" ") ); + // if np is found, store the information + if(SplitVec[0] == "np") { + npLO_ = atof(SplitVec[1].c_str()); + npNLO_ = atof(SplitVec[2].c_str()); + } + } + return; +} + +// get hadron COM energy +void FxFxHandler::getECOM() const { + split_vector_type SplitVec; + // pull the optional weights from the current event + map optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); + // loop over the optional weights and find np values + for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ + // split the line + boost::split( SplitVec, it->first, boost::is_any_of(" ") ); + // if np is found, store the information + if(SplitVec[0] == "ecom") { + ECOM_ = it->second; + } + } + return; +} + + +// get pt_clust information +void FxFxHandler::getptclust() const { + split_vector_type SplitVec; + // pull the optional weights from the current event + map optionalEventWeights = eventHandler()->currentEvent()->optionalWeights(); + // loop over the optional weights and find np values + string str_eq = "="; + string str_quote = "\""; + int countptc_(0); + for (map::const_iterator it=optionalEventWeights.begin(); it!=optionalEventWeights.end(); ++it){ + // split the line + double wgtid = it->second; + //cout << "wgtdid = " << wgtid << endl; + if(wgtid == -333) { + // cout << "it->first for -333 = " << it->first << endl; + boost::split( SplitVec, it->first, boost::is_any_of(" ") ); + // if np is found, store the information + double ptclust(0.); + string stringtohandle(""); + for(unsigned int i_ = 0; i_ < SplitVec.size(); ++i_) { + if(SplitVec[i_].find("pt_clust_") != std::string::npos) { + //cout << "pt_clust_ found in " << SplitVec[i_] << endl; + countptc_++; + // cout << "SplitVec[i_] = " << SplitVec[i_] << endl; + stringtohandle = SplitVec[i_]; + stringtohandle.erase(0,10); + erase_substr(stringtohandle,str_eq); + erase_substr(stringtohandle,str_quote); + // cout << "stringtohandle = " << stringtohandle << endl; + ptclust = atof(stringtohandle.c_str()); + ptclust_.push_back(ptclust); + } + } + } + } + return; +} + +void FxFxHandler::getPreshowerParticles() const { + // LH file initial-state partons: + preshowerISPs_ = lastXCombPtr()->subProcess()->incoming(); + // LH file final-state partICLEs: + preshowerFSPs_ = lastXCombPtr()->subProcess()->outgoing(); + return; +} + +void FxFxHandler::getShoweredParticles() const { + // Post-shower initial-state hadrons: + showeredISHs_ = eventHandler()->currentEvent()->incoming(); + + // Post-shower initial-state partons: + for(unsigned int ixx=0; ixx<(showeredISHs_.first)->children().size(); ixx++) + if(((showeredISHs_.first)->children()[ixx]->id())<6|| + ((showeredISHs_.first)->children()[ixx]->id())==21) + showeredISPs_.first=(showeredISHs_.first)->children()[ixx]; + for(unsigned int ixx=0; ixx<(showeredISHs_.second)->children().size(); ixx++) + if(((showeredISHs_.second)->children()[ixx]->id())<6|| + ((showeredISHs_.second)->children()[ixx]->id())==21) + showeredISPs_.second=(showeredISHs_.second)->children()[ixx]; + + // Post-shower final-state partICLEs plus remnants (to be removed later): + showeredFSPs_ = eventHandler()->currentEvent()->getFinalState(); + + // Post-shower final-state remnants: + for(unsigned int ixx=0; ixxPDGName()=="Rem:p+"|| + showeredFSPs_[ixx]->PDGName()=="Rem:pbar-") { + if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== + showeredISHs_.first) + showeredRems_.first=showeredFSPs_[ixx]; + else if(showeredFSPs_[ixx]->parents()[0]->parents()[0]== + showeredISHs_.second) + showeredRems_.second=showeredFSPs_[ixx]; + } + } + + // Now delete found remnants from the showeredFSPs vector for consistency. + for(unsigned int ixx=0; ixxPDGName()=="Rem:p+") + showeredFSPs_.erase(showeredFSPs_.begin()+ixx); + for(unsigned int ixx=0; ixxPDGName()=="Rem:pbar-") + showeredFSPs_.erase(showeredFSPs_.begin()+ixx); + sort(showeredFSPs_.begin(),showeredFSPs_.end(),recordEntry); + + return; +} + +void FxFxHandler::doSanityChecks(int debugLevel) const { + + // When checking momentum conservation in the form + // p_in - p_out, any momentum component bigger / less + // than + / - epsilon will result in the p_in - p_out + // vector being flagged as "non-null", triggering a + // warning that momentum conservation is violated. + Energy epsilon(0.5*GeV); + if(debugLevel>=5) epsilon=1e-9*GeV; + + // Print out what was found for the incoming and outgoing + // partons in the lastXCombPtr regardless. + if(debugLevel>=5) { + cout << "\n\n\n\n"; + cout << "****************************************************" << endl; + cout << " The following are the hard subprocess momenta from " << "\n" + << " lastXCombPtr and should be basically identical to " << "\n" + << " the input LH file momenta." << "\n\n"; + cout << " Incoming particles:" << "\n" + << *(preshowerISPs_.first) << "\n" + << *(preshowerISPs_.second) << endl; + cout << " Outgoing particles:" << endl; + for(unsigned int ixx=0; ixx=5) { + cout << "\n\n"; + cout << "****************************************************" << endl; + cout << " The following are the particles left at the end of" << "\n" + << " the showering step." << "\n\n"; + cout << " Incoming hadrons:" << "\n" + << *(showeredISHs_.first) << "\n" + << *(showeredISHs_.second) << endl; + cout << " Incoming partons:" << "\n" + << *(showeredISPs_.first) << "\n" + << *(showeredISPs_.second) << endl; + cout << " Outgoing partons:" << endl; + for(unsigned int ixx=0; ixx=4) { + Lorentz5Momentum tmpMom; + tmpMom += showeredISPs_.first->momentum(); + tmpMom += showeredISPs_.second->momentum(); + for(unsigned int ixx=0; ixxmomentum(); + if(!isMomLessThanEpsilon(tmpMom,epsilon)) + cout << "Total parton mom.in - total parton mom.out = " + << tmpMom/GeV << endl; + tmpMom = showeredISHs_.first->momentum() + - showeredRems_.first->momentum() -showeredISPs_.first->momentum(); + if(!isMomLessThanEpsilon(tmpMom,epsilon)) + cout << "First p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; + tmpMom = showeredISHs_.second->momentum() + - showeredRems_.second->momentum()-showeredISPs_.second->momentum(); + if(!isMomLessThanEpsilon(tmpMom,epsilon)) + cout << "Second p_hadron-p_remnant-p_incoming " << tmpMom/GeV << endl; + } + + // Check if what we found to be the remnant is consistent with + // what we identified as the parent incoming hadron i.e. p+ + // goes with Rem:p+ and pbar- goes with Rem:pbar-. + if(debugLevel>=0) { + string tmpString; + tmpString=showeredRems_.first->PDGName(); + tmpString=tmpString.substr(tmpString.find_first_of(":")+1, + string::npos); + if(showeredISHs_.first->PDGName()!=tmpString) { + cout << "FxFxHandler::showerHardProcessVeto" << "\n" + << "Fatal error in pairing of remnant and parent hadron." << "\n" + << "Remnant = " << *(showeredRems_.first) << "\n" + << "Parent hadron = " << *(showeredISHs_.first) + << endl; + cout << showeredISHs_.first->PDGName() << endl; + cout << tmpString << endl; + } + tmpString=showeredRems_.second->PDGName(); + tmpString=tmpString.substr(tmpString.find_first_of(":")+1, + string::npos); + if(showeredISHs_.second->PDGName()!=tmpString) { + cout << "FxFxHandler::showerHardProcessVeto" << "\n" + << "Fatal error in pairing of remnant and parent hadron." << "\n" + << "Remnant = " << *(showeredRems_.second) << "\n" + << "Parent hadron = " << *(showeredISHs_.second) + << endl; + cout << showeredISHs_.second->PDGName() << endl; + cout << tmpString << endl; + } + } + return; +} + +void FxFxHandler::printMomVec(vector momVec) { + cout << "\n\n"; + + // Label columns. + printf("%5s %9s %9s %9s %9s %9s %9s %9s %9s %9s\n", + "jet #", + "px","py","pz","E", + "eta","phi","pt","et","mass"); + + // Print out the details for each jet + for (unsigned int ixx=0; ixx split_vector_type; + +/** + * Here is the documentation of the FxFxHandler class. + * + * @see \ref FxFxHandlerInterfaces "The interfaces" + * defined for FxFxHandler. + */ +class FxFxHandler: public QTildeShowerHandler { + + /** + * FxFxHandler should have access to our private parts. + */ + friend class FxFxEventHandler; + + friend class FxFxReader; + + +public: + + /** + * The default constructor. + */ + FxFxHandler(); + +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. */ + //@{ + /** + * Finalize the object + */ + virtual void dofinish(); + + /** + * 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(); + //@} + +public: + /** + * Hook to allow vetoing of event after showering hard sub-process + * as in e.g. MLM merging. + */ + virtual bool showerHardProcessVeto() const; + + /** + * information for FxFx merging + */ + mutable int npLO_; + mutable int npNLO_; + + /** + * information for tree-level merging + */ + mutable vector ptclust_; + +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: + + /* + * whether a heavy quark has been found in the merging + */ + mutable bool hvqfound = false; + + /* + * Run MLM jet-parton matching on the 'extra' jets. + */ + bool lightJetPartonVeto(); + + /* + * Function that calculates deltaR between a parton and a jet + */ + double partonJetDeltaR(ThePEG::tPPtr partonptr, LorentzMomentum jetmom) const; + + + /* + * Function that calculates deltaR between two jets + */ + double partonJetDeltaR(LorentzMomentum jetmom1, LorentzMomentum jetmom2) const; + + /** + * Find jets using the FastJet package on particlesToCluster_. + */ + void getFastJets(double rjet, Energy ejcut, double etajcut) const; + + /** + * Find jets using the FastJet package on particlesToCluster_. + */ + void getFastJetsToMatch(double rjet) const; + + /** + * Deletes particles from partonsToMatch_ and particlesToCluster_ + * vectors so that these contain only the partons to match to the + * jets and the particles used to build jets respectively. By and + * large the candidates for deletion are: vector bosons and their + * decay products, Higgs bosons, photons as well as _primary_, i.e. + * present in the lowest multiplicity process, heavy quarks and + * any related decay products. + */ + void caldel_m() const; + + /** + * Deletes particles from partonsToMatch_ and particlesToCluster_ + * vectors so that these contain only the partons to match to the + * jets and the particles used to build jets respectively. The candidates + * are chosen according to the information passed from madgraph. + */ + void caldel_mg() const; + + /** + * c++ translation of subroutine of same name from alpsho.f. + * Label all particles with status between ISTLO and ISTHI + * (until a particle with status ISTOP is found) as final-state, + * call calsim_m and then put labels back to normal. This + * version keeps only all IST=1 particles rejected by caldel as + * daughters of vetoed heavy-quark mothers: jets complementary + * to those reconstructed by caldel. + */ + void caldel_hvq() const; + + /** + * get the MG5_aMC information required for FxFx merging + */ + void getnpFxFx() const; + + /** + * get the MG5_aMC information required for FxFx merging + */ + void getECOM() const; + + + /** + * get the MG5_aMC information required for tree-level merging + */ + void getptclust() const; + + /** + * Erases all occurences of a substring from a string + */ + + void erase_substr(std::string& subject, const std::string& search) const; + + + /** + * Get the particles from lastXCombPtr filling the pair + * preshowerISPs_ and particle pointer vector preshowerFSPs_. + */ + void getPreshowerParticles() const; + + /** + * Get the particles from eventHandler()->currentEvent()->... + * filling the particle pairs showeredISHs_, showeredISPs_, + * showeredRems_ and the particle pointer vector showeredFSPs_. + */ + void getShoweredParticles() const; + + /** + * Allows printing of debug output and sanity checks like + * total momentum consrvation to be carried out. + * debugLevel = -1, 0, ...5 + * = no debugging, minimal debugging, ... verbose. + */ + void doSanityChecks(int debugLevel) const; + + /** + * Given a pointer to a particle this finds all its final state + * descendents. + */ + void getDescendents(PPtr theParticle) const; + + /** + * Accumulates all descendents of tops down to the b and W + * but not including them. + */ + void getTopRadiation(PPtr theParticle) const; + + /** + * Sorts a given vector of particles by descending pT or ETJET + */ + + ParticleVector pTsort(ParticleVector unsortedVec); + pair< vector, vector > ETsort(vector unsortedetjet, vector unsortedVec); + + /* + * A function that prints a vector of Lorentz5Momenta in a fancy way + */ + void printMomVec(vector momVec); + + + /* + * A probability function for varying etclus_ about the mean value + */ + Energy etclusran_(double petc) const; + +private: + + /** + * The static object used to initialize the description of this class. + * Indicates that this is a concrete class with persistent data. + */ + static ClassDescription initFxFxHandler; + + /** + * The assignment operator is private and must never be called. + * In fact, it should not even be implemented. + */ + FxFxHandler & operator=(const FxFxHandler &) = delete; + +private: + + + /** + * Initial-state incoming partons prior to showering + * (i.e. from lastXCombPtr). + */ + mutable PPair preshowerISPs_; + + /** + * Final-state outgoing partICLEs prior to showering + * (i.e. from lastXCombPtr). + */ + mutable ParticleVector preshowerFSPs_; + + /** + * Final-state outgoing partICLEs prior to showering _to_be_removed_ + * from preShowerFSPs_ prior to the light-parton-light-jet matching + * step. This same list is the starting point for determining + * partonsToMatch_ for the case of merging in heavy quark production. + */ + mutable ParticleVector preshowerFSPsToDelete_; + + /** + * Initial-state incoming hadrons after shower of hard process + * (eventHandler()->currentEvent()->incoming()). + */ + mutable PPair showeredISHs_; + + /** + * Initial-state incoming partons after shower of hard process + * (look for partonic children of showeredISHs_). + */ + mutable PPair showeredISPs_; + + /** + * Final-state outgoing partICLEs after shower of hard process + * (eventHandler()->currentEvent()->getFinalState()). + */ + mutable tPVector showeredFSPs_; + + /** + * Final-state outgoing partICLEs after shower of hard process + * _to_be_removed_ from showeredFSPs_ prior to the + * light-parton-light-jet matching step. This same list is the + * starting point for determining particlesToCluster_ for the + * case of merging in heavy quark production. + */ + mutable ParticleVector showeredFSPsToDelete_; + + /** + * ONLY the final-state partons from preshowerFSPs_ that are + * supposed to enter the jet-parton matching. + */ + mutable ParticleVector partonsToMatch_; + + /* + * The shower progenitors + */ + + mutable PPtr theProgenitor; + mutable PPtr theLastProgenitor; + + /** + * ONLY the final-state particles from showeredFSPs_ (and maybe + * also showeredRems_) that are supposed to go for jet clustering. + */ + mutable tPVector particlesToCluster_; + + /** + * Final-state remnants after shower of hard process + * (look for remnants initially in showeredFSPs_). + */ + mutable PPair showeredRems_; + + /** + * the COM of the incoming hadrons + */ + + mutable double ECOM_; + + /** + * Pointer to the object calculating the strong coupling + */ + ShowerAlphaPtr alphaS_; + + /** + * Information extracted from the XComb object + */ + //@{ + /** + * The fixed factorization scale used in the MEs. + */ + Energy pdfScale_; + + /** + * Centre of mass energy + */ + Energy2 sHat_; + + /** + * Constant alphaS used to generate LH events - if not already + * using CKKW scale (ickkw = 1 in AlpGen for example). + */ + double alphaSME_; + //@} + + /* + * Number of rapidity segments of the calorimeter. + */ + unsigned int ncy_; + + /* + * Number of phi segments of the calorimeter. + */ + unsigned int ncphi_; + + /* + * Heavy flavour in WQQ,ZQQ,2Q etc (4=c, 5=b, 6=t). + */ + int ihvy_; + + /* + * Number of photons in the AlpGen process. + */ + int nph_; + + /* + * Number of higgses in the AlpGen process. + */ + int nh_; + + /* + * Jet ET cut to apply in jet clustering (in merging). + */ + mutable Energy etclus_; + + + + /* + * The merging mode (FxFx vs tree-level) used. + */ + int mergemode_; + + + + /* + * Allows the vetoing on heavy quark decay products to be turned off. + */ + bool vetoHeavyQ_; + + /* + * Allows vetoing of heavy flavour + */ + + bool vetoHeavyFlavour_; + + + /* + * Mean Jet ET cut to apply in jet clustering (in merging). + */ + Energy etclusmean_; + + + /* + * The jet algorithm used for parton-jet matching in the MLM procedure. + */ + int jetAlgorithm_; + + /* + * Allows the vetoing to be turned off completely - just for convenience. + */ + bool vetoIsTurnedOff_; + + /* + * Veto if there exist softer unmatched jets than matched + */ + + bool vetoSoftThanMatched_; + + /* + * This flags whether the etclus_ (merging scale) should be fixed or variable according to a prob. distribution around the mean + */ + bool etclusfixed_; + + + + /* + * maximum deviation from mean Jet ET cut to apply in jet clustering (in merging). + */ + Energy epsetclus_; + + + + /* + * Cone size used in jet clustering (in merging). + */ + double rclus_; + + /* + * Max |eta| for jets in clustering (in merging). + */ + double etaclmax_; + + /* + * Default 1.5 factor used to decide if a jet matches a parton + * in merging: if DR(parton,jet) ncphi). + * ==> Cosine goes from +1 ---> +1 (index = 0 ---> ncphi). + */ + vector cphcal_; + + /* + * Sine of phi values of calorimeter cell centres. + * Goes phi~=0 to phi~=2*pi (index = 0 ---> ncphi). + * ==> Sine goes 0 -> 1 -> 0 -> -1 -> 0 (index = 0 ---> ncphi). + */ + vector sphcal_; + + /* + * Cosine of theta values of calorimeter cell centres in Y. + * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). + * ==> Cosine goes from -1 ---> +1 (index = 0 ---> ncy). + */ + vector cthcal_; + + /* + * Sine of theta values of calorimeter cell centres in Y. + * Goes bwds th~=pi to fwds th~=0 (index = 0 ---> ncy). + * ==> Sine goes from 0 ---> +1 ---> 0 (index = 0 ---> ncy). + */ + vector sthcal_; + + /* + * Transverse energy deposit in a given calorimeter cell. + * First array index corresponds to rapidity index of cell, + * second array index corresponds to phi cell index. + */ + vector > et_; + + /* + * For a given calorimeter cell this holds the index of the jet + * that the cell was clustered into. + */ + vector > jetIdx_; + + /* + * Vector holding the Lorentz 5 momenta of each jet. + */ + mutable vector pjet_; + + /* + * Vector holding the Lorentz 5 momenta of each jet from ME partons + */ + mutable vector pjetME_; + + + /* + * Vector holding the list of FS particles resulting from + * the particle input to getDescendents. + */ + mutable ParticleVector tmpList_; + + /* + * Variables for the C++ translation of the calini_m(), calsim_m(), + * getjet_m(...) and caldel_m() functions + */ + mutable vector etjet_; + vector etjetME_; + mutable double dely_, delphi_; + +}; + +} + +#include "ThePEG/Utilities/ClassTraits.h" + +namespace ThePEG { + +/** @cond TRAITSPECIALIZATIONS */ + +/** This template specialization informs ThePEG about the + * base classes of FxFxHandler. */ +template <> +struct BaseClassTrait { + /** Typedef of the first base class of FxFxHandler. */ + typedef Herwig::QTildeShowerHandler NthBase; +}; + +/** This template specialization informs ThePEG about the name of + * the FxFxHandler class and the shared object where it is defined. */ +template <> +struct ClassTraits + : public ClassTraitsBase { + /** Return a platform-independent class name */ + static string className() { return "Herwig::FxFxHandler"; } + /** + * The name of a file containing the dynamic library where the class + * FxFxHandler is implemented. It may also include several, space-separated, + * libraries if the class FxFxHandler 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 "HwFxFxHandler.so"; } +}; + +/** @endcond */ + +} + +#endif /* HERWIG_FxFxHandler_H */ diff --git a/Contrib/FxFx/FxFxReader.cc b/MatrixElement/FxFx/FxFxReader.cc rename from Contrib/FxFx/FxFxReader.cc rename to MatrixElement/FxFx/FxFxReader.cc diff --git a/Contrib/FxFx/FxFxReader.fh b/MatrixElement/FxFx/FxFxReader.fh rename from Contrib/FxFx/FxFxReader.fh rename to MatrixElement/FxFx/FxFxReader.fh diff --git a/MatrixElement/FxFx/FxFxReader.h b/MatrixElement/FxFx/FxFxReader.h new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/FxFxReader.h @@ -0,0 +1,1006 @@ +// -*- C++ -*- +// +// FxFxReader.h is a part of ThePEG - Toolkit for HEP Event Generation +// Copyright (C) 1999-2011 Leif Lonnblad +// +// ThePEG is licenced under version 3 of the GPL, see COPYING for details. +// Please respect the MCnet academic guidelines, see GUIDELINES for details. +// +#ifndef THEPEG_FxFxReader_H +#define THEPEG_FxFxReader_H +// This is the declaration of the FxFxReader class. + +#include "FxFx.h" +#include "ThePEG/Handlers/HandlerBase.h" +#include "ThePEG/Utilities/ObjectIndexer.h" +#include "ThePEG/Utilities/Exception.h" +#include "ThePEG/Utilities/XSecStat.h" +#include "ThePEG/PDF/PartonBinInstance.h" +#include "ThePEG/PDF/PartonBin.fh" +#include "ThePEG/MatrixElement/ReweightBase.h" +#include "FxFxEventHandler.fh" +#include "FxFxReader.fh" +#include "ThePEG/Utilities/CFile.h" +#include +#include + +namespace ThePEG { + +/** + * FxFxReader is an abstract base class to be used for objects + * which reads event files or streams from matrix element + * generators. Derived classes must at least implement the open() and + * doReadEvent() methods to read in information about the whole run into + * the HEPRUP variable and next event into the HEPEUP variable + * respectively. Also the close() function to close the file or stream + * read must be implemented. Although these functions are named as if + * we are reading from event files, they could just as well implement + * the actual generation of events. + * + * After filling the HEPRUP and HEPEUP variables, which are protected + * and easily accesible from the sub-class, this base class will then + * be responsible for transforming this data to the ThePEG Event + * record in the getEvent() method. FxFxReaders can + * only be used inside FxFxEventHandler objects. + * + * In the initialization the virtual open() and scan() functions are + * called. Here the derived class must provide the information about + * the processes in the variables corresponding to the HEPRUP common + * block. Note that the IDWTUP is required to be +/- 1, and sub + * classes are required to change the information accordingly to + * ensure the correct corss section sampling. Note also that the + * controlling FxFxEventHandler may choose to generate weighted + * events even if IDWTUP is 1. + * + * Note that the information given per process in e.g. the XSECUP and + * XMAXUP vectors is not used by the FxFxEventHandler and by + * default the FxFxReader is not assumed to be able to actively + * choose between the sub-processes. Instead, the + * FxFxEventHandler can handle several FxFxReader objects + * and choose between them. However, a sub-class of FxFxReader + * may set the flag isActive, in which case it is assumed to be able + * to select between its sub-processes itself. + * + * The FxFxReader may be assigned a number ReweightBase objects + * which either completely reweights the events produced (in the + * reweights vector), or only biases the selection without influencing + * the cross section (in the preweights vector). Note that it is the + * responsibility of a sub-class to call the reweight() function and + * multiply the weight according to its return value (typically done + * in the readEvent() function). + * + * @see \ref FxFxReaderInterfaces "The interfaces" + * defined for FxFxReader. + * @see Event + * @see FxFxEventHandler + */ +class FxFxReader: public HandlerBase, public LastXCombInfo<> { + + /** + * FxFxEventHandler should have access to our private parts. + */ + friend class FxFxEventHandler; + + /** + * Map for accumulating statistics of cross sections per process + * number. + */ + typedef map StatMap; + + /** + * Map of XComb objects describing the incoming partons indexed by + * the corresponding PartonBin pair. + */ + typedef map XCombMap; + + /** + * A vector of pointers to ReweightBase objects. + */ + typedef vector ReweightVector; + +public: + + /** @name Standard constructors and destructors. */ + //@{ + /** + * Default constructor. If the optional argument is true, the reader + * is assumed to be able to produce events on demand for a given + * process. + */ + FxFxReader(bool active = false); + + /** + * Copy-constructor. + */ + FxFxReader(const FxFxReader &); + + /** + * Destructor. + */ + virtual ~FxFxReader(); + //@} + +public: + + /** @name Main virtual fuctions to be overridden in + * sub-classes. They are named as if we are reading from event + * files, but could equally well implement the actual generation of + * events. */ + //@{ + /** + * Open a file or stream with events and read in the run information + * into the heprup variable. + */ + virtual void open() = 0; + + /** + * Read the next event from the file or stream into the + * corresponding protected variables. Return false if there is no + * more events. + */ + virtual bool doReadEvent() = 0; + + /** + * Close the file or stream from which events have been read. + */ + virtual void close() = 0; + + /** + * return the weight names + */ + // virtual vector optWeightsNamesFunc(); + virtual vector optWeightsNamesFunc() = 0; + //virtual vector optWeightNamesFunc() = 0; + vector optionalWeightsNames; + + /** + * The ID (e.g. 100x, 2001) for the weight + */ + + // vector optionalWeightsNames; + + + //@} + + /** @name Other important function which may be overridden in + * sub-classes which wants to bypass the basic HEPRUP or HEPEUP + * variables or otherwise facilitate the conversion to ThePEG + * objects. */ + //@{ + /** + * Initialize. This function is called by the FxFxEventHandler + * to which this object is assigned. + */ + virtual void initialize(FxFxEventHandler & eh); + + /** + * Calls readEvent() or uncacheEvent() to read information into the + * FxFx common block variables. This function is called by the + * FxFxEventHandler if this reader has been selectod to + * produce an event. + * + * @return the weight asociated with this event. If negative weights + * are allowed it should be between -1 and 1, otherwise between 0 + * and 1. If outside these limits the previously estimated maximum + * is violated. Note that the estimated maximum then should be + * updated from the outside. + */ + virtual double getEvent(); + + /** + * Calls doReadEvent() and performs pre-defined reweightings. A + * sub-class overrides this function it must make sure that the + * corresponding reweightings are done. + */ + virtual bool readEvent(); + + /** + * Skip \a n events. Used by FxFxEventHandler to make sure + * that a file is scanned an even number of times in case the events + * are not ramdomly distributed in the file. + */ + virtual void skip(long n); + + /** + * Get an XComb object. Converts the information in the Les Houches + * common block variables to an XComb object describing the sub + * process. This is the way information is conveyed from the reader + * to the controlling FxFxEventHandler. + */ + tXCombPtr getXComb(); + + /** + * Get a SubProcess object corresponding to the information in the + * Les Houches common block variables. + */ + tSubProPtr getSubProcess(); + + /** + * Scan the file or stream to obtain information about cross section + * weights and particles etc. This function should fill the + * variables corresponding to the /HEPRUP/ common block. The + * function returns the number of events scanned. + */ + virtual long scan(); + + /** + * Take the information corresponding to the HEPRUP common block and + * initialize the statistics for this reader. + */ + virtual void initStat(); + + /** + * Reweights the current event using the reweights and preweights + * vectors. It is the responsibility of the sub-class to call this + * function after the HEPEUP information has been retrieved. + */ + double reweight(); + + /** + * Converts the information in the Les Houches common block + * variables into a Particle objects. + */ + virtual void fillEvent(); + + /** + * Removes the particles created in the last generated event, + * preparing to produce a new one. + */ + void reset(); + + /** + * Possibility for subclasses to recover from non-conformant + * settings of XMAXUP when an event file has been scanned with \a + * neve events. Should set weightScale so that the average XMAXUP + * times weightScale gives the cross section for a process. (This is + * needed for MadEvent). + */ + virtual void setWeightScale(long neve); + + //@} + + /** @name Access information about the current event. */ + //@{ + + /** + * Return the size of this event in bytes. To be used for the cache + * file. \a npart is the number of particles. If \a npart is 0, the + * number is taken from NUP. + */ + static size_t eventSize(int N) { + return (N + 1)*sizeof(int) + // IDPRUP, ISTUP + (7*N + 4)*sizeof(double) + // XWGTUP, SCALUP, AQEDUP, AQCDUP, PUP, + // VTIMUP, SPINUP + N*sizeof(long) + // IDUP + 2*N*sizeof(pair) + // MOTHUP, ICOLUP + sizeof(pair) + // XPDWUP. + 2*sizeof(double); // lastweight and preweight + } + + /** + * The current event weight given by XWGTUP times possible + * reweighting. Note that this is not necessarily the same as what + * is returned by getEvent(), which is scaled with the maximum + * weight. + */ + double eventWeight() const { return hepeup.XWGTUP*lastweight; } + + /** + * Return the optional named weights associated to the current event. + */ + const map& optionalEventWeights() const { return optionalWeights; } + + /** + * Return the optional npLO and npNLO + */ + const int& optionalEventnpLO() const { return optionalnpLO; } + const int& optionalEventnpNLO() const { return optionalnpNLO; } + + /** + * The pair of PartonBinInstance objects describing the current + * incoming partons in the event. + */ + const PBIPair & partonBinInstances() const { return thePartonBinInstances; } + /** + * Return the instances of the beam particles for the current event. + */ + const PPair & beams() const { return theBeams; } + /** + * Return the instances of the incoming particles to the sub process + * for the current event. + */ + const PPair & incoming() const { return theIncoming; } + /** + * Return the instances of the outgoing particles from the sub process + * for the current event. + */ + const PVector & outgoing() const { return theOutgoing; } + /** + * Return the instances of the intermediate particles in the sub + * process for the current event. + */ + const PVector & intermediates() const { return theIntermediates; } + /** + * If this reader is to be used (possibly together with others) for + * CKKW reweighting and veto, this should give the multiplicity of + * outgoing particles in the highest multiplicity matrix element in + * the group. + */ + int maxMultCKKW() const { return theMaxMultCKKW; } + /** + * If this reader is to be used (possibly together with others) for + * CKKW reweighting and veto, this should give the multiplicity of + * outgoing particles in the lowest multiplicity matrix element in + * the group. + */ + int minMultCKKW() const { return theMinMultCKKW; } //@} + + /** @name Other inlined access functions. */ + //@{ + /** + * The number of events found in this reader. If less than zero the + * number of events are unlimited. + */ + long NEvents() const { return theNEvents; } + + /** + * The number of events produced so far. Is reset to zero if an + * event file is reopened. + */ + long currentPosition() const { return position; } + + /** + * The maximum number of events to scan to collect information about + * processes and cross sections. If less than 0, all events will be + * scanned. + */ + long maxScan() const { return theMaxScan; } + + /** + * Return true if this reader is active. + */ + bool active() const { return isActive; } + + /** + * True if negative weights may be produced. + */ + bool negativeWeights() const { return heprup.IDWTUP < 0; } + + /** + * The collected cross section statistics for this reader. + */ + const XSecStat & xSecStats() const { return stats; } + + /** + * Collected statistics about the individual processes. + */ + const StatMap & processStats() const { return statmap; } + + /** + * Select the current event. It will later be rejected with a + * probability given by \a weight. + */ + void select(double weight) { + stats.select(weight); + statmap[hepeup.IDPRUP].select(weight); + } + + /** + * Accept the current event assuming it was previously selcted. + */ + void accept() { + stats.accept(); + statmap[hepeup.IDPRUP].accept(); + } + + /** + * Reject the current event assuming it was previously accepted. + */ + void reject(double w) { + stats.reject(w); + statmap[hepeup.IDPRUP].reject(w); + } + + /** + * Increase the overestimated cross section for this reader. + */ + virtual void increaseMaxXSec(CrossSection maxxsec); + + /** + * The PartonExtractor object used to construct remnants. + */ + tPExtrPtr partonExtractor() const { return thePartonExtractor; } + + /** + * Return a possibly null pointer to a CascadeHandler to be used for + * CKKW-reweighting. + */ + tCascHdlPtr CKKWHandler() const { return theCKKW; } + + /** + * The pairs of PartonBin objects describing the partons which can + * be extracted by the PartonExtractor object. + */ + const PartonPairVec & partonBins() const { return thePartonBins; } + + /** + * The map of XComb objects indexed by the corresponding PartonBin + * pair. + */ + const XCombMap & xCombs() const { return theXCombs; } + + /** + * The Cuts object to be used for this reader. + */ + const Cuts & cuts() const { return *theCuts; } + + //@} + +protected: + + /** @name Functions for manipulating cache files. */ + //@{ + + /** + * Name of file used to cache the events form the reader in a + * fast-readable form. If empty, no cache file will be generated. + */ + string cacheFileName() const { return theCacheFileName; } + + /** + * Determines whether to apply cuts to events converting them to + * ThePEG format. + */ + bool cutEarly() const { return doCutEarly; } + + /** + * File stream for the cache. + */ + CFile cacheFile() const { return theCacheFile;} + + /** + * Open the cache file for reading. + */ + void openReadCacheFile(); + + /** + * Open the cache file for writing. + */ + void openWriteCacheFile(); + + /** + * Close the cache file; + */ + void closeCacheFile(); + + /** + * Write the current event to the cache file. + */ + void cacheEvent() const; + + /** + * Read an event from the cache file. Return false if something went wrong. + */ + bool uncacheEvent(); + + /** + * Reopen a reader. If we have reached the end of an event file, + * reopen it and issue a warning if we have used up a large fraction + * of it. + */ + void reopen(); + + /** + * Helper function to write a variable to a memory location + */ + template + static char * mwrite(char * pos, const T & t, size_t n = 1) { + std::memcpy(pos, &t, n*sizeof(T)); + return pos + n*sizeof(T); + } + + /** + * Helper function to read a variable from a memory location + */ + template + static const char * mread(const char * pos, T & t, size_t n = 1) { + std::memcpy(&t, pos, n*sizeof(T)); + return pos + n*sizeof(T); + } + + //@} + + /** @name Auxilliary virtual methods which may be verridden by sub-classes. */ + //@{ + /** + * Check the existence of a pair of PartonBin objects corresponding + * to the current event. + * + * @return false if no pair of suitable PartonBin objects was found. + */ + virtual bool checkPartonBin(); + + /** + * Create instances of all particles in the event and store them + * in particleIndex. + */ + virtual void createParticles(); + + /** + * Using the already created particles create a pair of + * PartonBinInstance objects corresponding to the incoming + * partons. Return the corresponding PartonBin objects. + */ + virtual tcPBPair createPartonBinInstances(); + + /** + * Create instances of the incoming beams in the event and store + * them in particleIndex. If no beam particles are included in the + * event they are created from the run info. + */ + virtual void createBeams(); + + /** + * Go through the mother indices and connect up the Particles. + */ + virtual void connectMothers(); + //@} + +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 Set functions for some variables not in the Les Houches accord. */ + //@{ + /** + * The number of events in this reader. If less than zero the number + * of events is unlimited. + */ + void NEvents(long x) { theNEvents = x; } + + /** + * The map of XComb objects indexed by the corresponding PartonBin + * pair. + */ + XCombMap & xCombs() { return theXCombs; } + //@} + + /** @name Standard (and non-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(); + + /** + * Finalize this object. Called in the run phase just after a + * run has ended. Used eg. to write out statistics. + */ + virtual void dofinish() { + close(); + HandlerBase::dofinish(); + } + + /** + * Return true if this object needs to be initialized before all + * other objects because it needs to extract PDFs from the event file. + */ + virtual bool preInitialize() const; + + /** + * Called from doinit() to extract PDFs from the event file and add + * the corresponding objects to the current EventGenerator. + */ + virtual void initPDFs(); + //@} + +protected: + + /** + * The HEPRUP common block. + */ + HEPRUP heprup; + + /** + * The HEPEUP common block. + */ + HEPEUP hepeup; + + /** + * The ParticleData objects corresponding to the incoming particles. + */ + tcPDPair inData; + + /** + * The PDFBase objects which has been used for the beam particle + * when generating the events being read. Specified in the interface + * or derived from PDFGUP and PDFSUP. + */ + pair inPDF; + + /** + * The PDFBase object to be used in the subsequent generation. + */ + pair outPDF; + + /** + * The PartonExtractor object used to construct remnants. + */ + PExtrPtr thePartonExtractor; + + /** + * A pointer to a CascadeHandler to be used for CKKW-reweighting. + */ + tCascHdlPtr theCKKW; + + /** + * The pairs of PartonBin objects describing the partons which can + * be extracted by the PartonExtractor object. + */ + PartonPairVec thePartonBins; + + /** + * The map of XComb objects indexed by the corresponding PartonBin + * pair. + */ + XCombMap theXCombs; + + /** + * The Cuts object to be used for this reader. + */ + CutsPtr theCuts; + + /** + * The number of events in this reader. If less than zero the number + * of events is unlimited. + */ + long theNEvents; + + /** + * The number of events produced by this reader so far. Is reset + * every time an event file is reopened. + */ + long position; + + /** + * The number of times this reader has been reopened. + */ + int reopened; + + /** + * The maximum number of events to scan to collect information about + * processes and cross sections. If less than 0, all events will be + * scanned. + */ + long theMaxScan; + + /** + * Flag to tell whether we are in the process of scanning. + */ + bool scanning; + + /** + * True if this is an active reader. + */ + bool isActive; + + /** + * Name of file used to cache the events form the reader in a + * fast-readable form. If empty, no cache file will be generated. + */ + string theCacheFileName; + + /** + * Determines whether to apply cuts to events before converting them + * to ThePEG format. + */ + bool doCutEarly; + + /** + * Collect statistics for this reader. + */ + XSecStat stats; + + /** + * Collect statistics for each individual process. + */ + StatMap statmap; + + /** + * The pair of PartonBinInstance objects describing the current + * incoming partons in the event. + */ + PBIPair thePartonBinInstances; + + /** + * Association between ColourLines and colour indices in the current + * translation. + */ + ObjectIndexer colourIndex; + + /** + * Association between Particles and indices in the current + * translation. + */ + ObjectIndexer particleIndex; + + /** + * The instances of the beam particles for the current event. + */ + PPair theBeams; + + /** + * The instances of the incoming particles to the sub process for + * the current event. + */ + PPair theIncoming; + + /** + * The instances of the outgoing particles from the sub process for + * the current event. + */ + PVector theOutgoing; + + /** + * The instances of the intermediate particles in the sub process for + * the current event. + */ + PVector theIntermediates; + + /** + * File stream for the cache. + */ + CFile theCacheFile; + + /** + * The reweight objects modifying the weights of this reader. + */ + ReweightVector reweights; + + /** + * The preweight objects modifying the weights of this reader. + */ + ReweightVector preweights; + + /** + * The factor with which this reader was last pre-weighted. + */ + double preweight; + + /** + * Should the event be reweighted by PDFs used by the PartonExtractor? + */ + bool reweightPDF; + + /** + * Should PDFBase objects be constructed from the information in the + * event file in the initialization? + */ + bool doInitPDFs; + + /** + * If this reader is to be used (possibly together with others) for + * CKKW reweighting and veto, this should give the multiplicity of + * outgoing particles in the highest multiplicity matrix element in + * the group. + */ + int theMaxMultCKKW; + + /** + * If this reader is to be used (possibly together with others) for + * CKKW reweighting and veto, this should give the multiplicity of + * outgoing particles in the lowest multiplicity matrix element in + * the group. + */ + int theMinMultCKKW; + + /** + * The weight multiplying the last read event due to PDF + * reweighting, CKKW reweighting or assigned reweight and preweight + * objects. + */ + double lastweight; + + /** + * The optional weights associated to the last read events. + */ + map optionalWeights; + + /** + * If the maximum cross section of this reader has been increased + * with increaseMaxXSec(), this is the total factor with which it + * has been increased. + */ + double maxFactor; + + /** + * npLO for FxFx merging + */ + int optionalnpLO; + + /** + * npNLO for FxFx merging + */ + int optionalnpNLO; + + /** + * The (reweighted) XWGTUP value should be scaled with this cross + * section when compared to the overestimated cross section. + */ + CrossSection weightScale; + + /** + * Individual scales for different sub-processes if reweighted. + */ + vector xSecWeights; + + /** + * Individual maximum weights for individual (possibly reweighted) + * processes. + */ + map maxWeights; + + /** + * Is set to true when getEvent() is called from skip(int). + */ + bool skipping; + + /** + * Option for the treatment of the momenta supplied + */ + unsigned int theMomentumTreatment; + + /** + * Set to true if warnings about possible weight incompatibilities + * should be issued. + */ + bool useWeightWarnings; + + /** + * Option to allow reopening of the file + */ + bool theReOpenAllowed; + + /** + * Use the spin information + */ + bool theIncludeSpin; + +private: + + /** Access function for the interface. */ + void setBeamA(long id); + /** Access function for the interface. */ + long getBeamA() const; + /** Access function for the interface. */ + void setBeamB(long id); + /** Access function for the interface. */ + long getBeamB() const; + /** Access function for the interface. */ + void setEBeamA(Energy e); + /** Access function for the interface. */ + Energy getEBeamA() const; + /** Access function for the interface. */ + void setEBeamB(Energy e); + /** Access function for the interface. */ + Energy getEBeamB() const; + /** Access function for the interface. */ + void setPDFA(PDFPtr); + /** Access function for the interface. */ + PDFPtr getPDFA() const; + /** Access function for the interface. */ + void setPDFB(PDFPtr); + /** Access function for the interface. */ + PDFPtr getPDFB() const; + +private: + + /** + * Describe an abstract base class with persistent data. + */ + static AbstractClassDescription initFxFxReader; + + /** + * Private and non-existent assignment operator. + */ + FxFxReader & operator=(const FxFxReader &) = delete; + +public: + + /** @cond EXCEPTIONCLASSES */ + /** Exception class used by FxFxReader in case inconsistencies + * are encountered. */ + class FxFxInconsistencyError: public Exception {}; + + /** Exception class used by FxFxReader in case more events + than available are requested. */ + class FxFxReopenWarning: public Exception {}; + + /** Exception class used by FxFxReader in case reopening an + event file fails. */ + class FxFxReopenError: public Exception {}; + + /** Exception class used by FxFxReader in case there is + information missing in the initialization phase. */ + class FxFxInitError: public InitException {}; + /** @endcond */ + +}; + +/// Stream output for HEPEUP +ostream & operator<<(ostream & os, const HEPEUP & h); + +} + + +#include "ThePEG/Utilities/ClassTraits.h" + +namespace ThePEG { + +/** @cond TRAITSPECIALIZATIONS */ + +/** + * This template specialization informs ThePEG about the + * base class of FxFxReader. + */ +template <> +struct BaseClassTrait: public ClassTraitsType { + /** Typedef of the base class of FxFxReader. */ + typedef HandlerBase NthBase; +}; + +/** + * This template specialization informs ThePEG about the name of the + * FxFxReader class and the shared object where it is + * defined. + */ +template <> +struct ClassTraits + : public ClassTraitsBase { + /** + * Return the class name. + */ + static string className() { return "Herwig::FxFxReader"; } + /** + * Return the name of the shared library to be loaded to get access + * to the FxFxReader class and every other class it uses + * (except the base class). + */ + static string library() { return "HwFxFx.so"; } + +}; + +/** @endcond */ + +} + +#endif /* THEPEG_FxFxReader_H */ diff --git a/MatrixElement/FxFx/Makefile.am b/MatrixElement/FxFx/Makefile.am new file mode 100644 --- /dev/null +++ b/MatrixElement/FxFx/Makefile.am @@ -0,0 +1,15 @@ +pkglib_LTLIBRARIES = HwFxFx.la HwFxFxHandler.la +HwFxFx_la_SOURCES = \ +FxFxFileReader.cc FxFxFileReader.fh FxFxFileReader.h\ +FxFxEventHandler.cc FxFxEventHandler.h\ +FxFxReader.cc FxFxReader.fh FxFxReader.h\ +FxFx.h +HwFxFx_la_CPPFLAGS = $(AM_CPPFLAGS) $(FASTJETINCLUDE) -I$(FASTJETPATH) +HwFxFx_la_LIBADD = $(FASTJETLIBS) +HwFxFx_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0 + +HwFxFxHandler_la_SOURCES = \ +FxFxHandler.cc FxFxHandler.h +HwFxFxHandler_la_CPPFLAGS = $(AM_CPPFLAGS) $(FASTJETINCLUDE) -I$(FASTJETPATH) +HwFxFxHandler_la_LIBADD = $(FASTJETLIBS) +HwFxFxHandler_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 1:0:0 diff --git a/MatrixElement/Hadron/MEDiffraction.cc b/MatrixElement/Hadron/MEDiffraction.cc --- a/MatrixElement/Hadron/MEDiffraction.cc +++ b/MatrixElement/Hadron/MEDiffraction.cc @@ -1,890 +1,959 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the MEDiffraction class. // #include "MEDiffraction.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Interface/ClassDocumentation.h" +#include "ThePEG/Interface/Reference.h" #include "ThePEG/Utilities/SimplePhaseSpace.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Handlers/StandardXComb.h" - +#include "ThePEG/Handlers/SamplerBase.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/MatrixElement/Tree2toNDiagram.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Switch.h" #include "Herwig/Utilities/Kinematics.h" MEDiffraction::MEDiffraction() : HwMEBase(), deltaOnly(false), isInRunPhase(false), theProtonMass(-MeV) // to be set in doinit {} void MEDiffraction::getDiagrams() const { //incoming particles cPDPair incomingHardons = generator()->eventHandler()->incoming(); tcPDPtr pom = getParticleData(990); //get incoming particles tcPDPtr prt11 = getParticleData(incomingHardons.first->id()); tcPDPtr prt12 = getParticleData(incomingHardons.second->id()); //get sign of id int sign1=0, sign2=0; sign1 = (incomingHardons.first->id() > 0) ? 1 : -1; sign2 = (incomingHardons.second->id() > 0) ? 1 : -1; tcPDPtr prt21 = getParticleData(sign1*2214);//Delta+ tcPDPtr prt22 = getParticleData(sign2*2214);//Delta+ //for the left side tcPDPtr q11 = getParticleData(sign1*2); //u tcPDPtr q21 = getParticleData(sign1*1); //d //for the right side tcPDPtr q12 = getParticleData(sign2*2); //u tcPDPtr q22 = getParticleData(sign2*1); //d //for the left side tcPDPtr dq11 = getParticleData(sign1*2101); //ud_0 tcPDPtr dq111 = getParticleData(sign1*2103); //ud_1 tcPDPtr dq21 = getParticleData(sign1*2203); //uu_1 //for the right side tcPDPtr dq12 = getParticleData(sign2*2101); //ud_0 tcPDPtr dq112 = getParticleData(sign2*2103); //ud_1 tcPDPtr dq22 = getParticleData(sign2*2203); //uu_1 tcPDPtr gl = getParticleData(21);//gluon //switch between dissociation decays to different //number of clusters or dissociation into delta only //(Maybe can be automated???) //(Should be generalized to ppbar, for example!!!) switch(dissociationDecay){ case 0: //one cluster or only delta in the final state if(deltaOnly) //only delta in the final state { switch (diffDirection){ case 0: add(new_ptr((Tree2toNDiagram(3), prt11, pom, prt12, 1, prt21, 2, prt12, -1))); break; case 1: add(new_ptr((Tree2toNDiagram(3), prt11, pom, prt12, 1, prt11, 2, prt22, -1))); break; case 2: add(new_ptr((Tree2toNDiagram(3), prt11, pom, prt12, 1, prt21, 2, prt22, -1))); break; } }else { //switch between direction of dissociated proton for single diffraction or //double diffraction switch (diffDirection){ case 0: //left //u -- ud_0 add(new_ptr((Tree2toNDiagram(4), prt11, q11, pom, prt12, 3, prt12, 1, dq11, 2, q11, -1))); //d -- uu_1 add(new_ptr((Tree2toNDiagram(4), prt11, q21, pom, prt12, 3, prt12, 1, dq21, 2, q21, -2))); break; case 1: //right //u -- ud_0 add(new_ptr((Tree2toNDiagram(4), prt11, pom, q12, prt12, 1, prt11, 3, dq12, 2, q12, -1))); //d -- uu_1 add(new_ptr((Tree2toNDiagram(4), prt11, pom, q22, prt12, 1, prt11, 3, dq22, 2, q22, -2))); break; case 2: //double //u -- ud_0 left u -- ud_0 right add(new_ptr((Tree2toNDiagram(5), prt11, q11, pom, q12, prt12, 1, dq11, 2, q11, 3, q12, 4, dq12, -1))); //u -- ud_0 left d -- uu_1 right add(new_ptr((Tree2toNDiagram(5), prt11, q11, pom, q22, prt12, 1, dq11, 2, q11, 3, q22, 4, dq22, -2))); //d -- uu_1 left u -- ud_0 right add(new_ptr((Tree2toNDiagram(5), prt11, q21, pom, q12, prt12, 1,dq21, 2, q21, 3, q12, 4, dq12, -3))); //d -- uu_1 left d -- uu_1 right add(new_ptr((Tree2toNDiagram(5), prt11, q21, pom, q22, prt12, 1, dq21, 2, q21, 3, q22, 4, dq22, -4))); break; } } break; case 1: //two clusters (cases with ud_1 not included) switch (diffDirection){ case 0: //left //u -- ud_0 add(new_ptr((Tree2toNDiagram(5), prt11, q11, gl, pom, prt12, 1, dq11, 2, q11, 3, gl, 4, prt12, -1))); //d -- uu_1 add(new_ptr((Tree2toNDiagram(5), prt11, q21, gl, pom, prt12, 1, dq21, 2, q21, 3, gl, 4, prt12, -2))); break; case 1: //right //u -- ud_0 add(new_ptr((Tree2toNDiagram(5), prt11, pom, gl, q12, prt12, 1, prt11, 2, gl, 3, q12, 4, dq12, -1))); //d -- ud_1 add(new_ptr((Tree2toNDiagram(5), prt11, pom, gl, q22, prt12, 1, prt11, 2, gl, 3, q22, 4, dq22, -2))); break; case 2: //double //u -- ud_0 left u -- ud_0 right add(new_ptr((Tree2toNDiagram(7), prt11, q11, gl, pom, gl, q12, prt12, 1, dq11, 2, q11, 3, gl, 4, gl, 5, q12, 6, dq12, -1))); //u -- ud_0 left d -- uu_1 right add(new_ptr((Tree2toNDiagram(7), prt11, q11, gl, pom, gl, q22, prt12, 1, dq11, 2, q11, 3, gl, 4, gl, 5, q22, 6, dq22, -2))); //d -- uu_1 left u -- ud_0 right add(new_ptr((Tree2toNDiagram(7), prt11, q21, gl, pom, gl, q12, prt12, 1, dq21, 2, q21, 3, gl, 4, gl, 5, q12, 6, dq12, -3))); //d -- uu_1 left d -- uu_1 right add(new_ptr((Tree2toNDiagram(7), prt11, q21, gl, pom, gl, q22, prt12, 1, dq21, 2, q21, 3, gl, 4, gl, 5, q22, 6, dq22, -4))); break; } break; } } Energy2 MEDiffraction::scale() const { return sqr(10*GeV); } int MEDiffraction::nDim() const { return 0; } void MEDiffraction::setKinematics() { HwMEBase::setKinematics(); // Always call the base class method first } bool MEDiffraction::generateKinematics(const double * ) { // generate the masses of the particles for (size_t i = 2; i < meMomenta().size(); ++i) meMomenta()[i] = Lorentz5Momentum(mePartonData()[i]->generateMass()); /* sample M12, M22 and t, characterizing the diffractive final state */ const pair,Energy2> point = diffractiveMassAndMomentumTransfer(); const Energy2 M12 (point.first.first); const Energy2 M22 (point.first.second); const Energy2 t(point.second); /* construct the hadronic momenta in the lab frame */ const double phi = UseRandom::rnd() * Constants::twopi; const Energy cmEnergy = generator()->maximumCMEnergy(); const Energy2 s = sqr(cmEnergy); //proton mass const Energy2 m2 = sqr( theProtonMass ); const Energy E3 = (s - M22 + M12) / (2.*cmEnergy); const Energy E4 = (s + M22 - M12) / (2.*cmEnergy); //Momentum of outgoing proton and dissociated proton const Energy pprime = sqrt(kallen(s, M12, M22)) / (2.*cmEnergy); //costheta of scattering angle double costheta = s*(s + 2*t - 2*m2 - M12 - M22) / sqrt( kallen(s, M12, M22)*kallen(s, m2, m2) ); assert(abs(costheta)<=1.); const Energy pzprime = pprime*costheta; const Energy pperp = pprime*sqrt(1 - sqr(costheta)); /* momenta in the lab frame */ const Lorentz5Momentum p3 = Lorentz5Momentum(pperp*cos(phi), pperp*sin(phi), pzprime, E3); const Lorentz5Momentum p4 = Lorentz5Momentum(-pperp*cos(phi), -pperp*sin(phi), -pzprime, E4); /* decay dissociated proton into quark-diquark */ //squares of constituent masses of quark and diquark const Energy2 mq2(sqr(mq())); Energy2 Mx2; switch(diffDirection){ case 0: Mx2=M12; break; case 1: Mx2=M22; break; } /* Select between left/right single diffraction and double diffraction */ //check if we want only delta for the excited state //pair of momenta for double decay for a two cluster case pair momPair, momPair1; //fraction of momenta double frac = UseRandom::rnd(); switch(dissociationDecay){ case 0: if(!deltaOnly) { pair decayMomenta; pair decayMomentaTwo; //absolute collinear dissociation of the hadron const double phiprime = phi; //aligned with outgoing dissociated proton const double costhetaprime = costheta; const double sinthetaprime=sqrt(1-sqr(costhetaprime)); //axis along which diquark from associated proton is aligned Axis dir = Axis(sinthetaprime*cos(phiprime), sinthetaprime*sin(phiprime), costhetaprime); switch (diffDirection){ case 0://Left single diffraction meMomenta()[4].setT(sqrt(mq2+sqr(meMomenta()[4].x())+sqr(meMomenta()[4].y())+sqr(meMomenta()[4].z()))); //////////////////////////////////////////////////// do{} while(!Kinematics::twoBodyDecay(p3,mqq(),mq(),-dir,decayMomenta.first,decayMomenta.second)); /////////// meMomenta()[2].setVect(p4.vect()); meMomenta()[2].setT(p4.t()); meMomenta()[3].setVect(decayMomenta.first.vect()); meMomenta()[3].setT(decayMomenta.first.t()); meMomenta()[4].setVect(decayMomenta.second.vect()); meMomenta()[4].setT(decayMomenta.second.t()); meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); meMomenta()[4].rescaleEnergy(); break; case 1://Right single diffraction meMomenta()[4].setT(sqrt(mq2+sqr(meMomenta()[4].x())+sqr(meMomenta()[4].y())+sqr(meMomenta()[4].z()))); //////////////////////////////////////////////////// do{} while(!Kinematics::twoBodyDecay(p4,mqq(),mq(),dir,decayMomenta.first,decayMomenta.second)); meMomenta()[2].setVect(p3.vect()); meMomenta()[2].setT(p3.t()); meMomenta()[3].setVect(decayMomenta.first.vect()); meMomenta()[3].setT(decayMomenta.first.t()); meMomenta()[4].setVect(decayMomenta.second.vect()); meMomenta()[4].setT(decayMomenta.second.t()); meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); meMomenta()[4].rescaleEnergy(); break; case 2://double diffraction do{} while(!Kinematics::twoBodyDecay(p3,mqq(),mq(),-dir,decayMomenta.first,decayMomenta.second)); do{} while(!Kinematics::twoBodyDecay(p4,mqq(),mq(),dir,decayMomentaTwo.first,decayMomentaTwo.second)); meMomenta()[2].setVect(decayMomenta.first.vect()); meMomenta()[2].setT(decayMomenta.first.t()); meMomenta()[3].setVect(decayMomenta.second.vect()); meMomenta()[3].setT(decayMomenta.second.t()); meMomenta()[4].setVect(decayMomentaTwo.second.vect()); meMomenta()[4].setT(decayMomentaTwo.second.t()); meMomenta()[5].setVect(decayMomentaTwo.first.vect()); meMomenta()[5].setT(decayMomentaTwo.first.t()); meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); meMomenta()[4].rescaleEnergy(); meMomenta()[5].rescaleEnergy(); break; } }else { const auto tmp=diffDirection==1?1:0; meMomenta()[2+tmp].setVect(p3.vect()); meMomenta()[2+tmp].setT(p3.t()); meMomenta()[3-tmp].setVect(p4.vect()); meMomenta()[3-tmp].setT(p4.t()); meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); } break; case 1: switch(diffDirection){ case 0: //quark and diquark masses meMomenta()[2].setMass(mqq()); meMomenta()[3].setMass(mq()); //gluon constituent mass meMomenta()[4].setMass(getParticleData(21)->constituentMass()); //outgoing proton meMomenta()[5].setVect(p4.vect()); meMomenta()[5].setT(p4.t()); //two body decay of the outgoing dissociation proton do{} while(!Kinematics::twoBodyDecay(p3,mqq()+mq(),getParticleData(21)->constituentMass(), p3.vect().unit(),momPair.first,momPair.second)); //put gluon back-to-back with quark-diquark //set momenta of quark and diquark frac = mqq()/(mqq()+mq()); meMomenta()[2].setVect(frac*momPair.first.vect()); meMomenta()[2].setT(sqrt(sqr(frac)*momPair.first.vect().mag2()+sqr(mqq()))); meMomenta()[3].setVect((1-frac)*momPair.first.vect()); meMomenta()[3].setT(sqrt(sqr(1-frac)*momPair.first.vect().mag2()+sqr(mq()))); //set momentum of gluon meMomenta()[4].setVect(momPair.second.vect()); meMomenta()[4].setT(momPair.second.t()); break; case 1: //quark and diquark masses meMomenta()[5].setMass(mqq()); meMomenta()[4].setMass(mq()); //gluon constituent mass meMomenta()[3].setMass(getParticleData(21)->constituentMass()); //outgoing proton meMomenta()[2].setVect(p3.vect()); meMomenta()[2].setT(p3.t()); //two body decay of the outgoing dissociation proton do{} while(!Kinematics::twoBodyDecay(p4,mqq()+mq(),getParticleData(21)->constituentMass(), p4.vect().unit(),momPair.first,momPair.second)); //put gluon back-to-back with quark-diquark //set momenta of quark and diquark frac = mqq()/(mqq()+mq()); meMomenta()[5].setVect(frac*momPair.first.vect()); meMomenta()[5].setT(sqrt(sqr(frac)*momPair.first.vect().mag2()+sqr(mqq()))); meMomenta()[4].setVect((1-frac)*momPair.first.vect()); meMomenta()[4].setT(sqrt(sqr(1-frac)*momPair.first.vect().mag2()+sqr(mq()))); //set momentum of gluon meMomenta()[3].setVect(momPair.second.vect()); meMomenta()[3].setT(momPair.second.t()); break; case 2: //first dissociated proton constituents meMomenta()[2].setMass(mqq()); meMomenta()[3].setMass(mq()); meMomenta()[4].setMass(getParticleData(21)->constituentMass()); //second dissociated proton constituents meMomenta()[5].setMass(getParticleData(21)->constituentMass()); meMomenta()[6].setMass(mq()); meMomenta()[7].setMass(mqq()); //two body decay of the outgoing dissociation proton do{} while(!Kinematics::twoBodyDecay(p3,mqq()+mq(),getParticleData(21)->constituentMass(), p3.vect().unit(),momPair.first,momPair.second)); do{} while(!Kinematics::twoBodyDecay(p4,mqq()+mq(),getParticleData(21)->constituentMass(), p4.vect().unit(),momPair1.first,momPair1.second)); //put gluon back-to-back with quark-diquark frac = mqq()/(mqq()+mq()); //first dissociated proton //set momenta of quark and diquark meMomenta()[2].setVect(frac*momPair.first.vect()); meMomenta()[2].setT(sqrt(sqr(frac)*momPair.first.vect().mag2()+sqr(mqq()))); meMomenta()[3].setVect((1-frac)*momPair.first.vect()); meMomenta()[3].setT(sqrt(sqr(1-frac)*momPair.first.vect().mag2()+sqr(mq()))); //set momentum of gluon meMomenta()[4].setVect(momPair.second.vect()); meMomenta()[4].setT(momPair.second.t()); //first dissociated proton //set momenta of quark and diquark meMomenta()[7].setVect(frac*momPair1.first.vect()); meMomenta()[7].setT(sqrt(sqr(frac)*momPair1.first.vect().mag2()+sqr(mqq()))); meMomenta()[6].setVect((1-frac)*momPair1.first.vect()); meMomenta()[6].setT(sqrt(sqr(1-frac)*momPair1.first.vect().mag2()+sqr(mq()))); //set momentum of gluon meMomenta()[5].setVect(momPair1.second.vect()); meMomenta()[5].setT(momPair1.second.t()); break; } meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); meMomenta()[4].rescaleEnergy(); meMomenta()[5].rescaleEnergy(); if(diffDirection==2){ meMomenta()[6].rescaleEnergy(); meMomenta()[7].rescaleEnergy(); } break; } jacobian(sqr(cmEnergy)/GeV2); return true; } //Generate masses of dissociated protons and momentum transfer from probability f(M2,t) //(for single diffraction). Sample according to f(M2,t)=f(M2)f(t|M2). pair,Energy2> MEDiffraction::diffractiveMassAndMomentumTransfer() const { Energy2 theM12(ZERO),theM22(ZERO), thet(ZERO); //proton mass squared const Energy2 m2 = sqr(theProtonMass); //delta mass squared const Energy2 md2 = sqr(getParticleData(2214)->mass()); Energy2 M2; bool condition = true; do { //check if we want only delta if(deltaOnly) { switch(diffDirection){ case 0: theM12 = md2; theM22 = m2; M2 = md2; if(generator()->maximumCMEnergy()maximumCMEnergy()maximumCMEnergy()maximumCMEnergy()maximumCMEnergy()theM22) ? theM12: theM22; if(generator()->maximumCMEnergy()maximumCMEnergy(); const Energy2 s = sqr(cmEnergy); if(generator()->maximumCMEnergy()= sqr(cmEnergy)/softPomeronSlope()) { condition = true; continue; } const double expmax = exp(slope*tmaxfun(s,m2,M2)); const double expmin = exp(slope*tminfun(s,m2,M2)); // without (1-M2/s) constraint condition = (UseRandom::rnd() > protonPomeronSlope()*(expmax-expmin)/slope ); } while(condition); return make_pair (make_pair(theM12,theM22),thet); } //Decay of the excited proton to quark-diquark pair MEDiffraction::twoBodyDecayMomenta(Lorentz5Momentum pp) const{ //Decay of the excited proton const Energy2 Mx2(sqr(pp.mass())),mq2(sqr(mq())),mqq2(sqr(mqq())); const Energy2 psq = ((Mx2-sqr(mq()+mqq()))*(Mx2-sqr(mq()-mqq())))/(4*Mx2); assert(psq/GeV2>0); const Energy p(sqrt(psq)); const double phi = UseRandom::rnd() * Constants::twopi; const double costheta =1-2*UseRandom::rnd(); const double sintheta = sqrt(1-sqr(costheta)); Lorentz5Momentum k1=Lorentz5Momentum(p*sintheta*cos(phi), p*sintheta*sin(phi), p*costheta, sqrt(mq2+psq)); Lorentz5Momentum k2=Lorentz5Momentum(-p*sintheta*cos(phi), -p*sintheta*sin(phi), -p*costheta,sqrt(mqq2+psq)); //find boost to pp center of mass const Boost betap3 = (pp).findBoostToCM(); //k1 and k2 calculated at p3 center of mass, so boost back k1.boost(-betap3); k2.boost(-betap3); //first is quark, second diquark return make_pair(k1,k2); } Energy2 MEDiffraction::randomt(Energy2 M2) const { assert(protonPomeronSlope()*GeV2 > 0); //proton mass const Energy2 m2 = sqr( theProtonMass ); const Energy cmEnergy = generator()->maximumCMEnergy(); const Energy2 ttmin = tminfun(sqr(cmEnergy),m2,M2); const Energy2 ttmax = tmaxfun(sqr(cmEnergy),m2,M2); const InvEnergy2 slope = protonPomeronSlope() + 2*softPomeronSlope()*log(sqr(cmEnergy)/M2); double r = UseRandom::rnd(); Energy2 newVal; if(slope*ttmax>slope*ttmin) { newVal = ttmax + log( r + (1.-r)*exp(slope*(ttmin-ttmax)) ) / slope; } else { newVal = ttmin + log( 1. - r + r*exp(slope*(ttmax-ttmin))) / slope; } return newVal; } Energy2 MEDiffraction::doublediffrandomt(Energy2 M12, Energy2 M22) const { const Energy cmEnergy = generator()->maximumCMEnergy(); const double shift = 0.1; const InvEnergy2 slope = 2*softPomeronSlope()*log(shift+(sqr(cmEnergy)/softPomeronSlope())/(M12*M22)); const Energy2 ttmin = tminfun(sqr(cmEnergy),M12,M22); const Energy2 ttmax = tmaxfun(sqr(cmEnergy),M12,M22); double r = UseRandom::rnd(); Energy2 newVal; if(slope*ttmax>slope*ttmin) { newVal = ttmax + log( r + (1.-r)*exp(slope*(ttmin-ttmax)) ) / slope; } else { newVal = ttmin + log( 1. - r + r*exp(slope*(ttmax-ttmin))) / slope; } return newVal; } Energy2 MEDiffraction::randomM2() const { const double tmp = 1 - softPomeronIntercept(); const Energy cmEnergy = generator()->maximumCMEnergy(); return sqr(cmEnergy) * pow( pow(M2min()/sqr(cmEnergy),tmp) + UseRandom::rnd() * (pow(M2max()/sqr(cmEnergy),tmp) - pow(M2min()/sqr(cmEnergy),tmp)), 1.0/tmp ); } Energy2 MEDiffraction::tminfun(Energy2 s, Energy2 M12, Energy2 M22) const { const Energy2 m2 = sqr( theProtonMass ); return 0.5/s*(-sqrt(kallen(s, m2, m2)*kallen(s, M12, M22))-sqr(s)+2*s*m2+s*M12+s*M22); } Energy2 MEDiffraction::tmaxfun(Energy2 s, Energy2 M12, Energy2 M22) const { const Energy2 m2 = sqr( theProtonMass ); return 0.5/s*(sqrt(kallen(s, m2, m2)*kallen(s, M12, M22))-sqr(s)+2*s*m2+s*M12+s*M22); } + +double MEDiffraction::correctionweight() const { + + + // Here we calculate the weight to restore the diffractiveXSec + // given by the MPIHandler. + + // First get the eventhandler to get the current cross sections. + static Ptr::tptr eh = + dynamic_ptr_cast::tptr>(generator()->eventHandler()); + + // All diffractive processes make use of this ME. + // The static map can be used to collect all the sumOfWeights. + static map weightsmap; + weightsmap[lastXCombPtr()]=lastXComb().stats().sumWeights(); + + + // Define static variable to keep trac of reweighting + static double rew_=1.; + static int countUpdateWeight=50; + static double sumRew=0.; + static double countN=0; + + // if we produce events we count + if(eh->integratedXSec()>ZERO)sumRew+=rew_; + if(eh->integratedXSec()>ZERO)countN+=1.; + + if(countUpdateWeightsampler()->maxXSec()/eh->sampler()->attempts()*sum; + CrossSection XS_wanted=MPIHandler_->diffractiveXSec(); + double deltaN=50; + + // Cross section without reweighting: XS_norew + // XS_have = avcsNorm2*XS_norew (for large N) + // We want to determine the rew that allows to get the wanted XS. + // In deltaN points we want (left) and we get (right): + // XS_wanted*(countN+deltaN) = XS_have*countN + rew*deltaN*XS_norew + // Solve for rew: + + rew_=avRew*(XS_wanted*(countN+deltaN)-XS_have*countN)/(XS_have*deltaN); + countUpdateWeight+=deltaN; + } + //Make sure we dont produce negative weights. + // TODO: write finalize method that checks if reweighting was performed correctly. + rew_=max(rew_,0.000001); + rew_=min(rew_,10000.0); + + return rew_; + +} + double MEDiffraction::me2() const{ - return theme2; + return theme2; } CrossSection MEDiffraction::dSigHatDR() const { - return me2()*jacobian()/sHat()*sqr(hbarc); + return me2()*jacobian()/sHat()*sqr(hbarc)*correctionweight(); } unsigned int MEDiffraction::orderInAlphaS() const { return 0; } unsigned int MEDiffraction::orderInAlphaEW() const { return 0; } Selector MEDiffraction::diagrams(const DiagramVector & diags) const { Selector sel; if(!deltaOnly){ if(diffDirection<2){ for(unsigned int i = 0; i < diags.size(); i++){ if(diags[0]->id()==-1) sel.insert(2./3.,i); else sel.insert(1./3.,i); } }else{ for(unsigned int i = 0; i < diags.size(); i++){ if(diags[0]->id()==-1) sel.insert(4./9.,i); else if(diags[0]->id()==-2) sel.insert(2./9.,i); else if(diags[0]->id()==-3) sel.insert(2./9.,i); else sel.insert(1./9.,i); } } }else{ sel.insert(1.0,0); } return sel; } Selector MEDiffraction::colourGeometries(tcDiagPtr ) const { Selector sel; int sign1=0, sign2=0; sign1 = (generator()->eventHandler()->incoming().first->id() > 0) ? 1 : -1; sign2 = (generator()->eventHandler()->incoming().second->id() > 0) ? 1 : -1; switch(dissociationDecay){ case 0: if(!deltaOnly) { if(diffDirection!=2){ if (diffDirection == 0){ if(sign1>0){ static ColourLines dqq0=ColourLines("-6 2 7"); sel.insert(1.0,&dqq0); }else{ static ColourLines dqq0=ColourLines("6 -2 -7"); sel.insert(1.0,&dqq0); } } else{ if(sign2>0){ static ColourLines dqq1=ColourLines("-6 3 7"); sel.insert(1.0,&dqq1); }else{ static ColourLines dqq1=ColourLines("6 -3 -7"); sel.insert(1.0,&dqq1); } } }else{ if(sign1>0 && sign2>0){ static ColourLines ddqq0=ColourLines("-6 2 7, -9 4 8"); sel.insert(1.0,&ddqq0); }else if(sign1<0 && sign2>0){ static ColourLines ddqq0=ColourLines("6 -2 -7, -9 4 8"); sel.insert(1.0,&ddqq0); }else if(sign1>0&& sign2<0){ static ColourLines ddqq0=ColourLines("-6 2 7, 9 -4 -8"); sel.insert(1.0,&ddqq0); }else{ static ColourLines ddqq0=ColourLines("6 -2 -7, 9 -4 -8"); sel.insert(1.0,&ddqq0); } } }else { static ColourLines cl(""); sel.insert(1.0, &cl); } break; case 1: switch(diffDirection){ case 0: static ColourLines clleft("-6 2 3 8, -8 -3 7"); sel.insert(1.0, &clleft); break; case 1: static ColourLines clright("-9 4 3 7, -7 -3 8"); sel.insert(1.0, &clright); break; case 2: static ColourLines cldouble("-8 2 3 10, -10 -3 9, -13 6 5 11, -11 -5 12"); sel.insert(1.0, &cldouble); break; } break; } return sel; } void MEDiffraction::doinit() { HwMEBase::doinit(); theProtonMass = getParticleData(2212)->mass(); } void MEDiffraction::doinitrun() { HwMEBase::doinitrun(); isInRunPhase = true; } IBPtr MEDiffraction::clone() const { return new_ptr(*this); } IBPtr MEDiffraction::fullclone() const { return new_ptr(*this); } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigMEDiffraction("Herwig::MEDiffraction", "HwMEHadron.so"); void MEDiffraction::persistentOutput(PersistentOStream & os) const { os << theme2 << deltaOnly << diffDirection << theprotonPomeronSlope << thesoftPomeronIntercept << thesoftPomeronSlope << dissociationDecay - << ounit(theProtonMass,GeV); + << ounit(theProtonMass,GeV) << MPIHandler_; } void MEDiffraction::persistentInput(PersistentIStream & is, int) { is >> theme2 >> deltaOnly >> diffDirection >> theprotonPomeronSlope >> thesoftPomeronIntercept >> thesoftPomeronSlope >> dissociationDecay - >> iunit(theProtonMass,GeV); + >> iunit(theProtonMass,GeV)>> MPIHandler_; } InvEnergy2 MEDiffraction::protonPomeronSlope() const{ return theprotonPomeronSlope/GeV2; } double MEDiffraction::softPomeronIntercept() const { return thesoftPomeronIntercept; } InvEnergy2 MEDiffraction::softPomeronSlope() const { return thesoftPomeronSlope/GeV2; } void MEDiffraction::Init() { static ClassDocumentation documentation ("There is no documentation for the MEDiffraction class"); static Parameter interfaceme2 ("DiffractionAmplitude", "The square of the diffraction amplitude used to determine the " "cross section.", &MEDiffraction::theme2, 1.0, 0.00001, 100.0, false, false, Interface::limited); static Parameter interfaceprotonPomeronSlope ("ProtonPomeronSlope", "The proton-pomeron slope parameter.", &MEDiffraction::theprotonPomeronSlope, 10.1, 0.00001, 100.0, false, false, Interface::limited); static Parameter interfacesoftPomeronIntercept ("SoftPomeronIntercept", "The soft pomeron intercept.", &MEDiffraction::thesoftPomeronIntercept, 1.08, 0.00001, 100.0, false, false, Interface::limited); static Parameter interfacesoftPomeronSlope ("SoftPomeronSlope", "The soft pomeron slope parameter.", &MEDiffraction::thesoftPomeronSlope, 0.25, 0.00001, 100.0, false, false, Interface::limited); static Switch interfaceDeltaOnly ("DeltaOnly", "proton-proton to proton-delta only", &MEDiffraction::deltaOnly, 0, false, false); static SwitchOption interfaceDeltaOnly0 (interfaceDeltaOnly,"No","Final state with Delta only is OFF", 0); static SwitchOption interfaceDeltaOnly1 (interfaceDeltaOnly,"Yes","Final state with Delta only is ON", 1); //Select if the left, right or both protons are excited static Switch interfaceDiffDirection ("DiffDirection", "Direction of the excited proton", &MEDiffraction::diffDirection, 0, false, false); static SwitchOption left (interfaceDiffDirection,"Left","Proton moving in the positive z direction", 0); static SwitchOption right (interfaceDiffDirection,"Right","Proton moving in the negative z direction", 1); static SwitchOption both (interfaceDiffDirection,"Both","Both protons", 2); //Select if two or three body decay static Switch interfaceDissociationDecay ("DissociationDecay", "Number of clusters the dissociated proton decays", &MEDiffraction::dissociationDecay, 0, false, false); static SwitchOption one (interfaceDissociationDecay,"One","Dissociated proton decays into one cluster", 0); static SwitchOption two (interfaceDissociationDecay,"Two","Dissociated proton decays into two clusters", 1); + + + static Reference interfaceMPIHandler + ("MPIHandler", + "The object that administers all additional scatterings.", + &MEDiffraction::MPIHandler_, false, false, true, true); + + + + } diff --git a/MatrixElement/Hadron/MEDiffraction.h b/MatrixElement/Hadron/MEDiffraction.h --- a/MatrixElement/Hadron/MEDiffraction.h +++ b/MatrixElement/Hadron/MEDiffraction.h @@ -1,302 +1,315 @@ // -*- C++ -*- #ifndef HERWIG_MEDiffraction_H #define HERWIG_MEDiffraction_H // // This is the declaration of the MEDiffraction class. // #include "Herwig/MatrixElement/HwMEBase.h" +#include "Herwig/Shower/UEBase.h" namespace Herwig { using namespace ThePEG; /** * The MEDiffraction class provides a simple colour singlet exchange matrix element * to be used in the soft component of the multiple scattering model of the * underlying event * * @see \ref MEDiffractionInterfaces "The interfaces" * defined for MEDiffraction. */ class MEDiffraction: public HwMEBase { public: MEDiffraction(); /** @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; + + /** + * Correction weight to reweight the cross section to the diffractive + * cross section. + */ + double correctionweight() const; /** * Return the scale associated with the last set phase space point. */ virtual Energy2 scale() const; /** * Set the typed and momenta of the incoming and outgoing partons to * be used in subsequent calls to me() and colourGeometries() * according to the associated XComb object. If the function is * overridden in a sub class the new function must call the base * class one first. */ virtual void setKinematics(); /** * The number of internal degrees of freedom used in the matrix * element. */ virtual int nDim() const; /** * Generate internal degrees of freedom given nDim() uniform * random numbers in the interval \f$ ]0,1[ \f$. To help the phase space * generator, the dSigHatDR should be a smooth function of these * numbers, although this is not strictly necessary. * @param r a pointer to the first of nDim() consecutive random numbers. * @return true if the generation succeeded, otherwise false. */ virtual bool generateKinematics(const double * r); /** * Return the matrix element squared differential in the variables * given by the last call to generateKinematics(). */ virtual CrossSection dSigHatDR() 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 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 colourGeometries(tcDiagPtr diag) const; //@} /** * Expect the incoming partons in the laboratory frame */ /* virtual bool wantCMS() const { return false; } */ 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(); //@} /** @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 matrix element squared */ double theme2; /* Use only delta as excited state */ bool deltaOnly; /* Direction of the excited proton */ unsigned int diffDirection; /* Number of clusters the dissociated proton decays into */ unsigned int dissociationDecay; /* The mass of the consitutent quark */ Energy mq() const {return Energy(0.325*GeV);} /* The mass of the constituent diquark */ Energy mqq() const {return Energy(0.650*GeV);} /* The proton-pomeron slope */ double theprotonPomeronSlope; /* The soft pomeron intercept */ double thesoftPomeronIntercept; /* The soft pomeron slope */ double thesoftPomeronSlope; /** * Sample the diffractive mass squared M2 and the momentum transfer t */ pair,Energy2> diffractiveMassAndMomentumTransfer() const; /** * Random value for the diffractive mass squared M2 according to (M2/s0)^(-intercept) */ Energy2 randomM2() const; /** * Random value for t according to exp(diffSlope*t) */ Energy2 randomt(Energy2 M2) const; /** * Random value for t according to exp(diffSlope*t) for double diffraction */ Energy2 doublediffrandomt(Energy2 M12, Energy2 M22) const; /** * Returns the momenta of the two-body decay of momentum pp */ pair twoBodyDecayMomenta(Lorentz5Momentum pp) const; /** * Returns the proton-pomeron slope */ InvEnergy2 protonPomeronSlope() const; /** * Returns the soft pomeron intercept */ double softPomeronIntercept() const; //M12 and M22 are masses squared of //outgoing particles /** * Returns the minimal possible value of momentum transfer t given the center * of mass energy and diffractive masses */ Energy2 tminfun(Energy2 s, Energy2 M12, Energy2 M22) const; /** * Returns the maximal possible value of momentum transfer t given the center * of mass energy and diffractive masses */ Energy2 tmaxfun(Energy2 s , Energy2 M12, Energy2 M22) const; /** * Returns the minimal possible value of diffractive mass */ //lowest possible mass given the constituent masses of quark and diquark Energy2 M2min() const{return sqr(getParticleData(2212)->mass()+mq()+mqq());} /** * Returns the maximal possible value of diffractive mass */ Energy2 M2max() const{ return sqr(generator()->maximumCMEnergy()-getParticleData(2212)->mass()); }//TODO:modify to get proper parameters InvEnergy2 softPomeronSlope() const; /* Kallen function */ template auto kallen(A a, B b, C c) const -> decltype(a*a) { return a*a + b*b + c*c - 2.0*(a*b + b*c + c*a); } /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ MEDiffraction & operator=(const MEDiffraction &) = delete; bool isInRunPhase; /* The proton mass */ Energy theProtonMass; + + /** + * a MPIHandler to administer the creation of several (semihard) + * partonic interactions. + */ + UEBasePtr MPIHandler_; }; } #endif /* HERWIG_MEDiffraction_H */ diff --git a/MatrixElement/Hadron/MEMinBias.cc b/MatrixElement/Hadron/MEMinBias.cc --- a/MatrixElement/Hadron/MEMinBias.cc +++ b/MatrixElement/Hadron/MEMinBias.cc @@ -1,167 +1,249 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the MEMinBias class. // #include "MEMinBias.h" #include "ThePEG/Utilities/DescribeClass.h" +#include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/SimplePhaseSpace.h" //#include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Handlers/StandardXComb.h" #include "ThePEG/Interface/Parameter.h" +#include "ThePEG/Handlers/SamplerBase.h" + #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/MatrixElement/Tree2toNDiagram.h" void MEMinBias::getDiagrams() const { int maxflav(2); // Pomeron data tcPDPtr pom = getParticleData(990); for ( int i = 1; i <= maxflav; ++i ) { for( int j=1; j <= i; ++j){ tcPDPtr q1 = getParticleData(i); tcPDPtr q1b = q1->CC(); tcPDPtr q2 = getParticleData(j); tcPDPtr q2b = q2->CC(); // For each flavour we add: //qq -> qq add(new_ptr((Tree2toNDiagram(3), q1, pom, q2, 1, q1, 2, q2, -1))); //qqb -> qqb add(new_ptr((Tree2toNDiagram(3), q1, pom, q2b, 1, q1, 2, q2b, -2))); //qbqb -> qbqb add(new_ptr((Tree2toNDiagram(3), q1b, pom, q2b, 1, q1b, 2, q2b, -3))); } } } Energy2 MEMinBias::scale() const { - return sqr(10*GeV); + return sqr(Scale_); } int MEMinBias::nDim() const { return 0; } void MEMinBias::setKinematics() { HwMEBase::setKinematics(); // Always call the base class method first. } bool MEMinBias::generateKinematics(const double *) { // generate the masses of the particles for ( int i = 2, N = meMomenta().size(); i < N; ++i ) { meMomenta()[i] = Lorentz5Momentum(mePartonData()[i]->generateMass()); } Energy q = ZERO; try { q = SimplePhaseSpace:: getMagnitude(sHat(), meMomenta()[2].mass(), meMomenta()[3].mass()); } catch ( ImpossibleKinematics & e ) { return false; } Energy pt = ZERO; meMomenta()[2].setVect(Momentum3( pt, pt, q)); meMomenta()[3].setVect(Momentum3(-pt, -pt, -q)); meMomenta()[2].rescaleEnergy(); meMomenta()[3].rescaleEnergy(); jacobian(1.0); return true; } + +double MEMinBias::correctionweight() const { + + + + // Here we calculate the weight to restore the inelastic-diffractiveXSec + // given by the MPIHandler. + + // First get the eventhandler to get the current cross sections. + static Ptr::tptr eh = + dynamic_ptr_cast::tptr>(generator()->eventHandler()); + + // All diffractive processes make use of this ME. + // The static map can be used to collect all the sumOfWeights. + static map weightsmap; + weightsmap[lastXCombPtr()]=lastXComb().stats().sumWeights(); + + + // Define static variable to keep trac of reweighting + static double rew_=1.; + static int countUpdateWeight=50; + static double sumRew=0.; + static double countN=0; + + // if we produce events we count + if(eh->integratedXSec()>ZERO)sumRew+=rew_; + if(eh->integratedXSec()>ZERO)countN+=1.; + + + + if(countUpdateWeightsampler()->maxXSec()/eh->sampler()->attempts()*sum; + CrossSection XS_wanted=MPIHandler_->inelasticXSec()-MPIHandler_->diffractiveXSec(); + double deltaN=50; + + // Cross section without reweighting: XS_norew + // XS_have = avcsNorm2*XS_norew (for large N) + // We want to determine the rew that allows to get the wanted XS. + // In deltaN points we want (left) and we get (right): + // XS_wanted*(countN+deltaN) = XS_have*countN + rew*deltaN*XS_norew + // Solve for rew: + rew_=avRew*(XS_wanted*(countN+deltaN)-XS_have*countN)/(XS_have*deltaN); + countUpdateWeight+=deltaN; + } + //Make sure we dont produce negative weights. + // TODO: write finalize method that checks if reweighting was performed correctly. + rew_=max(rew_,0.000001); + rew_=min(rew_,10000.0); + + return rew_; + + + + + +} + + + double MEMinBias::me2() const { //tuned so it gives the correct normalization for xmin = 0.11 return csNorm_*(sqr(generator()->maximumCMEnergy())/GeV2); } CrossSection MEMinBias::dSigHatDR() const { - return me2()*jacobian()/sHat()*sqr(hbarc); + return me2()*jacobian()/sHat()*sqr(hbarc)*correctionweight(); } unsigned int MEMinBias::orderInAlphaS() const { return 2; } unsigned int MEMinBias::orderInAlphaEW() const { return 0; } Selector MEMinBias::diagrams(const DiagramVector & diags) const { Selector sel; for ( DiagramIndex i = 0; i < diags.size(); ++i ) sel.insert(1.0, i); return sel; } Selector MEMinBias::colourGeometries(tcDiagPtr diag) const { static ColourLines qq("1 4, 3 5"); static ColourLines qqb("1 4, -3 -5"); static ColourLines qbqb("-1 -4, -3 -5"); Selector sel; switch(diag->id()){ case -1: sel.insert(1.0, &qq); break; case -2: sel.insert(1.0, &qqb); break; case -3: sel.insert(1.0, &qbqb); break; } return sel; } IBPtr MEMinBias::clone() const { return new_ptr(*this); } IBPtr MEMinBias::fullclone() const { return new_ptr(*this); } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigMEMinBias("Herwig::MEMinBias", "HwMEHadron.so"); void MEMinBias::persistentOutput(PersistentOStream & os) const { - os << csNorm_; + os << csNorm_ << ounit(Scale_,GeV) << MPIHandler_; } void MEMinBias::persistentInput(PersistentIStream & is, int) { - is >> csNorm_; + is >> csNorm_ >> iunit(Scale_,GeV) >> MPIHandler_; } void MEMinBias::Init() { static ClassDocumentation documentation ("There is no documentation for the MEMinBias class"); static Parameter interfacecsNorm ("csNorm", "Normalization of the min-bias cross section.", &MEMinBias::csNorm_, 1.0, 0.0, 100.0, false, false, Interface::limited); + static Parameter interfaceScale + ("Scale", + "Scale for the Min Bias matrix element.", + &MEMinBias::Scale_,GeV, + 2.0*GeV, 0.0*GeV, 100.0*GeV, + false, false, Interface::limited); + + static Reference interfaceMPIHandler + ("MPIHandler", + "The object that administers all additional scatterings.", + &MEMinBias::MPIHandler_, false, false, true, true); + + } diff --git a/MatrixElement/Hadron/MEMinBias.h b/MatrixElement/Hadron/MEMinBias.h --- a/MatrixElement/Hadron/MEMinBias.h +++ b/MatrixElement/Hadron/MEMinBias.h @@ -1,190 +1,212 @@ // -*- C++ -*- #ifndef HERWIG_MEMinBias_H #define HERWIG_MEMinBias_H // // This is the declaration of the MEMinBias class. // #include "Herwig/MatrixElement/HwMEBase.h" +#include "Herwig/Shower/UEBase.h" namespace Herwig { using namespace ThePEG; /** * The MEMinBias class provides a simple colour singlet exchange matrix element * to be used in the soft component of the multiple scattering model of the * underlying event * * @see \ref MEMinBiasInterfaces "The interfaces" * defined for MEMinBias. */ class MEMinBias: public HwMEBase { public: /** * The default constructor. */ - MEMinBias() : csNorm_(1.) {} + MEMinBias() : csNorm_(1.), Scale_(2.*GeV) {} 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; /** + * Correction weight to reweight the cross section to the inelastic cross + * section subtracted by the diffractive cross section. + */ + double correctionweight() const; + + /** * Return the scale associated with the last set phase space point. */ virtual Energy2 scale() const; /** * Set the typed and momenta of the incoming and outgoing partons to * be used in subsequent calls to me() and colourGeometries() * according to the associated XComb object. If the function is * overridden in a sub class the new function must call the base * class one first. */ virtual void setKinematics(); /** * The number of internal degrees of freedom used in the matrix * element. */ virtual int nDim() const; /** * Generate internal degrees of freedom given nDim() uniform * random numbers in the interval \f$ ]0,1[ \f$. To help the phase space * generator, the dSigHatDR should be a smooth function of these * numbers, although this is not strictly necessary. * @param r a pointer to the first of nDim() consecutive random numbers. * @return true if the generation succeeded, otherwise false. */ virtual bool generateKinematics(const double * r); /** * Return the matrix element squared differential in the variables * given by the last call to generateKinematics(). */ virtual CrossSection dSigHatDR() 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 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 colourGeometries(tcDiagPtr diag) 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. */ /** * 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; //@} // If needed, insert declarations of virtual function defined in the // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs). private: /** - * Normalization of the min-bias cross section - */ + * Normalization of the min-bias cross section. + * Note that the cross section is reweighted in addition to produce the + * non-diffractive cross section given by the MPIHandler + * csNorm can be modified to improve the unweighting effiency. + */ double csNorm_; /** + * Scale for the Min Bias matrix element + */ + Energy Scale_; + + /** + * a MPIHandler to administer the creation of several (semihard) + * partonic interactions. + * Needed to comunicate the non-diffractive cross section. + */ + UEBasePtr MPIHandler_; + + /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ MEMinBias & operator=(const MEMinBias &) = delete; }; } #endif /* HERWIG_MEMinBias_H */ diff --git a/MatrixElement/Lepton/MEee2VectorMeson.cc b/MatrixElement/Lepton/MEee2VectorMeson.cc --- a/MatrixElement/Lepton/MEee2VectorMeson.cc +++ b/MatrixElement/Lepton/MEee2VectorMeson.cc @@ -1,231 +1,228 @@ // -*- C++ -*- // // MEee2VectorMeson.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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 MEee2VectorMeson class. // #include "MEee2VectorMeson.h" #include "ThePEG/Utilities/DescribeClass.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/Cuts/Cuts.h" #include "Herwig/PDT/GenericMassGenerator.h" #include "ThePEG/Handlers/StandardXComb.h" +#include "Herwig/Models/StandardModel/StandardModel.h" #include "Herwig/MatrixElement/HardVertex.h" using namespace Herwig; using namespace ThePEG; using namespace ThePEG::Helicity; - void MEee2VectorMeson::getDiagrams() const { tcPDPtr em = getParticleData(ParticleID::eminus); tcPDPtr ep = getParticleData(ParticleID::eplus); - add(new_ptr((Tree2toNDiagram(2), em, ep, 1, _vector,-1))); + add(new_ptr((Tree2toNDiagram(2), em, ep, 1, vector_,-1))); } Energy2 MEee2VectorMeson::scale() const { return sHat(); } int MEee2VectorMeson::nDim() const { - return 1; + return 0; } void MEee2VectorMeson::setKinematics() { - MEBase::setKinematics(); // Always call the base class method first. + MEBase::setKinematics(); } -bool MEee2VectorMeson::generateKinematics(const double *r) { +bool MEee2VectorMeson::generateKinematics(const double *) { Lorentz5Momentum pout=meMomenta()[0]+meMomenta()[1]; pout.rescaleMass(); meMomenta()[2] = pout; jacobian(1.0); // check passes all the cuts vector out(1,meMomenta()[2]); tcPDVector tout(1,mePartonData()[2]); - jacobian(1.+0.002*(0.5-r[0])); - // return true if passes the cuts return lastCuts().passCuts(tout, out, mePartonData()[0], mePartonData()[1]); } unsigned int MEee2VectorMeson::orderInAlphaS() const { return 0; } unsigned int MEee2VectorMeson::orderInAlphaEW() const { - return 0; + return 2; } Selector MEee2VectorMeson::colourGeometries(tcDiagPtr) const { static ColourLines neutral ( " " ); Selector sel;sel.insert(1.,&neutral); return sel; } void MEee2VectorMeson::persistentOutput(PersistentOStream & os) const { - os << _coupling << _vector << _massgen << _lineshape; + os << coupling_ << vector_ << massGen_ << lineShape_; } void MEee2VectorMeson::persistentInput(PersistentIStream & is, int) { - is >> _coupling >> _vector >> _massgen >> _lineshape; + is >> coupling_ >> vector_ >> massGen_ >> lineShape_; } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigMEee2VectorMeson("Herwig::MEee2VectorMeson", "HwMELepton.so"); void MEee2VectorMeson::Init() { static ClassDocumentation documentation ("The MEee2VectorMeson class implements the production of a vector meson" " in e+e- collisions and is primilarly intended to test the hadron decay package"); static Switch interfaceLineShape ("LineShape", "Option for the vector meson lineshape", - &MEee2VectorMeson::_lineshape, false, false, false); + &MEee2VectorMeson::lineShape_, false, false, false); static SwitchOption interfaceLineShapeMassGenerator (interfaceLineShape, "MassGenerator", "Use the mass generator if available", true); static SwitchOption interfaceLineShapeBreitWigner (interfaceLineShape, "BreitWigner", "Use a Breit-Wigner with the naive running width", false); static Reference interfaceVectorMeson ("VectorMeson", "The vector meson produced", - &MEee2VectorMeson::_vector, false, false, true, false, false); + &MEee2VectorMeson::vector_, false, false, true, false, false); static Parameter interfaceCoupling ("Coupling", "The leptonic coupling of the vector meson", - &MEee2VectorMeson::_coupling, 0.0012, 0.0, 10.0, + &MEee2VectorMeson::coupling_, 0., 0.0, 100.0, false, false, Interface::limited); } Selector MEee2VectorMeson::diagrams(const DiagramVector &) const { Selector sel;sel.insert(1.0, 0); return sel; } CrossSection MEee2VectorMeson::dSigHatDR() const { InvEnergy2 wgt; - Energy M(_vector->mass()),G(_vector->width()); + Energy M(vector_->mass()),G(vector_->width()); Energy2 M2(sqr(M)),GM(G*M); - if(_massgen&&_lineshape) { - wgt =Constants::pi*_massgen->weight(sqrt(sHat()))/(sqr(sHat()-M2)+sqr(GM))*UnitRemoval::E2; - } - else { + if(massGen_&&lineShape_) + wgt = Constants::pi*massGen_->BreitWignerWeight(sqrt(sHat())); + else wgt = sHat()*G/M/(sqr(sHat()-M2)+sqr(sHat()*G/M)); - } - return me2()*jacobian()*wgt*sqr(hbarc); + return sqr(4.*Constants::pi*SM().alphaEM(sHat()))*me2()*jacobian()*wgt*sqr(hbarc)*sqr(M2/sHat()); } void MEee2VectorMeson::doinit() { MEBase::doinit(); // mass generator - tMassGenPtr mass=_vector->massGenerator(); + tMassGenPtr mass=vector_->massGenerator(); if(mass) { - _massgen=dynamic_ptr_cast(mass); + massGen_=dynamic_ptr_cast(mass); } } double MEee2VectorMeson::me2() const { double aver=0.; // get the order right int ielectron(0),ipositron(1); if(mePartonData()[0]->id()!=11) swap(ielectron,ipositron); // the vectors for the wavefunction to be passed to the matrix element vector fin; vector ain; vector vout; for(unsigned int ihel=0;ihel<2;++ihel) { fin.push_back(SpinorWaveFunction(meMomenta()[ielectron], mePartonData()[ielectron],ihel,incoming)); ain.push_back(SpinorBarWaveFunction(meMomenta()[ipositron], mePartonData()[ipositron],ihel,incoming)); } for(unsigned int ihel=0;ihel<3;++ihel) { vout.push_back(VectorWaveFunction(meMomenta()[2],mePartonData()[2],ihel,outgoing)); } ProductionMatrixElement temp=HelicityME(fin,ain,vout,aver); return aver; } // the helicity amplitude matrix element ProductionMatrixElement MEee2VectorMeson::HelicityME(vector fin, vector ain, vector vout, double & aver) const { ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin1); Complex product; // sum over helicities to get the matrix element unsigned int inhel1,inhel2,outhel1; - double me(0.); - LorentzPolarizationVector vec; + aver = 0.; + LorentzPolarizationVectorE vec; Complex ii(0.,1.); + Energy ecms = sqrt(sHat()); for(inhel1=0;inhel1<2;++inhel1) { for(inhel2=0;inhel2<2;++inhel2) { - vec = fin[inhel1].wave().vectorCurrent(ain[inhel2].wave()); - vec*=_coupling; + vec = fin[inhel1].dimensionedWave().vectorCurrent(ain[inhel2].dimensionedWave()); + vec /= coupling_; for(outhel1=0;outhel1<3;++outhel1) { - product = vec.dot(vout[outhel1].wave()); + product = vec.dot(vout[outhel1].wave())/ecms; output(inhel1,inhel2,outhel1)=product; - me+=real(product*conj(product)); + aver += norm(product); } } } - aver=(me*UnitRemoval::E2)/sHat(); + aver *= 0.25; return output; } void MEee2VectorMeson::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]); if(hard[0]->id()id()) swap(hard[0],hard[1]); vector fin; vector ain; vector vout; SpinorWaveFunction( fin ,hard[0],incoming,false,true); SpinorBarWaveFunction(ain ,hard[1],incoming,false,true); VectorWaveFunction(vout ,hard[2],outgoing,true,false,true); double dummy; ProductionMatrixElement prodme=HelicityME(fin,ain,vout,dummy); // 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<3;++ix) { (hard[ix]->spinInfo())->productionVertex(hardvertex); } } diff --git a/MatrixElement/Lepton/MEee2VectorMeson.h b/MatrixElement/Lepton/MEee2VectorMeson.h --- a/MatrixElement/Lepton/MEee2VectorMeson.h +++ b/MatrixElement/Lepton/MEee2VectorMeson.h @@ -1,236 +1,236 @@ // -*- C++ -*- // // MEee2VectorMeson.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // -#ifndef THEPEG_MEee2VectorMeson_H -#define THEPEG_MEee2VectorMeson_H +#ifndef HERWIG_MEee2VectorMeson_H +#define HERWIG_MEee2VectorMeson_H // // This is the declaration of the MEee2VectorMeson class. // #include "ThePEG/MatrixElement/MEBase.h" #include "Herwig/PDT/GenericMassGenerator.fh" #include "Herwig/MatrixElement/ProductionMatrixElement.h" #include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" #include "ThePEG/Helicity/WaveFunction/SpinorBarWaveFunction.h" #include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" namespace Herwig { using namespace ThePEG; using Helicity::SpinorWaveFunction; using Helicity::SpinorBarWaveFunction; using Helicity::VectorWaveFunction; /** * The MEee2VectorMeson class is designed to produce neutral vector mesons * in \f$e^+e^-\f$ collisions and is primarily intended to test the hadronic * decay package. * * @see \ref MEee2VectorMesonInterfaces "The interfaces" * defined for MEee2VectorMeson. */ class MEee2VectorMeson: public MEBase { public: /** * The default constructor. */ - inline MEee2VectorMeson() :_coupling(0.0012), _lineshape(false) + MEee2VectorMeson() : coupling_(0.0012), lineShape_(false) {} /** @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; /** * Set the typed and momenta of the incoming and outgoing partons to * be used in subsequent calls to me() and colourGeometries() * according to the associated XComb object. If the function is * overridden in a sub class the new function must call the base * class one first. */ virtual void setKinematics(); /** * The number of internal degrees of freedom used in the matrix * element. */ virtual int nDim() const; /** * Generate internal degrees of freedom given nDim() uniform * random numbers in the interval \f$ ]0,1[ \f$. To help the phase space * generator, the dSigHatDR should be a smooth function of these * numbers, although this is not strictly necessary. * @param r a pointer to the first of nDim() consecutive random numbers. * @return true if the generation succeeded, otherwise false. */ virtual bool generateKinematics(const double * r); /** * Return the matrix element squared differential in the variables * given by the last call to generateKinematics(). */ virtual CrossSection dSigHatDR() 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 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 colourGeometries(tcDiagPtr diag) const; /** * Set up the spin correlations */ virtual void constructVertex(tSubProPtr sub); //@} 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. */ inline 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. */ inline 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: /** * Member to return the helicity amplitudes */ ProductionMatrixElement HelicityME(vector fin, vector ain, vector vout,double& me) const; private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ MEee2VectorMeson & operator=(const MEee2VectorMeson &) = delete; private: /** * The vector meson being produced */ - PDPtr _vector; + PDPtr vector_; /** * The coupling */ - double _coupling; + double coupling_; /** * Use the mass generator for the line shape */ - bool _lineshape; + bool lineShape_; /** * Pointer to the mass generator for the Higgs */ - GenericMassGeneratorPtr _massgen; + GenericMassGeneratorPtr massGen_; }; } -#endif /* THEPEG_MEee2VectorMeson_H */ +#endif /* HERWIG_MEee2VectorMeson_H */ diff --git a/MatrixElement/Makefile.am b/MatrixElement/Makefile.am --- a/MatrixElement/Makefile.am +++ b/MatrixElement/Makefile.am @@ -1,12 +1,16 @@ SUBDIRS = General Lepton Hadron DIS Powheg Gamma Matchbox Reweighters +if WANT_LIBFASTJET +SUBDIRS += FxFx +endif + noinst_LTLIBRARIES = libHwME.la libHwME_la_SOURCES = \ HwMEBase.h HwMEBase.fh HwMEBase.cc \ MEfftoVH.h MEfftoVH.cc \ MEfftoffH.h MEfftoffH.cc \ HardVertex.fh HardVertex.h HardVertex.cc \ ProductionMatrixElement.h ProductionMatrixElement.cc \ DrellYanBase.h DrellYanBase.cc \ BlobME.h BlobME.cc diff --git a/MatrixElement/Matchbox/Base/MatchboxMEBase.cc b/MatrixElement/Matchbox/Base/MatchboxMEBase.cc --- a/MatrixElement/Matchbox/Base/MatchboxMEBase.cc +++ b/MatrixElement/Matchbox/Base/MatchboxMEBase.cc @@ -1,1663 +1,1680 @@ // -*- C++ -*- // // MatchboxMEBase.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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 MatchboxMEBase class. // #include "MatchboxMEBase.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDF/PDF.h" #include "ThePEG/PDT/PDT.h" #include "ThePEG/StandardModel/StandardModelBase.h" #include "ThePEG/Cuts/Cuts.h" #include "ThePEG/Handlers/StdXCombGroup.h" #include "ThePEG/EventRecord/SubProcess.h" #include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.h" #include "Herwig/MatrixElement/Matchbox/Utility/DiagramDrawer.h" #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h" #include "Herwig/MatrixElement/Matchbox/Base/MergerBase.h" #include "Herwig/API/RunDirectories.h" #include "Herwig/MatrixElement/ProductionMatrixElement.h" #include "Herwig/MatrixElement/HardVertex.h" #include #include using std::ostream_iterator; using namespace Herwig; MatchboxMEBase::MatchboxMEBase() : MEBase(), theOneLoop(false), theOneLoopNoBorn(false), theOneLoopNoLoops(false), theNoCorrelations(false), theHavePDFs(false,false), checkedPDFs(false) {} MatchboxMEBase::~MatchboxMEBase() {} Ptr::tptr MatchboxMEBase::factory() const { return MatchboxFactory::currentFactory(); } Ptr::tptr MatchboxMEBase::diagramGenerator() const { return factory()->diagramGenerator(); } Ptr::tptr MatchboxMEBase::processData() const { return factory()->processData(); } unsigned int MatchboxMEBase::getNLight() const { return factory()->nLight(); } vector MatchboxMEBase::getNLightJetVec() const { return factory()->nLightJetVec(); } vector MatchboxMEBase::getNHeavyJetVec() const { return factory()->nHeavyJetVec(); } vector MatchboxMEBase::getNLightProtonVec() const { return factory()->nLightProtonVec(); } double MatchboxMEBase::factorizationScaleFactor() const { return factory()->factorizationScaleFactor(); } double MatchboxMEBase::renormalizationScaleFactor() const { return factory()->renormalizationScaleFactor(); } bool MatchboxMEBase::fixedCouplings() const { return factory()->fixedCouplings(); } bool MatchboxMEBase::fixedQEDCouplings() const { return factory()->fixedQEDCouplings(); } bool MatchboxMEBase::checkPoles() const { return factory()->checkPoles(); } bool MatchboxMEBase::verbose() const { return factory()->verbose(); } bool MatchboxMEBase::initVerbose() const { return factory()->initVerbose(); } void MatchboxMEBase::getDiagrams() const { if ( diagramGenerator() && processData() ) { vector::ptr> diags; vector::ptr>& res = processData()->diagramMap()[subProcess().legs]; if ( res.empty() ) { res = diagramGenerator()->generate(subProcess().legs,orderInAlphaS(),orderInAlphaEW()); } copy(res.begin(),res.end(),back_inserter(diags)); processData()->fillMassGenerators(subProcess().legs); if ( diags.empty() ) return; for (auto const & d : diags ) add(d); return; } throw Exception() << "MatchboxMEBase::getDiagrams() expects a Tree2toNGenerator and ProcessData object.\n" << "Please check your setup." << Exception::runerror; } Selector MatchboxMEBase::diagrams(const DiagramVector & diags) const { if ( phasespace() ) { return phasespace()->selectDiagrams(diags); } throw Exception() << "MatchboxMEBase::diagrams() expects a MatchboxPhasespace object.\n" << "Please check your setup." << Exception::runerror; return Selector(); } Selector MatchboxMEBase::colourGeometries(tcDiagPtr diag) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->haveColourFlows() ) { if ( matchboxAmplitude()->treeAmplitudes() ) matchboxAmplitude()->prepareAmplitudes(this); return matchboxAmplitude()->colourGeometries(diag); } } Ptr::tcptr tdiag = dynamic_ptr_cast::tcptr>(diag); assert(diag && processData()); vector& flows = processData()->colourFlowMap()[tdiag]; if ( flows.empty() ) { list > > > cflows = ColourBasis::colourFlows(tdiag); for ( auto const & fit : cflows) flows.push_back(new ColourLines(ColourBasis::cfstring(fit))); } Selector res; for ( auto const & f : flows ) res.insert(1.0,f); return res; } void MatchboxMEBase::constructVertex(tSubProPtr sub, const ColourLines* cl) { if ( !canFillRhoMatrix() || !factory()->spinCorrelations() ) return; assert(matchboxAmplitude()); assert(matchboxAmplitude()->colourBasis()); // get the colour structure for the selected colour flow size_t cStructure = matchboxAmplitude()->colourBasis()->tensorIdFromFlow(lastXComb().lastDiagram(),cl); // hard process for processing the spin info tPVector hard; hard.push_back(sub->incoming().first); hard.push_back(sub->incoming().second); vector out; for ( auto const & p : sub->outgoing() ) { out.push_back(p->data().iSpin()); hard.push_back(p); } // calculate dummy wave functions to fill the spin info static vector dummyPolarizations; static vector dummySpinors; static vector dummyBarSpinors; for ( size_t k = 0; k < hard.size(); ++k ) { if ( hard[k]->data().iSpin() == PDT::Spin1Half ) { if ( hard[k]->id() > 0 && k > 1 ) { SpinorBarWaveFunction(dummyBarSpinors,hard[k], outgoing, true); } else if ( hard[k]->id() < 0 && k > 1 ) { SpinorWaveFunction(dummySpinors,hard[k], outgoing, true); } else if ( hard[k]->id() > 0 && k < 2 ) { SpinorWaveFunction(dummySpinors,hard[k], incoming, false); } else if ( hard[k]->id() < 0 && k < 2 ) { SpinorBarWaveFunction(dummyBarSpinors,hard[k], incoming, false); } } else if ( hard[k]->data().iSpin() == PDT::Spin1 ) { VectorWaveFunction(dummyPolarizations,hard[k], k > 1 ? outgoing : incoming, k > 1 ? true : false, hard[k]->data().hardProcessMass() == ZERO); } else if (hard[k]->data().iSpin() == PDT::Spin0 ) { ScalarWaveFunction(hard[k],k > 1 ? outgoing : incoming, k > 1 ? true : false); } else assert(false); } // fill the production matrix element ProductionMatrixElement pMe(mePartonData()[0]->iSpin(), mePartonData()[1]->iSpin(), out); for ( map,CVector>::const_iterator lamp = lastLargeNAmplitudes().begin(); lamp != lastLargeNAmplitudes().end(); ++lamp ) { vector pMeHelicities = matchboxAmplitude()->physicalHelicities(lamp->first); pMe(pMeHelicities) = lamp->second[cStructure]; } // set the spin information HardVertexPtr hardvertex = new_ptr(HardVertex()); hardvertex->ME(pMe); if ( sub->incoming().first->spinInfo() ) sub->incoming().first->spinInfo()->productionVertex(hardvertex); if ( sub->incoming().second->spinInfo() ) sub->incoming().second->spinInfo()->productionVertex(hardvertex); for ( auto const & p : sub->outgoing() ) if ( p->spinInfo() ) p->spinInfo()->productionVertex(hardvertex); } unsigned int MatchboxMEBase::orderInAlphaS() const { return subProcess().orderInAlphaS; } unsigned int MatchboxMEBase::orderInAlphaEW() const { return subProcess().orderInAlphaEW; } void MatchboxMEBase::setXComb(tStdXCombPtr xc) { MEBase::setXComb(xc); lastMatchboxXComb(xc); if ( phasespace() ) phasespace()->setXComb(xc); if ( scaleChoice() ) scaleChoice()->setXComb(xc); if ( matchboxAmplitude() ) matchboxAmplitude()->setXComb(xc); if (theMerger){ theMerger->setME(this); theMerger->setXComb( xc ); } } double MatchboxMEBase::generateIncomingPartons(const double* r1, const double* r2) { // shamelessly stolen from PartonExtractor.cc Energy2 shmax = lastCuts().sHatMax(); Energy2 shmin = lastCuts().sHatMin(); Energy2 sh = shmin*pow(shmax/shmin, *r1); double ymax = lastCuts().yHatMax(); double ymin = lastCuts().yHatMin(); double km = log(shmax/shmin); ymax = min(ymax, log(lastCuts().x1Max()*sqrt(lastS()/sh))); ymin = max(ymin, -log(lastCuts().x2Max()*sqrt(lastS()/sh))); double y = ymin + (*r2)*(ymax - ymin); double x1 = exp(-0.5*log(lastS()/sh) + y); double x2 = exp(-0.5*log(lastS()/sh) - y); Lorentz5Momentum P1 = lastParticles().first->momentum(); LorentzMomentum p1 = lightCone((P1.rho() + P1.e())*x1, Energy()); p1.rotateY(P1.theta()); p1.rotateZ(P1.phi()); meMomenta()[0] = p1; Lorentz5Momentum P2 = lastParticles().second->momentum(); LorentzMomentum p2 = lightCone((P2.rho() + P2.e())*x2, Energy()); p2.rotateY(P2.theta()); p2.rotateZ(P2.phi()); meMomenta()[1] = p2; lastXCombPtr()->lastX1X2(make_pair(x1,x2)); lastXCombPtr()->lastSHat((meMomenta()[0]+meMomenta()[1]).m2()); return km*(ymax - ymin); } bool MatchboxMEBase::generateKinematics(const double * r) { if ( phasespace() ) { jacobian(phasespace()->generateKinematics(r,meMomenta())); if ( jacobian() == 0.0 ) return false; setScale(); if (theMerger&&!theMerger->generateKinematics(r)){ return false; } logGenerateKinematics(r); assert(lastMatchboxXComb()); if ( nDimAmplitude() > 0 ) { amplitudeRandomNumbers().resize(nDimAmplitude()); copy(r + nDimPhasespace(), r + nDimPhasespace() + nDimAmplitude(), amplitudeRandomNumbers().begin()); } if ( nDimInsertions() > 0 ) { insertionRandomNumbers().resize(nDimInsertions()); copy(r + nDimPhasespace() + nDimAmplitude(), r + nDimPhasespace() + nDimAmplitude() + nDimInsertions(), insertionRandomNumbers().begin()); } return true; } throw Exception() << "MatchboxMEBase::generateKinematics() expects a MatchboxPhasespace object.\n" << "Please check your setup." << Exception::runerror; return false; } int MatchboxMEBase::nDim() const { if ( lastMatchboxXComb() ) return nDimPhasespace() + nDimAmplitude() + nDimInsertions(); int ampAdd = 0; if ( matchboxAmplitude() ) { ampAdd = matchboxAmplitude()->nDimAdditional(); } int insertionAdd = 0; for ( auto const & v : virtuals() ) { insertionAdd = max(insertionAdd,v->nDimAdditional()); } return nDimBorn() + ampAdd + insertionAdd; } int MatchboxMEBase::nDimBorn() const { if ( lastMatchboxXComb() ) return nDimPhasespace(); if ( phasespace() ) return phasespace()->nDim(diagrams().front()->partons()); throw Exception() << "MatchboxMEBase::nDim() expects a MatchboxPhasespace object.\n" << "Please check your setup." << Exception::runerror; return 0; } void MatchboxMEBase::setScale(Energy2 ren, Energy2 fac) const { if ( haveX1X2() ) { lastXCombPtr()->lastSHat((meMomenta()[0]+meMomenta()[1]).m2()); } Energy2 fcscale = (fac == ZERO) ? factorizationScale() : fac; Energy2 fscale = fcscale*sqr(factorizationScaleFactor()); Energy2 rscale = (ren == ZERO ? renormalizationScale() : ren)*sqr(renormalizationScaleFactor()); Energy2 ewrscale = renormalizationScaleQED(); lastXCombPtr()->lastScale(fscale); lastXCombPtr()->lastCentralScale(fcscale); lastXCombPtr()->lastShowerScale(showerScale()); lastMatchboxXComb()->lastRenormalizationScale(rscale); if ( !fixedCouplings() ) { if ( rscale > lastCuts().scaleMin() ) lastXCombPtr()->lastAlphaS(SM().alphaS(rscale)); else lastXCombPtr()->lastAlphaS(SM().alphaS(lastCuts().scaleMin())); } else { lastXCombPtr()->lastAlphaS(SM().alphaS()); } if ( !fixedQEDCouplings() ) { lastXCombPtr()->lastAlphaEM(SM().alphaEMME(ewrscale)); } else { lastXCombPtr()->lastAlphaEM(SM().alphaEMMZ()); } logSetScale(); } Energy2 MatchboxMEBase::factorizationScale() const { if ( scaleChoice() ) { return scaleChoice()->factorizationScale(); } throw Exception() << "MatchboxMEBase::factorizationScale() expects a MatchboxScaleChoice object.\n" << "Please check your setup." << Exception::runerror; return ZERO; } Energy2 MatchboxMEBase::renormalizationScale() const { if ( scaleChoice() ) { return scaleChoice()->renormalizationScale(); } throw Exception() << "MatchboxMEBase::renormalizationScale() expects a MatchboxScaleChoice object.\n" << "Please check your setup." << Exception::runerror; return ZERO; } Energy2 MatchboxMEBase::renormalizationScaleQED() const { if ( scaleChoice() ) { return scaleChoice()->renormalizationScaleQED(); } return renormalizationScale(); } Energy2 MatchboxMEBase::showerScale() const { if ( scaleChoice() ) { return scaleChoice()->showerScale(); } throw Exception() << "MatchboxMEBase::showerScale() expects a MatchboxScaleChoice object.\n" << "Please check your setup." << Exception::runerror; return ZERO; } void MatchboxMEBase::setVetoScales(tSubProPtr) const {} bool MatchboxMEBase::havePDFWeight1() const { if ( checkedPDFs ) return theHavePDFs.first; theHavePDFs.first = factory()->isIncoming(mePartonData()[0]) && lastXCombPtr()->partonBins().first->pdf(); theHavePDFs.second = factory()->isIncoming(mePartonData()[1]) && lastXCombPtr()->partonBins().second->pdf(); checkedPDFs = true; return theHavePDFs.first; } bool MatchboxMEBase::havePDFWeight2() const { if ( checkedPDFs ) return theHavePDFs.second; theHavePDFs.first = factory()->isIncoming(mePartonData()[0]) && lastXCombPtr()->partonBins().first->pdf(); theHavePDFs.second = factory()->isIncoming(mePartonData()[1]) && lastXCombPtr()->partonBins().second->pdf(); checkedPDFs = true; return theHavePDFs.second; } void MatchboxMEBase::getPDFWeight(Energy2 factorizationScale) const { if ( !havePDFWeight1() && !havePDFWeight2() ) { lastMEPDFWeight(1.0); logPDFWeight(); return; } double w = 1.; if ( havePDFWeight1() ) w *= pdf1(factorizationScale); if ( havePDFWeight2() ) w *= pdf2(factorizationScale); lastMEPDFWeight(w); logPDFWeight(); } double MatchboxMEBase::pdf1(Energy2 fscale, double xEx, double xFactor) const { assert(lastXCombPtr()->partonBins().first->pdf()); if ( xEx < 1. && lastX1()*xFactor >= xEx ) { return ( ( 1. - lastX1()*xFactor ) / ( 1. - xEx ) ) * lastXCombPtr()->partonBins().first->pdf()->xfx(lastParticles().first->dataPtr(), lastPartons().first->dataPtr(), fscale == ZERO ? lastScale() : fscale, xEx)/xEx; } return lastXCombPtr()->partonBins().first->pdf()->xfx(lastParticles().first->dataPtr(), lastPartons().first->dataPtr(), fscale == ZERO ? lastScale() : fscale, lastX1()*xFactor)/lastX1()/xFactor; } double MatchboxMEBase::pdf2(Energy2 fscale, double xEx, double xFactor) const { assert(lastXCombPtr()->partonBins().second->pdf()); if ( xEx < 1. && lastX2()*xFactor >= xEx ) { return ( ( 1. - lastX2()*xFactor ) / ( 1. - xEx ) ) * lastXCombPtr()->partonBins().second->pdf()->xfx(lastParticles().second->dataPtr(), lastPartons().second->dataPtr(), fscale == ZERO ? lastScale() : fscale, xEx)/xEx; } return lastXCombPtr()->partonBins().second->pdf()->xfx(lastParticles().second->dataPtr(), lastPartons().second->dataPtr(), fscale == ZERO ? lastScale() : fscale, lastX2()*xFactor)/lastX2()/xFactor; } double MatchboxMEBase::me2() const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) matchboxAmplitude()->prepareAmplitudes(this); double res = matchboxAmplitude()->me2()* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::me2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } double MatchboxMEBase::largeNME2(Ptr::tptr largeNBasis) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) { largeNBasis->prepare(mePartonData(),false); matchboxAmplitude()->prepareAmplitudes(this); } double res = matchboxAmplitude()->largeNME2(largeNBasis)* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::largeNME2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } double MatchboxMEBase::finalStateSymmetry() const { if ( symmetryFactor() > 0.0 ) return symmetryFactor(); double sFactor = 1.; map counts; cPDVector checkData; copy(mePartonData().begin()+2,mePartonData().end(),back_inserter(checkData)); cPDVector::iterator p = checkData.begin(); while ( !checkData.empty() ) { if ( counts.find((**p).id()) != counts.end() ) { counts[(**p).id()] += 1; } else { counts[(**p).id()] = 1; } checkData.erase(p); p = checkData.begin(); continue; } for ( auto const & c : counts) { if ( c.second == 1 ) continue; if ( c.second == 2 ) sFactor /= 2.; else if ( c.second == 3 ) sFactor /= 6.; else if ( c.second == 4 ) sFactor /= 24.; } symmetryFactor(sFactor); return symmetryFactor(); } double MatchboxMEBase::me2Norm(unsigned int addAlphaS) const { - // assume that we always have incoming - // spin-1/2 or massless spin-1 particles - double fac = 1./4.; + double fac = 1.; - if ( hasInitialAverage() ) - fac = 1.; + if ( !hasInitialAverage() ) { + for ( size_t k = 0; k < 2; ++k ) { + // Spin 0 does not involve any additional factors + if ( mePartonData()[k]->iSpin() == PDT::Spin1Half ) + fac *= 1./2.; + else if ( mePartonData()[k]->iSpin() == PDT::Spin1 && + mePartonData()[k]->hardProcessMass() == ZERO ) + fac *= 1./2.; + else if ( mePartonData()[k]->iSpin() == PDT::Spin1 && + mePartonData()[k]->hardProcessMass() > ZERO ) + fac *= 1./3.; + else if ( mePartonData()[k]->iSpin() == PDT::Spin3Half ) + fac *= 1./4.; + else if ( mePartonData()[k]->iSpin() == PDT::Spin2 && + mePartonData()[k]->hardProcessMass() == ZERO ) + fac *= 1./2.; + else if ( mePartonData()[k]->iSpin() == PDT::Spin2 && + mePartonData()[k]->hardProcessMass() > ZERO ) + fac *= 1./5.; + } + } double couplings = 1.0; if ( (orderInAlphaS() > 0 || addAlphaS != 0) && !hasRunningAlphaS() ) { fac *= pow(lastAlphaS()/SM().alphaS(),double(orderInAlphaS()+addAlphaS)); couplings *= pow(lastAlphaS(),double(orderInAlphaS()+addAlphaS)); } if ( orderInAlphaEW() > 0 && !hasRunningAlphaEW() ) { fac *= pow(lastAlphaEM()/SM().alphaEMMZ(),double(orderInAlphaEW())); couplings *= pow(lastAlphaEM(),double(orderInAlphaEW())); } lastMECouplings(couplings); if ( !hasInitialAverage() ) { if ( mePartonData()[0]->iColour() == PDT::Colour3 || mePartonData()[0]->iColour() == PDT::Colour3bar ) fac /= SM().Nc(); else if ( mePartonData()[0]->iColour() == PDT::Colour8 ) fac /= (SM().Nc()*SM().Nc()-1.); if ( mePartonData()[1]->iColour() == PDT::Colour3 || mePartonData()[1]->iColour() == PDT::Colour3bar ) fac /= SM().Nc(); else if ( mePartonData()[1]->iColour() == PDT::Colour8 ) fac /= (SM().Nc()*SM().Nc()-1.); } return !hasFinalStateSymmetry() ? finalStateSymmetry()*fac : fac; } CrossSection MatchboxMEBase::prefactor()const{ return (sqr(hbarc)/(2.*lastSHat())) *jacobian()* lastMEPDFWeight(); } CrossSection MatchboxMEBase::dSigHatDRB() const { getPDFWeight(); lastME2(me2()); return oneLoopNoBorn()?ZERO:prefactor() * lastME2(); } CrossSection MatchboxMEBase::dSigHatDRV() const { getPDFWeight(); lastME2(me2()); return ( oneLoop() && !oneLoopNoLoops() )?(prefactor() * oneLoopInterference()):ZERO; } CrossSection MatchboxMEBase::dSigHatDRI() const { getPDFWeight(); lastME2(me2()); CrossSection res=ZERO; if (oneLoop() &&!onlyOneLoop()) { for ( auto const & v : virtuals()) { v->setXComb(lastXCombPtr()); res += v->dSigHatDR(); } if ( checkPoles() && oneLoop() ) logPoles(); } return res; } CrossSection MatchboxMEBase::dSigHatDRAlphaDiff(double alpha) const { getPDFWeight(); lastME2(me2()); CrossSection res=ZERO; for ( auto const & v: virtuals() ) { v->setXComb(lastXCombPtr()); res+=v->dSigHatDRAlphaDiff( alpha); } return res; } CrossSection MatchboxMEBase::dSigHatDR() const { getPDFWeight(); if (theMerger){ lastMECrossSection(theMerger->MergingDSigDR()); return lastMECrossSection(); } else if (lastXCombPtr()->willPassCuts() ) { lastME2(me2()); CrossSection _dSigHatDRB, _dSigHatDRV, _dSigHatDRI, res = ZERO; // ----- dSigHatDRB ----- _dSigHatDRB = oneLoopNoBorn()?ZERO:prefactor() * lastME2(); // ----- dSigHatDRV ----- _dSigHatDRV = ( oneLoop() && !oneLoopNoLoops() )?(prefactor() * oneLoopInterference()):ZERO; // ----- dSigHatDRI ----- if (oneLoop() &&!onlyOneLoop()) { for ( auto const & v : virtuals()) { v->setXComb(lastXCombPtr()); res += v->dSigHatDR(); } if ( checkPoles() && oneLoop() ) logPoles(); } _dSigHatDRI = res; // ----- finalizing ----- lastMECrossSection(_dSigHatDRB + _dSigHatDRV + _dSigHatDRI); return lastMECrossSection(); } else { lastME2(ZERO); lastMECrossSection(ZERO); return lastMECrossSection(); } } double MatchboxMEBase::oneLoopInterference() const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->oneLoopAmplitudes() ) matchboxAmplitude()->prepareOneLoopAmplitudes(this); double res = matchboxAmplitude()->oneLoopInterference()* me2Norm(1); return res; } throw Exception() << "MatchboxMEBase::oneLoopInterference() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } MatchboxMEBase::AccuracyHistogram::AccuracyHistogram(double low, double up, unsigned int nbins) : lower(low), upper(up), sameSign(0), oppositeSign(0), nans(0), overflow(0), underflow(0) { double step = (up-low)/nbins; for ( unsigned int k = 1; k <= nbins; ++k ) bins[lower + k*step] = 0.0; } void MatchboxMEBase::AccuracyHistogram::book(double a, double b) { if ( ! (isfinite(a) && isfinite(b)) ) { ++nans; return; } if ( a*b >= 0. ) ++sameSign; if ( a*b < 0. ) ++oppositeSign; double r = 1.; if ( abs(a) != 0.0 ) r = abs(1.-abs(b/a)); else if ( abs(b) != 0.0 ) r = abs(b); if ( log10(r) < lower || r == 0.0 ) { ++underflow; return; } if ( log10(r) > upper ) { ++overflow; return; } map::iterator bin = bins.upper_bound(log10(r)); if ( bin == bins.end() ) return; bin->second += 1.; } void MatchboxMEBase::AccuracyHistogram::dump(const std::string& folder, const std::string& prefix, const cPDVector& proc) const { ostringstream fname(""); for ( cPDVector::const_iterator p = proc.begin(); p != proc.end(); ++p ) fname << (**p).PDGName(); ofstream out((folder+"/"+prefix+fname.str()+".dat").c_str()); out << "# same sign : " << sameSign << " opposite sign : " << oppositeSign << " nans : " << nans << " overflow : " << overflow << " underflow : " << underflow << "\n"; for ( map::const_iterator b = bins.begin(); b != bins.end(); ++b ) { map::const_iterator bp = b; --bp; if ( b->second != 0. ) { if ( b != bins.begin() ) out << bp->first; else out << lower; out << " " << b->first << " " << b->second << "\n" << flush; } } ofstream gpout((folder+"/"+prefix+fname.str()+".gp").c_str()); gpout << "set terminal png\n" << "set xlabel 'accuracy of pole cancellation [decimal places]'\n" << "set ylabel 'counts\n" << "set xrange [-20:0]\n" << "set output '" << prefix << fname.str() << ".png'\n" << "plot '" << prefix << fname.str() << ".dat' using (0.5*($1+$2)):3 with linespoints pt 7 ps 1 not"; } void MatchboxMEBase::AccuracyHistogram::persistentOutput(PersistentOStream& os) const { os << lower << upper << bins << sameSign << oppositeSign << nans << overflow << underflow; } void MatchboxMEBase::AccuracyHistogram::persistentInput(PersistentIStream& is) { is >> lower >> upper >> bins >> sameSign >> oppositeSign >> nans >> overflow >> underflow; } void MatchboxMEBase::logPoles() const { double res2me = oneLoopDoublePole(); double res1me = oneLoopSinglePole(); double res2i = 0.; double res1i = 0.; for ( auto const & v : virtuals()) { res2i += v->oneLoopDoublePole(); res1i += v->oneLoopSinglePole(); } if (res2me != 0.0 || res2i != 0.0) epsilonSquarePoleHistograms[mePartonData()].book(res2me,res2i); if (res1me != 0.0 || res1i != 0.0) epsilonPoleHistograms[mePartonData()].book(res1me,res1i); } bool MatchboxMEBase::haveOneLoop() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->haveOneLoop(); return false; } bool MatchboxMEBase::onlyOneLoop() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->onlyOneLoop(); return false; } bool MatchboxMEBase::isDRbar() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->isDRbar(); return false; } bool MatchboxMEBase::isDR() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->isDR(); return false; } bool MatchboxMEBase::isCS() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->isCS(); return false; } bool MatchboxMEBase::isBDK() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->isBDK(); return false; } bool MatchboxMEBase::isExpanded() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->isExpanded(); return false; } Energy2 MatchboxMEBase::mu2() const { if ( matchboxAmplitude() ) return matchboxAmplitude()->mu2(); return 0*GeV2; } double MatchboxMEBase::oneLoopDoublePole() const { if ( matchboxAmplitude() ) { return matchboxAmplitude()->oneLoopDoublePole()* me2Norm(1); } return 0.; } double MatchboxMEBase::oneLoopSinglePole() const { if ( matchboxAmplitude() ) { return matchboxAmplitude()->oneLoopSinglePole()* me2Norm(1); } return 0.; } vector MatchboxMEBase::getDipoles(const vector& dipoles, const vector & borns,bool slim) const { vector res; // keep track of the dipoles we already did set up set,int>,pair::tptr,Ptr::tptr> > > done; cPDVector rep = diagrams().front()->partons(); int nreal = rep.size(); // now loop over configs for ( int emitter = 0; emitter < nreal; ++emitter ) { list matchDipoles; for ( auto const & d : dipoles ) { if ( ! d->canHandleEmitter(rep,emitter) ) continue; matchDipoles.push_back(d); } if ( matchDipoles.empty() ) continue; for ( int emission = 2; emission < nreal; ++emission ) { if ( emission == emitter ) continue; list matchDipoles2; for ( auto const & d : matchDipoles ) { if ( !d->canHandleSplitting(rep,emitter,emission) ) continue; matchDipoles2.push_back(d); } if ( matchDipoles2.empty() ) continue; map::ptr,SubtractionDipole::MergeInfo> mergeInfo; for ( auto const & d : diagrams() ) { Ptr::ptr check = new_ptr(Tree2toNDiagram(*dynamic_ptr_cast::ptr>(d))); map theMergeLegs; for ( unsigned int i = 0; i < check->external().size(); ++i ) theMergeLegs[i] = -1; int theEmitter = check->mergeEmission(emitter,emission,theMergeLegs); // no underlying Born if ( theEmitter == -1 ) continue; SubtractionDipole::MergeInfo info; info.diagram = check; info.emitter = theEmitter; info.mergeLegs = theMergeLegs; mergeInfo[d] = info; } if ( mergeInfo.empty() ) continue; for ( int spectator = 0; spectator < nreal; ++spectator ) { if ( spectator == emitter || spectator == emission ) continue; list matchDipoles3; for ( auto const & d : matchDipoles2 ) { if ( ! d->canHandleSpectator(rep,spectator) ) continue; matchDipoles3.push_back(d); } if ( matchDipoles3.empty() ) continue; if ( noDipole(emitter,emission,spectator) ) continue; for ( auto const & d : matchDipoles3 ) { if ( !d->canHandle(rep,emitter,emission,spectator) ) continue; for ( auto const & b : borns ) { if ( b->onlyOneLoop() ) continue; if ( done.find(make_pair(make_pair(make_pair(emitter,emission),spectator),make_pair(b,d))) != done.end() ) continue; // now get to work d->clearBookkeeping(); d->realEmitter(emitter); d->realEmission(emission); d->realSpectator(spectator); d->realEmissionME(const_cast(this)); d->underlyingBornME(b); d->setupBookkeeping(mergeInfo,slim); if ( ! d->empty() ) { res.push_back( d->cloneMe() ); Ptr::tptr nDipole = res.back(); done.insert(make_pair(make_pair(make_pair(emitter,emission),spectator),make_pair(b,d))); if ( nDipole->isSymmetric() ) done.insert(make_pair(make_pair(make_pair(emission,emitter),spectator),make_pair(b,d))); ostringstream dname; if ( theMerger) { dname << fullName(); if (theOneLoopNoBorn) dname << ".virtual" << "." ; dname << b->name() << "." << d->name() << ".[(" << emitter << "," << emission << ")," << spectator << "]"; } else { dname << fullName() << "." << b->name() << "." << d->name() << ".[(" << emitter << "," << emission << ")," << spectator << "]"; } if ( ! (generator()->preinitRegister(nDipole,dname.str()) ) ) throw Exception() << "MatchboxMEBase::getDipoles(): Dipole " << dname.str() << " already existing." << Exception::runerror; if ( !factory()->reweighters().empty() ) { for ( auto const & rw : factory()->reweighters()) nDipole->addReweighter(rw); } if ( !factory()->preweighters().empty() ) { for ( auto const & rw : factory()->preweighters() ) nDipole->addPreweighter(rw); } nDipole->cloneDependencies(dname.str(),slim); } } } } } } vector::tptr> partners; copy(res.begin(),res.end(),back_inserter(partners)); for ( auto const & d : res ) d->partnerDipoles(partners); return res; } double MatchboxMEBase::colourCorrelatedME2(pair ij) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) matchboxAmplitude()->prepareAmplitudes(this); double res = matchboxAmplitude()->colourCorrelatedME2(ij)* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::colourCorrelatedME2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } double MatchboxMEBase::largeNColourCorrelatedME2(pair ij, Ptr::tptr largeNBasis) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) { largeNBasis->prepare(mePartonData(),false); matchboxAmplitude()->prepareAmplitudes(this); } double res = matchboxAmplitude()->largeNColourCorrelatedME2(ij,largeNBasis)* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::largeNColourCorrelatedME2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } double MatchboxMEBase::spinColourCorrelatedME2(pair ij, const SpinCorrelationTensor& c) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) matchboxAmplitude()->prepareAmplitudes(this); double res = matchboxAmplitude()->spinColourCorrelatedME2(ij,c)* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::spinColourCorrelatedME2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } double MatchboxMEBase::spinCorrelatedME2(pair ij, const SpinCorrelationTensor& c) const { if ( matchboxAmplitude() ) { if ( matchboxAmplitude()->treeAmplitudes() ) matchboxAmplitude()->prepareAmplitudes(this); double res = matchboxAmplitude()->spinCorrelatedME2(ij,c)* me2Norm(); return res; } throw Exception() << "MatchboxMEBase::spinCorrelatedME2() expects a MatchboxAmplitude object.\n" << "Please check your setup." << Exception::runerror; return 0.; } void MatchboxMEBase::flushCaches() { if ( theMerger )theMerger->flushCaches(); MEBase::flushCaches(); if ( matchboxAmplitude() ) matchboxAmplitude()->flushCaches(); for ( auto const & r : reweights() ) r->flushCaches(); for ( auto const & v : virtuals()) v->flushCaches(); } void MatchboxMEBase::setKinematics() { MEBase::setKinematics(); if ( theMerger ) theMerger->setKinematics(); } void MatchboxMEBase::clearKinematics() { MEBase::clearKinematics(); if ( theMerger ) theMerger->clearKinematics(); } const MergerBasePtr MatchboxMEBase::merger() const { return theMerger; } MergerBasePtr MatchboxMEBase::merger() { return theMerger; } void MatchboxMEBase::merger(MergerBasePtr v) { theMerger = v; } void MatchboxMEBase::print(ostream& os) const { os << "--- MatchboxMEBase setup -------------------------------------------------------\n"; os << " '" << name() << "' for subprocess:\n"; os << " "; for ( PDVector::const_iterator pp = subProcess().legs.begin(); pp != subProcess().legs.end(); ++pp ) { os << (**pp).PDGName() << " "; if ( pp == subProcess().legs.begin() + 1 ) os << "-> "; } os << "\n"; os << " including " << (oneLoop() ? "" : "no ") << "virtual corrections"; if ( oneLoopNoBorn() ) os << " without Born contributions"; if ( oneLoopNoLoops() ) os << " without loop contributions"; os << "\n"; if ( oneLoop() && !onlyOneLoop() ) { os << " using insertion operators\n"; for ( vector::ptr>::const_iterator v = virtuals().begin(); v != virtuals().end(); ++v ) { os << " '" << (**v).name() << "' with " << ((**v).isDR() ? "" : "C") << "DR/"; if ( (**v).isCS() ) os << "CS"; if ( (**v).isBDK() ) os << "BDK"; if ( (**v).isExpanded() ) os << "expanded"; os << " conventions\n"; } } os << "--------------------------------------------------------------------------------\n"; os << flush; } void MatchboxMEBase::printLastEvent(ostream& os) const { os << "--- MatchboxMEBase last event information --------------------------------------\n"; os << " for matrix element '" << name() << "'\n"; os << " process considered:\n "; int in = 0; for ( cPDVector::const_iterator p = mePartonData().begin(); p != mePartonData().end(); ++p ) { os << (**p).PDGName() << " "; if ( ++in == 2 ) os << " -> "; } os << " kinematic environment as set by the XComb " << lastXCombPtr() << ":\n" << " sqrt(shat)/GeV = " << sqrt(lastSHat()/GeV2) << " x1 = " << lastX1() << " x2 = " << lastX2() << " alphaS = " << lastAlphaS() << "\n"; os << " momenta/GeV generated from random numbers\n "; copy(lastXComb().lastRandomNumbers().begin(), lastXComb().lastRandomNumbers().end(),ostream_iterator(os," ")); os << ":\n "; for ( vector::const_iterator p = meMomenta().begin(); p != meMomenta().end(); ++p ) { os << (*p/GeV) << "\n "; } os << "last cross section/nb calculated was:\n " << (lastMECrossSection()/nanobarn) << " (pdf weight " << lastMEPDFWeight() << ")\n"; os << "--------------------------------------------------------------------------------\n"; os << flush; } void MatchboxMEBase::logGenerateKinematics(const double * r) const { if ( !verbose() ) return; generator()->log() << "'" << name() << "' generated kinematics\nfrom " << nDim() << " random numbers:\n"; copy(r,r+nDim(),ostream_iterator(generator()->log()," ")); generator()->log() << "\n"; generator()->log() << "storing phase space information in XComb " << lastXCombPtr() << "\n"; generator()->log() << "generated phase space point (in GeV):\n"; vector::const_iterator pit = meMomenta().begin(); cPDVector::const_iterator dit = mePartonData().begin(); for ( ; pit != meMomenta().end() ; ++pit, ++dit ) generator()->log() << (**dit).PDGName() << " : " << (*pit/GeV) << "\n"; generator()->log() << "with x1 = " << lastX1() << " x2 = " << lastX2() << "\n" << "and Jacobian = " << jacobian() << " sHat/GeV2 = " << (lastSHat()/GeV2) << "\n" << flush; } void MatchboxMEBase::logSetScale() const { if ( !verbose() ) return; generator()->log() << "'" << name() << "' set scales using XComb " << lastXCombPtr() << ":\n" << "scale/GeV2 = " << (scale()/GeV2) << " xi_R = " << renormalizationScaleFactor() << " xi_F = " << factorizationScaleFactor() << "\n" << "alpha_s = " << lastAlphaS() << "\n" << flush; } void MatchboxMEBase::logPDFWeight() const { if ( !verbose() ) return; generator()->log() << "'" << name() << "' calculated pdf weight = " << lastMEPDFWeight() << " from XComb " << lastXCombPtr() << "\n" << "x1 = " << lastX1() << " (" << (mePartonData()[0]->coloured() ? "" : "not ") << "used) " << "x2 = " << lastX2() << " (" << (mePartonData()[1]->coloured() ? "" : "not ") << "used)\n" << flush; } void MatchboxMEBase::logME2() const { if ( !verbose() ) return; generator()->log() << "'" << name() << "' evaluated me2 using XComb " << lastXCombPtr() << "\n" << "and phase space point (in GeV):\n"; vector::const_iterator pit = meMomenta().begin(); cPDVector::const_iterator dit = mePartonData().begin(); for ( ; pit != meMomenta().end() ; ++pit, ++dit ) generator()->log() << (**dit).PDGName() << " : " << (*pit/GeV) << "\n"; generator()->log() << "with x1 = " << lastX1() << " x2 = " << lastX2() << "\n" << "sHat/GeV2 = " << (lastSHat()/GeV2) << "\n" << flush; } void MatchboxMEBase::logDSigHatDR() const { if ( !verbose() ) return; generator()->log() << "'" << name() << "' evaluated cross section using XComb " << lastXCombPtr() << "\n" << "Jacobian = " << jacobian() << " sHat/GeV2 = " << (lastSHat()/GeV2) << " dsig/nb = " << (lastMECrossSection()/nanobarn) << "\n" << flush; } void MatchboxMEBase::cloneDependencies(const std::string& prefix,bool slim) { if ( phasespace() && !slim ) { Ptr::ptr myPhasespace = phasespace()->cloneMe(); ostringstream pname; pname << (prefix == "" ? fullName() : prefix) << "/" << myPhasespace->name(); if ( ! (generator()->preinitRegister(myPhasespace,pname.str()) ) ) throw Exception() << "MatchboxMEBase::cloneDependencies(): Phasespace generator " << pname.str() << " already existing." << Exception::runerror; myPhasespace->cloneDependencies(pname.str()); phasespace(myPhasespace); } theAmplitude = dynamic_ptr_cast::ptr>(amplitude()); if ( matchboxAmplitude() ) { Ptr::ptr myAmplitude = matchboxAmplitude()->cloneMe(); ostringstream pname; pname << (prefix == "" ? fullName() : prefix) << "/" << myAmplitude->name(); if ( ! (generator()->preinitRegister(myAmplitude,pname.str()) ) ){ throw Exception() << "MatchboxMEBase::cloneDependencies(): Amplitude " << pname.str() << " already existing." << Exception::runerror; } myAmplitude->cloneDependencies(pname.str(),slim); matchboxAmplitude(myAmplitude); amplitude(myAmplitude); matchboxAmplitude()->orderInGs(orderInAlphaS()); matchboxAmplitude()->orderInGem(orderInAlphaEW()); } if ( scaleChoice() &&!slim ) { Ptr::ptr myScaleChoice = scaleChoice()->cloneMe(); ostringstream pname; pname << (prefix == "" ? fullName() : prefix) << "/" << myScaleChoice->name(); if ( ! (generator()->preinitRegister(myScaleChoice,pname.str()) ) ) throw Exception() << "MatchboxMEBase::cloneDependencies(): Scale choice " << pname.str() << " already existing." << Exception::runerror; scaleChoice(myScaleChoice); } for ( auto & rw : theReweights ) { Ptr::ptr myReweight = rw->cloneMe(); ostringstream pname; pname << (prefix == "" ? fullName() : prefix) << "/" << rw->name(); if ( ! (generator()->preinitRegister(myReweight,pname.str()) ) ) throw Exception() << "MatchboxMEBase::cloneDependencies(): Reweight " << pname.str() << " already existing." << Exception::runerror; myReweight->cloneDependencies(pname.str()); rw = myReweight; } for ( auto & v : virtuals()) { Ptr::ptr myIOP = v->cloneMe(); ostringstream pname; pname << (prefix == "" ? fullName() : prefix) << "/" << v->name(); if ( ! (generator()->preinitRegister(myIOP,pname.str()) ) ) throw Exception() << "MatchboxMEBase::cloneDependencies(): Insertion operator " << pname.str() << " already existing." << Exception::runerror; v = myIOP; } } void MatchboxMEBase::prepareXComb(MatchboxXCombData& xc) const { // fixme We need to pass on the partons from the xcmob here, not // assuming one subprocess per matrix element if ( phasespace() ) xc.nDimPhasespace(phasespace()->nDim(diagrams().front()->partons())); if ( matchboxAmplitude() ) { xc.nDimAmplitude(matchboxAmplitude()->nDimAdditional()); if ( matchboxAmplitude()->colourBasis() ) { size_t cdim = matchboxAmplitude()->colourBasis()->prepare(diagrams(),noCorrelations()); xc.colourBasisDim(cdim); } if ( matchboxAmplitude()->isExternal() ) { xc.externalId(matchboxAmplitude()->externalId(diagrams().front()->partons())); } } int insertionAdd = 0; for ( auto const & v : virtuals() ) insertionAdd = max(insertionAdd,v->nDimAdditional()); xc.nDimInsertions(insertionAdd); xc.nLight(getNLight()); if(xc.nLightJetVec().empty()) for (auto const & id : getNLightJetVec()) xc.nLightJetVec( id ); if(xc.nHeavyJetVec().empty()) for (auto const & id :getNHeavyJetVec()) xc.nHeavyJetVec(id); if(xc.nLightProtonVec().empty()) for (auto const & id : getNLightProtonVec()) xc.nLightProtonVec(id); xc.olpId(olpProcess()); if ( initVerbose() ) { ostringstream fname_strm; // only allow alphanumeric, / and _ in filename for (const char c : name()) { switch (c) { case '+' : fname_strm << "+"; break; case '-' : fname_strm << "-"; break; case '~' : fname_strm << "_tilde"; break; case ']' : break; case ',' : fname_strm << "__"; break; default : fname_strm << (isalnum(c) ? c : '_'); break; } } fname_strm << ".diagrams"; const string fname = fname_strm.str(); ifstream test(fname.c_str()); if ( !test ) { test.close(); ofstream out(fname.c_str()); for ( vector::ptr>::const_iterator d = diagrams().begin(); d != diagrams().end(); ++d ) { DiagramDrawer::drawDiag(out,dynamic_cast(**d)); out << "\n"; } } } } StdXCombPtr MatchboxMEBase::makeXComb(Energy newMaxEnergy, const cPDPair & inc, tEHPtr newEventHandler,tSubHdlPtr newSubProcessHandler, tPExtrPtr newExtractor, tCascHdlPtr newCKKW, const PBPair & newPartonBins, tCutsPtr newCuts, const DiagramVector & newDiagrams, bool mir, const PartonPairVec&, tStdXCombPtr newHead, tMEPtr newME) { if ( !newME ) newME = this; Ptr::ptr xc = new_ptr(MatchboxXComb(newMaxEnergy, inc, newEventHandler, newSubProcessHandler, newExtractor, newCKKW, newPartonBins, newCuts, newME, newDiagrams, mir, newHead)); prepareXComb(*xc); return xc; } StdXCombPtr MatchboxMEBase::makeXComb(tStdXCombPtr newHead, const PBPair & newPartonBins, const DiagramVector & newDiagrams, tMEPtr newME) { if ( !newME ) newME = this; Ptr::ptr xc = new_ptr(MatchboxXComb(newHead, newPartonBins, newME, newDiagrams)); prepareXComb(*xc); return xc; } void MatchboxMEBase::persistentOutput(PersistentOStream & os) const { os << theLastXComb << thePhasespace << theAmplitude << theScaleChoice << theVirtuals << theReweights << theSubprocess << theOneLoop << theOneLoopNoBorn << theOneLoopNoLoops << epsilonSquarePoleHistograms << epsilonPoleHistograms << theMerger << theOLPProcess << theNoCorrelations << theHavePDFs << checkedPDFs; } void MatchboxMEBase::persistentInput(PersistentIStream & is, int) { is >> theLastXComb >> thePhasespace >> theAmplitude >> theScaleChoice >> theVirtuals >> theReweights >> theSubprocess >> theOneLoop >> theOneLoopNoBorn >> theOneLoopNoLoops >> epsilonSquarePoleHistograms >> epsilonPoleHistograms >> theMerger >> theOLPProcess >> theNoCorrelations >> theHavePDFs >> checkedPDFs; lastMatchboxXComb(theLastXComb); } void MatchboxMEBase::Init() { static ClassDocumentation documentation ("MatchboxMEBase is the base class for matrix elements " "in the context of the matchbox NLO interface."); } IBPtr MatchboxMEBase::clone() const { return new_ptr(*this); } IBPtr MatchboxMEBase::fullclone() const { return new_ptr(*this); } void MatchboxMEBase::doinit() { MEBase::doinit(); if ( !theAmplitude ) theAmplitude = dynamic_ptr_cast::ptr>(amplitude()); if ( matchboxAmplitude() ) matchboxAmplitude()->init(); if ( phasespace() ) { phasespace()->init(); matchboxAmplitude()->checkReshuffling(phasespace()); } if ( scaleChoice() ) { scaleChoice()->init(); } for (auto const & rw : theReweights) rw->init(); for (auto const & v : virtuals() ) v->init(); } void MatchboxMEBase::doinitrun() { MEBase::doinitrun(); if ( matchboxAmplitude() ) matchboxAmplitude()->initrun(); if ( phasespace() ) phasespace()->initrun(); if ( scaleChoice() ) scaleChoice()->initrun(); for (auto const & rw : theReweights) rw->initrun(); for (auto const & v : virtuals() ) v->initrun(); } void MatchboxMEBase::dofinish() { MEBase::dofinish(); for (auto const & b : epsilonSquarePoleHistograms ) { b.second.dump(factory()->poleData(),"epsilonSquarePoles-",b.first); } for (auto const & b : epsilonPoleHistograms ) { b.second.dump(factory()->poleData(),"epsilonPoles-",b.first); } } // *** 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 describeHerwigMatchboxMEBase("Herwig::MatchboxMEBase", "Herwig.so"); diff --git a/MatrixElement/Matchbox/External/MadGraph/mg2herwig.in b/MatrixElement/Matchbox/External/MadGraph/mg2herwig.in --- a/MatrixElement/Matchbox/External/MadGraph/mg2herwig.in +++ b/MatrixElement/Matchbox/External/MadGraph/mg2herwig.in @@ -1,389 +1,392 @@ #! /usr/bin/env python import os,sys,glob,errno,shutil,time,fnmatch,tempfile from optparse import OptionParser def mkdir_p(path): """Recursive mkdir""" if not os.path.isdir(path): os.makedirs(path) def finddirs(pattern, path): """Find all paths which contain a filename matching 'pattern'""" result = [ root for root, _, files in os.walk(path) if fnmatch.filter(files, pattern) ] return result # fill the proc.dat file from BornAmplitudes.dat and VirtAmplitudes.dat. def fillprocs(model,oras,orew): """Fill proc.dat from BornAmplitudes.dat and VirtAmplitudes.dat""" oras=int(oras) orew=int(orew) bornlist=[] virtlist=[] result = [] result.append('set fortran_compiler @FC@ --no_save') result.append("import model "+model) borns="BornAmplitudes.dat" virts="VirtAmplitudes.dat" procnr=0 virtlines=[] bornlines=[] # first pass to work out leg numbers minlegs=100 legs=0 for i in [borns, virts]: with open(i, "r") as f: for line in f: line = line.split(" ") N = len(line) if N < minlegs: minlegs = N for it in line: if it.replace("-","").isdigit(): legs += 1 #conversion for heft model to go from (2QCD+1QED)->1HIG for each FS HIGGS. if model=="heft": HIG = oras+orew-legs+2 if HIG % 2 == 0: HIG = HIG//2 else: sys.stderr.write("Warning: No possible coupling power:(int(oras)+int(orew)-legs+2)%2!=0\n") exit(1) else: HIG = 0 with open(borns, "r") as f: for i, line in enumerate(f): #this assumes extra QCD emmissions addalphas = len(line.split(" ")) - minlegs line = line.rstrip() procnr += 1 bornlist.append(str(procnr)) cmd = "generate " if i==0 else "add process" hig = "" qcd = oras+addalphas qed = orew if HIG: hig = "HIG=%s" % HIG qcd -= 2*HIG qed -= HIG bornlines.append("{cmd} {line} {hig} QCD<={qcd} QED<={qed} @{procnr}".format(**locals())) result.extend(bornlines) with open(virts, "r") as f: for i, line in enumerate(f): addalphas = len(line.split(" ")) - minlegs line = line.rstrip() procnr += 1 virtlist.append(str(procnr)) cmd = "generate " if i==0 else "add process" qcd = oras+addalphas qed = orew virtlines.append("{cmd} {line} QCD<={qcd} QED<={qed} [ virt=QCD ] @{procnr}".format(**locals())) if virtlines and bornlines: result.append("output matchbox MG5 --postpone_model") result.extend(virtlines) result.append("output matchbox MG5 -f\n") with open("proc.dat","w") as f: f.write('\n'.join(result)) return bornlist,virtlist def build_matchbox_tmp(pwd,buildpath,absolute_links): """Create the working directories and link the required files from central MG""" pwd = os.path.abspath(pwd) if not os.path.isabs(buildpath): buildpath = os.path.join(pwd,buildpath) resources =glob.glob(os.path.join(buildpath,"MG5","SubProcesses","MadLoop5_resources","*")) resources+=glob.glob(os.path.join(buildpath,"MG5","Cards","*")) resources+=glob.glob(os.path.join(buildpath,"MG5","Cards","SubProcesses","*")) for i in resources: f = os.path.join(MG_TMP, os.path.basename(i)) if not os.path.isfile(f) and not os.path.islink(f): if absolute_links: os.symlink(i,f) else: os.symlink(os.path.relpath(i,MG_TMP), f) parser = OptionParser() parser.add_option("-a", "--buildpath", dest="buildpath",help="Do not use this script. Only for Herwig internal use. ") parser.add_option("-b", "--build", action="store_true", dest="build", default=True,help="Do not use this script. Only for Herwig internal use.") parser.add_option("-c", "--madgraph", dest="madgraph",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-d", "--runpath", dest="runpath",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-e", "--model", dest="model",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-f", "--orderas", dest="orderas",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-g", "--orderew", dest="orderew",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-i", "--datadir",dest="datadir",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-I", "--includedir",dest="includedir",help="Do not use this script. Only for Herwig internal use.") parser.add_option("-l", "--absolute-links",action="store_true", dest="absolute_links", default=False,\ help="Do not use this script. Only for Herwig internal use.") parser.add_option("--cacheprefix", dest="cacheprefix",help="Do not use this script. Only for Herwig internal use.") (options, args) = parser.parse_args() if not options.cacheprefix: sys.stderr.write("Need a value for --cacheprefix\n") exit(1) cachedir = os.path.abspath(options.cacheprefix) mkdir_p(cachedir) #MG_TMP = tempfile.mkdtemp(prefix='MG_tmp_',dir=cachedir) MG_TMP = os.path.join(cachedir, 'MG_tmp') mkdir_p(MG_TMP) pwd=os.getcwd() param_card="" if options.model=="loop_sm" or options.model=="heft": if options.model=="loop_sm": param_card="param_card.dat" else: param_card="param_card_"+options.model+".dat" file = open("%s/MadGraphInterface/%s.in" % (options.datadir,param_card) , "r") paramcard = file.read() file.close() file = open(options.runpath+"/"+param_card, "w") params=open(options.runpath+"/MG-Parameter.dat", "r") for line in params: a=line.split() paramcard=paramcard.replace(a[0],a[1]) params.close() file.write(paramcard) file.close() elif options.model.startswith("/"): os.system("python %s/write_param_card.py " % options.model) else: print "---------------------------------------------------------------" print "---------------------------------------------------------------" print "Warning: The model set for the MadGraph Interface " print " needs a parameter setting by hand." print " Please fill the param_card_"+options.model+".dat" print " with your favourite assumptions." print " And make sure Herwig uses the same parameters." print "---------------------------------------------------------------" print "---------------------------------------------------------------" if os.path.isfile(options.buildpath +"/MG5/Cards/param_card.dat") and not os.path.isfile(options.runpath+"/"+"param_card_"+options.model+".dat"): shutil.copyfile(options.buildpath +"/MG5/Cards/param_card.dat", options.runpath+"/"+"param_card_"+options.model+".dat") time.sleep(1) if not os.path.isdir(options.buildpath): print "The MadGraph Install path did not exist. It has been created for you." print "Just start Herwig read again.." mkdir_p(options.buildpath) exit() os.chdir(options.buildpath) if os.path.isfile("InterfaceMadGraph.so"): build_matchbox_tmp(pwd,options.buildpath,options.absolute_links) exit() Bornlist,Virtlist=fillprocs(options.model,options.orderas,options.orderew) if not options.madgraph and not os.path.isfile("InterfaceMadGraph.so"): sys.stderr.write("*** MadGraph build failed, check logfile for details ***") exit(1) os.system("python "+options.madgraph+"/mg5_aMC proc.dat") def make_case_stmts(func): """Create Fortran case statements for all processes""" result = [] # add a case option for each item for i in Bornlist + list(set(Virtlist) - set(Bornlist)): if func == "SLOOPMATRIX(momenta,virt)" and i not in Virtlist: continue result.append(" CASE(%s)" % i) result.append(" CALL MG5_%s_%s" % (i,func)) # if we have anything, add header and footer if result: result.insert(0, " SELECT CASE (proc)") result.append(" CASE DEFAULT") result.append(" WRITE(*,*) '##W02A WARNING No id found '") result.append(" END SELECT ") return "\n".join(result) else: return "" def write_interfaceMG(): """Create the InterfaceMadGraph.f FORTRAN file""" subs = { "MG_CalculateBORNtxt" : make_case_stmts("BORN(momenta,hel)"), "MG_CalculateVIRTtxt" : make_case_stmts("SLOOPMATRIX(momenta,virt)"), "MG_Jamptxt" : make_case_stmts("GET_JAMP(color,Jamp)"), "MG_LNJamptxt" : make_case_stmts("GET_LNJAMP(color,Jamp)"), "MG_NColtxt" : make_case_stmts("GET_NCOL(color)"), "MG_ColourMattxt" : make_case_stmts("GET_NCOLOR(i,j,color)"), } baseN = 5 if subs["MG_CalculateVIRTtxt"] else 3 subs["MG_vxxxxxtxt"] = """\ subroutine MG_vxxxxx(p, n,inc,VC) $ bind(c, name='MG_vxxxxx') IMPLICIT NONE double precision p(0:3) double precision n(0:3) INTEGER inc double precision VC(0:7) double complex VCtmp({d}) call vxxxxx(p, 0d0,1,inc ,VCtmp) VC(0)= real(VCtmp({a})) VC(1)=aimag(VCtmp({a})) VC(2)= real(VCtmp({b})) VC(3)=aimag(VCtmp({b})) VC(4)= real(VCtmp({c})) VC(5)=aimag(VCtmp({c})) VC(6)= real(VCtmp({d})) VC(7)=aimag(VCtmp({d})) END """.format(a=baseN, b=baseN+1, c=baseN+2, d=baseN+3) fname = os.path.join( options.datadir, "MadGraphInterface", "InterfaceMadGraph.f.in" ) with open(fname, 'r') as f: tmp = f.read() with open("InterfaceMadGraph.f", 'w') as f: f.write(tmp.format(**subs)) write_interfaceMG() make=" " fortanfiles=glob.glob('*/*/*.f')+glob.glob('*/*/*/*.f') for i in fortanfiles: if "check_sa" not in i and "f2py_wrapper" not in i: if not os.path.islink(i): make += " "+i+"\\\n " incfiles=glob.glob('*/*/*.inc')+glob.glob('*/*/*/*.inc') coefdir="" for i in incfiles: if "nexternal.inc" in i: coefdir+=" -I"+i.replace("nexternal.inc"," ") file=open("makefile","w") file.write("include MG5/Source/make_opts ") if Virtlist!=[]: collierlib=options.madgraph collierlib=collierlib.replace("bin","HEPTools/collier") onelooplib=options.madgraph onelooplib=onelooplib.replace("bin","HEPTools/oneloop") file.write("\nLIBDIR = MG5/lib") file.write("\nLINKLIBS =-L$(LIBDIR) -lcts -liregi ") if (os.path.exists("MG5/lib/ninja_lib")): file.write("\nLINKLIBS += -L$(LIBDIR)/ninja_lib -lninja ") if (os.path.exists(collierlib)): file.write("\nLINKLIBS += -L%s -lcollier "%(collierlib)) if (os.path.exists(onelooplib)): file.write("\nLINKLIBS += -L%s -lavh_olo "%(onelooplib)) if (os.path.exists("MG5/lib/golem95_lib")): file.write("\nLINKLIBS += -L$(LIBDIR)/golem95_lib -lgolem") file.write("\nPROCESS= InterfaceMadGraph.f "+make+"\n\nall: \n\t @FC@ @FFLAGS@ -w -fbounds-check -ffixed-line-length-none -fPIC -fno-f2c -shared -s -o InterfaceMadGraph.so -IMG5/SubProcesses/" ) if Virtlist!=[]: if (os.path.exists("MG5/lib/golem95_include")): file.write(" -IMG5/lib/golem95_include ") if (os.path.exists("MG5/lib/ninja_include")): file.write(" -IMG5/lib/ninja_include ") incldir=options.madgraph.replace("bin","HEPTools/include") file.write(" -I%s -I./ "%incldir) # Find all .mod files also in /usr/include if golem was build there. # There can be an error message in the MadGraph output to add the golem include path to the makefiles. # Usually MadGraph finds the path if its Golem was build in an separate dictionary. # Our bootstrap script installs golem with gosam beside boost. Here MadGraph creates a link (->errormessage). # If we can find the modfiles easily the user doesn't need to change the makefiles. moddirs=finddirs('*.mod',options.includedir) for moddir in moddirs: file.write(" -I%s " % moddir) if os.path.isdir("/usr/include"): moddirs=finddirs('*.mod',"/usr/include") for moddir in moddirs: file.write(" -I%s " % moddir) if coefdir != "": file.write(coefdir) file.write(" $(PROCESS) $(LINKLIBS) ") file.close() def replacetext(filename, sourceText, replaceText): """Replace text in existing file.""" with open(filename, "r") as f: text = f.read() with open(filename, "w") as f: f.write(text.replace(sourceText, replaceText)) os.chdir(pwd) os.chdir(options.buildpath) -replacetext("MG5/Source/MODEL/lha_read.f", "ident_card.dat", os.path.join(MG_TMP,"ident_card.dat")) -replacetext("MG5/Source/MODEL/lha_read.f", "param.log", os.path.join(MG_TMP,"param.log")) + +replacetext("MG5/Source/MODEL/lha_read.f", "ident_card.dat", os.path.join(options.cacheprefix, + "MG_tmp","ident_card.dat")) +replacetext("MG5/Source/MODEL/lha_read.f", "param.log", os.path.join(options.cacheprefix, + "MG_tmp","param.log")) if Virtlist: replacetext("MG5/SubProcesses/MadLoopCommons.f", "PREFIX='./'", "PREFIX='%s'" % MG_TMP) os.system("make") if not os.path.isfile("InterfaceMadGraph.so"): print "Second trial to make MadGraph Interface. " print "Needed if new .mod files are produced by make." os.system("make") build_matchbox_tmp(pwd,options.buildpath,options.absolute_links) diff --git a/MatrixElement/Matchbox/Phasespace/Makefile.am b/MatrixElement/Matchbox/Phasespace/Makefile.am --- a/MatrixElement/Matchbox/Phasespace/Makefile.am +++ b/MatrixElement/Matchbox/Phasespace/Makefile.am @@ -1,72 +1,72 @@ noinst_LTLIBRARIES = libHwMatchboxPhasespace.la nodist_libHwMatchboxPhasespace_la_SOURCES = \ Phasespace__all.cc BUILT_SOURCES = Phasespace__all.cc CLEANFILES = Phasespace__all.cc Phasespace__all.cc : $(DIR_H_FILES) $(DIR_CC_FILES) Makefile @echo "Concatenating .cc files into $@" @$(top_srcdir)/cat_with_cpplines $(DIR_CC_FILES) > $@ EXTRA_DIST = $(ALL_H_FILES) $(ALL_CC_FILES) DIR_H_FILES = $(addprefix $(srcdir)/,$(ALL_H_FILES)) ALL_H_FILES = \ FFLightInvertedTildeKinematics.h \ FFLightTildeKinematics.h \ FFMassiveInvertedTildeKinematics.h \ FFMassiveTildeKinematics.h \ FILightInvertedTildeKinematics.h \ FILightTildeKinematics.h \ FIMassiveInvertedTildeKinematics.h \ FIMassiveTildeKinematics.h \ IFLightInvertedTildeKinematics.h \ IFLightTildeKinematics.h \ IFMassiveInvertedTildeKinematics.h \ IFMassiveTildeKinematics.h \ IILightInvertedTildeKinematics.h \ IILightTildeKinematics.h \ InvertedTildeKinematics.fh \ InvertedTildeKinematics.h \ MatchboxPhasespace.h \ MatchboxRambo.h \ PhasespaceHelpers.h \ RandomHelpers.h \ TildeKinematics.fh \ TildeKinematics.h \ TreePhasespace.h \ TreePhasespaceChannels.h \ MatchboxReference.h \ FlatInvertiblePhasespace.h \ FlatInvertibleLabframePhasespace.h \ -PhasespaceCouplings.h +PhasespaceCouplings.h DIR_CC_FILES = $(addprefix $(srcdir)/,$(ALL_CC_FILES)) ALL_CC_FILES = \ FFLightInvertedTildeKinematics.cc \ FFLightTildeKinematics.cc \ FFMassiveInvertedTildeKinematics.cc \ FFMassiveTildeKinematics.cc \ FILightInvertedTildeKinematics.cc \ FILightTildeKinematics.cc \ FIMassiveInvertedTildeKinematics.cc \ FIMassiveTildeKinematics.cc \ IFLightInvertedTildeKinematics.cc \ IFLightTildeKinematics.cc \ IFMassiveInvertedTildeKinematics.cc \ IFMassiveTildeKinematics.cc \ IILightInvertedTildeKinematics.cc \ IILightTildeKinematics.cc \ InvertedTildeKinematics.cc \ MatchboxPhasespace.cc \ MatchboxRambo.cc \ PhasespaceHelpers.cc \ TildeKinematics.cc \ TreePhasespace.cc \ TreePhasespaceChannels.cc \ MatchboxReference.cc \ FlatInvertiblePhasespace.cc \ FlatInvertibleLabframePhasespace.cc \ PhasespaceCouplings.cc diff --git a/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.cc b/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.cc --- a/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.cc +++ b/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.cc @@ -1,563 +1,571 @@ // -*- C++ -*- // // PhasespaceHelpers.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #include "PhasespaceHelpers.h" #include "Herwig/MatrixElement/Matchbox/Phasespace/RandomHelpers.h" using namespace Herwig; using namespace Herwig::PhasespaceHelpers; using namespace Herwig::RandomHelpers; Energy PhasespaceInfo::generateMass(tcPDPtr data, const pair& range) { double xlow = sqr(range.first)/sHat; if ( range.first < ZERO ) xlow = -xlow; double xup = sqr(range.second)/sHat; if ( range.second < ZERO ) xup = -xup; double mu = sqr(data->hardProcessMass())/sHat; double gamma = sqr(data->hardProcessWidth())/sHat; if ( gamma < 1e-14 ) gamma = 0.0; if ( M0 != ZERO ) x0 = M0/sqrtSHat; if ( Mc != ZERO ) xc = Mc/sqrtSHat; double r = rnd(); pair event; if ( gamma == 0. ) { if ( mu < xlow || mu > xup ) { if ( abs(xlow-mu) < xc ) xlow = mu; if ( abs(xup-mu) < xc ) xup = mu; } if ( mu < xlow || mu > xup ) { event = generate(inverse(mu,xlow,xup),r); } else { pair pLeft(xlow,xlow < mu-x0 ? mu-x0 : xlow); pair pRight(xup > mu+x0 ? mu+x0 : xup,xup); pair fLeft(pLeft.second < mu-x0 ? mu-x0 : pLeft.second,mu-xc); if ( fLeft.first >= fLeft.second ) fLeft.first = fLeft.second; pair fRight(mu+xc,pRight.first > mu+x0 ? mu+x0 : pRight.first); if ( fRight.first >= fRight.second ) fRight.second = fRight.first; const bool pL= abs( pLeft.first - pLeft.second ) < 1e-14; const bool fL= abs( fLeft.first - fLeft.second ) < 1e-14; const bool fR= abs( fRight.first - fRight.second ) < 1e-14; const bool pR= abs( pRight.first - pRight.second ) < 1e-14; if ( !pL && !fL && !fR && !pR ) { event = generate((piecewise(), inverse(mu,pLeft.first,pLeft.second), match(flat(fLeft.first,fLeft.second))) + match((piecewise(), flat(fRight.first,fRight.second), match(inverse(mu,pRight.first,pRight.second)))), r); } else if ( pL && !fL && !fR && !pR ) { event = generate(flat(fLeft.first,fLeft.second) + match((piecewise(), flat(fRight.first,fRight.second), match(inverse(mu,pRight.first,pRight.second)))), r); } else if ( !pL && !fL && !fR && pR ) { event = generate((piecewise(), inverse(mu,pLeft.first,pLeft.second), match(flat(fLeft.first,fLeft.second))) + match(flat(fRight.first,fRight.second)), r); } else if ( pL && fL && !fR && !pR ) { event = generate((piecewise(),flat(fRight.first,fRight.second), match(inverse(mu,pRight.first,pRight.second))), r); } else if ( !pL && !fL && fR && pR ) { event = generate((piecewise(), inverse(mu,pLeft.first,pLeft.second), match(flat(fLeft.first,fLeft.second))),r); } else if ( pL && !fL && !fR && pR ) { event = generate(flat(fLeft.first,fLeft.second) + match(flat(fRight.first,fRight.second)),r); } else if ( pL && fL && !fR && pR ) { event = generate(flat(fRight.first,fRight.second),r); } else if ( pL && !fL && fR && pR ) { event = generate(flat(fLeft.first,fLeft.second),r); } else if ( pL && fL && fR && pR ) { throw Veto(); } else assert(false); } } else { event = generate(breitWigner(mu,gamma,xlow,xup),r); } if ( abs(event.first) < xc ) throw Veto(); weight *= event.second; Energy res = sqrt(abs(event.first)*sHat); if ( event.first < 0. ) res = -res; return res; } Lorentz5Momentum PhasespaceInfo::generateKt(const Lorentz5Momentum& p1, const Lorentz5Momentum& p2, Energy pt) { double phi = 2.*Constants::pi*rnd(); weight *= 2.*Constants::pi; Lorentz5Momentum P = p1 + p2; Energy2 Q2 = abs(P.m2()); Lorentz5Momentum Q = Lorentz5Momentum(ZERO,ZERO,ZERO,sqrt(Q2),sqrt(Q2)); bool boost = abs((P-Q).vect().mag2()/GeV2) > 1e-8 || abs((P-Q).t()/GeV) > 1e-4; boost &= (P*Q-Q.mass2())/GeV2 > 1e-8; Lorentz5Momentum inFrame1; if ( boost ) inFrame1 = p1 + ((P*p1-Q*p1)/(P*Q-Q.mass2()))*(P-Q); else inFrame1 = p1; Energy ptx = inFrame1.x(); Energy pty = inFrame1.y(); Energy q = 2.*inFrame1.z(); Energy Qp = sqrt(4.*(sqr(ptx)+sqr(pty))+sqr(q)); Energy Qy = sqrt(4.*sqr(pty)+sqr(q)); double cPhi = cos(phi); double sPhi = sqrt(1.-sqr(cPhi)); if ( phi > Constants::pi ) sPhi = -sPhi; Lorentz5Momentum kt; kt.setT(ZERO); kt.setX(pt*Qy*cPhi/Qp); kt.setY(-pt*(4*ptx*pty*cPhi/Qp+q*sPhi)/Qy); kt.setZ(2.*pt*(-ptx*q*cPhi/Qp + pty*sPhi)/Qy); if ( boost ) kt = kt + ((P*kt-Q*kt)/(P*Q-Q.mass2()))*(P-Q); kt.setMass(-pt); kt.rescaleRho(); return kt; } void PhasespaceTree::setup(const Tree2toNDiagram& diag, int pos) { doMirror = false; pair dchildren = diag.children(pos); data = diag.allPartons()[pos]; spacelike = pos < diag.nSpace(); if ( pos == 0 ) externalId = 0; if ( dchildren.first == -1 ) { externalId = diag.externalId(pos); leafs.insert(externalId); return; } children.push_back(PhasespaceTree()); children.back().setup(diag,dchildren.first); children.push_back(PhasespaceTree()); children.back().setup(diag,dchildren.second); if ( !children[0].children.empty() && children[1].children.empty() && !spacelike ) swap(children[0],children[1]); if ( spacelike && !children[0].spacelike ) swap(children[0],children[1]); copy(children[0].leafs.begin(),children[0].leafs.end(), inserter(leafs,leafs.begin())); copy(children[1].leafs.begin(),children[1].leafs.end(), inserter(leafs,leafs.begin())); } void PhasespaceTree::setupMirrored(const Tree2toNDiagram& diag, int pos) { doMirror = true; spacelike = pos < diag.nSpace(); pair dchildren; if (pos != 0 && spacelike) dchildren = {diag.parent(pos), diag.children(diag.parent(pos)).second}; else if ( !spacelike ) dchildren = diag.children(pos); else dchildren = {-1,-1}; data = diag.allPartons()[pos]; if ( pos == diag.nSpace() - 1 ) externalId = 1; if ( dchildren.first == -1 ) { externalId = diag.externalId(pos); leafs.insert(externalId); return; } children.push_back(PhasespaceTree()); children.back().setupMirrored(diag,dchildren.first); children.push_back(PhasespaceTree()); children.back().setupMirrored(diag,dchildren.second); if ( !children[0].children.empty() && children[1].children.empty() && !spacelike ) swap(children[0],children[1]); if ( spacelike && !children[0].spacelike ) { assert (false); } copy(children[0].leafs.begin(),children[0].leafs.end(), inserter(leafs,leafs.begin())); copy(children[1].leafs.begin(),children[1].leafs.end(), inserter(leafs,leafs.begin())); } void PhasespaceTree::print(int in) { for (int i = 0; i != in; i++) cerr << " "; cerr << " |- " << data->PDGName() << " " << externalId << "\n" << flush; if ( !children.empty() ) { children[1].print(in+1); children[0].print(in+int(!spacelike)); } else { cerr << "\n"; } } void PhasespaceTree::init(const vector& meMomenta) { if ( children.empty() ) { massRange.first = meMomenta[externalId].mass(); massRange.second = massRange.first; if ( !doMirror && externalId == 1 ) momentum = meMomenta[1]; if ( doMirror && externalId == 0 ) momentum = meMomenta[0]; momentum.setMass(meMomenta[externalId].mass()); return; } children[0].init(meMomenta); children[1].init(meMomenta); if ( !children[0].spacelike && !children[1].spacelike ) { massRange.first = children[0].massRange.first + children[1].massRange.first; } } void PhasespaceTree::generateKinematics(PhasespaceInfo& info, vector& meMomenta) { if ( !doMirror && externalId == 0 ) { init(meMomenta); - momentum = meMomenta[0]; + Energy2 s = (meMomenta[0]+meMomenta[1]).m2(); + double sign = meMomenta[0].z() >= ZERO ? 1. : -1; + momentum = Lorentz5Momentum(ZERO,ZERO,sign*sqrt(s)/2.,sqrt(s)/2.,ZERO); + backwardMomentum = Lorentz5Momentum(ZERO,ZERO,-sign*sqrt(s)/2.,sqrt(s)/2.,ZERO); } else if ( doMirror && externalId == 1) { init(meMomenta); - momentum = meMomenta[1]; + Energy2 s = (meMomenta[0]+meMomenta[1]).m2(); + double sign = meMomenta[0].z() >= ZERO ? 1. : -1; + momentum = Lorentz5Momentum(ZERO,ZERO,-sign*sqrt(s)/2.,sqrt(s)/2.,ZERO); + backwardMomentum = Lorentz5Momentum(ZERO,ZERO,sign*sqrt(s)/2.,sqrt(s)/2.,ZERO); } if ( children.empty() ) { if ( ( !doMirror && externalId != 1 ) || ( doMirror && externalId !=0 ) ) meMomenta[externalId] = momentum; return; } // s-channel if ( ( !doMirror && externalId == 0 && children[0].externalId == 1 ) || ( doMirror && externalId == 1 && children[0].externalId == 0 ) ) { children[1].momentum = meMomenta[0] + meMomenta[1]; children[1].momentum.setMass(info.sqrtSHat); children[1].momentum.rescaleEnergy(); children[1].generateKinematics(info,meMomenta); return; } if ( !spacelike ) { Energy mij = momentum.mass(); Energy mi,mj; // work out the mass for the first child if ( !children[0].children.empty() ) { Energy sumOthers = ZERO; for ( size_t k = 2; k < meMomenta.size(); ++k ) if ( children[1].leafs.find(k) != children[1].leafs.end() ) sumOthers += meMomenta[k].mass(); children[0].massRange.second = momentum.mass() - sumOthers; if ( children[0].massRange.second < children[0].massRange.first ) throw Veto(); if ( children[0].massRange.second > momentum.mass() ) throw Veto(); mi = info.generateMass(children[0].data,children[0].massRange); children[0].momentum.setMass(mi); } else { mi = children[0].momentum.mass(); } // work out the mass for the second child if ( !children[1].children.empty() ) { children[1].massRange.second = momentum.mass()-children[0].momentum.mass(); if ( children[1].massRange.second < children[1].massRange.first ) throw Veto(); mj = info.generateMass(children[1].data,children[1].massRange); children[1].momentum.setMass(mj); } else { mj = children[1].momentum.mass(); } Energy2 mij2 = sqr(mij); Energy2 mi2 = sqr(mi); Energy2 mj2 = sqr(mj); // perform the decay Energy4 lambda2 = sqr(mij2-mi2-mj2)-4.*mi2*mj2; if ( lambda2 <= ZERO ) throw Veto(); Energy2 lambda = sqrt(lambda2); double phi = 2.*Constants::pi*info.rnd(); double cosPhi = cos(phi); double sinPhi = sqrt(1.-sqr(cosPhi)); if ( phi > Constants::pi ) sinPhi = -sinPhi; info.weight *= Constants::pi*lambda/(2.*mij2); double cosTheta = 2.*info.rnd() - 1.; double sinTheta = sqrt(1.-sqr(cosTheta)); Energy p = lambda/(2.*mij); children[0].momentum.setX(p*cosPhi*sinTheta); children[0].momentum.setY(p*sinPhi*sinTheta); children[0].momentum.setZ(p*cosTheta); children[0].momentum.rescaleEnergy(); if ( momentum.m2() <= ZERO ) throw Veto(); Boost out = momentum.boostVector(); if ( out.mag2() > Constants::epsilon ) { children[0].momentum.boost(out); } children[1].momentum = momentum - children[0].momentum; children[1].momentum.setMass(mj); children[1].momentum.rescaleEnergy(); // go on with next branchings children[0].generateKinematics(info,meMomenta); children[1].generateKinematics(info,meMomenta); return; } // get the minimum mass of the `W' system Energy Wmin = ZERO; PhasespaceTree* current = &children[0]; while ( !(current->children.empty()) ) { Wmin += current->children[1].massRange.first; current = &(current->children[0]); } // get the CM energy avaialble - Energy2 s = (momentum+meMomenta[int(!doMirror)]).m2(); + Energy2 s = (momentum+backwardMomentum).m2(); if ( s <= ZERO ) throw Veto(); // generate a mass for the timelike child Energy mi; if ( !children[1].children.empty() ) { children[1].massRange.second = sqrt(s)-Wmin; if ( children[1].massRange.second < children[1].massRange.first ) throw Veto(); mi = info.generateMass(children[1].data,children[1].massRange); children[1].momentum.setMass(mi); } else { mi = children[1].momentum.mass(); } Energy2 mi2 = sqr(mi); // wether or not this is the last 2->2 scatter bool lastScatter = children[0].children[0].children.empty(); // `W' mass relevant for the other boundaries Energy MW = Wmin; // generate a mass for second outgoing leg, if needed if ( lastScatter ) if ( !children[0].children[1].children.empty() ) { // get the maximum `W' mass Energy Wmax = sqrt(s)-children[1].momentum.mass(); children[0].children[1].massRange.second = Wmax; if ( children[0].children[1].massRange.second < children[0].children[1].massRange.first ) throw Veto(); MW = info.generateMass(children[0].children[1].data, children[0].children[1].massRange); children[0].children[1].momentum.setMass(MW); } Energy2 MW2 = sqr(MW); Energy ma = momentum.mass(); Energy2 ma2 = sqr(ma); if ( ma < ZERO ) ma2 = -ma2; - Energy mb = meMomenta[int(!doMirror)].mass(); + Energy mb = backwardMomentum.mass(); Energy2 mb2 = sqr(mb); + if ( mb < ZERO ) + mb2 = -mb2; // pick the ys variable Energy2 ys = ZERO; if ( !lastScatter ) { ys = info.rnd()*(sqr(sqrt(s)-mi)-MW2); info.weight *= (sqr(sqrt(s)-mi)-MW2)/info.sHat; } Energy4 lambda2 = sqr(s-ma2-mb2)-4.*ma2*mb2; if ( lambda2 <= ZERO ) { throw Veto(); } Energy2 lambda = sqrt(lambda2); info.weight *= info.sHat/(4.*lambda); // get the boundaries on the momentum transfer Energy4 rho2 = sqr(s-ys-MW2-mi2)-4.*mi2*(ys+MW2); if ( rho2 < ZERO ) throw Veto(); Energy2 rho = sqrt(rho2); Energy4 tau2 = ys*(ma2-mb2+s) - sqr(s)+s*(ma2+mb2+mi2+MW2)-(mi2-MW2)*(ma2-mb2); pair tBounds ((tau2-rho*lambda)/(2.*s),(tau2+rho*lambda)/(2.*s)); children[0].massRange.first = sqrt(abs(tBounds.first)); if ( tBounds.first < ZERO ) children[0].massRange.first = -children[0].massRange.first; children[0].massRange.second = sqrt(abs(tBounds.second)); if ( tBounds.second < ZERO ) children[0].massRange.second = -children[0].massRange.second; // generate a momentum transfer Energy mai = info.generateMass(children[0].data,children[0].massRange); children[0].momentum.setMass(mai); Energy2 t = sqr(mai); if ( mai < ZERO ) t = -t; Energy2 u = -s -t + ys + ma2 + mb2 + mi2 + MW2; Energy2 st = s - ma2 - mb2; Energy2 tt = t - mi2 - ma2; Energy2 ut = u - mi2 - mb2; // get the timelike momentum double xa = (-st*ut+2.*mb2*tt)/lambda2; double xb = (-st*tt+2.*ma2*ut)/lambda2; Energy2 pt2 = (st*tt*ut-ma2*sqr(ut)-mb2*sqr(tt)-mi2*sqr(st)+4.*ma2*mb2*mi2)/lambda2; if ( pt2 < ZERO ) throw Veto(); Energy pt = sqrt(pt2); children[1].momentum = - xa*momentum + xb*meMomenta[int(!doMirror)] - + info.generateKt(momentum,meMomenta[int(!doMirror)],pt); + xa*momentum + xb*backwardMomentum + + info.generateKt(momentum,backwardMomentum,pt); children[1].momentum.setMass(mi); children[1].momentum.rescaleEnergy(); children[0].momentum = momentum - children[1].momentum; children[0].momentum.setMass(mai); bool changeSign = false; if ( children[0].momentum.t() < ZERO && mai > ZERO ) changeSign = true; if ( mai < ZERO ) children[0].momentum.rescaleRho(); else children[0].momentum.rescaleEnergy(); if ( changeSign ) children[0].momentum.setT(-children[0].momentum.t()); children[1].generateKinematics(info,meMomenta); if ( !lastScatter ) { children[0].generateKinematics(info,meMomenta); } else { children[0].children[1].momentum = - meMomenta[int(!doMirror)] + children[0].momentum; + backwardMomentum + children[0].momentum; children[0].children[1].momentum.setMass(MW); children[0].children[1].momentum.rescaleEnergy(); children[0].children[1].generateKinematics(info,meMomenta); } } void PhasespaceTree::put(PersistentOStream& os) const { os << children.size(); if ( !children.empty() ) { children[0].put(os); children[1].put(os); } os << data << externalId << leafs << spacelike << doMirror; } void PhasespaceTree::get(PersistentIStream& is) { size_t nc; is >> nc; assert(nc == 0 || nc == 2); if ( nc == 2 ) { children.resize(2,PhasespaceTree()); children[0].get(is); children[1].get(is); } is >> data >> externalId >> leafs >> spacelike >> doMirror; } diff --git a/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.h b/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.h --- a/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.h +++ b/MatrixElement/Matchbox/Phasespace/PhasespaceHelpers.h @@ -1,189 +1,194 @@ // -*- C++ -*- // // PhasespaceHelpers.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_PhasespaceHelpers_H #define HERWIG_PhasespaceHelpers_H #include "ThePEG/Config/ThePEG.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h" namespace Herwig { using namespace ThePEG; namespace PhasespaceHelpers { /** * \ingroup Matchbox * \author Simon Platzer * \brief General information for phase space generation */ struct PhasespaceInfo { /** * The center of mass energy squared. */ Energy2 sHat; /** * The center of mass energy. */ Energy sqrtSHat; /** * The phase space weight. */ double weight; /** * The random number generator. */ StreamingRnd rnd; /** * Parameter steering from which on propagator virtualities are * sampled flat. */ double x0; /** * Parameter steering at which virtuality singularities of * propagators are actually cut off. */ double xc; /** * Parameter steering from which on propagator virtualities are * sampled flat. */ Energy M0; /** * Parameter steering at which virtuality singularities of * propagators are actually cut off. */ Energy Mc; /** * Generate a mass for the given particle type and mass range. */ Energy generateMass(tcPDPtr, const pair&); /** * Calculate a transverse momentum for the given momenta, * invariant pt and azimuth. */ Lorentz5Momentum generateKt(const Lorentz5Momentum& p1, const Lorentz5Momentum& p2, Energy pt); }; /** * \ingroup Matchbox * \author Simon Platzer, Ken Arnold * \brief A phase space tree. */ struct PhasespaceTree { /** * Default constructor */ PhasespaceTree() : massRange(ZERO,ZERO), externalId(-1), spacelike(false) {} /** * The particle running along this line. */ tcPDPtr data; /** * The allowed mass range for this line. */ pair massRange; /** * The momentum running along this line. */ Lorentz5Momentum momentum; /** + * A backward momentum, if needed + */ + Lorentz5Momentum backwardMomentum; + + /** * The external leg id of this line, if external. */ int externalId; /** * The children lines; if empty this is an external line. */ vector children; /** * External lines originating from this line. */ set leafs; /** * Wether or not this is a spacelike line. */ bool spacelike; /** * Wether or not this is a mirrored channel. */ bool doMirror; /** * Setup from diagram at given position. */ void setup(const Tree2toNDiagram&, int pos = 0); /** * Setup mirror from diagram at given position. */ void setupMirrored(const Tree2toNDiagram& diag, int pos); /** * Initialize using masses as given by mass() members of the * final state momenta */ void init(const vector&); /** * Generate kinematics for the children */ void generateKinematics(PhasespaceInfo&, vector&); /** * Write phase space tree to ostream */ void put(PersistentOStream&) const; /** * Read phase space tree from istream */ void get(PersistentIStream&); /** * Print tree, only for debugging purposes */ void print(int in = 0); }; } } #endif // HERWIG_PhasespaceHelpers_H diff --git a/PDF/HwRemDecayer.cc b/PDF/HwRemDecayer.cc --- a/PDF/HwRemDecayer.cc +++ b/PDF/HwRemDecayer.cc @@ -1,1537 +1,1967 @@ // -*- C++ -*- // // HwRemDecayer.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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/Utilities/DescribeClass.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 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::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 || lastID == ParticleID::gamma) ) { 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, lastID!=ParticleID::gamma ? ParticleID::g : ParticleID::gamma, 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); return; } else if( lastID == ParticleID::gamma) { partners.push_back(make_pair(parton, newValence)); anti = newValence->hasAntiColour(); ColinePtr newLine(new_ptr(ColourLine())); newLine->addColoured(newValence, anti); 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; } //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 partons, pair pdfs, bool first) { if(theRems.first) { ParticleVector children=theRems.first->children(); for(unsigned int ix=0;ixdataPtr()==theRems.first->dataPtr()) theRems.first = dynamic_ptr_cast(children[ix]); } } if(theRems.second) { ParticleVector children=theRems.second->children(); for(unsigned int ix=0;ixdataPtr()==theRems.second->dataPtr()) theRems.second = dynamic_ptr_cast(children[ix]); } } // forced splitting for first parton if(isPartonic(partons.first )) { try { split(partons.first, theContent.first, theRems.first, theUsed.first, theMaps.first, pdfs.first, first); } catch(ShowerHandler::ExtraScatterVeto) { throw ShowerHandler::ExtraScatterVeto(); } } // forced splitting for second parton if(isPartonic(partons.second)) { 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; iychildren().size(); ++iy) pnew[0] += theRems.first->children()[iy]->momentum(); for(unsigned int iy=0; iychildren().size(); ++iy) pnew[1] += theRems.second->children()[iy]->momentum(); Lorentz5Momentum ptotal= theRems.first ->momentum()-partons.first ->momentum()+ theRems.second->momentum()-partons.second->momentum(); // add x limits 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(); theX.second -= partons.second->momentum().rho()/ parent(theRems.second)->momentum().rho(); 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(); //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); // There is already a colour line (not the final diquark) if(clnew){ 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->coloured()) pold = prev->second; else 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 { static const double eps=1e-6; // 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; unsigned int ntry=0,maxtry=100; double xExtracted = rem==theRems.first ? theX.first : theX.second; double zmin= lastx/(1.-xExtracted) ,zmax,yy; if(1-lastx ids; if(child==21||child==22) { ids=content.flav; for(unsigned int ix=0;ix > > partonprob; double ptotal(0.); for(unsigned int iflav=0;iflav prob; for(unsigned int iz=0;izvalue(sqr(max(wz*q,_kinCutoff))) : _alphaEM->value(sqr(max(wz*q,_kinCutoff))); double az=wz*zz*coup; // 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 > >::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(;izsecond.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 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]; - int remid = theprocessed[0] ? theContent.first.RemID() : theContent.second.RemID(); Lorentz5Momentum deltap(rem->momentum()); // find the diquark and momentum we still need in the energy tPPtr diquark; vector progenitors; for(unsigned int ix=0;ixchildren().size();++ix) { - if(rem->children()[ix]->id()!=remid) { + 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 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;ixchildren().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 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 psystem.mass() + diquark->mass()) --iloc; if(iloc==progenitors.size()) { // try touching the lepton in dis as a last restort for(unsigned int ix=0;ixmomentum(); ptotal = psystem + deltap; ptotal.rescaleMass(); psystem.rescaleMass(); ++iloc; } --iloc; if(ptotal.mass() > psystem.mass() + diquark->mass()) { if(DISRemnantOpt_==0||DISRemnantOpt_==2) Throw() << "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;iychildren().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;iychildren().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; + << Exception::runerror; + + //ofstream myfile2("softPt.txt", ios::app ); + //myfile2 << pt2/GeV2 <<" "<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; } //parton mass Energy mp; if(quarkPair_){ mp = getParticleData(ParticleID::u)->constituentMass(); }else{ mp = mg_; } //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())); double x1; if(!multiPeriph_){ //now generate according to 1/x x_g1 = xmin * exp(UseRandom::rnd(log(x1max/xmin))); x_g2 = xmin * exp(UseRandom::rnd(log(x2max/xmin))); }else{ if(valOfN_==0) return; double param = (1/(2*valOfN_+1))*initTotRap_; do{ // need 1-x instead of x to get the proper final momenta x1 = UseRandom::rndGauss(gaussWidth_, 1 - (exp(param)-1)/exp(param)); }while(x1 < 0 || x1>=1.0); x_g1 = x1max*x1; x_g2 = x2max*x1; } 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(mp); ig2.setMass(mp); ig1.rescaleEnergy(); ig2.rescaleEnergy(); cmf = ig1 + ig2; //boost vector from cmf to lab Boost boostv(cmf.boostVector()); - //outgoing gluons in cmf g1.setMass(mp); g2.setMass(mp); 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(mp) - sqr(pt); + pz2 = cmf.m2()/4 - sqr(mp) - (pt*pt); - if(pz2/GeV2 < 0.0){ + if( pz2/GeV2 < 0.0 ){ if(dbg) cerr << "EXCEPTION not enough energy...." << endl; throw ExtraSoftScatterVeto(); } if(!multiPeriph_){ - if(UseRandom::rndbool()) + if(UseRandom::rndbool()){ pz = sqrt(pz2); - else - pz = -sqrt(pz2); + + }else + pz = -sqrt(pz2); }else{ - pz = pz2 > ZERO ? sqrt(pz2) : ZERO; + pz = pz2 > ZERO ? sqrt(pz2) : ZERO; + } if(dbg) - cerr << "pz has been calculated to: " << pz/GeV << endl; + cerr << "pz1 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; - + r1 -= g1; + r2 -= g2; + 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_old(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 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 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); + + // case 2: +oldrems.first->colourLine(anti.first) + ->addColoured(gluons.second,anti.second); +cl2->addColoured(softRems_.first, anti.second); + cl2->addColoured(gluons.second, !anti.second); + + + oldrems.first->colourLine(anti.first) + ->addColoured(gluons.second,anti.second); + oldrems.second->colourLine(anti.second) + ->addColoured(gluons.first,anti.first); + + cl1->addColoured(softRems_.second, anti.first); cl1->addColoured(gluons.first, !anti.first); - cl2->addColoured(softRems_.second, anti.second); + cl2->addColoured(softRems_.first, anti.second); cl2->addColoured(gluons.second, !anti.second); - } - //reset counter tries = 1; } if(dbg) cerr << "generated " << i << "th soft scatters\n"; } +// Solve the reshuffling equation to rescale the remnant momenta +double bisectReshuffling(const vector& particles, + Energy w, + double target = -16., double maxLevel = 80.) { + double level = 0; + double left = 0; + double right = 1; + + double check = -1.; + double xi = -1; + + while ( level < maxLevel ) { + + xi = (left+right)*pow(0.5,level+1.); + check = 0.; + for (vector::const_iterator p = particles.begin(); p != particles.end(); ++p){ + check += sqrt(sqr(xi)*((*p)->momentum().vect().mag2())+sqr((*p)->mass()))/w; + } + + if ( check==1. || log10(abs(1.-check)) <= target ) + break; + + left *= 2.; + right *= 2.; + + if ( check >= 1. ) { + right -= 1.; + ++level; + } + + if ( check < 1. ) { + left += 1.; + ++level; + } + + } + return xi; + +} + +LorentzRotation HwRemDecayer::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; +} + +struct vectorSort{ + bool operator() (Lorentz5Momentum i,Lorentz5Momentum j) {return(i.rapidity() < j.rapidity());} +} ySort; + + + void HwRemDecayer::doSoftInteractions_multiPeriph(unsigned int N) { if(N == 0) return; int Nmpi = N; + for(int j=0;jmaximumCMEnergy()); - double reference = sqr(energy/TeV); - double ladderMult_; + //double reference = sqr(energy/TeV); + // double ladderMult_; // Parametrization of the ladder multiplicity - ladderMult_ = ladderNorm_ * pow( ( reference ) , ladderPower_ ); + // ladderMult_ = ladderNorm_ * pow( ( reference ) , ladderPower_ ); - - int avgN = floor(ladderMult_*log((softRems_.first->momentum() - +softRems_.second->momentum()).m()/mg_) + ladderbFactor_); + double avgN = 2.*ladderMult_*log((softRems_.first->momentum() + +softRems_.second->momentum()).m()/mg_) + ladderbFactor_; initTotRap_ = abs(softRems_.first->momentum().rapidity()) +abs(softRems_.second->momentum().rapidity()); - //generate the poisson distribution with mean avgN - double L = exp(-double(avgN)); - int k = 0; - double p = 1; - do { - k++; - p *= UseRandom::rnd(); - } while( p > L); - N=k-1; - + // Generate the poisson distribution with mean avgN + N=UseRandom::rndPoisson(avgN); + valOfN_=N; - if(N == 0) return; + if(N <= 1){ + // j--; //TODO: Do we want to make all Nmpi soft MPIs? + // Compare to MaxTryMPI for hard mpis. + continue; + } 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, q1, q2; - //intermediate gluons; erased in if there is - //another step - Lorentz5Momentum gint1, gint2; + // The remnants + PPtr rem1 = softRems_.first; + PPtr rem2 = softRems_.second; + // Vector for the ladder particles + vector ladderMomenta; + // Remnant momenta + Lorentz5Momentum r1(softRems_.first->momentum()), r2(softRems_.second->momentum()); + Lorentz5Momentum cm =r1+r2; + + // Initialize partons in the ladder + // The toy masses are needed for the correct calculation of the available energy + Lorentz5Momentum sumMomenta; + for(unsigned int i = 0; i < N; i++) { + + // choose constituents + Energy newMass = ZERO; + Energy toyMass; + if(i<2){ + // u and d have the same mass so its enough to use u + toyMass = getParticleData(ParticleID::u)->constituentMass(); + } + else{ + toyMass = getParticleData(ParticleID::g)->constituentMass(); + } + Lorentz5Momentum cp(ZERO,ZERO,ZERO,newMass,newMass); + // dummy container for the momentum that is used for momentum conservation + Lorentz5Momentum dummy(ZERO,ZERO,ZERO,toyMass,toyMass); + ladderMomenta.push_back(cp); + sumMomenta+=dummy; + } + + // Get the beam energy + tcPPair beam(generator()->currentEventHandler()->currentCollision()->incoming()); + Lorentz5Momentum P1(beam.first->momentum()), P2(beam.second->momentum()); + + // Calculate available energy for the partons + double x1,x2; + double param = (1./(valOfN_+1.))*initTotRap_; + do{ + // Need 1-x instead of x to get the proper final momenta + // TODO: physical to use different x's (see comment below) + x1 = UseRandom::rndGauss( gaussWidth_ , exp(-param) ); + // x2 = UseRandom::rndGauss( gaussWidth_ , exp(-param) ); + }while(x1 < 0 || x1>=1.0); // x2 < 0 || x2>=1.0); + + // Remnants 1 and 2 need to be rescaled later by this amount + Lorentz5Momentum ig1 = x1*r1; + Lorentz5Momentum ig2 = x1*r2; //TODO: x2*r2 + // requires boost of Ladder in x1/x2-dependent + // frame. + + // The available energy that is used to generate the ladder + // sumMomenta is the the sum of rest masses of the ladder partons + // the available energy goes all into the kinematics + Energy availableEnergy = (ig1+ig2).m() - sumMomenta.m(); - //momenta of the gluon pair generated in - //each step - vector< pair > gluonMomPairs; - //momenta of remnants - Lorentz5Momentum r1(softRems_.first->momentum()), r2(softRems_.second->momentum()); - - unsigned int tries(1), i(0); - //generate the momenta of particles in the ladder - for(i = 0; i < N; i++){ - //check how often this scattering has been regenerated - //and break if exeeded maximal number - if(tries > maxtrySoft_) break; - - if(dbg){ - cerr << "new try \n" << *softRems_.first << *softRems_.second << endl; + // If not enough energy then continue + // The available energy has to be larger then the rest mass of the remnants + if ( availableEnergy < ZERO ) { + // j--; //TODO: Do we want to make all Nmpi soft MPIs? + continue; + } + + unsigned int its(0); + // Generate the momenta of the partons in the ladder + if ( !(doPhaseSpaceGenerationGluons(ladderMomenta,availableEnergy,its)) ){ + // j--; //TODO: Do we want to make all Nmpi soft MPIs? + continue; + } + // Add gluon mass and rescale + Lorentz5Momentum totalMomPartons; + Lorentz5Momentum totalMassLessPartons; + + // Sort the ladder partons according to their rapidity and then choose which ones will be the quarks + sort(ladderMomenta.begin(),ladderMomenta.end(),ySort); + + int countPartons=0; + long quarkID=0; + // Choose between up and down quarks + int choice = UseRandom::rnd2(1,1); + switch (choice) { + case 0: quarkID = ParticleID::u; break; + case 1: quarkID = ParticleID::d; break; + } + + for (auto &p:ladderMomenta){ + totalMomPartons+=p; + // Set the mass of the gluons and the two quarks in the ladder + if(countPartons==0 || countPartons==(ladderMomenta.size()-1)){ + p.setMass( getParticleData(quarkID)->constituentMass() ); + }else{ + p.setMass( getParticleData(ParticleID::g)->constituentMass() ); + } + p.rescaleEnergy(); + countPartons++; + } + + // Continue if energy conservation is violated + if ( abs(availableEnergy - totalMomPartons.m()) > 1e-8*GeV){ + // j--; //TODO: Do we want to make all Nmpi soft MPIs? + continue; + } + + // Boost momenta into CM frame + const Boost boostv(-totalMomPartons.boostVector()); + Lorentz5Momentum totalMomentumAfterBoost; + for ( unsigned int i=0; i remnants; + rem1->set5Momentum(r1); + rem2->set5Momentum(r2); + remnants.push_back(rem1); + remnants.push_back(rem2); + + vector reshuffledRemnants; + Lorentz5Momentum totalMomentumAll; + + // Bisect reshuffling for rescaling of remnants + double xi_remnants = bisectReshuffling(remnants,remainingEnergy); + + // Rescale remnants + for ( auto &rems: remnants ) { + Lorentz5Momentum reshuffledMomentum; + reshuffledMomentum = xi_remnants*rems->momentum(); + + reshuffledMomentum.setMass(getParticleData(softRems_.first->id())->constituentMass()); + reshuffledMomentum.rescaleEnergy(); + reshuffledMomentum.boost(-boostvR); + rems->set5Momentum(reshuffledMomentum); + totalMomentumAll+=reshuffledMomentum; + } + // Then the other particles + for ( auto &p:ladderMomenta ) { + p.boost(-boostvR); + totalMomentumAll+=p; + } + + // Do the colour connections + // Original rems are the ones which are connected to other parts of the event + PPair oldRems_ = softRems_; + + pair anti = make_pair(oldRems_.first->hasAntiColour(), + oldRems_.second->hasAntiColour()); + + // Replace first remnant + softRems_.first = addParticle(softRems_.first, softRems_.first->id(), + remnants[0]->momentum()); + + // Connect the old remnant to the new remnant + oldRems_.first->colourLine(anti.first)->addColoured(softRems_.first, anti.first); + // Replace second remnant + softRems_.second = addParticle(softRems_.second, softRems_.second->id(), + remnants[1]->momentum()); + // This connects the old remnants to the new remnants + oldRems_.second->colourLine(anti.second)->addColoured(softRems_.second, anti.second); + // Add all partons to the first remnant for the event record + vector partons; + int count=0; + + // Choose the colour connections and position of quark antiquark + // Choose between R1-q-g..g-qbar-R2 or R1-qbar-g...g-q-R2 + // (place of quark antiquarks in the ladder) + int quarkPosition = UseRandom::rnd2(1,1); + + for (auto &p:ladderMomenta){ + + if(p.mass()==getParticleData(ParticleID::u)->constituentMass()){ + if(count==0){ + if(quarkPosition==0){ + partons.push_back(addParticle(softRems_.first, quarkID, p)); + count++; + }else{ + partons.push_back(addParticle(softRems_.first, -quarkID, p)); + count++; + } + }else{ + if(quarkPosition==0){ + partons.push_back(addParticle(softRems_.first, -quarkID, p)); + }else{ + partons.push_back(addParticle(softRems_.first, quarkID, p)); + } + } + }else{ + partons.push_back(addParticle(softRems_.first, ParticleID::g, p)); + } + softRems_.first = addParticle(softRems_.first, softRems_.first->id(), + softRems_.first->momentum()); + + + oldRems_.first->colourLine(anti.first)->addColoured(softRems_.first, anti.first); + + } + + + // Need to differenciate between the two quark positions, this defines the + // colour connections to the new remnants and old remnants + if(quarkPosition==0){ + // ladder self contained + if(partons.size()==2){ + ColinePtr clq = new_ptr(ColourLine()); + clq->addColoured(partons[0]); + clq->addAntiColoured(partons[1]); + } + + ColinePtr clfirst = new_ptr(ColourLine()); + ColinePtr cllast = new_ptr(ColourLine()); + + if(partons.size()>2){ + clfirst->addColoured(partons[0]); + clfirst->addAntiColoured(partons[1]); + cllast->addAntiColoured(partons[partons.size()-1]); + cllast->addColoured(partons[partons.size()-2]); + //now the remaining gluons + for (unsigned int i=1; iaddColoured(partons[i]); + cl->addAntiColoured(partons[i+1]); + } + } + } else { + if(partons.size()==2){ + ColinePtr clq = new_ptr(ColourLine()); + clq->addAntiColoured(partons[0]); + clq->addColoured(partons[1]); + } + + ColinePtr clfirst = new_ptr(ColourLine()); + ColinePtr cllast = new_ptr(ColourLine()); + + if(partons.size()>2){ + clfirst->addAntiColoured(partons[0]); + clfirst->addColoured(partons[1]); + cllast->addColoured(partons[partons.size()-1]); + cllast->addAntiColoured(partons[partons.size()-2]); + //now the remaining gluons + for (unsigned int i=1; iaddAntiColoured(partons[i]); + cl->addColoured(partons[i+1]); + } + } + }// end colour connection loop + + }// end Nmpi loop + + +}//end function + +// Do the phase space generation here is 1 to 1 the same from UA5 model +bool HwRemDecayer::doPhaseSpaceGenerationGluons(vector &softGluons, Energy CME, unsigned int &its) + const{ + + // Define the parameters + unsigned int _maxtries = 300; + + double alog = log(CME*CME/GeV2); + unsigned int ncl = softGluons.size(); + // calculate the slope parameters for the different clusters + // outside loop to save time + vector mom(ncl); + + // Sets the slopes depending on the constituent quarks of the cluster + for(unsigned int ix=0;ix remnant + quark - softKinematics(r1, r2, q1, q2); - }else if(i==1){ - - //generated pair is gluon-gluon - quarkPair_ = false; - //second splitting; quark -> quark + gluon - softKinematics(q1, q2, g1, g2); - //record generated gluon pair - gluonMomPairs.push_back(make_pair(g1,g2)); - + // generate the momenta + double eps = 1e-10/double(ncl); + vector xi(ncl); + vector tempEnergy(ncl); + Energy sum1(ZERO); + double yy(0.); + + // We want to make sure that the first Pt is from the + // desired pt-distribution. If we select the first pt in the + // trial loop we introduce a bias. + Energy firstPt=softPt(); + + while(its < _maxtries) { + ++its; + Energy sumx = ZERO; + Energy sumy = ZERO; + unsigned int iterations(0); + unsigned int _maxtriesNew = 100; + while(iterations < _maxtriesNew) { + iterations++; + Energy sumxIt = ZERO; + Energy sumyIt = ZERO; + bool success=false; + Energy pTmax=ZERO; + for(unsigned int i = 0; ipT2...pTN + //2) pT1>pT2>..>pTN + //3) flat + //4) y dependent + //5) Frist then flat + int triesPt=0; + Energy pt; + Energy ptTest; + switch(PtDistribution_) { + case 0: //default softPt() + pt=softPt(); + break; + case 1: //pTordered + if(i==0){ + pt=softPt(); + pTmax=pt; + }else{ + do{ + pt=softPt(); + }while(pt>pTmax); + } + break; + case 2: //strongly pT ordered + if ( i==0 ) { + pt=softPt(); + pTmax=pt; + } else { + do { + if ( triesPt==20 ) { + pt=pTmax; + break; + } + pt=softPt(); + triesPt++; + } while ( pt>pTmax ); + pTmax=pt; + } + break; + case 3: //flat + pt = UseRandom::rnd(0.0,(double)(ptmin_/GeV))*GeV; + break; + case 4: //flat below first pT + if ( i==0 ) { + pt = firstPt; + } else { + pt = firstPt * UseRandom::rnd(); + } + break; + case 5: //flat but rising below first pT + if ( i==0 ) { + pt=firstPt; + } else { + pt = firstPt * pow(UseRandom::rnd(),1/2); + } + + + } + + Energy2 ptp = pt*pt; + if(ptp <= ZERO) pt = - sqrt(-ptp); + else pt = sqrt(ptp); + // randomize azimuth + Energy px,py; + //randomize the azimuth, but the last one should cancel all others + if(i gluon+gluon - //but, the previous gluon gets deleted - quarkPair_ = false; - //save first the previous gluon momentum - g1=gluonMomPairs.back().first; - g2=gluonMomPairs.back().second; - //split gluon momentum - softKinematics(g1, g2, gint1, gint2); - - //erase the last entry - gluonMomPairs.pop_back(); - - //add new gluons - gluonMomPairs.push_back(make_pair(g1,g2)); - gluonMomPairs.push_back(make_pair(gint1,gint2)); + //calculate azimuth angle s.t + // double factor; + Energy pTdummy; + pTdummy = sqrt(sumxIt*sumxIt+sumyIt*sumyIt); + if( pTdummy < ptmin_ ){ + px=-sumxIt; + py=-sumyIt; + mom[i].setX(px); + mom[i].setY(py); + + sumxIt+=px; + sumyIt+=py; + sumx = sumxIt; + sumy = sumyIt; + success=true; } - }catch(ExtraSoftScatterVeto){ - tries++; - i--; - continue; + } } - //reset counter - tries = 1; + if(success){ + break; + } + } + sumx /= ncl; + sumy /= ncl; + // find the sum of the transverse mass + Energy sumtm=ZERO; + for(unsigned int ix = 0; ix CME) continue; + + + // randomize the mom vector to get the first and the compensating parton + // at all possible positions: + long (*p_irnd)(long) = UseRandom::irnd; + random_shuffle(mom.begin(),mom.end(),p_irnd); + + + for(unsigned int i = 0; 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 100) eps *= 10.; } - //if no gluons discard the ladder - if(gluonMomPairs.size()==0) return; - - if(dbg) - cerr << "generated " << i << "th soft scatters\n"; - - //gluons from previous step - PPair oldgluons; - //quark-antiquark pair - PPair quarks; - //colour direction of quark-antiquark (true if anticolour) - pair anti_q; - //generate particles (quark-antiquark and gluons) in the - //ladder from momenta generated above - for(i = 0; i <= gluonMomPairs.size(); i++){ - //remnants before splitting - PPair oldrems = softRems_; - //current gluon pair - PPair gluons; - - //add quarks - if(i==0){ - quarks = make_pair(addParticle(softRems_.first, ParticleID::u, q1), - addParticle(softRems_.second, ParticleID::ubar, q2)); - anti_q = make_pair(quarks.first->hasAntiColour(), - quarks.second->hasAntiColour()); - } - - - - if(i>0){ - - gluons = make_pair(addParticle(softRems_.first, ParticleID::g, - gluonMomPairs[i-1].first), - addParticle(softRems_.second, ParticleID::g, - gluonMomPairs[i-1].second)); - } - - //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); - - - //colour direction of remnats - pair anti = make_pair(oldrems.first->hasAntiColour(), - oldrems.second->hasAntiColour()); - - - - ColinePtr cl1 = new_ptr(ColourLine()); - ColinePtr cl2 = new_ptr(ColourLine()); - //first colour connect remnants and if no - //gluons the quark-antiquark pair - if(i==0){ - oldrems.first->colourLine(anti.first)->addColoured(softRems_.first, - anti.first); - oldrems.second->colourLine(anti.second)->addColoured(softRems_.second, - anti.second); - if(gluonMomPairs.size()==0){ - ColinePtr clq = new_ptr(ColourLine()); - clq->addColoured(quarks.first, anti_q.first); - clq->addColoured(quarks.second, anti_q.second); - } - }//colour connect remnants from previous step and gluons to quarks or gluons - if(i!=0){ - oldrems.first->colourLine(anti.first)->addColoured(softRems_.first, - anti.first); - oldrems.second->colourLine(anti.second)->addColoured(softRems_.second, - anti.second); - if(i==1){ - cl1->addColoured(quarks.first, anti_q.first); - cl1->addColoured(gluons.first, !anti_q.first); - cl2->addColoured(quarks.second, anti_q.second); - cl2->addColoured(gluons.second, !anti_q.second); - }else{ - cl1->addColoured(oldgluons.first, anti_q.first); - cl1->addColoured(gluons.first, !anti_q.first); - cl2->addColoured(oldgluons.second, anti_q.second); - cl2->addColoured(gluons.second, !anti_q.second); - } - - } //last step; connect last gluons - if(i > 0 && i == gluonMomPairs.size()){ - ColinePtr clg = new_ptr(ColourLine()); - clg->addColoured(gluons.first, anti_q.first); - clg->addColoured(gluons.second, anti_q.second); - } - - - //save gluons for the next step - if(i < gluonMomPairs.size()) oldgluons = gluons; + if(its==_maxtries){ + return false; } - - //////// +// throw Exception() << "Can't generate soft underlying event in " +// << "UA5Handler::generateCylindricalPS" +// << Exception::eventerror; + double zz = log(CME/sum1); + for(unsigned int i = 0; iDiquark 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 & particles) const { if(part->children().empty()) particles.push_back(part); else { for(unsigned int ix=0;ixchildren().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 << _alphaS << _alphaEM << DISRemnantOpt_ - << maxtrySoft_ << colourDisrupt_ << ladderPower_<< ladderNorm_ << ladderbFactor_ << pomeronStructure_ + << maxtrySoft_ << colourDisrupt_ << ladderPower_<< ladderNorm_ << ladderMult_ << ladderbFactor_ << pomeronStructure_ << ounit(mg_,GeV) << ounit(ptmin_,GeV) << ounit(beta_,sqr(InvGeV)) - << allowTop_ << multiPeriph_ << valOfN_ << initTotRap_; + << allowTop_ << multiPeriph_ << valOfN_ << initTotRap_ << PtDistribution_; } void HwRemDecayer::persistentInput(PersistentIStream & is, int) { is >> iunit(_kinCutoff, GeV) >> _range >> _zbin >> _ybin >> _nbinmax >> _alphaS >> _alphaEM >> DISRemnantOpt_ - >> maxtrySoft_ >> colourDisrupt_ >> ladderPower_ >> ladderNorm_ >> ladderbFactor_ >> pomeronStructure_ + >> maxtrySoft_ >> colourDisrupt_ >> ladderPower_ >> ladderNorm_ >> ladderMult_ >> ladderbFactor_ >> pomeronStructure_ >> iunit(mg_,GeV) >> iunit(ptmin_,GeV) >> iunit(beta_,sqr(InvGeV)) - >> allowTop_ >> multiPeriph_ >> valOfN_ >> initTotRap_; + >> allowTop_ >> multiPeriph_ >> valOfN_ >> initTotRap_ >> PtDistribution_; } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigHwRemDecayer("Herwig::HwRemDecayer", "HwShower.so"); void HwRemDecayer::Init() { static ClassDocumentation documentation ("The HwRemDecayer class decays the remnant for Herwig"); static Parameter 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 interfaceMaxBin ("MaxBin", "Maximum number of z bins", &HwRemDecayer::_nbinmax, 100, 10, 1000, false, false, Interface::limited); static Reference interfaceAlphaS ("AlphaS", "Pointer to object to calculate the strong coupling", &HwRemDecayer::_alphaS, false, false, true, false, false); static Reference interfaceAlphaEM ("AlphaEM", "Pointer to object to calculate the electromagnetic coupling", &HwRemDecayer::_alphaEM, false, false, true, false, false); static Parameter 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 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 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 interfaceMaxTrySoft ("MaxTrySoft", "The maximum number of regeneration attempts for an additional soft scattering", &HwRemDecayer::maxtrySoft_, 10, 0, 100, false, false, Interface::limited); static Parameter 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 Parameter interaceladderPower ("ladderPower", "The power factor in the ladder parameterization.", &HwRemDecayer::ladderPower_, 1.0, -5.0, 10.0, false, false, Interface::limited); static Parameter interfaceladderNorm ("ladderNorm", "The normalization factor in the ladder parameterization", &HwRemDecayer::ladderNorm_, 1.0, 0.0, 10.0, false, false, Interface::limited); - + static Parameter interfaceladderMult + ("ladderMult", + "The ladder multiplicity factor ", + &HwRemDecayer::ladderMult_, + 1.0, 0.0, 10.0, + false, false, Interface::limited); + static Parameter interfaceladderbFactor ("ladderbFactor", "The additive factor in the multiperipheral ladder multiplicity.", &HwRemDecayer::ladderbFactor_, 1.0, 0.0, 10.0, false, false, Interface::limited); static Parameter interfacegaussWidth ("gaussWidth", "The gaussian width of the fluctuation of longitudinal momentum fraction.", &HwRemDecayer::gaussWidth_, 0.1, 0.0, 1.0, false, false, Interface::limited); static Switch 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); static Switch interfaceAllowTop ("AllowTop", "Allow top quarks in the hadron", &HwRemDecayer::allowTop_, false, false, false); static SwitchOption interfaceAllowTopNo (interfaceAllowTop, "No", "Don't allow them", false); static SwitchOption interfaceAllowTopYes (interfaceAllowTop, "Yes", "Allow them", true); static Switch interfaceMultiPeriph ("MultiPeriph", "Use multiperipheral kinematics", &HwRemDecayer::multiPeriph_, false, false, false); static SwitchOption interfaceMultiPeriphNo (interfaceMultiPeriph, "No", "Don't use multiperipheral", false); static SwitchOption interfaceMultiPeriphYes (interfaceMultiPeriph, "Yes", "Use multiperipheral kinematics", true); + static Switch interfacePtDistribution + ("PtDistribution", + "Options for different pT generation methods", + &HwRemDecayer::PtDistribution_, 0, false, false); + static SwitchOption interfacePtDistributionDefault + (interfacePtDistribution, + "Default", + "Default generation of pT", + 0); + static SwitchOption interfacePtDistributionOrdered + (interfacePtDistribution, + "Ordered", + "Ordered generation of pT,where the first pT is the hardest", + 1); + static SwitchOption interfacePtDistributionStronglyOrdered + (interfacePtDistribution, + "StronglyOrdered", + "Strongly ordered generation of pT", + 2); + static SwitchOption interfacePtDistributionFlat + (interfacePtDistribution, + "Flat", + "Sample from a flat pT distribution", + 3); + static SwitchOption interfacePtDistributionFlatOrdered + (interfacePtDistribution, + "FlatOrdered", + "First pT normal, then flat", + 4); + static SwitchOption interfacePtDistributionFlatOrdered2 + (interfacePtDistribution, + "FlatOrdered2", + "First pT normal, then flat but steep", + 5); } bool HwRemDecayer::canHandle(tcPDPtr particle, tcPDPtr parton) const { if(! (StandardQCDPartonMatcher::Check(*parton) || parton->id()==ParticleID::gamma) ) { if(abs(parton->id())==ParticleID::t) { if(!allowTop_) throw Exception() << "Top is not allow as a parton in the remant handling, please " << "use a PDF which does not contain top for the remnant" << " handling (preferred) or allow top in the remnant using\n" << " set " << fullName() << ":AllowTop Yes\n" << Exception::runerror; } else return false; } return HadronMatcher::Check(*particle) || particle->id()==ParticleID::gamma || particle->id()==ParticleID::pomeron || particle->id()==ParticleID::reggeon; } bool HwRemDecayer::isPartonic(tPPtr parton) const { if(parton->parents().empty()) return false; tPPtr parent = parton->parents()[0]; bool partonic = false; for(unsigned int ix=0;ixchildren().size();++ix) { if(dynamic_ptr_cast(parent->children()[ix])) { partonic = true; break; } } return partonic; } diff --git a/PDF/HwRemDecayer.h b/PDF/HwRemDecayer.h --- a/PDF/HwRemDecayer.h +++ b/PDF/HwRemDecayer.h @@ -1,665 +1,747 @@ // -*- C++ -*- // // HwRemDecayer.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_HwRemDecayer_H #define HERWIG_HwRemDecayer_H // // This is the declaration of the HwRemDecayer class. // #include "ThePEG/PDT/RemnantDecayer.h" #include "ThePEG/Handlers/EventHandler.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/EventRecord/SubProcess.h" #include "ThePEG/PDF/BeamParticleData.h" #include "Herwig/Shower/ShowerAlpha.h" #include "Herwig/PDT/StandardMatchers.h" #include "ThePEG/PDT/StandardMatchers.h" #include "HwRemDecayer.fh" namespace Herwig { using namespace ThePEG; /** * The HwRemDecayer class is responsible for the decay of the remnants. Additional * secondary scatters have to be evolved backwards to a gluon, the * first/hard interaction has to be evolved back to a valence quark. * This is all generated inside this class, * which main methods are then called by the ShowerHandler. * * A simple forced splitting algorithm is used. * This takes the Remnant object produced from the PDF and backward * evolution (hadron - parton) and produce partons with the remaining * flavours and with the correct colour connections. * * The algorithim operates by starting with the parton which enters the hard process. * If this is from the sea there is a forced branching to produce the antiparticle * from a gluon branching. If the parton entering the hard process was a gluon, or * a gluon was produced from the first step of the algorithm, there is then a further * branching back to a valence parton. After these partons have been produced a quark or * diquark is produced to give the remaining valence content of the incoming hadron. * * The forced branching are generated using a scale between QSpac and EmissionRange times * the minimum scale. The energy fractions are then distributed using * \f[\frac{\alpha_S}{2\pi}\frac{P(z)}{z}f(x/z,\tilde{q})\f] * with the massless splitting functions. * * \author Manuel B\"ahr * * @see \ref HwRemDecayerInterfaces "The interfaces" * defined for HwRemDecayer. */ class HwRemDecayer: public RemnantDecayer { public: /** Typedef to store information about colour partners */ typedef vector > PartnerMap; public: /** * The default constructor. */ HwRemDecayer() : allowTop_(false), multiPeriph_(false), quarkPair_(false), ptmin_(-1.*GeV), beta_(ZERO), maxtrySoft_(10), colourDisrupt_(1.0), ladderbFactor_(0.0), ladderPower_(-0.08), ladderNorm_(1.0), + ladderMult_(1.0), gaussWidth_(0.1), valOfN_(0), initTotRap_(0), _kinCutoff(0.75*GeV), _forcedSplitScale(2.5*GeV), _range(1.1), _zbin(0.05),_ybin(0.), _nbinmax(100), DISRemnantOpt_(0), + PtDistribution_(0), pomeronStructure_(0), mg_(ZERO) {} /** @name Virtual functions required by the Decayer class. */ //@{ /** * Check if this decayer can perfom the decay specified by the * given decay mode. * @return true if this decayer can handle the given mode, otherwise false. */ virtual bool accept(const DecayMode &) const { return true; } /** * Return true if this decayer can handle the extraction of the \a * extracted parton from the given \a particle. */ virtual bool canHandle(tcPDPtr particle, tcPDPtr parton) const; /** * Return true if this decayed can extract more than one parton from * a particle. */ virtual bool multiCapable() const { return true; } /** * Perform a decay for a given DecayMode and a given Particle instance. * @param dm the DecayMode describing the decay. * @param p the Particle instance to be decayed. * @param step the step we are working on. * @return a ParticleVector containing the decay products. */ virtual ParticleVector decay(const DecayMode & dm, const Particle & p, Step & step) const; //@} public: /** * struct that is used to catch exceptions which are thrown * due to energy conservation issues of additional soft scatters */ struct ExtraSoftScatterVeto {}; /** @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(); /** * Do several checks and initialization, for remnantdecay inside ShowerHandler. */ void initialize(pair rems, tPPair beam, Step & step, Energy forcedSplitScale); /** * Initialize the soft scattering machinery. * @param ptmin = the pt cutoff used in the UE model * @param beta = slope of the soft pt-spectrum */ void initSoftInteractions(Energy ptmin, InvEnergy2 beta); /** * Perform the acual forced splitting. * @param partons is a pair of ThePEG::Particle pointers which store the final * partons on which the shower ends. * @param pdfs are pointers to the pdf objects for both beams * @param first is a flage wether or not this is the first or a secondary interation */ void doSplit(pair partons, pair pdfs, bool first); /** * Perform the final creation of the diquarks. Set the remnant masses and do * all colour connections. * @param colourDisrupt = variable to control how many "hard" scatters * are colour isolated * @param softInt = parameter for the number of soft scatters */ void finalize(double colourDisrupt=0.0, unsigned int softInt=0); /** * Find the children */ void findChildren(tPPtr,vector &) 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() { Interfaced::doinit(); _ybin=0.25/_zbin; mg_ = getParticleData(ParticleID::g)->constituentMass(); } //@} private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ - HwRemDecayer & operator=(const HwRemDecayer &) = delete; + HwRemDecayer & operator=(const HwRemDecayer &); public: /** * Simple struct to store info about baryon quark and di-quark * constituents. */ struct HadronContent { /** * manually extract the valence flavour \a id. */ inline void extract(int id) { for(unsigned int i=0; iid() == ParticleID::gamma || (hadron->id() == ParticleID::pomeron && pomeronStructure==1) || hadron->id() == ParticleID::reggeon) { flav[0] = id; flav[1] = -id; extracted = 0; flav.resize(2); } else if (hadron->id() == ParticleID::pomeron && pomeronStructure==0) { extracted = 0; } else { extracted = i; } break; } } } /** * Return a proper particle ID assuming that \a id has been removed * from the hadron. */ long RemID() const; /** * Method to determine whether \a parton is a quark from the sea. * @return TRUE if \a parton is neither a valence quark nor a gluon. */ bool isSeaQuark(tcPPtr parton) const { return ((parton->id() != ParticleID::g) && ( !isValenceQuark(parton) ) ); } /** * Method to determine whether \a parton is a valence quark. */ bool isValenceQuark(tcPPtr parton) const { return isValenceQuark(parton->id()); } /** * Method to determine whether \a parton is a quark from the sea. * @return TRUE if \a parton is neither a valence quark nor a gluon. */ bool isSeaQuarkData(tcPDPtr partonData) const { return ((partonData->id() != ParticleID::g) && ( !isValenceQuarkData(partonData) ) ); } /** * Method to determine whether \a parton is a valence quark. */ bool isValenceQuarkData(tcPDPtr partonData) const { int id(sign*partonData->id()); return find(flav.begin(),flav.end(),id) != flav.end(); } /** * Method to determine whether \a parton is a valence quark. */ bool isValenceQuark(int id) const { return find(flav.begin(),flav.end(),sign*id) != flav.end(); } /** The valence flavours of the corresponding baryon. */ vector flav; /** The array index of the extracted particle. */ int extracted; /** -1 if the particle is an anti-particle. +1 otherwise. */ int sign; /** The ParticleData objects of the hadron */ tcPDPtr hadron; /** Pomeron treatment */ unsigned int pomeronStructure; }; /** * Return the hadron content objects for the incoming particles. */ const pair& content() const { return theContent; } /** * Return a HadronContent struct from a PPtr to a hadron. */ HadronContent getHadronContent(tcPPtr hadron) const; /** * Set the hadron contents. */ void setHadronContent(tPPair beam) { theContent.first = getHadronContent(beam.first); theContent.second = getHadronContent(beam.second); } private: /** * Do the forced Splitting of the Remnant with respect to the * extracted parton \a parton. * @param parton = PPtr to the parton going into the subprocess. * @param content = HadronContent struct to keep track of flavours. * @param rem = Pointer to the ThePEG::RemnantParticle. * @param used = Momentum vector to keep track of remaining momenta. * @param partners = Vector of pairs filled with tPPtr to the particles * which should be colour connected. * @param pdf pointer to the PDF Object which is used for this particle * @param first = Flag for the first interaction. */ void split(tPPtr parton, HadronContent & content, tRemPPtr rem, Lorentz5Momentum & used, PartnerMap & partners, tcPDFPtr pdf, bool first); /** * Merge the colour lines of two particles * @param p1 = Pointer to particle 1 * @param p2 = Pointer to particle 2 * @param anti = flag to indicate, if (anti)colour was extracted as first parton. */ void mergeColour(tPPtr p1, tPPtr p2, bool anti) const; /** * Set the colour connections. * @param partners = Object that holds the information which particles to connect. * @param anti = flag to indicate, if (anti)colour was extracted as first parton. * @param disrupt parameter for disruption of the colour structure */ void fixColours(PartnerMap partners, bool anti, double disrupt) const; /** * Set the momenta of the Remnants properly and boost the decay particles. */ void setRemMasses() const; /** * This creates a parton from the remaining flavours of the hadron. The * last parton used was a valance parton, so only 2 (or 1, if meson) flavours * remain to be used. */ PPtr finalSplit(const tRemPPtr rem, long remID, Lorentz5Momentum usedMomentum) const { // Create the remnant and set its momentum, also reset all of the decay // products from the hadron PPtr remnant = new_ptr(Particle(getParticleData(remID))); Lorentz5Momentum prem(rem->momentum()-usedMomentum); prem.setMass(getParticleData(remID)->constituentMass()); prem.rescaleEnergy(); remnant->set5Momentum(prem); // Add the remnant to the step, but don't do colour connections thestep->addDecayProduct(rem,remnant,false); return remnant; } /** * This takes the particle and find a splitting for np -> p + child and * creates the correct kinematics and connects for such a split. This * Splitting has an upper bound on qtilde given by the energy argument * @param rem The Remnant * @param child The PDG code for the outgoing particle * @param oldQ The maximum scale for the evolution * @param oldx The fraction of the hadron's momentum carried by the last parton * @param pf The momentum of the last parton at input and after branching at output * @param p The total emitted momentum * @param content The content of the hadron */ PPtr forceSplit(const tRemPPtr rem, long child, Energy &oldQ, double &oldx, Lorentz5Momentum &pf, Lorentz5Momentum &p, HadronContent & content) const; /** * Check if a particle is a parton from a hadron or not * @param parton The parton to be tested */ bool isPartonic(tPPtr parton) const; /** @name Soft interaction methods. */ //@{ /** * Produce pt values according to dN/dp_T = N p_T exp(-beta_*p_T^2) */ Energy softPt() const; /** * Get the 2 pairs of 5Momenta for the scattering. Needs calling of * initSoftInteractions. */ void softKinematics(Lorentz5Momentum &r1, Lorentz5Momentum &r2, Lorentz5Momentum &g1, Lorentz5Momentum &g2) const; /** * Create N soft gluon interactions */ void doSoftInteractions(unsigned int N){ if(!multiPeriph_){ - doSoftInteractions_old(N);} + doSoftInteractions_old(N);} //outdated model for soft interactions else{ - doSoftInteractions_multiPeriph(N); + doSoftInteractions_multiPeriph(N); // Multiperipheral model } } /** * Create N soft gluon interactions (old version) */ void doSoftInteractions_old(unsigned int N); /** - * Create N soft gluon interactions - multiperhpheral kinematics + * Create N soft gluon interactions with multiperhpheral kinematics */ void doSoftInteractions_multiPeriph(unsigned int N); /** + * Phase space generation for the ladder partons + */ + bool doPhaseSpaceGenerationGluons(vector &softGluons, Energy energy, unsigned int &its) + const; + + /** + * This returns the rotation matrix needed to rotate p into the z axis + */ + LorentzRotation rotate(const LorentzMomentum &p) const; + + /** + * Methods to generate random distributions also all stolen form UA5Handler + **/ + + template + inline T gaussDistribution(T mean, T stdev) const{ + double x = rnd(); + x = sqrt(-2.*log(x)); + double y; + randAzm(x,x,y); + return mean + stdev*x; + } + + + /** + * This returns a random number with a flat distribution + * [-A,A] plus gaussian tail with stdev B + * TODO: Should move this to Utilities + * @param A The width of the flat part + * @param B The standard deviation of the gaussian tail + * @return the randomly generated value + */ + inline double randUng(double A, double B) const{ + double prun; + if(A == 0.) prun = 0.; + else prun = 1./(1.+B*1.2533/A); + if(rnd() < prun) return 2.*(rnd()-0.5)*A; + else { + double temp = gaussDistribution(0.,B); + if(temp < 0) return temp - abs(A); + else return temp + abs(A); + } + } + template + inline void randAzm(T pt, T &px, T &py) const{ + double c,s,cs; + while(true) { + c = 2.*rnd()-1.; + s = 2.*rnd()-1.; + cs = c*c+s*s; + if(cs <= 1.&&cs!=0.) break; + } + T qt = pt/cs; + px = (c*c-s*s)*qt; + py = 2.*c*s*qt; + } + + inline Energy randExt(Energy AM0,InvEnergy B) const{ + double r = rnd(); + // Starting value + Energy am = AM0-log(r)/B; + for(int i = 1; i<20; ++i) { + double a = exp(-B*(am-AM0))/(1.+B*AM0); + double f = (1.+B*am)*a-r; + InvEnergy df = -B*B*am*a; + Energy dam = -f/df; + am += dam; + if(am theanti; /** * variable to sum up the x values of the extracted particles */ pair theX; /**Pair of HadronContent structs to know about the quark content of the beams*/ pair theContent; /**Pair of Lorentz5Momentum to keep track of the forced splitting product momenta*/ pair theUsed; /** * Pair of PartnerMap's to store the particles, which will be colour * connected in the end. */ pair theMaps; /** * Variable to hold a pointer to the current step. The variable is used to * determine, wether decay(const DecayMode & dm, const Particle & p, Step & step) * has been called in this event or not. */ StepPtr thestep; /** * Pair of Remnant pointers. This is needed to boost * in the Remnant-Remnant CMF after all have been decayed. */ pair theRems; /** * The beam particle data for the current incoming hadron */ mutable tcPPtr theBeam; /** * the beam data */ mutable Ptr::const_pointer theBeamData; /** * The PDF for the current initial-state shower */ mutable tcPDFPtr _pdf; private: /** * Switch to control handling of top quarks in proton */ bool allowTop_; /** * Switch to control using multiperipheral kinemaics */ bool multiPeriph_; /** * True if kinematics is to be calculated for quarks */ bool quarkPair_; /** @name Soft interaction variables. */ //@{ /** * Pair of soft Remnant pointers, i.e. Diquarks. */ tPPair softRems_; /** * ptcut of the UE model */ Energy ptmin_; /** * slope of the soft pt-spectrum: dN/dp_T = N p_T exp(-beta*p_T^2) */ InvEnergy2 beta_; /** * Maximum number of attempts for the regeneration of an additional * soft scattering, before the number of scatters is reduced. */ unsigned int maxtrySoft_; /** * Variable to store the relative number of colour disrupted * connections to additional soft subprocesses. */ double colourDisrupt_; /** * Variable to store the additive factor of the multiperipheral ladder multiplicity. */ double ladderbFactor_; /** * Variable of the parameterization of the ladder multiplicity. */ double ladderPower_; /** * Variable of the parameterization of the ladder multiplicity. */ double ladderNorm_; + double ladderMult_; /** * Variable to store the gaussian width of the * fluctuation of the longitudinal momentum * fraction. */ double gaussWidth_; /** * Variable to store the current total multiplicity of a ladder. */ double valOfN_; /** * Variable to store the initial total rapidity between of the remnants. */ double initTotRap_; //@} /** @name Forced splitting variables. */ //@{ /** * The kinematic cut-off */ Energy _kinCutoff; /** * The PDF freezing scale as set in ShowerHandler */ Energy _forcedSplitScale; /** * Range for emission */ double _range; /** * Size of the bins in z for the interpolation */ double _zbin; /** * Size of the bins in y for the interpolation */ double _ybin; /** * Maximum number of bins for the z interpolation */ int _nbinmax; /** * Pointer to the object calculating the QCD coupling */ ShowerAlphaPtr _alphaS; /** * Pointer to the object calculating the QED coupling */ ShowerAlphaPtr _alphaEM; /** * Option for the DIS remnant */ unsigned int DISRemnantOpt_; /** + * Option for the pT generation + */ + unsigned int PtDistribution_; + + /** * Option for the treatment of the pomeron structure */ unsigned int pomeronStructure_; //@} /** * The gluon constituent mass. */ Energy mg_; }; } #endif /* HERWIG_HwRemDecayer_H */ diff --git a/README b/README --- a/README +++ b/README @@ -1,14 +1,14 @@ ======== Herwig 7 ======== -This is the release of Herwig 7.1.4, a multi purpose event +This is the release of Herwig 7.2.0, a multi purpose event generator for high energy physics. The Herwig++ distribution contains an adapted version of LoopTools 2.6 . BUILD AND INSTALL ================= Please refer to https://herwig.hepforge.org/tutorials/ for detailed instructions. diff --git a/Shower/QTilde/QTildeShowerHandler.cc b/Shower/QTilde/QTildeShowerHandler.cc --- a/Shower/QTilde/QTildeShowerHandler.cc +++ b/Shower/QTilde/QTildeShowerHandler.cc @@ -1,3216 +1,3216 @@ // -*- C++ -*- // // QTildeShowerHandler.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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 QTildeShowerHandler class. // #include "QTildeShowerHandler.h" #include "ThePEG/Interface/Deleted.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/RefVector.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/EventRecord/Particle.h" #include "ThePEG/Repository/UseRandom.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Utilities/EnumIO.h" #include "Herwig/Shower/QTilde/Base/ShowerParticle.h" #include "Herwig/PDF/MPIPDF.h" #include "Herwig/PDF/MinBiasPDF.h" #include "Herwig/Shower/QTilde/Base/ShowerTree.h" #include "Herwig/Shower/QTilde/Base/HardTree.h" #include "Herwig/Shower/QTilde/Kinematics/KinematicsReconstructor.h" #include "Herwig/Shower/QTilde/Base/PartnerFinder.h" #include "Herwig/PDF/HwRemDecayer.h" #include "Herwig/Shower/QTilde/Base/ShowerVertex.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "Herwig/MatrixElement/Matchbox/Base/SubtractedME.h" #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h" #include "ThePEG/PDF/PartonExtractor.h" #include "Herwig/Shower/RealEmissionProcess.h" #include "Herwig/Shower/QTilde/Kinematics/FS_QTildeShowerKinematics1to2.h" #include "Herwig/Shower/QTilde/Kinematics/IS_QTildeShowerKinematics1to2.h" #include "Herwig/Shower/QTilde/Kinematics/Decay_QTildeShowerKinematics1to2.h" using namespace Herwig; bool QTildeShowerHandler::_hardEmissionWarn = true; bool QTildeShowerHandler::_missingTruncWarn = true; QTildeShowerHandler::QTildeShowerHandler() : _maxtry(100), _meCorrMode(1), _evolutionScheme(1), _hardVetoReadOption(false), _iptrms(ZERO), _beta(0.), _gamma(ZERO), _iptmax(), _limitEmissions(0), _initialenhance(1.), _finalenhance(1.), _nReWeight(100), _reWeight(false), interaction_(ShowerInteraction::Both), _trunc_Mode(true), _hardEmission(1), _softOpt(2), _hardPOWHEG(false), muPt(ZERO) {} QTildeShowerHandler::~QTildeShowerHandler() {} IBPtr QTildeShowerHandler::clone() const { return new_ptr(*this); } IBPtr QTildeShowerHandler::fullclone() const { return new_ptr(*this); } void QTildeShowerHandler::persistentOutput(PersistentOStream & os) const { os << _splittingGenerator << _maxtry << _meCorrMode << _hardVetoReadOption << _limitEmissions << _softOpt << _hardPOWHEG << ounit(_iptrms,GeV) << _beta << ounit(_gamma,GeV) << ounit(_iptmax,GeV) << _vetoes << _fullShowerVetoes << _nReWeight << _reWeight << _trunc_Mode << _hardEmission << _evolutionScheme << ounit(muPt,GeV) << oenum(interaction_) << _reconstructor << _partnerfinder; } void QTildeShowerHandler::persistentInput(PersistentIStream & is, int) { is >> _splittingGenerator >> _maxtry >> _meCorrMode >> _hardVetoReadOption >> _limitEmissions >> _softOpt >> _hardPOWHEG >> iunit(_iptrms,GeV) >> _beta >> iunit(_gamma,GeV) >> iunit(_iptmax,GeV) >> _vetoes >> _fullShowerVetoes >> _nReWeight >> _reWeight >> _trunc_Mode >> _hardEmission >> _evolutionScheme >> iunit(muPt,GeV) >> ienum(interaction_) >> _reconstructor >> _partnerfinder; } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigQTildeShowerHandler("Herwig::QTildeShowerHandler", "HwShower.so"); void QTildeShowerHandler::Init() { static ClassDocumentation documentation ("TheQTildeShowerHandler class is the main class" " for the angular-ordered parton shower", "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 interfaceSplitGen("SplittingGenerator", "A reference to the SplittingGenerator object", &Herwig::QTildeShowerHandler::_splittingGenerator, false, false, true, false); static Parameter interfaceMaxTry ("MaxTry", "The maximum number of attempts to generate the shower from a" " particular ShowerTree", &QTildeShowerHandler::_maxtry, 100, 1, 100000, false, false, Interface::limited); static Parameter interfaceNReWeight ("NReWeight", "The number of attempts for the shower when reweighting", &QTildeShowerHandler::_nReWeight, 100, 10, 10000, false, false, Interface::limited); static Switch ifaceMECorrMode ("MECorrMode", "Choice of the ME Correction Mode", &QTildeShowerHandler::_meCorrMode, 1, false, false); static SwitchOption on (ifaceMECorrMode,"HardPlusSoft","hard+soft on", 1); static SwitchOption hard (ifaceMECorrMode,"Hard","only hard on", 2); static SwitchOption soft (ifaceMECorrMode,"Soft","only soft on", 3); static Switch ifaceHardVetoReadOption ("HardVetoReadOption", "Apply read-in scale veto to all collisions or just the primary one?", &QTildeShowerHandler::_hardVetoReadOption, false, false, false); static SwitchOption AllCollisions (ifaceHardVetoReadOption, "AllCollisions", "Read-in pT veto applied to primary and secondary collisions.", false); static SwitchOption PrimaryCollision (ifaceHardVetoReadOption, "PrimaryCollision", "Read-in pT veto applied to primary but not secondary collisions.", true); static Parameter ifaceiptrms ("IntrinsicPtGaussian", "RMS of intrinsic pT of Gaussian distribution:\n" "2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS)", &QTildeShowerHandler::_iptrms, GeV, ZERO, ZERO, 1000000.0*GeV, false, false, Interface::limited); static Parameter ifacebeta ("IntrinsicPtBeta", "Proportion of inverse quadratic distribution in generating intrinsic pT.\n" "(1-Beta) is the proportion of Gaussian distribution", &QTildeShowerHandler::_beta, 0, 0, 1, false, false, Interface::limited); static Parameter ifacegamma ("IntrinsicPtGamma", "Parameter for inverse quadratic:\n" "2*Beta*Gamma/(sqr(Gamma)+sqr(intrinsicpT))", &QTildeShowerHandler::_gamma,GeV, ZERO, ZERO, 100000.0*GeV, false, false, Interface::limited); static Parameter ifaceiptmax ("IntrinsicPtIptmax", "Upper bound on intrinsic pT for inverse quadratic", &QTildeShowerHandler::_iptmax,GeV, ZERO, ZERO, 100000.0*GeV, false, false, Interface::limited); static RefVector ifaceVetoes ("Vetoes", "The vetoes to be checked during showering", &QTildeShowerHandler::_vetoes, -1, false,false,true,true,false); static RefVector interfaceFullShowerVetoes ("FullShowerVetoes", "The vetos to be appliede on the full final state of the shower", &QTildeShowerHandler::_fullShowerVetoes, -1, false, false, true, false, false); static Switch interfaceLimitEmissions ("LimitEmissions", "Limit the number and type of emissions for testing", &QTildeShowerHandler::_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 SwitchOption interfaceLimitEmissionsOneEmission (interfaceLimitEmissions, "OneEmission", "Allow one emission in either the final state or initial state, but not both", 4); static Switch interfaceTruncMode ("TruncatedShower", "Include the truncated shower?", &QTildeShowerHandler::_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 interfaceHardEmission ("HardEmission", "Whether to use ME corrections or POWHEG for the hardest emission", &QTildeShowerHandler::_hardEmission, 0, false, false); static SwitchOption interfaceHardEmissionNone (interfaceHardEmission, "None", "No Corrections", 0); static SwitchOption interfaceHardEmissionMECorrection (interfaceHardEmission, "MECorrection", "Old fashioned ME correction", 1); static SwitchOption interfaceHardEmissionPOWHEG (interfaceHardEmission, "POWHEG", "Powheg style hard emission", 2); static Switch interfaceInteractions ("Interactions", "The interactions to be used in the shower", &QTildeShowerHandler::interaction_, ShowerInteraction::Both, false, false); static SwitchOption interfaceInteractionsQCD (interfaceInteractions, "QCD", "Only QCD radiation", ShowerInteraction::QCD); static SwitchOption interfaceInteractionsQED (interfaceInteractions, "QED", "Only QEd radiation", ShowerInteraction::QED); static SwitchOption interfaceInteractionsQCDandQED (interfaceInteractions, "QCDandQED", "Both QED and QCD radiation", ShowerInteraction::Both); static Deleted delReconstructionOption ("ReconstructionOption", "The old reconstruction option switch has been replaced with" " the new EvolutionScheme switch, see arXiv:1904.11866 for details"); static Switch interfaceEvolutionScheme ("EvolutionScheme", "The scheme to interpret the evolution variable in the case of multple emission.", &QTildeShowerHandler::_evolutionScheme, 1, false, false); static SwitchOption interfaceEvolutionSchemepT (interfaceEvolutionScheme, "pT", "pT scheme", 0); static SwitchOption interfaceEvolutionSchemeDotProduct (interfaceEvolutionScheme, "DotProduct", "Dot-product scheme", 1); static SwitchOption interfaceEvolutionSchemeQ2 (interfaceEvolutionScheme, "Q2", "Q2 scheme", 2); static Switch interfaceSoftCorrelations ("SoftCorrelations", "Option for the treatment of soft correlations in the parton shower", &QTildeShowerHandler::_softOpt, 2, false, false); static SwitchOption interfaceSoftCorrelationsNone (interfaceSoftCorrelations, "No", "No soft correlations", 0); static SwitchOption interfaceSoftCorrelationsFull (interfaceSoftCorrelations, "Full", "Use the full eikonal", 1); static SwitchOption interfaceSoftCorrelationsSingular (interfaceSoftCorrelations, "Singular", "Use original Webber-Marchisini form", 2); static Switch interfaceHardPOWHEG ("HardPOWHEG", "Treatment of powheg emissions which are too hard to have a shower interpretation", &QTildeShowerHandler::_hardPOWHEG, false, false, false); static SwitchOption interfaceHardPOWHEGAsShower (interfaceHardPOWHEG, "AsShower", "Still interpret as shower emissions", false); static SwitchOption interfaceHardPOWHEGRealEmission (interfaceHardPOWHEG, "RealEmission", "Generate shower from the real emmission configuration", true); static Reference interfaceKinematicsReconstructor ("KinematicsReconstructor", "Reference to the KinematicsReconstructor object", &QTildeShowerHandler::_reconstructor, false, false, true, false, false); static Reference interfacePartnerFinder ("PartnerFinder", "Reference to the PartnerFinder object", &QTildeShowerHandler::_partnerfinder, false, false, true, false, false); } tPPair QTildeShowerHandler::cascade(tSubProPtr sub, XCPtr xcomb) { // use me for reference in tex file etc useMe(); prepareCascade(sub); // set things up in the base class resetWeights(); hard_=ShowerTreePtr(); decay_.clear(); done_.clear(); // start of the try block for the whole showering process unsigned int countFailures=0; while (countFailuresoutgoing().begin(), currentSubProcess()->outgoing().end()), hard,decay); ShowerTree::constructTrees(hard_,decay_,hard,decay); // 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 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 QTildeShowerHandler::decay(decayingTree,decay_); // now shower the decay showerDecay(decayingTree); done_.push_back(decayingTree); decayingTree->updateAfterShower(decay_); } // suceeded break out of the loop break; } catch (KinematicsReconstructionVeto) { resetWeights(); ++countFailures; } catch ( ... ) { hard_=ShowerTreePtr(); decay_.clear(); done_.clear(); throw; } } // if loop exited because of too many tries, throw event away if (countFailures >= maxtry()) { resetWeights(); hard_=ShowerTreePtr(); decay_.clear(); done_.clear(); throw Exception() << "Too many tries for main while loop " << "in QTildeShowerHandler::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(incomingBeams().first ) && !isResolvedHadron(incomingBeams().second) ) return incomingBeams(); // 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)); } void QTildeShowerHandler::fillEventRecord() { // create a new step StepPtr pstep = newStep(); assert(!done_.empty()); assert(done_[0]->isHard()); // insert the steps for(unsigned int ix=0;ixfillEventRecord(pstep,doISR(),doFSR()); } } HardTreePtr QTildeShowerHandler::generateCKKW(ShowerTreePtr ) const { return HardTreePtr(); } void QTildeShowerHandler::doinit() { ShowerHandler::doinit(); // check on the reweighting for(unsigned int ix=0;ix<_fullShowerVetoes.size();++ix) { if(_fullShowerVetoes[ix]->behaviour()==1) { _reWeight = true; break; } } if(_reWeight && maximumTries()<_nReWeight) { throw Exception() << "Reweight being performed in the shower but the number of attempts for the" << "shower is less than that for the reweighting.\n" << "Maximum number of attempt for the shower " << fullName() << ":MaxTry is " << maximumTries() << "\nand for reweighting is " << fullName() << ":NReWeight is " << _nReWeight << "\n" << "we recommend the number of attempts is 10 times the number for reweighting\n" << Exception::runerror; } ShowerTree::_vmin2 = vMin(); ShowerTree::_spaceTime = includeSpaceTime(); } void QTildeShowerHandler::doinitrun() { ShowerHandler::doinitrun(); ShowerTree::_vmin2 = vMin(); ShowerTree::_spaceTime = includeSpaceTime(); } void QTildeShowerHandler::generateIntrinsicpT(vector particlesToShower) { _intrinsic.clear(); if ( !ipTon() || !doISR() ) return; // don't do anything for the moment for secondary scatters if( !firstInteraction() ) return; // generate intrinsic pT for(unsigned int ix=0;ixprogenitor()->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 pt = make_pair(ipt,UseRandom::rnd(Constants::twopi)); _intrinsic[particlesToShower[ix]] = pt; } } void QTildeShowerHandler::setupMaximumScales(const vector & p, XCPtr xcomb) { // let POWHEG events radiate freely if(_hardEmission==2&&hardTree()) { vector::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->maxHardPt(Constants::MaxEnergy); return; } // return if no vetos if (!restrictPhasespace()) return; // find out if hard partonic subprocess. bool isPartonic(false); map::const_iterator cit = _currenttree->incomingLines().begin(); Lorentz5Momentum pcm; for(; cit!=currentTree()->incomingLines().end(); ++cit) { pcm += cit->first->progenitor()->momentum(); isPartonic |= cit->first->progenitor()->coloured(); } // find minimum 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 = generator()->maximumCMEnergy(); // general case calculate the scale if ( !hardScaleIsMuF() || (hardVetoReadOption()&&!firstInteraction()) ) { // scattering process if(currentTree()->isHard()) { assert(xcomb); // coloured incoming particles if (isPartonic) { map::const_iterator cjt = currentTree()->outgoingLines().begin(); for(; cjt!=currentTree()->outgoingLines().end(); ++cjt) { if (cjt->first->progenitor()->coloured()) ptmax = min(ptmax,cjt->first->progenitor()->momentum().mt()); } } if (ptmax == generator()->maximumCMEnergy() ) ptmax = pcm.m(); if(hardScaleIsMuF()&&hardVetoReadOption()&& !firstInteraction()) { ptmax=min(ptmax,sqrt(xcomb->lastShowerScale())); } } // decay, incoming() is the decaying particle. else { ptmax = currentTree()->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 { if(currentTree()->isHard()) { assert(xcomb); ptmax = sqrt( xcomb->lastShowerScale() ); } else { ptmax = currentTree()->incomingLines().begin()->first ->progenitor()->momentum().mass(); } } ptmax *= hardScaleFactor(); // 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::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->maxHardPt(ptmax); } void QTildeShowerHandler::setupHardScales(const vector & p, XCPtr xcomb) { if ( hardScaleIsMuF() && (!hardVetoReadOption() || firstInteraction()) ) { Energy hardScale = ZERO; if(currentTree()->isHard()) { assert(xcomb); hardScale = sqrt( xcomb->lastShowerScale() ); } else { hardScale = currentTree()->incomingLines().begin()->first ->progenitor()->momentum().mass(); } hardScale *= hardScaleFactor(); vector::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->hardScale(hardScale); muPt = hardScale; } } void QTildeShowerHandler::showerHardProcess(ShowerTreePtr hard, XCPtr xcomb) { _hardme = HwMEBasePtr(); // extract the matrix element tStdXCombPtr lastXC = dynamic_ptr_cast(xcomb); if(lastXC) { _hardme = dynamic_ptr_cast(lastXC->matrixElement()); } _decayme = HwDecayerBasePtr(); // set the current tree currentTree(hard); hardTree(HardTreePtr()); // work out the type of event currentTree()->xcombPtr(dynamic_ptr_cast(xcomb)); currentTree()->identifyEventType(); checkFlags(); // generate the showering doShowering(true,xcomb); } RealEmissionProcessPtr QTildeShowerHandler::hardMatrixElementCorrection(bool hard) { // set the initial enhancement factors for the soft correction _initialenhance = 1.; _finalenhance = 1.; // see if we can get the correction from the matrix element // or decayer RealEmissionProcessPtr real; if(hard) { if(_hardme&&_hardme->hasMECorrection()) { _hardme->initializeMECorrection(_currenttree->perturbativeProcess(), _initialenhance,_finalenhance); if(hardMEC()) real = _hardme->applyHardMatrixElementCorrection(_currenttree->perturbativeProcess()); } } else { if(_decayme&&_decayme->hasMECorrection()) { _decayme->initializeMECorrection(_currenttree->perturbativeProcess(), _initialenhance,_finalenhance); if(hardMEC()) real = _decayme->applyHardMatrixElementCorrection(_currenttree->perturbativeProcess()); } } return real; } ShowerParticleVector QTildeShowerHandler::createTimeLikeChildren(tShowerParticlePtr, IdList ids) { // 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 children; for(unsigned int ix=0;ix<2;++ix) { children.push_back(new_ptr(ShowerParticle(ids[ix+1],true))); if(children[ix]->id()==_progenitor->id()&&!ids[ix+1]->stable()&&abs(ids[ix+1]->id())!=ParticleID::tauminus) children[ix]->set5Momentum(Lorentz5Momentum(_progenitor->progenitor()->mass())); else children[ix]->set5Momentum(Lorentz5Momentum(ids[ix+1]->mass())); } return children; } bool QTildeShowerHandler::timeLikeShower(tShowerParticlePtr particle, ShowerInteraction type, Branching fb, bool first) { // don't do anything if not needed if(_limitEmissions == 1 || hardOnly() || ( _limitEmissions == 2 && _nfs != 0) || ( _limitEmissions == 4 && _nfs + _nis != 0) ) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } // generate the emission ShowerParticleVector children; // generate the emission if(!fb.kinematics) fb = selectTimeLikeBranching(particle,type,HardBranchingPtr()); // no emission, return if(!fb.kinematics) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } Branching fc[2] = {Branching(),Branching()}; assert(fb.kinematics); // has emitted // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); // check highest pT if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the children children = createTimeLikeChildren(particle,fb.ids); // update the children particle->showerKinematics()-> updateChildren(particle, children,fb.type); // update number of emissions ++_nfs; if(_limitEmissions!=0) { if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } // select branchings for children fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); // shower the first particle if(fc[0].kinematics) timeLikeShower(children[0],type,fc[0],false); if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],false); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); particle->showerKinematics()->updateParent(particle, children,_evolutionScheme,fb.type); // branching has happened if(first&&!children.empty()) particle->showerKinematics()->resetChildren(particle,children); if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } bool QTildeShowerHandler::spaceLikeShower(tShowerParticlePtr particle, PPtr beam, ShowerInteraction 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(firstPDF().particle() == _beam) + if(beam == incomingBeams().first) pdf = firstPDF().pdf(); - if(secondPDF().particle() == _beam) + if(beam == incomingBeams().second) pdf = secondPDF().pdf(); Energy freeze = pdfFreezingScale(); // don't do anything if not needed if(_limitEmissions == 2 || hardOnly() || ( _limitEmissions == 1 && _nis != 0 ) || ( _limitEmissions == 4 && _nis + _nfs != 0 ) ) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } Branching bb; // generate branching while (true) { bb=_splittingGenerator->chooseBackwardBranching(*particle,beam, _initialenhance, _beam,type, pdf,freeze); // return if no emission if(!bb.kinematics) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } // if not vetoed break if(!spaceLikeVetoed(bb,particle)) break; // otherwise reset scale and continue particle->vetoEmission(bb.type,bb.kinematics->scale()); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); } // assign the splitting function and shower kinematics particle->showerKinematics(bb.kinematics); if(bb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(bb.kinematics->pT()); // For the time being we are considering only 1->2 branching // particles as in Sudakov form factor tcPDPtr part[2]={bb.ids[0],bb.ids[2]}; // 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,_evolutionScheme,bb.type); // 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; if(newParent->spinInfo()) newParent->spinInfo()->develop(); // now reconstruct the momentum if(!emitted) { if(_intrinsic.find(_progenitor)==_intrinsic.end()) { bb.kinematics->updateLast(newParent,ZERO,ZERO); } else { pair kt=_intrinsic[_progenitor]; bb.kinematics->updateLast(newParent, kt.first*cos(kt.second), kt.first*sin(kt.second)); } } particle->showerKinematics()-> updateChildren(newParent, theChildren,bb.type); if(_limitEmissions!=0) { if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } // perform the shower of the final-state particle timeLikeShower(otherChild,type,Branching(),true); updateHistory(otherChild); if(theChildren[1]->spinInfo()) theChildren[1]->spinInfo()->develop(); // return the emitted if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } void QTildeShowerHandler::showerDecay(ShowerTreePtr decay) { // work out the type of event currentTree()->xcombPtr(StdXCombPtr()); currentTree()->identifyEventType(); _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() + "->"; OrderedParticles outgoing; for(map::const_iterator it=decay->outgoingLines().begin();it!=decay->outgoingLines().end();++it) { if(abs(decay->incomingLines().begin()->first->original()->id()) == ParticleID::t && abs(it->first->original()->id())==ParticleID::Wplus && decay->treelinks().size() == 1) { ShowerTreePtr Wtree = decay->treelinks().begin()->first; for(map::const_iterator it2=Wtree->outgoingLines().begin();it2!=Wtree->outgoingLines().end();++it2) { outgoing.insert(it2->first->original()->dataPtr()); } } else { outgoing.insert(it->first->original()->dataPtr()); } } for(OrderedParticles::const_iterator it=outgoing.begin(); it!=outgoing.end();++it) { if(it!=outgoing.begin()) tag += ","; tag +=(**it).name(); } tag += ";"; dm = findDecayMode(tag); } if(dm) _decayme = dynamic_ptr_cast(dm->decayer()); // set the ShowerTree to be showered currentTree(decay); decay->applyTransforms(); hardTree(HardTreePtr()); // generate the showering doShowering(false,XCPtr()); // if no vetos // force calculation of spin correlations SpinPtr spInfo = decay->incomingLines().begin()->first->progenitor()->spinInfo(); if(spInfo) { if(!spInfo->developed()) spInfo->needsUpdate(); spInfo->develop(); } } bool QTildeShowerHandler::spaceLikeDecayShower(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass,ShowerInteraction type, Branching fb) { // don't do anything if not needed if(_limitEmissions == 1 || hardOnly() || ( _limitEmissions == 3 && _nis != 0) || ( _limitEmissions == 4 && _nfs + _nis != 0) ) { return false; } // generate the emission ShowerParticleVector children; // generate the emission if(!fb.kinematics) fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type, HardBranchingPtr()); // no emission, return if(!fb.kinematics) return false; Branching fc[2]; if(particle->virtualMass()==ZERO) particle->virtualMass(_progenitor->progenitor()->mass()); fc[0] = Branching(); fc[1] = Branching(); assert(fb.kinematics); // has emitted // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the ShowerParticle objects for the two children children = createTimeLikeChildren(particle,fb.ids); // updateChildren the children particle->showerKinematics()-> updateChildren(particle, children, fb.type); // select branchings for children fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass, type,HardBranchingPtr()); fc[1] = selectTimeLikeBranching (children[1],type,HardBranchingPtr()); // old default ++_nis; // shower the first particle _currenttree->updateInitialStateShowerProduct(_progenitor,children[0]); _currenttree->addInitialStateBranching(particle,children[0],children[1]); if(fc[0].kinematics) spaceLikeDecayShower(children[0],maxScales,minmass,type,Branching()); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],true); updateHistory(children[1]); // TODO NEED AN UPDATE HERE FOR RECONOPT!=0 // branching has happened return true; } vector QTildeShowerHandler::setupShower(bool hard) { RealEmissionProcessPtr real; // generate hard me if needed if(_hardEmission==1) { real = hardMatrixElementCorrection(hard); if(real&&!real->outgoing().empty()) setupMECorrection(real); } // generate POWHEG hard emission if needed else if(_hardEmission==2) hardestEmission(hard); // set the initial colour partners setEvolutionPartners(hard,interaction_,false); // get the particles to be showered vector particlesToShower = currentTree()->extractProgenitors(); // return the answer return particlesToShower; } void QTildeShowerHandler::setEvolutionPartners(bool hard,ShowerInteraction type, bool clear) { // match the particles in the ShowerTree and hardTree if(hardTree() && !hardTree()->connect(currentTree())) throw Exception() << "Can't match trees in " << "QTildeShowerHandler::setEvolutionPartners()" << Exception::eventerror; // extract the progenitors vector particles = currentTree()->extractProgenitorParticles(); // clear the partners if needed if(clear) { for(unsigned int ix=0;ixpartner(ShowerParticlePtr()); particles[ix]->clearPartners(); } } // sort out the colour partners if(hardTree()) { // find the partner for(unsigned int ix=0;ixparticles()[particles[ix]]->branchingParticle()->partner(); if(!partner) continue; for(map::const_iterator it=hardTree()->particles().begin(); it!=hardTree()->particles().end();++it) { if(it->second->branchingParticle()==partner) { particles[ix]->partner(it->first); break; } } if(!particles[ix]->partner()) throw Exception() << "Can't match partners in " << "QTildeShowerHandler::setEvolutionPartners()" << Exception::eventerror; } } // Set the initial evolution scales partnerFinder()-> setInitialEvolutionScales(particles,!hard,interaction_,!_hardtree); if(hardTree() && _hardPOWHEG) { bool tooHard=false; map::const_iterator eit=hardTree()->particles().end(); for(unsigned int ix=0;ix::const_iterator mit = hardTree()->particles().find(particles[ix]); Energy hardScale(ZERO); ShowerPartnerType type(ShowerPartnerType::Undefined); // final-state if(particles[ix]->isFinalState()) { if(mit!= eit && !mit->second->children().empty()) { hardScale = mit->second->scale(); type = mit->second->type(); } } // initial-state else { if(mit!= eit && mit->second->parent()) { hardScale = mit->second->parent()->scale(); type = mit->second->parent()->type(); } } if(type!=ShowerPartnerType::Undefined) { if(type==ShowerPartnerType::QED) { tooHard |= particles[ix]->scales().QED_noAOscales().QCD_c_noAOscales().QCD_ac_noAOchildren().empty()) { ShowerParticleVector theChildren; for(unsigned int ix=0;ixchildren().size();++ix) { ShowerParticlePtr part = dynamic_ptr_cast (particle->children()[ix]); theChildren.push_back(part); } // update the history if needed if(particle==_currenttree->getFinalStateShowerProduct(_progenitor)) _currenttree->updateFinalStateShowerProduct(_progenitor, particle,theChildren); _currenttree->addFinalStateBranching(particle,theChildren); for(unsigned int ix=0;ixprogenitor()->partner()) return false; progenitor()->progenitor()->initializeFinalState(); if(hardTree()) { map::const_iterator eit=hardTree()->particles().end(), mit = hardTree()->particles().find(progenitor()->progenitor()); if( mit != eit && !mit->second->children().empty() ) { bool output=truncatedTimeLikeShower(progenitor()->progenitor(), mit->second ,type,Branching(),true); if(output) updateHistory(progenitor()->progenitor()); return output; } } // do the shower bool output = hardOnly() ? false : timeLikeShower(progenitor()->progenitor() ,type,Branching(),true) ; if(output) updateHistory(progenitor()->progenitor()); return output; } bool QTildeShowerHandler::startSpaceLikeShower(PPtr parent, ShowerInteraction type) { // initialise the basis vectors if(!progenitor()->progenitor()->partner()) return false; progenitor()->progenitor()->initializeInitialState(parent); if(hardTree()) { map::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 ); } } // perform the shower return hardOnly() ? false : spaceLikeShower(progenitor()->progenitor(),parent,type); } bool QTildeShowerHandler:: startSpaceLikeDecayShower(const ShowerParticle::EvolutionScales & maxScales, Energy minimumMass,ShowerInteraction type) { // set up the particle basis vectors if(!progenitor()->progenitor()->partner()) return false; progenitor()->progenitor()->initializeDecay(); if(hardTree()) { map::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(),maxScales, minimumMass, branch ,type, Branching()); } } // perform the shower return hardOnly() ? false : spaceLikeDecayShower(progenitor()->progenitor(),maxScales,minimumMass,type,Branching()); } bool QTildeShowerHandler::timeLikeVetoed(const Branching & fb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction type = convertInteraction(fb.type); // check whether emission was harder than largest pt of hard subprocess if ( restrictPhasespace() && fb.kinematics->pT() > _progenitor->maxHardPt() ) return true; // soft matrix element correction veto if( softMEC()) { if(_hardme && _hardme->hasMECorrection()) { if(_hardme->softMatrixElementVeto(particle, _progenitor->progenitor(), particle->isFinalState(), _progenitor->highestpT(), fb.ids, fb.kinematics->z(), fb.kinematics->scale(), fb.kinematics->pT())) return true; } else if(_decayme && _decayme->hasMECorrection()) { if(_decayme->softMatrixElementVeto(particle, _progenitor->progenitor(), particle->isFinalState(), _progenitor->highestpT(), fb.ids, fb.kinematics->z(), fb.kinematics->scale(), fb.kinematics->pT())) return true; } } // veto on maximum pt if(fb.kinematics->pT()>_progenitor->maximumpT(type)) return true; // general vetos if (fb.kinematics && !_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoTimeLike(_progenitor,particle,fb,currentTree()); 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; } if ( firstInteraction() && profileScales() ) { double weight = profileScales()-> hardScaleProfile(_progenitor->hardScale(),fb.kinematics->pT()); if ( UseRandom::rnd() > weight ) return true; } return false; } bool QTildeShowerHandler::spaceLikeVetoed(const Branching & bb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction type = convertInteraction(bb.type); // check whether emission was harder than largest pt of hard subprocess if (restrictPhasespace() && bb.kinematics->pT() > _progenitor->maxHardPt()) return true; // apply the soft correction if( softMEC() && _hardme && _hardme->hasMECorrection() ) { if(_hardme->softMatrixElementVeto(particle, _progenitor->progenitor(), particle->isFinalState(), _progenitor->highestpT(), bb.ids, bb.kinematics->z(), bb.kinematics->scale(), bb.kinematics->pT())) return true; } // the more general vetos // check vs max pt for the shower if(bb.kinematics->pT()>_progenitor->maximumpT(type)) return true; if (!_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoSpaceLike(_progenitor,particle,bb,currentTree()); 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; } if ( firstInteraction() && profileScales() ) { double weight = profileScales()-> hardScaleProfile(_progenitor->hardScale(),bb.kinematics->pT()); if ( UseRandom::rnd() > weight ) return true; } return false; } bool QTildeShowerHandler::spaceLikeDecayVetoed( const Branching & fb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction type = convertInteraction(fb.type); // apply the soft correction if( softMEC() && _decayme && _decayme->hasMECorrection() ) { if(_decayme->softMatrixElementVeto(particle, _progenitor->progenitor(), particle->isFinalState(), _progenitor->highestpT(), fb.ids, fb.kinematics->z(), fb.kinematics->scale(), fb.kinematics->pT())) return true; } // veto on hardest pt in the shower if(fb.kinematics->pT()> _progenitor->maximumpT(type)) return true; // general vetos if (!_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoSpaceLike(_progenitor,particle,fb,currentTree()); 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 QTildeShowerHandler::hardestEmission(bool hard) { HardTreePtr ISRTree; // internal POWHEG in production or decay if( (( _hardme && _hardme->hasPOWHEGCorrection()!=0 ) || ( _decayme && _decayme->hasPOWHEGCorrection()!=0 ) ) ) { RealEmissionProcessPtr real; unsigned int type(0); // production if(_hardme) { assert(hard); real = _hardme->generateHardest( currentTree()->perturbativeProcess(), interaction_); type = _hardme->hasPOWHEGCorrection(); } // decay else { assert(!hard); real = _decayme->generateHardest( currentTree()->perturbativeProcess() ); type = _decayme->hasPOWHEGCorrection(); } if(real) { // set up ther hard tree if(!real->outgoing().empty()) _hardtree = new_ptr(HardTree(real)); // set up the vetos currentTree()->setVetoes(real->pT(),type); } // store initial state POWHEG radiation if(_hardtree && _hardme && _hardme->hasPOWHEGCorrection()==1) ISRTree = _hardtree; } else if (hard) { // Get minimum pT cutoff used in shower approximation Energy maxpt = 1.*GeV; if ( currentTree()->showerApproximation() ) { int colouredIn = 0; int colouredOut = 0; for( map< ShowerProgenitorPtr, tShowerParticlePtr >::iterator it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if( it->second->coloured() ) ++colouredOut; } for( map< ShowerProgenitorPtr, ShowerParticlePtr >::iterator it = currentTree()->incomingLines().begin(); it != currentTree()->incomingLines().end(); ++it ) { if( it->second->coloured() ) ++colouredIn; } if ( currentTree()->showerApproximation()->ffPtCut() == currentTree()->showerApproximation()->fiPtCut() && currentTree()->showerApproximation()->ffPtCut() == currentTree()->showerApproximation()->iiPtCut() ) maxpt = currentTree()->showerApproximation()->ffPtCut(); else if ( colouredIn == 2 && colouredOut == 0 ) maxpt = currentTree()->showerApproximation()->iiPtCut(); else if ( colouredIn == 0 && colouredOut > 1 ) maxpt = currentTree()->showerApproximation()->ffPtCut(); else if ( colouredIn == 2 && colouredOut == 1 ) maxpt = min(currentTree()->showerApproximation()->iiPtCut(), currentTree()->showerApproximation()->fiPtCut()); else if ( colouredIn == 1 && colouredOut > 1 ) maxpt = min(currentTree()->showerApproximation()->ffPtCut(), currentTree()->showerApproximation()->fiPtCut()); else maxpt = min(min(currentTree()->showerApproximation()->iiPtCut(), currentTree()->showerApproximation()->fiPtCut()), currentTree()->showerApproximation()->ffPtCut()); } // Generate hardtree from born and real emission subprocesses _hardtree = generateCKKW(currentTree()); // Find transverse momentum of hardest emission if (_hardtree){ for(set::iterator it=_hardtree->branchings().begin(); it!=_hardtree->branchings().end();++it) { if ((*it)->parent() && (*it)->status()==HardBranching::Incoming) maxpt=(*it)->branchingParticle()->momentum().perp(); if ((*it)->children().size()==2 && (*it)->status()==HardBranching::Outgoing){ if ((*it)->branchingParticle()->id()!=21 && abs((*it)->branchingParticle()->id())>5 ){ if ((*it)->children()[0]->branchingParticle()->id()==21 || abs((*it)->children()[0]->branchingParticle()->id())<6) maxpt=(*it)->children()[0]->branchingParticle()->momentum().perp(); else if ((*it)->children()[1]->branchingParticle()->id()==21 || abs((*it)->children()[1]->branchingParticle()->id())<6) maxpt=(*it)->children()[1]->branchingParticle()->momentum().perp(); } else { if ( abs((*it)->branchingParticle()->id())<6){ if (abs((*it)->children()[0]->branchingParticle()->id())<6) maxpt = (*it)->children()[1]->branchingParticle()->momentum().perp(); else maxpt = (*it)->children()[0]->branchingParticle()->momentum().perp(); } else maxpt = (*it)->children()[1]->branchingParticle()->momentum().perp(); } } } } // Hardest (pt) emission should be the first powheg emission. maxpt=min(sqrt(lastXCombPtr()->lastShowerScale()),maxpt); // set maximum pT for subsequent emissions from S events if ( currentTree()->isPowhegSEvent() ) { for( map< ShowerProgenitorPtr, tShowerParticlePtr >::iterator it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if( ! it->second->coloured() ) continue; it->first->maximumpT(maxpt, ShowerInteraction::QCD ); } for( map< ShowerProgenitorPtr, ShowerParticlePtr >::iterator it = currentTree()->incomingLines().begin(); it != currentTree()->incomingLines().end(); ++it ) { if( ! it->second->coloured() ) continue; it->first->maximumpT(maxpt, ShowerInteraction::QCD ); } } } else _hardtree = generateCKKW(currentTree()); // if hard me doesn't have a FSR powheg // correction use decay powheg correction if (_hardme && _hardme->hasPOWHEGCorrection()<2) { addFSRUsingDecayPOWHEG(ISRTree); } // connect the trees if(_hardtree) { connectTrees(currentTree(),_hardtree,hard); } } void QTildeShowerHandler::addFSRUsingDecayPOWHEG(HardTreePtr ISRTree) { // check for intermediate colour singlet resonance const ParticleVector inter = _hardme->subProcess()->intermediates(); if (inter.size()!=1 || inter[0]->momentum().m2()/GeV2 < 0 || inter[0]->dataPtr()->iColour()!=PDT::Colour0) { return; } // ignore cases where outgoing particles are not coloured map out = currentTree()->outgoingLines(); if (out.size() != 2 || out. begin()->second->dataPtr()->iColour()==PDT::Colour0 || out.rbegin()->second->dataPtr()->iColour()==PDT::Colour0) { return; } // look up decay mode tDMPtr dm; string tag; string inParticle = inter[0]->dataPtr()->name() + "->"; vector outParticles; outParticles.push_back(out.begin ()->first->progenitor()->dataPtr()->name()); outParticles.push_back(out.rbegin()->first->progenitor()->dataPtr()->name()); for (int it=0; it<2; ++it){ tag = inParticle + outParticles[it] + "," + outParticles[(it+1)%2] + ";"; dm = generator()->findDecayMode(tag); if(dm) break; } // get the decayer HwDecayerBasePtr decayer; if(dm) decayer = dynamic_ptr_cast(dm->decayer()); // check if decayer has a FSR POWHEG correction if (!decayer || decayer->hasPOWHEGCorrection()<2) { return; } // generate the hardest emission // create RealEmissionProcess PPtr in = new_ptr(*inter[0]); RealEmissionProcessPtr newProcess(new_ptr(RealEmissionProcess())); newProcess->bornIncoming().push_back(in); newProcess->bornOutgoing().push_back(out.begin ()->first->progenitor()); newProcess->bornOutgoing().push_back(out.rbegin()->first->progenitor()); // generate the FSR newProcess = decayer->generateHardest(newProcess); HardTreePtr FSRTree; if(newProcess) { // set up ther hard tree if(!newProcess->outgoing().empty()) FSRTree = new_ptr(HardTree(newProcess)); // set up the vetos currentTree()->setVetoes(newProcess->pT(),2); } if(!FSRTree) return; // if there is no ISRTree make _hardtree from FSRTree if (!ISRTree){ vector inBranch,hardBranch; for(map::const_iterator cit =currentTree()->incomingLines().begin(); cit!=currentTree()->incomingLines().end();++cit ) { inBranch.push_back(new_ptr(HardBranching(cit->second,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); inBranch.back()->beam(cit->first->original()->parents()[0]); hardBranch.push_back(inBranch.back()); } if(inBranch[0]->branchingParticle()->dataPtr()->coloured()) { inBranch[0]->colourPartner(inBranch[1]); inBranch[1]->colourPartner(inBranch[0]); } for(set::iterator it=FSRTree->branchings().begin(); it!=FSRTree->branchings().end();++it) { if((**it).branchingParticle()->id()!=in->id()) hardBranch.push_back(*it); } hardBranch[2]->colourPartner(hardBranch[3]); hardBranch[3]->colourPartner(hardBranch[2]); HardTreePtr newTree = new_ptr(HardTree(hardBranch,inBranch, ShowerInteraction::QCD)); _hardtree = newTree; } // Otherwise modify the ISRTree to include the emission in FSRTree else { vector FSROut, ISROut; set::iterator itFSR, itISR; // get outgoing particles for(itFSR =FSRTree->branchings().begin(); itFSR!=FSRTree->branchings().end();++itFSR){ if ((**itFSR).status()==HardBranching::Outgoing) FSROut.push_back((*itFSR)->branchingParticle()); } for(itISR =ISRTree->branchings().begin(); itISR!=ISRTree->branchings().end();++itISR){ if ((**itISR).status()==HardBranching::Outgoing) ISROut.push_back((*itISR)->branchingParticle()); } // find COM frame formed by outgoing particles LorentzRotation eventFrameFSR, eventFrameISR; eventFrameFSR = ((FSROut[0]->momentum()+FSROut[1]->momentum()).findBoostToCM()); eventFrameISR = ((ISROut[0]->momentum()+ISROut[1]->momentum()).findBoostToCM()); // find rotation between ISR and FSR frames int j=0; if (ISROut[0]->id()!=FSROut[0]->id()) j=1; eventFrameISR.rotateZ( (eventFrameFSR*FSROut[0]->momentum()).phi()- (eventFrameISR*ISROut[j]->momentum()).phi() ); eventFrameISR.rotateY( (eventFrameFSR*FSROut[0]->momentum()).theta()- (eventFrameISR*ISROut[j]->momentum()).theta() ); eventFrameISR.invert(); for (itFSR=FSRTree->branchings().begin(); itFSR!=FSRTree->branchings().end();++itFSR){ if ((**itFSR).branchingParticle()->id()==in->id()) continue; for (itISR =ISRTree->branchings().begin(); itISR!=ISRTree->branchings().end();++itISR){ if ((**itISR).status()==HardBranching::Incoming) continue; if ((**itFSR).branchingParticle()->id()== (**itISR).branchingParticle()->id()){ // rotate FSRTree particle to ISRTree event frame (**itISR).branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).branchingParticle()->momentum()); (**itISR).branchingParticle()->rescaleMass(); // add the children of the FSRTree particles to the ISRTree if(!(**itFSR).children().empty()){ (**itISR).addChild((**itFSR).children()[0]); (**itISR).addChild((**itFSR).children()[1]); // rotate momenta to ISRTree event frame (**itISR).children()[0]->branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).children()[0]->branchingParticle()->momentum()); (**itISR).children()[1]->branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).children()[1]->branchingParticle()->momentum()); } } } } _hardtree = ISRTree; } } bool QTildeShowerHandler::truncatedTimeLikeShower(tShowerParticlePtr particle, HardBranchingPtr branch, ShowerInteraction type, Branching fb, bool first) { // select a branching if we don't have one if(!fb.kinematics) fb = selectTimeLikeBranching(particle,type,branch); // must be an emission, the forced one it not a truncated one assert(fb.kinematics); ShowerParticleVector children; Branching fc[2] = {Branching(),Branching()}; // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the children children = createTimeLikeChildren(particle,fb.ids); // update the children particle->showerKinematics()-> updateChildren(particle, children,fb.type); // select branchings for children if(!fc[0].kinematics) { // select branching for first particle if(!fb.hard && fb.iout ==1 ) fc[0] = selectTimeLikeBranching(children[0],type,branch); else if(fb.hard && !branch->children()[0]->children().empty() ) fc[0] = selectTimeLikeBranching(children[0],type,branch->children()[0]); else fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); } // select branching for the second particle if(!fc[1].kinematics) { // select branching for first particle if(!fb.hard && fb.iout ==2 ) fc[1] = selectTimeLikeBranching(children[1],type,branch); else if(fb.hard && !branch->children()[1]->children().empty() ) fc[1] = selectTimeLikeBranching(children[1],type,branch->children()[1]); else fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); } // shower the first particle if(fc[0].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 1) truncatedTimeLikeShower(children[0],branch,type,fc[0],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 2) truncatedTimeLikeShower(children[1],branch,type,fc[1],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[1]->children().empty() ) truncatedTimeLikeShower(children[1],branch->children()[1],type,fc[1],false); else timeLikeShower(children[1],type,fc[1],false); } if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,_evolutionScheme,fb.type); if(first&&!children.empty()) particle->showerKinematics()->resetChildren(particle,children); if(particle->spinInfo()) particle->spinInfo()->develop(); // TODO NEED AN UPDATE HERE FOR RECONOPT!=0 ? return true; } bool QTildeShowerHandler::truncatedSpaceLikeShower(tShowerParticlePtr particle, PPtr beam, HardBranchingPtr branch, ShowerInteraction type) { tcPDFPtr pdf; if(firstPDF().particle() == beamParticle()) pdf = firstPDF().pdf(); if(secondPDF().particle() == beamParticle()) pdf = secondPDF().pdf(); Energy freeze = pdfFreezingScale(); Branching bb; // parameters of the force branching 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(); } // generate truncated branching tcPDPtr part[2]; if(z>=0.&&z<=1.) { 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] = bb.ids[0]; part[1] = bb.ids[2]; double zsplit = bb.kinematics->z(); // apply the vetos for the truncated shower // if doesn't carry most of momentum ShowerInteraction type2 = convertInteraction(bb.type); if(type2==branch->sudakov()->interactionType() && zsplit < 0.5) { particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } // others if( part[0]->id() != particle->id() || // if particle changes type bb.kinematics->pT() > progenitor()->maximumpT(type2) || // pt veto bb.kinematics->scale() < branch->scale()) { // angular ordering veto particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } // and those from the base class if(spaceLikeVetoed(bb,particle)) { particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } break; } } if( !bb.kinematics ) { //do the hard emission ShoKinPtr kinematics = new_ptr(IS_QTildeShowerKinematics1to2( branch->scale(), z, branch->phi(), branch->children()[0]->pT(), branch->sudakov() )); // assign the splitting function and shower kinematics particle->showerKinematics( kinematics ); if(kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(kinematics->pT()); // 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,_evolutionScheme, branch->type()); // 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 kt = intrinsicpT()[progenitor()]; kinematics->updateLast( newParent, kt.first*cos( kt.second ), kt.first*sin( kt.second ) ); } } particle->showerKinematics()-> updateChildren( newParent, theChildren,bb.type); if(hardOnly()) return true; // perform the shower of the final-state particle if( timelike->children().empty() ) { timeLikeShower( otherChild , type,Branching(),true); } else { truncatedTimeLikeShower( otherChild, timelike , type,Branching(), true); } updateHistory(otherChild); // return the emitted return true; } // assign the splitting function and shower kinematics particle->showerKinematics( bb.kinematics ); if(bb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(bb.kinematics->pT()); // 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,_evolutionScheme, bb.type); // 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 kt = intrinsicpT()[ progenitor() ]; bb.kinematics->updateLast( newParent, kt.first*cos( kt.second ), kt.first*sin( kt.second ) ); } } particle->showerKinematics()-> updateChildren( newParent, theChildren, bb.type); // perform the shower of the final-state particle timeLikeShower( otherChild , type,Branching(),true); updateHistory(otherChild); // return the emitted return true; } bool QTildeShowerHandler:: truncatedSpaceLikeDecayShower(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass, HardBranchingPtr branch, ShowerInteraction type, Branching fb) { // select a branching if we don't have one if(!fb.kinematics) fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type,branch); // must be an emission, the forced one it not a truncated one assert(fb.kinematics); ShowerParticleVector children; Branching fc[2]={Branching(),Branching()}; // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the ShowerParticle objects for the two children children = createTimeLikeChildren(particle,fb.ids); // updateChildren the children particle->showerKinematics()-> updateChildren(particle, children, fb.type); // select branchings for children if(!fc[0].kinematics) { if(children[0]->id()==particle->id()) { // select branching for first particle if(!fb.hard) fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type,branch); else if(fb.hard && ! branch->children()[0]->children().empty() ) fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type, branch->children()[0]); else fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type, HardBranchingPtr()); } else { // select branching for first particle if(fb.hard && !branch->children()[0]->children().empty() ) fc[0] = selectTimeLikeBranching(children[0],type,branch->children()[0]); else fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); } } // select branching for the second particle if(!fc[1].kinematics) { if(children[1]->id()==particle->id()) { // select branching for first particle if(!fb.hard) fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type,branch); else if(fb.hard && ! branch->children()[1]->children().empty() ) fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type, branch->children()[1]); else fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type, HardBranchingPtr()); } else { if(fb.hard && !branch->children()[1]->children().empty() ) fc[1] = selectTimeLikeBranching(children[1],type,branch->children()[1]); else fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); } } // old default // update the history if needed currentTree()->updateInitialStateShowerProduct(progenitor(),children[0]); currentTree()->addInitialStateBranching(particle,children[0],children[1]); // shower the first particle if(fc[0].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[0]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[0]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[0]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } } // shower the second particle if(fc[1].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[1]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[1]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[1]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[1],false); // normal shower else timeLikeShower(children[0],type,fc[1],false); } } updateHistory(children[1]); // TODO DO WE NEED A CHECK IF RECONPT !=0 return true; } void QTildeShowerHandler::connectTrees(ShowerTreePtr showerTree, HardTreePtr hardTree, bool hard ) { ShowerParticleVector particles; // find the Sudakovs for(set::iterator cit=hardTree->branchings().begin(); cit!=hardTree->branchings().end();++cit) { // Sudakovs for ISR if((**cit).parent()&&(**cit).status()==HardBranching::Incoming) { ++_nis; array br; 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.particles; if(ids[0]->id()==br[0]&&ids[1]->id()==br[1]&&ids[2]->id()==br[2]) { sudakov=cjt->second.sudakov; break; } } if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in " << "QTildeShowerHandler::connectTrees() for ISR" << Exception::runerror; (**cit).parent()->sudakov(sudakov); } // Sudakovs for FSR else if(!(**cit).children().empty()) { ++_nfs; array br; 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.particles; if(ids[0]->id()==br[0]&&ids[1]->id()==br[1]&&ids[2]->id()==br[2]) { sudakov=cjt->second.sudakov; break; } } if(!sudakov) { throw Exception() << "Can't find Sudakov for the hard emission in " << "QTildeShowerHandler::connectTrees()" << Exception::runerror; } (**cit).sudakov(sudakov); } } // calculate the evolution scale for(set::iterator cit=hardTree->branchings().begin(); cit!=hardTree->branchings().end();++cit) { particles.push_back((*cit)->branchingParticle()); } partnerFinder()-> setInitialEvolutionScales(particles,!hard,interaction_,true); hardTree->partnersSet(true); // inverse reconstruction if(hard) { kinematicsReconstructor()-> deconstructHardJets(hardTree,interaction_); } else kinematicsReconstructor()-> deconstructDecayJets(hardTree,interaction_); // now reset the momenta of the showering particles vector particlesToShower=showerTree->extractProgenitors(); // match them map partners; for(set::const_iterator bit=hardTree->branchings().begin(); bit!=hardTree->branchings().end();++bit) { Energy2 dmin( 1e30*GeV2 ); ShowerProgenitorPtr partner; for(vector::const_iterator pit=particlesToShower.begin(); pit!=particlesToShower.end();++pit) { if(partners.find(*pit)!=partners.end()) continue; if( (**bit).branchingParticle()->id() != (**pit).progenitor()->id() ) continue; if( (**bit).branchingParticle()->isFinalState() != (**pit).progenitor()->isFinalState() ) continue; if( (**pit).progenitor()->isFinalState() ) { Energy2 dtest = sqr( (**pit).progenitor()->momentum().x() - (**bit).showerMomentum().x() ) + sqr( (**pit).progenitor()->momentum().y() - (**bit).showerMomentum().y() ) + sqr( (**pit).progenitor()->momentum().z() - (**bit).showerMomentum().z() ) + sqr( (**pit).progenitor()->momentum().t() - (**bit).showerMomentum().t() ); // add mass difference for identical particles (e.g. Z0 Z0 production) dtest += 1e10*sqr((**pit).progenitor()->momentum().m()-(**bit).showerMomentum().m()); if( dtest < dmin ) { partner = *pit; dmin = dtest; } } else { // ensure directions are right if((**pit).progenitor()->momentum().z()/(**bit).showerMomentum().z()>ZERO) { partner = *pit; break; } } } if(!partner) throw Exception() << "Failed to match shower and hard trees in QTildeShowerHandler::hardestEmission" << Exception::eventerror; partners[partner] = *bit; } for(vector::const_iterator pit=particlesToShower.begin(); pit!=particlesToShower.end();++pit) { HardBranchingPtr partner = partners[*pit]; if((**pit).progenitor()->dataPtr()->stable()) { (**pit).progenitor()->set5Momentum(partner->showerMomentum()); (**pit).copy()->set5Momentum(partner->showerMomentum()); } else { Lorentz5Momentum oldMomentum = (**pit).progenitor()->momentum(); Lorentz5Momentum newMomentum = partner->showerMomentum(); LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass()); (**pit).progenitor()->transform(boost); (**pit).copy() ->transform(boost); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); (**pit).progenitor()->transform(boost); (**pit).copy() ->transform(boost); } } // correction boosts for daughter trees for(map >::const_iterator tit = showerTree->treelinks().begin(); tit != showerTree->treelinks().end();++tit) { ShowerTreePtr decayTree = tit->first; map::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()); decayTree->transform(boost,true); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); decayTree->transform(boost,true); } } void QTildeShowerHandler::doShowering(bool hard,XCPtr xcomb) { // zero number of emissions _nis = _nfs = 0; // if MC@NLO H event and limited emissions // indicate both final and initial state emission if ( currentTree()->isMCatNLOHEvent() && _limitEmissions != 0 ) { _nis = _nfs = 1; } // extract particles to shower vector particlesToShower(setupShower(hard)); // check if we should shower bool colCharge = false; for(unsigned int ix=0;ixprogenitor()->dataPtr()->coloured() || particlesToShower[ix]->progenitor()->dataPtr()->charged()) { colCharge = true; break; } } if(!colCharge) { _currenttree->hasShowered(true); return; } // setup the maximum scales for the shower if (restrictPhasespace()) setupMaximumScales(particlesToShower,xcomb); // set the hard scales for the profiles setupHardScales(particlesToShower,xcomb); // specific stuff for hard processes and decays Energy minmass(ZERO), mIn(ZERO); // hard process generate the intrinsic p_T once and for all if(hard) { generateIntrinsicpT(particlesToShower); } // decay compute the minimum mass of the final-state else { for(unsigned int ix=0;ixprogenitor()->isFinalState()) { if(particlesToShower[ix]->progenitor()->dataPtr()->stable()){ auto dm= ShowerHandler::currentHandler()->retConstituentMasses()? particlesToShower[ix]->progenitor()->dataPtr()->constituentMass(): particlesToShower[ix]->progenitor()->dataPtr()->mass(); minmass += dm; }else minmass += particlesToShower[ix]->progenitor()->mass(); } else { mIn = particlesToShower[ix]->progenitor()->mass(); } } // throw exception if decay can't happen if ( minmass > mIn ) { throw Exception() << "QTildeShowerHandler.cc: Mass of decaying particle is " << "below constituent masses of decay products." << Exception::eventerror; } } // setup for reweighted bool reWeighting = _reWeight && hard && ShowerHandler::currentHandler()->firstInteraction(); double eventWeight=0.; unsigned int nTryReWeight(0); // create random particle vector (only need to do once) vector tmp; unsigned int nColouredIncoming = 0; while(particlesToShower.size()>0){ unsigned int xx=UseRandom::irnd(particlesToShower.size()); tmp.push_back(particlesToShower[xx]); particlesToShower.erase(particlesToShower.begin()+xx); } particlesToShower=tmp; for(unsigned int ix=0;ixprogenitor()->isFinalState() && particlesToShower[ix]->progenitor()->coloured()) ++nColouredIncoming; } bool switchRecon = hard && nColouredIncoming !=1; // main shower loop unsigned int ntry(0); bool reconstructed = false; do { // clear results of last attempt if needed if(ntry!=0) { currentTree()->clear(); setEvolutionPartners(hard,interaction_,true); _nis = _nfs = 0; // if MC@NLO H event and limited emissions // indicate both final and initial state emission if ( currentTree()->isMCatNLOHEvent() && _limitEmissions != 0 ) { _nis = _nfs = 1; } for(unsigned int ix=0; ixprogenitor()->spinInfo(); if(spin && spin->decayVertex() && dynamic_ptr_cast(spin->decayVertex())) { spin->decayVertex(VertexPtr()); } } for(unsigned int ix=0;ixprogenitor()->isFinalState() || (hard && !particlesToShower[ix]->progenitor()->isFinalState())) { if(particlesToShower[ix]->progenitor()->spinInfo()) particlesToShower[ix]->progenitor()->spinInfo()->reset(); } } } // loop over particles for(unsigned int ix=0;ixprogenitor()->isFinalState()) { if(!doFSR()) continue; // perform shower progenitor()->hasEmitted(startTimeLikeShower(interaction_)); } // initial-state radiation else { if(!doISR()) continue; // hard process if(hard) { // get the PDF setBeamParticle(_progenitor->beam()); if(!beamParticle()) { throw Exception() << "Incorrect type of beam particle in " << "QTildeShowerHandler::doShowering(). " << "This should not happen for conventional choices but may happen if you have used a" << " non-default choice and have not changed the create ParticleData line in the input files" << " for this particle to create BeamParticleData." << Exception::runerror; } // 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, interaction_)); } // decay else { // skip colour and electrically neutral particles if(!progenitor()->progenitor()->dataPtr()->coloured() && !progenitor()->progenitor()->dataPtr()->charged()) { progenitor()->hasEmitted(false); continue; } // perform shower // set the scales correctly. The current scale is the maximum scale for // emission not the starting scale ShowerParticle::EvolutionScales maxScales(progenitor()->progenitor()->scales()); progenitor()->progenitor()->scales() = ShowerParticle::EvolutionScales(); if(progenitor()->progenitor()->dataPtr()->charged()) { progenitor()->progenitor()->scales().QED = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QED_noAO = progenitor()->progenitor()->mass(); } if(progenitor()->progenitor()->hasColour()) { progenitor()->progenitor()->scales().QCD_c = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QCD_c_noAO = progenitor()->progenitor()->mass(); } if(progenitor()->progenitor()->hasAntiColour()) { progenitor()->progenitor()->scales().QCD_ac = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QCD_ac_noAO = progenitor()->progenitor()->mass(); } // perform the shower progenitor()->hasEmitted(startSpaceLikeDecayShower(maxScales,minmass, interaction_)); } } } // do the kinematic reconstruction, checking if it worked reconstructed = hard ? kinematicsReconstructor()-> reconstructHardJets (currentTree(),intrinsicpT(),interaction_, switchRecon && ntry>maximumTries()/2) : kinematicsReconstructor()-> reconstructDecayJets(currentTree(),interaction_); if(!reconstructed) continue; // apply vetos on the full shower for(vector::const_iterator it=_fullShowerVetoes.begin(); it!=_fullShowerVetoes.end();++it) { int veto = (**it).applyVeto(currentTree()); if(veto<0) continue; // veto the shower if(veto==0) { reconstructed = false; break; } // veto the shower and reweight else if(veto==1) { reconstructed = false; break; } // veto the event else if(veto==2) { throw Veto(); } } if(reWeighting) { if(reconstructed) eventWeight += 1.; reconstructed=false; ++nTryReWeight; if(nTryReWeight==_nReWeight) { reWeighting = false; if(eventWeight==0.) throw Veto(); } } } while(!reconstructed&&maximumTries()>++ntry); // check if failed to generate the shower if(ntry==maximumTries()) { if(hard) throw ShowerHandler::ShowerTriesVeto(ntry); else throw Exception() << "Failed to generate the shower after " << ntry << " attempts in QTildeShowerHandler::showerDecay()" << Exception::eventerror; } // handle the weights and apply any reweighting required if(nTryReWeight>0) { tStdEHPtr seh = dynamic_ptr_cast(generator()->currentEventHandler()); static bool first = true; if(seh) { seh->reweight(eventWeight/double(nTryReWeight)); } else if(first) { generator()->log() << "Reweighting the shower only works with internal Herwig7 processes" << "Presumably you are showering Les Houches Events. These will not be" << "reweighted\n"; first = false; } } // tree has now showered _currenttree->hasShowered(true); hardTree(HardTreePtr()); } void QTildeShowerHandler:: convertHardTree(bool hard,ShowerInteraction type) { map cmap; // incoming particles for(map::const_iterator cit=currentTree()->incomingLines().begin();cit!=currentTree()->incomingLines().end();++cit) { map::const_iterator mit = hardTree()->particles().find(cit->first->progenitor()); // put the colour lines in the map ShowerParticlePtr oldParticle = cit->first->progenitor(); ShowerParticlePtr newParticle = mit->second->branchingParticle(); ColinePtr cLine = oldParticle-> colourLine(); ColinePtr aLine = oldParticle->antiColourLine(); if(newParticle->colourLine() && cmap.find(newParticle-> colourLine())==cmap.end()) cmap[newParticle-> colourLine()] = cLine; if(newParticle->antiColourLine() && cmap.find(newParticle->antiColourLine())==cmap.end()) cmap[newParticle->antiColourLine()] = aLine; // check whether or not particle emits bool emission = mit->second->parent(); if(emission) { if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); } if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); } newParticle = mit->second->parent()->branchingParticle(); } // get the new colour lines ColinePtr newCLine,newALine; // sort out colour lines if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newCLine = cmap[ctemp]; } else { newCLine = new_ptr(ColourLine()); cmap[ctemp] = newCLine; } } // and anticolour lines if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newALine = cmap[ctemp]; } else { newALine = new_ptr(ColourLine()); cmap[ctemp] = newALine; } } // remove colour lines from old particle if(aLine) { aLine->removeAntiColoured(cit->first->copy()); aLine->removeAntiColoured(cit->first->progenitor()); } if(cLine) { cLine->removeColoured(cit->first->copy()); cLine->removeColoured(cit->first->progenitor()); } // add particle to colour lines if(newCLine) newCLine->addColoured (newParticle); if(newALine) newALine->addAntiColoured(newParticle); // insert new particles cit->first->copy(newParticle); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newParticle,1,false))); cit->first->progenitor(sp); currentTree()->incomingLines()[cit->first]=sp; cit->first->perturbative(!emission); // and the emitted particle if needed if(emission) { ShowerParticlePtr newOut = mit->second->parent()->children()[1]->branchingParticle(); if(newOut->colourLine()) { ColinePtr ctemp = newOut-> colourLine(); ctemp->removeColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addColoured (newOut); } if(newOut->antiColourLine()) { ColinePtr ctemp = newOut->antiColourLine(); ctemp->removeAntiColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addAntiColoured(newOut); } ShowerParticlePtr sout=new_ptr(ShowerParticle(*newOut,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(cit->first->original(),newOut,sout)); out->perturbative(false); currentTree()->outgoingLines().insert(make_pair(out,sout)); } if(hard) { // sort out the value of x if(mit->second->beam()->momentum().z()>ZERO) { sp->x(newParticle->momentum(). plus()/mit->second->beam()->momentum(). plus()); } else { sp->x(newParticle->momentum().minus()/mit->second->beam()->momentum().minus()); } } } // outgoing particles for(map::const_iterator cit=currentTree()->outgoingLines().begin();cit!=currentTree()->outgoingLines().end();++cit) { map >::const_iterator tit; for(tit = currentTree()->treelinks().begin(); tit != currentTree()->treelinks().end();++tit) { if(tit->second.first && tit->second.second==cit->first->progenitor()) break; } map::const_iterator mit = hardTree()->particles().find(cit->first->progenitor()); if(mit==hardTree()->particles().end()) continue; // put the colour lines in the map ShowerParticlePtr oldParticle = cit->first->progenitor(); ShowerParticlePtr newParticle = mit->second->branchingParticle(); ShowerParticlePtr newOut; ColinePtr cLine = oldParticle-> colourLine(); ColinePtr aLine = oldParticle->antiColourLine(); if(newParticle->colourLine() && cmap.find(newParticle-> colourLine())==cmap.end()) cmap[newParticle-> colourLine()] = cLine; if(newParticle->antiColourLine() && cmap.find(newParticle->antiColourLine())==cmap.end()) cmap[newParticle->antiColourLine()] = aLine; // check whether or not particle emits bool emission = !mit->second->children().empty(); if(emission) { if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); } if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); } newParticle = mit->second->children()[0]->branchingParticle(); newOut = mit->second->children()[1]->branchingParticle(); if(newParticle->id()!=oldParticle->id()&&newParticle->id()==newOut->id()) swap(newParticle,newOut); } // get the new colour lines ColinePtr newCLine,newALine; // sort out colour lines if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newCLine = cmap[ctemp]; } else { newCLine = new_ptr(ColourLine()); cmap[ctemp] = newCLine; } } // and anticolour lines if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newALine = cmap[ctemp]; } else { newALine = new_ptr(ColourLine()); cmap[ctemp] = newALine; } } // remove colour lines from old particle if(aLine) { aLine->removeAntiColoured(cit->first->copy()); aLine->removeAntiColoured(cit->first->progenitor()); } if(cLine) { cLine->removeColoured(cit->first->copy()); cLine->removeColoured(cit->first->progenitor()); } // special for unstable particles if(newParticle->id()==oldParticle->id() && (tit!=currentTree()->treelinks().end()||!oldParticle->dataPtr()->stable())) { Lorentz5Momentum oldMomentum = oldParticle->momentum(); Lorentz5Momentum newMomentum = newParticle->momentum(); LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass()); if(tit!=currentTree()->treelinks().end()) tit->first->transform(boost,false); oldParticle->transform(boost); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); oldParticle->transform(boost); if(tit!=currentTree()->treelinks().end()) tit->first->transform(boost,false); newParticle=oldParticle; } // add particle to colour lines if(newCLine) newCLine->addColoured (newParticle); if(newALine) newALine->addAntiColoured(newParticle); // insert new particles cit->first->copy(newParticle); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newParticle,1,true))); cit->first->progenitor(sp); currentTree()->outgoingLines()[cit->first]=sp; cit->first->perturbative(!emission); // and the emitted particle if needed if(emission) { if(newOut->colourLine()) { ColinePtr ctemp = newOut-> colourLine(); ctemp->removeColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addColoured (newOut); } if(newOut->antiColourLine()) { ColinePtr ctemp = newOut->antiColourLine(); ctemp->removeAntiColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addAntiColoured(newOut); } ShowerParticlePtr sout=new_ptr(ShowerParticle(*newOut,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(cit->first->original(),newOut,sout)); out->perturbative(false); currentTree()->outgoingLines().insert(make_pair(out,sout)); } // update any decay products if(tit!=currentTree()->treelinks().end()) currentTree()->updateLink(tit->first,make_pair(cit->first,sp)); } // reset the tree currentTree()->resetShowerProducts(); // reextract the particles and set the colour partners vector particles = currentTree()->extractProgenitorParticles(); // clear the partners for(unsigned int ix=0;ixpartner(ShowerParticlePtr()); particles[ix]->clearPartners(); } // clear the tree hardTree(HardTreePtr()); // Set the initial evolution scales partnerFinder()-> setInitialEvolutionScales(particles,!hard,type,!_hardtree); } Branching QTildeShowerHandler::selectTimeLikeBranching(tShowerParticlePtr particle, ShowerInteraction type, HardBranchingPtr branch) { Branching fb; unsigned int iout=0; while (true) { // break if doing truncated shower and no truncated shower needed if(branch && (!isTruncatedShowerON()||hardOnly())) break; fb=_splittingGenerator->chooseForwardBranching(*particle,_finalenhance,type); // no emission break if(!fb.kinematics) break; // special for truncated shower if(branch) { // check haven't evolved too far if(fb.kinematics->scale() < branch->scale()) { fb=Branching(); break; } // find the truncated line iout=0; if(fb.ids[1]->id()!=fb.ids[2]->id()) { if(fb.ids[1]->id()==particle->id()) iout=1; else if (fb.ids[2]->id()==particle->id()) iout=2; } else if(fb.ids[1]->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->vetoEmission(fb.type,fb.kinematics->scale()); continue; } double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z(); // only if same interaction for forced branching ShowerInteraction type2 = convertInteraction(fb.type); // and evolution if(type2==branch->sudakov()->interactionType()) { if(zsplit < 0.5 || // hardest line veto fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // pt veto if(fb.kinematics->pT() > progenitor()->maximumpT(type2)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // standard vetos for all emissions if(timeLikeVetoed(fb,particle)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); continue; } // special for already decayed particles // don't allow flavour changing branchings bool vetoDecay = false; for(map >::const_iterator tit = currentTree()->treelinks().begin(); tit != currentTree()->treelinks().end();++tit) { if(tit->second.first == progenitor()) { map::const_iterator it = currentTree()->outgoingLines().find(progenitor()); if(it!=currentTree()->outgoingLines().end() && particle == it->second && fb.ids[0]!=fb.ids[1] && fb.ids[1]!=fb.ids[2]) { vetoDecay = true; break; } } } if(vetoDecay) { particle->vetoEmission(fb.type,fb.kinematics->scale()); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); continue; } break; } // normal case if(!branch) { if(fb.kinematics) fb.hard = false; return fb; } // truncated emission if(fb.kinematics) { fb.hard = false; fb.iout = iout; return fb; } // otherwise need to return the hard emission // construct the kinematics for the hard emission ShoKinPtr showerKin = new_ptr(FS_QTildeShowerKinematics1to2( branch->scale(), branch->children()[0]->z(), branch->phi(), branch->children()[0]->pT(), branch->sudakov() )); IdList idlist(3); idlist[0] = particle->dataPtr(); idlist[1] = branch->children()[0]->branchingParticle()->dataPtr(); idlist[2] = branch->children()[1]->branchingParticle()->dataPtr(); fb = Branching( showerKin, idlist, branch->sudakov(),branch->type() ); fb.hard = true; fb.iout=0; // return it return fb; } Branching QTildeShowerHandler::selectSpaceLikeDecayBranching(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass,ShowerInteraction type, HardBranchingPtr branch) { Branching fb; unsigned int iout=0; while (true) { // break if doing truncated shower and no truncated shower needed if(branch && (!isTruncatedShowerON()||hardOnly())) break; // select branching fb=_splittingGenerator->chooseDecayBranching(*particle,maxScales,minmass, _initialenhance,type); // return if no radiation if(!fb.kinematics) break; // special for truncated shower if(branch) { // check haven't evolved too far if(fb.kinematics->scale() < branch->scale()) { fb=Branching(); break; } // find the truncated line iout=0; if(fb.ids[1]->id()!=fb.ids[2]->id()) { if(fb.ids[1]->id()==particle->id()) iout=1; else if (fb.ids[2]->id()==particle->id()) iout=2; } else if(fb.ids[1]->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->vetoEmission(fb.type,fb.kinematics->scale()); continue; } ShowerInteraction type2 = convertInteraction(fb.type); double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z(); if(type2==branch->sudakov()->interactionType()) { if(zsplit < 0.5 || // hardest line veto fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // pt veto if(fb.kinematics->pT() > progenitor()->maximumpT(type2)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // if not vetoed break if(spaceLikeDecayVetoed(fb,particle)) { // otherwise reset scale and continue particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } break; } // normal case if(!branch) { if(fb.kinematics) fb.hard = false; return fb; } // truncated emission if(fb.kinematics) { fb.hard = false; fb.iout = iout; return fb; } // otherwise need to return the hard emission // construct the kinematics for the hard emission ShoKinPtr showerKin = new_ptr(Decay_QTildeShowerKinematics1to2( branch->scale(), branch->children()[0]->z(), branch->phi(), branch->children()[0]->pT(), branch->sudakov())); IdList idlist(3); idlist[0] = particle->dataPtr(); idlist[1] = branch->children()[0]->branchingParticle()->dataPtr(); idlist[2] = branch->children()[1]->branchingParticle()->dataPtr(); // create the branching fb = Branching( showerKin, idlist, branch->sudakov(),ShowerPartnerType::QCDColourLine ); fb.hard=true; fb.iout=0; // return it return fb; } void QTildeShowerHandler::checkFlags() { string error = "Inconsistent hard emission set-up in QTildeShowerHandler::showerHardProcess(). "; if ( ( currentTree()->isMCatNLOSEvent() || currentTree()->isMCatNLOHEvent() ) ) { if (_hardEmission ==2 ) throw Exception() << error << "Cannot generate POWHEG matching with MC@NLO shower " << "approximation. Add 'set QTildeShowerHandler:HardEmission 0' to input file." << Exception::runerror; if ( canHandleMatchboxTrunc() ) throw Exception() << error << "Cannot use truncated qtilde shower with MC@NLO shower " << "approximation. Set LHCGenerator:EventHandler" << ":CascadeHandler to '/Herwig/Shower/ShowerHandler' or " << "'/Herwig/Shower/Dipole/DipoleShowerHandler'." << Exception::runerror; } else if ( ((currentTree()->isPowhegSEvent() || currentTree()->isPowhegHEvent()) ) && _hardEmission != 2){ if ( canHandleMatchboxTrunc()) throw Exception() << error << "Unmatched events requested for POWHEG shower " << "approximation. Set QTildeShowerHandler:HardEmission to " << "'POWHEG'." << Exception::runerror; else if (_hardEmissionWarn) { _hardEmissionWarn = false; _hardEmission=2; throw Exception() << error << "Unmatched events requested for POWHEG shower " << "approximation. Changing QTildeShowerHandler:HardEmission from " << _hardEmission << " to 2" << Exception::warning; } } if ( currentTree()->isPowhegSEvent() || currentTree()->isPowhegHEvent()) { if (currentTree()->showerApproximation()->needsTruncatedShower() && !canHandleMatchboxTrunc() ) throw Exception() << error << "Current shower handler cannot generate truncated shower. " << "Set Generator:EventHandler:CascadeHandler to " << "'/Herwig/Shower/PowhegShowerHandler'." << Exception::runerror; } else if ( currentTree()->truncatedShower() && _missingTruncWarn) { _missingTruncWarn=false; throw Exception() << "Warning: POWHEG shower approximation used without " << "truncated shower. Set Generator:EventHandler:" << "CascadeHandler to '/Herwig/Shower/PowhegShowerHandler' and " << "'MEMatching:TruncatedShower Yes'." << Exception::warning; } // else if ( !dipme && _hardEmissionMode > 1 && // firstInteraction()) // throw Exception() << error // << "POWHEG matching requested for LO events. Include " // << "'set Factory:ShowerApproximation MEMatching' in input file." // << Exception::runerror; } tPPair QTildeShowerHandler::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 // ATTENTION Broken here for very strange configuration PBIPair newbins = pex.newRemnants(oldp, newp, newStep()); newStep()->addIntermediate(newp.first); newStep()->addIntermediate(newp.second); // return the new partons return newp; } PPtr QTildeShowerHandler::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 == incomingBeams().first || parent == incomingBeams().second ) return seed; else return findFirstParton(parent); } void QTildeShowerHandler::decay(ShowerTreePtr tree, ShowerDecayMap & decay) { // must be one incoming particle assert(tree->incomingLines().size()==1); // apply any transforms tree->applyTransforms(); // if already decayed return if(!tree->outgoingLines().empty()) return; // now we need to replace the particle with a new copy after the shower // find particle after the shower map >::const_iterator tit = tree->parent()->treelinks().find(tree); assert(tit!=tree->parent()->treelinks().end()); ShowerParticlePtr newparent=tit->second.second; PerturbativeProcessPtr newProcess = new_ptr(PerturbativeProcess()); newProcess->incoming().push_back(make_pair(newparent,PerturbativeProcessPtr())); DecayProcessMap decayMap; ShowerHandler::decay(newProcess,decayMap); ShowerTree::constructTrees(tree,decay,newProcess,decayMap); } namespace { ShowerProgenitorPtr findFinalStateLine(ShowerTreePtr tree, long id, Lorentz5Momentum momentum) { map::iterator partner; Energy2 dmin(1e30*GeV2); for(map::iterator cit =tree->outgoingLines().begin(); cit!=tree->outgoingLines().end(); ++cit) { if(cit->second->id()!=id) continue; Energy2 test = sqr(cit->second->momentum().x()-momentum.x())+ sqr(cit->second->momentum().y()-momentum.y())+ sqr(cit->second->momentum().z()-momentum.z())+ sqr(cit->second->momentum().t()-momentum.t()); if(testfirst; } ShowerProgenitorPtr findInitialStateLine(ShowerTreePtr tree, long id, Lorentz5Momentum momentum) { map::iterator partner; Energy2 dmin(1e30*GeV2); for(map::iterator cit =tree->incomingLines().begin(); cit!=tree->incomingLines().end(); ++cit) { if(cit->second->id()!=id) continue; Energy2 test = sqr(cit->second->momentum().x()-momentum.x())+ sqr(cit->second->momentum().y()-momentum.y())+ sqr(cit->second->momentum().z()-momentum.z())+ sqr(cit->second->momentum().t()-momentum.t()); if(testfirst; } void fixSpectatorColours(PPtr newSpect,ShowerProgenitorPtr oldSpect, ColinePair & cline,ColinePair & aline, bool reconnect) { cline.first = oldSpect->progenitor()->colourLine(); cline.second = newSpect->colourLine(); aline.first = oldSpect->progenitor()->antiColourLine(); aline.second = newSpect->antiColourLine(); if(!reconnect) return; if(cline.first) { cline.first ->removeColoured(oldSpect->copy()); cline.first ->removeColoured(oldSpect->progenitor()); cline.second->removeColoured(newSpect); cline.first ->addColoured(newSpect); } if(aline.first) { aline.first ->removeAntiColoured(oldSpect->copy()); aline.first ->removeAntiColoured(oldSpect->progenitor()); aline.second->removeAntiColoured(newSpect); aline.first ->addAntiColoured(newSpect); } } void fixInitialStateEmitter(ShowerTreePtr tree, PPtr newEmit,PPtr emitted, ShowerProgenitorPtr emitter, ColinePair cline,ColinePair aline,double x) { // sort out the colours if(emitted->dataPtr()->iColour()==PDT::Colour8) { // emitter if(cline.first && cline.first == emitter->progenitor()->antiColourLine() && cline.second !=newEmit->antiColourLine()) { // sort out not radiating line ColinePtr col = emitter->progenitor()->colourLine(); if(col) { col->removeColoured(emitter->copy()); col->removeColoured(emitter->progenitor()); newEmit->colourLine()->removeColoured(newEmit); col->addColoured(newEmit); } } else if(aline.first && aline.first == emitter->progenitor()->colourLine() && aline.second !=newEmit->colourLine()) { // sort out not radiating line ColinePtr anti = emitter->progenitor()->antiColourLine(); if(anti) { anti->removeAntiColoured(emitter->copy()); anti->removeAntiColoured(emitter->progenitor()); newEmit->colourLine()->removeAntiColoured(newEmit); anti->addAntiColoured(newEmit); } } else assert(false); // emitted if(cline.first && cline.second==emitted->colourLine()) { cline.second->removeColoured(emitted); cline.first->addColoured(emitted); } else if(aline.first && aline.second==emitted->antiColourLine()) { aline.second->removeAntiColoured(emitted); aline.first->addAntiColoured(emitted); } else assert(false); } else { if(emitter->progenitor()->antiColourLine() ) { ColinePtr col = emitter->progenitor()->antiColourLine(); col->removeAntiColoured(emitter->copy()); col->removeAntiColoured(emitter->progenitor()); if(newEmit->antiColourLine()) { newEmit->antiColourLine()->removeAntiColoured(newEmit); col->addAntiColoured(newEmit); } else if (emitted->colourLine()) { emitted->colourLine()->removeColoured(emitted); col->addColoured(emitted); } else assert(false); } if(emitter->progenitor()->colourLine() ) { ColinePtr col = emitter->progenitor()->colourLine(); col->removeColoured(emitter->copy()); col->removeColoured(emitter->progenitor()); if(newEmit->colourLine()) { newEmit->colourLine()->removeColoured(newEmit); col->addColoured(newEmit); } else if (emitted->antiColourLine()) { emitted->antiColourLine()->removeAntiColoured(emitted); col->addAntiColoured(emitted); } else assert(false); } } // update the emitter emitter->copy(newEmit); ShowerParticlePtr sp = new_ptr(ShowerParticle(*newEmit,1,false)); sp->x(x); emitter->progenitor(sp); tree->incomingLines()[emitter]=sp; emitter->perturbative(false); // add emitted sp=new_ptr(ShowerParticle(*emitted,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(emitter->original(),emitted,sp)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sp)); } void fixFinalStateEmitter(ShowerTreePtr tree, PPtr newEmit,PPtr emitted, ShowerProgenitorPtr emitter, ColinePair cline,ColinePair aline) { map >::const_iterator tit; // special case if decayed for(tit = tree->treelinks().begin(); tit != tree->treelinks().end();++tit) { if(tit->second.first && tit->second.second==emitter->progenitor()) break; } // sort out the colour lines if(cline.first && cline.first == emitter->progenitor()->antiColourLine() && cline.second !=newEmit->antiColourLine()) { // sort out not radiating line ColinePtr col = emitter->progenitor()->colourLine(); if(col) { col->removeColoured(emitter->copy()); col->removeColoured(emitter->progenitor()); newEmit->colourLine()->removeColoured(newEmit); col->addColoured(newEmit); } } else if(aline.first && aline.first == emitter->progenitor()->colourLine() && aline.second !=newEmit->colourLine()) { // sort out not radiating line ColinePtr anti = emitter->progenitor()->antiColourLine(); if(anti) { anti->removeAntiColoured(emitter->copy()); anti->removeAntiColoured(emitter->progenitor()); newEmit->colourLine()->removeAntiColoured(newEmit); anti->addAntiColoured(newEmit); } } else assert(false); // update the emitter emitter->copy(newEmit); ShowerParticlePtr sp = new_ptr(ShowerParticle(*newEmit,1,true)); emitter->progenitor(sp); tree->outgoingLines()[emitter]=sp; emitter->perturbative(false); // update for decaying particles if(tit!=tree->treelinks().end()) tree->updateLink(tit->first,make_pair(emitter,sp)); // add the emitted particle // sort out the colour if(cline.first && cline.second==emitted->antiColourLine()) { cline.second->removeAntiColoured(emitted); cline.first->addAntiColoured(emitted); } else if(aline.first && aline.second==emitted->colourLine()) { aline.second->removeColoured(emitted); aline.first->addColoured(emitted); } else assert(false); sp=new_ptr(ShowerParticle(*emitted,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(emitter->original(), emitted,sp)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sp)); } } void QTildeShowerHandler::setupMECorrection(RealEmissionProcessPtr real) { assert(real); // II emission if(real->emitter() < real->incoming().size() && real->spectator() < real->incoming().size()) { // recoiling system for( map::const_iterator cjt= currentTree()->outgoingLines().begin(); cjt != currentTree()->outgoingLines().end();++cjt ) { cjt->first->progenitor()->transform(real->transformation()); cjt->first->copy()->transform(real->transformation()); } // the the radiating system ShowerProgenitorPtr emitter,spectator; unsigned int iemit = real->emitter(); unsigned int ispect = real->spectator(); int ig = int(real->emitted())-int(real->incoming().size()); emitter = findInitialStateLine(currentTree(), real->bornIncoming()[iemit]->id(), real->bornIncoming()[iemit]->momentum()); spectator = findInitialStateLine(currentTree(), real->bornIncoming()[ispect]->id(), real->bornIncoming()[ispect]->momentum()); // sort out the colours ColinePair cline,aline; fixSpectatorColours(real->incoming()[ispect],spectator,cline,aline,true); // update the spectator spectator->copy(real->incoming()[ispect]); ShowerParticlePtr sp(new_ptr(ShowerParticle(*real->incoming()[ispect],1,false))); sp->x(ispect ==0 ? real->x().first :real->x().second); spectator->progenitor(sp); currentTree()->incomingLines()[spectator]=sp; spectator->perturbative(true); // now for the emitter fixInitialStateEmitter(currentTree(),real->incoming()[iemit],real->outgoing()[ig], emitter,cline,aline,iemit ==0 ? real->x().first :real->x().second); } // FF emission else if(real->emitter() >= real->incoming().size() && real->spectator() >= real->incoming().size()) { assert(real->outgoing()[real->emitted()-real->incoming().size()]->id()==ParticleID::g); // find the emitter and spectator in the shower tree ShowerProgenitorPtr emitter,spectator; int iemit = int(real->emitter())-int(real->incoming().size()); emitter = findFinalStateLine(currentTree(), real->bornOutgoing()[iemit]->id(), real->bornOutgoing()[iemit]->momentum()); int ispect = int(real->spectator())-int(real->incoming().size()); spectator = findFinalStateLine(currentTree(), real->bornOutgoing()[ispect]->id(), real->bornOutgoing()[ispect]->momentum()); map >::const_iterator tit; // first the spectator // special case if decayed for(tit = currentTree()->treelinks().begin(); tit != currentTree()->treelinks().end();++tit) { if(tit->second.first && tit->second.second==spectator->progenitor()) break; } // sort out the colours ColinePair cline,aline; fixSpectatorColours(real->outgoing()[ispect],spectator,cline,aline,true); // update the spectator spectator->copy(real->outgoing()[ispect]); ShowerParticlePtr sp(new_ptr(ShowerParticle(*real->outgoing()[ispect],1,true))); spectator->progenitor(sp); currentTree()->outgoingLines()[spectator]=sp; spectator->perturbative(true); // update for decaying particles if(tit!=currentTree()->treelinks().end()) currentTree()->updateLink(tit->first,make_pair(spectator,sp)); // now the emitting particle int ig = int(real->emitted())-int(real->incoming().size()); fixFinalStateEmitter(currentTree(),real->outgoing()[iemit], real->outgoing()[ig], emitter,cline,aline); } // IF emission else { // scattering process if(real->incoming().size()==2) { ShowerProgenitorPtr emitter,spectator; unsigned int iemit = real->emitter(); unsigned int ispect = real->spectator(); int ig = int(real->emitted())-int(real->incoming().size()); ColinePair cline,aline; // incoming spectator if(ispect<2) { spectator = findInitialStateLine(currentTree(), real->bornIncoming()[ispect]->id(), real->bornIncoming()[ispect]->momentum()); fixSpectatorColours(real->incoming()[ispect],spectator,cline,aline,true); // update the spectator spectator->copy(real->incoming()[ispect]); ShowerParticlePtr sp(new_ptr(ShowerParticle(*real->incoming()[ispect],1,false))); sp->x(ispect ==0 ? real->x().first :real->x().second); spectator->progenitor(sp); currentTree()->incomingLines()[spectator]=sp; spectator->perturbative(true); } // outgoing spectator else { spectator = findFinalStateLine(currentTree(), real->bornOutgoing()[ispect-real->incoming().size()]->id(), real->bornOutgoing()[ispect-real->incoming().size()]->momentum()); // special case if decayed map >::const_iterator tit; for(tit = currentTree()->treelinks().begin(); tit != currentTree()->treelinks().end();++tit) { if(tit->second.first && tit->second.second==spectator->progenitor()) break; } fixSpectatorColours(real->outgoing()[ispect-real->incoming().size()],spectator,cline,aline,true); // update the spectator spectator->copy(real->outgoing()[ispect-real->incoming().size()]); ShowerParticlePtr sp(new_ptr(ShowerParticle(*real->outgoing()[ispect-real->incoming().size()],1,true))); spectator->progenitor(sp); currentTree()->outgoingLines()[spectator]=sp; spectator->perturbative(true); // update for decaying particles if(tit!=currentTree()->treelinks().end()) currentTree()->updateLink(tit->first,make_pair(spectator,sp)); } // incoming emitter if(iemit<2) { emitter = findInitialStateLine(currentTree(), real->bornIncoming()[iemit]->id(), real->bornIncoming()[iemit]->momentum()); fixInitialStateEmitter(currentTree(),real->incoming()[iemit],real->outgoing()[ig], emitter,aline,cline,iemit ==0 ? real->x().first :real->x().second); } // outgoing emitter else { emitter = findFinalStateLine(currentTree(), real->bornOutgoing()[iemit-real->incoming().size()]->id(), real->bornOutgoing()[iemit-real->incoming().size()]->momentum()); fixFinalStateEmitter(currentTree(),real->outgoing()[iemit-real->incoming().size()], real->outgoing()[ig],emitter,aline,cline); } } // decay process else { assert(real->spectator()==0); unsigned int iemit = real->emitter()-real->incoming().size(); int ig = int(real->emitted())-int(real->incoming().size()); ColinePair cline,aline; // incoming spectator ShowerProgenitorPtr spectator = findInitialStateLine(currentTree(), real->bornIncoming()[0]->id(), real->bornIncoming()[0]->momentum()); fixSpectatorColours(real->incoming()[0],spectator,cline,aline,false); // find the emitter ShowerProgenitorPtr emitter = findFinalStateLine(currentTree(), real->bornOutgoing()[iemit]->id(), real->bornOutgoing()[iemit]->momentum()); // recoiling system for( map::const_iterator cjt= currentTree()->outgoingLines().begin(); cjt != currentTree()->outgoingLines().end();++cjt ) { if(cjt->first==emitter) continue; cjt->first->progenitor()->transform(real->transformation()); cjt->first->copy()->transform(real->transformation()); } // sort out the emitter fixFinalStateEmitter(currentTree(),real->outgoing()[iemit], real->outgoing()[ig],emitter,aline,cline); } } // clean up the shower tree _currenttree->resetShowerProducts(); } diff --git a/Shower/UEBase.h b/Shower/UEBase.h --- a/Shower/UEBase.h +++ b/Shower/UEBase.h @@ -1,131 +1,141 @@ // -*- C++ -*- #ifndef HERWIG_UEBase_H #define HERWIG_UEBase_H // // This is the declaration of the UEBase class. // #include "ThePEG/Interface/Interfaced.h" #include "ThePEG/Handlers/StandardXComb.fh" #include "UEBase.fh" namespace Herwig { using namespace ThePEG; /** * Abstract base class used to minimize the dependence between * MPIHandler and all Shower classes. * * \author Manuel B\"ahr * * @see \ref UEBaseInterfaces "The interfaces" * defined for UEBase. */ class UEBase: public Interfaced { 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(); /** @name Virtual functions used for the generation of additional interactions . */ //@{ /** * Some initialization code eventually. */ virtual void initialize() {} /** * Return true or false depending on the generator setup. */ virtual bool beamOK() const = 0; /** * Return true or false depending on whether soft interactions are enabled. */ virtual bool softInt() const {return false;} /** * Return the value of the pt cutoff. */ virtual Energy Ptmin() const = 0; /** * Return the slope of the soft pt spectrum. Only necessary when the * soft part is modelled. */ virtual InvEnergy2 beta() const {return ZERO;} /** * Some finalize code eventually. */ virtual void finalize() {} /** * Clean up method called after each event. */ virtual void clean() {} /** * Return the number of different hard processes. Use 0 as default to * not require implementation. */ virtual unsigned int additionalHardProcs() const {return 0;} /** * return the hard multiplicity of process i. Can't be constant in my * case because drawing from the probability distribution also * specifies the soft multiplicity that has to be stored.... */ virtual unsigned int multiplicity(unsigned int i=0) = 0; /** * Generate a additional interaction for ProcessHandler sel. Method * can't be const because it saves the state of the underlying XComb * object on it's way. */ virtual tStdXCombPtr generate(unsigned int sel=0) = 0; /** * Return the type of algorithm. */ virtual int Algorithm() const = 0; /** * Return the value of the hard Process pt cutoff for vetoing. */ virtual Energy PtForVeto() const = 0; /** * Return the fraction of colour disrupted subprocesses. Use default 0 * so that it is not required to implement. */ virtual double colourDisrupt() const {return 0.0;} /** * Return the soft multiplicity. Use 0 as default to not require * implementation. */ virtual unsigned int softMultiplicity() const {return 0;} //@} + /** + * Return the inelastic cross section ( sigmaND + sigmaDiff ) + */ + virtual CrossSection inelasticXSec() const =0; + + /** + * Return the diffractiv cross section assumed by the model. + */ + virtual CrossSection diffractiveXSec() const =0; + private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ UEBase & operator=(const UEBase &) = delete; }; } #endif /* HERWIG_UEBase_H */ diff --git a/Tests/Makefile.am b/Tests/Makefile.am --- a/Tests/Makefile.am +++ b/Tests/Makefile.am @@ -1,373 +1,371 @@ AM_LDFLAGS += -module -avoid-version -rpath /dummy/path/not/used EXTRA_DIST = Inputs python Rivet EXTRA_LTLIBRARIES = LeptonTest.la GammaTest.la HadronTest.la DISTest.la if WANT_LIBFASTJET EXTRA_LTLIBRARIES += HadronJetTest.la LeptonJetTest.la HadronJetTest_la_SOURCES = \ Hadron/VHTest.h Hadron/VHTest.cc\ Hadron/VTest.h Hadron/VTest.cc\ Hadron/HTest.h Hadron/HTest.cc HadronJetTest_la_CPPFLAGS = $(AM_CPPFLAGS) $(FASTJETINCLUDE) \ -I$(FASTJETPATH) HadronJetTest_la_LIBADD = $(FASTJETLIBS) LeptonJetTest_la_SOURCES = \ Lepton/TopDecay.h Lepton/TopDecay.cc LeptonJetTest_la_CPPFLAGS = $(AM_CPPFLAGS) $(FASTJETINCLUDE) \ -I$(FASTJETPATH) LeptonJetTest_la_LIBADD = $(FASTJETLIBS) endif LeptonTest_la_SOURCES = \ Lepton/VVTest.h Lepton/VVTest.cc \ Lepton/VBFTest.h Lepton/VBFTest.cc \ Lepton/VHTest.h Lepton/VHTest.cc \ Lepton/FermionTest.h Lepton/FermionTest.cc GammaTest_la_SOURCES = \ Gamma/GammaMETest.h Gamma/GammaMETest.cc \ Gamma/GammaPMETest.h Gamma/GammaPMETest.cc DISTest_la_SOURCES = \ DIS/DISTest.h DIS/DISTest.cc HadronTest_la_SOURCES = \ Hadron/HadronVVTest.h Hadron/HadronVVTest.cc\ Hadron/HadronVBFTest.h Hadron/HadronVBFTest.cc\ Hadron/WHTest.h Hadron/WHTest.cc\ Hadron/ZHTest.h Hadron/ZHTest.cc\ Hadron/VGammaTest.h Hadron/VGammaTest.cc\ Hadron/ZJetTest.h Hadron/ZJetTest.cc\ Hadron/WJetTest.h Hadron/WJetTest.cc\ Hadron/QQHTest.h Hadron/QQHTest.cc REPO = $(top_builddir)/src/HerwigDefaults.rpo HERWIG = $(top_builddir)/src/Herwig HWREAD = $(HERWIG) read --repo $(REPO) -L $(builddir)/.libs -i $(top_builddir)/src HWBUILD = $(HERWIG) build --repo $(REPO) -L $(builddir)/.libs -i $(top_builddir)/src HWINTEGRATE = $(HERWIG) integrate HWRUN = $(HERWIG) run -N $${NUMEVENTS:-10000} tests : tests-LEP tests-DIS tests-LHC tests-Gamma LEPDEPS = \ test-LEP-VV \ test-LEP-VH \ test-LEP-VBF \ test-LEP-BB \ test-LEP-Quarks \ test-LEP-Leptons if WANT_LIBFASTJET LEPDEPS += test-LEP-TopDecay endif tests-LEP : $(LEPDEPS) tests-DIS : test-DIS-Charged test-DIS-Neutral LHCDEPS = \ test-LHC-WW test-LHC-WZ test-LHC-ZZ \ test-LHC-ZGamma test-LHC-WGamma \ test-LHC-ZH test-LHC-WH \ test-LHC-ZJet test-LHC-WJet \ test-LHC-Z test-LHC-W \ test-LHC-ZZVBF test-LHC-VBF \ test-LHC-WWVBF \ test-LHC-bbH test-LHC-ttH \ test-LHC-GammaGamma test-LHC-GammaJet \ test-LHC-Higgs test-LHC-HiggsJet \ test-LHC-QCDFast test-LHC-QCD \ test-LHC-Top if WANT_LIBFASTJET LHCDEPS += \ test-LHC-Bottom \ test-LHC-WHJet test-LHC-ZHJet test-LHC-HJet \ test-LHC-ZShower test-LHC-WShower \ test-LHC-WHJet-Powheg test-LHC-ZHJet-Powheg test-LHC-HJet-Powheg \ test-LHC-ZShower-Powheg test-LHC-WShower-Powheg endif tests-LHC : $(LHCDEPS) tests-Gamma : test-Gamma-FF test-Gamma-WW test-Gamma-P LEPLIBS = LeptonTest.la HADLIBS = HadronTest.la if WANT_LIBFASTJET LEPLIBS += LeptonJetTest.la HADLIBS += HadronJetTest.la endif test-LEP-% : Inputs/LEP-%.in $(LEPLIBS) $(HWREAD) $< $(HWRUN) $(notdir $(subst .in,.run,$<)) test-Gamma-% : Inputs/Gamma-%.in GammaTest.la $(HWREAD) $< $(HWRUN) $(notdir $(subst .in,.run,$<)) test-DIS-% : Inputs/DIS-%.in DISTest.la $(HWREAD) $< $(HWRUN) $(notdir $(subst .in,.run,$<)) test-LHC-% : Inputs/LHC-%.in GammaTest.la $(HADLIBS) $(HWREAD) $< $(HWRUN) $(notdir $(subst .in,.run,$<)) tests-Rivet : Rivet-EE Rivet-DIS Rivet-Star Rivet-SppS \ Rivet-TVT-WZ Rivet-TVT-Photon Rivet-TVT-Jets \ Rivet-LHC-Jets Rivet-LHC-EW Rivet-LHC-Photon Rivet-LHC-Higgs Rivet-%.run : Rivet/%.in $(HWBUILD) -c .cache/$(subst .run,,$@) $< Rivet-Matchbox-%.yoda : Rivet-Matchbox-%.run $(HWINTEGRATE) -c .cache/$(subst .run,,$<) $< $(HWRUN) -c .cache/$(subst .run,,$<) $< Rivet-%.yoda : Rivet-%.run $(HWRUN) $< Rivet/%.in : python/make_input_files.py $(notdir $(subst .in,,$@)) - - -Rivet-inputfiles: $(shell echo Rivet/EE{,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg,-Merging}-{7.7,9.4,12,13,17,27.6,29,30.2,30.7,30,31.3,34,34.8,41,42.1,42.6,43.6,45,50,52,53.3,55,56,57,58,59.5,60.8,60,61.4,66,76,82,8510,12.8,21.522,25,26.8,34.5,35,36.2,44,48.0,91,93.0,130,133,136,161,172,177,183,189,192,196,197,200,202,205,206,207,91-nopi}.in) \ - $(shell echo Rivet/EE{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Powheg,-Matchbox-Powheg}-{14,14.8}.in) \ +Rivet-inputfiles: $(shell echo Rivet/EE{,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg,-Merging}-{9.4,12,13,17,27.6,29,30.2,30.7,30,31.3,34.8,41,43.6,45,50,52,55,56,57,60.8,60,61.4,66,76,82,85,10,12.8,22,26.8,35,44,48.0,91,93.0,130,133,136,161,172,177,183,189,192,196,197,200,202,206,91-nopi}.in) \ + $(shell echo Rivet/EE{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Powheg,-Matchbox-Powheg}-14.in) \ $(shell echo Rivet/EE{,-Dipole}-{10.5,11.96,12.8,13.96,16.86,21.84,26.8,28.48,35.44,48.0,97.0}-gg.in) \ - $(shell echo Rivet/EE{,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg}-{2.2,2.6,3.0,3.2,4.6,4.8,3.63,4.03,4.5,9.46,10.00,10.52,10.52-sym,10.54,10.45,10.47}.in) \ - $(shell echo Rivet/EE-{Upsilon,Upsilon2,Upsilon4,Tau,Phi,JPsi,Psi2S,10.58-res,Lambdac,Omega,Xi0,Xic0,Xim}.in) \ + $(shell echo Rivet/EE{,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg}-{2.2,2.6,3.0,3.2,4.6,4.8,4.5,10.52,10.52-sym,10.54,10.45,10.47}.in) \ + $(shell echo Rivet/EE-{Upsilon,Upsilon2,Upsilon4,JPsi,Psi2S,Tau,10.58-res,Lambdac,Omega,Xi0,Xic0,Xim}.in) \ $(shell echo Rivet/DIS{,-NoME,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg,-Merging}-{e--LowQ2,e+-LowQ2,e+-HighQ2}.in) \ $(shell echo Rivet/TVT{,-Powheg,-Matchbox,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox-Powheg,-Merging}-{Run-I-Z,Run-I-W,Run-I-WZ,Run-II-Z-e,Run-II-Z-{,LowMass-,HighMass-}mu,Run-II-W}.in) \ $(shell echo Rivet/TVT{,-Dipole}-Run-II-{DiPhoton-GammaGamma,DiPhoton-GammaJet,PromptPhoton}.in) \ $(shell echo Rivet/TVT-Powheg-Run-II-{DiPhoton-GammaGamma,DiPhoton-GammaJet}.in) \ $(shell echo Rivet/TVT{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-{Run-II-Jets-{0..11},Run-I-Jets-{1..8}}.in ) \ $(shell echo Rivet/TVT{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-{630-Jets-{1..3},300-Jets-1,900-Jets-1}.in ) \ $(shell echo Rivet/TVT{,-Dipole}-{Run-I,Run-II,300,630,900}-UE.in) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-7-DiJets-{1..7}-{A,B,C}.in ) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-13-DiJets-{{1..11}-A,{6..11}-B}.in ) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-{7,8,13}-Jets-{0..10}.in ) \ $(shell echo Rivet/LHC{,-Dipole}-{900,2360,2760,7,8,13}-UE.in ) \ $(shell echo Rivet/LHC{,-Dipole}-{900,7,13}-UE-Long.in ) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-7-Charm-{1..5}.in) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-7-Bottom-{0..9}.in) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-7-Top-{L,SL}.in) \ $(shell echo Rivet/LHC{,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Matchbox,-Matchbox-Powheg,-Merging}-{8,13}-Top-{All,L,SL}.in) \ $(shell echo Rivet/Star{,-Dipole}-{UE,Jets-{1..4}}.in ) \ $(shell echo Rivet/SppS{,-Dipole}-{200,500,900,546}-UE.in ) \ $(shell echo Rivet/LHC{,-Matchbox,-Matchbox-Powheg,-Powheg,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-{W-{e,mu},13-Z-{e,mu},Z-HighMass{1,2}-e,{8,13}-W-mu,8-Z-Mass{1..4}-{e,mu},Z-{e,mu,mu-SOPHTY},Z-LowMass-{e,mu},Z-MedMass-e,WZ,WW-{emu,ll},ZZ-{ll,lv},{8,13}-WZ,8-ZZ-lv,8-WW-ll,Z-mu-Short}.in) \ $(shell echo Rivet/LHC{,-Dipole}-7-{W,Z}Gamma-{e,mu}.in) \ $(shell echo Rivet/LHC{,-Dipole}-8-ZGamma-{e,mu}.in) \ $(shell echo Rivet/LHC{,-Matchbox,-Matchbox-Powheg,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-{7-W-Jet-{1..3}-e,7-Z-Jet-{0..3}-e,7-Z-Jet-0-mu}.in) \ $(shell echo Rivet/LHC{-Matchbox,-Matchbox-Powheg,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-{Z-b,Z-bb,8-Z-b,8-Z-bb,W-b,8-Z-jj}.in) \ $(shell echo Rivet/LHC{,-Dipole}-{7,8,13}-PromptPhoton-{1..4}.in) Rivet/LHC-GammaGamma-7.in \ $(shell echo Rivet/LHC{,-Powheg}-{7,8}-{DiPhoton-GammaGamma,DiPhoton-GammaJet}.in) \ $(shell echo Rivet/LHC{,-Powheg,-Matchbox,-Matchbox-Powheg,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-{ggH,VBF,WH,ZH}.in) \ $(shell echo Rivet/LHC{,-Powheg,-Matchbox,-Matchbox-Powheg,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-8-{{ggH,VBF,WH,ZH}{,-GammaGamma},ggH-WW}.in) \ $(shell echo Rivet/LHC{,-Matchbox,-Matchbox-Powheg,-Dipole,-Dipole-MCatNLO,-Dipole-Matchbox-Powheg,-Merging}-ggHJet.in) # $(shell echo Rivet/ISR-{30,44,53,62}-UE.in ) $(shell echo Rivet/SppS-{53,63}-UE.in ) Rivet-GammaGamma: Rivet-GammaGamma/done touch $@ Rivet-GammaGamma/done: $(shell echo Rivet-GammaGamma-mumu-{3.5,4.5,5.5,6.5,7.5,9.0,12.5,17.5,30.0}.yoda ) rm -rf Rivet-GammaGamma python/merge-GammaGamma GammaGamma rivet-mkhtml -o Rivet-GammaGamma GammaGamma.yoda:Hw touch $@ Rivet-EE-Gamma: Rivet-EE-Gamma/done touch $@ Rivet-EE-Gamma/done: $(shell echo Rivet-EE-Gamma-Direct-mumu-{161,172,183,189,196,206}.yoda ) \ $(shell echo Rivet-EE-Gamma-Direct-tautau-{189,196,206}.yoda ) \ $(shell echo Rivet-EE-Gamma-{Direct,Single-Resolved,Double-Resolved}-Jets-{198,206}.yoda ) rm -rf Rivet-EE-Gamma python/merge-EE-Gamma EE-Gamma rivet-mkhtml -o Rivet-EE-Gamma EE-Gamma.yoda:Hw touch $@ Rivet-EE : Rivet-EE/done touch $@ -Rivet-EE/done : $(shell echo Rivet{,-Powheg}-EE-{7.7,9.4,12,13,14,14.8,17,27.6,29,30.2,30.7,30,31.3,34,34.8,43.6,45,50,52,53.3,55,56,57,58,59.5,60.8,60,61.4,66,76,10,12.8,21.5,22,25,26.8,34.5,35,36.2,41,42.1,42.6,44,48.0,82,85,91,93.0,130,133,136,161,172,177,183,189,192,196,197,200,202,205,206,207,91-nopi}.yoda) \ +Rivet-EE/done : $(shell echo Rivet{,-Powheg}-EE-{9.4,12,13,14,17,27.6,29,30.2,30.7,30,31.3,34.8,43.6,45,50,52,55,56,57,60.8,60,61.4,66,76,10,12.8,22,26.8,35,41,44,48.0,82,85,91,93.0,130,133,136,161,172,177,183,189,192,196,197,200,202,206,91-nopi}.yoda) \ $(shell echo Rivet-EE-{10.5,11.96,12.8,13.96,16.86,21.84,26.8,28.48,35.44,48.0,97.0}-gg.yoda) \ - $(shell echo Rivet-EE-{10.52,10.52-sym,2.2,2.6,3.0,3.2,4.6,4.8,3.63,4.03,4.5,9.46,10.00,10.54,10.45,10.47,Upsilon,Upsilon2,Upsilon4,Tau,Phi,10.58-res,10.58,Lambdac,Omega,Xi0,Xic0,Xim,JPsi,Psi2S}.yoda) + $(shell echo Rivet-EE-{10.52,10.52-sym,2.2,2.6,3.0,3.2,4.6,4.8,10.54,10.45,10.47,Upsilon,Upsilon2,Upsilon4,Tau,Phi,10.58-res,10.58,Lambdac,Omega,Xi0,Xic0,Xim,JPsi,Psi2S}.yoda) rm -rf Rivet-EE python/merge-EE --with-gg EE python/merge-EE Powheg-EE rivet-mkhtml -o Rivet-EE EE.yoda:Hw Powheg-EE.yoda:Hw-Powheg python/plot-EE Rivet-EE touch $@ Rivet-DIS : Rivet-DIS/done touch $@ Rivet-DIS/done: $(shell echo Rivet{-DIS,-DIS-NoME,-Powheg-DIS}-{e--LowQ2,e+-LowQ2,e+-HighQ2}.yoda) rm -rf Rivet-DIS python/merge-DIS DIS python/merge-DIS Powheg-DIS python/merge-DIS DIS-NoME rivet-mkhtml -o Rivet-DIS DIS.yoda:Hw Powheg-DIS.yoda:Hw-Powheg DIS-NoME.yoda:Hw-NoME touch $@ Rivet-TVT-EW : Rivet-TVT-EW/done touch $@ Rivet-TVT-EW/done: $(shell echo Rivet{,-Powheg}-TVT-{Run-I-Z,Run-I-W,Run-I-WZ,Run-II-Z-{e,{,LowMass-,HighMass-}mu},Run-II-W}.yoda) rm -rf Rivet-TVT-EW python/merge-TVT-EW TVT python/merge-TVT-EW Powheg-TVT rivet-mkhtml -o Rivet-TVT-EW TVT-EW.yoda:Hw Powheg-TVT-EW.yoda:Hw-Powheg touch $@ Rivet-TVT-Photon : Rivet-TVT-Photon/done touch $@ Rivet-TVT-Photon/done: $(shell echo Rivet{,-Powheg}-TVT-Run-II-{DiPhoton-GammaGamma,DiPhoton-GammaJet}.yoda Rivet-TVT-Run-II-PromptPhoton.yoda) rm -rf Rivet-TVT-Photon python/merge-TVT-Photon TVT python/merge-TVT-Photon Powheg-TVT rivet-mkhtml -o Rivet-TVT-Photon TVT-Photon.yoda:Hw Powheg-TVT-Photon.yoda:Hw-Powheg touch $@ Rivet-TVT-Jets : Rivet-TVT-Jets/done touch $@ Rivet-TVT-Jets/done: $(shell echo Rivet-TVT-{Run-II-Jets-{0..11},Run-I-Jets-{1..8}}.yoda ) \ $(shell echo Rivet-TVT-{630-Jets-{1..3},300-Jets-1,900-Jets-1}.yoda ) \ $(shell echo Rivet-TVT-{Run-I,Run-II,300,630,900}-UE.yoda) rm -rf Rivet-TVT-Jets python/merge-TVT-Jets TVT rivet-mkhtml -o Rivet-TVT-Jets TVT-Jets.yoda:Hw touch $@ Rivet-Star : Rivet-Star/done touch $@ Rivet-Star/done : $(shell echo Rivet-Star-{UE,Jets-{1..4}}.yoda ) rm -rf Rivet-Star python/merge-Star Star rivet-mkhtml -o Rivet-Star Star.yoda:Hw touch $@ Rivet-SppS : Rivet-SppS/done touch $@ ## $(shell echo Rivet-ISR-{30,44,53,62}-UE.yoda ) \ ## {53,63,200,500,900,546} EHS-UE Rivet-SppS/done : $(shell echo Rivet-SppS-{200,500,900,546}-UE.yoda ) rm -rf Rivet-SppS python/merge-SppS SppS rivet-mkhtml -o Rivet-SppS SppS.yoda:Hw touch $@ Rivet-LHC-Jets : Rivet-LHC-Jets/done touch $@ Rivet-LHC-Jets/done : \ $(shell echo Rivet-LHC-7-DiJets-{1..7}-{A,B,C}.yoda ) \ $(shell echo Rivet-LHC-13-DiJets-{{1..11}-A,{6..11}-B}.yoda ) \ $(shell echo Rivet-LHC-{7,8,13}-Jets-{0..10}.yoda ) \ $(shell echo Rivet-LHC-2760-Jets-{1..3}.yoda ) \ $(shell echo Rivet-LHC-{900,2360,2760,7,8,13}-UE.yoda ) \ $(shell echo Rivet-LHC-{900,7,13}-UE-Long.yoda ) \ $(shell echo Rivet-LHC-7-Charm-{1..5}.yoda ) \ $(shell echo Rivet-LHC-7-Bottom-{0..9}.yoda ) \ $(shell echo Rivet-LHC-{7,8,13}-Top-{L,SL}.yoda ) \ $(shell echo Rivet-LHC-{8,13}-Top-All.yoda ) rm -rf Rivet-LHC-Jets python/merge-LHC-Jets LHC rivet-mkhtml -o Rivet-LHC-Jets LHC-Jets.yoda:Hw touch $@ Rivet-LHC-EW : Rivet-LHC-EW/done touch $@ Rivet-LHC-EW/done: \ $(shell echo Rivet{,-Powheg}-LHC-{13-Z-{e,mu},{8,13}-W-mu,Z-HighMass{1,2}-e,8-Z-Mass{1..4}-{e,mu},W-{e,mu},Z-{e,mu,mu-SOPHTY},Z-LowMass-{e,mu},Z-MedMass-e,WZ,WW-{emu,ll},ZZ-{ll,lv},{8,13}-WZ,8-ZZ-lv,8-WW-ll,Z-mu-Short}.yoda) \ $(shell echo Rivet-LHC-{7-W-Jet-{1..3}-e,7-Z-Jet-{0..3}-e,7-Z-Jet-0-mu}.yoda) \ $(shell echo Rivet-LHC-7-{W,Z}Gamma-{e,mu}.yoda) \ $(shell echo Rivet-LHC-8-ZGamma-{e,mu}.yoda) rm -rf Rivet-LHC-EW; python/merge-LHC-EW LHC python/merge-LHC-EW Powheg-LHC rivet-mkhtml -o Rivet-LHC-EW LHC-EW.yoda:Hw Powheg-LHC-EW.yoda:Hw-Powheg \ Rivet-LHC-Z-mu-SOPHTY.yoda:Hw Rivet-Powheg-LHC-Z-mu-SOPHTY.yoda:Hw-Powheg touch $@ Rivet-LHC-Photon : Rivet-LHC-Photon/done touch $@ Rivet-LHC-Photon/done: \ $(shell echo Rivet-LHC-{7,8,13}-PromptPhoton-{1..4}.yoda) \ Rivet-LHC-GammaGamma-7.yoda \ $(shell echo Rivet{,-Powheg}-LHC-{7,8}-{DiPhoton-GammaGamma,DiPhoton-GammaJet}.yoda) rm -rf Rivet-LHC-Photon python/merge-LHC-Photon LHC python/merge-LHC-Photon Powheg-LHC rivet-mkhtml -o Rivet-LHC-Photon LHC-Photon.yoda:Hw Powheg-LHC-Photon.yoda:Hw-Powheg touch $@ Rivet-LHC-Higgs : Rivet-LHC-Higgs/done touch $@ Rivet-LHC-Higgs/done: \ $(shell echo Rivet{,-Powheg}-LHC-{ggH,VBF,WH,ZH}.yoda) \ $(shell echo Rivet{,-Powheg}-LHC-8-{{ggH,VBF,WH,ZH}{,-GammaGamma},ggH-WW}.yoda) \ Rivet-LHC-ggHJet.yoda yodamerge --add Rivet-Powheg-LHC-8-{ggH{-GammaGamma,-WW,},{VBF,ZH,WH}{,-GammaGamma}}.yoda -o Powheg-LHC-Higgs.yoda yodamerge --add Rivet-LHC-8-{ggH{-GammaGamma,-WW,},{VBF,ZH,WH}{,-GammaGamma}}.yoda -o LHC-Higgs.yoda rm -rf Rivet-LHC-Higgs rivet-mkhtml -o Rivet-LHC-Higgs Powheg-LHC-Higgs.yoda:Hw-Powheg LHC-Higgs.yoda:Hw\ Rivet-Powheg-LHC-ggH.yoda:gg-Powheg Rivet-LHC-ggH.yoda:gg Rivet-LHC-ggHJet.yoda:HJet \ Rivet-Powheg-LHC-VBF.yoda:VBF-Powheg Rivet-LHC-VBF.yoda:VBF Rivet-LHC-WH.yoda:WH Rivet-LHC-ZH.yoda:ZH \ Rivet-Powheg-LHC-WH.yoda:WH-Powheg Rivet-Powheg-LHC-ZH.yoda:ZH-Powheg touch $@ clean-local: rm -f *.out *.log *.tex *.top *.run *.dump *.mult *.Bmult *.yoda Rivet/*.in anatohepmc.txt hepmctoana.txt rm -rf Rivet-* distclean-local: rm -rf .cache diff --git a/Tests/Rivet/EE/EE-10.52-sym.in b/Tests/Rivet/EE/EE-10.52-sym.in --- a/Tests/Rivet/EE/EE-10.52-sym.in +++ b/Tests/Rivet/EE/EE-10.52-sym.in @@ -1,16 +1,16 @@ # -*- ThePEG-repository -*- create ThePEG::LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxA 5.26*GeV set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxB 5.26*GeV set /Herwig/Generators/EventGenerator:EventHandler:Cuts:MHatMin 10.50 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity # CLEO charm hadron production insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CLEO_2004_S5809304 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CLEO_2000_I526554 -# CEOL baryon assymetry +# CLEO baryon assymetry insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CLEO_2001_I552541 # BELLE charm hadron production insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BELLE_2017_I1606201 diff --git a/Tests/Rivet/EE/EE-10.58-res.in b/Tests/Rivet/EE/EE-10.58-res.in --- a/Tests/Rivet/EE/EE-10.58-res.in +++ b/Tests/Rivet/EE/EE-10.58-res.in @@ -1,13 +1,13 @@ # -*- ThePEG-repository -*- create ThePEG::LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxA 3.5*GeV set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxB 8.*GeV set /Herwig/Generators/EventGenerator:EventHandler:Cuts:MHatMin 9.99 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity # BELLE charm hadron production insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BELLE_2001_S4598261 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BABAR_2007_S6895344 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BABAR_2003_I593379 -insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BELLE_2017_I1512299 \ No newline at end of file +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BELLE_2017_I1512299 diff --git a/Tests/Rivet/EE/EE-35.in b/Tests/Rivet/EE/EE-35.in --- a/Tests/Rivet/EE/EE-35.in +++ b/Tests/Rivet/EE/EE-35.in @@ -1,30 +1,28 @@ # -*- ThePEG-repository -*- ################################################## # LEP physics parameters (override defaults) ################################################## set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy 35. ################################################## # select the analyses ################################################## # OPAL/JADE jet rates at many energies insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_OPAL_2000_S4300807 # JADE jet rates at many energies insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_1998_S3612880 # tasso event shapes at various low energies insert /Herwig/Analysis/RivetAnalysis:Analyses 0 TASSO_1990_S2148048 # PDG hadron multiplicities and ratios insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES insert /Herwig/Analysis/RivetAnalysis:Analyses 0 PDG_HADRON_MULTIPLICITIES_RATIOS insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_1983_I190818 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 TASSO_1987_I248660 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CELLO_1990_I283026 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CELLO_1989_I276764 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_1984_I203145 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 TASSO_1982_I177174 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 TASSO_1990_I284251 -# jade gamma,pi0 and eta spectra +## jade gamma,pi0 and eta spectra insert /Herwig/Analysis/RivetAnalysis:Analyses 0 JADE_1990_I282847 -# TASSO event shapes +## TASSO event shapes insert /Herwig/Analysis/RivetAnalysis:Analyses 0 TASSO_1988_I263859 - - diff --git a/Tests/Rivet/EE/EE-JPsi.in b/Tests/Rivet/EE/EE-JPsi.in --- a/Tests/Rivet/EE/EE-JPsi.in +++ b/Tests/Rivet/EE/EE-JPsi.in @@ -1,21 +1,21 @@ # -*- ThePEG-repository -*- # e+ e- -> J/Psi create Herwig::MEee2VectorMeson /Herwig/MatrixElements/MEJpsi HwMELepton.so set /Herwig/MatrixElements/MEJpsi:VectorMeson /Herwig/Particles/Jpsi -set /Herwig/MatrixElements/MEJpsi:Coupling 13.60507 +set /Herwig/MatrixElements/MEJpsi:Coupling 11.43148 set /Herwig/MatrixElements/SubProcess:MatrixElements 0 /Herwig/MatrixElements/MEJpsi set EventGenerator:EventHandler:LuminosityFunction:Energy 3.096916 set /Herwig/Generators/EventGenerator:EventHandler:Cuts:MHatMin 0.2 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF do /Herwig/Particles/Jpsi:SelectDecayModes /Herwig/Particles/Jpsi/Jpsi->n0,nbar0; /Herwig/Particles/Jpsi/Jpsi->p+,pbar-; /Herwig/Particles/Jpsi/Jpsi->Sigma0,Sigmabar0; /Herwig/Particles/Jpsi/Jpsi->Lambda0,Lambdabar0; /Herwig/Particles/Jpsi/Jpsi->Sigma*-,Sigma*bar+; /Herwig/Particles/Jpsi/Jpsi->Sigma*0,Sigma*bar0; /Herwig/Particles/Jpsi/Jpsi->Sigma*+,Sigma*bar-; /Herwig/Particles/Jpsi/Jpsi->Xi-,Xibar+; /Herwig/Particles/Jpsi/Jpsi->Sigma*0,Sigma*bar0; /Herwig/Particles/Jpsi/Jpsi->Xi0,Xibar0; # J/psi-> lambda anti-lambda and sigma anti-sigma insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2017_I1510563 # J/psi -> p pbar and n nbar insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2012_I1113599 # J/Psi -> xi- and Sigma*+/- insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2016_I1422780 # J/Psi -> xi0 and Sigma*0 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2017_I1506414 # J/psi-> lambda anti-lambda insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2019_I1691850 \ No newline at end of file diff --git a/Tests/Rivet/EE/EE-Psi2S.in b/Tests/Rivet/EE/EE-Psi2S.in --- a/Tests/Rivet/EE/EE-Psi2S.in +++ b/Tests/Rivet/EE/EE-Psi2S.in @@ -1,19 +1,19 @@ # -*- ThePEG-repository -*- # e+ e- -> psi(2S) create Herwig::MEee2VectorMeson /Herwig/MatrixElements/MEPsi2S HwMELepton.so set /Herwig/MatrixElements/MEPsi2S:VectorMeson /Herwig/Particles/psi(2S) -set /Herwig/MatrixElements/MEPsi2S:Coupling 13.60507 +set /Herwig/MatrixElements/MEPsi2S:Coupling 19.25684 set /Herwig/MatrixElements/SubProcess:MatrixElements 0 /Herwig/MatrixElements/MEPsi2S set EventGenerator:EventHandler:LuminosityFunction:Energy 3.77 set /Herwig/Generators/EventGenerator:EventHandler:Cuts:MHatMin 0.2 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF do /Herwig/Particles/psi(2S):SelectDecayModes /Herwig/Particles/psi(2S)/psi(2S)->n0,nbar0; /Herwig/Particles/psi(2S)/psi(2S)->p+,pbar-; /Herwig/Particles/psi(2S)/psi(2S)->Sigma0,Sigmabar0; /Herwig/Particles/psi(2S)/psi(2S)->Lambda0,Lambdabar0; /Herwig/Particles/psi(2S)/psi(2S)->Sigma*-,Sigma*bar+; /Herwig/Particles/psi(2S)/psi(2S)->Sigma*0,Sigma*bar0; /Herwig/Particles/psi(2S)/psi(2S)->Sigma*+,Sigma*bar-; /Herwig/Particles/psi(2S)/psi(2S)->Xi-,Xibar+; /Herwig/Particles/psi(2S)/psi(2S)->Xi0,Xibar0; /Herwig/Particles/psi(2S)/psi(2S)->Sigma*0,Sigma*bar0; # psi(2S) -> lambda anti-lambda and sigma anti-sigma insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2017_I1510563 # psi(2S) -> p pbar and n nbar insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2018_I1658762 # psi(2S) -> xi- and Sigma+/- insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2016_I1422780 # psi(2S) -> xi0 and Sigma*0 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 BESIII_2017_I1506414 diff --git a/Tests/Rivet/EE/EE-Upsilon2.in b/Tests/Rivet/EE/EE-Upsilon2.in --- a/Tests/Rivet/EE/EE-Upsilon2.in +++ b/Tests/Rivet/EE/EE-Upsilon2.in @@ -1,17 +1,17 @@ # -*- ThePEG-repository -*- create ThePEG::LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxA 5.01163*GeV set /Herwig/EventHandlers/BFactoryLuminosity:BeamEMaxB 5.01163*GeV set /Herwig/Generators/EventGenerator:EventHandler:Cuts:MHatMin 10.02 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction /Herwig/EventHandlers/BFactoryLuminosity create Herwig::MEee2VectorMeson /Herwig/MatrixElements/MEUpsilon HwMELepton.so set /Herwig/MatrixElements/MEUpsilon:VectorMeson /Herwig/Particles/Upsilon(2S) -set /Herwig/MatrixElements/MEUpsilon:Coupling 62.7291136761 +set /Herwig/MatrixElements/MEUpsilon:Coupling 62.72911 set /Herwig/MatrixElements/SubProcess:MatrixElements 0 /Herwig/MatrixElements/MEUpsilon # BELLE charm hadron production insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ARGUS_1993_S2669951 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ARGUS_1990_I278933 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ARGUS_1989_I262551 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ARGUS_1988_I251097 diff --git a/Tests/python/rivet_check.script b/Tests/python/rivet_check.script --- a/Tests/python/rivet_check.script +++ b/Tests/python/rivet_check.script @@ -1,99 +1,106 @@ #!/usr/bin/python import glob,subprocess,os,optparse op = optparse.OptionParser(usage=__doc__) op.add_option("--obsolete", dest="obsolete" , default=False, action="store_true" , help="Warn if obsolete analyses not included") op.add_option("--search", dest="search" , default=False, action="store_true" , help="Warn if search analyses not included") op.add_option("--heavy-ion", dest="heavy_ion" , default=False, action="store_true" , help="Warn if heavy ion analyses not included") op.add_option("--MC", dest="MC" , default=False, action="store_true" , help="Warn if MC analyses not included") op.add_option("--print-descriptions", dest="output" , default=False, action="store_true" , help="Print analysis descriptions") opts, args = op.parse_args() # analyses to skip skip = [ "ATLAS_2010_I849050", # alias "TOTEM_2012_002" , # alias "TEST" , # test analysis ] searches=["ALEPH_2016_I1492968"] p=subprocess.Popen(["rivet","--list"],stdout=subprocess.PIPE) analyses={} for line in p.communicate()[0].split("\n") : line=line.strip() if(line=="") : continue temp = line.split(None,1) if(len(temp)==2) : analyses[temp[0].strip()] = temp[1].strip() elif(len(temp)==1) : analyses[temp[0].strip()] = "" else : print line quit() # main line hw analyses at high energy hw_analyses={} files=[] for idir in glob.glob("Rivet/*") : if( "Powheg" in idir or "MCatNLO" in idir) : continue if ( not os.path.isdir(idir) ) : continue if ( "Templates" in idir ) : continue for ifile in glob.glob("%s/*.in" % idir) : fshort=ifile.split("/")[-1].replace(".in","") files.append(fshort) file=open(ifile) line=file.readline() while line: - if("RivetAnalysis:Analyses" in line) : + if("RivetAnalysis:Analyses" in line and line[0]!="#") : line=line.strip().split() anal = line[-1].strip().split(":")[0] if(anal not in hw_analyses) : hw_analyses[anal] = [fshort] else : hw_analyses[anal].append(fshort) line=file.readline() anatohepmc = open("anatohepmc.txt",'w') hepmctoana = open("hepmctoana.txt",'w') +not_in_rivet=[] +for val in hw_analyses.keys() : not_in_rivet.append(val) # check the analyses for analysis in sorted(analyses.keys()) : # we have it high energy if(analysis in hw_analyses) : anatohepmc.write("%s %s\n" % (analysis,' '.join(sorted(hw_analyses[analysis]))) ) if("[OBSOLETE]" in analyses[analysis]) : print "WARNING Obsolete analysis %s included : %s" % (analysis,analyses[analysis]) + if(analysis in not_in_rivet) : + not_in_rivet.remove(analysis) # obsolete elif("[OBSOLETE]" in analyses[analysis]) : if(opts.obsolete) : print "Obsolete analysis %s not included : %s" % (analysis,analyses[analysis]) # searches elif("Search" in analyses[analysis] or "search" in analyses[analysis] or analysis in searches) : if(opts.search) : print "Search analysis %s not included : %s" % (analysis,analyses[analysis]) # mc only elif(analysis[0:3]=="MC_") : if(opts.MC) : print "MC analysis %s not included : %s" % (analysis,analyses[analysis]) # examples elif("[EXAMPLE]" in analyses[analysis]) : continue # we don't have it else : p=subprocess.Popen(["rivet","--show-analysis",analysis],stdout=subprocess.PIPE) desc=p.communicate()[0] beams=[] for line in desc.split("\n") : if("Beams:" in line) : beams=line.replace("Beams:","").split() nHeavy = sum((part=="Pb" or part=="Au") for part in beams) if(nHeavy == len(beams) or nHeavy+1 == len(beams)) : if(opts.heavy_ion) : print "Heavy Ion analysis %s not included : %s" % (analysis,analyses[analysis]) else : print "MISSING ANALYSIS",analysis,analyses[analysis] if(opts.output) : print desc +# outout analyses missing from rivet +for val in not_in_rivet: + print "NOT IN RIVET ",val # output second file for rivet anatohepmc.close() for fname in sorted(files) : anals=[] for anal in hw_analyses : if(fname in hw_analyses[anal]) : anals.append(anal) hepmctoana.write("%s %s\n" % (fname,' '.join(sorted(anals))) ) hepmctoana.close() diff --git a/UnderlyingEvent/MPIHandler.cc b/UnderlyingEvent/MPIHandler.cc --- a/UnderlyingEvent/MPIHandler.cc +++ b/UnderlyingEvent/MPIHandler.cc @@ -1,857 +1,874 @@ // -*- C++ -*- // // MPIHandler.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 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/Utilities/DescribeClass.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/JetCuts.h" #include "ThePEG/Cuts/SimpleKTCut.h" #include "ThePEG/PDF/PartonExtractor.h" #include "gsl/gsl_sf_bessel.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" using namespace Herwig; MPIHandler * MPIHandler::currentHandler_ = 0; 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() { currentHandler_ = this; 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; // override the cuts for the additional scatters if energyExtrapolation_ is // set if (energyExtrapolation_ != 0 ) { overrideUECuts(); } 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 Ptr::pointer eH = dynamic_ptr_cast::pointer>(eventHandler()); if( eH ) { PtOfQCDProc_ = eH->cuts()->minKT(gluon); // find the jet cut in the new style cuts for(unsigned int ix=0;ixcuts()->multiCuts().size();++ix) { Ptr::pointer jetCuts = dynamic_ptr_cast::pointer>(eH->cuts()->multiCuts()[ix]); if(jetCuts) { Energy ptMin=1e30*GeV; for(unsigned int iy=0;iyjetRegions().size();++iy) { ptMin = min(ptMin,jetCuts->jetRegions()[iy]->ptMin()); } if(ptMin<1e29*GeV&&ptMin>PtOfQCDProc_) PtOfQCDProc_ = ptMin; } } } 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; iinitialize(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 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){ try{ // Very low energies (e.g. 200 GeV) need this. // Very high energies (e.g. 100 TeV) produce issues with // this choice. This is a temp. fix. softMu2_ = rootFinder.value(fs, 0.25*GeV2, 1.3*GeV2); softXSec_ = fs.softXSec(); }catch(GSLBisection::IntervalError){ 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() << "\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::pointer ktCut = new_ptr(SimpleKTCut(ptminPlus)); ktCut->init(); ktCut->initrun(); CutsPtr qcdCut = new_ptr(Cuts(2*ptminPlus)); qcdCut->add(dynamic_ptr_cast(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){ try{ // Very low energies (e.g. 200 GeV) need this. // Very high energies (e.g. 100 TeV) produce issues with // this choice. This is a temp. fix. beta_ = rootFinder.value(fn2, -5/GeV2, 8./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::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; istatistics(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' + << "diffractive cross section (mb): " + << diffratio_*totalXSecExp()/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); + + + auto nondiffXS=integrator.value(inelint, ZERO, bmax); + inelXSec_ = nondiffXS+diffratio_*totalXSecExp(); 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_; + P = integrator.value(integrand, ZERO, bmax) / nondiffXS; } //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 { static 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()); + CrossSection minbiasXS = integrator.value(integrand, ZERO, bmax); + + auto totalXS=totalXSecExp(); + CrossSection tot=minbiasXS+diffratio_*totalXS; + + return (tot-totalXS); } 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::overrideUECuts() { if(energyExtrapolation_==1) Ptmin_ = EEparamA_ * log(generator()->maximumCMEnergy() / EEparamB_); else if(energyExtrapolation_==2) Ptmin_ = pT0_*pow(double(generator()->maximumCMEnergy()/refScale_),b_); else assert(false); // create a new SimpleKTCut object with the calculated ptmin value Ptr::pointer newUEktCut = new_ptr(SimpleKTCut(Ptmin_)); newUEktCut->init(); newUEktCut->initrun(); // create a new Cuts object with MHatMin = 2 * Ptmin_ CutsPtr newUEcuts = new_ptr(Cuts(2*Ptmin_)); newUEcuts->add(dynamic_ptr_cast(newUEktCut)); newUEcuts->init(); newUEcuts->initrun(); // replace the old Cuts object cuts()[0] = newUEcuts; } 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) << energyExtrapolation_ << ounit(EEparamA_, GeV) << ounit(EEparamB_, GeV) << ounit(refScale_,GeV) << ounit(pT0_,GeV) << b_ << avgNhard_ << avgNsoft_ << softMult_ << ounit(inelXSec_, millibarn) - << ounit(softMu2_, GeV2); + << ounit(softMu2_, GeV2) << diffratio_; } 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) >> energyExtrapolation_ >> iunit(EEparamA_, GeV) >> iunit(EEparamB_, GeV) >> iunit(refScale_,GeV) >> iunit(pT0_,GeV) >> b_ >> avgNhard_ >> avgNsoft_ >> softMult_ >> iunit(inelXSec_, millibarn) - >> iunit(softMu2_, GeV2); + >> iunit(softMu2_, GeV2) >> diffratio_; currentHandler_ = this; } void MPIHandler::clean() { // ThePEG's event handler's usual event cleanup doesn't reach these // XCombs. Need to do it by hand here. for ( size_t i = 0; i < theSubProcesses.size(); ++i ) { theSubProcesses[i]->pExtractor()->lastXCombPtr()->clean(); } } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeHerwigMPIHandler("Herwig::MPIHandler", "JetCuts.so SimpleKTCut.so HwMPI.so"); void MPIHandler::Init() { static ClassDocumentation 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 interfaceSubhandlers ("SubProcessHandlers", "The list of sub-process handlers used in this EventHandler. ", &MPIHandler::theSubProcesses, -1, false, false, true, false, false); static RefVector 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 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 interfaceadditionalMultiplicities ("additionalMultiplicities", "specify the multiplicities of secondary hard processes (multiple parton scattering)", &MPIHandler::additionalMultiplicities_, -1, 0, 0, 3, false, false, true); static Parameter 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 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 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 Parameter interfaceDiffRatio + ("DiffractiveRatio", + "Fraction of diffractive cross section in total cross section.", + &MPIHandler::diffratio_, + 0.2, 0.0, 1.0, + false, false, Interface::limited); + static Switch 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 interEnergyExtrapolation ("EnergyExtrapolation", "Switch to ignore the cuts object at MPIHandler:Cuts[0]. " "Instead, extrapolate the pt cut.", &MPIHandler::energyExtrapolation_, 2, false, false); static SwitchOption interEnergyExtrapolationLog (interEnergyExtrapolation, "Log", "Use logarithmic dependence, ptmin = A * log (sqrt(s) / B).", 1); static SwitchOption interEnergyExtrapolationPower (interEnergyExtrapolation, "Power", "Use power law, ptmin = pt_0 * (sqrt(s) / E_0)^b.", 2); static SwitchOption interEnergyExtrapolationNo (interEnergyExtrapolation, "No", "Use manually set value for the minimal pt, " "specified in MPIHandler:Cuts[0]:OneCuts[0]:MinKT.", 0); static Parameter interfaceEEparamA ("EEparamA", "Parameter A in the empirical parametrization " "ptmin = A * log (sqrt(s) / B)", &MPIHandler::EEparamA_, GeV, 0.6*GeV, ZERO, Constants::MaxEnergy, false, false, Interface::limited); static Parameter interfaceEEparamB ("EEparamB", "Parameter B in the empirical parametrization " "ptmin = A * log (sqrt(s) / B)", &MPIHandler::EEparamB_, GeV, 39.0*GeV, ZERO, Constants::MaxEnergy, false, false, Interface::limited); static Switch 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 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 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); static Parameter interfaceReferenceScale ("ReferenceScale", "The reference energy for power law energy extrapolation of pTmin", &MPIHandler::refScale_, GeV, 7000.0*GeV, 0.0*GeV, 20000.*GeV, false, false, Interface::limited); static Parameter interfacepTmin0 ("pTmin0", "The pTmin at the reference scale for power law extrapolation of pTmin.", &MPIHandler::pT0_, GeV, 3.11*GeV, 0.0*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfacePower ("Power", "The power for power law extrapolation of the pTmin cut-off.", &MPIHandler::b_, 0.21, 0.0, 10.0, false, false, Interface::limited); } diff --git a/UnderlyingEvent/MPIHandler.h b/UnderlyingEvent/MPIHandler.h --- a/UnderlyingEvent/MPIHandler.h +++ b/UnderlyingEvent/MPIHandler.h @@ -1,878 +1,895 @@ // -*- C++ -*- // // MPIHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2017 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_MPIHandler_H #define HERWIG_MPIHandler_H // // This is the declaration of the MPIHandler class. // #include "ThePEG/Interface/Interfaced.h" #include "ThePEG/Handlers/StandardEventHandler.h" #include "ThePEG/Repository/EventGenerator.h" #include "Herwig/PDT/StandardMatchers.h" #include "Herwig/Utilities/GSLBisection.h" //#include "Herwig/Utilities/GSLMultiRoot.h" #include "Herwig/Utilities/GSLIntegrator.h" #include "Herwig/Shower/UEBase.h" #include #include "ProcessHandler.h" #include "MPIHandler.fh" namespace Herwig { using namespace ThePEG; /** \ingroup UnderlyingEvent * \class MPIHandler * This class is responsible for generating additional * semi hard partonic interactions. * * \author Manuel B\"ahr * * @see \ref MPIHandlerInterfaces "The interfaces" * defined for MPIHandler. * @see ProcessHandler * @see ShowerHandler * @see HwRemDecayer */ class MPIHandler: public UEBase { /** * Maximum number of scatters */ static const unsigned int maxScatters_ = 99; /** * Class for the integration is a friend to access private members */ friend struct Eikonalization; friend struct TotalXSecBisection; friend struct slopeAndTotalXSec; friend struct slopeInt; friend struct slopeBisection; public: /** A vector of SubProcessHandlers. */ typedef vector SubHandlerList; /** A vector of Cuts. */ typedef vector CutsList; /** A vector of ProcessHandlers. */ typedef vector ProcessHandlerList; /** A vector of cross sections. */ typedef vector XSVector; /** A pair of multiplicities: hard, soft. */ typedef pair MPair; /** @name Standard constructors and destructors. */ //@{ /** * The default constructor. */ MPIHandler(): softMult_(0), identicalToUE_(-1), PtOfQCDProc_(-1.0*GeV), Ptmin_(-1.0*GeV), hardXSec_(0*millibarn), softXSec_(0*millibarn), totalXSecExp_(0*millibarn), softMu2_(ZERO), beta_(100.0/GeV2), algorithm_(2), numSubProcs_(0), colourDisrupt_(0.0), softInt_(true), twoComp_(true), DLmode_(2), avgNhard_(0.0), avgNsoft_(0.0), energyExtrapolation_(2), EEparamA_(0.6*GeV), EEparamB_(37.5*GeV), refScale_(7000.*GeV), pT0_(3.11*GeV), b_(0.21) {} /** * The destructor. */ virtual ~MPIHandler(){} //@} public: /** @name Methods for the MPI generation. */ //@{ /* * @return true if for this beam setup MPI can be generated */ virtual bool beamOK() const; /** * Return true or false depending on whether soft interactions are enabled. */ virtual bool softInt() const {return softInt_;} /** * Get the soft multiplicity from the pretabulated multiplicity * distribution. Generated in multiplicity in the first place. * @return the number of extra soft events in this collision */ virtual unsigned int softMultiplicity() const {return softMult_;} /** * Sample from the pretabulated multiplicity distribution. * @return the number of extra events in this collision */ virtual unsigned int multiplicity(unsigned int sel=0); /** * Select a StandardXComb according to it's weight * @return that StandardXComb Object * @param sel is the subprocess that should be returned, * if more than one is specified. */ virtual tStdXCombPtr generate(unsigned int sel=0); //@} /** @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(); /** * Initialize this Multiple Interaction handler and all related objects needed to * generate additional events. */ virtual void initialize(); /** * Finalize this Multiple Interaction handler and all related objects needed to * generate additional events. */ virtual void finalize(); /** * Clean up the XCombs from our subprocesses after each event. * ThePEG cannot see them, so the usual cleaning misses these. */ virtual void clean(); /** * Write out accumulated statistics about integrated cross sections. */ void statistics() const; /** * The level of statistics. Controlls the amount of statistics * written out after each run to the EventGenerators * .out file. Simply the EventHandler method is called here. */ int statLevel() const {return eventHandler()->statLevel();} /** * Return the hard cross section above ptmin */ CrossSection hardXSec() const { return hardXSec_; } /** * Return the soft cross section below ptmin */ CrossSection softXSec() const { return softXSec_; } /** * Return the inelastic cross section */ CrossSection inelasticXSec() const { return inelXSec_; } + + /** + * Return the diffractive cross section assumed by the model. + * The diffractive cross section is seen as part of the + * inelastic cross section. + */ + CrossSection diffractiveXSec() const { + static auto totalXS=totalXSecExp(); + return diffratio_*totalXS; + } + + /** @name Simple access functions. */ //@{ /** * Return the ThePEG::EventHandler assigned to this handler. * This methods shadows ThePEG::StepHandler::eventHandler(), because * it is not virtual in ThePEG::StepHandler. This is ok, because this * method would give a null-pointer at some stages, whereas this method * gives access to the explicitely copied pointer (in initialize()) * to the ThePEG::EventHandler. */ tEHPtr eventHandler() const {return theHandler;} /** * Return the current handler */ static const MPIHandler * currentHandler() { return currentHandler_; } /** * Return theAlgorithm. */ virtual int Algorithm() const {return algorithm_;} /** * Return the ptmin parameter of the model */ virtual Energy Ptmin() const { if(Ptmin_ > ZERO) return Ptmin_; else throw Exception() << "MPIHandler::Ptmin called without initialize before" << Exception::runerror; } /** * Return the slope of the soft pt spectrum as calculated. */ virtual InvEnergy2 beta() const { if(beta_ != 100.0/GeV2) return beta_; else throw Exception() << "MPIHandler::beta called without initialization" << Exception::runerror; } /** * Return the pt Cutoff of the Interaction that is identical to the UE * one. */ virtual Energy PtForVeto() const {return PtOfQCDProc_;} /** * Return the number of additional "hard" processes ( = multiple * parton scattering) */ virtual unsigned int additionalHardProcs() const {return numSubProcs_-1;} /** * Return the fraction of colour disrupted connections to the * suprocesses. */ virtual double colourDisrupt() const {return colourDisrupt_;} 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: /** * Access the list of sub-process handlers. */ const SubHandlerList & subProcesses() const {return theSubProcesses;} /** * Access the list of sub-process handlers. */ SubHandlerList & subProcesses() {return theSubProcesses;} /** * Access the list of cuts. */ const CutsList & cuts() const {return theCuts;} /** * Access the list of cuts. */ CutsList & cuts() {return theCuts;} /** * Access the list of sub-process handlers. */ const ProcessHandlerList & processHandlers() const {return theProcessHandlers;} /** * Access the list of sub-process handlers. */ ProcessHandlerList & processHandlers() {return theProcessHandlers;} /** * Method to calculate the individual probabilities for N scatters in the event. * @param UEXSecs is(are) the inclusiv cross section(s) for the UE process(es). */ void Probs(XSVector UEXSecs); /** * Debug method to check the individual probabilities. * @param filename is the file the output gets written to */ void MultDistribution(string filename) const; /** * Return the value of the Overlap function A(b) for a given impact * parameter \a b. * @param b impact parameter * @param mu2 = inv hadron radius squared. 0 will use the value of * invRadius_ * @return inverse area. */ InvArea OverlapFunction(Length b, Energy2 mu2=ZERO) const; /** * Method to calculate the poisson probability for expectation value * \f$ = A(b)\sigma\f$, and multiplicity N. */ double poisson(Length b, CrossSection sigma, unsigned int N, Energy2 mu2=ZERO) const; /** * Return n! */ double factorial (unsigned int n) const; /** * Returns the total cross section for the current CMenergy. The * decision which parametrization will be used is steered by a * external parameter of this class. */ CrossSection totalXSecExp() const; /** * Difference of the calculated total cross section and the * experimental one from totalXSecExp. * @param softXSec = the soft cross section that is used * @param softMu2 = the soft radius, if 0 the hard radius will be used */ CrossSection totalXSecDiff(CrossSection softXSec, Energy2 softMu2=ZERO) const; /** * Difference of the calculated elastic slope and the * experimental one from slopeExp. * @param softXSec = the soft cross section that is used * @param softMu2 = the soft radius, if 0 the hard radius will be used */ InvEnergy2 slopeDiff(CrossSection softXSec, Energy2 softMu2=ZERO) const; /** * Returns the value of the elastic slope for the current CMenergy. * The decision which parametrization will be used is steered by a * external parameter of this class. */ InvEnergy2 slopeExp() const; /** * Calculate the minimal transverse momentum from the extrapolation */ void overrideUECuts(); private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ MPIHandler & operator=(const MPIHandler &) = delete; /** * A pointer to the EventHandler that calls us. Has to be saved, because the * method eventHandler() inherited from ThePEG::StepHandler returns a null-pointer * sometimes. Leif changed that in r1053 so that a valid pointer is present, when * calling doinitrun(). */ tEHPtr theHandler; /** * The list of SubProcessHandlers. */ SubHandlerList theSubProcesses; /** * The kinematical cuts used for this collision handler. */ CutsList theCuts; /** * List of ProcessHandler used to sample different processes independently */ ProcessHandlerList theProcessHandlers; /** * A ThePEG::Selector where the individual Probabilities P_N are stored * and the actual Multiplicities can be selected. */ Selector theMultiplicities; /** * Variable to store the soft multiplicity generated for a event. This * has to be stored as it is generated at the time of the hard * additional interactions but used later on. */ unsigned int softMult_; /** * Variable to store the multiplicity of the second hard process */ vector additionalMultiplicities_; /** * Variable to store the information, which process is identical to * the UE one (QCD dijets). * 0 means "real" hard one * n>0 means the nth additional hard scatter * -1 means no one! */ int identicalToUE_; /** * Variable to store the minimal pt of the process that is identical * to the UE one. This only has to be set, if it can't be determined * automatically (i.e. when reading QCD LesHouches files in). */ Energy PtOfQCDProc_; /** * Variable to store the parameter ptmin */ Energy Ptmin_; /** * Variable to store the hard cross section above ptmin */ CrossSection hardXSec_; /** * Variable to store the final soft cross section below ptmin */ CrossSection softXSec_; /** * Variable to store the inelastic cross section */ CrossSection inelXSec_; /** * Variable to store the total pp cross section (assuming rho=0!) as * measured at LHC. If this variable is set, this value is used in the * subsequent run instead of any of the Donnachie-Landshoff * parametrizations. */ CrossSection totalXSecExp_; /** * Variable to store the soft radius, that is calculated during * initialization for the two-component model. */ Energy2 softMu2_; /** * slope to the non-perturbative pt spectrum: \f$d\sigma/dp_T^2 = A \exp * (- beta p_T^2)\f$. Its value is determined durint initialization. */ InvEnergy2 beta_; /** * Switch to be set from outside to determine the algorithm used for * UE activity. */ int algorithm_; /** * Inverse hadron Radius squared \f$ (\mu^2) \f$. Used inside the overlap function. */ Energy2 invRadius_; /** * Member variable to store the actual number of separate SubProcesses */ unsigned int numSubProcs_; /** * Variable to store the relative number of colour disrupted * connections to additional subprocesses. This variable is used in * Herwig::HwRemDecayer but store here, to have access to all * parameters through one Object. */ double colourDisrupt_; /** * Flag to store whether soft interactions, i.e. pt < ptmin should be * simulated. */ bool softInt_; /** * Flag to steer wheather the soft part has a different radius, that * will be dynamically fixed. */ bool twoComp_; /** * Switch to determine which Donnachie & Landshoff parametrization * should be used. */ unsigned int DLmode_; /** * Variable to store the average hard multiplicity. */ double avgNhard_; /** * Variable to store the average soft multiplicity. */ double avgNsoft_; /** * The current handler */ static MPIHandler * currentHandler_; /** * Flag to store whether to calculate the minimal UE pt according to an * extrapolation formula or whether to use MPIHandler:Cuts[0]:OneCuts[0]:MinKT */ unsigned int energyExtrapolation_; /** * Parameters for the energy extrapolation formula */ Energy EEparamA_; Energy EEparamB_; Energy refScale_; Energy pT0_; double b_; + /** + * Parameters to set the fraction of diffractive cross section in the total cross section. + */ + double diffratio_=0.2; + protected: /** @cond EXCEPTIONCLASSES */ /** * Exception class used by the MultipleInteractionHandler, when something * during initialization went wrong. * \todo understand!!! */ class InitError: public Exception {}; /** @endcond */ }; } namespace Herwig { /** * A struct for the 2D root finding that is necessary to determine the * soft cross section and the soft radius that is needed to describe * the total cross section correctly. * NOT IN USE CURRENTLY */ struct slopeAndTotalXSec : public GSLHelper { public: /** * Constructor */ slopeAndTotalXSec(tcMPIHPtr handler): handler_(handler) {} /** second argument type */ typedef Energy2 ArgType2; /** second value type */ typedef InvEnergy2 ValType2; /** first element of the vector like function to find root for * @param softXSec soft cross-section * @param softMu2 \f$\mu^2\f$ */ CrossSection f1(ArgType softXSec, ArgType2 softMu2) const { return handler_->totalXSecDiff(softXSec, softMu2); } /** second element of the vector like function to find root for * @param softXSec soft cross-section * @param softMu2 \f$\mu^2\f$ */ InvEnergy2 f2(ArgType softXSec, ArgType2 softMu2) const { return handler_->slopeDiff(softXSec, softMu2); } /** provide the actual units of use */ virtual ValType vUnit() const {return 1.0*millibarn;} /** otherwise rounding errors may get significant */ virtual ArgType aUnit() const {return 1.0*millibarn;} /** provide the actual units of use */ ValType2 vUnit2() const {return 1.0/GeV2;} /** otherwise rounding errors may get significant */ ArgType2 aUnit2() const {return GeV2;} private: /** * Pointer to the handler */ tcMPIHPtr handler_; }; /** * A struct for the root finding that is necessary to determine the * slope of the soft pt spectrum to match the soft cross section */ struct betaBisection : public GSLHelper{ public: /** * Constructor. * @param soft = soft cross section, i.e. the integral of the soft * pt spectrum f(u=p_T^2) = dsig exp(-beta*u/u_min) * @param dsig = dsigma_hard/dp_T^2 at the p_T cutoff * @param ptmin = p_T cutoff */ betaBisection(CrossSection soft, DiffXSec dsig, Energy ptmin) : softXSec_(soft), dsig_(dsig), ptmin_(ptmin) {} /** * Operator that is used inside the GSLBisection class */ virtual Energy2 operator ()(InvEnergy2 beta) const { if( fabs(beta*GeV2) < 1.E-4 ) beta = (beta > ZERO) ? 1.E-4/GeV2 : -1.E-4/GeV2; return (exp(beta*sqr(ptmin_)) - 1.0)/beta - softXSec_/dsig_; } /** provide the actual units of use */ virtual ValType vUnit() const {return 1.0*GeV2;} /** provide the actual units of use */ virtual ArgType aUnit() const {return 1.0/GeV2;} private: /** soft cross section */ CrossSection softXSec_; /** dsigma/dp_T^2 at ptmin */ DiffXSec dsig_; /** pt cutoff */ Energy ptmin_; }; /** * A struct for the root finding that is necessary to determine the * soft cross section and soft mu2 that are needed to describe the * total cross section AND elastic slope correctly. */ struct slopeBisection : public GSLHelper { public: /** Constructor */ slopeBisection(tcMPIHPtr handler) : handler_(handler) {} /** * Return the difference of the calculated elastic slope to the * experimental one for a given value of the soft mu2. During that, * the soft cross section get fixed. */ InvEnergy2 operator ()(Energy2 arg) const; /** Return the soft cross section that has been calculated */ CrossSection softXSec() const {return softXSec_;} private: /** const pointer to the MPIHandler to give access to member functions.*/ tcMPIHPtr handler_; /** soft cross section that is determined on the fly.*/ mutable CrossSection softXSec_; }; /** * A struct for the root finding that is necessary to determine the * soft cross section that is needed to describe the total cross * section correctly. */ struct TotalXSecBisection : public GSLHelper { public: /** * Constructor * @param handler The handler * @param softMu2 \f$\mu^2\f$ */ TotalXSecBisection(tcMPIHPtr handler, Energy2 softMu2=ZERO): handler_(handler), softMu2_(softMu2) {} /** * operator to return the cross section * @param argument input cross section */ CrossSection operator ()(CrossSection argument) const { return handler_->totalXSecDiff(argument, softMu2_); } /** provide the actual units of use */ virtual ValType vUnit() const {return 1.0*millibarn;} /** otherwise rounding errors may get significant */ virtual ArgType aUnit() const {return 1.0*millibarn;} private: /** * The handler */ tcMPIHPtr handler_; /** * \f$\mu^2\f$ */ Energy2 softMu2_; }; /** * Typedef for derivative of the length */ typedef decltype(mm/GeV2) LengthDiff; /** * A struct for the integrand for the slope */ struct slopeInt : public GSLHelper{ public: /** Constructor * @param handler The handler * @param hard The hard cross section * @param soft The soft cross section * @param softMu2 \f$\mu^2\f$ */ slopeInt(tcMPIHPtr handler, CrossSection hard, CrossSection soft=0*millibarn, Energy2 softMu2=ZERO) : handler_(handler), hardXSec_(hard), softXSec_(soft), softMu2_(softMu2) {} /** * Operator to return the answer * @param arg The argument */ ValType operator ()(ArgType arg) const; private: /** * Pointer to the Handler that calls this integrand */ tcMPIHPtr handler_; /** * The hard cross section to be eikonalized */ CrossSection hardXSec_; /** * The soft cross section to be eikonalized. Default is zero */ CrossSection softXSec_; /** * The inv radius^2 of the soft interactions. */ Energy2 softMu2_; }; /** * A struct for the eikonalization of the inclusive cross section. */ struct Eikonalization : public GSLHelper{ /** * The constructor * @param handler is the pointer to the MPIHandler to get access to * MPIHandler::OverlapFunction and member variables of the MPIHandler. * @param option is a flag, whether the inelastic or the total * @param handler The handler * @param hard The hard cross section * @param soft The soft cross section * @param softMu2 \f$\mu^2\f$ * cross section should be returned (-2 or -1). For option = N > 0 the integrand * is N*(A(b)*sigma)^N/N! exp(-A(b)*sigma) this is the P_N*sigma where * P_N is the Probability of having exactly N interaction (including the hard one) * This is equation 14 from "Jimmy4: Multiparton Interactions in HERWIG for the LHC" */ Eikonalization(tcMPIHPtr handler, int option, CrossSection hard, CrossSection soft=0*millibarn, Energy2 softMu2=ZERO) : theHandler(handler), theoption(option), hardXSec_(hard), softXSec_(soft), softMu2_(softMu2) {} /** * Get the function value */ Length operator ()(Length argument) const; private: /** * Pointer to the Handler that calls this integrand */ tcMPIHPtr theHandler; /** * A flag to switch between the calculation of total and inelastic cross section * or calculations for the individual probabilities. See the constructor */ int theoption; /** * The hard cross section to be eikonalized */ CrossSection hardXSec_; /** * The soft cross section to be eikonalized. Default is zero */ CrossSection softXSec_; /** * The inv radius^2 of the soft interactions. */ Energy2 softMu2_; }; } #endif /* HERWIG_MPIHandler_H */ diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1,245 +1,246 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT([Herwig],[devel],[herwig@projects.hepforge.org],[Herwig]) +AC_INIT([Herwig],[7.2.0],[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 dnl === disable debug symbols by default ===== if test "x$CXXFLAGS" = "x"; then CXXFLAGS=-O2 fi if test "x$CFLAGS" = "x"; then CFLAGS=-O2 fi AC_LANG([C++]) AM_INIT_AUTOMAKE([1.11 subdir-objects gnu dist-bzip2 no-dist-gzip -Wall -Wno-portability]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Checks for C++ compiler. Handle C++11 flags. AC_PROG_CXX AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory]) dnl check for POSIX AC_CHECK_HEADER([unistd.h],[], [AC_MSG_ERROR([Herwig needs "unistd.h". Non-POSIX systems are not supported.])]) AC_CHECK_HEADER([sys/stat.h],[], [AC_MSG_ERROR([Herwig needs "sys/stat.h". Non-POSIX systems are not supported.])]) dnl Checks for programs. 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]) AC_FC_WRAPPERS LT_PREREQ([2.2.6]) LT_INIT([disable-static dlopen pic-only]) dnl #################################### dnl #################################### dnl for Doc/fixinterfaces.pl AC_PATH_PROG(PERL, perl) dnl for Models/Feynrules AM_PATH_PYTHON([2.6],, [:]) AM_CONDITIONAL([HAVE_PYTHON], [test "x$PYTHON" != "x:"]) HERWIG_CHECK_GSL HERWIG_CHECK_THEPEG BOOST_REQUIRE([1.41]) BOOST_FIND_HEADER([boost/numeric/ublas/io.hpp]) dnl Boost 1.64 is missing a required header to make these work dnl we just assume they're there if io.hpp has been found OK above dnl BOOST_FIND_HEADER([boost/numeric/ublas/matrix.hpp]) dnl BOOST_FIND_HEADER([boost/numeric/ublas/matrix_proxy.hpp]) dnl BOOST_FIND_HEADER([boost/numeric/ublas/matrix_sparse.hpp]) dnl BOOST_FIND_HEADER([boost/numeric/ublas/symmetric.hpp]) dnl BOOST_FIND_HEADER([boost/numeric/ublas/vector.hpp]) BOOST_FIND_HEADER([boost/operators.hpp]) BOOST_TEST() HERWIG_CHECK_VBFNLO HERWIG_CHECK_NJET HERWIG_CHECK_GOSAM HERWIG_CHECK_GOSAM_CONTRIB HERWIG_CHECK_OPENLOOPS HERWIG_CHECK_MADGRAPH HERWIG_CHECK_EVTGEN HERWIG_CHECK_PYTHIA HERWIG_COMPILERFLAGS HERWIG_LOOPTOOLS FASTJET_CHECK_FASTJET 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/UED/Makefile Models/LH/Makefile Models/LHTP/Makefile Models/Transplanckian/Makefile Models/Leptoquarks/Makefile Models/Zprime/Makefile Models/TTbAsymm/Makefile Models/Feynrules/Makefile Models/Feynrules/python/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 Decay/EvtGen/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 MatrixElement/Reweighters/Makefile MatrixElement/Matchbox/Makefile MatrixElement/Matchbox/Base/Makefile MatrixElement/Matchbox/Utility/Makefile MatrixElement/Matchbox/Phasespace/Makefile MatrixElement/Matchbox/Dipoles/Makefile MatrixElement/Matchbox/InsertionOperators/Makefile MatrixElement/Matchbox/Matching/Makefile MatrixElement/Matchbox/Cuts/Makefile MatrixElement/Matchbox/Scales/Makefile MatrixElement/Matchbox/ColorFull/Makefile MatrixElement/Matchbox/CVolver/Makefile MatrixElement/Matchbox/Builtin/Makefile MatrixElement/Matchbox/Builtin/Amplitudes/Makefile MatrixElement/Matchbox/Tests/Makefile MatrixElement/Matchbox/External/Makefile MatrixElement/Matchbox/External/BLHAGeneric/Makefile MatrixElement/Matchbox/External/VBFNLO/Makefile MatrixElement/Matchbox/External/NJet/Makefile MatrixElement/Matchbox/External/GoSam/Makefile MatrixElement/Matchbox/External/OpenLoops/Makefile MatrixElement/Matchbox/External/MadGraph/Makefile MatrixElement/Matchbox/External/MadGraph/mg2herwig + MatrixElement/FxFx/Makefile Sampling/Makefile Sampling/CellGrids/Makefile Shower/Makefile Shower/QTilde/Makefile Shower/QTilde/Matching/Makefile Shower/Dipole/Makefile Shower/Dipole/Base/Makefile Shower/Dipole/Kernels/Makefile Shower/Dipole/Kinematics/Makefile Shower/Dipole/Utility/Makefile Shower/Dipole/AlphaS/Makefile Shower/Dipole/SpinCorrelations/Makefile Utilities/Makefile Utilities/XML/Makefile Utilities/Statistics/Makefile Hadronization/Makefile lib/Makefile include/Makefile src/Makefile src/defaults/Makefile src/snippets/Makefile src/Matchbox/Makefile src/herwig-config Doc/Makefile Doc/HerwigDefaults.in Looptools/Makefile Analysis/Makefile API/Makefile src/Makefile-UserModules src/defaults/Analysis.in src/defaults/MatchboxDefaults.in src/defaults/Decays.in src/defaults/decayers.in src/defaults/setup.gosam.in src/Matchbox/LO-DefaultShower.in src/Matchbox/LO-DipoleShower.in src/Matchbox/MCatLO-DefaultShower.in src/Matchbox/MCatLO-DipoleShower.in src/Matchbox/LO-NoShower.in src/Matchbox/MCatNLO-DefaultShower.in src/Matchbox/MCatNLO-DipoleShower.in src/Matchbox/NLO-NoShower.in src/Matchbox/Powheg-DefaultShower.in src/Matchbox/Powheg-DipoleShower.in src/Merging/Makefile Shower/Dipole/Merging/Makefile Shower/Dipole/Colorea/Makefile src/defaults/MatchboxMergingDefaults.in Contrib/Makefile Contrib/make_makefiles.sh Tests/Makefile Makefile]) AC_CONFIG_LINKS([Doc/BSMlibs.in:Doc/BSMlibs.in]) AC_CONFIG_FILES([Doc/fixinterfaces.pl],[chmod +x Doc/fixinterfaces.pl]) AC_CONFIG_HEADERS([PDF/SaSPhotonPDF.cc]) HERWIG_OVERVIEW AC_CONFIG_COMMANDS([summary],[cat config.herwig]) AC_OUTPUT diff --git a/m4/herwig.m4 b/m4/herwig.m4 --- a/m4/herwig.m4 +++ b/m4/herwig.m4 @@ -1,900 +1,901 @@ dnl ##### THEPEG ##### AC_DEFUN([HERWIG_CHECK_THEPEG], [ defaultlocation="${prefix}" test "x$defaultlocation" = xNONE && defaultlocation="${ac_default_prefix}" AC_MSG_CHECKING([for libThePEG in]) AC_ARG_WITH(thepeg, AC_HELP_STRING([--with-thepeg=DIR],[location of ThePEG installation]), [], [with_thepeg="${defaultlocation}"]) AC_MSG_RESULT([$with_thepeg]) if test "x$with_thepeg" = "xno"; then AC_MSG_ERROR([Cannot build Herwig without ThePEG. Please set --with-thepeg.]) fi THEPEGLDFLAGS="-L${with_thepeg}/lib/ThePEG" THEPEGHASLHAPDF="no" if test -e ${with_thepeg}/lib/ThePEG/ThePEGLHAPDF.so ; then THEPEGHASLHAPDF="yes" fi if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG" if test -e ${with_thepeg}/lib64/ThePEG/ThePEGLHAPDF.so ; then THEPEGHASLHAPDF="yes" fi fi if test "x$THEPEGHASLHAPDF" == "xno" ; then AC_MSG_ERROR([Herwig requires ThePEG to be build with lhapdf.]) fi THEPEGHASFASTJET="no" if test -e ${with_thepeg}/lib/ThePEG/FastJetFinder.so ; then THEPEGHASFASTJET="yes" fi if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG" if test -e ${with_thepeg}/lib64/ThePEG/FastJetFinder.so ; then THEPEGHASFASTJET="yes" fi fi if test "x$THEPEGHASFASTJET" == "xno" ; then AC_MSG_ERROR([Herwig requires ThePEG to be build with FastJet.]) fi THEPEGPATH="${with_thepeg}" oldldflags="$LDFLAGS" oldlibs="$LIBS" LDFLAGS="$LDFLAGS $THEPEGLDFLAGS" AC_CHECK_LIB([ThePEG],[debugThePEG],[], [AC_MSG_ERROR([No ThePEG libraries in $THEPEGLDFLAGS. Please set --with-thepeg.])]) AC_SUBST([THEPEGLIB],[-lThePEG]) AC_SUBST(THEPEGLDFLAGS) AC_SUBST(THEPEGPATH) AC_SUBST(THEPEGHASLHAPDF) AC_SUBST(THEPEGHASFASTJET) LIBS="$oldlibs" LDFLAGS="$oldldflags" AC_MSG_CHECKING([for ThePEG headers in]) AC_ARG_WITH([thepeg-headers], AC_HELP_STRING([--with-thepeg-headers=DIR],[location of ThePEG include directory]), [], [with_thepeg_headers="${with_thepeg}/include"]) AC_MSG_RESULT([$with_thepeg_headers]) if test "x$with_thepeg_headers" = "xno"; then AC_MSG_ERROR([Cannot build Herwig without ThePEG headers. Please set --with-thepeg-headers.]) fi THEPEGINCLUDE="-I$with_thepeg_headers" oldcppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $THEPEGINCLUDE" AC_CHECK_HEADER([ThePEG/Config/ThePEG.h],[], [AC_MSG_ERROR([No ThePEG headers in $with_thepeg_headers. Please set --with-thepeg-headers.])]) CPPFLAGS="$oldcppflags" AC_SUBST(THEPEGINCLUDE) AC_MSG_CHECKING([for HepMCAnalysis.so in ThePEG]) THEPEGHASHEPMC="no" if test -e ${with_thepeg}/lib/ThePEG/HepMCAnalysis.so ; then THEPEGHASHEPMC="yes" fi if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG" if test -e ${with_thepeg}/lib64/ThePEG/HepMCAnalysis.so ; then THEPEGHASHEPMC="yes" fi fi if test "x$THEPEGHASHEPMC" == "xno" ; then CREATE_HEPMC="# create" AC_MSG_RESULT([not found]) else CREATE_HEPMC="create" AC_MSG_RESULT([found]) fi AC_SUBST([CREATE_HEPMC]) AC_MSG_CHECKING([for RivetAnalysis.so in ThePEG]) THEPEGHASRIVET="no" if test -e ${with_thepeg}/lib/ThePEG/RivetAnalysis.so ; then THEPEGHASRIVET="yes" fi if test "${host_cpu}" == "x86_64" -a -e ${with_thepeg}/lib64/ThePEG/libThePEG.so ; then THEPEGLDFLAGS="-L${with_thepeg}/lib64/ThePEG" if test -e ${with_thepeg}/lib64/ThePEG/RivetAnalysis.so ; then THEPEGHASRIVET="yes" fi fi if test "x$THEPEGHASRIVET" == "xno" ; then CREATE_RIVET="# create" AC_MSG_RESULT([not found]) else CREATE_RIVET="create" AC_MSG_RESULT([found]) fi +AM_CONDITIONAL(HAVE_RIVET,[test x$THEPEGHASRIVET = xyes]) AC_SUBST([CREATE_RIVET]) ]) dnl ##### LOOPTOOLS ##### AC_DEFUN([HERWIG_LOOPTOOLS], [ AC_REQUIRE([AC_PROG_FC]) AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([HERWIG_COMPILERFLAGS]) AC_MSG_CHECKING([if Looptools build works]) enable_looptools=yes if test "x$GCC" = "xyes"; then case "${host}" in x86_64-*|*-darwin1*) AM_FCFLAGS="$AM_FCFLAGS -fdefault-integer-8" ;; esac AC_LANG_PUSH([Fortran]) oldFCFLAGS="$FCFLAGS" FCFLAGS="$AM_FCFLAGS" AC_COMPILE_IFELSE( AC_LANG_PROGRAM([],[ print *[,]"Hello"]), [], [AC_MSG_RESULT([no]) AC_MSG_ERROR([needs gfortran on 64bit machines])] ) FCFLAGS="$oldFCFLAGS" AC_LANG_POP([Fortran]) fi AC_MSG_RESULT([$enable_looptools]) AC_SUBST([F77],[$FC]) AC_SUBST([FFLAGS],[$FCFLAGS]) AC_SUBST([AM_FFLAGS],[$AM_FCFLAGS]) AC_SUBST([FLIBS],[$FCLIBS]) ]) dnl ##### VBFNLO ##### AC_DEFUN([HERWIG_CHECK_VBFNLO], [ AC_MSG_CHECKING([for VBFNLO]) AC_ARG_WITH([vbfnlo], AS_HELP_STRING([--with-vbfnlo=DIR], [Installation path of VBFNLO]), [], [with_vbfnlo=no] ) AC_MSG_RESULT([$with_vbfnlo]) AS_IF([test "x$with_vbfnlo" != "xno"], [AC_CHECK_FILES( ${with_vbfnlo}/lib/VBFNLO/libVBFNLO.so, [have_vbfnlo=lib], [have_vbfnlo=no])], [have_vbfnlo=no]) AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ], [AC_CHECK_FILES( ${with_vbfnlo}/lib64/VBFNLO/libVBFNLO.so, [have_vbfnlo=lib64], [have_vbfnlo=no])]) AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ], [AC_CHECK_FILES( ${with_vbfnlo}/lib/VBFNLO/libVBFNLO.dylib, [have_vbfnlo=lib], [have_vbfnlo=no])]) AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno" ], [AC_CHECK_FILES( ${with_vbfnlo}/lib64/VBFNLO/libVBFNLO.dylib, [have_vbfnlo=lib64], [have_vbfnlo=no])]) AS_IF([test "x$have_vbfnlo" = "xlib"], [VBFNLOLIBS=${with_vbfnlo}/lib/VBFNLO AC_SUBST(VBFNLOLIBS) ]) AS_IF([test "x$have_vbfnlo" = "xlib64"], [VBFNLOLIBS=${with_vbfnlo}/lib64/VBFNLO AC_SUBST(VBFNLOLIBS) ]) AS_IF([test "x$with_vbfnlo" != "xno" -a "x$have_vbfnlo" = "xno"], [AC_MSG_ERROR([vbfnlo requested but not found])]) AM_CONDITIONAL(HAVE_VBFNLO,[test "x$have_vbfnlo" = "xlib" -o "x$have_vbfnlo" = "xlib64"]) if test "x$have_vbfnlo" = "xlib" -o "x$have_vbfnlo" = "xlib64" ; then AC_REQUIRE([AC_PROG_SED]) VBFNLOINCLUDE=${with_vbfnlo}/include AC_SUBST(VBFNLOINCLUDE) VBFNLOLIB=$(echo ${with_vbfnlo}/${have_vbfnlo}/VBFNLO | $SED -e 's%/\+%/%g') AC_SUBST(VBFNLOLIB) LOAD_VBFNLO="library" CREATE_VBFNLO="create" INSERT_VBFNLO="insert" SET_VBFNLO="set" DO_VBFNLO="do" MKDIR_VBFNLO="mkdir" else LOAD_VBFNLO="# library" CREATE_VBFNLO="# create" INSERT_VBFNLO="# insert" SET_VBFNLO="# set" DO_VBFNLO="# do" MKDIR_VBFNLO="# mkdir" fi AC_SUBST([LOAD_VBFNLO]) AC_SUBST([CREATE_VBFNLO]) AC_SUBST([INSERT_VBFNLO]) AC_SUBST([SET_VBFNLO]) AC_SUBST([DO_VBFNLO]) AC_SUBST([MKDIR_VBFNLO]) ]) dnl ##### njet ##### AC_DEFUN([HERWIG_CHECK_NJET], [ AC_MSG_CHECKING([for njet]) AC_ARG_WITH([njet], AS_HELP_STRING([--with-njet=DIR], [Installation path of njet]), [], [with_njet=no] ) AC_MSG_RESULT([$with_njet]) AS_IF([test "x$with_njet" != "xno"], [AC_CHECK_FILES( ${with_njet}/lib/libnjet2.so, [have_njet=lib], [have_njet=no])], [have_njet=no]) AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno" ], [AC_CHECK_FILES( ${with_njet}/lib64/libnjet2.so, [have_njet=lib64], [have_njet=no])]) AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno" ], [AC_CHECK_FILES( ${with_njet}/lib/libnjet2.dylib, [have_njet=lib], [have_njet=no])]) AS_IF([test "x$have_njet" = "xlib"], [NJETLIBPATH=${with_njet}/lib AC_SUBST(NJETLIBPATH) NJETINCLUDEPATH=${with_njet}/include AC_SUBST(NJETINCLUDEPATH) NJETPREFIX=${with_njet} AC_SUBST(NJETPREFIX) ]) AS_IF([test "x$have_njet" = "xlib64"], [NJETLIBPATH=${with_njet}/lib64 AC_SUBST(NJETLIBPATH) NJETINCLUDEPATH=${with_njet}/include AC_SUBST(NJETINCLUDEPATH) NJETPREFIX=${with_njet} AC_SUBST(NJETPREFIX) ]) AS_IF([test "x$with_njet" != "xno" -a "x$have_njet" = "xno"], [AC_MSG_ERROR([njet requested but not found])]) AM_CONDITIONAL(HAVE_NJET,[test "x$have_njet" = "xlib" -o "x$have_njet" = "xlib64"]) if test "x$have_njet" = "xlib" -o "x$have_njet" = "xlib64" ; then LOAD_NJET="library" CREATE_NJET="create" INSERT_NJET="insert" DO_NJET="do" else LOAD_NJET="# library" CREATE_NJET="# create" INSERT_NJET="# insert" DO_NJET="# do" fi AC_SUBST([LOAD_NJET]) AC_SUBST([CREATE_NJET]) AC_SUBST([INSERT_NJET]) AC_SUBST([DO_NJET]) ]) dnl ##### gosam ##### AC_DEFUN([HERWIG_CHECK_GOSAM], [ AC_MSG_CHECKING([for GoSam]) AC_ARG_WITH([gosam], AS_HELP_STRING([--with-gosam=DIR], [Installation path of GoSam]), [], [with_gosam=no] ) AC_MSG_RESULT([$with_gosam]) AS_IF([test "x$with_gosam" != "xno"], [AC_CHECK_FILES( ${with_gosam}/bin/gosam.py, [have_gosam=lib], [have_gosam=no])], [have_gosam=no]) AS_IF([test "x$have_gosam" = "xlib"], [GOSAMPREFIX=${with_gosam} AC_SUBST(GOSAMPREFIX) ]) AS_IF([test "x$with_gosam" != "xno" -a "x$have_gosam" = "xno"], [AC_MSG_ERROR([GoSam requested but not found])]) AS_IF([test "x$with_gosam" != "xno"], [AC_MSG_CHECKING([for GoSam version >= 2.0.4]) tmp_gosamversion=[$(${with_gosam}/bin/gosam.py --version | grep 'GoSam.*rev' | cut -d' ' -f2)] AX_COMPARE_VERSION([${tmp_gosamversion}],[lt],[2.0.4], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Herwig requires GoSam 2.0.4 or later, found ${tmp_gosamversion}])], [AC_MSG_RESULT([yes])])]) AM_CONDITIONAL(HAVE_GOSAM,[test "x$have_gosam" = "xlib" ]) if test "x$have_gosam" = "xlib" ; then LOAD_GOSAM="library" CREATE_GOSAM="create" INSERT_GOSAM="insert" DO_GOSAM="do" else LOAD_GOSAM="# library" CREATE_GOSAM="# create" INSERT_GOSAM="# insert" DO_GOSAM="# do" fi AC_SUBST([LOAD_GOSAM]) AC_SUBST([CREATE_GOSAM]) AC_SUBST([INSERT_GOSAM]) AC_SUBST([DO_GOSAM]) ]) dnl ##### gosam-contrib ##### AC_DEFUN([HERWIG_CHECK_GOSAM_CONTRIB], [ AC_MSG_CHECKING([for gosam-contrib]) AC_ARG_WITH([gosam-contrib], AS_HELP_STRING([--with-gosam-contrib=DIR], [Installation path of gosam-contrib]), [], [with_gosam_contrib=no] ) AC_MSG_RESULT([$with_gosam_contrib]) AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"], [AC_CHECK_FILES( ${with_gosam}/lib/libsamurai.so, [with_gosam_contrib=${with_gosam}], []) ]) AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"], [AC_CHECK_FILES( ${with_gosam}/lib64/libsamurai.so, [with_gosam_contrib=${with_gosam}], []) ]) AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"], [AC_CHECK_FILES( ${with_gosam}/lib/libsamurai.dylib, [with_gosam_contrib=${with_gosam}], []) ]) AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"], [AC_CHECK_FILES( ${with_gosam}/lib64/libsamurai.dylib, [with_gosam_contrib=${with_gosam}], []) ]) AS_IF([test "x$with_gosam_contrib" = "xno" -a "x$with_gosam" != "xno"], [AC_MSG_ERROR([GoSam requested without requesting GoSam-Contrib])]) AS_IF([test "x$with_gosam_contrib" != "xno"], [AC_CHECK_FILES( ${with_gosam_contrib}/lib/libsamurai.so, [have_gosam_contrib=lib], [have_gosam_contrib=no])], [have_gosam_contrib=no]) AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ], [AC_CHECK_FILES( ${with_gosam_contrib}/lib64/libsamurai.so, [have_gosam_contrib=lib64], [have_gosam_contrib=no])]) AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ], [AC_CHECK_FILES( ${with_gosam_contrib}/lib/libsamurai.dylib, [have_gosam_contrib=lib], [have_gosam_contrib=no])]) AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno" ], [AC_CHECK_FILES( ${with_gosam_contrib}/lib64/libsamurai.dylib, [have_gosam_contrib=lib64], [have_gosam_contrib=no])]) AS_IF([test "x$have_gosam_contrib" != "xno"], [GOSAMCONTRIBPREFIX=${with_gosam_contrib} AC_SUBST(GOSAMCONTRIBPREFIX) ]) AS_IF([test "x$have_gosam_contrib" = "xlib"], [GOSAMCONTRIBLIBS=${with_gosam_contrib}/lib AC_SUBST(GOSAMCONTRIBLIBS) ]) AS_IF([test "x$have_gosam_contrib" = "xlib64"], [GOSAMCONTRIBLIBS=${with_gosam_contrib}/lib64 AC_SUBST(GOSAMCONTRIBLIBS) ]) AS_IF([test "x$with_gosam_contrib" != "xno" -a "x$have_gosam_contrib" = "xno"], [AC_MSG_ERROR([GoSam-Contrib requested but not found])]) AM_CONDITIONAL(HAVE_GOSAM_CONTRIB,[test "x$have_gosam_contrib" = "xlib" -o "x$have_gosam_contrib" = "xlib64"]) if test "x$have_gosam_contrib" = "xlib" -o "x$have_gosam_contrib" = "xlib64" ; then LOAD_GOSAM_CONTRIB="library" CREATE_GOSAM_CONTRIB="create" INSERT_GOSAM_CONTRIB="insert" else LOAD_GOSAM_CONTRIB="# library" CREATE_GOSAM_CONTRIB="# create" INSERT_GOSAM_CONTRIB="# insert" fi AC_SUBST([LOAD_GOSAM_CONTRIB]) AC_SUBST([CREATE_GOSAM_CONTRIB]) AC_SUBST([INSERT_GOSAM_CONTRIB]) ]) dnl ##### OpenLoops ##### AC_DEFUN([HERWIG_CHECK_OPENLOOPS], [ AC_MSG_CHECKING([for OpenLoops]) AC_ARG_WITH([openloops], AS_HELP_STRING([--with-openloops=DIR], [Installation path of OpenLoops]), [], [with_openloops=no] ) AC_MSG_RESULT([$with_openloops]) AS_IF([test "x$with_openloops" != "xno"], [AC_CHECK_FILES( ${with_openloops}/lib/libopenloops.so, [have_openloops=lib], [have_openloops=no])], [have_openloops=no]) AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ], [AC_CHECK_FILES( ${with_openloops}/lib/libopenloops.dylib, [have_openloops=lib], [have_openloops=no])]) AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ], [AC_CHECK_FILES( ${with_openloops}/lib64/libopenloops.so, [have_openloops=lib64], [have_openloops=no])]) AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno" ], [AC_CHECK_FILES( ${with_openloops}/lib64/libopenloops.dylib, [have_openloops=lib64], [have_openloops=no])]) AS_IF([test "x$have_openloops" = "xlib"], [OPENLOOPSLIBS=${with_openloops}/lib AC_SUBST(OPENLOOPSLIBS) ]) AS_IF([test "x$have_openloops" = "xlib64"], [OPENLOOPSLIBS=${with_openloops}/lib64 AC_SUBST(OPENLOOPSLIBS) ]) AS_IF([test "x$with_openloops" != "xno" -a "x$have_openloops" = "xno"], [AC_MSG_ERROR([OpenLoops requested but not found])]) AM_CONDITIONAL(HAVE_OPENLOOPS,[test "x$have_openloops" = "xlib" -o "x$have_openloops" = "xlib64"]) if test "x$have_openloops" = "xlib" -o "x$have_openloops" = "xlib64" ; then OPENLOOPSPREFIX=${with_openloops} LOAD_OPENLOOPS="library" CREATE_OPENLOOPS="create" INSERT_OPENLOOPS="insert" SET_OPENLOOPS="set" DO_OPENLOOPS="do" MKDIR_OPENLOOPS="mkdir" else LOAD_OPENLOOPS="# library" CREATE_OPENLOOPS="# create" INSERT_OPENLOOPS="# insert" SET_OPENLOOPS="# set" DO_OPENLOOPS="# do" MKDIR_OPENLOOPS="# mkdir" fi AC_SUBST([OPENLOOPSPREFIX]) AC_SUBST([LOAD_OPENLOOPS]) AC_SUBST([CREATE_OPENLOOPS]) AC_SUBST([INSERT_OPENLOOPS]) AC_SUBST([SET_OPENLOOPS]) AC_SUBST([DO_OPENLOOPS]) AC_SUBST([MKDIR_OPENLOOPS]) ]) ######################################### dnl ##### madgraph ##### AC_DEFUN([HERWIG_CHECK_MADGRAPH], [ AC_MSG_CHECKING([for MadGraph]) AC_ARG_WITH([madgraph], AS_HELP_STRING([--with-madgraph=DIR], [Installation path of MadGraph]), [], [with_madgraph=no] ) AC_MSG_RESULT([$with_madgraph]) AS_IF([test "x$with_madgraph" != "xno"], [AC_CHECK_FILES( ${with_madgraph}/bin/mg5_aMC, [have_madgraph=yes], [have_madgraph=no])], [have_madgraph=no]) AS_IF([test "x$have_madgraph" = "xyes"], [MADGRAPHPREFIX=${with_madgraph} AC_SUBST(MADGRAPHPREFIX) ]) AS_IF([test "x$with_madgraph" != "xno" -a "x$have_madgraph" = "xno"], [AC_MSG_ERROR([MadGraph requested but not found])]) AM_CONDITIONAL(HAVE_MADGRAPH,[test "x$have_madgraph" = "xyes" ]) if test "x$have_madgraph" = "xyes" ; then LOAD_MADGRAPH="library" CREATE_MADGRAPH="create" INSERT_MADGRAPH="insert" SET_MADGRAPH="set" DO_MADGRAPH="do" else LOAD_MADGRAPH="# library" CREATE_MADGRAPH="# create" INSERT_MADGRAPH="# insert" SET_MADGRAPH="# set" DO_MADGRAPH="# do" fi AC_SUBST([LOAD_MADGRAPH]) AC_SUBST([CREATE_MADGRAPH]) AC_SUBST([INSERT_MADGRAPH]) AC_SUBST([SET_MADGRAPH]) AC_SUBST([DO_MADGRAPH]) ]) dnl ##### EvtGen ##### AC_DEFUN([HERWIG_CHECK_EVTGEN], [ AC_MSG_CHECKING([for evtgen]) AC_ARG_WITH([evtgen], AS_HELP_STRING([--with-evtgen=DIR], [Installation path of EvtGen]), [], [with_evtgen=no] ) AC_MSG_RESULT([$with_evtgen]) AS_IF([test "x$with_evtgen" != "xno"], [AC_CHECK_FILES( ${with_evtgen}/lib/libEvtGenExternal.so, [have_evtgen=lib], [have_evtgen=no])], [have_evtgen=no]) AS_IF([test "x$with_evtgen" != "xno" -a "x$have_evtgen" = "xno"], [AC_CHECK_FILES( ${with_evtgen}/lib64/libEvtGenExternal.so, [have_evtgen=lib64], [have_evtgen=no])]) AS_IF([test "x$with_evtgen" != "xno" -a "x$have_evtgen" = "xno" ], [AC_CHECK_FILES( ${with_evtgen}/lib/libEvtGenExternal.dylib, [have_evtgen=lib], [have_evtgen=no])]) AS_IF([test "x$have_evtgen" = "xlib" -o "x$have_evtgen" = "xlib64" ], [EVTGENPREFIX=${with_evtgen} AC_SUBST(EVTGENPREFIX) ]) AS_IF([test "x$with_evtgen" != "xno" -a "x$have_evtgen" = "xno"], [AC_MSG_ERROR([EvtGen requested but not found])]) AC_SUBST([EVTGENINCLUDE],[-I$EVTGENPREFIX/include]) AM_CONDITIONAL(HAVE_EVTGEN,[test "x$have_evtgen" = "xlib" -o "x$have_evtgen" = "xlib64"]) if test "x$have_evtgen" = "xlib" ; then LOAD_EVTGEN_DECAYS="read EvtGenBDecays.in" LOAD_EVTGEN_DECAYER="read EvtGenDecayer.in" EVTGENLIBS="-L$with_evtgen/lib -lEvtGen -lEvtGenExternal" elif test "x$have_evtgen" = "xlib64" ; then LOAD_EVTGEN_DECAYS="read EvtGenBDecays.in" LOAD_EVTGEN_DECAYER="read EvtGenDecayer.in" EVTGENLIBS="-L$with_evtgen/lib64 -lEvtGen -lEvtGenExternal" else LOAD_EVTGEN_DECAYS="read HerwigBDecays.in" LOAD_EVTGEN_DECAYER="#read EvtGenDecayer.in" EVTGENLIBS="" fi AC_SUBST([LOAD_EVTGEN_DECAYS]) AC_SUBST([LOAD_EVTGEN_DECAYER]) AC_SUBST([EVTGENLIBS]) ]) AC_DEFUN([HERWIG_CHECK_PYTHIA], [ dnl check if a directory is specified for Pythia AC_ARG_WITH(pythia, [AC_HELP_STRING([--with-pythia=dir], [Assume the given directory for Pythia])]) dnl search for the pythia-config script if test "$with_pythia" = ""; then AC_PATH_PROG(pythiaconfig, pythia8-config, no) else AC_PATH_PROG(pythiaconfig, pythia8-config, no, ${with_pythia}/bin) fi if test "${pythiaconfig}" = "no"; then AC_MSG_CHECKING(Pythia) AC_MSG_RESULT(no); # $2 else PYTHIA8DATA=`${pythiaconfig} --datadir`/xmldoc fi AC_SUBST(PYTHIA8DATA) ]) dnl CHECK PYTHIA END dnl ###### GSL ###### AC_DEFUN([HERWIG_CHECK_GSL], [ AC_MSG_CHECKING([for gsl location]) GSLINCLUDE="" GSLLIBS="" AC_ARG_WITH(gsl, AC_HELP_STRING([--with-gsl=DIR],[location of gsl installation @<:@default=system libs@:>@]), [], [with_gsl=system]) if test "x$with_gsl" = "xno"; then AC_MSG_ERROR([libgsl is required. Please install the GNU scientific library and header files.]) fi if test "x$with_gsl" = "xsystem"; then AC_MSG_RESULT([in system libraries]) oldlibs="$LIBS" AC_CHECK_LIB(m,main) AC_CHECK_LIB(gslcblas,main) AC_CHECK_LIB(gsl,main,[], [ AC_MSG_ERROR([Cannot find libgsl. Please install the GNU scientific library and header files or use --with-gsl=.]) ] ) GSLLIBS="$LIBS" GSLPATH="$with_gsl" LIBS=$oldlibs else if test "`uname -m`" = "x86_64" -a -e "$with_gsl/lib64/libgsl.a" -a -d "$with_gsl/include/gsl"; then AC_MSG_RESULT([found in $with_gsl]) GSLLIBS="-L$with_gsl/lib64 -R$with_gsl/lib64 -lgslcblas -lgsl" GSLINCLUDE="-I$with_gsl/include" GSLPATH="$with_gsl" elif test -e "$with_gsl/lib/libgsl.a" -a -d "$with_gsl/include/gsl"; then AC_MSG_RESULT([found in $with_gsl]) GSLLIBS="-L$with_gsl/lib -R$with_gsl/lib -lgslcblas -lgsl" GSLINCLUDE="-I$with_gsl/include" GSLPATH="$with_gsl" else AC_MSG_RESULT([not found]) AC_MSG_ERROR([Can't find $with_gsl/lib/libgsl.a or the headers in $with_gsl/include]) fi fi AC_SUBST(GSLINCLUDE) AC_SUBST(GSLLIBS) AC_SUBST(GSLPATH) ]) dnl ##### COMPILERFLAGS ##### AC_DEFUN([HERWIG_COMPILERFLAGS], [ AC_REQUIRE([HERWIG_CHECK_GSL]) AC_REQUIRE([HERWIG_CHECK_THEPEG]) AC_REQUIRE([BOOST_REQUIRE]) AC_REQUIRE([AX_COMPILER_VENDOR]) AM_CPPFLAGS="-I\$(top_builddir)/include $THEPEGINCLUDE \$(GSLINCLUDE) \$(BOOST_CPPFLAGS)" AC_MSG_CHECKING([for debugging mode]) AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[debug mode, use --enable-debug=slow for additional options that slow down the run.]), [], [enable_debug=no] ) AC_MSG_RESULT([$enable_debug]) if test "x$enable_debug" = "xno"; then debugflags="" else debugflags="-g" fi dnl -Wfloat-equal -fvisibility-inlines-hidden -Wctor-dtor-privacy -Weffc++ if test -n "$GCC"; then warnflags="-pedantic -Wall -Wextra -Wno-overloaded-virtual" if test "x$enable_debug" = "xslow"; then debugflags="$debugflags -fno-inline" AM_CPPFLAGS="$AM_CPPFLAGS -D_GLIBCXX_DEBUG" fi fi dnl do an actual capability check on ld instead of this workaround case "${host}" in *-darwin*) ;; *) AM_LDFLAGS="-Wl,--enable-new-dtags" ;; esac case "${ax_cv_cxx_compiler_vendor}" in gnu) AM_CXXFLAGS="-pedantic -Wall -W" ;; clang) AM_CXXFLAGS="-pedantic -Wall -Wno-overloaded-virtual -Wno-unused-function -Wno-unused-parameter" dnl -Wno-unneeded-internal-declaration ;; intel) AM_CXXFLAGS="-strict-ansi -Wall -wd13000,1418,981,444,383,1599,1572,2259,980" ;; esac AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CFLAGS, ["$warnflags $debugflags"]) AC_SUBST(AM_CXXFLAGS,["$AM_CXXFLAGS $warnflags $debugflags"]) AC_SUBST(AM_FCFLAGS, ["$debugflags"]) AC_SUBST(AM_LDFLAGS) ]) AC_DEFUN([HERWIG_ENABLE_MODELS], [ AC_MSG_CHECKING([if BSM models should be built]) AC_ARG_ENABLE(models, AC_HELP_STRING([--disable-models],[Turn off compilation of BSM models.]), [], [enable_models=yes] ) AC_MSG_RESULT([$enable_models]) LOAD_BSM="" if test "$enable_models" = "yes"; then LOAD_BSM="read BSMlibs.in" fi AC_SUBST(LOAD_BSM) AM_CONDITIONAL(WANT_BSM,[test "$enable_models" = "yes"]) ]) AC_DEFUN([HERWIG_OVERVIEW], [ FCSTRING=`$FC --version | head -1` CXXSTRING=`$CXX --version | head -1` CCSTRING=`$CC --version | head -1` if test "x$PYTHON" != "x:" then python_was_found="yes, using Python $PYTHON_VERSION" else python_was_found="no, requires Python >= 2.6" fi cat << _HW_EOF_ > config.herwig ***************************************************** *** $PACKAGE_STRING configuration summary *** Please include this information in bug reports! ***-------------------------------------------------- *** Prefix: $prefix *** *** BSM models: $enable_models *** UFO converter: ${python_was_found} *** *** Herwig debug mode: $enable_debug *** *** ThePEG: $with_thepeg *** ThePEG headers: $with_thepeg_headers *** *** GoSam: $with_gosam *** GoSam-Contrib: $with_gosam_contrib *** MadGraph: $with_madgraph *** njet: $with_njet *** OpenLoops: $with_openloops *** VBFNLO: $with_vbfnlo *** *** EvtGen: $with_evtgen *** GSL: $with_gsl *** boost: ${BOOST_CPPFLAGS:-system} *** Fastjet: ${fjconfig} *** *** Host: $host *** CC: $CCSTRING *** CXX: $CXXSTRING *** FC: $FCSTRING *** *** CXXFLAGS: $CXXFLAGS ***************************************************** _HW_EOF_ ]) diff --git a/src/LHC-MB.in b/src/LHC-MB.in --- a/src/LHC-MB.in +++ b/src/LHC-MB.in @@ -1,69 +1,103 @@ # -*- ThePEG-repository -*- ################################################################################ # This file contains our best tune to UE data from ATLAS at 7 TeV. More recent # tunes and tunes for other centre-of-mass energies as well as more usage # instructions can be obtained from this Herwig wiki page: # http://projects.hepforge.org/herwig/trac/wiki/MB_UE_tunes # The model for soft interactions and diffractions is explained in # [S. Gieseke, P. Kirchgaesser, F. Loshaj, arXiv:1612.04701] ################################################################################ read snippets/PPCollider.in ################################################## # Technical parameters for this run ################################################## cd /Herwig/Generators ################################################## # LHC physics parameters (override defaults here) ################################################## set EventGenerator:EventHandler:LuminosityFunction:Energy 7000.0 +# Intrinsic pT tune extrapolated to LHC energy +set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 2.2*GeV # Minimum Bias read snippets/MB.in # Read in parameters of the soft model recommended for MB/UE simulations read snippets/SoftTune.in -# Diffraction model + +#Diffraction model read snippets/Diffraction.in -# Read in snippet in order to use baryonic reconnection model with modified gluon splitting (uds) -# For more details see [S. Gieseke, P. Kirchgaeßer, S. Plätzer. arXiv:1710.10906]] -############################################################################################## +#Turn on Baryonic reconnection +read snippets/BaryonicReconnection.in -# read snippets/BaryonicReconnection.in +# Normalization of the Min bias cross section for correct diffractive cross section +set /Herwig/MatrixElements/MEMinBias:csNorm 0.01 -################################################## + +# Use LHC parametrization of the cross section +set /Herwig/UnderlyingEvent/MPIHandler:DLmode 2 + + +#some preliminary parameters for the MPI model which need to be tuned +#TODO +set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.02 +set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.4 +set /Herwig/UnderlyingEvent/MPIHandler:Power 0.308 +set /Herwig/Partons/RemnantDecayer:ladderMult 0.45 +set /Herwig/Partons/RemnantDecayer:ladderbFactor 1.0 +set /Herwig/UnderlyingEvent/MPIHandler:DiffractiveRatio 0.17 + +#ordered pTs +set /Herwig/Partons/RemnantDecayer:PtDistribution 4 +#use random remnant connections +set /Herwig/Partons/RemnantDecayer:RandomConnection No + +# set the correct PDFs +set /Herwig/Partons/HardLOPDF:PDFName CT14lo +set /Herwig/Partons/ShowerLOPDF:PDFName CT14lo +set /Herwig/Partons/MPIPDF:PDFName CT14lo +set /Herwig/Partons/RemnantPDF:PDFName CT14lo + +#set /Herwig/Shower/ShowerHandler:CascadeHandler NULL # Switch off parton shower +#set /Herwig/Hadronization/HadronizationHandler:HadronizationHandler NULL +# do Soft interactions + +#set /Herwig/Hadronization/ColourReconnector:ColourReconnection No +################################################# # Analyses ################################################## +#Comment these lines out in order to use rivet analyses +cd /Herwig/Analysis +create ThePEG::RivetAnalysis RivetAnalysis RivetAnalysis.so -# cd /Herwig/Analysis -# create ThePEG::RivetAnalysis RivetAnalysis RivetAnalysis.so +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis -# cd /Herwig/Generators -# insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/RivetAnalysis - -# insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_20XX_XXXXXXX - +#Some example analyses +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2012_I1084540 +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2010_S8918562 #set /Herwig/Analysis/Plot:EventNumber 54 #cd /Herwig/Generators #insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/Plot #insert EventGenerator: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' ################################################## cd /Herwig/Generators saverun LHC-MB EventGenerator diff --git a/src/LHE-FxFx.in b/src/LHE-FxFx.in new file mode 100644 --- /dev/null +++ b/src/LHE-FxFx.in @@ -0,0 +1,150 @@ +################################################## +# Example generator based on LHC parameters +# For FxFx merging with MadGraph5/aMC@NLO +# usage: Herwig read FxFx.in +################################################## +read snippets/SoftModel.in +################################################## +# Technical parameters for this run +################################################## +cd /Herwig/Generators +set EventGenerator:NumberOfEvents 100000000 +set EventGenerator:RandomNumberGenerator:Seed 31122001 +set EventGenerator:PrintEvent 1 +set EventGenerator:MaxErrors 10000 +################################################################## +# Create the Les Houches file handler and reader for FxFx events +################################################################## +cd /Herwig/EventHandlers +library HwFxFx.so +create Herwig::FxFxEventHandler LesHouchesHandler + +# set the various step handlers +set LesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor +set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler +set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler + +# set the weight option (for MC@NLO) +set LesHouchesHandler:WeightOption VarNegWeight + +# set event hander as one to be used +set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler + +# Set up an EMPTY CUTS object +# Normally you will have imposed any cuts you want +# when generating the event file and don't want any more +# in particular for POWHEG and MC@NLO you must not apply cuts on the +# the extra jet +create ThePEG::Cuts /Herwig/Cuts/NoCuts + +# Create a LH reader specialised for FxFx events +cd /Herwig/EventHandlers +create Herwig::FxFxFileReader FxFxLHReader +insert LesHouchesHandler:FxFxReaders[0] FxFxLHReader + +# Create the FxFxHandler for merging with the shower +cd /Herwig/Shower +library HwFxFxHandler.so +create Herwig::FxFxHandler FxFxHandler +set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator +set /Herwig/Shower/FxFxHandler:KinematicsReconstructor /Herwig/Shower/KinematicsReconstructor +set /Herwig/Shower/FxFxHandler:PartnerFinder /Herwig/Shower/PartnerFinder +set /Herwig/EventHandlers/LesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler + +################################################################################### +# PDF settings # +# You may wish to use the same PDF as the events were generated with # +################################################################################### +create ThePEG::LHAPDF /Herwig/Partons/LHAPDF ThePEGLHAPDF.so +set /Herwig/Partons/LHAPDF:PDFName NAME_OF_PDF +set /Herwig/Partons/RemnantDecayer:AllowTop Yes +set /Herwig/Partons/LHAPDF:RemnantHandler /Herwig/Partons/HadronRemnants +set /Herwig/Particles/p+:PDF /Herwig/Partons/LHAPDF +set /Herwig/Particles/pbar-:PDF /Herwig/Partons/LHAPDF +set /Herwig/Partons/PPExtractor:FirstPDF /Herwig/Partons/LHAPDF +set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/LHAPDF +# We would recommend the shower uses the default PDFs with which it was tuned. +# However it can be argued that the same set as for the sample should be used for +# matched samples, i.e. MC@NLO (and less so POWHEG) +set /Herwig/Shower/ShowerHandler:PDFA /Herwig/Partons/LHAPDF +set /Herwig/Shower/ShowerHandler:PDFB /Herwig/Partons/LHAPDF + +# You can in principle also change the PDFs for the remnant extraction and +# multiple scattering. As the generator was tuned with the default values +# this is STRONGLY DISCOURAGED without retuning the MPI parameters +# create the reader and set cuts +set /Herwig/EventHandlers/FxFxLHReader:FileName NAME_OF_FILE #(the file can be compressed (gziped,bziped)) +set /Herwig/EventHandlers/FxFxLHReader:WeightWarnings false +set /Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen No +set /Herwig/EventHandlers/FxFxLHReader:InitPDFs 0 +set /Herwig/EventHandlers/FxFxLHReader:Cuts /Herwig/Cuts/NoCuts +# option to ensure momentum conservation is O.K. due rounding errors (recommended) +set /Herwig/EventHandlers/FxFxLHReader:MomentumTreatment RescaleEnergy +# set the pdfs +set /Herwig/EventHandlers/FxFxLHReader:PDFA /Herwig/Partons/LHAPDF +set /Herwig/EventHandlers/FxFxLHReader:PDFB /Herwig/Partons/LHAPDF +# if using BSM models with QNUMBER info +#set /Herwig/EventHandlers/FxFxLHReader:QNumbers Yes +#set /Herwig/EventHandlers/FxFxLHReader:Decayer /Herwig/Decays/Mambo + +################################################## +# Shower parameters # +################################################## +# normally, especially for POWHEG, you want +# the scale supplied in the event files (SCALUP) +# to be used as a pT veto scale in the parton shower +set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes +set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes +# Shower parameters +# treatment of wide angle radiation +set /Herwig/Shower/PartnerFinder:PartnerMethod Random +set /Herwig/Shower/PartnerFinder:ScaleChoice Partner +# with MC@NLO these parameters are required for consistency of the subtraction terms +set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost +set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General +set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity +set /Herwig/Shower/ShowerHandler:SpinCorrelations No + +############################################################# +# Set up the FxFxHandler # +############################################################# +cd /Herwig/Shower +set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer +set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD +# set the heavy quark decay product vetoing process on/off +set FxFxHandler:HeavyQVeto Yes +# Automatic detection of the hard process (experimental) +set FxFxHandler:HardProcessDetection Automatic +# No. of light jets in maximum-multiplicity FxFx process +set FxFxHandler:njetsmax MAXIMUM_NUMBER_OF_PARTONS_IN_LHE_FILE # Make sure this is set correctly! +# Mimimum parton-parton R-sep used for generation. +set FxFxHandler:drjmin 0 +# Recommended key merging parameters below +cd /Herwig/Shower +# turn the Vetoing On or Off completely +set FxFxHandler:VetoIsTurnedOff VetoingIsOn +# merging mode: in this case FxFx: +set FxFxHandler:MergeMode FxFx +# merging scale +set FxFxHandler:ETClus 20*GeV +# jet radius used in clustering in merging. +set FxFxHandler:RClus 1.0 +# Max |eta| for jets in clustering in merging. +set FxFxHandler:EtaClusMax 10 +# Default 1.5 factor used to decide if a jet matches a parton +# in merging: if DR(parton,jet) valgrind-$(notdir $(subst .in,,$<))-read.log $(VALGRIND) ./Herwig run $(notdir $(subst .in,.run,$<)) -N 500 -d1 -D &> valgrind-$(notdir $(subst .in,,$<))-run.log valgrind: valgrind-init valgrind-read valgrind-run valgrind-init: $(VALGRIND) ./Herwig init -d1 -D -L$(top_builddir)/lib 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 CHECKCOMMAND = ./Herwig run $(notdir $(subst .in,.run,$<)) -N500 -d1 -D check-%: $(srcdir)/%.in HerwigDefaults.rpo link-helper-files ./Herwig read -i . $< -D @echo $(CHECKCOMMAND) @$(CHECKCOMMAND) && echo "# $@ OK #" \ || (echo "###### $@ BAD ######"; false) SETUPTHEPEG=$(THEPEGPATH)/bin/setupThePEG THEPEGREPO=$(THEPEGLIBPATH)/ThePEGDefaults.rpo install-data-hook: @echo Creating repository @./Herwig init -L$(DESTDIR)$(pkglibdir) -i$(DESTDIR)$(pkgdatadir) -i$(DESTDIR)$(pkgdatadir)/snippets $(DESTDIR)$(defaultsdir)/HerwigDefaults.in --repo=$(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo @if test -n "$(DESTDIR)"; \ then sed -i.bak -e "s@$(DESTDIR)@@g" $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo; \ rm -f $(DESTDIR)$(pkgdatadir)/HerwigDefaults.rpo.bak; \ fi 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)" \ -i $(DESTDIR)$(pkgdatadir) \ -l$(DESTDIR)$(pkglibdir) ; \ if test -n "$(DESTDIR)"; \ then sed -i -e "s@$(DESTDIR)@@g" "$(THEPEGREPO)" ; fi ; \ 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 nodist_Herwig_SOURCES = hgstamp.inc BUILT_SOURCES += hgstamp.inc CLEANFILES += hgstamp.inc HGVERSION := $(shell hg -R $(top_srcdir) parents --template '"Herwig {node|short} ({branch})"' 2> /dev/null || echo \"$(PACKAGE_STRING)\" || true ) .PHONY: update_hgstamp hgstamp.inc: update_hgstamp @[ -f $@ ] || touch $@ @echo '$(HGVERSION)' | cmp -s $@ - || echo '$(HGVERSION)' > $@ GENGETOPT = gengetopt %opts.h %opts.c : %opts.ggo $(GENGETOPT) < $< diff --git a/src/snippets/BaryonicReconnection.in b/src/snippets/BaryonicReconnection.in --- a/src/snippets/BaryonicReconnection.in +++ b/src/snippets/BaryonicReconnection.in @@ -1,17 +1,17 @@ # Set strange quark mass to 0.45 in order to allow alternative gluon splitting set /Herwig/Particles/s:ConstituentMass 0.45*GeV set /Herwig/Particles/sbar:ConstituentMass 0.45*GeV # Use Baryonic Colour Reconnection Model -set /Herwig/Hadronization/ColourReconnector:Algorithm BaryonicReco +set /Herwig/Hadronization/ColourReconnector:Algorithm Baryonic # Allow alternative gluon splitting set /Herwig/Hadronization/PartonSplitter:Split uds # Parameters for the Baryonic Reconnection Model set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.772606 set /Herwig/Hadronization/ColourReconnector:ReconnectionProbabilityBaryonic 0.477612 set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.053252 set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.282032 set /Herwig/Hadronization/HadronSelector:PwtSquark 0.291717 set /Herwig/Hadronization/PartonSplitter:SplitPwtSquark 0.824135 diff --git a/src/snippets/Diffraction.in b/src/snippets/Diffraction.in --- a/src/snippets/Diffraction.in +++ b/src/snippets/Diffraction.in @@ -1,104 +1,120 @@ ################################################## # Create separate SubProcessHandler for Diffraction ################################################## cd /Herwig/MatrixElements create Herwig::MEDiffraction MEDiffractionLeft set MEDiffractionLeft:DiffDirection Left create Herwig::MEDiffraction MEDiffractionRight set MEDiffractionRight:DiffDirection Right create Herwig::MEDiffraction MEDiffractionDouble set MEDiffractionDouble:DiffDirection Both create Herwig::MEDiffraction MEDiffractionDeltaLeft set MEDiffractionDeltaLeft:DiffDirection Left create Herwig::MEDiffraction MEDiffractionDeltaRight set MEDiffractionDeltaRight:DiffDirection Right create Herwig::MEDiffraction MEDiffractionDeltaDouble set MEDiffractionDeltaDouble:DiffDirection Both # Make a parton extractor for diffraction cd /Herwig/Partons cp PPExtractor DiffPPExtractor set DiffPPExtractor:FirstPDF /Herwig/Partons/NoPDF set DiffPPExtractor:SecondPDF /Herwig/Partons/NoPDF cd /Herwig/MatrixElements/ # Create Diffraction SubProcessHandler cp SubProcess QCDDiffraction # Assign the PartonExtractor to the SubProcessHandler set QCDDiffraction:PartonExtractor /Herwig/Partons/DiffPPExtractor # Use only Delta as final excited state (Yes/No) set MEDiffractionLeft:DeltaOnly No set MEDiffractionRight:DeltaOnly No set MEDiffractionDouble:DeltaOnly No set MEDiffractionDeltaLeft:DeltaOnly Yes set MEDiffractionDeltaRight:DeltaOnly Yes set MEDiffractionDeltaDouble:DeltaOnly Yes # Set weight for Diffraction set MEDiffractionLeft:DiffractionAmplitude 12 set MEDiffractionRight:DiffractionAmplitude 12 set MEDiffractionDouble:DiffractionAmplitude 8 set MEDiffractionDeltaLeft:DiffractionAmplitude 4 set MEDiffractionDeltaRight:DiffractionAmplitude 4 set MEDiffractionDeltaDouble:DiffractionAmplitude 2 # Set soft diffraction paramters # Parameter values from arxiv/0709.0395 set MEDiffractionLeft:ProtonPomeronSlope 10.1 set MEDiffractionLeft:SoftPomeronIntercept 1.08 set MEDiffractionLeft:SoftPomeronSlope 0.25 set MEDiffractionRight:ProtonPomeronSlope 10.1 set MEDiffractionRight:SoftPomeronIntercept 1.08 set MEDiffractionRight:SoftPomeronSlope 0.25 set MEDiffractionDouble:ProtonPomeronSlope 10.1 set MEDiffractionDouble:SoftPomeronIntercept 1.08 set MEDiffractionDouble:SoftPomeronSlope 0.25 set MEDiffractionDeltaLeft:ProtonPomeronSlope 10.1 set MEDiffractionDeltaLeft:SoftPomeronIntercept 1.08 set MEDiffractionDeltaLeft:SoftPomeronSlope 0.25 set MEDiffractionDeltaRight:ProtonPomeronSlope 10.1 set MEDiffractionDeltaRight:SoftPomeronIntercept 1.08 set MEDiffractionDeltaRight:SoftPomeronSlope 0.25 set MEDiffractionDeltaDouble:ProtonPomeronSlope 10.1 set MEDiffractionDeltaDouble:SoftPomeronIntercept 1.08 set MEDiffractionDeltaDouble:SoftPomeronSlope 0.25 # Set number of clusters for dissociation set MEDiffractionLeft:DissociationDecay One set MEDiffractionRight:DissociationDecay One set MEDiffractionDouble:DissociationDecay One set MEDiffractionDeltaLeft:DissociationDecay One set MEDiffractionDeltaRight:DissociationDecay One set MEDiffractionDeltaDouble:DissociationDecay One # Insert matrix elements insert QCDDiffraction:MatrixElements[0] MEDiffractionLeft insert QCDDiffraction:MatrixElements[0] MEDiffractionRight insert QCDDiffraction:MatrixElements[0] MEDiffractionDouble insert QCDDiffraction:MatrixElements[0] MEDiffractionDeltaLeft insert QCDDiffraction:MatrixElements[0] MEDiffractionDeltaRight #insert QCDDiffraction:MatrixElements[0] MEDiffractionDeltaDouble # No cluster fission (set to E/2, if needed. Here E=7TeV.) #set /Herwig/Hadronization/ClusterFissioner:ClMaxLight 3500 + +# The DiffractionMEs need to know the MPIHandler for the cross section. +set MEDiffractionLeft:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set MEDiffractionRight:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set MEDiffractionDouble:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set MEDiffractionDeltaLeft:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set MEDiffractionDeltaRight:MPIHandler /Herwig/UnderlyingEvent/MPIHandler +set MEDiffractionDeltaDouble:MPIHandler /Herwig/UnderlyingEvent/MPIHandler + + set QCDDiffraction:CascadeHandler NULL set /Herwig/Generators/EventGenerator:EventHandler:CascadeHandler NULL insert /Herwig/Generators/EventGenerator:EventHandler:SubProcessHandlers[0] QCDDiffraction + + +## These cuts are also set in MB.in +# If only diffraction is needed, we want the same cuts: +set /Herwig/Generators/EventGenerator:EventHandler:Cuts /Herwig/Cuts/MinBiasCuts + ########################################################################## ########################################################################## diff --git a/src/snippets/MB-DipoleShower.in b/src/snippets/MB-DipoleShower.in --- a/src/snippets/MB-DipoleShower.in +++ b/src/snippets/MB-DipoleShower.in @@ -1,47 +1,54 @@ ################################################## # MEMinBias Matrix Element ################################################## ### Note to users - Release 7.1: ### This currently uses parameters tuned for the ### default shower. # MPI model settings set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0 ## Report the correct cross section cd /Herwig/Generators -create Herwig::MPIXSecReweighter MPIXSecReweighter -insert EventGenerator:EventHandler:PostSubProcessHandlers 0 MPIXSecReweighter + +# TODO: remove the MPIXSecReweighter once validated. +# create Herwig::MPIXSecReweighter MPIXSecReweighter +# insert EventGenerator:EventHandler:PostSubProcessHandlers 0 MPIXSecReweighter set EventGenerator:EventHandler:CascadeHandler NULL clear EventGenerator:EventHandler:SubProcessHandlers[0] ################################################## # Create separate SubProcessHandler for MinBias ################################################## cd /Herwig/MatrixElements/ cp SubProcess QCDMinBias set QCDMinBias:CascadeHandler /Herwig/DipoleShower/DipoleShowerHandler set QCDMinBias:CascadeHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler set QCDMinBias:DecayHandler /Herwig/Decays/DecayHandler # Due to numerics the pomeron could be seen as timelike. set /Herwig/Shower/ShowerHandler:SplitHardProcess No set /Herwig/DipoleShower/DipoleShowerHandler:SplitHardProcess No +set MEMinBias:MPIHandler /Herwig/UnderlyingEvent/MPIHandler + insert QCDMinBias:MatrixElements[0] MEMinBias cd /Herwig/Generators # MinBias parameters used for the new kinematics of soft MPI -set /Herwig/Cuts/MinBiasCuts:X1Min 0.11 -set /Herwig/Cuts/MinBiasCuts:X2Min 0.11 +set /Herwig/Cuts/MinBiasCuts:X1Min 0.011 +set /Herwig/Cuts/MinBiasCuts:X2Min 0.011 + # Needed to get the correct fraction of diffractive events -set /Herwig/MatrixElements/MEMinBias:csNorm 4.5584 +set /Herwig/MatrixElements/MEMinBias:csNorm 0.01 +set /Herwig/MatrixElements/MEMinBias:Scale 2.0 + set EventGenerator:EventHandler:Cuts /Herwig/Cuts/MinBiasCuts cd /Herwig/MatrixElements/ insert /Herwig/Generators/EventGenerator:EventHandler:SubProcessHandlers[0] QCDMinBias diff --git a/src/snippets/MB.in b/src/snippets/MB.in --- a/src/snippets/MB.in +++ b/src/snippets/MB.in @@ -1,43 +1,63 @@ ################################################## # MEMinBias Matrix Element ################################################## # MPI model settings set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0 ## Report the correct cross section cd /Herwig/Generators -create Herwig::MPIXSecReweighter MPIXSecReweighter -insert EventGenerator:EventHandler:PostSubProcessHandlers 0 MPIXSecReweighter + +# TODO: remove the MPIXSecReweighter once validated. +#create Herwig::MPIXSecReweighter MPIXSecReweighter +#insert EventGenerator:EventHandler:PostSubProcessHandlers 0 MPIXSecReweighter + + set EventGenerator:EventHandler:CascadeHandler NULL clear EventGenerator:EventHandler:SubProcessHandlers[0] ################################################## # Create separate SubProcessHandler for MinBias ################################################## cd /Herwig/MatrixElements/ cp SubProcess QCDMinBias set QCDMinBias:CascadeHandler /Herwig/Shower/ShowerHandler set QCDMinBias:CascadeHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler set QCDMinBias:DecayHandler /Herwig/Decays/DecayHandler # Due to numerics the pomeron could be seen as timelike. set /Herwig/Shower/ShowerHandler:SplitHardProcess No set /Herwig/DipoleShower/DipoleShowerHandler:SplitHardProcess No insert QCDMinBias:MatrixElements[0] MEMinBias +# MEMinBias is automatically reweighted to give the cross section +# comunicated by the MPIHandler. +set MEMinBias:MPIHandler /Herwig/UnderlyingEvent/MPIHandler + cd /Herwig/Generators # MinBias parameters used for the new kinematics of soft MPI -set /Herwig/Cuts/MinBiasCuts:X1Min 0.11 -set /Herwig/Cuts/MinBiasCuts:X2Min 0.11 +set /Herwig/Cuts/MinBiasCuts:X1Min 0.011 +set /Herwig/Cuts/MinBiasCuts:X2Min 0.011 + + +#PDFs for MPI,Underlying Event, Min Bias +# set the correct PDFs + +set /Herwig/Partons/HardLOPDF:PDFName CT14lo +set /Herwig/Partons/ShowerLOPDF:PDFName CT14lo +set /Herwig/Partons/MPIPDF:PDFName CT14lo +set /Herwig/Partons/RemnantPDF:PDFName CT14lo + # Needed to get the correct fraction of diffractive events -set /Herwig/MatrixElements/MEMinBias:csNorm 4.5584 +set /Herwig/MatrixElements/MEMinBias:csNorm 0.01 + +set /Herwig/MatrixElements/MEMinBias:Scale 2.0 set EventGenerator:EventHandler:Cuts /Herwig/Cuts/MinBiasCuts cd /Herwig/MatrixElements/ insert /Herwig/Generators/EventGenerator:EventHandler:SubProcessHandlers[0] QCDMinBias