Loading...
Searching...
No Matches
Par02FastSimModelHCal.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 Par02FastSimModelHCal.cc
28/// \brief Implementation of the Par02FastSimModelHCal 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//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
48 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
49 fParametrisation( aType ) {}
50
51//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52
54 G4Region* aEnvelope ) :
55 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
56 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
57
58//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
61 G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
62 fParametrisation( Par02DetectorParametrisation::eCMS ) {}
63
64//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
71 G4bool isOk = false;
72 // Applicable to all hadrons, i.e. any particle made of quarks
73 if ( aParticleType.GetQuarkContent(1) +
74 aParticleType.GetQuarkContent(2) +
75 aParticleType.GetQuarkContent(3) +
76 aParticleType.GetQuarkContent(4) +
77 aParticleType.GetQuarkContent(5) +
78 aParticleType.GetQuarkContent(6) != 0 ) {
79 isOk = true;
80 }
81 return isOk;
82}
83
84//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85
86G4bool Par02FastSimModelHCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) {
87 return true; // No kinematical restrictions to apply the parametrisation
88}
89
90//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91
93 G4FastStep& aFastStep ) {
94 //G4cout << " ________HCal model triggered _________" << G4endl;
95
96 // Kill the parameterised particle at the entrance of the hadronic calorimeter
97 aFastStep.KillPrimaryTrack();
98 aFastStep.ProposePrimaryTrackPathLength( 0.0 );
99 G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
100
101 // Consider only primary tracks (do nothing else for secondary hadrons)
102 G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition();
103 if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
104 auto info = (Par02EventInformation*)
105 G4EventManager::GetEventManager()->GetUserInformation();
106 if ( info->GetDoSmearing() ) {
107 // Smearing according to the hadronic calorimeter resolution
108 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
109 G4double res = fCalculateParametrisation->
111 fParametrisation, Porg.mag() );
112 G4double eff = fCalculateParametrisation->
114 fParametrisation, Porg.mag() );
115 G4double Esm;
116 Esm = std::abs( Par02Smearer::Instance()->
117 SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) );
118 Par02Output::Instance()->FillHistogram( 2, (Esm/MeV) / (Edep/MeV) );
119 // Setting the values of Pos, Esm, res and eff
120 auto primaryInfo=
122 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
123 GetUserInformation() ) ;
124 primaryInfo->SetHCalPosition( Pos );
125 primaryInfo->SetHCalEnergy( Esm );
126 primaryInfo->SetHCalResolution( res );
127 primaryInfo->SetHCalEfficiency( eff );
128 // The (smeared) energy of the particle is deposited in the step
129 // (which corresponds to the entrance of the hadronic calorimeter)
130 aFastStep.ProposeTotalEnergyDeposited( Esm );
131 } else {
132 // No smearing: simply setting the value of Edep
134 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
135 GetUserInformation() ) )->SetHCalEnergy( Edep );
136 // The (initial) energy of the particle is deposited in the step
137 // (which corresponds to the entrance of the hadronic calorimeter)
138 aFastStep.ProposeTotalEnergyDeposited( Edep );
139 }
140 }
141}
142
143//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144
Definition of the Par02EventInformation class.
Definition of the Par02FastSimModelHCal 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).
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,...
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticle)
Checks if this model should be applied to this particle type.
Par02FastSimModelHCal(G4String aModelName, G4Region *aEnvelope, Par02DetectorParametrisation::Parametrisation aParamType)
A constructor.
Par02DetectorParametrisation * fCalculateParametrisation
A pointer to Par02DetectorParametrisation used to get the efficiency and resolution of the detector f...
Par02DetectorParametrisation::Parametrisation fParametrisation
A parametrisation type.
void FillHistogram(G4int HNo, G4double value) const
Fills the histogram.
static Par02Output * Instance()
Allows the access to the unique Par02Output object.
void SetHCalPosition(G4ThreeVector aPosition)
Sets the position of the energy deposit in the hadronic calorimeter.
static Par02Smearer * Instance()
Allows the access to the unique Par02Smearer class object.

Applications | User Support | Publications | Collaboration