8 #include "G4Poisson.hh" 9 #include "G4ParticleDefinition.hh" 10 #include "G4NavigationHistory.hh" 13 #include "Randomize.hh" 15 #include <CLHEP/Units/SystemOfUnits.h> 35 <<
" Check photon survival in HF " <<
checkSurvive <<
" Gain " <<
gain <<
" useNewPMT " 44 const G4ParticleDefinition* pDef,
57 if (pBeta < (1 /
ref_index) || step_length < 0.0001) {
60 <<
" step_length " << step_length;
66 int nbOfPhotons =
computeNbOfPhotons(pBeta, step_length) * aStep->GetTrack()->GetWeight();
68 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: pBeta " << pBeta <<
" u/v/w " << u <<
"/" <<
v <<
"/" <<
w 69 <<
" step_length " << step_length <<
" zFib " << zFiber <<
" nbOfPhotons " 72 if (nbOfPhotons < 0) {
74 }
else if (nbOfPhotons > 0) {
75 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
76 const G4TouchableHandle& theTouchable = preStepPoint->GetTouchableHandle();
77 G4ThreeVector localprepos =
78 theTouchable->GetHistory()->GetTopTransform().TransformPoint(aStep->GetPreStepPoint()->GetPosition());
79 G4ThreeVector localpostpos =
80 theTouchable->GetHistory()->GetTopTransform().TransformPoint(aStep->GetPostStepPoint()->GetPosition());
82 double length =
std::sqrt((localpostpos.x() - localprepos.x()) * (localpostpos.x() - localprepos.x()) +
83 (localpostpos.y() - localprepos.y()) * (localpostpos.y() - localprepos.y()));
86 double u_ph = 0, v_ph = 0, w_ph = 0;
87 for (
int i = 0;
i < nbOfPhotons;
i++) {
88 double rand = G4UniformRand();
89 double theta_C = acos(1. / (pBeta *
ref_index));
90 double phi_C = 2 *
M_PI * rand;
91 double sinTheta =
sin(theta_C);
92 double cosTheta =
cos(theta_C);
101 u_ph = uv * cosTheta + sinTheta *
cosPhi *
w;
103 w_ph =
w * cosTheta - sinTheta *
cosPhi * uv;
105 double r_lambda = G4UniformRand();
107 double lambda = (lambda0 / CLHEP::cm) * 1.
e+7;
108 wlini.push_back(lambda);
110 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: " <<
i <<
" lambda " << lambda <<
" w_ph " << w_ph;
113 double xemit = length * (G4UniformRand() - 0.5);
114 double gam = atan2(yemit, xemit);
115 double eps = atan2(v_ph, u_ph);
116 double sinBeta =
sin(gam -
eps);
119 double cosEta =
std::sqrt(1. - sinEta * sinEta);
120 double sinPsi =
std::sqrt(1. - w_ph * w_ph);
121 double cosKsi = cosEta * sinPsi;
124 if (cosKsi < aperturetrapped && w_ph > 0.) {
125 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::Trapped photon : " << u_ph <<
" " << v_ph <<
" " << w_ph <<
" " 126 << xemit <<
" " << gam <<
" " <<
eps <<
" " << sinBeta <<
" " <<
rho <<
" " 127 << sinEta <<
" " << cosEta <<
" " 128 <<
" " << sinPsi <<
" " << cosKsi;
130 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::Rejected photon : " << u_ph <<
" " << v_ph <<
" " << w_ph <<
" " 131 << xemit <<
" " << gam <<
" " <<
eps <<
" " << sinBeta <<
" " <<
rho <<
" " 132 << sinEta <<
" " << cosEta <<
" " 133 <<
" " << sinPsi <<
" " << cosKsi;
140 double prob_HF = 1.0;
142 double a0_inv = 0.1234;
143 double a_inv = a0_inv + 0.14 *
pow(dose, 0.30);
144 double z_meters = zFiber;
145 prob_HF =
exp(-z_meters * a_inv);
147 rand = G4UniformRand();
149 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: probHF " << prob_HF <<
" Random " << rand
150 <<
" Survive? " << (rand < prob_HF);
152 if (rand < prob_HF) {
156 rand = G4UniformRand();
157 double phi = 0.5 *
M_PI * rand;
158 double rad_bundle = 19.;
160 rand = G4UniformRand();
161 double rad = rad_bundle *
std::sqrt(rand);
164 double length_lg = 430;
165 double sin_air = sinPsi * 1.46;
166 double tang = sin_air /
std::sqrt(1. - sin_air * sin_air);
167 int nbounce = length_lg / tlength * tang + 0.5;
168 double eff =
pow(effHEM, nbounce);
169 rand = G4UniformRand();
171 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: w_ph " << w_ph <<
" effHEM " << effHEM <<
" eff " 172 << eff <<
" Random " << rand <<
" Survive? " << (rand < eff);
175 wlhem.push_back(lambda);
177 rand = G4UniformRand();
179 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPE: qEffic " << qEffic <<
" Random " << rand
180 <<
" Survive? " << (rand < qEffic);
184 momZ.push_back(w_ph);
185 wl.push_back(lambda);
201 const G4ParticleDefinition* pDef,
double pBeta,
double u,
double v,
double w,
double step_length) {
207 if (pBeta < (1 /
ref_index) || step_length < 0.0001) {
210 <<
" step_length " << step_length;
218 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPEinPMT: pBeta " << pBeta <<
" u/v/w " << u <<
"/" <<
v <<
"/" 219 <<
w <<
" step_length " << step_length <<
" nbOfPhotons " << nbOfPhotons;
221 if (nbOfPhotons < 0) {
223 }
else if (nbOfPhotons > 0) {
225 for (
int i = 0;
i < nbOfPhotons;
i++) {
226 double rand = G4UniformRand();
227 double theta_C = acos(1. / (pBeta *
ref_index));
228 double phi_C = 2 *
M_PI * rand;
229 double sinTheta =
sin(theta_C);
230 double cosTheta =
cos(theta_C);
236 w_ph =
w * cosTheta - sinTheta *
cosPhi * uv;
238 double r_lambda = G4UniformRand();
240 double lambda = (lambda0 / CLHEP::cm) * 1.
e+7;
241 wlini.push_back(lambda);
243 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPEinPMT: " <<
i <<
" lambda " << lambda <<
" w_ph " << w_ph
248 rand = G4UniformRand();
250 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPEinPMT: Random " << rand <<
" Survive? " << (rand < 1.);
255 rand = G4UniformRand();
257 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPEinPMT: qEffic " << qEffic <<
" Random " << rand
258 <<
" Survive? " << (rand < qEffic);
262 momZ.push_back(w_ph);
263 wl.push_back(lambda);
271 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNPEinPMT: npe " << npe_;
277 std::vector<double>
v =
wlini;
282 std::vector<double>
v =
wltrap;
292 std::vector<double>
v =
wlhem;
297 std::vector<double>
v =
wlqeff;
302 std::vector<double>
v =
wl;
307 std::vector<double>
v =
momZ;
313 double alpha = 0.0073;
314 double step_length = stepL;
315 double theta_C = acos(1. / (pBeta *
ref_index));
317 double cherenPhPerLength = 2 *
M_PI *
alpha * lambdaDiff * CLHEP::cm;
318 double d_NOfPhotons = cherenPhPerLength *
sin(theta_C) *
sin(theta_C) * (step_length / CLHEP::cm);
319 int nbOfPhotons =
int(d_NOfPhotons);
321 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeNbOfPhotons: StepLength " << step_length <<
" theta_C " 322 << theta_C <<
" lambdaDiff " << lambdaDiff <<
" cherenPhPerLength " << cherenPhPerLength
323 <<
" Photons " << d_NOfPhotons <<
" " << nbOfPhotons;
331 if (wavelength <= 350) {
332 qeff = 2.45867 * (TMath::Landau(wavelength, 353.820, 59.1324));
333 }
else if (wavelength > 350 && wavelength < 500) {
334 qeff = 0.441989 *
exp(-
pow((wavelength - 358.371), 2) / (2 *
pow((138.277), 2)));
335 }
else if (wavelength >= 500 && wavelength < 550) {
336 qeff = 0.271862 *
exp(-
pow((wavelength - 491.505), 2) / (2 *
pow((47.0418), 2)));
337 }
else if (wavelength >= 550) {
338 qeff = 0.137297 *
exp(-
pow((wavelength - 520.260), 2) / (2 *
pow((75.5023), 2)));
341 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov:: for new PMT : wavelength === " << wavelength <<
"\tqeff ===\t" 345 double y = (wavelength - 275.) / 180.;
346 double func = 1. / (1. + 250. *
pow((
y / 5.), 4));
347 double qE_R7525 = 0.77 *
y *
exp(-
y) *
func;
350 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeQEff: wavelength " << wavelength <<
" y/func " <<
y <<
"/" 351 <<
func <<
" qeff " << qeff;
352 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov:: for old PMT : wavelength === " << wavelength <<
"; qeff = " << qeff;
360 if (wavelength < 400.) {
362 }
else if (wavelength >= 400. && wavelength < 410.) {
364 hEMEff = (-1322.453 / wavelength) + 4.2056;
365 }
else if (wavelength >= 410.) {
367 if (wavelength > 415. && wavelength < 445.) {
371 }
else if (wavelength > 550. && wavelength < 600.) {
375 }
else if (wavelength > 565. && wavelength <= 635.) {
377 hEMEff = (701.7268 / wavelength) - 0.186;
381 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::computeHEMEff: wavelength " << wavelength <<
" hEMEff " << hEMEff;
389 for (
int i = 0;
i < npe; ++
i) {
391 pe += (
val /
gain) + 0.001 * G4UniformRand();
395 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::smearNPE: npe " << npe <<
" pe " << pe;
411 bool tmp = (aParticleType->GetPDGCharge() != 0);
413 edm::LogVerbatim(
"HFShower") <<
"HFCherenkov::isApplicable: aParticleType " << aParticleType->GetParticleName()
414 <<
" PDGCharge " << aParticleType->GetPDGCharge() <<
" Result " <<
tmp;
Log< level::Info, true > LogVerbatim
double computeQEff(double wavelength)
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
HFCherenkov(edm::ParameterSet const &p)
std::vector< double > wlqeff
std::vector< double > wlini
double computeHEMEff(double wavelength)
double smearNPE(G4int Npe)
std::vector< double > getWL()
std::vector< double > getWLQEff()
std::vector< double > wltrap
Cos< T >::type cos(const T &t)
std::vector< double > wlhem
std::vector< double > getMom()
std::vector< double > getWLIni()
int computeNbOfPhotons(double pBeta, double step_length)
std::vector< double > getWLTrap()
std::vector< double > getWLAtten()
bool isApplicable(const G4ParticleDefinition *aParticleType)
std::vector< double > wlatten
int computeNPE(const G4Step *step, const G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length, double zFiber, double Dose, int Npe_Dose)
std::vector< double > momZ
int computeNPEinPMT(const G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length)
Power< A, B >::type pow(const A &a, const B &b)
std::vector< double > getWLHEM()