Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 08:35:29

0001 // Copyright 2023, Christopher Dilks
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <Evaluator/DD4hepUnits.h>
0007 #include <algorithms/logger.h>
0008 #include <spdlog/spdlog.h>
0009 
0010 namespace eicrecon {
0011 
0012 // radiator config parameters
0013 struct RadiatorConfig {
0014   double referenceRIndex;   // reference radiator refractive index
0015   double attenuation;       // reference radiator attenuation length [mm]; set to 0 to disable
0016   std::string smearingMode; // smearing type: "gaussian", "uniform"
0017   double smearing;          // smearing amount [radians]
0018 };
0019 
0020 // IRT algorithm config
0021 class IrtCherenkovParticleIDConfig {
0022 public:
0023   /////////////////////////////////////////////////////
0024   // CONFIGURATION PARAMETERS
0025   //   NOTE: some defaults are hard-coded here; override externally
0026 
0027   unsigned numRIndexBins = 100; // number of bins to interpolate the refractive index vs. energy
0028 
0029   /* radiator-specific settings; handled by `RadiatorConfig` struct (see above)
0030        * example: radiators.insert({ "Aerogel", RadiatorConfig{ ... }});
0031        *          radiators.insert({ "Gas", RadiatorConfig{ ... }});
0032        */
0033   std::map<std::string, RadiatorConfig> radiators;
0034 
0035   /* list of PDG codes to identify with this PID algorithm
0036        * example: std::vector<int> pdgList = { 11, 211, 321, 2212 };
0037        */
0038   std::vector<int> pdgList;
0039 
0040   /* cheat modes: useful for test purposes, or idealizing; the real PID should run with all
0041        * cheat modes off
0042        */
0043   bool cheatPhotonVertex = false; // if true, use MC photon vertex, wavelength, and refractive index
0044   bool cheatTrueRadiator = false; // if true, use MC truth to obtain true radiator, for each hit
0045 
0046   //
0047   /////////////////////////////////////////////////////
0048 
0049   // boolean: true if any cheat mode is enabled
0050   bool CheatModeEnabled() const { return cheatPhotonVertex || cheatTrueRadiator; }
0051 
0052   // stream all parameters
0053   friend std::ostream& operator<<(std::ostream& os, const IrtCherenkovParticleIDConfig& cfg) {
0054     os << fmt::format("{:=^60}", " IrtCherenkovParticleIDConfig Settings ") << std::endl;
0055     auto print_param = [&os](auto name, auto val) {
0056       os << fmt::format("  {:>20} = {:<}", name, val) << std::endl;
0057     };
0058     print_param("numRIndexBins", cfg.numRIndexBins);
0059     print_param("cheatPhotonVertex", cfg.cheatPhotonVertex);
0060     print_param("cheatTrueRadiator", cfg.cheatTrueRadiator);
0061     os << "pdgList:" << std::endl;
0062     for (const auto& pdg : cfg.pdgList)
0063       os << fmt::format("  {}", pdg) << std::endl;
0064     for (const auto& [name, rad] : cfg.radiators) {
0065       os << fmt::format("{:-<60}", fmt::format("--- {} config ", name)) << std::endl;
0066       print_param("smearingMode", rad.smearingMode);
0067       print_param("smearing", rad.smearing);
0068       print_param("referenceRIndex", rad.referenceRIndex);
0069       print_param("attenuation", rad.attenuation);
0070     }
0071     os << fmt::format("{:=^60}", "") << std::endl;
0072     return os;
0073   };
0074 };
0075 
0076 } // namespace eicrecon