Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RootScintillatorTowerContainer.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4RootScintillatorTowerContainer.cc
2 
4 
5 #include <TClonesArray.h>
6 
7 #include <cmath> // for NAN
8 #include <ostream> // for basic_ostream::operator<<, oper...
9 
10 using namespace std;
11 
12 static const int NMAX = 1000;
13 
15  : idet(-1)
16  , etotal(NAN)
17  , eion(NAN)
18  , leakage(NAN)
19  , event(0)
20 {
21  SnglTowers = new TClonesArray("G4RootScintillatorTower", NMAX);
22 }
23 
25 {
26  SnglTowers->Clear();
27  delete SnglTowers;
28 }
29 
31 {
32  etotal = NAN;
33  leakage = NAN;
34  event = 0;
35  SnglTowers->Clear();
36  if (SnglTowers->GetSize() > NMAX)
37  {
38  SnglTowers->Expand(NMAX);
39  }
40  return;
41 }
42 
44 G4RootScintillatorTowerContainer::AddTower(double towerenergy, int ieta, int iphi)
45 {
46  TClonesArray &cl = *SnglTowers;
47  int nextindex = SnglTowers->GetLast() + 1;
48  if (nextindex == SnglTowers->GetSize())
49  {
50  SnglTowers->Expand(SnglTowers->GetSize() + 10000);
51  }
52  new (cl[nextindex]) G4RootScintillatorTower(towerenergy,ieta,iphi);
53  return (static_cast<G4RootScintillatorTower *>(cl[nextindex]));
54 }
55 
57 {
58  os << "Number of Hits: " << SnglTowers->GetLast() << endl;
59  return;
60 }