Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-28 07:50:59

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file WLSSteppingAction.hh
0027 /// \brief Definition of the WLSSteppingAction class
0028 
0029 #ifndef WLSSteppingAction_h
0030 #define WLSSteppingAction_h 1
0031 
0032 #include "G4Types.hh"
0033 #include "G4UserSteppingAction.hh"
0034 
0035 class WLSDetectorConstruction;
0036 class WLSSteppingActionMessenger;
0037 class WLSEventAction;
0038 
0039 class G4OpBoundaryProcess;
0040 class G4Track;
0041 class G4StepPoint;
0042 
0043 class WLSSteppingAction : public G4UserSteppingAction
0044 {
0045   public:
0046     WLSSteppingAction(WLSDetectorConstruction*, WLSEventAction*);
0047     ~WLSSteppingAction() override;
0048 
0049     void UserSteppingAction(const G4Step*) override;
0050 
0051     // Set the bounce limit, 0 for no limit
0052     void SetBounceLimit(G4int);
0053 
0054     G4int GetNumberOfBounces();
0055     G4int GetNumberOfClad1Bounces();
0056     G4int GetNumberOfClad2Bounces();
0057     G4int GetNumberOfWLSBounces();
0058     // return number of successful events and reset the counter
0059     G4int ResetSuccessCounter();
0060 
0061   private:
0062     // Artificially kill the photon after it has bounced more than this number
0063     G4int fBounceLimit = 100000;
0064     // number of photons that reach the end
0065     G4int fCounterEnd = 0;
0066     // number of photons that didn't make it to the end
0067     G4int fCounterMid = 0;
0068     // total number of bounces that a photon been through
0069     G4int fCounterBounce = 0;
0070     // number of bounces that a photon been through within the fibre
0071     G4int fCounterWLSBounce = 0;
0072     // number of bounces that a photon been through from Cladding 1 to 2
0073     G4int fCounterClad1Bounce = 0;
0074     // number of bounces that a photon been through from Cladding 2 to World
0075     G4int fCounterClad2Bounce = 0;
0076 
0077     // initial gamma of the photon
0078     G4double fInitGamma = -1.;
0079     // initial theta of the photon
0080     G4double fInitTheta = -1.;
0081 
0082     G4OpBoundaryProcess* fOpProcess = nullptr;
0083 
0084     WLSDetectorConstruction* fDetector = nullptr;
0085     WLSSteppingActionMessenger* fSteppingMessenger = nullptr;
0086     WLSEventAction* fEventAction = nullptr;
0087 
0088     inline void ResetCounters()
0089     {
0090       fCounterBounce = 0;
0091       fCounterWLSBounce = 0;
0092       fCounterClad1Bounce = 0;
0093       fCounterClad2Bounce = 0;
0094       fInitGamma = -1;
0095       fInitTheta = -1;
0096     }
0097 };
0098 
0099 #endif