Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ===========================================================================
0002 /*! \file   TrksInJetQA.h
0003  *  \author Derek Anderson
0004  *  \date   03.25.2024
0005  *
0006  *  A "small" Fun4All module to produce QA plots for tracks,
0007  *  hits, and more.
0008  */
0009 /// ============================================================================
0010 
0011 #ifndef TRKSINJETQA_H
0012 #define TRKSINJETQA_H
0013 
0014 // module utilities
0015 #include "JetQADefs.h"
0016 #include "TrksInJetQAConfig.h"
0017 #include "TrksInJetQAHist.h"
0018 #include "TrksInJetQAInJetFiller.h"
0019 #include "TrksInJetQAInclusiveFiller.h"
0020 
0021 // calo trigger includes
0022 #include <calotrigger/TriggerAnalyzer.h>
0023 
0024 // f4a includes
0025 #include <fun4all/Fun4AllHistoManager.h>
0026 #include <fun4all/Fun4AllReturnCodes.h>
0027 #include <fun4all/SubsysReco.h>
0028 
0029 // phool includes
0030 #include <phool/PHCompositeNode.h>
0031 #include <phool/phool.h>
0032 
0033 // qa utilities
0034 #include <qautils/QAHistManagerDef.h>
0035 
0036 // root includes
0037 #include <TFile.h>
0038 
0039 // c++ utilities
0040 #include <algorithm>
0041 #include <cassert>
0042 #include <cstdlib>
0043 #include <optional>
0044 #include <string>
0045 #include <utility>
0046 #include <vector>
0047 
0048 // ============================================================================
0049 //! Tracks-in-jet QA
0050 // ============================================================================
0051 /*! This Fun4All module generates histograms to QA low-level
0052  *  info of tracks found inside a jet, as well as some
0053  *  kinematic information.
0054  */ 
0055 class TrksInJetQA : public SubsysReco
0056 {
0057  public:
0058 
0059   ///! enumerates possibe output modes
0060   enum OutMode
0061   {
0062     File,
0063     QA
0064   };
0065 
0066   // ctor/dtor
0067   TrksInJetQA(const std::string& name = "TrksInJetQA");
0068   ~TrksInJetQA() override;
0069 
0070   // setters
0071   void SetOutFileName(const std::string& name) { m_outFileName = name; }
0072   void SetHistPrefix(const std::string& prefix) { m_histPrefix = prefix; }
0073   void SetHistSuffix(const std::string& suffix) { m_histSuffix = suffix; }
0074   void SetTrgToSelect(const uint32_t trig = JetQADefs::GL1::MBDNSJet1)
0075   {
0076     m_doTrgSelect = true;
0077     m_trgToSelect = trig;
0078   }
0079 
0080   // public methods
0081   void Configure(const TrksInJetQAConfig& config,
0082                  std::optional<TrksInJetQAHist> hist = std::nullopt);
0083 
0084   // f4a methods
0085   int Init(PHCompositeNode* /*topNode*/) override;
0086   int process_event(PHCompositeNode* topNode) override;
0087   int End(PHCompositeNode* /*topNode*/) override;
0088 
0089  private:
0090 
0091   // private methods
0092   void InitOutput();
0093   void InitHistograms();
0094   void RegisterHistograms();
0095 
0096   // io members
0097   TFile* m_outFile {nullptr};
0098   std::string m_moduleName;
0099   std::string m_outFileName {"tracksInJetsQA.root"};
0100   Fun4AllHistoManager* m_manager {nullptr};
0101   TriggerAnalyzer* m_analyzer {nullptr};
0102 
0103   // trigger selection
0104   bool m_doTrgSelect {false};
0105   uint32_t m_trgToSelect {JetQADefs::GL1::MBDNSJet1};
0106 
0107   // optional prefix, suffix for histograms
0108   std::optional<std::string> m_histPrefix {std::nullopt};
0109   std::optional<std::string> m_histSuffix {std::nullopt};
0110 
0111   // submodules to run
0112   std::unique_ptr<TrksInJetQAInJetFiller> m_inJet;
0113   std::unique_ptr<TrksInJetQAInclusiveFiller> m_inclusive;
0114 
0115   // module utilities
0116   TrksInJetQAConfig m_config;
0117   TrksInJetQAHist m_hist;
0118 
0119 };  // end TrksInJetQA
0120 
0121 #endif
0122 
0123 // end ========================================================================