00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana_examples/DumpLusi.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/lusi.ddl.h"
00027
00028
00029
00030
00031
00032 using namespace psana_examples;
00033 PSANA_MODULE_FACTORY(DumpLusi)
00034
00035
00036
00037
00038
00039 namespace psana_examples {
00040
00041
00042
00043
00044 DumpLusi::DumpLusi (const std::string& name)
00045 : Module(name)
00046 {
00047 m_ipimbSrc = configSrc("ipimbSource", "DetInfo(:Ipimb)");
00048 m_tmSrc = configSrc("tmSource", "DetInfo(:Tm6740)");
00049 }
00050
00051
00052
00053
00054 DumpLusi::~DumpLusi ()
00055 {
00056 }
00057
00058
00059 void
00060 DumpLusi::beginCalibCycle(Event& evt, Env& env)
00061 {
00062 MsgLog(name(), info, "in beginCalibCycle()");
00063
00064 shared_ptr<Psana::Lusi::DiodeFexConfigV1> dconfig1 = env.configStore().get(m_ipimbSrc);
00065 if (dconfig1) {
00066
00067 WithMsgLog(name(), info, str) {
00068 str << "Lusi::DiodeFexConfigV1:";
00069 str << "\n base = " << dconfig1->base();
00070 str << "\n scale = " << dconfig1->scale();
00071 }
00072
00073 }
00074
00075 shared_ptr<Psana::Lusi::DiodeFexConfigV2> dconfig2 = env.configStore().get(m_ipimbSrc);
00076 if (dconfig2) {
00077
00078 WithMsgLog(name(), info, str) {
00079 str << "Lusi::DiodeFexConfigV2:";
00080 str << "\n base = " << dconfig2->base();
00081 str << "\n scale = " << dconfig2->scale();
00082 }
00083
00084 }
00085
00086 shared_ptr<Psana::Lusi::IpmFexConfigV1> iconfig1 = env.configStore().get(m_ipimbSrc);
00087 if (iconfig1) {
00088
00089 WithMsgLog(name(), info, str) {
00090 str << "Psana::Lusi::IpmFexConfigV1:";
00091 str << "\n xscale = " << iconfig1->xscale();
00092 str << "\n yscale = " << iconfig1->yscale();
00093
00094 const ndarray<const Psana::Lusi::DiodeFexConfigV1, 1>& diodes = iconfig1->diode();
00095 for (unsigned ch = 0; ch < diodes.size(); ++ ch) {
00096 str << "\n channel #" << ch << ":";
00097
00098 const Psana::Lusi::DiodeFexConfigV1& dconfig = diodes[ch];
00099 str << "\n base = " << dconfig.base();
00100 str << "\n scale = " << dconfig.scale();
00101 }
00102 }
00103
00104 }
00105
00106 shared_ptr<Psana::Lusi::IpmFexConfigV2> iconfig2 = env.configStore().get(m_ipimbSrc);
00107 if (iconfig2) {
00108
00109 WithMsgLog(name(), info, str) {
00110 str << "Psana::Lusi::IpmFexConfigV2:";
00111 str << "\n xscale = " << iconfig2->xscale();
00112 str << "\n yscale = " << iconfig2->yscale();
00113
00114 const ndarray<const Psana::Lusi::DiodeFexConfigV2, 1>& diodes = iconfig2->diode();
00115 for (int ch = 0; ch < Psana::Lusi::IpmFexConfigV2::NCHANNELS; ++ ch) {
00116 str << "\n channel #" << ch << ":";
00117
00118 const Psana::Lusi::DiodeFexConfigV2& dconfig = diodes[ch];
00119 str << "\n base = " << dconfig.base();
00120 str << "\n scale = " << dconfig.scale();
00121 }
00122 }
00123
00124 }
00125
00126 shared_ptr<Psana::Lusi::PimImageConfigV1> pconfig = env.configStore().get(m_tmSrc);
00127 if (pconfig) {
00128
00129 WithMsgLog(name(), info, str) {
00130 str << "Psana::Lusi::PimImageConfigV1:";
00131 str << "\n xscale = " << pconfig->xscale();
00132 str << "\n yscale = " << pconfig->yscale();
00133 }
00134
00135 }
00136
00137 }
00138
00139
00140 void
00141 DumpLusi::event(Event& evt, Env& env)
00142 {
00143 shared_ptr<Psana::Lusi::DiodeFexV1> diode = evt.get(m_ipimbSrc);
00144 if (diode) {
00145 WithMsgLog(name(), info, str) {
00146 str << "Lusi::DiodeFexV1: value = " << diode->value();
00147 }
00148 }
00149
00150 shared_ptr<Psana::Lusi::IpmFexV1> fex = evt.get(m_ipimbSrc);
00151 if (fex) {
00152 WithMsgLog(name(), info, str) {
00153 str << "Psana::Lusi::IpmFexV1:";
00154 str << "\n sum = " << fex->sum();
00155 str << "\n xpos = " << fex->xpos();
00156 str << "\n ypos = " << fex->ypos();
00157 str << "\n channel =" << fex->channel();
00158 }
00159 }
00160
00161 }
00162
00163 }