Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id: $
27 //
30 
31 #include "Par02FastSimModelHCal.hh"
32 #include "Par02EventInformation.hh"
34 #include "Par02Smearer.hh"
35 #include "Par02Output.hh"
36 
37 #include "G4Track.hh"
38 #include "G4Event.hh"
39 #include "G4RunManager.hh"
40 #include "g4root.hh"
41 
42 #include "Randomize.hh"
43 #include "G4SystemOfUnits.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
49  G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
50  fParametrisation( aType ) {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  G4Region* aEnvelope ) :
56  G4VFastSimulationModel( aModelName, aEnvelope ), fCalculateParametrisation(),
57  fParametrisation( Par02DetectorParametrisation::eCMS ) {}
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62  G4VFastSimulationModel( aModelName ), fCalculateParametrisation(),
63  fParametrisation( Par02DetectorParametrisation::eCMS ) {}
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72  G4bool isOk = false;
73  // Applicable to all hadrons, i.e. any particle made of quarks
74  if ( aParticleType.GetQuarkContent(1) +
75  aParticleType.GetQuarkContent(2) +
76  aParticleType.GetQuarkContent(3) +
77  aParticleType.GetQuarkContent(4) +
78  aParticleType.GetQuarkContent(5) +
79  aParticleType.GetQuarkContent(6) != 0 ) {
80  isOk = true;
81  }
82  return isOk;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88  return true; // No kinematical restrictions to apply the parametrisation
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
93 void Par02FastSimModelHCal::DoIt( const G4FastTrack& aFastTrack,
94  G4FastStep& aFastStep ) {
95  //G4cout << " ________HCal model triggered _________" << G4endl;
96 
97  // Kill the parameterised particle at the entrance of the hadronic calorimeter
98  aFastStep.KillPrimaryTrack();
99  aFastStep.ProposePrimaryTrackPathLength( 0.0 );
100  G4double Edep = aFastTrack.GetPrimaryTrack()->GetKineticEnergy();
101 
102  // Consider only primary tracks (do nothing else for secondary hadrons)
103  G4ThreeVector Pos = aFastTrack.GetPrimaryTrack()->GetPosition();
104  if ( ! aFastTrack.GetPrimaryTrack()->GetParentID() ) {
107  if ( info->GetDoSmearing() ) {
108  // Smearing according to the hadronic calorimeter resolution
109  G4ThreeVector Porg = aFastTrack.GetPrimaryTrack()->GetMomentum();
110  G4double res = fCalculateParametrisation->
111  GetResolution( Par02DetectorParametrisation::eHCAL,
112  fParametrisation, Porg.mag() );
113  G4double eff = fCalculateParametrisation->
114  GetEfficiency( Par02DetectorParametrisation::eHCAL,
115  fParametrisation, Porg.mag() );
116  G4double Esm;
117  Esm = std::abs( Par02Smearer::Instance()->
118  SmearEnergy( aFastTrack.GetPrimaryTrack(), res ) );
119  Par02Output::Instance()->FillHistogram( 2, (Esm/MeV) / (Edep/MeV) );
120  // Setting the values of Pos, Esm, res and eff
121  Par02PrimaryParticleInformation* primaryInfo=
122  static_cast<Par02PrimaryParticleInformation*>(
123  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
124  GetUserInformation() ) ;
125  primaryInfo->SetHCalPosition( Pos );
126  primaryInfo->SetHCalEnergy( Esm );
127  primaryInfo->SetHCalResolution( res );
128  primaryInfo->SetHCalEfficiency( eff );
129  // The (smeared) energy of the particle is deposited in the step
130  // (which corresponds to the entrance of the hadronic calorimeter)
131  aFastStep.ProposeTotalEnergyDeposited( Esm );
132  } else {
133  // No smearing: simply setting the value of Edep
134  ( (Par02PrimaryParticleInformation*) ( const_cast< G4PrimaryParticle* >
135  ( aFastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetPrimaryParticle() )->
136  GetUserInformation() ) )->SetHCalEnergy( Edep );
137  // The (initial) energy of the particle is deposited in the step
138  // (which corresponds to the entrance of the hadronic calorimeter)
139  aFastStep.ProposeTotalEnergyDeposited( Edep );
140  }
141  }
142 }
143 
144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145 
const XML_Char XML_Encoding * info
Definition: expat.h:530
G4int GetParentID() const
Definition of the Par02EventInformation class.
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
static Par02Smearer * Instance()
Definition: Par02Smearer.cc:59
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticle)
const G4DynamicParticle * GetDynamicParticle() const
ush Pos
Definition: deflate.h:89
const G4ThreeVector & GetPosition() const
Parametrisation
A parametrisation type (CMS, ATLAS, ALEPH).
Par02FastSimModelHCal(G4String aModelName, G4Region *aEnvelope, Par02DetectorParametrisation::Parametrisation aParamType)
Definition of the Par02PrimaryParticleInformation class.
void FillHistogram(G4int HNo, G4double value) const
Definition: Par02Output.cc:219
Definition of the Par02Smearer class.
G4double GetKineticEnergy() const
bool G4bool
Definition: G4Types.hh:79
void ProposePrimaryTrackPathLength(G4double)
G4int GetQuarkContent(G4int flavor) const
Definition of the Par02Output class.
static Par02Output * Instance()
Definition: Par02Output.cc:60
G4PrimaryParticle * GetPrimaryParticle() const
G4ThreeVector GetMomentum() const
Definition of the Par02FastSimModelHCal class.
static G4EventManager * GetEventManager()
virtual void DoIt(const G4FastTrack &aFastTrack, G4FastStep &aFastStep)
void ProposeTotalEnergyDeposited(G4double anEnergyPart)
static constexpr double MeV
Definition: G4SIunits.hh:214
void KillPrimaryTrack()
Definition: G4FastStep.cc:88
virtual G4bool ModelTrigger(const G4FastTrack &aFastTrack)
double G4double
Definition: G4Types.hh:76
double mag() const
G4bool GetDoSmearing()
Gets the flag indicating if smearing should be done.
G4VUserEventInformation * GetUserInformation()