File indexing completed on 2025-01-18 09:58:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #ifndef G4CollisionComposite_h
0042 #define G4CollisionComposite_h
0043
0044 #include "globals.hh"
0045 #include "G4HadronicException.hh"
0046 #include "G4VCollision.hh"
0047 #include "G4CollisionVector.hh"
0048 #include "G4KineticTrackVector.hh"
0049 #include "G4CrossSectionBuffer.hh"
0050 #include "G4Pair.hh"
0051 #include "G4ParticleTable.hh"
0052 #include "G4Threading.hh"
0053
0054 class G4KineticTrack;
0055 class G4VCrossSectionSource;
0056
0057 class G4CollisionComposite : public G4VCollision
0058 {
0059 public:
0060
0061 G4CollisionComposite();
0062 virtual ~G4CollisionComposite();
0063
0064 virtual G4double CrossSection(const G4KineticTrack& trk1,
0065 const G4KineticTrack& trk2) const;
0066
0067 virtual G4KineticTrackVector* FinalState(const G4KineticTrack& trk1,
0068 const G4KineticTrack& trk2) const;
0069
0070 virtual G4bool IsInCharge(const G4KineticTrack& trk1,
0071 const G4KineticTrack& trk2) const;
0072 void AddComponent(G4VCollision * aC) {components.push_back(aC);}
0073
0074 public:
0075 virtual const G4VCrossSectionSource* GetCrossSectionSource() const { return 0; }
0076 virtual const G4VAngularDistribution* GetAngularDistribution() const { return 0; }
0077
0078 virtual const G4CollisionVector* GetComponents() const { return &components;}
0079 struct Register
0080 {
0081 template <class T> void operator()(T*, G4CollisionComposite * aC)
0082 {
0083 aC->AddComponent(new T());
0084 }
0085 };
0086 struct Resolve
0087 {
0088
0089 template <class T>
0090 void operator()(T * , G4CollisionComposite * aC)
0091 {
0092 G4ParticleDefinition * p2, *p3, *p4, *p5;
0093 G4int pdg = 0;
0094 pdg = T::i1;
0095 p2=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
0096 pdg = T::i2;
0097 p3=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
0098 pdg = T::i3;
0099 p4=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
0100 pdg = T::i4;
0101 p5=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
0102 if(p2->GetPDGCharge()+p3->GetPDGCharge() != p4->GetPDGCharge()+p5->GetPDGCharge())
0103 {
0104 G4cerr << "charge-unbalance in collision composite"<<G4endl;
0105 }
0106 aC->AddComponent(new typename T::it(p2, p3, p4, p5));
0107 }
0108 };
0109
0110 private:
0111
0112 G4CollisionComposite(const G4CollisionComposite &right);
0113
0114 const G4CollisionComposite& operator=(const G4CollisionComposite &right);
0115 void BufferCrossSection(const G4ParticleDefinition * aP, const G4ParticleDefinition * bP);
0116 G4double BufferedCrossSection(const G4KineticTrack& trk1, const G4KineticTrack& trk2) const;
0117
0118 private:
0119
0120 G4CollisionVector components;
0121 std::vector<G4CrossSectionBuffer> theBuffer;
0122
0123 static const G4int nPoints;
0124 static const G4double theT[];
0125
0126 mutable G4Mutex bufferMutex;
0127 };
0128
0129 #endif