Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TreeMakerGetClusters.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TreeMakerGetClusters.C
1 #include <TreeMaker.h>
2 
3 #include <phool/getClass.h>
5 
6 // --- calorimeter towers
7 #include <calobase/RawTower.h>
8 #include <calobase/RawTowerContainer.h>
9 #include <calobase/RawTowerGeom.h>
10 #include <calobase/RawTowerGeomContainer.h>
11 
12 // --- calorimeter clusters
13 #include <calobase/RawCluster.h>
14 #include <calobase/RawClusterv1.h>
15 #include <calobase/RawClusterContainer.h>
16 
17 using std::cout;
18 using std::endl;
19 
20 
21 
23 {
24 
25  // -----------------------------------------------------------------------------------------------------
26  // ---
27  // -----------------------------------------------------------------------------------------------------
28 
29  // --- calorimeter tower containers
30  // RawTowerContainer* cemc_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_CEMC");
31  // RawTowerContainer* hcalin_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALIN");
32  // RawTowerContainer* hcalout_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALOUT");
33 
34  // --- calorimeter geometry objects
35  // RawTowerGeomContainer* cemc_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_CEMC");
36  // RawTowerGeomContainer* hcalin_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALIN");
37  // RawTowerGeomContainer* hcalout_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALOUT");
38 
39  // --- calorimeter cluster containers
40  RawClusterContainer* cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_CEMC");
41  RawClusterContainer* hcalin_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALIN");
42  RawClusterContainer* hcalout_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALOUT");
43 
44  if ( verbosity > 3 )
45  {
46  cout << "cemc_clusters " << cemc_clusters << endl;
47  cout << "hcalin_clusters " << hcalin_clusters << endl;
48  cout << "hcalout_clusters " << hcalout_clusters << endl;
49  }
50 
51  // --- these nodes are created in CreateNode and filled in CopyAndMakeClusters
52  RawClusterContainer* new_cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_CEMC_MOD");
53  RawClusterContainer* new_hcalin_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALIN_MOD");
54  RawClusterContainer* new_hcalout_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALOUT_MOD");
55 
56  if ( verbosity > 3 )
57  {
58  cout << "new_cemc_clusters " << new_cemc_clusters << endl;
59  cout << "new_hcalin_clusters " << new_hcalin_clusters << endl;
60  cout << "new_hcalout_clusters " << new_hcalout_clusters << endl;
61  }
62 
63  // --- loop over cemc clusters
64  double cemc_esum = 0;
65  RawClusterContainer::Range cemc_range = cemc_clusters->getClusters();
66  for ( RawClusterContainer::Iterator cemc_iter = cemc_range.first; cemc_iter != cemc_range.second; ++cemc_iter )
67  {
68  // --- get the current cluster
69  RawCluster* cluster = cemc_iter->second;
70  double energy = cluster->get_energy();
71  cemc_esum += energy;
72  }
73 
74  // --- loop over new_cemc clusters
75  double new_cemc_esum = 0;
76  RawClusterContainer::Range new_cemc_range = new_cemc_clusters->getClusters();
77  for ( RawClusterContainer::Iterator new_cemc_iter = new_cemc_range.first; new_cemc_iter != new_cemc_range.second; ++new_cemc_iter )
78  {
79  // --- get the current cluster
80  RawCluster* cluster = new_cemc_iter->second;
81  double energy = cluster->get_energy();
82  new_cemc_esum += energy;
83  }
84 
85  if ( verbosity > 1 )
86  {
87  cout << "process_event: cemc_esum " << cemc_esum << endl;
88  cout << "process_event: new_cemc_esum " << new_cemc_esum << endl;
89  }
90 
91 
92 
93  return 0;
94 
95 }