Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SaveTowerInfo.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SaveTowerInfo.cc
1 #include "SaveTowerInfo.h"
2 
3 #include <calobase/TowerInfov1.h>
4 #include <calobase/TowerInfoContainerv1.h>
5 #include <calobase/RawTowerv1.h>
6 #include <calobase/RawTowerContainer.h>
7 
8 #include <phool/getClass.h>
10 #include <phool/phool.h>
11 
14 
16 #include <cassert>
17 #include <sstream>
18 #include <string>
19 
20 using namespace std;
21 
32  : SubsysReco(name)
33  , m_EMCalTowerContainer(0)
34 {
37 }
38 
43 {
44 
45 }
46 
51 {
52  if (Verbosity() > 5)
53  {
54  cout << "Beginning Init in SaveTowerInfo" << endl;
55  }
56 
57  CreateNodeTree(topNode);
58 
59  return 0;
60 }
61 
67 {
68  if (Verbosity() > 5)
69  {
70  cout << "Beginning process_event in AnaTutorial" << endl;
71  }
72 
73  RawTowerContainer *EMCalRawTowers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_CEMC");
74 
75  if(!EMCalRawTowers)
76  {
78  }
79 
80  RawTowerContainer::ConstRange tower_range = EMCalRawTowers->getTowers();
81 
82  int towercounter = 0;
83 
84  for (RawTowerContainer::ConstIterator tower_iter = tower_range.first; tower_iter != tower_range.second; tower_iter++)
85  {
86  TowerInfov1 *towerInfo = new TowerInfov1();
87  towerInfo->set_time(tower_iter->second->get_time());
88  towerInfo->set_energy(tower_iter->second->get_energy());
89  m_EMCalTowerContainer->add(towerInfo,towercounter); //TowerInfo object is added to the Container
90  towercounter++;
91  }
92 
94 
95 }
96 
102 {
103  if (Verbosity() > 1)
104  {
105  cout << "Ending SaveTowerInfo analysis package" << endl;
106  }
107 
108 
109  if (Verbosity() > 1)
110  {
111  cout << "Finished SaveTowerInfo analysis package" << endl;
112  }
113 
114  return 0;
115 }
116 
118 {
119  PHNodeIterator nodeItr(topNode);
120  // DST node
121  dst_node = static_cast<PHCompositeNode *>(
122  nodeItr.findFirst("PHCompositeNode", "DST"));
123  if (!dst_node)
124  {
125  std::cout << "PHComposite node created: DST" << std::endl;
126  dst_node = new PHCompositeNode("DST");
127  topNode->addNode(dst_node);
128  }
129  // towers
130  //Detector is set when the constructor is called. Eta-phi bins will be calculated based on the detector
131  m_EMCalTowerContainer = new TowerInfoContainerv1(TowerInfoContainerv1::DETECTOR::EMCAL);
132  PHIODataNode<PHObject> *emcal_towerNode = new PHIODataNode<PHObject>(m_EMCalTowerContainer, "TOWERS_CEMC", "PHObject");
133  dst_node->addNode(emcal_towerNode);
134 }