Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:58:06

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