ATLAS Offline Software
Loading...
Searching...
No Matches
LArHitContainerBuilder Class Reference

Event-owned builder for standard LAr hits. More...

#include <LArHitContainerBuilder.h>

Inheritance diagram for LArHitContainerBuilder:
Collaboration diagram for LArHitContainerBuilder:

Classes

class  LessHit
struct  Partition

Public Types

using hit_ptr_t = std::unique_ptr<LArHit>
using hits_t = std::set<hit_ptr_t, LessHit>
using timeBins_t = std::map<G4int, hits_t>
using base_value_type
using CONT
using value_type
using pointer
using reference
using iterator
using size_type
using difference_type
using const_pointer
using const_reference
using const_iterator

Public Member Functions

 ~LArHitContainerBuilder () override=default
void RegisterSource (const std::string &sourceName)
 Register a regular-SD partition in final output order.
void AddHit (const std::string &sourceName, hit_ptr_t hit, G4int timeBin)
 Take ownership of a hit and add it to one regular-SD partition.
void Finalize ()
 Move merged hits into the persisted container in final output order.
 LArHitContainer (const std::string &collectionName="DefaultCollectionName")
 operator std::string () const
 Returns a string containing the description of this
LArHitContainer with a dump of all the hits that it contains
.
void Clear ()
void Insert (LArHit *h)
int Size () const
const std::string & Name () const
void setName (const std::string &name)
const std::vector< LArHit * > & getVector ()
bool empty () const
const_iterator begin () const
const_iterator end () const
size_type size () const
void push_back (LArHit *t)
const LArHitAt (unsigned int pos) const
const LArHitoperator[] (size_type n) const
void resize (size_type sz)
void clear ()
void reserve (size_type n)

Static Public Member Functions

static const std::type_info * initHelper ()

Static Public Attributes

static const std::type_info *const s_info

Protected Attributes

std::string m_name
std::vector< LArHit * > m_hitvector
AthHitVec::OwnershipPolicy m_ownPolicy

Private Member Functions

void Finalize (timeBins_t &timeBins)
PartitionFindOrCreatePartition (const std::string &sourceName)

Static Private Member Functions

static void AddHit (timeBins_t &timeBins, hit_ptr_t hit, G4int timeBin)

Private Attributes

std::vector< Partitionm_partitions
timeBins_t m_directHits

Detailed Description

Event-owned builder for standard LAr hits.

The builder owns the merge state for the full Athena event. Regular sensitive detectors register named partitions during Geant4 initialization; each partition merges hits independently and partitions are finalized in registration order. Hits with an empty source name go to the direct bucket, which is finalized after regular SD partitions and is used by contributors such as frozen-shower fast simulation.

Named per-SD partitions are retained only to preserve the historical output contract: hits from different SDs remain distinct and are emitted in SD setup order. If that compatibility requirement is intentionally dropped, the implementation can be simplified to a single event-wide merge bucket.

Definition at line 34 of file LArHitContainerBuilder.h.

Member Typedef Documentation

◆ base_value_type

using AthenaHitsVector< LArHit >::base_value_type
inherited

Definition at line 91 of file AthenaHitsVector.h.

◆ const_iterator

using AthenaHitsVector< LArHit >::const_iterator
inherited

Definition at line 105 of file AthenaHitsVector.h.

◆ const_pointer

using AthenaHitsVector< LArHit >::const_pointer
inherited

Definition at line 99 of file AthenaHitsVector.h.

◆ const_reference

using AthenaHitsVector< LArHit >::const_reference
inherited

Definition at line 100 of file AthenaHitsVector.h.

◆ CONT

using AthenaHitsVector< LArHit >::CONT
inherited

Definition at line 92 of file AthenaHitsVector.h.

◆ difference_type

using AthenaHitsVector< LArHit >::difference_type
inherited

Definition at line 98 of file AthenaHitsVector.h.

◆ hit_ptr_t

using LArHitContainerBuilder::hit_ptr_t = std::unique_ptr<LArHit>

Definition at line 38 of file LArHitContainerBuilder.h.

◆ hits_t

Definition at line 48 of file LArHitContainerBuilder.h.

◆ iterator

using AthenaHitsVector< LArHit >::iterator
inherited

Definition at line 96 of file AthenaHitsVector.h.

◆ pointer

using AthenaHitsVector< LArHit >::pointer
inherited

Definition at line 94 of file AthenaHitsVector.h.

◆ reference

using AthenaHitsVector< LArHit >::reference
inherited

Definition at line 95 of file AthenaHitsVector.h.

◆ size_type

using AthenaHitsVector< LArHit >::size_type
inherited

