CMS 3D CMS Logo

List of all members | Classes | Public 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 Attributes

const G4ParticleDefinition * mParticle
 
std::vector< StopPointmStopPoints
 
bool mStopRegular
 
double mTraceEnergy
 
std::string mTraceParticleName
 

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 16 of file RHStopTracer.h.

Constructor & Destructor Documentation

RHStopTracer::RHStopTracer ( edm::ParameterSet const &  p)

Definition at line 20 of file RHStopTracer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), GeV, mParticle, mStopRegular, mTraceEnergy, mTraceParticleName, metProducer_cfi::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.

20  {
21  edm::ParameterSet parameters = p.getParameter<edm::ParameterSet>("RHStopTracer");
22  mStopRegular = parameters.getUntrackedParameter<bool>("stopRegularParticles", false);
23  mTraceEnergy = parameters.getUntrackedParameter<double>("traceEnergy", 1.e20);
24  mTraceParticleName = parameters.getParameter<std::string>("traceParticle");
25  produces< std::vector<std::string> >("StoppedParticlesName");
26  produces< std::vector<float> >("StoppedParticlesX");
27  produces< std::vector<float> >("StoppedParticlesY");
28  produces< std::vector<float> >("StoppedParticlesZ");
29  produces< std::vector<float> >("StoppedParticlesTime");
30  produces< std::vector<int> >("StoppedParticlesPdgId");
31  produces< std::vector<float> >("StoppedParticlesMass");
32  produces< std::vector<float> >("StoppedParticlesCharge");
33 
34  mParticle = G4ParticleTable::GetParticleTable()->FindParticle(mTraceParticleName);
35 
36  edm::LogInfo("SimG4CoreCustomPhysics")
37  << "RHStopTracer::RHStopTracer " << mTraceParticleName
38  << " Eth(GeV)= " << mTraceEnergy;
39  mTraceEnergy *= CLHEP::GeV;
40 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const double GeV
Definition: MathUtil.h:16
const G4ParticleDefinition * mParticle
Definition: RHStopTracer.h:47
double mTraceEnergy
Definition: RHStopTracer.h:45
std::string mTraceParticleName
Definition: RHStopTracer.h:46
bool mStopRegular
Definition: RHStopTracer.h:44
RHStopTracer::~RHStopTracer ( )
virtual

Definition at line 42 of file RHStopTracer.cc.

42  {
43 }

Member Function Documentation

void RHStopTracer::produce ( edm::Event fEvent,
const edm::EventSetup  
)
virtual

Implements SimProducer.

Definition at line 99 of file RHStopTracer.cc.

References LogDebug, particleFlowDisplacedVertex_cfi::masses, eostools::move(), mStopPoints, cscdqm::h::names, and edm::Event::put().

99  {
100  LogDebug("SimG4CoreCustomPhysics") << "RHStopTracer::produce->";
101 
102  std::unique_ptr<std::vector<std::string> > names(new std::vector<std::string>);
103  std::unique_ptr<std::vector<float> > xs(new std::vector<float>);
104  std::unique_ptr<std::vector<float> > ys(new std::vector<float>);
105  std::unique_ptr<std::vector<float> > zs(new std::vector<float>);
106  std::unique_ptr<std::vector<float> > ts(new std::vector<float>);
107  std::unique_ptr<std::vector<int> > ids(new std::vector<int>);
108  std::unique_ptr<std::vector<float> > masses(new std::vector<float>);
109  std::unique_ptr<std::vector<float> > charges(new std::vector<float>);
110 
111  std::vector <StopPoint>::const_iterator stopPoint = mStopPoints.begin ();
112  for (; stopPoint != mStopPoints.end(); ++stopPoint) {
113  names->push_back (stopPoint->name);
114  xs->push_back (stopPoint->x);
115  ys->push_back (stopPoint->y);
116  zs->push_back (stopPoint->z);
117  ts->push_back (stopPoint->t);
118  ids->push_back (stopPoint->id);
119  masses->push_back (stopPoint->mass);
120  charges->push_back (stopPoint->charge);
121  }
122  fEvent.put(std::move(names), "StoppedParticlesName");
123  fEvent.put(std::move(xs), "StoppedParticlesX");
124  fEvent.put(std::move(ys), "StoppedParticlesY");
125  fEvent.put(std::move(zs), "StoppedParticlesZ");
126  fEvent.put(std::move(ts), "StoppedParticlesTime");
127  fEvent.put(std::move(ids), "StoppedParticlesPdgId");
128  fEvent.put(std::move(masses), "StoppedParticlesMass");
129  fEvent.put(std::move(charges), "StoppedParticlesCharge");
130  mStopPoints.clear ();
131 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static const HistoName names[]
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:48
def move(src, dest)
Definition: eostools.py:510
void RHStopTracer::update ( const BeginOfRun )
virtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 45 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().

45  {
46  LogDebug("SimG4CoreCustomPhysics")
47  << "RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
48 }
#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 50 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().

50  {
51  LogDebug("SimG4CoreCustomPhysics")
52  << "RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
53 }
#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 55 of file RHStopTracer.cc.

References GeV, LogDebug, mParticle, mStopRegular, mTraceEnergy, and HiIsolationCommonParameters_cff::track.

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

55  {
56  const G4Track* track = (*fTrack)();
57  const G4ParticleDefinition* part = track->GetDefinition();
58  if(part && part == mParticle && track->GetKineticEnergy() > mTraceEnergy) {
59  LogDebug("SimG4CoreCustomPhysics")
60  << "RHStopTracer::update-> new track: ID/Name/pdgId/mass/charge/Parent: "
61  << track->GetTrackID() << '/' << part->GetParticleName() << '/'
62  << part->GetPDGEncoding() << '/'
63  << part->GetPDGMass()/GeV <<" GeV/" << part->GetPDGCharge() << '/'
64  << track->GetParentID()
65  << " Position: " << track->GetPosition() << ' '
66  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
67  << " 4vec " << track->GetMomentum();
68  } else if (mStopRegular) { // kill regular particles
69  const_cast<G4Track*>(track)->SetTrackStatus(fStopAndKill);
70  }
71 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
const G4ParticleDefinition * mParticle
Definition: RHStopTracer.h:47
double mTraceEnergy
Definition: RHStopTracer.h:45
bool mStopRegular
Definition: RHStopTracer.h:44
part
Definition: HCALResponse.h:20
void RHStopTracer::update ( const EndOfTrack )
virtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 73 of file RHStopTracer.cc.

References GeV, LogDebug, mParticle, mStopPoints, mTraceEnergy, and HiIsolationCommonParameters_cff::track.

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

73  {
74  const G4Track* track = (*fTrack)();
75  const G4ParticleDefinition* part = track->GetDefinition();
76  if(part && part == mParticle && track->GetKineticEnergy() > mTraceEnergy) {
77  LogDebug("SimG4CoreCustomPhysics") <<
78  "RHStopTracer::update-> stop track: ID/Name/pdgId/mass/charge/Parent: "
79  << track->GetTrackID() << '/' << part->GetParticleName() << '/'
80  << part->GetPDGEncoding() << '/'
81  << part->GetPDGMass()/GeV <<" GeV/" << part->GetPDGCharge() << '/'
82  << track->GetParentID()
83  << " Position: " << track->GetPosition() << ' '
84  << " R/phi: " << track->GetPosition().perp() << '/' << track->GetPosition().phi()
85  << " 4vec " << track->GetMomentum();
86  if (track->GetMomentum().mag () < 0.001) {
87  mStopPoints.push_back (StopPoint (track->GetDefinition()->GetParticleName(),
88  track->GetPosition().x(),
89  track->GetPosition().y(),
90  track->GetPosition().z(),
91  track->GetGlobalTime(),
92  track->GetDefinition()->GetPDGEncoding(),
93  track->GetDefinition()->GetPDGMass()/GeV,
94  track->GetDefinition()->GetPDGCharge() ));
95  }
96  }
97 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
const G4ParticleDefinition * mParticle
Definition: RHStopTracer.h:47
double mTraceEnergy
Definition: RHStopTracer.h:45
part
Definition: HCALResponse.h:20
std::vector< StopPoint > mStopPoints
Definition: RHStopTracer.h:48

Member Data Documentation

const G4ParticleDefinition* RHStopTracer::mParticle
private

Definition at line 47 of file RHStopTracer.h.

Referenced by RHStopTracer(), and update().

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

Definition at line 48 of file RHStopTracer.h.

Referenced by produce(), and update().

bool RHStopTracer::mStopRegular
private

Definition at line 44 of file RHStopTracer.h.

Referenced by RHStopTracer(), and update().

double RHStopTracer::mTraceEnergy
private

Definition at line 45 of file RHStopTracer.h.

Referenced by RHStopTracer(), and update().

std::string RHStopTracer::mTraceParticleName
private

Definition at line 46 of file RHStopTracer.h.

Referenced by RHStopTracer().