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

#include <TileHit.h>

Inheritance diagram for TileHit:
Collaboration diagram for TileHit:

Public Member Functions

 TileHit ()
 Default constructor needed for POOL.
 TileHit (const TileSimHit *hitInp)
 Constructor which copies everything from TileSimHit.
 TileHit (const Identifier &id, float energy=0.0, float time=0.0)
 Constructor for single hit without time binning.
 TileHit (const Identifier &id, float energy, float time, float deltaT)
 Constructor with time rounding to the center of nearest deltaT bin.
 TileHit (const TileHit &)=default
TileHitoperator= (const TileHit &)=default
 TileHit (TileHit &&)=default
TileHitoperator= (TileHit &&)=default
 ~TileHit ()
 Default destructor.
int add (float energy, float time)
 Add sub-hit to a given hit.
int add (float energy, float time, float deltaT)
 Add sub-hit to a given hit with time rounding to the center of nearest deltaT bin.
int add (const TileHit *hitInp, float deltaT)
 Addi all sub-hits from another hit to a given hit.
void scale (float coeff)
 Scale energy of all sub-hits in a hit.
void addEnergy (float e)
 Add energy to the first sub-hit in a hit.
void setEnergy (float e, int ind=0)
 Set energy of ind-th sub-hit in a hit.
void setTime (float t, int ind=0)
 Set time of ind-th sub-hit in a hit.
void resize (int len)
 Resize energy and time vectors in a hit.
void reserve (int len)
 Reserve length of energy and time vectors in a hit.
void setZero ()
 Resize energy/time vectors in a hit to one and set energy/time to zero.
Identifier identify (void) const
 Return logical ID of the pmt.
Identifier pmt_ID (void) const
 Return logical ID of the pmt.
HWIdentifier pmt_HWID (void) const
 Return pmt hardware ID (== channel ID)
Identifier tt_ID (void) const
 Return trigger tower ID.
Identifier mt_ID (void) const
 Return muon trigger ID.
int frag_ID (void) const
 Return frag ID (like in BS file)
float energy (int ind=0) const
 Return energy of ind-th sub-hit.
float time (int ind=0) const
 Return time of ind-th sub-hit.
int size (void) const
 Return length of energy/time vectors.
std::string whoami (void) const
 Return name of this object.
void print (void) const
 Dump contents of the hit to std::out.
 operator std::string () const
 Return contents of the hit in a form of string.

Static Public Member Functions

static void print_to_stream (const std::vector< float > &val, const std::string &label, std::ostringstream &text)
 Print contents of one vector to output stream.

Private Attributes

Identifier m_pmt_id
 Logical ID of the pmt.
std::vector< float > m_energy
 Energy deposited in scint, as seen by pmt in sepatate time bins.
std::vector< float > m_time
 Time of the energy deposition relative to BC.

Detailed Description

Definition at line 29 of file TileSimEvent/TileSimEvent/TileHit.h.

Constructor & Destructor Documentation

◆ TileHit() [1/6]

TileHit::TileHit ( )
inline

Default constructor needed for POOL.

Definition at line 34 of file TileSimEvent/TileSimEvent/TileHit.h.

34{ }

◆ TileHit() [2/6]

TileHit::TileHit ( const TileSimHit * hitInp)

Constructor which copies everything from TileSimHit.

Definition at line 62 of file TileHit.cxx.

63 : m_pmt_id( hitInp->identify() )
64{
65 int size = hitInp->size();
66 m_energy.reserve(size);
67 m_time.reserve(size);
68 for (int i=0; i<size; ++i) {
69 m_energy.push_back((float)hitInp->energy(i));
70 m_time.push_back((float)hitInp->time(i));
71 }
72}
Identifier m_pmt_id
Logical ID of the pmt.
std::vector< float > m_time
Time of the energy deposition relative to BC.
std::vector< float > m_energy
Energy deposited in scint, as seen by pmt in sepatate time bins.
int size(void) const
Return length of energy/time vectors.
double time(int ind=0) const
Return time of ind-th sub-hit.
Definition TileSimHit.h:53
double energy(int ind=0) const
Return energy of ind-th sub-hit.
Definition TileSimHit.h:51
int size(void) const
Return length of energy/time vectors.
Definition TileSimHit.h:55
Identifier identify(void) const
Return logical ID of the pmt.
Definition TileSimHit.h:49

◆ TileHit() [3/6]

TileHit::TileHit ( const Identifier & id,
float energy = 0.0,
float time = 0.0 )

Constructor for single hit without time binning.

Definition at line 38 of file TileHit.cxx.

