#include // for the function 'exp()' #include "LGSteppingAction.hh" #include "LGDetectorConstruction.hh" #include "LGEventAction.hh" #include "G4StepStatus.hh" #include "G4Track.hh" #include "G4Step.hh" #include "G4ios.hh" #include "G4ParticleDefinition.hh" #include "G4Navigator.hh" #include "Randomize.hh" // parametrization of the quantum efficiency of the FEU-84-3 PMT tube // as polynomial order 5 #define A -2545.6 #define B 27.133 #define C -0.11521 #define D 2.45206E-04 #define E -2.60431E-07 #define F 1.09761E-10 G4int old=0; G4int cnt=0; G4ThreeVector photon_dir; G4ThreeVector photon_pos; G4ThreeVector photon_pos1; G4int flag1 = 0; G4int flag2 = 0; G4int flag3 = 0; G4int flag4 = 0; G4int tid = 0; LGSteppingAction::LGSteppingAction(LGEventAction* event_Act, G4double zLG, G4int qeff, TH1F **hist, TH2F **hist2d, G4int BendFirst ) : event_Action(event_Act), zGlass(zLG), QE(qeff), Spec(hist), Spec2d(hist2d), LGBendFirst(BendFirst){} LGSteppingAction::~LGSteppingAction() {;} void LGSteppingAction::UserSteppingAction(const G4Step* aStep) { //-------- 1. Get pre-step and post-step pointers G4StepPoint* pre_Step = aStep->GetPreStepPoint(); G4TouchableHandle pre_TouchHandle = pre_Step->GetTouchableHandle(); G4VPhysicalVolume* pre_Volume = pre_TouchHandle->GetVolume(); G4StepPoint* post_Step = aStep->GetPostStepPoint(); G4TouchableHandle post_TouchHandle = post_Step->GetTouchableHandle(); G4VPhysicalVolume* post_Volume = post_TouchHandle->GetVolume(); // primary particle stopped! => photon got absorbed if ((aStep->GetTrack()->GetTrackID()== 1)&& (aStep->GetTrack()->GetTrackStatus()!=fAlive)){ } // get impact angle of photon on lead glass-PMT interace surface //if (aStep->GetTrack()->GetDefinition()->GetParticleName()=="opticalphoton"){ //} G4bool VolumeTest = (pre_Volume != NULL) && (post_Volume != NULL); // 2. Check if the photon enters the light guide if (VolumeTest) { G4String particle_Name = aStep->GetTrack()->GetDefinition()->GetParticleName(); //G4cout<GetName()<<" "<GetName()<GetName() == "ScinBox") && (post_Volume->GetName() == "LGBox") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[0]->Fill(localPos.x(),localPos.y()); } } if (LGBendFirst){ // if the bending section of the light guide is first if ( (pre_Volume->GetName() == "LGBox") && (post_Volume->GetName() == "LGBendSection") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[1]->Fill(worldPos.x(),worldPos.y()); } } if ( (pre_Volume->GetName() == "LGBendSection") && (post_Volume->GetName() == "LGTappered") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[2]->Fill(localPos.x(),localPos.y()); } } if ( (pre_Volume->GetName() == "LGTappered") && (post_Volume->GetName() == "LGTub") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[3]->Fill(localPos.x(),localPos.y()); } } } else { // if the bending section of the light guide is after the tapered section if ( (pre_Volume->GetName() == "LGBox") && (post_Volume->GetName() == "LGTappered") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[1]->Fill(localPos.x(),localPos.y()); } } if ( (pre_Volume->GetName() == "LGTappered") && (post_Volume->GetName() == "LGBendSection") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[2]->Fill(worldPos.x(),worldPos.y()); } } if ( (pre_Volume->GetName() == "LGBendSection") && (post_Volume->GetName() == "LGTub") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[3]->Fill(localPos.x(),localPos.y()); } } } if ( (pre_Volume->GetName() == "LGTub") && (post_Volume->GetName() == "PMTGlass") ){ if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[4]->Fill(localPos.x(),localPos.y()); } } if ( (pre_Volume->GetName() == "PMTGlass") && (post_Volume->GetName() == "PMTCathode") ) { if (particle_Name == "opticalphoton"){ G4ThreeVector worldPos = post_Step->GetPosition(); G4ThreeVector localPos = post_TouchHandle->GetHistory()->GetTopTransform().TransformPoint(worldPos); Spec2d[5]->Fill(localPos.x(),localPos.y()); } } } }