ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
LArHitContainer Class Reference

Hit collection. More...

#include <LArHitContainer.h>

Inheritance diagram for LArHitContainer:
Collaboration diagram for LArHitContainer:

Public Types

using base_value_type = LArHit
 
using CONT = std::vector< LArHit * >
 
using value_type = typename CONT::value_type
 
using pointer = typename CONT::pointer
 
using reference = typename CONT::reference
 
using iterator = typename CONT::iterator
 
using size_type = typename CONT::size_type
 
using difference_type = typename CONT::difference_type
 
using const_pointer = const LArHit *const *
 
using const_reference = const LArHit *const &
 
using const_iterator = boost::transform_iterator< make_const, typename CONT::const_iterator >
 

Public Member Functions

 LArHitContainer (const std::string &collectionName="DefaultCollectionName")
 
virtual ~LArHitContainer ()
 
virtual operator std::string () const
 Returns a string containing the description of this
LArHitContainer with a dump of all the hits that it contains
More...
 
void Clear ()
 
void Clear (AthHitVec::OwnershipPolicy ownPolicy)
 
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
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
size_type size () const
 
void push_back (LArHit *t)
 
void push_back (std::unique_ptr< 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

Definition at line 43 of file AthenaHitsVector.h.

◆ const_iterator

using AthenaHitsVector< LArHit >::const_iterator = boost::transform_iterator<make_const, typename CONT::const_iterator>
inherited

Definition at line 57 of file AthenaHitsVector.h.

◆ const_pointer

Definition at line 51 of file AthenaHitsVector.h.

◆ const_reference

Definition at line 52 of file AthenaHitsVector.h.

◆ CONT

using AthenaHitsVector< LArHit >::CONT = std::vector<LArHit *>
inherited

Definition at line 44 of file AthenaHitsVector.h.

◆ difference_type

using AthenaHitsVector< LArHit >::difference_type = typename CONT::difference_type
inherited

Definition at line 50 of file AthenaHitsVector.h.

◆ iterator

using AthenaHitsVector< LArHit >::iterator = typename CONT::iterator
inherited

Definition at line 48 of file AthenaHitsVector.h.

◆ pointer

using AthenaHitsVector< LArHit >::pointer = typename CONT::pointer
inherited

Definition at line 46 of file AthenaHitsVector.h.

◆ reference

using AthenaHitsVector< LArHit >::reference = typename CONT::reference
inherited

Definition at line 47 of file AthenaHitsVector.h.

◆ size_type

using AthenaHitsVector< LArHit >::size_type = typename CONT::size_type
inherited

Definition at line 49 of file AthenaHitsVector.h.

◆ value_type

using AthenaHitsVector< LArHit >::value_type = typename CONT::value_type
inherited

Definition at line 45 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 }

◆ ~LArHitContainer()

LArHitContainer::~LArHitContainer ( )
virtual

Definition at line 17 of file LArHitContainer.cxx.

18 {
19 
20 }

Member Function Documentation

◆ At()

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

Definition at line 156 of file AthenaHitsVector.h.

156 { return m_hitvector.at(pos); }

◆ begin() [1/2]

iterator AthenaHitsVector< LArHit >::begin
inlineinherited

Definition at line 147 of file AthenaHitsVector.h.

147 { return m_hitvector.begin(); }

◆ begin() [2/2]

const_iterator AthenaHitsVector< LArHit >::begin
inlineinherited

Definition at line 139 of file AthenaHitsVector.h.

139  {
140  return const_iterator(m_hitvector.begin(), make_const());
141  }

◆ Clear() [1/2]

void AthenaHitsVector< LArHit >::Clear
inlineinherited

Definition at line 76 of file AthenaHitsVector.h.

76  {
77  // delete pointers if we own the elements
79  for (unsigned int i = 0; i < m_hitvector.size(); i++)
80  delete m_hitvector[i];
81  }
82  m_hitvector.clear();
83  }

◆ clear()

void AthenaHitsVector< LArHit >::clear
inlineinherited

Definition at line 174 of file AthenaHitsVector.h.

174  {
176  for (unsigned int i = 0; i < m_hitvector.size(); i++)
177  delete m_hitvector[i];
178  }
179  m_hitvector.clear();
180  }

◆ Clear() [2/2]

void AthenaHitsVector< LArHit >::Clear ( AthHitVec::OwnershipPolicy  ownPolicy)
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  m_ownPolicy = ownPolicy;
93  }

◆ empty()

bool AthenaHitsVector< LArHit >::empty
inlineinherited

Definition at line 137 of file AthenaHitsVector.h.

137 { return m_hitvector.empty(); }

◆ end() [1/2]

iterator AthenaHitsVector< LArHit >::end
inlineinherited

Definition at line 149 of file AthenaHitsVector.h.

149 { return m_hitvector.end(); }

◆ end() [2/2]

const_iterator AthenaHitsVector< LArHit >::end
inlineinherited

Definition at line 143 of file AthenaHitsVector.h.

143  {
144  return const_iterator(m_hitvector.end(), make_const());
145  }

◆ getVector()

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

Definition at line 135 of file AthenaHitsVector.h.

135 { return m_hitvector; }

◆ initHelper()

static const std::type_info* AthenaHitsVector< LArHit >::initHelper
inlinestaticinherited

Definition at line 192 of file AthenaHitsVector.h.

◆ Insert()

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

Definition at line 95 of file AthenaHitsVector.h.

