6 #include "G4LogicalVolumeStore.hh" 7 #include "G4ParticleTable.hh" 8 #include "G4PhysicalVolumeStore.hh" 9 #include "G4RegionStore.hh" 10 #include "G4UnitsTable.hh" 11 #include "G4SystemOfUnits.hh" 44 <<
" MaxTrackTime = " <<
maxTrackTime / CLHEP::ns <<
" ns";
50 <<
"SteppingAction::MaxTrackTime for " << maxTimeNames[
i] <<
" is " << maxTrackTimes[
i] <<
" ns ";
51 maxTrackTimes[
i] *= ns;
58 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " <<
ndeadRegions;
60 edm::LogVerbatim(
"SimG4CoreApplication") <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
74 <<
"SteppingAction::Particle " <<
i <<
" " << ekinParticles[
i] <<
" Threshold = " << ekinMins[
i] <<
" MeV";
78 edm::LogVerbatim(
"SimG4CoreApplication") <<
"SteppingAction::LogVolume[" <<
i <<
"] = " << ekinNames[
i];
93 G4Track* theTrack = aStep->GetTrack();
96 G4StepPoint* postStep = aStep->GetPostStepPoint();
98 if (
sAlive == tstat && postStep->GetPhysicalVolume() !=
nullptr) {
99 G4StepPoint* preStep = aStep->GetPreStepPoint();
100 const G4Region* theRegion = preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
113 <<
"Track #" << theTrack->GetTrackID() <<
" " << theTrack->GetDefinition()->GetParticleName()
114 <<
" E(MeV)= " << preStep->GetKineticEnergy() /
MeV 115 <<
" is killed due to edep=NaN inside PV: " << preStep->GetPhysicalVolume()->GetName() <<
" at " 116 << theTrack->GetPosition() <<
" StepLen(mm)= " << aStep->GetStepLength();
131 G4double kinEnergy = theTrack->GetKineticEnergy();
133 theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0 &&
134 theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity() <=
theCriticalDensity) {
141 math::XYZVectorD pos((preStep->GetPosition()).
x(), (preStep->GetPosition()).
y(), (preStep->GetPosition()).
z());
144 (preStep->GetMomentum()).
y(),
145 (preStep->GetMomentum()).
z(),
146 preStep->GetTotalEnergy());
148 uint32_t
id = theTrack->GetTrackID();
150 std::pair<math::XYZVectorD, math::XYZTLorentzVectorD>
p(
pos, mom);
154 theTrack->SetTrackStatus(fStopAndKill);
167 const G4StepPoint* sp = aStep->GetPostStepPoint();
168 G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume();
176 double ekin = sp->GetKineticEnergy();
177 int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
180 return (ekin <=
ekinMins[i]) ?
true :
false;
188 const G4PhysicalVolumeStore*
pvs = G4PhysicalVolumeStore::GetInstance();
190 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
191 for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) {
192 if ((*pvcite)->GetName() ==
"Tracker")
194 if ((*pvcite)->GetName() ==
"CALO")
202 LogDebug(
"SimG4CoreApplication") <<
"Tracker vol name " <<
tracker->GetName();
204 LogDebug(
"SimG4CoreApplication") <<
"Calorimeter vol name " << calo->GetName();
208 const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
212 std::vector<G4LogicalVolume*>::const_iterator lvcite;
213 for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
215 if ((*lvcite)->GetName() == (G4String)(
ekinNames[
i])) {
228 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
238 const G4RegionStore* rs = G4RegionStore::GetInstance();
241 std::vector<G4Region*>::const_iterator rcite;
242 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
253 std::vector<G4Region*>::const_iterator rcite;
254 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
275 typ =
" in dead region ";
278 typ =
" out of time window ";
281 typ =
" low energy limit ";
284 typ =
" low energy limit in vacuum ";
287 typ =
" energy deposition is NaN ";
292 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
294 vname = pv->GetLogicalVolume()->GetName();
295 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
299 <<
"Track #" << aTrack->GetTrackID() <<
" " << aTrack->GetDefinition()->GetParticleName()
300 <<
" E(MeV)= " << aTrack->GetKineticEnergy() /
MeV <<
" T(ns)= " << aTrack->GetGlobalTime() / ns
301 <<
" is killed due to " << typ <<
" inside LV: " << vname <<
" (" << rname <<
") at " << aTrack->GetPosition();
T getParameter(std::string const &) const
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 isOutOfTimeWindow(G4Track *theTrack, const G4Region *reg) 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
std::vector< std::string > deadRegionNames
const G4VPhysicalVolume * calo
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
const G4String rname[NREG]
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
bool isLowEnergy(const G4Step *aStep) const
bool isInsideDeadRegion(const G4Region *reg) const
SteppingAction(EventAction *ea, const edm::ParameterSet &ps, const CMSSteppingVerbose *, bool hasW)
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