diff --git a/SimG4Core/CustomPhysics/plugins/RHStopDump.cc b/SimG4Core/CustomPhysics/plugins/RHStopDump.cc index 42f5c12be6f3b..e5ee60bbf09af 100644 --- a/SimG4Core/CustomPhysics/plugins/RHStopDump.cc +++ b/SimG4Core/CustomPhysics/plugins/RHStopDump.cc @@ -18,6 +18,15 @@ RHStopDump::RHStopDump(edm::ParameterSet const & parameters) fEvent.getByLabel (mProducer, "StoppedParticlesY", ys); edm::Handle > zs; fEvent.getByLabel (mProducer, "StoppedParticlesZ", zs); + edm::Handle > ts; + fEvent.getByLabel (mProducer, "StoppedParticlesTime", ts); + edm::Handle > ids; + fEvent.getByLabel (mProducer, "StoppedParticlesPdgId", ids); + edm::Handle > masses; + fEvent.getByLabel (mProducer, "StoppedParticlesMass", masses); + edm::Handle > charges; + fEvent.getByLabel (mProducer, "StoppedParticlesCharge", charges); + if (names->size() != xs->size() || xs->size() != ys->size() || ys->size() != zs->size()) { edm::LogError ("RHStopDump") << "mismatch array sizes name/x/y/z:" << names->size() << '/' << xs->size() << '/' << ys->size() << '/' << zs->size() @@ -25,7 +34,8 @@ RHStopDump::RHStopDump(edm::ParameterSet const & parameters) } else { for (size_t i = 0; i < names->size(); ++i) { - mStream << (*names)[i] << ' ' << (*xs)[i] << ' ' << (*ys)[i] << ' ' << (*zs)[i] << std::endl; + mStream << (*names)[i] << ' ' << (*xs)[i] << ' ' << (*ys)[i] << ' ' << (*zs)[i] << ' ' << (*ts)[i] << std::endl; + mStream << (*ids)[i] << ' ' << (*masses)[i] << ' ' << (*charges)[i] << std::endl; } } } diff --git a/SimG4Core/CustomPhysics/plugins/RHStopTracer.cc b/SimG4Core/CustomPhysics/plugins/RHStopTracer.cc index a04687e5a6f26..1d8ae0878a07c 100644 --- a/SimG4Core/CustomPhysics/plugins/RHStopTracer.cc +++ b/SimG4Core/CustomPhysics/plugins/RHStopTracer.cc @@ -25,7 +25,10 @@ RHStopTracer::RHStopTracer(edm::ParameterSet const & p) { produces< std::vector >("StoppedParticlesY"); produces< std::vector >("StoppedParticlesZ"); produces< std::vector >("StoppedParticlesTime"); - + produces< std::vector >("StoppedParticlesPdgId"); + produces< std::vector >("StoppedParticlesMass"); + produces< std::vector >("StoppedParticlesCharge"); + LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::RHStopTracer->" << mTraceParticleNameRegex << '/' << mTraceEnergy; } @@ -34,7 +37,7 @@ RHStopTracer::~RHStopTracer() { } void RHStopTracer::update (const BeginOfRun * fRun) { - LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID(); + LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID(); } void RHStopTracer::update (const BeginOfEvent * fEvent) { @@ -53,7 +56,7 @@ void RHStopTracer::update (const BeginOfTrack * fTrack) { << track->GetPosition().y() << '/' << track->GetPosition().z() << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi() << " px/py/pz/p=" << track->GetMomentum().x() << '/' - << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag(); + << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag(); } if (mStopRegular && !matched (track->GetDefinition()->GetParticleName())) { // kill regular particles const_cast(track)->SetTrackStatus(fStopAndKill); @@ -72,13 +75,16 @@ void RHStopTracer::update (const EndOfTrack * fTrack) { << track->GetPosition().y() << '/' << track->GetPosition().z() << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi() << " px/py/pz/p=" << track->GetMomentum().x() << '/' - << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag(); + << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag(); if (track->GetMomentum().mag () < 0.001) { mStopPoints.push_back (StopPoint (track->GetDefinition()->GetParticleName(), track->GetPosition().x(), track->GetPosition().y(), track->GetPosition().z(), - track->GetGlobalTime())); + track->GetGlobalTime(), + track->GetDefinition()->GetPDGEncoding(), + track->GetDefinition()->GetPDGMass()/GeV, + track->GetDefinition()->GetPDGCharge() )); } } } @@ -95,6 +101,9 @@ bool RHStopTracer::matched (const std::string& fName) const { std::auto_ptr > ys (new std::vector); std::auto_ptr > zs (new std::vector); std::auto_ptr > ts (new std::vector); + std::auto_ptr > ids (new std::vector); + std::auto_ptr > masses (new std::vector); + std::auto_ptr > charges (new std::vector); std::vector ::const_iterator stopPoint = mStopPoints.begin (); for (; stopPoint != mStopPoints.end(); ++stopPoint) { @@ -103,11 +112,17 @@ bool RHStopTracer::matched (const std::string& fName) const { ys->push_back (stopPoint->y); zs->push_back (stopPoint->z); ts->push_back (stopPoint->t); + ids->push_back (stopPoint->id); + masses->push_back (stopPoint->mass); + charges->push_back (stopPoint->charge); } fEvent.put (names, "StoppedParticlesName"); fEvent.put (xs, "StoppedParticlesX"); fEvent.put (ys, "StoppedParticlesY"); fEvent.put (zs, "StoppedParticlesZ"); fEvent.put (ts, "StoppedParticlesTime"); + fEvent.put (ids, "StoppedParticlesPdgId"); + fEvent.put (masses, "StoppedParticlesMass"); + fEvent.put (charges, "StoppedParticlesCharge"); mStopPoints.clear (); } diff --git a/SimG4Core/CustomPhysics/plugins/RHStopTracer.h b/SimG4Core/CustomPhysics/plugins/RHStopTracer.h index a154081dac5b0..e14e022c76d28 100644 --- a/SimG4Core/CustomPhysics/plugins/RHStopTracer.h +++ b/SimG4Core/CustomPhysics/plugins/RHStopTracer.h @@ -28,16 +28,18 @@ class RHStopTracer : public SimProducer, void produce(edm::Event&, const edm::EventSetup&); private: struct StopPoint { - StopPoint (const std::string& fName, double fX, double fY, double fZ, double fT) - : name(fName), x(fX), y(fY), z(fZ), t(fT) + StopPoint (const std::string& fName, double fX, double fY, double fZ, double fT, int fId, double fMass, double fCharge) + : name(fName), x(fX), y(fY), z(fZ), t(fT), id(fId), mass(fMass), charge(fCharge) {} std::string name; double x; double y; double z; double t; + int id; + double mass; + double charge; }; - bool mDebug; bool mStopRegular; double mTraceEnergy; boost::regex mTraceParticleNameRegex;