00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "psana_examples/DumpPartition.h"
00016
00017
00018
00019
00020 #include <iomanip>
00021 #include <iostream>
00022
00023
00024
00025
00026 #include "MsgLogger/MsgLogger.h"
00027 #include "psddl_psana/partition.ddl.h"
00028
00029
00030
00031
00032
00033 using namespace psana_examples;
00034 PSANA_MODULE_FACTORY(DumpPartition)
00035
00036 namespace {
00037 void printPartition(std::ostream &out, boost::shared_ptr<Psana::Partition::ConfigV1> config) {
00038 out << "Partition::ConfigV1:\n";
00039 out << " bldMask: " << "0x" << std::setw(16) << std::setfill('0') << std::hex << config->bldMask() << '\n';
00040 out << " numSources: " << config->numSources() << '\n';
00041 ndarray<const Psana::Partition::Source, 1> sources = config->sources();
00042 for (unsigned idx = 0; idx < config->numSources(); ++ idx) {
00043 const Psana::Partition::Source & source = sources[idx];
00044 const Pds::Src& src = source.src();
00045 uint32_t group = source.group();
00046 out << " src= " << src << " group= " << group << '\n';
00047 }
00048 }
00049 }
00050
00051
00052
00053
00054
00055 namespace psana_examples {
00056
00057
00058
00059
00060 DumpPartition::DumpPartition (const std::string& name)
00061 : Module(name)
00062 {
00063 }
00064
00065
00066
00067
00068 DumpPartition::~DumpPartition ()
00069 {
00070 }
00071
00072 void
00073 DumpPartition::beginJob(Event& evt, Env& env)
00074 {
00075 PSEvt::Source src("ProcInfo()");
00076 boost::shared_ptr<Psana::Partition::ConfigV1> config = env.configStore().get(src);
00077 if (config) {
00078 MsgLog(name(),info,"DumpPartition In beginJob()");
00079 printPartition(std::cout, config);
00080 }
00081 }
00082
00083
00084 void
00085 DumpPartition::event(Event& evt, Env& env)
00086 {
00087 }
00088
00089 }