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)
35 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction:: KillBeamPipe = " 39 <<
" CriticalEnergyForVacuum = " 49 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::MaxTrackTime for " 50 << maxTimeNames[
i] <<
" is " 51 << maxTrackTimes[
i] <<
" ns ";
52 maxTrackTimes[
i] *= ns;
59 <<
"SteppingAction: Number of DeadRegions where all trackes are killed " 63 <<
"SteppingAction: DeadRegion " <<
i <<
". " << deadRegionNames[
i];
72 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::Kill following " 77 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::Particle " <<
i 78 <<
" " << ekinParticles[
i]
79 <<
" Threshold = " << ekinMins[
i]
84 edm::LogInfo(
"SimG4CoreApplication") <<
"SteppingAction::LogVolume[" <<
i 85 <<
"] = " << ekinNames[
i];
99 G4Track * theTrack = aStep->GetTrack();
101 G4StepPoint* postStep = aStep->GetPostStepPoint();
103 if(0 == tstat && postStep->GetPhysicalVolume() !=
nullptr) {
105 G4StepPoint* preStep = aStep->GetPreStepPoint();
106 const G4Region* theRegion =
107 preStep->GetPhysicalVolume()->GetLogicalVolume()->GetRegion();
119 G4double kinEnergy = theTrack->GetKineticEnergy();
121 && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0
122 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity()
134 (preStep->GetPosition()).
y(),
135 (preStep->GetPosition()).
z());
138 (preStep->GetMomentum()).
y(),
139 (preStep->GetMomentum()).
z(),
140 preStep->GetTotalEnergy());
142 uint32_t
id = theTrack->GetTrackID();
144 std::pair<math::XYZVectorD,math::XYZTLorentzVectorD>
p(
pos,mom);
148 theTrack->SetTrackStatus(fStopAndKill);
162 const G4StepPoint* sp = aStep->GetPostStepPoint();
163 G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume();
171 double ekin = sp->GetKineticEnergy();
172 int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
175 return (ekin <=
ekinMins[i]) ?
true :
false;
184 const G4PhysicalVolumeStore * pvs = G4PhysicalVolumeStore::GetInstance();
186 std::vector<G4VPhysicalVolume*>::const_iterator pvcite;
187 for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) {
188 if ((*pvcite)->GetName() ==
"Tracker")
tracker = (*pvcite);
189 if ((*pvcite)->GetName() ==
"CALO")
calo = (*pvcite);
194 <<
" and for Calo " <<
calo;
197 if (calo)
LogDebug(
"SimG4CoreApplication") <<
"Calorimeter vol name " 202 const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
206 std::vector<G4LogicalVolume*>::const_iterator lvcite;
207 for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
209 if ((*lvcite)->GetName() == (G4String)(
ekinNames[
i])) {
223 G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
228 theParticleTable->FindParticle(partName=
ekinParticles[
i])->GetPDGEncoding();
231 <<
" and KE cut off " 236 const G4RegionStore * rs = G4RegionStore::GetInstance();
239 std::vector<G4Region*>::const_iterator rcite;
240 for (rcite = rs->begin(); rcite != rs->end(); ++rcite) {
251 std::vector<G4Region*>::const_iterator rcite;
252 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 ";
289 G4VPhysicalVolume*
pv = aTrack->GetNextVolume();
291 vname = pv->GetLogicalVolume()->GetName();
292 rname = pv->GetLogicalVolume()->GetRegion()->GetName();
296 <<
"Track #" << aTrack->GetTrackID()
297 <<
" " << aTrack->GetDefinition()->GetParticleName()
298 <<
" E(MeV)= " << aTrack->GetKineticEnergy()/
MeV 299 <<
" T(ns)= " << aTrack->GetGlobalTime()/ns
300 <<
" is killed due to " << typ
301 <<
" inside LV: " << vname <<
" (" << rname
302 <<
") at " << aTrack->GetPosition();
virtual ~SteppingAction()
T getParameter(std::string const &) const
virtual 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
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