4#ifndef ACTSTRK_HITSUMMARYDATAUTILS_H
5#define ACTSTRK_HITSUMMARYDATAUTILS_H
68 constexpr static unsigned short makeKey(
unsigned short region,
unsigned short layer,
int eta_mod) {
79 return static_cast<uint8_t
>(region) | (layer<<
REGION_BITS);
81 constexpr static unsigned short makeKey(
unsigned short region) {
83 return static_cast<uint8_t
>(region);
133 if (!detEl) {
return false; }
134 assert(detEl ->getIdHelper()->is_pixel(
id));
146 if (!detEl) {
return false; }
147 assert(detEl ->getIdHelper()->is_sct(
id));
156 if (!detEl) {
return false; }
157 assert(detEl ->getIdHelper()->is_hgtd(
id));
160 layer=hgtd_id->
layer(
id);
168 unsigned short key =
makeKey(region, layer, eta_module);
169 for (
auto &[stat_key, stat_hits, stat_outlier_hits, stat_shared_hits, stat_split_hits] :
m_stat) {
170 if (stat_key == key) {
178 m_stat.emplace_back( std::make_tuple(key,
190 for (
const auto &[stat_key, stat_hits, stat_outlier_hits, stat_shared_hits, stat_split_hits] :
m_stat) {
198 for (
unsigned int region_i=0; region_i<
unknown+1; ++region_i) {
199 for (
unsigned int count_type_i=0; count_type_i<static_cast<unsigned int>(
CountType::NCountTypes);++count_type_i) {
207 for (
unsigned int count_type_i=0; count_type_i<static_cast<unsigned int>(
CountType::NCountTypes);++count_type_i) {
227 return m_hits[
static_cast<unsigned int>(hit_type)].at(region);
251 template <
unsigned short HIT_
SELECTION>
254 unsigned short key =
makeKey(region, layer, 0);
255 for (
const auto &[stat_key, stat_hits, stat_outlier_hits, stat_shared_hits, stat_split_hits] :
m_stat) {
261 total += stat_outlier_hits;
264 total += stat_shared_hits;
267 total += stat_split_hits;
278 std::array<uint8_t,4> total{};
279 unsigned short key =
makeKey(region, layer, 0);
280 for (
const auto &[stat_key, stat_hits, stat_outlier_hits, stat_shared_hits, stat_split_hits] :
m_stat) {
297 unsigned int layer_pattern=0u;
298 unsigned short key =
makeKey(region);
299 std::array<uint8_t,2> stat_mask{ 0xff,
static_cast<uint8_t
>(include_outlier ? 0xff : 0) };
300 for (
const auto &[stat_key, stat_hits, stat_outlier_hits, stat_shared_hits, stat_split_hits] :
m_stat) {
302 if ((stat_hits & stat_mask[0])+(stat_outlier_hits & stat_mask[1]) >0u) {
307 return layer_pattern;
311 std::vector< std::tuple<unsigned short, uint8_t, uint8_t, uint8_t, uint8_t> >
m_stat;
314 static constexpr std::array<uint8_t, unknown+1>
s_type
337 double inv_n =
m_n>0 ? 1/
m_n : 0 ;
342 double inv_n =
m_n>0 ? 1./
m_n : 0 ;
364 &measurement_to_summary_type,
367 std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > ¶m_state_idx_out,
368 std::array<std::array<uint8_t,Acts::toUnderlying(
HitCategory::N)>,
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
size_t size() const
Number of registered mappings.
Helper class to gather hit summary information for e.g.
std::vector< std::tuple< unsigned short, uint8_t, uint8_t, uint8_t, uint8_t > > m_stat
unsigned int layerPattern(DetectorRegion region, bool include_outlier) const
Get a bit pattern with one bit set per layer which is set if the layer has a hit or optionally an out...
void reset()
reset all summary counters to zero.
static constexpr unsigned short REGION_MASK
std::array< uint8_t, Total+1 > m_layers
static constexpr DetectorRegion regionFromKey(unsigned short key)
extract the region index from the given key.
DetectorRegion
Regions for which hit counts are computed.
std::array< uint8_t, 4 > sumPerCountType(DetectorRegion region, uint8_t layer) const
return the total number of hits, outliers, shared hits and split hits in the given detector region an...
static constexpr unsigned short LAYER_BITS
static constexpr std::array< uint8_t, unknown+1 > s_type
std::array< std::array< uint8_t, Total+1 >, static_cast< unsigned int >(CountType::NCountTypes)> m_hits
uint8_t contributingSharedHits(DetectorRegion region) const
return the number of shared hits in a certain detector region.
static constexpr unsigned short SIGNED_ETA_MOD_MASK
void computeSummaries()
Compute the varius summaries.
static constexpr unsigned short REGION_BITS
static constexpr unsigned short LAYER_MASK
uint8_t contributingHits(DetectorRegion region, CountType hit_type=CountType::Hit) const
return the number of hits in a certain detector region.
static constexpr uint8_t layerFromKey(unsigned short key)
extract the layer index from the given key.
static constexpr unsigned short makeKey(unsigned short region)
static constexpr unsigned short makeKey(unsigned short region, unsigned short layer, int eta_mod)
Compute a counter key for the given region, layer and module eta module index.
uint8_t sum(DetectorRegion region, uint8_t layer) const
return the total number of hits, outliers, shared hits and/or split hits in the given detector region...
uint8_t contributingOutlierHits(DetectorRegion region) const
return the number of outliers in a certain detector region.
static constexpr unsigned short LAYER_REGION_MASK
static constexpr unsigned short SIGNED_ETA_MOD_BITS
bool addHit(xAOD::UncalibMeasType det_type, const InDetDD::SolidStateDetectorElementBase *detEl, EHitSelection hit_selection)
update summaries to take the given hit into account.
uint8_t contributingLayers(DetectorRegion region) const
return the number of layers contributing to the hit collection in the given detector region.
Helper class to gather statistics and compute the biased variance.
std::array< double, 2 > meanAndBiasedVariance() const
double biasedVariance() const
This is an Identifier helper class for the HGTD subdetector.
int layer(const Identifier &id) const
virtual DetectorType type() const
Type of element.
Class to hold geometrical description of a solid state detector element.
virtual const DetectorDesign & design() const
access to the local description (inline):
virtual Identifier identify() const override final
identifier of this detector element (inline)
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline).
This is an Identifier helper class for the Pixel subdetector.
int layer_disk(const Identifier &id) const
int eta_module(const Identifier &id) const
This is an Identifier helper class for the SCT subdetector.
int layer_disk(const Identifier &id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
int eta_module(const Identifier &id) const
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Hash functions to pack the source link into unordered_maps / unordered_sets.
void gatherTrackSummaryData(const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const std::array< unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> &measurement_to_summary_type, SumOfValues &chi2_stat_out, HitSummaryData &hit_info_out, std::vector< ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > ¶m_state_idx_out, std::array< std::array< uint8_t, Acts::toUnderlying(HitCategory::N)>, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out, TimeInfo &time_info)
Helper to gather track summary information from the track states of the specified track.
UncalibMeasType
Define the type of the uncalibrated measurement.