|
|
|||
File indexing completed on 2026-08-06 09:24:27
0001 // -*- C++ -*- 0002 // 0003 // ShowerHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator 0004 // Copyright (C) 2002-2019 The Herwig Collaboration 0005 // 0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef HERWIG_ShowerHandler_H 0010 #define HERWIG_ShowerHandler_H 0011 // 0012 // This is the declaration of the ShowerHandler class. 0013 // 0014 0015 #include "ThePEG/Handlers/EventHandler.h" 0016 #include "ThePEG/Handlers/CascadeHandler.h" 0017 #include "ShowerVariation.h" 0018 #include "Herwig/PDF/HwRemDecayer.fh" 0019 #include "ThePEG/EventRecord/RemnantParticle.fh" 0020 #include "UEBase.h" 0021 #include "PerturbativeProcess.h" 0022 #include "Herwig/MatrixElement/Matchbox/Matching/HardScaleProfile.h" 0023 #include "ShowerHandler.fh" 0024 0025 namespace Herwig { 0026 using namespace ThePEG; 0027 0028 /** \ingroup Shower 0029 * 0030 * This class is the main driver of the shower: it is responsible for 0031 * the proper handling of all other specific collaborating classes 0032 * and for the storing of the produced particles in the event record. 0033 * 0034 * @see \ref ShowerHandlerInterfaces "The interfaces" 0035 * 0036 * @see ThePEG::CascadeHandler 0037 * @see MPIHandler 0038 * @see HwRemDecayer 0039 */ 0040 class ShowerHandler: public CascadeHandler { 0041 0042 public: 0043 0044 /** 0045 * Typedef for a pair of ThePEG::RemnantParticle pointers. 0046 */ 0047 typedef pair<tRemPPtr, tRemPPtr> RemPair; 0048 0049 public: 0050 0051 /** 0052 * Default constructor 0053 */ 0054 ShowerHandler(); 0055 0056 /** 0057 * Destructor 0058 */ 0059 virtual ~ShowerHandler(); 0060 0061 public: 0062 0063 /** 0064 * The main method which manages the multiple interactions and starts 0065 * the shower by calling cascade(sub, lastXC). 0066 */ 0067 virtual void cascade(); 0068 0069 /** 0070 * pointer to "this", the current ShowerHandler. 0071 */ 0072 static const tShowerHandlerPtr currentHandler() { 0073 if(currentHandler_) 0074 return currentHandler_; 0075 else 0076 return tShowerHandlerPtr(); 0077 } 0078 0079 /** 0080 * pointer to "this", the current ShowerHandler. 0081 */ 0082 static bool currentHandlerIsSet() { 0083 return currentHandler_; 0084 } 0085 0086 public: 0087 0088 /** 0089 * Hook to allow vetoing of event after showering hard sub-process 0090 * as in e.g. MLM merging. 0091 */ 0092 virtual bool showerHardProcessVeto() const { return false; } 0093 0094 /** 0095 * Return true, if this cascade handler will perform reshuffling from hard 0096 * process masses. 0097 */ 0098 virtual bool isReshuffling() const { return true; } 0099 0100 /** 0101 * Return true, if this cascade handler will put the final state 0102 * particles to their constituent mass. If false the nominal mass is used. 0103 */ 0104 virtual bool retConstituentMasses() const { return useConstituentMasses_; } 0105 0106 0107 0108 /** 0109 * Return true, if the shower handler can generate a truncated 0110 * shower for POWHEG style events generated using Matchbox 0111 */ 0112 virtual bool canHandleMatchboxTrunc() const { return false; } 0113 0114 /** 0115 * Get the PDF freezing scale 0116 */ 0117 Energy pdfFreezingScale() const { return pdfFreezingScale_; } 0118 0119 /** 0120 * Get the local PDFs. 0121 */ 0122 PDFPtr getPDFA() const {return PDFA_;} 0123 0124 /** 0125 * Get the local PDFs. 0126 */ 0127 PDFPtr getPDFB() const {return PDFB_;} 0128 0129 /** 0130 * Return true if currently the primary subprocess is showered. 0131 */ 0132 bool firstInteraction() const { 0133 if (!eventHandler()->currentCollision())return true; 0134 return ( subProcess_ == 0135 eventHandler()->currentCollision()->primarySubProcess() ); 0136 } 0137 0138 /** 0139 * Return the remnant decayer. 0140 */ 0141 tHwRemDecPtr remnantDecayer() const { return remDec_; } 0142 0143 /** 0144 * Split the hard process into production and decays 0145 * @param tagged The tagged particles from the StepHandler 0146 * @param hard The hard perturbative process 0147 * @param decay The decay particles 0148 */ 0149 void splitHardProcess(tPVector tagged, PerturbativeProcessPtr & hard, 0150 DecayProcessMap & decay) const; 0151 0152 /** 0153 * Information if the Showerhandler splits the hard process. 0154 */ 0155 bool doesSplitHardProcess()const {return splitHardProcess_;} 0156 0157 /** 0158 * Decay a particle. 0159 * radPhotons switches the generation of photon 0160 * radiation on/off. 0161 * Required for Dipole Shower but not QTilde Shower. 0162 */ 0163 tDMPtr decay(PerturbativeProcessPtr, 0164 DecayProcessMap & decay, 0165 bool radPhotons = false) const; 0166 0167 0168 /** 0169 * Cached lookup of decay modes. 0170 * Generator::findDecayMode() is not efficient. 0171 */ 0172 tDMPtr findDecayMode(const string & tag) const; 0173 0174 0175 /** 0176 * A struct to order the particles in the same way as in the DecayMode's 0177 */ 0178 0179 struct ParticleOrdering { 0180 0181 bool operator() (tcPDPtr p1, tcPDPtr p2) const; 0182 0183 }; 0184 0185 0186 /** 0187 * A container for ordered particles required 0188 * for constructing tags for decay mode lookup. 0189 */ 0190 typedef multiset<tcPDPtr,ParticleOrdering> OrderedParticles; 0191 0192 0193 public: 0194 0195 /** 0196 * @name Switches for initial- and final-state radiation 0197 */ 0198 //@{ 0199 /** 0200 * Switch for any radiation 0201 */ 0202 bool doRadiation() const {return doFSR_ || doISR_;} 0203 0204 /** 0205 * Switch on or off final state radiation. 0206 */ 0207 bool doFSR() const { return doFSR_;} 0208 0209 /** 0210 * Switch on or off initial state radiation. 0211 */ 0212 bool doISR() const { return doISR_;} 0213 //@} 0214 0215 public: 0216 0217 /** 0218 * @name Switches for scales 0219 */ 0220 //@{ 0221 /** 0222 * Return true if maximum pt should be deduced from the factorization scale 0223 */ 0224 bool hardScaleIsMuF() const { return maxPtIsMuF_; } 0225 0226 /** 0227 * The factorization scale factor. 0228 */ 0229 double factorizationScaleFactor() const { 0230 return factorizationScaleFactor_; 0231 } 0232 0233 /** 0234 * The renormalization scale factor. 0235 */ 0236 double renFac() const { 0237 return renormalizationScaleFactor_; 0238 } 0239 0240 /** 0241 * The factorization scale factor. 0242 */ 0243 double facFac() const { 0244 return factorizationScaleFactor_; 0245 } 0246 0247 /** 0248 * The renormalization scale factor. 0249 */ 0250 double renormalizationScaleFactor() const { 0251 return renormalizationScaleFactor_; 0252 } 0253 0254 /** 0255 * The scale factor for the hard scale 0256 */ 0257 double hardScaleFactor() const { 0258 return hardScaleFactor_; 0259 } 0260 /** 0261 * Return true, if the phase space restrictions of the dipole shower should 0262 * be applied. 0263 */ 0264 bool restrictPhasespace() const { return restrictPhasespace_; } 0265 0266 /** 0267 * Return profile scales 0268 */ 0269 Ptr<HardScaleProfile>::tptr profileScales() const { return hardScaleProfile_; } 0270 0271 /** 0272 * Return the relevant hard scale to be used in the profile scales 0273 */ 0274 virtual Energy hardScale() const; 0275 0276 /** 0277 * Return information about shower phase space choices 0278 */ 0279 virtual int showerPhaseSpaceOption() const { 0280 assert(false && "not implemented in general"); 0281 return -1; 0282 } 0283 //@} 0284 0285 public: 0286 0287 /** 0288 * Access the shower variations 0289 */ 0290 map<string,ShowerVariation>& showerVariations() { 0291 return showerVariations_; 0292 } 0293 0294 /** 0295 * Return the shower variations 0296 */ 0297 const map<string,ShowerVariation>& showerVariations() const { 0298 return showerVariations_; 0299 } 0300 0301 /** 0302 * Access the current Weights 0303 */ 0304 map<string,double>& currentWeights() { 0305 return currentWeights_; 0306 } 0307 0308 /** 0309 * Return the current Weights 0310 */ 0311 const map<string,double>& currentWeights() const { 0312 return currentWeights_; 0313 } 0314 0315 /** 0316 * Change the current reweighting factor 0317 */ 0318 void reweight(double w) { 0319 reweight_ = w; 0320 } 0321 0322 /** 0323 * Return the current reweighting factor 0324 */ 0325 double reweight() const { 0326 return reweight_; 0327 } 0328 0329 public : 0330 0331 /** 0332 * Access to switches for spin correlations 0333 */ 0334 //@{ 0335 /** 0336 * Spin Correlations 0337 */ 0338 unsigned int spinCorrelations() const { 0339 return spinOpt_; 0340 } 0341 0342 /** 0343 * Any correlations 0344 */ 0345 virtual bool correlations() const { 0346 return spinOpt_!=0; 0347 } 0348 //@} 0349 0350 public: 0351 0352 /** 0353 * struct that is used to catch exceptions which are thrown 0354 * due to energy conservation issues of additional scatters 0355 */ 0356 struct ExtraScatterVeto {}; 0357 0358 /** 0359 * struct that is used to catch exceptions which are thrown 0360 * due to fact that the Shower has been invoked more than 0361 * a defined threshold on a certain configuration 0362 */ 0363 struct ShowerTriesVeto { 0364 /** variable to store the number of attempts */ 0365 const int tries; 0366 0367 /** constructor */ 0368 ShowerTriesVeto(int t) : tries(t) {} 0369 }; 0370 0371 public: 0372 0373 /** @name Functions used by the persistent I/O system. */ 0374 //@{ 0375 /** 0376 * Function used to write out object persistently. 0377 * @param os the persistent output stream written to. 0378 */ 0379 void persistentOutput(PersistentOStream & os) const; 0380 0381 /** 0382 * Function used to read in object persistently. 0383 * @param is the persistent input stream read from. 0384 * @param version the version number of the object when written. 0385 */ 0386 void persistentInput(PersistentIStream & is, int version); 0387 //@} 0388 0389 /** 0390 * The standard Init function used to initialize the interfaces. 0391 * Called exactly once for each class by the class description system 0392 * before the main function starts or 0393 * when this class is dynamically loaded. 0394 */ 0395 static void Init(); 0396 0397 protected: 0398 0399 /** @name Functions to perform the cascade 0400 */ 0401 //@{ 0402 /** 0403 * The main method which manages the showering of a subprocess. 0404 */ 0405 virtual tPPair cascade(tSubProPtr sub, XCPtr xcomb); 0406 0407 /** 0408 * Set up for the cascade 0409 */ 0410 void prepareCascade(tSubProPtr sub) { 0411 current_ = currentStep(); 0412 subProcess_ = sub; 0413 } 0414 0415 /** 0416 * Boost all the particles in the collision so that the collision always occurs 0417 * in the rest frame with the incoming particles along the z axis 0418 */ 0419 void boostCollision(bool boost); 0420 //@} 0421 0422 protected: 0423 0424 /** 0425 * Set/unset the current shower handler 0426 */ 0427 //@{ 0428 /** 0429 * Set the current handler 0430 */ 0431 void setCurrentHandler() { 0432 currentHandler_ = tShowerHandlerPtr(this); 0433 } 0434 0435 /** 0436 * Unset the current handler 0437 */ 0438 void unSetCurrentHandler() { 0439 currentHandler_ = tShowerHandlerPtr(); 0440 } 0441 //@} 0442 0443 protected: 0444 0445 /** 0446 * @name Members relating to the underlying event and MPI 0447 */ 0448 //@{ 0449 /** 0450 * Return true if multiple parton interactions are switched on 0451 * and can be used for this beam setup. 0452 */ 0453 bool isMPIOn() const { 0454 return MPIHandler_ && MPIHandler_->beamOK(); 0455 } 0456 0457 /** 0458 * Access function for the MPIHandler, it should only be called after 0459 * checking with isMPIOn. 0460 */ 0461 tUEBasePtr getMPIHandler() const { 0462 assert(MPIHandler_); 0463 return MPIHandler_; 0464 } 0465 0466 /** 0467 * Is a beam particle where hadronic structure is resolved 0468 */ 0469 bool isResolvedHadron(tPPtr); 0470 0471 /** 0472 * Get the remnants from the ThePEG::PartonBinInstance es and 0473 * do some checks. 0474 */ 0475 RemPair getRemnants(PBIPair incbins); 0476 0477 /** 0478 * Reset the PDF's after the hard collision has been showered 0479 */ 0480 void setMPIPDFs(); 0481 //@} 0482 0483 public: 0484 0485 /** 0486 * Check if a particle decays in the shower 0487 * @param id The PDG code for the particle 0488 */ 0489 bool decaysInShower(long id) const { 0490 return ( particlesDecayInShower_.find( abs(id) ) != 0491 particlesDecayInShower_.end() ); 0492 } 0493 0494 protected: 0495 0496 /** 0497 * Members to handle splitting up of hard process and decays 0498 */ 0499 //@{ 0500 /** 0501 * Find decay products from the hard process and create decay processes 0502 * @param parent The parent particle 0503 * @param hard The hard process 0504 * @param decay The decay processes 0505 */ 0506 void findDecayProducts(PPtr parent, PerturbativeProcessPtr hard, DecayProcessMap & decay) const; 0507 0508 /** 0509 * Find decay products from the hard process and create decay processes 0510 * @param parent The parent particle 0511 * @param hard The parent hard process 0512 * @param decay The decay processes 0513 */ 0514 void createDecayProcess(PPtr parent,PerturbativeProcessPtr hard, DecayProcessMap & decay) const; 0515 //@} 0516 0517 /** 0518 * @name Functions to return information relevant to the process being showered 0519 */ 0520 //@{ 0521 /** 0522 * Return the currently used SubProcess. 0523 */ 0524 tSubProPtr currentSubProcess() const { 0525 assert(subProcess_); 0526 return subProcess_; 0527 } 0528 0529 /** 0530 * Access to the incoming beam particles 0531 */ 0532 tPPair incomingBeams() const { 0533 return incoming_; 0534 } 0535 //@} 0536 0537 protected: 0538 0539 /** 0540 * Weight handling for shower variations 0541 */ 0542 //@ 0543 /** 0544 * Combine the variation weights which have been encountered 0545 */ 0546 void combineWeights(); 0547 0548 /** 0549 * Initialise the weights in currentEvent() 0550 */ 0551 void initializeWeights(); 0552 0553 /** 0554 * Reset the current weights 0555 */ 0556 void resetWeights(); 0557 //@} 0558 0559 protected: 0560 0561 /** 0562 * Return the maximum number of attempts for showering 0563 * a given subprocess. 0564 */ 0565 unsigned int maxtry() const { return maxtry_; } 0566 0567 protected: 0568 0569 /** 0570 * Parameters for the space-time model 0571 */ 0572 //@{ 0573 /** 0574 * Whether or not to include spa-cetime distances in the shower 0575 */ 0576 bool includeSpaceTime() const {return includeSpaceTime_;} 0577 0578 /** 0579 * The minimum virtuality for the space-time model 0580 */ 0581 Energy2 vMin() const {return vMin_;} 0582 //@} 0583 0584 protected: 0585 0586 /** @name Clone Methods. */ 0587 //@{ 0588 /** 0589 * Make a simple clone of this object. 0590 * @return a pointer to the new object. 0591 */ 0592 virtual IBPtr clone() const; 0593 0594 /** Make a clone of this object, possibly modifying the cloned object 0595 * to make it sane. 0596 * @return a pointer to the new object. 0597 */ 0598 virtual IBPtr fullclone() const; 0599 //@} 0600 0601 protected: 0602 0603 /** @name Standard Interfaced functions. */ 0604 //@{ 0605 /** 0606 * Initialize this object after the setup phase before saving an 0607 * EventGenerator to disk. 0608 * @throws InitException if object could not be initialized properly. 0609 */ 0610 virtual void doinit(); 0611 0612 /** 0613 * Initialize this object. Called in the run phase just before 0614 * a run begins. 0615 */ 0616 virtual void doinitrun(); 0617 0618 /** 0619 * Finalize this object. Called in the run phase just after a 0620 * run has ended. Used eg. to write out statistics. 0621 */ 0622 virtual void dofinish(); 0623 //@} 0624 0625 private: 0626 0627 /** 0628 * The assignment operator is private and must never be called. 0629 * In fact, it should not even be implemented. 0630 */ 0631 ShowerHandler & operator=(const ShowerHandler &) = delete; 0632 0633 private: 0634 0635 /** 0636 * pointer to "this", the current ShowerHandler. 0637 */ 0638 static tShowerHandlerPtr currentHandler_; 0639 0640 /** 0641 * a MPIHandler to administer the creation of several (semihard) 0642 * partonic interactions. 0643 */ 0644 UEBasePtr MPIHandler_; 0645 0646 /** 0647 * Pointer to the HwRemDecayer 0648 */ 0649 HwRemDecPtr remDec_; 0650 0651 private: 0652 0653 /** 0654 * Maximum tries for various stages of the showering process 0655 */ 0656 //@{ 0657 /** 0658 * Maximum number of attempts for the 0659 * main showering loop 0660 */ 0661 unsigned int maxtry_; 0662 0663 /** 0664 * Maximum number of attempts for the regeneration of an additional 0665 * scattering, before the number of scatters is reduced. 0666 */ 0667 unsigned int maxtryMPI_; 0668 0669 /** 0670 * Maximum number of attempts for the regeneration of an additional 0671 * hard scattering, before this event is vetoed. 0672 */ 0673 unsigned int maxtryDP_; 0674 0675 /** 0676 * Maximum number of attempts to generate a decay 0677 */ 0678 unsigned int maxtryDecay_; 0679 //@} 0680 0681 private: 0682 0683 /** 0684 * Factors for the various scales 0685 */ 0686 //@{ 0687 /** 0688 * The factorization scale factor. 0689 */ 0690 double factorizationScaleFactor_; 0691 0692 /** 0693 * The renormalization scale factor. 0694 */ 0695 double renormalizationScaleFactor_; 0696 0697 /** 0698 * The scale factor for the hard scale 0699 */ 0700 double hardScaleFactor_; 0701 0702 /** 0703 * True, if the phase space restrictions of the dipole shower should 0704 * be applied. 0705 */ 0706 bool restrictPhasespace_; 0707 0708 /** 0709 * True if maximum pt should be deduced from the factorization scale 0710 */ 0711 bool maxPtIsMuF_; 0712 0713 /** 0714 * The profile scales 0715 */ 0716 Ptr<HardScaleProfile>::ptr hardScaleProfile_; 0717 //@} 0718 0719 /** 0720 * Option to include spin correlations 0721 */ 0722 unsigned int spinOpt_; 0723 0724 private: 0725 0726 /** 0727 * Storage of information about the current event 0728 */ 0729 //@{ 0730 /** 0731 * The incoming beam particles for the current collision 0732 */ 0733 tPPair incoming_; 0734 0735 /** 0736 * Boost to get back to the lab 0737 */ 0738 LorentzRotation boost_; 0739 0740 /** 0741 * Const pointer to the currently handeled ThePEG::SubProcess 0742 */ 0743 tSubProPtr subProcess_; 0744 0745 /** 0746 * Const pointer to the current step 0747 */ 0748 tcStepPtr current_; 0749 //@} 0750 0751 private: 0752 0753 /** 0754 * PDFs to be used for the various stages and related parameters 0755 */ 0756 //@{ 0757 /** 0758 * The PDF freezing scale 0759 */ 0760 Energy pdfFreezingScale_; 0761 0762 /** 0763 * PDFs to be used for the various stages and related parameters 0764 */ 0765 //@{ 0766 /** 0767 * The PDF for beam particle A. Overrides the particle's own PDF setting. 0768 */ 0769 PDFPtr PDFA_; 0770 0771 /** 0772 * The PDF for beam particle B. Overrides the particle's own PDF setting. 0773 */ 0774 PDFPtr PDFB_; 0775 0776 /** 0777 * The PDF for beam particle A for remnant splitting. Overrides the particle's own PDF setting. 0778 */ 0779 PDFPtr PDFARemnant_; 0780 0781 /** 0782 * The PDF for beam particle B for remnant splitting. Overrides the particle's own PDF setting. 0783 */ 0784 PDFPtr PDFBRemnant_; 0785 0786 /** 0787 * The MPI PDF's to be used for secondary scatters. 0788 */ 0789 pair <PDFPtr, PDFPtr> mpipdfs_; 0790 0791 /** 0792 * The MPI PDF's to be used for secondary scatters. 0793 */ 0794 pair <PDFPtr, PDFPtr> rempdfs_; 0795 0796 /** 0797 * The MPI PDF's to be used for secondary scatters. 0798 */ 0799 pair <PDFPtr, PDFPtr> remmpipdfs_; 0800 //@} 0801 0802 private: 0803 0804 /** 0805 * @name Parameters for initial- and final-state radiation 0806 */ 0807 //@{ 0808 /** 0809 * Switch on or off final state radiation. 0810 */ 0811 bool doFSR_; 0812 0813 /** 0814 * Switch on or off initial state radiation. 0815 */ 0816 bool doISR_; 0817 //@} 0818 0819 private: 0820 0821 /** 0822 * @name Parameters for particle decays 0823 */ 0824 //@{ 0825 /** 0826 * Whether or not to split into hard and decay trees 0827 */ 0828 bool splitHardProcess_; 0829 0830 /** 0831 * PDG codes of the particles which decay during showering 0832 * this is fast storage for use during running 0833 */ 0834 set<long> particlesDecayInShower_; 0835 0836 /** 0837 * PDG codes of the particles which decay during showering 0838 * this is a vector that is interfaced so they can be changed 0839 */ 0840 vector<long> inputparticlesDecayInShower_; 0841 //@} 0842 0843 private: 0844 0845 /** 0846 * Parameters for the space-time model 0847 */ 0848 //@{ 0849 /** 0850 * Whether or not to include space-time distances in the shower 0851 */ 0852 bool includeSpaceTime_; 0853 0854 /** 0855 * The minimum virtuality for the space-time model 0856 */ 0857 Energy2 vMin_; 0858 //@} 0859 0860 0861 private: 0862 0863 /** 0864 * Parameters for the constituent mass treatment. 0865 */ 0866 //@{ 0867 0868 /** 0869 * True if shower should return constituent masses. 0870 */ 0871 bool useConstituentMasses_ = true; 0872 0873 /** 0874 * Status code to tag intermediate state as after the showering; if zero no tagging will be performed 0875 */ 0876 int tagIntermediates_ = 0; 0877 0878 //@} 0879 0880 private: 0881 0882 /** 0883 * Parameters relevant for reweight and variations 0884 */ 0885 //@{ 0886 /** 0887 * The shower variations 0888 */ 0889 map<string,ShowerVariation> showerVariations_; 0890 0891 /** 0892 * Command to add a shower variation 0893 */ 0894 string doAddVariation(string); 0895 0896 /** 0897 * A reweighting factor applied by the showering 0898 */ 0899 double reweight_; 0900 0901 /** 0902 * The shower variation weights 0903 */ 0904 map<string,double> currentWeights_; 0905 //@} 0906 }; 0907 0908 } 0909 0910 #endif /* HERWIG_ShowerHandler_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|