16 #include "G4SystemOfUnits.hh" 17 #include "G4ParticleTable.hh" 18 #include "G4ParticleDefinition.hh" 28 produces< std::vector<std::string> >(
"StoppedParticlesName");
29 produces< std::vector<float> >(
"StoppedParticlesX");
30 produces< std::vector<float> >(
"StoppedParticlesY");
31 produces< std::vector<float> >(
"StoppedParticlesZ");
32 produces< std::vector<float> >(
"StoppedParticlesTime");
33 produces< std::vector<int> >(
"StoppedParticlesPdgId");
34 produces< std::vector<float> >(
"StoppedParticlesMass");
35 produces< std::vector<float> >(
"StoppedParticlesCharge");
41 <<
"RHStopTracer::RHStopTracer " << mTraceParticleName
51 <<
"RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
56 <<
"RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
60 const G4Track*
track = (*fTrack)();
61 const G4ParticleDefinition*
part = track->GetDefinition();
62 const std::string& stringPartName = part->GetParticleName();
66 matched = std::regex_match(stringPartName,
rePartName);
67 if( matched || track->GetKineticEnergy() >
mTraceEnergy) {
69 <<
"RHStopTracer::update-> new track: ID/Name/pdgId/mass/charge/Parent: " 70 << track->GetTrackID() <<
'/' << part->GetParticleName() <<
'/' 71 << part->GetPDGEncoding() <<
'/' 72 << part->GetPDGMass()/
GeV <<
" GeV/" << part->GetPDGCharge() <<
'/' 73 << track->GetParentID()
74 <<
" Position: " << track->GetPosition() <<
' ' 75 <<
" R/phi: " << track->GetPosition().perp() <<
'/' << track->GetPosition().phi()
76 <<
" 4vec " << track->GetMomentum();
78 const_cast<G4Track*
>(
track)->SetTrackStatus(fStopAndKill);
83 const G4Track*
track = (*fTrack)();
84 const G4ParticleDefinition*
part = track->GetDefinition();
85 const std::string& stringPartName = part->GetParticleName();
89 matched = std::regex_match(stringPartName,
rePartName);
90 if( matched || track->GetKineticEnergy() >
mTraceEnergy) {
92 <<
"RHStopTracer::update-> stop track: ID/Name/pdgId/mass/charge/Parent: " 93 << track->GetTrackID() <<
'/' << part->GetParticleName() <<
'/' 94 << part->GetPDGEncoding() <<
'/' 95 << part->GetPDGMass()/
GeV <<
" GeV/" << part->GetPDGCharge() <<
'/' 96 << track->GetParentID()
97 <<
" Position: " << track->GetPosition() <<
' ' 98 <<
" R/phi: " << track->GetPosition().perp() <<
'/' << track->GetPosition().phi()
99 <<
" 4vec " << track->GetMomentum();
100 if (track->GetMomentum().mag () < 0.001) {
101 LogDebug(
"SimG4CoreCustomPhysics") <<
102 "RHStopTracer:: track has stopped, so making StopPoint";
104 track->GetPosition().x(),
105 track->GetPosition().y(),
106 track->GetPosition().z(),
107 track->GetGlobalTime(),
108 track->GetDefinition()->GetPDGEncoding(),
109 track->GetDefinition()->GetPDGMass()/
GeV,
110 track->GetDefinition()->GetPDGCharge() ));
116 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::produce->";
118 std::unique_ptr<std::vector<std::string> >
names(
new std::vector<std::string>);
119 std::unique_ptr<std::vector<float> > xs(
new std::vector<float>);
120 std::unique_ptr<std::vector<float> > ys(
new std::vector<float>);
121 std::unique_ptr<std::vector<float> > zs(
new std::vector<float>);
122 std::unique_ptr<std::vector<float> > ts(
new std::vector<float>);
123 std::unique_ptr<std::vector<int> >
ids(
new std::vector<int>);
124 std::unique_ptr<std::vector<float> >
masses(
new std::vector<float>);
125 std::unique_ptr<std::vector<float> > charges(
new std::vector<float>);
127 std::vector <StopPoint>::const_iterator stopPoint =
mStopPoints.begin ();
128 for (; stopPoint !=
mStopPoints.end(); ++stopPoint) {
129 names->push_back (stopPoint->name);
130 xs->push_back (stopPoint->x);
131 ys->push_back (stopPoint->y);
132 zs->push_back (stopPoint->z);
133 ts->push_back (stopPoint->t);
134 ids->push_back (stopPoint->id);
135 masses->push_back (stopPoint->mass);
136 charges->push_back (stopPoint->charge);
145 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 produce(edm::Event &, const edm::EventSetup &) override
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
Abs< T >::type abs(const T &t)
std::string mTraceParticleName
RHStopTracer(edm::ParameterSet const &p)
std::vector< StopPoint > mStopPoints