11 #ifndef Pythia8_ColourReconnection_H
12 #define Pythia8_ColourReconnection_H
14 #include "Pythia8/Basics.h"
15 #include "Pythia8/BeamParticle.h"
16 #include "Pythia8/Event.h"
17 #include "Pythia8/FragmentationFlavZpT.h"
18 #include "Pythia8/Info.h"
19 #include "Pythia8/ParticleData.h"
20 #include "Pythia8/StringFragmentation.h"
21 #include "Pythia8/PartonDistributions.h"
22 #include "Pythia8/PartonSystems.h"
23 #include "Pythia8/PythiaStdlib.h"
24 #include "Pythia8/Settings.h"
25 #include "Pythia8/StringLength.h"
26 #include "Pythia8/StringInteractions.h"
41 ColourDipole(
int colIn = 0,
int iColIn = 0,
int iAcolIn = 0,
42 int colReconnectionIn = 0,
bool isJunIn =
false,
bool isAntiJunIn =
false,
43 bool isActiveIn =
true,
bool isRealIn =
false) : col(colIn), iCol(iColIn),
44 iAcol(iAcolIn), colReconnection(colReconnectionIn), isJun(isJunIn),
45 isAntiJun(isAntiJunIn),isActive(isActiveIn), isReal(isRealIn)
46 {leftDip = 0; rightDip = 0; iColLeg = 0; iAcolLeg = 0; printed =
false;
49 double mDip(
Event & event) {
50 if (isJun || isAntiJun)
return 1E9;
51 else return m(event[iCol].p(),event[iAcol].p());
55 int col, iCol, iAcol, iColLeg, iAcolLeg, colReconnection;
56 bool isJun, isAntiJun, isActive, isReal, printed;
57 ColourDipole *leftDip, *rightDip;
58 vector<ColourDipole *> colDips, acolDips;
71 class ColourJunction :
public Junction {
75 ColourJunction(
const Junction& ju) : Junction(ju), dips(), dipsOrig() { }
77 ColourJunction(
const ColourJunction& ju) : Junction(Junction(ju)), dips(),
78 dipsOrig() {
for(
int i = 0;i < 3;++i) {
79 dips[i] = ju.dips[i]; dipsOrig[i] = ju.dipsOrig[i];}
81 ColourJunction& operator=(
const ColourJunction& ju) {
82 this->Junction::operator=(ju);
83 for(
int i = 0;i < 3;++i) {
84 dips[i] = ju.dips[i]; dipsOrig[i] = ju.dipsOrig[i];
89 ColourDipole * getColDip(
int i) {
return dips[i];}
90 void setColDip(
int i, ColourDipole * dip) {dips[i] = dip;}
91 ColourDipole * dips[3];
92 ColourDipole * dipsOrig[3];
103 class TrialReconnection {
107 TrialReconnection(ColourDipole* dip1In = 0, ColourDipole* dip2In = 0,
108 ColourDipole* dip3In = 0, ColourDipole* dip4In = 0,
int modeIn = 0,
109 double lambdaDiffIn = 0) {
110 dips.push_back(dip1In); dips.push_back(dip2In);
111 dips.push_back(dip3In); dips.push_back(dip4In);
112 mode = modeIn; lambdaDiff = lambdaDiffIn;
116 cout <<
"mode: " << mode <<
" " <<
"lambdaDiff: " << lambdaDiff << endl;
117 for (
int i = 0;i < int(dips.size()) && dips[i] != 0;++i) {
118 cout <<
" "; dips[i]->list(); }
121 vector<ColourDipole*> dips;
133 class ColourParticle :
public Particle {
137 ColourParticle(
const Particle& ju) : Particle(ju), isJun(), junKind() {}
139 vector<vector<ColourDipole *> > dips;
140 vector<bool> colEndIncluded, acolEndIncluded;
141 vector<ColourDipole *> activeDips;
147 void listActiveDips();
158 class ColourReconnection :
public ColourReconnectionBase {
163 ColourReconnection() : allowJunctions(), sameNeighbourCol(),
164 singleReconOnly(), lowerLambdaOnly(), nSys(), nReconCols(), swap1(),
165 swap2(), reconnectMode(), flipMode(), timeDilationMode(), eCM(), sCM(),
166 pT0(), pT20Rec(), pT0Ref(), ecmRef(), ecmPow(), reconnectRange(), m0(),
167 m0sqr(), m2Lambda(), fracGluon(), dLambdaCut(), timeDilationPar(),
168 timeDilationParGeV(), tfrag(), blowR(), blowT(), rHadron(), kI(),
175 void reassignBeamPtrs( BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn)
176 {beamAPtr = beamAPtrIn; beamBPtr = beamBPtrIn;}
179 bool next(
Event & event,
int oldSize);
184 static const double MINIMUMGAIN, MINIMUMGAINJUN, TINYP1P2;
185 static const int MAXRECONNECTIONS;
188 bool allowJunctions, sameNeighbourCol, singleReconOnly, lowerLambdaOnly;
189 int nSys, nReconCols, swap1, swap2, reconnectMode, flipMode,
191 double eCM, sCM, pT0, pT20Rec, pT0Ref, ecmRef, ecmPow, reconnectRange,
192 m0, m0sqr, m2Lambda, fracGluon, dLambdaCut, timeDilationPar,
193 timeDilationParGeV, tfrag, blowR, blowT, rHadron, kI;
196 vector<ColourDipole*> dipoles, usedDipoles;
197 vector<ColourJunction> junctions;
198 vector<ColourParticle> particles;
199 vector<TrialReconnection> junTrials, dipTrials;
200 vector<vector<int> > iColJun;
201 map<int,double> formationTimes;
204 StringFragmentation stringFragmentation;
207 StringLength stringLength;
210 bool nextNew(
Event & event,
int oldSize);
213 void swapDipoles(ColourDipole* dip1, ColourDipole* dip2,
bool back =
false);
216 void setupDipoles(
Event& event,
int iFirst = 0);
219 void makePseudoParticle( ColourDipole* dip,
int status,
220 bool setupDone =
false);
224 bool getJunctionIndices(ColourDipole* dip,
int &iJun,
int &i0,
int &i1,
225 int &i2,
int &junLeg0,
int &junLeg1,
int &junLeg2);
228 void makeAllPseudoParticles(
Event & event,
int iFirst = 0);
231 void updateEvent(
Event& event,
int iFirst = 0);
233 double calculateStringLength( ColourDipole* dip,
234 vector<ColourDipole*> & dips);
237 double calculateStringLength(
int i,
int j);
241 double calculateJunctionLength(
int i,
int j,
int k);
246 double calculateDoubleJunctionLength(
int i,
int j,
int k,
int l);
251 bool findJunctionParticles(
int iJun, vector<int>& iParticles,
252 vector<bool> &usedJuns,
int &nJuns, vector<ColourDipole*> &dips);
255 void singleReconnection( ColourDipole* dip1, ColourDipole* dip2);
258 void singleJunction(ColourDipole* dip1, ColourDipole* dip2);
261 void singleJunction(ColourDipole* dip1, ColourDipole* dip2,
265 void listChain(ColourDipole* dip);
268 void listAllChains();
271 void listDipoles(
bool onlyActive =
false,
bool onlyReal =
false);
274 void listParticles();
277 void listJunctions();
283 void checkRealDipoles(
Event& event,
int iFirst);
286 double mDip(ColourDipole* dip);
290 bool findAntiNeighbour(ColourDipole*& dip);
294 bool findColNeighbour(ColourDipole*& dip);
297 bool checkJunctionTrials();
300 void storeUsedDips(TrialReconnection& trial);
303 void doJunctionTrial(
Event& event, TrialReconnection& juncTrial);
306 void doDipoleTrial(TrialReconnection& trial);
309 void doTripleJunctionTrial(
Event& event, TrialReconnection& juncTrial);
312 double getLambdaDiff(ColourDipole* dip1,
313 ColourDipole* dip2, ColourDipole* dip3, ColourDipole* dip4,
int mode);
316 double getLambdaDiff(ColourDipole* dip1, ColourDipole* dip2);
319 void updateDipoleTrials();
322 void updateJunctionTrials();
325 bool checkTimeDilation(ColourDipole* dip1 = 0, ColourDipole* dip2 = 0,
326 ColourDipole* dip3 = 0, ColourDipole* dip4 = 0);
329 bool checkTimeDilation(Vec4 p1, Vec4 p2,
double t1,
double t2);
332 Vec4 getDipoleMomentum(ColourDipole* dip);
335 void addJunctionIndices(
int iSinglePar, vector<int> &iPar,
336 vector<int> &usedJuncs);
339 void setupFormationTimes(
Event & event);
342 double getJunctionMass(
Event & event,
int col);
345 void addJunctionIndices(
Event & event,
int iSinglePar,
346 vector<int> &iPar, vector<int> &usedJuncs);
349 bool reconnectMPIs(
Event& event,
int oldSize);
354 vector<int> iReduceCol, iExpandCol;
358 vector<double> lambdaijMove;
361 double lambda12Move(
int i,
int j) {
362 int iAC = iReduceCol[i];
int jAC = iReduceCol[j];
363 return lambdaijMove[nColMove * min( iAC, jAC) + max( iAC, jAC)];
367 double lambda123Move(
int i,
int j,
int k) {
368 int iAC = iReduceCol[i];
int jAC = iReduceCol[j];
int kAC = iReduceCol[k];
369 return lambdaijMove[nColMove * min( iAC, jAC) + max( iAC, jAC)]
370 + lambdaijMove[nColMove * min( iAC, kAC) + max( iAC, kAC)]
371 - lambdaijMove[nColMove * min( jAC, kAC) + max( jAC, kAC)];
375 bool reconnectMove(
Event& event,
int oldSize);
378 bool reconnectTypeCommon(
Event& event,
int oldSize);
381 map<double,pair<int,int> > reconnectTypeI(
Event& event,
382 vector<vector<ColourDipole> > &dips, Vec4 decays[2]);
386 map<double,pair<int,int> > reconnectTypeII(
Event& event,
387 vector<vector<ColourDipole> > &dips, Vec4 decays[2]);
391 double determinant3(vector<vector< double> >& vec);
398 #endif // Pythia8_ColourReconnection_H