|
[Rivet-svn] rivet: 2 new changesetsRivet Mercurial rivet at projects.hepforge.orgWed Aug 3 11:30:02 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/c8cdf9422416 branches: release-2-5-x changeset: 5375:c8cdf9422416 user: Andy Buckley <andy at insectnation.org> date: Wed Aug 03 11:21:58 2016 +0100 description: Add a standard mass-smearing function details: https://rivet.hepforge.org/hg/rivet/rev/d7cbff5e1876 branches: release-2-5-x changeset: 5376:d7cbff5e1876 user: Andy Buckley <andy at insectnation.org> date: Wed Aug 03 11:25:31 2016 +0100 description: Add documentation for primitive smearing functions diffs (truncated from 60 to 50 lines): --- a/include/Rivet/Tools/SmearingFunctions.hh Tue Aug 02 19:45:36 2016 +0100 +++ b/include/Rivet/Tools/SmearingFunctions.hh Wed Aug 03 11:25:31 2016 +0100 @@ -23,16 +23,22 @@ /// @name General particle & momentum efficiency and smearing functions //@{ + /// Take a Particle and return 0 inline double PARTICLE_FN0(const Particle& p) { return 0; } + /// Take a Particle and return 1 inline double PARTICLE_FN1(const Particle& p) { return 1; } + /// Take a Particle and return it unmodified inline Particle PARTICLE_SMEAR_IDENTITY(const Particle& p) { return p; } + /// Take a FourMomentum and return 0 inline double P4_FN0(const FourMomentum& p) { return 0; } + /// Take a FourMomentum and return 1 inline double P4_FN1(const FourMomentum& p) { return 1; } - + /// Take a FourMomentum and return it unmodified inline FourMomentum P4_SMEAR_IDENTITY(const FourMomentum& p) { return p; } + /// Smear a FourMomentum's energy using a Gaussian of absolute width @a resolution /// @todo Also make jet versions that update/smear constituents? inline FourMomentum P4_SMEAR_E_GAUSS(const FourMomentum& p, double resolution) { /// @todo Need to isolate random generators to a single thread @@ -44,6 +50,7 @@ return FourMomentum::mkEtaPhiME(p.eta(), p.phi(), mass, smeared_E); } + /// Smear a FourMomentum's transverse momentum using a Gaussian of absolute width @a resolution inline FourMomentum P4_SMEAR_PT_GAUSS(const FourMomentum& p, double resolution) { /// @todo Need to isolate random generators to a single thread static random_device rd; @@ -54,11 +61,25 @@ return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), mass, smeared_pt); } + /// Smear a FourMomentum's mass using a Gaussian of absolute width @a resolution + inline FourMomentum P4_SMEAR_MASS_GAUSS(const FourMomentum& p, double resolution) { + /// @todo Need to isolate random generators to a single thread + static random_device rd; + static mt19937 gen(rd()); + normal_distribution<> d(p.mass(), resolution); + const double smeared_mass = max(d(gen), 0.); + return FourMomentum::mkEtaPhiMPt(p.eta(), p.phi(), smeared_mass, p.pT()); + } + + /// Take a Vector3 and return 0
More information about the Rivet-svn mailing list |