Geant4  10.02.p03
Par01PionShowerModel Class Reference

#include <Par01PionShowerModel.hh>

Inheritance diagram for Par01PionShowerModel:
Collaboration diagram for Par01PionShowerModel:

Public Member Functions

 Par01PionShowerModel (G4String, G4Region *)
 
 Par01PionShowerModel (G4String)
 
 ~Par01PionShowerModel ()
 
virtual G4bool IsApplicable (const G4ParticleDefinition &)
 
virtual G4bool ModelTrigger (const G4FastTrack &)
 
virtual void DoIt (const G4FastTrack &, G4FastStep &)
 
- Public Member Functions inherited from G4VFastSimulationModel
 G4VFastSimulationModel (const G4String &aName)
 
 G4VFastSimulationModel (const G4String &aName, G4Envelope *, G4bool IsUnique=FALSE)
 
virtual ~G4VFastSimulationModel ()
 
virtual G4bool AtRestModelTrigger (const G4FastTrack &)
 
virtual void AtRestDoIt (const G4FastTrack &, G4FastStep &)
 
const G4String GetName () const
 
G4bool operator== (const G4VFastSimulationModel &) const
 

Private Member Functions

void AssignSpotAndCallHit (const Par01EnergySpot &eSpot)
 
void FillFakeStep (const Par01EnergySpot &eSpot)
 
void Explode (const G4FastTrack &)
 
void BuildDetectorResponse ()
 

Private Attributes

G4Step * fFakeStep
 
G4StepPoint * fFakePreStepPoint
 
G4StepPoint * fFakePostStepPoint
 
G4TouchableHandle fTouchableHandle
 
G4NavigatorfpNavigator
 
G4bool fNaviSetup
 
std::vector< Par01EnergySpotfeSpotList
 

Detailed Description

Definition at line 43 of file Par01PionShowerModel.hh.

Constructor & Destructor Documentation

◆ Par01PionShowerModel() [1/2]

Par01PionShowerModel::Par01PionShowerModel ( G4String  modelName,
G4Region envelope 
)

Definition at line 44 of file Par01PionShowerModel.cc.

45 : G4VFastSimulationModel(modelName, envelope)
46 {
47  fFakeStep = new G4Step();
48  fFakePreStepPoint = fFakeStep->GetPreStepPoint();
49  fFakePostStepPoint = fFakeStep->GetPostStepPoint();
51  fpNavigator = new G4Navigator();
52  fNaviSetup = false;
53 }
G4TouchableHandle fTouchableHandle
G4StepPoint * fFakePostStepPoint
G4VFastSimulationModel(const G4String &aName)

◆ Par01PionShowerModel() [2/2]

Par01PionShowerModel::Par01PionShowerModel ( G4String  modelName)

Definition at line 55 of file Par01PionShowerModel.cc.

56 : G4VFastSimulationModel(modelName)
57 {
58  fFakeStep = new G4Step();
59  fFakePreStepPoint = fFakeStep->GetPreStepPoint();
60  fFakePostStepPoint = fFakeStep->GetPostStepPoint();
62  fpNavigator = new G4Navigator();
63  fNaviSetup = false;
64 }
G4TouchableHandle fTouchableHandle
G4StepPoint * fFakePostStepPoint
G4VFastSimulationModel(const G4String &aName)

◆ ~Par01PionShowerModel()

Par01PionShowerModel::~Par01PionShowerModel ( )

Definition at line 66 of file Par01PionShowerModel.cc.

67 {
68  delete fFakeStep;
69  delete fpNavigator;
70 }

Member Function Documentation

◆ AssignSpotAndCallHit()

void Par01PionShowerModel::AssignSpotAndCallHit ( const Par01EnergySpot eSpot)
private

Definition at line 171 of file Par01PionShowerModel.cc.

