Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:42

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