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 {}
11 
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  }
std::ofstream mStream
Definition: RHStopDump.h:18
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: RHStopDump.cc:12
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:535
std::string mProducer
Definition: RHStopDump.h:19