Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:21

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 //---------------------------------------------------------------
0030 //
0031 //  G4VFastSimulationModel.hh
0032 //
0033 //  Description:
0034 //    Base class for fast simulation models.
0035 //
0036 //  History:
0037 //    Oct 97: Verderi && MoraDeFreitas - First Implementation.
0038 //
0039 //---------------------------------------------------------------
0040 
0041 #ifndef G4VFastSimulationModel_h
0042 #define G4VFastSimulationModel_h
0043 
0044 #include "G4FastStep.hh"
0045 #include "G4FastTrack.hh"
0046 
0047 //-------------------------------------------
0048 //
0049 //        G4VFastSimulationModel class
0050 //
0051 //-------------------------------------------
0052 
0053 // Class Description:
0054 //   This is the abstract class for the implementation of parameterisations.
0055 //   You have to inherit from it to implement your concrete parameterisation
0056 //   model.
0057 //
0058 
0059 class G4VFastSimulationModel
0060 {
0061   public:
0062     // aName identifies the parameterisation model.
0063     G4VFastSimulationModel(const G4String& aName);
0064 
0065     // This constructor allows you to get a quick "getting started".
0066     // In addition to the model name, this constructor accepts a G4LogicalVolume
0067     // pointer. This volume will automatically becomes the envelope, and the
0068     // needed G4FastSimulationManager object is constructed if necessary giving
0069     // it the G4LogicalVolume pointer and the boolean value. If it already
0070     // exists, the model is simply added to this manager. However the
0071     // G4VFastSimulationModel object will not keep track of the envelope given
0072     // in the constructor.
0073     // The boolean argument is there for optimization purpose: if you know that
0074     // the G4LogicalVolume envelope is placed only once you can turn this
0075     // boolean value to "true" (an automated mechanism is foreseen here.)
0076     G4VFastSimulationModel(const G4String& aName, G4Envelope*, G4bool IsUnique = FALSE);
0077 
0078     virtual ~G4VFastSimulationModel() = default;
0079 
0080     // In your implementation, you have to return "true" when your model is
0081     // applicable to the G4ParticleDefinition passed to this method. The
0082     // G4ParticleDefinition provides all intrisic particle informations (mass,
0083     // charge, spin, name ...).
0084     virtual G4bool IsApplicable(const G4ParticleDefinition&) = 0;
0085 
0086     // You have to return "true" when the dynamics conditions to trigger your
0087     // parameterisation are fulfiled. The G4FastTrack provides you access to
0088     // the current G4Track, gives simple access to envelope related features
0089     // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
0090     // global and the envelope local coordinates systems) and simple access to
0091     // the position, momentum expressed in the envelope coordinate system.
0092     // Using those quantities and the G4VSolid methods, you can for example
0093     // easily check how far you are from the envelope boundary.
0094     virtual G4bool ModelTrigger(const G4FastTrack&) = 0;
0095 
0096     // Your parameterisation properly said. The G4FastTrack reference provides
0097     // input informations. The final state of the particles after parameterisation
0098     // has to be returned through the G4FastStep reference. This final state is
0099     // described has "requests" the tracking will apply after your
0100     // parameterisation has been invoked.
0101     virtual void DoIt(const G4FastTrack&, G4FastStep&) = 0;
0102 
0103     // ---------------------------
0104     // -- Idem for AtRest methods:
0105     // ---------------------------
0106     // -- A default dummy implementation is provided.
0107 
0108     // You have to return "true" when the dynamics conditions to trigger your
0109     // parameterisation are fulfiled. The G4FastTrack provides you access to
0110     // the current G4Track, gives simple access to envelope related features
0111     // (G4LogicalVolume, G4VSolid, G4AffineTransform references between the
0112     // global and the envelope local coordinates systems) and simple access to
0113     // the position, momentum expressed in the envelope coordinate system.
0114     // Using those quantities and the G4VSolid methods, you can for example
0115     // easily check how far you are from the envelope boundary.
0116     virtual G4bool AtRestModelTrigger(const G4FastTrack&) { return false; }
0117 
0118     // Your parameterisation properly said. The G4FastTrack reference provides
0119     // input informations. The final state of the particles after parameterisation
0120     // has to be returned through the G4FastStep reference. This final state is
0121     // described has "requests" the tracking will apply after your
0122     // parameterisation has been invoked.
0123     virtual void AtRestDoIt(const G4FastTrack&, G4FastStep&) {}
0124 
0125     // Complete processing of any buffered or offloaded tracks at end of tracking
0126     virtual void Flush() {}
0127 
0128     // Useful public methods :
0129     const G4String GetName() const;
0130     G4bool operator==(const G4VFastSimulationModel&) const;
0131 
0132   private:
0133     //-------------
0134     // Model Name:
0135     //-------------
0136     G4String theModelName;
0137 };
0138 
0139 inline const G4String G4VFastSimulationModel::GetName() const
0140 {
0141   return theModelName;
0142 }
0143 
0144 inline G4bool G4VFastSimulationModel::operator==(const G4VFastSimulationModel& fsm) const
0145 {
0146   return this == &fsm;
0147 }
0148 #endif