CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
HFCherenkov Class Reference

#include <HFCherenkov.h>

Public Member Functions

void clearVectors ()
 
int computeNPE (G4Step *step, G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length, double zFiber, double Dose, int Npe_Dose)
 
int computeNPEinPMT (G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length)
 
int computeNPhTrapped (double pBeta, double u, double v, double w, double step_length, double zFiber, double Dose, int Npe_Dose)
 
std::vector< double > getMom ()
 
std::vector< double > getWL ()
 
std::vector< double > getWLAtten ()
 
std::vector< double > getWLHEM ()
 
std::vector< double > getWLIni ()
 
std::vector< double > getWLQEff ()
 
std::vector< double > getWLTrap ()
 
 HFCherenkov (edm::ParameterSet const &p)
 
double smearNPE (G4int Npe)
 
virtual ~HFCherenkov ()
 

Private Member Functions

double computeHEMEff (double wavelength)
 
int computeNbOfPhotons (double pBeta, double step_length)
 
double computeQEff (double wavelength)
 
bool isApplicable (const G4ParticleDefinition *aParticleType)
 

Private Attributes

double aperture
 
double apertureTrap
 
double aperturetrapped
 
bool checkSurvive
 
double fibreR
 
double gain
 
double lambda1
 
double lambda2
 
std::vector< double > momZ
 
G4ThreeVector phMom
 
double ref_index
 
double sinPsimax
 
bool UseNewPMT
 
std::vector< double > wl
 
std::vector< double > wlatten
 
std::vector< double > wlhem
 
std::vector< double > wlini
 
std::vector< double > wlqeff
 
std::vector< double > wltrap
 

Detailed Description

Definition at line 19 of file HFCherenkov.h.

Constructor & Destructor Documentation

HFCherenkov::HFCherenkov ( edm::ParameterSet const &  p)

Definition at line 15 of file HFCherenkov.cc.

References aperture, apertureTrap, aperturetrapped, checkSurvive, clearVectors(), funct::cos(), fibreR, gain, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), lambda1, lambda2, funct::pow(), ref_index, sinPsimax, and UseNewPMT.

15  {
16 
17  ref_index = m_HF.getParameter<double>("RefIndex");
18  lambda1 = ((m_HF.getParameter<double>("Lambda1"))/pow(double(10),7))*cm;
19  lambda2 = ((m_HF.getParameter<double>("Lambda2"))/pow(double(10),7))*cm;
20  aperture = cos(asin(m_HF.getParameter<double>("Aperture")));
21  apertureTrap = cos(asin(m_HF.getParameter<double>("ApertureTrapped")));
22  aperturetrapped = m_HF.getParameter<double>("CosApertureTrapped");
23  gain = m_HF.getParameter<double>("Gain");
24  checkSurvive = m_HF.getParameter<bool>("CheckSurvive");
25  UseNewPMT = m_HF.getParameter<bool>("UseR7600UPMT");
26  sinPsimax = m_HF.getUntrackedParameter<double>("SinPsiMax",0.5);
27  fibreR = m_HF.getUntrackedParameter<double>("FibreR",0.3)*mm;
28 
29  edm::LogInfo("HFShower") << "HFCherenkov:: initialised with ref_index "
30  << ref_index << " lambda1/lambda2 (cm) "
31  << lambda1/cm << "|" << lambda2/cm
32  << " aperture(total/trapped) " << aperture << "|"
33  << apertureTrap << "|" << aperturetrapped
34  << " Check photon survival in HF " << checkSurvive
35  << " Gain " << gain << " useNewPMT " << UseNewPMT
36  << " FibreR " << fibreR;
37 
38  clearVectors();
39 }
double fibreR
Definition: HFCherenkov.h:63
double aperturetrapped
Definition: HFCherenkov.h:62
void clearVectors()
Definition: HFCherenkov.cc:444
bool UseNewPMT
Definition: HFCherenkov.h:65
double sinPsimax
Definition: HFCherenkov.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double aperture
Definition: HFCherenkov.h:62
double apertureTrap
Definition: HFCherenkov.h:62
double gain
Definition: HFCherenkov.h:63
double lambda1
Definition: HFCherenkov.h:61
double lambda2
Definition: HFCherenkov.h:61
bool checkSurvive
Definition: HFCherenkov.h:64
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double ref_index
Definition: HFCherenkov.h:60
HFCherenkov::~HFCherenkov ( )
virtual

