psana_examples/src/DumpCsPad2x2.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpCsPad2x2.cpp 5979 2013-03-27 17:43:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpCsPad2x2...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpCsPad2x2.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <algorithm>
00022 #include <iomanip>
00023 #include <iterator>
00024 #include <numeric>
00025 #include <functional>
00026 
00027 //-------------------------------
00028 // Collaborating Class Headers --
00029 //-------------------------------
00030 #include "MsgLogger/MsgLogger.h"
00031 #include "psddl_psana/cspad2x2.ddl.h"
00032 
00033 //-----------------------------------------------------------------------
00034 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00035 //-----------------------------------------------------------------------
00036 
00037 using namespace psana_examples;
00038 PSANA_MODULE_FACTORY(DumpCsPad2x2)
00039 
00040 //              ----------------------------------------
00041 //              -- Public Function Member Definitions --
00042 //              ----------------------------------------
00043 
00044 namespace psana_examples {
00045 
00046 //----------------
00047 // Constructors --
00048 //----------------
00049 DumpCsPad2x2::DumpCsPad2x2 (const std::string& name)
00050   : Module(name)
00051 {
00052   m_key = configStr("inputKey", "");
00053   m_src = configSrc("source", "DetInfo(:Cspad2x2)");
00054 }
00055 
00056 //--------------
00057 // Destructor --
00058 //--------------
00059 DumpCsPad2x2::~DumpCsPad2x2 ()
00060 {
00061 }
00062 
00063 // Method which is called at the beginning of the calibration cycle
00064 void 
00065 DumpCsPad2x2::beginCalibCycle(Event& evt, Env& env)
00066 {
00067   MsgLog(name(), trace, "in beginCalibCycle()");
00068 
00069   shared_ptr<Psana::CsPad2x2::ConfigV1> config1 = env.configStore().get(m_src);
00070   if (config1) {
00071     
00072     WithMsgLog(name(), info, str) {
00073       str << "CsPad2x2::ConfigV1:";
00074       str << "\n  concentratorVersion = " << config1->concentratorVersion();
00075       str << "\n  protectionEnable = " << config1->protectionEnable();
00076       str << "\n  protectionThreshold:";
00077       str << "\n    adcThreshold= " << config1->protectionThreshold().adcThreshold()
00078           << "\n    pixelCountThreshold= " << config1->protectionThreshold().pixelCountThreshold();
00079       str << "\n  inactiveRunMode = " << config1->inactiveRunMode();
00080       str << "\n  activeRunMode = " << config1->activeRunMode();
00081       str << "\n  tdi = " << config1->tdi();
00082       str << "\n  payloadSize = " << config1->payloadSize();
00083       str << "\n  badAsicMask1 = " << config1->badAsicMask();
00084       str << "\n  asicMask = " << config1->asicMask();
00085       str << "\n  numAsicsRead = " << config1->numAsicsRead();
00086       str << "\n  roiMask = " << config1->roiMask();
00087       str << "\n  numAsicsStored = " << config1->numAsicsStored();
00088       const Psana::CsPad2x2::ConfigV1QuadReg& quad = config1->quad();
00089       str << "\n  quad:";
00090       str << "\n    shiftSelect = " << quad.shiftSelect();
00091       str << "\n    edgeSelect = " << quad.edgeSelect();
00092       str << "\n    readClkSet = " << quad.readClkSet();
00093       str << "\n    readClkHold = " << quad.readClkHold();
00094       str << "\n    dataMode = " << quad.dataMode();
00095       str << "\n    prstSel = " << quad.prstSel();
00096       str << "\n    acqDelay = " << quad.acqDelay();
00097       str << "\n    intTime = " << quad.intTime();
00098       str << "\n    digDelay = " << quad.digDelay();
00099       str << "\n    ampIdle = " << quad.ampIdle();
00100       str << "\n    injTotal = " << quad.injTotal();
00101       str << "\n    rowColShiftPer = " << quad.rowColShiftPer();
00102       str << "\n    ampReset = " << quad.ampReset();
00103       str << "\n    digCount = " << quad.digCount();
00104       str << "\n    digPeriod = " << quad.digPeriod();
00105       str << "\n    PeltierEnable = " << quad.PeltierEnable();
00106       str << "\n    kpConstant = " << quad.kpConstant();
00107       str << "\n    kiConstant = " << quad.kiConstant();
00108       str << "\n    kdConstant = " << quad.kdConstant();
00109       str << "\n    humidThold = " << quad.humidThold();
00110       str << "\n    setPoint = " << quad.setPoint();
00111       str << "\n    digitalPots = " << quad.dp().pots();
00112       str << "\n    readOnly = shiftTest: " << quad.ro().shiftTest() << " verstion: " << quad.ro().version();
00113       str << "\n    gainMap = " << quad.gm().gainMap();
00114     }
00115     
00116   }
00117 
00118   shared_ptr<Psana::CsPad2x2::ConfigV2> config2 = env.configStore().get(m_src);
00119   if (config2) {
00120 
00121     WithMsgLog(name(), info, str) {
00122       str << "CsPad2x2::ConfigV2:";
00123       str << "\n  concentratorVersion = " << config2->concentratorVersion();
00124       str << "\n  protectionEnable = " << config2->protectionEnable();
00125       str << "\n  protectionThreshold:";
00126       str << "\n    adcThreshold= " << config2->protectionThreshold().adcThreshold()
00127           << "\n    pixelCountThreshold= " << config2->protectionThreshold().pixelCountThreshold();
00128       str << "\n  inactiveRunMode = " << config2->inactiveRunMode();
00129       str << "\n  activeRunMode = " << config2->activeRunMode();
00130       str << "\n  runTriggerDelay = " << config2->runTriggerDelay();
00131       str << "\n  tdi = " << config2->tdi();
00132       str << "\n  payloadSize = " << config2->payloadSize();
00133       str << "\n  badAsicMask1 = " << config2->badAsicMask();
00134       str << "\n  asicMask = " << config2->asicMask();
00135       str << "\n  numAsicsRead = " << config2->numAsicsRead();
00136       str << "\n  roiMask = " << config2->roiMask();
00137       str << "\n  numAsicsStored = " << config2->numAsicsStored();
00138       const Psana::CsPad2x2::ConfigV2QuadReg& quad = config2->quad();
00139       str << "\n  quad:";
00140       str << "\n    shiftSelect = " << quad.shiftSelect();
00141       str << "\n    edgeSelect = " << quad.edgeSelect();
00142       str << "\n    readClkSet = " << quad.readClkSet();
00143       str << "\n    readClkHold = " << quad.readClkHold();
00144       str << "\n    dataMode = " << quad.dataMode();
00145       str << "\n    prstSel = " << quad.prstSel();
00146       str << "\n    acqDelay = " << quad.acqDelay();
00147       str << "\n    intTime = " << quad.intTime();
00148       str << "\n    digDelay = " << quad.digDelay();
00149       str << "\n    ampIdle = " << quad.ampIdle();
00150       str << "\n    injTotal = " << quad.injTotal();
00151       str << "\n    rowColShiftPer = " << quad.rowColShiftPer();
00152       str << "\n    ampReset = " << quad.ampReset();
00153       str << "\n    digCount = " << quad.digCount();
00154       str << "\n    digPeriod = " << quad.digPeriod();
00155       str << "\n    biasTuning = " << quad.biasTuning();
00156       str << "\n    pdpmndnmBalance = " << quad.pdpmndnmBalance();
00157       str << "\n    PeltierEnable = " << quad.PeltierEnable();
00158       str << "\n    kpConstant = " << quad.kpConstant();
00159       str << "\n    kiConstant = " << quad.kiConstant();
00160       str << "\n    kdConstant = " << quad.kdConstant();
00161       str << "\n    humidThold = " << quad.humidThold();
00162       str << "\n    setPoint = " << quad.setPoint();
00163       str << "\n    digitalPots = " << quad.dp().pots();
00164       str << "\n    readOnly = shiftTest: " << quad.ro().shiftTest() << " verstion: " << quad.ro().version();
00165       str << "\n    gainMap = " << quad.gm().gainMap();
00166     }
00167 
00168   }
00169 }
00170 
00171 // Method which is called with event data
00172 void 
00173 DumpCsPad2x2::event(Event& evt, Env& env)
00174 {
00175   shared_ptr<Psana::CsPad2x2::ElementV1> elem1 = evt.get(m_src, m_key);
00176   if (elem1) {
00177 
00178     WithMsgLog(name(), info, str) {
00179       str << "CsPad2x2::ElementV1:";
00180       str << "\n  virtual_channel = " << elem1->virtual_channel() ;
00181       str << "\n  lane = " << elem1->lane() ;
00182       str << "\n  tid = " << elem1->tid() ;
00183       str << "\n  acq_count = " << elem1->acq_count() ;
00184       str << "\n  op_code = " << elem1->op_code() ;
00185       str << "\n  quad = " << elem1->quad() ;
00186       str << "\n  seq_count = " << elem1->seq_count() ;
00187       str << "\n  ticks = " << elem1->ticks() ;
00188       str << "\n  fiducials = " << elem1->fiducials() ;
00189       str << "\n  frame_type = " << elem1->frame_type() ;
00190 
00191       str << "\n    sb_temp = " << elem1->sb_temp();
00192 
00193       const ndarray<const int16_t, 3>& data = elem1->data();
00194       str << "\n    common_mode = [ ";
00195       for (unsigned i = 0; i != data.shape()[2]; ++ i) {
00196           str << elem1->common_mode(i) << ' ';
00197       }
00198       str << "]";
00199       str << "\n    data = " << data;
00200     }
00201   }
00202 
00203 }
00204 
00205 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7