Loading...
Searching...
No Matches
Par02FastSimModelTracker.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27/// \file Par02FastSimModelTracker.cc
28/// \brief Implementation of the Par02FastSimModelTracker class
29
33#include "Par02Smearer.hh"
34#include "Par02Output.hh"
35
36#include "G4Track.hh"
37#include "G4Event.hh"
38#include "G4RunManager.hh"
39#include "G4AnalysisManager.hh"
40
41#include "Randomize.hh"
42
43#include "G4Electron.hh"
44#include "G4Positron.hh"
45#include "G4Gamma.hh"
46
47#include "G4PathFinder.hh"
48#include "G4FieldTrack.hh"
49#include "G4FieldTrackUpdator.hh"
50#include "G4SystemOfUnits.hh"
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
56 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
57 fParametrisation( aType ) {}
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60
62 G4Region* aEnvelope ) :
63 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
64 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
65
66//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67
69 G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
70 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
71
72//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
79 aParticleType ) {
80 return aParticleType.GetPDGCharge() != 0; // Applicable for all charged particles
81}
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
85G4bool Par02FastSimModelTracker::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
86 return true; // No kinematical restrictions to apply the parametrisation
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90
92 G4FastStep& aFastStep ) {
93
94 G4cout << " ________Tracker model triggered _________" << G4endl;
95
96 // Calculate the final position (at the outer boundary of the tracking detector)
97 // of the particle with the momentum at the entrance of the tracking detector.
98
99 G4Track track = * aFastTrack.GetPrimaryTrack();
100 G4FieldTrack aFieldTrack( '0' );
101 G4FieldTrackUpdator::Update( &aFieldTrack, &track );
102
103 G4double retSafety = -1.0;
104 ELimited retStepLimited;
105 G4FieldTrack endTrack( 'a' );
106 G4double currentMinimumStep = 10.0*m; // Temporary: change that to sth connected
107 // to particle momentum.
108 G4PathFinder* fPathFinder = G4PathFinder::GetInstance();
109 /*G4double lengthAlongCurve = */
110 fPathFinder->ComputeStep( aFieldTrack,
111 currentMinimumStep,
112 0,
113 aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(),
114 retSafety,
115 retStepLimited,
116 endTrack,
117 aFastTrack.GetPrimaryTrack()->GetVolume() );
118
119 // Place the particle at the tracking detector exit
120 // (at the place it would reach without the change of its momentum).
121 aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() );
122
123 // Consider only primary tracks (do nothing else for secondary charged particles)
124 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
125 if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
126 auto info = (Par02EventInformation*)
127 G4EventManager::GetEventManager()->GetUserInformation();
128 if ( info->GetDoSmearing() ) {
129 // Smearing according to the tracking detector resolution
130 G4double res = fCalculateParametrisation->
132 fParametrisation, Porg.mag() );
133 G4double eff = fCalculateParametrisation->
135 fParametrisation, Porg.mag() );
136 G4ThreeVector Psm;
137 Psm = Par02Smearer::Instance()->
138 SmearMomentum( aFastTrack.GetPrimaryTrack(), res );
139 Par02Output::Instance()->FillHistogram( 0, ((Psm.mag()/MeV) / (Porg.mag()/MeV)) );
140 // Setting the values of Psm, res and eff
142 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
143 GetUserInformation() ) )->SetTrackerMomentum( Psm );
145 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
146 GetUserInformation() ) )->SetTrackerResolution( res );
148 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
149 GetUserInformation() ) )->SetTrackerEfficiency( eff );
150 } else {
151 // No smearing: simply setting the value of Porg
153 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
154 GetUserInformation() ) )->SetTrackerMomentum( Porg );
155 }
156 }
157}
158
159//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160
Definition of the Par02EventInformation class.
Definition of the Par02FastSimModelTracker class.
Definition of the Par02Output class.
Definition of the Par02PrimaryParticleInformation class.
Definition of the Par02Smearer class.
Definition of detector resolution and efficiency.
Parametrisation
A parametrisation type (CMS, ATLAS, ALEPH).
virtual G4bool ModelTrigger(const G4FastTrack &aFastTrack)
Checks if the model should be applied taking into account the kinematics of a track.
virtual void DoIt(const G4FastTrack &aFastTrack, G4FastStep &aFastStep)
Calculates the final position (at the outer boundary of the tracking detector) of a particle with the...
Par02DetectorParametrisation * fCalculateParametrisation
A pointer to Par02DetectorParametrisation used to get the efficiency and resolution of the tracking d...
Par02FastSimModelTracker(G4String aModelName, G4Region *aEnvelope, Par02DetectorParametrisation::Parametrisation aParamType)
A constructor.
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticle)
Checks if this model should be applied to this particle type.
Par02DetectorParametrisation::Parametrisation fParametrisation
A parametrisation type.
void FillHistogram(G4int HNo, G4double value) const
Fills the histogram.
static Par02Output * Instance()
Allows the access to the unique Par02Output object.
static Par02Smearer * Instance()
Allows the access to the unique Par02Smearer class object.

Applications | User Support | Publications | Collaboration