ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Par02FastSimModelTracker.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Par02FastSimModelTracker.cc
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 //
29 
31 #include "Par02EventInformation.hh"
33 #include "Par02Smearer.hh"
34 #include "Par02Output.hh"
35 
36 #include "G4Track.hh"
37 #include "G4Event.hh"
38 #include "G4RunManager.hh"
39 #include "g4root.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 
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() ) {
128  if ( info->GetDoSmearing() ) {
129  // Smearing according to the tracking detector resolution
132  fParametrisation, Porg.mag() );
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
141  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
142  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
143  GetUserInformation() ) )->SetTrackerMomentum( Psm );
144  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
145  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
146  GetUserInformation() ) )->SetTrackerResolution( res );
147  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
148  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
149  GetUserInformation() ) )->SetTrackerEfficiency( eff );
150  } else {
151  // No smearing: simply setting the value of Porg
152  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
153  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
154  GetUserInformation() ) )->SetTrackerMomentum( Porg );
155  }
156  }
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160