Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:13

0001 /// ===========================================================================
0002 /*! \file   CaloStatusMapper.h
0003  *  \author Derek Anderson
0004  *  \date   05.22.2024
0005  *
0006  *  A Fun4All QA module to plot no. of towers per event
0007  *  and vs. eta, phi as a function of status.
0008  */
0009 /// ===========================================================================
0010 
0011 #ifndef CLUSTERSTATUSMAPPER_H
0012 #define CLUSTERSTATUSMAPPER_H
0013 
0014 // jet qa
0015 // FIXME change to local include when ready to merge
0016 #include <jetqa/JetQADefs.h>
0017 
0018 // module definitions
0019 #include "CaloStatusMapperDefs.h"
0020 
0021 // calo base
0022 #include <calobase/TowerInfoContainerv2.h>
0023 
0024 // f4a libraries
0025 #include <fun4all/SubsysReco.h>
0026 
0027 // c++ utilities
0028 #include <map>
0029 #include <string>
0030 #include <vector>
0031 
0032 // forward declarations
0033 class PHCompositeNode;
0034 class Fun4AllHistoManager;
0035 class TH1;
0036 class TriggerAnalyzer;
0037 
0038 
0039 
0040 // ============================================================================
0041 //! Map Status of Calo Towers
0042 // ============================================================================
0043 /*! This Fun4all modules ingests calorimeter towers, and then plots
0044  *  the no. of towers per event and vs. eta/phi for a given status.
0045  */
0046 class CaloStatusMapper : public SubsysReco
0047 {
0048 
0049   public:
0050 
0051     // ========================================================================
0052     //! Options for CaloStatusMapper module
0053     // ========================================================================
0054     struct Config
0055     {
0056 
0057       ///! turn debug messages on/off
0058       bool debug {true};
0059 
0060       ///! module name
0061       std::string moduleName {"CaloStatusMapper"};
0062 
0063       ///! histogram tag
0064       std::string histTag {""};
0065 
0066       ///! input nodes and what type of calo they are
0067       std::vector<CaloStatusMapperDefs::NodeDef> inNodeNames
0068       {
0069         {"TOWERINFO_CALIB_CEMC",    CaloStatusMapperDefs::Calo::EMCal},
0070         {"TOWERINFO_CALIB_HCALIN",  CaloStatusMapperDefs::Calo::HCal},
0071         {"TOWERINFO_CALIB_HCALOUT", CaloStatusMapperDefs::Calo::HCal}
0072       };
0073 
0074      ///! turn trigger selection on/off
0075      bool doTrgSelect {false};
0076 
0077      ///! trigger to select
0078      uint32_t trgToSelect {JetQADefs::GL1::MBDNSJet1};
0079 
0080     };  // end Config
0081 
0082     // ctor/dtor
0083     CaloStatusMapper(const std::string& modulename = "CaloStatusMapper", const bool debug = false);
0084     CaloStatusMapper(const Config& config);
0085     ~CaloStatusMapper() override;
0086 
0087     // setters
0088     void SetConfig(const Config& config) {m_config = config;}
0089 
0090     // getters
0091     Config GetConfig() {return m_config;}
0092 
0093     // f4a methods
0094     int Init(PHCompositeNode* /*topNode*/) override;
0095     int process_event(PHCompositeNode* topNode) override;
0096     int End(PHCompositeNode* /*topNode*/) override;
0097 
0098   private:
0099 
0100     // private methods
0101     void InitHistManager();
0102     void BuildHistograms();
0103     void GrabNodes(PHCompositeNode* topNode);
0104     std::string MakeBaseName(const std::string& base, const std::string& node, const std::string& stat = "") const;
0105 
0106     ///! module configuration
0107     Config m_config;
0108 
0109     ///! histogram manager
0110     Fun4AllHistoManager* m_manager {nullptr};
0111 
0112     ///! for checking which trigger fired
0113     TriggerAnalyzer* m_analyzer {nullptr};
0114 
0115     ///! status labels
0116     std::map<CaloStatusMapperDefs::Stat, std::string> m_mapStatLabels {CaloStatusMapperDefs::StatLabels()};
0117 
0118     ///! output histograms
0119     std::map<std::string, TH1*> m_hists;
0120 
0121     ///! input nodes
0122     std::vector<TowerInfoContainer*> m_inNodes;
0123 
0124     ///! no. of events processed
0125     uint64_t m_nEvent {0};
0126 
0127 };  // end CaloStatusMapper
0128 
0129 #endif
0130 
0131 // end ========================================================================