5 #include "G4LogicalVolumeStore.hh"
6 #include "G4ParticleTable.hh"
7 #include "G4PhysicalVolumeStore.hh"
8 #include "G4RegionStore.hh"
9 #include "G4UnitsTable.hh"
10 #include "G4SystemOfUnits.hh"
32 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction:: KillBeamPipe = "
36 <<
" CriticalEnergyForVacuum = "
46 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::MaxTrackTime for "
47 << maxTimeNames[
i] <<
" is "
48 << maxTrackTimes[
i] <<
" ns ";
49 maxTrackTimes[
i] *= ns;
56 <<
"SteppingAction: Number of DeadRegions where all trackes are killed "
60 <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
69 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::Kill following "
74 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::Particle " <<
i
75 <<
" " << ekinParticles[
i]
76 <<
" Threshold = " << ekinMins[
i]
81 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::LogVolume[" <<
i
82 <<
"] = " << ekinNames[
i];
94 G4Track * theTrack = aStep->GetTrack();
95 bool ok = (theTrack->GetTrackStatus() == fAlive);
96 G4StepPoint* postStep = aStep->GetPostStepPoint();
97 if(ok && postStep->GetPhysicalVolume() != 0) {
99 G4StepPoint* preStep = aStep->GetPreStepPoint();
100 const G4Region* theRegion =
101 preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
113 G4double kinEnergy = theTrack->GetKineticEnergy();
115 && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0
116 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity()
118 theTrack->SetTrackStatus(fStopAndKill);
132 (preStep->GetPosition()).
y(),
133 (preStep->GetPosition()).
z());
136 (preStep->GetMomentum()).
y(),
137 (preStep->GetMomentum()).
z(),
138 preStep->GetTotalEnergy());
140 uint32_t
id = theTrack->GetTrackID();
142 std::pair<math::XYZVectorD,math::XYZTLorentzVectorD>
p(pos,mom);
150 const G4Region* reg)
const
156 theTrack->SetTrackStatus(fStopAndKill);
179 if (theTrack->GetGlobalTime() > tofM) {
180 theTrack->SetTrackStatus(fStopAndKill);
193 G4LogicalVolume* lv =
194 aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
202 G4Track * track = aStep->GetTrack();
203 double ekin = track->GetKineticEnergy();
205 int pCode = track->GetDefinition()->GetPDGEncoding();
213 track->SetTrackStatus(fStopAndKill);
224 G4VPhysicalVolume* pv)
const
227 int level = (touch->GetHistoryDepth())+1;
228 if (level >= 3) { res = (touch->GetVolume(level - 3) == pv); }
234 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
236 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
237 for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) {
238 if ((*pvcite)->GetName() ==
"Tracker")
tracker = (*pvcite);
239 if ((*pvcite)->GetName() ==
"CALO")
calo = (*pvcite);
244 <<
" and for Calo " <<
calo;
247 if (calo)
LogDebug(
"SimG4CoreApplication") <<
"Calorimeter vol name "
252 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
256 std::vector<G4LogicalVolume*>::const_iterator lvcite;
257 for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
259 if ((*lvcite)->GetName() == (G4String)(
ekinNames[
i])) {
273 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
278 theParticleTable->FindParticle(partName=
ekinParticles[
i])->GetPDGEncoding();
281 <<
" and KE cut off "
286 const G4RegionStore * rs = G4RegionStore::GetInstance();
289 std::vector<G4Region*>::const_iterator rcite;
290 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
301 std::vector<G4Region*>::const_iterator rcite;
302 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
319 G4VPhysicalVolume* pv = aTrack->GetNextVolume();
321 vname = pv->GetLogicalVolume()->GetName();
322 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
326 <<
"Track #" << aTrack->GetTrackID()
327 <<
" " << aTrack->GetDefinition()->GetParticleName()
328 <<
" E(MeV)= " << aTrack->GetKineticEnergy()/
MeV
329 <<
" is killed due to " << typ
330 <<
" inside LV: " << vname <<
" (" << rname
331 <<
") at " << aTrack->GetPosition();
virtual ~SteppingAction()
bool killInsideDeadRegion(G4Track *theTrack, const G4Region *reg) const
T getParameter(std::string const &) const
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
bool killLowEnergy(const G4Step *aStep) const
double theCriticalDensity
SimActivityRegistry::G4StepSignal m_g4StepSignal
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
virtual void UserSteppingAction(const G4Step *aStep)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
std::vector< std::string > deadRegionNames
std::vector< double > maxTrackTimes
SteppingAction(EventAction *ea, const edm::ParameterSet &ps)
std::vector< G4LogicalVolume * > ekinVolumes
double theCriticalEnergyForVacuum
EventAction * eventAction_
std::vector< double > ekinMins
bool isThisVolume(const G4VTouchable *touch, G4VPhysicalVolume *pv) const
std::vector< std::string > maxTimeNames
std::vector< std::string > ekinNames
void PrintKilledTrack(const G4Track *, const std::string &) const
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
G4VPhysicalVolume * tracker
volatile std::atomic< bool > shutdown_flag false
unsigned int ndeadRegions
bool catchLongLived(G4Track *theTrack, const G4Region *reg) const
std::vector< std::string > ekinParticles
std::vector< const G4Region * > maxTimeRegions