psana_examples/src/DumpGsc16ai.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpGsc16ai.cpp 5865 2013-03-22 23:28:10Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpGsc16ai...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpGsc16ai.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/gsc16ai.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(DumpGsc16ai)
00035 
00036 //              ----------------------------------------
00037 //              -- Public Function Member Definitions --
00038 //              ----------------------------------------
00039 
00040 namespace psana_examples {
00041 
00042 //----------------
00043 // Constructors --
00044 //----------------
00045 DumpGsc16ai::DumpGsc16ai (const std::string& name)
00046   : Module(name)
00047   , m_src()
00048 {
00049   // get the values from configuration or use defaults
00050   m_src = configSrc("source", "DetInfo(:Gsc16ai)");
00051 }
00052 
00053 //--------------
00054 // Destructor --
00055 //--------------
00056 DumpGsc16ai::~DumpGsc16ai ()
00057 {
00058 }
00059 
00060 /// Method which is called at the beginning of the calibration cycle
00061 void 
00062 DumpGsc16ai::beginCalibCycle(Event& evt, Env& env)
00063 {
00064   shared_ptr<Psana::Gsc16ai::ConfigV1> config1 = env.configStore().get(m_src);
00065   if (config1) {
00066 
00067     WithMsgLog(name(), info, str) {
00068       str << "Psana::Gsc16ai::ConfigV1:";
00069       str << "\n  voltageRange = " << config1->voltageRange();
00070       str << "\n  firstChan = " << config1->firstChan();
00071       str << "\n  lastChan = " << config1->lastChan();
00072       str << "\n  inputMode = " << config1->inputMode();
00073       str << "\n  triggerMode = " << config1->triggerMode();
00074       str << "\n  dataFormat = " << config1->dataFormat();
00075       str << "\n  fps = " << config1->fps();
00076       str << "\n  autocalibEnable = " << int(config1->autocalibEnable());
00077       str << "\n  timeTagEnable = " << int(config1->timeTagEnable());
00078       str << "\n  numChannels = " << config1->numChannels();
00079     }
00080 
00081   }}
00082 
00083 /// Method which is called with event data, this is the only required 
00084 /// method, all other methods are optional
00085 void 
00086 DumpGsc16ai::event(Event& evt, Env& env)
00087 {
00088   shared_ptr<Psana::Gsc16ai::DataV1> data1 = evt.get(m_src);
00089   if (data1) {
00090 
00091     WithMsgLog(name(), info, str) {
00092       str << "Psana::Gsc16ai::DataV1:";
00093       str << "\n  timestamp = " << data1->timestamp();
00094       str << "\n  channelValue = " << data1->channelValue();
00095     }
00096 
00097   }
00098 }
00099 
00100 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7