39 : m_pmt_id( id )
40 , m_energy(1)
41 , m_time(1)
42{
43 m_energy[0] = energy;
44 m_time[0] = time;
45}
float time(int ind=0) const
Return time of ind-th sub-hit.
float energy(int ind=0) const
Return energy of ind-th sub-hit.

◆ TileHit() [4/6]

TileHit::TileHit ( const Identifier & id,
float energy,
float time,
float deltaT )

Constructor with time rounding to the center of nearest deltaT bin.

Definition at line 47 of file TileHit.cxx.

48 : m_pmt_id( id )
49 , m_energy(1)
50 , m_time(1)
51{
52 m_energy[0] = energy;
53 if(delta>0){
54 m_time[0] = delta*nearbyint(time/delta);
55 }
56 else{
57 // ignore time completely if delta is zero
58 m_time[0]=0.0;
59 }
60}

◆ TileHit() [5/6]

TileHit::TileHit ( const TileHit & )
default

◆ TileHit() [6/6]

TileHit::TileHit ( TileHit && )
default

◆ ~TileHit()

TileHit::~TileHit ( )
inline

Default destructor.

Definition at line 51 of file TileSimEvent/TileSimEvent/TileHit.h.

51{ }

Member Function Documentation

◆ add() [1/3]

int TileHit::add ( const TileHit * hitInp,
float deltaT )

Addi all sub-hits from another hit to a given hit.

Definition at line 107 of file TileHit.cxx.

108{
109 int result=0;
110 int sizeInp = hitInp->size();
111 for (int i=0; i<sizeInp; ++i) {
112 result += add(hitInp->energy(i),hitInp->time(i),delta);
113 }
114 return result;
115}
int add(float energy, float time)
Add sub-hit to a given hit.
Definition TileHit.cxx:74

◆ add() [2/3]

int TileHit::add ( float energy,
float time )

Add sub-hit to a given hit.

Definition at line 74 of file TileHit.cxx.

75{
76 m_energy.push_back(energy);
77 m_time.push_back(time);
78 return 1;
79}

◆ add() [3/3]

int TileHit::add ( float energy,
float time,
float deltaT )

Add sub-hit to a given hit with time rounding to the center of nearest deltaT bin.

Definition at line 81 of file TileHit.cxx.

82{
83 if(delta>0) {
84 int size=m_time.size();
85 for (int i=0; i<size; ++i) {
86 float dt = time-m_time[i];
87 if (fabs(dt)<delta/2.) {
89 //if ( (m_energy[i] += energy) > 0.0)
90 // m_time[i] += dt * energy / m_energy[i];
91 return 0;
92 }
93 }
94
95 m_energy.push_back(energy);
96 m_time.push_back(delta*nearbyint(time/delta));
97
98 } else{
99 // ignore time completely if delta is zero
100 m_energy[0] += energy;
101 return 0;
102 }
103
104 return 1;
105}

◆ addEnergy()

void TileHit::addEnergy ( float e)
inline

Add energy to the first sub-hit in a hit.

Definition at line 66 of file TileSimEvent/TileSimEvent/TileHit.h.

◆ energy()

float TileHit::energy ( int ind = 0) const
inline

Return energy of ind-th sub-hit.

Definition at line 95 of file TileSimEvent/TileSimEvent/TileHit.h.

95{ return m_energy[ind]; }

◆ frag_ID()

int TileHit::frag_ID ( void ) const

Return frag ID (like in BS file)

Definition at line 137 of file TileHit.cxx.

137 {
138 return s_cabling->frag(m_pmt_id);
139}

◆ identify()

Identifier TileHit::identify ( void ) const
inline

Return logical ID of the pmt.

Definition at line 81 of file TileSimEvent/TileSimEvent/TileHit.h.

81{ return m_pmt_id; }

◆ mt_ID()

Identifier TileHit::mt_ID ( void ) const

Return muon trigger ID.

Definition at line 133 of file TileHit.cxx.

133 {
134 return s_cabling->pmt2mt_id(m_pmt_id);
135}

◆ operator std::string()

TileHit::operator std::string ( ) const

Return contents of the hit in a form of string.

Can be used in a cast operation : (std::string) TileHit

Definition at line 146 of file TileHit.cxx.

147{
148 std::ostringstream text;
149
150 text << whoami();
151 text << " Id = " + s_cabling->getTileID()->to_string(m_pmt_id,-1); // pmt_id => -1 level from adc_id
152 print_to_stream(m_energy, " ener =", text);
153 print_to_stream(m_time, " time =", text);
154 return text.str();
155}
static void print_to_stream(const std::vector< float > &val, const std::string &label, std::ostringstream &text)
Print contents of one vector to output stream.
Definition TileHit.cxx:157
std::string whoami(void) const
Return name of this object.

