ATLAS Offline Software
PoWHEGVetoedShower.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "UserHooksUtils.h"
7 #include <stdexcept>
8 #include <iostream>
9 
10 namespace Pythia8{
11  class PoWHEGVetoedShower;
12 }
13 
15 
16 namespace Pythia8{
17 
34  class PoWHEGVetoedShower : public UserHooks{
35 
36  public:
37 
39 
40  std::cout<<"*******************************************************************"<<std::endl;
41  std::cout<<"* *"<<std::endl;
42  std::cout<<"* Using new PoWHEG author scale definition for QCD production! *"<<std::endl;
43  std::cout<<"* *"<<std::endl;
44  std::cout<<"*******************************************************************"<<std::endl;
45 
46  }
47 
49 
56  bool doVetoMPIStep(int nMPI, const Event &evt){
57 
58  // Only do anything on the first call.
59  if(nMPI > 1) return false;
60 
61  m_powhegScale = infoPtr->QRen();;
62 
63  // momentum components to boost to CMS frame
64  double pxCMS = 0.;
65  double pyCMS = 0.;
66  double pzCMS = 0.;
67  double eCMS = 0.;
68 
69  std::vector<Particle> powhegLegs;
70 
71  // Find the entries corresponding to outgoing legs from PoWHEG
72  // start the loop at 1, since entry 0 represents the event as a whole
73  for(int ii=1; ii != evt.size(); ++ii){
74 
75  // status -21 is the incoming hard partons
76  if(evt[ii].status() == -21){
77  pxCMS += evt[ii].px();
78  pyCMS += evt[ii].py();
79  pzCMS += evt[ii].pz();
80  eCMS += evt[ii].e();
81  }
82 
83  // here Event::isFinal refers to whether the particle can still decay/radiate, or whether it is an internal leg
84  if(evt[ii].isFinal()){
85  powhegLegs.push_back(Particle(evt[ii]));
86  }
87  }
88 
89  // compare the pT of each leg to the powheg scale.
90  // Set the scale to the lowest (or leave the scale unchanged if it is already lower)
91  for(std::vector<Particle>::const_iterator leg=powhegLegs.begin();
92  leg != powhegLegs.end(); ++leg){
93  if(leg->pT() < m_powhegScale )m_powhegScale = leg->pT();
94  }
95 
96  double norm = -1./eCMS;
97  pxCMS *= norm;
98  pyCMS *= norm;
99  pzCMS *= norm;
100 
101  // boost all outgoing legs to the CMS frame
102  for(std::vector<Particle>::iterator leg=powhegLegs.begin();
103  leg != powhegLegs.end(); ++leg){
104  leg->bst(pxCMS, pyCMS, pzCMS);
105  }
106 
107  for(std::vector<Particle>::const_iterator leg=powhegLegs.begin();
108  leg != powhegLegs.end(); ++leg){
109 
110  if(leg->pT() < m_powhegScale )m_powhegScale = leg->pT();
111 
112  // calculate the pT relative to each other leg
113  // if any such pT is lower than the current scale, reset the scale to that value
114  for(std::vector<Particle>::const_iterator otherLeg = powhegLegs.begin();
115  otherLeg != powhegLegs.end(); ++otherLeg){
116  if(otherLeg == leg) continue;
117 
118  double pTLeg = Pythia8_UserHooks::pTLeg(*leg, *otherLeg);
119 
121  }
122  }
123 
124 // std::cout<<m_powhegScale<<" "<<infoPtr->QRen()<<std::endl;
125 
126 
127  return false;
128  }
129 
136  bool doVetoISREmission(int, const Event &evt, int iSys){
137 
138  // only veto emissions from the hard system
139  if(iSys != 0) return false;
140 
141  size_t emission = Pythia8_UserHooks::findLastISREmission(evt);
142 
143  // Veto emission above the veto scale
144  if(evt[emission].pT() > m_powhegScale) return true;
145 
146  return false;
147  }
152  bool doVetoFSREmission(int, const Event &evt, int iSys, bool){
153 
154  // only veto emissions from the hard system
155  if(iSys != 0) return false;
156 
157  size_t emission = Pythia8_UserHooks::findLastFSREmission(evt);
158 
159  // Veto if above the POWHEG scale
160  if (evt[emission].pT() > m_powhegScale) return true;
161 
162  return false;
163  }
164 
166  bool canVetoMPIStep(){return true;}
168  int numberVetoMPIStep(){return 1;}
170  bool canVetoISREmission(){return true;}
172  bool canVetoFSREmission(){return true;}
173 
174  private:
175 
177 
178  };
179 }
180 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Pythia8::PoWHEGVetoedShower::canVetoMPIStep
bool canVetoMPIStep()
Switch on calling of doVetoMPIStep.
Definition: PoWHEGVetoedShower.cxx:166
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
Pythia8::PoWHEGVetoedShower::doVetoMPIStep
bool doVetoMPIStep(int nMPI, const Event &evt)
doVetoMPIStep is called immediately after the MPI generation In this case it never actually vetoes th...
Definition: PoWHEGVetoedShower.cxx:56
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
Event
Definition: trigbs_orderedMerge.cxx:42
Pythia8::PoWHEGVetoedShower::m_powhegScale
double m_powhegScale
Definition: PoWHEGVetoedShower.cxx:176
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
Pythia8_UserHooks::UserHooksFactory::Creator
Definition: UserHooksFactory.h:54
Pythia8::PoWHEGVetoedShower::canVetoISREmission
bool canVetoISREmission()
Switch on veto of ISR.
Definition: PoWHEGVetoedShower.cxx:170
xAOD::Particle
Particle_v1 Particle
Define the latest version of the particle class.
Definition: Event/xAOD/xAODParticleEvent/xAODParticleEvent/Particle.h:17
powhegVetoedShowerCreator
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::PoWHEGVetoedShower > powhegVetoedShowerCreator("PoWHEGVetoedShower")
UserHooksFactory.h
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
Pythia8::PoWHEGVetoedShower::doVetoISREmission
bool doVetoISREmission(int, const Event &evt, int iSys)
This is called after the generation of each new ISR emission Can use it to test if the last generated...
Definition: PoWHEGVetoedShower.cxx:136
compute_lumi.leg
leg
Definition: compute_lumi.py:95
Pythia8::PoWHEGVetoedShower::numberVetoMPIStep
int numberVetoMPIStep()
Call doVetoMIStep once.
Definition: PoWHEGVetoedShower.cxx:168
Pythia8_UserHooks::pTLeg
double pTLeg(const Pythia8::Particle &leg, const Pythia8::Particle &comparison)
Definition: UserHooksUtils.h:50
Pythia8::PoWHEGVetoedShower
This UserHook should be used when showering QCD jets generated with PoWHEG-box.
Definition: PoWHEGVetoedShower.cxx:34
Pythia8_UserHooks::findLastISREmission
size_t findLastISREmission(const Pythia8::Event &evt)
Definition: UserHooksUtils.h:80
Pythia8::PoWHEGVetoedShower::~PoWHEGVetoedShower
~PoWHEGVetoedShower()
Definition: PoWHEGVetoedShower.cxx:48
Pythia8::PoWHEGVetoedShower::doVetoFSREmission
bool doVetoFSREmission(int, const Event &evt, int iSys, bool)
This is similar to the ISR veto.
Definition: PoWHEGVetoedShower.cxx:152
UserHooksUtils.h
Pythia8::PoWHEGVetoedShower::PoWHEGVetoedShower
PoWHEGVetoedShower()
Definition: PoWHEGVetoedShower.cxx:38
Pythia8::PoWHEGVetoedShower::canVetoFSREmission
bool canVetoFSREmission()
Switch off veto of FSR.
Definition: PoWHEGVetoedShower.cxx:172
merge.status
status
Definition: merge.py:17
Pythia8_UserHooks::findLastFSREmission
size_t findLastFSREmission(const Pythia8::Event &evt)
Definition: UserHooksUtils.h:89