6 #include "G4LogicalVolumeStore.hh" 7 #include "G4ParticleTable.hh" 8 #include "G4PhysicalVolumeStore.hh" 9 #include "G4RegionStore.hh" 10 #include "G4UnitsTable.hh" 11 #include "G4SystemOfUnits.hh" 21 nWarnings(0),initialized(
false), killBeamPipe(
false),hasWatcher(hasW)
37 <<
"SteppingAction:: KillBeamPipe = " <<
killBeamPipe <<
" CriticalDensity = " 40 <<
" Mev;" <<
" MaxTrackTime = " <<
maxTrackTime/CLHEP::ns <<
" ns";
46 <<
"SteppingAction::MaxTrackTime for " << maxTimeNames[
i] <<
" is " 47 << maxTrackTimes[
i] <<
" ns ";
48 maxTrackTimes[
i] *= ns;
55 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " 59 <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
69 <<
"SteppingAction::Kill following " <<
numberPart 73 <<
"SteppingAction::Particle " <<
i <<
" " << ekinParticles[
i]
74 <<
" Threshold = " << ekinMins[
i] <<
" MeV";
79 <<
"SteppingAction::LogVolume[" <<
i <<
"] = " << ekinNames[
i];
93 G4Track * theTrack = aStep->GetTrack();
96 G4StepPoint* postStep = aStep->GetPostStepPoint();
98 if(
sAlive == tstat && postStep->GetPhysicalVolume() !=
nullptr) {
100 G4StepPoint* preStep = aStep->GetPreStepPoint();
101 const G4Region* theRegion =
102 preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
113 <<
"Track #" << theTrack->GetTrackID()
114 <<
" " << theTrack->GetDefinition()->GetParticleName()
115 <<
" E(MeV)= " << preStep->GetKineticEnergy()/
MeV 116 <<
" is killed due to edep=NaN inside PV: " 117 << preStep->GetPhysicalVolume()->GetName()
118 <<
" at " << theTrack->GetPosition()
119 <<
" StepLen(mm)= " << aStep->GetStepLength();
130 G4double kinEnergy = theTrack->GetKineticEnergy();
132 && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0
133 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity()
145 (preStep->GetPosition()).
y(),
146 (preStep->GetPosition()).
z());
149 (preStep->GetMomentum()).
y(),
150 (preStep->GetMomentum()).
z(),
151 preStep->GetTotalEnergy());
153 uint32_t
id = theTrack->GetTrackID();
155 std::pair<math::XYZVectorD,math::XYZTLorentzVectorD>
p(
pos,mom);
159 theTrack->SetTrackStatus(fStopAndKill);
173 const G4StepPoint* sp = aStep->GetPostStepPoint();
174 G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume();
182 double ekin = sp->GetKineticEnergy();
183 int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
186 return (ekin <=
ekinMins[i]) ?
true :
false;
195 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
197 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
198 for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) {
199 if ((*pvcite)->GetName() ==
"Tracker")
tracker = (*pvcite);
200 if ((*pvcite)->GetName() ==
"CALO")
calo = (*pvcite);
205 <<
"Pointer for Tracker " <<
tracker <<
" and for Calo " <<
calo;
208 if (calo)
LogDebug(
"SimG4CoreApplication") <<
"Calorimeter vol name " 213 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
217 std::vector<G4LogicalVolume*>::const_iterator lvcite;
218 for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
220 if ((*lvcite)->GetName() == (G4String)(
ekinNames[
i])) {
234 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
239 theParticleTable->FindParticle(partName=
ekinParticles[
i])->GetPDGEncoding();
246 const G4RegionStore * rs = G4RegionStore::GetInstance();
249 std::vector<G4Region*>::const_iterator rcite;
250 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
261 std::vector<G4Region*>::const_iterator rcite;
262 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
285 typ =
" in dead region ";
288 typ =
" out of time window ";
291 typ =
" low energy limit ";
294 typ =
" low energy limit in vacuum ";
297 typ =
" energy deposition is NaN ";
302 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
304 vname = pv->GetLogicalVolume()->GetName();
305 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
309 <<
"Track #" << aTrack->GetTrackID()
310 <<
" " << aTrack->GetDefinition()->GetParticleName()
311 <<
" E(MeV)= " << aTrack->GetKineticEnergy()/
MeV 312 <<
" T(ns)= " << aTrack->GetGlobalTime()/ns
313 <<
" is killed due to " << typ
314 <<
" inside LV: " << vname <<
" (" << rname
315 <<
") 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
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