16 #include "G4ParticleTable.hh" 20 #include "CLHEP/Units/GlobalPhysicalConstants.h" 21 #include "CLHEP/Units/GlobalSystemOfUnits.h" 25 edm::LogInfo(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction set mode for" 26 <<
" start at first step to " <<
mode;
39 <<
" Y: " << (bField->
inTesla(p)).
y() <<
" Z: " <<
bZ;
43 G4ParticleTable *partTable = G4ParticleTable::GetParticleTable();
45 for (
int ii = 0;
ii < partTable->size();
ii++) {
46 G4ParticleDefinition *particle = partTable->GetParticle(
ii);
48 if (strcmp(particleName.c_str(),
"Monopole") == 0) {
50 pdgCode.push_back(particle->GetPDGEncoding());
53 edm::LogInfo(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction Finds " <<
pdgCode.size() <<
" candidates";
60 edm::LogInfo(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction Constants:" 68 const G4Track *aTrack = (*trk)();
69 int code = aTrack->GetDefinition()->GetPDGEncoding();
72 eStart = aTrack->GetTotalEnergy();
73 pxStart = aTrack->GetMomentum().x();
74 pyStart = aTrack->GetMomentum().y();
75 pzStart = aTrack->GetMomentum().z();
76 dirxStart = aTrack->GetMomentumDirection().x();
77 diryStart = aTrack->GetMomentumDirection().y();
78 dirzStart = aTrack->GetMomentumDirection().z();
79 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction Track " << code <<
" Flag " <<
actOnTrack 88 double eT,
pT, pZ, tStep;
89 G4Track *aTrack = aStep->GetTrack();
90 G4ThreeVector initialPosition(0, 0, 0);
92 tStep = aTrack->GetGlobalTime();
97 const G4ThreeVector &dirStep = aTrack->GetMomentumDirection();
98 double lStep = aTrack->GetStepLength();
99 double xStep = aTrack->GetPosition().x() - lStep * dirStep.x();
100 double yStep = aTrack->GetPosition().y() - lStep * dirStep.y();
101 double zStep = aTrack->GetPosition().z() - lStep * dirStep.z();
102 double vStep = aTrack->GetVelocity();
103 initialPosition = G4ThreeVector(xStep, yStep, zStep);
104 tStep = (vStep > 0. ? (lStep / vStep) : 0.);
105 double eStep = aTrack->GetTotalEnergy();
106 eT = eStep * dirStep.perp();
107 pT = aTrack->GetMomentum().perp();
108 pZ = aTrack->GetMomentum().z();
110 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: tStep " << tStep <<
" eT " << eT <<
" pT " << pT <<
" pZ " 116 double eT2 = (eT1 > 0. ? (1. / eT1) : 0.);
118 double fac2 = pZ1 * cInMByS * eT2;
119 double fac1 = fac0 * cInMByS * ts1 * eT2 + fac2;
120 double fact1 = (eT1 / fac0) * (
std::sqrt(1 + fac1 * fac1) -
std::sqrt(1 + fac2 * fac2));
121 double fact2 = (pT1 / (
magCharge *
bZ) * (asinh(fac1) - asinh(fac2)));
122 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: Factor eT = " << eT <<
" " << eT1 <<
" " << eT2
123 <<
", pT = " << pT <<
" " << pT1 <<
", pZ = " << pZ <<
" " << pZ1
124 <<
", time = " << tStep <<
" " << ts1 <<
", Factors " << fac0 <<
" " << fac1 <<
" " 125 << fac2 <<
", Final ones " << fact1 <<
" " << fact2;
127 G4ThreeVector displacement = (fact1 * ez + fact2 *
et) *
CLHEP::m;
129 LogDebug(
"SimG4CoreWatcher") <<
"MonopoleSeppingAction: Initial " << initialPosition <<
" Displacement " 130 << displacement <<
" Final " << (initialPosition + displacement);
131 aTrack->SetPosition(initialPosition + displacement);
std::vector< int > pdgCode
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
MonopoleSteppingAction(edm::ParameterSet const &p)
void update(const BeginOfJob *) override
This routine will be called when the appropriate signal arrives.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
et
define resolution functions of each parameter
~MonopoleSteppingAction() override