Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:15:56

0001 #include <TreeMaker.h>
0002 
0003 #include <phool/getClass.h>
0004 #include <phool/PHCompositeNode.h>
0005 
0006 // --- calorimeter towers
0007 #include <calobase/RawTower.h>
0008 #include <calobase/RawTowerContainer.h>
0009 #include <calobase/RawTowerGeom.h>
0010 #include <calobase/RawTowerGeomContainer.h>
0011 
0012 // --- calorimeter clusters
0013 #include <calobase/RawCluster.h>
0014 #include <calobase/RawClusterv1.h>
0015 #include <calobase/RawClusterContainer.h>
0016 
0017 using std::cout;
0018 using std::endl;
0019 
0020 
0021 
0022 int TreeMaker::GetClusters(PHCompositeNode *topNode)
0023 {
0024 
0025   // -----------------------------------------------------------------------------------------------------
0026   // ---
0027   // -----------------------------------------------------------------------------------------------------
0028 
0029   // --- calorimeter tower containers
0030   // RawTowerContainer* cemc_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_CEMC");
0031   // RawTowerContainer* hcalin_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALIN");
0032   // RawTowerContainer* hcalout_towers = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALOUT");
0033 
0034   // --- calorimeter geometry objects
0035   // RawTowerGeomContainer* cemc_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_CEMC");
0036   // RawTowerGeomContainer* hcalin_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALIN");
0037   // RawTowerGeomContainer* hcalout_geom = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALOUT");
0038 
0039   // --- calorimeter cluster containers
0040   RawClusterContainer* cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_CEMC");
0041   RawClusterContainer* hcalin_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALIN");
0042   RawClusterContainer* hcalout_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALOUT");
0043 
0044   if ( verbosity > 3 )
0045     {
0046       cout << "cemc_clusters " << cemc_clusters << endl;
0047       cout << "hcalin_clusters " << hcalin_clusters << endl;
0048       cout << "hcalout_clusters " << hcalout_clusters << endl;
0049     }
0050 
0051   // --- these nodes are created in CreateNode and filled in CopyAndMakeClusters
0052   RawClusterContainer* new_cemc_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_CEMC_MOD");
0053   RawClusterContainer* new_hcalin_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALIN_MOD");
0054   RawClusterContainer* new_hcalout_clusters = findNode::getClass<RawClusterContainer>(topNode,"CLUSTER_HCALOUT_MOD");
0055 
0056   if ( verbosity > 3 )
0057     {
0058       cout << "new_cemc_clusters " << new_cemc_clusters << endl;
0059       cout << "new_hcalin_clusters " << new_hcalin_clusters << endl;
0060       cout << "new_hcalout_clusters " << new_hcalout_clusters << endl;
0061     }
0062 
0063   // --- loop over cemc clusters
0064   double cemc_esum = 0;
0065   RawClusterContainer::Range cemc_range = cemc_clusters->getClusters();
0066   for ( RawClusterContainer::Iterator cemc_iter = cemc_range.first; cemc_iter != cemc_range.second; ++cemc_iter )
0067     {
0068       // --- get the current cluster
0069       RawCluster* cluster = cemc_iter->second;
0070       double energy = cluster->get_energy();
0071       cemc_esum += energy;
0072     }
0073 
0074   // --- loop over new_cemc clusters
0075   double new_cemc_esum = 0;
0076   RawClusterContainer::Range new_cemc_range = new_cemc_clusters->getClusters();
0077   for ( RawClusterContainer::Iterator new_cemc_iter = new_cemc_range.first; new_cemc_iter != new_cemc_range.second; ++new_cemc_iter )
0078     {
0079       // --- get the current cluster
0080       RawCluster* cluster = new_cemc_iter->second;
0081       double energy = cluster->get_energy();
0082       new_cemc_esum += energy;
0083     }
0084 
0085   if ( verbosity > 1 )
0086     {
0087       cout << "process_event: cemc_esum " << cemc_esum << endl;
0088       cout << "process_event: new_cemc_esum " << new_cemc_esum << endl;
0089     }
0090 
0091 
0092 
0093   return 0;
0094 
0095 }