psana_examples/src/DumpPnccd.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpPnccd.cpp 5355 2013-02-05 22:07:12Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpPnccd...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpPnccd.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/pnccd.ddl.h"
00027 
00028 //-----------------------------------------------------------------------
00029 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00030 //-----------------------------------------------------------------------
00031 
00032 using namespace psana_examples;
00033 PSANA_MODULE_FACTORY(DumpPnccd)
00034 
00035 //              ----------------------------------------
00036 //              -- Public Function Member Definitions --
00037 //              ----------------------------------------
00038 
00039 namespace psana_examples {
00040 
00041 //----------------
00042 // Constructors --
00043 //----------------
00044 DumpPnccd::DumpPnccd (const std::string& name)
00045   : Module(name)
00046 {
00047     m_src = configSrc("source", "DetInfo(:pnCCD)");
00048 }
00049 
00050 //--------------
00051 // Destructor --
00052 //--------------
00053 DumpPnccd::~DumpPnccd ()
00054 {
00055 }
00056 
00057 // Method which is called at the beginning of the calibration cycle
00058 void 
00059 DumpPnccd::beginCalibCycle(Event& evt, Env& env)
00060 {
00061   MsgLog(name(), trace, "in beginCalibCycle()");
00062 
00063   shared_ptr<Psana::PNCCD::ConfigV1> config1 = env.configStore().get(m_src);
00064   if (config1) {
00065     
00066     WithMsgLog(name(), info, str) {
00067       str << "PNCCD::ConfigV1:";
00068       str << "\n  numLinks = " << config1->numLinks();
00069       str << "\n  payloadSizePerLink = " << config1->payloadSizePerLink();
00070     }
00071     
00072   }
00073 
00074   shared_ptr<Psana::PNCCD::ConfigV2> config2 = env.configStore().get(m_src);
00075   if (config2) {
00076     
00077     WithMsgLog(name(), info, str) {
00078       str << "PNCCD::ConfigV2:";
00079       str << "\n  numLinks = " << config2->numLinks();
00080       str << "\n  payloadSizePerLink = " << config2->payloadSizePerLink();
00081       str << "\n  numChannels = " << config2->numChannels();
00082       str << "\n  numRows = " << config2->numRows();
00083       str << "\n  numSubmoduleChannels = " << config2->numSubmoduleChannels();
00084       str << "\n  numSubmoduleRows = " << config2->numSubmoduleRows();
00085       str << "\n  numSubmodules = " << config2->numSubmodules();
00086       str << "\n  camexMagic = " << config2->camexMagic();
00087       str << "\n  info = " << config2->info();
00088       str << "\n  timingFName = " << config2->timingFName();
00089     }
00090     
00091   }
00092 
00093 }
00094 
00095 // Method which is called with event data
00096 void 
00097 DumpPnccd::event(Event& evt, Env& env)
00098 {
00099   // First dump raw frames as they come out of device
00100   shared_ptr<Psana::PNCCD::FramesV1> data = evt.get(m_src);
00101   if (data) {
00102     WithMsgLog(name(), info, str) {
00103 
00104       str << "PNCCD::FramesV1:";
00105 
00106       for (unsigned i = 0 ; i != data->numLinks(); ++ i) {
00107 
00108         const Psana::PNCCD::FrameV1& frame = data->frame(i);
00109 
00110         str << "\n  Frame #" << i;
00111 
00112         str << "\n    specialWord = " << frame.specialWord();
00113         str << "\n    frameNumber = " << frame.frameNumber();
00114         str << "\n    timeStampHi = " << frame.timeStampHi();
00115         str << "\n    timeStampLo = " << frame.timeStampLo();
00116 
00117         const ndarray<const uint16_t, 2> data = frame.data();
00118         str << "\n    frame size = " << data.shape()[0] << 'x' << data.shape()[1];
00119         str << "\n    data = " << data;
00120       }
00121     }
00122   }
00123 
00124   // Next dump combined full frame
00125   shared_ptr<Psana::PNCCD::FullFrameV1> frame = evt.get(m_src);
00126   if (frame) {
00127     WithMsgLog(name(), info, str) {
00128 
00129       str << "PNCCD::FullFrameV1:";
00130       str << "\n    specialWord = " << frame->specialWord();
00131       str << "\n    frameNumber = " << frame->frameNumber();
00132       str << "\n    timeStampHi = " << frame->timeStampHi();
00133       str << "\n    timeStampLo = " << frame->timeStampLo();
00134 
00135       const ndarray<const uint16_t, 2> data = frame->data();
00136       str << "\n    frame size = " << data.shape()[0] << 'x' << data.shape()[1];
00137       str << "\n    data = " << data;
00138     }
00139 
00140   }
00141 
00142 }
00143 
00144 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7