ATLAS Offline Software
GravFlat.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "UserSetting.h"
7 #include "Pythia8/PhaseSpace.h"
8 
9 #include <stdexcept>
10 
11 namespace Pythia8 {
12  class GravFlat;
13 }
14 
16 
17 
18 namespace Pythia8 {
19 
20 
21  class GravFlat : public UserHooks {
22  public:
23 
24  // Constructor.
26  : m_energyMode("GravFlat:EnergyMode", 8),
27  m_flatpT("GravFlat:FlatPt", false)
28  { }
29 
30  // Destructor.
31  //~GravFlat() { }
32 
33  // Allow process cross section to be modified...
34  virtual bool canModifySigma() { return true; }
35 
36  // ...which gives access to the event at the trial level, before selection.
37  virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr, const PhaseSpace* phaseSpacePtr, bool /* inEvent */) {
38 
39  // All events should be 2 -> 1, but kill them if not.
40  if (sigmaProcessPtr->nFinal() != 1) return 0.;
41 
42  // Weight cross section with BW propagator, i.e. to remove it.
43  // (inEvent = false for initialization).
44  // No inEvent criteria, want weight both for cross section
45  // and MC generation.
46  const int idRes = sigmaProcessPtr->resonanceA();
47  const double mRes = particleDataPtr->m0(idRes);
48  const double wRes = particleDataPtr->mWidth(idRes);
49  const double m2Res = mRes*mRes;
50  const double GamMRat = wRes/mRes;
51  const double sHat = phaseSpacePtr->sHat();
52  const double rH = std::sqrt(sHat);
53  const double weightBW = pow2(sHat - m2Res) + pow2(sHat * GamMRat);
54 
55  // Calculate weight depending on energy mode, sHat, and flat-pT mode
56  double weight = 1;
57  double weightPL = 1;
58  double weightpT_G = 1;
59 
60  const int emode = m_energyMode(settingsPtr);
61  switch (emode) {
62  case 8:
63 
64  if (rH < 50) {
65  // do nothing
66  }
67  else if (rH < 2000) {
68  // Completely Flat M=2 TeV, Above 0.05 TeV, Below 2 TeV
69  // 1e5
70  const double p0 = 12.4176;
71  const double p1 = -0.364611;
72  const double p2 = 0.00293827;
73  const double p3 = 4.3106e-07;
74  const double p4 = -2.61662e-09;
75  const double p5 = 1.33037e-12;
76  const double p6 = -2.07848e-16;
77  weightPL = 1/(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)));
78  }
79  else if (rH < 4000) {
80  // Completely Flat M=2 TeV, Above 2 TeV, Below 4 TeV
81  // 1e5
82  const double p0 = 41237.9;
83  const double p1 = -95.9745;
84  const double p2 = 0.0979667;
85  const double p3 = -5.14644e-05;
86  const double p4 = 1.45857e-08;
87  const double p5 = -2.13169e-12;
88  const double p6 = 1.26473e-16;
89  weightPL = 1/(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)));
90  }
91  else if (rH < 5500) {
92  // Completely Flat M=2 TeV, Above 4 TeV, Below 5.5 TeV
93  // 1e5
94  const double p0 = 1.11676e+06;
95  const double p1 = -925.647;
96  const double p2 = 0.311595;
97  const double p3 = -5.38465e-05;
98  const double p4 = 4.92286e-09;
99  const double p5 = -2.1452e-13;
100  const double p6 = 2.97112e-18;
101  weightPL = 1/(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)));
102  }
103  else if (rH <= 6500) {
104  // Completely Flat M=2 TeV, Above 5.5 TeV, Below 6.5 TeV
105  // 1e5
106  const double p0 = 9.70964e+13;
107  const double p1 = -4.17142e-03;
108  const double p2 = -3.06415e-03;
109  weightPL = 1/((p0*std::exp(p1*rH))+(p2*rH));
110  }
111  weight = weightBW * weightPL;
112  break;
113 
114 
115  case 13:
116 
117  if (m_flatpT(settingsPtr)) {// in flat mode
118 
119  if (rH < 4000) {
120  const double p0 = 0.00384785;
121  const double p1 = -1.72701e-05;
122  const double p2 = 2.25365e-08;
123  const double p3 = -6.15774e-12;
124  const double p4 = 4.85585e-16;
125  weightpT_G = 1/(p0+p1*std::pow(rH,1)+p2*std::pow(rH,2)+p3*std::pow(rH,3)+p4*std::pow(rH,4));
126  }
127  else if (rH < 6000) {
128  const double p10 = 0.00659488 ;
129  const double p11 = 2.68603e-05;
130  const double p12 = -7.80009e-09;
131  const double p13 = 5.54463e-13;
132  weightpT_G = 1/(p10+p11*std::pow(rH,1)+p12*std::pow(rH,2)+p13*std::pow(rH,3));
133  }
134  else if (rH < 13000) {
135  weightpT_G = 1./exp(2.14289e+00 - 1.17687e-03*rH);
136  } else {
137  weightpT_G = 0;
138  }
139  weight = weightpT_G * (1 + rH/13000.);
140 
141  } else { // not in flat mode
142 
143  if (rH < 50) {
144  // do nothing
145  } else if (rH < 2500) {
146  // Completely flat M=5 TeV, k/M=0.1; above 0.05 TeV, below 2.5 TeV
147  // 8e5
148  const double
149  p0 = 1.06963e+01,
150  p1 = -1.86534e-01,
151  p2 = 9.00278e-04,
152  p3 = 1.01576e-06,
153  p4 = -1.29332e-09,
154  p5 = 4.64752e-13,
155  p6 = -5.68297e-17;
156  weightPL = 1./(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)));
157  }
158  else if (rH < 6000) {
159  // Completely flat M=5 TeV, k/M=0.1; above 2.5 TeV, below 6.0 TeV
160  // 8e5
161  const double
162  p0 = -1.77843e+03,
163  p1 = 3.70114e+00,
164  p2 = -1.06644e-03,
165  p3 = 3.77245e-08,
166  p4 = 2.49922e-11,
167  p5 = -3.96985e-15,
168  p6 = 1.88504e-19;
169  weightPL = 1/(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)));
170  }
171  else if (rH < 8000) {
172  // Completely flat M=5 TeV, k/M=0.1; above 6.0 TeV, below 8.0 TeV
173  // 8e5
174  const double
175  p0 = 1.43663e+03,
176  p1 = 3.40467e-01,
177  p2 = -7.44453e-05,
178  p3 = -1.08578e-08,
179  p4 = 6.74486e-13,
180  p5 = 2.82952e-16,
181  p6 = -2.20149e-20;
182  weightPL = 1/(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)));
183  }
184  else if (rH <= 10500) {
185  // Completely flat M=5 TeV, k/M=0.1; above 8.0 TeV, below 10.5 TeV
186  // 8e5
187  const double
188  p0 = 1.21245e+03,
189  p1 = -1.08389e-01,
190  p2 = -1.02834e-05,
191  p3 = 4.11376e-12,
192  p4 = 8.55312e-14,
193  p5 = 6.98307e-18,
194  p6 = -6.52683e-22;
195  weightPL = 1/(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)));
196  }
197  weight = weightBW * weightPL;
198  }
199  break;
200 
201 
202  default:
203  throw std::runtime_error("Unknown GravFlat:EnergyMode = " + std::to_string(emode) + " (should be either 8 or 13!)");
204  }
205 
206  return weight;
207  }
208 
209 
210  private:
211 
216 
217  };
218 
219 
220 } // end namespace Pythia8
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Pythia8_UserHooks::UserHooksFactory::Creator
Definition: UserHooksFactory.h:54
Pythia8::GravFlat::m_flatpT
Pythia8_UserHooks::UserSetting< bool > m_flatpT
User-settable flag to get a flat pT distribution.
Definition: GravFlat.cxx:215
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Pythia8::GravFlat::m_energyMode
Pythia8_UserHooks::UserSetting< int > m_energyMode
User-settable mode to set the collision energy (default is 8)
Definition: GravFlat.cxx:213
UserHooksFactory.h
ParticleJetTools::p3
Amg::Vector3D p3(const xAOD::TruthVertex *p)
Definition: ParticleJetLabelCommon.cxx:55
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
Pythia8_UserHooks::UserSetting< int >
Pythia8::GravFlat::GravFlat
GravFlat()
Definition: GravFlat.cxx:25
gravFlatCreator
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::GravFlat > gravFlatCreator("GravFlat")
UserSetting.h
Pythia8::GravFlat::multiplySigmaBy
virtual double multiplySigmaBy(const SigmaProcess *sigmaProcessPtr, const PhaseSpace *phaseSpacePtr, bool)
Definition: GravFlat.cxx:37
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Pythia8::GravFlat
Definition: GravFlat.cxx:21
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Pythia8::GravFlat::canModifySigma
virtual bool canModifySigma()
Definition: GravFlat.cxx:34