psana/src/PrintEventId.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: PrintEventId.cpp 3319 2012-05-02 23:14:22Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class PrintEventId...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana/PrintEventId.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "PSEvt/EventId.h"
00027 
00028 //-----------------------------------------------------------------------
00029 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00030 //-----------------------------------------------------------------------
00031 
00032 using namespace psana;
00033 PSANA_MODULE_FACTORY(PrintEventId)
00034 
00035 //              ----------------------------------------
00036 //              -- Public Function Member Definitions --
00037 //              ----------------------------------------
00038 
00039 namespace psana {
00040 
00041 //----------------
00042 // Constructors --
00043 //----------------
00044 PrintEventId::PrintEventId (const std::string& name)
00045   : Module(name)
00046 {
00047 }
00048 
00049 //--------------
00050 // Destructor --
00051 //--------------
00052 PrintEventId::~PrintEventId ()
00053 {
00054 }
00055 
00056 /// Method which is called once at the beginning of the job
00057 void 
00058 PrintEventId::beginJob(Event& evt, Env& env)
00059 {
00060   MsgLog(name(), info, "in beginJob()");
00061   printId(evt);
00062 }
00063 
00064 /// Method which is called at the beginning of the run
00065 void 
00066 PrintEventId::beginRun(Event& evt, Env& env)
00067 {
00068   MsgLog(name(), info, "in beginRun()");
00069   printId(evt);
00070 }
00071 
00072 /// Method which is called at the beginning of the calibration cycle
00073 void 
00074 PrintEventId::beginCalibCycle(Event& evt, Env& env)
00075 {
00076   MsgLog(name(), info, "in beginCalibCycle()");
00077   printId(evt);
00078 }
00079 
00080 /// Method which is called with event data, this is the only required 
00081 /// method, all other methods are optional
00082 void 
00083 PrintEventId::event(Event& evt, Env& env)
00084 {
00085   printId(evt);
00086 }
00087   
00088 /// Method which is called at the end of the calibration cycle
00089 void 
00090 PrintEventId::endCalibCycle(Event& evt, Env& env)
00091 {
00092   MsgLog(name(), info, "in endCalibCycle()");
00093   printId(evt);
00094 }
00095 
00096 /// Method which is called at the end of the run
00097 void 
00098 PrintEventId::endRun(Event& evt, Env& env)
00099 {
00100   MsgLog(name(), info, "in endRun()");
00101   printId(evt);
00102 }
00103 
00104 /// Method which is called once at the end of the job
00105 void 
00106 PrintEventId::endJob(Event& evt, Env& env)
00107 {
00108   MsgLog(name(), info, "in endJob()");
00109   printId(evt);
00110 }
00111 
00112 /// fetch and print event ID
00113 void
00114 PrintEventId::printId(Event& evt)
00115 {
00116   // get event ID
00117   shared_ptr<EventId> eventId = evt.get();
00118   if (not eventId.get()) {
00119     MsgLog(name(), info, "event ID not found");
00120   } else {
00121     MsgLog(name(), info, "event ID: " << *eventId);
00122   }
00123 }
00124 
00125 } // namespace psana

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7