Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:27

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 PHG4TpcGeomContainer;
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   float m_zmax = 0;
0114   float m_zmin = 0;
0115   
0116   ///@name selection parameters
0117   //@{
0118   // residual cuts in r, phi plane
0119   float m_max_dca {std::numeric_limits<float>::quiet_NaN()};
0120 
0121   /// residual cuts in r, phi plane
0122   float m_max_drphi {std::numeric_limits<float>::quiet_NaN()};
0123 
0124   /// residual cuts in r, z plane
0125   float m_max_dz {std::numeric_limits<float>::quiet_NaN()};
0126 
0127   float m_pedestal {74.4};  // pedestal for hit ASDC values
0128 
0129   //@}
0130 
0131   /// matrix container
0132   std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
0133 
0134   ///@name counters
0135   //@{
0136   int m_total_hits {0};
0137   int m_matched_hits {0};
0138   int m_accepted_clusters {0};
0139   //@}
0140 
0141   ///@name nodes
0142   //@{
0143 
0144   PHG4TpcGeomContainer *m_geom_container {nullptr};
0145 
0146   /// Acts geometry
0147   ActsGeometry *m_tGeometry {nullptr};
0148 
0149   /// acts transformation
0150   ActsTransformations m_transformer;
0151 
0152   /// tracks
0153   SvtxTrackMap *m_track_map {nullptr};
0154 
0155   TrkrHitSetContainer *m_hit_map {nullptr};
0156 
0157   //@}
0158 
0159   ///@name evaluation
0160   //@{
0161   bool m_savehistograms {false};
0162   std::string m_histogramfilename {"TpcDirectLaserReconstruction.root"};
0163   std::unique_ptr<TFile> m_histogramfile {nullptr};
0164 
0165   /// dca vs layer number
0166   TH2 *h_dca_layer {nullptr};
0167 
0168   /// delta rphi vs layer number
0169   TH2 *h_deltarphi_layer_south {nullptr};
0170   TH2 *h_deltarphi_layer_north {nullptr};
0171 
0172   /// delta z vs layer number
0173   TH2 *h_deltaz_layer {nullptr};
0174 
0175   TH2 *h_deltar_r {nullptr};
0176 
0177   /// number of entries per cell
0178   TH3 *h_entries {nullptr};
0179   TNtuple *h_hits {nullptr};
0180   TNtuple *h_hits_reco {nullptr};
0181   // adc spectra of ALL lasers
0182   TH1 *h_adc {nullptr};
0183   TH1 *h_adc_reco {nullptr};
0184 
0185   TH1 *h_adc_sum {nullptr};
0186   TH1 *h_adc_sum_reco {nullptr};
0187 
0188   TH1 *h_adc_sum_ratio_true {nullptr};
0189   TH1 *h_adc_sum_ratio {nullptr};
0190 
0191   //_______________________________________
0192 
0193   TH1 *h_num_sum {nullptr};
0194   TH1 *h_num_sum_reco {nullptr};
0195 
0196   TH1 *h_num_sum_ratio_true {nullptr};
0197   TH1 *h_num_sum_ratio {nullptr};
0198 
0199   //_______________________________________
0200 
0201   TH2 *h_adc_vs_DCA_true {nullptr};
0202   TH2 *h_adc_sum_ratio_lasrangle {nullptr};
0203   TH2 *h_num_sum_ratio_lasrangle {nullptr};
0204 
0205   // TNtuple *h_origins {nullptr};
0206   // TNtuple *h_assoc_hits {nullptr};
0207   TNtuple *h_bright_hits_laser1 {nullptr};
0208   TNtuple *h_bright_hits_laser2 {nullptr};
0209   TNtuple *h_bright_hits_laser3 {nullptr};
0210   TNtuple *h_bright_hits_laser4 {nullptr};
0211 
0212   /// for diagnosing separation b/w laser starting points and tpc volume hits
0213   TH2 *h_deltheta_delphi {nullptr};
0214   TH2 *h_deltheta_delphi_1 {nullptr};
0215   TH2 *h_deltheta_delphi_2 {nullptr};
0216   TH2 *h_deltheta_delphi_3 {nullptr};
0217   TH2 *h_deltheta_delphi_4 {nullptr};
0218   TH2 *h_deltheta_delphi_5 {nullptr};
0219   TH2 *h_deltheta_delphi_6 {nullptr};
0220   TH2 *h_deltheta_delphi_7 {nullptr};
0221   TH2 *h_deltheta_delphi_8 {nullptr};
0222 
0223   // for recording # of unique GEM modules hit for the number of associated hits (to be replaced with GEM Modules)
0224   TH1 *h_GEMs_hit {nullptr};
0225   TH1 *h_layers_hit {nullptr};
0226 
0227   TH2 *h_relangle_lasrangle {nullptr};
0228   TH2 *h_relangle_theta_lasrangle {nullptr};
0229   TH2 *h_relangle_phi_lasrangle {nullptr};
0230 
0231   TH2 *h_xy {nullptr};
0232   TH2 *h_xz {nullptr};
0233   TH2 *h_xy_pca {nullptr};
0234   TH2 *h_xz_pca {nullptr};
0235   TH2 *h_dca_path {nullptr};
0236   TH2 *h_zr {nullptr};
0237   TH2 *h_zr_pca {nullptr};
0238   TH2 *h_dz_z {nullptr};
0239   // TNtuple *h_clusters {nullptr};
0240 
0241   //@}
0242 };
0243 
0244 #endif