CMS 3D CMS Logo

RHStopDump.cc
Go to the documentation of this file.
2 
6 
8  : mStream(parameters.getParameter<std::string>("stoppedFile").c_str()),
9  mProducer(parameters.getUntrackedParameter<std::string>("producer", "g4SimHits")) {}
10 
13  fEvent.getByLabel(mProducer, "StoppedParticlesName", names);
15  fEvent.getByLabel(mProducer, "StoppedParticlesX", xs);
17  fEvent.getByLabel(mProducer, "StoppedParticlesY", ys);
19  fEvent.getByLabel(mProducer, "StoppedParticlesZ", zs);
21  fEvent.getByLabel(mProducer, "StoppedParticlesTime", ts);
23  fEvent.getByLabel(mProducer, "StoppedParticlesPdgId", ids);
25  fEvent.getByLabel(mProducer, "StoppedParticlesMass", masses);
27  fEvent.getByLabel(mProducer, "StoppedParticlesCharge", charges);
28 
29  if (names->size() != xs->size() || xs->size() != ys->size() || ys->size() != zs->size()) {
30  edm::LogError("RHStopDump") << "mismatch array sizes name/x/y/z:" << names->size() << '/' << xs->size() << '/'
31  << ys->size() << '/' << zs->size() << std::endl;
32  } else {
33  for (size_t i = 0; i < names->size(); ++i) {
34  mStream << (*names)[i] << ' ' << (*xs)[i] << ' ' << (*ys)[i] << ' ' << (*zs)[i] << ' ' << (*ts)[i] << std::endl;
35  mStream << (*ids)[i] << ' ' << (*masses)[i] << ' ' << (*charges)[i] << std::endl;
36  }
37  }
38 }
std::ofstream mStream
Definition: RHStopDump.h:19
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RHStopDump.cc:11
const std::string names[nVars_]
RHStopDump(const edm::ParameterSet &)
Definition: RHStopDump.cc:7
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
std::string mProducer
Definition: RHStopDump.h:20