test
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::ProducerBase &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

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 18 of file RHStopTracer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, mStopRegular, mTraceEnergy, mTraceParticleNameRegex, HLT_25ns10e33_v2_cff::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.

18  {
19  edm::ParameterSet parameters = p.getParameter<edm::ParameterSet>("RHStopTracer");
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  produces< std::vector<int> >("StoppedParticlesPdgId");
29  produces< std::vector<float> >("StoppedParticlesMass");
30  produces< std::vector<float> >("StoppedParticlesCharge");
31 
32  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::RHStopTracer->"
33  << mTraceParticleNameRegex << '/' << mTraceEnergy;
34 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::regex mTraceParticleNameRegex
Definition: RHStopTracer.h:45
double mTraceEnergy
Definition: RHStopTracer.h:44
bool mStopRegular
Definition: RHStopTracer.h:43
RHStopTracer::~RHStopTracer ( )
virtual

Definition at line 36 of file RHStopTracer.cc.

36  {
37 }

Member Function Documentation

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

Definition at line 92 of file RHStopTracer.cc.

References mTraceParticleNameRegex.

Referenced by update().

92  {
93  return boost::regex_match (fName, mTraceParticleNameRegex);
94 }
boost::regex mTraceParticleNameRegex
Definition: RHStopTracer.h:45
void RHStopTracer::produce ( edm::Event fEvent,
const edm::EventSetup  
)
virtual

Implements SimProducer.

Definition at line 96 of file RHStopTracer.cc.

References LogDebug, mStopPoints, cscdqm::h::names, and edm::Event::put().

96  {
97  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::produce->";
98 
99  std::auto_ptr<std::vector<std::string> > names (new std::vector<std::string>);
100  std::auto_ptr<std::vector<float> > xs (new std::vector<float>);
101  std::auto_ptr<std::vector<float> > ys (new std::vector<float>);
102  std::auto_ptr<std::vector<float> > zs (new std::vector<float>);
103  std::auto_ptr<std::vector<float> > ts (new std::vector<float>);
104  std::auto_ptr<std::vector<int> > ids (new std::vector<int>);
105  std::auto_ptr<std::vector<float> > masses (new std::vector<float>);
106  std::auto_ptr<std::vector<float> > charges (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  ids->push_back (stopPoint->id);
116  masses->push_back (stopPoint->mass);
117  charges->push_back (stopPoint->charge);
118  }
119  fEvent.put (names, "StoppedParticlesName");
120  fEvent.put (xs, "StoppedParticlesX");
121  fEvent.put (ys, "StoppedParticlesY");
122  fEvent.put (zs, "StoppedParticlesZ");
123  fEvent.put (ts, "StoppedParticlesTime");
124  fEvent.put (ids, "StoppedParticlesPdgId");
125  fEvent.put (masses, "StoppedParticlesMass");
126  fEvent.put (charges, "StoppedParticlesCharge");
127  mStopPoints.clear ();
128  }
#define LogDebug(id)
static const HistoName names[]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:46
void RHStopTracer::update ( const BeginOfRun )
virtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 39 of file RHStopTracer.cc.

References LogDebug.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

39  {
40  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
41 }
#define LogDebug(id)
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 LogDebug.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
45 }
#define LogDebug(id)
void RHStopTracer::update ( const BeginOfTrack )
virtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 47 of file RHStopTracer.cc.

References GeV, LogDebug, matched(), mStopRegular, and mTraceEnergy.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

47  {
48  const G4Track* track = (*fTrack)();
49  if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) {
50  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> new track: ID/Name/pdgId/mass/charge/Parent: "
51  << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/'
52  << track->GetDefinition()->GetPDGEncoding() << '/'
53  << track->GetDefinition()->GetPDGMass()/GeV <<" GeV/" << track->GetDefinition()->GetPDGCharge() << '/'
54  << track->GetParentID()
55  << " position X/Y/Z: " << track->GetPosition().x() << '/'
56  << track->GetPosition().y() << '/' << track->GetPosition().z()
57  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
58  << " px/py/pz/p=" << track->GetMomentum().x() << '/'
59  << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag();
60  }
61  if (mStopRegular && !matched (track->GetDefinition()->GetParticleName())) { // kill regular particles
62  const_cast<G4Track*>(track)->SetTrackStatus(fStopAndKill);
63  }
64 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
bool matched(const std::string &fName) const
Definition: RHStopTracer.cc:92
double mTraceEnergy
Definition: RHStopTracer.h:44
bool mStopRegular
Definition: RHStopTracer.h:43
void RHStopTracer::update ( const EndOfTrack )
virtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 66 of file RHStopTracer.cc.

References GeV, LogDebug, matched(), mStopPoints, and mTraceEnergy.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

66  {
67  const G4Track* track = (*fTrack)();
68  if ((track->GetMomentum().mag()> mTraceEnergy) || matched (track->GetDefinition()->GetParticleName())) {
69  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::update-> stop track: ID/Name/pdgId/mass/charge/Parent: "
70  << track->GetTrackID() << '/' << track->GetDefinition()->GetParticleName() << '/'
71  << track->GetDefinition()->GetPDGEncoding() << '/'
72  << track->GetDefinition()->GetPDGMass()/GeV <<" GeV/" << track->GetDefinition()->GetPDGCharge() << '/'
73  << track->GetParentID()
74  << " position X/Y/Z: " << track->GetPosition().x() << '/'
75  << track->GetPosition().y() << '/' << track->GetPosition().z()
76  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
77  << " px/py/pz/p=" << track->GetMomentum().x() << '/'
78  << track->GetMomentum().y() << '/' << track->GetMomentum().z() << '/'<< track->GetMomentum().mag();
79  if (track->GetMomentum().mag () < 0.001) {
80  mStopPoints.push_back (StopPoint (track->GetDefinition()->GetParticleName(),
81  track->GetPosition().x(),
82  track->GetPosition().y(),
83  track->GetPosition().z(),
84  track->GetGlobalTime(),
85  track->GetDefinition()->GetPDGEncoding(),
86  track->GetDefinition()->GetPDGMass()/GeV,
87  track->GetDefinition()->GetPDGCharge() ));
88  }
89  }
90 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
bool matched(const std::string &fName) const
Definition: RHStopTracer.cc:92
double mTraceEnergy
Definition: RHStopTracer.h:44
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:46

Member Data Documentation

std::vector<StopPoint> RHStopTracer::mStopPoints
private

Definition at line 46 of file RHStopTracer.h.

Referenced by produce(), and update().

bool RHStopTracer::mStopRegular
private

Definition at line 43 of file RHStopTracer.h.

Referenced by RHStopTracer(), and update().

double RHStopTracer::mTraceEnergy
private

Definition at line 44 of file RHStopTracer.h.

Referenced by RHStopTracer(), and update().

boost::regex RHStopTracer::mTraceParticleNameRegex
private

Definition at line 45 of file RHStopTracer.h.

Referenced by matched(), and RHStopTracer().