Back to home page

EIC code displayed by LXR

 
 

    


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