Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:08

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 // Class description:
0027 //
0028 // This is a stack class used for transferring a sub-event.
0029 
0030 // Author: Makoto Asai (JLAB) - 23/Aug/23
0031 // --------------------------------------------------------------------
0032 #ifndef G4SubEvent_hh
0033 #define G4SubEvent_hh 1
0034 
0035 #include <vector>
0036 
0037 class G4Event;
0038 
0039 #include "G4StackedTrack.hh"
0040 #include "G4Types.hh"
0041 
0042 class G4SubEvent : public std::vector<G4StackedTrack>
0043 {
0044   public:
0045 
0046     G4SubEvent() = default;
0047     explicit G4SubEvent(G4int ty, std::size_t maxEnt)
0048       : fSubEventType(ty), fMaxEnt(maxEnt) {;}
0049    ~G4SubEvent();
0050   
0051     G4SubEvent& operator=(const G4SubEvent&) = delete;
0052     G4bool operator==(const G4SubEvent&) const = delete;
0053     G4bool operator!=(const G4SubEvent&) const = delete;
0054   
0055     inline void PushToStack(const G4StackedTrack& aStackedTrack)
0056     { push_back(aStackedTrack); }
0057     G4StackedTrack PopFromStack();
0058   
0059     void clearAndDestroy();
0060 
0061     inline G4int GetSubEventType() const { return fSubEventType; }
0062     inline std::size_t GetNTrack() const { return size(); }
0063     inline std::size_t GetMaxNTrack() const { return fMaxEnt; }
0064   
0065     G4double getTotalEnergy() const;
0066 
0067     // pointer to G4Event where this sub-event belongs to
0068     inline void SetEvent(G4Event* evt) { fpEvent = evt; }
0069     inline G4Event* GetEvent() const { return fpEvent; }
0070   
0071   private:
0072 
0073     G4int fSubEventType = -1;
0074     std::size_t fMaxEnt = 1000;
0075     G4Event* fpEvent = nullptr;
0076 
0077 };
0078 
0079 #endif