Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4MCTEvent.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // G4MCTEvent
0027 
0028 // Author: Youhei Morita, 12.09.2001
0029 // --------------------------------------------------------------------
0030 #ifndef G4MCTEVENT_HH
0031 #define G4MCTEVENT_HH 1
0032 
0033 #include <iostream>
0034 #include <map>
0035 
0036 #include "G4Types.hh"
0037 #include "G4MCTGenParticle.hh"
0038 
0039 class G4MCTGenEvent;
0040 class G4MCTSimEvent;
0041 class G4MCTSimParticle;
0042 
0043 using MCTGen2SimParticleMap = std::map<G4MCTGenParticle, G4MCTSimParticle*>;
0044 using MCTSim2GenParticleMap = std::map<G4MCTSimParticle*, G4MCTGenParticle>;
0045 
0046 class G4MCTEvent
0047 {
0048   public:
0049 
0050     G4MCTEvent();
0051     virtual ~G4MCTEvent();
0052 
0053     inline G4MCTEvent(const G4MCTEvent& right);
0054     inline G4MCTEvent& operator=(const G4MCTEvent& right);
0055       // copy constructor and assignment operator
0056 
0057     inline void SetEventNumber(G4int n);
0058     inline G4int GetEventNumber() const;
0059       // set/get functions
0060 
0061     inline G4MCTGenEvent* GetGenEvent() const;
0062     inline G4MCTSimEvent* GetSimEvent() const;
0063 
0064     inline G4int GetNofPrimaries() const;
0065     G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
0066     G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
0067     G4int AddPrimaryPair(const G4MCTGenParticle& genp,
0068                         const G4MCTSimParticle* simp);
0069     void ClearEvent();
0070     void Print(std::ostream& ostr = std::cout) const;
0071 
0072     // iterators
0073 
0074     using genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator;
0075     inline genprimary_const_iterator genprimaries_begin() const;
0076     inline genprimary_const_iterator genprimaries_end() const;
0077 
0078     using simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator;
0079     inline simprimary_const_iterator simprimaries_begin() const;
0080     inline simprimary_const_iterator simprimaries_end() const;
0081 
0082   protected:
0083 
0084     G4int eventNumber = 0;
0085     G4MCTGenEvent* genEvent = nullptr;
0086     G4MCTSimEvent* simEvent = nullptr;
0087 
0088     // primary table (bidirectional)
0089     MCTGen2SimParticleMap gen2simParticleMap;
0090     MCTSim2GenParticleMap sim2genParticleMap;
0091 };
0092 
0093 // ====================================================================
0094 // inline methods
0095 // ====================================================================
0096 
0097 inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right) { *this = right; }
0098 
0099 inline G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
0100 {
0101   eventNumber = right.eventNumber;
0102 
0103   simEvent = right.simEvent;  // shallow copy...
0104   genEvent = right.genEvent;
0105 
0106   gen2simParticleMap = right.gen2simParticleMap;
0107   sim2genParticleMap = right.sim2genParticleMap;
0108 
0109   return *this;
0110 }
0111 
0112 inline void G4MCTEvent::SetEventNumber(G4int n)
0113 {
0114   eventNumber = n;
0115 }
0116 
0117 inline G4int G4MCTEvent::GetEventNumber() const
0118 {
0119   return eventNumber;
0120 }
0121 
0122 inline G4int G4MCTEvent::GetNofPrimaries() const
0123 {
0124   return (G4int)gen2simParticleMap.size();
0125 }
0126 
0127 inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const
0128 { 
0129   return simEvent;
0130 }
0131 
0132 inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const
0133 {
0134   return genEvent;
0135 }
0136 
0137 // iterators
0138 inline
0139 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
0140 {
0141   return gen2simParticleMap.cbegin();
0142 }
0143 
0144 inline
0145 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
0146 {
0147   return gen2simParticleMap.cend();
0148 }
0149 
0150 inline
0151 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
0152 {
0153   return sim2genParticleMap.cbegin();
0154 }
0155 
0156 inline
0157 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
0158 {
0159   return sim2genParticleMap.cend();
0160 }
0161 
0162 #endif