Detector/src/NDArrProducerCSPAD.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: NDArrProducerCSPAD.cpp 10108 2015-05-18 21:23:05Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Author List:
00006 //      Mikhail S. Dubrovin
00007 //
00008 //------------------------------------------------------------------------
00009 
00010 //---------------
00011 // -- Headers --
00012 //---------------
00013 
00014 #include "Detector/NDArrProducerCSPAD.h"
00015 
00016 //-----------------------------
00017 namespace Detector {
00018 
00019 typedef NDArrProducerCSPAD::data_t data_t;
00020 
00021 //-----------------------------
00022 
00023   NDArrProducerCSPAD::NDArrProducerCSPAD(const PSEvt::Source& source, const unsigned& mode, const unsigned& pbits, const float& vdef)
00024   : NDArrProducerBase(source, mode, pbits, vdef)
00025   , m_as_data(mode)
00026   , m_count_evt(0)
00027   , m_count_cfg(0)
00028   , m_count_msg(0)
00029 {
00030   for (uint32_t q=0; q<NQuadsMax; ++q) m_roiMask[q] = 0xff;
00031 }
00032 
00033 //-----------------------------
00034 
00035 NDArrProducerCSPAD::~NDArrProducerCSPAD ()
00036 {
00037 }
00038 
00039 //-----------------------------
00040 
00041 void 
00042 NDArrProducerCSPAD::getConfigPars(PSEnv::Env& env)
00043 {
00044   if ( getConfigParsForType<Psana::CsPad::ConfigV2>(env) ) return;
00045   if ( getConfigParsForType<Psana::CsPad::ConfigV3>(env) ) return;
00046   if ( getConfigParsForType<Psana::CsPad::ConfigV4>(env) ) return;
00047   if ( getConfigParsForType<Psana::CsPad::ConfigV5>(env) ) return;
00048 
00049   m_count_msg++;
00050   if (m_count_msg < 11 && m_pbits) {
00051     MsgLog(name(), warning, "CsPad::ConfigV2-V5 is not available in this run, event:" << m_count_evt << " for source:" << m_str_src);
00052     if (m_count_msg == 10) MsgLog(name(), warning, "STOP PRINTING WARNINGS for source:" << m_str_src);
00053   }
00054 }
00055 
00056 //-----------------------------
00057 
00058 ndarray<data_t,3>  
00059 NDArrProducerCSPAD::getNDArr(PSEvt::Event& evt, PSEnv::Env& env)
00060 {
00061   m_count_evt ++;
00062 
00063   if ( m_count_cfg==0 ) getConfigPars(env);
00064   if ( m_count_cfg==0 ) return m_nda_def;
00065 
00066   // Check if the requested src and key are consistent with Psana::CsPad::DataV1, or V2
00067   ndarray<data_t,3> nda1 = getNDArrForType<Psana::CsPad::DataV1, Psana::CsPad::ElementV1, data_t>(evt);
00068   if (nda1.size()) return nda1;
00069 
00070   ndarray<data_t,3> nda2 = getNDArrForType<Psana::CsPad::DataV2, Psana::CsPad::ElementV2, data_t>(evt);
00071   if (nda2.size()) return nda2;
00072 
00073   m_count_msg++;
00074   if (m_count_msg < 11 && m_pbits) {
00075     MsgLog(name(), warning, "procEvent(...): Psana::CsPad::DataV# / ElementV# for #=[2-5] is not available in event:"
00076            << m_count_evt << " for source:" << m_str_src << " key:\"" << m_key << '\"');
00077     if (m_count_msg == 10) MsgLog(name(), warning, "STOP PRINTING WARNINGS for source:"
00078            << m_str_src << " key:\"" << m_key << '\"');
00079   }
00080   return m_nda_def;
00081 }
00082 
00083 //-----------------------------
00084 } // namespace Detector
00085 //-----------------------------

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7