16 #include "G4SystemOfUnits.hh"
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");
32 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::RHStopTracer->"
40 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
44 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
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();
62 const_cast<G4Track*
>(track)->SetTrackStatus(fStopAndKill);
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) {
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() ));
97 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::produce->";
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>);
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);
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");
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static const HistoName names[]
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
bool matched(const std::string &fName) const
boost::regex mTraceParticleNameRegex
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
RHStopTracer(edm::ParameterSet const &p)
void produce(edm::Event &, const edm::EventSetup &)
std::vector< StopPoint > mStopPoints