Go to the documentation of this file.00001 #include "RHStopDump.h"
00002
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006
00007 RHStopDump::RHStopDump(edm::ParameterSet const & parameters)
00008 : mStream (parameters.getParameter<std::string>("stoppedFile").c_str()),
00009 mProducer (parameters.getUntrackedParameter<std::string>("producer", "g4SimHits"))
00010 {}
00011
00012 void RHStopDump::analyze(const edm::Event& fEvent, const edm::EventSetup&) {
00013 edm::Handle<std::vector<std::string> > names;
00014 fEvent.getByLabel (mProducer, "StoppedParticlesName", names);
00015 edm::Handle<std::vector<float> > xs;
00016 fEvent.getByLabel (mProducer, "StoppedParticlesX", xs);
00017 edm::Handle<std::vector<float> > ys;
00018 fEvent.getByLabel (mProducer, "StoppedParticlesY", ys);
00019 edm::Handle<std::vector<float> > zs;
00020 fEvent.getByLabel (mProducer, "StoppedParticlesZ", zs);
00021 if (names->size() != xs->size() || xs->size() != ys->size() || ys->size() != zs->size()) {
00022 edm::LogError ("RHStopDump") << "mismatch array sizes name/x/y/z:"
00023 << names->size() << '/' << xs->size() << '/' << ys->size() << '/' << zs->size()
00024 << std::endl;
00025 }
00026 else {
00027 for (size_t i = 0; i < names->size(); ++i) {
00028 mStream << (*names)[i] << ' ' << (*xs)[i] << ' ' << (*ys)[i] << ' ' << (*zs)[i] << std::endl;
00029 }
00030 }
00031 }