6 #include "CLHEP/Units/GlobalPhysicalConstants.h"
7 #include "CLHEP/Units/GlobalSystemOfUnits.h"
8 #include "G4HCofThisEvent.hh"
11 #include "G4VProcess.hh"
22 edm::LogInfo(
"CheckSecondary") <<
"Instantiate CheckSecondary with Flag"
23 <<
" for Killing track after " << killAfter
24 <<
" hadronic interactions\nDefine inelastic"
25 <<
" if > 1 seondary or change in KE > " << minDeltaE <<
" MeV\n";
40 LogDebug(
"CheckSecondary") <<
"TreatSecondary::initTrack:Track: " << thTk->GetTrackID()
41 <<
" Type: " << thTk->GetDefinition()->GetParticleName() <<
" KE "
42 << thTk->GetKineticEnergy() /
GeV <<
" GeV p " << thTk->GetMomentum().mag() /
GeV
43 <<
" GeV daughter of particle " << thTk->GetParentID();
47 const G4Step *aStep,
std::string &
name,
int &procid,
bool &hadrInt,
double &deltaE, std::vector<int> &charges) {
53 std::vector<math::XYZTLorentzVector> secondaries;
56 if (aStep !=
nullptr) {
57 const G4TrackVector *tkV = aStep->GetSecondary();
58 G4Track *thTk = aStep->GetTrack();
59 const G4StepPoint *preStepPoint = aStep->GetPreStepPoint();
60 const G4StepPoint *postStepPoint = aStep->GetPostStepPoint();
61 double eTrackNew = thTk->GetKineticEnergy() /
MeV;
62 deltaE =
eTrack - eTrackNew;
64 if (tkV !=
nullptr && postStepPoint !=
nullptr) {
65 int nsc = (*tkV).size();
66 const G4VProcess *
proc = postStepPoint->GetProcessDefinedStep();
67 if (proc !=
nullptr) {
68 G4ProcessType
type = proc->GetProcessType();
70 name = proc->GetProcessName();
71 int sec = nsc -
nsecL;
72 LogDebug(
"CheckSecondary") << sec <<
" secondaries in step " << thTk->GetCurrentStepNumber() <<
" of track "
73 << thTk->GetTrackID() <<
" from " << name <<
" of type " << type <<
" ID " << procid
77 if (procid >= 121 && procid <= 151) {
78 LogDebug(
"CheckSecondary") <<
"Hadronic Interaction " <<
nHad <<
" of Type " << procid <<
" with " << sec
79 <<
" secondaries from process " << proc->GetProcessName() <<
" Delta E " << deltaE
80 <<
" Flag " << hadrInt;
82 for (
int i = nsecL;
i < nsc; ++
i) {
83 G4Track *tk = (*tkV)[
i];
84 G4ThreeVector
pp = tk->GetMomentum();
85 double ee = tk->GetTotalEnergy();
87 secondaries.push_back(secondary);
88 int charge = (int)(tk->GetDefinition()->GetPDGCharge());
89 charges.push_back(charge);
92 for (
int i = nsecL;
i < nsc;
i++) {
93 G4Track *tk = (*tkV)[
i];
94 LogDebug(
"CheckSecondary") <<
"Secondary: " << sec <<
" ID " << tk->GetTrackID() <<
" Status "
95 << tk->GetTrackStatus() <<
" Particle "
96 << tk->GetDefinition()->GetParticleName() <<
" Position " << tk->GetPosition()
97 <<
" KE " << tk->GetKineticEnergy() <<
" Time " << tk->GetGlobalTime();
105 LogDebug(
"CheckSecondary") <<
"Track: " << thTk->GetTrackID() <<
" Status " << thTk->GetTrackStatus()
106 <<
" Particle " << thTk->GetDefinition()->GetParticleName() <<
" at "
107 << preStepPoint->GetPosition() <<
" Step: " <<
step <<
" KE "
108 << thTk->GetKineticEnergy() /
GeV <<
" GeV; p " << thTk->GetMomentum().mag() /
GeV
109 <<
" GeV/c; Step Length " << aStep->GetStepLength() <<
" Energy Deposit "
110 << aStep->GetTotalEnergyDeposit() /
MeV <<
" MeV; Interaction " << hadrInt;
T getUntrackedParameter(std::string const &, T const &) const
std::string processG4Name(int) const
virtual ~TreatSecondary()
std::vector< math::XYZTLorentzVector > tracks(const G4Step *step, std::string &procName, int &procID, bool &intr, double &deltaE, std::vector< int > &charges)
G4ProcessTypeEnumerator * typeEnumerator
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TreatSecondary(const edm::ParameterSet &p)
Log< level::Info, false > LogInfo
void initTrack(const G4Track *trk)
int processIdLong(const G4VProcess *p) const