Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef TPCCALIB_TPCDIRECTLASERRECONSTRUCTION_H
0002 #define TPCCALIB_TPCDIRECTLASERRECONSTRUCTION_H
0003 
0004 /**
0005  * \file TpcDirectLaserReconstruction.h
0006  * \brief performs the reconstruction of TPC direct laser tracks
0007  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0008  */
0009 
0010 #include <fun4all/SubsysReco.h>
0011 #include <phparameter/PHParameterInterface.h>
0012 #include <trackbase_historic/ActsTransformations.h>
0013 
0014 #include <limits>
0015 #include <memory>
0016 
0017 class SvtxTrack;
0018 class SvtxTrackMap;
0019 class TpcSpaceChargeMatrixContainer;
0020 class TrkrHitSetContainer;
0021 class PHG4TpcCylinderGeomContainer;
0022 
0023 class TFile;
0024 class TH1;
0025 class TH2;
0026 class TH3;
0027 class TH2;
0028 class TVector3;
0029 class TNtuple;
0030 
0031 class TpcDirectLaserReconstruction : public SubsysReco, public PHParameterInterface
0032 {
0033  public:
0034   /// constructor
0035   TpcDirectLaserReconstruction(const std::string & = "TpcDirectLaserReconstruction");
0036 
0037   /// global initialization
0038   int Init(PHCompositeNode *) override;
0039 
0040   /// run initialization
0041   int InitRun(PHCompositeNode *) override;
0042 
0043   /// event processing
0044   int process_event(PHCompositeNode *) override;
0045 
0046   /// end of processing
0047   int End(PHCompositeNode *) override;
0048 
0049   /// parameters
0050   void SetDefaultParameters() override;
0051 
0052   /// output file
0053   /**
0054    * this is the file where space charge matrix container is stored
0055    */
0056   void set_outputfile(const std::string &filename)
0057   {
0058     m_outputfile = filename;
0059   }
0060 
0061   /// set to true to store evaluation histograms and ntuples
0062   void set_savehistograms(bool value) { m_savehistograms = value; }
0063 
0064   /// output file name for evaluation histograms
0065   void set_histogram_outputfile(const std::string &outputfile)
0066   {
0067     m_histogramfilename = outputfile;
0068   }
0069 
0070   /// set grid dimensions
0071   void set_grid_dimensions(int phibins, int rbins, int zbins);
0072 
0073   void set_max_zrange(float length)
0074   {
0075     m_max_zrange = length;
0076   }
0077 
0078   void set_max_dca(float length)
0079   {
0080     m_max_dca = length;
0081   }
0082 
0083  private:
0084   /// load nodes
0085   int load_nodes(PHCompositeNode *);
0086 
0087   /// create evaluation histograms
0088   void create_histograms();
0089 
0090   /// process tracks
0091   void process_tracks();
0092 
0093   /// process track
0094   void process_track(SvtxTrack *);
0095 
0096   /// get relevant cell for a given hit
0097   int get_cell_index(const TVector3 &) const;
0098 
0099   /// get the GEM module where cluster hit
0100   int Locate(float r, float phi, float z);
0101 
0102   float GetRelPhi(float xorig, float yorig, float x, float y, float phiorig);
0103 
0104   float GetRelTheta(float xorig, float yorig, float zorig, float x, float y, float z, float thetaorig, float phiorig);
0105 
0106   bool sameSign(float num1, float num2);
0107 
0108   /// output file
0109   std::string m_outputfile {"TpcSpaceChargeMatrices.root"};
0110 
0111   float m_max_zrange {10.0};  // cm
0112 
0113   ///@name selection parameters
0114   //@{
0115   // residual cuts in r, phi plane
0116   float m_max_dca {std::numeric_limits<float>::quiet_NaN()};
0117 
0118   /// residual cuts in r, phi plane
0119   float m_max_drphi {std::numeric_limits<float>::quiet_NaN()};
0120 
0121   /// residual cuts in r, z plane
0122   float m_max_dz {std::numeric_limits<float>::quiet_NaN()};
0123 
0124   float m_pedestal {74.4};  // pedestal for hit ASDC values
0125 
0126   //@}
0127 
0128   /// matrix container
0129   std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
0130 
0131   ///@name counters
0132   //@{
0133   int m_total_hits {0};
0134   int m_matched_hits {0};
0135   int m_accepted_clusters {0};
0136   //@}
0137 
0138   ///@name nodes
0139   //@{
0140 
0141   PHG4TpcCylinderGeomContainer *m_geom_container {nullptr};
0142 
0143   /// Acts geometry
0144   ActsGeometry *m_tGeometry {nullptr};
0145 
0146   /// acts transformation
0147   ActsTransformations m_transformer;
0148 
0149   /// tracks
0150   SvtxTrackMap *m_track_map {nullptr};
0151 
0152   TrkrHitSetContainer *m_hit_map {nullptr};
0153 
0154   //@}
0155 
0156   ///@name evaluation
0157   //@{
0158   bool m_savehistograms {false};
0159   std::string m_histogramfilename {"TpcDirectLaserReconstruction.root"};
0160   std::unique_ptr<TFile> m_histogramfile {nullptr};
0161 
0162   /// dca vs layer number
0163   TH2 *h_dca_layer {nullptr};
0164 
0165   /// delta rphi vs layer number
0166   TH2 *h_deltarphi_layer_south {nullptr};
0167   TH2 *h_deltarphi_layer_north {nullptr};
0168 
0169   /// delta z vs layer number
0170   TH2 *h_deltaz_layer {nullptr};
0171 
0172   TH2 *h_deltar_r {nullptr};
0173 
0174   /// number of entries per cell
0175   TH3 *h_entries {nullptr};
0176   TNtuple *h_hits {nullptr};
0177   TNtuple *h_hits_reco {nullptr};
0178   // adc spectra of ALL lasers
0179   TH1 *h_adc {nullptr};
0180   TH1 *h_adc_reco {nullptr};
0181 
0182   TH1 *h_adc_sum {nullptr};
0183   TH1 *h_adc_sum_reco {nullptr};
0184 
0185   TH1 *h_adc_sum_ratio_true {nullptr};
0186   TH1 *h_adc_sum_ratio {nullptr};
0187 
0188   //_______________________________________
0189 
0190   TH1 *h_num_sum {nullptr};
0191   TH1 *h_num_sum_reco {nullptr};
0192 
0193   TH1 *h_num_sum_ratio_true {nullptr};
0194   TH1 *h_num_sum_ratio {nullptr};
0195 
0196   //_______________________________________
0197 
0198   TH2 *h_adc_vs_DCA_true {nullptr};
0199   TH2 *h_adc_sum_ratio_lasrangle {nullptr};
0200   TH2 *h_num_sum_ratio_lasrangle {nullptr};
0201 
0202   // TNtuple *h_origins {nullptr};
0203   // TNtuple *h_assoc_hits {nullptr};
0204   TNtuple *h_bright_hits_laser1 {nullptr};
0205   TNtuple *h_bright_hits_laser2 {nullptr};
0206   TNtuple *h_bright_hits_laser3 {nullptr};
0207   TNtuple *h_bright_hits_laser4 {nullptr};
0208 
0209   /// for diagnosing separation b/w laser starting points and tpc volume hits
0210   TH2 *h_deltheta_delphi {nullptr};
0211   TH2 *h_deltheta_delphi_1 {nullptr};
0212   TH2 *h_deltheta_delphi_2 {nullptr};
0213   TH2 *h_deltheta_delphi_3 {nullptr};
0214   TH2 *h_deltheta_delphi_4 {nullptr};
0215   TH2 *h_deltheta_delphi_5 {nullptr};
0216   TH2 *h_deltheta_delphi_6 {nullptr};
0217   TH2 *h_deltheta_delphi_7 {nullptr};
0218   TH2 *h_deltheta_delphi_8 {nullptr};
0219 
0220   // for recording # of unique GEM modules hit for the number of associated hits (to be replaced with GEM Modules)
0221   TH1 *h_GEMs_hit {nullptr};
0222   TH1 *h_layers_hit {nullptr};
0223 
0224   TH2 *h_relangle_lasrangle {nullptr};
0225   TH2 *h_relangle_theta_lasrangle {nullptr};
0226   TH2 *h_relangle_phi_lasrangle {nullptr};
0227 
0228   TH2 *h_xy {nullptr};
0229   TH2 *h_xz {nullptr};
0230   TH2 *h_xy_pca {nullptr};
0231   TH2 *h_xz_pca {nullptr};
0232   TH2 *h_dca_path {nullptr};
0233   TH2 *h_zr {nullptr};
0234   TH2 *h_zr_pca {nullptr};
0235   TH2 *h_dz_z {nullptr};
0236   // TNtuple *h_clusters {nullptr};
0237 
0238   //@}
0239 };
0240 
0241 #endif