ATLAS Offline Software
Loading...
Searching...
No Matches
TileSimEvent/TileSimEvent/TileHit.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//********************************************************************
6// Filename : TileHit.h
7// Author : Zhifang
8// Created : April, 2002
9//
10// DESCRIPTION:
11// A TileHit represents the total energy deposited in scintillator
12// which is visible by one PMT
13//
14// HISTORY:
15//
16// BUGS:
17//
18// *******************************************************************
19
20#ifndef TILESIMEVENT_TILEHIT_H
21#define TILESIMEVENT_TILEHIT_H
22
24
25#include <string>
26#include <vector>
27class TileSimHit;
28
30{
31public:
32
34 TileHit() { }
35
37 TileHit( const TileSimHit * hitInp );
38
40 TileHit(const Identifier & id, float energy=0.0, float time=0.0);
41
43 TileHit(const Identifier & id, float energy, float time, float deltaT);
44
45 TileHit(const TileHit&) = default;
46 TileHit& operator=(const TileHit&) = default;
47 TileHit(TileHit&&) = default;
48 TileHit& operator=(TileHit&&) = default;
49
52
54 int add (float energy, float time);
56 int add (float energy, float time, float deltaT);
58 int add (const TileHit *hitInp, float deltaT);
59
61 void scale(float coeff);
62
63 /* Inline set methods */
64
66 inline void addEnergy (float e) { m_energy[0] += e; }
68 inline void setEnergy (float e, int ind=0) { m_energy[ind] = e; }
70 inline void setTime (float t, int ind=0) { m_time[ind] = t; }
72 inline void resize (int len) { m_energy.resize(len); m_time.resize(len); }
74 inline void reserve (int len) { m_energy.reserve(len); m_time.reserve(len); }
76 inline void setZero () { m_energy.resize(1); m_time.resize(1);
77 m_energy[0] = 0.0; m_time[0] = 0.0;}
78 /* Inline access methods */
79
81 inline Identifier identify(void) const { return m_pmt_id; }
83 inline Identifier pmt_ID (void) const { return m_pmt_id; }
84
86 HWIdentifier pmt_HWID(void) const;
88 Identifier tt_ID (void) const;
90 Identifier mt_ID (void) const;
92 int frag_ID (void) const;
93
95 inline float energy (int ind=0) const { return m_energy[ind]; }
97 inline float time (int ind=0) const { return m_time[ind]; }
99 inline int size (void) const { return m_energy.size(); }
100
102 std::string whoami (void) const { return "TileHit"; }
104 void print (void) const;
107 operator std::string() const;
108
110 static void print_to_stream ( const std::vector<float>& val,
111 const std::string & label,
112 std::ostringstream & text);
113
114private:
115
119 std::vector<float> m_energy; //
121 std::vector<float> m_time;
122};
123
124#endif //TILESIMEVENT_TILEHIT_H
125
void setTime(float t, int ind=0)
Set time of ind-th sub-hit in a hit.
Identifier m_pmt_id
Logical ID of the pmt.
void reserve(int len)
Reserve length of energy and time vectors in a hit.
HWIdentifier pmt_HWID(void) const
Return pmt hardware ID (== channel ID)
Definition TileHit.cxx:125
TileHit(const TileHit &)=default
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
int frag_ID(void) const
Return frag ID (like in BS file)
Definition TileHit.cxx:137
std::string whoami(void) const
Return name of this object.
void addEnergy(float e)
Add energy to the first sub-hit in a hit.
float time(int ind=0) const
Return time of ind-th sub-hit.
void resize(int len)
Resize energy and time vectors in a hit.
Identifier tt_ID(void) const
Return trigger tower ID.
Definition TileHit.cxx:129
TileHit & operator=(const TileHit &)=default
void scale(float coeff)
Scale energy of all sub-hits in a hit.
Definition TileHit.cxx:117
TileHit()
Default constructor needed for POOL.
void print(void) const
Dump contents of the hit to std::out.
Definition TileHit.cxx:141
std::vector< float > m_time
Time of the energy deposition relative to BC.
Identifier pmt_ID(void) const
Return logical ID of the pmt.
void setEnergy(float e, int ind=0)
Set energy of ind-th sub-hit in a hit.
float energy(int ind=0) const
Return energy of ind-th sub-hit.
Identifier identify(void) const
Return logical ID of the pmt.
int add(float energy, float time)
Add sub-hit to a given hit.
Definition TileHit.cxx:74
TileHit & operator=(TileHit &&)=default
std::vector< float > m_energy
Energy deposited in scint, as seen by pmt in sepatate time bins.
TileHit(TileHit &&)=default
Identifier mt_ID(void) const
Return muon trigger ID.
Definition TileHit.cxx:133
void setZero()
Resize energy/time vectors in a hit to one and set energy/time to zero.
~TileHit()
Default destructor.
int size(void) const
Return length of energy/time vectors.
std::string label(const std::string &format, int i)
Definition label.h:19