diff --git a/Hadronization/Makefile.am b/Hadronization/Makefile.am --- a/Hadronization/Makefile.am +++ b/Hadronization/Makefile.am @@ -1,16 +1,17 @@ noinst_LTLIBRARIES = libHwHadronization.la libHwHadronization_la_SOURCES = \ CheckId.cc CheckId.h \ CluHadConfig.h \ Cluster.h Cluster.cc Cluster.fh \ ClusterDecayer.cc ClusterDecayer.h ClusterDecayer.fh \ ClusterFinder.cc ClusterFinder.h ClusterFinder.fh \ ClusterFissioner.cc ClusterFissioner.h ClusterFissioner.fh \ ClusterHadronizationHandler.cc ClusterHadronizationHandler.h \ ClusterHadronizationHandler.fh \ ColourReconnector.cc ColourReconnector.h ColourReconnector.fh\ HadronSelector.cc HadronSelector.h HadronSelector.fh\ Hw64Selector.cc Hw64Selector.h Hw64Selector.fh\ HwppSelector.cc HwppSelector.h HwppSelector.fh\ LightClusterDecayer.cc LightClusterDecayer.h LightClusterDecayer.fh \ -PartonSplitter.cc PartonSplitter.h PartonSplitter.fh +PartonSplitter.cc PartonSplitter.h PartonSplitter.fh \ +SpinHadronizer.h SpinHadronizer.cc diff --git a/Hadronization/SpinHadronizer.cc b/Hadronization/SpinHadronizer.cc new file mode 100644 --- /dev/null +++ b/Hadronization/SpinHadronizer.cc @@ -0,0 +1,149 @@ +// -*- C++ -*- +// +// This is the implementation of the non-inlined, non-templated member +// functions of the SpinHadronizer class. +// + +#include "SpinHadronizer.h" +#include "ThePEG/Interface/ClassDocumentation.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/PDT/StandardMatchers.h" +# include "Herwig/Utilities/EnumParticles.h" +#include "ThePEG/Persistency/PersistentOStream.h" +#include "ThePEG/Persistency/PersistentIStream.h" +#include "ThePEG/Helicity/WaveFunction/SpinorWaveFunction.h" +#include "ThePEG/Helicity/WaveFunction/RSSpinorWaveFunction.h" +#include "Cluster.h" + +using namespace Herwig; + +void SpinHadronizer:: +handle(EventHandler &, const tPVector & tagged,const Hint & ) { + for(const tPPtr & hadron : tagged) { + // mesons + if(MesonMatcher::Check(hadron->data())) { + continue; + } + // baryons + else if(BaryonMatcher::Check(hadron->data())) { + baryonSpin(hadron); + } + else + continue; + } +} + +void SpinHadronizer::baryonSpin(tPPtr baryon) { + // check only one parent + if(baryon->parents().size()!=1) return; + tPPtr parent = baryon->parents()[0]; + // and its a cluster + if(parent->id()!=ParticleID::Cluster) return; + tClusterPtr cluster = dynamic_ptr_cast(parent); + int prim_quark = (abs(baryon->id())/1000)%10; + int sign_quark = baryon->id()>0 ? prim_quark : -prim_quark; + // only strange, charm and bottom for the moment + if(prim_quark<3) return; + tPPtr quark; + for(unsigned int ix=0;ixnumComponents();++ix) { + if(cluster->particle(ix)->id()==sign_quark) { + quark = cluster->particle(ix); + } + } + if(!quark) return; + if(!quark->spinInfo()) return; + tcFermionSpinPtr sp(dynamic_ptr_cast(quark->spinInfo())); + // decay it + sp->decay(); + // create the spin info + if(baryon->dataPtr()->iSpin()==PDT::Spin1Half) { + vector waves; + RhoDMatrix rho; + SpinorWaveFunction::calculateWaveFunctions(waves,rho,baryon,outgoing); + SpinorWaveFunction::constructSpinInfo(waves,baryon,outgoing,true); + } + else if(baryon->dataPtr()->iSpin()==PDT::Spin3Half) { + vector waves; + RhoDMatrix rho; + RSSpinorWaveFunction::calculateWaveFunctions(waves,rho,baryon,outgoing); + RSSpinorWaveFunction::constructSpinInfo(waves,baryon,outgoing,true); + } + // can't handle spin 5/2 > 3/2 + else { + return; + } + // extract the polarization of the quark + double pol = 2.*sp->rhoMatrix()(1,1).real()-1.; + // the different options for different spin types + vector polB(baryon->dataPtr()->iSpin(),1./double(baryon->dataPtr()->iSpin())); + const int mult = prim_quark*1000; + int bid = abs(baryon->id()); + // lambda and Xi spin 1/2 (spin0 diquark) + if(bid== mult+122|| bid== mult+132|| bid== mult+232) { + baryon->spinInfo()->rhoMatrix()(0,0) = 0.5*(1.-pol); + baryon->spinInfo()->rhoMatrix()(1,1) = 0.5*(1.+pol); + } + // sigma_b, xi' and omega_b spin 1/2 (spin1 diquark) + else if(bid== mult+112|| bid== mult+212|| bid== mult+222|| + bid== mult+312|| bid== mult+322|| bid== mult+332) { + baryon->spinInfo()->rhoMatrix()(0,0) = 0.5*(1.-pol) +pol*omegaHalf_; + baryon->spinInfo()->rhoMatrix()(1,1) = 0.5*(1.+pol) -pol*omegaHalf_; + } + // sigma*, xi* and omegab* spin 3/2 (spin1 diquark) + else if(bid== mult+114|| bid== mult+214|| bid== mult+224|| bid== mult+334) { + baryon->spinInfo()->rhoMatrix()(0,0) = 0.375*(1.-pol)*omegaHalf_; + baryon->spinInfo()->rhoMatrix()(1,1) = 0.5*(1.-pol)-omegaHalf_/6.*(3.-5.*pol); + baryon->spinInfo()->rhoMatrix()(2,2) = 0.5*(1.+pol)-omegaHalf_/6.*(3.+5.*pol); + baryon->spinInfo()->rhoMatrix()(3,3) = 0.375*(1.+pol)*omegaHalf_; + } + else + return; + + + + // generator()->log() << "Baryon: " << *baryon << "\n"; + // generator()->log() << "Parent: " << *cluster << "\n"; + // generator()->log() << "Quark: " << *quark << "\n"; + // generator()->log() << "Rho\n" << sp->rhoMatrix() << "\n"; + // generator()->log() << "testing is decayed " << sp->decayed() <<" \n"; + // generator()->log() << baryon->spinInfo()->rhoMatrix() << "\n"; +} + +IBPtr SpinHadronizer::clone() const { + return new_ptr(*this); +} + +IBPtr SpinHadronizer::fullclone() const { + return new_ptr(*this); +} + +void SpinHadronizer::persistentOutput(PersistentOStream & os) const { + os << omegaHalf_; +} + +void SpinHadronizer::persistentInput(PersistentIStream & is, int) { + is >> omegaHalf_; +} + +// The following static variable is needed for the type +// description system in ThePEG. +DescribeClass + describeHerwigSpinHadronizer("Herwig::SpinHadronizer", "Herwig.so"); + +void SpinHadronizer::Init() { + + static ClassDocumentation documentation + ("The SpinHadronizer class implements a simple mode for" + " the transfer of spin from quarks to hadrons"); + + static Parameter interfaceOmegaHalf + ("OmegaHalf", + "The omega_1/2 Falk-Psekin parameter", + &SpinHadronizer::omegaHalf_, 2./3., 0.0, 1.0, + false, false, Interface::limited); + +} diff --git a/Hadronization/SpinHadronizer.h b/Hadronization/SpinHadronizer.h new file mode 100644 --- /dev/null +++ b/Hadronization/SpinHadronizer.h @@ -0,0 +1,138 @@ +// -*- C++ -*- +#ifndef Herwig_SpinHadronizer_H +#define Herwig_SpinHadronizer_H +// +// This is the declaration of the SpinHadronizer class. +// + +#include "ThePEG/Handlers/StepHandler.h" + +namespace Herwig { + +using namespace ThePEG; + +/** + * The SpinHadronizer class is designed to be used as a post-hadronization handler to + * give a simple model of spin transfer between the perturbative and non-perturbative + * stages. + * + * @see \ref SpinHadronizerInterfaces "The interfaces" + * defined for SpinHadronizer. + */ +class SpinHadronizer: public StepHandler { + +public: + + /** + * The default constructor. + */ + SpinHadronizer() : omegaHalf_(2./3.) + {} + +public: + + /** @name Virtual functions required by the StepHandler class. */ + //@{ + /** + * The main function called by the EventHandler class to + * perform a step. Given the current state of an Event, this function + * performs the event generation step and includes the result in a new + * Step object int the Event record. + * @param eh the EventHandler in charge of the Event generation. + * @param tagged if not empty these are the only particles which should + * be considered by the StepHandler. + * @param hint a Hint object with possible information from previously + * performed steps. + * @throws Veto if the StepHandler requires the current step to be discarded. + * @throws Stop if the generation of the current Event should be stopped + * after this call. + * @throws Exception if something goes wrong. + */ + virtual void handle(EventHandler & eh, const tPVector & tagged, + const Hint & hint); + //@} + +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: + + /** + * Functions to calculate the spins + */ + //@{ + + /** + * Calculate the spin of a baryon + */ + void baryonSpin(tPPtr baryon); + + //@} + + + +protected: + + /** @name Clone Methods. */ + //@{ + /** + * Make a simple clone of this object. + * @return a pointer to the new object. + */ + virtual IBPtr clone() const; + + /** Make a clone of this object, possibly modifying the cloned object + * to make it sane. + * @return a pointer to the new object. + */ + virtual IBPtr fullclone() const; + //@} + +private: + + /** + * The assignment operator is private and must never be called. + * In fact, it should not even be implemented. + */ + SpinHadronizer & operator=(const SpinHadronizer &); + +private: + + /** + * Parameters + */ + //@{ + /** + * Falk-Peskin \f$\omega_\frac12\f$ parameter + */ + double omegaHalf_; + //@} + +}; + +} + +#endif /* Herwig_SpinHadronizer_H */ diff --git a/src/defaults/Hadronization.in b/src/defaults/Hadronization.in --- a/src/defaults/Hadronization.in +++ b/src/defaults/Hadronization.in @@ -1,95 +1,97 @@ # -*- ThePEG-repository -*- ############################################################ # Setup of default hadronization # # There are no user servicable parts inside. # # Anything that follows below should only be touched if you # know what you're doing. ############################################################# cd /Herwig/Particles create ThePEG::ParticleData Cluster setup Cluster 81 Cluster 0.00990 0.0 0.0 0.0 0 0 0 1 create ThePEG::ParticleData Remnant setup Remnant 82 Remnant 0.00990 0.0 0.0 0.0 0 0 0 1 mkdir /Herwig/Hadronization cd /Herwig/Hadronization create Herwig::ClusterHadronizationHandler ClusterHadHandler create Herwig::PartonSplitter PartonSplitter create Herwig::ClusterFinder ClusterFinder create Herwig::ColourReconnector ColourReconnector create Herwig::ClusterFissioner ClusterFissioner create Herwig::LightClusterDecayer LightClusterDecayer create Herwig::ClusterDecayer ClusterDecayer create Herwig::HwppSelector HadronSelector newdef ClusterHadHandler:PartonSplitter PartonSplitter newdef ClusterHadHandler:ClusterFinder ClusterFinder newdef ClusterHadHandler:ColourReconnector ColourReconnector newdef ClusterHadHandler:ClusterFissioner ClusterFissioner newdef ClusterHadHandler:LightClusterDecayer LightClusterDecayer newdef ClusterHadHandler:ClusterDecayer ClusterDecayer newdef ClusterHadHandler:MinVirtuality2 0.1*GeV2 newdef ClusterHadHandler:MaxDisplacement 1.0e-10*millimeter newdef ClusterHadHandler:UnderlyingEventHandler NULL newdef ClusterFissioner:HadronSelector HadronSelector newdef LightClusterDecayer:HadronSelector HadronSelector newdef ClusterDecayer:HadronSelector HadronSelector newdef ColourReconnector:ColourReconnection Yes newdef ColourReconnector:ReconnectionProbability 0.652710 newdef ColourReconnector:Algorithm Plain newdef ColourReconnector:InitialTemperature 0.01 newdef ColourReconnector:AnnealingFactor 0.21 newdef ColourReconnector:AnnealingSteps 10 newdef ColourReconnector:TriesPerStepFactor 0.66 newdef ColourReconnector:OctetTreatment All # Clustering parameters for light quarks newdef ClusterFissioner:ClMaxLight 3.649 newdef ClusterFissioner:ClPowLight 2.780 newdef ClusterFissioner:PSplitLight 0.899 newdef ClusterDecayer:ClDirLight 1 newdef ClusterDecayer:ClSmrLight 0.78 # Clustering parameters for b-quarks newdef ClusterFissioner:ClMaxBottom 3.757 newdef ClusterFissioner:ClPowBottom 0.547 newdef ClusterFissioner:PSplitBottom 0.625 newdef ClusterDecayer:ClDirBottom 1 newdef ClusterDecayer:ClSmrBottom 0.078 newdef HadronSelector:SingleHadronLimitBottom 0.000 # Clustering parameters for c-quarks newdef ClusterFissioner:ClMaxCharm 3.950 newdef ClusterFissioner:ClPowCharm 2.559 newdef ClusterFissioner:PSplitCharm 0.994 newdef ClusterDecayer:ClDirCharm 1 newdef ClusterDecayer:ClSmrCharm 0.163 newdef HadronSelector:SingleHadronLimitCharm 0.000 # Clustering parameters for exotic quarks # (e.g. hadronizing Susy particles) newdef ClusterFissioner:ClMaxExotic 2.7*GeV newdef ClusterFissioner:ClPowExotic 1.46 newdef ClusterFissioner:PSplitExotic 1.00 newdef ClusterDecayer:ClDirExotic 1 newdef ClusterDecayer:ClSmrExotic 0. newdef HadronSelector:SingleHadronLimitExotic 0. # newdef HadronSelector:PwtDquark 1.0 newdef HadronSelector:PwtUquark 1.0 newdef HadronSelector:PwtSquark 0.700 newdef HadronSelector:PwtCquark 1.0 newdef HadronSelector:PwtBquark 1.0 newdef HadronSelector:PwtDIquark 0.298 newdef HadronSelector:SngWt 0.74 newdef HadronSelector:DecWt 0.62 newdef HadronSelector:Mode 1 newdef HadronSelector:BelowThreshold All + +create Herwig::SpinHadronizer SpinHadronizer diff --git a/src/defaults/HerwigDefaults.in b/src/defaults/HerwigDefaults.in --- a/src/defaults/HerwigDefaults.in +++ b/src/defaults/HerwigDefaults.in @@ -1,174 +1,175 @@ # -*- ThePEG-repository -*- ################################################################### # # This is the main repository setup file for Herwig. # # It is read using the 'Herwig init' command which prepares the # default repository file 'HerwigDefaults.rpo'. # # The 'Herwig read' step allows additional configuration # instructions to be read from a run-specific file, to modify the # default values. (We provide LEP.in, ILC.in, LHC.in and TVT.in as # examples) # # You will not need to change any settings here. # Any modifications can be made in your own input files. # ################################################################### globallibrary Herwig.so ################################################################### # The repository contains its own internal directory structure to # keep track of created objects. (This is entirely independent of # the file system) ################################################################### globallibrary Herwig.so # Make the root directory in the Repository rrmdir /Herwig mkdir /Herwig ##################################################################### # The 'create' command creates an object in the repository from # a C++ class. The arguments are (1) the C++ class name, (2) your # chosen repository name, and optionally, (3) the library name where # the class can be found. # # Created objects are _not_ automatically associated to a run. They # need to be assigned to it using a chain of 'set' or 'insert' # commands (see below). ##################################################################### # the default random number generator create ThePEG::StandardRandom /Herwig/Random # the default phase space sampler create ThePEG::ACDCSampler /Herwig/ACDCSampler ACDCSampler.so ##################################################################### # Objects in the repository are influenced through 'interfaces'. # The most important ones can be found in these files, and the # doxygen documentation provides complete lists. # # To set an interface to a new value, use the 'set' command: # set object:interface value # # Note that only repository names can be used here. You must 'create' # objects before you can use them in a 'set' command ##################################################################### newdef /Herwig/ACDCSampler:Margin 1.1 ################################################################### # The 'read' command includes external files in place, to reduce # clutter. You can also use it for blocks of settings you're likely # to use again and again. ################################################################### read Particles.in read QEDRadiation.in read Model.in read Partons.in read UnderlyingEvent.in read Shower.in read MatrixElements.in read Hadronization.in read Decays.in read BSM.in ####################################################################### # The EventHandler is the most important object in a run. It # (directly or indirectly) owns most of the objects that have been # created up to now. # # Below we create one handler for LEP and one for LHC. # # Try to understand the following few lines (also look at the external # .in files if you can't find the 'create' line for an object). # # If you need to make modifications, it's best to make them in your # own input file (for the 'Herwig read' step) and not here. ####################################################################### mkdir /Herwig/EventHandlers cd /Herwig/EventHandlers # Create the EventHandler create ThePEG::StandardEventHandler EventHandler newdef EventHandler:CascadeHandler /Herwig/Shower/ShowerHandler newdef EventHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler newdef EventHandler:DecayHandler /Herwig/Decays/DecayHandler newdef EventHandler:Sampler /Herwig/ACDCSampler insert EventHandler:SubProcessHandlers[0] /Herwig/MatrixElements/SubProcess +insert EventHandler:PostHadronizationHandlers 0 /Herwig/Hadronization/SpinHadronizer mkdir /Herwig/Generators cd /Herwig/Generators ################################################################# # Finally, the EventGenerator objects are responsible # for the run. They tie together an EventHandler on the one side # with a physics model (Feynman rules, etc) and random number # generator on the other. # # In your own input files, it will be this EventGenerator object # that will be called with the 'run' command to start the event # generation (see LEP.in, LHC.in, TVT.in or LHC.in for examples) ################################################################# # The Strategy objects can be used for default settings # (see the Doxygen documentation) # Currently it only provides the LaTeX reference to Herwig create Herwig::HerwigStrategy DefaultStrategy # set DefaultStrategy:LocalParticlesDir /Herwig/Particles insert DefaultStrategy:DefaultParticlesDirs[0] /Herwig/Particles # The EventGenerator create ThePEG::EventGenerator EventGenerator newdef EventGenerator:RandomNumberGenerator /Herwig/Random newdef EventGenerator:StandardModelParameters /Herwig/Model newdef EventGenerator:EventHandler /Herwig/EventHandlers/EventHandler newdef EventGenerator:Strategy DefaultStrategy newdef EventGenerator:DumpPeriod -1 newdef EventGenerator:RandomNumberGenerator:Seed 31122001 newdef EventGenerator:DebugLevel 1 newdef EventGenerator:PrintEvent 10 newdef EventGenerator:MaxErrors 10000 newdef EventGenerator:NumberOfEvents 100000000 ############################################ # The default cuts ############################################ read Cuts.in cd /Herwig/Generators ########################################## # include some default analysis handlers ########################################## read Analysis.in ########################################## # setup additional samplers ########################################## read Samplers.in ########################################## # setup the matchbox framework ########################################## read MatchboxDefaults.in ########################################## # setup the merging framework ########################################## read MatchboxMergingDefaults.in ########################################## # setup the dipole shower ########################################## read DipoleShowerDefaults.in cd /