Loading...
Searching...
No Matches
Par02FastSimModelEMCal.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 Par02FastSimModelEMCal.cc
28/// \brief Implementation of the Par02FastSimModelEMCal 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#include "G4SystemOfUnits.hh"
43
44#include "G4Electron.hh"
45#include "G4Positron.hh"
46#include "G4Gamma.hh"
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49
52 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
53 fParametrisation( aType ) {}
54
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
58 G4Region* aEnvelope ) :
59 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
60 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
65 G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
66 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
71
72//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
75 const G4ParticleDefinition& aParticleType ) {
76 // Applicable for electrons, positrons, and gammas
77 return &aParticleType == G4Electron::Definition() ||
78 &aParticleType == G4Positron::Definition() ||
79 &aParticleType == G4Gamma::Definition();
80}
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83
84G4bool Par02FastSimModelEMCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
85 return true; // No kinematical restrictions to apply the parametrisation
86}
87
88//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89
91 G4FastStep& aFastStep ) {
92 //G4cout << " ________EMCal model triggered _________" << G4endl;
93
94 // Kill the parameterised particle at the entrance of the electromagnetic calorimeter
95 aFastStep.KillPrimaryTrack();
96 aFastStep.ProposePrimaryTrackPathLength( 0.0 );
97 G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
98
99 // Consider only primary tracks (do nothing else for secondary e-, e+, gammas)
100 G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition();
101 if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
102 auto info = (Par02EventInformation*)
103 G4EventManager::GetEventManager()->GetUserInformation();
104 if ( info->GetDoSmearing() ) {
105 // Smearing according to the electromagnetic calorimeter resolution
106 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
111 G4double Esm;
112 Esm = std::abs( Par02Smearer::Instance()->
113 SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) );
114 Par02Output::Instance()->FillHistogram( 1, (Esm/MeV) / (Edep/MeV) );
115 // Setting the values of Pos, Esm, res and eff
117 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
118 GetUserInformation() ) )->SetEMCalPosition( Pos );
120 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
121 GetUserInformation() ) )->SetEMCalEnergy( Esm );
123 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
124 GetUserInformation() ) )->SetEMCalResolution( res );
126 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
127 GetUserInformation() ) )->SetEMCalEfficiency( eff );
128 // The (smeared) energy of the particle is deposited in the step
129 // (which corresponds to the entrance of the electromagnetic calorimeter)
130 aFastStep.ProposeTotalEnergyDeposited( Esm );
131 } else {
132 // No smearing: simply setting the value of Edep
134 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
135 GetUserInformation() ) )->SetEMCalEnergy( Edep );
136 // The (initial) energy of the particle is deposited in the step
137 // (which corresponds to the entrance of the electromagnetic calorimeter)
138 aFastStep.ProposeTotalEnergyDeposited( Edep );
139 }
140 }
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144
Definition of the Par02EventInformation class.
Definition of the Par02FastSimModelEMCal 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).
G4double GetEfficiency(Detector aDetector, Parametrisation aParametrisation, G4double aMomentum)
Gets the efficiency of a detector for a given particle.
G4double GetResolution(Detector aDetector, Parametrisation aParametrisation, G4double aMomentum)
Gets the resolution of a detector for a given particle.
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)
Smears the energy deposit and saves it, together with the position of the deposit,...
Par02DetectorParametrisation::Parametrisation fParametrisation
A parametrisation type.
Par02FastSimModelEMCal(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 * fCalculateParametrisation
A pointer to Par02DetectorParametrisation used to get the efficiency and resolution of the detector f...
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