@@ -35,32 +35,47 @@ class BoxGenerator : public Generator
3535 BoxGenerator () = default ;
3636 BoxGenerator (int pdgid, int mult = 1 );
3737
38+ // / With sampleYAndPt, eta bounds specify rapidity and p bounds specify pT.
3839 BoxGenerator (int pdgid,
3940 int mult,
4041 double etamin,
4142 double etamax,
4243 double pmin,
4344 double pmax,
4445 double phimin,
45- double phimax) : mPDG {pdgid}, mMult {mult}
46+ double phimax,
47+ bool sampleYAndPt = false ) : mPDG {pdgid}, mMult {mult}
4648 {
47- SetEtaRange (etamin, etamax);
48- SetPRange (pmin, pmax);
49+ if (sampleYAndPt) {
50+ SetYRange (etamin, etamax);
51+ SetPtRange (pmin, pmax);
52+ } else {
53+ SetEtaRange (etamin, etamax);
54+ SetPRange (pmin, pmax);
55+ }
4956 SetPhiRange (phimin, phimax);
5057 }
5158
52- BoxGenerator (BoxGenConfig const & config) : mPDG {config.pdg }, mMult {config.number }
59+ BoxGenerator (BoxGenConfig const & config)
60+ : BoxGenerator(config.pdg, config.number, config.eta[0 ], config.eta[1 ],
61+ config.prange[0 ], config.prange[1 ], config.phirange[0 ], config.phirange[1 ], config.sampleYAndPt)
5362 {
54- SetEtaRange (config.eta [0 ], config.eta [1 ]);
55- SetPRange (config.prange [0 ], config.prange [1 ]);
56- SetPhiRange (config.phirange [0 ], config.phirange [1 ]);
5763 }
5864
5965 void SetPRange (Double32_t pmin = 0 , Double32_t pmax = 10 )
6066 {
6167 mPMin = pmin;
6268 mPMax = pmax;
6369 mPRangeIsSet = true ;
70+ mPtRangeIsSet = false ;
71+ }
72+
73+ void SetPtRange (Double32_t ptmin = 0 , Double32_t ptmax = 10 )
74+ {
75+ mPtMin = ptmin;
76+ mPtMax = ptmax;
77+ mPtRangeIsSet = true ;
78+ mPRangeIsSet = false ;
6479 }
6580
6681 void SetPhiRange (double phimin = 0 , double phimax = 360 )
@@ -74,6 +89,16 @@ class BoxGenerator : public Generator
7489 mEtaMin = etamin;
7590 mEtaMax = etamax;
7691 mEtaRangeIsSet = true ;
92+ mYRangeIsSet = false ;
93+ }
94+
95+ // / Sample rapidity uniformly; requires a transverse momentum range.
96+ void SetYRange (double ymin = -5 , double ymax = 5 )
97+ {
98+ mYMin = ymin;
99+ mYMax = ymax;
100+ mYRangeIsSet = true ;
101+ mEtaRangeIsSet = false ;
77102 }
78103
79104 // / generates a single particle conforming to particle gun parameters
0 commit comments