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