Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id: $
27 //
30 
32 #include "Par02EventInformation.hh"
34 #include "Par02Smearer.hh"
35 #include "Par02Output.hh"
36 
37 #include "G4Track.hh"
38 #include "G4Event.hh"
39 #include "G4RunManager.hh"
40 #include "g4root.hh"
41 
42 #include "Randomize.hh"
43 
44 #include "G4Electron.hh"
45 #include "G4Positron.hh"
46 #include "G4Gamma.hh"
47 
48 #include "G4PathFinder.hh"
49 #include "G4FieldTrack.hh"
50 #include "G4FieldTrackUpdator.hh"
51 #include "G4SystemOfUnits.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
57  G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
58  fParametrisation( aType ) {}
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63  G4Region* aEnvelope ) :
64  G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
65  fParametrisation( Par02DetectorParametrisation::eCMS ) {}
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70  G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
71  fParametrisation( Par02DetectorParametrisation::eCMS ) {}
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
80  aParticleType ) {
81  return aParticleType.GetPDGCharge() != 0; // Applicable for all charged particles
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87  return true; // No kinematical restrictions to apply the parametrisation
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93  G4FastStep& aFastStep ) {
94 
95  G4cout << " ________Tracker model triggered _________" << G4endl;
96 
97  // Calculate the final position (at the outer boundary of the tracking detector)
98  // of the particle with the momentum at the entrance of the tracking detector.
99 
100  G4Track track = * aFastTrack.GetPrimaryTrack();
101  G4FieldTrack aFieldTrack( '0' );
102  G4FieldTrackUpdator::Update( &aFieldTrack, &track );
103 
104  G4double retSafety = -1.0;
105  ELimited retStepLimited;
106  G4FieldTrack endTrack( 'a' );
107  G4double currentMinimumStep = 10.0*m; // Temporary: change that to sth connected
108  // to particle momentum.
109  G4PathFinder* fPathFinder = G4PathFinder::GetInstance();
110  /*G4double lengthAlongCurve = */
111  fPathFinder->ComputeStep( aFieldTrack,
112  currentMinimumStep,
113  0,
114  aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(),
115  retSafety,
116  retStepLimited,
117  endTrack,
118  aFastTrack.GetPrimaryTrack()->GetVolume() );
119 
120  // Place the particle at the tracking detector exit
121  // (at the place it would reach without the change of its momentum).
122  aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() );
123 
124  // Consider only primary tracks (do nothing else for secondary charged particles)
125  G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
126  if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
129  if ( info->GetDoSmearing() ) {
130  // Smearing according to the tracking detector resolution
131  G4double res = fCalculateParametrisation->
133  fParametrisation, Porg.mag() );
134  G4double eff = fCalculateParametrisation->
136  fParametrisation, Porg.mag() );
137  G4ThreeVector Psm;
138  Psm = Par02Smearer::Instance()->
139  SmearMomentum( aFastTrack.GetPrimaryTrack(), res );
140  Par02Output::Instance()->FillHistogram( 0, ((Psm.mag()/MeV) / (Porg.mag()/MeV)) );
141  // Setting the values of Psm, res and eff
142  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
143  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
144  GetUserInformation() ) )->SetTrackerMomentum( Psm );
145  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
146  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
147  GetUserInformation() ) )->SetTrackerResolution( res );
148  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
149  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
150  GetUserInformation() ) )->SetTrackerEfficiency( eff );
151  } else {
152  // No smearing: simply setting the value of Porg
153  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
154  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
155  GetUserInformation() ) )->SetTrackerMomentum( Porg );
156  }
157  }
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161 
static G4PathFinder * GetInstance()
Definition: G4PathFinder.cc:57
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4int GetParentID() const
Definition of the Par02EventInformation class.
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
static Par02Smearer * Instance()
Definition: Par02Smearer.cc:59
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticle)
const G4DynamicParticle * GetDynamicParticle() const
ELimited
virtual G4bool ModelTrigger(const G4FastTrack &aFastTrack)
Par02FastSimModelTracker(G4String aModelName, G4Region *aEnvelope, Par02DetectorParametrisation::Parametrisation aParamType)
Parametrisation
A parametrisation type (CMS, ATLAS, ALEPH).
Definition of the Par02PrimaryParticleInformation class.
void FillHistogram(G4int HNo, G4double value) const
Definition: Par02Output.cc:219
Definition of the Par02Smearer class.
void ProposePrimaryTrackFinalPosition(const G4ThreeVector &, G4bool localCoordinates=true)
Definition: G4FastStep.cc:99
G4GLOB_DLL std::ostream G4cout
G4int GetCurrentStepNumber() const
static constexpr double m
Definition: G4SIunits.hh:129
bool G4bool
Definition: G4Types.hh:79
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
Definition of the Par02Output class.
static Par02Output * Instance()
Definition: Par02Output.cc:60
G4PrimaryParticle * GetPrimaryParticle() const
G4ThreeVector GetMomentum() const
virtual void DoIt(const G4FastTrack &aFastTrack, G4FastStep &aFastStep)
static G4EventManager * GetEventManager()
G4VPhysicalVolume * GetVolume() const
Definition of the Par02FastSimModelTracker class.
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
double mag() const
G4bool GetDoSmearing()
Gets the flag indicating if smearing should be done.
static void Update(G4FieldTrack *, const G4Track *)
G4VUserEventInformation * GetUserInformation()