Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:27

0001 #include "Pythia8/Pythia.h"
0002 #include "GeneratorInterface/Pythia8Interface/interface/PTFilterHook.h"
0003 
0004 using namespace Pythia8;
0005 
0006 //--------------------------------------------------------------------------
0007 bool PTFilterHook::initAfterBeams() {
0008   filter_ = settingsPtr->flag("PTFilter:filter");
0009   quark_ = settingsPtr->mode("PTFilter:quarkToFilter");
0010   scale_ = settingsPtr->parm("PTFilter:scaleToFilter");
0011   quarkY_ = settingsPtr->parm("PTFilter:quarkRapidity");
0012   quarkPt_ = settingsPtr->parm("PTFilter:quarkPt");
0013 
0014   return true;
0015 }
0016 
0017 //--------------------------------------------------------------------------
0018 bool PTFilterHook::checkVetoPT(int iPos, const Pythia8::Event& event) {
0019   if (!filter_ || iPos > 3)
0020     return false;
0021   bool foundQuark = false;
0022 
0023   //look for quark
0024   for (int i = 0; i < event.size(); ++i) {
0025     if ((abs(event[i].id()) == quark_) && (abs(event[i].y()) <= quarkY_)) {
0026       if (event[i].pT() >= quarkPt_) {
0027         foundQuark = true;
0028         break;
0029       }
0030     }
0031   }
0032 
0033   if (!foundQuark)
0034     return true;
0035   //all criteria satisfied, don't veto
0036   return false;
0037 }