Geant4  10.02
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  //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  G4ThreeVector spin = aFastTrack.GetPrimaryTrack()->GetPolarization() ;
99  G4FieldTrack theFieldTrack =
100  G4FieldTrack( aFastTrack.GetPrimaryTrack()->GetPosition(),
101  aFastTrack.GetPrimaryTrack()->GetMomentumDirection(),
102  0.0,
103  aFastTrack.GetPrimaryTrack()->GetKineticEnergy(),
104  aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->
105  GetDefinition()->GetPDGMass(),
106  0.0, // UNUSED: aFastTrack.GetPrimaryTrack().GetVelocity(),
107  aFastTrack.GetPrimaryTrack()->GetGlobalTime(), // Lab.
108  aFastTrack.GetPrimaryTrack()->GetProperTime(), // Part.
109  &spin );
110  G4double retSafety = -1.0;
111  ELimited retStepLimited;
112  G4FieldTrack endTrack( 'a' );
113  G4double currentMinimumStep = 10.0*m; // Temporary: change that to sth connected
114  // to particle momentum.
115  G4PathFinder* fPathFinder = G4PathFinder::GetInstance();
116  /*G4double lengthAlongCurve = */
117  fPathFinder->ComputeStep( theFieldTrack,
118  currentMinimumStep,
119  0,
120  aFastTrack.GetPrimaryTrack()->GetCurrentStepNumber(),
121  retSafety,
122  retStepLimited,
123  endTrack,
124  aFastTrack.GetPrimaryTrack()->GetVolume() ) ;
125  // Place the particle at the tracking detector exit
126  // (at the place it would reach without the change of its momentum).
127  aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() );
128 
129  // Consider only primary tracks (do nothing else for secondary charged particles)
130  G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
131  if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
134  if ( info->GetDoSmearing() ) {
135  // Smearing according to the tracking detector resolution
138  fParametrisation, Porg.mag() );
141  fParametrisation, Porg.mag() );
142  G4ThreeVector Psm;
143  Psm = Par02Smearer::Instance()->
144  SmearMomentum( aFastTrack.GetPrimaryTrack(), res );
145  Par02Output::Instance()->FillHistogram( 0, ((Psm.mag()/MeV) / (Porg.mag()/MeV)) );
146  // Setting the values of Psm, res and eff
147  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
148  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
149  GetUserInformation() ) )->SetTrackerMomentum( Psm );
150  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
151  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
152  GetUserInformation() ) )->SetTrackerResolution( res );
153  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
154  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
155  GetUserInformation() ) )->SetTrackerEfficiency( eff );
156  } else {
157  // No smearing: simply setting the value of Porg
158  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
159  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
160  GetUserInformation() ) )->SetTrackerMomentum( Porg );
161  }
162  }
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
static G4PathFinder * GetInstance()
Definition: G4PathFinder.cc:57
G4int GetParentID() const
const G4ThreeVector & GetPolarization() const
Definition of the Par02EventInformation class.
static const double MeV
Definition: G4SIunits.hh:211
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
Definition of detector resolution and efficiency.
static Par02Smearer * Instance()
Allows the access to the unique Par02Smearer class object.
Definition: Par02Smearer.cc:59
G4double GetProperTime() const
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticle)
Checks if this model should be applied to this particle type.
CLHEP::Hep3Vector G4ThreeVector
const G4DynamicParticle * GetDynamicParticle() const
ELimited
const G4ThreeVector & GetPosition() const
virtual G4bool ModelTrigger(const G4FastTrack &aFastTrack)
Checks if the model should be applied taking into account the kinematics of a track.
Par02FastSimModelTracker(G4String aModelName, G4Region *aEnvelope, Par02DetectorParametrisation::Parametrisation aParamType)
A constructor.
Parametrisation
A parametrisation type (CMS, ATLAS, ALEPH).
Definition of the Par02PrimaryParticleInformation class.
void FillHistogram(G4int HNo, G4double value) const
Fills the histogram.
Definition: Par02Output.cc:219
Definition of the Par02Smearer class.
G4double GetKineticEnergy() const
void ProposePrimaryTrackFinalPosition(const G4ThreeVector &, G4bool localCoordinates=true)
Definition: G4FastStep.cc:98
G4int GetCurrentStepNumber() const
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()
Allows the access to the unique Par02Output object.
Definition: Par02Output.cc:60
G4double GetGlobalTime() const
Par02DetectorParametrisation::Parametrisation fParametrisation
A parametrisation type.
G4PrimaryParticle * GetPrimaryParticle() const
G4ThreeVector GetMomentum() const
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...
const G4ThreeVector & GetMomentumDirection() const
static G4EventManager * GetEventManager()
G4VPhysicalVolume * GetVolume() const
Definition of the Par02FastSimModelTracker class.
static const double m
Definition: G4SIunits.hh:128
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
G4bool GetDoSmearing()
Gets the flag indicating if smearing should be done.
Par02DetectorParametrisation * fCalculateParametrisation
A pointer to Par02DetectorParametrisation used to get the efficiency and resolution of the tracking d...
G4VUserEventInformation * GetUserInformation()