Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:34

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 PAR04EVENTACTION_HH
0027 #define PAR04EVENTACTION_HH
0028 
0029 #include "G4Timer.hh"  // for G4Timer
0030 #include "G4UserEventAction.hh"  // for G4UserEventAction
0031 
0032 #include <G4Types.hh>  // for G4int, G4double
0033 #include <vector>  // for vector
0034 class G4Event;
0035 class Par04DetectorConstruction;
0036 class Par04ParallelFullWorld;
0037 
0038 /**
0039  * @brief Event action class for hits' analysis.
0040  *
0041  * Analysis of single-particle events and developed showers in the detector.
0042  * At the end of the event basic variables are calculated and saved in the
0043  * histograms.
0044  * Additionally ntuple with cell energies and IDs (in cylindrical coordinates) is stored.
0045  *
0046  */
0047 
0048 class Par04EventAction : public G4UserEventAction
0049 {
0050   public:
0051     Par04EventAction(Par04DetectorConstruction* aDetector, Par04ParallelFullWorld* aParallel);
0052     virtual ~Par04EventAction();
0053 
0054     /// Timer is started
0055     virtual void BeginOfEventAction(const G4Event* aEvent) final;
0056     /// Hits collection is retrieved, analysed, and histograms are filled.
0057     virtual void EndOfEventAction(const G4Event* aEvent) final;
0058     inline std::vector<G4double>& GetCalEdep() { return fCalEdep; }
0059     inline std::vector<G4int>& GetCalRho() { return fCalRho; }
0060     inline std::vector<G4int>& GetCalPhi() { return fCalPhi; }
0061     inline std::vector<G4int>& GetCalZ() { return fCalZ; }
0062     inline std::vector<G4double>& GetPhysicalCalEdep() { return fCalPhysicalEdep; }
0063     inline std::vector<G4int>& GetPhysicalCalLayer() { return fCalPhysicalLayer; }
0064     inline std::vector<G4int>& GetPhysicalCalSlice() { return fCalPhysicalSlice; }
0065     inline std::vector<G4int>& GetPhysicalCalRow() { return fCalPhysicalRow; }
0066     void StartTimer();
0067     void StopTimer();
0068 
0069   private:
0070     /// ID of a hit collection to analyse
0071     G4int fHitCollectionID = -1;
0072     G4int fPhysicalFullHitCollectionID = -1;
0073     G4int fPhysicalFastHitCollectionID = -1;
0074     /// Timer measurement from Geant4
0075     G4Timer fTimer;
0076     /// Pointer to detector construction to retrieve (once) the detector
0077     /// dimensions and size of readout
0078     Par04DetectorConstruction* fDetector = nullptr;
0079     Par04ParallelFullWorld* fParallel = nullptr;
0080     /// Size of cell along Z axis
0081     G4double fCellSizeZ = 0;
0082     /// Size of cell along radius of cylinder
0083     G4double fCellSizeRho = 0;
0084     /// Size of cell in azimuthal angle
0085     G4double fCellSizePhi = 0;
0086     /// Number of readout cells along radius
0087     G4int fCellNbRho = 0;
0088     /// Number of readout cells in azimuthal angle
0089     G4int fCellNbPhi = 0;
0090     /// Number of readout cells along z axis
0091     G4int fCellNbZ = 0;
0092     /// Number of physical readout layers
0093     G4int fPhysicalNbLayers = 0;
0094     /// Number of physical readout slices
0095     G4int fPhysicalNbSlices = 0;
0096     /// Number of physical readout rows
0097     G4int fPhysicalNbRows = 0;
0098     /// Cell energy deposits to be stored in ntuple
0099     std::vector<G4double> fCalEdep;
0100     /// Cell ID of radius to be stored in ntuple
0101     std::vector<G4int> fCalRho;
0102     /// Cell ID of azimuthal angle to be stored in ntuple
0103     std::vector<G4int> fCalPhi;
0104     /// Cell ID of z axis to be stored in ntuple
0105     std::vector<G4int> fCalZ;
0106     /// Physical cell energy deposits to be stored in ntuple
0107     std::vector<G4double> fCalPhysicalEdep;
0108     /// Physical layer ID to be stored in ntuple
0109     std::vector<G4int> fCalPhysicalLayer;
0110     /// Physical slice ID to be stored in ntuple
0111     std::vector<G4int> fCalPhysicalSlice;
0112     /// Physical row ID to be stored in ntuple
0113     std::vector<G4int> fCalPhysicalRow;
0114 };
0115 
0116 #endif /* PAR04EVENTACTION_HH */