6 #include "G4LogicalVolumeStore.hh" 7 #include "G4ParticleTable.hh" 8 #include "G4PhysicalVolumeStore.hh" 9 #include "G4RegionStore.hh" 10 #include "G4UnitsTable.hh" 11 #include <CLHEP/Units/SystemOfUnits.h> 19 : steppingVerbose(
sv), hasWatcher(hasW), dd4hep_(
dd4hep) {
27 maxTrackTime =
p.getParameter<
double>(
"MaxTrackTime") * CLHEP::ns;
29 maxTrackTimes =
p.getParameter<std::vector<double> >(
"MaxTrackTimes");
30 maxTimeNames =
p.getParameter<std::vector<std::string> >(
"MaxTimeNames");
33 ekinMins =
p.getParameter<std::vector<double> >(
"EkinThresholds");
34 ekinNames =
p.getParameter<std::vector<std::string> >(
"EkinNames");
35 ekinParticles =
p.getParameter<std::vector<std::string> >(
"EkinParticles");
44 <<
" MaxTrackTime = " <<
maxTrackTime / CLHEP::ns <<
" ns;" 62 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " <<
ndeadRegions;
94 G4Track* theTrack = aStep->GetTrack();
96 const double ekin = theTrack->GetKineticEnergy();
102 <<
"SteppingAction::UserSteppingAction: Track #" << theTrack->GetTrackID() <<
" " 103 << theTrack->GetDefinition()->GetParticleName() <<
" Ekin(MeV)=" << ekin;
105 theTrack->SetKineticEnergy(0.0);
116 const G4StepPoint* preStep = aStep->GetPreStepPoint();
117 const G4StepPoint* postStep = aStep->GetPostStepPoint();
123 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
124 <<
" E(MeV)=" << ekin <<
" Nstep=" << theTrack->GetCurrentStepNumber()
125 <<
" is killed due to limit on number of steps;/n PV:" << preStep->GetPhysicalVolume()->GetName() <<
" at " 126 << theTrack->GetPosition() <<
" StepLen(mm)=" << aStep->GetStepLength();
130 const double time = theTrack->GetGlobalTime();
140 const G4LogicalVolume* lv = postStep->GetPhysicalVolume()->GetLogicalVolume();
141 const G4Region* theRegion = lv->GetRegion();
150 const G4Region* preRegion = preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
151 if (preRegion ==
m_ZDCRegion && preRegion != theRegion)
169 if (ekin < theCriticalEnergyForVacuum && theTrack->GetDefinition()->GetPDGCharge() != 0.0 &&
176 bool isKilled =
false;
178 if (preStep->GetPhysicalVolume() ==
tracker && postStep->GetPhysicalVolume() ==
calo) {
185 theTrack->SetTrackStatus(fStopAndKill);
197 const double ekin = theTrack->GetKineticEnergy();
198 int pCode = theTrack->GetDefinition()->GetPDGEncoding();
214 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
215 for (
auto const& pvcite : *
pvs) {
226 edm::LogVerbatim(
"SimG4CoreApplication") <<
pvs->size() <<
" Physical volume in the store";
227 for (
auto const& pvcite : *
pvs)
228 edm::LogVerbatim(
"SimG4CoreApplication") << pvcite <<
" corresponds to " << pvcite->GetName();
231 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
234 edm::LogVerbatim(
"SimG4CoreApplication") << lvs->size() <<
" Logical volume in the store";
235 for (
auto const& lvcite : *lvs)
236 edm::LogVerbatim(
"SimG4CoreApplication") << lvcite <<
" corresponds to " << lvcite->GetName();
238 for (
auto const& lvcite : *lvs) {
251 <<
"SteppingAction: pointer for Tracker: " <<
tracker <<
"; Calo: " <<
calo <<
"; to CMStoZDC: " <<
m_CMStoZDC;
257 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
264 <<
" and KE cut off " <<
ekinMins[
i] / CLHEP::MeV <<
" MeV";
268 const G4RegionStore* rs = G4RegionStore::GetInstance();
270 edm::LogVerbatim(
"SimG4CoreApplication") << rs->size() <<
" Regions in the store";
271 for (
auto const& rcite : *rs)
272 edm::LogVerbatim(
"SimG4CoreApplication") << rcite <<
" corresponds to " << rcite->GetName();
274 for (
auto const& rcite : *rs) {
275 const G4String&
rname = rcite->GetName();
307 typ =
" in dead region ";
310 typ =
" out of time window ";
313 typ =
" low energy limit ";
316 typ =
" low energy limit in vacuum ";
319 typ =
" energy deposition is NaN ";
322 typ =
" very forward track ";
325 typ =
" too many steps ";
330 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
331 vname =
pv->GetLogicalVolume()->GetName();
332 rname =
pv->GetLogicalVolume()->GetRegion()->GetName();
334 const double ekin = aTrack->GetKineticEnergy();
335 if (ekin < 2 * CLHEP::MeV) {
339 <<
"Track #" << aTrack->GetTrackID() <<
" StepN= " << aTrack->GetCurrentStepNumber() <<
" " 340 << aTrack->GetDefinition()->GetParticleName() <<
" E(MeV)=" << ekin / CLHEP::MeV
341 <<
" T(ns)=" << aTrack->GetGlobalTime() / CLHEP::ns <<
" is killed due to " << typ <<
"\n LV: " << vname <<
" (" 342 <<
rname <<
") at " << aTrack->GetPosition() <<
" step(cm)=" << aTrack->GetStep()->GetStepLength() / CLHEP::cm;
Log< level::Info, true > LogVerbatim
const G4LogicalVolume * m_CMStoZDC
void UserSteppingAction(const G4Step *aStep) final
const G4VPhysicalVolume * tracker
std::vector< int > ekinPDG
std::vector< const G4Region * > deadRegions
double theCriticalDensity
SimActivityRegistry::G4StepSignal m_g4StepSignal
bool isOutOfTimeWindow(const G4Region *reg, const double &time) const
const CMSSteppingVerbose * steppingVerbose
bool isForZDC(const G4LogicalVolume *lv, int pdg) const
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
void PrintKilledTrack(const G4Track *, const TrackStatus &) const
std::vector< std::string > deadRegionNames
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
const G4VPhysicalVolume * calo
double theCriticalEnergyForVacuum
const G4Region * m_ZDCRegion
std::vector< double > ekinMins
std::vector< std::string > maxTimeNames
std::vector< std::string > ekinNames
std::string namePV(const std::string &name, bool dd4hep)
double maxTrackTimeForward
const G4String rname[NREG]
SteppingAction(const CMSSteppingVerbose *, const edm::ParameterSet &, bool, bool)
void nextStep(const G4Step *, const G4SteppingManager *ptr, bool isKilled) const
Log< level::Warning, false > LogWarning
std::string nameMatterLV(const std::string &name, bool dd4hep)
unsigned int ndeadRegions
std::vector< std::string > ekinParticles
std::vector< const G4Region * > maxTimeRegions