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 Par02FastSimModelHCal.cc 27 /// \file Par02FastSimModelHCal.cc 28 /// \brief Implementation of the Par02FastSimM 28 /// \brief Implementation of the Par02FastSimModelHCal class 29 29 30 #include "Par02FastSimModelHCal.hh" 30 #include "Par02FastSimModelHCal.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 "G4Event.hh" 37 #include "G4Event.hh" 39 #include "G4RunManager.hh" 38 #include "G4RunManager.hh" 40 #include "G4SystemOfUnits.hh" << 39 #include "g4root.hh" 41 #include "G4Track.hh" << 40 42 #include "Randomize.hh" 41 #include "Randomize.hh" >> 42 #include "G4SystemOfUnits.hh" 43 43 44 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 45 46 Par02FastSimModelHCal::Par02FastSimModelHCal(G << 46 Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName, 47 P << 47 G4Region* aEnvelope, Par02DetectorParametrisation::Parametrisation aType ) : 48 : G4VFastSimulationModel(aModelName, aEnvelo << 48 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(), 49 fCalculateParametrisation(), << 49 fParametrisation( aType ) {} 50 fParametrisation(aType) << 51 {} << 52 50 53 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 54 52 55 Par02FastSimModelHCal::Par02FastSimModelHCal(G << 53 Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName, 56 : G4VFastSimulationModel(aModelName, aEnvelo << 54 G4Region* aEnvelope ) : 57 fCalculateParametrisation(), << 55 G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(), 58 fParametrisation(Par02DetectorParametrisat << 56 fParametrisation( Par02DetectorParametrisation::eCMS ) {} 59 {} << 60 57 61 //....oooOO0OOooo........oooOO0OOooo........oo 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 59 63 Par02FastSimModelHCal::Par02FastSimModelHCal(G << 60 Par02FastSimModelHCal::Par02FastSimModelHCal( G4String aModelName ) : 64 : G4VFastSimulationModel(aModelName), << 61 G4VFastSimulationModel( aModelName ), fCalculateParametrisation(), 65 fCalculateParametrisation(), << 62 fParametrisation( Par02DetectorParametrisation::eCMS ) {} 66 fParametrisation(Par02DetectorParametrisat << 67 {} << 68 63 69 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 65 71 Par02FastSimModelHCal::~Par02FastSimModelHCal( << 66 Par02FastSimModelHCal::~Par02FastSimModelHCal() {} 72 67 73 //....oooOO0OOooo........oooOO0OOooo........oo 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 69 75 G4bool Par02FastSimModelHCal::IsApplicable(con << 70 G4bool Par02FastSimModelHCal::IsApplicable( const G4ParticleDefinition& aParticleType ) { 76 { << 77 G4bool isOk = false; 71 G4bool isOk = false; 78 // Applicable to all hadrons, i.e. any parti 72 // Applicable to all hadrons, i.e. any particle made of quarks 79 if (aParticleType.GetQuarkContent(1) + aPart << 73 if ( aParticleType.GetQuarkContent(1) + 80 + aParticleType.GetQuarkContent(3) + a << 74 aParticleType.GetQuarkContent(2) + 81 + aParticleType.GetQuarkContent(5) + a << 75 aParticleType.GetQuarkContent(3) + 82 != 0) << 76 aParticleType.GetQuarkContent(4) + 83 { << 77 aParticleType.GetQuarkContent(5) + >> 78 aParticleType.GetQuarkContent(6) != 0 ) { 84 isOk = true; 79 isOk = true; 85 } 80 } 86 return isOk; << 81 return isOk; 87 } 82 } 88 83 89 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 90 85 91 G4bool Par02FastSimModelHCal::ModelTrigger(con << 86 G4bool Par02FastSimModelHCal::ModelTrigger( const G4FastTrack& /*aFastTrack*/ ) { 92 { << 93 return true; // No kinematical restrictions 87 return true; // No kinematical restrictions to apply the parametrisation 94 } 88 } 95 89 96 //....oooOO0OOooo........oooOO0OOooo........oo 90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 97 91 98 void Par02FastSimModelHCal::DoIt(const G4FastT << 92 void Par02FastSimModelHCal::DoIt( const G4FastTrack& aFastTrack, 99 { << 93 G4FastStep& aFastStep ) { 100 // G4cout << " ________HCal model triggered << 94 //G4cout << " ________HCal model triggered _________" << G4endl; 101 95 102 // Kill the parameterised particle at the en 96 // Kill the parameterised particle at the entrance of the hadronic calorimeter 103 aFastStep.KillPrimaryTrack(); 97 aFastStep.KillPrimaryTrack(); 104 aFastStep.ProposePrimaryTrackPathLength(0.0) << 98 aFastStep.ProposePrimaryTrackPathLength( 0.0 ); 105 G4double Edep = aFastTrack.GetPrimaryTrack() 99 G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy(); 106 100 107 // Consider only primary tracks (do nothing 101 // Consider only primary tracks (do nothing else for secondary hadrons) 108 G4ThreeVector Pos = aFastTrack.GetPrimaryTra 102 G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition(); 109 if (!aFastTrack.GetPrimaryTrack()->GetParent << 103 if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) { 110 auto info = (Par02EventInformation*)G4Even << 104 Par02EventInformation* info = (Par02EventInformation*) 111 if (info->GetDoSmearing()) { << 105 G4EventManager::GetEventManager()->GetUserInformation(); >> 106 if ( info->GetDoSmearing() ) { 112 // Smearing according to the hadronic ca 107 // Smearing according to the hadronic calorimeter resolution 113 G4ThreeVector Porg = aFastTrack.GetPrima 108 G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum(); 114 G4double res = fCalculateParametrisation << 109 G4double res = fCalculateParametrisation-> 115 << 110 GetResolution( Par02DetectorParametrisation::eHCAL, 116 G4double eff = fCalculateParametrisation << 111 fParametrisation, Porg.mag() ); 117 << 112 G4double eff = fCalculateParametrisation-> >> 113 GetEfficiency( Par02DetectorParametrisation::eHCAL, >> 114 fParametrisation, Porg.mag() ); 118 G4double Esm; 115 G4double Esm; 119 Esm = std::abs(Par02Smearer::Instance()- << 116 Esm = std::abs( Par02Smearer::Instance()-> 120 Par02Output::Instance()->FillHistogram(2 << 117 SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) ); >> 118 Par02Output::Instance()->FillHistogram( 2, (Esm/MeV) / (Edep/MeV) ); 121 // Setting the values of Pos, Esm, res a 119 // Setting the values of Pos, Esm, res and eff 122 auto primaryInfo = static_cast<Par02Prim << 120 Par02PrimaryParticleInformation* primaryInfo= 123 (aFastTrack.GetPrimaryTrack()->GetDyna << 121 static_cast<Par02PrimaryParticleInformation*>( 124 ->GetUserInformation()); << 122 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 125 primaryInfo->SetHCalPosition(Pos); << 123 GetUserInformation() ) ; 126 primaryInfo->SetHCalEnergy(Esm); << 124 primaryInfo->SetHCalPosition( Pos ); 127 primaryInfo->SetHCalResolution(res); << 125 primaryInfo->SetHCalEnergy( Esm ); 128 primaryInfo->SetHCalEfficiency(eff); << 126 primaryInfo->SetHCalResolution( res ); >> 127 primaryInfo->SetHCalEfficiency( eff ); 129 // The (smeared) energy of the particle 128 // The (smeared) energy of the particle is deposited in the step 130 // (which corresponds to the entrance of 129 // (which corresponds to the entrance of the hadronic calorimeter) 131 aFastStep.ProposeTotalEnergyDeposited(Es << 130 aFastStep.ProposeTotalEnergyDeposited( Esm ); 132 } << 131 } else { 133 else { << 134 // No smearing: simply setting the value 132 // No smearing: simply setting the value of Edep 135 ((Par02PrimaryParticleInformation*)(cons << 133 ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* > 136 aF << 134 ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )-> 137 << 135 GetUserInformation() ) )->SetHCalEnergy( Edep ); 138 << 139 -> << 140 ->SetHCalEnergy(Edep); << 141 // The (initial) energy of the particle 136 // The (initial) energy of the particle is deposited in the step 142 // (which corresponds to the entrance of 137 // (which corresponds to the entrance of the hadronic calorimeter) 143 aFastStep.ProposeTotalEnergyDeposited(Ed << 138 aFastStep.ProposeTotalEnergyDeposited( Edep ); 144 } 139 } 145 } 140 } 146 } 141 } 147 142 148 //....oooOO0OOooo........oooOO0OOooo........oo 143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 144 149 145