11/// \author R+Preghenella - July 2020
22
33/// This Pythia8 UserHooks can veto the processing at parton level.
4- /// The partonic event is scanned searching for a c-cbar mother
4+ /// The partonic event is scanned searching for a q-qbar mother
55/// with at least one of the c quarks produced withing a fiducial
66/// window around midrapidity that can be specified by the user.
77
88#include "Pythia8/Pythia.h"
99
10- class UserHooks_ccbar : public Pythia8 ::UserHooks
10+ class UserHooks_qqbar : public Pythia8 ::UserHooks
1111{
1212
1313 public :
14- UserHooks_ccbar () = default ;
15- ~UserHooks_ccbar () = default ;
14+ UserHooks_qqbar () = default ;
15+ ~UserHooks_qqbar () = default ;
1616 bool canVetoPartonLevel () override { return true; };
1717 bool doVetoPartonLevel (const Pythia8 ::Event & event ) override {
1818 // search for c-cbar mother with at least one c at midrapidity
1919 for (int ipa = 0 ; ipa < event .size (); ++ ipa ) {
2020 auto daughterList = event [ipa ].daughterList ();
2121 bool hasc = false, hascbar = false, atmidy = false;
2222 for (auto ida : daughterList ) {
23- if (event [ida ].id () == 4 ) hasc = true;
24- if (event [ida ].id () == -4 ) hascbar = true;
23+ if (event [ida ].id () == mPDG ) hasc = true;
24+ if (event [ida ].id () == - mPDG ) hascbar = true;
2525 if (fabs (event [ida ].y ()) < mRapidity ) atmidy = true;
2626 }
2727 if (hasc && hascbar && atmidy )
@@ -30,18 +30,31 @@ class UserHooks_ccbar : public Pythia8::UserHooks
3030 return true; // did not find it, veto event
3131 };
3232
33+ void setPDG (int val ) { mPDG = val ; };
3334 void setRapidity (double val ) { mRapidity = val ; };
3435
3536private :
3637
38+ int mPDG = 4 ;
3739 double mRapidity = 1.5 ;
3840
3941};
4042
4143Pythia8 ::UserHooks *
4244 pythia8_userhooks_ccbar (double rapidity = 1.5 )
4345{
44- auto hooks = new UserHooks_ccbar ();
46+ auto hooks = new UserHooks_qqbar ();
47+ hooks -> setPDG (4 );
4548 hooks -> setRapidity (rapidity );
4649 return hooks ;
4750}
51+
52+ Pythia8 ::UserHooks *
53+ pythia8_userhooks_bbbar (double rapidity = 1.5 )
54+ {
55+ auto hooks = new UserHooks_qqbar ();
56+ hooks -> setPDG (5 );
57+ hooks -> setRapidity (rapidity );
58+ return hooks ;
59+ }
60+
0 commit comments