00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana_examples/DumpOpal1k.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/opal1k.ddl.h"
00027
00028
00029
00030
00031
00032 using namespace psana_examples;
00033 PSANA_MODULE_FACTORY(DumpOpal1k)
00034
00035 namespace {
00036
00037 void
00038 printFrameCoord(std::ostream& str, const Psana::Camera::FrameCoord& coord)
00039 {
00040 str << "(" << coord.column() << ", " << coord.row() << ")";
00041 }
00042 }
00043
00044
00045
00046
00047
00048 namespace psana_examples {
00049
00050
00051
00052
00053 DumpOpal1k::DumpOpal1k (const std::string& name)
00054 : Module(name)
00055 {
00056 m_src = configSrc("source", "DetInfo(:Opal1000)");
00057 }
00058
00059
00060
00061
00062 DumpOpal1k::~DumpOpal1k ()
00063 {
00064 }
00065
00066
00067 void
00068 DumpOpal1k::beginCalibCycle(Event& evt, Env& env)
00069 {
00070 MsgLog(name(), trace, "in beginCalibCycle()");
00071
00072 shared_ptr<Psana::Opal1k::ConfigV1> config = env.configStore().get(m_src);
00073 if (config) {
00074
00075 WithMsgLog(name(), info, str) {
00076 str << "Psana::Opal1k::ConfigV1:";
00077 str << "\n black_level = " << config->black_level();
00078 str << "\n gain_percent = " << config->gain_percent();
00079 str << "\n output_resolution = " << config->output_resolution();
00080 str << "\n vertical_binning = " << config->vertical_binning();
00081 str << "\n output_mirroring = " << config->output_mirroring();
00082 str << "\n vertical_remapping = " << int(config->vertical_remapping());
00083 str << "\n output_offset = " << config->output_offset();
00084 str << "\n output_resolution_bits = " << config->output_resolution_bits();
00085 str << "\n defect_pixel_correction_enabled = " << int(config->defect_pixel_correction_enabled());
00086 str << "\n output_lookup_table_enabled = " << int(config->output_lookup_table_enabled());
00087 if (config->output_lookup_table_enabled()) {
00088 str << "\n output_lookup_table = " << config->output_lookup_table();
00089 }
00090
00091
00092 if (config->number_of_defect_pixels()) {
00093 str << "\n defect_pixel_coordinates =";
00094 const ndarray<const Psana::Camera::FrameCoord, 1>& coord = config->defect_pixel_coordinates();
00095 for (unsigned i = 0; i < coord.size(); ++ i) {
00096 str << " ";
00097 printFrameCoord(str, coord[i]);
00098 }
00099 }
00100 }
00101
00102 }
00103 }
00104
00105
00106 void
00107 DumpOpal1k::event(Event& evt, Env& env)
00108 {
00109 }
00110
00111 }