File indexing completed on 2026-04-07 07:52:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "Par02FastSimModelTracker.hh"
0030
0031 #include "Par02EventInformation.hh"
0032 #include "Par02Output.hh"
0033 #include "Par02PrimaryParticleInformation.hh"
0034 #include "Par02Smearer.hh"
0035
0036 #include "G4AnalysisManager.hh"
0037 #include "G4Electron.hh"
0038 #include "G4Event.hh"
0039 #include "G4FieldTrack.hh"
0040 #include "G4FieldTrackUpdator.hh"
0041 #include "G4Gamma.hh"
0042 #include "G4PathFinder.hh"
0043 #include "G4Positron.hh"
0044 #include "G4RunManager.hh"
0045 #include "G4SystemOfUnits.hh"
0046 #include "G4Track.hh"
0047 #include "Randomize.hh"
0048
0049
0050
0051 Par02FastSimModelTracker::Par02FastSimModelTracker(
0052 G4String aModelName, G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType)
0053 : G4VFastSimulationModel(aModelName, aEnvelope),
0054 fCalculateParametrisation(),
0055 fParametrisation(aType)
0056 {}
0057
0058
0059
0060 Par02FastSimModelTracker::Par02FastSimModelTracker(G4String aModelName, G4Region* aEnvelope)
0061 : G4VFastSimulationModel(aModelName, aEnvelope),
0062 fCalculateParametrisation(),
0063 fParametrisation(Par02DetectorParametrisation::eCMS)
0064 {}
0065
0066
0067
0068 Par02FastSimModelTracker::Par02FastSimModelTracker(G4String aModelName)
0069 : G4VFastSimulationModel(aModelName),
0070 fCalculateParametrisation(),
0071 fParametrisation(Par02DetectorParametrisation::eCMS)
0072 {}
0073
0074
0075
0076 Par02FastSimModelTracker::~Par02FastSimModelTracker() = default;
0077
0078
0079
0080 G4bool Par02FastSimModelTracker::IsApplicable(const G4ParticleDefinition& aParticleType)
0081 {
0082 return aParticleType.GetPDGCharge() != 0;
0083 }
0084
0085
0086
0087 G4bool Par02FastSimModelTracker::ModelTrigger(const G4FastTrack& )
0088 {
0089 return true;
0090 }
0091
0092
0093
0094 void Par02FastSimModelTracker::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep)
0095 {
0096 G4cout << " ________Tracker model triggered _________" << G4endl;
0097
0098
0099
0100
0101 G4Track track = *aFastTrack.GetPrimaryTrack();
0102 G4FieldTrack aFieldTrack('0');
0103 G4FieldTrackUpdator::Update(&aFieldTrack, &track);
0104
0105 G4double retSafety = -1.0;
0106 ELimited retStepLimited;
0107 G4FieldTrack endTrack('a');
0108 G4double currentMinimumStep = 10.0 * m;
0109
0110 G4PathFinder* fPathFinder = G4PathFinder::GetInstance();
0111
0112 fPathFinder->ComputeStep(aFieldTrack, currentMinimumStep, 0,
0113 aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(), retSafety,
0114 retStepLimited, endTrack, aFastTrack.GetPrimaryTrack()->GetVolume());
0115
0116
0117
0118 aFastStep.ProposePrimaryTrackFinalPosition(endTrack.GetPosition());
0119
0120
0121 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
0122 if (!aFastTrack.GetPrimaryTrack()->GetParentID()) {
0123 auto info = (Par02EventInformation*)G4EventManager::GetEventManager()->GetUserInformation();
0124 if (info->GetDoSmearing()) {
0125
0126 G4double res = fCalculateParametrisation->GetResolution(
0127 Par02DetectorParametrisation::eTRACKER, fParametrisation, Porg.mag());
0128 G4double eff = fCalculateParametrisation->GetEfficiency(
0129 Par02DetectorParametrisation::eTRACKER, fParametrisation, Porg.mag());
0130 G4ThreeVector Psm;
0131 Psm = Par02Smearer::Instance()->SmearMomentum(aFastTrack.GetPrimaryTrack(), res);
0132 Par02Output::Instance()->FillHistogram(0, ((Psm.mag() / MeV) / (Porg.mag() / MeV)));
0133
0134 ((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
0135 aFastTrack.GetPrimaryTrack()
0136 ->GetDynamicParticle()
0137 ->GetPrimaryParticle())
0138 ->GetUserInformation()))
0139 ->SetTrackerMomentum(Psm);
0140 ((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
0141 aFastTrack.GetPrimaryTrack()
0142 ->GetDynamicParticle()
0143 ->GetPrimaryParticle())
0144 ->GetUserInformation()))
0145 ->SetTrackerResolution(res);
0146 ((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
0147 aFastTrack.GetPrimaryTrack()
0148 ->GetDynamicParticle()
0149 ->GetPrimaryParticle())
0150 ->GetUserInformation()))
0151 ->SetTrackerEfficiency(eff);
0152 }
0153 else {
0154
0155 ((Par02PrimaryParticleInformation*)(const_cast<G4PrimaryParticle*>(
0156 aFastTrack.GetPrimaryTrack()
0157 ->GetDynamicParticle()
0158 ->GetPrimaryParticle())
0159 ->GetUserInformation()))
0160 ->SetTrackerMomentum(Porg);
0161 }
0162 }
0163 }
0164
0165