Back to home page

EIC code displayed by LXR

 
 

    


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

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 // author: hoang tran
0027 
0028 #ifndef PULSE_PULSEACTION_HH
0029 #define PULSE_PULSEACTION_HH 1
0030 
0031 #include "G4MoleculeCounter.hh"
0032 #include "G4UserTrackingAction.hh"
0033 #include "G4VUserPulseInfo.hh"
0034 #include "G4VUserTrackInformation.hh"
0035 
0036 #include <memory>
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0039 
0040 class G4ParticleDefinition;
0041 
0042 class PulseActionMessenger;
0043 
0044 class PulseInfo : public G4VUserPulseInfo
0045 {
0046   public:
0047     explicit PulseInfo(G4double delayedTime);
0048 
0049     ~PulseInfo() override;
0050 
0051     G4double GetDelayedTime() const override;
0052 
0053   private:
0054     G4double fDelayedTime = 0;
0055 };
0056 
0057 class PulseAction : public G4UserTrackingAction
0058 {
0059   public:
0060     using PulseMap = std::map<G4double, G4double>;
0061 
0062     PulseAction();
0063 
0064     ~PulseAction() override;
0065 
0066     void Initialize();
0067 
0068     void PreUserTrackingAction(const G4Track*) override;
0069 
0070     G4double RandomizeInPulse();
0071 
0072     G4double PulseSpectrum(G4double);
0073 
0074     static G4double Interpolate(const std::array<G4double, 5>& dat);
0075 
0076     G4double GetLonggestDelayedTime() const;
0077 
0078     inline void SetPulse(const G4bool& pulse)
0079     {
0080       fActivePulse = pulse;
0081       if (fActivePulse) {
0082         G4MoleculeCounter::Instance()->Use(false);
0083       }
0084     }
0085 
0086     inline G4bool IsActivedPulse() const { return fActivePulse; }
0087 
0088   private:
0089     std::unique_ptr<PulseInfo> fpPulseInfo;
0090     G4double fPulseLarger = 74.16666667;
0091     G4double fDelayedTime = 0;
0092     PulseMap fPulseData;
0093     std::vector<G4double> fPulseVector;
0094     G4double fLonggestDelayedTime = 0;
0095     std::unique_ptr<PulseActionMessenger> fpMessenger;
0096     G4bool fActivePulse = false;
0097 };
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0099 
0100 #endif