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"))
88 },
"min_abs_d0_" + std::to_string(
m_minAbsD0)));
103 m_cutList.add(Accept_t([](
const P_t& p) {
114 m_cutList.add(Accept_t([](
const P_t& p) {
120 return(std::abs(p.pdgId()) ==
m_pdgId);
129 m_cutList.add(Accept_t([](
const P_t& p) {
130 return((p.nParents() == 0) || ((p.nParents() == 1)and((p.parent(0))->nParents() == 0)));
131 },
"hasNoGrandparent"));
137 if (not pTruth)
return false;
142 m_cutList.add(Accept_t([](
const P_t& p) {
143 return((p.absPdgId() == electronId)and(p.nParents() >= 1) and(p.parent(0)) and(p.parent(0)->pdgId() == gammaId));
144 },
"poselectronfromgamma"));
154 m_cutList.add(Accept_t([
this](
const P_t& p) ->
bool {
158 if (ptruthVertex ==
nullptr) {
163 const auto xPos = ptruthVertex->
x();
164 const auto yPos = ptruthVertex->
y();
165 const auto z_truth = ptruthVertex->
z();
177 ATH_MSG_VERBOSE(
"Extrapolated parameters to cylinder: " << *exParameters);
178 const float ex_abs_z = fabs(exParameters->
position().z());
186 },
"SelectCylinder"));
196 m_cutList.add(Accept_t([
this](
const P_t& p) ->
bool {
200 if (ptruthVertex ==
nullptr) {
205 const auto xPos = ptruthVertex->
x();
206 const auto yPos = ptruthVertex->
y();
207 const auto z_truth = ptruthVertex->
z();
217 float ex_radius = sqrt(pow(exParameters->
position().x(),2)+pow(exParameters->
position().y(),2));
224 ATH_MSG_VERBOSE(
"Strange, extrapolation succeeded but extrapolated position not within disc radius! Test next disc");
230 float ex_radius = sqrt(pow(exParameters->
position().x(),2)+pow(exParameters->
position().y(),2));
237 ATH_MSG_VERBOSE(
"Strange, extrapolation succeeded but extrapolated position not within disc radius! Rejecting");
245 std::string
msg = std::to_string(
m_cutList.size()) +
" truth acceptance cuts are used:\n";
253 return StatusCode::SUCCESS;
259 return StatusCode::SUCCESS;
263std::vector<std::string>
287 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.
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
Helper class to provide constant type-safe access to aux data.
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.