|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include <type_traits>
20 template <
typename T_EnumClass >
26 #ifndef __cpp_lib_erase_if
28 template <
class T_container,
class T_Func>
29 inline std::size_t
erase_if(T_container &container, T_Func pred) {
30 std::size_t orig_size = container->size();
32 iter != container.end();
41 return orig_size - container->size();
55 ISvcLocator *pSvcLocator)
69 return StatusCode::SUCCESS;
72 template <
bool IsDebug>
73 template <
class T_OutStream>
76 out <<
"Measurements per truth particle :" << m_measPerTruthParticle << std::endl
77 << m_measPerTruthParticle.histogramToString();
80 template <
bool IsDebug>
83 std::lock_guard<std::mutex> lock(m_mutex);
84 m_measPerTruthParticle.add(n_measurements);
90 ATH_MSG_INFO(
"Number of truth particles with hits : " << m_nTruthParticlesWithHits);
99 return StatusCode::SUCCESS;
104 std::unique_ptr<TruthParticleHitCounts>
105 truth_particle_hit_counts( std::make_unique<TruthParticleHitCounts>() );
108 if (!pixelClustersToTruthAssociation.
isValid()) {
110 return StatusCode::FAILURE;
113 if (!stripClustersToTruthAssociation.
isValid()) {
115 return StatusCode::FAILURE;
121 measurement_to_truth_association_maps{};
128 unsigned int measurement_type_i=0;
129 --measurement_type_i;
131 ++measurement_type_i;
132 if (!associated_truth_particles)
continue;
135 assert (truth_particle);
137 if (mother_particle) {
138 assert(measurement_type_i < (*truth_particle_hit_counts)[mother_particle].
size());
139 ++(*truth_particle_hit_counts)[mother_particle][measurement_type_i];
145 unsigned int truth_particles_without_enough_measurements
146 = std::erase_if( *truth_particle_hit_counts,
147 [
this, n_hits_min](
const std::pair<const xAOD::TruthParticle * const,HitCounterArray> &elm) {
148 unsigned int n_measurements=
std::accumulate(elm.second.begin(), elm.second.end(),0
u);
150 return n_measurements<n_hits_min;
153 m_nTruthParticlesWithHits += truth_particle_hit_counts->size();
155 ATH_MSG_DEBUG(
"Truth particles with hits:" << truth_particle_hit_counts->size()
156 <<
", without enough hits: " << truth_particles_without_enough_measurements);
159 if (truth_particle_hit_counts_out_handle.
record( std::move(truth_particle_hit_counts)).isFailure()) {
161 return StatusCode::FAILURE;
164 return StatusCode::SUCCESS;
JetConstituentVector::iterator iterator
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
virtual StatusCode initialize() override
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_pixelClustersToTruth
void fillStatistics(unsigned int n_measurements) const
const xAOD::TruthParticle * getMother(const xAOD::TruthParticle &truth_particle, float max_energy_loss) const
follow decay chain upwards assuming quasi elastic processes.
const_pointer_type cptr()
Dereference the pointer.
Gaudi::Property< float > m_maxEnergyLoss
constexpr std::underlying_type< T_EnumClass >::type to_underlying(T_EnumClass an_enum)
Helper to convert class enum into an integer.
TruthParticleHitCountAlg(const std::string &name, ISvcLocator *pSvcLocator)
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
void dumpStatistics(T_OutStream &out) const
SG::WriteHandleKey< TruthParticleHitCounts > m_truthHitCountsOut
Gaudi::Property< unsigned int > m_nHitsMin
bool msgLvl(const MSG::Level lvl) const
const std::string & key() const
Return the StoreGate ID for the referenced object.
constexpr bool TruthParticleHitCountDebugHists
@ u
Enums for curvilinear frames.
virtual StatusCode finalize() override
void dumpStatistics(T_OutStream &out) const
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Simple class to gather statistics : min, max, mean, rms.
void dumpStat(T_Stream &out, const Stat &stat)
Dump the given statistics object to the given output stream.
::StatusCode StatusCode
StatusCode definition for legacy code.
ElasticDecayUtil< TruthParticleHitCountDebugHists > m_elasticDecayUtil
Class describing a truth particle in the MC record.
AssociationCounter< TruthParticleHitCountDebugHists > m_associationCounter
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::size_t erase_if(T_container &container, T_Func pred)
boost::container::small_vector< const xAOD::TruthParticle *, NTruthParticlesPerMeasurement > ParticleVector
virtual StatusCode execute(const EventContext &ctx) const override
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::conditional< TruthParticleHitCountDebugHists, Gaudi::Property< std::vector< float > >, EmptyProperty >::type m_energyLossBinning
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
void setEnergyLossBinning(const typename std::conditional< IsDebug, std::vector< float >, EmptyProperty >::type &binning)
SG::ReadHandleKey< MeasurementToTruthParticleAssociation > m_stripClustersToTruth