95 { m_hitvector.push_back(h); }

◆ Name()

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

Definition at line 130 of file AthenaHitsVector.h.

130 { return m_name; }

◆ operator std::string()

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

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 22 of file LArHitContainer.cxx.

22  {
23 
24  char * stCounter = new char[48] ;
25  char * nameOfContainer = new char[48] ;
26 
27  const char * stname = typeid( *this ).name() ;
28  int lname ;
29  sscanf( stname , "%80d%47s" , &lname , nameOfContainer ) ;
30 
31  std::string newline( "\n" ) ;
32  std::string hitContainerString = nameOfContainer ;
33  hitContainerString += ": content " ;
34  hitContainerString += newline ;
35 
36  int counter = 0 ;
37 
38  for (const LArHit* hit : *this) { // Loop over Hits
39  sprintf( stCounter , "%d" , counter ) ;
40 
41  hitContainerString += "LArHit[" ;
42  hitContainerString += stCounter ;
43  hitContainerString += "] " ;
44 
45  sprintf( stCounter , " ID = %x ; " ,hit->cellID().get_identifier32().get_compact() ) ;
46  hitContainerString += stCounter ;
47 
48  sprintf( stCounter , " E= %f MeV ; " , hit->energy() ) ;
49  hitContainerString += stCounter ;
50  sprintf( stCounter , " t= %f ns ; " , hit->time() ) ;
51  hitContainerString += stCounter ;
52 
53 // hitContainerString += (std::string) (*hit) ;
54  hitContainerString += newline ;
55 
56  counter ++ ;
57 
58  }
59 
60  sprintf( stCounter , "%d" , counter ) ;
61  hitContainerString += newline ;
62  hitContainerString += "Number of Hits in this container : " ;
63  hitContainerString += stCounter ;
64 
65 
66  delete[] stCounter ;
67  delete[] nameOfContainer ;
68 
69  return hitContainerString ;
70 
71 }

◆ operator[]()

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

Definition at line 158 of file AthenaHitsVector.h.

158 { return m_hitvector[n]; }

◆ push_back() [1/2]

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

Definition at line 153 of file AthenaHitsVector.h.

153 { m_hitvector.push_back(t); }

◆ push_back() [2/2]

void AthenaHitsVector< LArHit >::push_back ( std::unique_ptr< LArHit t)
inlineinherited

Definition at line 154 of file AthenaHitsVector.h.

154 { m_hitvector.push_back(t.release()); }

◆ reserve()

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

Definition at line 182 of file AthenaHitsVector.h.

182 { m_hitvector.reserve(n); }

◆ resize()

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

Definition at line 160 of file AthenaHitsVector.h.

160  {
161  if (sz < size()) {
163  iterator i(m_hitvector.begin() + sz), e(m_hitvector.end());
164  while (i != e) {
165  delete *i++;
166  }
167  }
168  m_hitvector.resize(sz);
169  } else {
170  m_hitvector.insert(m_hitvector.end(), sz - m_hitvector.size(), nullptr);
171  }
172  }

◆ setName()

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

Definition at line 132 of file AthenaHitsVector.h.

132 { m_name = name; }

◆ Size()

int AthenaHitsVector< LArHit >::Size
inlineinherited

Definition at line 96 of file AthenaHitsVector.h.

96 { return size(); }

◆ size()

size_type AthenaHitsVector< LArHit >::size
inlineinherited

Definition at line 151 of file AthenaHitsVector.h.

151 { return m_hitvector.size(); }

Member Data Documentation

◆ m_hitvector

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

Definition at line 186 of file AthenaHitsVector.h.

◆ m_name

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

Definition at line 185 of file AthenaHitsVector.h.

◆ m_ownPolicy

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

Definition at line 187 of file AthenaHitsVector.h.

◆ s_info

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

Definition at line 195 of file AthenaHitsVector.h.


The documentation for this class was generated from the following files:
fitman.sz
sz
Definition: fitman.py:527
LArHit::energy
double energy() const
Definition: LArHit.h:113
AthHitVec::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: AthenaHitsVector.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthenaHitsVector< LArHit >::m_hitvector
std::vector< LArHit * > m_hitvector
Definition: AthenaHitsVector.h:186
AthenaHitsVector< LArHit >::const_iterator
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
Definition: AthenaHitsVector.h:58
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
AthenaHitsVector< LArHit >::initHelper
static const std::type_info * initHelper()
Definition: AthenaHitsVector.h:192
LArHit::time
double time() const
Definition: LArHit.h:118
LArHit::cellID
Identifier cellID() const
Definition: LArHit.h:108
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LArHit
Class to store hit energy and time in LAr cell from G4 simulation.
Definition: LArHit.h:25
AthenaHitsVector< LArHit >::iterator
typename CONT::iterator iterator
Definition: AthenaHitsVector.h:48
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
h
AthenaHitsVector< LArHit >::m_name
std::string m_name
Definition: AthenaHitsVector.h:185
AthenaHitsVector< LArHit >::size
size_type size() const
Definition: AthenaHitsVector.h:151
AthenaHitsVector< LArHit >
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
test_pyathena.counter
counter
Definition: test_pyathena.py:15
DataModel_detail::DVLInfo
Definition: DVLInfo.h:237
calibdata.newline
newline
Definition: calibdata.py:526
AthenaHitsVector< LArHit >::m_ownPolicy
AthHitVec::OwnershipPolicy m_ownPolicy
Definition: AthenaHitsVector.h:187