ATLAS Offline Software
WprimeWZFlat.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
5 #include "Pythia8/PhaseSpace.h"
6 
7 #include "UserSetting.h"
8 
9 namespace Pythia8{
10  class WprimeWZFlat;
11 }
12 
14 
15 namespace Pythia8 {
16 
17  class WprimeWZFlat : public UserHooks {
18 
19  public:
20 
21  // Constructor.
23 
24  // Destructor.
26 
27  // Allow process cross section to be modified...
28  virtual bool canModifySigma() {return true;}
29 
30  // ...which gives access to the event at the trial level, before selection.
31  virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
32  const PhaseSpace* phaseSpacePtr,
33  bool /* inEvent */) {
34  // All events should be 2 -> 1, but kill them if not.
35  if (sigmaProcessPtr->nFinal() != 1) return 0.;
36 
37  // Weight cross section with BW propagator, i.e. to remove it.
38  // (inEvent = false for initialization).
39  // No inEvent criteria, want weight both for cross section
40  // and MC generation.
41  int idRes = sigmaProcessPtr->resonanceA();
42  double mRes = particleDataPtr->m0(idRes);
43  double wRes = particleDataPtr->mWidth(idRes);
44  double m2Res = mRes*mRes;
45  double gamMRat = wRes/mRes;
46  double sHat = phaseSpacePtr->sHat();
47  double weightBW = m2Res*m2Res + sHat*sHat*(1 + gamMRat*gamMRat) - 2.*sHat*m2Res;
48  double rH = std::sqrt(sHat);
49 
50  return (m_flattenPT(settingsPtr)) ? weightBW * pTWeight(rH) : weightBW * breitWignerDenom(rH/settingsPtr->parm("Beams:eCM"));
51  }
52 
53  private:
54 
55  double breitWignerDenom(double mFrac){
56 
57  if(mFrac < 0.025) return breitWignerDenom(0.025);
58  if(mFrac > 0.6) return breitWignerDenom(0.6);
59 
60  if(mFrac < 0.0425) return 1e-12/(-1.293+1.098e+2*mFrac-2.800e+3*mFrac*mFrac+2.345e+4*mFrac*mFrac*mFrac);
61  if(mFrac < 0.073) return 1.248e-12*(std::exp(1.158+18.34*mFrac));
62 
63  return 5.733e-10*std::pow(mFrac,-3.798-0.6555*std::log(mFrac))/std::pow(1.427-mFrac,30.017);
64  }
65 
66  double pTWeight(double rH){
67 
68  double pe0 = 9.705/2000.;
69  double pe1 = -1.27668e-03;
70 
71  double weightHighpT =1./(std::exp(pe0+pe1*rH));
72 
73  double p0 = 0.00405295;
74  double p1 = -1.15389e-06;
75  double p2 = -8.83305e-10;
76  double p3 = 1.02983e-12;
77  double p4 = -3.64486e-16;
78  double p5 = 6.05783e-20;
79  double p6 = -4.74988e-24;
80  double p7 = 1.40627e-28;
81  double weightFinal = (p0+(p1*rH)+(p2*std::pow(rH,2))+(p3*std::pow(rH,3))+(p4*std::pow(rH,4))+(p5*std::pow(rH,5))+(p6*std::pow(rH,6))+(p7*std::pow(rH,7)));
82 
83  if(rH < 400.) weightFinal *= 0.5;
84 
85  return weightHighpT * weightFinal;
86  }
87 
88  // This switch says whether to use the old style flattening of the Breit Wigner, or additionally flatten the PT spectrum.
89  // Off by default, for consistency with old production jobs
91 
92  };
93 
94 } // end namespace Pythia8
95 
96 
Pythia8::WprimeWZFlat::pTWeight
double pTWeight(double rH)
Definition: WprimeWZFlat.cxx:66
Pythia8::WprimeWZFlat::breitWignerDenom
double breitWignerDenom(double mFrac)
Definition: WprimeWZFlat.cxx:55
Pythia8::WprimeWZFlat::multiplySigmaBy
virtual double multiplySigmaBy(const SigmaProcess *sigmaProcessPtr, const PhaseSpace *phaseSpacePtr, bool)
Definition: WprimeWZFlat.cxx:31
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Pythia8::WprimeWZFlat::WprimeWZFlat
WprimeWZFlat()
Definition: WprimeWZFlat.cxx:22
Pythia8_UserHooks::UserHooksFactory::Creator
Definition: UserHooksFactory.h:54
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
UserHooksFactory.h
ParticleJetTools::p3
Amg::Vector3D p3(const xAOD::TruthVertex *p)
Definition: ParticleJetLabelCommon.cxx:55
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
Pythia8_UserHooks::UserSetting< int >
WprimeWZFlatCreator
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::WprimeWZFlat > WprimeWZFlatCreator("WprimeWZFlat")
UserSetting.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Pythia8::WprimeWZFlat
Definition: WprimeWZFlat.cxx:17
Pythia8::WprimeWZFlat::canModifySigma
virtual bool canModifySigma()
Definition: WprimeWZFlat.cxx:28
Pythia8::WprimeWZFlat::m_flattenPT
Pythia8_UserHooks::UserSetting< int > m_flattenPT
Definition: WprimeWZFlat.cxx:90
Pythia8::WprimeWZFlat::~WprimeWZFlat
~WprimeWZFlat()
Definition: WprimeWZFlat.cxx:25