ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimEvent
src
FCS_StepInfo.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ISF_FastCaloSimEvent/FCS_StepInfo.h
"
6
7
#include "GaudiKernel/MsgStream.h"
8
9
/*
10
ISF_FCS_Parametrization::FCS_StepInfo::FCS_StepInfo(const FCS_StepInfo& first,
11
const FCS_StepInfo& second)
12
{
13
double esum = first.m_energy + second.m_energy;
14
double w1 = 0;
15
double w2 = 0;
16
17
if (esum > 0) {
18
w1 = first.m_energy/esum;
19
w2 = second.m_energy/esum;
20
}
21
22
m_pos = w1*first.m_pos + w2*second.m_pos;
23
m_time = w1*first.m_time + w2*second.m_time;
24
m_energy = esum;
25
m_valid = true;
26
m_detector = first.m_detector; //need to make sure that it's not merging hits
27
from different detector parts.. m_ID = first.m_ID; //dtto
28
}
29
*/
30
double
31
ISF_FCS_Parametrization::FCS_StepInfo::diff2
(
const
FCS_StepInfo
&other)
const
{
32
return
(this->
position
().
diff2
(other.
position
()));
33
}
34
35
ISF_FCS_Parametrization::FCS_StepInfo
&
36
ISF_FCS_Parametrization::FCS_StepInfo::operator+=
(
37
const
ISF_FCS_Parametrization::FCS_StepInfo
&other) {
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
}
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
FCS_StepInfo.h
ISF_FCS_Parametrization::FCS_StepInfo
Definition
FCS_StepInfo.h:45
ISF_FCS_Parametrization::FCS_StepInfo::position
CLHEP::Hep3Vector position() const
return spacial position
Definition
FCS_StepInfo.h:79
ISF_FCS_Parametrization::FCS_StepInfo::operator+=
FCS_StepInfo & operator+=(const FCS_StepInfo &other)
energy weighted sum
Definition
FCS_StepInfo.cxx:36
ISF_FCS_Parametrization::FCS_StepInfo::setP
void setP(const CLHEP::Hep3Vector &p)
set position
Definition
FCS_StepInfo.h:61
ISF_FCS_Parametrization::FCS_StepInfo::FCS_StepInfo
FCS_StepInfo()
empty default constructor
Definition
FCS_StepInfo.h:49
ISF_FCS_Parametrization::FCS_StepInfo::diff2
double diff2(const FCS_StepInfo &other) const
return spactial distance squared
Definition
FCS_StepInfo.cxx:31
ISF_FCS_Parametrization::FCS_StepInfo::m_pos
CLHEP::Hep3Vector m_pos
spatial position
Definition
FCS_StepInfo.h:105
TileHit::setTime
void setTime(float t, int ind=0)
Set time of ind-th sub-hit in a hit.
Definition
TileSimEvent/TileSimEvent/TileHit.h:70
TileHit::time
float time(int ind=0) const
Return time of ind-th sub-hit.
Definition
TileSimEvent/TileSimEvent/TileHit.h:97
TileHit::setEnergy
void setEnergy(float e, int ind=0)
Set energy of ind-th sub-hit in a hit.
Definition
TileSimEvent/TileSimEvent/TileHit.h:68
TileHit::energy
float energy(int ind=0) const
Return energy of ind-th sub-hit.
Definition
TileSimEvent/TileSimEvent/TileHit.h:95
TileHit::identify
Identifier identify(void) const
Return logical ID of the pmt.
Definition
TileSimEvent/TileSimEvent/TileHit.h:81
Generated on
for ATLAS Offline Software by
1.17.0