Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:04:50

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 
0012       // random number generator seed
0013       /* FIXME: don't use 0 if `TRandomMixMax` is the RNG, it can get "stuck"
0014        * FIXME: remove this warning when this issue is resolved:
0015        *        https://github.com/eic/EICrecon/issues/539
0016        */
0017       unsigned long seed = 1; // seed for RNG (note: `0` might mean "unique" seed)
0018 
0019       // triggering
0020       double hitTimeWindow  = 20.0;   // time gate in which 2 input hits will be grouped to 1 output hit // [ns]
0021       double timeResolution = 1/16.0; // time resolution (= 1 / TDC counts per unit time) // [ns]
0022       double speMean        = 80.0;   // mean ADC counts for a single photon
0023       double speError       = 16.0;   // sigma of ADC counts for a single photon
0024       double pedMean        = 200.0;  // mean ADC counts for the pedestal
0025       double pedError       = 3.0;    // sigma of ADC counts for the pedestal
0026 
0027       // noise
0028       bool enableNoise       = false;
0029       double noiseRate       = 20000; // [Hz]
0030       double noiseTimeWindow = 20.0;  // [ns]
0031 
0032       // SiPM pixels
0033       bool   enablePixelGaps = false; // enable/disable removal of hits in gaps between pixels
0034 
0035       // overall safety factor
0036       /* simulations assume the detector is ideal and perfect, but reality is
0037        * often neither; use this safety factor to reduce the number of initial
0038        * photon hits for a more conservative estimate of the number of
0039        * photoelectrons, or set to 1 to apply no such factor
0040        */
0041       double safetyFactor = 1.0; // allowed range: (0,1]
0042 
0043       // quantum efficiency
0044       bool enableQuantumEfficiency = true;
0045       // - wavelength units are [nm]
0046       // FIXME: figure out how users can override this, maybe an external `yaml` file
0047       std::vector<std::pair<double, double> > quantumEfficiency = {
0048         {315,  0.00},
0049         {325,  0.04},
0050         {340,  0.10},
0051         {350,  0.20},
0052         {370,  0.30},
0053         {400,  0.35},
0054         {450,  0.40},
0055         {500,  0.38},
0056         {550,  0.35},
0057         {600,  0.27},
0058         {650,  0.20},
0059         {700,  0.15},
0060         {750,  0.12},
0061         {800,  0.08},
0062         {850,  0.06},
0063         {900,  0.04},
0064         {1000, 0.00}
0065       };
0066 
0067       /*
0068          std::vector<std::pair<double, double> > quantumEfficiency = { // test unit QE
0069          {325, 1.00},
0070          {900, 1.00}
0071          };
0072          */
0073 
0074       friend std::ostream& operator<<(std::ostream& os, const PhotoMultiplierHitDigiConfig& cfg);
0075 
0076   };
0077 
0078   std::ostream& operator<<(std::ostream& os, const PhotoMultiplierHitDigiConfig& cfg) {
0079     os << fmt::format("{:=^60}", " PhotoMultiplierHitDigiConfig Settings ") << std::endl;
0080     auto print_param = [&os] (auto name, auto val) {
0081       os << fmt::format("  {:>20} = {:<}", name, val) << std::endl;
0082     };
0083     print_param("seed", cfg.seed);
0084     print_param("hitTimeWindow", cfg.hitTimeWindow);
0085     print_param("timeResolution", cfg.timeResolution);
0086     print_param("speMean", cfg.speMean);
0087     print_param("speError", cfg.speError);
0088     print_param("pedMean", cfg.pedMean);
0089     print_param("pedError", cfg.pedError);
0090     print_param("enablePixelGaps", cfg.enablePixelGaps);
0091     print_param("safetyFactor", cfg.safetyFactor);
0092     print_param("enableNoise", cfg.enableNoise);
0093     print_param("noiseRate", cfg.noiseRate);
0094     print_param("noiseTimeWindow", cfg.noiseTimeWindow);
0095     os << fmt::format("{:-^60}", " Quantum Efficiency vs. Wavelength ") << std::endl;
0096     for(auto& [wl,qe] : cfg.quantumEfficiency)
0097       os << fmt::format("  {:>10} {:<}", wl, qe) << std::endl;
0098     return os;
0099   }
0100 
0101 }