herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
Evolver.h
00001 // -*- C++ -*-
00002 //
00003 // Evolver.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
00004 // Copyright (C) 2002-2011 The Herwig Collaboration
00005 //
00006 // Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
00008 //
00009 #ifndef HERWIG_Evolver_H
00010 #define HERWIG_Evolver_H
00011 //
00012 // This is the declaration of the Evolver class.
00013 //
00014 
00015 #include "ThePEG/Interface/Interfaced.h"
00016 #include "Herwig++/Shower/SplittingFunctions/SplittingGenerator.h"
00017 #include "ShowerModel.h"
00018 #include "ThePEG/PDF/BeamParticleData.h"
00019 #include "ShowerTree.h"
00020 #include "ShowerProgenitor.fh"
00021 #include "Herwig++/Shower/ShowerHandler.fh"
00022 #include "Branching.h"
00023 #include "ShowerVeto.h"
00024 #include "HardTree.h"
00025 #include "ThePEG/Handlers/XComb.h"
00026 #include "Evolver.fh"
00027 #include "Herwig++/MatrixElement/HwMEBase.h"
00028 #include "Herwig++/Decay/HwDecayerBase.h"
00029 
00030 namespace Herwig {
00031 
00032 using namespace ThePEG;
00033 
00041 class Evolver: public Interfaced {
00042 
00046 friend class ShowerHandler;
00047 
00048 public:
00049   
00053   typedef Ptr<XComb>::pointer XCPtr;
00054 
00055 public:
00056 
00060   Evolver() : _maxtry(100), _meCorrMode(1), _hardVetoMode(1),
00061               _hardVetoRead(0), _reconOpt(0), _hardVetoReadOption(false),
00062               _iptrms(ZERO), _beta(0.), _gamma(ZERO), _iptmax(),
00063               _limitEmissions(0), _initialenhance(1.), _finalenhance(1.),
00064               _hardonly(false), _trunc_Mode(true), _hardEmissionMode(0),
00065               _colourEvolutionMethod(0), _hardScaleFactor(1.0)
00066   {}
00067 
00075   virtual void showerHardProcess(ShowerTreePtr,XCPtr);
00076 
00080   virtual void showerDecay(ShowerTreePtr);
00082 
00090   bool showeringON() const { return isISRadiationON() || isFSRadiationON(); }
00091 
00095   bool isISRadiationON() const { return _splittingGenerator->isISRadiationON(); }
00096 
00100   bool isFSRadiationON() const { return _splittingGenerator->isFSRadiationON(); }
00101 
00105   ShowerModelPtr showerModel() const {return _model;}
00106 
00110   tSplittingGeneratorPtr splittingGenerator() const { return _splittingGenerator; }
00112 
00116   virtual void connectTrees(ShowerTreePtr showerTree, HardTreePtr hardTree, bool hard )const;
00117 
00118 public:
00119 
00126   void persistentOutput(PersistentOStream & os) const;
00127 
00133   void persistentInput(PersistentIStream & is, int version);
00135 
00142   static void Init();
00143 
00144 protected:
00145 
00149   virtual void hardMatrixElementCorrection(bool);
00150 
00154   virtual void hardestEmission(bool hard);
00155 
00162   virtual vector<ShowerProgenitorPtr> setupShower(bool hard);
00163 
00167   virtual void setEvolutionPartners(bool hard,ShowerInteraction::Type);
00168 
00182   virtual bool timeLikeShower(tShowerParticlePtr particle, ShowerInteraction::Type,
00183                               bool first); 
00184 
00193   virtual bool spaceLikeShower(tShowerParticlePtr particle,PPtr beam,
00194                                ShowerInteraction::Type); 
00195 
00205   virtual bool spaceLikeDecayShower(tShowerParticlePtr particle,
00206                                     Energy maxscale,
00207                                     Energy minimumMass,
00208                                     ShowerInteraction::Type);
00209 
00213   virtual bool truncatedTimeLikeShower(tShowerParticlePtr particle,
00214                                        HardBranchingPtr branch,
00215                                        ShowerInteraction::Type type);
00216  
00220   virtual bool truncatedSpaceLikeShower(tShowerParticlePtr particle,PPtr beam,
00221                                         HardBranchingPtr branch,
00222                                         ShowerInteraction::Type type);
00223 
00227   virtual bool truncatedSpaceLikeDecayShower(tShowerParticlePtr particle,
00228                                              Energy maxscale, Energy minimumMass,
00229                                              HardBranchingPtr branch,
00230                                              ShowerInteraction::Type type);
00232 
00240   bool MECOn() const {
00241     return _meCorrMode > 0 && _hardEmissionMode==0;
00242   }
00243 
00247   bool hardMEC() const {
00248     return (_meCorrMode == 1 || _meCorrMode == 2) && _hardEmissionMode==0;
00249   }
00250 
00254   bool softMEC() const {
00255     return (_meCorrMode == 1 || _meCorrMode > 2) && _hardEmissionMode==0;
00256   }
00258 
00262   bool isTruncatedShowerON() const {return _trunc_Mode;}
00263 
00271   bool ipTon() const {
00272     return _iptrms != ZERO || ( _beta == 1.0 && _gamma != ZERO && _iptmax !=ZERO );
00273   }
00275 
00281   void addVeto (ShowerVetoPtr v) { _vetoes.push_back(v); }
00282 
00286   void removeVeto (ShowerVetoPtr v) { 
00287     vector<ShowerVetoPtr>::iterator vit = find(_vetoes.begin(),_vetoes.end(),v);
00288     if (vit != _vetoes.end())
00289       _vetoes.erase(vit);
00290   }
00291 
00293 
00301   bool hardVetoOn() const { return _hardVetoMode > 0; }
00302 
00306   bool hardVetoIS() const { return _hardVetoMode == 1 || _hardVetoMode == 2; }
00307 
00311   bool hardVetoFS() const { return _hardVetoMode == 1 || _hardVetoMode > 2; }
00312 
00316   bool hardVetoXComb() const {return (_hardVetoRead == 1);}
00317 
00322   bool hardVetoReadOption() const {return _hardVetoReadOption;}
00324 
00333   double initialStateRadiationEnhancementFactor() const { return _initialenhance; }
00334 
00338   double finalStateRadiationEnhancementFactor() const { return _finalenhance; }
00339 
00343   void initialStateRadiationEnhancementFactor(double in) { _initialenhance=in; }
00344 
00348   void finalStateRadiationEnhancementFactor(double in) { _finalenhance=in; }
00350 
00358   tHardTreePtr hardTree() {return _hardtree;}
00359 
00363   void hardTree(tHardTreePtr in) {_hardtree = in;}
00365 
00373   Ptr<BeamParticleData>::const_pointer beamParticle() const { return _beam; }
00374 
00378   void setBeamParticle(Ptr<BeamParticleData>::const_pointer in) { _beam=in; }
00380 
00388   tShowerTreePtr currentTree() { return _currenttree; }
00389 
00393   void currentTree(tShowerTreePtr tree) { _currenttree=tree; }
00394 
00396 
00400   unsigned int maximumTries() const { return _maxtry; }
00401 
00409   ShowerProgenitorPtr progenitor() { return _progenitor; }
00410 
00414   void progenitor(ShowerProgenitorPtr in) { _progenitor=in; }
00416 
00420   virtual void generateIntrinsicpT(vector<ShowerProgenitorPtr>);
00421 
00425   map<tShowerProgenitorPtr,pair<Energy,double> > & intrinsicpT() { return _intrinsic; }
00426 
00430   void setupMaximumScales(ShowerTreePtr, const vector<ShowerProgenitorPtr> &,XCPtr);
00431 
00435   double hardScaleFactor() const { return _hardScaleFactor; }
00436 
00440   void hardScaleFactor(double f) { _hardScaleFactor = f; };
00441 
00442 protected:
00443 
00447   virtual bool startTimeLikeShower(ShowerInteraction::Type);
00448 
00452   void updateHistory(tShowerParticlePtr particle);
00453 
00457   virtual bool startSpaceLikeShower(PPtr,ShowerInteraction::Type);
00458 
00462   virtual bool startSpaceLikeDecayShower(Energy maxscale,Energy minimumMass,
00463                                          ShowerInteraction::Type);
00464 
00468   virtual bool timeLikeVetoed(const Branching &,ShowerParticlePtr);
00469 
00473   virtual bool spaceLikeVetoed(const Branching &,ShowerParticlePtr);
00474 
00478   virtual bool spaceLikeDecayVetoed(const Branching &,ShowerParticlePtr);
00479 
00483   bool hardOnly() const {return _hardonly;}
00484 
00485 protected:
00486 
00493   virtual IBPtr clone() const;
00494 
00499   virtual IBPtr fullclone() const;
00501 
00502 private:
00503 
00507   double getReductionFactor(tShowerParticlePtr particle);
00508 
00513   Evolver & operator=(const Evolver &);
00514 
00515 private:
00516 
00520   ShowerModelPtr _model;
00521 
00525   SplittingGeneratorPtr _splittingGenerator;
00526 
00530   unsigned int _maxtry;
00531 
00535   unsigned int _meCorrMode; 
00536 
00540   unsigned int _hardVetoMode; 
00541 
00545   unsigned int _hardVetoRead; 
00546 
00550   unsigned int _reconOpt;
00551 
00559   bool _hardVetoReadOption; 
00560 
00564   Energy _iptrms;
00565 
00569   double _beta;
00570 
00574   Energy _gamma;
00575 
00579   Energy _iptmax;
00580 
00584   unsigned int _limitEmissions;
00585   
00589   ShowerProgenitorPtr _progenitor;
00590 
00594   HwMEBasePtr _hardme;
00595 
00599   HwDecayerBasePtr _decayme;
00600 
00604   ShowerTreePtr _currenttree;
00605 
00609   HardTreePtr _hardtree;
00610 
00619   double _initialenhance;
00620 
00624   double _finalenhance;
00626 
00630   Ptr<BeamParticleData>::const_pointer _beam;
00631 
00635   map<tShowerProgenitorPtr,pair<Energy,double> > _intrinsic;
00636 
00640   vector<ShowerVetoPtr> _vetoes;
00641 
00645   unsigned int _nis;
00646 
00650   unsigned int _nfs;
00651 
00656   bool _hardonly;
00657 
00661   bool _trunc_Mode;
00662   
00666   unsigned int _truncEmissions;
00667 
00671   unsigned int _hardEmissionMode;
00672 
00676   int _colourEvolutionMethod;
00677 
00681   double _hardScaleFactor;
00682 
00683 };
00684 
00685 }
00686 
00687 #endif /* HERWIG_Evolver_H */