ATLAS Offline Software
Loading...
Searching...
No Matches
CheckForFinalPartons.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8StatusCode CheckForFinalPartons::ModifyPythiaEvent(Pythia8::Pythia &pythia) const {
9
10 bool status = true;
11 while( !(acceptEvent(pythia.event) && status) && m_nFailures <= m_maxFailures ){
12 status = pythia.next();
13 ++ m_nFailures;
14 ATH_MSG_WARNING("Event rejected due to unhadronised partons");
15 ATH_MSG_WARNING("Events rejected so far: "<<m_nFailures<< " (limit "<<m_maxFailures<<")");
16 }
17
19 ATH_MSG_ERROR("Too many failures due to unhadronised partons in a single job.");
20 ATH_MSG_ERROR("Maximum allowed failures per job = " << m_maxFailures);
21 return StatusCode::FAILURE;
22 }
23
24 return StatusCode::SUCCESS;
25}
26
27
28bool CheckForFinalPartons::acceptEvent(Pythia8::Event &event) const {
29
30 for(int ii=0; ii != event.size(); ++ii){
31
32 if(!event[ii].isFinal()) continue;
33
34 if(abs(event[ii].id()) < 7 || event[ii].id() == 21 ) return false;
35
36 }
37
38 return true;
39}
40
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
StatusCode ModifyPythiaEvent(Pythia8::Pythia &pythia) const override
bool acceptEvent(Pythia8::Event &event) const
Gaudi::Property< int > m_maxFailures