#include <RHStopTracer.h>
Classes | |
struct | StopPoint |
Public Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
RHStopTracer (edm::ParameterSet const &p) | |
void | update (const EndOfTrack *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfTrack *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfEvent *) |
This routine will be called when the appropriate signal arrives. | |
void | update (const BeginOfRun *) |
This routine will be called when the appropriate signal arrives. | |
virtual | ~RHStopTracer () |
Private Member Functions | |
bool | matched (const std::string &fName) const |
Private Attributes | |
bool | mDebug |
std::vector< StopPoint > | mStopPoints |
bool | mStopRegular |
double | mTraceEnergy |
boost::regex | mTraceParticleNameRegex |
Definition at line 15 of file RHStopTracer.h.
RHStopTracer::RHStopTracer | ( | edm::ParameterSet const & | p | ) |
Definition at line 17 of file RHStopTracer.cc.
References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mDebug, mStopRegular, mTraceEnergy, mTraceParticleNameRegex, Parameters::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.
{ edm::ParameterSet parameters = p.getParameter<edm::ParameterSet>("RHStopTracer"); mDebug = parameters.getUntrackedParameter<bool>("verbose", false); mStopRegular = parameters.getUntrackedParameter<bool>("stopRegularParticles", false); mTraceEnergy = 1000 * parameters.getUntrackedParameter<double>("traceEnergy", 1.e20); // GeV->KeV mTraceParticleNameRegex = parameters.getParameter<std::string>("traceParticle"); produces< std::vector<std::string> >("StoppedParticlesName"); produces< std::vector<float> >("StoppedParticlesX"); produces< std::vector<float> >("StoppedParticlesY"); produces< std::vector<float> >("StoppedParticlesZ"); produces< std::vector<float> >("StoppedParticlesTime"); if (mDebug) { std::cout << "RHStopTracer::RHStopTracer->" << mTraceParticleNameRegex << '/' << mTraceEnergy << std::endl; } }
RHStopTracer::~RHStopTracer | ( | ) | [virtual] |
Definition at line 35 of file RHStopTracer.cc.
{ }
bool RHStopTracer::matched | ( | const std::string & | fName | ) | const [private] |
Definition at line 94 of file RHStopTracer.cc.
References mTraceParticleNameRegex.
Referenced by update().
{ return boost::regex_match (fName, mTraceParticleNameRegex); }
void RHStopTracer::produce | ( | edm::Event & | fEvent, |
const edm::EventSetup & | |||
) | [virtual] |
Implements SimProducer.
Definition at line 98 of file RHStopTracer.cc.
References gather_cfg::cout, mDebug, mStopPoints, cscdqm::h::names, and edm::Event::put().
{ if (mDebug) { std::cout << "RHStopTracer::produce->" << std::endl; } std::auto_ptr<std::vector<std::string> > names (new std::vector<std::string>); std::auto_ptr<std::vector<float> > xs (new std::vector<float>); std::auto_ptr<std::vector<float> > ys (new std::vector<float>); std::auto_ptr<std::vector<float> > zs (new std::vector<float>); std::auto_ptr<std::vector<float> > ts (new std::vector<float>); std::vector <StopPoint>::const_iterator stopPoint = mStopPoints.begin (); for (; stopPoint != mStopPoints.end(); ++stopPoint) { names->push_back (stopPoint->name); xs->push_back (stopPoint->x); ys->push_back (stopPoint->y); zs->push_back (stopPoint->z); ts->push_back (stopPoint->t); } fEvent.put (names, "StoppedParticlesName"); fEvent.put (xs, "StoppedParticlesX"); fEvent.put (ys, "StoppedParticlesY"); fEvent.put (zs, "StoppedParticlesZ"); fEvent.put (ts, "StoppedParticlesTime"); mStopPoints.clear (); }
void RHStopTracer::update | ( | const BeginOfEvent * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfEvent * >.
Definition at line 43 of file RHStopTracer.cc.
References gather_cfg::cout, and mDebug.
void RHStopTracer::update | ( | const EndOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const EndOfTrack * >.
Definition at line 69 of file RHStopTracer.cc.
References gather_cfg::cout, matched(), mDebug, mStopPoints, and mTraceEnergy.
{ const G4Track* track = (*fTrack)(); if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) { if (mDebug) std::cout << "RHStopTracer::update-> stop track: ID/Name/mass/Parent: " << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/' << track->GetDefinition()->GetPDGMass() << '/' << track->GetParentID() << std::endl << " position X/Y/Z: " << track->GetPosition().x() << '/' << track->GetPosition().y() << '/' << track->GetPosition().z() << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi() << std::endl << " px/py/pz/p=" << track->GetMomentum().x() << '/' << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag() << std::endl; if (track->GetMomentum().mag () < 0.001) { mStopPoints.push_back (StopPoint (track->GetDefinition()->GetParticleName(), track->GetPosition().x(), track->GetPosition().y(), track->GetPosition().z(), track->GetGlobalTime())); } } }
void RHStopTracer::update | ( | const BeginOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfTrack * >.
Definition at line 48 of file RHStopTracer.cc.
References gather_cfg::cout, matched(), mDebug, mStopRegular, and mTraceEnergy.
{ const G4Track* track = (*fTrack)(); if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) { if (mDebug) std::cout << "RHStopTracer::update-> new track: ID/Name/mass/Parent: " << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/' << track->GetDefinition()->GetPDGMass() << '/' << track->GetParentID() << std::endl << " position X/Y/Z: " << track->GetPosition().x() << '/' << track->GetPosition().y() << '/' << track->GetPosition().z() << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi() << std::endl << " px/py/pz/p=" << track->GetMomentum().x() << '/' << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag() << std::endl; } if (mStopRegular && !matched (track->GetDefinition()->GetParticleName())) { // kill regular particles const_cast<G4Track*>(track)->SetTrackStatus(fStopAndKill); } }
void RHStopTracer::update | ( | const BeginOfRun * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfRun * >.
Definition at line 38 of file RHStopTracer.cc.
References gather_cfg::cout, and mDebug.
bool RHStopTracer::mDebug [private] |
Definition at line 40 of file RHStopTracer.h.
Referenced by produce(), RHStopTracer(), and update().
std::vector<StopPoint> RHStopTracer::mStopPoints [private] |
Definition at line 44 of file RHStopTracer.h.
bool RHStopTracer::mStopRegular [private] |
Definition at line 41 of file RHStopTracer.h.
Referenced by RHStopTracer(), and update().
double RHStopTracer::mTraceEnergy [private] |
Definition at line 42 of file RHStopTracer.h.
Referenced by RHStopTracer(), and update().
boost::regex RHStopTracer::mTraceParticleNameRegex [private] |
Definition at line 43 of file RHStopTracer.h.
Referenced by matched(), and RHStopTracer().