6 #include "G4LogicalVolumeStore.hh"
7 #include "G4ParticleTable.hh"
8 #include "G4PhysicalVolumeStore.hh"
9 #include "G4RegionStore.hh"
10 #include "G4UnitsTable.hh"
11 #include "G4SystemOfUnits.hh"
47 <<
" MaxTrackTime = " << maxTrackTime / CLHEP::ns <<
" ns;"
49 <<
" MaxTrackTimeForward = " << maxTrackTimeForward / CLHEP::ns <<
" ns"
56 <<
"SteppingAction::MaxTrackTime for " << maxTimeNames[
i] <<
" is " << maxTrackTimes[
i] <<
" ns ";
57 maxTrackTimes[
i] *= ns;
64 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " <<
ndeadRegions;
66 edm::LogVerbatim(
"SimG4CoreApplication") <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
80 <<
"SteppingAction::Particle " <<
i <<
" " << ekinParticles[
i] <<
" Threshold = " << ekinMins[
i] <<
" MeV";
81 ekinMins[
i] *= CLHEP::MeV;
84 edm::LogVerbatim(
"SimG4CoreApplication") <<
"SteppingAction::LogVolume[" <<
i <<
"] = " << ekinNames[
i];
99 G4Track* theTrack = aStep->GetTrack();
102 const G4StepPoint* preStep = aStep->GetPreStepPoint();
103 const G4StepPoint* postStep = aStep->GetPostStepPoint();
111 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
112 <<
" E(MeV)= " << preStep->GetKineticEnergy() / MeV <<
" Nstep= " << theTrack->GetCurrentStepNumber()
113 <<
" is killed due to edep=NaN inside PV: " << preStep->GetPhysicalVolume()->GetName() <<
" at "
114 << theTrack->GetPosition() <<
" StepLen(mm)= " << aStep->GetStepLength();
131 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
132 <<
" E(MeV)= " << preStep->GetKineticEnergy() / MeV <<
" Nstep= " << theTrack->GetCurrentStepNumber()
133 <<
" is killed due to limit on number of steps;/n PV: " << preStep->GetPhysicalVolume()->GetName() <<
" at "
134 << theTrack->GetPosition() <<
" StepLen(mm)= " << aStep->GetStepLength();
137 const double time = theTrack->GetGlobalTime();
147 const G4LogicalVolume* lv = postStep->GetPhysicalVolume()->GetLogicalVolume();
148 const G4Region* theRegion = lv->GetRegion();
169 theTrack->GetDefinition()->GetPDGCharge() != 0.0 && lv->GetMaterial()->GetDensity() <=
theCriticalDensity) {
177 math::XYZVectorD pos((preStep->GetPosition()).
x(), (preStep->GetPosition()).
y(), (preStep->GetPosition()).
z());
180 (preStep->GetMomentum()).
y(),
181 (preStep->GetMomentum()).
z(),
182 preStep->GetTotalEnergy());
184 uint32_t
id = theTrack->GetTrackID();
186 std::pair<math::XYZVectorD, math::XYZTLorentzVectorD>
p(pos, mom);
190 theTrack->SetTrackStatus(fStopAndKill);
201 const double ekin = theTrack->GetKineticEnergy();
202 int pCode = theTrack->GetDefinition()->GetPDGEncoding();
218 const G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
219 for (
auto const& pvcite : *pvs) {
220 const G4String& pvname = pvcite->GetName();
221 if (pvname ==
"Tracker")
223 else if (pvname ==
"CALO")
230 <<
"SteppingAction: pointer for Tracker " <<
tracker <<
" and for Calo " <<
calo;
232 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
235 for (
auto const& lvcite : *lvs) {
236 const G4String& lvname = lvcite->GetName();
250 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
255 ekinPDG[
i] = part->GetPDGEncoding();
257 <<
" and KE cut off " <<
ekinMins[
i] / MeV <<
" MeV";
261 const G4RegionStore* rs = G4RegionStore::GetInstance();
264 for (
auto const& rcite : *rs) {
265 const G4String&
rname = rcite->GetName();
276 for (
auto const& rcite : *rs) {
277 const G4String&
rname = rcite->GetName();
295 typ =
" in dead region ";
298 typ =
" out of time window ";
301 typ =
" low energy limit ";
304 typ =
" low energy limit in vacuum ";
307 typ =
" energy deposition is NaN ";
310 typ =
" very forward track ";
313 typ =
" too many steps ";
318 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
319 vname = pv->GetLogicalVolume()->GetName();
320 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
322 const double ekin = aTrack->GetKineticEnergy();
323 if (ekin < 2 * CLHEP::MeV) {
327 <<
"Track #" << aTrack->GetTrackID() <<
" StepN= " << aTrack->GetCurrentStepNumber() <<
" "
328 << aTrack->GetDefinition()->GetParticleName() <<
" E(MeV)=" << ekin / CLHEP::MeV
329 <<
" T(ns)=" << aTrack->GetGlobalTime() / CLHEP::ns <<
" is killed due to " << typ <<
"\n LV: " << vname <<
" ("
330 << 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
void NextStep(const G4Step *, const G4SteppingManager *ptr, bool isKilled) const
const CMSSteppingVerbose * steppingVerbose
bool isLowEnergy(const G4LogicalVolume *, const G4Track *) 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
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
bool isOutOfTimeWindow(const G4Region *reg, const double &time) const
std::vector< std::string > deadRegionNames
const G4VPhysicalVolume * calo
Abs< T >::type abs(const T &t)
std::vector< double > maxTrackTimes
std::vector< G4LogicalVolume * > ekinVolumes
double theCriticalEnergyForVacuum
EventAction * eventAction_
std::vector< double > ekinMins
std::vector< std::string > maxTimeNames
std::vector< std::string > ekinNames
T getParameter(std::string const &) const
double maxTrackTimeForward
const G4String rname[NREG]
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
bool isInsideDeadRegion(const G4Region *reg) const
SteppingAction(EventAction *ea, const edm::ParameterSet &ps, const CMSSteppingVerbose *, bool hasW)
Log< level::Warning, false > LogWarning
void PrintKilledTrack(const G4Track *, const TrackStatus &) const
unsigned int ndeadRegions
std::vector< std::string > ekinParticles
bool isThisVolume(const G4VTouchable *touch, const G4VPhysicalVolume *pv) const
std::vector< const G4Region * > maxTimeRegions