Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:19:26

0001 // Tell emacs that this is a C++ source
0002 // -*- C++ -*-.
0003 
0004 #ifndef G4MICROMEGAS_PHG4MICROMEGASHITRECO_H
0005 #define G4MICROMEGAS_PHG4MICROMEGASHITRECO_H
0006 
0007 /*!
0008  * \file PHG4MicromegasHitReco.h
0009  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0010  */
0011 
0012 #include <phparameter/PHParameterInterface.h>
0013 
0014 #include <fun4all/SubsysReco.h>
0015 
0016 #include <gsl/gsl_rng.h>
0017 #include <memory>
0018 #include <string>
0019 #include <utility>
0020 #include <vector>
0021 
0022 class ActsGeometry;
0023 
0024 class CylinderGeomMicromegas;
0025 class PHCompositeNode;
0026 class PHG4Hit;
0027 class TVector2;
0028 
0029 class PHG4MicromegasHitReco : public SubsysReco, public PHParameterInterface
0030 {
0031  public:
0032   explicit PHG4MicromegasHitReco(const std::string& name = "PHG4MicromegasHitReco");
0033 
0034   //! run initialization
0035   int InitRun(PHCompositeNode*) override;
0036 
0037   //! event processing
0038   int process_event(PHCompositeNode*) override;
0039 
0040   //! parameters
0041   void SetDefaultParameters() override;
0042 
0043  private:
0044   //! return full geo node name, that also contains tile information
0045   std::string full_geonodename() const
0046   {
0047     return "CYLINDERGEOM_MICROMEGAS_FULL";
0048   }
0049 
0050   //! get total number of electrons collected for a give g4hit
0051   /*! this accounts for the number of primary electrons, the detector gain, and fluctuations */
0052   uint get_primary_electrons(PHG4Hit*) const;
0053 
0054   //! get single electron amplification
0055   uint get_single_electron_amplification() const;
0056 
0057   //! stores strip number and corresponding charge fraction
0058   using charge_pair_t = std::pair<int, double>;
0059 
0060   //! map strip number to charge fraction
0061   using charge_list_t = std::vector<charge_pair_t>;
0062 
0063   //! distribute a Gaussian charge across adjacent strips
0064   charge_list_t distribute_charge(CylinderGeomMicromegas*, uint tileid, const TVector2& local_position, double sigma) const;
0065 
0066   //! acts geometry
0067   ActsGeometry* m_acts_geometry = nullptr;
0068 
0069   //! timing window (ns)
0070   double m_tmin = -20;
0071 
0072   //! timing window (ns)
0073   double m_tmax = 800;
0074 
0075   //! number of primary electrons per GeV
0076   double m_electrons_per_gev = 0;
0077 
0078   //! min gain
0079   double m_gain = 0;
0080 
0081   //! electron cloud sigma (cm) after avalanche
0082   double m_cloud_sigma = 0.04;
0083 
0084   //! electron transverse diffusion (cm/sqrt(cm))
0085   double m_diffusion_trans = 0.03;
0086 
0087   //! additional smearing of primary electrons (cm)
0088   /** it is used to adjust the Micromegas resolution to actual measurements */
0089   double m_added_smear_sigma_z = 0;
0090   double m_added_smear_sigma_rphi = 0;
0091 
0092   //! rng de-allocator
0093   class Deleter
0094   {
0095    public:
0096     //! deletion operator
0097     void operator()(gsl_rng* rng) const { gsl_rng_free(rng); }
0098   };
0099 
0100   //! random generator that conform with sPHENIX standard
0101   /*! using a unique_ptr with custom Deleter ensures that the structure is properly freed when parent object is destroyed */
0102   std::unique_ptr<gsl_rng, Deleter> m_rng;
0103 };
0104 
0105 #endif