Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:55:18

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022, 2023, Christopher Dilks, Luigi Dello Stritto
0003 
0004 #pragma once
0005 
0006 #include <spdlog/spdlog.h>
0007 
0008 namespace eicrecon {
0009 class PhotoMultiplierHitDigiConfig {
0010 public:
0011   // Detector and readout identifiers
0012   std::string detectorName{""};
0013   std::string readoutClass{""};
0014 
0015   // triggering
0016   double hitTimeWindow =
0017       20.0; // time gate in which 2 input hits will be grouped to 1 output hit // [ns]
0018   double timeResolution = 1 / 16.0; // time resolution (= 1 / TDC counts per unit time) // [ns]
0019   double speMean        = 80.0;     // mean ADC counts for a single photon
0020   double speError       = 16.0;     // sigma of ADC counts for a single photon
0021   double pedMean        = 200.0;    // mean ADC counts for the pedestal
0022   double pedError       = 3.0;      // sigma of ADC counts for the pedestal
0023 
0024   // noise
0025   bool enableNoise       = false;
0026   double noiseRate       = 20000; // [Hz]
0027   double noiseTimeWindow = 20.0;  // [ns]
0028 
0029   // SiPM pixels
0030   bool enablePixelGaps = false; // enable/disable removal of hits in gaps between pixels
0031 
0032   // overall safety factor
0033   /* simulations assume the detector is ideal and perfect, but reality is
0034        * often neither; use this safety factor to reduce the number of initial
0035        * photon hits for a more conservative estimate of the number of
0036        * photoelectrons, or set to 1 to apply no such factor
0037        */
0038   double safetyFactor = 1.0; // allowed range: (0,1]
0039 
0040   // quantum efficiency
0041   bool enableQuantumEfficiency = true;
0042   // - wavelength units are [nm]
0043   // FIXME: figure out how users can override this, maybe an external `yaml` file
0044   std::vector<std::pair<double, double>> quantumEfficiency = {
0045       {315, 0.00}, {325, 0.04}, {340, 0.10}, {350, 0.20}, {370, 0.30}, {400, 0.35},
0046       {450, 0.40}, {500, 0.38}, {550, 0.35}, {600, 0.27}, {650, 0.20}, {700, 0.15},
0047       {750, 0.12}, {800, 0.08}, {850, 0.06}, {900, 0.04}, {1000, 0.00}};
0048 
0049   /*
0050          std::vector<std::pair<double, double> > quantumEfficiency = { // test unit QE
0051          {325, 1.00},
0052          {900, 1.00}
0053          };
0054          */
0055 
0056   friend std::ostream& operator<<(std::ostream& os, const PhotoMultiplierHitDigiConfig& cfg);
0057 };
0058 
0059 std::ostream& operator<<(std::ostream& os, const PhotoMultiplierHitDigiConfig& cfg) {
0060   os << fmt::format("{:=^60}", " PhotoMultiplierHitDigiConfig Settings ") << std::endl;
0061   auto print_param = [&os](auto name, auto val) {
0062     os << fmt::format("  {:>20} = {:<}", name, val) << std::endl;
0063   };
0064   print_param("hitTimeWindow", cfg.hitTimeWindow);
0065   print_param("timeResolution", cfg.timeResolution);
0066   print_param("speMean", cfg.speMean);
0067   print_param("speError", cfg.speError);
0068   print_param("pedMean", cfg.pedMean);
0069   print_param("pedError", cfg.pedError);
0070   print_param("enablePixelGaps", cfg.enablePixelGaps);
0071   print_param("safetyFactor", cfg.safetyFactor);
0072   print_param("enableNoise", cfg.enableNoise);
0073   print_param("noiseRate", cfg.noiseRate);
0074   print_param("noiseTimeWindow", cfg.noiseTimeWindow);
0075   os << fmt::format("{:-^60}", " Quantum Efficiency vs. Wavelength ") << std::endl;
0076   for (auto& [wl, qe] : cfg.quantumEfficiency)
0077     os << fmt::format("  {:>10} {:<}", wl, qe) << std::endl;
0078   return os;
0079 }
0080 
0081 } // namespace eicrecon