ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Par02FastSimModelHCal.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Par02FastSimModelHCal.cc
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 //
29 
30 #include "Par02FastSimModelHCal.hh"
31 #include "Par02EventInformation.hh"
33 #include "Par02Smearer.hh"
34 #include "Par02Output.hh"
35 
36 #include "G4Track.hh"
37 #include "G4Event.hh"
38 #include "G4RunManager.hh"
39 #include "g4root.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 
87  return true; // No kinematical restrictions to apply the parametrisation
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
92 void Par02FastSimModelHCal::DoIt( const G4FastTrack& aFastTrack,
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() ) {
106  if ( info->GetDoSmearing() ) {
107  // Smearing according to the hadronic calorimeter resolution
108  G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
110  GetResolution( Par02DetectorParametrisation::eHCAL,
111  fParametrisation, Porg.mag() );
113  GetEfficiency( Par02DetectorParametrisation::eHCAL,
114  fParametrisation, Porg.mag() );
115  G4double Esm;
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  Par02PrimaryParticleInformation* primaryInfo=
121  static_cast<Par02PrimaryParticleInformation*>(
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
133  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
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