ATLAS Offline Software
Loading...
Searching...
No Matches
TileHitVectorCellBuilder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TILESIMEVENT_TILEHITVECTORCELLBUILDER_H
6#define TILESIMEVENT_TILEHITVECTORCELLBUILDER_H
7
8#include "Identifier/Identifier.h"
10
11#include <array>
12#include <cstddef>
13#include <memory>
14#include <string>
15
24template <std::size_t NCells>
26{
27public:
28 explicit TileHitVectorCellBuilder(const std::string& collectionName)
29 : TileHitVector(collectionName)
30 {}
31
32 bool HasHit(std::size_t index) const { return m_hits[index] != nullptr; }
33
34 void AddHit(std::size_t index, Identifier id, double energy, double time = 0.0, double deltaT = 0.0)
35 {
36 if (m_hits[index]) {
37 m_hits[index]->add(energy, time, deltaT);
38 } else {
39 m_hits[index] = std::make_unique<TileSimHit>(id, energy, time, deltaT);
40 }
41 }
42
43 void Finalize()
44 {
45 for (std::size_t index = 0; index < NCells; ++index) {
46 if (m_hits[index]) {
48 m_hits[index].reset();
49 }
50 }
51 }
52
53private:
54 std::array<std::unique_ptr<TileSimHit>, NCells> m_hits{};
55};
56
57#endif // TILESIMEVENT_TILEHITVECTORCELLBUILDER_H
AtlasHitsVector< TileHit > TileHitVector
void Insert(const TileHit &h)
bool HasHit(std::size_t index) const
void AddHit(std::size_t index, Identifier id, double energy, double time=0.0, double deltaT=0.0)
TileHitVectorCellBuilder(const std::string &collectionName)
std::array< std::unique_ptr< TileSimHit >, NCells > m_hits
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
Definition index.py:1