CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RHStopDump.cc
Go to the documentation of this file.
1 #include "RHStopDump.h"
2 
6 
8  : mStream (parameters.getParameter<std::string>("stoppedFile").c_str()),
9  mProducer (parameters.getUntrackedParameter<std::string>("producer", "g4SimHits"))
10 {}
11 
12  void RHStopDump::analyze(const edm::Event& fEvent, const edm::EventSetup&) {
14  fEvent.getByLabel (mProducer, "StoppedParticlesName", names);
16  fEvent.getByLabel (mProducer, "StoppedParticlesX", xs);
18  fEvent.getByLabel (mProducer, "StoppedParticlesY", ys);
20  fEvent.getByLabel (mProducer, "StoppedParticlesZ", zs);
22  fEvent.getByLabel (mProducer, "StoppedParticlesTime", ts);
24  fEvent.getByLabel (mProducer, "StoppedParticlesPdgId", ids);
26  fEvent.getByLabel (mProducer, "StoppedParticlesMass", masses);
28  fEvent.getByLabel (mProducer, "StoppedParticlesCharge", charges);
29 
30  if (names->size() != xs->size() || xs->size() != ys->size() || ys->size() != zs->size()) {
31  edm::LogError ("RHStopDump") << "mismatch array sizes name/x/y/z:"
32  << names->size() << '/' << xs->size() << '/' << ys->size() << '/' << zs->size()
33  << std::endl;
34  }
35  else {
36  for (size_t i = 0; i < names->size(); ++i) {
37  mStream << (*names)[i] << ' ' << (*xs)[i] << ' ' << (*ys)[i] << ' ' << (*zs)[i] << ' ' << (*ts)[i] << std::endl;
38  mStream << (*ids)[i] << ' ' << (*masses)[i] << ' ' << (*charges)[i] << std::endl;
39  }
40  }
41  }
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
static const HistoName names[]
std::ofstream mStream
Definition: RHStopDump.h:18
RHStopDump(const edm::ParameterSet &)
Definition: RHStopDump.cc:7
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: RHStopDump.cc:12
std::string mProducer
Definition: RHStopDump.h:19