Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:41

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef G4DETECTORS_LIGHTCOLLECTIONMODEL_H
0004 #define G4DETECTORS_LIGHTCOLLECTIONMODEL_H
0005 #include <string>
0006 
0007 class TH2;
0008 class TH1;
0009 
0010 class LightCollectionModel
0011 {
0012  public:
0013   LightCollectionModel() = default;
0014 
0015   //! delete copy ctor and assignment opertor (cppcheck)
0016   explicit LightCollectionModel(const LightCollectionModel &) = delete;
0017   LightCollectionModel &operator=(const LightCollectionModel &) = delete;
0018 
0019   virtual ~LightCollectionModel();
0020 
0021   //! input data file
0022   void load_data_file(const std::string &input_file, const std::string &histogram_light_guide_model, const std::string &histogram_fiber_model);
0023 
0024   //! load from CDB
0025   void load_data_from_CDB(const std::string &domain, const std::string &histogram_light_guide_model, const std::string &histogram_fiber_model);
0026 
0027   //! Whether use light collection model
0028   bool use_light_guide_model() const { return data_grid_light_guide_efficiency != nullptr; }
0029 
0030   //! Whether use Light Transmission Efficiency model for the fiber
0031   bool use_fiber_model() const { return data_grid_fiber_trans != nullptr; }
0032 
0033   //! get Light Collection Efficiency for the light guide as function of x,y position in fraction of tower width
0034   double get_light_guide_efficiency(const double x_fraction, const double y_fraction);
0035 
0036   //! get Light Transmission Efficiency for the fiber as function of z position (cm) in the fiber. Z=0 is at the middle of the fiber
0037   double get_fiber_transmission(const double z_distance);
0038 
0039  private:
0040   //! 2-D data grid for Light Collection Efficiency for the light guide as function of x,y position in fraction of tower width
0041   TH2 *data_grid_light_guide_efficiency{nullptr};
0042 
0043   //! 1-D data grid for the light transmission efficiency in the fiber as function of distance to location in the fiber. Z=0 is at the middle of the fiber
0044   TH1 *data_grid_fiber_trans{nullptr};
0045 
0046   // These two histograms are handed off to Fun4All and will be deleted there
0047   // this suppresses the cppcheck warning
0048   // cppcheck-suppress unsafeClassCanLeak
0049   TH2 *data_grid_light_guide_efficiency_verify{nullptr};
0050   // cppcheck-suppress unsafeClassCanLeak
0051   TH1 *data_grid_fiber_trans_verify{nullptr};
0052 };
0053 
0054 #endif