Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-08-31 08:22:18

0001 #ifndef QA_TRACKING_SILICONDRIFTQA_H
0002 #define QA_TRACKING_SILICONDRIFTQA_H
0003 
0004 /*
0005  * QA version of SiliconDriftEvaluator (B. Sayki, LANL).
0006  *
0007  * Monitors the TPC drift velocity calibration by comparing the z position of
0008  * the TPC seed and the silicon seed at the beam line, following the standard
0009  * sPHENIX QA module conventions
0010  * Claude code was used in formatting and debugging of this module
0011  * v_new = v_in / (1 + slope)
0012  * t0    = (offset_pos - offset_neg) / (2 v_new)
0013  */
0014 
0015 #include <fun4all/SubsysReco.h>
0016 
0017 #include <string>
0018 
0019 class PHCompositeNode;
0020 class TH1;
0021 class TH2;
0022 
0023 class SiliconDriftQA : public SubsysReco
0024 {
0025  public:
0026   explicit SiliconDriftQA(const std::string& name = "SiliconDriftQA");
0027 
0028   ~SiliconDriftQA() override = default;
0029 
0030   //! run initialization: create and register histograms
0031   int InitRun(PHCompositeNode* topNode) override;
0032 
0033   //! event processing: fill histograms
0034   int process_event(PHCompositeNode* topNode) override;
0035 
0036   //! end of processing: fit accumulated distributions, fill summary histogram
0037   int End(PHCompositeNode* topNode) override;
0038 
0039   //! track map name
0040   void set_trackmapname(const std::string& value) { m_trackmapname = value; }
0041 
0042   //! initial drift velocity (cm/ns); starting point for the fit and used in the crossing correction
0043   void set_drift_velocity(double value) { m_drift_velocity = value; }
0044 
0045   //! bunch-crossing interval in ns (default: 106.65237 ns)
0046   void set_crossing_interval(double value) { m_crossing_interval = value; }
0047 
0048   //! minimum pT cut on tracks (GeV)
0049   void set_min_pt(double value) { m_min_pt = value; }
0050 
0051   //! minimum number of TPC clusters required
0052   void set_min_nclusters_tpc(unsigned int value) { m_min_nclusters_tpc = value; }
0053 
0054   //! minimum number of MVTX clusters required
0055   void set_min_nclusters_mvtx(unsigned int value) { m_min_nclusters_mvtx = value; }
0056 
0057   //! minimum number of INTT clusters required
0058   void set_min_nclusters_intt(unsigned int value) { m_min_nclusters_intt = value; }
0059 
0060   //! maximum abs(eta) of TPC seed accepted
0061   void set_max_eta(double value) { m_max_eta = value; }
0062 
0063   //! half-range of the z_si histogram axis (cm)
0064   void set_max_z(double value) { m_max_z = value; }
0065 
0066   //! half-range of the dz histogram axis (cm)
0067   void set_max_dz(double value) { m_max_dz = value; }
0068 
0069   //! minimum entries per z slice required by FitSlicesY
0070   void set_min_slice_entries(int value) { m_min_slice_entries = value; }
0071 
0072  private:
0073   void createHistos();
0074   std::string getHistoPrefix() const;
0075 
0076   //!@name histograms (owned by the QA histogram manager)
0077   //@{
0078 
0079   //! z_si vs dz, one per eta bin (0: eta<0, 1: eta>=0)
0080   TH2* h_zsi_dz[2]{nullptr, nullptr};
0081 
0082   //! crossing-corrected dz = z_tpc_corr - z_si (cm)
0083   TH1* h_dz{nullptr};
0084 
0085   //! number of accepted tracks per event
0086   TH1* h_ntracks{nullptr};
0087 
0088   //! drift velocity fit summary, filled in End()
0089   TH1* h_driftSummary{nullptr};
0090 
0091   //@}
0092 
0093   //! track map name
0094   std::string m_trackmapname{"SvtxTrackMap"};
0095 
0096   //! initial drift velocity (cm/ns)
0097   double m_drift_velocity{0.00749};
0098 
0099   //! bunch-crossing interval (ns)
0100   double m_crossing_interval{106.65237};
0101 
0102   //!@name track selection cuts
0103   //@{
0104   double m_min_pt{0.5};
0105   unsigned int m_min_nclusters_tpc{20};
0106   unsigned int m_min_nclusters_mvtx{3};
0107   unsigned int m_min_nclusters_intt{2};
0108   double m_max_eta{0.9};
0109   //@}
0110 
0111   //! histogram ranges
0112   double m_max_z{20.0};
0113   double m_max_dz{10.0};
0114 
0115   //! minimum entries per z slice for FitSlicesY
0116   int m_min_slice_entries{10};
0117 };
0118 
0119 #endif  // QA_TRACKING_SILICONDRIFTQA_H