00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "psana_examples/DumpIpimb.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "MsgLogger/MsgLogger.h"
00026 #include "psddl_psana/ipimb.ddl.h"
00027
00028
00029
00030
00031
00032 using namespace psana_examples;
00033 PSANA_MODULE_FACTORY(DumpIpimb)
00034
00035
00036
00037
00038
00039 namespace psana_examples {
00040
00041
00042
00043
00044 DumpIpimb::DumpIpimb (const std::string& name)
00045 : Module(name)
00046 {
00047 m_src = configSrc("source", "DetInfo(:Ipimb)");
00048 }
00049
00050
00051
00052
00053 DumpIpimb::~DumpIpimb ()
00054 {
00055 }
00056
00057
00058 void
00059 DumpIpimb::beginCalibCycle(Event& evt, Env& env)
00060 {
00061 MsgLog(name(), info, "in beginCalibCycle()");
00062
00063 shared_ptr<Psana::Ipimb::ConfigV1> config1 = env.configStore().get(m_src);
00064 if (config1) {
00065
00066 WithMsgLog(name(), info, str) {
00067 str << "Ipimb::ConfigV1:";
00068 str << "\n triggerCounter = " << config1->triggerCounter();
00069 str << "\n serialID = " << config1->serialID();
00070 str << "\n chargeAmpRange = " << config1->chargeAmpRange();
00071 str << "\n capacitorValue = " << config1->capacitorValue(0) << " " << config1->capacitorValue(1)
00072 << " " << config1->capacitorValue(2) << " " << config1->capacitorValue(3);
00073 str << "\n calibrationRange = " << config1->calibrationRange();
00074 str << "\n resetLength = " << config1->resetLength();
00075 str << "\n resetDelay = " << config1->resetDelay();
00076 str << "\n chargeAmpRefVoltage = " << config1->chargeAmpRefVoltage();
00077 str << "\n calibrationVoltage = " << config1->calibrationVoltage();
00078 str << "\n diodeBias = " << config1->diodeBias();
00079 str << "\n status = " << config1->status();
00080 str << "\n errors = " << config1->errors();
00081 str << "\n calStrobeLength = " << config1->calStrobeLength();
00082 str << "\n trigDelay = " << config1->trigDelay();
00083 }
00084
00085 }
00086
00087 shared_ptr<Psana::Ipimb::ConfigV2> config2 = env.configStore().get(m_src);
00088 if (config2) {
00089
00090 WithMsgLog(name(), info, str) {
00091 str << "Ipimb::ConfigV2:";
00092 str << "\n triggerCounter = " << config2->triggerCounter();
00093 str << "\n serialID = " << config2->serialID();
00094 str << "\n chargeAmpRange = " << config2->chargeAmpRange();
00095 str << "\n capacitorValue = " << config2->capacitorValue(0) << " " << config2->capacitorValue(1)
00096 << " " << config2->capacitorValue(2) << " " << config2->capacitorValue(3);
00097 str << "\n calibrationRange = " << config2->calibrationRange();
00098 str << "\n resetLength = " << config2->resetLength();
00099 str << "\n resetDelay = " << config2->resetDelay();
00100 str << "\n chargeAmpRefVoltage = " << config2->chargeAmpRefVoltage();
00101 str << "\n calibrationVoltage = " << config2->calibrationVoltage();
00102 str << "\n diodeBias = " << config2->diodeBias();
00103 str << "\n status = " << config2->status();
00104 str << "\n errors = " << config2->errors();
00105 str << "\n calStrobeLength = " << config2->calStrobeLength();
00106 str << "\n trigDelay = " << config2->trigDelay();
00107 str << "\n trigPsDelay = " << config2->trigPsDelay();
00108 str << "\n adcDelay = " << config2->adcDelay();
00109 }
00110
00111 }
00112
00113 }
00114
00115
00116 void
00117 DumpIpimb::event(Event& evt, Env& env)
00118 {
00119 shared_ptr<Psana::Ipimb::DataV1> data1 = evt.get(m_src);
00120 if (data1) {
00121
00122 WithMsgLog(name(), info, str) {
00123 str << "Ipimb::DataV1:"
00124 << "\n triggerCounter = " << data1->triggerCounter()
00125 << "\n config = " << data1->config0()
00126 << "," << data1->config1()
00127 << "," << data1->config2()
00128 << "\n channel = " << data1->channel0()
00129 << "," << data1->channel1()
00130 << "," << data1->channel2()
00131 << "," << data1->channel3()
00132 << "\n volts = " << data1->channel0Volts()
00133 << "," << data1->channel1Volts()
00134 << "," << data1->channel2Volts()
00135 << "," << data1->channel3Volts()
00136 << "\n checksum = " << data1->checksum();
00137 }
00138 }
00139
00140 shared_ptr<Psana::Ipimb::DataV2> data2 = evt.get(m_src);
00141 if (data2) {
00142
00143 WithMsgLog(name(), info, str) {
00144 str << "Ipimb::DataV2:"
00145 << "\n triggerCounter = " << data2->triggerCounter()
00146 << "\n config = " << data2->config0()
00147 << "," << data2->config1()
00148 << "," << data2->config2()
00149 << "\n channel = " << data2->channel0()
00150 << "," << data2->channel1()
00151 << "," << data2->channel2()
00152 << "," << data2->channel3()
00153 << "\n volts = " << data2->channel0Volts()
00154 << "," << data2->channel1Volts()
00155 << "," << data2->channel2Volts()
00156 << "," << data2->channel3Volts()
00157 << "\n channel-ps = " << data2->channel0ps()
00158 << "," << data2->channel1ps()
00159 << "," << data2->channel2ps()
00160 << "," << data2->channel3ps()
00161 << "\n volts-ps = " << data2->channel0psVolts()
00162 << "," << data2->channel1psVolts()
00163 << "," << data2->channel2psVolts()
00164 << "," << data2->channel3psVolts()
00165 << "\n checksum = " << data2->checksum();
00166 }
00167 }
00168 }
00169
00170 }