Definition at line 41 of file HFCherenkov.cc.

41 {}

Member Function Documentation

void HFCherenkov::clearVectors ( )

Definition at line 444 of file HFCherenkov.cc.

References momZ, wl, wlatten, wlhem, wlini, wlqeff, and wltrap.

Referenced by computeNPE(), computeNPEinPMT(), and HFCherenkov().

444  {
445 
446  wl.clear();
447  wlini.clear();
448  wltrap.clear();
449  wlatten.clear();
450  wlhem.clear();
451  wlqeff.clear();
452  momZ.clear();
453 }
std::vector< double > wlqeff
Definition: HFCherenkov.h:74
std::vector< double > wlini
Definition: HFCherenkov.h:70
std::vector< double > wltrap
Definition: HFCherenkov.h:71
std::vector< double > wlhem
Definition: HFCherenkov.h:73
std::vector< double > wlatten
Definition: HFCherenkov.h:72
std::vector< double > momZ
Definition: HFCherenkov.h:69
std::vector< double > wl
Definition: HFCherenkov.h:68
double HFCherenkov::computeHEMEff ( double  wavelength)
private

Definition at line 399 of file HFCherenkov.cc.

References LogDebug.

Referenced by computeNPE().

399  {
400 
401  double hEMEff = 0;
402  if (wavelength < 400.) {
403  hEMEff = 0.;
404  } else if (wavelength >= 400. && wavelength < 410.) {
405  //hEMEff = .99 * (wavelength - 400.) / 10.;
406  hEMEff = (-1322.453 / wavelength) + 4.2056;
407  } else if (wavelength >= 410.) {
408  hEMEff = 0.99;
409  if (wavelength > 415. && wavelength < 445.) {
410  //abs(wavelength - 430.) < 15.
411  //hEMEff = 0.95;
412  hEMEff = 0.97;
413  } else if (wavelength > 550. && wavelength < 600.) {
414  // abs(wavelength - 575.) < 25.)
415  //hEMEff = 0.96;
416  hEMEff = 0.98;
417  } else if (wavelength > 565. && wavelength <= 635.) { // added later
418  // abs(wavelength - 600.) < 35.)
419  hEMEff = (701.7268 / wavelength) - 0.186;
420  }
421  }
422 #ifdef DebugLog
423  LogDebug("HFShower") << "HFCherenkov::computeHEMEff: wavelength "
424  << wavelength << " hEMEff " << hEMEff;
425 #endif
426  return hEMEff;
427 }
#define LogDebug(id)
int HFCherenkov::computeNbOfPhotons ( double  pBeta,
double  step_length 
)
private

Definition at line 344 of file HFCherenkov.cc.

References alpha, beta, lambda1, lambda2, LogDebug, M_PI, ref_index, and funct::sin().

Referenced by computeNPE(), computeNPEinPMT(), and computeNPhTrapped().

344  {
345 
346  double pBeta = beta;
347  double alpha = 0.0073;
348  double step_length = stepL;
349  double theta_C = acos(1./(pBeta*ref_index));
350  double lambdaDiff = (1./lambda1 - 1./lambda2);
351  double cherenPhPerLength = 2 * M_PI * alpha * lambdaDiff*cm;
352  double d_NOfPhotons = cherenPhPerLength * sin(theta_C)*sin(theta_C) * (step_length/cm);
353  int nbOfPhotons = int(d_NOfPhotons);
354 #ifdef DebugLog
355  LogDebug("HFShower") << "HFCherenkov::computeNbOfPhotons: StepLength "
356  << step_length << " theta_C " << theta_C
357  << " lambdaDiff " << lambdaDiff
358  << " cherenPhPerLength " << cherenPhPerLength
359  << " Photons " << d_NOfPhotons << " " << nbOfPhotons;
360 #endif
361  return nbOfPhotons;
362 }
#define LogDebug(id)
const double beta
float alpha
Definition: AMPTWrapper.h:95
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI
Definition: BFit3D.cc:3
double lambda1
Definition: HFCherenkov.h:61
double lambda2
Definition: HFCherenkov.h:61
double ref_index
Definition: HFCherenkov.h:60
int HFCherenkov::computeNPE ( G4Step *  step,
G4ParticleDefinition *  pDef,
double  pBeta,
double  u,
double  v,
double  w,
double  step_length,
double  zFiber,
double  Dose,
int  Npe_Dose 
)

