StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBarrelEmcCluster.cxx
1 #include <iomanip>
2 
3 #include "StGammaTower.h"
4 #include "StBarrelEmcCluster.h"
5 
6 ClassImp(StBarrelEmcCluster);
7 
8 ostream& operator<<(ostream& out, const StBarrelEmcCluster& cluster)
9 {
10 
11  out << "Energy [GeV]:\t" << cluster.energy() << '\n';
12  out << "Transverse energy [GeV]:\t" << cluster.momentum().Pt() << '\n';
13  out << "Eta:\t" << cluster.momentum().Eta() << '\n';
14  out << "Phi [radians]:\t" << cluster.momentum().Phi() << '\n';
15  out << "Position [cm]: [ x = " << cluster.position().x() << ", y = "
16  << cluster.position().y() << ", z = " << cluster.position().z() << " ]\n";
17 
18  out << "Tower id:\n";
19  for (int dphi = 1; dphi >= -1; --dphi)
20  {
21 
22  out << "+------+------+------+\n";
23  out << "| ";
24 
25  for (int deta = -1; deta <= 1; ++deta)
26  {
27  StGammaTower* tower = cluster.tower(deta, dphi);
28  int id = tower ? tower->id : 0;
29  out << setw(4) << id << " | ";
30  }
31 
32  out << '\n';
33 
34  }
35 
36  out << "+------+------+------+\n";
37 
38  out << "Energy [GeV]:\n";
39  for (int dphi = 1; dphi >= -1; --dphi)
40  {
41 
42  out << "+--------+--------+--------+\n";
43  out << "| ";
44 
45  for (int deta = -1; deta <= 1; ++deta)
46  {
47 
48  StGammaTower* tower = cluster.tower(deta, dphi);
49  float energy = tower ? tower->energy : 0;
50  out << fixed << setprecision(3) << setw(6) << energy << " | ";
51 
52  }
53 
54  out << '\n';
55  }
56  out << "+--------+--------+--------+\n";
57 
58  return out;
59 }