CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DummyChargeFlipProcess Class Reference

#include <DummyChargeFlipProcess.h>

Inheritance diagram for DummyChargeFlipProcess:

Public Member Functions

 DummyChargeFlipProcess (const G4String &processName="Dummy")
 
G4bool IsApplicable (const G4ParticleDefinition &aParticleType) override
 
G4VParticleChange * PostStepDoIt (const G4Track &aTrack, const G4Step &aStep) override
 
 ~DummyChargeFlipProcess () override
 

Private Attributes

G4ParticleChange * fPartChange
 

Detailed Description

Definition at line 8 of file DummyChargeFlipProcess.h.

Constructor & Destructor Documentation

◆ DummyChargeFlipProcess()

DummyChargeFlipProcess::DummyChargeFlipProcess ( const G4String &  processName = "Dummy")

Definition at line 13 of file DummyChargeFlipProcess.cc.

13  : G4HadronicProcess(pname, fHadronic) {
14  AddDataSet(new G4NeutronElasticXS());
15  fPartChange = new G4ParticleChange();
16 }

References fPartChange.

◆ ~DummyChargeFlipProcess()

DummyChargeFlipProcess::~DummyChargeFlipProcess ( )
override

Definition at line 18 of file DummyChargeFlipProcess.cc.

18 { delete fPartChange; }

References fPartChange.

Member Function Documentation

◆ IsApplicable()

G4bool DummyChargeFlipProcess::IsApplicable ( const G4ParticleDefinition &  aParticleType)
override

Definition at line 20 of file DummyChargeFlipProcess.cc.

20  {
21  return (aParticleType.GetParticleType() == "rhadron");
22 }

◆ PostStepDoIt()

G4VParticleChange * DummyChargeFlipProcess::PostStepDoIt ( const G4Track &  aTrack,
const G4Step &  aStep 
)
override

Definition at line 24 of file DummyChargeFlipProcess.cc.

24  {
25  fPartChange->Initialize(aTrack);
26  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
27 
28  G4double ParentEnergy = aParticle->GetTotalEnergy();
29  const G4ThreeVector& ParentDirection(aParticle->GetMomentumDirection());
30 
31  G4double energyDeposit = 0.0;
32  G4double finalGlobalTime = aTrack.GetGlobalTime();
33 
34  G4int numberOfSecondaries = 1;
35  fPartChange->SetNumberOfSecondaries(numberOfSecondaries);
36  const G4TouchableHandle& thand = aTrack.GetTouchableHandle();
37 
38  // get current position of the track
39  aTrack.GetPosition();
40  // create a new track object
41  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
42  float randomParticle = G4UniformRand();
43  G4ParticleDefinition* newType;
44  if (randomParticle < 0.333)
45  newType = particleTable->FindParticle(1009213);
46  else if (randomParticle > 0.667)
47  newType = particleTable->FindParticle(-1009213);
48  else
49  newType = particleTable->FindParticle(1009113);
50 
51  //G4cout << "RHADRON: New charge = " << newType->GetPDGCharge() << G4endl;
52 
53  G4DynamicParticle* newP = new G4DynamicParticle(newType, ParentDirection, ParentEnergy);
54  G4Track* secondary = new G4Track(newP, finalGlobalTime, aTrack.GetPosition());
55  // switch on good for tracking flag
56  secondary->SetGoodForTrackingFlag();
57  secondary->SetTouchableHandle(thand);
58  // add the secondary track in the List
59  fPartChange->AddSecondary(secondary);
60 
61  // Kill the parent particle
62  fPartChange->ProposeTrackStatus(fStopAndKill);
63  fPartChange->ProposeLocalEnergyDeposit(energyDeposit);
64  fPartChange->ProposeGlobalTime(finalGlobalTime);
65 
66  ClearNumberOfInteractionLengthLeft();
67 
68  return fPartChange;
69 }

References fPartChange.

Member Data Documentation

◆ fPartChange

G4ParticleChange* DummyChargeFlipProcess::fPartChange
private
unpackData-CaloStage2.pname
pname
Definition: unpackData-CaloStage2.py:76
DummyChargeFlipProcess::fPartChange
G4ParticleChange * fPartChange
Definition: DummyChargeFlipProcess.h:19