56 if (pBeta < (1 /
ref_index) || step_length < 0.0001) {
59 <<
" step_length " << step_length;
65 int nbOfPhotons =
computeNbOfPhotons(pBeta, step_length) * aStep->GetTrack()->GetWeight();
67 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: pBeta " << pBeta <<
" u/v/w " << u <<
"/" <<
v <<
"/" <<
w 68 <<
" step_length " << step_length <<
" zFib " << zFiber <<
" nbOfPhotons " 71 if (nbOfPhotons < 0) {
73 }
else if (nbOfPhotons > 0) {
74 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
75 const G4TouchableHandle& theTouchable = preStepPoint->GetTouchableHandle();
76 G4ThreeVector localprepos =
77 theTouchable->GetHistory()->GetTopTransform().TransformPoint(aStep->GetPreStepPoint()->GetPosition());
78 G4ThreeVector localpostpos =
79 theTouchable->GetHistory()->GetTopTransform().TransformPoint(aStep->GetPostStepPoint()->GetPosition());
81 double length =
std::sqrt((localpostpos.x() - localprepos.x()) * (localpostpos.x() - localprepos.x()) +
82 (localpostpos.y() - localprepos.y()) * (localpostpos.y() - localprepos.y()));
85 double u_ph = 0, v_ph = 0, w_ph = 0;
86 for (
int i = 0;
i < nbOfPhotons;
i++) {
87 double rand = G4UniformRand();
88 double theta_C = acos(1. / (pBeta *
ref_index));
89 double phi_C = 2 *
M_PI * rand;
90 double sinTheta =
sin(theta_C);
91 double cosTheta =
cos(theta_C);
100 u_ph = uv * cosTheta + sinTheta *
cosPhi *
w;
102 w_ph =
w * cosTheta - sinTheta *
cosPhi * uv;
104 double r_lambda = G4UniformRand();
106 double lambda = (lambda0 / CLHEP::cm) * 1.
e+7;
107 wlini.push_back(lambda);
109 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: " <<
i <<
" lambda " << lambda <<
" w_ph " << w_ph;
112 double xemit = length * (G4UniformRand() - 0.5);
113 double gam = atan2(yemit, xemit);
114 double eps = atan2(v_ph, u_ph);
115 double sinBeta =
sin(gam -
eps);
118 double cosEta =
std::sqrt(1. - sinEta * sinEta);
119 double sinPsi =
std::sqrt(1. - w_ph * w_ph);
120 double cosKsi = cosEta * sinPsi;
123 if (cosKsi < aperturetrapped && w_ph > 0.) {
124 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::Trapped photon : " << u_ph <<
" " << v_ph <<
" " << w_ph <<
" " 125 << xemit <<
" " << gam <<
" " <<
eps <<
" " << sinBeta <<
" " <<
rho <<
" " 126 << sinEta <<
" " << cosEta <<
" " 127 <<
" " << sinPsi <<
" " << cosKsi;
129 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::Rejected photon : " << u_ph <<
" " << v_ph <<
" " << w_ph <<
" " 130 << xemit <<
" " << gam <<
" " <<
eps <<
" " << sinBeta <<
" " <<
rho <<
" " 131 << sinEta <<
" " << cosEta <<
" " 132 <<
" " << sinPsi <<
" " << cosKsi;
139 double prob_HF = 1.0;
141 double a0_inv = 0.1234;
142 double a_inv = a0_inv + 0.14 *
pow(dose, 0.30);
143 double z_meters = zFiber;
144 prob_HF =
exp(-z_meters * a_inv);
146 rand = G4UniformRand();
148 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: probHF " << prob_HF <<
" Random " << rand
149 <<
" Survive? " << (rand < prob_HF);
151 if (rand < prob_HF) {
155 rand = G4UniformRand();
156 double phi = 0.5 *
M_PI * rand;
157 double rad_bundle = 19.;
159 rand = G4UniformRand();
160 double rad = rad_bundle *
std::sqrt(rand);
163 double length_lg = 430;
164 double sin_air = sinPsi * 1.46;
165 double tang = sin_air /
std::sqrt(1. - sin_air * sin_air);
166 int nbounce = length_lg / tlength * tang + 0.5;
167 double eff =
pow(effHEM, nbounce);
168 rand = G4UniformRand();
170 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: w_ph " << w_ph <<
" effHEM " << effHEM <<
" eff " 171 << eff <<
" Random " << rand <<
" Survive? " << (rand < eff);
174 wlhem.push_back(lambda);
176 rand = G4UniformRand();
178 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: qEffic " << qEffic <<
" Random " << rand
179 <<
" Survive? " << (rand < qEffic);
183 momZ.push_back(w_ph);
184 wl.push_back(lambda);
Log< level::Info, true > LogVerbatim
double computeQEff(double wavelength)
Sin< T >::type sin(const T &t)
std::vector< double > wlqeff
std::vector< double > wlini
double computeHEMEff(double wavelength)
std::vector< double > wltrap
Cos< T >::type cos(const T &t)
std::vector< double > wlhem
int computeNbOfPhotons(double pBeta, double step_length)
bool isApplicable(const G4ParticleDefinition *aParticleType)
std::vector< double > wlatten
std::vector< double > momZ
Power< A, B >::type pow(const A &a, const B &b)