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