Definition at line 97 of file AthenaHitsVector.h.

◆ timeBins_t

using LArHitContainerBuilder::timeBins_t = std::map<G4int, hits_t>

Definition at line 49 of file LArHitContainerBuilder.h.

◆ value_type

using AthenaHitsVector< LArHit >::value_type
inherited

Definition at line 93 of file AthenaHitsVector.h.

Constructor & Destructor Documentation

◆ ~LArHitContainerBuilder()

LArHitContainerBuilder::~LArHitContainerBuilder ( )
overridedefault

Member Function Documentation

◆ AddHit() [1/2]

void LArHitContainerBuilder::AddHit ( const std::string & sourceName,
hit_ptr_t hit,
G4int timeBin )

Take ownership of a hit and add it to one regular-SD partition.

◆ AddHit() [2/2]

void LArHitContainerBuilder::AddHit ( timeBins_t & timeBins,
hit_ptr_t hit,
G4int timeBin )
staticprivate

◆ At()

const LArHit * AthenaHitsVector< LArHit >::At ( unsigned int pos) const
inlineinherited

Definition at line 204 of file AthenaHitsVector.h.

204{ return m_hitvector.at(pos); }
std::vector< LArHit * > m_hitvector

◆ begin()

const_iterator AthenaHitsVector< LArHit >::begin ( ) const
inlineinherited

Definition at line 187 of file AthenaHitsVector.h.

187 {
188 return const_iterator(m_hitvector.begin(), make_const());
189 }
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator

◆ Clear()

void AthenaHitsVector< LArHit >::Clear ( )
inlineinherited

Definition at line 124 of file AthenaHitsVector.h.

124 {
125 // delete pointers if we own the elements
127 for (unsigned int i = 0; i < m_hitvector.size(); i++)
128 delete m_hitvector[i];
129 }
130 m_hitvector.clear();
131 }
AthHitVec::OwnershipPolicy m_ownPolicy

◆ clear()

void AthenaHitsVector< LArHit >::clear ( )
inlineinherited

Definition at line 222 of file AthenaHitsVector.h.

222 {
224 for (unsigned int i = 0; i < m_hitvector.size(); i++)
225 delete m_hitvector[i];
226 }
227 m_hitvector.clear();
228 }

◆ empty()

bool AthenaHitsVector< LArHit >::empty ( ) const
inlineinherited

Definition at line 185 of file AthenaHitsVector.h.

185{ return m_hitvector.empty(); }

◆ end()

const_iterator AthenaHitsVector< LArHit >::end ( ) const
inlineinherited

Definition at line 191 of file AthenaHitsVector.h.

191 {
192 return const_iterator(m_hitvector.end(), make_const());
193 }

◆ Finalize() [1/2]

void LArHitContainerBuilder::Finalize ( )

Move merged hits into the persisted container in final output order.

◆ Finalize() [2/2]

void LArHitContainerBuilder::Finalize ( timeBins_t & timeBins)
private

◆ FindOrCreatePartition()

Partition & LArHitContainerBuilder::FindOrCreatePartition ( const std::string & sourceName)
private

◆ getVector()

const std::vector< LArHit * > & AthenaHitsVector< LArHit >::getVector ( )
inlineinherited

Definition at line 183 of file AthenaHitsVector.h.

183{ return m_hitvector; }

◆ initHelper()

const std::type_info * AthenaHitsVector< LArHit >::initHelper ( )
inlinestaticinherited

Definition at line 240 of file AthenaHitsVector.h.

240 {
242 };
static const std::type_info * initHelper()

◆ Insert()

void AthenaHitsVector< LArHit >::Insert ( LArHit * h)
inlineinherited

Definition at line 143 of file AthenaHitsVector.h.

143{ m_hitvector.push_back(h); }

◆ LArHitContainer()

LArHitContainer::LArHitContainer ( const std::string & collectionName = "DefaultCollectionName")

Definition at line 29 of file LArHitContainer.cxx.

12: AthenaHitsVector<LArHit>(collectionName)
13{
14
15}
AthenaHitsVector(const std::string &collectionName="DefaultCollectionName", AthHitVec::OwnershipPolicy ownPolicy=AthHitVec::OWN_ELEMENTS)

◆ Name()

const std::string & AthenaHitsVector< LArHit >::Name ( ) const
inlineinherited

Definition at line 178 of file AthenaHitsVector.h.

178{ return m_name; }

◆ operator std::string()

LArHitContainer::operator std::string ( ) const
inherited

Returns a string containing the description of this
LArHitContainer with a dump of all the hits that it contains
.

Can be used in printouts

Definition at line 17 of file LArHitContainer.cxx.

