|
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include "TDatabasePDG.h"
18 #include "TParticlePDG.h"
68 return StatusCode::SUCCESS;
74 std::lock_guard<std::mutex> lock(
m_mutex);
80 return StatusCode::SUCCESS;
87 return StatusCode::FAILURE;
89 std::size_t ptruth_size=ptruth->
size();
91 std::vector<unsigned int> truthIndexMap;
94 unsigned int max_size=0;
97 max_size =
std::max( max_size, decor_index(*truth_particle) );
101 return StatusCode::FAILURE;
105 unsigned int new_index=0;
107 truthIndexMap.at( decor_index(*truth_particle) ) = new_index;
112 truthIndexMap.reserve(ptruth_size);
113 for (
unsigned int i=0;
i<ptruth_size; ++
i) {
114 truthIndexMap.push_back(
i);
118 std::vector< IDPVM::OptionalDecoration<xAOD::TruthParticleContainer,float> >
122 std::vector< std::array<uint16_t, kNClusterTypes> > tp_clustercount;
123 tp_clustercount.resize(ptruth_size,std::array<uint16_t,kNClusterTypes>{});
124 unsigned int missing_truth_particle=0
u;
130 for (
const auto *
const sct : *sctClusters) {
134 const std::vector<unsigned int> &truth_indices = truthIndexAcc(*sctCluster);
135 for (
auto index : truth_indices) {
138 ++tp_clustercount.at(truthIndexMap[
index])[
kSCT];
141 ++missing_truth_particle;
148 for (
const auto *
const pix : *pixelClusters) {
152 const std::vector<unsigned int> &truth_indices = truthIndexAcc(*pixCluster);
153 for (
auto index : truth_indices) {
156 ++tp_clustercount.at(truthIndexMap[
index])[
kPixel];
159 ++missing_truth_particle;
168 if (not float_decor.empty()) {
180 decorateTruth(*truth_particle, float_decor, beamPos, tp_clustercount);
182 std::lock_guard<std::mutex> lock(
m_mutex);
183 m_cutFlow.merge(std::move(tmp_cut_flow));
187 decorateTruth(*truth_particle, float_decor, beamPos, tp_clustercount);
191 return StatusCode::SUCCESS;
200 const std::vector<std::array<uint16_t,kNClusterTypes> > &counts)
const {
205 const EventContext& ctx = Gaudi::Hive::currentContext();
225 ATH_MSG_WARNING(
"A non existent production vertex was requested in calculating the track parameters d0 etc");
231 ATH_MSG_DEBUG(
"A production vertex pointer was retrieved, but it is NULL");
234 const auto xPos = ptruthVertex->
x();
235 const auto yPos = ptruthVertex->
y();
236 const auto z_truth = ptruthVertex->
z();
238 const float prodR_truth = std::sqrt(xPos * xPos + yPos * yPos);
244 std::unique_ptr<const Trk::TrackParameters> tP (
m_extrapolator->extrapolate(ctx,
248 float d0_truth = tP->parameters()[
Trk::d0];
249 float theta_truth = tP->parameters()[
Trk::theta];
250 float z0_truth = tP->parameters()[
Trk::z0];
251 float phi_truth = tP->parameters()[
Trk::phi];
252 float qOverP_truth = tP->parameters()[
Trk::qOverP];
253 float z0st_truth = z0_truth *
std::sin(theta_truth);
268 ATH_MSG_DEBUG(
"The TrackParameters pointer for this TruthParticle is NULL");
PublicToolHandle< IAthSelectionTool > m_truthSelectionTool
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
virtual ~InDetPhysValTruthDecoratorAlg()
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
SG::ReadDecorHandleKeyArray< xAOD::EventInfo > m_beamSpotDecoKey
bool decorateTruth(const xAOD::TruthParticle &particle, std::vector< std::pair< SG::WriteDecorHandle< xAOD::TruthParticleContainer, float >, bool > > &float_decor, const Amg::Vector3D &beamPos, const std::vector< std::array< uint16_t, kNClusterTypes > > &counts) const
std::vector< std::pair< SG::WriteDecorHandleKey< xAOD::TruthParticleContainer >, SG::AuxElement::ConstAccessor< float > > > m_decor
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
void createDecoratorKeysAndAccessor(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< WriteKeyAccessorPair< T_Cont, T > > &decor_out)
bool msgLvl(const MSG::Level lvl) const
std::atomic< std::size_t > m_nMissingTruthParticles
Helper class to provide constant type-safe access to aux data.
virtual StatusCode initialize()
std::atomic< bool > m_errorEmitted
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
bool empty() const
Test if the key is blank.
@ u
Enums for curvilinear frames.
float y() const
Vertex y displacement.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode execute(const EventContext &ctx) const
virtual StatusCode finalize()
Class describing a TrackMeasurementValidation.
Handle class for reading a decoration on an object.
std::pair< SG::WriteDecorHandle< ContainerType, VariableType >, bool > OptionalDecoration
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
::StatusCode StatusCode
StatusCode definition for legacy code.
void decorateOrRejectQuietly(const T_Cont_Elm &particle, OptionalDecoration< T_Cont, T > &decorator, const T &value)
Class describing a truth particle in the MC record.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
TruthParticle container's name needed to create decorators.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::vector< OptionalDecoration< T_Cont, T > > createDecoratorsIfNeeded(const T_Cont &container, const std::vector< WriteKeyAccessorPair< T_Cont, T > > &keys, const EventContext &ctx, bool verbose=false)
Class describing a truth vertex in the MC record.
double charge(const T &p)
Eigen::Matrix< double, 3, 1 > Vector3D
float x() const
Vertex x displacement.
Gaudi::Property< std::string > m_prefix
InDetPhysValTruthDecoratorAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthPixelClusterName
TruthPixelClusterContainer and TruthSCTClusterContainer needed for truth silicon hit cut.
#define ATH_MSG_WARNING(x)
float z() const
Vertex longitudinal distance along the beam line form the origin.
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_truthParticleIndexDecor
Handle class for reading a decoration on an object.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
SG::ReadHandleKey< xAOD::TrackMeasurementValidationContainer > m_truthSCTClusterName
size_type size() const noexcept
Returns the number of elements in the collection.
float nSiHits(const U &p)