Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-14 08:54:39

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 // G4MCTSimVertex
0027 
0028 // Author: Youhei Morita, 12.09.2001
0029 // --------------------------------------------------------------------
0030 #ifndef G4MCTSIMVERTEX_HH
0031 #define G4MCTSIMVERTEX_HH 1
0032 
0033 #include <iostream>
0034 #include <vector>
0035 
0036 #include "G4Types.hh"
0037 #include "G4ThreeVector.hh"
0038 #include "G4MCTSimParticle.hh"
0039 
0040 class G4MCTSimVertex
0041 {
0042   public:
0043 
0044     G4MCTSimVertex();
0045     G4MCTSimVertex(const G4ThreeVector& x, G4double t);
0046     G4MCTSimVertex(const G4ThreeVector& x, G4double t,
0047                    const G4String& vname, G4int ncopy,
0048                    const G4String& pname);
0049     ~G4MCTSimVertex();
0050 
0051     inline G4MCTSimVertex(const G4MCTSimVertex& right);
0052     inline G4MCTSimVertex& operator=(const G4MCTSimVertex& right);
0053       // copy constructor and assignment operator
0054 
0055     inline void SetID(G4int i);
0056     inline G4int GetID() const;
0057 
0058     inline void SetPosition(const G4ThreeVector& x);
0059     inline const G4ThreeVector& GetPosition() const;
0060 
0061     inline void SetTime(G4double t);
0062     inline G4double GetTime() const;
0063 
0064     inline void SetVolumeName(const G4String& vname);
0065     inline const G4String& GetVolumeName() const;
0066 
0067     inline void SetVolumeNumber(G4int n);
0068     inline G4int GetVolumeNumber() const;
0069 
0070     inline void SetCreatorProcessName(const G4String& pname);
0071     inline const G4String& GetCreatorProcessName() const;
0072 
0073     inline void SetStoreFlag(G4bool q);
0074     inline G4bool GetStoreFlag() const;
0075 
0076     inline void SetInParticle(const G4MCTSimParticle* in);
0077     inline void SetInParticle(G4int in);
0078     inline G4int GetInParticleTrackID() const;
0079 
0080     inline G4int GetNofOutParticles() const;
0081     inline G4int AddOutParticle(const G4MCTSimParticle* out);
0082     inline G4int AddOutParticle(G4int out);
0083     inline G4int GetOutParticleTrackID(G4int i) const;
0084 
0085     void Print(std::ostream& ostr = std::cout) const;
0086 
0087   private:
0088 
0089     G4int inParticleTrackID = 0;
0090     std::vector<G4int> outParticleTrackIDList;
0091 
0092     G4String volumeName = "";
0093     G4String creatorProcessName = "none";
0094     G4ThreeVector position;
0095     G4double time = 0.0;
0096     G4int id = -1;  // assigned independently from G4
0097     G4int volumeNumber = -1;
0098     G4bool storeFlag = false;
0099 };
0100 
0101 // ====================================================================
0102 // inline methods
0103 // ====================================================================
0104 
0105 inline G4MCTSimVertex::G4MCTSimVertex(const G4MCTSimVertex& right)
0106 {
0107   *this = right;
0108 }
0109 
0110 inline G4MCTSimVertex& G4MCTSimVertex::operator=(
0111   const G4MCTSimVertex& right)
0112 {
0113   inParticleTrackID      = right.inParticleTrackID;
0114   outParticleTrackIDList = right.outParticleTrackIDList;
0115 
0116   id                 = right.id;
0117   position           = right.position;
0118   time               = right.time;
0119   volumeName         = right.volumeName;
0120   volumeNumber       = right.volumeNumber;
0121   creatorProcessName = right.creatorProcessName;
0122 
0123   return *this;
0124 }
0125 
0126 inline void G4MCTSimVertex::SetID(G4int i)
0127 {
0128   id = i;
0129 }
0130 
0131 inline G4int G4MCTSimVertex::GetID() const
0132 {
0133   return id;
0134 }
0135 
0136 inline void G4MCTSimVertex::SetPosition(const G4ThreeVector& x)
0137 {
0138   position = x;
0139 }
0140 
0141 inline const G4ThreeVector& G4MCTSimVertex::GetPosition() const
0142 {
0143   return position;
0144 }
0145 
0146 inline void G4MCTSimVertex::SetTime(G4double t)
0147 {
0148   time = t;
0149 }
0150 
0151 inline G4double G4MCTSimVertex::GetTime() const
0152 {
0153   return time;
0154 }
0155 
0156 inline void G4MCTSimVertex::SetVolumeName(const G4String& vname)
0157 {
0158   volumeName = vname;
0159 }
0160 
0161 inline const G4String& G4MCTSimVertex::GetVolumeName() const
0162 {
0163   return volumeName;
0164 }
0165 
0166 inline void G4MCTSimVertex::SetVolumeNumber(G4int n)
0167 {
0168   volumeNumber = n;
0169 }
0170 
0171 inline G4int G4MCTSimVertex::GetVolumeNumber() const
0172 {
0173   return volumeNumber;
0174 }
0175 
0176 inline void G4MCTSimVertex::SetCreatorProcessName(const G4String& pname)
0177 {
0178   creatorProcessName = pname;
0179 }
0180 
0181 inline const G4String& G4MCTSimVertex::GetCreatorProcessName() const
0182 {
0183   return creatorProcessName;
0184 }
0185 
0186 inline void G4MCTSimVertex::SetStoreFlag(G4bool q)
0187 {
0188   storeFlag = q;
0189 }
0190 
0191 inline G4bool G4MCTSimVertex::GetStoreFlag() const
0192 {
0193   return storeFlag;
0194 }
0195 
0196 inline void G4MCTSimVertex::SetInParticle(const G4MCTSimParticle* in)
0197 {
0198   inParticleTrackID = in->GetTrackID();
0199 }
0200 
0201 inline void G4MCTSimVertex::SetInParticle(G4int in)
0202 {
0203   inParticleTrackID = in;
0204 }
0205 
0206 inline G4int G4MCTSimVertex::GetInParticleTrackID() const
0207 {
0208   return inParticleTrackID;
0209 }
0210 
0211 inline G4int G4MCTSimVertex::GetNofOutParticles() const
0212 {
0213   return (G4int)outParticleTrackIDList.size();
0214 }
0215 
0216 inline G4int G4MCTSimVertex::AddOutParticle(const G4MCTSimParticle* out)
0217 {
0218   outParticleTrackIDList.push_back(out->GetTrackID());
0219   return (G4int)outParticleTrackIDList.size();
0220 }
0221 
0222 inline G4int G4MCTSimVertex::AddOutParticle(G4int out)
0223 {
0224   outParticleTrackIDList.push_back(out);
0225   return (G4int)outParticleTrackIDList.size();
0226 }
0227 
0228 inline G4int G4MCTSimVertex::GetOutParticleTrackID(G4int i) const
0229 {
0230   G4int size = (G4int)outParticleTrackIDList.size();
0231   if(i >= 0 && i < size)
0232     return outParticleTrackIDList[i];
0233   else
0234     return 0;
0235 }
0236 
0237 #endif