WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimPMTQE.cc
Go to the documentation of this file.
1 // -*- mode:c++; tab-width:4; -*-
3 #include "WCSimPMTObject.hh"
4 #include "globals.hh"
5 #include "G4SystemOfUnits.hh"
6 #include "G4PhysicalConstants.hh"
7 
8 /***********************************************************
9  *
10  * This file contains the PMT QE as a function of
11  * wavelength for variety of PMTs. It is used in both the
12  * StackingAction and the sensitive detectors so it was
13  * put here (in WCSimDetectorConstruction) so both pieces of
14  * code would have access to it.
15  *
16  * Sourcefile for the WCSimDetectorConstruction class
17  *
18  ***********************************************************/
19 
20 
21 G4double WCSimDetectorConstruction::GetPMTQE(G4String CollectionName, G4double PhotonWavelength, G4int flag, G4double low_wl, G4double high_wl, G4double ratio){
22  // XQ 08/17/10
23  // Decide to include the QE in the WCSim detector
24  // rathe than hard coded into the StackingAction
25  // This way, one can load this QE in both the StackingAction
26  // and the sensitive detector.
27 
28  // flag
29  // flag == 0 return the maximum QE for all wave length
30  // flag == 1 return the actual QE for the wave length
31 
32 
33  // low_wl and high_wl
34  // remove any optical photons outside the range
35  // basically return QE = 0
36 
37  // ratio, fudge factor to increase QE for certain purpose
38 
39  // return 0 for wavelenght outside the range
40  if (flag==1){
41  if (PhotonWavelength <= low_wl || PhotonWavelength >= high_wl || PhotonWavelength <=280 || PhotonWavelength >=660){
42  return 0;
43  }
44  }else if (flag==0){
45  if (PhotonWavelength <= low_wl || PhotonWavelength >= high_wl){
46  return 0;
47  }
48  }
49 
50  WCSimPMTObject *PMT;
51  PMT = GetPMTPointer(CollectionName);
52  G4double *wavelength;
53  wavelength = PMT->GetQEWavelength();
54  G4double *QE;
55  QE = PMT->GetQE();
56  G4double maxQE;
57  maxQE = PMT->GetmaxQE();
58  G4double wavelengthQE = 0;
59 
60  if (flag == 1){
61  //MF: off by one bug fix.
62  for (int i=0; i<=18; i++){
63  if ( PhotonWavelength <= *(wavelength+(i+1))){
64  wavelengthQE = *(QE+i) +
65  (*(QE+(i+1))-*(QE+i))/(*(wavelength+(i+1))-*(wavelength+i))*
66  (PhotonWavelength - *(wavelength+i));
67  break;
68  }
69  }
70  }else if (flag == 0){
71  wavelengthQE = maxQE;
72  }
73  wavelengthQE = wavelengthQE *ratio;
74 
75  return wavelengthQE;
76 }
77 
78 
79 
80 
virtual G4double * GetQE()=0
G4double GetPMTQE(G4String, G4double, G4int, G4double, G4double, G4double)
Definition: WCSimPMTQE.cc:21
virtual G4double * GetQEWavelength()=0
WCSimPMTObject * GetPMTPointer(G4String CollectionName)
virtual G4double GetmaxQE()=0