WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimStackingAction.cc
Go to the documentation of this file.
1 #include "WCSimStackingAction.hh"
3 
4 #include "G4Track.hh"
5 #include "G4TrackStatus.hh"
6 #include "G4VProcess.hh"
7 #include "G4VPhysicalVolume.hh"
8 #include "Randomize.hh"
9 #include "G4Navigator.hh"
10 #include "G4TransportationManager.hh"
11 #include "G4ParticleDefinition.hh"
12 #include "G4ParticleTypes.hh"
13 
14 #include "G4PhysicalConstants.hh"
15 #include "G4SystemOfUnits.hh"
16 
17 //class WCSimDetectorConstruction;
18 
21 
22 
23 G4ClassificationOfNewTrack WCSimStackingAction::ClassifyNewTrack
24 (const G4Track* aTrack)
25 {
26  G4String WCIDCollectionName = DetConstruct->GetIDCollectionName();
27  G4ClassificationOfNewTrack classification = fWaiting;
28  G4ParticleDefinition* particleType = aTrack->GetDefinition();
29 
30 
31  // Make sure it is an optical photon
32  if( particleType == G4OpticalPhoton::OpticalPhotonDefinition() )
33  {
34  G4double photonWavelength = (2.0*M_PI*197.3)/(aTrack->GetTotalEnergy()/eV);
35  G4double ratio = 1./(1.0-0.25);
36  G4double wavelengthQE = 0;
37  if(aTrack->GetCreatorProcess()==NULL) {
38  wavelengthQE = DetConstruct->GetPMTQE(WCIDCollectionName,photonWavelength,1,240,660,ratio);
39  if( G4UniformRand() > wavelengthQE )
40  classification = fKill;
41  }
42  else if (((G4VProcess*)(aTrack->GetCreatorProcess()))->GetProcessType()!=3)
43  {
44  G4double photonWavelength = (2.0*M_PI*197.3)/(aTrack->GetTotalEnergy()/eV);
45  // MF : translated from skdetsim : better to increase the number of photons
46  // than to throw in a global factor at Digitization time !
47  G4double ratio = 1./(1.0-0.25);
48  // XQ: get the maximum QE and multiply it by the ratio
49  // only work for the range between 240 nm and 660 nm for now
50  // Even with WLS
51  G4double wavelengthQE = 0;
52  if (DetConstruct->GetPMT_QE_Method() == 1){
53  wavelengthQE = DetConstruct->GetPMTQE(WCIDCollectionName,photonWavelength,1,240,660,ratio);
54  }else if (DetConstruct->GetPMT_QE_Method() == 2){
55  wavelengthQE = DetConstruct->GetPMTQE(WCIDCollectionName,photonWavelength,0,240,660,ratio);
56  }else if (DetConstruct->GetPMT_QE_Method() == 3 || DetConstruct->GetPMT_QE_Method() == 4){
57  wavelengthQE = 1.1;
58  }
59 
60  if( G4UniformRand() > wavelengthQE )
61  classification = fKill;
62  }
63  }
64 
65  return classification;
66 }
67 
70 
WCSimStackingAction(WCSimDetectorConstruction *)
virtual void PrepareNewEvent()
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)