![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include "GaudiKernel/PhysicalConstants.h"
10 #include "CLHEP/Random/RandomEngine.h"
50 if (m_MinPt < 1999. && m_MaxPt > 21. &&
m_doShape) {
56 ATH_MSG_INFO(
"Requested shaping with bounds of " <<
m_MinPt <<
" , " <<
m_MaxPt <<
" which cannot be done. Turning off shaping (sorry).");
65 return StatusCode::SUCCESS;
71 return StatusCode::SUCCESS;
79 const EventContext& ctx = Gaudi::Hive::currentContext();
82 ATH_MSG_WARNING(
"Failed to retrieve random number engine QCDTruthJetFilter");
83 setFilterPassed(
false);
84 return StatusCode::SUCCESS;
93 return StatusCode::SUCCESS;
97 double pt_lead = -1, phi_lead = 0;
99 if (!(*it_truth))
continue;
102 if (pt_lead < (*it_truth)->pt()) {
103 pt_lead = (*it_truth)->pt();
104 phi_lead = (*it_truth)->phi();
113 setFilterPassed(
false);
115 return StatusCode::SUCCESS;
120 setFilterPassed(
false);
122 if (phi_lead < m_MinPhi || phi_lead >
m_MaxPhi) {
124 return StatusCode::SUCCESS;
127 setFilterPassed(
true);
135 double rnd = rndm->flat();
137 setFilterPassed(
false);
138 ATH_MSG_DEBUG(
"Event failed weighting cut. Weight is " <<
w <<
" for pt_lead of " << pt_lead <<
" high end is " <<
m_high <<
" rnd is " << rnd);
139 return StatusCode::SUCCESS;
144 setFilterPassed(
true);
149 ATH_MSG_DEBUG(
"Event passed. Will mod event weights by " <<
w*
m_norm <<
" for pt_lead of " << pt_lead <<
" norm " <<
m_norm <<
" w " <<
w <<
" high " <<
m_high <<
" rnd " << rnd);
152 for (
unsigned int i=0;
i<mec->
size();++
i) {
153 if ( !(*mec)[
i] )
continue;
154 orig = (*mec)[
i]->weights().
size()>0?(*mec)[
i]->weights()[0]:1.;
155 if ((*mec)[
i]->weights().size()>0) (*mec)[
i]->weights()[0] = orig*
w*
m_norm;
156 else (*mec)[
i]->weights().push_back(
w*
m_norm*orig );
159 (*mec)[
i]->add_attribute(
"filterWeight", std::make_shared<HepMC3::DoubleAttribute>(
w*
m_norm));
163 return StatusCode::SUCCESS;
168 const EventContext& ctx)
const
172 rngWrapper->
setSeed( rngName, ctx );
def retrieve(aClass, aKey=None)
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
Const iterator class for DataVector/DataList.
static double fitFn(const double x)
StatusCode filterInitialize()
double m_MinPhi
Min phi for the lead truth jet.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
std::string m_mcEventKey
StoreGate key for the MC event collection (defaults to GEN_EVENT)
double m_high
High-side function level.
QCDTruthJetFilter(const std::string &name, ISvcLocator *pSvcLocator)
double m_MaxEta
Max eta for the truth jets.
double m_MinEta
Min eta for the truth jets.
ServiceHandle< IAthRNGSvc > m_rndmSvc
double m_MaxPt
Max pT for the truth jets.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Base class for event generator filtering modules.
CLHEP::HepRandomEngine * getRandomEngine(const std::string &streamName, const EventContext &ctx) const
long m_total
Total number of events tested.
::StatusCode StatusCode
StatusCode definition for legacy code.
bool m_SymEta
Use symmetric cut for min eta? (Default false for p-Pb run filters)
#define CHECK(...)
Evaluate an expression and check for errors.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
StatusCode filterFinalize()
A wrapper class for event-slot-local random engines.
CLHEP::HepRandomEngine * getEngine(const EventContext &ctx) const
Retrieve the random engine corresponding to the provided EventContext.
long m_ptfailed
Number of events failing the pT cuts.
long m_passed
Number of events passing all cuts.
double m_norm
Normalization for weights.
#define ATH_MSG_WARNING(x)
std::string m_TruthJetContainerName
Name of the truth jet container.
double m_MinPt
Min pT for the truth jets.
size_type size() const noexcept
Returns the number of elements in the collection.
bool m_doShape
Attempt to flatten the pT distribution.
double m_StartMinEta
Default start value for min eta.