ATLAS Offline Software
CheckForFinalPartons.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CheckForFinalPartons.h"
6 
7 CheckForFinalPartons::CheckForFinalPartons(const std::string &type, const std::string &name, const IInterface *parent):
8 AthAlgTool(type, name, parent), m_nFailures(0){
9  declareInterface<IPythia8Custom>(this);
10  declareProperty("MaxFailures", m_maxFailures=5);
11 }
12 
13 
15 
16  bool status = true;
17  while( !(acceptEvent(pythia.event) && status) && m_nFailures <= m_maxFailures ){
18  status = pythia.next();
19  ++ m_nFailures;
20  ATH_MSG_WARNING("Event rejected due to unhadronised partons");
21  ATH_MSG_WARNING("Events rejected so far: "<<m_nFailures<< " (limit "<<m_maxFailures<<")");
22  }
23 
25  ATH_MSG_ERROR("Too many failures due to unhadronised partons in a single job.");
26  ATH_MSG_ERROR("Maximum allowed failures per job = " << m_maxFailures);
27  return StatusCode::FAILURE;
28  }
29 
30  return StatusCode::SUCCESS;
31 }
32 
33 
35 
36  for(int ii=0; ii != event.size(); ++ii){
37 
38  if(!event[ii].isFinal()) continue;
39 
40  if(abs(event[ii].id()) < 7 || event[ii].id() == 21 ) return false;
41 
42  }
43 
44  return true;
45 }
46 
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CheckForFinalPartons::ModifyPythiaEvent
StatusCode ModifyPythiaEvent(Pythia8::Pythia &pythia) const override
Update the pythia event.
Definition: CheckForFinalPartons.cxx:14
JiveXML::Event
struct Event_t Event
Definition: ONCRPCServer.h:65
bTosllAli.Pythia
Pythia
Definition: bTosllAli.py:46
CheckForFinalPartons::acceptEvent
bool acceptEvent(Pythia8::Event &event) const
Definition: CheckForFinalPartons.cxx:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CheckForFinalPartons::CheckForFinalPartons
CheckForFinalPartons(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CheckForFinalPartons.cxx:7
CheckForFinalPartons::m_maxFailures
int m_maxFailures
Definition: CheckForFinalPartons.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
CheckForFinalPartons.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
merge.status
status
Definition: merge.py:17
AthAlgTool
Definition: AthAlgTool.h:26
CheckForFinalPartons::m_nFailures
int m_nFailures
Definition: CheckForFinalPartons.h:26