File indexing completed on 2025-07-01 08:35:33
0001 #pragma once
0002
0003 #include <JANA/JEvent.h>
0004 #include <JANA/JEventProcessor.h>
0005 #include <algorithm>
0006 #include <cctype>
0007 #include <memory>
0008 #include <string>
0009 #include <vector>
0010
0011 #include "extensions/spdlog/SpdlogMixin.h"
0012
0013 class DumpFlags_processor : public JEventProcessor, public eicrecon::SpdlogMixin {
0014 public:
0015
0016
0017
0018
0019
0020
0021 void Init() override;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 void Process(const std::shared_ptr<const JEvent>& event) override;
0032
0033
0034
0035
0036
0037
0038
0039 void Finish() override;
0040
0041 private:
0042
0043 std::string m_python_file_name = "";
0044
0045
0046 std::string m_markdown_file_name = "";
0047
0048
0049 std::string m_json_file_name = "";
0050
0051
0052 std::string m_janaconfig_file_name = "jana.conf";
0053
0054
0055 bool m_print_to_screen = true;
0056
0057
0058 std::vector<std::string> m_reco_prefixes = {
0059 "B0TRK", "BEMC", "DRICH", "BTRK", "BVTX", "ECTRK", "EEMC", "FOFFMTRK", "HCAL",
0060 "MPGD", "RPOTS", "LOWQ2", "ZDC", "Tracking", "Reco", "Digi", "Calorimetry"};
0061
0062
0063 bool isReconstructionFlag(
0064 std::string
0065 flag_name) {
0066
0067
0068 std::transform(flag_name.begin(), flag_name.end(), flag_name.begin(),
0069 static_cast<int (*)(int)>(&std::tolower));
0070
0071 for (auto subsystem : m_reco_prefixes) {
0072
0073
0074 std::transform(subsystem.begin(), subsystem.end(), subsystem.begin(),
0075 static_cast<int (*)(int)>(&std::tolower));
0076
0077
0078
0079 if (flag_name.rfind(subsystem, 0) == 0) {
0080
0081 return true;
0082 }
0083 }
0084
0085
0086 return false;
0087 }
0088
0089 std::string findCategory(
0090 std::string
0091 flag_name) {
0092
0093
0094 std::transform(flag_name.begin(), flag_name.end(), flag_name.begin(),
0095 static_cast<int (*)(int)>(&std::tolower));
0096
0097 for (auto subsystem : m_reco_prefixes) {
0098
0099
0100 std::string original_subsystem_name = subsystem;
0101 std::transform(subsystem.begin(), subsystem.end(), subsystem.begin(),
0102 static_cast<int (*)(int)>(&std::tolower));
0103
0104
0105
0106 if (flag_name.rfind(subsystem, 0) == 0) {
0107
0108 return original_subsystem_name;
0109 }
0110 }
0111
0112
0113 return "";
0114 }
0115 };