psana_examples/src/DumpQuartz.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpQuartz.cpp 5355 2013-02-05 22:07:12Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpQuartz...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpQuartz.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/quartz.ddl.h"
00027 
00028 //-----------------------------------------------------------------------
00029 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00030 //-----------------------------------------------------------------------
00031 
00032 using namespace psana_examples;
00033 PSANA_MODULE_FACTORY(DumpQuartz)
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 //              -- Public Function Member Definitions --
00046 //              ----------------------------------------
00047 
00048 namespace psana_examples {
00049 
00050 //----------------
00051 // Constructors --
00052 //----------------
00053 DumpQuartz::DumpQuartz (const std::string& name)
00054   : Module(name)
00055 {
00056   m_src = configSrc("source", "DetInfo(:Quartz4A150)");
00057 }
00058 
00059 //--------------
00060 // Destructor --
00061 //--------------
00062 DumpQuartz::~DumpQuartz ()
00063 {
00064 }
00065 
00066 // Method which is called at the beginning of the calibration cycle
00067 void 
00068 DumpQuartz::beginCalibCycle(Event& evt, Env& env)
00069 {
00070   MsgLog(name(), trace, "in beginCalibCycle()");
00071 
00072   shared_ptr<Psana::Quartz::ConfigV1> config = env.configStore().get(m_src);
00073   if (config) {
00074     
00075     WithMsgLog(name(), info, str) {
00076       str << "Psana::Quartz::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  horizontal_binning = " << config->horizontal_binning();
00081       str << "\n  vertical_binning = " << config->vertical_binning();
00082       str << "\n  output_mirroring = " << config->output_mirroring();
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 // Method which is called with event data
00106 void 
00107 DumpQuartz::event(Event& evt, Env& env)
00108 {
00109   // Quartz device produces standard Camera::Frame type of images,
00110   // check DumpCamera module which can dump those images
00111 }
00112   
00113 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7