21 return StatusCode::SUCCESS;
33 ppars = readHandlePcontainer.
get();
35 using Grid=std::vector<std::vector<std::vector<const xAOD::IParticle*>>>;
36 const double etaMin = -5;
37 const double etaMax = 5;
38 const double phiMin = -3.1416;
39 const double phiMax = 3.1416;
43 grid.resize(1+ (etaMax-etaMin)/
m_DR);
44 for (
auto& phiVec: grid) {
45 phiVec.resize(1+ (phiMax-phiMin)/
m_DR);
48 auto etaToIndex = [etaMin,
this](
double eta) ->
size_t {
return (
eta-etaMin)/
m_DR; };
49 auto phiToIndex = [phiMin,
this](
double phi) ->
size_t {
return (
phi-phiMin)/
m_DR; };
51 auto neighborsInEta = [&grid, etaToIndex](
double eta) -> std::vector<size_t> {
52 const size_t etaIndex = etaToIndex(
eta);
54 return {etaIndex, etaIndex+1};
56 if ( etaIndex == grid.size()-1){
57 return {etaIndex-1, etaIndex};
59 return {etaIndex-1, etaIndex, etaIndex+1};
62 auto neighborsInPhi = [&grid, phiToIndex](
double phi) -> std::vector<size_t> {
63 const size_t phiIndex = phiToIndex(
phi);
65 return {grid[0].size()-1, phiIndex, phiIndex+1};
67 if ( phiIndex == grid[0].size()-1){
68 return {phiIndex-1, phiIndex, 0ul};
70 return {phiIndex-1, phiIndex, phiIndex+1};
73 for(
const auto* ap : *ppars) {
74 grid[etaToIndex(ap->eta())][phiToIndex(ap->phi())].push_back(ap);
81 auto etaN = neighborsInEta(theJet->
eta());
82 auto phiN = neighborsInPhi(theJet->
phi());
84 for (
size_t etaI : etaN) {
85 for (
size_t phiI : phiN ) {
86 for (
auto ap: grid[etaI][phiI]) {
93 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
std::vector< const IParticle * > ParticleVector
DataModel_detail::iterator< DataVector > iterator
JetModifierBase(const std::string &myname)
Ctor.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
void setAssociatedObjects(const std::string &name, const std::vector< const T * > &vec)
set associated objects from a vector of arbitrary object.
virtual double eta() const
The pseudorapidity ( ) of the particle.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.