17 {
18
19 char * stCounter = new char[48] ;
20 char * nameOfContainer = new char[48] ;
21
22 const char * stname = typeid( *this ).name() ;
23 int lname ;
24 sscanf( stname , "%80d%47s" , &lname , nameOfContainer ) ;
25
26 std::string newline( "\n" ) ;
27 std::string hitContainerString = nameOfContainer ;
28 hitContainerString += ": content " ;
29 hitContainerString += newline ;
30
31 int counter = 0 ;
32
33 for (const LArHit* hit : *this) { // Loop over Hits
34 sprintf( stCounter , "%d" , counter ) ;
35
36 hitContainerString += "LArHit[" ;
37 hitContainerString += stCounter ;
38 hitContainerString += "] " ;
39
40 sprintf( stCounter , " ID = %x ; " ,hit->cellID().get_identifier32().get_compact() ) ;
41 hitContainerString += stCounter ;
42
43 sprintf( stCounter , " E= %f MeV ; " , hit->energy() ) ;
44 hitContainerString += stCounter ;
45 sprintf( stCounter , " t= %f ns ; " , hit->time() ) ;
46 hitContainerString += stCounter ;
47
48// hitContainerString += (std::string) (*hit) ;
49 hitContainerString += newline ;
50
51 counter ++ ;
52
53 }
54
55 sprintf( stCounter , "%d" , counter ) ;
56 hitContainerString += newline ;
57 hitContainerString += "Number of Hits in this container : " ;
58 hitContainerString += stCounter ;
59
60
61 delete[] stCounter ;
62 delete[] nameOfContainer ;
63
64 return hitContainerString ;
65
66}
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
double energy() const
Definition LArHit.h:113
Identifier cellID() const
Definition LArHit.h:108
double time() const
Definition LArHit.h:118

◆ operator[]()

const LArHit * AthenaHitsVector< LArHit >::operator[] ( size_type n) const
inlineinherited

Definition at line 206 of file AthenaHitsVector.h.

206{ return m_hitvector[n]; }

◆ push_back()

void AthenaHitsVector< LArHit >::push_back ( LArHit * t)
inlineinherited

Definition at line 201 of file AthenaHitsVector.h.

201{ m_hitvector.push_back(t); }

◆ RegisterSource()

void LArHitContainerBuilder::RegisterSource ( const std::string & sourceName)

Register a regular-SD partition in final output order.

◆ reserve()

void AthenaHitsVector< LArHit >::reserve ( size_type n)
inlineinherited

Definition at line 230 of file AthenaHitsVector.h.

230{ m_hitvector.reserve(n); }

◆ resize()

void AthenaHitsVector< LArHit >::resize ( size_type sz)
inlineinherited

Definition at line 208 of file AthenaHitsVector.h.

208 {
209 if (sz < size()) {
211 iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
212 while (i != e) {
213 delete *i++;
214 }
215 }
216 m_hitvector.resize(sz);
217 } else {
218 m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
219 }
220 }
typename CONT::iterator iterator

◆ setName()

void AthenaHitsVector< LArHit >::setName ( const std::string & name)
inlineinherited

Definition at line 180 of file AthenaHitsVector.h.

180{ m_name = name; }

◆ Size()

int AthenaHitsVector< LArHit >::Size ( ) const
inlineinherited

Definition at line 144 of file AthenaHitsVector.h.

144{ return size(); }

◆ size()

size_type AthenaHitsVector< LArHit >::size ( ) const
inlineinherited

Definition at line 199 of file AthenaHitsVector.h.

199{ return m_hitvector.size(); }

Member Data Documentation

◆ m_directHits

timeBins_t LArHitContainerBuilder::m_directHits
private

Definition at line 72 of file LArHitContainerBuilder.h.

◆ m_hitvector

std::vector<LArHit*> AthenaHitsVector< LArHit >::m_hitvector
protectedinherited

Definition at line 234 of file AthenaHitsVector.h.

◆ m_name

std::string AthenaHitsVector< LArHit >::m_name
protectedinherited

Definition at line 233 of file AthenaHitsVector.h.

◆ m_ownPolicy

AthHitVec::OwnershipPolicy AthenaHitsVector< LArHit >::m_ownPolicy
protectedinherited

Definition at line 235 of file AthenaHitsVector.h.

◆ m_partitions

std::vector<Partition> LArHitContainerBuilder::m_partitions
private

Definition at line 71 of file LArHitContainerBuilder.h.

◆ s_info

const std::type_info* const AthenaHitsVector< LArHit >::s_info
staticinherited

Definition at line 243 of file AthenaHitsVector.h.


The documentation for this class was generated from the following file: