Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file Par02FastSimModelEMCal.cc 27 /// \file Par02FastSimModelEMCal.cc 28 /// \brief Implementation of the Par02FastSimM 28 /// \brief Implementation of the Par02FastSimModelEMCal class 29 29 30 #include "Par02FastSimModelEMCal.hh" 30 #include "Par02FastSimModelEMCal.hh" 31 << 32 #include "Par02EventInformation.hh" 31 #include "Par02EventInformation.hh" 33 #include "Par02Output.hh" << 34 #include "Par02PrimaryParticleInformation.hh" 32 #include "Par02PrimaryParticleInformation.hh" 35 #include "Par02Smearer.hh" 33 #include "Par02Smearer.hh" >> 34 #include "Par02Output.hh" 36 35 37 #include "G4AnalysisManager.hh" << 36 #include "G4Track.hh" 38 #include "G4Electron.hh" << 39 #include "G4Event.hh" 37 #include "G4Event.hh" 40 #include "G4Gamma.hh" << 41 #include "G4Positron.hh" << 42 #include "G4RunManager.hh" 38 #include "G4RunManager.hh" 43 #include "G4SystemOfUnits.hh" << 39 #include "g4root.hh" 44 #include "G4Track.hh" << 40 45 #include "Randomize.hh" 41 #include "Randomize.hh" >> 42 #include "G4SystemOfUnits.hh" >> 43 >> 44 #include "G4Electron.hh" >> 45 #include "G4Positron.hh" >> 46 #include "G4Gamma.hh" 46 47 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 49 49 Par02FastSimModelEMCal::Par02FastSimModelEMCal << 50 Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName, 50 << 51 G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType ) : 51 : G4VFastSimulationModel(aModelName, aEnvelo << 52 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(), 52 fCalculateParametrisation(), << 53 fParametrisation( aType ) {} 53 fParametrisation(aType) << 54 {} << 55 54 56 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 56 58 Par02FastSimModelEMCal::Par02FastSimModelEMCal << 57 Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName, 59 : G4VFastSimulationModel(aModelName, aEnvelo << 58 G4Region* aEnvelope ) : 60 fCalculateParametrisation(), << 59 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(), 61 fParametrisation(Par02DetectorParametrisat << 60 fParametrisation( Par02DetectorParametrisation::eCMS ) {} 62 {} << 63 61 64 //....oooOO0OOooo........oooOO0OOooo........oo 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 65 63 66 Par02FastSimModelEMCal::Par02FastSimModelEMCal << 64 Par02FastSimModelEMCal::Par02FastSimModelEMCal( G4String aModelName ) : 67 : G4VFastSimulationModel(aModelName), << 65 G4VFastSimulationModel( aModelName ), fCalculateParametrisation(), 68 fCalculateParametrisation(), << 66 fParametrisation( Par02DetectorParametrisation::eCMS ) {} 69 fParametrisation(Par02DetectorParametrisat << 70 {} << 71 67 72 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 69 74 Par02FastSimModelEMCal::~Par02FastSimModelEMCa << 70 Par02FastSimModelEMCal::~Par02FastSimModelEMCal() {} 75 71 76 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 73 78 G4bool Par02FastSimModelEMCal::IsApplicable(co << 74 G4bool Par02FastSimModelEMCal::IsApplicable( 79 { << 75 const G4ParticleDefinition& aParticleType ) { 80 // Applicable for electrons, positrons, and 76 // Applicable for electrons, positrons, and gammas 81 return &aParticleType == G4Electron::Definit << 77 return &aParticleType == G4Electron::Definition() || 82 || &aParticleType == G4Gamma::Definit << 78 &aParticleType == G4Positron::Definition() || >> 79 &aParticleType == G4Gamma::Definition(); 83 } 80 } 84 81 85 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 86 83 87 G4bool Par02FastSimModelEMCal::ModelTrigger(co << 84 G4bool Par02FastSimModelEMCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) { 88 { << 89 return true; // No kinematical restrictions 85 return true; // No kinematical restrictions to apply the parametrisation 90 } 86 } 91 87 92 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 93 89 94 void Par02FastSimModelEMCal::DoIt(const G4Fast << 90 void Par02FastSimModelEMCal::DoIt( const G4FastTrack& aFastTrack, 95 { << 91 G4FastStep& aFastStep ) { 96 // G4cout << " ________EMCal model triggered << 92 //G4cout << " ________EMCal model triggered _________" << G4endl; 97 93 98 // Kill the parameterised particle at the en 94 // Kill the parameterised particle at the entrance of the electromagnetic calorimeter 99 aFastStep.KillPrimaryTrack(); 95 aFastStep.KillPrimaryTrack(); 100 aFastStep.ProposePrimaryTrackPathLength(0.0) << 96 aFastStep.ProposePrimaryTrackPathLength( 0.0 ); 101 G4double Edep = aFastTrack.GetPrimaryTrack() 97 G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy(); 102 98 103 // Consider only primary tracks (do nothing 99 // Consider only primary tracks (do nothing else for secondary e-, e+, gammas) 104 G4ThreeVector Pos = aFastTrack.GetPrimaryTra 100 G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition(); 105 if (!aFastTrack.GetPrimaryTrack()->GetParent << 101 if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) { 106 auto info = (Par02EventInformation*)G4Even << 102 Par02EventInformation* info = (Par02EventInformation*) 107 if (info->GetDoSmearing()) { << 103 G4EventManager::GetEventManager()->GetUserInformation(); >> 104 if ( info->GetDoSmearing() ) { 108 // Smearing according to the electromagn 105 // Smearing according to the electromagnetic calorimeter resolution 109 G4ThreeVector Porg = aFastTrack.GetPrima 106 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum(); 110 G4double res = fCalculateParametrisation << 107 G4double res = fCalculateParametrisation->GetResolution( 111 << 108 Par02DetectorParametrisation::eEMCAL, fParametrisation, Porg.mag() ); 112 G4double eff = fCalculateParametrisation << 109 G4double eff = fCalculateParametrisation->GetEfficiency( 113 << 110 Par02DetectorParametrisation::eEMCAL, fParametrisation, Porg.mag() ); 114 G4double Esm; 111 G4double Esm; 115 Esm = std::abs(Par02Smearer::Instance()- << 112 Esm = std::abs( Par02Smearer::Instance()-> 116 Par02Output::Instance()->FillHistogram(1 << 113 SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) ); >> 114 Par02Output::Instance()->FillHistogram( 1, (Esm/MeV) / (Edep/MeV) ); 117 // Setting the values of Pos, Esm, res a 115 // Setting the values of Pos, Esm, res and eff 118 ((Par02PrimaryParticleInformation*)(cons << 116 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 119 aF << 117 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 120 << 118 GetUserInformation() ) )->SetEMCalPosition( Pos ); 121 << 119 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 122 -> << 120 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 123 ->SetEMCalPosition(Pos); << 121 GetUserInformation() ) )->SetEMCalEnergy( Esm ); 124 ((Par02PrimaryParticleInformation*)(cons << 122 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 125 aF << 123 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 126 << 124 GetUserInformation() ) )->SetEMCalResolution( res ); 127 << 125 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 128 -> << 126 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 129 ->SetEMCalEnergy(Esm); << 127 GetUserInformation() ) )->SetEMCalEfficiency( eff ); 130 ((Par02PrimaryParticleInformation*)(cons << 131 aF << 132 << 133 << 134 -> << 135 ->SetEMCalResolution(res); << 136 ((Par02PrimaryParticleInformation*)(cons << 137 aF << 138 << 139 << 140 -> << 141 ->SetEMCalEfficiency(eff); << 142 // The (smeared) energy of the particle 128 // The (smeared) energy of the particle is deposited in the step 143 // (which corresponds to the entrance of 129 // (which corresponds to the entrance of the electromagnetic calorimeter) 144 aFastStep.ProposeTotalEnergyDeposited(Es << 130 aFastStep.ProposeTotalEnergyDeposited( Esm ); 145 } << 131 } else { 146 else { << 147 // No smearing: simply setting the value 132 // No smearing: simply setting the value of Edep 148 ((Par02PrimaryParticleInformation*)(cons << 133 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 149 aF << 134 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 150 << 135 GetUserInformation() ) )->SetEMCalEnergy( Edep ); 151 << 152 -> << 153 ->SetEMCalEnergy(Edep); << 154 // The (initial) energy of the particle 136 // The (initial) energy of the particle is deposited in the step 155 // (which corresponds to the entrance of 137 // (which corresponds to the entrance of the electromagnetic calorimeter) 156 aFastStep.ProposeTotalEnergyDeposited(Ed << 138 aFastStep.ProposeTotalEnergyDeposited( Edep ); 157 } 139 } 158 } 140 } 159 } 141 } 160 142 161 //....oooOO0OOooo........oooOO0OOooo........oo 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 144 162 145