ATLAS Offline Software
mHatReweight.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 mHatReweight;
13 }
14 
16 
17 namespace Pythia8 {
18 
19  class mHatReweight : public UserHooks {
20 
21  public:
22 
23  // Constructor
25  : m_slope("mHatReweight:Slope", 1)
26  , m_mHatConstMin("mHatReweight:mHatConstMin", 1500)
27  , m_p1("mHatReweight:p1", -3.872)
28  , m_p2("mHatReweight:p2", 15.606)
29  {
30  std::cout<<"*************************************************************"<<std::endl;
31  std::cout<<"* *"<<std::endl;
32  std::cout<<"* Populating high-mass events with mHatReweight UserHook! *"<<std::endl;
33  std::cout<<"* *"<<std::endl;
34  std::cout<<"*************************************************************"<<std::endl;
35  }
36 
37  // Allow process cross section to be modified...
38  virtual bool canModifySigma() {return true;}
39 
40  // ...which gives access to the event at the trial level, before selection.
41  virtual double multiplySigmaBy(const SigmaProcess* sigmaProcessPtr,
42  const PhaseSpace* phaseSpacePtr,
43  bool /* inEvent */) {
44  // All events should be 2 -> 1, but kill them if not.
45  if (sigmaProcessPtr->nFinal() != 1) return 0.;
46  // config
47  double slope = m_slope(settingsPtr);
48  double mHatConstMin = m_mHatConstMin(settingsPtr);
49  double p1 = m_p1(settingsPtr);
50  double p2 = m_p2(settingsPtr);
51  // event kinematics
52  double mHat = std::sqrt(phaseSpacePtr->sHat());
53  double ecm = phaseSpacePtr->ecm();
54 
55  // scale factor
56  double scale = 0.0;
57  // low-mass slope modification
58  if( mHat < mHatConstMin ){
59  scale = std::pow(mHat/ecm, slope);
60  }
61  // const high-mass
62  else {
63  double xsec = std::pow(mHat/ecm, p1) * std::pow(1 - mHat/ecm, p2);
64  double xsecMin = std::pow(mHatConstMin/ecm, p1) * std::pow(1 - mHatConstMin/ecm, p2);
65  scale = std::pow(mHatConstMin/ecm, slope) * xsecMin / xsec;
66  }
67  return scale;
68  }
69 
70  private:
71  // User-settable slope for power-law scaling (s^m)
76  };
77 
78 } // end namespace Pythia8
79 
80 
mHatReweightCreator
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::mHatReweight > mHatReweightCreator("mHatReweight")
Pythia8::mHatReweight::mHatReweight
mHatReweight()
Definition: mHatReweight.cxx:24
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
Pythia8_UserHooks::UserHooksFactory::Creator
Definition: UserHooksFactory.h:54
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
UserHooksFactory.h
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
Pythia8_UserHooks::UserSetting< double >
Pythia8::mHatReweight::m_p2
Pythia8_UserHooks::UserSetting< double > m_p2
Definition: mHatReweight.cxx:75
UserSetting.h
Pythia8::mHatReweight::canModifySigma
virtual bool canModifySigma()
Definition: mHatReweight.cxx:38
Pythia8::mHatReweight::multiplySigmaBy
virtual double multiplySigmaBy(const SigmaProcess *sigmaProcessPtr, const PhaseSpace *phaseSpacePtr, bool)
Definition: mHatReweight.cxx:41
Pythia8::mHatReweight::m_p1
Pythia8_UserHooks::UserSetting< double > m_p1
Definition: mHatReweight.cxx:74
GetAllXsec.xsec
xsec
Definition: GetAllXsec.py:85
Pythia8::mHatReweight::m_mHatConstMin
Pythia8_UserHooks::UserSetting< double > m_mHatConstMin
Definition: mHatReweight.cxx:73
Pythia8::mHatReweight
Definition: mHatReweight.cxx:19
Pythia8::mHatReweight::m_slope
Pythia8_UserHooks::UserSetting< double > m_slope
Definition: mHatReweight.cxx:72