G4MCTEvent.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //   G4MCTEvent.hh
00027 //
00028 // ====================================================================
00029 #ifndef MCT_EVENT_H
00030 #define MCT_EVENT_H
00031 
00032 #include "G4Types.hh"
00033 #include <iostream>
00034 #include <map>
00035 #include "G4MCTGenParticle.hh"
00036  
00037 // ====================================================================
00038 //
00039 // class definition
00040 //
00041 // ====================================================================
00042 class G4MCTGenEvent;
00043 class G4MCTSimEvent;
00044 class G4MCTSimParticle;
00045 
00046 typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
00047 typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
00048 
00049 class G4MCTEvent {
00050 protected:
00051   int eventNumber;
00052   G4MCTGenEvent* genEvent;
00053   G4MCTSimEvent* simEvent;
00054 
00055   // primary table (bidirectional)
00056   MCTGen2SimParticleMap gen2simParticleMap;
00057   MCTSim2GenParticleMap sim2genParticleMap;
00058 
00059 public:
00060   G4MCTEvent();
00061   virtual ~G4MCTEvent();
00062  
00063   // copy constructor and assignment operator
00064   G4MCTEvent(const G4MCTEvent& right);
00065   const G4MCTEvent& operator=(const G4MCTEvent& right);
00066 
00067   // set/get functions
00068   void SetEventNumber(int n);
00069   int GetEventNumber() const;
00070 
00071   G4MCTGenEvent* GetGenEvent() const;
00072   G4MCTSimEvent* GetSimEvent() const;
00073 
00074   // methods...
00075   int GetNofPrimaries() const;
00076   G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
00077   G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
00078   int AddPrimaryPair(const G4MCTGenParticle& genp, 
00079                      const G4MCTSimParticle* simp); 
00080   void ClearEvent();
00081   void Print(std::ostream& ostr= std::cout) const;
00082 
00083   // iterators
00084   typedef MCTGen2SimParticleMap::const_iterator genprimary_const_iterator;
00085   genprimary_const_iterator genprimaries_begin() const;
00086   genprimary_const_iterator genprimaries_end() const;
00087   
00088   typedef MCTSim2GenParticleMap::const_iterator simprimary_const_iterator;
00089   simprimary_const_iterator simprimaries_begin() const;
00090   simprimary_const_iterator simprimaries_end() const;
00091 };
00092 
00093 // ====================================================================
00094 // inline functions
00095 // ====================================================================
00096 
00097 inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right)
00098 {
00099   *this= right;
00100 }
00101  
00102 inline const G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
00103 {
00104   eventNumber= right.eventNumber;
00105 
00106   simEvent= right.simEvent; // shallow copy...
00107   genEvent= right.genEvent;
00108 
00109   gen2simParticleMap= right.gen2simParticleMap;
00110   sim2genParticleMap= right.sim2genParticleMap;
00111 
00112   return *this;
00113 }
00114 
00115 inline void G4MCTEvent::SetEventNumber(int n) { eventNumber= n; }
00116 inline int G4MCTEvent::GetEventNumber() const { return eventNumber; }
00117 
00118 inline int G4MCTEvent::GetNofPrimaries() const 
00119            { return gen2simParticleMap.size(); }
00120 inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const { return simEvent; }
00121 inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const { return genEvent; }
00122 
00123 // iterators
00124 inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
00125 { return gen2simParticleMap.begin(); }
00126 
00127 inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
00128 { return gen2simParticleMap.end(); }
00129 
00130 inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
00131 { return sim2genParticleMap.begin(); }
00132 
00133 inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
00134 { return sim2genParticleMap.end(); }
00135 
00136 #endif

Generated on Mon May 27 17:48:51 2013 for Geant4 by  doxygen 1.4.7