PSXtcInput/src/XtcIndexInputModule.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: XtcIndexInputModule.cpp 7696 2014-02-27 00:40:59Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class XtcIndexInputModule...
00007 //
00008 // Author List:
00009 //      Christopher O'Grady
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "PSXtcInput/XtcIndexInputModule.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <boost/make_shared.hpp>
00022 #include <boost/pointer_cast.hpp>
00023 
00024 //-------------------------------
00025 // Collaborating Class Headers --
00026 //-------------------------------
00027 #include "PSXtcInput/DgramSourceIndex.h"
00028 #include "MsgLogger/MsgLogger.h"
00029 
00030 //-----------------------------------------------------------------------
00031 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00032 //-----------------------------------------------------------------------
00033 
00034 using namespace PSXtcInput;
00035 PSANA_INPUT_MODULE_FACTORY(XtcIndexInputModule)
00036 
00037 
00038 //              ----------------------------------------
00039 //              -- Public Function Member Definitions --
00040 //              ----------------------------------------
00041 
00042 namespace {
00043   const char* logger = "PSXtcInput::XtcIndexInputModule";
00044 }
00045 
00046 namespace PSXtcInput {
00047 
00048 //----------------
00049 // Constructors --
00050 //----------------
00051 XtcIndexInputModule::XtcIndexInputModule (const std::string& name)
00052   : XtcInputModuleBase(name, boost::make_shared<DgramSourceIndex>())
00053   , _idx(name,_queue)
00054 {
00055   // this is ugly. necessary because it's hard to remember the
00056   // DgramSourceIndex that we give to XtcInputModuleBase.
00057   boost::shared_ptr<DgramSourceIndex> dgSourceIndex = boost::dynamic_pointer_cast<DgramSourceIndex>(m_dgsource);
00058   dgSourceIndex->setQueue(_queue);
00059 
00060   // disable features not supported by indexing
00061   if (skipEvents()!=0) {
00062     MsgLog(logger, warning, "Skip-events option not supported by indexing input module");
00063     skipEvents(0);
00064   }
00065   if (maxEvents()!=0) {
00066     MsgLog(logger, warning, "Max-events option not supported by indexing input module");
00067     maxEvents(0);
00068   }
00069   if (skipEpics()) skipEpics(false);
00070   if (l3tAcceptOnly()) l3tAcceptOnly(false);
00071   ConfigSvc::ConfigSvc cfg = configSvc();
00072   bool allowCorruptEpics = cfg.get("psana", "allow-corrupt-epics", false);
00073   if (allowCorruptEpics) _idx.allowCorruptEpics();
00074 }
00075 
00076 //--------------
00077 // Destructor --
00078 //--------------
00079 XtcIndexInputModule::~XtcIndexInputModule ()
00080 {
00081 }
00082 
00083 void 
00084 XtcIndexInputModule::beginJob(Event& evt, Env& env)
00085 {
00086   // to match the behavior of non-indexing mode, so that
00087   // configuration information is available at beginJob.
00088   // it feels somewhat awkward that we have run-specific
00089   // information available at that time, but we already
00090   // have this idea in the sequential-access mode -cpo
00091 
00092   int runbegin = _idx.runs()[0];
00093   _idx.setrun(runbegin);
00094 
00095   // now that indexing is set up, do the base class beginJob
00096   XtcInputModuleBase::beginJob(evt, env);
00097 }
00098 
00099 } // namespace PSXtcInput

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7