Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
Par01PionShowerModel.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 //
28 //
29 //
30 // $Id: Par01PionShowerModel.cc 101151 2016-11-08 08:06:16Z gcosmo $
31 //
32 #include "Par01PionShowerModel.hh"
33 #include "Par01EnergySpot.hh"
34 
35 #include "Randomize.hh"
36 
37 #include "G4PionMinus.hh"
38 #include "G4PionPlus.hh"
40 #include "G4VSensitiveDetector.hh"
41 #include "G4TouchableHistory.hh"
42 
43 #include "G4Colour.hh"
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 : G4VFastSimulationModel(modelName, envelope)
51 {
52  fFakeStep = new G4Step();
56  fpNavigator = new G4Navigator();
57  fNaviSetup = false;
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 : G4VFastSimulationModel(modelName)
64 {
65  fFakeStep = new G4Step();
69  fpNavigator = new G4Navigator();
70  fNaviSetup = false;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 {
77  delete fFakeStep;
78  delete fpNavigator;
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
82 
84 {
85  return
86  &particleType == G4PionMinus::PionMinusDefinition() ||
87  &particleType == G4PionPlus::PionPlusDefinition();
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
94  // Applies the parameterisation always:
95  // ie as soon as the pion enters the envelope
96  return true;
97 }
98 
99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
100 
102  G4FastStep& fastStep)
103 {
104  // G4cout << "Par01PionShowerModel::DoIt" << G4endl;
105 
106  // Kill the parameterised particle:
107  fastStep.KillPrimaryTrack();
108  fastStep.ProposePrimaryTrackPathLength(0.0);
110 
111  // split into "energy spots" energy according to the shower shape:
112  Explode(fastTrack);
113 
114  // and put those energy spots into the crystals:
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  //-----------------------------------------------------
123  // Non-physical shower generated: exp along z and
124  // transverse.
125  //-----------------------------------------------------
126 
127  // center of the shower, we put at the middle of the ghost:
128  G4ThreeVector showerCenter;
129  G4double distOut;
130  distOut = fastTrack.GetEnvelopeSolid()->
131  DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
132  fastTrack.GetPrimaryTrackLocalDirection());
133  showerCenter = fastTrack.GetPrimaryTrackLocalPosition() +
134  (distOut/2.)*fastTrack.GetPrimaryTrackLocalDirection();
135 
136  showerCenter = fastTrack.GetInverseAffineTransformation()->
137  TransformPoint(showerCenter);
138 
139  // axis of the shower, in global reference frame:
140  G4ThreeVector xShower, yShower, zShower;
141  zShower = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
142  xShower = zShower.orthogonal();
143  yShower = zShower.cross(xShower);
144 
145  // shoot the energy spots:
146  G4double Energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
147  G4int nSpot = 50;
148  G4double deposit = Energy/double(nSpot);
149  Par01EnergySpot eSpot;
150  eSpot.SetEnergy(deposit);
151  G4ThreeVector ePoint;
152 
153  // clear the spot list before use
154  feSpotList.clear();
155 
156  G4double z, r, phi;
157  for (int i = 0; i < nSpot; i++)
158  {
159  z = G4RandGauss::shoot(0,20*cm);
160  r = G4RandGauss::shoot(0,10*cm);
161  phi = G4UniformRand()*twopi;
162  ePoint = showerCenter +
163  z*zShower +
164  r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
165  eSpot.SetPosition(ePoint);
166  feSpotList.push_back(eSpot);
167  }
168 }
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171 
173 {
174  // Does the assignation of the energy spots to the sensitive volumes:
175  for (size_t i = 0; i < feSpotList.size(); i++)
176  {
177  // Draw the energy spot:
178  // G4Colour red(1.,0.,0.);
179  // feSpotList[i].Draw(&red);
180  // feSpotList[i].Print();
181 
182  // "converts" the energy spot into the fake
183  // G4Step to pass to sensitive detector:
185  }
186 }
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
189 
191 {
192  //
193  // "converts" the energy spot into the fake
194  // G4Step to pass to sensitive detector:
195  //
196  FillFakeStep(eSpot);
197 
198  //
199  // call sensitive part: taken/adapted from the stepping:
200  // Send G4Step information to Hit/Dig if the volume is sensitive
201  //
202  G4VPhysicalVolume* pCurrentVolume =
204  G4VSensitiveDetector* pSensitive;
205 
206  if( pCurrentVolume != 0 )
207  {
208  pSensitive = pCurrentVolume->GetLogicalVolume()->
209  GetSensitiveDetector();
210  if( pSensitive != 0 )
211  {
212  pSensitive->Hit(fFakeStep);
213  }
214  }
215 }
216 
217 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
218 
220 {
221  //-----------------------------------------------------------
222  // find in which volume the spot is.
223  //-----------------------------------------------------------
224  if (!fNaviSetup)
225  {
226  fpNavigator->
228  GetNavigatorForTracking()->GetWorldVolume());
229  fpNavigator->
230  LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
231  G4ThreeVector(0.,0.,0.),
233  false);
234  fNaviSetup = true;
235  }
236  else
237  {
238  fpNavigator->
239  LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
240  G4ThreeVector(0.,0.,0.),
242  }
243  //--------------------------------------
244  // Fills attribute of the G4Step needed
245  // by our sensitive detector:
246  //-------------------------------------
247  // set touchable volume at PreStepPoint:
249  // set total energy deposit:
251 }
void ProposePrimaryTrackPathLength(G4double)
G4double GetKineticEnergy() const
G4bool Hit(G4Step *aStep)
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GetPosition() const
G4LogicalVolume * GetLogicalVolume() const
G4VSolid * GetEnvelopeSolid() const
Definition: G4FastTrack.hh:203
G4StepPoint * GetPreStepPoint() const
Definition of the Par01EnergySpot class.
Double_t z
void SetTotalEnergyDeposit(G4double value)
void SetEnergy(const G4double &E)
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
virtual G4bool IsApplicable(const G4ParticleDefinition &)
G4VPhysicalVolume * GetPhysicalVolume() const
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
G4ThreeVector GetPrimaryTrackLocalPosition() const
Definition: G4FastTrack.hh:213
std::vector< Par01EnergySpot > feSpotList
G4TouchableHandle fTouchableHandle
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4ThreeVector GetPrimaryTrackLocalDirection() const
Definition: G4FastTrack.hh:223
void AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
#define G4UniformRand()
Definition: Randomize.hh:53
static constexpr double twopi
Definition: G4SIunits.hh:76
G4StepPoint * fFakePostStepPoint
Definition: G4Step.hh:76
Par01PionShowerModel(G4String, G4Region *)
G4StepPoint * GetPostStepPoint() const
void KillPrimaryTrack()
Definition: G4FastStep.cc:88
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
Definition of the Par01PionShowerModel class.
ThreeVector shoot(const G4int Ap, const G4int Af)
Hep3Vector cross(const Hep3Vector &) const
G4double GetEnergy() const
static G4TransportationManager * GetTransportationManager()
virtual G4bool ModelTrigger(const G4FastTrack &)
const G4AffineTransform * GetInverseAffineTransformation() const
Definition: G4FastTrack.hh:238
int G4int
Definition: G4Types.hh:78
void FillFakeStep(const Par01EnergySpot &eSpot)
static constexpr double cm
Definition: G4SIunits.hh:119
Hep3Vector orthogonal() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4ThreeVector & GetMomentumDirection() const
void ProposeTotalEnergyDeposited(G4double anEnergyPart)
virtual void DoIt(const G4FastTrack &, G4FastStep &)
void Explode(const G4FastTrack &)
void SetPosition(const G4ThreeVector &point)