ATLAS Offline Software
Loading...
Searching...
No Matches
ISF_FCS_Parametrization::FCS_StepInfo Class Reference

#include <FCS_StepInfo.h>

Inheritance diagram for ISF_FCS_Parametrization::FCS_StepInfo:
Collaboration diagram for ISF_FCS_Parametrization::FCS_StepInfo:

Public Member Functions

 FCS_StepInfo ()
 empty default constructor
 FCS_StepInfo (CLHEP::Hep3Vector l_vec, Identifier l_cell, double l_energy, double l_time, bool l_valid, int l_detector)
void setP (const CLHEP::Hep3Vector &p)
 set position
void setX (const double x)
 set x position
void setY (const double y)
 set y position
void setZ (const double z)
 set z position
void setValid (const bool flag)
 set depoisted energy
void setDetector (const int det)
 set identifier
CLHEP::Hep3Vector position () const
 return spacial position
double x () const
 return x position
double y () const
 return y position
double z () const
 return z position
bool valid () const
 return deposited energy
int detector () const
double diff2 (const FCS_StepInfo &other) const
 return spactial distance squared
FCS_StepInfooperator+= (const FCS_StepInfo &other)
 energy weighted sum
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.
bool msgLvl (const MSG::Level lvl) const
 Check whether the logging system is active at the provided verbosity level.
MsgStream & msg () const
 Return a stream for sending messages directly (no decoration)
MsgStream & msg (const MSG::Level lvl) const
 Return a decorated starting stream for sending messages.
MSG::Level level () const
 Retrieve output level.
virtual void setLevel (MSG::Level lvl)
 Update outputlevel.

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.
static std::string startMsg (MSG::Level lvl, const std::string &file, int line)
 Make a message to decorate the start of logging.

Private Attributes

CLHEP::Hep3Vector m_pos
 spatial position
bool m_valid
 flag, if hit is valid (if valid calculator?)
int m_detector
 dictionary value in which detector the hit is
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.
std::string m_nm
 Message source name.

Static Private Attributes

static boost::thread_specific_ptr< MsgStream > m_msg_tls ATLAS_THREAD_SAFE
 Do not persistify!

Detailed Description

Definition at line 45 of file FCS_StepInfo.h.

Constructor & Destructor Documentation

◆ FCS_StepInfo() [1/2]

ISF_FCS_Parametrization::FCS_StepInfo::FCS_StepInfo ( )
inline

empty default constructor

Definition at line 49 of file FCS_StepInfo.h.

49: m_pos(), m_valid(false), m_detector(-1) {}
int m_detector
dictionary value in which detector the hit is
CLHEP::Hep3Vector m_pos
spatial position
bool m_valid
flag, if hit is valid (if valid calculator?)

◆ FCS_StepInfo() [2/2]

ISF_FCS_Parametrization::FCS_StepInfo::FCS_StepInfo ( CLHEP::Hep3Vector l_vec,
Identifier l_cell,
double l_energy,
double l_time,
bool l_valid,
int l_detector )
inline

Definition at line 51 of file FCS_StepInfo.h.

53 : TileHit(l_cell, l_energy, l_time), m_pos(l_vec), m_valid(l_valid),
54 m_detector(l_detector) {}
TileHit()
Default constructor needed for POOL.

Member Function Documentation

◆ add() [1/3]

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

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}
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.
int add(float energy, float time)
Add sub-hit to a given hit.
Definition TileHit.cxx:74
int size(void) const
Return length of energy/time vectors.

◆ add() [2/3]

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

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

◆ add() [3/3]

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

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

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

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

◆ detector()

int ISF_FCS_Parametrization::FCS_StepInfo::detector ( ) const
inline

Definition at line 93 of file FCS_StepInfo.h.

93{ return m_detector; }

◆ diff2()

double ISF_FCS_Parametrization::FCS_StepInfo::diff2 ( const FCS_StepInfo & other) const

return spactial distance squared

Definition at line 31 of file FCS_StepInfo.cxx.

31 {
32 return (this->position().diff2(other.position()));
33}
CLHEP::Hep3Vector position() const
return spacial position
double diff2(const FCS_StepInfo &other) const
return spactial distance squared

◆ energy()

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

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
inherited

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}
Identifier m_pmt_id
Logical ID of the pmt.

◆ identify()

Identifier TileHit::identify ( void ) const
inlineinherited

Return logical ID of the pmt.

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

81{ return m_pmt_id; }

◆ level()

MSG::Level ISF_FCS::MLogging::level ( ) const
inlineinherited

Retrieve output level.

Definition at line 201 of file MLogging.h.

201{ return msg().level(); }
MsgStream & msg() const
Return a stream for sending messages directly (no decoration)
Definition MLogging.h:231

◆ msg() [1/2]

MsgStream & ISF_FCS::MLogging::msg ( ) const
inlineinherited

Return a stream for sending messages directly (no decoration)

Definition at line 231 of file MLogging.h.

231 {
232 MsgStream *ms = m_msg_tls.get();
233 if (!ms) {
234 ms = new MsgStream(Athena::getMessageSvc(), m_nm);
235 m_msg_tls.reset(ms);
236 }
237 return *ms;
238}
std::string m_nm
Message source name.
Definition MLogging.h:211
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [2/2]

