ATLAS Offline Software
TileSimHit.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 //********************************************************************
6 // Filename : TileSimHit.cxx
7 // Author : Alexander Solodkov
8 // Created : June, 2009
9 //
10 // DESCRIPTION:
11 // A TileSimHit represents the total energy deposited in scintillator
12 // which is visible by one PMT
13 // Energy and time is kept as double
14 //
15 // HISTORY:
16 // 04Jun09: Copied from TileHit class
17 //
18 // BUGS:
19 //
20 // *******************************************************************
21 
23 #include <cmath>
24 
25 
26 TileSimHit::TileSimHit(Identifier & id, double energy, double time, double delta)
27  : m_pmt_id( id )
28  , m_energy(1)
29  , m_time(1)
30 {
31  m_energy[0] = energy;
32  if(delta>0){
33  m_time[0] = delta*nearbyint(time/delta);
34  }
35  else{
36  // ignore time completely if delta is zero
37  m_time[0]=0.0;
38  }
39 }
40 
41 int TileSimHit::add(double energy, double time, double delta)
42 {
43  if(delta>0) {
44  int size=m_time.size();
45  for (int i=0; i<size; ++i) {
46  double dt = time-m_time[i];
47  if (fabs(dt)<delta/2.) {
48  m_energy[i]+=energy;
49  //if ( (m_energy[i] += energy) > 0.0)
50  // m_time[i] += dt * energy / m_energy[i];
51  return 0;
52  }
53  }
54 
55  m_energy.push_back(energy);
56  m_time.push_back(delta*nearbyint(time/delta));
57 
58  } else{
59  // ignore time completely if delta is zero
60  m_energy[0] += energy;
61  return 0;
62  }
63 
64  return 1;
65 }
TileSimHit::m_energy
std::vector< double > m_energy
Energy deposited in scint, as seen by pmt in sepatate time bins
Definition: TileSimHit.h:62
TileSimHit::add
int add(double energy, double time, double deltaT)
Add sub-hit to a given hit with time rounding to the center of nearest deltaT bin.
Definition: TileSimHit.cxx:41
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TileSimHit::m_time
std::vector< double > m_time
Time of the energy deposition relative to BC
Definition: TileSimHit.h:64
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
TileSimHit::time
double time(int ind=0) const
Return time of ind-th sub-hit
Definition: TileSimHit.h:53
TileSimHit::energy
double energy(int ind=0) const
Return energy of ind-th sub-hit
Definition: TileSimHit.h:51
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
TileSimHit::size
int size(void) const
Return length of energy/time vectors
Definition: TileSimHit.h:55
TileSimHit.h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TileSimHit::TileSimHit
TileSimHit()
Default constructor needed for POOL.
Definition: TileSimHit.h:35
Identifier
Definition: IdentifierFieldParser.cxx:14