Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:22

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   TwrInterfaces.cc
0003  *  \author Derek Anderson
0004  *  \date   08.04.2024
0005  *
0006  *  Calorimeter tower-related interfaces.
0007  */
0008 /// ---------------------------------------------------------------------------
0009 
0010 #define SCORRELATORUTILITIES_TWRINTERFACES_CC
0011 
0012 // namespace definition 
0013 #include "TwrInterfaces.h"
0014 
0015 // make common namespaces implicit
0016 using namespace std;
0017 using namespace findNode;
0018 
0019 
0020 
0021 // tower interfaces ===========================================================
0022 
0023 namespace SColdQcdCorrelatorAnalysis {
0024 
0025   // --------------------------------------------------------------------------
0026   //! Get raw tower container from node tree
0027   // --------------------------------------------------------------------------
0028   RawTowerContainer* Interfaces::GetRawTowerStore(PHCompositeNode* topNode, const string node) {
0029 
0030     // grab clusters
0031     RawTowerContainer* towerStore = getClass<RawTowerContainer>(topNode, node.data());
0032     if (!towerStore) {
0033       cout << PHWHERE
0034            << "PANIC: " << node << " node is missing!"
0035            << endl;
0036       assert(towerStore);
0037     }
0038     return towerStore;
0039 
0040   }  // end 'GetRawTowerStore(PHCompositeNode*, string)'
0041 
0042 
0043 
0044   // --------------------------------------------------------------------------
0045   //! Get tower info container from node tree
0046   // --------------------------------------------------------------------------
0047   TowerInfoContainer* Interfaces::GetTowerInfoStore(PHCompositeNode* topNode, const string node) {
0048 
0049     // grab clusters
0050     TowerInfoContainer* towerStore = getClass<TowerInfoContainer>(topNode, node.data());
0051     if (!towerStore) {
0052       cout << PHWHERE
0053            << "PANIC: " << node << " node is missing!"
0054            << endl;
0055       assert(towerStore);
0056     }
0057     return towerStore;
0058 
0059   }  // end 'GetTowerInfoStore(PHCompositeNode*, string)'
0060 
0061 
0062 
0063   // --------------------------------------------------------------------------
0064   //! Get raw towers from container
0065   // --------------------------------------------------------------------------
0066   RawTowerContainer::ConstRange Interfaces::GetRawTowers(PHCompositeNode* topNode, const string store) {
0067 
0068     // get store and return range of clusters
0069     RawTowerContainer* towerStore = GetRawTowerStore(topNode, store);
0070     return towerStore -> getTowers();
0071 
0072   }  // end 'GetRawTowers(PHCompositeNode*, string)'
0073 
0074 
0075 
0076   // --------------------------------------------------------------------------
0077   //! Get tower geometry container from node tree
0078   // --------------------------------------------------------------------------
0079   RawTowerGeomContainer* Interfaces::GetTowerGeometries(PHCompositeNode* topNode, const string node) {
0080 
0081     // grab container
0082     RawTowerGeomContainer* geometries = getClass<RawTowerGeomContainer>(topNode, node.data());
0083     if (!geometries) {
0084       cout << PHWHERE
0085            << "PANIC: " << node << " node is missing!"
0086            << endl;
0087       assert(geometries);
0088     }
0089     return geometries;
0090 
0091   }  // end 'GetTowerGeomtries(PHCompositeNode*, string)'
0092 
0093 
0094 
0095   // --------------------------------------------------------------------------
0096   //! Get a specific tower geometry
0097   // --------------------------------------------------------------------------
0098   RawTowerGeom* Interfaces::GetTowerGeometry(PHCompositeNode* topNode, const int subsys, const int rawKey) {
0099 
0100     // grab geometry container
0101     RawTowerGeomContainer* geometries = GetTowerGeometries( 
0102       topNode,
0103       Const::MapIndexOntoTowerGeom()[ subsys ]
0104     );
0105 
0106     // now grab geometry associated with RawTower key
0107     RawTowerGeom* geometry = geometries -> get_tower_geometry(rawKey);
0108     if (!geometry) {
0109       cout << PHWHERE
0110            << "PANIC: geometry is missing for key " << rawKey << " from node " << Const::MapIndexOntoTowerGeom()[ subsys ] << "!"
0111            << endl;
0112       assert(geometry);
0113     }
0114     return geometry;
0115 
0116   }  // end 'GetTowerGeometry(PHCompositeNode*, int, int)'
0117 
0118 }  // end SColdQcdCorrealtorAnalysis namespace
0119 
0120 // end ------------------------------------------------------------------------