00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "Detector/NDArrProducerPrinceton.h"
00015
00016
00017
00018 namespace Detector {
00019
00020 typedef NDArrProducerPrinceton::data_t data_t;
00021
00022
00023
00024 NDArrProducerPrinceton::NDArrProducerPrinceton(const PSEvt::Source& source, const unsigned& mode, const unsigned& pbits, const float& vdef)
00025 : NDArrProducerBase(source, mode, pbits, vdef)
00026 , m_count_ent(0)
00027 , m_count_msg(0)
00028 {
00029
00030 m_as_data = true;
00031 }
00032
00033
00034
00035 NDArrProducerPrinceton::~NDArrProducerPrinceton ()
00036 {
00037 }
00038
00039
00040
00041 void
00042 NDArrProducerPrinceton::print_warning(const char* msg)
00043 {
00044 m_count_msg++;
00045 if (m_count_msg < 11 && m_pbits) {
00046 MsgLog(name(), warning, "Princeton::FramesV1,2, Pimax::FrameV1 object"
00047 << " is not available in this run/event for source:" << m_source);
00048 if (m_count_msg == 10) MsgLog(name(), warning, "STOP PRINT WARNINGS for source:" << m_source);
00049 }
00050 }
00051
00052
00053
00054 ndarray<const data_t, 2>
00055 NDArrProducerPrinceton::data_nda_uint16_2(PSEvt::Event& evt, PSEnv::Env& env)
00056 {
00057 ndarray<const data_t, 2> nda1 = getNDArrForType<Psana::Princeton::FrameV1, data_t>(evt, env);
00058 if ( ! nda1.empty()) return nda1;
00059
00060 ndarray<const data_t, 2> nda2 = getNDArrForType<Psana::Princeton::FrameV2, data_t>(evt, env);
00061 if ( ! nda2.empty()) return nda2;
00062
00063 ndarray<const data_t, 2> nda3 = getNDArrForType<Psana::Pimax::FrameV1, data_t>(evt, env);
00064 if ( ! nda3.empty()) return nda3;
00065
00066 print_warning();
00067 ndarray<data_t, 2> nda;
00068 return nda;
00069 }
00070
00071
00072
00073 void
00074 NDArrProducerPrinceton::print_config(PSEvt::Event& evt, PSEnv::Env& env)
00075 {
00076
00077 boost::shared_ptr<Psana::Princeton::ConfigV1> config1 = env.configStore().get(m_source);
00078 if (config1.get()) {
00079 WithMsgLog(name(), info, str) {
00080 str << "Princeton::ConfigV1:";
00081 str << "\n width = " << config1->width();
00082 str << "\n height = " << config1->height();
00083 str << "\n orgX = " << config1->orgX();
00084 str << "\n orgY = " << config1->orgY();
00085 str << "\n binX = " << config1->binX();
00086 str << "\n binY = " << config1->binY();
00087 str << "\n exposureTime = " << config1->exposureTime();
00088 str << "\n coolingTemp = " << config1->coolingTemp();
00089 str << "\n readoutSpeedIndex = " << config1->readoutSpeedIndex();
00090 str << "\n readoutEventCode = " << config1->readoutEventCode();
00091 str << "\n delayMode = " << config1->delayMode();
00092 str << "\n frameSize = " << config1->frameSize();
00093 str << "\n numPixels = " << config1->numPixels();
00094 }
00095 return;
00096 }
00097
00098
00099 boost::shared_ptr<Psana::Princeton::ConfigV2> config2 = env.configStore().get(m_source);
00100 if (config2.get()) {
00101 WithMsgLog(name(), info, str) {
00102 str << "Princeton::ConfigV2:";
00103 str << "\n width = " << config2->width();
00104 str << "\n height = " << config2->height();
00105 str << "\n orgX = " << config2->orgX();
00106 str << "\n orgY = " << config2->orgY();
00107 str << "\n binX = " << config2->binX();
00108 str << "\n binY = " << config2->binY();
00109 str << "\n exposureTime = " << config2->exposureTime();
00110 str << "\n coolingTemp = " << config2->coolingTemp();
00111 str << "\n gainIndex = " << config2->gainIndex();
00112 str << "\n readoutSpeedIndex = " << config2->readoutSpeedIndex();
00113 str << "\n readoutEventCode = " << config2->readoutEventCode();
00114 str << "\n delayMode = " << config2->delayMode();
00115 str << "\n frameSize = " << config2->frameSize();
00116 str << "\n numPixels = " << config2->numPixels();
00117 }
00118 return;
00119 }
00120
00121
00122 boost::shared_ptr<Psana::Princeton::ConfigV3> config3 = env.configStore().get(m_source);
00123 if (config3.get()) {
00124 WithMsgLog(name(), info, str) {
00125 str << "Princeton::ConfigV3:";
00126 str << "\n width = " << config3->width();
00127 str << "\n height = " << config3->height();
00128 str << "\n orgX = " << config3->orgX();
00129 str << "\n orgY = " << config3->orgY();
00130 str << "\n binX = " << config3->binX();
00131 str << "\n binY = " << config3->binY();
00132 str << "\n exposureTime = " << config3->exposureTime();
00133 str << "\n coolingTemp = " << config3->coolingTemp();
00134 str << "\n gainIndex = " << config3->gainIndex();
00135 str << "\n readoutSpeedIndex = " << config3->readoutSpeedIndex();
00136 str << "\n exposureEventCode = " << config3->exposureEventCode();
00137 str << "\n numDelayShots = " << config3->numDelayShots();
00138 str << "\n frameSize = " << config3->frameSize();
00139 str << "\n numPixels = " << config3->numPixels();
00140 }
00141 return;
00142 }
00143
00144 boost::shared_ptr<Psana::Princeton::ConfigV4> config4 = env.configStore().get(m_source);
00145 if (config4) {
00146 WithMsgLog(name(), info, str) {
00147 str << "Princeton::ConfigV4:";
00148 str << "\n width = " << config4->width();
00149 str << "\n height = " << config4->height();
00150 str << "\n orgX = " << config4->orgX();
00151 str << "\n orgY = " << config4->orgY();
00152 str << "\n binX = " << config4->binX();
00153 str << "\n binY = " << config4->binY();
00154 str << "\n maskedHeight = " << config4->maskedHeight();
00155 str << "\n kineticHeight = " << config4->kineticHeight();
00156 str << "\n vsSpeed = " << config4->vsSpeed();
00157 str << "\n exposureTime = " << config4->exposureTime();
00158 str << "\n coolingTemp = " << config4->coolingTemp();
00159 str << "\n gainIndex = " << int(config4->gainIndex());
00160 str << "\n readoutSpeedIndex = " << int(config4->readoutSpeedIndex());
00161 str << "\n exposureEventCode = " << config4->exposureEventCode();
00162 str << "\n numDelayShots = " << config4->numDelayShots();
00163 str << "\n frameSize = " << config4->frameSize();
00164 str << "\n numPixels = " << config4->numPixels();
00165 }
00166 return;
00167 }
00168
00169 boost::shared_ptr<Psana::Princeton::ConfigV5> config5 = env.configStore().get(m_source);
00170 if (config5) {
00171 WithMsgLog(name(), info, str) {
00172 str << "Princeton::ConfigV5:";
00173 str << "\n width = " << config5->width();
00174 str << "\n height = " << config5->height();
00175 str << "\n orgX = " << config5->orgX();
00176 str << "\n orgY = " << config5->orgY();
00177 str << "\n binX = " << config5->binX();
00178 str << "\n binY = " << config5->binY();
00179 str << "\n exposureTime = " << config5->exposureTime();
00180 str << "\n coolingTemp = " << config5->coolingTemp();
00181 str << "\n gainIndex = " << config5->gainIndex();
00182 str << "\n readoutSpeedIndex = " << config5->readoutSpeedIndex();
00183 str << "\n maskedHeight = " << config5->maskedHeight();
00184 str << "\n kineticHeight = " << config5->kineticHeight();
00185 str << "\n vsSpeed = " << config5->vsSpeed();
00186 str << "\n infoReportInterval = " << config5->infoReportInterval();
00187 str << "\n exposureEventCode = " << config5->exposureEventCode();
00188 str << "\n numDelayShots = " << config5->numDelayShots();
00189 str << "\n frameSize = " << config5->frameSize();
00190 str << "\n numPixels = " << config5->numPixels();
00191 }
00192 return;
00193 }
00194
00195 boost::shared_ptr<Psana::Pimax::ConfigV1> config1_pimax = env.configStore().get(m_source);
00196 if (config1_pimax) {
00197 WithMsgLog(name(), info, str) {
00198 str << "Pimax::ConfigV1:";
00199 str << "\n width = " << config1_pimax->width();
00200 str << "\n height = " << config1_pimax->height();
00201 str << "\n orgX = " << config1_pimax->orgX();
00202 str << "\n orgY = " << config1_pimax->orgY();
00203 str << "\n binX = " << config1_pimax->binX();
00204 str << "\n binY = " << config1_pimax->binY();
00205 str << "\n exposureTime = " << config1_pimax->exposureTime();
00206 str << "\n coolingTemp = " << config1_pimax->coolingTemp();
00207 str << "\n readoutSpeed = " << config1_pimax->readoutSpeed();
00208 str << "\n gainIndex = " << config1_pimax->gainIndex();
00209 str << "\n intensifierGain = " << config1_pimax->intensifierGain();
00210 str << "\n gateDelay = " << config1_pimax->gateDelay();
00211 str << "\n gateWidth = " << config1_pimax->gateWidth();
00212 str << "\n maskedHeight = " << config1_pimax->maskedHeight();
00213 str << "\n kineticHeight = " << config1_pimax->kineticHeight();
00214 str << "\n vsSpeed = " << config1_pimax->vsSpeed();
00215 str << "\n infoReportInterval = " << config1_pimax->infoReportInterval();
00216 str << "\n exposureEventCode = " << config1_pimax->exposureEventCode();
00217 str << "\n numIntegrationShots = " << config1_pimax->numIntegrationShots();
00218 str << "\n frameSize = " << config1_pimax->frameSize();
00219 str << "\n numPixelsX = " << config1_pimax->numPixelsX();
00220 str << "\n numPixelsY = " << config1_pimax->numPixelsY();
00221 str << "\n numPixels = " << config1_pimax->numPixels();
00222 }
00223 return;
00224 }
00225
00226 MsgLog(name(), info, "Princeton::ConfigV# is not found for source " << m_source);
00227 }
00228
00229
00230 }
00231