23 constexpr int electronId(11);
24 constexpr int gammaId(22);
25 bool hasAncestor(
const xAOD::TruthParticle* particle,
const std::vector<int>& allowedAncestors) {
28 for (
uint i = 0;
i < nPar;
i++) {
29 for (
const int & ancestorID : allowedAncestors) {
30 if (std::abs(
particle->parent(i)->pdgId()) == ancestorID) {
35 for (
uint i = 0;
i < nPar;
i++) {
37 if (hasAncestor(parent, allowedAncestors))
return true;
45 const IInterface* parent) :
49 declareInterface<IAthSelectionTool>(
this);
58 const std::vector<Accept_t> filters = {
62 Accept_t([
this](
const P_t& p) ->
bool {
63 return((p.pt() > 0.1) ? (std::abs(p.eta()) <
m_maxEta) :
false);
64 }, std::string(
"eta")),
65 Accept_t([
this](
const P_t& p) ->
bool {
67 }, std::string(
"min_pt"))
101 m_cutList.add(Accept_t([](
const P_t& p) {
107 return(std::abs(p.pdgId()) ==
m_pdgId);
116 m_cutList.add(Accept_t([](
const P_t& p) {
117 return((p.nParents() == 0) || ((p.nParents() == 1)and((p.parent(0))->nParents() == 0)));
118 },
"hasNoGrandparent"));
124 if (not pTruth)
return false;
129 m_cutList.add(Accept_t([](
const P_t& p) {
130 return((p.absPdgId() == electronId)and(p.nParents() >= 1) and(p.parent(0)) and(p.parent(0)->pdgId() == gammaId));
131 },
"poselectronfromgamma"));
141 m_cutList.add(Accept_t([
this](
const P_t& p) ->
bool {
145 if (ptruthVertex ==
nullptr) {
150 const auto xPos = ptruthVertex->
x();
151 const auto yPos = ptruthVertex->
y();
152 const auto z_truth = ptruthVertex->
z();
164 ATH_MSG_VERBOSE(
"Extrapolated parameters to cylinder: " << *exParameters);
165 const float ex_abs_z = fabs(exParameters->
position().z());
173 },
"SelectCylinder"));
183 m_cutList.add(Accept_t([
this](
const P_t& p) ->
bool {
187 if (ptruthVertex ==
nullptr) {
192 const auto xPos = ptruthVertex->
x();
193 const auto yPos = ptruthVertex->
y();
194 const auto z_truth = ptruthVertex->
z();
211 ATH_MSG_VERBOSE(
"Strange, extrapolation succeeded but extrapolated position not within disc radius! Test next disc");
224 ATH_MSG_VERBOSE(
"Strange, extrapolation succeeded but extrapolated position not within disc radius! Rejecting");
232 std::string
msg = std::to_string(
m_cutList.size()) +
" truth acceptance cuts are used:\n";
240 return StatusCode::SUCCESS;
246 return StatusCode::SUCCESS;
250std::vector<std::string>
274 return m_cutList.testAllCuts(*pTruth,counter);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
ATLAS-specific HepMC functions.
constexpr int pow(int base, int exp) noexcept
Templated class containing a cut, name of cut and description of cut(optional) Typically,...
Templated CutList class to contain a group of cuts.
SG::ConstAccessor< T, ALLOC > ConstAccessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const Amg::Vector3D & position() const
Access method for the position.
Class providing the definition of the 4-vector interface.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
TruthVertex_v1 TruthVertex
Typedef to implementation.
TruthParticle_v1 TruthParticle
Typedef to implementation.