Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:30

0001 #ifndef GLOBALQA_GLOBALQA_H
0002 #define GLOBALQA_GLOBALQA_H
0003 
0004 #include <fun4all/SubsysReco.h>
0005 
0006 #include <limits>  // for numeric_limits
0007 #include <string>
0008 #include <vector>
0009 
0010 // Forward declarations
0011 class CDBTTree;
0012 class PHCompositeNode;
0013 class TH1;
0014 class TH2;
0015 class TProfile2D;
0016 
0017 class GlobalQA : public SubsysReco
0018 {
0019  public:
0020   //! constructor
0021   GlobalQA(const std::string &name =
0022                "GlobalQA");  // const std::string &filename = "testQA.root");
0023   // //int nevents = 100);
0024 
0025   //! destructor
0026   ~GlobalQA() override;
0027 
0028   //! full initialization
0029   int Init(PHCompositeNode *) override;
0030 
0031   //! event processing method
0032   int process_event(PHCompositeNode *) override;
0033 
0034   int process_g4hits(PHCompositeNode *);
0035   int process_g4cells(PHCompositeNode *);
0036   int process_towers(PHCompositeNode *);
0037   int process_clusters(PHCompositeNode *);
0038 
0039   void Detector(const std::string &name) { detector = name; }
0040   void set_timing_cut_width(const int &t) { _range = t; }
0041 
0042   void set_debug(bool debug) { m_debug = debug; }
0043   TH2 *LogYHist2D(const std::string &name, const std::string &title, int,
0044                   double, double, int, double, double);
0045 
0046  private:
0047   int evtcount{0};
0048   int Getpeaktime(TH1 *h);
0049   void createHistos();
0050 
0051   // MBD histos
0052   TH1 *h_GlobalQA_mbd_zvtx{nullptr};
0053   TH1 *h_GlobalQA_mbd_zvtx_wide{nullptr};
0054   TH1 *h_GlobalQA_calc_zvtx{nullptr};
0055   TH1 *h_GlobalQA_calc_zvtx_wide{nullptr};
0056   TH1 *h_GlobalQA_mbd_charge_s{nullptr};
0057   TH1 *h_GlobalQA_mbd_charge_n{nullptr};
0058   TH1 *h_GlobalQA_mbd_charge_sum{nullptr};
0059   TH2 *h2_GlobalQA_mbd_charge_NS_correlation{nullptr};
0060   TH1 *h_GlobalQA_mbd_nhit_s{nullptr};
0061   TH1 *h_GlobalQA_mbd_nhit_n{nullptr};
0062   TH2 *h2_GlobalQA_mbd_nhits_NS_correlation{nullptr};
0063   TH1 *h_GlobalQA_mbd_zvtxq{nullptr};
0064 
0065   // sEPD
0066   TH1 *h_GlobalQA_sEPD_tile[744] = {nullptr};
0067   TH1 *h_GlobalQA_sEPD_adcsum_s{nullptr};
0068   TH1 *h_GlobalQA_sEPD_adcsum_n{nullptr};
0069   TH2 *h2_GlobalQA_sEPD_adcsum_ns{nullptr};
0070   TH2 *h2_GlobalQA_sEPD_ADC_channel_north{nullptr};
0071   TH2 *h2_GlobalQA_sEPD_ADC_channel_south{nullptr};
0072   TProfile2D *h2Profile_GlobalQA_sEPD_tiles_north{nullptr};
0073   TProfile2D *h2Profile_GlobalQA_sEPD_tiles_south{nullptr};
0074 
0075   // ZDC histos
0076   TH1 *h_GlobalQA_zdc_zvtx{nullptr};
0077   TH1 *h_GlobalQA_zdc_zvtx_wide{nullptr};
0078   TH1 *h_GlobalQA_zdc_energy_s{nullptr};
0079   TH1 *h_GlobalQA_zdc_energy_n{nullptr};
0080   TH1 *h_GlobalQA_triggerVec{nullptr};
0081   float zdc_zvtx{std::numeric_limits<float>::quiet_NaN()};
0082 
0083   int _eventcounter{0};
0084   int _range{1};
0085 
0086   bool m_debug{false};
0087 
0088   std::string detector;
0089   std::string m_outputFileName;
0090   std::string OutputFileName;
0091 
0092   // MBD trigger bit definitions (matching online monitoring)
0093   static constexpr uint64_t mbdns = (0x1UL << 10) | (0x1UL << 11);  // MBD NS2 and NS1
0094   static constexpr uint64_t mbdnsvtx10 = (0x1UL << 12) | (0x1UL << 15);  // MBD NS2/NS1 with vtx < 10cm
0095   static constexpr uint64_t mbdnsvtx30 = (0x1UL << 13);  // MBD NS2 with vtx < 30cm
0096   static constexpr uint64_t mbdnsvtx150 = (0x1UL << 14);  // MBD NS2 with vtx < 150cm
0097   static constexpr uint64_t mbdtrig = mbdns | mbdnsvtx10 | mbdnsvtx30 | mbdnsvtx150;  // Combined MBD triggers
0098 };
0099 
0100 #endif