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

Hit collection. More...

#include <LArHitContainer.h>

Inheritance diagram for LArHitContainer:
Collaboration diagram for LArHitContainer:

Public Types

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

 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

Detailed Description

Hit collection.

Definition at line 23 of file LArHitContainer.h.

Member Typedef Documentation

◆ base_value_type

using AthenaHitsVector< LArHit >::base_value_type
inherited

Definition at line 52 of file AthenaHitsVector.h.

◆ const_iterator

Definition at line 66 of file AthenaHitsVector.h.

◆ const_pointer

using AthenaHitsVector< LArHit >::const_pointer
inherited

Definition at line 60 of file AthenaHitsVector.h.

◆ const_reference

using AthenaHitsVector< LArHit >::const_reference
inherited

Definition at line 61 of file AthenaHitsVector.h.

◆ CONT

using AthenaHitsVector< LArHit >::CONT
inherited

Definition at line 53 of file AthenaHitsVector.h.

◆ difference_type

using AthenaHitsVector< LArHit >::difference_type
inherited

Definition at line 59 of file AthenaHitsVector.h.

◆ iterator

using AthenaHitsVector< LArHit >::iterator
inherited

Definition at line 57 of file AthenaHitsVector.h.

◆ pointer

using AthenaHitsVector< LArHit >::pointer
inherited

Definition at line 55 of file AthenaHitsVector.h.

◆ reference

using AthenaHitsVector< LArHit >::reference
inherited

Definition at line 56 of file AthenaHitsVector.h.

◆ size_type

using AthenaHitsVector< LArHit >::size_type
inherited

Definition at line 58 of file AthenaHitsVector.h.

◆ value_type

Definition at line 54 of file AthenaHitsVector.h.

Constructor & Destructor Documentation

◆ LArHitContainer()

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

Definition at line 11 of file LArHitContainer.cxx.

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

Member Function Documentation

◆ At()

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

Definition at line 165 of file AthenaHitsVector.h.

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

◆ begin()

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

Definition at line 148 of file AthenaHitsVector.h.

148 {
149 return const_iterator(m_hitvector.begin(), make_const());
150 }
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator

◆ Clear()

void AthenaHitsVector< LArHit >::Clear ( )
inlineinherited

Definition at line 85 of file AthenaHitsVector.h.

85 {
86 // delete pointers if we own the elements
88 for (unsigned int i = 0; i < m_hitvector.size(); i++)
89 delete m_hitvector[i];
90 }
91 m_hitvector.clear();
92 }
AthHitVec::OwnershipPolicy m_ownPolicy

◆ clear()

void AthenaHitsVector< LArHit >::clear ( )
inlineinherited

Definition at line 183 of file AthenaHitsVector.h.

183 {
185 for (unsigned int i = 0; i < m_hitvector.size(); i++)
186 delete m_hitvector[i];
187 }
188 m_hitvector.clear();
189 }

◆ empty()

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

Definition at line 146 of file AthenaHitsVector.h.

146{ return m_hitvector.empty(); }

◆ end()

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

Definition at line 152 of file AthenaHitsVector.h.

152 {
153 return const_iterator(m_hitvector.end(), make_const());
154 }

◆ getVector()

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

Definition at line 144 of file AthenaHitsVector.h.

144{ return m_hitvector; }

◆ initHelper()

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

Definition at line 201 of file AthenaHitsVector.h.

201 {
203 };
static const std::type_info * initHelper()

◆ Insert()

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

Definition at line 104 of file AthenaHitsVector.h.

104{ m_hitvector.push_back(h); }

◆ Name()

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

Definition at line 139 of file AthenaHitsVector.h.

139{ return m_name; }

◆ operator std::string()

LArHitContainer::operator std::string ( ) const

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 167 of file AthenaHitsVector.h.

167{ return m_hitvector[n]; }

◆ push_back()

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

Definition at line 162 of file AthenaHitsVector.h.

162{ m_hitvector.push_back(t); }

◆ reserve()

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

Definition at line 191 of file AthenaHitsVector.h.

191{ m_hitvector.reserve(n); }

◆ resize()

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

Definition at line 169 of file AthenaHitsVector.h.

169 {
170 if (sz < size()) {
172 iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
173 while (i != e) {
174 delete *i++;
175 }
176 }
177 m_hitvector.resize(sz);
178 } else {
179 m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
180 }
181 }
typename CONT::iterator iterator

◆ setName()

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

Definition at line 141 of file AthenaHitsVector.h.

141{ m_name = name; }

◆ Size()

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

Definition at line 105 of file AthenaHitsVector.h.

105{ return size(); }

◆ size()

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

Definition at line 160 of file AthenaHitsVector.h.

160{ return m_hitvector.size(); }

Member Data Documentation

◆ m_hitvector

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

Definition at line 195 of file AthenaHitsVector.h.

◆ m_name

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

Definition at line 194 of file AthenaHitsVector.h.

◆ m_ownPolicy

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

Definition at line 196 of file AthenaHitsVector.h.

◆ s_info

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

Definition at line 204 of file AthenaHitsVector.h.


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