10 #ifndef Pythia8_History_H
11 #define Pythia8_History_H
13 #include "Pythia8/Basics.h"
14 #include "Pythia8/BeamParticle.h"
15 #include "Pythia8/Event.h"
16 #include "Pythia8/Info.h"
17 #include "Pythia8/ParticleData.h"
18 #include "Pythia8/PartonLevel.h"
19 #include "Pythia8/PythiaStdlib.h"
20 #include "Pythia8/Settings.h"
21 #include "Pythia8/StandardModel.h"
22 #include "Pythia8/WeakShowerMEs.h"
80 Clustering(
const Clustering& inSystem ){
81 emitted = inSystem.emitted;
82 emittor = inSystem.emittor;
83 recoiler = inSystem.recoiler;
84 partner = inSystem.partner;
85 pTscale = inSystem.pTscale;
86 flavRadBef = inSystem.flavRadBef;
87 spinRad = inSystem.spinRad;
88 spinEmt = inSystem.spinEmt;
89 spinRec = inSystem.spinRec;
90 spinRadBef = inSystem.spinRad;
91 radBef = inSystem.radBef;
92 recBef = inSystem.recBef;
96 Clustering(
int emtIn,
int radIn,
int recIn,
int partnerIn,
97 double pTscaleIn,
int flavRadBefIn = 0,
int spinRadIn = 9,
98 int spinEmtIn = 9,
int spinRecIn = 9,
int spinRadBefIn = 9,
99 int radBefIn = 0,
int recBefIn = 0)
100 : emitted(emtIn), emittor(radIn), recoiler(recIn), partner(partnerIn),
101 pTscale(pTscaleIn), flavRadBef(flavRadBefIn), spinRad(spinRadIn),
102 spinEmt(spinEmtIn), spinRec(spinRecIn), spinRadBef(spinRadBefIn),
103 radBef(radBefIn), recBef(recBefIn) {}
106 double pT()
const {
return pTscale; }
147 MergingHooks* mergingHooksPtrIn,
148 BeamParticle beamAIn,
149 BeamParticle beamBIn,
150 ParticleData* particleDataPtrIn,
152 PartonLevel* showersIn,
155 bool isStronglyOrdered,
163 for (
int i = 0, N = children.size(); i < N; ++i )
delete children[i];
167 bool projectOntoDesiredHistories();
179 double weightTREE(PartonLevel* trial, AlphaStrong * asFSR,
180 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN);
185 double weightLOOP(PartonLevel* trial,
double RN);
187 double weightFIRST(PartonLevel* trial, AlphaStrong* asFSR,
188 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN,
193 double weight_UMEPS_TREE(PartonLevel* trial, AlphaStrong * asFSR,
194 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN);
195 double weight_UMEPS_SUBT(PartonLevel* trial, AlphaStrong * asFSR,
196 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN);
200 double weight_UNLOPS_TREE(PartonLevel* trial, AlphaStrong * asFSR,
201 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN,
203 double weight_UNLOPS_SUBT(PartonLevel* trial, AlphaStrong * asFSR,
204 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN,
206 double weight_UNLOPS_LOOP(PartonLevel* trial, AlphaStrong * asFSR,
207 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN,
209 double weight_UNLOPS_SUBTNLO(PartonLevel* trial, AlphaStrong * asFSR,
210 AlphaStrong * asISR, AlphaEM * aemFSR, AlphaEM * aemISR,
double RN,
212 double weight_UNLOPS_CORRECTION(
int order, PartonLevel* trial,
213 AlphaStrong* asFSR, AlphaStrong * asISR, AlphaEM * aemFSR,
214 AlphaEM * aemISR,
double RN, Rndm* rndmPtr );
217 bool foundAllowedHistories() {
218 return (children.size() > 0 && foundAllowedPath); }
220 bool foundOrderedHistories() {
221 return (children.size() > 0 && foundOrderedPath); }
223 bool foundCompleteHistories() {
224 return (children.size() > 0 && foundCompletePath); }
227 void getStartingConditions(
const double RN,
Event& outState );
229 bool getClusteredEvent(
const double RN,
int nSteps,
Event& outState);
231 bool getFirstClusteredEventAboveTMS(
const double RN,
int nDesired,
232 Event& process,
int & nPerformed,
bool updateProcess =
true );
238 Event lowestMultProc(
const double RN) {
240 return (select(RN)->state);
244 double getPDFratio(
int side,
bool forSudakov,
bool useHardPDF,
245 int flavNum,
double xNum,
double muNum,
246 int flavDen,
double xDen,
double muDen);
249 double getWeakProb();
254 double getWeakProb(vector<int>& mode, vector<Vec4>& mom,
255 vector<int> fermionLines);
260 double getSingleWeakProb(vector<int> &mode, vector<Vec4> &mom,
261 vector<int> fermionLines);
267 void findStateTransfer(map<int,int> &transfer);
271 void printHistory(
const double RN );
279 friend class Merging;
285 static const int NTRIAL;
289 void setScalesInHistory();
298 void findPath(vector<int>& out);
318 void setScales( vector<int> index,
bool forward);
327 void scaleCopies(
int iPart,
const Event& refEvent,
double rho);
333 void setEventScales();
337 void printScales() {
if ( mother ) mother->printScales();
338 cout <<
" size " << state.size() <<
" scale " << scale <<
" clusterIn "
339 << clusterIn.pT() <<
" state.scale() " << state.scale() << endl; }
342 bool trimHistories();
344 void remove(){ doInclude =
false; }
346 bool keep(){
return doInclude; }
351 bool isOrderedPath(
double maxscale );
353 bool followsInputPath();
357 bool allIntermediateAboveRhoMS(
double rhoms,
bool good =
true );
359 bool foundAnyOrderedPaths();
385 Event clusteredState(
int nSteps);
391 History * select(
double rnd);
405 double weightTree(PartonLevel* trial,
double as0,
double aem0,
406 double maxscale,
double pdfScale, AlphaStrong * asFSR, AlphaStrong * asISR,
407 AlphaEM * aemFSR, AlphaEM * aemISR,
double& asWeight,
double& aemWeight,
411 double weightTreeALPHAS(
double as0, AlphaStrong * asFSR,
412 AlphaStrong * asISR,
int njetMax = -1 );
414 double weightTreeALPHAEM(
double aem0, AlphaEM * aemFSR,
415 AlphaEM * aemISR,
int njetMax = -1 );
417 double weightTreePDFs(
double maxscale,
double pdfScale,
int njetMax = -1 );
419 double weightTreeEmissions( PartonLevel* trial,
int type,
int njetMin,
420 int njetMax,
double maxscale );
423 double weightFirst(PartonLevel* trial,
double as0,
double muR,
424 double maxscale, AlphaStrong * asFSR, AlphaStrong * asISR, Rndm* rndmPtr );
428 double weightFirstALPHAS(
double as0,
double muR, AlphaStrong * asFSR,
429 AlphaStrong * asISR);
432 double weightFirstALPHAEM(
double aem0,
double muR, AlphaEM * aemFSR,
436 double weightFirstPDFs(
double as0,
double maxscale,
double pdfScale,
440 double weightFirstEmissions(PartonLevel* trial,
double as0,
double maxscale,
441 AlphaStrong * asFSR, AlphaStrong * asISR,
bool fixpdf,
bool fixas );
444 double hardFacScale(
const Event& event);
446 double hardRenScale(
const Event& event);
456 double doTrialShower(PartonLevel* trial,
int type,
double maxscale,
457 double minscale = 0.);
460 bool updateind(vector<int> & ind,
int i,
int N);
463 vector<double> countEmissions(PartonLevel* trial,
double maxscale,
464 double minscale,
int showerType,
double as0, AlphaStrong * asFSR,
465 AlphaStrong * asISR,
int N,
bool fixpdf,
bool fixas);
469 double monteCarloPDFratios(
int flav,
double x,
double maxScale,
470 double minScale,
double pdfScale,
double asME, Rndm* rndmPtr);
475 bool onlyOrderedPaths();
480 bool onlyStronglyOrderedPaths();
485 bool onlyAllowedPaths();
493 bool registerPath(History & l,
bool isOrdered,
bool isStronglyOrdered,
494 bool isAllowed,
bool isComplete);
500 vector<Clustering> getAllQCDClusterings();
505 vector<Clustering> getQCDClusterings(
const Event& event);
516 vector<Clustering> findQCDTriple (
int emtTagIn,
int colTopIn,
517 const Event& event, vector<int> posFinalPartn,
518 vector <int> posInitPartn );
520 vector<Clustering> getAllEWClusterings();
521 vector<Clustering> getEWClusterings(
const Event& event);
522 vector<Clustering> findEWTripleW(
int emtTagIn,
const Event& event,
523 vector<int> posFinalPartn, vector<int> posInitPartn );
524 vector<Clustering> findEWTripleZ(
int emtTagIn,
const Event& event,
525 vector<int> posFinalPartn, vector<int> posInitPartn );
527 vector<Clustering> getAllSQCDClusterings();
528 vector<Clustering> getSQCDClusterings(
const Event& event);
529 vector<Clustering> findSQCDTriple (
int emtTagIn,
int colTopIn,
530 const Event& event, vector<int> posFinalPartn,
531 vector <int> posInitPartn );
534 void attachClusterings (vector<Clustering>& clus,
int iEmt,
int iRad,
535 int iRec,
int iPartner,
double pT,
const Event& event);
541 double getProb(
const Clustering & SystemIn);
556 double pdfForSudakov();
560 double hardProcessME(
const Event& event);
566 Event cluster( Clustering & inSystem);
574 int getRadBeforeFlav(
const int radAfter,
const int emtAfter,
581 int getRadBeforeSpin(
const int radAfter,
const int emtAfter,
582 const int spinRadAfter,
const int spinEmtAfter,
591 int getRadBeforeCol(
const int radAfter,
const int emtAfter,
600 int getRadBeforeAcol(
const int radAfter,
const int emtAfter,
608 int getColPartner(
const int in,
const Event& event);
615 int getAcolPartner(
const int in,
const Event& event);
625 vector<int> getReclusteredPartners(
const int rad,
const int emt,
644 bool getColSinglet(
const int flavType,
const int iParton,
645 const Event& event, vector<int>& exclude,
646 vector<int>& colSinglet);
652 bool isColSinglet(
const Event& event, vector<int> system);
659 bool isFlavSinglet(
const Event& event,
660 vector<int> system,
int flav=0);
671 bool connectRadiator( Particle& radiator,
const int radType,
672 const Particle& recoiler,
const int recType,
673 const Event& event );
689 int FindCol(
int col,
int iExclude1,
int iExclude2,
690 const Event& event,
int type,
bool isHardIn);
698 int FindParticle(
const Particle& particle,
const Event& event,
699 bool checkStatus =
true );
706 bool allowedClustering(
int rad,
int emt,
int rec,
int partner,
707 const Event& event );
714 bool isSinglett(
int rad,
int emt,
int rec,
const Event& event );
722 bool validEvent(
const Event& event );
726 bool equalClustering( Clustering clus1 , Clustering clus2 );
731 double choseHardScale(
const Event& event )
const;
735 int getCurrentFlav(
const int)
const;
739 double getCurrentX(
const int)
const;
741 double getCurrentZ(
const int rad,
const int rec,
const int emt,
742 int idRadBef = 0)
const;
745 double pTLund(
const Event& event,
int radAfterBranch,
int emtAfterBranch,
746 int recAfterBranch,
int showerType,
int idRadBef = 0);
750 int posChangedIncoming(
const Event& event,
bool before);
756 double pdfFactor(
const Event& event,
const int type,
double pdfScale,
762 double integrand(
int flav,
double x,
double scaleInt,
double z);
766 vector<int> posFlavCKM(
int flav);
771 bool checkFlavour(vector<int>& flavCounts,
int flavRad,
int flavRadBef,
775 bool checkWeakRecoils(map<int,int> &allowedRecoils,
bool isFirst =
false);
779 int findISRRecoiler();
784 void reverseBoostISR(Vec4& pMother, Vec4& pSister, Vec4& pPartner,
785 Vec4& pDaughter, Vec4& pRecoiler,
int sign,
double eCM,
double& phi);
789 bool isQCD2to2(
const Event& event);
793 bool isEW2to1(
const Event& event);
796 void setSelectedChild();
799 void setupWeakShower(
int nSteps);
802 void transferWeakShower(vector<int> &mode, vector<Vec4> &mom,
803 vector<int> fermionLines, vector<pair<int,int> > &dipoles,
int nSteps);
806 vector<int> updateWeakModes(vector<int>& weakModes,
807 map<int,int>& stateTransfer);
811 vector<int> updateWeakFermionLines(vector<int> fermionLines,
812 map<int,int>& stateTransfer);
815 vector<pair<int,int> > updateWeakDipoles(vector<pair<int,int> > &dipoles,
816 map<int,int>& stateTransfer);
820 void setupWeakHard(vector<int>& mode, vector<int>& fermionLines,
824 double getShowerPluginScale(
const Event& event,
int rad,
int emt,
int rec,
825 string key,
double scalePythia);
842 vector<History *> children;
850 map<double,History *> paths;
859 map<double,History *> goodBranches, badBranches;
862 double sumGoodBranches, sumBadBranches;
866 bool foundOrderedPath;
870 bool foundStronglyOrderedPath;
874 bool foundAllowedPath;
878 bool foundCompletePath;
894 Clustering clusterIn;
895 int iReclusteredOld, iReclusteredNew;
901 MergingHooks* mergingHooksPtr;
907 History(
const History &) {}
910 History & operator=(
const History &) {
919 ParticleData* particleDataPtr;
925 WeakShowerMEs weakShowerMEs;
928 PartonLevel* showers;
942 #endif // end Pythia8_History_H