Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:21

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 #ifndef EVENTACTION_HH
0027 #define EVENTACTION_HH
0028 
0029 #include "G4UserEventAction.hh"
0030 #include "G4Types.hh"
0031 
0032 #include <vector>
0033 
0034 class G4GenericMessenger;
0035 
0036 /**
0037  * @brief Event action class
0038  *
0039  * Fills ntuples with information about hits in sensitive detectors.
0040  *
0041  */
0042 
0043 class EventAction : public G4UserEventAction {
0044 public:
0045   EventAction();
0046   virtual ~EventAction();
0047 
0048   virtual void BeginOfEventAction(const G4Event *event);
0049   virtual void EndOfEventAction(const G4Event *event);
0050 
0051   /// Vector of primary particles in an event: PDG type
0052   std::vector<G4int> fPrimariesPDG;
0053   /// Vector of primary particles in an event: particle energy (in GeV)
0054   std::vector<G4double> fPrimariesEnergy;
0055   /// Vector of primary particles in an event: vertex position x (in cm)
0056   std::vector<G4double> fPrimariesX;
0057   /// Vector of primary particles in an event: vertex position y (in cm)
0058   std::vector<G4double> fPrimariesY;
0059   /// Vector of primary particles in an event: vertex position z (in cm)
0060   std::vector<G4double> fPrimariesZ;
0061 
0062   /// Vector of hits in silicon sensors: hit ID
0063   std::vector<G4int> fSiHitsID;
0064   /// Vector of hits in silicon sensors: hit position x (in cm)
0065   std::vector<G4double> fSiHitsX;
0066   /// Vector of hits in silicon sensors: hit position y (in cm)
0067   std::vector<G4double> fSiHitsY;
0068   /// Vector of hits in silicon sensors: hit position z (in cm)
0069   std::vector<G4double> fSiHitsZ;
0070   /// Vector of hits in silicon sensors: hit energy (in keV)
0071   std::vector<G4double> fSiHitsEdep;
0072   /// Vector of hits in silicon sensors: hit non-ionizing energy (in keV)
0073   std::vector<G4double> fSiHitsEdepNonIonising;
0074   /// Vector of hits in silicon sensors: hit time of arrival (in ns)
0075   /// calculated as global time of energy deposit which added to hit energy
0076   /// exceeds the toa threshold (by default threshold is 0, so it is the first
0077   /// deposit)
0078   std::vector<G4double> fSiHitsTOA;
0079   /// Vector of hits in silicon sensors: hit time of last arrival (in ns)
0080   /// calculated as global time of energy deposit which is the last deposit
0081   /// that fits within the digitisation time window (by default window is
0082   /// undefined, so it is the last deposit)
0083   std::vector<G4double> fSiHitsTOAlast;
0084   /// Vector of hits in silicon sensors: hit type
0085   /// Simulation defines only hits of type 0 (hexagonal cells, no calibration or
0086   /// edge cell is constructed)
0087   std::vector<G4int> fSiHitsType;
0088 
0089   /// Vector of hits in SiPM: hit ID
0090   std::vector<G4int> fSiPMhitsID;
0091   /// Vector of hits in SiPM: hit position x (in cm)
0092   std::vector<G4double> fSiPMhitsX;
0093   /// Vector of hits in SiPM: hit position y (in cm)
0094   std::vector<G4double> fSiPMhitsY;
0095   /// Vector of hits in SiPM: hit position z (in cm)
0096   std::vector<G4double> fSiPMhitsZ;
0097   /// Vector of hits in SiPM: hit energy (in keV)
0098   std::vector<G4double> fSiPMhitsEdep;
0099   /// Vector of hits in SiPM: hit non-ionizing energy (in keV)
0100   std::vector<G4double> fSiPMhitsEdepNonIonising;
0101   /// Vector of hits in SiPM: hit time of last arrival (in ns)
0102   /// calculated as global time of energy deposit which is the last deposit
0103   /// that fits within the digitisation time window (by default window is
0104   /// undefined, so it is the last deposit)
0105   std::vector<G4double> fSiPMhitsTOA;
0106   /// Vector of hits in silicon sensors: hit type
0107   /// Simulation defines only hits of type 1
0108   std::vector<G4int> fSiPMhitsType;
0109 
0110 private:
0111   /// Define UI commands: digitisation of hits with the time cut on deposits
0112   /// (time window), and the energy threshold for the first deposit counted as
0113   /// the time of arrival
0114   void DefineCommands();
0115   /// Pointer to the messenger for UI commands
0116   G4GenericMessenger *fMessenger = nullptr;
0117   /// Time window for hit digitisation (in ns)
0118   /// By default undefined window indicates the last created deposit will set up
0119   /// the time
0120   /// Can be changed by the UI command /HGCalTestbeam/hits/timeCut
0121   G4double fHitTimeCut = -1;
0122   /// Time of arrival threshold (in keV)
0123   /// Default value of 0 indicates the first created deposit will set up the
0124   /// time, independent on the amount of deposited energy
0125   /// Can be changed by the UI command /HGCalTestbeam/hits/toaThreshold
0126   G4double fToaThreshold = 0;
0127 };
0128 
0129 #endif /* EVENTACTION_HH */