G4CollisionComposite.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 //
00027 // $Id: G4CollisionComposite.hh 69856 2013-05-16 13:32:36Z gcosmo $
00028 // -------------------------------------------------------------------
00029 //      GEANT4 Class file
00030 //
00031 //      For information related to this code contact:
00032 //
00033 //      File name:     G4CollisionComposite
00034 //
00035 // 
00036 //      Creation date: 15 April 1999
00037 //
00038 //      Modifications: 
00039 //      
00040 // -------------------------------------------------------------------
00041 
00042 #ifndef G4CollisionComposite_h
00043 #define G4CollisionComposite_h
00044 
00045 #include "globals.hh"
00046 #include "G4HadronicException.hh"
00047 #include "G4VCollision.hh"
00048 #include "G4CollisionVector.hh"
00049 #include "G4KineticTrackVector.hh"
00050 #include "G4CrossSectionBuffer.hh"
00051 #include "G4Pair.hh"
00052 #include "G4ParticleTable.hh"
00053 
00054 class G4KineticTrack;
00055 class G4VCrossSectionSource;
00056 
00057 class G4CollisionComposite : public G4VCollision
00058 {
00059 public:
00060 
00061   G4CollisionComposite();
00062   virtual ~G4CollisionComposite();
00063 
00064   virtual G4double CrossSection(const G4KineticTrack& trk1, 
00065                                 const G4KineticTrack& trk2) const;
00066 
00067   virtual G4KineticTrackVector* FinalState(const G4KineticTrack& trk1, 
00068                                               const G4KineticTrack& trk2) const;
00069 
00070   virtual G4bool IsInCharge(const G4KineticTrack& trk1, 
00071                             const G4KineticTrack& trk2) const;
00072   void AddComponent(G4VCollision * aC) {components.push_back(aC);}
00073 
00074 public:
00075   virtual const G4VCrossSectionSource* GetCrossSectionSource() const { return 0; }
00076   virtual const G4VAngularDistribution* GetAngularDistribution() const { return 0; }
00077 
00078   virtual const G4CollisionVector* GetComponents() const  { return &components;}
00079   struct Register
00080   {
00081     template <class T> void operator()(T*, G4CollisionComposite * aC)
00082     {
00083       aC->AddComponent(new T());
00084     }
00085   };
00086   struct Resolve
00087   {
00088 //     template <class t1, int t2, int t3, int t4, int t5> 
00089     template <class T> 
00090     void operator()(T * , G4CollisionComposite * aC)
00091     {
00092       G4ParticleDefinition * p2, *p3, *p4, *p5;
00093       G4int pdg = 0;
00094       pdg = T::i1;
00095       p2=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
00096       pdg = T::i2;
00097       p3=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
00098       pdg = T::i3;
00099       p4=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
00100       pdg = T::i4;
00101       p5=G4ParticleTable::GetParticleTable()->FindParticle(pdg);
00102       if(p2->GetPDGCharge()+p3->GetPDGCharge() != p4->GetPDGCharge()+p5->GetPDGCharge())
00103       {
00104         G4cerr << "charge-unbalance in collision composite"<<G4endl;
00105       }
00106       aC->AddComponent(new typename T::it(p2, p3, p4, p5));  
00107     }
00108   };
00109 
00110 private:  
00111 
00112   G4CollisionComposite(const G4CollisionComposite &right);
00113 
00114   const G4CollisionComposite& operator=(const G4CollisionComposite &right);
00115   void BufferCrossSection(const G4ParticleDefinition * aP, const G4ParticleDefinition * bP);
00116   G4double BufferedCrossSection(const G4KineticTrack& trk1, const G4KineticTrack& trk2) const;
00117 
00118 private:
00119 
00120   G4CollisionVector components;
00121   std::vector<G4CrossSectionBuffer> theBuffer;
00122   
00123   static const G4int nPoints;
00124   static G4double theT[];
00125   
00126 };
00127 
00128 #endif

Generated on Mon May 27 17:47:54 2013 for Geant4 by  doxygen 1.4.7