Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:34

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 #ifdef USE_INFERENCE
0027 #  ifndef PAR04MLFASTSIMMODEL_HH
0028 #    define PAR04MLFASTSIMMODEL_HH
0029 
0030 #    include "G4VFastSimulationModel.hh"  // for G4VFastSimulationModel
0031 
0032 #    include <G4String.hh>  // for G4String
0033 #    include <G4ThreeVector.hh>  // for G4ThreeVector
0034 #    include <G4Types.hh>  // for G4bool, G4double
0035 #    include <memory>  // for unique_ptr
0036 #    include <vector>  // for vector
0037 class G4FastSimHitMaker;
0038 class G4FastStep;
0039 class G4FastHit;
0040 class G4FastTrack;
0041 class G4ParticleDefinition;
0042 class G4Region;
0043 class Par04InferenceSetup;
0044 
0045 /**
0046  * @brief Inference for the fast simulation model.
0047  *
0048  * Parametrisation of electrons, positrons, and gammas. Energy is deposited and
0049  * distributed according to ML inference. This class is only a shell that
0050  * triggers the inference, asks for values, and deposits energies at
0051  * given positions.
0052  *
0053  **/
0054 
0055 class Par04MLFastSimModel : public G4VFastSimulationModel
0056 {
0057   public:
0058     Par04MLFastSimModel(G4String, G4Region*);
0059     Par04MLFastSimModel(G4String);
0060     ~Par04MLFastSimModel();
0061     /// There are no kinematics constraints. True is returned.
0062     virtual G4bool ModelTrigger(const G4FastTrack&) final;
0063     /// Model is applicable to electrons, positrons, and photons.
0064     virtual G4bool IsApplicable(const G4ParticleDefinition&) final;
0065     /// Take particle out of the full simulation (kill it at the entrance
0066     /// depositing all the energy). Calculate energy deposited in the detector
0067     /// from the NN model inference.
0068     virtual void DoIt(const G4FastTrack&, G4FastStep&) final;
0069 
0070   private:
0071     /// Inference model that is NN aware
0072     Par04InferenceSetup* fInference;
0073     /// Inference model that is NN aware
0074     /// Helper class for creation of hits within the sensitive detector
0075     std::unique_ptr<G4FastSimHitMaker> fHitMaker;
0076     std::unique_ptr<G4FastSimHitMaker> fParallelHitMaker;
0077     /// Vector of energy values
0078     std::vector<G4double> fEnergies;
0079     /// Vector of positions corresponding to energy values (const for one NN
0080     /// model)
0081     std::vector<G4ThreeVector> fPositions;
0082 };
0083 #  endif /* PAR04INFERENCEMODEL_HH */
0084 #endif