Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 // -*- C++ -*-.
0003 
0004 #ifndef G4MICROMEGAS_PHG4MICROMEGASDIGITIZER_H
0005 #define G4MICROMEGAS_PHG4MICROMEGASDIGITIZER_H
0006 
0007 /*!
0008  * \file PHG4MicromegasDigitizer.h
0009  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0010  */
0011 
0012 #include <fun4all/SubsysReco.h>
0013 
0014 #include <phparameter/PHParameterInterface.h>
0015 
0016 #include <gsl/gsl_rng.h>
0017 
0018 #include <memory>
0019 #include <string>  // for string
0020 
0021 class PHCompositeNode;
0022 
0023 class PHG4MicromegasDigitizer : public SubsysReco, public PHParameterInterface
0024 {
0025  public:
0026   PHG4MicromegasDigitizer(const std::string &name = "PHG4MicromegasDigitizer");
0027 
0028   //! run initialization
0029   int InitRun(PHCompositeNode *) override;
0030 
0031   //! event processing
0032   int process_event(PHCompositeNode *topNode) override;
0033 
0034   //! parameters
0035   void SetDefaultParameters() override;
0036 
0037  private:
0038   //! add noise to a measurement
0039   double add_noise() const;
0040 
0041   //! threshold (electrons)
0042   double m_adc_threshold = 2700;
0043 
0044   //! noise (electrons)
0045   double m_enc = 670;
0046 
0047   //! pedestal (electrons)
0048   double m_pedestal = 50000;
0049 
0050   //! conversion factor mv/fc
0051   double m_volts_per_charge = 20;
0052 
0053   //! conversion factor (mv/electron)
0054   double m_volt_per_electron_signal = 0;
0055 
0056   //! conversion factor (mv/electron)
0057   double m_volt_per_electron_noise = 0;
0058 
0059   //! conversion factor (adc/mv)
0060   /*! this is a fixed parameter, from SAMPA */
0061   static constexpr double m_adc_per_volt = 1024. / 2200;
0062 
0063   //! rng de-allocator
0064   class Deleter
0065   {
0066    public:
0067     //! deletion operator
0068     void operator()(gsl_rng *rng) const { gsl_rng_free(rng); }
0069   };
0070 
0071   //! random generator that conform with sPHENIX standard
0072   /*! using a unique_ptr with custom Deleter ensures that the structure is properly freed when parent object is destroyed */
0073   std::unique_ptr<gsl_rng, Deleter> m_rng;
0074 };
0075 
0076 #endif