9 #include "Pythia8/HiddenValleyFragmentation.h"
21 void HVStringFlav::init(Settings& settings, Rndm* rndmPtrIn) {
27 nFlav = settings.mode(
"HiddenValley:nFlav");
28 probVector = settings.parm(
"HiddenValley:probVector");
36 FlavContainer HVStringFlav::pick(FlavContainer& flavOld) {
39 FlavContainer flavNew;
40 flavNew.rank = flavOld.rank + 1;
43 flavNew.id = 4900100 + min( 1 +
int(nFlav * rndmPtr->flat()), nFlav);
44 if (flavOld.id > 0) flavNew.id = -flavNew.id;
56 int HVStringFlav::combine(FlavContainer& flav1, FlavContainer& flav2) {
61 int idPos = max( flav1.id, flav2.id) - 4900000;
62 int idNeg = -min( flav1.id, flav2.id) - 4900000;
63 if (idPos < 20) idPos = 101;
64 if (idNeg < 20) idNeg = 101;
67 if (idNeg == idPos) idMeson = 4900111;
68 else if (idPos > idNeg) idMeson = 4900211;
69 else idMeson = -4900211;
70 if (rndmPtr->flat() < probVector) idMeson += ((idMeson > 0) ? 2 : -2);
85 void HVStringPT::init(Settings& settings, ParticleData& particleData,
92 double sigmamqv = settings.parm(
"HiddenValley:sigmamqv");
93 double sigma = sigmamqv * particleData.m0( 4900101);
94 sigmaQ = sigma / sqrt(2.);
95 enhancedFraction = 0.;
99 sigma2Had = 2. * pow2( max( SIGMAMIN, sigma) );
111 void HVStringZ::init(Settings& settings, ParticleData& particleData,
118 aLund = settings.parm(
"HiddenValley:aLund");
119 bmqv2 = settings.parm(
"HiddenValley:bmqv2");
120 rFactqv = settings.parm(
"HiddenValley:rFactqv");
123 mqv2 = pow2( particleData.m0( 4900101) );
124 bLund = bmqv2 / mqv2;
127 mhvMeson = particleData.m0( 4900111);
135 double HVStringZ::zFrag(
int ,
int ,
double mT2) {
138 double bShape = bLund * mT2;
139 double cShape = 1. + rFactqv * bmqv2;
140 return zLund( aLund, bShape, cShape);
152 bool HiddenValleyFragmentation::init(Info* infoPtrIn, Settings& settings,
153 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn) {
157 particleDataPtr = particleDataPtrIn;
161 doHVfrag = settings.flag(
"HiddenValley:fragment");
162 if (settings.mode(
"HiddenValley:Ngauge") < 2) doHVfrag =
false;
163 if (!doHVfrag)
return false;
166 nFlav = settings.mode(
"HiddenValley:nFlav");
168 int spinType = particleDataPtr->spinType(4900101);
169 double m0 = particleDataPtr->m0(4900101);
170 for (
int iFlav = 2; iFlav <= nFlav; ++iFlav)
171 particleDataPtr->addParticle( 4900100 + iFlav,
"qv",
"qvbar",
176 mhvMeson = particleDataPtr->m0(4900111);
179 hvEvent.init(
"(Hidden Valley fragmentation)", particleDataPtr);
182 hvFlavSelPtr =
new HVStringFlav();
183 hvFlavSelPtr->init( settings, rndmPtr);
186 hvPTSelPtr =
new HVStringPT();
187 hvPTSelPtr->init( settings, *particleDataPtr, rndmPtr);
190 hvZSelPtr =
new HVStringZ();
191 hvZSelPtr->init( settings, *particleDataPtr, rndmPtr);
194 hvColConfig.init(infoPtr, settings, hvFlavSelPtr);
197 hvStringFrag.init(infoPtr, settings, particleDataPtr, rndmPtr,
198 hvFlavSelPtr, hvPTSelPtr, hvZSelPtr);
199 hvMinistringFrag.init(infoPtr, settings, particleDataPtr, rndmPtr,
200 hvFlavSelPtr, hvPTSelPtr, hvZSelPtr);
211 bool HiddenValleyFragmentation::fragment(
Event& event) {
220 if (!extractHVevent(event))
return true;
223 if (!hvColConfig.insert(ihvParton, hvEvent))
return false;
227 hvColConfig.collect(0, hvEvent,
false);
230 mSys = hvColConfig[0].mass;
233 if (mSys > 3.5 * mhvMeson) {
234 if (!hvStringFrag.fragment( 0, hvColConfig, hvEvent))
return false;
237 }
else if (mSys > 2.1 * mhvMeson) {
238 if (!hvMinistringFrag.fragment( 0, hvColConfig, hvEvent,
true))
242 }
else if (!collapseToMeson())
return false;
245 insertHVevent(event);
256 bool HiddenValleyFragmentation::extractHVevent(
Event& event) {
259 for (
int i = 0; i <
event.size(); ++i) {
260 int idAbs =
event[i].idAbs();
261 bool isHV = (idAbs > 4900000 && idAbs < 4900007)
262 || (idAbs > 4900010 && idAbs < 4900017)
263 || idAbs == 4900021 || idAbs == 4900101;
265 int iHV = hvEvent.append( event[i]);
267 if (event[i].
id() == 4900021) hvEvent[iHV].id(21);
270 hvEvent[iHV].mothers( 0, i);
271 hvEvent[iHV].daughters( 0, 0);
272 int iMother =
event[i].mother1();
273 for (
int iHVM = 1; iHVM < hvEvent.size(); ++iHVM)
274 if (hvEvent[iHVM].mother2() == iMother) {
275 hvEvent[iHV].mother1( iHVM);
276 if (hvEvent[iHVM].daughter1() == 0) hvEvent[iHVM].daughter1(iHV);
277 else hvEvent[iHVM].daughter2(iHV);
283 hvOldSize = hvEvent.size();
284 if (hvOldSize == 1)
return false;
287 int colBeg = hvEvent.nextColTag();
288 for (
int iHV = 1; iHV < hvOldSize; ++iHV)
289 if (hvEvent[iHV].mother1() == 0) {
290 if (hvEvent[iHV].
id() > 0) hvEvent[iHV].col( colBeg);
291 else hvEvent[iHV].acol( colBeg);
295 for (
int iHV = 1; iHV < hvOldSize; ++iHV) {
296 int dau1 = hvEvent[iHV].daughter1();
297 int dau2 = hvEvent[iHV].daughter2();
298 if (dau1 > 0 && dau2 == 0)
299 hvEvent[dau1].cols( hvEvent[iHV].col(), hvEvent[iHV].acol());
301 int colHV = hvEvent[iHV].col();
302 int acolHV = hvEvent[iHV].acol();
303 int colNew = hvEvent.nextColTag();
305 hvEvent[dau1].cols( colNew, 0);
306 hvEvent[dau2].cols( colHV, colNew);
307 }
else if (colHV == 0) {
308 hvEvent[dau1].cols( 0, colNew);
309 hvEvent[dau2].cols( colNew, acolHV);
311 }
else if (rndmPtr->flat() > 0.5) {
312 hvEvent[dau1].cols( colHV, colNew);
313 hvEvent[dau2].cols( colNew, acolHV);
315 hvEvent[dau1].cols( colNew, acolHV);
316 hvEvent[dau2].cols( colHV, colNew);
323 for (
int iHV = 1; iHV < hvOldSize; ++iHV)
324 if (hvEvent[iHV].isFinal() && hvEvent[iHV].acol() == 0) {
325 ihvParton.push_back( iHV);
326 colNow = hvEvent[iHV].col();
331 for (
int iHV = 1; iHV < hvOldSize; ++iHV)
332 if (hvEvent[iHV].isFinal() && hvEvent[iHV].acol() == colNow) {
333 ihvParton.push_back( iHV);
334 colNow = hvEvent[iHV].col();
348 bool HiddenValleyFragmentation::collapseToMeson() {
351 if (mSys < 1.001 * mhvMeson) {
352 infoPtr->errorMsg(
"Error in HiddenValleyFragmentation::collapseToMeson:"
353 " too low mass to do anything");
358 double mhvGlue = (0.001 + 0.998 * rndmPtr->flat()) * (mSys - mhvMeson);
361 double pAbs = 0.5 * sqrtpos( pow2(mSys*mSys - mhvMeson*mhvMeson
362 - mhvGlue*mhvGlue) - pow2(2. * mhvMeson * mhvGlue) ) / mSys;
363 double pz = (2 * rndmPtr->flat() - 1.) * pAbs;
364 double pT = sqrtpos( pAbs*pAbs - pz*pz);
365 double phi = 2. * M_PI * rndmPtr->flat();
366 double px = pT * cos(phi);
367 double py = pT * sin(phi);
370 Vec4 phvMeson( px, py, pz, sqrt(mhvMeson*mhvMeson + pAbs*pAbs) );
371 Vec4 phvGlue( -px, -py, -pz, sqrt(mhvGlue*mhvGlue + pAbs*pAbs) );
372 phvMeson.bst( hvColConfig[0].pSum );
373 phvGlue.bst( hvColConfig[0].pSum );
376 vector<int> iParton = hvColConfig[0].iParton;
377 int iFirst = hvEvent.append( 4900111, 82, iParton.front(),
378 iParton.back(), 0, 0, 0, 0, phvMeson, mhvMeson);
379 int iLast = hvEvent.append( 4900991, 82, iParton.front(),
380 iParton.back(), 0, 0, 0, 0, phvGlue, mhvGlue);
383 for (
int i = 0; i < int(iParton.size()); ++i) {
384 hvEvent[ iParton[i] ].statusNeg();
385 hvEvent[ iParton[i] ].daughters(iFirst, iLast);
397 bool HiddenValleyFragmentation::insertHVevent(
Event& event) {
400 hvNewSize = hvEvent.size();
401 int nOffset =
event.size() - hvOldSize;
404 int iNew, iMot1, iMot2, iDau1, iDau2;
405 for (
int iHV = hvOldSize; iHV < hvNewSize; ++iHV) {
406 iNew =
event.append( hvEvent[iHV]);
409 if (hvEvent[iHV].
id() == 21)
event[iNew].id(4900021);
410 event[iNew].cols( 0, 0);
413 iMot1 = hvEvent[iHV].mother1();
414 iMot2 = hvEvent[iHV].mother2();
415 iDau1 = hvEvent[iHV].daughter1();
416 iDau2 = hvEvent[iHV].daughter2();
419 if (iMot1 > 0 && iMot1 < hvOldSize) {
420 iMot1 = hvEvent[iMot1].mother2();
421 event[iMot1].statusNeg();
422 event[iMot1].daughter1(iNew);
423 }
else if (iMot1 > 0) iMot1 += nOffset;
424 if (iMot2 > 0 && iMot2 < hvOldSize) {
425 iMot2 = hvEvent[iMot2].mother2();
426 event[iMot2].statusNeg();
427 if (event[iMot2].daughter1() == 0)
event[iMot2].daughter1(iNew);
428 else event[iMot2].daughter2(iNew);
429 }
else if (iMot2 > 0) iMot2 += nOffset;
430 if (iDau1 > 0) iDau1 += nOffset;
431 if (iDau2 > 0) iDau2 += nOffset;
432 event[iNew].mothers( iMot1, iMot2);
433 event[iNew].daughters( iDau1, iDau2);