Detector/src/NDArrProducerEpix.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: NDArrProducerEpix.cpp 10108 2015-05-18 21:23:05Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author:
00006 //      Mikhail S. Dubrovin
00007 //
00008 //------------------------------------------------------------------------
00009 
00010 //---------------
00011 // -- Headers --
00012 //---------------
00013 
00014 #include "Detector/NDArrProducerEpix.h"
00015 
00016 //-----------------------------
00017 
00018 namespace Detector {
00019 
00020 typedef NDArrProducerEpix::data_t data_t;
00021 
00022 //-----------------------------
00023 
00024 NDArrProducerEpix::NDArrProducerEpix(const PSEvt::Source& source, const unsigned& mode, const unsigned& pbits, const float& vdef)
00025   : NDArrProducerBase(source, mode, pbits, vdef)
00026   , m_count_ent(0)
00027   , m_count_msg(0)
00028 {
00029   //m_as_data = (mode) ? false : true;
00030   m_as_data = true;
00031 }
00032 
00033 //-----------------------------
00034 
00035 NDArrProducerEpix::~NDArrProducerEpix ()
00036 {
00037 }
00038 
00039 //-----------------------------
00040 
00041 void
00042 NDArrProducerEpix::print_warning(const char* msg)
00043 {
00044   m_count_msg++;
00045   if (m_count_msg < 11 && m_pbits) {
00046     MsgLog(name(), warning, "Epix::ElementV1,2 object"
00047            << " is not available in this run/event for source:" << m_source);
00048     if (m_count_msg == 10) MsgLog(name(), warning, "STOP PRINT WARNINGS for source:" << m_source);
00049   }
00050 }
00051 
00052 //-----------------------------
00053 
00054 ndarray<const data_t, 2> 
00055 NDArrProducerEpix::data_nda_uint16_2(PSEvt::Event& evt, PSEnv::Env& env)
00056 {
00057   ndarray<const data_t, 2> nda1 = getNDArrForType<Psana::Epix::ElementV1, data_t>(evt, env);
00058   if ( ! nda1.empty()) return nda1; 
00059 
00060   ndarray<const data_t, 2> nda2 = getNDArrForType<Psana::Epix::ElementV2, data_t>(evt, env);
00061   if ( ! nda2.empty()) return nda2; 
00062 
00063   print_warning();
00064   ndarray<data_t, 2> nda;
00065   return nda; // empty
00066 }
00067 
00068 //-----------------------------
00069 
00070 void
00071 NDArrProducerEpix::print_config(PSEvt::Event& evt, PSEnv::Env& env)
00072 {
00073   printConfigFromData(evt);
00074 
00075   if      (printConfigForType<Psana::Epix::ConfigV1>    (evt, env, "ConfigV1"    )) return;
00076   else if (printConfigForType<Psana::Epix::Config10KV1> (evt, env, "Config10KV1" )) return;
00077   else if (printConfigForType<Psana::Epix::Config100aV1>(evt, env, "Config100aV1")) return;
00078 
00079   MsgLog(name(), info, "Epix::ConfigV# is not found for source " << m_source);  
00080 }
00081 
00082 //-----------------------------
00083 
00084 void
00085 NDArrProducerEpix::printConfigFromData(PSEvt::Event& evt) {
00086 
00087   boost::shared_ptr<Psana::Epix::ElementV1> data1 = evt.get(m_source, m_key, &m_src);
00088   if (data1) {        
00089       const ndarray<const data_t, 2> data = data1->frame();
00090       std::stringstream ss; 
00091       ss << "Epix::ElementV1 at " << m_source;
00092       ss << "\n  vc           = " << int(data1->vc());
00093       ss << "\n  lane         = " << int(data1->lane());
00094       ss << "\n  acqCount     = " << data1->acqCount();
00095       ss << "\n  frameNumber  = " << data1->frameNumber();
00096       ss << "\n  ticks        = " << data1->ticks();
00097       ss << "\n  fiducials    = " << data1->fiducials();
00098       ss << "\n  frame        = " << data1->frame();
00099       ss << "\n  excludedRows = " << data1->excludedRows();
00100       ss << "\n  temperatures = " << data1->temperatures();
00101       ss << "\n  lastWord     = " << data1->lastWord();
00102       ss << "\n  data_ndarr:\n"   << data; 
00103       MsgLog(name(), info, ss.str());
00104   }
00105 
00106   boost::shared_ptr<Psana::Epix::ElementV2> data2 = evt.get(m_source, m_key, &m_src);
00107   if (data2) {        
00108       const ndarray<const data_t, 2> data = data2->frame();
00109       std::stringstream ss; 
00110       ss << "Epix::ElementV2 at "      << m_source;
00111       ss << "\n  vc                = " << int(data2->vc());
00112       ss << "\n  lane              = " << int(data2->lane());
00113       ss << "\n  acqCount          = " << data2->acqCount();
00114       ss << "\n  frameNumber       = " << data2->frameNumber();
00115       ss << "\n  ticks             = " << data2->ticks();
00116       ss << "\n  fiducials         = " << data2->fiducials();
00117       ss << "\n  frame             = " << data2->frame();
00118       ss << "\n  calibrationRows   = " << data2->calibrationRows();      //New
00119       ss << "\n  environmentalRows = " << data2->environmentalRows();    //New
00120       ss << "\n  temperatures      = " << data2->temperatures();
00121       ss << "\n  lastWord          = " << data2->lastWord();
00122       ss << "\n  data_ndarr:\n"        << data;  
00123       MsgLog(name(), info, ss.str());
00124   }
00125 }
00126  
00127 //-----------------------------
00128 } // namespace Detector
00129 //-----------------------------

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7