Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-05-23 08:13:15

0001 #ifndef MBD_MBDCALIBRECO_H
0002 #define MBD_MBDCALIBRECO_H
0003 
0004 #include "MbdDefs.h"
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <array>
0009 #include <cstdint>
0010 #include <memory>
0011 #include <string>
0012 #include <THnSparse.h>
0013 
0014 class PHCompositeNode;
0015 class MbdCalib;
0016 class MbdPmtContainer;
0017 class MbdOut;
0018 class MbdGeom;
0019 class Gl1Packet;
0020 class EventHeader;
0021 class RunHeader;
0022 class TH1;
0023 class TH2;
0024 class TFile;
0025 class TGraphErrors;
0026 
0027 class MbdCalibReco : public SubsysReco
0028 {
0029  public:
0030   MbdCalibReco(const std::string& name = "MbdCalibReco");
0031   ~MbdCalibReco() override = default;
0032 
0033   int Init(PHCompositeNode* topNode) override;
0034   int InitRun(PHCompositeNode* topNode) override;
0035   int process_event(PHCompositeNode* topNode) override;
0036   int EndRun(const int runnumber) override;
0037 
0038   void SetSubPass(const int s)          { _subpass = s; }
0039   void SetCalDir(const std::string& d)  { _caldir = d; }
0040   void SetCDBTag(const std::string& t)  { _cdbtag = t; }
0041 
0042  private:
0043   int  getNodes(PHCompositeNode* topNode);
0044   void BookHistograms();
0045   void DeleteHistograms();
0046 
0047   uint64_t    _mbias_trigger_mask{0};
0048 
0049   int         _subpass{0};
0050   int         _runnumber{0};
0051   std::string _caldir{"results"};
0052   std::string _rundir;   // _caldir/<runnumber>/
0053   std::string _cdbtag{}; // non-empty → download from CDB instead of local files
0054 
0055   std::unique_ptr<MbdCalib> _mbdcal;
0056   MbdPmtContainer* _mbdpmts{nullptr};
0057   MbdOut*          _mbdout{nullptr};
0058   MbdGeom*         _mbdgeom{nullptr};
0059   EventHeader*     _evtheader{nullptr};
0060   RunHeader*       _runheader{nullptr};
0061   Gl1Packet*       _gl1packet{nullptr};
0062 
0063   std::array<TH1*, MbdDefs::MBD_N_PMT> h_tt{};
0064   std::array<TH1*, MbdDefs::MBD_N_PMT> h_tq{};
0065   std::array<TH1*, MbdDefs::MBD_N_PMT> h_qp{};
0066   std::array<THnSparseF*, MbdDefs::MBD_N_PMT> h2_slew{};
0067   TH2* h2_tt{nullptr};
0068   TH2* h2_tq{nullptr};
0069 
0070   std::unique_ptr<TFile> _outfile{nullptr};
0071 };
0072 
0073 #endif  // MBD_MBDCALIBRECO_H