16 #include "G4SystemOfUnits.hh" 17 #include "G4ParticleTable.hh" 18 #include "G4ParticleDefinition.hh" 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");
34 mParticle = G4ParticleTable::GetParticleTable()->FindParticle(mTraceParticleName);
37 <<
"RHStopTracer::RHStopTracer " << mTraceParticleName
47 <<
"RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
52 <<
"RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
56 const G4Track*
track = (*fTrack)();
57 const G4ParticleDefinition*
part = track->GetDefinition();
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();
69 const_cast<G4Track*
>(
track)->SetTrackStatus(fStopAndKill);
74 const G4Track*
track = (*fTrack)();
75 const G4ParticleDefinition*
part = track->GetDefinition();
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) {
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() ));
100 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::produce->";
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>);
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);
129 fEvent.
put(
std::move(charges),
"StoppedParticlesCharge");
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static const HistoName names[]
void update(const BeginOfRun *)
This routine will be called when the appropriate signal arrives.
const G4ParticleDefinition * mParticle
std::string mTraceParticleName
RHStopTracer(edm::ParameterSet const &p)
void produce(edm::Event &, const edm::EventSetup &)
std::vector< StopPoint > mStopPoints