herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
HadronSelector.h
1// -*- C++ -*-
2//
3// HadronSelector.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4// Copyright (C) 2002-2019 The Herwig Collaboration
5//
6// Herwig is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef HERWIG_HadronSelector_H
10#define HERWIG_HadronSelector_H
11//
12// This is the declaration of the HadronSelector class.
13//
14
15#include "ThePEG/Interface/Interfaced.h"
16#include <ThePEG/Persistency/PersistentOStream.h>
17#include <ThePEG/Persistency/PersistentIStream.h>
18#include <ThePEG/PDT/ParticleData.h>
20#include <ThePEG/Repository/EventGenerator.h>
21#include "HadronSelector.fh"
22#include "HadronInfo.h"
23#include "Kupco.h"
24#include <tuple>
25
26namespace Herwig {
27
28using namespace ThePEG;
29
52
53public:
54
58 HadronSelector(unsigned int);
59
68 virtual tcPDPair chooseHadronPair(const Energy cluMass,
69 tcPDPtr par1, tcPDPtr par2) const;
70
78 tcPDPtr chooseSingleHadron(tcPDPtr par1, tcPDPtr par2, Energy mass) const;
79
110
116 Energy massLightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2) const {
117 map<pair<long,long>,tcPDPair>::const_iterator lightest =
118 lightestHadrons_.find(make_pair(abs(ptr1->id()),abs(ptr2->id())));
119 if(lightest!=lightestHadrons_.end())
120 return lightest->second.first->mass()+lightest->second.second->mass();
121 else
122 return ZERO;
123 }
124
134
145 vector<pair<tcPDPtr,double> >
146 hadronsBelowThreshold(Energy threshold,
147 tcPDPtr ptr1, tcPDPtr ptr2) const;
148
154 Energy massLightestHadron(tcPDPtr ptr1, tcPDPtr ptr2) const {
155 // find entry in the table
156 pair<long,long> ids(abs(ptr1->id()),abs(ptr2->id()));
157 HadronTable::const_iterator tit=_table.find(ids);
158 // throw exception if flavours wrong
159 if(tit==_table.end()||tit->second.empty())
160 throw Exception() << "HadronSelector::massLightestHadron "
161 << "failed for particle" << ptr1->id() << " "
162 << ptr2->id()
164 // return the mass
165 return tit->second.begin()->mass;
166 }
167
171 double pwt(long pid) const {
172 map<long,double>::const_iterator it = _pwt.find(abs(pid));
173 assert( it != _pwt.end() );
174 return it->second;
175 }
176
180 virtual std::tuple<bool,bool,bool> selectBaryon(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const;
181
185 virtual double strangeWeight(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const;
186
193 virtual PDPtr makeDiquark(tcPDPtr par1, tcPDPtr par2);
194
195public:
196
204
210 void persistentInput(PersistentIStream & is, int version);
212
219 static void Init();
220
221protected:
222
235 virtual void doinit();
237
238protected:
239
248 void insertToHadronTable(tPDPtr &particle, int flav1, int flav2);
249
288 virtual void constructHadronTable();
289
293 const HadronTable & table() const {
294 return _table;
295 }
296
301 return _table;
302 }
303
307 const vector<PDPtr> & partons() const {
308 return _partons;
309 }
310
314 vector<PDPtr> & partons() {
315 return _partons;
316 }
317
321 map<long,double> & pwt() {
322 return _pwt;
323 }
324
351 double probabilityMixing(const double angleMix,
352 const int order) const {
353 static double convert=Constants::pi/180.0;
354 if (order == 1)
355 return sqr( cos( angleMix*convert + atan( sqrt(2.0) ) ) );
356 else if (order == 2)
357 return sqr( sin( angleMix*convert + atan( sqrt(2.0) ) ) );
358 else
359 return 1.;
360 }
361
366 virtual double mixingStateWeight(long id) const;
368
373 double specialWeight(long id) const {
374 const int pspin = id % 10;
375 // Only K0L and K0S have pspin == 0, should
376 // not get them until Decay step
377 assert( pspin != 0 );
378 // Baryon : J = 1/2 or 3/2
379 if(pspin%2==0)
380 return baryonWeight(id);
381 // Meson
382 else
383 return mesonWeight(id);
384 }
385
389 virtual double mesonWeight(long id) const;
390
394 virtual double baryonWeight(long id) const = 0;
395
401 int signHadron(tcPDPtr ptr1, tcPDPtr ptr2, tcPDPtr hadron) const;
402
406 virtual void insertMeson(HadronInfo a, int flav1, int flav2);
407
411 virtual void insertOneHalf(HadronInfo a, int flav1, int flav2);
412
416 virtual void insertThreeHalf(HadronInfo a, int flav1, int flav2);
417
418private:
419
425
426private:
427
431 vector<PDPtr> _partons;
432
436 vector<PDPtr> _forbidden;
437
441 map<long,double> _pwt;
442
450 double _etamix;
451
455 double _phimix;
456
460 double _h1mix;
461
465 double _f0mix;
466
470 double _f1mix;
471
475 double _f2mix;
476
480 double _eta2mix;
481
485 double _omhmix;
486
490 double _ph3mix;
491
495 double _eta2Smix;
496
500 double _phi2Smix;
502
511 vector<double> _weight1S0;
512
516 vector<double> _weight3S1;
517
521 vector<double> _weight1P1;
522
526 vector<double> _weight3P0;
527
531 vector<double> _weight3P1;
532
536 vector<double> _weight3P2;
537
541 vector<double> _weight1D2;
542
546 vector<double> _weight3D1;
547
551 vector<double> _weight3D2;
552
556 vector<double> _weight3D3;
558
562 vector<vector<vector<double> > > _repwt;
563
568
576 enum MesonMultiplets { Lmax = 3, Jmax = 4, Nmax = 4};
578
582 unsigned int _topt;
583
587 unsigned int _trial;
588
597 double _limBottom;
598 double _limCharm;
599 double _limExotic;
601
605 unsigned int belowThreshold_;
606
614 map<pair<long,long>,tcPDPair> lightestHadrons_;
616};
617
618
619}
620
621#endif /* HERWIG_HadronSelector_H */
Class used to store all the hadron information for easy access.
Definition: HadronInfo.h:25
This class selects the hadron flavours of a cluster decay.
virtual tcPDPair chooseHadronPair(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const
Method to return a pair of hadrons given the PDG codes of two or three constituents.
vector< double > _weight3P1
The weights for the multiplets.
vector< PDPtr > _partons
The PDG codes of the constituent particles allowed.
virtual double strangeWeight(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const
Strange quark weight.
virtual double baryonWeight(long id) const =0
Weights for baryons.
unsigned int belowThreshold_
Option for the selection of hadrons below the pair threshold.
const HadronTable & table() const
Access to the table of hadrons.
map< long, double > & pwt()
Access the parton weights.
virtual double mixingStateWeight(long id) const
Returns the weight of given mixing state.
double _etamix
The mixing angles for the mesons containing light quarks.
double _eta2mix
The mixing angle.
MesonMultiplets
Enums so arrays can be statically allocated.
tcPDPair lightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2) const
This returns the lightest pair of hadrons given by the flavours.
vector< double > _weight1S0
The weights for the various meson multiplets to be used to supress the production of particular state...
virtual void insertThreeHalf(HadronInfo a, int flav1, int flav2)
Insert a spin baryon in the table.
double _f0mix
The mixing angle.
double _f1mix
The mixing angle.
unsigned int _trial
Which particles to produce for debugging purposes.
HadronSelector(unsigned int)
The default constructor.
vector< double > _weight3D2
The weights for the multiplets.
double specialWeight(long id) const
Calculates a special weight specific to a given hadron.
tcPDPtr chooseSingleHadron(tcPDPtr par1, tcPDPtr par2, Energy mass) const
Select the single hadron for a cluster decay return null pointer if not a single hadron decay.
virtual void insertMeson(HadronInfo a, int flav1, int flav2)
Insert a meson in the table.
Energy massLightestHadronPair(tcPDPtr ptr1, tcPDPtr ptr2) const
Returns the mass of the lightest pair of hadrons with the given particles.
tcPDPtr lightestHadron(tcPDPtr ptr1, tcPDPtr ptr2) const
Returns the lightest hadron formed by the given particles.
HadronSelector & operator=(const HadronSelector &)=delete
The assignment operator is private and must never be called.
void insertToHadronTable(tPDPtr &particle, int flav1, int flav2)
A sub-function of HadronSelector::constructHadronTable().
vector< vector< vector< double > > > _repwt
The weights for the excited meson multiplets.
double _omhmix
The mixing angle.
vector< double > _weight3S1
The weights for the multiplets.
vector< double > _weight3D1
The weights for the multiplets.
vector< double > _weight3P2
The weights for the multiplets.
double _eta2Smix
The mixing angle.
double _phimix
The mixing angle.
virtual double mesonWeight(long id) const
Weights for mesons.
vector< PDPtr > & partons()
Access to the list of partons.
vector< double > _weight1D2
The weights for the multiplets.
vector< double > _weight1P1
The weights for the multiplets.
HadronTable & table()
Access to the table of hadrons.
unsigned int _topt
Option for the construction of the tables.
map< pair< long, long >, tcPDPair > lightestHadrons_
Caches of lightest pairs for speed.
virtual void constructHadronTable()
Construct the table of hadron data This is the main method to initialize the hadron data (mainly the ...
double _ph3mix
The mixing angle.
double probabilityMixing(const double angleMix, const int order) const
Methods for the mixing of mesons.
vector< pair< tcPDPtr, double > > hadronsBelowThreshold(Energy threshold, tcPDPtr ptr1, tcPDPtr ptr2) const
Returns the hadrons below the constituent mass threshold formed by the given particles,...
int signHadron(tcPDPtr ptr1, tcPDPtr ptr2, tcPDPtr hadron) const
This method returns the proper sign ( > 0 hadron; < 0 anti-hadron ) for the input PDG id idHad > 0,...
double pwt(long pid) const
Access the parton weights.
static void Init()
The standard Init function used to initialize the interfaces.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
vector< double > _weight3D3
The weights for the multiplets.
const vector< PDPtr > & partons() const
Access to the list of partons.
vector< double > _weight3P0
The weights for the multiplets.
HadronTable _table
The table of hadron data.
virtual PDPtr makeDiquark(tcPDPtr par1, tcPDPtr par2)
Return the particle data of the diquark (anti-diquark) made by the two quarks (antiquarks) par1,...
map< long, double > _pwt
Weights for quarks and diquarks.
virtual std::tuple< bool, bool, bool > selectBaryon(const Energy cluMass, tcPDPtr par1, tcPDPtr par2) const
Force baryon/meson selection.
virtual void insertOneHalf(HadronInfo a, int flav1, int flav2)
Insert a spin baryon in the table.
vector< PDPtr > _forbidden
The PDG codes of the hadrons which cannot be produced in the hadronization.
double _phi2Smix
The mixing angle.
double _h1mix
The mixing angle.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
double _f2mix
The mixing angle.
Energy massLightestHadron(tcPDPtr ptr1, tcPDPtr ptr2) const
Return the nominal mass of the hadron returned by lightestHadron()
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
-*- C++ -*-
map< pair< long, long >, KupcoData > HadronTable
The hadron table type.
Definition: HadronInfo.h:136
constexpr double pi
ThePEG::Ptr< ParticleData >::transient_pointer tPDPtr
double sqrt(int x)
pair< tcPDPtr, tcPDPtr > tcPDPair
constexpr ZeroUnit ZERO
ThePEG::Ptr< ParticleData >::transient_const_pointer tcPDPtr
ThePEG::Ptr< ParticleData >::pointer PDPtr
constexpr auto sqr(const T &x) -> decltype(x *x)