00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana/EventKeys.h"
00017
00018
00019
00020
00021 #include <iostream>
00022
00023
00024
00025
00026 #include "MsgLogger/MsgLogger.h"
00027
00028
00029
00030
00031
00032 using namespace psana;
00033 PSANA_MODULE_FACTORY(EventKeys)
00034
00035 namespace {
00036
00037 const char* logger = "EventKeys";
00038
00039 void printKeys(std::ostream& out, const std::list<EventKey>& keys)
00040 {
00041 for (std::list<EventKey>::const_iterator it = keys.begin(); it != keys.end(); ++it) {
00042 std::cout << " " << *it << '\n';
00043 }
00044 }
00045 }
00046
00047
00048
00049
00050
00051 namespace psana {
00052
00053
00054
00055
00056 EventKeys::EventKeys (const std::string& name)
00057 : Module(name)
00058 , m_print_cfg_in_evt()
00059 , m_print_clb_in_evt()
00060 {
00061 m_print_cfg_in_evt = config("print_cfg_in_evt", false);
00062 m_print_clb_in_evt = config("print_clb_in_evt", false);
00063 }
00064
00065
00066
00067
00068 EventKeys::~EventKeys ()
00069 {
00070 }
00071
00072
00073 void
00074 EventKeys::beginJob(Event& evt, Env& env)
00075 {
00076 MsgLog(logger, info, name() << ": in beginJob()");
00077
00078 std::cout << "Config keys:\n";
00079 ::printKeys(std::cout, env.configStore().keys());
00080 std::cout << "Calib keys:\n";
00081 ::printKeys(std::cout, env.calibStore().keys());
00082 std::cout << "Event keys:\n";
00083 ::printKeys(std::cout, evt.keys());
00084 }
00085
00086
00087 void
00088 EventKeys::beginRun(Event& evt, Env& env)
00089 {
00090 MsgLog(logger, info, name() << ": in beginRun()");
00091
00092 std::cout << "Config keys:\n";
00093 ::printKeys(std::cout, env.configStore().keys());
00094 std::cout << "Calib keys:\n";
00095 ::printKeys(std::cout, env.calibStore().keys());
00096 std::cout << "Event keys:\n";
00097 ::printKeys(std::cout, evt.keys());
00098 }
00099
00100
00101 void
00102 EventKeys::beginCalibCycle(Event& evt, Env& env)
00103 {
00104 MsgLog(logger, info, name() << ": in beginCalibCycle()");
00105
00106 std::cout << "Config keys:\n";
00107 ::printKeys(std::cout, env.configStore().keys());
00108 std::cout << "Calib keys:\n";
00109 ::printKeys(std::cout, env.calibStore().keys());
00110 std::cout << "Event keys:\n";
00111 ::printKeys(std::cout, evt.keys());
00112 }
00113
00114
00115
00116 void
00117 EventKeys::event(Event& evt, Env& env)
00118 {
00119 MsgLog(logger, info, name() << ": in event()");
00120
00121 if(m_print_cfg_in_evt) {
00122 std::cout << "Config keys:\n";
00123 ::printKeys(std::cout, env.configStore().keys());
00124 }
00125
00126 if(m_print_clb_in_evt) {
00127 std::cout << "Calib keys:\n";
00128 ::printKeys(std::cout, env.calibStore().keys());
00129 }
00130
00131 std::cout << "Event keys:\n";
00132 ::printKeys(std::cout, evt.keys());
00133 }
00134
00135
00136 void
00137 EventKeys::endCalibCycle(Event& evt, Env& env)
00138 {
00139 MsgLog(logger, info, name() << ": in endCalibCycle()");
00140
00141 std::cout << "Event keys:\n";
00142 ::printKeys(std::cout, evt.keys());
00143 }
00144
00145
00146 void
00147 EventKeys::endRun(Event& evt, Env& env)
00148 {
00149 MsgLog(logger, info, name() << ": in endRun()");
00150
00151 std::cout << "Event keys:\n";
00152 ::printKeys(std::cout, evt.keys());
00153 }
00154
00155
00156 void
00157 EventKeys::endJob(Event& evt, Env& env)
00158 {
00159 MsgLog(logger, info, name() << ": in endJob()");
00160
00161 std::cout << "Event keys:\n";
00162 ::printKeys(std::cout, evt.keys());
00163 }
00164
00165
00166 }