File indexing completed on 2025-01-18 09:55:42
0001
0002
0003
0004 #pragma once
0005
0006 #include <Evaluator/DD4hepUnits.h>
0007 #include <spdlog/spdlog.h>
0008
0009 namespace eicrecon {
0010
0011
0012 struct RadiatorConfig {
0013 double referenceRIndex;
0014 double attenuation;
0015 std::string smearingMode;
0016 double smearing;
0017 };
0018
0019
0020 class IrtCherenkovParticleIDConfig {
0021 public:
0022
0023
0024
0025
0026
0027 unsigned numRIndexBins = 100;
0028
0029
0030
0031
0032
0033 std::map <std::string,RadiatorConfig> radiators;
0034
0035
0036
0037
0038 std::vector<int> pdgList;
0039
0040
0041
0042
0043 bool cheatPhotonVertex = false;
0044 bool cheatTrueRadiator = false;
0045
0046
0047
0048
0049
0050 void PrintCheats(
0051 std::shared_ptr<spdlog::logger> m_log,
0052 spdlog::level::level_enum lvl=spdlog::level::debug,
0053 bool printAll=false
0054 )
0055 {
0056 auto print_param = [&m_log, &lvl, &printAll] (auto name, bool val, auto desc) {
0057 if(printAll) m_log->log(lvl, " {:>20} = {:<}", name, val);
0058 else if(val) m_log->warn("CHEAT MODE '{}' ENABLED: {}", name, desc);
0059 };
0060 print_param("cheatPhotonVertex", cheatPhotonVertex, "use MC photon vertex, wavelength, refractive index");
0061 print_param("cheatTrueRadiator", cheatTrueRadiator, "use MC truth to obtain true radiator");
0062 }
0063
0064
0065 bool CheatModeEnabled() const {
0066 return cheatPhotonVertex || cheatTrueRadiator;
0067 }
0068
0069
0070 void Print(
0071 std::shared_ptr<spdlog::logger> m_log,
0072 spdlog::level::level_enum lvl=spdlog::level::debug
0073 )
0074 {
0075 m_log->log(lvl, "{:=^60}"," IrtCherenkovParticleIDConfig Settings ");
0076 auto print_param = [&m_log, &lvl] (auto name, auto val) {
0077 m_log->log(lvl, " {:>20} = {:<}", name, val);
0078 };
0079 print_param("numRIndexBins",numRIndexBins);
0080 PrintCheats(m_log, lvl, true);
0081 m_log->log(lvl, "pdgList:");
0082 for(const auto& pdg : pdgList) m_log->log(lvl, " {}", pdg);
0083 for(const auto& [name,rad] : radiators) {
0084 m_log->log(lvl, "{:-<60}", fmt::format("--- {} config ",name));
0085 print_param("smearingMode", rad.smearingMode);
0086 print_param("smearing", rad.smearing);
0087 print_param("referenceRIndex", rad.referenceRIndex);
0088 print_param("attenuation", rad.attenuation);
0089 }
0090 m_log->log(lvl, "{:=^60}","");
0091 }
0092
0093 };
0094 }