CMS 3D CMS Logo

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

#include <DummyChargeFlipProcess.h>

Inheritance diagram for DummyChargeFlipProcess:

Public Member Functions

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

Private Member Functions

G4double GetMicroscopicCrossSection (const G4DynamicParticle *aParticle, const G4Element *anElement, G4double aTemp)
 

Detailed Description

Definition at line 18 of file DummyChargeFlipProcess.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file DummyChargeFlipProcess.cc.

10  :
11  G4HadronicProcess(processName)
12 {
13  AddDataSet(new G4HadronElasticDataSet);
14 }
DummyChargeFlipProcess::~DummyChargeFlipProcess ( )

Definition at line 16 of file DummyChargeFlipProcess.cc.

References BuildPhysicsTable().

17 {
18 }

Member Function Documentation

void DummyChargeFlipProcess::BuildPhysicsTable ( const G4ParticleDefinition &  aParticleType)

Definition at line 22 of file DummyChargeFlipProcess.cc.

References GetMicroscopicCrossSection().

Referenced by ~DummyChargeFlipProcess().

23 {
24  if (!G4HadronicProcess::GetCrossSectionDataStore()) {
25  return;
26  }
27  G4HadronicProcess::GetCrossSectionDataStore()->BuildPhysicsTable(aParticleType);
28 }
void DummyChargeFlipProcess::DumpPhysicsTable ( const G4ParticleDefinition &  aParticleType)

Definition at line 53 of file DummyChargeFlipProcess.cc.

Referenced by IsApplicable().

54 {
55 
56 }
G4double DummyChargeFlipProcess::GetMicroscopicCrossSection ( const G4DynamicParticle *  aParticle,
const G4Element *  anElement,
G4double  aTemp 
)
private

Definition at line 32 of file DummyChargeFlipProcess.cc.

References IsApplicable().

Referenced by BuildPhysicsTable().

34 {
35 
36  return 30*millibarn*element->GetN();
37 }
G4bool DummyChargeFlipProcess::IsApplicable ( const G4ParticleDefinition &  aParticleType)

Definition at line 42 of file DummyChargeFlipProcess.cc.

References DumpPhysicsTable().

Referenced by GetMicroscopicCrossSection().

43 {
44  if(aParticleType.GetParticleType() == "rhadron")
45  return true;
46  else
47  return false;
48 }
G4VParticleChange * DummyChargeFlipProcess::PostStepDoIt ( const G4Track &  aTrack,
const G4Step &  aStep 
)

Definition at line 59 of file DummyChargeFlipProcess.cc.

References ecalTB2006H4_GenSimDigiReco_cfg::G4cout.

61 {
62  G4ParticleChange * pc = new G4ParticleChange();
63  pc->Initialize(aTrack);
64  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
65  //G4ParticleDefinition* aParticleDef = aParticle->GetDefinition();
66 
67  G4double ParentEnergy = aParticle->GetTotalEnergy();
68  G4ThreeVector ParentDirection(aParticle->GetMomentumDirection());
69 
70  G4double energyDeposit = 0.0;
71  G4double finalGlobalTime = aTrack.GetGlobalTime();
72 
73  G4int numberOfSecondaries = 1;
74  pc->SetNumberOfSecondaries(numberOfSecondaries);
75  const G4TouchableHandle thand = aTrack.GetTouchableHandle();
76 
77  // get current position of the track
78  aTrack.GetPosition();
79  // create a new track object
80  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
81  float randomParticle = G4UniformRand();
82  G4ParticleDefinition * newType;
83  if(randomParticle < 0.333)
84  newType=particleTable->FindParticle(1009213);
85  else if(randomParticle > 0.667)
86  newType=particleTable->FindParticle(-1009213);
87  else
88  newType=particleTable->FindParticle(1009113);
89 
90  G4cout << "RHADRON: New charge = " << newType->GetPDGCharge() << G4endl;
91 
92  G4DynamicParticle * newP = new G4DynamicParticle(newType,ParentDirection,ParentEnergy);
93  G4Track* secondary = new G4Track( newP ,
94  finalGlobalTime ,
95  aTrack.GetPosition()
96  );
97  // switch on good for tracking flag
98  secondary->SetGoodForTrackingFlag();
99  secondary->SetTouchableHandle(thand);
100  // add the secondary track in the List
101  pc->AddSecondary(secondary);
102 
103  // Kill the parent particle
104  pc->ProposeTrackStatus( fStopAndKill ) ;
105  pc->ProposeLocalEnergyDeposit(energyDeposit);
106  pc->ProposeGlobalTime( finalGlobalTime );
107  // Clear NumberOfInteractionLengthLeft
108  ClearNumberOfInteractionLengthLeft();
109 
110  return pc;
111 }