Definition at line 79 of file HFCherenkov.cc.

References aperture, aperturetrapped, checkSurvive, clearVectors(), computeHEMEff(), computeNbOfPhotons(), computeQEff(), funct::cos(), create_public_lumi_plots::exp, fibreR, gam, i, isApplicable(), lambda1, lambda2, LogDebug, M_PI, momZ, funct::pow(), rand(), ref_index, rho, funct::sin(), sinPsimax, mathSSE::sqrt(), w(), wl, wlatten, wlhem, wlini, wlqeff, and wltrap.

Referenced by HFShower::getHits().

82  {
83 
84  clearVectors();
85  if (!isApplicable(pDef)) {return 0;}
86  if (pBeta < (1/ref_index) || step_length < 0.0001) {
87 #ifdef DebugLog
88  LogDebug("HFShower") << "HFCherenkov::computeNPE: pBeta " << pBeta
89  << " 1/mu " << (1/ref_index) << " step_length "
90  << step_length;
91 #endif
92  return 0;
93  }
94 
95  double uv = sqrt(u*u + v*v);
96  int nbOfPhotons = computeNbOfPhotons(pBeta, step_length)
97  *aStep->GetTrack()->GetWeight();
98 #ifdef DebugLog
99  LogDebug("HFShower") << "HFCherenkov::computeNPE: pBeta " << pBeta
100  << " u/v/w " << u << "/" << v << "/" << w
101  << " step_length " << step_length << " zFib " << zFiber
102  << " nbOfPhotons " << nbOfPhotons;
103 #endif
104  if (nbOfPhotons < 0) {
105  return 0;
106  } else if (nbOfPhotons > 0) {
107  G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
108  G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
109  G4ThreeVector localprepos = theTouchable->GetHistory()->
110  GetTopTransform().TransformPoint(aStep->GetPreStepPoint()->GetPosition());
111  G4ThreeVector localpostpos = theTouchable->GetHistory()->
112  GetTopTransform().TransformPoint(aStep->GetPostStepPoint()->GetPosition());
113 
114  double length=sqrt((localpostpos.x()-localprepos.x())*(localpostpos.x()-localprepos.x())
115  +(localpostpos.y()-localprepos.y())*(localpostpos.y()-localprepos.y()));
116  double yemit = std::sqrt(fibreR*fibreR-length*length/4.);
117 
118  double u_ph=0,v_ph=0, w_ph=0;
119  for (int i = 0; i < nbOfPhotons; i++) {
120  double rand = G4UniformRand();
121  double theta_C = acos(1./(pBeta*ref_index));
122  double phi_C = 2*M_PI*rand;
123  double sinTheta = sin(theta_C);
124  double cosTheta = cos(theta_C);
125  double cosPhi = cos(phi_C);
126  double sinPhi = sin(phi_C);
127  //photon momentum
128  if (uv < 0.001) { // aligned with z-axis
129  u_ph = sinTheta * cosPhi ;
130  v_ph = sinTheta * sinPhi;
131  w_ph = cosTheta;
132  } else { // general case
133  u_ph = uv * cosTheta + sinTheta * cosPhi * w;
134  v_ph = sinTheta * sinPhi;
135  w_ph = w * cosTheta - sinTheta * cosPhi * uv;
136  }
137  double r_lambda = G4UniformRand();
138  double lambda0 = (lambda1 * lambda2) / (lambda2 - r_lambda *
139  (lambda2 - lambda1));
140  double lambda = (lambda0/cm) * pow(double(10),7); // lambda is in nm
141  wlini.push_back(lambda);
142 #ifdef DebugLog
143  LogDebug("HFShower") << "HFCherenkov::computeNPE: " << i << " lambda "
144  << lambda << " w_ph " << w_ph << " aperture "
145  << aperture;
146 #endif
147 // --------------
148  double xemit=length*(G4UniformRand()-0.5);
149  double gam=atan2(yemit,xemit);
150  double eps=atan2(v_ph,u_ph);
151  double sinBeta=sin(gam-eps);
152  double rho=sqrt(xemit*xemit+yemit*yemit);
153  double sinEta=rho/fibreR*sinBeta;
154  double cosEta=sqrt(1.-sinEta*sinEta);
155  double sinPsi=sqrt(1.-w_ph*w_ph);
156  double cosKsi=cosEta*sinPsi;
157 #ifdef DebugLog
158  if (cosKsi < aperturetrapped && w_ph>0.) {
159  LogDebug("HFShower") << "HFCherenkov::Trapped photon : " << u_ph << " "
160  << v_ph << " " << w_ph << " " << xemit << " "
161  << gam << " " << eps << " " << sinBeta << " "
162  << rho << " " << sinEta << " " << cosEta << " "
163  << " " << sinPsi << " " << cosKsi;
164  } else {
165  LogDebug("HFShower") << "HFCherenkov::Rejected photon : " << u_ph <<" "
166  << v_ph << " " << w_ph << " " << xemit << " "
167  << gam << " " << eps << " " << sinBeta << " "
168  << rho << " " << sinEta << " " << cosEta << " "
169  << " " << sinPsi << " " << cosKsi;
170  }
171 #endif
172  if (cosKsi < aperturetrapped // photon trapped inside fiber
173  && w_ph>0. // and moves to PMT
174  && sinPsi < sinPsimax) { // and is not reflected at fiber end
175  wltrap.push_back(lambda);
176  double prob_HF = 1.0; //photon survived in HF
177  double a0_inv = 0.1234; //meter^-1
178  double prob_MX = exp( - 0.5 * a0_inv ); //light mixer
179  if (checkSurvive) {
180  double a_inv = a0_inv + 0.14 * pow(dose,0.30);
181  double z_meters = zFiber;
182  prob_HF = exp(-z_meters * a_inv ); //photon survived in HF
183  }
184  rand = G4UniformRand();
185 #ifdef DebugLog
186  LogDebug("HFShower") << "HFCherenkov::computeNPE: probHF " << prob_HF
187  << " prob_MX " << prob_MX << " Random " << rand
188  << " Survive? " << (rand < (prob_HF * prob_MX));
189 #endif
190  if (rand < (prob_HF * prob_MX)) { // survived and sent to light mixer
191  wlatten.push_back(lambda);
192  rand = G4UniformRand();
193  double effHEM = computeHEMEff(lambda);
194 #ifdef DebugLog
195  LogDebug("HFShower") << "HFCherenkov::computeNPE: w_ph " << w_ph
196  << " effHEM " << effHEM << " Random " << rand
197  << " Survive? " << (w_ph>0.997||(rand<effHEM));
198 #endif
199  if (w_ph>0.997 || (rand<effHEM)) { // survived HEM
200  wlhem.push_back(lambda);
201  double qEffic = computeQEff(lambda);
202  rand = G4UniformRand();
203 #ifdef DebugLog
204  LogDebug("HFShower") << "HFCherenkov::computeNPE: qEffic "
205  << qEffic << " Random " << rand
206  << " Survive? " <<(rand < qEffic);
207 #endif
208  if (rand < qEffic) { // made photoelectron
209  npe_Dose += 1;
210  momZ.push_back(w_ph);
211  wl.push_back(lambda);
212  wlqeff.push_back(lambda);
213  } // made pe
214  } // passed HEM
215  } // passed fiber
216  } // end of if(w_ph < w_aperture), trapped inside fiber
217  }// end of ++NbOfPhotons
218  } // end of if(NbOfPhotons)}
219  int npe = npe_Dose; // Nb of photoelectrons
220 #ifdef DebugLog
221  LogDebug("HFShower") << "HFCherenkov::computeNPE: npe " << npe;
222 #endif
223  return npe;
224 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double computeQEff(double wavelength)
Definition: HFCherenkov.cc:364
double fibreR
Definition: HFCherenkov.h:63
double aperturetrapped
Definition: HFCherenkov.h:62
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
std::vector< double > wlqeff
Definition: HFCherenkov.h:74
void clearVectors()
Definition: HFCherenkov.cc:444
std::vector< double > wlini
Definition: HFCherenkov.h:70
double computeHEMEff(double wavelength)
Definition: HFCherenkov.cc:399
double sinPsimax
Definition: HFCherenkov.h:63
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< double > wltrap
Definition: HFCherenkov.h:71
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double aperture
Definition: HFCherenkov.h:62
std::vector< double > wlhem
Definition: HFCherenkov.h:73
#define M_PI
Definition: BFit3D.cc:3
int computeNbOfPhotons(double pBeta, double step_length)
Definition: HFCherenkov.cc:344
Signal rand(Signal arg)
Definition: vlib.cc:442
bool isApplicable(const G4ParticleDefinition *aParticleType)
Definition: HFCherenkov.cc:455
std::vector< double > wlatten
Definition: HFCherenkov.h:72
T w() const
double lambda1
Definition: HFCherenkov.h:61
double lambda2
Definition: HFCherenkov.h:61
bool checkSurvive
Definition: HFCherenkov.h:64
std::vector< double > momZ
Definition: HFCherenkov.h:69
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double ref_index
Definition: HFCherenkov.h:60
std::vector< double > wl
Definition: HFCherenkov.h:68
int HFCherenkov::computeNPEinPMT ( G4ParticleDefinition *  pDef,
double  pBeta,
double  u,
double  v,
double  w,
double  step_length 
)

Definition at line 226 of file HFCherenkov.cc.

References aperture, clearVectors(), computeNbOfPhotons(), computeQEff(), funct::cos(), i, isApplicable(), lambda1, lambda2, LogDebug, M_PI, momZ, funct::pow(), rand(), ref_index, funct::sin(), mathSSE::sqrt(), wl, wlatten, wlini, wlqeff, and wltrap.

Referenced by HFShowerFibreBundle::getHits(), and HFShowerPMT::getHits().

228  {
229  clearVectors();
230  int npe_ = 0;
231  if (!isApplicable(pDef)) {return 0;}
232  if (pBeta < (1/ref_index) || step_length < 0.0001) {
233 #ifdef DebugLog
234  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: pBeta " << pBeta
235  << " 1/mu " << (1/ref_index) << " step_length "
236  << step_length;
237 #endif
238  return 0;
239  }
240 
241  double uv = sqrt(u*u + v*v);
242  int nbOfPhotons = computeNbOfPhotons(pBeta, step_length);
243 #ifdef DebugLog
244  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: pBeta " << pBeta
245  << " u/v/w " << u << "/" << v << "/" << w
246  << " step_length " << step_length
247  << " nbOfPhotons " << nbOfPhotons;
248 #endif
249  if (nbOfPhotons < 0) {
250  return 0;
251  } else if (nbOfPhotons > 0) {
252  double w_ph=0;
253  for (int i = 0; i < nbOfPhotons; i++) {
254  double rand = G4UniformRand();
255  double theta_C = acos(1./(pBeta*ref_index));
256  double phi_C = 2*M_PI*rand;
257  double sinTheta = sin(theta_C);
258  double cosTheta = cos(theta_C);
259  double cosPhi = cos(phi_C);
260  //photon momentum
261  if (uv < 0.001) { // aligned with z-axis
262  w_ph = cosTheta;
263  } else { // general case
264  w_ph = w * cosTheta - sinTheta * cosPhi * uv;
265  }
266  double r_lambda = G4UniformRand();
267  double lambda0 = (lambda1 * lambda2) / (lambda2 - r_lambda *
268  (lambda2 - lambda1));
269  double lambda = (lambda0/cm) * pow(double(10),7); // lambda is in nm
270  wlini.push_back(lambda);
271 #ifdef DebugLog
272  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: " <<i <<" lambda "
273  << lambda << " w_ph " << w_ph << " aperture "
274  << aperture;
275 #endif
276  if (w_ph > aperture) { // phton trapped inside PMT glass
277  wltrap.push_back(lambda);
278  rand = G4UniformRand();
279 #ifdef DebugLog
280  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: Random " << rand
281  << " Survive? " << (rand < 1.);
282 #endif
283  if (rand < 1.0) { // survived all the times and sent to photo-cathode
284  wlatten.push_back(lambda);
285  rand = G4UniformRand();
286  double qEffic = computeQEff(lambda);//Quantum efficiency of the PMT
287  rand = G4UniformRand();
288 #ifdef DebugLog
289  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: qEffic "
290  << qEffic << " Random " << rand
291  << " Survive? " <<(rand < qEffic);
292 #endif
293  if (rand < qEffic) { // made photoelectron
294  npe_ += 1;
295  momZ.push_back(w_ph);
296  wl.push_back(lambda);
297  wlqeff.push_back(lambda);
298  } // made pe
299  } // accepted all Cherenkov photons
300  } // end of if(w_ph < w_aperture), trapped inside glass
301  }// end of ++NbOfPhotons
302  } // end of if(NbOfPhotons)}
303 #ifdef DebugLog
304  LogDebug("HFShower") << "HFCherenkov::computeNPEinPMT: npe " << npe_;
305 #endif
306  return npe_;
307 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double computeQEff(double wavelength)
Definition: HFCherenkov.cc:364
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< double > wlqeff
Definition: HFCherenkov.h:74
void clearVectors()
Definition: HFCherenkov.cc:444
std::vector< double > wlini
Definition: HFCherenkov.h:70
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< double > wltrap
Definition: HFCherenkov.h:71
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double aperture
Definition: HFCherenkov.h:62
#define M_PI
Definition: BFit3D.cc:3
int computeNbOfPhotons(double pBeta, double step_length)
Definition: HFCherenkov.cc:344
Signal rand(Signal arg)
Definition: vlib.cc:442
bool isApplicable(const G4ParticleDefinition *aParticleType)
Definition: HFCherenkov.cc:455
std::vector< double > wlatten
Definition: HFCherenkov.h:72
T w() const
double lambda1
Definition: HFCherenkov.h:61
double lambda2
Definition: HFCherenkov.h:61
std::vector< double > momZ
Definition: HFCherenkov.h:69
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double ref_index
Definition: HFCherenkov.h:60
std::vector< double > wl
Definition: HFCherenkov.h:68
int HFCherenkov::computeNPhTrapped ( double  pBeta,
double  u,
double  v,
double  w,
double  step_length,
double  zFiber,
double  Dose,
int  Npe_Dose 
)

Definition at line 43 of file HFCherenkov.cc.

References apertureTrap, computeNbOfPhotons(), funct::cos(), i, M_PI, rand(), ref_index, funct::sin(), and mathSSE::sqrt().

46  {
47 
48  if (pBeta < (1/ref_index) || step_length < 0.0001) {return 0;}
49 
50  double uv = sqrt(u*u + v*v);
51  int nbOfPhotons = computeNbOfPhotons(pBeta, step_length);
52 
53  if (nbOfPhotons < 0) {
54  return 0;
55  } else if (nbOfPhotons > 0) {
56  double w_ph=0;
57  for (int i = 0; i < nbOfPhotons; i++) {
58  double rand = G4UniformRand();
59  double theta_C = acos(1./(pBeta*ref_index));
60  double phi_C = 2*M_PI*rand;
61  double sinTheta = sin(theta_C);
62  double cosTheta = cos(theta_C);
63  double cosPhi = cos(phi_C);
64  //photon momentum
65  if (uv < 0.001) { // aligned with z-axis
66  w_ph = cosTheta;
67  } else { // general case
68  w_ph = w * cosTheta - sinTheta * cosPhi * uv;
69  }
70  if (w_ph > apertureTrap) { // phton trapped inside fiber
71  npe_Dose += 1;
72  }
73  }
74  }
75  int n_photons = npe_Dose;
76  return n_photons;
77 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double apertureTrap
Definition: HFCherenkov.h:62
#define M_PI
Definition: BFit3D.cc:3
int computeNbOfPhotons(double pBeta, double step_length)
Definition: HFCherenkov.cc:344
Signal rand(Signal arg)
Definition: vlib.cc:442
T w() const
double ref_index
Definition: HFCherenkov.h:60
double HFCherenkov::computeQEff ( double  wavelength)
private

Definition at line 364 of file HFCherenkov.cc.

References create_public_lumi_plots::exp, LogDebug, funct::pow(), UseNewPMT, and detailsBasic3DVector::y.

Referenced by computeNPE(), and computeNPEinPMT().

364  {
365 
366  double qeff(0.);
367  if (UseNewPMT) {
368  if (wavelength<=350) {
369  qeff=2.45867*(TMath::Landau(wavelength,353.820,59.1324));
370  } else if (wavelength>350 && wavelength<500) {
371  qeff= 0.441989*exp(-pow((wavelength-358.371),2)/(2*pow((138.277),2)));
372  } else if (wavelength>=500 && wavelength<550) {
373  qeff= 0.271862*exp(-pow((wavelength-491.505),2)/(2*pow((47.0418),2)));
374  } else if (wavelength>=550) {
375  qeff= 0.137297*exp(-pow((wavelength-520.260),2)/(2*pow((75.5023),2)));
376  }
377 #ifdef DebugLog
378  LogDebug("HFShower") << "HFCherenkov:: for new PMT : wavelength === "
379  << wavelength << "\tqeff ===\t" << qeff;
380 #endif
381  } else {
382  double y = (wavelength - 275.) /180.;
383  double func = 1. / (1. + 250.*pow((y/5.),4));
384  double qE_R7525 = 0.77 * y * exp(-y) * func ;
385  qeff = qE_R7525;
386 #ifdef DebugLog
387  LogDebug("HFShower") << "HFCherenkov:: for old PMT : wavelength === "
388  << wavelength << "; qeff = " << qeff;
389 #endif
390  }
391 
392 #ifdef DebugLog
393  LogDebug("HFShower") << "HFCherenkov::computeQEff: wavelength " << wavelength
394  << " y/func " << y << "/" << func << " qeff " << qeff;
395 #endif
396  return qeff;
397 }
#define LogDebug(id)
bool UseNewPMT
Definition: HFCherenkov.h:65
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< double > HFCherenkov::getMom ( )

Definition at line 339 of file HFCherenkov.cc.

References momZ, and findQualityFiles::v.

Referenced by HFShower::getHits().

339  {
340  std::vector<double> v = momZ;
341  return v;
342 }
std::vector< double > momZ
Definition: HFCherenkov.h:69
std::vector< double > HFCherenkov::getWL ( )

Definition at line 334 of file HFCherenkov.cc.

References findQualityFiles::v, and wl.

Referenced by HFShower::getHits().

334  {
335  std::vector<double> v = wl;
336  return v;
337 }
std::vector< double > wl
Definition: HFCherenkov.h:68
std::vector< double > HFCherenkov::getWLAtten ( )

Definition at line 319 of file HFCherenkov.cc.

References findQualityFiles::v, and wlatten.

319  {
320  std::vector<double> v = wlatten;
321  return v;
322 }
std::vector< double > wlatten
Definition: HFCherenkov.h:72
std::vector< double > HFCherenkov::getWLHEM ( )

Definition at line 324 of file HFCherenkov.cc.

References findQualityFiles::v, and wlhem.

324  {
325  std::vector<double> v = wlhem;
326  return v;
327 }
std::vector< double > wlhem
Definition: HFCherenkov.h:73
std::vector< double > HFCherenkov::getWLIni ( )

Definition at line 309 of file HFCherenkov.cc.

References findQualityFiles::v, and wlini.

309  {
310  std::vector<double> v = wlini;
311  return v;
312 }
std::vector< double > wlini
Definition: HFCherenkov.h:70
std::vector< double > HFCherenkov::getWLQEff ( )

Definition at line 329 of file HFCherenkov.cc.

References findQualityFiles::v, and wlqeff.

329  {
330  std::vector<double> v = wlqeff;
331  return v;
332 }
std::vector< double > wlqeff
Definition: HFCherenkov.h:74
std::vector< double > HFCherenkov::getWLTrap ( )

Definition at line 314 of file HFCherenkov.cc.

References findQualityFiles::v, and wltrap.

314  {
315  std::vector<double> v = wltrap;
316  return v;
317 }
std::vector< double > wltrap
Definition: HFCherenkov.h:71
bool HFCherenkov::isApplicable ( const G4ParticleDefinition *  aParticleType)
private

Definition at line 455 of file HFCherenkov.cc.

References LogDebug, and tmp.

Referenced by computeNPE(), and computeNPEinPMT().

455  {
456  bool tmp = (aParticleType->GetPDGCharge() != 0);
457 #ifdef DebugLog
458  LogDebug("HFShower") << "HFCherenkov::isApplicable: aParticleType "
459  << aParticleType->GetParticleName() << " PDGCharge "
460  << aParticleType->GetPDGCharge() << " Result " << tmp;
461 #endif
462  return tmp;
463 }
#define LogDebug(id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double HFCherenkov::smearNPE ( G4int  Npe)

Definition at line 429 of file HFCherenkov.cc.

References gain, i, and LogDebug.

429  {
430 
431  double pe = 0.;
432  if (npe > 0) {
433  for (int i = 0; i < npe; ++i) {
434  double val = G4Poisson(gain);
435  pe += (val/gain) + 0.001*G4UniformRand();
436  }
437  }
438 #ifdef DebugLog
439  LogDebug("HFShower") << "HFCherenkov::smearNPE: npe " << npe << " pe " << pe;
440 #endif
441  return pe;
442 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double gain
Definition: HFCherenkov.h:63

Member Data Documentation

double HFCherenkov::aperture
private

Definition at line 62 of file HFCherenkov.h.

Referenced by computeNPE(), computeNPEinPMT(), and HFCherenkov().

double HFCherenkov::apertureTrap
private

Definition at line 62 of file HFCherenkov.h.

Referenced by computeNPhTrapped(), and HFCherenkov().

double HFCherenkov::aperturetrapped
private

Definition at line 62 of file HFCherenkov.h.

Referenced by computeNPE(), and HFCherenkov().

bool HFCherenkov::checkSurvive
private

Definition at line 64 of file HFCherenkov.h.

Referenced by computeNPE(), and HFCherenkov().

double HFCherenkov::fibreR
private

Definition at line 63 of file HFCherenkov.h.

Referenced by computeNPE(), and HFCherenkov().

double HFCherenkov::gain
private

Definition at line 63 of file HFCherenkov.h.

Referenced by HFCherenkov(), and smearNPE().

double HFCherenkov::lambda1
private

Definition at line 61 of file HFCherenkov.h.

Referenced by computeNbOfPhotons(), computeNPE(), computeNPEinPMT(), and HFCherenkov().

double HFCherenkov::lambda2
private

Definition at line 61 of file HFCherenkov.h.

Referenced by computeNbOfPhotons(), computeNPE(), computeNPEinPMT(), and HFCherenkov().

std::vector<double> HFCherenkov::momZ
private

Definition at line 69 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getMom().

G4ThreeVector HFCherenkov::phMom
private

Definition at line 67 of file HFCherenkov.h.

double HFCherenkov::ref_index
private
double HFCherenkov::sinPsimax
private

Definition at line 63 of file HFCherenkov.h.

Referenced by computeNPE(), and HFCherenkov().

bool HFCherenkov::UseNewPMT
private

Definition at line 65 of file HFCherenkov.h.

Referenced by computeQEff(), and HFCherenkov().

std::vector<double> HFCherenkov::wl
private

Definition at line 68 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getWL().

std::vector<double> HFCherenkov::wlatten
private

Definition at line 72 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getWLAtten().

std::vector<double> HFCherenkov::wlhem
private

Definition at line 73 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), and getWLHEM().

std::vector<double> HFCherenkov::wlini
private

Definition at line 70 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getWLIni().

std::vector<double> HFCherenkov::wlqeff
private

Definition at line 74 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getWLQEff().

std::vector<double> HFCherenkov::wltrap
private

Definition at line 71 of file HFCherenkov.h.

Referenced by clearVectors(), computeNPE(), computeNPEinPMT(), and getWLTrap().