Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:02

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 //
0027 // -------------------------------------------------------------------
0028 //      GEANT4 Class file
0029 //
0030 //      For information related to this code contact:
0031 //
0032 //      File name:     G4CollisionComposite
0033 //
0034 // 
0035 //      Creation date: 15 April 1999
0036 //
0037 //      Modifications: 
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 //     template <class t1, int t2, int t3, int t4, int t5> 
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; //Protects concurrent access to theBuffer in MT
0127 };
0128 
0129 #endif