Geant4  10.02.p03
Par02TrackingAction.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 
31 #include "Par02TrackingAction.hh"
32 #include "Par02EventInformation.hh"
34 #include "Par02Output.hh"
35 
36 #include "G4ThreeVector.hh"
37 #include "G4EventManager.hh"
38 #include "G4RunManager.hh"
39 
40 #include "Randomize.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4TrackingManager.hh"
43 #include <iomanip>
44 #include <vector>
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
56 void Par02TrackingAction::PreUserTrackingAction( const G4Track* aTrack ) {
57  // Kill the tracks that have a small transverse momentum or that are not
58  // in the central region.
59  if ( aTrack->GetMomentum().perp() < 1.0*MeV ||
60  std::abs( aTrack->GetMomentum().pseudoRapidity() ) > 5.5 ) {
61  ( (G4Track*) aTrack )->SetTrackStatus( fStopAndKill );
62  }
63 }
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
67 void Par02TrackingAction::PostUserTrackingAction( const G4Track* aTrack ) {
68  if ( aTrack->GetTrackStatus() == fStopAndKill && aTrack->GetParentID() == 0 ) {
70  aTrack->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation();
71  //info->Print();
73  info->GetPartID(),
74  info->GetPDG(),
75  info->GetMCMomentum()/MeV );
77  info->GetPartID(),
78  info->GetPDG(),
79  info->GetTrackerMomentum()/MeV,
80  info->GetTrackerResolution(),
81  info->GetTrackerEfficiency() );
83  info->GetPartID(),
84  info->GetPDG(),
85  info->GetEMCalPosition()/mm,
86  info->GetEMCalResolution(),
87  info->GetEMCalEfficiency(),
88  info->GetEMCalEnergy()/MeV );
90  info->GetPartID(),
91  info->GetPDG(),
92  info->GetHCalPosition()/mm,
93  info->GetHCalResolution(),
94  info->GetHCalEfficiency(),
95  info->GetHCalEnergy()/MeV );
96  }
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
G4double GetHCalEnergy()
Sets the energy deposit in the hadronic calorimeter.
Definition of the Par02EventInformation class.
G4int GetPDG() const
Gets the standard PDG code. Can be set only in the constructor.
static const double MeV
Definition: G4SIunits.hh:211
G4ThreeVector GetTrackerMomentum()
Gets the particle momentum at the entrance to the tracker detector.
Par02TrackingAction()
A default constructor.
virtual void PreUserTrackingAction(const G4Track *track)
G4ThreeVector GetEMCalPosition()
Gets the position of the energy deposit in the electromagnetic calorimeter.
Definition of the Par02PrimaryParticleInformation class.
G4ThreeVector GetHCalPosition()
Gets the position of the energy deposit in the hadronic calorimeter.
Definition of the Par02Output class.
static Par02Output * Instance()
Definition: Par02Output.cc:60
void SaveTrack(SaveType aWhatToSave, G4int aPartID, G4int aPDG, G4ThreeVector aVector, G4double aResolution=0, G4double aEfficiency=1, G4double aEnergy=0)
Definition: Par02Output.cc:162
Definition of the Par02TrackingAction class.
G4ThreeVector GetMCMomentum()
Gets the initial particle momentum (from particle generator).
G4double GetEMCalEnergy()
Sets the energy deposit in the electromagnetic calorimeter.
virtual void PostUserTrackingAction(const G4Track *track)
G4int GetPartID() const
Gets the particle unique ID (within event). Can be set only in the constructor.
static const double mm
Definition: G4SIunits.hh:114