5 #include "G4LogicalVolumeStore.hh" 6 #include "G4ParticleTable.hh" 7 #include "G4PhysicalVolumeStore.hh" 8 #include "G4RegionStore.hh" 9 #include "G4UnitsTable.hh" 10 #include "G4SystemOfUnits.hh" 32 maxTrackTime =
p.getParameter<
double>(
"MaxTrackTime") * CLHEP::ns;
34 maxTrackTimes =
p.getParameter<std::vector<double> >(
"MaxTrackTimes");
35 maxTimeNames =
p.getParameter<std::vector<std::string> >(
"MaxTimeNames");
38 ekinMins =
p.getParameter<std::vector<double> >(
"EkinThresholds");
39 ekinNames =
p.getParameter<std::vector<std::string> >(
"EkinNames");
40 ekinParticles =
p.getParameter<std::vector<std::string> >(
"EkinParticles");
46 <<
" MaxTrackTime = " <<
maxTrackTime / CLHEP::ns <<
" ns;" 63 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " <<
ndeadRegions;
98 G4Track* theTrack = aStep->GetTrack();
101 if (theTrack->GetKineticEnergy() < 0.0) {
105 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
106 <<
" Ekin(MeV)= " << theTrack->GetKineticEnergy() / MeV;
108 theTrack->SetKineticEnergy(0.0);
111 const G4StepPoint* preStep = aStep->GetPreStepPoint();
112 const G4StepPoint* postStep = aStep->GetPostStepPoint();
120 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
121 <<
" E(MeV)= " << preStep->GetKineticEnergy() / MeV <<
" Nstep= " << theTrack->GetCurrentStepNumber()
122 <<
" is killed due to edep=NaN inside PV: " << preStep->GetPhysicalVolume()->GetName() <<
" at " 123 << theTrack->GetPosition() <<
" StepLen(mm)= " << aStep->GetStepLength();
140 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
141 <<
" E(MeV)= " << preStep->GetKineticEnergy() / MeV <<
" Nstep= " << theTrack->GetCurrentStepNumber()
142 <<
" is killed due to limit on number of steps;/n PV: " << preStep->GetPhysicalVolume()->GetName() <<
" at " 143 << theTrack->GetPosition() <<
" StepLen(mm)= " << aStep->GetStepLength();
146 const double time = theTrack->GetGlobalTime();
156 const G4LogicalVolume* lv = postStep->GetPhysicalVolume()->GetLogicalVolume();
157 const G4Region* theRegion = lv->GetRegion();
178 theTrack->GetDefinition()->GetPDGCharge() != 0.0 && lv->GetMaterial()->GetDensity() <=
theCriticalDensity) {
184 bool isKilled =
false;
186 if (preStep->GetPhysicalVolume() ==
tracker && postStep->GetPhysicalVolume() ==
calo) {
187 math::XYZVectorD pos((postStep->GetPosition()).
x(), (postStep->GetPosition()).
y(), (postStep->GetPosition()).
z());
190 (postStep->GetMomentum()).
y(),
191 (postStep->GetMomentum()).
z(),
192 postStep->GetTotalEnergy());
194 uint32_t
id = theTrack->GetTrackID();
196 std::pair<math::XYZVectorD, math::XYZTLorentzVectorD>
p(
pos, mom);
200 theTrack->SetTrackStatus(fStopAndKill);
212 const double ekin = theTrack->GetKineticEnergy();
213 int pCode = theTrack->GetDefinition()->GetPDGEncoding();
229 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
230 for (
auto const& pvcite : *
pvs) {
231 const G4String& pvname = pvcite->GetName();
232 if (pvname ==
"Tracker" || pvname ==
"tracker:Tracker_1")
234 else if (pvname ==
"CALO" || pvname ==
"caloBase:CALO_1")
241 <<
"SteppingAction: pointer for Tracker " <<
tracker <<
" and for Calo " <<
calo;
243 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
246 for (
auto const& lvcite : *lvs) {
247 const G4String& lvname = lvcite->GetName();
261 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
268 <<
" and KE cut off " <<
ekinMins[
i] / MeV <<
" MeV";
272 const G4RegionStore* rs = G4RegionStore::GetInstance();
275 for (
auto const& rcite : *rs) {
276 const G4String&
rname = rcite->GetName();
287 for (
auto const& rcite : *rs) {
288 const G4String&
rname = rcite->GetName();
306 typ =
" in dead region ";
309 typ =
" out of time window ";
312 typ =
" low energy limit ";
315 typ =
" low energy limit in vacuum ";
318 typ =
" energy deposition is NaN ";
321 typ =
" very forward track ";
324 typ =
" too many steps ";
329 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
330 vname =
pv->GetLogicalVolume()->GetName();
331 rname =
pv->GetLogicalVolume()->GetRegion()->GetName();
333 const double ekin = aTrack->GetKineticEnergy();
334 if (ekin < 2 * CLHEP::MeV) {
338 <<
"Track #" << aTrack->GetTrackID() <<
" StepN= " << aTrack->GetCurrentStepNumber() <<
" " 339 << aTrack->GetDefinition()->GetParticleName() <<
" E(MeV)=" << ekin / CLHEP::MeV
340 <<
" T(ns)=" << aTrack->GetGlobalTime() / CLHEP::ns <<
" is killed due to " << typ <<
"\n LV: " << vname <<
" (" 341 <<
rname <<
") at " << aTrack->GetPosition() <<
" step(cm)=" << aTrack->GetStep()->GetStepLength() / CLHEP::cm;
Log< level::Info, true > LogVerbatim
void UserSteppingAction(const G4Step *aStep) final
const G4VPhysicalVolume * tracker
std::vector< int > ekinPDG
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< const G4Region * > deadRegions
double theCriticalDensity
SimActivityRegistry::G4StepSignal m_g4StepSignal
constexpr bool isNotFinite(T x)
~SteppingAction() override
bool isOutOfTimeWindow(const G4Region *reg, const double &time) const
const CMSSteppingVerbose * steppingVerbose
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
void PrintKilledTrack(const G4Track *, const TrackStatus &) const
std::vector< std::string > deadRegionNames
const G4VPhysicalVolume * calo
Abs< T >::type abs(const T &t)
bool isLowEnergy(const G4LogicalVolume *, const G4Track *) const
std::vector< double > maxTrackTimes
bool isInsideDeadRegion(const G4Region *reg) const
std::vector< G4LogicalVolume * > ekinVolumes
double theCriticalEnergyForVacuum
EventAction * eventAction_
std::vector< double > ekinMins
std::vector< std::string > maxTimeNames
std::vector< std::string > ekinNames
double maxTrackTimeForward
const G4String rname[NREG]
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
void NextStep(const G4Step *, const G4SteppingManager *ptr, bool isKilled) const
SteppingAction(EventAction *ea, const edm::ParameterSet &ps, const CMSSteppingVerbose *, bool hasW)
Log< level::Warning, false > LogWarning
unsigned int ndeadRegions
std::vector< std::string > ekinParticles
std::vector< const G4Region * > maxTimeRegions