6 #include "G4LogicalVolumeStore.hh" 7 #include "G4ParticleTable.hh" 8 #include "G4PhysicalVolumeStore.hh" 9 #include "G4RegionStore.hh" 10 #include "G4UnitsTable.hh" 11 #include "G4SystemOfUnits.hh" 20 initialized(
false), killBeamPipe(
false),hasWatcher(hasW)
36 <<
"SteppingAction:: KillBeamPipe = " <<
killBeamPipe <<
" CriticalDensity = " 39 <<
" Mev;" <<
" MaxTrackTime = " <<
maxTrackTime/CLHEP::ns <<
" ns";
45 <<
"SteppingAction::MaxTrackTime for " << maxTimeNames[
i] <<
" is " 46 << maxTrackTimes[
i] <<
" ns ";
47 maxTrackTimes[
i] *= ns;
54 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " 58 <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
68 <<
"SteppingAction::Kill following " <<
numberPart 72 <<
"SteppingAction::Particle " <<
i <<
" " << ekinParticles[
i]
73 <<
" Threshold = " << ekinMins[
i] <<
" MeV";
78 <<
"SteppingAction::LogVolume[" <<
i <<
"] = " << ekinNames[
i];
92 G4Track * theTrack = aStep->GetTrack();
94 G4StepPoint* postStep = aStep->GetPostStepPoint();
96 if(0 == tstat && postStep->GetPhysicalVolume() !=
nullptr) {
98 G4StepPoint* preStep = aStep->GetPreStepPoint();
99 const G4Region* theRegion =
100 preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
112 G4double kinEnergy = theTrack->GetKineticEnergy();
114 && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0
115 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity()
127 (preStep->GetPosition()).
y(),
128 (preStep->GetPosition()).
z());
131 (preStep->GetMomentum()).
y(),
132 (preStep->GetMomentum()).
z(),
133 preStep->GetTotalEnergy());
135 uint32_t
id = theTrack->GetTrackID();
137 std::pair<math::XYZVectorD,math::XYZTLorentzVectorD>
p(
pos,mom);
141 theTrack->SetTrackStatus(fStopAndKill);
155 const G4StepPoint* sp = aStep->GetPostStepPoint();
156 G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume();
164 double ekin = sp->GetKineticEnergy();
165 int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
168 return (ekin <=
ekinMins[i]) ?
true :
false;
177 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
179 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
180 for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) {
181 if ((*pvcite)->GetName() ==
"Tracker")
tracker = (*pvcite);
182 if ((*pvcite)->GetName() ==
"CALO")
calo = (*pvcite);
187 <<
"Pointer for Tracker " <<
tracker <<
" and for Calo " <<
calo;
190 if (calo)
LogDebug(
"SimG4CoreApplication") <<
"Calorimeter vol name " 195 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
199 std::vector<G4LogicalVolume*>::const_iterator lvcite;
200 for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
202 if ((*lvcite)->GetName() == (G4String)(
ekinNames[
i])) {
216 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
221 theParticleTable->FindParticle(partName=
ekinParticles[
i])->GetPDGEncoding();
228 const G4RegionStore * rs = G4RegionStore::GetInstance();
231 std::vector<G4Region*>::const_iterator rcite;
232 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
243 std::vector<G4Region*>::const_iterator rcite;
244 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
267 typ =
" in dead region ";
270 typ =
" out of time window ";
273 typ =
" low energy limit ";
276 typ =
" low energy limit in vacuum ";
281 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
283 vname = pv->GetLogicalVolume()->GetName();
284 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
288 <<
"Track #" << aTrack->GetTrackID()
289 <<
" " << aTrack->GetDefinition()->GetParticleName()
290 <<
" E(MeV)= " << aTrack->GetKineticEnergy()/
MeV 291 <<
" T(ns)= " << aTrack->GetGlobalTime()/ns
292 <<
" is killed due to " << typ
293 <<
" inside LV: " << vname <<
" (" << rname
294 <<
") 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
~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