172 {
173  //
174  // "converts" the energy spot into the fake
175  // G4Step to pass to sensitive detector:
176  //
177  FillFakeStep(eSpot);
178 
179  //
180  // call sensitive part: taken/adapted from the stepping:
181  // Send G4Step information to Hit/Dig if the volume is sensitive
182  //
183  G4VPhysicalVolume* pCurrentVolume =
184  fFakeStep->GetPreStepPoint()->GetPhysicalVolume();
185  G4VSensitiveDetector* pSensitive;
186 
187  if( pCurrentVolume != 0 )
188  {
189  pSensitive = pCurrentVolume->GetLogicalVolume()->
190  GetSensitiveDetector();
191  if( pSensitive != 0 )
192  {
193  pSensitive->Hit(fFakeStep);
194  }
195  }
196 }
void FillFakeStep(const Par01EnergySpot &eSpot)
G4bool Hit(G4Step *aStep)
G4LogicalVolume * GetLogicalVolume() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildDetectorResponse()

void Par01PionShowerModel::BuildDetectorResponse ( )
private

Definition at line 154 of file Par01PionShowerModel.cc.

155 {
156  // Does the assignation of the energy spots to the sensitive volumes:
157  for (size_t i = 0; i < feSpotList.size(); i++)
158  {
159  // Draw the energy spot:
160  G4Colour red(1.,0.,0.);
161  feSpotList[i].Draw(&red);
162  // feSpotList[i].Print();
163 
164  // "converts" the energy spot into the fake
165  // G4Step to pass to sensitive detector:
167  }
168 }
std::vector< Par01EnergySpot > feSpotList
Definition: test07.cc:36
void AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoIt()

void Par01PionShowerModel::DoIt ( const G4FastTrack fastTrack,
G4FastStep fastStep 
)
virtual

Implements G4VFastSimulationModel.

Definition at line 86 of file Par01PionShowerModel.cc.

88 {
89  // G4cout << "Par01PionShowerModel::DoIt" << G4endl;
90 
91  // Kill the parameterised particle:
92  fastStep.KillPrimaryTrack();
93  fastStep.ProposePrimaryTrackPathLength(0.0);
94  fastStep.ProposeTotalEnergyDeposited(fastTrack.GetPrimaryTrack()->GetKineticEnergy());
95 
96  // split into "energy spots" energy according to the shower shape:
97  Explode(fastTrack);
98 
99  // and put those energy spots into the crystals:
101 }
void Explode(const G4FastTrack &)
void ProposePrimaryTrackPathLength(G4double)
void ProposeTotalEnergyDeposited(G4double anEnergyPart)
void KillPrimaryTrack()
Definition: G4FastStep.cc:87
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
Here is the call graph for this function:

◆ Explode()

void Par01PionShowerModel::Explode ( const G4FastTrack fastTrack)
private

Definition at line 103 of file Par01PionShowerModel.cc.

104 {
105  //-----------------------------------------------------
106  // Non-physical shower generated: exp along z and
107  // transverse.
108  //-----------------------------------------------------
109 
110  // center of the shower, we put at the middle of the ghost:
111  G4ThreeVector showerCenter;
112  G4double distOut;
113  distOut = fastTrack.GetEnvelopeSolid()->
114  DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
115  fastTrack.GetPrimaryTrackLocalDirection());
116  showerCenter = fastTrack.GetPrimaryTrackLocalPosition() +
117  (distOut/2.)*fastTrack.GetPrimaryTrackLocalDirection();
118 
119  showerCenter = fastTrack.GetInverseAffineTransformation()->
120  TransformPoint(showerCenter);
121 
122  // axis of the shower, in global reference frame:
123  G4ThreeVector xShower, yShower, zShower;
124  zShower = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
125  xShower = zShower.orthogonal();
126  yShower = zShower.cross(xShower);
127 
128  // shoot the energy spots:
129  G4double Energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
130  G4int nSpot = 50;
131  G4double deposit = Energy/double(nSpot);
132  Par01EnergySpot eSpot;
133  eSpot.SetEnergy(deposit);
134  G4ThreeVector ePoint;
135 
136  // clear the spot list before use
137  feSpotList.clear();
138 
139  G4double z, r, phi;
140  for (int i = 0; i < nSpot; i++)
141  {
142  z = G4RandGauss::shoot(0,20*cm);
143  r = G4RandGauss::shoot(0,10*cm);
144  phi = G4UniformRand()*twopi;
145  ePoint = showerCenter +
146  z*zShower +
147  r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
148  eSpot.SetPosition(ePoint);
149  feSpotList.push_back(eSpot);
150  }
151 }
void SetPosition(const G4ThreeVector &point)
static const double cm
Definition: G4SIunits.hh:118
ThreeVector shoot(const G4int Ap, const G4int Af)
std::vector< Par01EnergySpot > feSpotList
const G4AffineTransform * GetInverseAffineTransformation() const
Definition: G4FastTrack.hh:238
G4VSolid * GetEnvelopeSolid() const
Definition: G4FastTrack.hh:203
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
Hep3Vector cross(const Hep3Vector &) const
G4ThreeVector GetPrimaryTrackLocalDirection() const
Definition: G4FastTrack.hh:223
static const double twopi
Definition: G4SIunits.hh:75
Hep3Vector orthogonal() const
void SetEnergy(const G4double &E)
G4ThreeVector GetPrimaryTrackLocalPosition() const
Definition: G4FastTrack.hh:213
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:208
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FillFakeStep()

