Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0029 // G4BiasingProcessSharedData
0030 //
0031 // Class Description:
0032 //        This class represents the data that the G4BiasingProcessInterface
0033 //    objects attached to a same particle / hold by a same G4ProcessManager
0034 //    share. It allows the active G4BiasingProcessInterface objects to share
0035 //    information on operations that are common the these instances:
0036 //        - the current and previous G4VBiasingOperator objects (their
0037 //          pointers are collected once, at the beginning of the PostStepGPIL
0038 //          by the first interface invoked)
0039 //        - add the list of cooperating G4BiasingProcessInterface objects,
0040 //          acting on a same particle type.
0041 //        G4BiasingProcessInterface is friend class of this one.
0042 //---------------------------------------------------------------------------
0043 //   Initial version                         Sep. 2014 M. Verderi
0044 
0045 #ifndef G4BiasingProcessSharedData_h
0046 #define G4BiasingProcessSharedData_h
0047 
0048 #include "globals.hh"
0049 #include "G4Cache.hh"
0050 #include <vector>
0051 
0052 class G4VBiasingOperator;
0053 class G4BiasingProcessInterface;
0054 class G4ProcessManager;
0055 class G4ParallelGeometriesLimiterProcess;
0056 
0057 class G4BiasingProcessSharedData {
0058 
0059 friend class G4BiasingProcessInterface;
0060 friend class G4ParallelGeometriesLimiterProcess;
0061 
0062 public:
0063   // -------------------------
0064   // -- Public access methods:
0065   // -------------------------
0066   // -- The biasing process interface objects sharing this shared data class:
0067   const std::vector< const G4BiasingProcessInterface* >&           GetBiasingProcessInterfaces() const
0068   { return           fPublicBiasingProcessInterfaces; }
0069   const std::vector< const G4BiasingProcessInterface* >&    GetPhysicsBiasingProcessInterfaces() const
0070   { return    fPublicPhysicsBiasingProcessInterfaces; }
0071   const std::vector< const G4BiasingProcessInterface* >& GetNonPhysicsBiasingProcessInterfaces() const
0072   { return fPublicNonPhysicsBiasingProcessInterfaces; }
0073   
0074   // -- The possible geometry limiter process:
0075   const G4ParallelGeometriesLimiterProcess*                GetParallelGeometriesLimiterProcess() const
0076   { return fParallelGeometriesLimiterProcess; }
0077   
0078 
0079 private:
0080   // -- Methods used by the G4BiasingProcessInterface objects, thanks to class friendness.
0081   // -- Object is created by G4BiasingProcessInterface object:
0082   G4BiasingProcessSharedData( const G4ProcessManager* mgr)
0083     : fProcessManager                  (mgr),
0084       fCurrentBiasingOperator          ( nullptr ),
0085       fPreviousBiasingOperator         ( nullptr ),
0086       fParallelGeometryOperator        ( nullptr ),
0087       fMassGeometryOperator            ( nullptr ),
0088       fIsNewOperator                   (true),
0089       fLeavingPreviousOperator         (false),
0090       fParallelGeometriesLimiterProcess( nullptr )
0091   {}
0092   ~G4BiasingProcessSharedData() {}
0093   // -- biasing operators:
0094   void                 CurrentBiasingOperator( G4VBiasingOperator* );
0095   G4VBiasingOperator*  CurrentBiasingOperator() const;
0096   void                PreviousBiasingOperator( G4VBiasingOperator* );
0097   G4VBiasingOperator* PreviousBiasingOperator() const;
0098 
0099 private:
0100   // -- 
0101   const G4ProcessManager* fProcessManager;
0102   // -- biasing operators:
0103   G4VBiasingOperator*   fCurrentBiasingOperator;
0104   G4VBiasingOperator*  fPreviousBiasingOperator;
0105   G4VBiasingOperator* fParallelGeometryOperator;
0106   G4VBiasingOperator*     fMassGeometryOperator;
0107   // -- 
0108   G4bool                         fIsNewOperator;
0109   G4bool               fLeavingPreviousOperator;
0110 
0111   // -- biasing process interfaces sharing this object:
0112   std::vector < G4BiasingProcessInterface* >                       fBiasingProcessInterfaces;
0113   std::vector < G4BiasingProcessInterface* >                fPhysicsBiasingProcessInterfaces;
0114   std::vector < G4BiasingProcessInterface* >             fNonPhysicsBiasingProcessInterfaces;
0115   // -- the same ones, for public use:
0116   std::vector < const G4BiasingProcessInterface* >           fPublicBiasingProcessInterfaces;
0117   std::vector < const G4BiasingProcessInterface* >    fPublicPhysicsBiasingProcessInterfaces;
0118   std::vector < const G4BiasingProcessInterface* > fPublicNonPhysicsBiasingProcessInterfaces;
0119 
0120   // -- possible process limiting step on parallel geometries:
0121   G4ParallelGeometriesLimiterProcess*                      fParallelGeometriesLimiterProcess;
0122 
0123   
0124   // -- thread local:
0125   // -- Map between process managers and shared data. This map is made of
0126   // -- pointers of G4BiasingSharedData instead of objects themselves :
0127   // -- each process needs to keep a valid pointer of a shared data object
0128   // -- but a map of object will make pointers invalid when map is increased.
0129   static G4MapCache< const G4ProcessManager*, 
0130              G4BiasingProcessSharedData* >         fSharedDataMap;
0131 
0132 };
0133 
0134 #endif