12 #include "G4ParticleTable.hh" 16 #include "CLHEP/Units/GlobalPhysicalConstants.h" 17 #include "CLHEP/Units/GlobalSystemOfUnits.h" 20 mode =
p.getUntrackedParameter<
bool>(
"ChangeFromFirstStep",
true);
22 <<
" start at first step to " <<
mode;
29 edm::LogVerbatim(
"SimG4CoreWatcher") <<
"MonopoleSteppingAction::Initialize ESGetToken for MagneticField";
37 <<
" Y: " << (
bField->inTesla(
p)).
y() <<
" Z: " <<
bZ;
41 G4ParticleTable *partTable = G4ParticleTable::GetParticleTable();
43 for (
int ii = 0;
ii < partTable->size();
ii++) {
44 G4ParticleDefinition *particle = partTable->GetParticle(
ii);
48 pdgCode.push_back(particle->GetPDGEncoding());
66 const G4Track *aTrack = (*trk)();
67 int code = aTrack->GetDefinition()->GetPDGEncoding();
70 eStart = aTrack->GetTotalEnergy();
71 pxStart = aTrack->GetMomentum().x();
72 pyStart = aTrack->GetMomentum().y();
73 pzStart = aTrack->GetMomentum().z();
74 dirxStart = aTrack->GetMomentumDirection().x();
75 diryStart = aTrack->GetMomentumDirection().y();
76 dirzStart = aTrack->GetMomentumDirection().z();
77 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction Track " << code <<
" Flag " <<
actOnTrack 78 <<
" (px,py,pz,E) = (" <<
pxStart / GeV <<
", " <<
pyStart / GeV <<
", " 86 double eT,
pT, pZ, tStep;
87 G4Track *aTrack = aStep->GetTrack();
88 G4ThreeVector initialPosition(0, 0, 0);
90 tStep = aTrack->GetGlobalTime();
95 const G4ThreeVector &dirStep = aTrack->GetMomentumDirection();
96 double lStep = aTrack->GetStepLength();
97 double xStep = aTrack->GetPosition().x() - lStep * dirStep.x();
98 double yStep = aTrack->GetPosition().y() - lStep * dirStep.y();
99 double zStep = aTrack->GetPosition().z() - lStep * dirStep.z();
100 double vStep = aTrack->GetVelocity();
102 tStep = (vStep > 0. ? (lStep / vStep) : 0.);
103 double eStep = aTrack->GetTotalEnergy();
104 eT = eStep * dirStep.perp();
105 pT = aTrack->GetMomentum().perp();
106 pZ = aTrack->GetMomentum().z();
108 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: tStep " << tStep <<
" eT " << eT <<
" pT " <<
pT <<
" pZ " 114 double eT2 = (eT1 > 0. ? (1. / eT1) : 0.);
120 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: Factor eT = " << eT <<
" " << eT1 <<
" " << eT2
121 <<
", pT = " <<
pT <<
" " <<
pT1 <<
", pZ = " << pZ <<
" " << pZ1
122 <<
", time = " << tStep <<
" " << ts1 <<
", Factors " <<
fac0 <<
" " <<
fac1 <<
" " 123 <<
fac2 <<
", Final ones " << fact1 <<
" " << fact2;
125 G4ThreeVector displacement = (fact1 * ez + fact2 *
et) *
CLHEP::m;
127 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: Initial " << initialPosition <<
" Displacement " 128 << displacement <<
" Final " << (initialPosition + displacement);
129 aTrack->SetPosition(initialPosition + displacement);
std::vector< int > pdgCode
Log< level::Info, true > LogVerbatim
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_bFieldH_
void registerConsumes(edm::ConsumesCollector) override
U second(std::pair< T, U > const &p)
void update(const BeginOfRun *) override
This routine will be called when the appropriate signal arrives.
def fac0(jeta)
marinas correction form
MonopoleSteppingAction(edm::ParameterSet const &p)
bool getData(T &iHolder) const
void beginRun(edm::EventSetup const &) override
~MonopoleSteppingAction() override