ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
TileHit Class Reference

#include <TileHit.h>

Inheritance diagram for TileHit:
Collaboration diagram for TileHit:

Public Member Functions

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

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. More...
 

Private Attributes

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

Detailed Description

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

Constructor & Destructor Documentation

◆ TileHit() [1/4]

TileHit::TileHit ( )
inline

Default constructor needed for POOL.

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

34 { }

◆ TileHit() [2/4]

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 }

◆ TileHit() [3/4]

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 }

◆ TileHit() [4/4]

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()

TileHit::~TileHit ( )
inline

Default destructor.

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

46 { }

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 }

◆ 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.) {
88  m_energy[i]+=energy;
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 61 of file TileSimEvent/TileSimEvent/TileHit.h.

61 { m_energy[0] += e; }

◆ energy()

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

Return energy of ind-th sub-hit

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

90 { 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 76 of file TileSimEvent/TileSimEvent/TileHit.h.

76 { 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 }

◆ 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 78 of file TileSimEvent/TileSimEvent/TileHit.h.

78 { 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 }

◆ reserve()

void TileHit::reserve ( int  len)
inline

Reserve length of energy and time vectors in a hit

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

69 { 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 67 of file TileSimEvent/TileSimEvent/TileHit.h.

67 { 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 63 of file TileSimEvent/TileSimEvent/TileHit.h.

63 { 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 65 of file TileSimEvent/TileSimEvent/TileHit.h.

65 { m_time[ind] = t; }

◆ setZero()

void TileHit::setZero ( )
inline

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

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

71  { m_energy.resize(1); m_time.resize(1);
72  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 94 of file TileSimEvent/TileSimEvent/TileHit.h.

94 { return m_energy.size(); }

◆ time()

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

Return time of ind-th sub-hit

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

92 { 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 97 of file TileSimEvent/TileSimEvent/TileHit.h.

97 { 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 114 of file TileSimEvent/TileSimEvent/TileHit.h.

◆ m_pmt_id

Identifier TileHit::m_pmt_id
private

Logical ID of the pmt

Definition at line 112 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 116 of file TileSimEvent/TileSimEvent/TileHit.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
TileHit::print_to_stream
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
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TileHit::size
int size(void) const
Return length of energy/time vectors
Definition: TileSimEvent/TileSimEvent/TileHit.h:94
lumiFormat.i
int i
Definition: lumiFormat.py:85
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
TileHit::add
int add(float energy, float time)
Add sub-hit to a given hit.
Definition: TileHit.cxx:74
TileSimHit::time
double time(int ind=0) const
Return time of ind-th sub-hit
Definition: TileSimHit.h:53
TileSimHit::identify
Identifier identify(void) const
Return logical ID of the pmt.
Definition: TileSimHit.h:49
TileSimHit::energy
double energy(int ind=0) const
Return energy of ind-th sub-hit
Definition: TileSimHit.h:51
TileSimHit::size
int size(void) const
Return length of energy/time vectors
Definition: TileSimHit.h:55
TileHit::whoami
std::string whoami(void) const
Return name of this object
Definition: TileSimEvent/TileSimEvent/TileHit.h:97
MuonCalib::Legendre::coeff
constexpr double coeff(unsigned int l, unsigned int k)
Calculates the n-th coefficient of the legendre polynomial series.
Definition: LegendrePoly.h:73
TileHit::m_pmt_id
Identifier m_pmt_id
Logical ID of the pmt
Definition: TileSimEvent/TileSimEvent/TileHit.h:112
TileHit::energy
float energy(int ind=0) const
Return energy of ind-th sub-hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:90
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
TileHit::time
float time(int ind=0) const
Return time of ind-th sub-hit
Definition: TileSimEvent/TileSimEvent/TileHit.h:92
TileHit::m_time
std::vector< float > m_time
Time of the energy deposition relative to BC
Definition: TileSimEvent/TileSimEvent/TileHit.h:116
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TileHit::m_energy
std::vector< float > m_energy
Energy deposited in scint, as seen by pmt in sepatate time bins
Definition: TileSimEvent/TileSimEvent/TileHit.h:114