7 #include "G4VProcess.hh"
8 #include "G4HCofThisEvent.hh"
9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
10 #include "CLHEP/Units/GlobalPhysicalConstants.h"
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 > "
26 << minDeltaE <<
" MeV\n";
40 eTrack = thTk->GetKineticEnergy()/MeV;
41 LogDebug(
"CheckSecondary") <<
"TreatSecondary::initTrack:Track: "
42 << thTk->GetTrackID() <<
" Type: "
43 << thTk->GetDefinition()->GetParticleName()
44 <<
" KE " << thTk->GetKineticEnergy()/GeV
45 <<
" GeV p " << thTk->GetMomentum().mag()/GeV
46 <<
" GeV daughter of particle "
47 << thTk->GetParentID();
55 std::vector<int> & charges) {
62 std::vector<math::XYZTLorentzVector> secondaries;
66 G4TrackVector* tkV =
const_cast<G4TrackVector*
>(aStep->GetSecondary());
67 G4Track* thTk = aStep->GetTrack();
68 const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
69 const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
70 double eTrackNew = thTk->GetKineticEnergy()/MeV;
74 int nsc = (*tkV).size();
75 const G4VProcess*
proc = 0;
76 if (postStepPoint) proc = postStepPoint->GetProcessDefinedStep();
78 G4ProcessType
type = fNotDefined;
80 type = proc->GetProcessType();
81 name = proc->GetProcessName();
83 int sec = nsc -
nsecL;
84 LogDebug(
"CheckSecondary") << sec <<
" secondaries in step "
85 << thTk->GetCurrentStepNumber()
86 <<
" of track " << thTk->GetTrackID()
87 <<
" from " << name <<
" of type "
88 << type <<
" ID " << procid <<
" ("
92 G4TrackStatus state = thTk->GetTrackStatus();
93 if (state == fAlive || state == fStopButAlive) sec++;
95 if (type == fHadronic || type == fPhotolepton_hadron || type == fDecay) {
100 LogDebug(
"CheckSecondary") <<
"Hadronic Interaction " <<
nHad
101 <<
" of Type " << type <<
" with "
102 << sec <<
" secondaries from process "
103 << proc->GetProcessName() <<
" Delta E "
104 << deltaE <<
" Flag " << hadrInt;
108 if (state == fAlive || state == fStopButAlive) {
109 G4ThreeVector
pp = postStepPoint->GetMomentum();
110 double ee = postStepPoint->GetTotalEnergy();
112 secondaries.push_back(secondary);
113 int charge = (int)(postStepPoint->GetCharge());
114 charges.push_back(charge);
116 for (
int i=nsecL;
i<nsc;
i++) {
117 G4Track* tk = (*tkV)[
i];
118 G4ThreeVector
pp = tk->GetMomentum();
119 double ee = tk->GetTotalEnergy();
121 secondaries.push_back(secondary);
122 int charge = (int)(tk->GetDefinition()->GetPDGCharge());
123 charges.push_back(charge);
128 thTk->SetTrackStatus(fStopAndKill);
132 if (state == fAlive || state == fStopButAlive) {
134 LogDebug(
"CheckSecondary") <<
"Secondary: " << sec <<
" ID "
135 << thTk->GetTrackID() <<
" Status "
136 << thTk->GetTrackStatus() <<
" Particle "
137 <<thTk->GetDefinition()->GetParticleName()
139 << postStepPoint->GetPosition() <<
" KE "
140 << postStepPoint->GetKineticEnergy()
142 << postStepPoint->GetGlobalTime();
144 for (
int i=nsecL;
i<nsc;
i++) {
146 G4Track* tk = (*tkV)[
i];
147 LogDebug(
"CheckSecondary") <<
"Secondary: " << sec <<
" ID "
148 << tk->GetTrackID() <<
" Status "
149 << tk->GetTrackStatus() <<
" Particle "
150 << tk->GetDefinition()->GetParticleName()
151 <<
" Position " << tk->GetPosition()
152 <<
" KE " << tk->GetKineticEnergy()
153 <<
" Time " << tk->GetGlobalTime();
160 LogDebug(
"CheckSecondary") <<
"Track: " << thTk->GetTrackID()
161 <<
" Status " << thTk->GetTrackStatus()
163 << thTk->GetDefinition()->GetParticleName()
164 <<
" at " << preStepPoint->GetPosition()
165 <<
" Step: " <<
step <<
" KE "
166 << thTk->GetKineticEnergy()/GeV <<
" GeV; p "
167 << thTk->GetMomentum().mag()/GeV
168 <<
" GeV/c; Step Length "
169 << aStep->GetStepLength()<<
" Energy Deposit "
170 << aStep->GetTotalEnergyDeposit()/MeV
171 <<
" MeV; Interaction " << hadrInt;
T getUntrackedParameter(std::string const &, T const &) const
TrainProcessor *const proc
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)
int processIdLong(const G4VProcess *)
void initTrack(const G4Track *trk)
std::vector< std::string > processG4Name(std::string)