48 (fMapBendingAngle.count(crystalID) > 0)
53 (fMapMiscutAngle.count(crystalID) > 0)
59 (fMapCUAmplitudePeriodPhase.count(crystalID) > 0)
72 fMapBendingAngle[crystalID]=tetab;
90 G4cout <<
"Warning: bending angle is lower than 1 urad => set to 0" <<
G4endl;
113 G4cout <<
"Warning: bending angle is negative => set to be positive" <<
G4endl;
127 fMapMiscutAngle[crystalID]=tetam;
131 if (std::abs(tetam)>1.*CLHEP::mrad)
134 G4cout <<
"Warning: miscut angle is higher than 1 mrad => " <<
G4endl;
135 G4cout <<
"coordinate transformation routines may be unstable" <<
G4endl;
155 G4cout <<
"Warning: The crystalline undulator parameters are out of range "
156 "=> the crystalline undulator mode switched off" <<
G4endl;
169 fMapImportCrystalGeometry[crystalID] =
true;
176 std::ifstream vfilein;
177 vfilein.open(filename);
189 G4cout <<
"Importing the Crystal geometry from the file: "
204 "The interpolation of the crystalline undulator does not start from 0.! "
205 "The program will terminate.");
215 "The interpolation of the crystalline undulator does not end with at"
216 "the boundary of the volume => check the crystal thickness in z! "
217 "The program will terminate.");
224 for(std::size_t i=1; i<inodes-1; i++)
229 G4String message =
"The interpolation nodes in the file " + filename +
230 " are not equidistant! The program will terminate.";
246 for(std::size_t i=1; i<inodes-1; i++)
256 vecD.
PutValue(inodes-1,vecD[inodes-2]);
258 vecDD.
PutValue(inodes-1,vecDD[inodes-2]);
264 fVecCUx.push_back(vec);
265 fVecCUtetax.push_back(vecD);
266 fVecCUCurv.push_back(vecDD);
269 if(fMapCUID.count(crystalID) > 0)
274 "It is not allowed to set up the crystalline undulator geometry "
275 "the second time for the same logical volume! The program will terminate.");
280 fMapCUID[crystalID] = (
G4int)fVecCUx.size()-1;
298 fMapCUAmplitudePeriodPhase[crystalID]=amplitudePeriodPhase;
300 G4double period = amplitudePeriodPhase.
y();
304 fImportCrystalGeometry = (fMapImportCrystalGeometry.count(crystalID) > 0) ?
305 fMapImportCrystalGeometry[crystalID] :
314 fCUK = CLHEP::twopi/period;
322 G4cout <<
"Warning: crystalline undulator is not compatible with "
323 "a bent crystal mode => setting bending angle to 0." <<
G4endl;
328 if(fImportCrystalGeometry)
330 fCUID = fMapCUID[crystalID];
339 fMapCUAmplitudePeriodPhase[crystalID] =
G4ThreeVector(0.,0.,0.);
356 fParticleName=particleName;
363 fTetaL = std::sqrt(std::abs(fZ2)*
fVmax2/fPV);
368 fGamma = etotal/mass;
369 fMe2Gamma = 2*CLHEP::electron_mass_c2*fGamma;
371 fTmax = fMe2Gamma*fGamma*fV2/
372 (CLHEP::electron_mass_c2/mass*CLHEP::electron_mass_c2/mass +
373 1. + fMe2Gamma/mass);
375 if(fParticleName==
"e-"){fTmax/=2;}
420 G4double pv0 = etotal-mass*mass/etotal;
421 return std::sqrt(2*std::abs(charge)*
fVmax/pv0);
441 angle = std::abs(tx);
445 angle = std::sqrt(tx*tx+ty*ty);
451 simulationstep = fChannelingStep;
456 if (angle > 0.0) { simulationstep /= angle; }
459 return simulationstep;
496 if (teta122<=
fTeta12[ielement]*1.000125)
503 teta22=teta122-
fTeta12[ielement];
509 (1.-std::exp(-aa*
fBB[ielement]))/aa1+
511 (expint(
fBB[ielement]*aa1)-
fE1XBbb[ielement]));
519 t=std::sqrt(-tetamsi*
G4Log(ksi));
523 tx+=t*std::cos(CLHEP::twopi*ksi);
524 ty+=t*std::sin(CLHEP::twopi*ksi);
567 tx+=t*std::cos(CLHEP::twopi*ksi);
568 ty+=t*std::sin(CLHEP::twopi*ksi);
600 if (eMinIonization<0.5*CLHEP::eV){eMinIonization=0.5*CLHEP::eV;}
603 if ((eMinIonization<fTmax)&&(electronDensity>
DBL_EPSILON))
610 zss=-1.0*
G4Log(ksi)/(
fK3*electronDensity)/(1./eMinIonization-1./fTmax);
620 G4double e1=eMinIonization/(1.-ksi*(1.-eMinIonization/fTmax));
626 t=std::sqrt(2.*CLHEP::electron_mass_c2*e1*(1-e1/fTmax))/fPz;
633 tx+=t*std::cos(CLHEP::twopi*ksi);
634 ty+=t*std::sin(CLHEP::twopi*ksi);
642 zss=-1.0*
G4Log(ksi)/(
fK3*electronDensity)/(1./eMinIonization-1./fTmax);
661 if(delta<0.){delta=0.;}
663 if(fParticleName==
"e-")
665 loge+=(-
G4Log(2.) + 1.
666 -(2.*fGamma - 1.)/fGamma/fGamma*
G4Log(2.) +
667 1./8.*((fGamma - 1.)/fGamma)*((fGamma - 1.)/fGamma));
669 else if(fParticleName==
"e+")
671 loge+=(-fV2/12.*(11. + 14./(fGamma + 1.) + 10./(fGamma + 1.)/(fGamma + 1.) +
672 4./(fGamma + 1.)/(fGamma + 1.)/(fGamma + 1.)));
678 elosses=fZ2*fZ2*
fKD[ielement]/fV2*loge*dz;
705 for(
int K=1; K<=25; K++)
707 R=-R*K*X/std::pow(K+1.,2.);
709 if (std::abs(R)<=std::abs(E1)*1.0e-15) {
break;}
712 E1=-0.5772156649015328-
G4Log(X)+X*E1;
716 M=20+std::trunc(80.0/X);
719 for(
int K=
M; K>=1; K--)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Log(G4double x)
CLHEP::Hep3Vector G4ThreeVector
Definition of the G4VChannelingFastSimCrystalData class The class contains the data and properties re...
G4GLOB_DLL std::ostream G4cout
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
G4VSolid * GetSolid() const
G4int GetInstanceID() const
const G4String & GetName() const
void PutValue(const std::size_t index, const G4double value)
G4double GetMaxEnergy() const
G4double Energy(const std::size_t index) const
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)
G4double GetMinEnergy() const
std::size_t GetVectorLength() const
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
std::vector< G4double > fBB
std::vector< G4double > fI0
std::vector< G4double > fTeta12
G4double IonizationLosses(G4double dz, G4int ielement)
ionization losses
std::vector< G4double > fK20
coefficients necessary for multiple and single coulomb scattering
G4double GetLindhardAngle()
Calculate the value of the Lindhard angle (!!! the value for a straight crystal).
void SetGeometryParameters(const G4LogicalVolume *crystallogic)
set geometry parameters from current logical volume
std::vector< G4double > fK40
void SetCUParameters(const G4ThreeVector &litudePeriodPhase, const G4LogicalVolume *crystallogic)
G4double GetMaxSimulationStep(G4double etotal, G4double mass, G4double charge)
Calculate maximal simulation step (standard value for channeling particles).
std::vector< G4double > fPzu11
std::vector< G4double > fBBDEXP
std::vector< G4double > fLogPlasmaEdI0
void SetCrystallineUndulatorParameters(G4double amplitude, G4double period, G4double phase, const G4LogicalVolume *crystallogic)
G4ThreeVector fHalfDimBoundingBox
values related to the crystal geometry
G4double GetSimulationStep(G4double tx, G4double ty)
void SetBendingAngle(G4double tetab, const G4LogicalVolume *crystallogic)
std::vector< G4double > fKD
std::vector< G4double > fTetamax0
G4VChannelingFastSimCrystalData()
G4int fNelements
values related to the crystal lattice
G4ThreeVector CoulombElectronScattering(G4double eMinIonization, G4double electronDensity, G4double step)
multiple and single scattering on electrons
std::vector< G4double > fTeta10
angles necessary for multiple and single coulomb scattering
std::vector< G4double > fTetamax12
std::vector< G4double > fPu11
coefficients for multiple scattering suppression
G4ThreeVector CoulombAtomicScattering(G4double effectiveStep, G4double step, G4int ielement)
multiple and single scattering on screened potential
std::vector< G4double > fE1XBbb
std::vector< G4double > fTetamax2
std::vector< G4double > fK2
virtual ~G4VChannelingFastSimCrystalData()
void SetMiscutAngle(G4double tetam, const G4LogicalVolume *crystallogic)
void SetParticleProperties(G4double etotal, G4double mp, G4double charge, const G4String &particleName)
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const