◆ operator=() [1/2]

TileHit & TileHit::operator= ( const TileHit & )
default

◆ operator=() [2/2]

TileHit & TileHit::operator= ( TileHit && )
default

◆ pmt_HWID()

HWIdentifier TileHit::pmt_HWID ( void ) const

Return pmt hardware ID (== channel ID)

Definition at line 125 of file TileHit.cxx.

125 {
126 return s_cabling->s2h_channel_id(m_pmt_id);
127}

◆ pmt_ID()

Identifier TileHit::pmt_ID ( void ) const
inline

Return logical ID of the pmt.

Definition at line 83 of file TileSimEvent/TileSimEvent/TileHit.h.

83{ return m_pmt_id; }

◆ print()

void TileHit::print ( void ) const

Dump contents of the hit to std::out.

Definition at line 141 of file TileHit.cxx.

142{
143 std::cout << (std::string) (*this) << std::endl;
144}

◆ print_to_stream()

void TileHit::print_to_stream ( const std::vector< float > & val,
const std::string & label,
std::ostringstream & text )
static

Print contents of one vector to output stream.

Definition at line 157 of file TileHit.cxx.

160{
161 text << label;
162
163 std::vector<float>::const_iterator it1=val.begin();
164 std::vector<float>::const_iterator it2=val.end();
165
166 for ( ; it1!=it2; ++it1) text << " " << (*it1);
167}
std::string label(const std::string &format, int i)
Definition label.h:19

◆ reserve()

void TileHit::reserve ( int len)
inline

Reserve length of energy and time vectors in a hit.

Definition at line 74 of file TileSimEvent/TileSimEvent/TileHit.h.

74{ m_energy.reserve(len); m_time.reserve(len); }

◆ resize()

void TileHit::resize ( int len)
inline

Resize energy and time vectors in a hit.

Definition at line 72 of file TileSimEvent/TileSimEvent/TileHit.h.

72{ m_energy.resize(len); m_time.resize(len); }

◆ scale()

void TileHit::scale ( float coeff)

Scale energy of all sub-hits in a hit.

Definition at line 117 of file TileHit.cxx.

118{
119 int i,s;
120 s = m_energy.size();
121 for(i=0; i<s; i++)
122 m_energy[i] = coeff*m_energy[i];
123}

◆ setEnergy()

void TileHit::setEnergy ( float e,
int ind = 0 )
inline

Set energy of ind-th sub-hit in a hit.

Definition at line 68 of file TileSimEvent/TileSimEvent/TileHit.h.

68{ m_energy[ind] = e; }

◆ setTime()

void TileHit::setTime ( float t,
int ind = 0 )
inline

Set time of ind-th sub-hit in a hit.

Definition at line 70 of file TileSimEvent/TileSimEvent/TileHit.h.

◆ setZero()

void TileHit::setZero ( )
inline

Resize energy/time vectors in a hit to one and set energy/time to zero.

Definition at line 76 of file TileSimEvent/TileSimEvent/TileHit.h.

76 { m_energy.resize(1); m_time.resize(1);
77 m_energy[0] = 0.0; m_time[0] = 0.0;}

◆ size()

int TileHit::size ( void ) const
inline

Return length of energy/time vectors.

Definition at line 99 of file TileSimEvent/TileSimEvent/TileHit.h.

99{ return m_energy.size(); }

◆ time()

float TileHit::time ( int ind = 0) const
inline

Return time of ind-th sub-hit.

Definition at line 97 of file TileSimEvent/TileSimEvent/TileHit.h.

97{ return m_time[ind]; }

◆ tt_ID()

Identifier TileHit::tt_ID ( void ) const

Return trigger tower ID.

Definition at line 129 of file TileHit.cxx.

129 {
130 return s_cabling->pmt2tt_id(m_pmt_id);
131}

◆ whoami()

std::string TileHit::whoami ( void ) const
inline

Return name of this object.

Definition at line 102 of file TileSimEvent/TileSimEvent/TileHit.h.

102{ return "TileHit"; }

Member Data Documentation

◆ m_energy

std::vector<float> TileHit::m_energy
private

Energy deposited in scint, as seen by pmt in sepatate time bins.

Definition at line 119 of file TileSimEvent/TileSimEvent/TileHit.h.

◆ m_pmt_id

Identifier TileHit::m_pmt_id
private

Logical ID of the pmt.

Definition at line 117 of file TileSimEvent/TileSimEvent/TileHit.h.

◆ m_time

std::vector<float> TileHit::m_time
private

Time of the energy deposition relative to BC.

Definition at line 121 of file TileSimEvent/TileSimEvent/TileHit.h.


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