22 #ifndef Pythia8_HIUserHooks_H
23 #define Pythia8_HIUserHooks_H
25 #include "Pythia8/Pythia.h"
43 const double femtometer = 1.0;
44 const double millimeter = 1.0e12;
47 const double femtometer2 = 1.0;
48 const double millibarn = 0.1;
49 const double nanobarn = 1.0e-7;
53 using namespace HIUnits;
82 : idSave(idIn), indexSave(indexIn), nPosSave(pos), bPosSave(pos),
83 statusSave(UNWOUNDED),eventp(0), isDone(0) {}
88 int id()
const {
return idSave; }
91 int index()
const {
return indexSave; }
106 bool done()
const {
return isDone; }
116 static State nullstate;
117 return i < int(altStatesSave.size())? altStatesSave[i]: nullstate;
166 vector<State> altStatesSave;
176 statusSave = UNWOUNDED;
177 altStatesSave.clear();
206 double bIn,
double bpIn, Type typeIn)
207 : proj(&projIn), targ(&targIn), b(bIn), bp(bpIn), type(typeIn) {}
210 : proj(0), targ(0), b(0.0), bp(0.0), type(NONE) {}
213 bool operator< (
const SubCollision & s)
const {
return b < s.b; }
217 int nucleons()
const {
218 return ( abs(targ->id()) == 2112? 1: 0 ) +
219 ( abs(proj->id()) == 2112? 2: 0 );
252 : idSave(0), ISave(0), ASave(0), ZSave(0), LSave(0), RSave(0.0),
253 settingsPtr(0), particleDataPtr(0), rndPtr(0) {}
259 void initPtr(
int idIn,
Settings & settingsIn,
263 virtual Particle produceIon(
bool istarg);
267 virtual vector<Nucleon> generate()
const = 0;
270 int id()
const {
return idSave; }
271 int I()
const {
return ISave; }
272 int A()
const {
return ASave; }
273 int Z()
const {
return ZSave; }
274 int L()
const {
return LSave; }
275 double R()
const {
return RSave; }
306 inthi0(0.0), inthi1(0.0), inthi2(0.0) {}
309 double a()
const {
return aSave; }
315 Vec4 generateNucleon()
const;
324 intlo = R()*R()*R()/3.0;
325 inthi0 = a()*R()*R();
326 inthi1 = 2.0*a()*a()*R();
327 inthi2 = 2.0*a()*a()*a();
328 return NucleusModel::init();
341 double intlo, inthi0, inthi1, inthi2;
367 virtual vector<Nucleon> generate()
const;
370 double Rh()
const {
return RhSave; }
372 double RhGauss()
const {
return RhSave*abs(rndPtr->gauss()); };
387 class SubCollisionModel;
402 : widthSave(0.0), collPtr(0), projPtr(0), targPtr(0),
403 settingsPtr(0), rndPtr(0) {}
418 virtual Vec4 generate(
double & weight)
const;
421 void width(
double widthIn) { widthSave = widthIn; }
424 double width()
const {
return widthSave; }
469 SigEst(): sig(8, 0.0), dsig2(8, 0.0), fsig(8, false),
470 avNDb(0.0), davNDb2(0.0) {}
478 NGen(20), NPop(20), sigFuzz(0.2),
479 fitPrint(true), avNDb(1.0*femtometer) {}
492 sigTotPtr = &sigTotIn;
493 settingsPtr = &settingsIn;
505 virtual multiset<SubCollision> getCollisions(vector<Nucleon> & proj,
506 vector<Nucleon> & targ,
519 double sigEl()
const {
return sigTarg[6]; }
522 double sigCDE()
const {
return sigTarg[5]; }
525 double sigSDE()
const {
return sigTarg[3] + sigTarg[4]; }
534 double sigDDE()
const {
return sigTarg[2]; }
537 double sigND()
const {
return sigTarg[1]; }
540 double bSlope()
const {
return sigTarg[7]; }
553 double Chi2(
const SigEst & sigs,
int npar)
const;
556 virtual bool evolve();
559 virtual void setParm(
const vector<double> &) {}
564 return vector<double>();
566 virtual vector<double> minParm()
const {
567 return vector<double>();
569 virtual vector<double> maxParm()
const {
570 return vector<double>();
577 vector<double> sigTarg, sigErr;
621 virtual multiset<SubCollision>
622 getCollisions(vector<Nucleon> & proj, vector<Nucleon> & targ,
623 const Vec4 & bvec,
double & T);
639 : r0(0.0), k0(4.0), sigd(75.0), alpha(0.5), opacityMode(modein) {}
647 virtual multiset<SubCollision>
648 getCollisions(vector<Nucleon> & proj, vector<Nucleon> & targ,
649 const Vec4 & bvec,
double & T);
652 double gamma()
const;
658 if ( opacityMode == 1 ) sig = 1.0/sig;
659 return sig > std::numeric_limits<double>::epsilon()?
660 pow(-expm1(-1.0/sig), alpha): 1.0;
667 double sig = M_PI*pow2(p[0] + t[0]);
668 double grey = opacity(sig);
669 return sig/grey > b*b*2.0*M_PI? grey: 0.0;
673 SigEst getSig()
const;
676 virtual void setParm(
const vector<double> &);
680 virtual vector<double> getParm()
const;
681 virtual vector<double> minParm()
const;
682 virtual vector<double> maxParm()
const;
685 static void shuffle(
double PND1,
double PND2,
686 double & PW1,
double & PW2);
687 static void shuffel(
double & PEL11,
double P11,
688 double P12,
double P21,
double P22);
689 static double PNW(
double PWp,
double PWt,
double PND) {
690 return ( 1.0 - PWp <= 0.0 || 1.0 - PWt <= 0.0 )?
691 0.0: (1.0 - PWp)*(1.0 - PWt)/(1.0 - PND);
727 dR = T0 = c = phi = vector<double>(Nr, 0.0);
736 virtual multiset<SubCollision>
737 getCollisions(vector<Nucleon> & proj, vector<Nucleon> & targ,
738 const Vec4 & bvec,
double & T);
744 return b < p[0] + t[0]? p[1]*t[1]: 0.0;
748 SigEst getSig()
const;
751 virtual void setParm(
const vector<double> &);
755 virtual vector<double> getParm()
const;
756 virtual vector<double> minParm()
const;
757 virtual vector<double> maxParm()
const;
803 bool operator<(
const EventInfo & ei)
const {
815 map<Nucleon *, pair<int,int> >
projs, targs;
833 : idProjSave(0), idTargSave(0), bSave(0.0), NSave(0), NAccSave(0),
834 sigmaTotSave(0.0), sigmaNDSave(0.0), sigErr2TotSave(0.0),
835 sigErr2NDSave(0.0), weightSave(0.0), weightSumSave(0.0),
836 nCollSave(10, 0), nProjSave(10, 0), nTargSave(10, 0), nFailSave(0),
846 return sigmaTotSave/millibarn;
851 return sqrt(sigErr2TotSave/max(1.0,
double(NSave)))/millibarn;
857 return sigmaNDSave/millibarn;
862 return sqrt(sigErr2NDSave/max(1.0,
double(NSave)));
883 int nCollNDTot()
const {
return nProjSave[1] + nTargSave[1] - nCollSave[1]; }
937 double weight()
const {
return weightSave; }
957 void addAttempt(
double T,
double bin,
double bweight);
960 void reweight(
double w) {
965 void select(Info & in) {
967 primInfo.hiinfo =
this;
977 int addSubCollision(
const SubCollision & c);
980 int addProjectileNucleon(
const Nucleon & n);
981 int addTargetNucleon(
const Nucleon & n);
985 int idProjSave, idTargSave;
991 long NSave, NAccSave;
992 double sigmaTotSave, sigmaNDSave, sigErr2TotSave, sigErr2NDSave;
993 double weightSave, weightSumSave;
997 vector<int> nCollSave, nProjSave, nTargSave;
1001 map<int,double> sumPrimW, sumPrimW2;
1003 map<int,string> NamePrim;
1014 multiset<SubCollision>* subCollisionsPtr() {
return subColsPtr; }
1016 void subCollisionsPtr(multiset<SubCollision> * sPtrIn) {
1017 subColsPtr = sPtrIn; }
1023 multiset<SubCollision>* subColsPtr;
1045 virtual void init(
int idProjIn,
int idTargIn) {
1046 idProjSave = idProjIn;
1047 idTargSave = idTargIn;
1057 virtual NucleusModel * projectileModel()
const {
return 0; }
1058 virtual bool hasTargetModel()
const {
return false; }
1059 virtual NucleusModel * targetModel()
const {
return 0; }
1068 virtual double eventOrdering(
const Event &,
const Info &) {
return -1; }
1073 virtual bool fixIsoSpin(
EventInfo &) {
return false; }
1087 virtual bool forceHadronLevel(
Pythia &) {
return false; }
1094 findRecoilers(
const Event &,
bool ,
int ,
int ,
1095 const Vec4 & ,
const Vec4 & )
const {
1096 return vector<int>();
1111 #endif // Pythia8_HIUserHooks_H
Both excited but with central diffraction.
double sigd
Saturation scale of the nucleus.
double r0
The average radius of the nucleon.
void status(Status s)
Manipulating functions:
Settings * settingsPtr
Pointers to useful objects.
virtual SigEst getSig() const
Calculate the cross sections for the given set of parameters.
virtual ~DoubleStrikman()
Virtual destructor,.
bool done() const
Check if nucleon has been assigned.
const Vec4 & bPos() const
The absolute position in impact parameter space.
vector< double > c
The probability distribution.
double opacity(double sig) const
The opacity of the collision at a given sigma.
int id() const
Accessor functions:
int Nr
The number of radii.
A general Woods-Saxon distributed nucleus.
Both projectile and target are diffractively excited.
int nCollTot() const
The total number of separate sub-collisions.
vector< double > State
The state of a nucleon is a general vector of doubles.
virtual vector< double > getParm() const
virtual bool hasProjectileModel() const
A suser-supplied NucleusModel for the projectile and target.
void select()
Select this nucleon to be assigned to an event.
EventInfo * event() const
The event this nucleon is assigned to.
virtual ~ImpactParameterGenerator()
Virtual destructor.
double bSlope() const
The elastic b-slope parameter.
vector< bool > fsig
Which cross sections were actually fitted.
void state(State s)
Set the physical state.
Type
This defines the type of a bunary nucleon collison.
DoubleStrikman(int modein=0)
double sigDDE() const
The double diffractive excitation cross section.
vector< double > dsig2
The extimated error (squared)
double avNDB() const
Return the average non-diffractive impact parameter.
double sigmaNDErr() const
The estimated statistical error on sigmaND().
vector< double > T0
The opacity for different radii.
double ordering
The ordering variable of this event.
virtual bool canFixIsoSpin() const
double width() const
Get the width.
map< Nucleon *, pair< int, int > > projs
virtual bool canFindRecoilers() const
virtual bool hasImpactParameterGenerator() const
A user-supplied impact parameter generator.
bool canAddNucleonExcitation() const
double weightSum() const
The sum of weights of the produced events.
Event event
The Event and info objects.
double sigND() const
The non-diffractive (absorptive) cross section.
void failedExcitation()
Register a failed nucleon excitation.
virtual bool canShiftEvent() const
A user-supplied method for shifting the event in impact parameter space.
long nAccepted() const
The number of produced events.
NucleusModel * projPtr
Info from the controlling HeavyIons object.
int nFail() const
The number of failed nuclon excitations in the current event.
SigEst()
Constructor for zeros.
void width(double widthIn)
Set the width (in femtometers).
void select(EventInfo &evp, Status s)
Select an event for this nucleon.
const Vec4 & nPos() const
The position of this nucleon relative to the nucleus center.
double sigEl() const
The total cross section.
Nucleon * targ
The target nucleon.
SubCollisionModel()
The default constructor is empty.
double b() const
The impact-parameter distance in the current event.
This is an elastic scattering.
The projectile is diffractively excited.
double Rh() const
Accessor functions.
double sigSDEP() const
The single diffractive excitation cross section (excited projectile).
int ISave
Cache information about the nucleus.
double k0
The power in the Gamma distribution.
void addAltState(State s)
Add an alternative state.
double RSave
The estimate of the nucleus radius.
virtual bool hasEventOrdering() const
A user-supplied ordering of events in (inverse) hardness.
virtual bool hasSubCollisionModel()
virtual void setParm(const vector< double > &)
Set the parameters of this model.
vector< double > phi
The angles defining the probability distribution for the radii.
GLISSANDOModel()
Default constructor.
double sigSDE() const
The single diffractive excitation cross section (both sides summed).
int nCollEL() const
The number of separate elastic sub collisions.
Internal class to report cross section estimates.
SubCollisionModel * collPtr
Info from the controlling HeavyIons object.
virtual void init(int idProjIn, int idTargIn)
Initialize this user hook.
bool ok
Is the event properly generated?
The target is diffractively excited.
virtual ~NucleusModel()
Virtual destructor.
const SubCollision * coll
The associated SubCollision object.
virtual ~WoodsSaxonModel()
Virtual destructor.
HIUserHooks()
The default constructor is empty.
int id() const
Accessor functions.
const State & altState(int i=0)
Return an alternative state.
const Vec4 & bShift(const Vec4 &bvec)
Shift the absolute position in impact parameter space.
double sigmaTot() const
The Monte Carlo integrated total cross section in the current run.
double Tpt(const Nucleon::State &p, const Nucleon::State &t, double b) const
ImpactParameterGenerator()
double b
The impact parameter distance between the nucleons in femtometer.
long nAttempts() const
The number of attempted impact parameter points.
int opacityMode
Optional mode for opacity.
double a() const
Accessor functions:
Status status() const
The status.
int index() const
The nucleon type.
EventInfo()
Empty constructor.
double sigSDET() const
The single diffractive excitation cross section (excited target).
virtual ~NaiveSubCollisionModel()
Virtual destructor,.
int nCollNDTot() const
The total number of non-diffractive sub collisions in the current event.
virtual ~MultiRadial()
Virtual destructor,.
double sigmaTotErr() const
The estimated statistical error on sigmaTot().
virtual ~HIUserHooks()
Virtual destructor.
vector< double > sig
The cross sections (tot, nd, dd, sdp, sdt, cd, el, bslope).
Status
Enum for specifying the status of a nucleon.
double sigCDE() const
The central diffractive excitation cross section.
virtual ~SubCollisionModel()
Virtual destructor,.
virtual bool canForceHadronLevel() const
A user supplied wrapper around the Pythia::forceHadronLevel()
double alpha
Power of the saturation scale.
double weight() const
The weight for this collision.
virtual ~GLISSANDOModel()
Virtual destructor.
double sigTot() const
The total cross section.
The default HeavyIon model in Pythia.
Type type
The type of collison.
double Tpt(const Nucleon::State &p, const Nucleon::State &t, double b) const
const State & state() const
The physical state of the incoming nucleon.
vector< double > dR
The difference between radii.