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");
30 std::cout <<
"RHStopTracer::RHStopTracer->"
31 << mTraceParticleNameRegex <<
'/' << mTraceEnergy << std::endl;
40 std::cout <<
"RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID () << std::endl;
45 std::cout <<
"RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID () << std::endl;
49 const G4Track* track = (*fTrack)();
50 if ((track->GetMomentum().mag()>
mTraceEnergy) ||
matched (track->GetDefinition()->GetParticleName())) {
52 std::cout <<
"RHStopTracer::update-> new track: ID/Name/mass/Parent: "
53 << track->GetTrackID() <<
'/' << track->GetDefinition()->GetParticleName() <<
'/'
54 << track->GetDefinition()->GetPDGMass() <<
'/' << track->GetParentID()
56 <<
" position X/Y/Z: " << track->GetPosition().x() <<
'/'
57 << track->GetPosition().y() <<
'/' << track->GetPosition().z()
58 <<
" R/phi: " << track->GetPosition().perp() <<
'/' << track->GetPosition().phi()
60 <<
" px/py/pz/p=" << track->GetMomentum().x() <<
'/'
61 << track->GetMomentum().y() <<
'/' << track->GetMomentum().z() <<
'/'<< track->GetMomentum().mag()
65 const_cast<G4Track*
>(track)->SetTrackStatus(fStopAndKill);
70 const G4Track* track = (*fTrack)();
71 if ((track->GetMomentum().mag()>
mTraceEnergy) ||
matched (track->GetDefinition()->GetParticleName())) {
73 std::cout <<
"RHStopTracer::update-> stop track: ID/Name/mass/Parent: "
74 << track->GetTrackID() <<
'/' << track->GetDefinition()->GetParticleName() <<
'/'
75 << track->GetDefinition()->GetPDGMass() <<
'/' << track->GetParentID()
77 <<
" position X/Y/Z: " << track->GetPosition().x() <<
'/'
78 << track->GetPosition().y() <<
'/' << track->GetPosition().z()
79 <<
" R/phi: " << track->GetPosition().perp() <<
'/' << track->GetPosition().phi()
81 <<
" px/py/pz/p=" << track->GetMomentum().x() <<
'/'
82 << track->GetMomentum().y() <<
'/' << track->GetMomentum().z() <<
'/'<< track->GetMomentum().mag()
84 if (track->GetMomentum().mag () < 0.001) {
86 track->GetPosition().x(),
87 track->GetPosition().y(),
88 track->GetPosition().z(),
89 track->GetGlobalTime()));
100 std::cout <<
"RHStopTracer::produce->" << std::endl;
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>);
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);
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");
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