MsgStream & ISF_FCS::MLogging::msg ( const MSG::Level lvl) const
inlineinherited

Return a decorated starting stream for sending messages.

Definition at line 240 of file MLogging.h.

240 {
241 return msg() << lvl;
242}

◆ msgLvl()

bool ISF_FCS::MLogging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Check whether the logging system is active at the provided verbosity level.

Definition at line 222 of file MLogging.h.

222 {
223 if (msg().level() <= lvl) {
224 msg() << lvl;
225 return true;
226 } else {
227 return false;
228 }
229}
MSG::Level level() const
Retrieve output level.
Definition MLogging.h:201

◆ mt_ID()

Identifier TileHit::mt_ID ( void ) const
inherited

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
inherited

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

ISF_FCS_Parametrization::FCS_StepInfo & ISF_FCS_Parametrization::FCS_StepInfo::operator+= ( const FCS_StepInfo & other)

energy weighted sum

Definition at line 36 of file FCS_StepInfo.cxx.

37 {
38 if (identify() != other.identify()) {
39 ATH_MSG_WARNING("Not merging hits from different cells!!! "
40 << identify() << " / " << other.identify());
41 return *this;
42 }
43
44 if ((fabs(energy()) > 1e-9) && (fabs(other.energy()) > 1e-9)) {
45 // both !=0
46 // Use absolute energies for weighting
47 double eabssum = fabs(energy()) + fabs(other.energy());
48 double esum = energy() + other.energy();
49 double w1 = fabs(energy()) / eabssum;
50 double w2 = fabs(other.energy()) / eabssum;
51 // Average position, time, energy sum
52 m_pos = w1 * m_pos + w2 * other.m_pos;
53 setEnergy(esum);
54 setTime(w1 * time() + w2 * other.time());
55
56 } else if (fabs(energy()) < 1e-9) {
57 // original is 0, use other
58 setEnergy(other.energy());
59 setP(other.position());
60 setTime(other.time());
61 } else if (fabs(other.energy()) < 1e-9) {
62 // other is 0, use original
63 // don't need to do anything...
64 } else {
65 ATH_MSG_WARNING("merging hits something weird: "
66 << "\nOriginal hit: " << energy() << " " << position()
67 << "\nSecond hit: " << other.energy() << " "
68 << other.position());
69 }
70
71 /*
72 double esum = energy() + other.energy();
73
74 double w1 = 0;
75 double w2 = 0;
76
77 //ignore negative energies
78 if (energy() <= 0.)
79 {
80 if (other.energy()>0.)
81 {
82 //use the other hit + sum energy
83 //setEnergy(other.energy());
84 setEnergy(esum);
85 setTime(other.time());
86 setP(other.position());
87 }
88 else
89 {
90 //both are negative -> set both to 0
91 setEnergy(0.);
92 setTime(0.);
93 setP(CLHEP::Hep3Vector(0,0,0));
94 //both are negative -> set both to 0
95 }
96 }
97 else if (other.energy() <0.)
98 {
99 //keep original, but with sum energy
100 setEnergy(esum);
101 }
102 else if (esum > 0) {
103 w1 = energy()/esum;
104 w2 = other.energy()/esum;
105
106 m_pos = w1*m_pos + w2*other.m_pos;
107 setEnergy(esum);
108 setTime(w1* time()+ w2 * other.time());
109 //m_time = w1*m_time + w2*other.m_time; //average time??
110 //what about m_ID...
111 }
112 else
113 {
114 ATH_MSG_INFO("Wow, you're still here??");
115 }
116 */
117 return *this;
118}
#define ATH_MSG_WARNING(x)
void setP(const CLHEP::Hep3Vector &p)
set position
void setTime(float t, int ind=0)
Set time of ind-th sub-hit in a hit.
void setEnergy(float e, int ind=0)
Set energy of ind-th sub-hit in a hit.
Identifier identify(void) const
Return logical ID of the pmt.

◆ pmt_HWID()

HWIdentifier TileHit::pmt_HWID ( void ) const
inherited

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
inlineinherited

Return logical ID of the pmt.

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

83{ return m_pmt_id; }

◆ position()

CLHEP::Hep3Vector ISF_FCS_Parametrization::FCS_StepInfo::position ( ) const
inline

return spacial position

Definition at line 79 of file FCS_StepInfo.h.

79{ return m_pos; }

◆ print()

void TileHit::print ( void ) const
inherited

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

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

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

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

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}

◆ setDetector()

void ISF_FCS_Parametrization::FCS_StepInfo::setDetector ( const int det)
inline

set identifier

Definition at line 77 of file FCS_StepInfo.h.

◆ setEnergy()

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

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; }

◆ setLevel()

void ISF_FCS::MLogging::setLevel ( MSG::Level lvl)
virtualinherited

Update outputlevel.

Definition at line 105 of file MLogging.cxx.

105 {
106 lvl = (lvl >= MSG::NUM_LEVELS) ? MSG::ALWAYS
107 : (lvl < MSG::NIL) ? MSG::NIL
108 : lvl;
109 msg().setLevel(lvl);
110}

