G4MCTSimParticle.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 //   G4MCTSimParticle.hh
00027 //
00028 // ====================================================================
00029 #ifndef MCT_SIM_PARTICLE_H
00030 #define MCT_SIM_PARTICLE_H
00031 
00032 #include "G4Types.hh"
00033 #include <vector>
00034 #include <string>
00035 #include <iostream>
00036 #include "G4LorentzVector.hh"
00037 
00038 // ====================================================================
00039 //
00040 // class definition
00041 //
00042 // ====================================================================
00043 class G4MCTSimVertex;
00044 class G4MCTSimParticle;
00045 
00046 typedef std::vector<G4MCTSimParticle*> SimParticleList;
00047 
00048 class G4MCTSimParticle {
00049 protected:
00050   G4MCTSimParticle* parentParticle;
00051   std::vector<G4MCTSimParticle*> associatedParticleList;
00052 
00053   std::string name;
00054   int pdgID;
00055   int trackID;
00056   int parentTrackID;
00057   G4bool primaryFlag;
00058   G4LorentzVector momentumAtVertex;
00059   G4MCTSimVertex* vertex;
00060   G4bool storeFlag;
00061   
00062 public:
00063   G4MCTSimParticle();
00064   G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
00065                  const G4LorentzVector& p);
00066   G4MCTSimParticle(std::string aname, int apcode, int atid, int ptid,
00067                  const G4LorentzVector& p, const G4MCTSimVertex* v);
00068   virtual ~G4MCTSimParticle();
00069  
00070   // copy constructor and assignment operator
00071   G4MCTSimParticle(const G4MCTSimParticle& right);
00072   const G4MCTSimParticle& operator=(const G4MCTSimParticle& right);
00073 
00074   // set/get functions
00075   void SetParentParticle(const G4MCTSimParticle* p);
00076   G4MCTSimParticle* GetParentParticle() const;
00077 
00078   void SetParticleName(std::string aname);
00079   const std::string& GetParticleName() const;
00080 
00081   void SetPdgID(int id);
00082   int GetPdgID() const;
00083 
00084   void SetTrackID(int id);
00085   int GetTrackID() const;
00086 
00087   void SetParentTrackID(int id);
00088   int GetParentTrackID() const;
00089 
00090   void SetPrimaryFlag(G4bool q);
00091   G4bool GetPrimaryFlag() const;
00092 
00093   void SetMomentumAtVertex(const G4LorentzVector& p);
00094   const G4LorentzVector& GetMomentumAtVertex() const;
00095 
00096   void SetVertex(const G4MCTSimVertex* v);
00097   G4MCTSimVertex* GetVertex() const;
00098 
00099   void SetStoreFlag(G4bool q);
00100   G4bool GetStoreFlag() const;
00101 
00102   // methods...
00103   int AssociateParticle(G4MCTSimParticle* p);
00104   int GetNofAssociatedParticles() const;
00105   G4MCTSimParticle* GetAssociatedParticle(int i) const;
00106   int GetTreeLevel() const;  
00107   void SetStoreFlagToParentTree(G4bool q=true);
00108 
00109   void Print(std::ostream& ostr= std::cout, G4bool qrevorder=false) const;
00110   void PrintSingle(std::ostream& ostr= std::cout) const;
00111 };
00112 
00113 // ====================================================================
00114 // inline functions
00115 // ====================================================================
00116 inline G4MCTSimParticle::G4MCTSimParticle(const G4MCTSimParticle& right)
00117 {
00118   *this= right;
00119 }
00120  
00121 inline const G4MCTSimParticle& 
00122   G4MCTSimParticle::operator=(const G4MCTSimParticle& right)
00123 {
00124   parentParticle= right.parentParticle;
00125   associatedParticleList= right.associatedParticleList;  // shallow copy
00126 
00127   name= right.name;
00128   pdgID= right.pdgID;
00129   trackID= right.trackID;
00130   parentTrackID= right.parentTrackID;
00131   primaryFlag= right.primaryFlag;
00132   momentumAtVertex= right.momentumAtVertex;
00133   vertex= right.vertex;
00134 
00135   return *this;
00136 }
00137 
00138 inline void G4MCTSimParticle::SetParentParticle(const G4MCTSimParticle* p)
00139 { parentParticle= const_cast<G4MCTSimParticle*>(p); }
00140 
00141 inline G4MCTSimParticle* G4MCTSimParticle::GetParentParticle() const
00142 { return parentParticle; }
00143 
00144 inline void G4MCTSimParticle::SetParticleName(std::string aname) 
00145 { name= aname; }
00146 
00147 inline const std::string& G4MCTSimParticle::GetParticleName() const 
00148 { return name; }
00149 
00150 inline  void G4MCTSimParticle::SetPdgID(int id) { pdgID= id; }
00151 
00152 inline  int G4MCTSimParticle::GetPdgID() const { return pdgID; }
00153 
00154 inline void G4MCTSimParticle::SetTrackID(int id) { trackID= id; }
00155 
00156 inline  int G4MCTSimParticle::GetTrackID() const { return trackID; }
00157 
00158 inline void G4MCTSimParticle::SetPrimaryFlag(G4bool q) { primaryFlag= q; }
00159 
00160 inline G4bool G4MCTSimParticle::GetPrimaryFlag() const { return primaryFlag; }
00161 
00162 inline void G4MCTSimParticle::SetParentTrackID(int id) 
00163 { parentTrackID= id; }
00164 
00165 inline  int G4MCTSimParticle::GetParentTrackID() const 
00166 { return parentTrackID; }
00167 
00168 inline  void G4MCTSimParticle::SetMomentumAtVertex(const G4LorentzVector& p)
00169 { momentumAtVertex= p; }
00170 
00171 inline  const G4LorentzVector& G4MCTSimParticle::GetMomentumAtVertex() const
00172 { return momentumAtVertex; }
00173 
00174 inline  void G4MCTSimParticle::SetVertex(const G4MCTSimVertex* v)
00175 { vertex= const_cast<G4MCTSimVertex*>(v); }
00176 
00177 inline G4MCTSimVertex* G4MCTSimParticle::GetVertex() const
00178 { return vertex; }
00179 
00180 inline void G4MCTSimParticle::SetStoreFlag(G4bool q) { storeFlag= q; }
00181 
00182 inline G4bool G4MCTSimParticle::GetStoreFlag() const { return storeFlag; }
00183 
00184 #endif

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