Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:28:31

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 //
0027 /// \file optical/LXe/include/LXeEventAction.hh
0028 /// \brief Definition of the LXeEventAction class
0029 //
0030 
0031 #ifndef LXeEventAction_h
0032 #define LXeEventAction_h 1
0033 
0034 #include "LXeEventMessenger.hh"
0035 
0036 #include "G4ThreeVector.hh"
0037 #include "G4UserEventAction.hh"
0038 #include "globals.hh"
0039 
0040 class G4Event;
0041 class LXeDetectorConstruction;
0042 
0043 class LXeEventAction : public G4UserEventAction
0044 {
0045   public:
0046     LXeEventAction(const LXeDetectorConstruction*);
0047     ~LXeEventAction() override;
0048 
0049     void BeginOfEventAction(const G4Event*) override;
0050     void EndOfEventAction(const G4Event*) override;
0051 
0052     void SetEventVerbose(G4int v) { fVerbose = v; }
0053 
0054     void SetPMTThreshold(G4int t) { fPMTThreshold = t; }
0055 
0056     void SetForceDrawPhotons(G4bool b) { fForcedrawphotons = b; }
0057     void SetForceDrawNoPhotons(G4bool b) { fForcenophotons = b; }
0058 
0059     void IncPhotonCount_Scint() { ++fPhotonCount_Scint; }
0060     void IncPhotonCount_Ceren() { ++fPhotonCount_Ceren; }
0061     void IncEDep(G4double dep) { fTotE += dep; }
0062     void IncAbsorption() { ++fAbsorptionCount; }
0063     void IncBoundaryAbsorption() { ++fBoundaryAbsorptionCount; }
0064     void IncHitCount(G4int i = 1) { fHitCount += i; }
0065 
0066     void SetEWeightPos(const G4ThreeVector& p) { fEWeightPos = p; }
0067     void SetReconPos(const G4ThreeVector& p) { fReconPos = p; }
0068     void SetConvPos(const G4ThreeVector& p)
0069     {
0070       fConvPos = p;
0071       fConvPosSet = true;
0072     }
0073     void SetPosMax(const G4ThreeVector& p, G4double edep)
0074     {
0075       fPosMax = p;
0076       fEdepMax = edep;
0077     }
0078 
0079     G4int GetPhotonCount_Scint() const { return fPhotonCount_Scint; }
0080     G4int GetPhotonCount_Ceren() const { return fPhotonCount_Ceren; }
0081     G4int GetHitCount() const { return fHitCount; }
0082     G4double GetEDep() const { return fTotE; }
0083     G4int GetAbsorptionCount() const { return fAbsorptionCount; }
0084     G4int GetBoundaryAbsorptionCount() const { return fBoundaryAbsorptionCount; }
0085 
0086     G4ThreeVector GetEWeightPos() { return fEWeightPos; }
0087     G4ThreeVector GetReconPos() { return fReconPos; }
0088     G4ThreeVector GetConvPos() { return fConvPos; }
0089     G4ThreeVector GetPosMax() { return fPosMax; }
0090     G4double GetEDepMax() { return fEdepMax; }
0091     G4double IsConvPosSet() { return fConvPosSet; }
0092 
0093     // Gets the total photon count produced
0094     G4int GetPhotonCount() { return fPhotonCount_Scint + fPhotonCount_Ceren; }
0095 
0096     void IncPMTSAboveThreshold() { ++fPMTsAboveThreshold; }
0097     G4int GetPMTSAboveThreshold() { return fPMTsAboveThreshold; }
0098 
0099   private:
0100     LXeEventMessenger* fEventMessenger = nullptr;
0101     const LXeDetectorConstruction* fDetector = nullptr;
0102 
0103     G4int fScintCollID = -1;
0104     G4int fPMTCollID = -1;
0105 
0106     G4int fVerbose = 0;
0107 
0108     G4int fPMTThreshold = 1;
0109 
0110     G4bool fForcedrawphotons = false;
0111     G4bool fForcenophotons = false;
0112 
0113     G4int fHitCount = 0;
0114     G4int fPhotonCount_Scint = 0;
0115     G4int fPhotonCount_Ceren = 0;
0116     G4int fAbsorptionCount = 0;
0117     G4int fBoundaryAbsorptionCount = 0;
0118 
0119     G4double fTotE = 0.;
0120 
0121     // These only have meaning if totE > 0
0122     // If totE = 0 then these won't be set by EndOfEventAction
0123     G4ThreeVector fEWeightPos;
0124     G4ThreeVector fReconPos;  // Also relies on hitCount>0
0125     G4ThreeVector fConvPos;  // true (initial) converstion position
0126     G4bool fConvPosSet = false;
0127     G4ThreeVector fPosMax;
0128     G4double fEdepMax = 0.;
0129 
0130     G4int fPMTsAboveThreshold = 0;
0131 };
0132 
0133 #endif