16 #include <CLHEP/Units/SystemOfUnits.h> 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");
46 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> begin of the run " << (*fRun)()->GetRunID();
50 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> begin of the event " << (*fEvent)()->GetEventID();
54 const G4Track*
track = (*fTrack)();
55 const G4ParticleDefinition*
part =
track->GetDefinition();
62 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> new track: ID/Name/pdgId/mass/charge/Parent: " 63 <<
track->GetTrackID() <<
'/' <<
part->GetParticleName() <<
'/' 64 <<
part->GetPDGEncoding() <<
'/' <<
part->GetPDGMass() / CLHEP::GeV <<
" GeV/" 65 <<
part->GetPDGCharge() <<
'/' <<
track->GetParentID()
66 <<
" Position: " <<
track->GetPosition() <<
' ' 67 <<
" R/phi: " <<
track->GetPosition().perp() <<
'/' <<
track->GetPosition().phi()
68 <<
" 4vec " <<
track->GetMomentum();
70 const_cast<G4Track*
>(
track)->SetTrackStatus(fStopAndKill);
75 const G4Track*
track = (*fTrack)();
76 const G4ParticleDefinition*
part =
track->GetDefinition();
83 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::update-> stop track: ID/Name/pdgId/mass/charge/Parent: " 84 <<
track->GetTrackID() <<
'/' <<
part->GetParticleName() <<
'/' 85 <<
part->GetPDGEncoding() <<
'/' <<
part->GetPDGMass() / CLHEP::GeV <<
" GeV/" 86 <<
part->GetPDGCharge() <<
'/' <<
track->GetParentID()
87 <<
" Position: " <<
track->GetPosition() <<
' ' 88 <<
" R/phi: " <<
track->GetPosition().perp() <<
'/' <<
track->GetPosition().phi()
89 <<
" 4vec " <<
track->GetMomentum();
90 if (
track->GetMomentum().mag() < 0.001) {
91 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer:: track has stopped, so making StopPoint";
93 track->GetPosition().x(),
94 track->GetPosition().y(),
95 track->GetPosition().z(),
96 track->GetGlobalTime(),
97 track->GetDefinition()->GetPDGEncoding(),
98 track->GetDefinition()->GetPDGMass() / CLHEP::GeV,
99 track->GetDefinition()->GetPDGCharge()));
105 LogDebug(
"SimG4CoreCustomPhysics") <<
"RHStopTracer::produce->";
107 std::unique_ptr<std::vector<std::string> >
names(
new std::vector<std::string>);
108 std::unique_ptr<std::vector<float> > xs(
new std::vector<float>);
109 std::unique_ptr<std::vector<float> > ys(
new std::vector<float>);
110 std::unique_ptr<std::vector<float> > zs(
new std::vector<float>);
111 std::unique_ptr<std::vector<float> > ts(
new std::vector<float>);
112 std::unique_ptr<std::vector<int> > ids(
new std::vector<int>);
113 std::unique_ptr<std::vector<float> > masses(
new std::vector<float>);
114 std::unique_ptr<std::vector<float> >
charges(
new std::vector<float>);
116 std::vector<StopPoint>::const_iterator stopPoint =
mStopPoints.begin();
117 for (; stopPoint !=
mStopPoints.end(); ++stopPoint) {
118 names->push_back(stopPoint->name);
119 xs->push_back(stopPoint->x);
120 ys->push_back(stopPoint->y);
121 zs->push_back(stopPoint->z);
122 ts->push_back(stopPoint->t);
123 ids->push_back(stopPoint->id);
124 masses->push_back(stopPoint->mass);
125 charges->push_back(stopPoint->charge);
Log< level::Info, true > LogVerbatim
const std::string names[nVars_]
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)
charges
only generated particles of these IDs are considered
std::vector< StopPoint > mStopPoints