psana_examples/src/DumpL3T.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpL3T.cpp 6920 2013-10-07 22:09:39Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpL3T...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpL3T.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/l3t.ddl.h"
00027 
00028 //-----------------------------------------------------------------------
00029 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00030 //-----------------------------------------------------------------------
00031 
00032 // This declares this class as psana module
00033 using namespace psana_examples;
00034 PSANA_MODULE_FACTORY(DumpL3T)
00035 
00036 //              ----------------------------------------
00037 //              -- Public Function Member Definitions --
00038 //              ----------------------------------------
00039 
00040 namespace psana_examples {
00041 
00042 //----------------
00043 // Constructors --
00044 //----------------
00045 DumpL3T::DumpL3T (const std::string& name)
00046   : Module(name)
00047   , m_src()
00048 {
00049   m_src = configSrc("source", "ProcInfo()");
00050 }
00051 
00052 //--------------
00053 // Destructor --
00054 //--------------
00055 DumpL3T::~DumpL3T ()
00056 {
00057 }
00058 
00059 /// Method which is called at the beginning of the run
00060 void 
00061 DumpL3T::beginRun(Event& evt, Env& env)
00062 {
00063   shared_ptr<Psana::L3T::ConfigV1> config1 = env.configStore().get(m_src);
00064   if (config1) {
00065     WithMsgLog(name(), info, str) {
00066       str << "L3T::ConfigV1:";
00067       str << "\n  module_id = \"" << config1->module_id() << "\"";
00068       str << "\n  description = \"" << config1->desc() << "\"";
00069     }
00070   }
00071 }
00072 
00073 /// Method which is called with event data, this is the only required 
00074 /// method, all other methods are optional
00075 void 
00076 DumpL3T::event(Event& evt, Env& env)
00077 {
00078   // example of getting detector data from event
00079   shared_ptr<Psana::L3T::DataV1> data1 = evt.get(m_src);
00080   if (data1) {
00081     MsgLog(name(), info, "L3T::DataV1: accept = " << int(data1->accept()));
00082   }
00083 }
00084   
00085 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7