void Par01PionShowerModel::FillFakeStep ( const Par01EnergySpot eSpot)
private

Definition at line 199 of file Par01PionShowerModel.cc.

200 {
201  //-----------------------------------------------------------
202  // find in which volume the spot is.
203  //-----------------------------------------------------------
204  if (!fNaviSetup)
205  {
206  fpNavigator->
208  GetNavigatorForTracking()->GetWorldVolume());
209  fpNavigator->
210  LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
211  G4ThreeVector(0.,0.,0.),
213  false);
214  fNaviSetup = true;
215  }
216  else
217  {
218  fpNavigator->
219  LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
220  G4ThreeVector(0.,0.,0.),
222  }
223  //--------------------------------------
224  // Fills attribute of the G4Step needed
225  // by our sensitive detector:
226  //-------------------------------------
227  // set touchable volume at PreStepPoint:
228  fFakePreStepPoint->SetTouchableHandle(fTouchableHandle);
229  // set total energy deposit:
230  fFakeStep->SetTotalEnergyDeposit(eSpot.GetEnergy());
231 }
G4TouchableHandle fTouchableHandle
CLHEP::Hep3Vector G4ThreeVector
static G4TransportationManager * GetTransportationManager()
G4ThreeVector GetPosition() const
G4double GetEnergy() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsApplicable()

G4bool Par01PionShowerModel::IsApplicable ( const G4ParticleDefinition particleType)
virtual

Implements G4VFastSimulationModel.

Definition at line 72 of file Par01PionShowerModel.cc.

73 {
74  return
75  &particleType == G4PionMinus::PionMinusDefinition() ||
76  &particleType == G4PionPlus::PionPlusDefinition();
77 }
static G4PionMinus * PionMinusDefinition()
Definition: G4PionMinus.cc:93
static G4PionPlus * PionPlusDefinition()
Definition: G4PionPlus.cc:93
Here is the call graph for this function:

◆ ModelTrigger()

G4bool Par01PionShowerModel::ModelTrigger ( const G4FastTrack )
virtual

Implements G4VFastSimulationModel.

Definition at line 79 of file Par01PionShowerModel.cc.

80 {
81  // Applies the parameterisation always:
82  // ie as soon as the pion enters the envelope
83  return true;
84 }

Member Data Documentation

◆ feSpotList

std::vector<Par01EnergySpot> Par01PionShowerModel::feSpotList
private

Definition at line 78 of file Par01PionShowerModel.hh.

◆ fFakePostStepPoint

G4StepPoint * Par01PionShowerModel::fFakePostStepPoint
private

Definition at line 73 of file Par01PionShowerModel.hh.

◆ fFakePreStepPoint

G4StepPoint* Par01PionShowerModel::fFakePreStepPoint
private

Definition at line 73 of file Par01PionShowerModel.hh.

◆ fFakeStep

G4Step* Par01PionShowerModel::fFakeStep
private

Definition at line 72 of file Par01PionShowerModel.hh.

◆ fNaviSetup

G4bool Par01PionShowerModel::fNaviSetup
private

Definition at line 76 of file Par01PionShowerModel.hh.

◆ fpNavigator

G4Navigator* Par01PionShowerModel::fpNavigator
private

Definition at line 75 of file Par01PionShowerModel.hh.

◆ fTouchableHandle

G4TouchableHandle Par01PionShowerModel::fTouchableHandle
private

Definition at line 74 of file Par01PionShowerModel.hh.


The documentation for this class was generated from the following files: