psana_examples/src/DumpBld.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: DumpBld.cpp 8419 2014-06-14 20:44:24Z davidsch@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class DumpBld...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana_examples/DumpBld.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <iomanip>
00022 
00023 //-------------------------------
00024 // Collaborating Class Headers --
00025 //-------------------------------
00026 #include "MsgLogger/MsgLogger.h"
00027 #include "psddl_psana/bld.ddl.h"
00028 
00029 //-----------------------------------------------------------------------
00030 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00031 //-----------------------------------------------------------------------
00032 
00033 using namespace psana_examples;
00034 PSANA_MODULE_FACTORY(DumpBld)
00035 
00036 //              ----------------------------------------
00037 //              -- Public Function Member Definitions --
00038 //              ----------------------------------------
00039 
00040 namespace psana_examples {
00041 
00042 //----------------
00043 // Constructors --
00044 //----------------
00045 DumpBld::DumpBld (const std::string& name)
00046   : Module(name)
00047 {
00048   m_ebeamSrc = configSrc("eBeamSource", "BldInfo(EBeam)");
00049   m_cavSrc = configSrc("phaseCavSource", "BldInfo(PhaseCavity)");
00050   m_feeSrc = configSrc("feeSource", "BldInfo(FEEGasDetEnergy)");
00051   m_ipimbSrc = configSrc("ipimbSource", "BldInfo(NH2-SB1-IPM-01)");
00052   m_pimSrc = configSrc("pimSource", "BldInfo(XCS-DIO-01)");
00053   m_gmdSrc = configSrc("gmdSource", "BldInfo()");
00054 }
00055 
00056 //--------------
00057 // Destructor --
00058 //--------------
00059 DumpBld::~DumpBld ()
00060 {
00061 }
00062 
00063 void
00064 DumpBld::beginJob(Event& evt, Env& env)
00065 {
00066   event(evt, env);
00067 }
00068 
00069 // Method which is called with event data
00070 void 
00071 DumpBld::event(Event& evt, Env& env)
00072 {
00073   shared_ptr<Psana::Bld::BldDataEBeamV0> ebeam0 = evt.get(m_ebeamSrc);
00074   if (ebeam0) {
00075     WithMsgLog(name(), info, str) {
00076       str << "Bld::BldDataEBeamV0:"
00077           << "\n  damageMask=" << std::showbase << std::hex << ebeam0->damageMask() << std::dec
00078           << "\n  ebeamCharge=" << ebeam0->ebeamCharge()
00079           << "\n  ebeamL3Energy=" << ebeam0->ebeamL3Energy()
00080           << "\n  ebeamLTUPosX=" << ebeam0->ebeamLTUPosX()
00081           << "\n  ebeamLTUPosY=" << ebeam0->ebeamLTUPosY()
00082           << "\n  ebeamLTUAngX=" << ebeam0->ebeamLTUAngX()
00083           << "\n  ebeamLTUAngY=" << ebeam0->ebeamLTUAngY();
00084     }
00085   }
00086 
00087   shared_ptr<Psana::Bld::BldDataEBeamV1> ebeam1 = evt.get(m_ebeamSrc);
00088   if (ebeam1) {
00089     WithMsgLog(name(), info, str) {
00090       str << "Bld::BldDataEBeamV1:"
00091           << "\n  damageMask=" << std::showbase << std::hex << ebeam1->damageMask() << std::dec
00092           << "\n  ebeamCharge=" << ebeam1->ebeamCharge()
00093           << "\n  ebeamL3Energy=" << ebeam1->ebeamL3Energy()
00094           << "\n  ebeamLTUPosX=" << ebeam1->ebeamLTUPosX()
00095           << "\n  ebeamLTUPosY=" << ebeam1->ebeamLTUPosY()
00096           << "\n  ebeamLTUAngX=" << ebeam1->ebeamLTUAngX()
00097           << "\n  ebeamLTUAngY=" << ebeam1->ebeamLTUAngY()
00098           << "\n  ebeamPkCurrBC2=" << ebeam1->ebeamPkCurrBC2();
00099     }
00100   }
00101 
00102   shared_ptr<Psana::Bld::BldDataEBeamV2> ebeam2 = evt.get(m_ebeamSrc);
00103   if (ebeam2) {
00104     WithMsgLog(name(), info, str) {
00105       str << "Bld::BldDataEBeamV2:"
00106           << "\n  damageMask=" << std::showbase << std::hex << ebeam2->damageMask() << std::dec
00107           << "\n  ebeamCharge=" << ebeam2->ebeamCharge()
00108           << "\n  ebeamL3Energy=" << ebeam2->ebeamL3Energy()
00109           << "\n  ebeamLTUPosX=" << ebeam2->ebeamLTUPosX()
00110           << "\n  ebeamLTUPosY=" << ebeam2->ebeamLTUPosY()
00111           << "\n  ebeamLTUAngX=" << ebeam2->ebeamLTUAngX()
00112           << "\n  ebeamLTUAngY=" << ebeam2->ebeamLTUAngY()
00113           << "\n  ebeamPkCurrBC2=" << ebeam2->ebeamPkCurrBC2()
00114           << "\n  ebeamEnergyBC2=" << ebeam2->ebeamEnergyBC2();
00115     }
00116   }
00117 
00118   shared_ptr<Psana::Bld::BldDataEBeamV3> ebeam3 = evt.get(m_ebeamSrc);
00119   if (ebeam3) {
00120     WithMsgLog(name(), info, str) {
00121       str << "Bld::BldDataEBeamV3:"
00122           << "\n  damageMask=" << std::showbase << std::hex << ebeam3->damageMask() << std::dec
00123           << "\n  ebeamCharge=" << ebeam3->ebeamCharge()
00124           << "\n  ebeamL3Energy=" << ebeam3->ebeamL3Energy()
00125           << "\n  ebeamLTUPosX=" << ebeam3->ebeamLTUPosX()
00126           << "\n  ebeamLTUPosY=" << ebeam3->ebeamLTUPosY()
00127           << "\n  ebeamLTUAngX=" << ebeam3->ebeamLTUAngX()
00128           << "\n  ebeamLTUAngY=" << ebeam3->ebeamLTUAngY()
00129           << "\n  ebeamPkCurrBC2=" << ebeam3->ebeamPkCurrBC2()
00130           << "\n  ebeamEnergyBC2=" << ebeam3->ebeamEnergyBC2()
00131           << "\n  ebeamPkCurrBC1=" << ebeam3->ebeamPkCurrBC1()
00132           << "\n  ebeamEnergyBC1=" << ebeam3->ebeamEnergyBC1();
00133     }
00134   }
00135 
00136   shared_ptr<Psana::Bld::BldDataEBeamV4> ebeam4 = evt.get(m_ebeamSrc);
00137   if (ebeam4) {
00138     WithMsgLog(name(), info, str) {
00139       str << "Bld::BldDataEBeamV4:"
00140           << "\n  damageMask=" << std::showbase << std::hex << ebeam4->damageMask() << std::dec
00141           << "\n  ebeamCharge=" << ebeam4->ebeamCharge()
00142           << "\n  ebeamL3Energy=" << ebeam4->ebeamL3Energy()
00143           << "\n  ebeamLTUPosX=" << ebeam4->ebeamLTUPosX()
00144           << "\n  ebeamLTUPosY=" << ebeam4->ebeamLTUPosY()
00145           << "\n  ebeamLTUAngX=" << ebeam4->ebeamLTUAngX()
00146           << "\n  ebeamLTUAngY=" << ebeam4->ebeamLTUAngY()
00147           << "\n  ebeamPkCurrBC2=" << ebeam4->ebeamPkCurrBC2()
00148           << "\n  ebeamEnergyBC2=" << ebeam4->ebeamEnergyBC2()
00149           << "\n  ebeamPkCurrBC1=" << ebeam4->ebeamPkCurrBC1()
00150           << "\n  ebeamEnergyBC1=" << ebeam4->ebeamEnergyBC1()
00151           << "\n  ebeamUndPosX=" << ebeam4->ebeamUndPosX()
00152           << "\n  ebeamUndPosY=" << ebeam4->ebeamUndPosY()
00153           << "\n  ebeamUndAngX=" << ebeam4->ebeamUndAngX()
00154           << "\n  ebeamUndAngY=" << ebeam4->ebeamUndAngY();
00155     }
00156   }
00157 
00158   shared_ptr<Psana::Bld::BldDataEBeamV5> ebeam5 = evt.get(m_ebeamSrc);
00159   if (ebeam5) {
00160     WithMsgLog(name(), info, str) {
00161       str << "Bld::BldDataEBeamV5:"
00162           << "\n  damageMask=" << std::showbase << std::hex << ebeam5->damageMask() << std::dec
00163           << "\n  ebeamCharge=" << ebeam5->ebeamCharge()
00164           << "\n  ebeamL3Energy=" << ebeam5->ebeamL3Energy()
00165           << "\n  ebeamLTUPosX=" << ebeam5->ebeamLTUPosX()
00166           << "\n  ebeamLTUPosY=" << ebeam5->ebeamLTUPosY()
00167           << "\n  ebeamLTUAngX=" << ebeam5->ebeamLTUAngX()
00168           << "\n  ebeamLTUAngY=" << ebeam5->ebeamLTUAngY()
00169           << "\n  ebeamPkCurrBC2=" << ebeam5->ebeamPkCurrBC2()
00170           << "\n  ebeamEnergyBC2=" << ebeam5->ebeamEnergyBC2()
00171           << "\n  ebeamPkCurrBC1=" << ebeam5->ebeamPkCurrBC1()
00172           << "\n  ebeamEnergyBC1=" << ebeam5->ebeamEnergyBC1()
00173           << "\n  ebeamUndPosX=" << ebeam5->ebeamUndPosX()
00174           << "\n  ebeamUndPosY=" << ebeam5->ebeamUndPosY()
00175           << "\n  ebeamUndAngX=" << ebeam5->ebeamUndAngX()
00176           << "\n  ebeamUndAngY=" << ebeam5->ebeamUndAngY()
00177           << "\n  ebeamXTCAVAmpl=" << ebeam5->ebeamXTCAVAmpl()
00178           << "\n  ebeamXTCAVPhase=" << ebeam5->ebeamXTCAVPhase()
00179           << "\n  ebeamDumpCharge=" << ebeam5->ebeamDumpCharge();
00180     }
00181   }
00182 
00183   shared_ptr<Psana::Bld::BldDataPhaseCavity> cav = evt.get(m_cavSrc);
00184   if (cav) {
00185     WithMsgLog(name(), info, str) {
00186       str << "Bld::BldDataPhaseCavity:" 
00187           << "\n  fitTime1=" << cav->fitTime1()
00188           << "\n  fitTime2=" << cav->fitTime2()
00189           << "\n  charge1=" << cav->charge1()
00190           << "\n  charge2=" << cav->charge2();
00191     }
00192   }
00193   
00194   shared_ptr<Psana::Bld::BldDataFEEGasDetEnergyV1> feeV1 = evt.get(m_feeSrc);
00195   if (feeV1) {
00196     WithMsgLog(name(), info, str) {
00197       str << "Bld::BldDataFEEGasDetEnergyV1:"
00198           << "\n  f_11_ENRC=" << feeV1->f_11_ENRC()
00199           << "\n  f_12_ENRC=" << feeV1->f_12_ENRC()
00200           << "\n  f_21_ENRC=" << feeV1->f_21_ENRC()
00201           << "\n  f_22_ENRC=" << feeV1->f_22_ENRC()
00202           << "\n  f_63_ENRC=" << feeV1->f_63_ENRC()
00203           << "\n  f_64_ENRC=" << feeV1->f_64_ENRC();
00204     }
00205   } else {
00206     shared_ptr<Psana::Bld::BldDataFEEGasDetEnergy> fee = evt.get(m_feeSrc);
00207     if (fee) {
00208       WithMsgLog(name(), info, str) {
00209         str << "Bld::BldDataFEEGasDetEnergy:"
00210             << "\n  f_11_ENRC=" << fee->f_11_ENRC()
00211             << "\n  f_12_ENRC=" << fee->f_12_ENRC()
00212             << "\n  f_21_ENRC=" << fee->f_21_ENRC()
00213             << "\n  f_22_ENRC=" << fee->f_22_ENRC();
00214       }
00215     }
00216   }
00217 
00218   shared_ptr<Psana::Bld::BldDataIpimbV0> ipimb0 = evt.get(m_ipimbSrc);
00219   if (ipimb0) {
00220     WithMsgLog(name(), info, str) {
00221       str << "Bld::BldDataIpimbV0:";
00222       const Psana::Ipimb::DataV1& ipimbData = ipimb0->ipimbData();
00223       str << "\n  Ipimb::DataV1:"
00224           << "\n    triggerCounter = " << ipimbData.triggerCounter()
00225           << "\n    config = " << ipimbData.config0()
00226           << "," << ipimbData.config1()
00227           << "," << ipimbData.config2()
00228           << "\n    channel = " << ipimbData.channel0()
00229           << "," << ipimbData.channel1()
00230           << "," << ipimbData.channel2()
00231           << "," << ipimbData.channel3()
00232           << "\n    volts = " << ipimbData.channel0Volts()
00233           << "," << ipimbData.channel1Volts()
00234           << "," << ipimbData.channel2Volts()
00235           << "," << ipimbData.channel3Volts()
00236           << "\n    checksum = " << ipimbData.checksum();
00237       
00238       const Psana::Ipimb::ConfigV1& ipimbConfig = ipimb0->ipimbConfig();
00239       str << "\n  Ipimb::ConfigV1:";
00240       str << "\n    triggerCounter = " << ipimbConfig.triggerCounter();
00241       str << "\n    serialID = " << ipimbConfig.serialID();
00242       str << "\n    chargeAmpRange = " << ipimbConfig.chargeAmpRange();
00243       str << "\n    calibrationRange = " << ipimbConfig.calibrationRange();
00244       str << "\n    resetLength = " << ipimbConfig.resetLength();
00245       str << "\n    resetDelay = " << ipimbConfig.resetDelay();
00246       str << "\n    chargeAmpRefVoltage = " << ipimbConfig.chargeAmpRefVoltage();
00247       str << "\n    calibrationVoltage = " << ipimbConfig.calibrationVoltage();
00248       str << "\n    diodeBias = " << ipimbConfig.diodeBias();
00249       str << "\n    status = " << ipimbConfig.status();
00250       str << "\n    errors = " << ipimbConfig.errors();
00251       str << "\n    calStrobeLength = " << ipimbConfig.calStrobeLength();
00252       str << "\n    trigDelay = " << ipimbConfig.trigDelay();
00253       
00254       const Psana::Lusi::IpmFexV1& ipmFexData = ipimb0->ipmFexData();
00255       str << "\n  Psana::Lusi::IpmFexV1:";
00256       str << "\n    sum = " << ipmFexData.sum();
00257       str << "\n    xpos = " << ipmFexData.xpos();
00258       str << "\n    ypos = " << ipmFexData.ypos();
00259       str << "\n    channel = " << ipmFexData.channel();
00260     }
00261   }
00262 
00263   shared_ptr<Psana::Bld::BldDataIpimbV1> ipimb1 = evt.get(m_ipimbSrc);
00264   if (ipimb1) {
00265     WithMsgLog(name(), info, str) {
00266       str << "Bld::BldDataIpimbV1:";
00267       const Psana::Ipimb::DataV2& ipimbData = ipimb1->ipimbData();
00268       str << "\n  Ipimb::DataV1:"
00269           << "\n    triggerCounter = " << ipimbData.triggerCounter()
00270           << "\n    config = " << ipimbData.config0()
00271           << "," << ipimbData.config1()
00272           << "," << ipimbData.config2()
00273           << "\n    channel = " << ipimbData.channel0()
00274           << "," << ipimbData.channel1()
00275           << "," << ipimbData.channel2()
00276           << "," << ipimbData.channel3()
00277           << "\n    volts = " << ipimbData.channel0Volts()
00278           << "," << ipimbData.channel1Volts()
00279           << "," << ipimbData.channel2Volts()
00280           << "," << ipimbData.channel3Volts()
00281           << "\n    channel-ps = " << ipimbData.channel0ps()
00282           << "," << ipimbData.channel1ps()
00283           << "," << ipimbData.channel2ps()
00284           << "," << ipimbData.channel3ps()
00285           << "\n    volts-ps = " << ipimbData.channel0psVolts()
00286           << "," << ipimbData.channel1psVolts()
00287           << "," << ipimbData.channel2psVolts()
00288           << "," << ipimbData.channel3psVolts()
00289           << "\n    checksum = " << ipimbData.checksum();
00290       
00291       const Psana::Ipimb::ConfigV2& ipimbConfig = ipimb1->ipimbConfig();
00292       str << "\n  Ipimb::ConfigV1:";
00293       str << "\n    triggerCounter = " << ipimbConfig.triggerCounter();
00294       str << "\n    serialID = " << ipimbConfig.serialID();
00295       str << "\n    chargeAmpRange = " << ipimbConfig.chargeAmpRange();
00296       str << "\n    calibrationRange = " << ipimbConfig.calibrationRange();
00297       str << "\n    resetLength = " << ipimbConfig.resetLength();
00298       str << "\n    resetDelay = " << ipimbConfig.resetDelay();
00299       str << "\n    chargeAmpRefVoltage = " << ipimbConfig.chargeAmpRefVoltage();
00300       str << "\n    calibrationVoltage = " << ipimbConfig.calibrationVoltage();
00301       str << "\n    diodeBias = " << ipimbConfig.diodeBias();
00302       str << "\n    status = " << ipimbConfig.status();
00303       str << "\n    errors = " << ipimbConfig.errors();
00304       str << "\n    calStrobeLength = " << ipimbConfig.calStrobeLength();
00305       str << "\n    trigDelay = " << ipimbConfig.trigDelay();
00306       str << "\n    trigPsDelay = " << ipimbConfig.trigPsDelay();
00307       str << "\n    adcDelay = " << ipimbConfig.adcDelay();
00308       
00309       const Psana::Lusi::IpmFexV1& ipmFexData = ipimb1->ipmFexData();
00310       str << "\n  Psana::Lusi::IpmFexV1:";
00311       str << "\n    sum = " << ipmFexData.sum();
00312       str << "\n    xpos = " << ipmFexData.xpos();
00313       str << "\n    ypos = " << ipmFexData.ypos();
00314       str << "\n    channel = " << ipmFexData.channel();
00315     }
00316   }
00317 
00318   shared_ptr<Psana::Bld::BldDataPimV1> pim1 = evt.get(m_pimSrc);
00319   if (pim1) {
00320     WithMsgLog(name(), info, str) {
00321       str << "Bld::BldDataPimV1:";
00322       const Psana::Pulnix::TM6740ConfigV2& camCfg = pim1->camConfig();
00323       str << "\n  Pulnix::TM6740ConfigV2:"
00324           << "\n    vref_a = " << camCfg.vref_a()
00325           << "\n    vref_b = " << camCfg.vref_b()
00326           << "\n    gain_a = " << camCfg.gain_a()
00327           << "\n    gain_b = " << camCfg.gain_b()
00328           << "\n    gain_balance = " << (camCfg.gain_balance() ? "yes" : "no")
00329           << "\n    output_resolution = " << camCfg.output_resolution()
00330           << "\n    output_resolution_bits = " << camCfg.output_resolution_bits()
00331           << "\n    horizontal_binning = " << camCfg.horizontal_binning()
00332           << "\n    vertical_binning = " << camCfg.vertical_binning()
00333           << "\n    lookuptable_mode = " << camCfg.lookuptable_mode();
00334 
00335       const Psana::Lusi::PimImageConfigV1& pimCfg = pim1->pimConfig();
00336       str << "\n  Lusi::PimImageConfigV1:"
00337           << "\n    xscale = " << pimCfg.xscale()
00338           << "\n    yscale = " << pimCfg.yscale();
00339 
00340       const Psana::Camera::FrameV1& frame = pim1->frame();
00341       str << "\n  Camera::FrameV1:"
00342           << "\n    width=" << frame.width()
00343           << "\n    height=" << frame.height()
00344           << "\n    depth=" << frame.depth()
00345           << "\n    offset=" << frame.offset();
00346 
00347       const ndarray<const uint8_t, 2>& data8 = frame.data8();
00348       if (not data8.empty()) {
00349         str << "\n    data8=" << data8;
00350       }
00351 
00352       const ndarray<const uint16_t, 2>& data16 = frame.data16();
00353       if (not data16.empty()) {
00354         str << "\n    data16=" << data16;
00355       }
00356     }
00357   }
00358 
00359 
00360   // dump BldDataGMDV0
00361   shared_ptr<Psana::Bld::BldDataGMDV0> gmd0 = evt.get(m_gmdSrc);
00362   if (gmd0) {
00363     WithMsgLog(name(), info, str) {
00364       str << "Bld::BldDataGMDV0:"
00365           << "\n  gasType = " << gmd0->gasType()
00366           << "\n  pressure = " << gmd0->pressure()
00367           << "\n  temperature = " << gmd0->temperature()
00368           << "\n  current = " << gmd0->current()
00369           << "\n  hvMeshElectron = " << gmd0->hvMeshElectron()
00370           << "\n  hvMeshIon = " << gmd0->hvMeshIon()
00371           << "\n  hvMultIon = " << gmd0->hvMultIon()
00372           << "\n  chargeQ = " << gmd0->chargeQ()
00373           << "\n  photonEnergy = " << gmd0->photonEnergy()
00374           << "\n  multPulseIntensity = " << gmd0->multPulseIntensity()
00375           << "\n  keithleyPulseIntensity = " << gmd0->keithleyPulseIntensity()
00376           << "\n  pulseEnergy = " << gmd0->pulseEnergy()
00377           << "\n  pulseEnergyFEE = " << gmd0->pulseEnergyFEE()
00378           << "\n  transmission = " << gmd0->transmission()
00379           << "\n  transmissionFEE = " << gmd0->transmissionFEE();
00380     }
00381   }
00382 
00383   // dump BldDataGMDV1
00384   shared_ptr<Psana::Bld::BldDataGMDV1> gmd1 = evt.get(m_gmdSrc);
00385   if (gmd1) {
00386     WithMsgLog(name(), info, str) {
00387       str << "Bld::BldDataGMDV1:"
00388           << "\n  milliJoulesPerPulse = " << gmd1->milliJoulesPerPulse()
00389           << "\n  milliJoulesAverage = " << gmd1->milliJoulesAverage()
00390           << "\n  correctedSumPerPulse = " << gmd1->correctedSumPerPulse()
00391           << "\n  bgValuePerSample = " << gmd1->bgValuePerSample()
00392           << "\n  relativeEnergyPerPulse = " << gmd1->relativeEnergyPerPulse();
00393     }
00394   }
00395 
00396   // dump BldDataSpectrometerV0
00397   shared_ptr<Psana::Bld::BldDataSpectrometerV0> spec0 = evt.get(m_gmdSrc);
00398   if (spec0) {
00399     WithMsgLog(name(), info, str) {
00400       str << "Bld::BldDataSpectrometerV0:"
00401           << "\n  hproj = " << spec0->hproj()
00402           << "\n  vproj = " << spec0->vproj();
00403     }
00404   }
00405 
00406 }
00407 
00408 } // namespace psana_examples

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7