◆ setP()

void ISF_FCS_Parametrization::FCS_StepInfo::setP ( const CLHEP::Hep3Vector & p)
inline

set position

Definition at line 61 of file FCS_StepInfo.h.

◆ setTime()

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

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

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

◆ setValid()

void ISF_FCS_Parametrization::FCS_StepInfo::setValid ( const bool flag)
inline

set depoisted energy

set time set validity

Definition at line 73 of file FCS_StepInfo.h.

73{ m_valid = flag; }
bool flag
Definition master.py:29

◆ setX()

void ISF_FCS_Parametrization::FCS_StepInfo::setX ( const double x)
inline

set x position

Definition at line 63 of file FCS_StepInfo.h.

63{ return m_pos.setX(x); }
double x() const
return x position

◆ setY()

void ISF_FCS_Parametrization::FCS_StepInfo::setY ( const double y)
inline

set y position

Definition at line 65 of file FCS_StepInfo.h.

65{ return m_pos.setY(y); }
double y() const
return y position

◆ setZ()

void ISF_FCS_Parametrization::FCS_StepInfo::setZ ( const double z)
inline

set z position

Definition at line 67 of file FCS_StepInfo.h.

67{ return m_pos.setZ(z); }
double z() const
return z position

◆ setZero()

void TileHit::setZero ( )
inlineinherited

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
inlineinherited

Return length of energy/time vectors.

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

99{ return m_energy.size(); }

◆ startMsg()

std::string ISF_FCS::MLogging::startMsg ( MSG::Level lvl,
const std::string & file,
int line )
staticinherited

Make a message to decorate the start of logging.

Print a message for the start of logging.

Definition at line 116 of file MLogging.cxx.

116 {
117 int col1_len = 20;
118 int col2_len = 5;
119 int col3_len = 10;
120 auto last_slash = file.find_last_of('/');
121 int path_len = last_slash == std::string::npos ? 0 : last_slash;
122 int trim_point = path_len;
123 int total_len = file.length();
124 if (total_len - path_len > col1_len)
125 trim_point = total_len - col1_len;
126 std::string trimmed_name = file.substr(trim_point);
127 const char *LevelNames[MSG::NUM_LEVELS] = {
128 "NIL", "VERBOSE", "DEBUG", "INFO", "WARNING", "ERROR", "FATAL", "ALWAYS"};
129 std::string level = LevelNames[lvl];
130 std::string level_string = std::string("(") + level + ") ";
131 std::stringstream output;
132 output << std::setw(col1_len) << std::right << trimmed_name << ":"
133 << std::setw(col2_len) << std::left << line << std::setw(col3_len)
134 << std::right << level_string;
135 return output.str();
136}
output
Definition merge.py:16
TFile * file

◆ time()

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

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
inherited

Return trigger tower ID.

Definition at line 129 of file TileHit.cxx.

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

◆ valid()

bool ISF_FCS_Parametrization::FCS_StepInfo::valid ( ) const
inline

return deposited energy

return time of hit return validity flag

Definition at line 91 of file FCS_StepInfo.h.

91{ return m_valid; }

◆ whoami()

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

Return name of this object.

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

102{ return "TileHit"; }

◆ x()

double ISF_FCS_Parametrization::FCS_StepInfo::x ( ) const
inline

return x position

Definition at line 81 of file FCS_StepInfo.h.

81{ return m_pos.x(); }

◆ y()

double ISF_FCS_Parametrization::FCS_StepInfo::y ( ) const
inline

return y position

Definition at line 83 of file FCS_StepInfo.h.

83{ return m_pos.y(); }

◆ z()

double ISF_FCS_Parametrization::FCS_StepInfo::z ( ) const
inline

return z position

Definition at line 85 of file FCS_StepInfo.h.

85{ return m_pos.z(); }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

boost::thread_specific_ptr<MsgStream> m_msg_tls ISF_FCS::MLogging::ATLAS_THREAD_SAFE
inlinestaticprivateinherited

Do not persistify!

MsgStream instance (a std::cout like with print-out levels)

Definition at line 215 of file MLogging.h.

◆ m_detector

int ISF_FCS_Parametrization::FCS_StepInfo::m_detector
private

dictionary value in which detector the hit is

Definition at line 107 of file FCS_StepInfo.h.

◆ m_energy

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

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

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

◆ m_nm

std::string ISF_FCS::MLogging::m_nm
privateinherited

Message source name.

Definition at line 211 of file MLogging.h.

◆ m_pmt_id

Identifier TileHit::m_pmt_id
privateinherited

Logical ID of the pmt.

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

◆ m_pos

CLHEP::Hep3Vector ISF_FCS_Parametrization::FCS_StepInfo::m_pos
private

spatial position

Definition at line 105 of file FCS_StepInfo.h.

◆ m_time

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

Time of the energy deposition relative to BC.

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

◆ m_valid

bool ISF_FCS_Parametrization::FCS_StepInfo::m_valid
private

flag, if hit is valid (if valid calculator?)

Definition at line 106 of file FCS_StepInfo.h.


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