CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
RHStopTracer Class Reference

#include <RHStopTracer.h>

Inheritance diagram for RHStopTracer:
SimProducer Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > SimWatcher

Classes

struct  StopPoint
 

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &)
 
 RHStopTracer (edm::ParameterSet const &p)
 
void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual ~RHStopTracer ()
 
- Public Member Functions inherited from SimProducer
void registerProducts (edm::EDProducer &iProd)
 
 SimProducer ()
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack *iT)
 
virtual ~Observer ()
 

Private Member Functions

bool matched (const std::string &fName) const
 

Private Attributes

bool mDebug
 
std::vector< StopPointmStopPoints
 
bool mStopRegular
 
double mTraceEnergy
 
boost::regex mTraceParticleNameRegex
 

Additional Inherited Members

- Protected Member Functions inherited from SimProducer
template<class T >
void produces ()
 
template<class T >
void produces (const std::string &instanceName)
 

Detailed Description

Definition at line 15 of file RHStopTracer.h.

Constructor & Destructor Documentation

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, and Parameters::parameters.

17  {
18  edm::ParameterSet parameters = p.getParameter<edm::ParameterSet>("RHStopTracer");
19  mDebug = parameters.getUntrackedParameter<bool>("verbose", false);
20  mStopRegular = parameters.getUntrackedParameter<bool>("stopRegularParticles", false);
21  mTraceEnergy = 1000 * parameters.getUntrackedParameter<double>("traceEnergy", 1.e20); // GeV->KeV
22  mTraceParticleNameRegex = parameters.getParameter<std::string>("traceParticle");
23  produces< std::vector<std::string> >("StoppedParticlesName");
24  produces< std::vector<float> >("StoppedParticlesX");
25  produces< std::vector<float> >("StoppedParticlesY");
26  produces< std::vector<float> >("StoppedParticlesZ");
27  produces< std::vector<float> >("StoppedParticlesTime");
28 
29  if (mDebug) {
30  std::cout << "RHStopTracer::RHStopTracer->"
31  << mTraceParticleNameRegex << '/' << mTraceEnergy << std::endl;
32  }
33 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
dictionary parameters
Definition: Parameters.py:2
boost::regex mTraceParticleNameRegex
Definition: RHStopTracer.h:43
double mTraceEnergy
Definition: RHStopTracer.h:42
bool mStopRegular
Definition: RHStopTracer.h:41
tuple cout
Definition: gather_cfg.py:121
RHStopTracer::~RHStopTracer ( )
virtual

Definition at line 35 of file RHStopTracer.cc.

35  {
36 }

Member Function Documentation

bool RHStopTracer::matched ( const std::string &  fName) const
private

Definition at line 94 of file RHStopTracer.cc.

References mTraceParticleNameRegex.

Referenced by update().

94  {
95  return boost::regex_match (fName, mTraceParticleNameRegex);
96 }
boost::regex mTraceParticleNameRegex
Definition: RHStopTracer.h:43
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().

98  {
99  if (mDebug) {
100  std::cout << "RHStopTracer::produce->" << std::endl;
101  }
102  std::auto_ptr<std::vector<std::string> > names (new std::vector<std::string>);
103  std::auto_ptr<std::vector<float> > xs (new std::vector<float>);
104  std::auto_ptr<std::vector<float> > ys (new std::vector<float>);
105  std::auto_ptr<std::vector<float> > zs (new std::vector<float>);
106  std::auto_ptr<std::vector<float> > ts (new std::vector<float>);
107 
108  std::vector <StopPoint>::const_iterator stopPoint = mStopPoints.begin ();
109  for (; stopPoint != mStopPoints.end(); ++stopPoint) {
110  names->push_back (stopPoint->name);
111  xs->push_back (stopPoint->x);
112  ys->push_back (stopPoint->y);
113  zs->push_back (stopPoint->z);
114  ts->push_back (stopPoint->t);
115  }
116  fEvent.put (names, "StoppedParticlesName");
117  fEvent.put (xs, "StoppedParticlesX");
118  fEvent.put (ys, "StoppedParticlesY");
119  fEvent.put (zs, "StoppedParticlesZ");
120  fEvent.put (ts, "StoppedParticlesTime");
121  mStopPoints.clear ();
122  }
static const HistoName names[]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple cout
Definition: gather_cfg.py:121
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:44
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.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

38  {
39  if (mDebug)
40  std::cout << "RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID () << std::endl;
41 }
tuple cout
Definition: gather_cfg.py:121
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.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

43  {
44  if (mDebug)
45  std::cout << "RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID () << std::endl;
46 }
tuple cout
Definition: gather_cfg.py:121
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.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

48  {
49  const G4Track* track = (*fTrack)();
50  if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) {
51  if (mDebug)
52  std::cout << "RHStopTracer::update-> new track: ID/Name/mass/Parent: "
53  << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/'
54  << track->GetDefinition()->GetPDGMass() << '/' << track->GetParentID()
55  << std::endl
56  << " position X/Y/Z: " << track->GetPosition().x() << '/'
57  << track->GetPosition().y() << '/' << track->GetPosition().z()
58  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
59  << std::endl
60  << " px/py/pz/p=" << track->GetMomentum().x() << '/'
61  << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag()
62  << std::endl;
63  }
64  if (mStopRegular && !matched (track->GetDefinition()->GetParticleName())) { // kill regular particles
65  const_cast<G4Track*>(track)->SetTrackStatus(fStopAndKill);
66  }
67 }
bool matched(const std::string &fName) const
Definition: RHStopTracer.cc:94
double mTraceEnergy
Definition: RHStopTracer.h:42
bool mStopRegular
Definition: RHStopTracer.h:41
tuple cout
Definition: gather_cfg.py:121
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.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

69  {
70  const G4Track* track = (*fTrack)();
71  if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) {
72  if (mDebug)
73  std::cout << "RHStopTracer::update-> stop track: ID/Name/mass/Parent: "
74  << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/'
75  << track->GetDefinition()->GetPDGMass() << '/' << track->GetParentID()
76  << std::endl
77  << " position X/Y/Z: " << track->GetPosition().x() << '/'
78  << track->GetPosition().y() << '/' << track->GetPosition().z()
79  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
80  << std::endl
81  << " px/py/pz/p=" << track->GetMomentum().x() << '/'
82  << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag()
83  << std::endl;
84  if (track->GetMomentum().mag () < 0.001) {
85  mStopPoints.push_back (StopPoint (track->GetDefinition()->GetParticleName(),
86  track->GetPosition().x(),
87  track->GetPosition().y(),
88  track->GetPosition().z(),
89  track->GetGlobalTime()));
90  }
91  }
92 }
bool matched(const std::string &fName) const
Definition: RHStopTracer.cc:94
double mTraceEnergy
Definition: RHStopTracer.h:42
tuple cout
Definition: gather_cfg.py:121
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:44

Member Data Documentation

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.

Referenced by produce(), and update().

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().